Skip to contentSkip to conversation

Some am3517 related patches [V3]

PATCH In review Stanley.Miao 4 participants 23 messages Apr 20, 2010 – May 13, 2010

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Some am3517 related patches [V3]

Changes from V2:
1, Again, removed the controversial patches.

Some am3517 related patches. The detaild changelog is below:

Stanley.Miao (7):
omap: fix the compile error if CONFIG_MTD_NAND_OMAP2 is not enabled
omap: remove one of the define of INT_34XX_BENCH_MPU_EMUL
AM3517: rename the i2c boardinfo to make it more readable
AM3517: initialize i2c subsystem after mux subsystem
OMAP: fix a gpmc nand problem
omap: init the gpio pinmux for mmc
omap hsmmc: fix the hsmmc driver for am3517.

 arch/arm/mach-omap2/board-am3517evm.c  |   24 ++++++++++++------------
 arch/arm/mach-omap2/devices.c          |    7 +++++++
 arch/arm/mach-omap2/gpmc-nand.c        |    3 +++
 arch/arm/mach-omap2/hsmmc.c            |   32 ++++++++++++++++++++++++--------
 arch/arm/plat-omap/include/plat/irqs.h |    2 --
 arch/arm/plat-omap/include/plat/nand.h |    7 +++++++
 6 files changed, 53 insertions(+), 22 deletions(-)
#1 lore raw

PATCH 1/7 omap: fix the compile error if CONFIG_MTD_NAND_OMAP2 is not enabled

If CONFIG_MTD_NAND_OMAP2 is not enabled, there will be a compile error, "gpmc_nand_init() is not defined". Add a inline noop function to fix it.

---
 arch/arm/plat-omap/include/plat/nand.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/nand.h +7 -0
index 6ba88d2..f8efd54 100644
@@ -29,4 +29,11 @@ struct omap_nand_platform_data {
 /* size (4 KiB) for IO mapping */
 #define	NAND_IO_SIZE	SZ_4K
 
+#if defined(CONFIG_MTD_NAND_OMAP2) || defined(CONFIG_MTD_NAND_OMAP2_MODULE)
 extern int gpmc_nand_init(struct omap_nand_platform_data *d);
+#else
+static inline int gpmc_nand_init(struct omap_nand_platform_data *d)
+{
+	return 0;
+}
+#endif
Signature · 1 line
1.5.4.3
maintainer
#2 lore raw

PATCH 1/7 omap: fix the compile error if CONFIG_MTD_NAND_OMAP2 is

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): b25b5176cd0fc3880c4f79fe16721a209a19dc2c

PatchWorks
http://patchwork.kernel.org/patch/93609/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=b25b5176cd0fc3880c4f79fe16721a209a19dc2c

#3 lore raw

PATCH 2/7 omap: remove one of the define of INT_34XX_BENCH_MPU_EMUL

In reply to Stanley.Miao

INT_34XX_BENCH_MPU_EMUL was defined twice, another is at Line 312.

---
 arch/arm/plat-omap/include/plat/irqs.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/plat-omap/include/plat/irqs.h +0 -2
index b65088a..4017019 100644
@@ -345,8 +345,6 @@
 #define INT_34XX_MMC3_IRQ	94
 #define INT_34XX_GPT12_IRQ	95
 
-#define	INT_34XX_BENCH_MPU_EMUL	3
-
 #define INT_35XX_HECC0_IRQ		24
 #define INT_35XX_HECC1_IRQ		28
 #define INT_35XX_EMAC_C0_RXTHRESH_IRQ	67
Signature · 1 line
1.5.4.3
maintainer
#4 lore raw

PATCH 2/7 omap: remove one of the define of

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): ff1b3f874262c46ee4b7178b2246c8d205b4469f

PatchWorks
http://patchwork.kernel.org/patch/93611/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=ff1b3f874262c46ee4b7178b2246c8d205b4469f

#5 lore raw

PATCH 3/7 AM3517: rename the i2c boardinfo to make it more readable

In reply to Stanley.Miao

There are three i2c buses on am3517, now rename these three boardinfo structure name to am3517evm_i2c1_boardinfo, am3517evm_i2c2_boardinfo, and am3517evm_i2c3_boardinfo, to make it more readable.

---
 arch/arm/mach-omap2/board-am3517evm.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +10 -10
index 6ae8805..3acfcae 100644
@@ -39,7 +39,7 @@
 #define LCD_PANEL_BKLIGHT_PWR	182
 #define LCD_PANEL_PWM		181
 
-static struct i2c_board_info __initdata am3517evm_i2c_boardinfo[] = {
+static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("s35390a", 0x30),
 		.type		= "s35390a",
@@ -69,7 +69,7 @@ static void __init am3517_evm_rtc_init(void)
 		gpio_free(GPIO_RTCS35390A_IRQ);
 		return;
 	}
-	am3517evm_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
+	am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
 }
 
 /*
@@ -80,7 +80,7 @@ static void __init am3517_evm_rtc_init(void)
 static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 };
-static struct i2c_board_info __initdata am3517evm_tca6416_info_0[] = {
+static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tca6416", 0x21),
 		.platform_data = &am3517evm_gpio_expander_info_0,
@@ -94,7 +94,7 @@ static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_1 = {
 static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES + 32,
 };
-static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = {
+static struct i2c_board_info __initdata am3517evm_i2c3_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tca6416", 0x20),
 		.platform_data = &am3517evm_ui_gpio_expander_info_1,
@@ -108,10 +108,10 @@ static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = {
 static int __init am3517_evm_i2c_init(void)
 {
 	omap_register_i2c_bus(1, 400, NULL, 0);
-	omap_register_i2c_bus(2, 400, am3517evm_tca6416_info_0,
-			ARRAY_SIZE(am3517evm_tca6416_info_0));
-	omap_register_i2c_bus(3, 400, am3517evm_ui_tca6416_info,
-			ARRAY_SIZE(am3517evm_ui_tca6416_info));
+	omap_register_i2c_bus(2, 400, am3517evm_i2c2_boardinfo,
+			ARRAY_SIZE(am3517evm_i2c2_boardinfo));
+	omap_register_i2c_bus(3, 400, am3517evm_i2c3_boardinfo,
+			ARRAY_SIZE(am3517evm_i2c3_boardinfo));
 
 	return 0;
 }
@@ -311,8 +311,8 @@ static void __init am3517_evm_init(void)
 	/* RTC - S35390A */
 	am3517_evm_rtc_init();
 
-	i2c_register_board_info(1, am3517evm_i2c_boardinfo,
-				ARRAY_SIZE(am3517evm_i2c_boardinfo));
+	i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
+				ARRAY_SIZE(am3517evm_i2c1_boardinfo));
 }
 
 static void __init am3517_evm_map_io(void)
Signature · 1 line
1.5.4.3
#6 lore raw

Re: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Hi,

arch/arm/mach-omap2/board-am3517evm.c static void __init am3517_evm_init(void) · line 315

Quoted 8 lines · ext Stanley.Miao
arch/arm/mach-omap2/board-am3517evm.c +2 -2
@@ -311,8 +311,8 @@ static void __init am3517_evm_init(void)
 	/* RTC - S35390A */
 	am3517_evm_rtc_init();
 
-	i2c_register_board_info(1, am3517evm_i2c_boardinfo,
-				ARRAY_SIZE(am3517evm_i2c_boardinfo));
+	i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
+				ARRAY_SIZE(am3517evm_i2c1_boardinfo));

I'm curious why isn't this together with the other busses ??

Signature · 1 line
balbi
#7 lore raw

Re: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Quoted 7 lines · Felipe Balbi

Hi,

Quoted 4 lines · ext Stanley.Miao
arch/arm/mach-omap2/board-am3517evm.c +0 -0
@@ -311,8 +311,8 @@ static void __init am3517_evm_init(void)
 /* RTC - S35390A */
 am3517_evm_rtc_init();
 
Quoted 7 lines

arch/arm/mach-omap2/board-am3517evm.c static void __init am3517_evm_init(void) · line 315

Quoted 4 lines
arch/arm/mach-omap2/board-am3517evm.c +2 -2
- i2c_register_board_info(1, am3517evm_i2c_boardinfo,
- ARRAY_SIZE(am3517evm_i2c_boardinfo));
+ i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
+ ARRAY_SIZE(am3517evm_i2c1_boardinfo));

I'm curious why isn't this together with the other busses ??

rtc s35390a is on i2c1 bus. am3517_evm_rtc_init() will initialize the IRQ(a gpio pin). So i2c_register_board_info have to be put after am3517_evm_rtc_init.

Stanley.

#8 lore raw

RE: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

In reply to Felipe Balbi
Quoted 17 lines

-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, April 20, 2010 12:01 PM
To: ext Stanley.Miao
Cc: [email protected]; [email protected]; Hiremath, Vaibhav; Govindarajan, Sriramakrishnan; Aggarwal, Anuj
Subject: Re: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Hi,

Quoted 4 lines · ext Stanley.Miao
arch/arm/mach-omap2/board-am3517evm.c +0 -0
@@ -311,8 +311,8 @@ static void __init am3517_evm_init(void)
 	/* RTC - S35390A */
 	am3517_evm_rtc_init();
 
Quoted 7 lines

arch/arm/mach-omap2/board-am3517evm.c static void __init am3517_evm_init(void) · line 315

Quoted 4 lines
arch/arm/mach-omap2/board-am3517evm.c +2 -2
-	i2c_register_board_info(1, am3517evm_i2c_boardinfo,
-				ARRAY_SIZE(am3517evm_i2c_boardinfo));
+	i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
+				ARRAY_SIZE(am3517evm_i2c1_boardinfo));

I'm curious why isn't this together with the other busses ??

[Hiremath, Vaibhav] Filipe,

This is because we need to assign IRQ number of GPIO 55 for RTC.

Thanks,
Vaibhav

Quoted 2 lines

--
balbi

Acked-by on v1 3/7
#9 lore raw

RE: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

In reply to Stanley.Miao

\

Quoted 9 lines

-----Original Message-----
From: Stanley.Miao [mailto:[email protected]]
Sent: Tuesday, April 20, 2010 12:03 PM
To: [email protected]
Cc: [email protected]; Hiremath, Vaibhav; Govindarajan, Sriramakrishnan; Aggarwal, Anuj
Subject: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Quoted 4 lines

There are three i2c buses on am3517, now rename these three boardinfo structure name to am3517evm_i2c1_boardinfo, am3517evm_i2c2_boardinfo, and am3517evm_i2c3_boardinfo, to make it more readable.

[Hiremath, Vaibhav] Since we haven't had any objection/suggestion to follow naming convention based on i2C indexes, I think we can merge this patch.

Thanks,
Vaibhav

Quoted 76 lines
---
 arch/arm/mach-omap2/board-am3517evm.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-omap2/board-am3517evm.c +0 -0

omap2/board-am3517evm.c
index 6ae8805..3acfcae 100644

arch/arm/mach-omap2/board-am3517evm.c +4 -4
@@ -39,7 +39,7 @@
 #define LCD_PANEL_BKLIGHT_PWR	182
 #define LCD_PANEL_PWM		181
 
-static struct i2c_board_info __initdata am3517evm_i2c_boardinfo[] = {
+static struct i2c_board_info __initdata am3517evm_i2c1_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("s35390a", 0x30),
 		.type		= "s35390a",
@@ -69,7 +69,7 @@ static void __init am3517_evm_rtc_init(void)
 		gpio_free(GPIO_RTCS35390A_IRQ);
 		return;
 	}
-	am3517evm_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
+	am3517evm_i2c1_boardinfo[0].irq = gpio_to_irq(GPIO_RTCS35390A_IRQ);
 }
 
 /*
@@ -80,7 +80,7 @@ static void __init am3517_evm_rtc_init(void)
 static struct pca953x_platform_data am3517evm_gpio_expander_info_0 = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 };
-static struct i2c_board_info __initdata am3517evm_tca6416_info_0[] = {
+static struct i2c_board_info __initdata am3517evm_i2c2_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tca6416", 0x21),
 		.platform_data = &am3517evm_gpio_expander_info_0,
@@ -94,7 +94,7 @@ static struct pca953x_platform_data
 am3517evm_ui_gpio_expander_info_1 = {
 static struct pca953x_platform_data am3517evm_ui_gpio_expander_info_2 = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES + 32,
 };
-static struct i2c_board_info __initdata am3517evm_ui_tca6416_info[] = {
+static struct i2c_board_info __initdata am3517evm_i2c3_boardinfo[] = {
 	{
 		I2C_BOARD_INFO("tca6416", 0x20),
arch/arm/mach-omap2/board-am3517evm.c +4 -4
 		.platform_data = &am3517evm_ui_gpio_expander_info_1,
@@ -108,10 +108,10 @@ static struct i2c_board_info __initdata
 am3517evm_ui_tca6416_info[] = {
 static int __init am3517_evm_i2c_init(void)
 {
 	omap_register_i2c_bus(1, 400, NULL, 0);
-	omap_register_i2c_bus(2, 400, am3517evm_tca6416_info_0,
-			ARRAY_SIZE(am3517evm_tca6416_info_0));
-	omap_register_i2c_bus(3, 400, am3517evm_ui_tca6416_info,
-			ARRAY_SIZE(am3517evm_ui_tca6416_info));
+	omap_register_i2c_bus(2, 400, am3517evm_i2c2_boardinfo,
+			ARRAY_SIZE(am3517evm_i2c2_boardinfo));
+	omap_register_i2c_bus(3, 400, am3517evm_i2c3_boardinfo,
+			ARRAY_SIZE(am3517evm_i2c3_boardinfo));
 
 	return 0;

}

arch/arm/mach-omap2/board-am3517evm.c +2 -3
@@ -311,8 +311,8 @@ static void __init am3517_evm_init(void)
 	/* RTC - S35390A */
 	am3517_evm_rtc_init();
 
-	i2c_register_board_info(1, am3517evm_i2c_boardinfo,
-				ARRAY_SIZE(am3517evm_i2c_boardinfo));
+	i2c_register_board_info(1, am3517evm_i2c1_boardinfo,
+				ARRAY_SIZE(am3517evm_i2c1_boardinfo));
 }
 
 static void __init am3517_evm_map_io(void)
--

1.5.4.3

maintainer
#10 lore raw

Re: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Quoted 11 lines · Hiremath, Vaibhav

\

Quoted 9 lines

-----Original Message-----
From: Stanley.Miao [mailto:[email protected]]
Sent: Tuesday, April 20, 2010 12:03 PM
To: [email protected]
Cc: [email protected]; Hiremath, Vaibhav; Govindarajan, Sriramakrishnan; Aggarwal, Anuj
Subject: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Quoted 7 lines
Quoted 4 lines

There are three i2c buses on am3517, now rename these three boardinfo structure name to am3517evm_i2c1_boardinfo, am3517evm_i2c2_boardinfo, and am3517evm_i2c3_boardinfo, to make it more readable.

[Hiremath, Vaibhav] Since we haven't had any objection/suggestion to follow naming convention based on i2C indexes, I think we can merge this patch.

Looks like this needs to be refreshed against the current omap-for-linus branch to apply.

Regards,

Tony

#11 lore raw

Re: [PATCH 3/7] AM3517: rename the i2c boardinfo to make it more readable

Quoted 9 lines · Tony Lindgren
Quoted 7 lines · Hiremath, Vaibhav

<snip>

Quoted 6 lines

There are three i2c buses on am3517, now rename these three boardinfo structure name to am3517evm_i2c1_boardinfo, am3517evm_i2c2_boardinfo, and am3517evm_i2c3_boardinfo, to make it more readable.

Quoted 8 lines
Quoted 4 lines

[Hiremath, Vaibhav] Since we haven't had any objection/suggestion to follow naming convention based on i2C indexes, I think we can merge this patch.

Looks like this needs to be refreshed against the current omap-for-linus branch to apply.

OK, I will re-send it soon.

Stanley.

Quoted 5 lines

Regards,

Tony

#12 lore raw

PATCH 4/7 AM3517: initialize i2c subsystem after mux subsystem

In reply to Stanley.Miao

The initialize of i2c subsystem will set pinmux, so it should be done after the initialize of mux subsystem initialization.

---
 arch/arm/mach-omap2/board-am3517evm.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/board-am3517evm.c +2 -2
index 3acfcae..cd031c9 100644
@@ -294,9 +294,9 @@ static struct omap_board_mux board_mux[] __initdata = {
 
 static void __init am3517_evm_init(void)
 {
-	am3517_evm_i2c_init();
-
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
+
+	am3517_evm_i2c_init();
 	platform_add_devices(am3517_evm_devices,
 				ARRAY_SIZE(am3517_evm_devices));
 
Signature · 1 line
1.5.4.3
maintainer
#13 lore raw

PATCH 4/7 AM3517: initialize i2c subsystem after mux subsystem

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): c48bdf43609d0dd3f25918b0870029c47bb0e699

PatchWorks
http://patchwork.kernel.org/patch/93616/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=c48bdf43609d0dd3f25918b0870029c47bb0e699

#14 lore raw

PATCH 5/7 OMAP: fix a gpmc nand problem

In reply to Stanley.Miao

If gpmc_t isn't given, we don't need to set timing for gpmc, or it will cause a Oops.

---
 arch/arm/mach-omap2/gpmc-nand.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/gpmc-nand.c +3 -0
index 64d74f0..e57fb29 100644
@@ -39,6 +39,9 @@ static int omap2_nand_gpmc_retime(void)
 	struct gpmc_timings t;
 	int err;
 
+	if (!gpmc_nand_data->gpmc_t)
+		return 0;
+
 	memset(&t, 0, sizeof(t));
 	t.sync_clk = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->sync_clk);
 	t.cs_on = gpmc_round_ns_to_ticks(gpmc_nand_data->gpmc_t->cs_on);
Signature · 1 line
1.5.4.3
maintainer
#15 lore raw

PATCH 5/7 OMAP: fix a gpmc nand problem

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: omap-fixes

Initial commit ID (Likely to change): 3449f462b56f7d3d3328cf2ed0948c3e5f022666

PatchWorks
http://patchwork.kernel.org/patch/93613/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=3449f462b56f7d3d3328cf2ed0948c3e5f022666

#16 lore raw

PATCH 6/7 omap: init the gpio pinmux for mmc

In reply to Stanley.Miao

There is two gpio for mmc use, one is for card detecting, another is used for checking write protect. Intialize its pinmux in case the bootloader doesn't set it.

---
 arch/arm/mach-omap2/devices.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +7 -0
index 23e4d77..df9c62a 100644
@@ -591,6 +591,13 @@ static inline void omap_hsmmc_reset(void) {}
 static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
 {
+	if (mmc_controller->slots[0].switch_pin > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
+					OMAP_PIN_INPUT_PULLUP);
+	if (mmc_controller->slots[0].gpio_wp > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
+					OMAP_PIN_INPUT_PULLUP);
+
 	if (cpu_is_omap2420() && controller_nr == 0) {
 		omap_cfg_reg(H18_24XX_MMC_CMD);
 		omap_cfg_reg(H15_24XX_MMC_CLKI);
Signature · 1 line
1.5.4.3
maintainer
#17 lore raw

Re: [PATCH 6/7] omap: init the gpio pinmux for mmc

Quoted 17 lines · Stanley.Miao

There is two gpio for mmc use, one is for card detecting, another is used for checking write protect. Intialize its pinmux in case the bootloader doesn't set it.

---
 arch/arm/mach-omap2/devices.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +0 -0
index 23e4d77..df9c62a 100644
@@ -591,6 +591,13 @@ static inline void omap_hsmmc_reset(void) {}
 static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
 {

arch/arm/mach-omap2/devices.c static inline void omap_hsmmc_reset(void) {} · line 603

Quoted 10 lines
arch/arm/mach-omap2/devices.c +7 -0
+	if (mmc_controller->slots[0].switch_pin > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
+					OMAP_PIN_INPUT_PULLUP);
+	if (mmc_controller->slots[0].gpio_wp > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
+					OMAP_PIN_INPUT_PULLUP);
+
 	if (cpu_is_omap2420() && controller_nr == 0) {
 		omap_cfg_reg(H18_24XX_MMC_CMD);
 		omap_cfg_reg(H15_24XX_MMC_CLKI);

The problem I see with this patch is that it attempts to mux even for the GPIO pins on the companion chips, such as twl4030.

Got any ideas on how to prevent that?

Tony

#18 lore raw

Re: [PATCH 6/7] omap: init the gpio pinmux for mmc

Quoted 34 lines · Tony Lindgren
Quoted 18 lines · Stanley.Miao

There is two gpio for mmc use, one is for card detecting, another is used for checking write protect. Intialize its pinmux in case the bootloader doesn't set it.

---
 arch/arm/mach-omap2/devices.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +0 -0
index 23e4d77..df9c62a 100644
@@ -591,6 +591,13 @@ static inline void omap_hsmmc_reset(void) {}
 static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
 			int controller_nr)
 {

arch/arm/mach-omap2/devices.c static inline void omap_hsmmc_reset(void) {} · line 603

Quoted 10 lines
arch/arm/mach-omap2/devices.c +7 -0
+	if (mmc_controller->slots[0].switch_pin > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
+					OMAP_PIN_INPUT_PULLUP);
+	if (mmc_controller->slots[0].gpio_wp > 0)
+		omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
+					OMAP_PIN_INPUT_PULLUP);
+
 	if (cpu_is_omap2420() && controller_nr == 0) {
 		omap_cfg_reg(H18_24XX_MMC_CMD);
 		omap_cfg_reg(H15_24XX_MMC_CLKI);

The problem I see with this patch is that it attempts to mux even for the GPIO pins on the companion chips, such as twl4030.

Quoted 2 lines

Got any ideas on how to prevent that?

Hi, Tony,

The gpios on companion chips are greater than OMAP_MAX_GPIO_LINES, they are not defined in mux34xx.c, so omap_mux_init_gpio will do nothing.

However, I will add "if(gpio_wp < OMAP_MAX_GPIO_LINES)" to prevent from invoking omap_mux_init_gpio().

Stanley.

Quoted 3 lines

Tony

#19 lore raw

PATCH 7/7 omap hsmmc: fix the hsmmc driver for am3517.

In reply to Stanley.Miao

AM3517 don't have the register OMAP343X_CONTROL_PBIAS_LITE and the regulators like "vmmc", so we set a noop "set_power" function for it.

---
 arch/arm/mach-omap2/hsmmc.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/hsmmc.c +24 -8
index 9ad2295..5f46797 100644
@@ -139,6 +139,12 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
 	}
 }
 
+static int am3517_mmc_set_power(struct device *dev, int slot, int power_on,
+								int vdd)
+{
+	return 0;
+}
+
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
@@ -150,7 +156,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 	if (cpu_is_omap2430()) {
 		control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
-	} else {
+	} else if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
 		control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
 	}
@@ -216,12 +222,25 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 		 */
 		mmc->slots[0].ocr_mask = c->ocr_mask;
 
+		if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
+			switch (c->mmc) {
+			case 1:
+				/* on-chip level shifting via PBIAS0/PBIAS1 */
+				mmc->slots[0].before_set_reg = hsmmc1_before_set_reg;
+				mmc->slots[0].after_set_reg = hsmmc1_after_set_reg;
+				break;
+			case 2:
+			case 3:
+				/* off-chip level shifting, or none */
+				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].after_set_reg = NULL;
+				break;
+			}
+		} else /* cpu_is_omap3517() || cpu_is_omap3505() */
+			mmc->slots[0].set_power = am3517_mmc_set_power;
+
 		switch (c->mmc) {
 		case 1:
-			/* on-chip level shifting via PBIAS0/PBIAS1 */
-			mmc->slots[0].before_set_reg = hsmmc1_before_set_reg;
-			mmc->slots[0].after_set_reg = hsmmc1_after_set_reg;
-
 			/* Omap3630 HSMMC1 supports only 4-bit */
 			if (cpu_is_omap3630() && c->wires > 4) {
 				c->wires = 4;
@@ -235,9 +254,6 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 				c->wires = 4;
 			/* FALLTHROUGH */
 		case 3:
-			/* off-chip level shifting, or none */
-			mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
-			mmc->slots[0].after_set_reg = NULL;
 			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
Signature · 1 line
1.5.4.3
maintainer
#20 lore raw

Re: [PATCH 7/7] omap hsmmc: fix the hsmmc driver for am3517.

Hi,

Some requests to make this more future proof.

Quoted 13 lines · Stanley.Miao

AM3517 don't have the register OMAP343X_CONTROL_PBIAS_LITE and the regulators like "vmmc", so we set a noop "set_power" function for it.

---
 arch/arm/mach-omap2/hsmmc.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/hsmmc.c +0 -0
index 9ad2295..5f46797 100644

arch/arm/mach-omap2/hsmmc.c static void hsmmc23_before_set_reg(struct device *dev, int slot, · line 147

Quoted 9 lines
arch/arm/mach-omap2/hsmmc.c +6 -0
@@ -139,6 +139,12 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
 	}
 }
 
+static int am3517_mmc_set_power(struct device *dev, int slot, int power_on,
+								int vdd)
+{
+	return 0;
+}
+

Please rename this to nop_mmc_set_power or similar. Other omaps may need it too.

arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) · line 162

Quoted 12 lines
arch/arm/mach-omap2/hsmmc.c +1 -1
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 
 void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
@@ -150,7 +156,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 	if (cpu_is_omap2430()) {
 		control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
-	} else {
+	} else if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
 		control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
 	}

Let's get rid of multiple cpu_is_omapxxxx tests please. Could you please update this along the lines of something like this:

#define HSMMC_HAS_PBIAS (1 << 0)
#define HSMMC_HAS_WHATEVER (1 << 1)
...

	if (!(cpu_is_omap3517() || cpu_is_omap3505())
		mmc->slots[i].features |= HSMMC_HAS_PBIAS;
Quoted 11 lines
arch/arm/mach-omap2/hsmmc.c +7 -0
@@ -216,12 +222,25 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 		 */
 		mmc->slots[0].ocr_mask = c->ocr_mask;
 
+		if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
+			switch (c->mmc) {
+			case 1:
+				/* on-chip level shifting via PBIAS0/PBIAS1 */
+				mmc->slots[0].before_set_reg = hsmmc1_before_set_reg;
+				mmc->slots[0].after_set_reg = hsmmc1_after_set_reg;
+				break;

arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) · line 241

Quoted 10 lines
arch/arm/mach-omap2/hsmmc.c +10 -0
+			case 2:
+			case 3:
+				/* off-chip level shifting, or none */
+				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].after_set_reg = NULL;
+				break;
+			}
+		} else /* cpu_is_omap3517() || cpu_is_omap3505() */
+			mmc->slots[0].set_power = am3517_mmc_set_power;
+

Then you can test for that flag here too. When new omaps get added, it just a question of setting the features flags right.

Regards,

Tony

#21 lore raw

Re: [PATCH 7/7] omap hsmmc: fix the hsmmc driver for am3517.

Quoted 22 lines · Tony Lindgren

Hi,

Some requests to make this more future proof.

Quoted 16 lines · Stanley.Miao

AM3517 don't have the register OMAP343X_CONTROL_PBIAS_LITE and the regulators like "vmmc", so we set a noop "set_power" function for it.

---
 arch/arm/mach-omap2/hsmmc.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/hsmmc.c +0 -0
index 9ad2295..5f46797 100644
@@ -139,6 +139,12 @@ static void hsmmc23_before_set_reg(struct device *dev, int slot,
 	}
 }
 
Quoted 11 lines

arch/arm/mach-omap2/hsmmc.c static void hsmmc23_before_set_reg(struct device *dev, int slot, · line 149

Quoted 7 lines
arch/arm/mach-omap2/hsmmc.c +6 -0
+static int am3517_mmc_set_power(struct device *dev, int slot, int power_on,
+								int vdd)
+{
+	return 0;
+}
+
 

Please rename this to nop_mmc_set_power or similar. Other omaps may need it too.

Accepted.

Quoted 18 lines
Quoted 6 lines
arch/arm/mach-omap2/hsmmc.c +0 -0
 static struct omap_mmc_platform_data *hsmmc_data[OMAP34XX_NR_MMC] __initdata;
 

void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)

arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) · line 162

Quoted 8 lines
arch/arm/mach-omap2/hsmmc.c +1 -1
@@ -150,7 +156,7 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 	if (cpu_is_omap2430()) {
 		control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP243X_CONTROL_DEVCONF1;
-	} else {
+	} else if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
 		control_pbias_offset = OMAP343X_CONTROL_PBIAS_LITE;
 		control_devconf1_offset = OMAP343X_CONTROL_DEVCONF1;
 	}

Let's get rid of multiple cpu_is_omapxxxx tests please. Could you please update this along the lines of something like this:

Quoted 7 lines

#define HSMMC_HAS_PBIAS (1 << 0)
#define HSMMC_HAS_WHATEVER (1 << 1)
...

	if (!(cpu_is_omap3517() || cpu_is_omap3505())
		mmc->slots[i].features |= HSMMC_HAS_PBIAS;

Accepted.

We can move other features into the variable "features", such as "nonremovable", "power_saving".

Stanley.

Quoted 32 lines
Quoted 13 lines
arch/arm/mach-omap2/hsmmc.c +8 -0
@@ -216,12 +222,25 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 		 */
 		mmc->slots[0].ocr_mask = c->ocr_mask;
 
+		if (!cpu_is_omap3517() && !cpu_is_omap3505()) {
+			switch (c->mmc) {
+			case 1:
+				/* on-chip level shifting via PBIAS0/PBIAS1 */
+				mmc->slots[0].before_set_reg = hsmmc1_before_set_reg;
+				mmc->slots[0].after_set_reg = hsmmc1_after_set_reg;
+				break;
+			case 2:

arch/arm/mach-omap2/hsmmc.c void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers) · line 242

Quoted 10 lines
arch/arm/mach-omap2/hsmmc.c +9 -0
+			case 3:
+				/* off-chip level shifting, or none */
+				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].after_set_reg = NULL;
+				break;
+			}
+		} else /* cpu_is_omap3517() || cpu_is_omap3505() */
+			mmc->slots[0].set_power = am3517_mmc_set_power;
+
 

Then you can test for that flag here too. When new omaps get added, it just a question of setting the features flags right.

Regards,

Tony

maintainer
#22 lore raw

Re: [PATCH 7/7] omap hsmmc: fix the hsmmc driver for am3517.

Quoted 2 lines · stanley.miao

We can move other features into the variable "features", such as "nonremovable", "power_saving".

Great, that sounds good to me. Might help with the mmc init issues for omap4 also.

Regards,

Tony