From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938299AbdAIFl0 (ORCPT ); Mon, 9 Jan 2017 00:41:26 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:48759 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932110AbdAIFlY (ORCPT ); Mon, 9 Jan 2017 00:41:24 -0500 X-AuditID: b6c32a2d-f79a76d0000074b4-4e-587322809ee8 Subject: Re: [PATCH v4] mmc: dw_mmc: force setup bus if active slots exist To: Ziyuan , Shawn Lin , ulf.hansson@linaro.org Cc: randy.li@rock-chips.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org From: Jaehoon Chung Message-id: <7c41a01e-ded2-9c03-78d9-c0b75984bf20@samsung.com> Date: Mon, 09 Jan 2017 14:41:20 +0900 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-version: 1.0 In-reply-to: <587305E5.30003@rock-chips.com> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgk+LIzCtJLcpLzFFi42LZdlhTXbdBqTjCoP27lcXlXXPYLI7872e0 +PTgP7PFom3bmCzuPFnPanF8bbjFkvmhDuwed67tYfPYvKTe4++s/SwenzfJBbBEpdpkpCam pBYppOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAK1XUihLzCkFCgUk Fhcr6dvZFOWXlqQqZOQXl9gqRRsaGukZGpjrGRkZ6ZkYx1oZmQKVJKRmvH39i6lgikTFkt8H GBsYLwh1MXJySAiYSPT9O8wCYYtJXLi3nq2LkYtDSGApo8TbW++gnHYmiXkXOhlhOr697maH SMxhlDj0cAoTSEJI4B6jxJ9mRxBbWMBL4sWtJ8wgtohAksSXv1fZQWxmgSqJb3+WgcXZBHQk t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jAQlzArXePZQLYjIL6Enc v6gFMVxeYvOat8wTGIGORGiYhVA1C0nVAkbmVYwSqQXJBcVJ6blGeanlesWJucWleel6yfm5 mxjB8fRMegfj4V3uhxgFOBiVeHgrThdFCLEmlhVX5h5ilOBgVhLhdZQvjhDiTUmsrEotyo8v Ks1JLT7EaAr0xERmKdHkfGCs55XEG5qYm5gbG1iYW1qaGCmJ8zbOfhYuJJCeWJKanZpakFoE 08fEwSnVwBiQL/Ld+6LBwcaCmxNK/DfJmy1x9mwWsas1V467sjxlG4vmo90m2zVj1JbPm9pR 5trFFPNsv9sVez+FzNlHDe6+CT0v3Zeyf++r41rxUz6a9NsfXprzsTLcqNnO3oDZ/4lOgm7j /wcmS0Jecq/nWLdMV/KaD79mikZ75hanojuaO7MynBqdlViKMxINtZiLihMBO0WPAL0CAAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170109054120epcas5p2c57d19aac60d5941bf756ca58cac81b7 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?7KCV7J6s7ZuIG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbUzUo7LGF7J6EKS/ssYXsnoQ=?= X-Global-Sender: =?UTF-8?B?SmFlaG9vbiBDaHVuZxtUaXplbiBQbGF0Zm9ybSBMYWIuG1Nh?= =?UTF-8?B?bXN1bmcgRWxlY3Ryb25pY3MbUzUvU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20170109033926epcas4p3d4ad93f61a96f2c8d5ff5405bb3fc9cc X-RootMTR: 20170109033926epcas4p3d4ad93f61a96f2c8d5ff5405bb3fc9cc References: <1483601012-18241-1-git-send-email-xzy.xu@rock-chips.com> <49544a65-9b3c-c56a-e5f7-89c5fa6e6cd0@rock-chips.com> <587305E5.30003@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/09/2017 12:39 PM, Ziyuan wrote: > > > On 01/05/2017 03:34 PM, Shawn Lin wrote: >> On 2017/1/5 15:23, Ziyuan Xu wrote: >>> It's necessary to setup bus if any slots are present. >>> - update clock after ctrl reset >>> - if the host has genpd node, we can guarantee the clock is available >>> before starting request. Otherwies, the clock register is reset once >>> power off the pd, and host can't output the active clock during >>> communication. >>> >>> fixes: e9ed8835e990 ("mmc: dw_mmc: add runtime PM callback") >>> Reported-by: Randy Li >>> Signed-off-by: Ziyuan Xu >>> >>> --- >>> Hi guys, >>> >>> I found a similar issue on rk3399 platform, which has a genpd node for >>> SD card host. Power off-on pd will reset the registers to a default >>> value (ie. CLKENA), so that the host can't output the active clock >>> during communication. >>> >> >> Indeed, Caesar recently introduced all the genpd for rk3399 platform, >> so we need to restore them. >> >>> So we need to setup bus in rpm resume. It also wraps the update clock >>> behaviour which I did in V3. >>> >>> Thanks, >>> Ziyuan Xu >>> >>> >>> Changes in v4: >>> - update commit message >>> - fix SD host rpm resume can't work >>> >>> Changes in v3: >>> - only reset host with active slot. >>> >>> Changes in v2: >>> - update the commit message >>> - use dw_mci_reset instead of dw_mci_ctrl_reset >>> >>> drivers/mmc/host/dw_mmc.c | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c >>> index b44306b..b6053b3 100644 >>> --- a/drivers/mmc/host/dw_mmc.c >>> +++ b/drivers/mmc/host/dw_mmc.c >>> @@ -3354,10 +3354,10 @@ int dw_mci_runtime_resume(struct device *dev) >>> >>> if (!slot) >>> continue; >>> - if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) { >>> + if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) >>> dw_mci_set_ios(slot->mmc, &slot->mmc->ios); >>> - dw_mci_setup_bus(slot, true); >>> - } >>> + /* Force setup bus to guarantee available clock output */ >>> + dw_mci_setup_bus(slot, true); >> >> So the spamming message about >> >> "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ div = %d)\n" >> >> will always be there, right? So you could append a new patch to shut >> up it as I think it's useless no matter for system pm or rpm to print >> it. How about? > > Fine, it's favourable with dev_vdbg if the dw_mmc rpm is enabled. > Hi Jaehoon, > What's your opinion? If you think this patch and shawn's advice are acceptable, I will send the v5 patch. I don't agreed to use dev_vdbg()..but it needs not to display at everytime. Hmm..It needs to consider more..because we needs to see the clock value when it's initialized. Best Regards, Jaehoon Chung > > BR > Ziyuan Xu > >> >>> } >>> >>> /* Now that slots are all setup, we can enable card detect */ >>> >> >> > > > > >