From ff9e06c41de00f281dd21ed66e8477d933ce69dd Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Tue, 11 Dec 2012 20:46:49 -0700 Subject: [PATCH 05/10] ARM: AM33xx: hwmod: Convert AES0 crypto device data to hwmod Convert the device data for the AM33xx AES0 crypto modules from explicit platform_data to hwmod. Signed-off-by: Mark A. Greer --- arch/arm/mach-omap2/devices.c | 65 ++++-------------------------- arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 32 +++++++++++++++ 2 files changed, 39 insertions(+), 58 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 3679369..e4caa06 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -809,69 +809,18 @@ static void omap_init_aes(void) } #elif defined(CONFIG_CRYPTO_DEV_OMAP4_AES) || defined(CONFIG_CRYPTO_DEV_OMAP4_AES_MODULE) - -static struct resource omap4_aes_resources[] = { - { - .start = AM33XX_AES0_P_BASE, - .end = AM33XX_AES0_P_BASE + 0x4C, - .flags = IORESOURCE_MEM, - }, - { - .start = AM33XX_DMA_AESEIP36T0_DOUT, - .flags = IORESOURCE_DMA, - }, - { - .start = AM33XX_DMA_AESEIP36T0_DIN, - .flags = IORESOURCE_DMA, - } -}; -static int omap4_aes_resources_sz = ARRAY_SIZE(omap4_aes_resources); - -static struct platform_device aes_device = { - .name = "omap4-aes", - .id = -1, -}; - -#if 0 -static void omap_init_aes(void) +static void __init omap_init_aes(void) { - aes_device.resource = omap4_aes_resources; - aes_device.num_resources = omap4_aes_resources_sz; - platform_device_register(&aes_device); -} -#endif - -int __init omap_init_aes(void) -{ - int id = -1; - struct platform_device *pdev; struct omap_hwmod *oh; - char *oh_name = "aes0"; - char *name = "omap4-aes"; - - oh = omap_hwmod_lookup(oh_name); - if (!oh) { - pr_err("Could not look up %s\n", oh_name); - return -ENODEV; - } - - pdev = omap_device_build(name, id, oh, NULL, 0, NULL, 0, 0); - //pdev.resource = omap4_sham_resources; - //pdev.num_resources = omap4_sham_resources_sz; + struct platform_device *pdev; - if (IS_ERR(pdev)) { - WARN(1, "Can't build omap_device for %s:%s.\n", - name, oh->name); - return PTR_ERR(pdev); - } + oh = omap_hwmod_lookup("aes0"); + if (!oh) + return; - return 0; + pdev = omap_device_build("omap4-aes", -1, oh, NULL, 0, NULL, 0, 0); + WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n"); } - - - - - #else static inline void omap_init_aes(void) { } #endif diff --git a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c index ad606c6..90e25d7 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c @@ -78,6 +78,7 @@ static struct omap_hwmod am33xx_spi0_hwmod; static struct omap_hwmod am33xx_spi1_hwmod; static struct omap_hwmod am33xx_elm_hwmod; static struct omap_hwmod am33xx_adc_tsc_hwmod; +static struct omap_hwmod am33xx_aes0_hwmod; static struct omap_hwmod am33xx_rtc_hwmod; static struct omap_hwmod am33xx_sha0_hwmod; static struct omap_hwmod am33xx_mcasp0_hwmod; @@ -427,8 +428,16 @@ static struct omap_hwmod am33xx_adc_tsc_hwmod = { }; /* 'aes' class */ +static struct omap_hwmod_class_sysconfig am33xx_aes_sysc = { + .rev_offs = 0x80, + .sysc_offs = 0x84, + .syss_offs = 0x88, + .sysc_flags = SYSS_HAS_RESET_STATUS, +}; + static struct omap_hwmod_class am33xx_aes_hwmod_class = { .name = "aes", + .sysc = &am33xx_aes_sysc, }; /* aes0 */ @@ -443,6 +452,27 @@ static struct omap_hwmod_dma_info am33xx_aes0_dma[] = { { .dma_req = -1 } }; +static struct omap_hwmod_addr_space am33xx_aes0_addrs[] = { + { + .pa_start = 0x53500000, + .pa_end = 0x53500000 + SZ_1M - 1, + .flags = ADDR_TYPE_RT + }, + { } +}; + +static struct omap_hwmod_ocp_if am33xx_l3_main__aes0 = { + .master = &am33xx_l3_main_hwmod, + .slave = &am33xx_aes0_hwmod, + .clk = "aes0_fck", + .addr = am33xx_aes0_addrs, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + +static struct omap_hwmod_ocp_if *am33xx_aes0_slaves[] = { + &am33xx_l3_main__aes0, +}; + static struct omap_hwmod am33xx_aes0_hwmod = { .name = "aes0", .class = &am33xx_aes_hwmod_class, @@ -456,6 +486,8 @@ static struct omap_hwmod am33xx_aes0_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, + .slaves = am33xx_aes0_slaves, + .slaves_cnt = ARRAY_SIZE(am33xx_aes0_slaves), }; /* cefuse */ -- 1.7.12