aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/omap_hsmmc.c
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2013-01-30 04:07:17 -0500
committerChris Ball <cjb@laptop.org>2013-03-22 11:51:49 -0400
commitdc642c28d4eb39d1c7f2f85bbf1cea45de4766af (patch)
tree81ca55d02be43988ccccc2724b23cd3747366f9c /drivers/mmc/host/omap_hsmmc.c
parent0aacd23ff29a846c7eebbd9db8752fa360f34ad1 (diff)
mmc: omap_hsmmc: support deferred probing for GPIOs
If the CD/WP-GPIOs are not provided by the SoC's GPIO controller, we need to handle the case where omap_hsmmc is probed earlier than the GPIO controller chosen in the device tree. Fix this by checking the return value of of_get_named_gpio against -EPROBE_DEFER and passing it through to the probe function. Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Acked-by: Balaji T K <balajitk@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/omap_hsmmc.c')
-rw-r--r--drivers/mmc/host/omap_hsmmc.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index bc5807873b2c..6e44025acf01 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1717,6 +1717,12 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
1717 struct omap_mmc_platform_data *pdata; 1717 struct omap_mmc_platform_data *pdata;
1718 struct device_node *np = dev->of_node; 1718 struct device_node *np = dev->of_node;
1719 u32 bus_width, max_freq; 1719 u32 bus_width, max_freq;
1720 int cd_gpio, wp_gpio;
1721
1722 cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
1723 wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
1724 if (cd_gpio == -EPROBE_DEFER || wp_gpio == -EPROBE_DEFER)
1725 return ERR_PTR(-EPROBE_DEFER);
1720 1726
1721 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); 1727 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
1722 if (!pdata) 1728 if (!pdata)
@@ -1727,8 +1733,8 @@ static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev)
1727 1733
1728 /* This driver only supports 1 slot */ 1734 /* This driver only supports 1 slot */
1729 pdata->nr_slots = 1; 1735 pdata->nr_slots = 1;
1730 pdata->slots[0].switch_pin = of_get_named_gpio(np, "cd-gpios", 0); 1736 pdata->slots[0].switch_pin = cd_gpio;
1731 pdata->slots[0].gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); 1737 pdata->slots[0].gpio_wp = wp_gpio;
1732 1738
1733 if (of_find_property(np, "ti,non-removable", NULL)) { 1739 if (of_find_property(np, "ti,non-removable", NULL)) {
1734 pdata->slots[0].nonremovable = true; 1740 pdata->slots[0].nonremovable = true;
@@ -1774,6 +1780,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
1774 match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev); 1780 match = of_match_device(of_match_ptr(omap_mmc_of_match), &pdev->dev);
1775 if (match) { 1781 if (match) {
1776 pdata = of_get_hsmmc_pdata(&pdev->dev); 1782 pdata = of_get_hsmmc_pdata(&pdev->dev);
1783
1784 if (IS_ERR(pdata))
1785 return PTR_ERR(pdata);
1786
1777 if (match->data) { 1787 if (match->data) {
1778 const u16 *offsetp = match->data; 1788 const u16 *offsetp = match->data;
1779 pdata->reg_offset = *offsetp; 1789 pdata->reg_offset = *offsetp;