]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP3: mmc-twl4030 init passes device nodes back, v2
authorDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 24 Mar 2009 01:23:47 +0000 (18:23 -0700)
committerTony Lindgren <tony@atomide.com>
Tue, 24 Mar 2009 01:51:22 +0000 (18:51 -0700)
When setting up HSMMC devices, pass the device nodes back so
board code can linking them to their power supply regulators.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/mmc-twl4030.c
arch/arm/mach-omap2/mmc-twl4030.h
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/include/mach/mmc.h

index df1539e2cd0705b7ba6169d2da4eb5069294f568..c67078db07be1b96f05260f9564aa5fc6042a689 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/delay.h>
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
+#include <linux/regulator/machine.h>
 
 #include <mach/hardware.h>
 #include <mach/control.h>
@@ -437,6 +438,15 @@ void __init twl4030_mmc_init(struct twl4030_hsmmc_info *controllers)
        }
 
        omap2_init_mmc(hsmmc_data, OMAP34XX_NR_MMC);
+
+       /* pass the device nodes back to board setup code */
+       for (c = controllers; c->mmc; c++) {
+               struct omap_mmc_platform_data *mmc = hsmmc_data[c->mmc - 1];
+
+               if (!c->mmc || c->mmc > nr_hsmmc)
+                       continue;
+               c->dev = mmc->dev;
+       }
 }
 
 #endif
index 380dde7bcfe34e5e860c50d3a461fecfd0147bd1..21d35727f921d66157b27194dc53bb5129505b7d 100644 (file)
@@ -13,6 +13,7 @@ struct twl4030_hsmmc_info {
        bool    ext_clock;      /* use external pin for input clock */
        int     gpio_cd;        /* or -EINVAL */
        int     gpio_wp;        /* or -EINVAL */
+       struct device *dev;     /* returned: pointer to mmc adapter */
 };
 
 #if    defined(CONFIG_TWL4030_CORE) && \
index 208dbb121f477e11d2eb4d79601633f379bcc313..87fb7ff4179489728874278092b176b14886ac3c 100644 (file)
@@ -228,6 +228,9 @@ int __init omap_mmc_add(const char *name, int id, unsigned long base,
        ret = platform_device_add(pdev);
        if (ret)
                goto fail;
+
+       /* return device handle to board setup code */
+       data->dev = &pdev->dev;
        return 0;
 
 fail:
index 73a9e15031b18e1c022ec372c5f04b8a97e49f69..4435bd434e179b995adfbec2944ac24436aa6119 100644 (file)
@@ -37,6 +37,8 @@
 #define OMAP_MMC_MAX_SLOTS     2
 
 struct omap_mmc_platform_data {
+       /* back-link to device */
+       struct device *dev;
 
        /* number of slots per controller */
        unsigned nr_slots:2;