Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2842165pxb; Sun, 3 Oct 2021 07:13:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvx2noInWSeIyuE7hB1wDhJ5EIRtl1dbBhqwY1STIsU0IukZPEIv2bg9rQ3UTwYW2yLeOH X-Received: by 2002:a05:6402:21ef:: with SMTP id ce15mr11293634edb.19.1633270388869; Sun, 03 Oct 2021 07:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633270388; cv=none; d=google.com; s=arc-20160816; b=F9nnC1y7ru5rVJYsmW2RRouTdzGLvsWUHwfJhWkvzZnOrctl3liBfhcURlLasezvGi naMnZlcVF07ZumV/XahjoU9jl8AW5B1j2RrLfCpwTMALXfHwGq4edMwsur96VeoNLlLA gE4mevw2rI2x1e2YFs/BLibXqyTl21pnQUc9oWpt83yOtiy2aznTQY7gMH1910X1fRtP I9/DLPmlA8Rrhg/+P3coOO0VBN+aVng2h6gH6YkOKuuuYGJWFVZ/hxinrkKiDN5DXVy7 szr1uj821KctHXm4R77NBUxZrmVPRSP/lscNxxVHlT/xF5STF+t2P74rcXg/SVD6gB0W tV3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=9WrBX8ansHuvSpv9nqokuMgzB1KN55NYa8tseNN8L50=; b=x6Bvm35g8zbUw/a3dZxwBH0Brtv7OacxHMRrFTtdzGFcqG4XIbqZPqCwp0FnqBEoXK TEiQ9+KUOURB+svJf5bBzLyAnAjPy0SN2Agpvol7jaCITQmPUl70px0m7S/E7ZP5RpNc 1oA6niRjzzmidQTLBZYIRxZIInZO1aSFSOUeXP3s2TQh4P/P05guTZC8a3U0K8JJq+Tl XMdNpSwPIJwI6NDILS/fGF9Zqx++apNFIiIdckKQRYhKx6F75f2ISpbzmytdeG+9kUKu rDoSvG3EQBT2BeND9pYZWhPlEc+sKOtlUXYlXjj+LkkUPdrpCN4kF4x1XB3rduQxa7vj Sy2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGkLXN6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si13934516ejc.493.2021.10.03.07.12.24; Sun, 03 Oct 2021 07:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IGkLXN6U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbhJCOAS (ORCPT + 99 others); Sun, 3 Oct 2021 10:00:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230050AbhJCOAR (ORCPT ); Sun, 3 Oct 2021 10:00:17 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C42CC0613EC for ; Sun, 3 Oct 2021 06:58:30 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id om12-20020a17090b3a8c00b0019eff43daf5so10295797pjb.4 for ; Sun, 03 Oct 2021 06:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9WrBX8ansHuvSpv9nqokuMgzB1KN55NYa8tseNN8L50=; b=IGkLXN6UzlOWMlfGr4FAb3ik+X6qyXcxNST8j4Y8fkYbAcYrpwSy9GUIyx1zE04SK+ BA2M/fGND4PLfs8KN65Nh8QDPGtCJeTD2lmMor9agL6KftLRg4rFc/aaVIuICmfIB2gM 9zIG6PbGz6exAoMxFmGgwug3MZuSCcCy+RnvUI1POVAWsu4shjZ4D80Xun2ZyDzT11gJ pobg3xrvB3vOQN/NCGZPRYzaYa9qeFs7tebBZnsuE93TYtX1GAWPvlsW8CamgMjD3CUF NrC+050PzO2GUdwfqI0/mYJtAIBxKN43YlK1rRWoCv69uv4wevy6PY+sQDW7/dejU9ld dcGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9WrBX8ansHuvSpv9nqokuMgzB1KN55NYa8tseNN8L50=; b=5iF1YaFELqu1L4AAk0GmOAxr16nBS4qLcia+jHnLNnEXZcdoJqCcblRPS/tr+09VBh qXZoPFOXTgX23Hj98XGfz9arGSK/RhQnKeBeHaQ2hTQ8OVByBqhGuqdclnzFPBLVY4O8 eqGoSXhOBLagYowMOgiNboNNJtxa42MS8hamkSv1h0B5UJuMphsQp3mztLhQrmqne1W0 q2kLVLtgliFtTrFSXnWEDJG+0is6jn9IUs7KjbY6Stt/SxMmX2S49kI4CRxm33orfJ6R P67CXNhAY+cBG9UB7tU6T+HZ/23Ho2FMhrnrMOehjCYTu+1WIZ8pN5aMur4PXYyfl1sD XFTA== X-Gm-Message-State: AOAM532fgM3Jb3tn6LPwg+298VLZtR0sHNx8wUFk4VMEc7cwtgUHUIiW 7B/ZTI2ejypEi6jvzLgJPkQi0Q== X-Received: by 2002:a17:90a:1a4c:: with SMTP id 12mr24541653pjl.175.1633269510042; Sun, 03 Oct 2021 06:58:30 -0700 (PDT) Received: from dragon (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id 3sm10493334pjk.18.2021.10.03.06.58.28 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Oct 2021 06:58:29 -0700 (PDT) Date: Sun, 3 Oct 2021 21:58:23 +0800 From: Shawn Guo To: Ulf Hansson Cc: Adrian Hunter , Bjorn Andersson , linux-mmc , linux-arm-msm , Linux Kernel Mailing List Subject: Re: [RFC PATCH] mmc: sdhci: Map more voltage level to SDHCI_POWER_330 Message-ID: <20211003135822.GA13320@dragon> References: <20210926132847.22268-1-shawn.guo@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 30, 2021 at 01:00:03PM +0200, Ulf Hansson wrote: > On Sun, 26 Sept 2021 at 15:28, Shawn Guo wrote: > > > > On Thundercomm TurboX CM2290, the eMMC OCR reports vdd = 23 (3.5 ~ 3.6 V), > > which is being treated as an invalid value by sdhci_set_power_noreg(). > > And thus eMMC is totally broken on the platform. > > > > [ 1.436599] ------------[ cut here ]------------ > > [ 1.436606] mmc0: Invalid vdd 0x17 > > [ 1.436640] WARNING: CPU: 2 PID: 69 at drivers/mmc/host/sdhci.c:2048 sdhci_set_power_noreg+0x168/0x2b4 > > [ 1.436655] Modules linked in: > > [ 1.436662] CPU: 2 PID: 69 Comm: kworker/u8:1 Tainted: G W 5.15.0-rc1+ #137 > > [ 1.436669] Hardware name: Thundercomm TurboX CM2290 (DT) > > [ 1.436674] Workqueue: events_unbound async_run_entry_fn > > [ 1.436685] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) > > [ 1.436692] pc : sdhci_set_power_noreg+0x168/0x2b4 > > [ 1.436698] lr : sdhci_set_power_noreg+0x168/0x2b4 > > [ 1.436703] sp : ffff800010803a60 > > [ 1.436705] x29: ffff800010803a60 x28: ffff6a9102465f00 x27: ffff6a9101720a70 > > [ 1.436715] x26: ffff6a91014de1c0 x25: ffff6a91014de010 x24: ffff6a91016af280 > > [ 1.436724] x23: ffffaf7b1b276640 x22: 0000000000000000 x21: ffff6a9101720000 > > [ 1.436733] x20: ffff6a9101720370 x19: ffff6a9101720580 x18: 0000000000000020 > > [ 1.436743] x17: 0000000000000000 x16: 0000000000000004 x15: ffffffffffffffff > > [ 1.436751] x14: 0000000000000000 x13: 00000000fffffffd x12: ffffaf7b1b84b0bc > > [ 1.436760] x11: ffffaf7b1b720d10 x10: 000000000000000a x9 : ffff800010803a60 > > [ 1.436769] x8 : 000000000000000a x7 : 000000000000000f x6 : 00000000fffff159 > > [ 1.436778] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 00000000ffffffff > > [ 1.436787] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff6a9101718d80 > > [ 1.436797] Call trace: > > [ 1.436800] sdhci_set_power_noreg+0x168/0x2b4 > > [ 1.436805] sdhci_set_ios+0xa0/0x7fc > > [ 1.436811] mmc_power_up.part.0+0xc4/0x164 > > [ 1.436818] mmc_start_host+0xa0/0xb0 > > [ 1.436824] mmc_add_host+0x60/0x90 > > [ 1.436830] __sdhci_add_host+0x174/0x330 > > [ 1.436836] sdhci_msm_probe+0x7c0/0x920 > > [ 1.436842] platform_probe+0x68/0xe0 > > [ 1.436850] really_probe.part.0+0x9c/0x31c > > [ 1.436857] __driver_probe_device+0x98/0x144 > > [ 1.436863] driver_probe_device+0xc8/0x15c > > [ 1.436869] __device_attach_driver+0xb4/0x120 > > [ 1.436875] bus_for_each_drv+0x78/0xd0 > > [ 1.436881] __device_attach_async_helper+0xac/0xd0 > > [ 1.436888] async_run_entry_fn+0x34/0x110 > > [ 1.436895] process_one_work+0x1d0/0x354 > > [ 1.436903] worker_thread+0x13c/0x470 > > [ 1.436910] kthread+0x150/0x160 > > [ 1.436915] ret_from_fork+0x10/0x20 > > [ 1.436923] ---[ end trace fcfac44cb045c3a8 ]--- > > > > Fix the issue by mapping MMC_VDD_35_36 (and MMC_VDD_34_35) to > > SDHCI_POWER_330 as well. > > > > Signed-off-by: Shawn Guo > > --- > > I'm not sure if this is the right solution, as I do not have SDHCI > > specification. Hence it's a RFC. > > > > drivers/mmc/host/sdhci.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > > index 8eefa7d5fe85..2427481535a3 100644 > > --- a/drivers/mmc/host/sdhci.c > > +++ b/drivers/mmc/host/sdhci.c > > @@ -2042,6 +2042,8 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, > > break; > > case MMC_VDD_32_33: > > case MMC_VDD_33_34: > > + case MMC_VDD_34_35: > > + case MMC_VDD_35_36: > > pwr = SDHCI_POWER_330; > > The SDHCI specification doesn't state exactly what level > SDHCI_POWER_330 corresponds to. It's 3.3V typically. > > I don't have any strong opinion about this change, although I am a > little bit puzzled over why this solves the problem for you. > > Unless the host (sdhci) announces that it supports MMC_VDD_34_35 or > MMC_VDD_35_36 through its mmc->ocr_avail mask, the mmc core shouldn't > try to use it. Can you perhaps check what value the mmc->ocr_avail > gets assigned to in sdhci_setup_host() for your mmc host? Hi Ulf, Thanks for the comment! ocr_avail is 0xfff800, which is a result of mmc_regulator_get_ocrmask() call. On this platform, the vmmc has a 3.6V max voltage. I can enforce `regulator-max-microvolt` to be 3.3V to fix the problem, but I'm not sure it's more correct than this RFC change. Shawn