aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2013-04-01 13:07:28 -0400
committerTony Lindgren <tony@atomide.com>2013-04-01 13:07:28 -0400
commitf13acab6594451da8b5bd39db0c0513aba592a8d (patch)
tree04470ee35b3583477ba51ee6cddd24a6fc95f2d8
parent78e52e026d288aad88b46bff0d94b05e145c4583 (diff)
parent1cb804b93f506dfba5fd684a8ea63706aaa8e709 (diff)
Merge tag 'omap-devel-a-for-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into omap-for-v3.10/crypto
For OMAP2+ SoCs, convert the SHA/MD5 and AES accelerator integration code and data to use hwmod and omap_device. This is a prerequisite for moving the hwmod code out of arch/arm. Basic test logs are available at: http://www.pwsan.com/omap/testlogs/sham_aes_integration_devel_3.10/20130330155313/
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c4
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c10
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c2
-rw-r--r--arch/arm/mach-omap2/devices.c149
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2420_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2430_data.c2
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c36
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c81
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_33xx_data.c92
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_3xxx_data.c172
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_common_data.h4
11 files changed, 401 insertions, 153 deletions
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
index bda353b2f7d9..5e4b037bb24c 100644
--- a/arch/arm/mach-omap2/cclock2430_data.c
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -1978,9 +1978,11 @@ static struct omap_clk omap2430_clks[] = {
1978 CLK(NULL, "sdrc_ick", &sdrc_ick), 1978 CLK(NULL, "sdrc_ick", &sdrc_ick),
1979 CLK(NULL, "des_ick", &des_ick), 1979 CLK(NULL, "des_ick", &des_ick),
1980 CLK("omap-sham", "ick", &sha_ick), 1980 CLK("omap-sham", "ick", &sha_ick),
1981 CLK("omap_rng", "ick", &rng_ick), 1981 CLK(NULL, "sha_ick", &sha_ick),
1982 CLK("omap_rng", "ick", &rng_ick),
1982 CLK(NULL, "rng_ick", &rng_ick), 1983 CLK(NULL, "rng_ick", &rng_ick),
1983 CLK("omap-aes", "ick", &aes_ick), 1984 CLK("omap-aes", "ick", &aes_ick),
1985 CLK(NULL, "aes_ick", &aes_ick),
1984 CLK(NULL, "pka_ick", &pka_ick), 1986 CLK(NULL, "pka_ick", &pka_ick),
1985 CLK(NULL, "usb_fck", &usb_fck), 1987 CLK(NULL, "usb_fck", &usb_fck),
1986 CLK("musb-omap2430", "ick", &usbhs_ick), 1988 CLK("musb-omap2430", "ick", &usbhs_ick),
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
index dcc5bf57a263..c8dcc523c31a 100644
--- a/arch/arm/mach-omap2/cclock33xx_data.c
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -413,6 +413,14 @@ static struct clk smartreflex1_fck;
413DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL); 413DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
414DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null); 414DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
415 415
416static struct clk sha0_fck;
417DEFINE_STRUCT_CLK_HW_OMAP(sha0_fck, NULL);
418DEFINE_STRUCT_CLK(sha0_fck, dpll_core_ck_parents, clk_ops_null);
419
420static struct clk aes0_fck;
421DEFINE_STRUCT_CLK_HW_OMAP(aes0_fck, NULL);
422DEFINE_STRUCT_CLK(aes0_fck, dpll_core_ck_parents, clk_ops_null);
423
416/* 424/*
417 * Modules clock nodes 425 * Modules clock nodes
418 * 426 *
@@ -878,6 +886,8 @@ static struct omap_clk am33xx_clks[] = {
878 CLK(NULL, "mmu_fck", &mmu_fck), 886 CLK(NULL, "mmu_fck", &mmu_fck),
879 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck), 887 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck),
880 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck), 888 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck),
889 CLK(NULL, "sha0_fck", &sha0_fck),
890 CLK(NULL, "aes0_fck", &aes0_fck),
881 CLK(NULL, "timer1_fck", &timer1_fck), 891 CLK(NULL, "timer1_fck", &timer1_fck),
882 CLK(NULL, "timer2_fck", &timer2_fck), 892 CLK(NULL, "timer2_fck", &timer2_fck),
883 CLK(NULL, "timer3_fck", &timer3_fck), 893 CLK(NULL, "timer3_fck", &timer3_fck),
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
index 438d13341e23..45cd26430d1f 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -3471,8 +3471,10 @@ static struct omap_clk omap3xxx_clks[] = {
3471 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck), 3471 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck),
3472 CLK(NULL, "init_60m_fclk", &dummy_ck), 3472 CLK(NULL, "init_60m_fclk", &dummy_ck),
3473 CLK(NULL, "gpt1_fck", &gpt1_fck), 3473 CLK(NULL, "gpt1_fck", &gpt1_fck),
3474 CLK(NULL, "aes2_ick", &aes2_ick),
3474 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck), 3475 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck),
3475 CLK(NULL, "gpio1_dbck", &gpio1_dbck), 3476 CLK(NULL, "gpio1_dbck", &gpio1_dbck),
3477 CLK(NULL, "sha12_ick", &sha12_ick),
3476 CLK(NULL, "wdt2_fck", &wdt2_fck), 3478 CLK(NULL, "wdt2_fck", &wdt2_fck),
3477 CLK("omap_wdt", "ick", &wdt2_ick), 3479 CLK("omap_wdt", "ick", &wdt2_ick),
3478 CLK(NULL, "wdt2_ick", &wdt2_ick), 3480 CLK(NULL, "wdt2_ick", &wdt2_ick),
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1ec7f0597710..4269fc145698 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -504,140 +504,31 @@ static void omap_init_rng(void)
504 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n"); 504 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
505} 505}
506 506
507#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE) 507static void __init omap_init_sham(void)
508
509#ifdef CONFIG_ARCH_OMAP2
510static struct resource omap2_sham_resources[] = {
511 {
512 .start = OMAP24XX_SEC_SHA1MD5_BASE,
513 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
514 .flags = IORESOURCE_MEM,
515 },
516 {
517 .start = 51 + OMAP_INTC_START,
518 .flags = IORESOURCE_IRQ,
519 }
520};
521static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
522#else
523#define omap2_sham_resources NULL
524#define omap2_sham_resources_sz 0
525#endif
526
527#ifdef CONFIG_ARCH_OMAP3
528static struct resource omap3_sham_resources[] = {
529 {
530 .start = OMAP34XX_SEC_SHA1MD5_BASE,
531 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
532 .flags = IORESOURCE_MEM,
533 },
534 {
535 .start = 49 + OMAP_INTC_START,
536 .flags = IORESOURCE_IRQ,
537 },
538 {
539 .start = OMAP34XX_DMA_SHA1MD5_RX,
540 .flags = IORESOURCE_DMA,
541 }
542};
543static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
544#else
545#define omap3_sham_resources NULL
546#define omap3_sham_resources_sz 0
547#endif
548
549static struct platform_device sham_device = {
550 .name = "omap-sham",
551 .id = -1,
552};
553
554static void omap_init_sham(void)
555{ 508{
556 if (cpu_is_omap24xx()) { 509 struct omap_hwmod *oh;
557 sham_device.resource = omap2_sham_resources; 510 struct platform_device *pdev;
558 sham_device.num_resources = omap2_sham_resources_sz;
559 } else if (cpu_is_omap34xx()) {
560 sham_device.resource = omap3_sham_resources;
561 sham_device.num_resources = omap3_sham_resources_sz;
562 } else {
563 pr_err("%s: platform not supported\n", __func__);
564 return;
565 }
566 platform_device_register(&sham_device);
567}
568#else
569static inline void omap_init_sham(void) { }
570#endif
571
572#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
573
574#ifdef CONFIG_ARCH_OMAP2
575static struct resource omap2_aes_resources[] = {
576 {
577 .start = OMAP24XX_SEC_AES_BASE,
578 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
579 .flags = IORESOURCE_MEM,
580 },
581 {
582 .start = OMAP24XX_DMA_AES_TX,
583 .flags = IORESOURCE_DMA,
584 },
585 {
586 .start = OMAP24XX_DMA_AES_RX,
587 .flags = IORESOURCE_DMA,
588 }
589};
590static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
591#else
592#define omap2_aes_resources NULL
593#define omap2_aes_resources_sz 0
594#endif
595 511
596#ifdef CONFIG_ARCH_OMAP3 512 oh = omap_hwmod_lookup("sham");
597static struct resource omap3_aes_resources[] = { 513 if (!oh)
598 { 514 return;
599 .start = OMAP34XX_SEC_AES_BASE,
600 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
601 .flags = IORESOURCE_MEM,
602 },
603 {
604 .start = OMAP34XX_DMA_AES2_TX,
605 .flags = IORESOURCE_DMA,
606 },
607 {
608 .start = OMAP34XX_DMA_AES2_RX,
609 .flags = IORESOURCE_DMA,
610 }
611};
612static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
613#else
614#define omap3_aes_resources NULL
615#define omap3_aes_resources_sz 0
616#endif
617 515
618static struct platform_device aes_device = { 516 pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
619 .name = "omap-aes", 517 WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
620 .id = -1, 518}
621};
622 519
623static void omap_init_aes(void) 520static void __init omap_init_aes(void)
624{ 521{
625 if (cpu_is_omap24xx()) { 522 struct omap_hwmod *oh;
626 aes_device.resource = omap2_aes_resources; 523 struct platform_device *pdev;
627 aes_device.num_resources = omap2_aes_resources_sz; 524
628 } else if (cpu_is_omap34xx()) { 525 oh = omap_hwmod_lookup("aes");
629 aes_device.resource = omap3_aes_resources; 526 if (!oh)
630 aes_device.num_resources = omap3_aes_resources_sz;
631 } else {
632 pr_err("%s: platform not supported\n", __func__);
633 return; 527 return;
634 }
635 platform_device_register(&aes_device);
636}
637 528
638#else 529 pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
639static inline void omap_init_aes(void) { } 530 WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
640#endif 531}
641 532
642/*-------------------------------------------------------------------------*/ 533/*-------------------------------------------------------------------------*/
643 534
@@ -764,11 +655,11 @@ static int __init omap2_init_devices(void)
764 omap_init_dmic(); 655 omap_init_dmic();
765 omap_init_mcpdm(); 656 omap_init_mcpdm();
766 omap_init_mcspi(); 657 omap_init_mcspi();
658 omap_init_sham();
659 omap_init_aes();
767 } 660 }
768 omap_init_sti(); 661 omap_init_sti();
769 omap_init_rng(); 662 omap_init_rng();
770 omap_init_sham();
771 omap_init_aes();
772 omap_init_vout(); 663 omap_init_vout();
773 omap_init_ocp2scp(); 664 omap_init_ocp2scp();
774 665
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
index 6a764af6c6d3..5137cc84b504 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c
@@ -610,6 +610,8 @@ static struct omap_hwmod_ocp_if *omap2420_hwmod_ocp_ifs[] __initdata = {
610 &omap2420_l4_core__mcbsp2, 610 &omap2420_l4_core__mcbsp2,
611 &omap2420_l4_core__msdi1, 611 &omap2420_l4_core__msdi1,
612 &omap2xxx_l4_core__rng, 612 &omap2xxx_l4_core__rng,
613 &omap2xxx_l4_core__sham,
614 &omap2xxx_l4_core__aes,
613 &omap2420_l4_core__hdq1w, 615 &omap2420_l4_core__hdq1w,
614 &omap2420_l4_wkup__counter_32k, 616 &omap2420_l4_wkup__counter_32k,
615 &omap2420_l3__gpmc, 617 &omap2420_l3__gpmc,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
index d2d3840557c3..4ce999ee3ee9 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c
@@ -963,6 +963,8 @@ static struct omap_hwmod_ocp_if *omap2430_hwmod_ocp_ifs[] __initdata = {
963 &omap2430_l4_core__mcbsp5, 963 &omap2430_l4_core__mcbsp5,
964 &omap2430_l4_core__hdq1w, 964 &omap2430_l4_core__hdq1w,
965 &omap2xxx_l4_core__rng, 965 &omap2xxx_l4_core__rng,
966 &omap2xxx_l4_core__sham,
967 &omap2xxx_l4_core__aes,
966 &omap2430_l4_wkup__counter_32k, 968 &omap2430_l4_wkup__counter_32k,
967 &omap2430_l3__gpmc, 969 &omap2430_l3__gpmc,
968 NULL, 970 NULL,
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
index 47901a5e76de..5fd40d4a989e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_interconnect_data.c
@@ -138,6 +138,24 @@ static struct omap_hwmod_addr_space omap2_rng_addr_space[] = {
138 { } 138 { }
139}; 139};
140 140
141static struct omap_hwmod_addr_space omap2xxx_sham_addrs[] = {
142 {
143 .pa_start = 0x480a4000,
144 .pa_end = 0x480a4000 + 0x64 - 1,
145 .flags = ADDR_TYPE_RT
146 },
147 { }
148};
149
150static struct omap_hwmod_addr_space omap2xxx_aes_addrs[] = {
151 {
152 .pa_start = 0x480a6000,
153 .pa_end = 0x480a6000 + 0x50 - 1,
154 .flags = ADDR_TYPE_RT
155 },
156 { }
157};
158
141/* 159/*
142 * Common interconnect data 160 * Common interconnect data
143 */ 161 */
@@ -389,3 +407,21 @@ struct omap_hwmod_ocp_if omap2xxx_l4_core__rng = {
389 .addr = omap2_rng_addr_space, 407 .addr = omap2_rng_addr_space,
390 .user = OCP_USER_MPU | OCP_USER_SDMA, 408 .user = OCP_USER_MPU | OCP_USER_SDMA,
391}; 409};
410
411/* l4 core -> sham interface */
412struct omap_hwmod_ocp_if omap2xxx_l4_core__sham = {
413 .master = &omap2xxx_l4_core_hwmod,
414 .slave = &omap2xxx_sham_hwmod,
415 .clk = "sha_ick",
416 .addr = omap2xxx_sham_addrs,
417 .user = OCP_USER_MPU | OCP_USER_SDMA,
418};
419
420/* l4 core -> aes interface */
421struct omap_hwmod_ocp_if omap2xxx_l4_core__aes = {
422 .master = &omap2xxx_l4_core_hwmod,
423 .slave = &omap2xxx_aes_hwmod,
424 .clk = "aes_ick",
425 .addr = omap2xxx_aes_addrs,
426 .user = OCP_USER_MPU | OCP_USER_SDMA,
427};
diff --git a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
index e596117004d4..c8c64b3e1acc 100644
--- a/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_2xxx_ipblock_data.c
@@ -864,3 +864,84 @@ struct omap_hwmod omap2xxx_rng_hwmod = {
864 .flags = HWMOD_INIT_NO_RESET, 864 .flags = HWMOD_INIT_NO_RESET,
865 .class = &omap2_rng_hwmod_class, 865 .class = &omap2_rng_hwmod_class,
866}; 866};
867
868/* SHAM */
869
870static struct omap_hwmod_class_sysconfig omap2_sham_sysc = {
871 .rev_offs = 0x5c,
872 .sysc_offs = 0x60,
873 .syss_offs = 0x64,
874 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
875 SYSS_HAS_RESET_STATUS),
876 .sysc_fields = &omap_hwmod_sysc_type1,
877};
878
879static struct omap_hwmod_class omap2xxx_sham_class = {
880 .name = "sham",
881 .sysc = &omap2_sham_sysc,
882};
883
884static struct omap_hwmod_irq_info omap2_sham_mpu_irqs[] = {
885 { .irq = 51 + OMAP_INTC_START, },
886 { .irq = -1 }
887};
888
889static struct omap_hwmod_dma_info omap2_sham_sdma_chs[] = {
890 { .name = "rx", .dma_req = 13 },
891 { .dma_req = -1 }
892};
893
894struct omap_hwmod omap2xxx_sham_hwmod = {
895 .name = "sham",
896 .mpu_irqs = omap2_sham_mpu_irqs,
897 .sdma_reqs = omap2_sham_sdma_chs,
898 .main_clk = "l4_ck",
899 .prcm = {
900 .omap2 = {
901 .module_offs = CORE_MOD,
902 .prcm_reg_id = 4,
903 .module_bit = OMAP24XX_EN_SHA_SHIFT,
904 .idlest_reg_id = 4,
905 .idlest_idle_bit = OMAP24XX_ST_SHA_SHIFT,
906 },
907 },
908 .class = &omap2xxx_sham_class,
909};
910
911/* AES */
912
913static struct omap_hwmod_class_sysconfig omap2_aes_sysc = {
914 .rev_offs = 0x44,
915 .sysc_offs = 0x48,
916 .syss_offs = 0x4c,
917 .sysc_flags = (SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE |
918 SYSS_HAS_RESET_STATUS),
919 .sysc_fields = &omap_hwmod_sysc_type1,
920};
921
922static struct omap_hwmod_class omap2xxx_aes_class = {
923 .name = "aes",
924 .sysc = &omap2_aes_sysc,
925};
926
927static struct omap_hwmod_dma_info omap2_aes_sdma_chs[] = {
928 { .name = "tx", .dma_req = 9 },
929 { .name = "rx", .dma_req = 10 },
930 { .dma_req = -1 }
931};
932
933struct omap_hwmod omap2xxx_aes_hwmod = {
934 .name = "aes",
935 .sdma_reqs = omap2_aes_sdma_chs,
936 .main_clk = "l4_ck",
937 .prcm = {
938 .omap2 = {
939 .module_offs = CORE_MOD,
940 .prcm_reg_id = 4,
941 .module_bit = OMAP24XX_EN_AES_SHIFT,
942 .idlest_reg_id = 4,
943 .idlest_idle_bit = OMAP24XX_ST_AES_SHIFT,
944 },
945 },
946 .class = &omap2xxx_aes_class,
947};
diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
index 26eee4a556ad..556a1222fde6 100644
--- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c
@@ -417,8 +417,6 @@ static struct omap_hwmod am33xx_adc_tsc_hwmod = {
417 * - clkdiv32k 417 * - clkdiv32k
418 * - debugss 418 * - debugss
419 * - ocp watch point 419 * - ocp watch point
420 * - aes0
421 * - sha0
422 */ 420 */
423#if 0 421#if 0
424/* 422/*
@@ -499,25 +497,41 @@ static struct omap_hwmod am33xx_ocpwp_hwmod = {
499 }, 497 },
500 }, 498 },
501}; 499};
500#endif
502 501
503/* 502/*
504 * 'aes' class 503 * 'aes0' class
505 */ 504 */
506static struct omap_hwmod_class am33xx_aes_hwmod_class = { 505static struct omap_hwmod_class_sysconfig am33xx_aes0_sysc = {
507 .name = "aes", 506 .rev_offs = 0x80,
507 .sysc_offs = 0x84,
508 .syss_offs = 0x88,
509 .sysc_flags = SYSS_HAS_RESET_STATUS,
510};
511
512static struct omap_hwmod_class am33xx_aes0_hwmod_class = {
513 .name = "aes0",
514 .sysc = &am33xx_aes0_sysc,
508}; 515};
509 516
510static struct omap_hwmod_irq_info am33xx_aes0_irqs[] = { 517static struct omap_hwmod_irq_info am33xx_aes0_irqs[] = {
511 { .irq = 102 + OMAP_INTC_START, }, 518 { .irq = 103 + OMAP_INTC_START, },
512 { .irq = -1 }, 519 { .irq = -1 },
513}; 520};
514 521
522static struct omap_hwmod_dma_info am33xx_aes0_edma_reqs[] = {
523 { .name = "tx", .dma_req = 6, },
524 { .name = "rx", .dma_req = 5, },
525 { .dma_req = -1 }
526};
527
515static struct omap_hwmod am33xx_aes0_hwmod = { 528static struct omap_hwmod am33xx_aes0_hwmod = {
516 .name = "aes0", 529 .name = "aes",
517 .class = &am33xx_aes_hwmod_class, 530 .class = &am33xx_aes0_hwmod_class,
518 .clkdm_name = "l3_clkdm", 531 .clkdm_name = "l3_clkdm",
519 .mpu_irqs = am33xx_aes0_irqs, 532 .mpu_irqs = am33xx_aes0_irqs,
520 .main_clk = "l3_gclk", 533 .sdma_reqs = am33xx_aes0_edma_reqs,
534 .main_clk = "aes0_fck",
521 .prcm = { 535 .prcm = {
522 .omap4 = { 536 .omap4 = {
523 .clkctrl_offs = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET, 537 .clkctrl_offs = AM33XX_CM_PER_AES0_CLKCTRL_OFFSET,
@@ -526,21 +540,35 @@ static struct omap_hwmod am33xx_aes0_hwmod = {
526 }, 540 },
527}; 541};
528 542
529/* sha0 */ 543/* sha0 HIB2 (the 'P' (public) device) */
544static struct omap_hwmod_class_sysconfig am33xx_sha0_sysc = {
545 .rev_offs = 0x100,
546 .sysc_offs = 0x110,
547 .syss_offs = 0x114,
548 .sysc_flags = SYSS_HAS_RESET_STATUS,
549};
550
530static struct omap_hwmod_class am33xx_sha0_hwmod_class = { 551static struct omap_hwmod_class am33xx_sha0_hwmod_class = {
531 .name = "sha0", 552 .name = "sha0",
553 .sysc = &am33xx_sha0_sysc,
532}; 554};
533 555
534static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = { 556static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = {
535 { .irq = 108 + OMAP_INTC_START, }, 557 { .irq = 109 + OMAP_INTC_START, },
536 { .irq = -1 }, 558 { .irq = -1 },
537}; 559};
538 560
561static struct omap_hwmod_dma_info am33xx_sha0_edma_reqs[] = {
562 { .name = "rx", .dma_req = 36, },
563 { .dma_req = -1 }
564};
565
539static struct omap_hwmod am33xx_sha0_hwmod = { 566static struct omap_hwmod am33xx_sha0_hwmod = {
540 .name = "sha0", 567 .name = "sham",
541 .class = &am33xx_sha0_hwmod_class, 568 .class = &am33xx_sha0_hwmod_class,
542 .clkdm_name = "l3_clkdm", 569 .clkdm_name = "l3_clkdm",
543 .mpu_irqs = am33xx_sha0_irqs, 570 .mpu_irqs = am33xx_sha0_irqs,
571 .sdma_reqs = am33xx_sha0_edma_reqs,
544 .main_clk = "l3_gclk", 572 .main_clk = "l3_gclk",
545 .prcm = { 573 .prcm = {
546 .omap4 = { 574 .omap4 = {
@@ -550,8 +578,6 @@ static struct omap_hwmod am33xx_sha0_hwmod = {
550 }, 578 },
551}; 579};
552 580
553#endif
554
555/* ocmcram */ 581/* ocmcram */
556static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = { 582static struct omap_hwmod_class am33xx_ocmcram_hwmod_class = {
557 .name = "ocmcram", 583 .name = "ocmcram",
@@ -3434,6 +3460,42 @@ static struct omap_hwmod_ocp_if am33xx_l3_main__ocmc = {
3434 .user = OCP_USER_MPU | OCP_USER_SDMA, 3460 .user = OCP_USER_MPU | OCP_USER_SDMA,
3435}; 3461};
3436 3462
3463/* l3 main -> sha0 HIB2 */
3464static struct omap_hwmod_addr_space am33xx_sha0_addrs[] = {
3465 {
3466 .pa_start = 0x53100000,
3467 .pa_end = 0x53100000 + SZ_512 - 1,
3468 .flags = ADDR_TYPE_RT
3469 },
3470 { }
3471};
3472
3473static struct omap_hwmod_ocp_if am33xx_l3_main__sha0 = {
3474 .master = &am33xx_l3_main_hwmod,
3475 .slave = &am33xx_sha0_hwmod,
3476 .clk = "sha0_fck",
3477 .addr = am33xx_sha0_addrs,
3478 .user = OCP_USER_MPU | OCP_USER_SDMA,
3479};
3480
3481/* l3 main -> AES0 HIB2 */
3482static struct omap_hwmod_addr_space am33xx_aes0_addrs[] = {
3483 {
3484 .pa_start = 0x53500000,
3485 .pa_end = 0x53500000 + SZ_1M - 1,
3486 .flags = ADDR_TYPE_RT
3487 },
3488 { }
3489};
3490
3491static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = {
3492 .master = &am33xx_l3_main_hwmod,
3493 .slave = &am33xx_aes0_hwmod,
3494 .clk = "aes0_fck",
3495 .addr = am33xx_aes0_addrs,
3496 .user = OCP_USER_MPU | OCP_USER_SDMA,
3497};
3498
3437static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = { 3499static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3438 &am33xx_l4_fw__emif_fw, 3500 &am33xx_l4_fw__emif_fw,
3439 &am33xx_l3_main__emif, 3501 &am33xx_l3_main__emif,
@@ -3514,6 +3576,8 @@ static struct omap_hwmod_ocp_if *am33xx_hwmod_ocp_ifs[] __initdata = {
3514 &am33xx_l3_s__usbss, 3576 &am33xx_l3_s__usbss,
3515 &am33xx_l4_hs__cpgmac0, 3577 &am33xx_l4_hs__cpgmac0,
3516 &am33xx_cpgmac0__mdio, 3578 &am33xx_cpgmac0__mdio,
3579 &am33xx_l3_main__sha0,
3580 &am33xx_l3_main__aes0,
3517 NULL, 3581 NULL,
3518}; 3582};
3519 3583
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index ac7e03ec952f..85c917cb193d 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -3545,6 +3545,132 @@ static struct omap_hwmod_ocp_if omap3xxx_l3_main__gpmc = {
3545 .user = OCP_USER_MPU | OCP_USER_SDMA, 3545 .user = OCP_USER_MPU | OCP_USER_SDMA,
3546}; 3546};
3547 3547
3548/* l4_core -> SHAM2 (SHA1/MD5) (similar to omap24xx) */
3549static struct omap_hwmod_sysc_fields omap3_sham_sysc_fields = {
3550 .sidle_shift = 4,
3551 .srst_shift = 1,
3552 .autoidle_shift = 0,
3553};
3554
3555static struct omap_hwmod_class_sysconfig omap3_sham_sysc = {
3556 .rev_offs = 0x5c,
3557 .sysc_offs = 0x60,
3558 .syss_offs = 0x64,
3559 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
3560 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
3561 .sysc_fields = &omap3_sham_sysc_fields,
3562};
3563
3564static struct omap_hwmod_class omap3xxx_sham_class = {
3565 .name = "sham",
3566 .sysc = &omap3_sham_sysc,
3567};
3568
3569static struct omap_hwmod_irq_info omap3_sham_mpu_irqs[] = {
3570 { .irq = 49 + OMAP_INTC_START, },
3571 { .irq = -1 }
3572};
3573
3574static struct omap_hwmod_dma_info omap3_sham_sdma_reqs[] = {
3575 { .name = "rx", .dma_req = OMAP34XX_DMA_SHA1MD5_RX, },
3576 { .dma_req = -1 }
3577};
3578
3579static struct omap_hwmod omap3xxx_sham_hwmod = {
3580 .name = "sham",
3581 .mpu_irqs = omap3_sham_mpu_irqs,
3582 .sdma_reqs = omap3_sham_sdma_reqs,
3583 .main_clk = "sha12_ick",
3584 .prcm = {
3585 .omap2 = {
3586 .module_offs = CORE_MOD,
3587 .prcm_reg_id = 1,
3588 .module_bit = OMAP3430_EN_SHA12_SHIFT,
3589 .idlest_reg_id = 1,
3590 .idlest_idle_bit = OMAP3430_ST_SHA12_SHIFT,
3591 },
3592 },
3593 .class = &omap3xxx_sham_class,
3594};
3595
3596static struct omap_hwmod_addr_space omap3xxx_sham_addrs[] = {
3597 {
3598 .pa_start = 0x480c3000,
3599 .pa_end = 0x480c3000 + 0x64 - 1,
3600 .flags = ADDR_TYPE_RT
3601 },
3602 { }
3603};
3604
3605static struct omap_hwmod_ocp_if omap3xxx_l4_core__sham = {
3606 .master = &omap3xxx_l4_core_hwmod,
3607 .slave = &omap3xxx_sham_hwmod,
3608 .clk = "sha12_ick",
3609 .addr = omap3xxx_sham_addrs,
3610 .user = OCP_USER_MPU | OCP_USER_SDMA,
3611};
3612
3613/* l4_core -> AES */
3614static struct omap_hwmod_sysc_fields omap3xxx_aes_sysc_fields = {
3615 .sidle_shift = 6,
3616 .srst_shift = 1,
3617 .autoidle_shift = 0,
3618};
3619
3620static struct omap_hwmod_class_sysconfig omap3_aes_sysc = {
3621 .rev_offs = 0x44,
3622 .sysc_offs = 0x48,
3623 .syss_offs = 0x4c,
3624 .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
3625 SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS),
3626 .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
3627 .sysc_fields = &omap3xxx_aes_sysc_fields,
3628};
3629
3630static struct omap_hwmod_class omap3xxx_aes_class = {
3631 .name = "aes",
3632 .sysc = &omap3_aes_sysc,
3633};
3634
3635static struct omap_hwmod_dma_info omap3_aes_sdma_reqs[] = {
3636 { .name = "tx", .dma_req = OMAP34XX_DMA_AES2_TX, },
3637 { .name = "rx", .dma_req = OMAP34XX_DMA_AES2_RX, },
3638 { .dma_req = -1 }
3639};
3640
3641static struct omap_hwmod omap3xxx_aes_hwmod = {
3642 .name = "aes",
3643 .sdma_reqs = omap3_aes_sdma_reqs,
3644 .main_clk = "aes2_ick",
3645 .prcm = {
3646 .omap2 = {
3647 .module_offs = CORE_MOD,
3648 .prcm_reg_id = 1,
3649 .module_bit = OMAP3430_EN_AES2_SHIFT,
3650 .idlest_reg_id = 1,
3651 .idlest_idle_bit = OMAP3430_ST_AES2_SHIFT,
3652 },
3653 },
3654 .class = &omap3xxx_aes_class,
3655};
3656
3657static struct omap_hwmod_addr_space omap3xxx_aes_addrs[] = {
3658 {
3659 .pa_start = 0x480c5000,
3660 .pa_end = 0x480c5000 + 0x50 - 1,
3661 .flags = ADDR_TYPE_RT
3662 },
3663 { }
3664};
3665
3666static struct omap_hwmod_ocp_if omap3xxx_l4_core__aes = {
3667 .master = &omap3xxx_l4_core_hwmod,
3668 .slave = &omap3xxx_aes_hwmod,
3669 .clk = "aes2_ick",
3670 .addr = omap3xxx_aes_addrs,
3671 .user = OCP_USER_MPU | OCP_USER_SDMA,
3672};
3673
3548static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { 3674static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3549 &omap3xxx_l3_main__l4_core, 3675 &omap3xxx_l3_main__l4_core,
3550 &omap3xxx_l3_main__l4_per, 3676 &omap3xxx_l3_main__l4_per,
@@ -3596,8 +3722,32 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = {
3596}; 3722};
3597 3723
3598/* GP-only hwmod links */ 3724/* GP-only hwmod links */
3599static struct omap_hwmod_ocp_if *omap3xxx_gp_hwmod_ocp_ifs[] __initdata = { 3725static struct omap_hwmod_ocp_if *omap34xx_gp_hwmod_ocp_ifs[] __initdata = {
3600 &omap3xxx_l4_sec__timer12, 3726 &omap3xxx_l4_sec__timer12,
3727 &omap3xxx_l4_core__sham,
3728 &omap3xxx_l4_core__aes,
3729 NULL
3730};
3731
3732static struct omap_hwmod_ocp_if *omap36xx_gp_hwmod_ocp_ifs[] __initdata = {
3733 &omap3xxx_l4_sec__timer12,
3734 &omap3xxx_l4_core__sham,
3735 &omap3xxx_l4_core__aes,
3736 NULL
3737};
3738
3739static struct omap_hwmod_ocp_if *am35xx_gp_hwmod_ocp_ifs[] __initdata = {
3740 &omap3xxx_l4_sec__timer12,
3741 /*
3742 * Apparently the SHA/MD5 and AES accelerator IP blocks are
3743 * only present on some AM35xx chips, and no one knows which
3744 * ones. See
3745 * http://www.spinics.net/lists/arm-kernel/msg215466.html So
3746 * if you need these IP blocks on an AM35xx, try uncommenting
3747 * the following lines.
3748 */
3749 /* &omap3xxx_l4_core__sham, */
3750 /* &omap3xxx_l4_core__aes, */
3601 NULL 3751 NULL
3602}; 3752};
3603 3753
@@ -3704,7 +3854,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = {
3704int __init omap3xxx_hwmod_init(void) 3854int __init omap3xxx_hwmod_init(void)
3705{ 3855{
3706 int r; 3856 int r;
3707 struct omap_hwmod_ocp_if **h = NULL; 3857 struct omap_hwmod_ocp_if **h = NULL, **h_gp = NULL;
3708 unsigned int rev; 3858 unsigned int rev;
3709 3859
3710 omap_hwmod_init(); 3860 omap_hwmod_init();
@@ -3714,13 +3864,6 @@ int __init omap3xxx_hwmod_init(void)
3714 if (r < 0) 3864 if (r < 0)
3715 return r; 3865 return r;
3716 3866
3717 /* Register GP-only hwmod links. */
3718 if (omap_type() == OMAP2_DEVICE_TYPE_GP) {
3719 r = omap_hwmod_register_links(omap3xxx_gp_hwmod_ocp_ifs);
3720 if (r < 0)
3721 return r;
3722 }
3723
3724 rev = omap_rev(); 3867 rev = omap_rev();
3725 3868
3726 /* 3869 /*
@@ -3732,11 +3875,14 @@ int __init omap3xxx_hwmod_init(void)
3732 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || 3875 rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 ||
3733 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { 3876 rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) {
3734 h = omap34xx_hwmod_ocp_ifs; 3877 h = omap34xx_hwmod_ocp_ifs;
3878 h_gp = omap34xx_gp_hwmod_ocp_ifs;
3735 } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { 3879 } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
3736 h = am35xx_hwmod_ocp_ifs; 3880 h = am35xx_hwmod_ocp_ifs;
3881 h_gp = am35xx_gp_hwmod_ocp_ifs;
3737 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || 3882 } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 ||
3738 rev == OMAP3630_REV_ES1_2) { 3883 rev == OMAP3630_REV_ES1_2) {
3739 h = omap36xx_hwmod_ocp_ifs; 3884 h = omap36xx_hwmod_ocp_ifs;
3885 h_gp = omap36xx_gp_hwmod_ocp_ifs;
3740 } else { 3886 } else {
3741 WARN(1, "OMAP3 hwmod family init: unknown chip type\n"); 3887 WARN(1, "OMAP3 hwmod family init: unknown chip type\n");
3742 return -EINVAL; 3888 return -EINVAL;
@@ -3746,6 +3892,14 @@ int __init omap3xxx_hwmod_init(void)
3746 if (r < 0) 3892 if (r < 0)
3747 return r; 3893 return r;
3748 3894
3895 /* Register GP-only hwmod links. */
3896 if (h_gp && omap_type() == OMAP2_DEVICE_TYPE_GP) {
3897 r = omap_hwmod_register_links(h_gp);
3898 if (r < 0)
3899 return r;
3900 }
3901
3902
3749 /* 3903 /*
3750 * Register hwmod links specific to certain ES levels of a 3904 * Register hwmod links specific to certain ES levels of a
3751 * particular family of silicon (e.g., 34xx ES1.0) 3905 * particular family of silicon (e.g., 34xx ES1.0)
diff --git a/arch/arm/mach-omap2/omap_hwmod_common_data.h b/arch/arm/mach-omap2/omap_hwmod_common_data.h
index cfcce299177c..6e04ff7065e1 100644
--- a/arch/arm/mach-omap2/omap_hwmod_common_data.h
+++ b/arch/arm/mach-omap2/omap_hwmod_common_data.h
@@ -78,6 +78,8 @@ extern struct omap_hwmod omap2xxx_mcspi2_hwmod;
78extern struct omap_hwmod omap2xxx_counter_32k_hwmod; 78extern struct omap_hwmod omap2xxx_counter_32k_hwmod;
79extern struct omap_hwmod omap2xxx_gpmc_hwmod; 79extern struct omap_hwmod omap2xxx_gpmc_hwmod;
80extern struct omap_hwmod omap2xxx_rng_hwmod; 80extern struct omap_hwmod omap2xxx_rng_hwmod;
81extern struct omap_hwmod omap2xxx_sham_hwmod;
82extern struct omap_hwmod omap2xxx_aes_hwmod;
81 83
82/* Common interface data across OMAP2xxx */ 84/* Common interface data across OMAP2xxx */
83extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core; 85extern struct omap_hwmod_ocp_if omap2xxx_l3_main__l4_core;
@@ -105,6 +107,8 @@ extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_dispc;
105extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi; 107extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_rfbi;
106extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc; 108extern struct omap_hwmod_ocp_if omap2xxx_l4_core__dss_venc;
107extern struct omap_hwmod_ocp_if omap2xxx_l4_core__rng; 109extern struct omap_hwmod_ocp_if omap2xxx_l4_core__rng;
110extern struct omap_hwmod_ocp_if omap2xxx_l4_core__sham;
111extern struct omap_hwmod_ocp_if omap2xxx_l4_core__aes;
108 112
109/* Common IP block data */ 113/* Common IP block data */
110extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[]; 114extern struct omap_hwmod_dma_info omap2_uart1_sdma_reqs[];