Hi, On 03/27/2014 10:44 AM, Maxime Ripard wrote: > Hi Hans, > > On Wed, Mar 26, 2014 at 09:17:57PM +0100, Hans de Goede wrote: >> This is necessary to support the sun6i-a31. >> >> Signed-off-by: Hans de Goede <hdego...@redhat.com> >> --- >> drivers/mmc/host/sunxi-mmc.c | 19 +++++++++++++++++++ >> drivers/mmc/host/sunxi-mmc.h | 1 + >> 2 files changed, 20 insertions(+) >> >> diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c >> index a16abd2..6b864165 100644 >> --- a/drivers/mmc/host/sunxi-mmc.c >> +++ b/drivers/mmc/host/sunxi-mmc.c >> @@ -31,6 +31,7 @@ >> #include <linux/dma-mapping.h> >> #include <linux/slab.h> >> #include <linux/regulator/consumer.h> >> +#include <linux/reset.h> >> >> #include <linux/of_address.h> >> #include <linux/of_gpio.h> >> @@ -64,6 +65,16 @@ static int sunxi_mmc_init_host(struct mmc_host *mmc) >> return ret; >> } >> >> + if (smc_host->reset) { >> + ret = reset_control_deassert(smc_host->reset); >> + if (ret) { >> + dev_err(mmc_dev(smc_host->mmc), "reset err %d\n", ret); >> + clk_disable_unprepare(smc_host->clk_ahb); >> + clk_disable_unprepare(smc_host->clk_mod); >> + return ret; >> + } >> + } >> + >> /* reset controller */ >> rval = mci_readl(smc_host, REG_GCTRL) | SDXC_HARDWARE_RESET; >> mci_writel(smc_host, REG_GCTRL, rval); >> @@ -85,6 +96,10 @@ static int sunxi_mmc_init_host(struct mmc_host *mmc) >> static void sunxi_mmc_exit_host(struct sunxi_mmc_host *smc_host) >> { >> mci_writel(smc_host, REG_GCTRL, SDXC_HARDWARE_RESET); >> + >> + if (smc_host->reset) >> + reset_control_assert(smc_host->reset); >> + >> clk_disable_unprepare(smc_host->clk_ahb); >> clk_disable_unprepare(smc_host->clk_mod); >> } >> @@ -738,6 +753,10 @@ static int sunxi_mmc_resource_request(struct >> sunxi_mmc_host *host, >> return PTR_ERR(host->clk_mod); >> } >> >> + host->reset = devm_reset_control_get(&pdev->dev, "reset"); > > You can probably use reset_control_get_optional here (not that it > matters much in this case, but anyway...)
That does not exist: http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/include/linux/reset.h Only the regulator framework has this _optional thing which you need to use to avoid it logging errors. In the phy / reset case you're expected to log an error yourself if an error is fatal and there only is a standard _get (AFAIK). > >> + if (IS_ERR(host->reset)) >> + host->reset = NULL; /* Having a reset controller is optional */ >> + > > And you should handle EPROBE_DEFER too. A yes, good one, will fix. David I'm going to fix this in my personal tree, if you merge the reset controller code into the existing mmc patches, please make sure you take the latest version of the patch from my personal tree. Regards, Hans -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.