diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-06-19 06:50:46 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-24 08:53:47 +0200 |
commit | a3cf324593eada0065d63e8db9d95bf7ee788ba0 (patch) | |
tree | e21e0975135b76a4b215607723624d08cdb333e4 /drivers | |
parent | d5536e6006baa40076dfd27ffce49d5bc54736b0 (diff) | |
download | barebox-a3cf324593eada0065d63e8db9d95bf7ee788ba0.tar.gz barebox-a3cf324593eada0065d63e8db9d95bf7ee788ba0.tar.xz |
mci: dw_mmc: add optional reset line
The bindings describe a reset line for the MMC controller and we have
boards with device tree that contain a reset line that barebox has so
far never acted upon. For the StarFive, we need the reset, so have the
driver toggle it optionally if specified. This change wasn't tested
on existing users of the driver, like the SoCFPGA or the Rockchip
rk2928 and rk3288.
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210619045055.779-21-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mci/dw_mmc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/mci/dw_mmc.c b/drivers/mci/dw_mmc.c index 930b538adc..ad1d2a06b9 100644 --- a/drivers/mci/dw_mmc.c +++ b/drivers/mci/dw_mmc.c @@ -17,6 +17,7 @@ #include <io.h> #include <platform_data/dw_mmc.h> #include <linux/bitops.h> +#include <linux/reset.h> #include <linux/clk.h> #include <linux/err.h> #include <errno.h> @@ -548,6 +549,7 @@ static int dwmci_init(struct mci_host *mci, struct device_d *dev) static int dw_mmc_probe(struct device_d *dev) { + struct reset_control *rst; struct resource *iores; struct dwmci_host *host; struct dw_mmc_platform_data *pdata = dev->platform_data; @@ -568,6 +570,15 @@ static int dw_mmc_probe(struct device_d *dev) clk_enable(host->clk_biu); clk_enable(host->clk_ciu); + rst = reset_control_get(dev, "reset"); + if (IS_ERR(rst)) { + dev_warn(dev, "error claiming reset: %pe\n", rst); + } else if (rst) { + reset_control_assert(rst); + udelay(10); + reset_control_deassert(rst); + } + iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) return PTR_ERR(iores); |