Commit b744c679f62b368cb94c21c1dcd4618e42d88d63

Authored by Dmitry Kasatkin
Committed by Herbert Xu
1 parent 57a2ce5f54

crypto: updates to enable omap aes

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Showing 4 changed files with 74 additions and 3 deletions Side-by-side Diff

arch/arm/mach-omap2/clock2420_data.c
... ... @@ -1838,7 +1838,7 @@
1838 1838 CLK(NULL, "des_ick", &des_ick, CK_242X),
1839 1839 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1840 1840 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1841   - CLK(NULL, "aes_ick", &aes_ick, CK_242X),
  1841 + CLK("omap-aes", "ick", &aes_ick, CK_242X),
1842 1842 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1843 1843 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1844 1844 CLK("musb_hdrc", "fck", &osc_ck, CK_242X),
arch/arm/mach-omap2/clock2430_data.c
... ... @@ -1926,7 +1926,7 @@
1926 1926 CLK(NULL, "des_ick", &des_ick, CK_243X),
1927 1927 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1928 1928 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1929   - CLK(NULL, "aes_ick", &aes_ick, CK_243X),
  1929 + CLK("omap-aes", "ick", &aes_ick, CK_243X),
1930 1930 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1931 1931 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
1932 1932 CLK("musb_hdrc", "ick", &usbhs_ick, CK_243X),
arch/arm/mach-omap2/clock3xxx_data.c
... ... @@ -3288,7 +3288,7 @@
3288 3288 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2 | CK_AM35XX),
3289 3289 CLK("mmci-omap-hs.2", "ick", &mmchs3_ick, CK_3430ES2 | CK_AM35XX),
3290 3290 CLK(NULL, "icr_ick", &icr_ick, CK_343X),
3291   - CLK(NULL, "aes2_ick", &aes2_ick, CK_343X),
  3291 + CLK("omap-aes", "ick", &aes2_ick, CK_343X),
3292 3292 CLK("omap-sham", "ick", &sha12_ick, CK_343X),
3293 3293 CLK(NULL, "des2_ick", &des2_ick, CK_343X),
3294 3294 CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_3XXX),
arch/arm/mach-omap2/devices.c
... ... @@ -552,6 +552,76 @@
552 552 static inline void omap_init_sham(void) { }
553 553 #endif
554 554  
  555 +#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
  556 +
  557 +#ifdef CONFIG_ARCH_OMAP24XX
  558 +static struct resource omap2_aes_resources[] = {
  559 + {
  560 + .start = OMAP24XX_SEC_AES_BASE,
  561 + .end = OMAP24XX_SEC_AES_BASE + 0x4C,
  562 + .flags = IORESOURCE_MEM,
  563 + },
  564 + {
  565 + .start = OMAP24XX_DMA_AES_TX,
  566 + .flags = IORESOURCE_DMA,
  567 + },
  568 + {
  569 + .start = OMAP24XX_DMA_AES_RX,
  570 + .flags = IORESOURCE_DMA,
  571 + }
  572 +};
  573 +static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
  574 +#else
  575 +#define omap2_aes_resources NULL
  576 +#define omap2_aes_resources_sz 0
  577 +#endif
  578 +
  579 +#ifdef CONFIG_ARCH_OMAP34XX
  580 +static struct resource omap3_aes_resources[] = {
  581 + {
  582 + .start = OMAP34XX_SEC_AES_BASE,
  583 + .end = OMAP34XX_SEC_AES_BASE + 0x4C,
  584 + .flags = IORESOURCE_MEM,
  585 + },
  586 + {
  587 + .start = OMAP34XX_DMA_AES2_TX,
  588 + .flags = IORESOURCE_DMA,
  589 + },
  590 + {
  591 + .start = OMAP34XX_DMA_AES2_RX,
  592 + .flags = IORESOURCE_DMA,
  593 + }
  594 +};
  595 +static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
  596 +#else
  597 +#define omap3_aes_resources NULL
  598 +#define omap3_aes_resources_sz 0
  599 +#endif
  600 +
  601 +static struct platform_device aes_device = {
  602 + .name = "omap-aes",
  603 + .id = -1,
  604 +};
  605 +
  606 +static void omap_init_aes(void)
  607 +{
  608 + if (cpu_is_omap24xx()) {
  609 + aes_device.resource = omap2_aes_resources;
  610 + aes_device.num_resources = omap2_aes_resources_sz;
  611 + } else if (cpu_is_omap34xx()) {
  612 + aes_device.resource = omap3_aes_resources;
  613 + aes_device.num_resources = omap3_aes_resources_sz;
  614 + } else {
  615 + pr_err("%s: platform not supported\n", __func__);
  616 + return;
  617 + }
  618 + platform_device_register(&aes_device);
  619 +}
  620 +
  621 +#else
  622 +static inline void omap_init_aes(void) { }
  623 +#endif
  624 +
555 625 /*-------------------------------------------------------------------------*/
556 626  
557 627 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
... ... @@ -908,6 +978,7 @@
908 978 omap_hdq_init();
909 979 omap_init_sti();
910 980 omap_init_sham();
  981 + omap_init_aes();
911 982 omap_init_vout();
912 983  
913 984 return 0;