public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@kernel.org>
To: Iker Pedrosa <ikerpedrosam@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Yixun Lan <dlan@gentoo.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/10] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation
Date: Sat, 7 Mar 2026 10:29:51 +0800	[thread overview]
Message-ID: <20260307022951-GKC302167@kernel.org> (raw)
In-Reply-To: <20260302-orangepi-sd-card-uhs-v1-2-89c219973c0c@gmail.com>

Hi Iker,

On 16:13 Mon 02 Mar     , Iker Pedrosa wrote:
> Ensure SD card pins receive clock signals by enabling pad clock
> generation and overriding automatic clock gating. Required for all SD
> operation modes.
> 
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
>  drivers/mmc/host/sdhci-of-k1.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index 0cc97e23a2f9c7b2f9376318a8a7ebb860571504..b703b78282ed8d89183c816477c149c0a565618a 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -20,6 +20,13 @@
>  #include "sdhci.h"
>  #include "sdhci-pltfm.h"
>  
[snip]

> +	spacemit_sdhci_setbits(host, SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON,
> +			       SPACEMIT_SDHC_OP_EXT_REG);
As I'm testing on Bananapi F3 board with emmc chip, this line will cause timeout problem

[   27.613806] mmc2: Timeout waiting for hardware interrupt.
[   27.616592] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[   27.623007] mmc2: sdhci: Sys addr:  0x00000400 | Version:  0x00000002
[   27.629429] mmc2: sdhci: Blk size:  0x00007200 | Blk cnt:  0x000003a6
[   27.635853] mmc2: sdhci: Argument:  0x001ca0a0 | Trn mode: 0x0000002b
[   27.642277] mmc2: sdhci: Present:   0x01f70106 | Host ctl: 0x00000035
[   27.648700] mmc2: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[   27.655124] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000107
[   27.661547] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
[   27.667971] mmc2: sdhci: Int enab:  0x03ff000b | Sig enab: 0x03ff000b
[   27.674394] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   27.680818] mmc2: sdhci: Caps:      0x35fc0080 | Caps_1:   0x00002f77
[   27.687241] mmc2: sdhci: Cmd:       0x0000193a | Max curr: 0x00000000
[   27.693666] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0xfff6dbff
[   27.700088] mmc2: sdhci: Resp[2]:   0x320f5903 | Resp[3]:  0x00000900
[   27.706513] mmc2: sdhci: Host ctl2: 0x0000400d
[   27.710940] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x02080208
[   27.717363] mmc2: sdhci: ============================================

Drop it will make emmc work again.. but I'm still unable to make SD card driver work,
that's probably another problem

I've took a look at current K3's sdhci driver, all operations on SPACEMIT_SDHC_OP_EXT_REG
register are used only when doing voltage switch with SD card, snip of the code from vendor

	if (host->mmc->caps2 & MMC_CAP2_NO_MMC) {
                /* sd/sdio has no phy */
                spacemit_sdhci_setbits(host, SDHC_TX_INT_CLK_SEL, SPACEMIT_SDHC_TX_CFG_REG);

        } else {
                /* use phy func mode */
                spacemit_sdhci_setbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
                                       SPACEMIT_SDHC_PHY_CTRL_REG);
                spacemit_sdhci_clrsetbits(host, SDHC_PHY_DRIVE_SEL,
                                          SDHC_RX_BIAS_CTRL |
                                          FIELD_PREP(SDHC_PHY_DRIVE_SEL, 4),
                                          SPACEMIT_SDHC_PHY_PADCFG_REG);
                /* mmc card mode */
                spacemit_sdhci_setbits(host, SDHC_MMC_CARD_MODE, SPACEMIT_SDHC_MMC_CTRL_REG);
        }

-- 
Yixun Lan (dlan)

  reply	other threads:[~2026-03-07  2:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 15:13 [PATCH 00/10] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-03-02 15:13 ` [PATCH 01/10] dt-bindings: mmc: spacemit,sdhci: add AIB voltage switching registers Iker Pedrosa
2026-03-02 18:25   ` Conor Dooley
2026-03-02 22:38     ` Yixun Lan
2026-03-03 13:51       ` Iker Pedrosa
2026-03-03 22:28         ` Yixun Lan
2026-03-04  8:10           ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 02/10] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation Iker Pedrosa
2026-03-07  2:29   ` Yixun Lan [this message]
2026-03-09 10:32     ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 03/10] mmc: sdhci-of-k1: add regulator framework support Iker Pedrosa
2026-03-03  4:11   ` Yao Zi
2026-03-03 13:58     ` Iker Pedrosa
2026-03-09  6:34   ` Yixun Lan
2026-03-02 15:13 ` [PATCH 04/10] mmc: sdhci-of-k1: add pinctrl state switching for voltage changes Iker Pedrosa
2026-03-02 15:13 ` [PATCH 05/10] mmc: sdhci-of-k1: add AIB register support for voltage switching Iker Pedrosa
2026-03-02 15:13 ` [PATCH 06/10] mmc: sdhci-of-k1: add SDR tuning infrastructure Iker Pedrosa
2026-03-02 15:13 ` [PATCH 07/10] mmc: sdhci-of-k1: add comprehensive SDR tuning support Iker Pedrosa
2026-03-02 15:13 ` [PATCH 08/10] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-03-02 15:13 ` [PATCH 09/10] riscv: dts: spacemit: k1-orangepi-rv2: add PMIC and power infrastructure Iker Pedrosa
2026-03-02 15:13 ` [PATCH 10/10] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
2026-03-04 14:06 ` [PATCH 00/10] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Michael Opdenacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260307022951-GKC302167@kernel.org \
    --to=dlan@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@gentoo.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=javierm@redhat.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=michael.opdenacker@rootcommit.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox