Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-08 Thread T Krishnamoorthy, Balaji
On Wed, Mar 7, 2012 at 9:12 PM, Chris Ball c...@laptop.org wrote:
 Hi Balaji,

 On Wed, Mar 07 2012, T Krishnamoorthy, Balaji wrote:
 OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
 Addng the offset to platform_device resource structure
 increments the start address for every insmod operation.
 MMC command fails on re-insertion as module due incorrect register base.
 Fix this by updating the ioremap base address only.

 Signed-off-by: Balaji T K balaj...@ti.com

 Is this a regression, or has it never worked in mainline?

Not a regression introduced in current merge window.
It happens on re-insertion of module.
will post a patch with $SUBJECT


 Note:  eMMC detection is still failing on resertion due to card vcc
 power off on rmmod

 And this?

This issue was hidden and uncovered after this fix.
This problem is Vcc being powered off without sleep command.


 Thanks,

 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-07 Thread T Krishnamoorthy, Balaji
On Mon, Mar 5, 2012 at 3:55 PM, T Krishnamoorthy, Balaji
balaj...@ti.com wrote:
 On Mon, Mar 5, 2012 at 2:46 PM, Rajendra Nayak rna...@ti.com wrote:
 On Friday 02 March 2012 10:52 PM, Tony Lindgren wrote:

 BTW, with -rc5, looks like re-inserting omap_hsmmc on omap4 fails
 to detect any cards, and then fails to unload. This works on omap3
 just fine. Any ideas why that would be?


 Yeah, looks like thats broken. I am not sure whats going wrong though.
 I just enabled CONFIG_MMC_DEBUG and saw these logs below.

 Venkat/Balaji, care to look at this one?


 Let me check this

OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
Addng the offset to platform_device resource structure
increments the start address for every insmod operation.
MMC command fails on re-insertion as module due incorrect register base.
Fix this by updating the ioremap base address only.

Signed-off-by: Balaji T K balaj...@ti.com
---
Note:  eMMC detection is still failing on resertion due to card vcc
power off on rmmod

 drivers/mmc/host/omap_hsmmc.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index fd0c661..4e1f8f6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1870,8 +1870,6 @@ static int __init omap_hsmmc_probe(struct
platform_device *pdev)
if (res == NULL || irq  0)
return -ENXIO;

-   res-start += pdata-reg_offset;
-   res-end += pdata-reg_offset;
res = request_mem_region(res-start, resource_size(res), pdev-name);
if (res == NULL)
return -EBUSY;
@@ -1896,7 +1894,7 @@ static int __init omap_hsmmc_probe(struct
platform_device *pdev)
host-irq   = irq;
host-id= pdev-id;
host-slot_id   = 0;
-   host-mapbase   = res-start;
+   host-mapbase   = res-start + pdata-reg_offset;
host-base  = ioremap(host-mapbase, SZ_4K);
host-power_mode = MMC_POWER_OFF;
host-next_data.cookie = 1;
-- 
1.7.0.4


 # insmod omap_hsmmc.ko
 [   43.358398] omap_hsmmc omap_hsmmc.0: context was not lost
 [   43.364105] omap_hsmmc omap_hsmmc.0: enabled
 [   44.434661] mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0
 timing 0
 [   44.442352] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
 [   44.474365] omap_hsmmc omap_hsmmc.0: disabled
 [   44.482208] omap_hsmmc omap_hsmmc.4: context was not lost
 [   44.482208] omap_hsmmc omap_hsmmc.4: enabled
 [   44.546600] omap_hsmmc omap_hsmmc.0: context was not lost
 [   44.552276] omap_hsmmc omap_hsmmc.0: enabled
 [   44.552276] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
 [   44.563720] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 18 width 0
 timing 0
 [   44.572174] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
 [   44.613800] mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 18 width
 0 timing 0
 [   44.621887] omap_hsmmc omap_hsmmc.0: Set clock to 40Hz
 [   44.735290] mmc0: starting CMD52 arg 0c00 flags 0195
 [   44.741271] omap_hsmmc omap_hsmmc.0: mmc0: CMD52, argument 0x0c00
 [   45.560241] mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0
 timing 0
 [   45.567871] omap_hsmmc omap_hsmmc.4: Set clock to 0Hz
 [   45.591491] omap_hsmmc omap_hsmmc.4: disabled
 #
 #
 # rmmod omap_hsmmc
 [  607.302307] omap_hsmmc omap_hsmmc.4: context was not lost
 [  607.308044] omap_hsmmc omap_hsmmc.4: enabled
 [  607.312591] omap_hsmmc omap_hsmmc.4: disabled
 [  607.317199] omap_hsmmc omap_hsmmc.4: context was not lost
 [  607.322875] omap_hsmmc omap_hsmmc.4: enabled




-- 
Thanks and Regards,
Balaji T K
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-07 Thread Tony Lindgren
* Chris Ball c...@laptop.org [120307 07:11]:
 Hi Balaji,
 
 On Wed, Mar 07 2012, T Krishnamoorthy, Balaji wrote:
  OMAP4 and OMAP3 HSMMC IP registers differ by 0x100 offset.
  Addng the offset to platform_device resource structure
  increments the start address for every insmod operation.
  MMC command fails on re-insertion as module due incorrect register base.
  Fix this by updating the ioremap base address only.
 
  Signed-off-by: Balaji T K balaj...@ti.com
 
 Is this a regression, or has it never worked in mainline?

Features that never worked originally so this can wait for the
merge window. It happens on re-inserting of the card.
 
  Note:  eMMC detection is still failing on resertion due to card vcc
  power off on rmmod
 
 And this?

That sounds like a separate issue that needs to be fixed.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-05 Thread Rajendra Nayak

On Friday 02 March 2012 10:52 PM, Tony Lindgren wrote:

BTW, with -rc5, looks like re-inserting omap_hsmmc on omap4 fails
to detect any cards, and then fails to unload. This works on omap3
just fine. Any ideas why that would be?


Yeah, looks like thats broken. I am not sure whats going wrong though.
I just enabled CONFIG_MMC_DEBUG and saw these logs below.

Venkat/Balaji, care to look at this one?

# insmod omap_hsmmc.ko
[   43.358398] omap_hsmmc omap_hsmmc.0: context was not lost
[   43.364105] omap_hsmmc omap_hsmmc.0: enabled
[   44.434661] mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 
timing 0

[   44.442352] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
[   44.474365] omap_hsmmc omap_hsmmc.0: disabled
[   44.482208] omap_hsmmc omap_hsmmc.4: context was not lost
[   44.482208] omap_hsmmc omap_hsmmc.4: enabled
[   44.546600] omap_hsmmc omap_hsmmc.0: context was not lost
[   44.552276] omap_hsmmc omap_hsmmc.0: enabled
[   44.552276] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
[   44.563720] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 18 width 0 
timing 0

[   44.572174] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
[   44.613800] mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 18 
width 0 timing 0

[   44.621887] omap_hsmmc omap_hsmmc.0: Set clock to 40Hz
[   44.735290] mmc0: starting CMD52 arg 0c00 flags 0195
[   44.741271] omap_hsmmc omap_hsmmc.0: mmc0: CMD52, argument 0x0c00
[   45.560241] mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0 
timing 0

[   45.567871] omap_hsmmc omap_hsmmc.4: Set clock to 0Hz
[   45.591491] omap_hsmmc omap_hsmmc.4: disabled
#
#
# rmmod omap_hsmmc
[  607.302307] omap_hsmmc omap_hsmmc.4: context was not lost
[  607.308044] omap_hsmmc omap_hsmmc.4: enabled
[  607.312591] omap_hsmmc omap_hsmmc.4: disabled
[  607.317199] omap_hsmmc omap_hsmmc.4: context was not lost
[  607.322875] omap_hsmmc omap_hsmmc.4: enabled

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-05 Thread T Krishnamoorthy, Balaji
On Mon, Mar 5, 2012 at 2:46 PM, Rajendra Nayak rna...@ti.com wrote:
 On Friday 02 March 2012 10:52 PM, Tony Lindgren wrote:

 BTW, with -rc5, looks like re-inserting omap_hsmmc on omap4 fails
 to detect any cards, and then fails to unload. This works on omap3
 just fine. Any ideas why that would be?


 Yeah, looks like thats broken. I am not sure whats going wrong though.
 I just enabled CONFIG_MMC_DEBUG and saw these logs below.

 Venkat/Balaji, care to look at this one?


Let me check this

 # insmod omap_hsmmc.ko
 [   43.358398] omap_hsmmc omap_hsmmc.0: context was not lost
 [   43.364105] omap_hsmmc omap_hsmmc.0: enabled
 [   44.434661] mmc0: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0
 timing 0
 [   44.442352] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
 [   44.474365] omap_hsmmc omap_hsmmc.0: disabled
 [   44.482208] omap_hsmmc omap_hsmmc.4: context was not lost
 [   44.482208] omap_hsmmc omap_hsmmc.4: enabled
 [   44.546600] omap_hsmmc omap_hsmmc.0: context was not lost
 [   44.552276] omap_hsmmc omap_hsmmc.0: enabled
 [   44.552276] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz
 [   44.563720] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 18 width 0
 timing 0
 [   44.572174] omap_hsmmc omap_hsmmc.0: Set clock to 0Hz
 [   44.613800] mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 18 width
 0 timing 0
 [   44.621887] omap_hsmmc omap_hsmmc.0: Set clock to 40Hz
 [   44.735290] mmc0: starting CMD52 arg 0c00 flags 0195
 [   44.741271] omap_hsmmc omap_hsmmc.0: mmc0: CMD52, argument 0x0c00
 [   45.560241] mmc1: clock 0Hz busmode 1 powermode 0 cs 0 Vdd 0 width 0
 timing 0
 [   45.567871] omap_hsmmc omap_hsmmc.4: Set clock to 0Hz
 [   45.591491] omap_hsmmc omap_hsmmc.4: disabled
 #
 #
 # rmmod omap_hsmmc
 [  607.302307] omap_hsmmc omap_hsmmc.4: context was not lost
 [  607.308044] omap_hsmmc omap_hsmmc.4: enabled
 [  607.312591] omap_hsmmc omap_hsmmc.4: disabled
 [  607.317199] omap_hsmmc omap_hsmmc.4: context was not lost
 [  607.322875] omap_hsmmc omap_hsmmc.4: enabled

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-02 Thread Samuel Ortiz
Hi Tony,

On Thu, Mar 01, 2012 at 10:55:35AM -0800, Tony Lindgren wrote:
 There's no need to use callbacks for this, we can
 do it directly between MMC driver and twl6030.
 
 Cc: Samuel Ortiz sa...@linux.intel.com
Acked-by: Samuel Ortiz sa...@linux.intel.com

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-02 Thread Tony Lindgren
* Rajendra Nayak rna...@ti.com [120301 21:38]:
 On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:
 --- a/arch/arm/mach-omap2/board-omap4panda.c
 +++ b/arch/arm/mach-omap2/board-omap4panda.c
 @@ -153,8 +153,8 @@ static struct omap2_hsmmc_info mmc[] = {
  {
  .mmc= 1,
  .caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 -.gpio_wp= -EINVAL,
  .gpio_cd= -EINVAL,
 +.gpio_wp= -EINVAL,
 
 stray change.

Hmm I'd like to keep this change before this ordering gets copied
to ten other board files that we may have in testing-board for a while..
I'll add a comment to the patch description about that.

 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -34,6 +34,7 @@
   #includelinux/gpio.h
   #includelinux/regulator/consumer.h
   #includelinux/pm_runtime.h
 +#includelinux/i2c/twl.h
   #includeplat/dma.h
   #includemach/hardware.h
   #includeplat/board.h
 @@ -578,6 +579,32 @@ static void omap_hsmmc_gpio_free(struct omap_hsmmc_host 
 *host)
  gpio_free(host-gpio_cd);
   }
 
 +#ifdef CONFIG_TWL4030_CORE
 +static int omap_hsmmc_init_twl6030(struct omap_hsmmc_host *host)
 +{
 +struct omap_mmc_platform_data *pdata = host-pdata;
 +struct omap_mmc_slot_data *slot =pdata-slots[0];
 +int irq;
 +
 +if (gpio_is_valid(host-gpio_cd) || host-id)
 
 I have a series, which I am asking Chris to pull, which completely
 gets rid of all host-id based hard-codings' in the driver.
 Isn't there a better way to do this than rely on the device instance?

Yes I was thinking about that too. I guess we need to pass some
flag in pdata for twl6030 card detect. I was thinking about using
the gpiochip_cd, but twl6030 is not gpio based card detect, so
a separate flag is better.

BTW, with -rc5, looks like re-inserting omap_hsmmc on omap4 fails
to detect any cards, and then fails to unload. This works on omap3
just fine. Any ideas why that would be?

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-01 Thread Tony Lindgren
There's no need to use callbacks for this, we can
do it directly between MMC driver and twl6030.

Cc: Samuel Ortiz sa...@linux.intel.com
Cc: Chris Ball c...@laptop.org
Cc: Rajendra Nayak rna...@ti.com
Signed-off-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/board-4430sdp.c|   45 +---
 arch/arm/mach-omap2/board-omap4panda.c |   52 +---
 drivers/mfd/twl6030-irq.c  |   33 +---
 drivers/mmc/host/omap_hsmmc.c  |   31 +++
 4 files changed, 48 insertions(+), 113 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 09ae257..c31efa4 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -455,49 +455,6 @@ static struct platform_device omap_vwlan_device = {
},
 };
 
-static int omap4_twl6030_hsmmc_late_init(struct device *dev)
-{
-   int ret = 0;
-   struct platform_device *pdev = container_of(dev,
-   struct platform_device, dev);
-   struct omap_mmc_platform_data *pdata = dev-platform_data;
-
-   /* Setting MMC1 Card detect Irq */
-   if (pdev-id == 0) {
-   ret = twl6030_mmc_card_detect_config();
-   if (ret)
-   pr_err(Failed configuring MMC1 card detect\n);
-   pdata-slots[0].card_detect_irq = TWL6030_IRQ_BASE +
-   MMCDETECT_INTR_OFFSET;
-   pdata-slots[0].card_detect = twl6030_mmc_card_detect;
-   }
-   return ret;
-}
-
-static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
-{
-   struct omap_mmc_platform_data *pdata;
-
-   /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
-   if (!dev) {
-   pr_err(Failed %s\n, __func__);
-   return;
-   }
-   pdata = dev-platform_data;
-   pdata-init =   omap4_twl6030_hsmmc_late_init;
-}
-
-static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
-{
-   struct omap2_hsmmc_info *c;
-
-   omap_hsmmc_init(controllers);
-   for (c = controllers; c-mmc; c++)
-   omap4_twl6030_hsmmc_set_late_init(c-pdev-dev);
-
-   return 0;
-}
-
 static struct regulator_init_data sdp4430_vaux1 = {
.constraints = {
.min_uV = 100,
@@ -906,7 +863,7 @@ static void __init omap_4430sdp_init(void)
omap_serial_init();
omap_sdrc_init(NULL, NULL);
omap4_sdp4430_wifi_init();
-   omap4_twl6030_hsmmc_init(mmc);
+   omap_hsmmc_init(mmc);
 
usb_musb_init(musb_board_data);
 
diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 7ca7a5c..8cf4e54 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -153,8 +153,8 @@ static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
.caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
-   .gpio_wp= -EINVAL,
.gpio_cd= -EINVAL,
+   .gpio_wp= -EINVAL,
},
{
.name   = wl1271,
@@ -204,54 +204,6 @@ struct wl12xx_platform_data omap_panda_wlan_data  
__initdata = {
.board_ref_clock = 2,
 };
 
-static int omap4_twl6030_hsmmc_late_init(struct device *dev)
-{
-   int ret = 0;
-   struct platform_device *pdev = container_of(dev,
-   struct platform_device, dev);
-   struct omap_mmc_platform_data *pdata = dev-platform_data;
-
-   if (!pdata) {
-   dev_err(dev, %s: NULL platform data\n, __func__);
-   return -EINVAL;
-   }
-   /* Setting MMC1 Card detect Irq */
-   if (pdev-id == 0) {
-   ret = twl6030_mmc_card_detect_config();
-if (ret)
-   dev_err(dev, %s: Error card detect config(%d)\n,
-   __func__, ret);
-else
-   pdata-slots[0].card_detect = twl6030_mmc_card_detect;
-   }
-   return ret;
-}
-
-static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
-{
-   struct omap_mmc_platform_data *pdata;
-
-   /* dev can be null if CONFIG_MMC_OMAP_HS is not set */
-   if (!dev) {
-   pr_err(Failed omap4_twl6030_hsmmc_set_late_init\n);
-   return;
-   }
-   pdata = dev-platform_data;
-
-   pdata-init =   omap4_twl6030_hsmmc_late_init;
-}
-
-static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info 
*controllers)
-{
-   struct omap2_hsmmc_info *c;
-
-   omap_hsmmc_init(controllers);
-   for (c = controllers; c-mmc; c++)
-   omap4_twl6030_hsmmc_set_late_init(c-pdev-dev);
-
-   return 0;
-}
-
 /* Panda board uses the common PMIC configuration */
 static struct 

Re: [PATCH 4/4] mmc: omap_hsmmc: Simplify init for twl6030 MMC card detect

2012-03-01 Thread Rajendra Nayak

On Friday 02 March 2012 12:25 AM, Tony Lindgren wrote:

There's no need to use callbacks for this, we can
do it directly between MMC driver and twl6030.

Cc: Samuel Ortizsa...@linux.intel.com
Cc: Chris Ballc...@laptop.org
Cc: Rajendra Nayakrna...@ti.com
Signed-off-by: Tony Lindgrent...@atomide.com
---

[..]

diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
b/arch/arm/mach-omap2/board-omap4panda.c
index 7ca7a5c..8cf4e54 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -153,8 +153,8 @@ static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 1,
.caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
-   .gpio_wp= -EINVAL,
.gpio_cd= -EINVAL,
+   .gpio_wp= -EINVAL,


stray change.


},

[..]

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index c6b456a..ce0002b 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -283,35 +283,30 @@ int twl6030_mmc_card_detect_config(void)
 * Card status on TWL6030 for MMC1
 */
ret = twl_i2c_read_u8(TWL6030_MODULE_ID0,reg_val, TWL6030_MMCCTRL);
-   if (ret  0) {
-   pr_err(twl6030: Failed to read MMCCTRL, error %d\n, ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;
reg_val= ~VMMC_AUTO_OFF;
reg_val |= SW_FC;
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val, TWL6030_MMCCTRL);
-   if (ret  0) {
-   pr_err(twl6030: Failed to write MMCCTRL, error %d\n, ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;

/* Configuring PullUp-PullDown register */
ret = twl_i2c_read_u8(TWL6030_MODULE_ID0,reg_val,
TWL6030_CFG_INPUT_PUPD3);
-   if (ret  0) {
-   pr_err(twl6030: Failed to read CFG_INPUT_PUPD3, error %d\n,
-   ret);
-   return ret;
-   }
+   if (ret  0)
+   goto err;
reg_val= ~(MMC_PU | MMC_PD);
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, reg_val,
TWL6030_CFG_INPUT_PUPD3);
-   if (ret  0) {
-   pr_err(twl6030: Failed to write CFG_INPUT_PUPD3, error %d\n,
-   ret);
-   return ret;
-   }
-   return 0;
+   if (ret  0)
+   goto err;
+
+   return twl6030_irq_base + MMCDETECT_INTR_OFFSET;
+
+err:
+   pr_err(twl6030: Failed to initialize MMC card detect: %d\n, ret);
+   return -ENODEV;
  }
  EXPORT_SYMBOL(twl6030_mmc_card_detect_config);

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 1aa2420..7f483b7 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -34,6 +34,7 @@
  #includelinux/gpio.h
  #includelinux/regulator/consumer.h
  #includelinux/pm_runtime.h
+#includelinux/i2c/twl.h
  #includeplat/dma.h
  #includemach/hardware.h
  #includeplat/board.h
@@ -578,6 +579,32 @@ static void omap_hsmmc_gpio_free(struct omap_hsmmc_host 
*host)
gpio_free(host-gpio_cd);
  }

+#ifdef CONFIG_TWL4030_CORE
+static int omap_hsmmc_init_twl6030(struct omap_hsmmc_host *host)
+{
+   struct omap_mmc_platform_data *pdata = host-pdata;
+   struct omap_mmc_slot_data *slot =pdata-slots[0];
+   int irq;
+
+   if (gpio_is_valid(host-gpio_cd) || host-id)


I have a series, which I am asking Chris to pull, which completely
gets rid of all host-id based hard-codings' in the driver.
Isn't there a better way to do this than rely on the device instance?

regards,
Rajendra


+   return 0;
+
+   irq = twl6030_mmc_card_detect_config();
+   if (irq= 0)
+   return irq;
+
+   slot-card_detect_irq = irq;
+   slot-card_detect = twl6030_mmc_card_detect;
+
+   return 0;
+}
+#else
+static inline int omap_hsmmc_init_twl6030(struct omap_hsmmc_host *host)
+{
+   return -ENODEV;
+}
+#endif
+
  /*
   * Start clock to the card
   */
@@ -1933,6 +1960,10 @@ static int __init omap_hsmmc_probe(struct 
platform_device *pdev)
if (ret)
goto err1;

+   ret = omap_hsmmc_init_twl6030(host);
+   if (ret)
+   goto err1;
+
mmc-ops =omap_hsmmc_ops;

/*



--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html