* [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs
@ 2020-05-17 18:19 Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-05-17 18:19 UTC (permalink / raw)
To: barebox; +Cc: Lucas Stach, Ahmad Fatoum
A barebox environment oftree node may reference its storage by a phandle
to a partition node under a MCI node. barebox will then call the
device's detect method to detect the card if this hasn't happened
before. Out of 17 MCI drivers, 8 host drivers already implement
a detect method, which just calls mci_detect_card.
Provide a generic implementation that does the same.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
Cc: Lucas Stach <lst@pengutronix.de>
---
drivers/mci/mci-core.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index e8844a3c0007..ab80c4d5ba5c 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1806,9 +1806,14 @@ int mci_detect_card(struct mci_host *host)
static int mci_detect(struct device_d *dev)
{
- struct mci *mci = container_of(dev, struct mci, dev);
+ struct mci *mci;
+
+ list_for_each_entry(mci, &mci_list, list) {
+ if (dev == &mci->dev || dev == mci->host->hw_dev)
+ return mci_detect_card(mci->host);
+ }
- return mci_detect_card(mci->host);
+ return -ENODEV;
}
/**
@@ -1819,6 +1824,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 +1839,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_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 +1858,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);
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers
2020-05-17 18:19 [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Ahmad Fatoum
@ 2020-05-17 18:19 ` Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 3/3] mci: reword MCI_STARTUP text Ahmad Fatoum
2020-05-18 6:17 ` [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-05-17 18:19 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Previous commit introduced a fall-back MCI hw_dev->detect
implementation. All drivers touched in this commit populate hw_dev, so
lets drop their now-superfluous detect implementations.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mci/bcm2835-sdhost.c | 10 ----------
drivers/mci/dove-sdhci.c | 8 --------
drivers/mci/dw_mmc.c | 11 -----------
drivers/mci/imx-esdhc.c | 11 -----------
drivers/mci/mci-bcm2835.c | 10 ----------
drivers/mci/mxs.c | 9 ---------
drivers/mci/omap_hsmmc.c | 10 ----------
drivers/mci/tegra-sdmmc.c | 10 ----------
8 files changed, 79 deletions(-)
diff --git a/drivers/mci/bcm2835-sdhost.c b/drivers/mci/bcm2835-sdhost.c
index 1d3a6c096910..f935ed5ea713 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 cb052e81b1e4..e09147fff9f7 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 f035317ef285..ab8270814b86 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 bff8dd67ada2..314a2264f952 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 b18d681870a5..c463c623e75f 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/mxs.c b/drivers/mci/mxs.c
index 5e9f17def8eb..afd6a563970d 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 fe0cd47a2822..b14161032594 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 1cc75dc524d4..15e33b85c598 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);
}
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/3] mci: reword MCI_STARTUP text
2020-05-17 18:19 [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
@ 2020-05-17 18:19 ` Ahmad Fatoum
2020-05-18 6:17 ` [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-05-17 18:19 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
With the recent addition of a generic device_detect for MCI devices,
the MCI_STARTUP help text is no longer accurate. Reword it, but leave
the option as-is as some boards may be broken if we drop the option
(e.g. because they still depend on a probe order or call
default_environment_path_set, but don't explicitly detect the device).
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mci/Kconfig | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mci/Kconfig b/drivers/mci/Kconfig
index 60c60ceaa527..6ae1e812528c 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"
--
2.26.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs
2020-05-17 18:19 [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 3/3] mci: reword MCI_STARTUP text Ahmad Fatoum
@ 2020-05-18 6:17 ` Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-05-18 6:17 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, Lucas Stach
On Sun, May 17, 2020 at 08:19:39PM +0200, Ahmad Fatoum wrote:
> A barebox environment oftree node may reference its storage by a phandle
> to a partition node under a MCI node. barebox will then call the
> device's detect method to detect the card if this hasn't happened
> before. Out of 17 MCI drivers, 8 host drivers already implement
> a detect method, which just calls mci_detect_card.
>
> Provide a generic implementation that does the same.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> Cc: Lucas Stach <lst@pengutronix.de>
> ---
> drivers/mci/mci-core.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> index e8844a3c0007..ab80c4d5ba5c 100644
> --- a/drivers/mci/mci-core.c
> +++ b/drivers/mci/mci-core.c
> @@ -1806,9 +1806,14 @@ int mci_detect_card(struct mci_host *host)
>
> static int mci_detect(struct device_d *dev)
> {
> - struct mci *mci = container_of(dev, struct mci, dev);
> + struct mci *mci;
> +
> + list_for_each_entry(mci, &mci_list, list) {
> + if (dev == &mci->dev || dev == mci->host->hw_dev)
> + return mci_detect_card(mci->host);
> + }
I think it would look better to keep the existing mci_detect function
and add a new mci_hw_detect which does the loop for the hw device only.
Otherwise I'm happy with this approach.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs
@ 2020-06-02 8:00 Ahmad Fatoum
2020-06-02 8:00 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2020-06-02 8:00 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
A barebox environment oftree node may reference its storage by a phandle
to a partition node under a MCI node. barebox will then call the
device's detect method to detect the card if this hasn't happened
before. Out of 17 MCI drivers, 8 host drivers already implement
a detect method, which just calls mci_detect_card.
Provide a generic implementation that does the same.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mci/mci-core.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index e8844a3c0007..09e66bad472e 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->dev || 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);
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers
2020-06-02 8:00 Ahmad Fatoum
@ 2020-06-02 8:00 ` Ahmad Fatoum
0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2020-06-02 8:00 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Previous commit introduced a fall-back MCI hw_dev->detect
implementation. All drivers touched in this commit populate hw_dev, so
lets drop their now-superfluous detect implementations.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/mci/bcm2835-sdhost.c | 10 ----------
drivers/mci/dove-sdhci.c | 8 --------
drivers/mci/dw_mmc.c | 11 -----------
drivers/mci/imx-esdhc.c | 11 -----------
drivers/mci/mci-bcm2835.c | 10 ----------
drivers/mci/mxs.c | 9 ---------
drivers/mci/omap_hsmmc.c | 10 ----------
drivers/mci/tegra-sdmmc.c | 10 ----------
8 files changed, 79 deletions(-)
diff --git a/drivers/mci/bcm2835-sdhost.c b/drivers/mci/bcm2835-sdhost.c
index 1d3a6c096910..f935ed5ea713 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 cb052e81b1e4..e09147fff9f7 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 f035317ef285..ab8270814b86 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 bff8dd67ada2..314a2264f952 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 b18d681870a5..c463c623e75f 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/mxs.c b/drivers/mci/mxs.c
index 5e9f17def8eb..afd6a563970d 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 fe0cd47a2822..b14161032594 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 1cc75dc524d4..15e33b85c598 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);
}
--
2.27.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-02 8:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 18:19 [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
2020-05-17 18:19 ` [PATCH 3/3] mci: reword MCI_STARTUP text Ahmad Fatoum
2020-05-18 6:17 ` [PATCH 1/3] mci: define fall-back hw_dev->detect for all MCIs Sascha Hauer
2020-06-02 8:00 Ahmad Fatoum
2020-06-02 8:00 ` [PATCH 2/3] mci: remove now-duplicate dev->detect implementations in host drivers Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox