From b567902d9d767867fdbf09ebb9a086bdb51bc0f1 Mon Sep 17 00:00:00 2001 From: EricLee Date: Fri, 14 Feb 2014 17:05:58 +0800 Subject: [PATCH] Add 0001-ARM-AM33xx-hwmod-Convert-SHA0-crypto-device-data-to-.patch that wasn't part of the official PSP 04.06.00.11 release --- arch/arm/mach-omap2/devices.c | 68 +++--------------------------- arch/arm/mach-omap2/omap_hwmod_33xx_data.c | 32 ++++++++++++++ 2 files changed, 39 insertions(+), 61 deletions(-) diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index bfbbb5f..8e232ab 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -708,72 +708,18 @@ static void omap_init_sham(void) } #elif defined(CONFIG_CRYPTO_DEV_OMAP4_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP4_SHAM_MODULE) - -static struct resource omap4_sham_resources[] = { - { - .start = AM33XX_SHA1MD5_P_BASE, - .end = AM33XX_SHA1MD5_P_BASE + 0x120, - .flags = IORESOURCE_MEM, - }, - { - .start = AM33XX_IRQ_SHAEIP57t0_P, - .flags = IORESOURCE_IRQ, - }, - { - .start = AM33XX_DMA_SHAEIP57T0_DIN, - .flags = IORESOURCE_DMA, - } -}; - -static int omap4_sham_resources_sz = ARRAY_SIZE(omap4_sham_resources); - - -static struct platform_device sham_device = { - .name = "omap4-sham", - .id = -1, -}; - -#if 0 -static void omap_init_sham(void) -{ - sham_device.resource = omap4_sham_resources; - sham_device.num_resources = omap4_sham_resources_sz; - - platform_device_register(&sham_device); -} -#endif - -int __init omap_init_sham(void) +static void __init omap_init_sham(void) { - int id = -1; - struct platform_device *pdev; struct omap_hwmod *oh; - char *oh_name = "sha0"; - char *name = "omap4-sham"; - - 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("sha0"); + if (!oh) + return; - return 0; + pdev = omap_device_build("omap4-sham", -1, oh, NULL, 0, NULL, 0, 0); + WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n"); } - - - - - #else static inline void omap_init_sham(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 ee3ebd9..ad606c6 100644 --- a/arch/arm/mach-omap2/omap_hwmod_33xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_data.c @@ -79,6 +79,7 @@ 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_rtc_hwmod; +static struct omap_hwmod am33xx_sha0_hwmod; static struct omap_hwmod am33xx_mcasp0_hwmod; static struct omap_hwmod am33xx_mcasp1_hwmod; static struct omap_hwmod am33xx_ehrpwm0_hwmod; @@ -2167,8 +2168,16 @@ static struct omap_hwmod am33xx_rtc_hwmod = { }; /* sha0 */ +static struct omap_hwmod_class_sysconfig am33xx_sha0_sysc = { + .rev_offs = 0x100, + .sysc_offs = 0x110, + .syss_offs = 0x114, + .sysc_flags = SYSS_HAS_RESET_STATUS, +}; + static struct omap_hwmod_class am33xx_sha0_hwmod_class = { .name = "sha0", + .sysc = &am33xx_sha0_sysc, }; static struct omap_hwmod_irq_info am33xx_sha0_irqs[] = { @@ -2181,6 +2190,27 @@ static struct omap_hwmod_dma_info am33xx_sha0_dma[] = { { .dma_req = -1 } }; +struct omap_hwmod_addr_space am33xx_sha0_addr_space[] = { + { + .pa_start = 0x53100000, + .pa_end = 0x53100000 + SZ_1M - 1, + .flags = ADDR_TYPE_RT, + }, + { } +}; + +struct omap_hwmod_ocp_if am33xx_l3_core__sha0 = { + .master = &am33xx_l3_main_hwmod, + .slave = &am33xx_sha0_hwmod, + .clk = "sha0_fck", + .addr = am33xx_sha0_addr_space, + .user = OCP_USER_MPU, +}; + +static struct omap_hwmod_ocp_if *am33xx_sha0_slaves[] = { + &am33xx_l3_core__sha0, +}; + static struct omap_hwmod am33xx_sha0_hwmod = { .name = "sha0", .class = &am33xx_sha0_hwmod_class, @@ -2194,6 +2224,8 @@ static struct omap_hwmod am33xx_sha0_hwmod = { .modulemode = MODULEMODE_SWCTRL, }, }, + .slaves = am33xx_sha0_slaves, + .slaves_cnt = ARRAY_SIZE(am33xx_sha0_slaves), }; /* 'smartreflex' class */ -- 1.9.1