Commit d456979731c14f78be0343bf0cb6aec1827f9a57
1 parent
9f23f2019c
Exists in
v3.2_SMARCT335xPSP_04.06.00.11
and in
2 other branches
Add 0009-ARM-AM33xx-hwmod-Convert-RNG-device-data-to-hwmod.patch that wasn't par…
…t of the official PSP 04.06.00.11 release
Showing 3 changed files with 82 additions and 22 deletions Side-by-side Diff
arch/arm/mach-omap2/devices.c
... | ... | @@ -807,6 +807,23 @@ |
807 | 807 | static inline void omap_init_aes(void) { } |
808 | 808 | #endif |
809 | 809 | |
810 | +#if IS_ENABLED(CONFIG_HW_RANDOM_OMAP4) | |
811 | +static void __init omap_init_rng(void) | |
812 | +{ | |
813 | + struct omap_hwmod *oh; | |
814 | + struct platform_device *pdev; | |
815 | + | |
816 | + oh = omap_hwmod_lookup("rng"); | |
817 | + if (!oh) | |
818 | + return; | |
819 | + | |
820 | + pdev = omap_device_build("omap4_rng", -1, oh, NULL, 0, NULL, 0, 0); | |
821 | + WARN(IS_ERR(pdev), "Can't build omap_device for omap-rng\n"); | |
822 | +} | |
823 | +#else | |
824 | +static inline void omap_init_rng(void) {} | |
825 | +#endif | |
826 | + | |
810 | 827 | /*-------------------------------------------------------------------------*/ |
811 | 828 | |
812 | 829 | #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) |
... | ... | @@ -1207,6 +1224,7 @@ |
1207 | 1224 | omap_init_sti(); |
1208 | 1225 | omap_init_sham(); |
1209 | 1226 | omap_init_aes(); |
1227 | + omap_init_rng(); | |
1210 | 1228 | omap_init_vout(); |
1211 | 1229 | am33xx_register_edma(); |
1212 | 1230 | am33xx_init_pcm(); |
arch/arm/mach-omap2/omap_hwmod_33xx_data.c
... | ... | @@ -94,6 +94,7 @@ |
94 | 94 | static struct omap_hwmod am33xx_mailbox_hwmod; |
95 | 95 | static struct omap_hwmod am33xx_cpgmac0_hwmod; |
96 | 96 | static struct omap_hwmod am33xx_mdio_hwmod; |
97 | +static struct omap_hwmod am33xx_rng_hwmod; | |
97 | 98 | |
98 | 99 | /* |
99 | 100 | * ERRATA: (Yet to conform from IP team) |
... | ... | @@ -3541,6 +3542,67 @@ |
3541 | 3542 | .rst_lines_cnt = ARRAY_SIZE(am33xx_pruss_resets), |
3542 | 3543 | }; |
3543 | 3544 | |
3545 | +/* rng */ | |
3546 | +static struct omap_hwmod_sysc_fields omap3_rng_sysc_fields = { | |
3547 | + .sidle_shift = 3, | |
3548 | + .autoidle_shift = 0, | |
3549 | +}; | |
3550 | + | |
3551 | +static struct omap_hwmod_class_sysconfig am33xx_rng_sysc = { | |
3552 | + .rev_offs = 0x1fe0, | |
3553 | + .sysc_offs = 0x1fe4, | |
3554 | + .rst_offs = 0x1ff0, | |
3555 | + .sysc_flags = SYSC_HAS_AUTOIDLE, | |
3556 | + .sysc_fields = &omap3_rng_sysc_fields, | |
3557 | +}; | |
3558 | + | |
3559 | +static struct omap_hwmod_class am33xx_rng_hwmod_class = { | |
3560 | + .name = "rng", | |
3561 | + .sysc = &am33xx_rng_sysc, | |
3562 | +}; | |
3563 | + | |
3564 | +static struct omap_hwmod_irq_info am33xx_rng_irqs[] = { | |
3565 | + { .irq = 111 }, | |
3566 | + { .irq = -1 } | |
3567 | +}; | |
3568 | + | |
3569 | +struct omap_hwmod_addr_space am33xx_rng_addr_space[] = { | |
3570 | + { | |
3571 | + .pa_start = 0x48310000, | |
3572 | + .pa_end = 0x48310000 + SZ_8K - 1, | |
3573 | + .flags = ADDR_TYPE_RT, | |
3574 | + }, | |
3575 | + { } | |
3576 | +}; | |
3577 | + | |
3578 | +struct omap_hwmod_ocp_if am33xx_l4per__rng = { | |
3579 | + .master = &am33xx_l4per_hwmod, | |
3580 | + .slave = &am33xx_rng_hwmod, | |
3581 | + .clk = "rng_fck", | |
3582 | + .addr = am33xx_rng_addr_space, | |
3583 | + .user = OCP_USER_MPU, | |
3584 | +}; | |
3585 | + | |
3586 | +static struct omap_hwmod_ocp_if *am33xx_rng_slaves[] = { | |
3587 | + &am33xx_l4per__rng, | |
3588 | +}; | |
3589 | + | |
3590 | +static struct omap_hwmod am33xx_rng_hwmod = { | |
3591 | + .name = "rng", | |
3592 | + .class = &am33xx_rng_hwmod_class, | |
3593 | + .clkdm_name = "l4ls_clkdm", | |
3594 | + .mpu_irqs = am33xx_rng_irqs, | |
3595 | + .main_clk = "rng_fck", | |
3596 | + .prcm = { | |
3597 | + .omap4 = { | |
3598 | + .clkctrl_offs = AM33XX_CM_PER_RNG_CLKCTRL_OFFSET, | |
3599 | + .modulemode = MODULEMODE_SWCTRL, | |
3600 | + }, | |
3601 | + }, | |
3602 | + .slaves = am33xx_rng_slaves, | |
3603 | + .slaves_cnt = ARRAY_SIZE(am33xx_rng_slaves), | |
3604 | +}; | |
3605 | + | |
3544 | 3606 | static __initdata struct omap_hwmod *am33xx_hwmods[] = { |
3545 | 3607 | /* l3 class */ |
3546 | 3608 | &am33xx_l3_instr_hwmod, |
... | ... | @@ -3661,6 +3723,8 @@ |
3661 | 3723 | &am33xx_gfx_hwmod, |
3662 | 3724 | /* pruss */ |
3663 | 3725 | &am33xx_pruss_hwmod, |
3726 | + /* rng */ | |
3727 | + &am33xx_rng_hwmod, | |
3664 | 3728 | NULL, |
3665 | 3729 | }; |
3666 | 3730 |
arch/arm/plat-omap/devices.c
... | ... | @@ -105,28 +105,6 @@ |
105 | 105 | { |
106 | 106 | (void) platform_device_register(&omap_rng_device); |
107 | 107 | } |
108 | -#elif defined(CONFIG_HW_RANDOM_OMAP4) || defined(CONFIG_HW_RANDOM_OMAP4_MODULE) | |
109 | - | |
110 | -static struct resource rng_resources[] = { | |
111 | - { | |
112 | - .start = AM33XX_RNG_BASE, | |
113 | - .end = AM33XX_RNG_BASE + 0x1FFC, | |
114 | - .flags = IORESOURCE_MEM, | |
115 | - }, | |
116 | -}; | |
117 | - | |
118 | -static struct platform_device omap4_rng_device = { | |
119 | - .name = "omap4_rng", | |
120 | - .id = -1, | |
121 | - .num_resources = ARRAY_SIZE(rng_resources), | |
122 | - .resource = rng_resources, | |
123 | -}; | |
124 | - | |
125 | -static void omap_init_rng(void) | |
126 | -{ | |
127 | - (void) platform_device_register(&omap4_rng_device); | |
128 | -} | |
129 | - | |
130 | 108 | #else |
131 | 109 | static inline void omap_init_rng(void) {} |
132 | 110 | #endif |