diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-12-05 08:34:51 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-01-13 12:48:21 -0500 |
commit | d1a1dfb2f5dad3fbcea71b95791d525f4775cff5 (patch) | |
tree | 8ebc191e36983487a348d11645d2eaf46826ddb5 /drivers/mmc | |
parent | abd37cccd47fe950e893578da12e7dc0604078de (diff) |
mmc: mxs: use mmc_of_parse to parse devicetree properties
Use generic helper function. This also adds support for the cd-gpios and
max-frequency devicetree properties.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/mxs-mmc.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 13016e2cccad..073e871a0fc8 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -76,7 +76,11 @@ static int mxs_mmc_get_cd(struct mmc_host *mmc) | |||
76 | { | 76 | { |
77 | struct mxs_mmc_host *host = mmc_priv(mmc); | 77 | struct mxs_mmc_host *host = mmc_priv(mmc); |
78 | struct mxs_ssp *ssp = &host->ssp; | 78 | struct mxs_ssp *ssp = &host->ssp; |
79 | int present; | 79 | int present, ret; |
80 | |||
81 | ret = mmc_gpio_get_cd(mmc); | ||
82 | if (ret >= 0) | ||
83 | return ret; | ||
80 | 84 | ||
81 | present = !(readl(ssp->base + HW_SSP_STATUS(ssp)) & | 85 | present = !(readl(ssp->base + HW_SSP_STATUS(ssp)) & |
82 | BM_SSP_STATUS_CARD_DETECT); | 86 | BM_SSP_STATUS_CARD_DETECT); |
@@ -564,15 +568,12 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
564 | { | 568 | { |
565 | const struct of_device_id *of_id = | 569 | const struct of_device_id *of_id = |
566 | of_match_device(mxs_mmc_dt_ids, &pdev->dev); | 570 | of_match_device(mxs_mmc_dt_ids, &pdev->dev); |
567 | struct device_node *np = pdev->dev.of_node; | ||
568 | struct mxs_mmc_host *host; | 571 | struct mxs_mmc_host *host; |
569 | struct mmc_host *mmc; | 572 | struct mmc_host *mmc; |
570 | struct resource *iores; | 573 | struct resource *iores; |
571 | int ret = 0, irq_err, gpio; | 574 | int ret = 0, irq_err; |
572 | struct regulator *reg_vmmc; | 575 | struct regulator *reg_vmmc; |
573 | enum of_gpio_flags flags; | ||
574 | struct mxs_ssp *ssp; | 576 | struct mxs_ssp *ssp; |
575 | u32 bus_width = 0; | ||
576 | 577 | ||
577 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 578 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
578 | irq_err = platform_get_irq(pdev, 0); | 579 | irq_err = platform_get_irq(pdev, 0); |
@@ -633,29 +634,13 @@ static int mxs_mmc_probe(struct platform_device *pdev) | |||
633 | mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | | 634 | mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | |
634 | MMC_CAP_SDIO_IRQ | MMC_CAP_NEEDS_POLL; | 635 | MMC_CAP_SDIO_IRQ | MMC_CAP_NEEDS_POLL; |
635 | 636 | ||
636 | of_property_read_u32(np, "bus-width", &bus_width); | ||
637 | if (bus_width == 4) | ||
638 | mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
639 | else if (bus_width == 8) | ||
640 | mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; | ||
641 | if (of_property_read_bool(np, "broken-cd")) | ||
642 | mmc->caps |= MMC_CAP_NEEDS_POLL; | ||
643 | if (of_property_read_bool(np, "non-removable")) | ||
644 | mmc->caps |= MMC_CAP_NONREMOVABLE; | ||
645 | gpio = of_get_named_gpio_flags(np, "wp-gpios", 0, &flags); | ||
646 | if (gpio_is_valid(gpio)) { | ||
647 | ret = mmc_gpio_request_ro(mmc, gpio); | ||
648 | if (ret) | ||
649 | goto out_clk_disable; | ||
650 | if (!(flags & OF_GPIO_ACTIVE_LOW)) | ||
651 | mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | ||
652 | } | ||
653 | |||
654 | if (of_property_read_bool(np, "cd-inverted")) | ||
655 | mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; | ||
656 | |||
657 | mmc->f_min = 400000; | 637 | mmc->f_min = 400000; |
658 | mmc->f_max = 288000000; | 638 | mmc->f_max = 288000000; |
639 | |||
640 | ret = mmc_of_parse(mmc); | ||
641 | if (ret) | ||
642 | goto out_clk_disable; | ||
643 | |||
659 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; | 644 | mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; |
660 | 645 | ||
661 | mmc->max_segs = 52; | 646 | mmc->max_segs = 52; |