diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-06-11 07:35:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-06-11 07:35:39 +0200 |
commit | 8e5951b62e26d271b44c5c1e22fcfbd5102aa9ed (patch) | |
tree | 1db1f575fc2e269347766a2150329b085aef8059 | |
parent | f8eaeee4571358afa5fb0d9e6374d095c7531c96 (diff) | |
parent | 91eeea3664bc223b0557ef2b7d4ab47190d2f44f (diff) | |
download | barebox-8e5951b62e26d271b44c5c1e22fcfbd5102aa9ed.tar.gz barebox-8e5951b62e26d271b44c5c1e22fcfbd5102aa9ed.tar.xz |
Merge branch 'for-next/mmc'
-rw-r--r-- | drivers/mci/Kconfig | 10 | ||||
-rw-r--r-- | drivers/mci/bcm2835-sdhost.c | 10 | ||||
-rw-r--r-- | drivers/mci/dove-sdhci.c | 8 | ||||
-rw-r--r-- | drivers/mci/dw_mmc.c | 11 | ||||
-rw-r--r-- | drivers/mci/imx-esdhc.c | 11 | ||||
-rw-r--r-- | drivers/mci/mci-bcm2835.c | 10 | ||||
-rw-r--r-- | drivers/mci/mci-core.c | 22 | ||||
-rw-r--r-- | drivers/mci/mxs.c | 9 | ||||
-rw-r--r-- | drivers/mci/omap_hsmmc.c | 10 | ||||
-rw-r--r-- | drivers/mci/tegra-sdmmc.c | 10 |
10 files changed, 24 insertions, 87 deletions
diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig index 60c60ceaa5..6ae1e81252 100644 --- a/drivers/mci/Kconfig +++ b/drivers/mci/Kconfig @@ -12,12 +12,12 @@ if MCI comment "--- Feature list ---" config MCI_STARTUP - bool "Probe on system start" + bool "Force probe on system start" help - Say 'y' here if the MCI framework should probe for attached MCI cards - on system start up. This is required if the card carries barebox's - environment (for example on systems where the MCI card is the sole - bootmedia). Otherwise probing run on demand with "mci*.probe=1" + Say 'y' here if the MCI framework should always probe for all attached + MCI cards on system start up. This may required for some legacy boards. + When this is 'n', probing happens on demand either with "mci*.probe=1" + or with driver/board code calling device_detect. config MCI_INFO bool "MCI Info" diff --git a/drivers/mci/bcm2835-sdhost.c b/drivers/mci/bcm2835-sdhost.c index 1d3a6c0969..f935ed5ea7 100644 --- a/drivers/mci/bcm2835-sdhost.c +++ b/drivers/mci/bcm2835-sdhost.c @@ -579,13 +579,6 @@ static void bcm2835_set_ios(struct mci_host *mci, struct mci_ios *ios) writel(hcfg, host->regs + SDHCFG); } -static int bcm2835_sdhost_detect(struct device_d *dev) -{ - struct bcm2835_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static int bcm2835_sdhost_probe(struct device_d *dev) { struct bcm2835_host *host; @@ -617,9 +610,6 @@ static int bcm2835_sdhost_probe(struct device_d *dev) mci->set_ios = bcm2835_set_ios; mci->send_cmd = bcm2835_send_cmd; - dev->priv = host; - dev->detect = bcm2835_sdhost_detect, - mci_of_parse(mci); return mci_register(mci); diff --git a/drivers/mci/dove-sdhci.c b/drivers/mci/dove-sdhci.c index cb052e81b1..e09147fff9 100644 --- a/drivers/mci/dove-sdhci.c +++ b/drivers/mci/dove-sdhci.c @@ -324,12 +324,6 @@ static void dove_sdhci_set_mci_caps(struct dove_sdhci *host) host->mci.host_caps &= ~MMC_CAP_8_BIT_DATA; } -static int dove_sdhci_detect(struct device_d *dev) -{ - struct dove_sdhci *host = dev->priv; - return mci_detect_card(&host->mci); -} - static int dove_sdhci_probe(struct device_d *dev) { struct dove_sdhci *host; @@ -350,8 +344,6 @@ static int dove_sdhci_probe(struct device_d *dev) host->sdhci.write32 = dove_sdhci_writel; host->sdhci.write16 = dove_sdhci_writew; host->sdhci.write8 = dove_sdhci_writeb; - dev->priv = host; - dev->detect = dove_sdhci_detect; dove_sdhci_set_mci_caps(host); diff --git a/drivers/mci/dw_mmc.c b/drivers/mci/dw_mmc.c index f035317ef2..ab8270814b 100644 --- a/drivers/mci/dw_mmc.c +++ b/drivers/mci/dw_mmc.c @@ -553,13 +553,6 @@ static int dwmci_init(struct mci_host *mci, struct device_d *dev) return 0; } -static int dw_mmc_detect(struct device_d *dev) -{ - struct dwmci_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static int dw_mmc_probe(struct device_d *dev) { struct resource *iores; @@ -615,8 +608,6 @@ static int dw_mmc_probe(struct device_d *dev) else host->pwren_value = 1; - dev->detect = dw_mmc_detect; - host->clkrate = clk_get_rate(host->clk_ciu); host->mci.f_min = host->clkrate / 510 / host->ciu_div; if (host->mci.f_min < 200000) @@ -625,8 +616,6 @@ static int dw_mmc_probe(struct device_d *dev) mci_of_parse(&host->mci); - dev->priv = host; - return mci_register(&host->mci); } diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index bff8dd67ad..314a2264f9 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -236,13 +236,6 @@ static int esdhc_init(struct mci_host *mci, struct device_d *dev) return ret; } -static int fsl_esdhc_detect(struct device_d *dev) -{ - struct fsl_esdhc_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static int fsl_esdhc_probe(struct device_d *dev) { struct resource *iores; @@ -311,8 +304,6 @@ static int fsl_esdhc_probe(struct device_d *dev) host->mci.card_present = esdhc_card_present; host->mci.hw_dev = dev; - dev->detect = fsl_esdhc_detect; - rate = clk_get_rate(host->clk); host->mci.f_min = rate >> 12; if (host->mci.f_min < 200000) @@ -325,8 +316,6 @@ static int fsl_esdhc_probe(struct device_d *dev) mci_of_parse(&host->mci); - dev->priv = host; - ret = mci_register(&host->mci); if (ret) goto err_release_res; diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c index b18d681870..c463c623e7 100644 --- a/drivers/mci/mci-bcm2835.c +++ b/drivers/mci/mci-bcm2835.c @@ -366,13 +366,6 @@ static int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev) return bcm2835_mci_wait_command_done(host); } -static int bcm2835_mci_detect(struct device_d *dev) -{ - struct bcm2835_mci_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static int bcm2835_mci_probe(struct device_d *hw_dev) { struct resource *iores; @@ -422,9 +415,6 @@ static int bcm2835_mci_probe(struct device_d *hw_dev) host->mci.f_min = MIN_FREQ; host->mci.f_max = host->max_clock; - hw_dev->priv = host; - hw_dev->detect = bcm2835_mci_detect, - /* * The Arasan has a bugette whereby it may lose the content of * successive writes to registers that are within two SD-card clock diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index e8844a3c00..a58dedc1cd 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -1811,6 +1811,18 @@ static int mci_detect(struct device_d *dev) return mci_detect_card(mci->host); } +static int mci_hw_detect(struct device_d *dev) +{ + struct mci *mci; + + list_for_each_entry(mci, &mci_list, list) { + if (dev == mci->host->hw_dev) + return mci_detect_card(mci->host); + } + + return -ENODEV; +} + /** * Create a new mci device (for convenience) * @param host mci_host for this MCI device @@ -1819,6 +1831,7 @@ static int mci_detect(struct device_d *dev) int mci_register(struct mci_host *host) { struct mci *mci; + struct device_d *hw_dev; struct param_d *param_probe; int ret; @@ -1833,13 +1846,16 @@ int mci_register(struct mci_host *host) mci->dev.id = DEVICE_ID_DYNAMIC; } + hw_dev = host->hw_dev; mci->dev.platform_data = host; - mci->dev.parent = host->hw_dev; + mci->dev.parent = hw_dev; mci->host = host; host->mci = mci; mci->dev.detect = mci_detect; + if (!hw_dev->detect) + hw_dev->detect = mci_hw_detect; - host->supply = regulator_get(host->hw_dev, "vmmc"); + host->supply = regulator_get(hw_dev, "vmmc"); if (IS_ERR(host->supply)) { dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n"); host->supply = NULL; @@ -1849,7 +1865,7 @@ int mci_register(struct mci_host *host) if (ret) goto err_free; - dev_info(mci->host->hw_dev, "registered as %s\n", dev_name(&mci->dev)); + dev_info(hw_dev, "registered as %s\n", dev_name(&mci->dev)); param_probe = dev_add_param_bool(&mci->dev, "probe", mci_set_probe, NULL, &mci->probe, mci); diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c index 5e9f17def8..afd6a56397 100644 --- a/drivers/mci/mxs.c +++ b/drivers/mci/mxs.c @@ -542,13 +542,6 @@ static void mxs_mci_info(struct device_d *hw_dev) printf("\n"); } -static int mxs_mmc_detect(struct device_d *dev) -{ - struct mxs_mci_host *mxs_mci = dev->priv; - - return mci_detect_card(&mxs_mci->host); -} - static int mxs_mci_probe(struct device_d *hw_dev) { struct resource *iores; @@ -584,8 +577,6 @@ static int mxs_mci_probe(struct device_d *hw_dev) mci_of_parse(host); } - hw_dev->detect = mxs_mmc_detect; - mxs_mci->clk = clk_get(hw_dev, NULL); if (IS_ERR(mxs_mci->clk)) return PTR_ERR(mxs_mci->clk); diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c index fe0cd47a28..b141610325 100644 --- a/drivers/mci/omap_hsmmc.c +++ b/drivers/mci/omap_hsmmc.c @@ -581,13 +581,6 @@ static void mmc_set_ios(struct mci_host *mci, struct mci_ios *ios) writel(readl(&mmc_base->sysctl) | CEN_ENABLE, &mmc_base->sysctl); } -static int omap_mmc_detect(struct device_d *dev) -{ - struct omap_hsmmc *hsmmc = dev->priv; - - return mci_detect_card(&hsmmc->mci); -} - static int omap_mmc_probe(struct device_d *dev) { struct resource *iores; @@ -633,9 +626,6 @@ static int omap_mmc_probe(struct device_d *dev) mci_of_parse(&hsmmc->mci); - dev->priv = hsmmc; - dev->detect = omap_mmc_detect, - mci_register(&hsmmc->mci); return 0; diff --git a/drivers/mci/tegra-sdmmc.c b/drivers/mci/tegra-sdmmc.c index 1cc75dc524..15e33b85c5 100644 --- a/drivers/mci/tegra-sdmmc.c +++ b/drivers/mci/tegra-sdmmc.c @@ -379,13 +379,6 @@ static int tegra_sdmmc_card_present(struct mci_host *mci) return !(sdhci_read32(&host->sdhci, SDHCI_PRESENT_STATE) & SDHCI_WRITE_PROTECT); } -static int tegra_sdmmc_detect(struct device_d *dev) -{ - struct tegra_sdmmc_host *host = dev->priv; - - return mci_detect_card(&host->mci); -} - static void tegra_sdmmc_parse_dt(struct tegra_sdmmc_host *host) { struct device_node *np = host->mci.hw_dev->device_node; @@ -459,9 +452,6 @@ static int tegra_sdmmc_probe(struct device_d *dev) mci->host_caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED_52MHZ | MMC_CAP_SD_HIGHSPEED; - dev->priv = host; - dev->detect = tegra_sdmmc_detect; - return mci_register(&host->mci); } |