On 2/04/20 2:54 pm, Michał Mirosław wrote: > Move clock frequency limit for SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN where > it belongs. Did you consider getting rid of SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN and handling it in sdhci-of-arasan instead? > > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx> > --- > drivers/mmc/host/sdhci-of-arasan.c | 7 ++++--- > drivers/mmc/host/sdhci.c | 3 +-- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c > index d4905c106c06..5e3b9131a631 100644 > --- a/drivers/mmc/host/sdhci-of-arasan.c > +++ b/drivers/mmc/host/sdhci-of-arasan.c > @@ -339,7 +339,6 @@ static const struct sdhci_pltfm_data sdhci_arasan_pdata = { > .ops = &sdhci_arasan_ops, > .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, > .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | > - SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | > SDHCI_QUIRK2_STOP_WITH_TC, > }; > > @@ -410,8 +409,7 @@ static const struct sdhci_ops sdhci_arasan_cqe_ops = { > static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = { > .ops = &sdhci_arasan_cqe_ops, > .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, > - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | > - SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, > + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, > }; > > static struct sdhci_arasan_of_data sdhci_arasan_rk3399_data = { > @@ -1155,6 +1153,9 @@ static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) > bool dma64; > int ret; > > + if (sdhci_pltfm_clk_get_max_clock(host) <= 25000000) > + host->quirks2 |= SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN; > + > if (!sdhci_arasan->has_cqe) > return sdhci_add_host(host); > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index a043bf5e3565..ed88ac4e4cf3 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -1809,8 +1809,7 @@ u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock, > /* Version 3.00 divisors must be a multiple of 2. */ > if (host->max_clk <= clock) { > div = 1; > - if ((host->quirks2 & SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN) > - && host->max_clk <= 25000000) > + if (host->quirks2 & SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN) > div = 2; > } else { > for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; >