HSMMC: Make loopback clock configurable
Subsystems (3)
PATCH 1/2 HSMMC: Make loopback clock configurable
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
---
This patch applies on previous patch I sent:
"minor mmc-twl4030 cleanups"
arch/arm/mach-omap2/mmc-twl4030.c | 14 ++++++++------ arch/arm/mach-omap2/mmc-twl4030.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/mmc-twl4030.c +8 -6
@@ -250,8 +250,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -/* REVISIT: Loop back clock not needed for 2430? */ -if (!cpu_is_omap2430 ()) { +if (c->mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel (reg,OMAP2_CONTROL_DEVCONF0 );
@@ -298,11 +297,13 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vdstruct twl_mmc_controller *c = &hsmmc[1 ];if (power_on) { -u32 reg; +if (c->mmc->slots[0 ].internal_clock) { +u32 reg; - reg =omap_ctrl_readl (control_devconf1_offset); - reg |=OMAP2_MMCSDIO2ADPCLKISEL ; -omap_ctrl_writel (reg, control_devconf1_offset); + reg =omap_ctrl_readl (control_devconf1_offset); + reg |=OMAP2_MMCSDIO2ADPCLKISEL ; +omap_ctrl_writel (reg, control_devconf1_offset); + } ret =twl_mmc_set_voltage (c, vdd); }else { ret =twl_mmc_set_voltage (c,0 );
@@ -354,6 +355,7 @@ void __init hsmmc_init(struct twl4030_hsmmc_info *controllers)MMC_VDD_29_30 |MMC_VDD_30_31 |MMC_VDD_31_32 ; mmc->slots[0 ].wires = c->wires; + mmc->slots[0 ].internal_clock = !c->ext_clock; mmc->dma_mask =0xffffffff ;/* note: twl4030 card detect GPIOs normally switch VMMCx ... */
arch/arm/mach-omap2/mmc-twl4030.h +1 -0
@@ -11,6 +11,7 @@ struct twl4030_hsmmc_info {u8 wires;/* 1/4/8 wires */ int gpio_cd;/* or -EINVAL */ int gpio_wp;/* or -EINVAL */ + int ext_clock:1; /* use external pin for input clock */ }; #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
Signature · 1 line
1.5.4.3
PATCH 2/2 HSMMC: Enable external input clock for 2430 SDP MMC1
Previous patch removed cpu_is_omap2430() check in mmc-twl4030.c, so update twl4030_hsmmc_info to accommodate that.
--- arch/arm/mach-omap2/board-2430sdp.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-2430sdp.c +1 -0
@@ -396,6 +396,7 @@ static struct twl4030_hsmmc_info mmc[] __initdata = { .wires = 4, .gpio_cd = -EINVAL, .gpio_wp = -EINVAL, + .ext_clock = 1, }, {}/* Terminator */ };
Signature · 1 line
1.5.4.3
Tony Lindgren
maintainerQuoted 3 lines · Grazvydas Ignotas
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Thanks, pushing both today.
Tony
Quoted 68 lines
Signed-off-by Grazvydas Ignotas <[email protected]>---
This patch applies on previous patch I sent:
"minor mmc-twl4030 cleanups"arch/arm/mach-omap2/mmc-twl4030.c | 14 ++++++++------ arch/arm/mach-omap2/mmc-twl4030.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-)arch/arm/mach-omap2/mmc-twl4030.c +8
-6@@ -250,8 +250,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -/* REVISIT: Loop back clock not needed for 2430? */ -if (!cpu_is_omap2430 ()) { +if (c->mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel (reg,OMAP2_CONTROL_DEVCONF0 );@@ -298,11 +297,13 @@ static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vdstruct twl_mmc_controller *c = &hsmmc[1 ];if (power_on) { -u32 reg; +if (c->mmc->slots[0 ].internal_clock) { +u32 reg; - reg =omap_ctrl_readl (control_devconf1_offset); - reg |=OMAP2_MMCSDIO2ADPCLKISEL ; -omap_ctrl_writel (reg, control_devconf1_offset); + reg =omap_ctrl_readl (control_devconf1_offset); + reg |=OMAP2_MMCSDIO2ADPCLKISEL ; +omap_ctrl_writel (reg, control_devconf1_offset); + } ret =twl_mmc_set_voltage (c, vdd); }else { ret =twl_mmc_set_voltage (c,0 );@@ -354,6 +355,7 @@ void __init hsmmc_init(struct twl4030_hsmmc_info *controllers)MMC_VDD_29_30 |MMC_VDD_30_31 |MMC_VDD_31_32 ; mmc->slots[0 ].wires = c->wires; + mmc->slots[0 ].internal_clock = !c->ext_clock; mmc->dma_mask =0xffffffff ;/* note: twl4030 card detect GPIOs normally switch VMMCx ... */ arch/arm/mach-omap2/mmc-twl4030.h +1
-0@@ -11,6 +11,7 @@ struct twl4030_hsmmc_info {u8 wires;/* 1/4/8 wires */ int gpio_cd;/* or -EINVAL */ int gpio_wp;/* or -EINVAL */ + int ext_clock:1; /* use external pin for input clock */ }; #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \Signature · 6 lines
1.5.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Tony Lindgren
Quoted 3 lines · Grazvydas Ignotas
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Thanks, pushing both today.
Hmm . . . not sure if it is related to this patch, but I now get an oops on Overo.
Has anyone else seen this?
I'll do some debugging after I get some sleep.
Steve
Unable to handle kernel NULL pointer dereference at virtual address 00000029 pgd = c0004000 [00000029] *pgd=00000000 Internal error: Oops: 5 [#1] Modules linked in: CPU: 0 Not tainted (2.6.28-rc4-omap1 #1) PC is at twl_mmc2_set_power+0x20/0x68 LR is at omap_mmc_set_ios+0x78/0x25c pc : [<c00fb62c>] lr : [<c02ec7d0>] psr: 20000013
sp : cf93bf10 ip : cf93bf30 fp : cf93bf2c
r10: 00000000 r9 : 00000000 r8 : 00000000
r7 : cfbb4968 r6 : 00000013 r5 : c04ea960 r4 : cfbb4800 r3 : 00000000 r2 : 00000001 r1 : 00000001 r0 : cf901008
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387f Table: 80004018 DAC: 00000017 Process kmmcd (pid: 209, stack limit = 0xcf93a2e8)
Stack: (0xcf93bf10 to 0xcf93c000)
bf00: cfbb4800 cfbb4800 cfbb4a00 cfbb4968
bf20: cf93bf4c cf93bf30 c02ec7d0 c00fb618 cfbb4968 cfbb4800 c02e21d0 cf831ea0
bf40: cf93bf64 cf93bf50 c02e1924 c02ec764 cfbb4800 60000013 cf93bf84 cf93bf68
bf60: c02e2270 c02e18c4 c03ecd08 c010a4f8 cf831ea0 cf93a000 cf93bfa4 cf93bf88
bf80: c011e098 c02e21dc cf93bfb8 cf8ec5a0 cf93a000 cf831ea0 cf93bfdc cf93bfa8
bfa0: c011ec34 c011e000 c01219a8 00000000 cf8ec5a0 c0121e90 cf93bfb8 cf93bfb8
bfc0: cf831ea0 c011eb44 00000000 00000000 cf93bff4 cf93bfe0 c01219c0 c011eb50
bfe0: 00000000 00000000 00000000 cf93bff8 c0111360 c0121978 948ee7d5 0e80e45a
Backtrace: [<c00fb60c>] (twl_mmc2_set_power+0x0/0x68) from [<c02ec7d0>] (omap_mmc_set_ios+0x78/0x25c) r7:cfbb4968 r6:cfbb4a00 r5:cfbb4800 r4:cfbb4800 [<c02ec758>] (omap_mmc_set_ios+0x0/0x25c) from [<c02e1924>] (mmc_power_up+0x6c/0xb0) r7:cf831ea0 r6:c02e21d0 r5:cfbb4800 r4:cfbb4968 [<c02e18b8>] (mmc_power_up+0x0/0xb0) from [<c02e2270>] (mmc_rescan+0xa0/0x1c0) r5:60000013 r4:cfbb4800 [<c02e21d0>] (mmc_rescan+0x0/0x1c0) from [<c011e098>] (run_workqueue+0xa4/0x120) r5:cf93a000 r4:cf831ea0 [<c011dff4>] (run_workqueue+0x0/0x120) from [<c011ec34>] (worker_thread+0xf0/0x104) r7:cf831ea0 r6:cf93a000 r5:cf8ec5a0 r4:cf93bfb8 [<c011eb44>] (worker_thread+0x0/0x104) from [<c01219c0>] (kthread+0x54/0x80) r7:00000000 r6:00000000 r5:c011eb44 r4:cf831ea0 [<c012196c>] (kthread+0x0/0x80) from [<c0111360>] (do_exit+0x0/0x6c8) r5:00000000 r4:00000000 Code: e1a06003 e59f5044 0a00000d e5953010 (e5d33029) ---[ end trace 62381099a6bde9b1 ]---
Quoted 10 lines · Steve Sakoman
Quoted 6 lines · Tony Lindgren
Quoted 3 lines · Grazvydas Ignotas
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Thanks, pushing both today.
Hmm . . . not sure if it is related to this patch, but I now get an oops on Overo.
Oops.. Haven't thought to try it without gpio_cd set up, in which case c->mmc is not set initialized.. Please try the following patch:
arch/arm/mach-omap2/mmc-twl4030.c +4 -3
@@ -239,6 +239,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,u32 reg;int ret =0 ;struct twl_mmc_controller *c = &hsmmc[0 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) {if (cpu_is_omap2430 ()) {
@@ -250,7 +251,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel (reg,OMAP2_CONTROL_DEVCONF0 );
@@ -293,11 +294,11 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,static int twl_mmc2_set_power (struct device *dev,int slot,int power_on,int vdd) {int ret; -struct twl_mmc_controller *c = &hsmmc[1 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) { -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) {u32 reg; reg =omap_ctrl_readl (control_devconf1_offset);
Quoted 7 lines · Grazvydas Ignotas
Quoted 6 lines · Steve Sakoman
Quoted 5 lines · Tony Lindgren
Quoted 3 lines · Grazvydas Ignotas
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks, pushing both today.
Hmm . . . not sure if it is related to this patch, but I now get an oops on Overo.
Oops.. Haven't thought to try it without
gpio_cdset up, in which casec->mmcis not set initialized.. Please try the following patch:
I did, and I am happy to report that it fixed the oops on mmc2 and my wi2wi driver is happily working again.
Thanks!
Steve
Quoted 36 lines
arch/arm/mach-omap2/mmc-twl4030.c +4
-3@@ -239,6 +239,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,u32 reg;int ret =0 ;struct twl_mmc_controller *c = &hsmmc[0 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) {if (cpu_is_omap2430 ()) {@@ -250,7 +251,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel (reg,OMAP2_CONTROL_DEVCONF0 );@@ -293,11 +294,11 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,static int twl_mmc2_set_power (struct device *dev,int slot,int power_on,int vdd) {int ret; -struct twl_mmc_controller *c = &hsmmc[1 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) { -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) {u32 reg; reg =omap_ctrl_readl (control_devconf1_offset);
Tony Lindgren
maintainerQuoted 10 lines · Steve Sakoman
Quoted 9 lines · Grazvydas Ignotas
Quoted 8 lines · Steve Sakoman
Quoted 6 lines · Tony Lindgren
Quoted 3 lines · Grazvydas Ignotas
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Thanks, pushing both today.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Hmm . . . not sure if it is related to this patch, but I now get an oops on Overo.
Oops.. Haven't thought to try it without
gpio_cdset up, in which casec->mmcis not set initialized.. Please try the following patch:I did, and I am happy to report that it fixed the oops on mmc2 and my wi2wi driver is happily working again.
Grazvydas, can you please reply with your S-O-B so I can push your fix?
Thanks,
Tony
Quoted 41 lines
Thanks!
Steve
Quoted 36 lines
arch/arm/mach-omap2/mmc-twl4030.c +4
-3@@ -239,6 +239,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,u32 reg;int ret =0 ;struct twl_mmc_controller *c = &hsmmc[0 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) {if (cpu_is_omap2430 ()) {@@ -250,7 +251,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel (reg,OMAP2_CONTROL_DEVCONF0 );@@ -293,11 +294,11 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,static int twl_mmc2_set_power (struct device *dev,int slot,int power_on,int vdd) {int ret; -struct twl_mmc_controller *c = &hsmmc[1 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) { -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) {u32 reg; reg =omap_ctrl_readl (control_devconf1_offset);
Op 14 nov 2008, om 11:49 heeft Grazvydas Ignotas het volgende geschreven:
Quoted 7 lines · Steve Sakoman
Quoted 6 lines · Tony Lindgren
Quoted 5 lines · Grazvydas Ignotas
Quoted 3 lines
Some boards use input clock from external pin for MMC/SDIO modules in OMAP chips. Make that option selectable instead of forcing loop back clock on everyone.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thanks, pushing both today.
Hmm . . . not sure if it is related to this patch, but I now get an oops on Overo.
Oops.. Haven't thought to try it without
gpio_cdset up, in which casec->mmcis not set initialized.. Please try the following patch:
This also fixes mmc on omap3evm.
regards,
Koen
Quoted 46 lines
arch/arm/mach-omap2/mmc-twl4030.c +1
-0@@ -239,6 +239,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on, u32 reg;int ret =0 ;struct twl_mmc_controller *c = &hsmmc[0 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) {if (cpu_is_omap2430()) {arch/arm/mach-omap2/mmc-twl4030.c +1
-1@@ -250,7 +251,7 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on,omap_ctrl_writel (reg,OMAP243X_CONTROL_DEVCONF1 ); } -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) { reg =omap_ctrl_readl (OMAP2_CONTROL_DEVCONF0 ); reg |=OMAP2_MMCSDIO1ADPCLKISEL ;omap_ctrl_writel(reg, OMAP2_CONTROL_DEVCONF0);arch/arm/mach-omap2/mmc-twl4030.c +2
-2@@ -293,11 +294,11 @@ static int twl_mmc1_set_power(struct device *dev, int slot, int power_on, static int twl_mmc2_set_power(struct device *dev, int slot, int power_on, int vdd) {int ret; -struct twl_mmc_controller *c = &hsmmc[1 ]; +struct omap_mmc_platform_data *mmc = dev->platform_data;if (power_on) { -if (c->mmc->slots[0 ].internal_clock) { +if (mmc->slots[0 ].internal_clock) {u32 reg;reg = omap_ctrl_readl(control_devconf1_offset);--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html