Message ID | 20210619225118.1862634-2-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] mmc: mmci: De-assert reset on probe | expand |
On Sun, 20 Jun 2021 at 00:54, Linus Walleij <linus.walleij@linaro.org> wrote: > > The .hw_reset() callback is optionally called when attaching > a host if and only if MMC_CAP_HW_RESET is set on the host, > which can be done from the device tree by putting the flag > cap-mmc-hw-reset in the DT node. This is sometimes helpful > for eMMC. > > Cc: Russell King <linux@armlinux.org.uk> > Cc: Yann Gautier <yann.gautier@foss.st.com> > Cc: Ludovic Barre <ludovic.barre@st.com> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > drivers/mmc/host/mmci.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > index af2ed6013ef9..97fa5e67ca0c 100644 > --- a/drivers/mmc/host/mmci.c > +++ b/drivers/mmc/host/mmci.c > @@ -1883,6 +1883,15 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) > return ret; > } > > +static void mmci_hw_reset(struct mmc_host *mmc) > +{ > + struct mmci_host *host = mmc_priv(mmc); > + > + reset_control_assert(host->rst); > + udelay(2); > + reset_control_deassert(host->rst); > +} Unfortunately, this is not the purpose of the ->hw_reset() ops. Instead, it's supposed to be used to make a HW reset of the card, not the controller. > + > static struct mmc_host_ops mmci_ops = { > .request = mmci_request, > .pre_req = mmci_pre_request, > @@ -1891,6 +1900,7 @@ static struct mmc_host_ops mmci_ops = { > .get_ro = mmc_gpio_get_ro, > .get_cd = mmci_get_cd, > .start_signal_voltage_switch = mmci_sig_volt_switch, > + .hw_reset = mmci_hw_reset, > }; > > static void mmci_probe_level_translator(struct mmc_host *mmc) > -- > 2.31.1 > Kind regards Uffe
On Tue, Jun 29, 2021 at 1:47 PM Ulf Hansson <ulf.hansson@linaro.org> wrote: > > +static void mmci_hw_reset(struct mmc_host *mmc) > > +{ > > + struct mmci_host *host = mmc_priv(mmc); > > + > > + reset_control_assert(host->rst); > > + udelay(2); > > + reset_control_deassert(host->rst); > > +} > > Unfortunately, this is not the purpose of the ->hw_reset() ops. > Instead, it's supposed to be used to make a HW reset of the card, not > the controller. OK I see, let's skip this patch. I think patch 1 & 3 should be fine though? Yours, Linus Walleij
On Wed, 30 Jun 2021 at 02:32, Linus Walleij <linus.walleij@linaro.org> wrote: > > On Tue, Jun 29, 2021 at 1:47 PM Ulf Hansson <ulf.hansson@linaro.org> wrote: > > > > +static void mmci_hw_reset(struct mmc_host *mmc) > > > +{ > > > + struct mmci_host *host = mmc_priv(mmc); > > > + > > > + reset_control_assert(host->rst); > > > + udelay(2); > > > + reset_control_deassert(host->rst); > > > +} > > > > Unfortunately, this is not the purpose of the ->hw_reset() ops. > > Instead, it's supposed to be used to make a HW reset of the card, not > > the controller. > > OK I see, let's skip this patch. > > I think patch 1 & 3 should be fine though? Yes. I have a minor comment on patch 1 though. Kind regards Uffe
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index af2ed6013ef9..97fa5e67ca0c 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1883,6 +1883,15 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) return ret; } +static void mmci_hw_reset(struct mmc_host *mmc) +{ + struct mmci_host *host = mmc_priv(mmc); + + reset_control_assert(host->rst); + udelay(2); + reset_control_deassert(host->rst); +} + static struct mmc_host_ops mmci_ops = { .request = mmci_request, .pre_req = mmci_pre_request, @@ -1891,6 +1900,7 @@ static struct mmc_host_ops mmci_ops = { .get_ro = mmc_gpio_get_ro, .get_cd = mmci_get_cd, .start_signal_voltage_switch = mmci_sig_volt_switch, + .hw_reset = mmci_hw_reset, }; static void mmci_probe_level_translator(struct mmc_host *mmc)
The .hw_reset() callback is optionally called when attaching a host if and only if MMC_CAP_HW_RESET is set on the host, which can be done from the device tree by putting the flag cap-mmc-hw-reset in the DT node. This is sometimes helpful for eMMC. Cc: Russell King <linux@armlinux.org.uk> Cc: Yann Gautier <yann.gautier@foss.st.com> Cc: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- drivers/mmc/host/mmci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)