From: Hiago De Franco <hfranco@baylibre.com>
To: Andrei Lalaev <andrey.lalaev@gmail.com>
Cc: u-boot@lists.denx.de, u-boot@lists.u-boot-project.org
Subject: Re: [PATCH v2 0/2] board: sophgo: add support for Milk-V Duo 256M
Date: Fri, 4 Sep 2026 17:29:21 -0300 [thread overview]
Message-ID: <apsphFWUeaW6MpJF@hiagonb> (raw)
In-Reply-To: <fc19ff71-06ec-4bae-8684-9c6f1e6be5a0@gmail.com>
Hi Andrei,
On Sun, Aug 30, 2026 at 05:29:59PM +0200, Andrei Lalaev wrote:
> Hi Hiago,
>
> So, I've dumped the registers using downstream U-Boot and yes, Claude was right.
> By default, downstream driver configures the PHY, so the PHY registers
> have the following values:
>
> # PHY_TX_RX_DLY
> milkv_duo_256m# md.l 0x04310240 1
> 04310240: 01000100 ....
>
> # PHY_CONFIG
> milkv_duo_256m# md.l 0x0431024c 1
> 0431024c: 00000001 ....
>
>
> With upstream U-Boot, the same registers are always 0.
>
> Simply setting `PHY_TX_RX_DLY` to `0x01000100` is enough to get
> the SD card working.
>
> The attached patch contains the backported PHY configuration from the downstream
> driver & upstream kernel. Could you please take a look and check if it
> resolves the issue on your side when increasing the clock?
First, apologies for the delay on my answer, it was a busy week.
I tested your patch and it works fine ;)
Thanks for the fix. Would you mind sending this patch to u-boot ML?
If you do, add:
Fixes: eb36f28ff721 ("mmc: cv1800b: Add sdhci driver support for cv1800b SoC")
>
> Thank you!
>
> ---
> drivers/mmc/cv1800b_sdhci.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/mmc/cv1800b_sdhci.c b/drivers/mmc/cv1800b_sdhci.c
> index b756649f90f3..5c129682daba 100644
> --- a/drivers/mmc/cv1800b_sdhci.c
> +++ b/drivers/mmc/cv1800b_sdhci.c
> @@ -8,11 +8,17 @@
> #include <sdhci.h>
> #include <linux/delay.h>
>
> +#define CV18XX_SDHCI_MSHC_CTRL 0x200
> +#define CV18XX_SDHCI_PHY_CONFIG 0x24c
> #define SDHCI_PHY_TX_RX_DLY 0x240
> #define MMC_MAX_CLOCK 375000000
> #define TUNE_MAX_PHCODE 128
>
> #define PHY_TX_SRC_INVERT BIT(8)
> +#define PHY_RX_SRC_INVERT BIT(24)
> +
> +#define CV18XX_LATANCY_1T BIT(1)
> +#define CV18XX_PHY_TX_BPS BIT(0)
>
> struct cv1800b_sdhci_plat {
> struct mmc_config cfg;
> @@ -64,10 +70,29 @@ static int cv1800b_execute_tuning(struct mmc *mmc, u8 opcode)
> }
> #endif
>
> +static int cv1800b_deferred_probe(struct sdhci_host *host)
> +{
> + u32 val;
> +
> + val = sdhci_readl(host, CV18XX_SDHCI_MSHC_CTRL);
> + val |= CV18XX_LATANCY_1T;
> + sdhci_writel(host, val, CV18XX_SDHCI_MSHC_CTRL);
> +
> + val = sdhci_readl(host, CV18XX_SDHCI_PHY_CONFIG);
> + val |= CV18XX_PHY_TX_BPS;
> + sdhci_writel(host, val, CV18XX_SDHCI_PHY_CONFIG);
> +
> + val = PHY_TX_SRC_INVERT | PHY_RX_SRC_INVERT;
> + sdhci_writel(host, val, SDHCI_PHY_TX_RX_DLY);
> +
> + return 0;
> +}
> +
> const struct sdhci_ops cv1800b_sdhci_sd_ops = {
> #if CONFIG_IS_ENABLED(MMC_SUPPORTS_TUNING)
> .platform_execute_tuning = cv1800b_execute_tuning,
> #endif
> + .deferred_probe = cv1800b_deferred_probe,
> };
>
> static int cv1800b_sdhci_bind(struct udevice *dev)
> --
> 2.55.0
>
>
> --
> Best regards,
> Andrei Lalaev
Regards,
--
Hiago
next prev parent reply other threads:[~2026-09-04 20:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 14:44 [PATCH v2 0/2] board: sophgo: add support for Milk-V Duo 256M Hiago De Franco
2026-07-23 14:44 ` [PATCH v2 1/2] board: sophgo: move ethernet driver to common directory Hiago De Franco
2026-08-05 15:29 ` Leo Liang via U-Boot
2026-07-23 14:44 ` [PATCH v2 2/2] board: sophgo: add support for Milk-V Duo 256M Hiago De Franco
2026-08-05 15:31 ` Leo Liang via U-Boot
2026-08-05 15:50 ` [PATCH v2 0/2] " Leo Liang via U-Boot
2026-08-22 9:15 ` Andrei Lalaev
2026-08-25 12:24 ` Hiago De Franco
2026-08-25 18:01 ` Andrei Lalaev
2026-08-27 13:30 ` Hiago De Franco
2026-08-27 16:04 ` Andrei Lalaev
2026-08-30 15:29 ` Andrei Lalaev
2026-09-04 20:29 ` Hiago De Franco [this message]
2026-09-05 13:34 ` Andrei Lalaev
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=apsphFWUeaW6MpJF@hiagonb \
--to=hfranco@baylibre.com \
--cc=andrey.lalaev@gmail.com \
--cc=u-boot@lists.denx.de \
--cc=u-boot@lists.u-boot-project.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