Message ID | 1524817045-31252-2-git-send-email-ley.foon.tan@intel.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | drivers: Add reset ctrl to drivers | expand |
On 04/27/2018 10:17 AM, Ley Foon Tan wrote: > Add code to reset all reset signals as in mmc DT node. A reset property is an optional feature, > so only print out a warning and do not fail if a reset property is not present. > > If a reset property is discovered, then use it to deassert, thus bringing the > IP out of reset. > > Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> > --- > drivers/mmc/socfpga_dw_mmc.c | 19 +++++++++++++++++++ Isn't this generic to the DWMMC core driver ? > 1 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c > index 9ace505..3a110a8 100644 > --- a/drivers/mmc/socfpga_dw_mmc.c > +++ b/drivers/mmc/socfpga_dw_mmc.c > @@ -14,6 +14,7 @@ > #include <linux/libfdt.h> > #include <linux/err.h> > #include <malloc.h> > +#include <reset.h> > > DECLARE_GLOBAL_DATA_PTR; > > @@ -34,6 +35,22 @@ struct dwmci_socfpga_priv_data { > unsigned int smplsel; > }; > > +static void socfpga_dwmci_reset(struct udevice *dev) > +{ > +#ifdef CONFIG_DM_RESET > + struct reset_ctl_bulk reset_bulk; > + int ret; > + > + ret = reset_get_bulk(dev, &reset_bulk); > + if (ret) { > + dev_warn(dev, "Can't get reset: %d\n", ret); > + return; > + } > + > + reset_deassert_bulk(&reset_bulk); > +#endif > +} > + > static void socfpga_dwmci_clksel(struct dwmci_host *host) > { > struct dwmci_socfpga_priv_data *priv = host->priv; > @@ -110,6 +127,8 @@ static int socfpga_dwmmc_probe(struct udevice *dev) > struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev); > struct dwmci_host *host = &priv->host; > > + socfpga_dwmci_reset(dev); > + > #ifdef CONFIG_BLK > dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000); > host->mmc = &plat->mmc; >
On Fri, Apr 27, 2018 at 4:27 PM, Marek Vasut <marex@denx.de> wrote: > On 04/27/2018 10:17 AM, Ley Foon Tan wrote: >> Add code to reset all reset signals as in mmc DT node. A reset property is an optional feature, >> so only print out a warning and do not fail if a reset property is not present. >> >> If a reset property is discovered, then use it to deassert, thus bringing the >> IP out of reset. >> >> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> >> --- >> drivers/mmc/socfpga_dw_mmc.c | 19 +++++++++++++++++++ > > Isn't this generic to the DWMMC core driver ? Yes, can add to DWMMC core for all platforms. Will update this. Thanks. Regards Ley Foon
diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c index 9ace505..3a110a8 100644 --- a/drivers/mmc/socfpga_dw_mmc.c +++ b/drivers/mmc/socfpga_dw_mmc.c @@ -14,6 +14,7 @@ #include <linux/libfdt.h> #include <linux/err.h> #include <malloc.h> +#include <reset.h> DECLARE_GLOBAL_DATA_PTR; @@ -34,6 +35,22 @@ struct dwmci_socfpga_priv_data { unsigned int smplsel; }; +static void socfpga_dwmci_reset(struct udevice *dev) +{ +#ifdef CONFIG_DM_RESET + struct reset_ctl_bulk reset_bulk; + int ret; + + ret = reset_get_bulk(dev, &reset_bulk); + if (ret) { + dev_warn(dev, "Can't get reset: %d\n", ret); + return; + } + + reset_deassert_bulk(&reset_bulk); +#endif +} + static void socfpga_dwmci_clksel(struct dwmci_host *host) { struct dwmci_socfpga_priv_data *priv = host->priv; @@ -110,6 +127,8 @@ static int socfpga_dwmmc_probe(struct udevice *dev) struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev); struct dwmci_host *host = &priv->host; + socfpga_dwmci_reset(dev); + #ifdef CONFIG_BLK dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000); host->mmc = &plat->mmc;
Add code to reset all reset signals as in mmc DT node. A reset property is an optional feature, so only print out a warning and do not fail if a reset property is not present. If a reset property is discovered, then use it to deassert, thus bringing the IP out of reset. Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> --- drivers/mmc/socfpga_dw_mmc.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)