From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaehoon Chung Subject: Re: [PATCH 2/3] mmc: dw_mmc: simplify the SDMMC_CLKEN_LOW_PWR logic Date: Mon, 17 Aug 2015 10:55:19 +0900 Message-ID: <55D13F07.70309@samsung.com> References: <3d03bfe2c18789eefa038018467c9c63c94ae4a2.1439381423.git.hramrach@gmail.com> Reply-To: jh80.chung-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-reply-to: <3d03bfe2c18789eefa038018467c9c63c94ae4a2.1439381423.git.hramrach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Michal Suchanek , linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Seungwon Jeon , Ulf Hansson , Maxime Ripard , =?windows-1252?Q?David_Lanzend=F6rfer?= , Hans de Goede , Chen-Yu Tsai , Arnd Bergmann , linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-mmc@vger.kernel.org Hi, Michal. On 08/12/2015 09:23 PM, Michal Suchanek wrote: > The driver has open-coded test for SDIO cards. Use the mmc core provided > MMC_QUIRK_BROKEN_CLK_GATING flag instead. Did you use the clock-gating for SDIO cards? Doesn't MMC_CAP_SDIO_IRQ bit set? Which case is broken? Could you explain to me more? Best Regards, Jaehoon Chung > > As a bonus this may enable clock gating on SDIO cards that are known to > work with it. > > Signed-off-by: Michal Suchanek > --- > drivers/mmc/host/dw_mmc.c | 33 +++++++++++++++------------------ > 1 file changed, 15 insertions(+), 18 deletions(-) > > diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c > index 40e9d8e..3bc9fd7 100644 > --- a/drivers/mmc/host/dw_mmc.c > +++ b/drivers/mmc/host/dw_mmc.c > @@ -1335,27 +1335,24 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card) > * description of the CLKENA register we should disable low power mode > * for SDIO cards if we need SDIO interrupts to work. > */ > - if (mmc->caps & MMC_CAP_SDIO_IRQ) { > - const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id; > - u32 clk_en_a_old; > - u32 clk_en_a; > + const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id; > + u32 clk_en_a_old; > + u32 clk_en_a; > > - clk_en_a_old = mci_readl(host, CLKENA); > + clk_en_a_old = mci_readl(host, CLKENA); > > - if (card->type == MMC_TYPE_SDIO || > - card->type == MMC_TYPE_SD_COMBO) { > - set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); > - clk_en_a = clk_en_a_old & ~clken_low_pwr; > - } else { > - clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); > - clk_en_a = clk_en_a_old | clken_low_pwr; > - } > + if (card->quirks & MMC_QUIRK_BROKEN_CLK_GATING) { > + set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); > + clk_en_a = clk_en_a_old & ~clken_low_pwr; > + } else { > + clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags); > + clk_en_a = clk_en_a_old | clken_low_pwr; > + } > > - if (clk_en_a != clk_en_a_old) { > - mci_writel(host, CLKENA, clk_en_a); > - mci_send_cmd(slot, SDMMC_CMD_UPD_CLK | > - SDMMC_CMD_PRV_DAT_WAIT, 0); > - } > + if (clk_en_a != clk_en_a_old) { > + mci_writel(host, CLKENA, clk_en_a); > + mci_send_cmd(slot, SDMMC_CMD_UPD_CLK | > + SDMMC_CMD_PRV_DAT_WAIT, 0); > } > } > >