diff options
author | Mark A. Greer <mgreer@animalcreek.com> | 2013-03-18 12:06:32 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2013-03-30 17:51:12 -0400 |
commit | 26f88e6ebfcb4a80050c7345919b9ab8e6eafeae (patch) | |
tree | 90afea766f8084934b688fbd6c994d54bbf9e63e /arch/arm | |
parent | fa7807b4cc77376b3ec245f8663201780e6c7450 (diff) |
ARM: OMAP3xxx: hwmod: Convert SHAM crypto device data to hwmod
Convert the device data for the OMAP3 SHAM2 (SHA1/MD5) crypto IP
from explicit platform_data to hwmod.
CC: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
[paul@pwsan.com: updated to use per-SoC registration lists for GP-only hwmods;
fixed lines causing sparse warnings]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/cclock3xxx_data.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 41 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 107 |
3 files changed, 101 insertions, 48 deletions
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c index 438d13341e23..55b50895503e 100644 --- a/arch/arm/mach-omap2/cclock3xxx_data.c +++ b/arch/arm/mach-omap2/cclock3xxx_data.c | |||
@@ -3473,6 +3473,7 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3473 | CLK(NULL, "gpt1_fck", &gpt1_fck), | 3473 | CLK(NULL, "gpt1_fck", &gpt1_fck), |
3474 | CLK(NULL, "wkup_32k_fck", &wkup_32k_fck), | 3474 | CLK(NULL, "wkup_32k_fck", &wkup_32k_fck), |
3475 | CLK(NULL, "gpio1_dbck", &gpio1_dbck), | 3475 | CLK(NULL, "gpio1_dbck", &gpio1_dbck), |
3476 | CLK(NULL, "sha12_ick", &sha12_ick), | ||
3476 | CLK(NULL, "wdt2_fck", &wdt2_fck), | 3477 | CLK(NULL, "wdt2_fck", &wdt2_fck), |
3477 | CLK("omap_wdt", "ick", &wdt2_ick), | 3478 | CLK("omap_wdt", "ick", &wdt2_ick), |
3478 | CLK(NULL, "wdt2_ick", &wdt2_ick), | 3479 | CLK(NULL, "wdt2_ick", &wdt2_ick), |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 8d51c65bdfce..df109dc6bd81 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -504,38 +504,9 @@ 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) | 507 | static void __init omap_init_sham(void) |
508 | |||
509 | #ifdef CONFIG_ARCH_OMAP3 | ||
510 | static struct resource omap3_sham_resources[] = { | ||
511 | { | ||
512 | .start = OMAP34XX_SEC_SHA1MD5_BASE, | ||
513 | .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64, | ||
514 | .flags = IORESOURCE_MEM, | ||
515 | }, | ||
516 | { | ||
517 | .start = 49 + OMAP_INTC_START, | ||
518 | .flags = IORESOURCE_IRQ, | ||
519 | }, | ||
520 | { | ||
521 | .start = OMAP34XX_DMA_SHA1MD5_RX, | ||
522 | .flags = IORESOURCE_DMA, | ||
523 | } | ||
524 | }; | ||
525 | static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources); | ||
526 | #else | ||
527 | #define omap3_sham_resources NULL | ||
528 | #define omap3_sham_resources_sz 0 | ||
529 | #endif | ||
530 | |||
531 | static struct platform_device sham_device = { | ||
532 | .name = "omap-sham", | ||
533 | .id = -1, | ||
534 | }; | ||
535 | |||
536 | static void omap_init_sham(void) | ||
537 | { | 508 | { |
538 | if (cpu_is_omap24xx()) { | 509 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { |
539 | struct omap_hwmod *oh; | 510 | struct omap_hwmod *oh; |
540 | struct platform_device *pdev; | 511 | struct platform_device *pdev; |
541 | 512 | ||
@@ -545,18 +516,10 @@ static void omap_init_sham(void) | |||
545 | 516 | ||
546 | pdev = omap_device_build("omap-sham", -1, oh, NULL, 0); | 517 | pdev = omap_device_build("omap-sham", -1, oh, NULL, 0); |
547 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); | 518 | WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); |
548 | } else if (cpu_is_omap34xx()) { | ||
549 | sham_device.resource = omap3_sham_resources; | ||
550 | sham_device.num_resources = omap3_sham_resources_sz; | ||
551 | platform_device_register(&sham_device); | ||
552 | } else { | 519 | } else { |
553 | pr_err("%s: platform not supported\n", __func__); | 520 | pr_err("%s: platform not supported\n", __func__); |
554 | return; | ||
555 | } | 521 | } |
556 | } | 522 | } |
557 | #else | ||
558 | static inline void omap_init_sham(void) { } | ||
559 | #endif | ||
560 | 523 | ||
561 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) | 524 | #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE) |
562 | 525 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index ac7e03ec952f..f01fe0795e69 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -3545,6 +3545,71 @@ 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) */ | ||
3549 | static struct omap_hwmod_sysc_fields omap3_sham_sysc_fields = { | ||
3550 | .sidle_shift = 4, | ||
3551 | .srst_shift = 1, | ||
3552 | .autoidle_shift = 0, | ||
3553 | }; | ||
3554 | |||
3555 | static 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 | |||
3564 | static struct omap_hwmod_class omap3xxx_sham_class = { | ||
3565 | .name = "sham", | ||
3566 | .sysc = &omap3_sham_sysc, | ||
3567 | }; | ||
3568 | |||
3569 | static struct omap_hwmod_irq_info omap3_sham_mpu_irqs[] = { | ||
3570 | { .irq = 49 + OMAP_INTC_START, }, | ||
3571 | { .irq = -1 } | ||
3572 | }; | ||
3573 | |||
3574 | static struct omap_hwmod_dma_info omap3_sham_sdma_reqs[] = { | ||
3575 | { .name = "rx", .dma_req = OMAP34XX_DMA_SHA1MD5_RX, }, | ||
3576 | { .dma_req = -1 } | ||
3577 | }; | ||
3578 | |||
3579 | static 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 | |||
3596 | static 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 | |||
3605 | static 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 | |||
3548 | static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { | 3613 | static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { |
3549 | &omap3xxx_l3_main__l4_core, | 3614 | &omap3xxx_l3_main__l4_core, |
3550 | &omap3xxx_l3_main__l4_per, | 3615 | &omap3xxx_l3_main__l4_per, |
@@ -3596,8 +3661,28 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { | |||
3596 | }; | 3661 | }; |
3597 | 3662 | ||
3598 | /* GP-only hwmod links */ | 3663 | /* GP-only hwmod links */ |
3599 | static struct omap_hwmod_ocp_if *omap3xxx_gp_hwmod_ocp_ifs[] __initdata = { | 3664 | static struct omap_hwmod_ocp_if *omap34xx_gp_hwmod_ocp_ifs[] __initdata = { |
3665 | &omap3xxx_l4_sec__timer12, | ||
3666 | &omap3xxx_l4_core__sham, | ||
3667 | NULL | ||
3668 | }; | ||
3669 | |||
3670 | static struct omap_hwmod_ocp_if *omap36xx_gp_hwmod_ocp_ifs[] __initdata = { | ||
3600 | &omap3xxx_l4_sec__timer12, | 3671 | &omap3xxx_l4_sec__timer12, |
3672 | &omap3xxx_l4_core__sham, | ||
3673 | NULL | ||
3674 | }; | ||
3675 | |||
3676 | static struct omap_hwmod_ocp_if *am35xx_gp_hwmod_ocp_ifs[] __initdata = { | ||
3677 | &omap3xxx_l4_sec__timer12, | ||
3678 | /* | ||
3679 | * Apparently the SHA/MD5 accelerator IP block is only present | ||
3680 | * on some AM35xx chips, and no one knows which ones. See | ||
3681 | * http://www.spinics.net/lists/arm-kernel/msg215466.html So | ||
3682 | * if you need this IP block on an AM35xx, try uncommenting | ||
3683 | * the next line. | ||
3684 | */ | ||
3685 | /* &omap3xxx_l4_core__sham, */ | ||
3601 | NULL | 3686 | NULL |
3602 | }; | 3687 | }; |
3603 | 3688 | ||
@@ -3704,7 +3789,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = { | |||
3704 | int __init omap3xxx_hwmod_init(void) | 3789 | int __init omap3xxx_hwmod_init(void) |
3705 | { | 3790 | { |
3706 | int r; | 3791 | int r; |
3707 | struct omap_hwmod_ocp_if **h = NULL; | 3792 | struct omap_hwmod_ocp_if **h = NULL, **h_gp = NULL; |
3708 | unsigned int rev; | 3793 | unsigned int rev; |
3709 | 3794 | ||
3710 | omap_hwmod_init(); | 3795 | omap_hwmod_init(); |
@@ -3714,13 +3799,6 @@ int __init omap3xxx_hwmod_init(void) | |||
3714 | if (r < 0) | 3799 | if (r < 0) |
3715 | return r; | 3800 | return r; |
3716 | 3801 | ||
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(); | 3802 | rev = omap_rev(); |
3725 | 3803 | ||
3726 | /* | 3804 | /* |
@@ -3732,11 +3810,14 @@ int __init omap3xxx_hwmod_init(void) | |||
3732 | rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || | 3810 | rev == OMAP3430_REV_ES2_1 || rev == OMAP3430_REV_ES3_0 || |
3733 | rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { | 3811 | rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2) { |
3734 | h = omap34xx_hwmod_ocp_ifs; | 3812 | h = omap34xx_hwmod_ocp_ifs; |
3813 | h_gp = omap34xx_gp_hwmod_ocp_ifs; | ||
3735 | } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { | 3814 | } else if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) { |
3736 | h = am35xx_hwmod_ocp_ifs; | 3815 | h = am35xx_hwmod_ocp_ifs; |
3816 | h_gp = am35xx_gp_hwmod_ocp_ifs; | ||
3737 | } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || | 3817 | } else if (rev == OMAP3630_REV_ES1_0 || rev == OMAP3630_REV_ES1_1 || |
3738 | rev == OMAP3630_REV_ES1_2) { | 3818 | rev == OMAP3630_REV_ES1_2) { |
3739 | h = omap36xx_hwmod_ocp_ifs; | 3819 | h = omap36xx_hwmod_ocp_ifs; |
3820 | h_gp = omap36xx_gp_hwmod_ocp_ifs; | ||
3740 | } else { | 3821 | } else { |
3741 | WARN(1, "OMAP3 hwmod family init: unknown chip type\n"); | 3822 | WARN(1, "OMAP3 hwmod family init: unknown chip type\n"); |
3742 | return -EINVAL; | 3823 | return -EINVAL; |
@@ -3746,6 +3827,14 @@ int __init omap3xxx_hwmod_init(void) | |||
3746 | if (r < 0) | 3827 | if (r < 0) |
3747 | return r; | 3828 | return r; |
3748 | 3829 | ||
3830 | /* Register GP-only hwmod links. */ | ||
3831 | if (h_gp && omap_type() == OMAP2_DEVICE_TYPE_GP) { | ||
3832 | r = omap_hwmod_register_links(h_gp); | ||
3833 | if (r < 0) | ||
3834 | return r; | ||
3835 | } | ||
3836 | |||
3837 | |||
3749 | /* | 3838 | /* |
3750 | * Register hwmod links specific to certain ES levels of a | 3839 | * Register hwmod links specific to certain ES levels of a |
3751 | * particular family of silicon (e.g., 34xx ES1.0) | 3840 | * particular family of silicon (e.g., 34xx ES1.0) |