diff options
author | Kevin Liu <kliu5@marvell.com> | 2013-03-25 05:42:58 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-04-04 09:59:12 -0400 |
commit | 943647f6fe3aa7217d13cacac830c88455a88326 (patch) | |
tree | 40f16214e8f69e4470b60a577bda182a44607649 /drivers/mmc/host | |
parent | c844a46f135e493ffda0bd770e16f6c3dd6c7eb7 (diff) |
mmc: sdhci-pxav3: enhance device tree parser code
1. seperate device tree parsing from platform data handling which
can make further work easy when platform data can be removed.
2. add calling mmc_of_parse which can parse more of property and
pxav3_get_mmc_pdata can be shrinked a lot.
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/sdhci-pxav3.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index 56d6a2e3194f..fb0d23c148ef 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
@@ -195,29 +195,16 @@ static struct sdhci_pxa_platdata *pxav3_get_mmc_pdata(struct device *dev) | |||
195 | { | 195 | { |
196 | struct sdhci_pxa_platdata *pdata; | 196 | struct sdhci_pxa_platdata *pdata; |
197 | struct device_node *np = dev->of_node; | 197 | struct device_node *np = dev->of_node; |
198 | u32 bus_width; | ||
199 | u32 clk_delay_cycles; | 198 | u32 clk_delay_cycles; |
200 | enum of_gpio_flags gpio_flags; | ||
201 | 199 | ||
202 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 200 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
203 | if (!pdata) | 201 | if (!pdata) |
204 | return NULL; | 202 | return NULL; |
205 | 203 | ||
206 | if (of_find_property(np, "non-removable", NULL)) | ||
207 | pdata->flags |= PXA_FLAG_CARD_PERMANENT; | ||
208 | |||
209 | of_property_read_u32(np, "bus-width", &bus_width); | ||
210 | if (bus_width == 8) | ||
211 | pdata->flags |= PXA_FLAG_SD_8_BIT_CAPABLE_SLOT; | ||
212 | |||
213 | of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); | 204 | of_property_read_u32(np, "mrvl,clk-delay-cycles", &clk_delay_cycles); |
214 | if (clk_delay_cycles > 0) | 205 | if (clk_delay_cycles > 0) |
215 | pdata->clk_delay_cycles = clk_delay_cycles; | 206 | pdata->clk_delay_cycles = clk_delay_cycles; |
216 | 207 | ||
217 | pdata->ext_cd_gpio = of_get_named_gpio_flags(np, "cd-gpios", 0, &gpio_flags); | ||
218 | if (gpio_flags != OF_GPIO_ACTIVE_LOW) | ||
219 | pdata->host_caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; | ||
220 | |||
221 | return pdata; | 208 | return pdata; |
222 | } | 209 | } |
223 | #else | 210 | #else |
@@ -264,10 +251,11 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
264 | host->mmc->caps |= MMC_CAP_1_8V_DDR; | 251 | host->mmc->caps |= MMC_CAP_1_8V_DDR; |
265 | 252 | ||
266 | match = of_match_device(of_match_ptr(sdhci_pxav3_of_match), &pdev->dev); | 253 | match = of_match_device(of_match_ptr(sdhci_pxav3_of_match), &pdev->dev); |
267 | if (match) | 254 | if (match) { |
255 | mmc_of_parse(host->mmc); | ||
256 | sdhci_get_of_property(pdev); | ||
268 | pdata = pxav3_get_mmc_pdata(dev); | 257 | pdata = pxav3_get_mmc_pdata(dev); |
269 | 258 | } else if (pdata) { | |
270 | if (pdata) { | ||
271 | /* on-chip device */ | 259 | /* on-chip device */ |
272 | if (pdata->flags & PXA_FLAG_CARD_PERMANENT) | 260 | if (pdata->flags & PXA_FLAG_CARD_PERMANENT) |
273 | host->mmc->caps |= MMC_CAP_NONREMOVABLE; | 261 | host->mmc->caps |= MMC_CAP_NONREMOVABLE; |
@@ -297,8 +285,6 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
297 | } | 285 | } |
298 | } | 286 | } |
299 | 287 | ||
300 | sdhci_get_of_property(pdev); | ||
301 | |||
302 | pm_runtime_set_active(&pdev->dev); | 288 | pm_runtime_set_active(&pdev->dev); |
303 | pm_runtime_enable(&pdev->dev); | 289 | pm_runtime_enable(&pdev->dev); |
304 | pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS); | 290 | pm_runtime_set_autosuspend_delay(&pdev->dev, PXAV3_RPM_DELAY_MS); |
@@ -316,7 +302,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev) | |||
316 | 302 | ||
317 | platform_set_drvdata(pdev, host); | 303 | platform_set_drvdata(pdev, host); |
318 | 304 | ||
319 | if (pdata->pm_caps & MMC_PM_KEEP_POWER) { | 305 | if (host->mmc->pm_caps & MMC_PM_KEEP_POWER) { |
320 | device_init_wakeup(&pdev->dev, 1); | 306 | device_init_wakeup(&pdev->dev, 1); |
321 | host->mmc->pm_flags |= MMC_PM_WAKE_SDIO_IRQ; | 307 | host->mmc->pm_flags |= MMC_PM_WAKE_SDIO_IRQ; |
322 | } else { | 308 | } else { |