Skip to contentSkip to conversation

implement omap_hwmod core, plus HSMMC example

PATCH New Paul Walmsley 1 participant 9 messages Jun 5, 2009

Subsystems (6)
lore
Share & tools
lore

Paul Walmsley

author maintainer
#0 lore raw

cover implement omap_hwmod core, plus HSMMC example

Hello,

This patch series implements the first public version of the omap_hwmod hardware module layer. It manages on-chip hardware IP blocks, and provides a means for defining their integration properties to the rest of the chip. Some of the major goals here are to collect all IP block integration data into one place, and to put devices in a known state at boot.

As an exemplar, this series also implements the basic omap_hwmod structures for HSMMC1/2/3 on OMAP2430 and OMAP34xx.

The omap_hwmod code is initially intended for use with OMAP2+ chips. The goal is to auto-generate these structures for OMAP4 from a TI hardware database export. OMAP2/3 structures will probably have to be filled in by hand.

The series starts with several prerequisite patches. OMAP1 and OMAP2 MMC core initialization code is split from plat-omap/devices.c into mach-omap1/devices.c and mach-omap2/devices.c. Several clock framework fixes are also required. Finally the omap_hwmod code and header file are created; they are integrated with the system boot process, and then the MMC example files are added.

More detailed descriptions are found in each individual patch description.

Boot-tested on OMAP3 Beagle and 3430SDP. Compile-tested on 2430SDP and N800.

Comments welcome and solicited.

- Paul

---

text data bss dec hex filename

3411061  192960  104048 3708069  3894a5 vmlinux.omap3beagle.old
3417637  194016  104080 3715733  38b295 vmlinux.omap3beagle

Paul Walmsley (8):
OMAP2430/34xx HSMMC: add basic omap_hwmod entries for OMAP2430/34xx
OMAP: omap_hwmod: call omap_hwmod initialization at boot OMAP2/3/4: create omap_hwmod layer
OMAP2/3/4 PRCM: add module IDLEST wait code
OMAP clock: associate MPU clocks with the mpu_clkdm OMAP2/3 clock: ensure each clock has a unique name
OMAP clock: add omap_clk_get_by_name()
OMAP2/3 board-*.c files: read bootloader configuration earlier

 arch/arm/mach-omap2/Makefile                 |    9 
 arch/arm/mach-omap2/board-2430sdp.c          |   19 
 arch/arm/mach-omap2/board-3430sdp.c          |   20 
 arch/arm/mach-omap2/board-apollon.c          |   20 
 arch/arm/mach-omap2/board-generic.c          |   14 
 arch/arm/mach-omap2/board-h4.c               |   20 
 arch/arm/mach-omap2/board-ldp.c              |   20 
 arch/arm/mach-omap2/board-omap2evm.c         |   20 
 arch/arm/mach-omap2/board-omap3beagle.c      |   24 
 arch/arm/mach-omap2/board-omap3evm.c         |   14 
 arch/arm/mach-omap2/board-omap3pandora.c     |   18 
 arch/arm/mach-omap2/board-overo.c            |   18 
 arch/arm/mach-omap2/board-rx51.c             |    4 
 arch/arm/mach-omap2/board-zoom2.c            |   18 
 arch/arm/mach-omap2/clock24xx.h              |   52 -
 arch/arm/mach-omap2/clock34xx.h              |   61 +
 arch/arm/mach-omap2/cm.c                     |   70 +
 arch/arm/mach-omap2/cm.h                     |    4 
 arch/arm/mach-omap2/cm4xxx.c                 |   68 +
 arch/arm/mach-omap2/io.c                     |   19 
 arch/arm/mach-omap2/omap_hwmod.c             | 1522 ++++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2420.h        |  140 ++
 arch/arm/mach-omap2/omap_hwmod_2430.h        |  285 +++++
 arch/arm/mach-omap2/omap_hwmod_34xx.h        |  399 +++++++
 arch/arm/mach-omap2/prm-regbits-34xx.h       |    8 
 arch/arm/mach-omap2/serial.c                 |    6 
 arch/arm/plat-omap/clock.c                   |   27 
 arch/arm/plat-omap/include/mach/clock.h      |    1 
 arch/arm/plat-omap/include/mach/l4_3xxx.h    |   24 
 arch/arm/plat-omap/include/mach/mmc.h        |    8 
 arch/arm/plat-omap/include/mach/omap_hwmod.h |  436 +++++++
 arch/arm/plat-omap/include/mach/serial.h     |    6 
 32 files changed, 3197 insertions(+), 177 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm.c
 create mode 100644 arch/arm/mach-omap2/cm4xxx.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod.c
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_2420.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_2430.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_34xx.h
 create mode 100644 arch/arm/plat-omap/include/mach/l4_3xxx.h
 create mode 100644 arch/arm/plat-omap/include/mach/omap_hwmod.h
author maintainer
#1 lore raw

PATCH 1/8 OMAP2/3 board-*.c files: read bootloader configuration earlier

Most board-*.c files read configuration data from the bootloader in their .init_machine() function. This needs to happen earlier, at some point before omap2_init_common_hw() is called. This is because a future patch will use the bootloader serial console port information to enable the UART clocks earlier, immediately after omap2_clk_init(). This is in turn necessary since otherwise clock tree usecounts on clocks like dpll4_m2x2_ck will be bogus, which can cause the currently-active console UART clock to be disabled during boot.

---
 arch/arm/mach-omap2/board-2430sdp.c      |   19 +++++++++----------
 arch/arm/mach-omap2/board-3430sdp.c      |   20 ++++++++++----------
 arch/arm/mach-omap2/board-apollon.c      |   20 ++++++++++----------
 arch/arm/mach-omap2/board-generic.c      |   14 +++++++-------
 arch/arm/mach-omap2/board-h4.c           |   20 ++++++++++----------
 arch/arm/mach-omap2/board-ldp.c          |   20 ++++++++++----------
 arch/arm/mach-omap2/board-omap2evm.c     |   20 ++++++++++----------
 arch/arm/mach-omap2/board-omap3beagle.c  |   24 ++++++++++++------------
 arch/arm/mach-omap2/board-omap3evm.c     |   14 +++++++-------
 arch/arm/mach-omap2/board-omap3pandora.c |   18 +++++++++---------
 arch/arm/mach-omap2/board-overo.c        |   18 +++++++++---------
 arch/arm/mach-omap2/board-rx51.c         |    4 ++--
 arch/arm/mach-omap2/board-zoom2.c        |   18 +++++++++---------
 arch/arm/mach-omap2/io.c                 |    2 ++
 arch/arm/mach-omap2/serial.c             |    6 +++++-
 arch/arm/plat-omap/include/mach/serial.h |    6 ++++++
 16 files changed, 127 insertions(+), 116 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +9 -10
index 899e6e3..c563768 100644
@@ -323,14 +323,6 @@ out:
 	clk_put(gpmc_fck);
 }
 
-static void __init omap_2430sdp_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-	sdp2430_init_smc91x();
-}
-
 static struct omap_uart_config sdp2430_uart_config __initdata = {
 	.enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -347,6 +339,15 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = {
 	{OMAP_TAG_SERIAL_CONSOLE, &sdp2430_serial_console_config},
 };
 
+static void __init omap_2430sdp_init_irq(void)
+{
+	omap_board_config = sdp2430_config;
+	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+	sdp2430_init_smc91x();
+}
 
 static struct twl4030_gpio_platform_data sdp2430_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
@@ -406,8 +407,6 @@ static void __init omap_2430sdp_init(void)
 	omap2430_i2c_init();
 
 	platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
-	omap_board_config = sdp2430_config;
-	omap_board_config_size = ARRAY_SIZE(sdp2430_config);
 	omap_serial_init();
 
 	msecure_init();
arch/arm/mach-omap2/board-3430sdp.c +10 -10
index 38550e2..26fa398 100644
@@ -296,14 +296,6 @@ static inline void __init sdp3430_init_smc91x(void)
 	gpio_direction_input(eth_gpio);
 }
 
-static void __init omap_3430sdp_init_irq(void)
-{
-	omap2_init_common_hw(hyb18m512160af6_sdrc_params);
-	omap_init_irq();
-	omap_gpio_init();
-	sdp3430_init_smc91x();
-}
-
 static struct omap_uart_config sdp3430_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -317,6 +309,16 @@ static struct omap_board_config_kernel sdp3430_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&sdp3430_lcd_config },
 };
 
+static void __init omap_3430sdp_init_irq(void)
+{
+	omap_board_config = sdp3430_config;
+	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
+	omap2_init_common_hw(hyb18m512160af6_sdrc_params);
+	omap_init_irq();
+	omap_gpio_init();
+	sdp3430_init_smc91x();
+}
+
 static int sdp3430_batt_table[] = {
 /* 0 C*/
 30800, 29500, 28300, 27100,
@@ -668,8 +670,6 @@ static void __init omap_3430sdp_init(void)
 {
 	omap3430_i2c_init();
 	platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
-	omap_board_config = sdp3430_config;
-	omap_board_config_size = ARRAY_SIZE(sdp3430_config);
 	if (omap_rev() > OMAP3430_REV_ES1_0)
 		ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2;
 	else
arch/arm/mach-omap2/board-apollon.c +10 -10
index 936cb49..3658587 100644
@@ -330,14 +330,6 @@ out:
 	clk_put(gpmc_fck);
 }
 
-static void __init omap_apollon_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-	apollon_init_smc91x();
-}
-
 static struct tsc210x_config tsc_platform_data = {
 	.use_internal		= 1,
 	.monitor		= TSC_TEMP,
@@ -376,6 +368,16 @@ static struct omap_board_config_kernel apollon_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&apollon_lcd_config },
 };
 
+static void __init omap_apollon_init_irq(void)
+{
+	omap_board_config = apollon_config;
+	omap_board_config_size = ARRAY_SIZE(apollon_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+	apollon_init_smc91x();
+}
+
 static void __init apollon_led_init(void)
 {
 	/* LED0 - AA10 */
@@ -506,8 +508,6 @@ static void __init omap_apollon_init(void)
 	 * if not needed.
 	 */
 	platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices));
-	omap_board_config = apollon_config;
-	omap_board_config_size = ARRAY_SIZE(apollon_config);
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_register_i2c_bus(2, 100, NULL, 0);
arch/arm/mach-omap2/board-generic.c +7 -7
index 0e353b3..7bb7722 100644
@@ -31,12 +31,6 @@
 #include <mach/board.h>
 #include <mach/common.h>
 
-static void __init omap_generic_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-}
-
 static struct omap_uart_config generic_uart_config __initdata = {
 	.enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -45,10 +39,16 @@ static struct omap_board_config_kernel generic_config[] __initdata = {
 	{ OMAP_TAG_UART,	&generic_uart_config },
 };
 
-static void __init omap_generic_init(void)
+static void __init omap_generic_init_irq(void)
 {
 	omap_board_config = generic_config;
 	omap_board_config_size = ARRAY_SIZE(generic_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+}
+
+static void __init omap_generic_init(void)
+{
 	omap_serial_init();
 	omap_register_i2c_bus(1, 100, NULL, 0);
 	omap_register_i2c_bus(2, 100, NULL, 0);
arch/arm/mach-omap2/board-h4.c +10 -10
index 6145139..66b527e 100644
@@ -358,14 +358,6 @@ static void __init h4_init_flash(void)
 	h4_flash_resource.end	= base + SZ_64M - 1;
 }
 
-static void __init omap_h4_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-	h4_init_flash();
-}
-
 static struct omap_uart_config h4_uart_config __initdata = {
 #ifdef	CONFIG_MACH_OMAP2_H4_USB1
 	.enabled_uarts = ((1 << 0) | (1 << 1)),
@@ -443,6 +435,16 @@ static struct omap_board_config_kernel h4_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&h4_lcd_config },
 };
 
+static void __init omap_h4_init_irq(void)
+{
+	omap_board_config = h4_config;
+	omap_board_config_size = ARRAY_SIZE(h4_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+	h4_init_flash();
+}
+
 #ifdef	CONFIG_MACH_OMAP_H4_TUSB
 
 #include <linux/usb/musb.h>
@@ -756,8 +758,6 @@ static void __init omap_h4_init(void)
 	omap_cfg_reg(W19_24XX_SYS_NIRQ);
 
 	platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
-	omap_board_config = h4_config;
-	omap_board_config_size = ARRAY_SIZE(h4_config);
 	omap_serial_init();
 	omap_usb_init(&h4_usb_config);
 	omap_register_i2c_bus(1, 100, h4_i2c_board_info,
arch/arm/mach-omap2/board-ldp.c +10 -10
index b79f989..8da85c1 100644
@@ -353,14 +353,6 @@ static inline void __init ldp_init_smsc911x(void)
 }
 
 
-static void __init omap_ldp_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-	ldp_init_smsc911x();
-}
-
 static struct omap_uart_config ldp_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -374,6 +366,16 @@ static struct omap_board_config_kernel ldp_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&ldp_lcd_config },
 };
 
+static void __init omap_ldp_init_irq(void)
+{
+	omap_board_config = ldp_config;
+	omap_board_config_size = ARRAY_SIZE(ldp_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+	ldp_init_smsc911x();
+}
+
 static int ldp_batt_table[] = {
 /* 0 C*/
 30800, 29500, 28300, 27100,
@@ -559,8 +561,6 @@ static void __init omap_ldp_init(void)
 {
 	omap_i2c_init();
 	platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
-	omap_board_config = ldp_config;
-	omap_board_config_size = ARRAY_SIZE(ldp_config);
 	ts_gpio = 54;
 	ldp_spi_board_info[0].irq = gpio_to_irq(ts_gpio);
 	spi_register_board_info(ldp_spi_board_info,
arch/arm/mach-omap2/board-omap2evm.c +10 -10
index 86477cc..3b80315 100644
@@ -278,14 +278,6 @@ static struct twl4030_keypad_data omap2evm_kp_data = {
 	.rep		= 1,
 };
 
-static void __init omap2_evm_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-	omap2evm_init_smc911x();
-}
-
 static struct omap_uart_config omap2_evm_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -295,6 +287,16 @@ static struct omap_board_config_kernel omap2_evm_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&omap2_evm_lcd_config },
 };
 
+static void __init omap2_evm_init_irq(void)
+{
+	omap_board_config = omap2_evm_config;
+	omap_board_config_size = ARRAY_SIZE(omap2_evm_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+	omap2evm_init_smc911x();
+}
+
 static struct twl4030_gpio_platform_data omap2evm_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
@@ -357,8 +359,6 @@ static void __init omap2_evm_init(void)
 	omap2_evm_i2c_init();
 
 	platform_add_devices(omap2_evm_devices, ARRAY_SIZE(omap2_evm_devices));
-	omap_board_config = omap2_evm_config;
-	omap_board_config_size = ARRAY_SIZE(omap2_evm_config);
 	spi_register_board_info(omap2evm_spi_board_info,
 				ARRAY_SIZE(omap2evm_spi_board_info));
 	omap_serial_init();
arch/arm/mach-omap2/board-omap3beagle.c +12 -12
index 19bc2a1..f40ed10 100644
@@ -306,16 +306,6 @@ static int __init omap3_beagle_i2c_init(void)
 	return 0;
 }
 
-static void __init omap3_beagle_init_irq(void)
-{
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
-	omap_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(12);
-#endif
-	omap_gpio_init();
-}
-
 static struct omap_lcd_config omap3_beagle_lcd_config __initdata = {
 	.ctrl_name	= "internal",
 };
@@ -378,6 +368,18 @@ static struct omap_board_config_kernel omap3_beagle_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&omap3_beagle_lcd_config },
 };
 
+static void __init omap3_beagle_init_irq(void)
+{
+	omap_board_config = omap3_beagle_config;
+	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap_init_irq();
+#ifdef CONFIG_OMAP_32K_TIMER
+	omap2_gp_clockevent_set_gptimer(12);
+#endif
+	omap_gpio_init();
+}
+
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&omap3_beagle_lcd_device,
 	&leds_gpio,
@@ -427,8 +429,6 @@ static void __init omap3_beagle_init(void)
 	omap3_beagle_i2c_init();
 	platform_add_devices(omap3_beagle_devices,
 			ARRAY_SIZE(omap3_beagle_devices));
-	omap_board_config = omap3_beagle_config;
-	omap_board_config_size = ARRAY_SIZE(omap3_beagle_config);
 	omap_serial_init();
 
 	omap_cfg_reg(J25_34XX_GPIO170);
arch/arm/mach-omap2/board-omap3evm.c +7 -7
index 6eb3c52..b7f5e1d 100644
@@ -279,19 +279,21 @@ struct spi_board_info omap3evm_spi_board_info[] = {
 	},
 };
 
+static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
+	{ OMAP_TAG_UART,	&omap3_evm_uart_config },
+	{ OMAP_TAG_LCD,		&omap3_evm_lcd_config },
+};
+
 static void __init omap3_evm_init_irq(void)
 {
+	omap_board_config = omap3_evm_config;
+	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
 	omap_init_irq();
 	omap_gpio_init();
 	omap3evm_init_smc911x();
 }
 
-static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
-	{ OMAP_TAG_UART,	&omap3_evm_uart_config },
-	{ OMAP_TAG_LCD,		&omap3_evm_lcd_config },
-};
-
 static struct platform_device *omap3_evm_devices[] __initdata = {
 	&omap3_evm_lcd_device,
 	&omap3evm_smc911x_device,
@@ -302,8 +304,6 @@ static void __init omap3_evm_init(void)
 	omap3_evm_i2c_init();
 
 	platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
-	omap_board_config = omap3_evm_config;
-	omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
 
 	spi_register_board_info(omap3evm_spi_board_info,
 				ARRAY_SIZE(omap3evm_spi_board_info));
arch/arm/mach-omap2/board-omap3pandora.c +9 -9
index c525b16..e8fa926 100644
@@ -263,13 +263,6 @@ static int __init omap3pandora_i2c_init(void)
 	return 0;
 }
 
-static void __init omap3pandora_init_irq(void)
-{
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
-	omap_init_irq();
-	omap_gpio_init();
-}
-
 static void __init omap3pandora_ads7846_init(void)
 {
 	int gpio = OMAP3_PANDORA_TS_GPIO;
@@ -333,6 +326,15 @@ static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&omap3pandora_lcd_config },
 };
 
+static void __init omap3pandora_init_irq(void)
+{
+	omap_board_config = omap3pandora_config;
+	omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap_init_irq();
+	omap_gpio_init();
+}
+
 static struct platform_device *omap3pandora_devices[] __initdata = {
 	&omap3pandora_lcd_device,
 };
@@ -342,8 +344,6 @@ static void __init omap3pandora_init(void)
 	omap3pandora_i2c_init();
 	platform_add_devices(omap3pandora_devices,
 			ARRAY_SIZE(omap3pandora_devices));
-	omap_board_config = omap3pandora_config;
-	omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
 	omap_serial_init();
 	spi_register_board_info(omap3pandora_spi_board_info,
 			ARRAY_SIZE(omap3pandora_spi_board_info));
arch/arm/mach-omap2/board-overo.c +9 -9
index 3a9c519..0462e99 100644
@@ -363,13 +363,6 @@ static int __init overo_i2c_init(void)
 	return 0;
 }
 
-static void __init overo_init_irq(void)
-{
-	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
-	omap_init_irq();
-	omap_gpio_init();
-}
-
 static struct platform_device overo_lcd_device = {
 	.name		= "overo_lcd",
 	.id		= -1,
@@ -384,6 +377,15 @@ static struct omap_board_config_kernel overo_config[] __initdata = {
 	{ OMAP_TAG_LCD,		&overo_lcd_config },
 };
 
+static void __init overo_init_irq(void)
+{
+	omap_board_config = overo_config;
+	omap_board_config_size = ARRAY_SIZE(overo_config);
+	omap2_init_common_hw(mt46h32m32lf6_sdrc_params);
+	omap_init_irq();
+	omap_gpio_init();
+}
+
 static struct platform_device *overo_devices[] __initdata = {
 	&overo_lcd_device,
 };
@@ -392,8 +394,6 @@ static void __init overo_init(void)
 {
 	overo_i2c_init();
 	platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
-	omap_board_config = overo_config;
-	omap_board_config_size = ARRAY_SIZE(overo_config);
 	omap_serial_init();
 	usb_musb_init();
 	usb_ehci_init();
arch/arm/mach-omap2/board-rx51.c +2 -2
index 5ee62f8..4714576 100644
@@ -62,6 +62,8 @@ static struct omap_board_config_kernel rx51_config[] = {
 
 static void __init rx51_init_irq(void)
 {
+	omap_board_config = rx51_config;
+	omap_board_config_size = ARRAY_SIZE(rx51_config);
 	omap2_init_common_hw(rx51_get_sdram_timings());
 	omap_init_irq();
 	omap_gpio_init();
@@ -72,8 +74,6 @@ extern void __init rx51_video_init(void);
 
 static void __init rx51_init(void)
 {
-	omap_board_config = rx51_config;
-	omap_board_config_size = ARRAY_SIZE(rx51_config);
 	omap_serial_init();
 	usb_musb_init();
 	rx51_peripherals_init();
arch/arm/mach-omap2/board-zoom2.c +9 -9
index 8535c3a..bce4c60 100644
@@ -23,13 +23,6 @@
 
 #include "mmc-twl4030.h"
 
-static void __init omap_zoom2_init_irq(void)
-{
-	omap2_init_common_hw(NULL);
-	omap_init_irq();
-	omap_gpio_init();
-}
-
 static struct omap_uart_config zoom2_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
@@ -38,6 +31,15 @@ static struct omap_board_config_kernel zoom2_config[] __initdata = {
 	{ OMAP_TAG_UART,	&zoom2_uart_config },
 };
 
+static void __init omap_zoom2_init_irq(void)
+{
+	omap_board_config = zoom2_config;
+	omap_board_config_size = ARRAY_SIZE(zoom2_config);
+	omap2_init_common_hw(NULL);
+	omap_init_irq();
+	omap_gpio_init();
+}
+
 static struct twl4030_gpio_platform_data zoom2_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
@@ -85,8 +87,6 @@ extern int __init omap_zoom2_debugboard_init(void);
 static void __init omap_zoom2_init(void)
 {
 	omap_i2c_init();
-	omap_board_config = zoom2_config;
-	omap_board_config_size = ARRAY_SIZE(zoom2_config);
 	omap_serial_init();
 	omap_zoom2_debugboard_init();
 	twl4030_mmc_init(mmc);
arch/arm/mach-omap2/io.c +2 -0
index 916fcd3..deb309a 100644
@@ -29,6 +29,7 @@
 #include <mach/sram.h>
 #include <mach/sdrc.h>
 #include <mach/gpmc.h>
+#include <mach/serial.h>
 
 #include "clock.h"
 
@@ -201,6 +202,7 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sp)
 	pwrdm_init(powerdomains_omap);
 	clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
 	omap2_clk_init();
+	omap_serial_early_init();
 	omap2_sdrc_init(sp);
 	gpmc_init();
 }
arch/arm/mach-omap2/serial.c +5 -1
index 3c2d325..352b88d 100644
@@ -106,7 +106,7 @@ static struct platform_device serial_device = {
 	},
 };
 
-void __init omap_serial_init(void)
+void __init omap_serial_early_init(void)
 {
 	int i;
 	const struct omap_uart_config *info;
@@ -150,6 +150,10 @@ void __init omap_serial_init(void)
 
 		omap_serial_reset(p);
 	}
+}
 
+void __init omap_serial_init(void)
+{
 	platform_device_register(&serial_device);
 }
+
arch/arm/plat-omap/include/mach/serial.h +6 -0
index 8a676a0..b34fa47 100644
@@ -10,6 +10,8 @@
 #ifndef __ASM_ARCH_SERIAL_H
 #define __ASM_ARCH_SERIAL_H
 
+#include <linux/init.h>
+
 #if defined(CONFIG_ARCH_OMAP1)
 /* OMAP1 serial ports */
 #define OMAP_UART1_BASE		0xfffb0000
@@ -40,4 +42,8 @@
 			__ret;						\
 			})
 
+#ifndef __ASSEMBLER__
+void __init omap_serial_early_init(void);
+#endif
+
 #endif
author maintainer
#2 lore raw

PATCH 2/8 OMAP clock: add omap_clk_get_by_name()

In reply to Paul Walmsley

After the recent clkdev conversion, struct clks are no longer locatable located by the struct clk name via clk_get(). Core code separate from the platform_device system needs to do this. This patch adds an omap_clk_get_by_name() function for this purpose.

---
 arch/arm/plat-omap/clock.c              |   27 +++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/clock.h |    1 +
 2 files changed, 28 insertions(+), 0 deletions(-)
arch/arm/plat-omap/clock.c +27 -0
index 29efc27..37db231 100644
@@ -300,6 +300,33 @@ void clk_enable_init_clocks(void)
 }
 EXPORT_SYMBOL(clk_enable_init_clocks);
 
+/**
+ * omap_clk_get_by_name - locate OMAP struct clk by its name
+ * @name: name of the struct clk to locate
+ *
+ * Locate an OMAP struct clk by its name.  Assumes that struct clk
+ * names are unique.  Returns NULL if not found or a pointer to the
+ * struct clk if found.
+ */
+struct clk *omap_clk_get_by_name(const char *name)
+{
+	struct clk *c;
+	struct clk *ret = NULL;
+
+	mutex_lock(&clocks_mutex);
+
+	list_for_each_entry(c, &clocks, node) {
+		if (!strcmp(c->name, name)) {
+			ret = c;
+			break;
+		}
+	}
+
+	mutex_unlock(&clocks_mutex);
+
+	return ret;
+}
+
 /*
  * Low level helpers
  */
arch/arm/plat-omap/include/mach/clock.h +1 -0
index 073a2c5..38e32d8 100644
@@ -130,6 +130,7 @@ extern void clk_enable_init_clocks(void);
 #ifdef CONFIG_CPU_FREQ
 extern void clk_init_cpufreq_table(struct cpufreq_frequency_table **table);
 #endif
+extern struct clk *omap_clk_get_by_name(const char *name);
 
 extern const struct clkops clkops_null;
 
author maintainer
#3 lore raw

PATCH 3/8 OMAP2/3 clock: ensure each clock has a unique name

In reply to Paul Walmsley

After the clkdev conversion, struct clk .name fields are free to be unique and to reflect the underlying hardware naming convention. This is important since it is useful for some core code that is unrelated to the platform_device subsystem, such as the clock debugfs code and the omap_hwmod code, to be able to address clocks by a single unique identifier, since platform drivers are only weakly bound to clocks. So, update all of the non-unique clock names in OMAP2/3 to be unique names. In the future it might be ideal to ensure that the names match the hardware information exactly, for ease of debugging and reference.

---
 arch/arm/mach-omap2/clock24xx.h |   52 +++++++++++++++++-----------------
 arch/arm/mach-omap2/clock34xx.h |   60 ++++++++++++++++++++-------------------
 2 files changed, 56 insertions(+), 56 deletions(-)
arch/arm/mach-omap2/clock24xx.h +26 -26
index 88c5acb..c0cc2ac 100644
@@ -1810,7 +1810,7 @@ static struct clk gpt12_fck = {
 };
 
 static struct clk mcbsp1_ick = {
-	.name		= "mcbsp_ick",
+	.name		= "mcbsp1_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &l4_ck,
@@ -1821,7 +1821,7 @@ static struct clk mcbsp1_ick = {
 };
 
 static struct clk mcbsp1_fck = {
-	.name		= "mcbsp_fck",
+	.name		= "mcbsp1_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_96m_ck,
@@ -1832,7 +1832,7 @@ static struct clk mcbsp1_fck = {
 };
 
 static struct clk mcbsp2_ick = {
-	.name		= "mcbsp_ick",
+	.name		= "mcbsp2_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &l4_ck,
@@ -1843,7 +1843,7 @@ static struct clk mcbsp2_ick = {
 };
 
 static struct clk mcbsp2_fck = {
-	.name		= "mcbsp_fck",
+	.name		= "mcbsp2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &func_96m_ck,
@@ -1854,7 +1854,7 @@ static struct clk mcbsp2_fck = {
 };
 
 static struct clk mcbsp3_ick = {
-	.name		= "mcbsp_ick",
+	.name		= "mcbsp3_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 3,
 	.parent		= &l4_ck,
@@ -1865,7 +1865,7 @@ static struct clk mcbsp3_ick = {
 };
 
 static struct clk mcbsp3_fck = {
-	.name		= "mcbsp_fck",
+	.name		= "mcbsp3_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 3,
 	.parent		= &func_96m_ck,
@@ -1876,7 +1876,7 @@ static struct clk mcbsp3_fck = {
 };
 
 static struct clk mcbsp4_ick = {
-	.name		= "mcbsp_ick",
+	.name		= "mcbsp4_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 4,
 	.parent		= &l4_ck,
@@ -1887,7 +1887,7 @@ static struct clk mcbsp4_ick = {
 };
 
 static struct clk mcbsp4_fck = {
-	.name		= "mcbsp_fck",
+	.name		= "mcbsp4_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 4,
 	.parent		= &func_96m_ck,
@@ -1898,7 +1898,7 @@ static struct clk mcbsp4_fck = {
 };
 
 static struct clk mcbsp5_ick = {
-	.name		= "mcbsp_ick",
+	.name		= "mcbsp5_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 5,
 	.parent		= &l4_ck,
@@ -1909,7 +1909,7 @@ static struct clk mcbsp5_ick = {
 };
 
 static struct clk mcbsp5_fck = {
-	.name		= "mcbsp_fck",
+	.name		= "mcbsp5_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 5,
 	.parent		= &func_96m_ck,
@@ -1920,7 +1920,7 @@ static struct clk mcbsp5_fck = {
 };
 
 static struct clk mcspi1_ick = {
-	.name		= "mcspi_ick",
+	.name		= "mcspi1_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &l4_ck,
@@ -1931,7 +1931,7 @@ static struct clk mcspi1_ick = {
 };
 
 static struct clk mcspi1_fck = {
-	.name		= "mcspi_fck",
+	.name		= "mcspi1_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_48m_ck,
@@ -1942,7 +1942,7 @@ static struct clk mcspi1_fck = {
 };
 
 static struct clk mcspi2_ick = {
-	.name		= "mcspi_ick",
+	.name		= "mcspi2_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &l4_ck,
@@ -1953,7 +1953,7 @@ static struct clk mcspi2_ick = {
 };
 
 static struct clk mcspi2_fck = {
-	.name		= "mcspi_fck",
+	.name		= "mcspi2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &func_48m_ck,
@@ -1964,7 +1964,7 @@ static struct clk mcspi2_fck = {
 };
 
 static struct clk mcspi3_ick = {
-	.name		= "mcspi_ick",
+	.name		= "mcspi3_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 3,
 	.parent		= &l4_ck,
@@ -1975,7 +1975,7 @@ static struct clk mcspi3_ick = {
 };
 
 static struct clk mcspi3_fck = {
-	.name		= "mcspi_fck",
+	.name		= "mcspi3_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 3,
 	.parent		= &func_48m_ck,
@@ -2303,7 +2303,7 @@ static struct clk hdq_fck = {
 };
 
 static struct clk i2c2_ick = {
-	.name		= "i2c_ick",
+	.name		= "i2c2_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &l4_ck,
@@ -2314,7 +2314,7 @@ static struct clk i2c2_ick = {
 };
 
 static struct clk i2c2_fck = {
-	.name		= "i2c_fck",
+	.name		= "i2c2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &func_12m_ck,
@@ -2325,7 +2325,7 @@ static struct clk i2c2_fck = {
 };
 
 static struct clk i2chs2_fck = {
-	.name		= "i2c_fck",
+	.name		= "i2chs2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 2,
 	.parent		= &func_96m_ck,
@@ -2336,7 +2336,7 @@ static struct clk i2chs2_fck = {
 };
 
 static struct clk i2c1_ick = {
-	.name		= "i2c_ick",
+	.name		= "i2c1_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &l4_ck,
@@ -2347,7 +2347,7 @@ static struct clk i2c1_ick = {
 };
 
 static struct clk i2c1_fck = {
-	.name		= "i2c_fck",
+	.name		= "i2c1_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_12m_ck,
@@ -2358,7 +2358,7 @@ static struct clk i2c1_fck = {
 };
 
 static struct clk i2chs1_fck = {
-	.name		= "i2c_fck",
+	.name		= "i2chs1_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_96m_ck,
@@ -2547,7 +2547,7 @@ static struct clk mmchs1_fck = {
 };
 
 static struct clk mmchs2_ick = {
-	.name		= "mmchs_ick",
+	.name		= "mmchs2_ick",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &l4_ck,
@@ -2558,7 +2558,7 @@ static struct clk mmchs2_ick = {
 };
 
 static struct clk mmchs2_fck = {
-	.name		= "mmchs_fck",
+	.name		= "mmchs2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_96m_ck,
@@ -2598,7 +2598,7 @@ static struct clk mdm_intc_ick = {
 };
 
 static struct clk mmchsdb1_fck = {
-	.name		= "mmchsdb_fck",
+	.name		= "mmchsdb1_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.parent		= &func_32k_ck,
 	.clkdm_name	= "core_l4_clkdm",
@@ -2608,7 +2608,7 @@ static struct clk mmchsdb1_fck = {
 };
 
 static struct clk mmchsdb2_fck = {
-	.name		= "mmchsdb_fck",
+	.name		= "mmchsdb2_fck",
 	.ops		= &clkops_omap2_dflt_wait,
 	.id		= 1,
 	.parent		= &func_32k_ck,
arch/arm/mach-omap2/clock34xx.h +30 -30

240 lines not on this page · raw message

author maintainer
#4 lore raw

PATCH 4/8 OMAP clock: associate MPU clocks with the mpu_clkdm

In reply to Paul Walmsley

All MPU-related clocks should be in the mpu_clkdm. This is needed for the upcoming omap_hwmod patches, which needs to know the clockdomain that arm_fck is in.

---
 arch/arm/mach-omap2/clock34xx.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.h +1 -0
index 1380563..8f58a97 100644
@@ -1018,6 +1018,7 @@ static struct clk arm_fck = {
 	.clksel_reg	= OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
 	.clksel_mask	= OMAP3430_ST_MPU_CLK_MASK,
 	.clksel		= arm_fck_clksel,
+	.clkdm_name	= "mpu_clkdm",
 	.recalc		= &omap2_clksel_recalc,
 };
 
author maintainer
#5 lore raw

PATCH 5/8 OMAP2/3/4 PRCM: add module IDLEST wait code

In reply to Paul Walmsley

After a hardware module's clocks are enabled, Linux must wait for it to indicate readiness via its IDLEST bit before attempting to access the device, otherwise register accesses to the device may trigger an abort. This has traditionally been implemented in the clock framework, but this is the wrong place for it: the clock framework doesn't know which module clocks must be enabled for a module to leave idle; and if a module is not in smart-idle mode, it may never leave idle at all. This type of information is best stored in a per-hardware module data structure (coming in a following patch), rather than a per-clock data structure. The new code will use these new functions to handle waiting for modules to enable.

Once hardware module data is filled in for all of the on-chip devices, the clock framework code to handle IDLEST waiting can be removed.

---
 arch/arm/mach-omap2/Makefile |    7 ++++
 arch/arm/mach-omap2/cm.c     |   70 ++++++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-omap2/cm.h     |    4 ++
 arch/arm/mach-omap2/cm4xxx.c |   68 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 148 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/cm.c
 create mode 100644 arch/arm/mach-omap2/cm4xxx.c
arch/arm/mach-omap2/Makefile +6 -1
index 5d01110..f1f3fae 100644
@@ -24,13 +24,18 @@ obj-y					+= pm.o
 obj-$(CONFIG_ARCH_OMAP24XX)		+= sleep24xx.o
 endif
 
+# PRCM
+obj-$(CONFIG_ARCH_OMAP2)		+= cm.o
+obj-$(CONFIG_ARCH_OMAP3)		+= cm.o
+obj-$(CONFIG_ARCH_OMAP4)		+= cm4xxx.o
+
 # Clock framework
 obj-$(CONFIG_ARCH_OMAP2)		+= clock24xx.o
 obj-$(CONFIG_ARCH_OMAP3)		+= clock34xx.o
 
 # DSP
 obj-$(CONFIG_OMAP_MBOX_FWK)	+= mailbox_mach.o
-mailbox_mach-objs		:= mailbox.o
+mailbox_mach-objs	:= mailbox.o
 
 # Specific board support
 obj-$(CONFIG_MACH_OMAP_GENERIC)		+= board-generic.o
arch/arm/mach-omap2/cm.c new file +70 -0

70 lines not on this page · raw message

arch/arm/mach-omap2/cm.h +4 -0
index 65fdf78..1366248 100644
@@ -102,6 +102,10 @@ extern u32 cm_read_mod_reg(s16 module, u16 idx);
 extern void cm_write_mod_reg(u32 val, s16 module, u16 idx);
 extern u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx);
 
+extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
+				      u8 idlest_shift);
+extern int omap4_cm_wait_module_ready(u32 prcm_mod, u8 prcm_dev_offs);
+
 static inline u32 cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
 {
 	return cm_rmw_mod_reg_bits(bits, bits, module, idx);
arch/arm/mach-omap2/cm4xxx.c new file +68 -0

68 lines not on this page · raw message

author maintainer
#6 lore raw

PATCH 6/8 OMAP2/3/4: create omap_hwmod layer

In reply to Paul Walmsley

OMAP SoCs can be considered a collection of hardware IP blocks connected by various interconnects. The bus topology and device integration data is somewhat more complex than platform_device can encode. This patch creates code and structures to manage information about OMAP on-chip devices ("hardware modules") and their integration to the rest of the chip. Hardware module data is intended to be generated dynamically from the TI hardware database for the OMAP4 chips and beyond, easing Linux support for new chip variants.

This code currently:

- resets and configures all hardware modules upon startup, reducing bootloader dependencies;

- provides hooks for Linux driver model code to enable, idle, and shutdown hardware modules (forthcoming patch);

- waits for hardware modules to leave idle once their clocks are enabled and OCP_SYSCONFIG bits are set appropriately.

- provides a means to pass arbitrary IP block configuration data (e.g., FIFO size) to the device driver (via the dev_attr void pointer)

In the future this code is intended to:

- estimate interconnect bandwidth and latency characteristics to ensure constraints are satisfied during DVFS

- provide *GRPSEL bit data to the powerdomain code

- handle pin/ball muxing for devices

- generate IO mapping information dynamically

- supply device firewall configuration data

- provide hardware module data to other on-chip coprocessor software

- allow the removal of the "disable unused clocks" code in the OMAP2/3 clock code

This patch represents a collaborative effort involving many people from TI, Nokia, and the Linux-OMAP community.

Cc Benoit Cousson <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Rajendra Nayak <[email protected]>
Cc Vikram Pandita <[email protected]>
Cc Sakari Poussa <[email protected]>
Cc Ansnd Sawant <[email protected]>
Cc Santosh Shilimkar <[email protected]>
Cc Eric Thomas <[email protected]>
Cc Richard Woodruff <[email protected]>
---
 arch/arm/mach-omap2/Makefile                 |    2 
 arch/arm/mach-omap2/omap_hwmod.c             | 1522 ++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/omap_hwmod.h |  436 +++++++
 3 files changed, 1959 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod.c
 create mode 100644 arch/arm/plat-omap/include/mach/omap_hwmod.h
arch/arm/mach-omap2/Makefile +1 -1
index f1f3fae..4509f8c 100644
@@ -5,7 +5,7 @@
 # Common support
 obj-y := irq.o id.o io.o sdrc.o control.o prcm.o clock.o mux.o \
 		devices.o serial.o gpmc.o timer-gp.o powerdomain.o \
-		clockdomain.o
+		clockdomain.o omap_hwmod.o
 
 obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
 
arch/arm/mach-omap2/omap_hwmod.c new file +1522 -0

1,522 lines not on this page · raw message

arch/arm/plat-omap/include/mach/omap_hwmod.h new file +436 -0

436 lines not on this page · raw message

author maintainer
#7 lore raw

PATCH 7/8 OMAP: omap_hwmod: call omap_hwmod initialization at boot

In reply to Paul Walmsley

Connect the omap_hwmod code to the kernel boot. Create some basic interconnect and device structures for OMAP2/3 chips.

---
 arch/arm/mach-omap2/io.c              |   17 +++
 arch/arm/mach-omap2/omap_hwmod_2420.h |  140 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_2430.h |  142 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_34xx.h |  167 +++++++++++++++++++++++++++++++++
 4 files changed, 465 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_2420.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_2430.h
 create mode 100644 arch/arm/mach-omap2/omap_hwmod_34xx.h
arch/arm/mach-omap2/io.c +16 -1
index deb309a..8f19623 100644
@@ -34,12 +34,16 @@
 #include "clock.h"
 
 #include <mach/powerdomain.h>
-
 #include "powerdomains.h"
 
 #include <mach/clockdomain.h>
 #include "clockdomains.h"
 
+#include <mach/omap_hwmod.h>
+#include "omap_hwmod_2420.h"
+#include "omap_hwmod_2430.h"
+#include "omap_hwmod_34xx.h"
+
 /*
  * The machine specific code may provide the extra mapping besides the
  * default mapping provided here.
@@ -198,11 +202,22 @@ void __init omap2_map_common_io(void)
 
 void __init omap2_init_common_hw(struct omap_sdrc_params *sp)
 {
+	struct omap_hwmod **hwmods = NULL;
+
+	if (cpu_is_omap2420())
+		hwmods = omap2420_hwmods;
+	else if (cpu_is_omap2430())
+		hwmods = omap2430_hwmods;
+	else if (cpu_is_omap34xx())
+		hwmods = omap34xx_hwmods;
+
+	omap_hwmod_init(hwmods);
 	omap2_mux_init();
 	pwrdm_init(powerdomains_omap);
 	clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
 	omap2_clk_init();
 	omap_serial_early_init();
+	omap_hwmod_late_init();
 	omap2_sdrc_init(sp);
 	gpmc_init();
 }
arch/arm/mach-omap2/omap_hwmod_2420.h new file +140 -0

140 lines not on this page · raw message

arch/arm/mach-omap2/omap_hwmod_2430.h new file +142 -0

142 lines not on this page · raw message

arch/arm/mach-omap2/omap_hwmod_34xx.h new file +167 -0

167 lines not on this page · raw message

author maintainer
#8 lore raw

PATCH 8/8 OMAP2430/34xx HSMMC: add basic omap_hwmod entries for OMAP2430/34xx

In reply to Paul Walmsley

Add basic HSMMC hardware modules for OMAP2430 and OMAP34xx.

The integration data is so similar between 2430 and 34xx in this case that these entries could almost be shared; that is probably worth investigating.

---
 arch/arm/mach-omap2/omap_hwmod_2430.h     |  143 ++++++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_34xx.h     |  236 +++++++++++++++++++++++++++++
 arch/arm/mach-omap2/prm-regbits-34xx.h    |    8 +
 arch/arm/plat-omap/include/mach/l4_3xxx.h |   24 +++
 arch/arm/plat-omap/include/mach/mmc.h     |    8 +
 5 files changed, 415 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/plat-omap/include/mach/l4_3xxx.h
arch/arm/mach-omap2/omap_hwmod_2430.h +143 -0
index 24e3521..0ae23f3 100644
@@ -21,6 +21,9 @@
 #include <mach/cpu.h>
 #include <mach/dma.h>
 
+#include <mach/mmc.h>
+
+#include "cm-regbits-24xx.h"
 #include "prm-regbits-24xx.h"
 
 static struct omap_hwmod omap2430_mpu_hwmod;
@@ -72,6 +75,43 @@ static struct omap_hwmod_ocp_if omap2430_l4_core__l4_wkup = {
 	.user	= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
+/* L4 CORE -> MMC1 interface */
+static struct omap_hwmod_addr_space omap2430_mmc1_addr_space[] = {
+	{
+		.pa_start	= OMAP2_MMC1_BASE,
+		.pa_end		= OMAP2_MMC1_BASE + 512 - 1,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc1 = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_mmc1_hwmod,
+	.interface_clk	= { .name = "mmchs1_ick" },
+	.addr		= omap2430_mmc1_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_mmc1_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+/* L4 CORE -> MMC2 interface */
+static struct omap_hwmod_addr_space omap2430_mmc2_addr_space[] = {
+	{
+		.pa_start	= OMAP2_MMC2_BASE,
+		.pa_end		= OMAP2_MMC2_BASE + 512 - 1,
+		.flags		= ADDR_TYPE_RT,
+	},
+};
+
+static struct omap_hwmod_ocp_if omap2430_l4_core__mmc2 = {
+	.master		= &omap2430_l4_core_hwmod,
+	.slave		= &omap2430_mmc2_hwmod,
+	.interface_clk	= { .name = "mmchs2_ick" },
+	.addr		= omap2430_mmc2_addr_space,
+	.addr_cnt	= ARRAY_SIZE(omap2430_mmc2_addr_space),
+	.user		= OCP_USER_MPU | OCP_USER_SDMA,
+};
+
+
 /* Slave interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
 	&omap2430_l3__l4_core,
@@ -80,6 +120,8 @@ static struct omap_hwmod_ocp_if *omap2430_l4_core_slaves[] = {
 /* Master interfaces on the L4_CORE interconnect */
 static struct omap_hwmod_ocp_if *omap2430_l4_core_masters[] = {
 	&omap2430_l4_core__l4_wkup,
+	&omap2430_l4_core__mmc1,
+	&omap2430_l4_core__mmc2,
 };
 
 /* L4 CORE */
@@ -125,6 +167,107 @@ static struct omap_hwmod omap2430_mpu_hwmod = {
 	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
 };
 
+/* MMC/SD/SDIO common */
+
+static struct omap_hwmod_sysconfig mmc_if_ctrl = {
+	.rev_offs	= 0x10,
+	.sysc_offs	= 0x14,
+	.sysc_flags	= (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE |
+			   SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET |
+			   SYSC_HAS_AUTOIDLE | SYSS_MISSING),
+	.idlemodes	= (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
+};
+
+/* MMC/SD/SDIO1 */
+
+static struct mmc_dev_attr mmc1_dev_attr = {
+	.flags = MMC_INTERNAL_XCVR,
+};
+
+static u8 mmc1_mpu_irqs[] = {
+	INT_24XX_MMC_IRQ,
+};
+
+static struct omap_hwmod_dma_info mmc1_sdma_chs[] = {
+	{ .name = "tx",	.dma_ch = OMAP24XX_DMA_MMC1_TX, },
+	{ .name = "rx",	.dma_ch = OMAP24XX_DMA_MMC1_RX, },
+};
+
+static struct omap_hwmod_opt_clk mmc1_opt_clks[] = {
+	{ .role = "dbck", .clk = { .name = "mmchsdb1_fck" } },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc1_slaves[] = {
+	&omap2430_l4_core__mmc1,
+};
+
+static struct omap_hwmod omap2430_mmc1_hwmod = {
+	.name		= "mmc1_hwmod",
+	.mpu_irqs	= mmc1_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc1_mpu_irqs),
+	.sdma_chs	= mmc1_sdma_chs,
+	.sdma_chs_cnt	= ARRAY_SIZE(mmc1_sdma_chs),
+	.opt_clks	= mmc1_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc1_opt_clks),
+	.main_clk	= { .name = "mmchs1_fck" },
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 2,
+			.module_bit  = OMAP2430_EN_MMCHS1_SHIFT,
+		},
+	},
+	.slaves		= omap2430_mmc1_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc1_slaves),
+	.sysconfig	= &mmc_if_ctrl,
+	.dev_attr	= &mmc1_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
+/* MMC/SD/SDIO2 */
+
+static struct mmc_dev_attr mmc2_dev_attr = {
+	.flags = MMC_SUPPORTS_EXTERNAL_XCVR,
+};
+
+static u8 mmc2_mpu_irqs[] = {
+	INT_24XX_MMC2_IRQ,
+};
+
+static struct omap_hwmod_dma_info mmc2_sdma_chs[] = {
+	{ .name = "tx",	.dma_ch = OMAP24XX_DMA_MMC2_TX, },
+	{ .name = "rx",	.dma_ch = OMAP24XX_DMA_MMC2_RX, },
+};
+
+static struct omap_hwmod_opt_clk mmc2_opt_clks[] = {
+	{ .role = "dbck", .clk = { .name = "mmchsdb2_fck" } },
+};
+
+static struct omap_hwmod_ocp_if *omap2430_mmc2_slaves[] = {
+	&omap2430_l4_core__mmc2,
+};
+
+static struct omap_hwmod omap2430_mmc2_hwmod = {
+	.name		= "mmc2_hwmod",
+	.mpu_irqs	= mmc2_mpu_irqs,
+	.mpu_irqs_cnt	= ARRAY_SIZE(mmc2_mpu_irqs),
+	.sdma_chs	= mmc2_sdma_chs,
+	.sdma_chs_cnt	= ARRAY_SIZE(mmc2_sdma_chs),
+	.opt_clks	= mmc2_opt_clks,
+	.opt_clks_cnt	= ARRAY_SIZE(mmc2_opt_clks),
+	.main_clk	= { .name = "mmchs2_fck" },
+	.prcm		= {
+		.omap2 = {
+			.prcm_reg_id = 2,
+			.module_bit  = OMAP2430_EN_MMCHS2_SHIFT,
+		},
+	},
+	.slaves		= omap2430_mmc2_slaves,
+	.slaves_cnt	= ARRAY_SIZE(omap2430_mmc2_slaves),
+	.sysconfig	= &mmc_if_ctrl,
+	.dev_attr	= &mmc2_dev_attr,
+	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
+};
+
 static __initdata struct omap_hwmod *omap2430_hwmods[] = {
 	&omap2430_l3_hwmod,
 	&omap2430_l4_core_hwmod,
arch/arm/mach-omap2/omap_hwmod_34xx.h +234 -2

274 lines not on this page · raw message

arch/arm/mach-omap2/prm-regbits-34xx.h +6 -2
index 9fd03a2..8533d74 100644
@@ -95,8 +95,12 @@
 #define OMAP3430_WKUP_EN					(1 << 0)
 
 /* PM_MPUGRPSEL1_CORE, PM_IVA2GRPSEL1_CORE shared bits */
-#define OMAP3430_GRPSEL_MMC2				(1 << 25)
-#define OMAP3430_GRPSEL_MMC1				(1 << 24)
+#define OMAP3430ES2_GRPSEL_MMC3_SHIFT			30
+#define OMAP3430ES2_GRPSEL_MMC3_MASK			(1 << 30)
+#define OMAP3430_GRPSEL_MMC2_SHIFT			25
+#define OMAP3430_GRPSEL_MMC2_MASK			(1 << 25)
+#define OMAP3430_GRPSEL_MMC1_SHIFT			24
+#define OMAP3430_GRPSEL_MMC1_MASK			(1 << 24)
 #define OMAP3430_GRPSEL_MCSPI4				(1 << 21)
 #define OMAP3430_GRPSEL_MCSPI3				(1 << 20)
 #define OMAP3430_GRPSEL_MCSPI2				(1 << 19)
arch/arm/plat-omap/include/mach/l4_3xxx.h new file +24 -0
new file mode 100644
index 0000000..06ead5c
@@ -0,0 +1,24 @@
+/*
+ * arch/arm/plat-omap/include/mach/l4_3xxx.h - L4 firewall definitions
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H
+#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_L4_3XXX_H
+
+/* L4 CORE */
+#define OMAP3_L4_CORE_FW_MMC1_REGION				39
+#define OMAP3_L4_CORE_FW_MMC1_TA_REGION				40
+#define OMAP3_L4_CORE_FW_MMC2_REGION				41
+#define OMAP3_L4_CORE_FW_MMC2_TA_REGION				42
+#define OMAP3_L4_CORE_FW_MMC3_REGION				98
+#define OMAP3_L4_CORE_FW_MMC3_TA_REGION				99
+
+#endif
arch/arm/plat-omap/include/mach/mmc.h +8 -0
index 81d5b36..4996a54 100644
@@ -36,6 +36,14 @@
 
 #define OMAP_MMC_MAX_SLOTS	2
 
+/* omap_hwmod integration data */
+#define MMC_INTERNAL_XCVR		(1 << 0)
+#define MMC_SUPPORTS_EXTERNAL_XCVR	(1 << 1)
+
+struct mmc_dev_attr {
+	u8 flags;
+};
+
 struct omap_mmc_platform_data {
 	/* back-link to device */
 	struct device *dev;