Skip to content

Commit

Permalink
ARM: OMAP3: mmc-twl4030 init passes device nodes back, v2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Brownell authored and Tony Lindgren committed Mar 24, 2009
1 parent 0329c37 commit 01971f6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arch/arm/mach-omap2/mmc-twl4030.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions arch/arm/mach-omap2/mmc-twl4030.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) && \
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/plat-omap/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/plat-omap/include/mach/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 01971f6

Please sign in to comment.