LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
@ 2023-12-06  8:09 Drew Fustini
  2023-12-06  8:09 ` [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520 Drew Fustini
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Drew Fustini @ 2023-12-06  8:09 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree, Drew Fustini

This series enables the MMC controller in the T-Head TH1520 SoC and
enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
LicheePi 4A.

The drivers/mmc/host patches from v6 were applied by Ulf and are already
in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
only a defconfig patch and three device tree patches. This v8 is a
followup to change the dwcmshc node names to match the documentation.

Jisheng - can you apply the dts patches to your for-next tree?

I tested with the riscv defconfig on the Ahead [4] and LPi4a [5]. I only
tested eMMC and microSD and plan to enable SDIO WiFi in the future.

References:
[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=49f23745b064cdb6270402403ef58125d78ba183
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=aff35fbc7830510ef7cbcf8e32a041a55de3dc51
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=af076680db846ed54b00b9a763473d1043446993
[4] https://gist.github.com/pdp7/881342620ec1509685f23a387e2fc8d7
[5] https://gist.github.com/pdp7/97017ad88d83fccac18eba69bff817b7

Changes in PATCH v8:
- change dwcmshc node labels to match TH1520 System Reference Manual:
  emmc, sdio0, sdio1

Changes in PATCH v7:
//lore.kernel.org/r/20231129-th1520_mmc_dts-v7-0-c77fc19caa6f@baylibre.com
- fix sorting of DT properties in the mmc nodes

Changes in PATCH v6:
https://lore.kernel.org/linux-riscv/20231114-th1520-mmc-v6-0-3273c661a571@baylibre.com/
- set the mmc nodes to disabled in the th1520.dtsi

Changes in PATCH v5:
https://lore.kernel.org/r/20231109-th1520-mmc-v5-0-018bd039cf17@baylibre.com
- fix logic in th1520_sdhci_set_phy() to correctly check that both
  MMC_CAP2_NO_SD and MMC_CAP2_NO_SDIO are set in host->mmc->caps2
- add Acked-by's from Adrian

Changes in PATCH v4:
https://lore.kernel.org/linux-riscv/20231101-th1520-mmc-v4-0-86e0216b5994@baylibre.com/
- set DWCMSHC_CARD_IS_EMMC when (MMC_CAP2_NO_SD | MMC_CAP2_NO_SDIO)
  as checking MMC_CAP_NONREMOVABLE is not sufficient
- change prefix of phy functions from th1520 to dwcmshc as they are not
  th1520 specific
- remove unneeded check of priv in dwcmshc_phy_1_8v_init()
- remove unneeded check of auto-tuning in th1520_execute_tuning()
- fix order of new nodes in th1520-beaglev-ahead.dts: move sdhci_clk
  before uart_sclk, move mmc0 and mmc1 before uart0
- fix comment typos pointed out by Adrian
- add trailers that I missed from v2

Changes in PATCH v3:
https://lore.kernel.org/r/20231023-th1520-mmc-v3-0-abc5e7491166@baylibre.com
- always call th1520_sdhci_set_phy() in th1520_set_uhs_signaling()
  and not only when timing is MMC_TIMING_MMC_HS400. This allows the
  microSD slot to work as th1520_phy_3_3v_init() is called from
  th1520_sdhci_set_phy().
- add mmc1 node for mmc controller connected to the microSD slot
- add enable mmc1 and add properties for microSD on the Ahead and LPi4A

Changes in PATCH v2:
https://lore.kernel.org/r/20231017-th1520-mmc-v2-0-4678c8cc4048@baylibre.com
- make use of BIT(), GENMASK(), FIELD_PREP(), FIELD_GET()
- add EXPORT_SYMBOL_GPL(__sdhci_execute_tuning)
- call th1520_phy_1_8v_init() when FLAG_IO_FIXED_1V8 is set
- set DWCMSHC_CARD_IS_EMMC when mmc caps contains MMC_CAP_NONREMOVABLE
- remove manipulation of AT_CTRL_AT_EN from th1520_set_uhs_signaling()
- remove unneccessary cycle of enabling and disabling AT_CTRL_AT_EN in
  th1520_execute_tuning()
- remove th1520_phy_1_8v_init_no_pull()
- remove th1520_phy_3_3v_init_no_pull()
- remove FLAG_PULL_UP_EN from priv->flags
- remove thead,phy-pull-up device tree property

Changes in PACH v1:
https://lore.kernel.org/all/20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com/
- ADMA mode now works correctly due to a patch from Jisheng on the list
  ("riscv: dts: thead: set dma-noncoherent to soc bus") and this commit
  from Icenowy that is now merged: 8eb8fe67e2c8 ("riscv: errata: fix
  T-Head dcache.cva encoding").
- Expose __sdhci_execute_tuning from sdhci.c so that it can be called
  from th1520_execute_tuning()
- Refactor the define macros for all the PHY related registers to make
  it easier to understand the bit fields that the code is manipulating
- Replace magic numbers in the PHY register writes with proper defines
- Replace non_removable in dwcmshc_priv with check of mmc_host.caps
- Drop dt prop "thead,io-fixed-1v8" and instead check for existing
  properties: "mmc-ddr-1_8v", "mmc-hs200-1_8v", or "mmc-hs400-1_8v"
- Rename dt prop from "thead,pull-up" to "thead,phy-pull-up" and
  improve the description in the dt binding
- Replace pull_up_en in dwcmshc_priv with bit field in new flags field
- Create th1520_set_uhs_signaling() and call dwcmshc_set_uhs_signaling()
  from it instead of adding th1520 code to dwcmshc_set_uhs_signaling()
- Return -EIO instead of -1 upon errors in th1520_execute_tuning()

Changes in RFC v2:
https://lore.kernel.org/linux-riscv/20230724-th1520-emmc-v2-0-132ed2e2171e@baylibre.com/
- Expand dwcmshc_priv based on driver in the T-Head 5.10 kernel:
  delay_line, non_removable, pull_up_en, io_fixed_1v8
- New boolean property "thead,pull-up" indicates phy pull-up config
- New boolean property "thead,io-fixed-1v8" indicates that io voltage
  should be set to 1.8V during reset
- Add th1520_phy_1_8v_init() as voltage_switch op
- Add th1520_execute_tuning() as the platform_execute_tuning op
- Added th1520_sdhci_reset() as the .reset op. This function will set
  io voltage to 1.8V after calling the standard sdhci_reset() function.
- Modified dwcmshc_set_uhs_signaling() to enable SDHCI_CTRL_VDD_180 when
  io_fixed_1v8 is true
- Add many defines for register offsets and settings based on the mmc
  support in the T-Head downstream v5.10 kernel

RFC v1 series:
https://lore.kernel.org/r/20230724-th1520-emmc-v1-0-cca1b2533da2@baylibre.com

Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
Drew Fustini (4):
      riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520
      riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
      riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
      riscv: dts: thead: Enable LicheePi 4A eMMC and microSD

 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 20 +++++++++++++
 .../boot/dts/thead/th1520-lichee-module-4a.dtsi    | 20 +++++++++++++
 arch/riscv/boot/dts/thead/th1520.dtsi              | 34 ++++++++++++++++++++++
 arch/riscv/configs/defconfig                       |  2 ++
 4 files changed, 76 insertions(+)
---
base-commit: 1f5c003694fab4b1ba6cbdcc417488b975c088d0
change-id: 20231129-th1520_mmc_dts-e472bcc70d0d

Best regards,
-- 
Drew Fustini <dfustini@baylibre.com>


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
@ 2023-12-06  8:09 ` Drew Fustini
  2023-12-06 10:08   ` Emil Renner Berthing
  2023-12-06  8:09 ` [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock Drew Fustini
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Drew Fustini @ 2023-12-06  8:09 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree, Drew Fustini

Enable the mmc controller driver and dma controller driver needed for
T-Head TH1520 based boards, like the LicheePi 4A and BeagleV-Ahead, to
boot from eMMC storage.

Reviewed-by: Guo Ren <guoren@kernel.org>
Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
 arch/riscv/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 905881282a7c..e635dc9d1997 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -214,6 +214,7 @@ CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_MMC_SDHCI_CADENCE=y
+CONFIG_MMC_SDHCI_OF_DWCMSHC=y
 CONFIG_MMC_SPI=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_STARFIVE=y
@@ -223,6 +224,7 @@ CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_SUN6I=y
 CONFIG_DMADEVICES=y
 CONFIG_DMA_SUN6I=m
+CONFIG_DW_AXI_DMAC=y
 CONFIG_RZ_DMAC=y
 CONFIG_VIRTIO_PCI=y
 CONFIG_VIRTIO_BALLOON=y

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
  2023-12-06  8:09 ` [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520 Drew Fustini
@ 2023-12-06  8:09 ` Drew Fustini
  2023-12-06 10:10   ` Emil Renner Berthing
  2023-12-07  8:23   ` Guo Ren
  2023-12-06  8:09 ` [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD Drew Fustini
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Drew Fustini @ 2023-12-06  8:09 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree, Drew Fustini

Add node for the fixed reference clock used for emmc and sdio nodes.
Add emmc node for the 1st dwcmshc instance which is typically connected
to an eMMC device. Add sdio0 node for the 2nd dwcmshc instance which is
typically connected to microSD slot. Add sdio1 node for the 3rd dwcmshc
instance which is typically connected to an SDIO WiFi module. The node
names are based on Table 1-2 C910/C906 memory map in the TH1520 System
User Manual.

Link: https://git.beagleboard.org/beaglev-ahead/beaglev-ahead/-/tree/main/docs
Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
 arch/riscv/boot/dts/thead/th1520.dtsi | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
index ba4d2c673ac8..8b915e206f3a 100644
--- a/arch/riscv/boot/dts/thead/th1520.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520.dtsi
@@ -146,6 +146,13 @@ uart_sclk: uart-sclk-clock {
 		#clock-cells = <0>;
 	};
 
+	sdhci_clk: sdhci-clock {
+		compatible = "fixed-clock";
+		clock-frequency = <198000000>;
+		clock-output-names = "sdhci_clk";
+		#clock-cells = <0>;
+	};
+
 	soc {
 		compatible = "simple-bus";
 		interrupt-parent = <&plic>;
@@ -304,6 +311,33 @@ dmac0: dma-controller@ffefc00000 {
 			status = "disabled";
 		};
 
+		emmc: mmc@ffe7080000 {
+			compatible = "thead,th1520-dwcmshc";
+			reg = <0xff 0xe7080000 0x0 0x10000>;
+			interrupts = <62 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sdhci_clk>;
+			clock-names = "core";
+			status = "disabled";
+		};
+
+		sdio0: mmc@ffe7090000 {
+			compatible = "thead,th1520-dwcmshc";
+			reg = <0xff 0xe7090000 0x0 0x10000>;
+			interrupts = <64 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sdhci_clk>;
+			clock-names = "core";
+			status = "disabled";
+		};
+
+		sdio1: mmc@ffe70a0000 {
+			compatible = "thead,th1520-dwcmshc";
+			reg = <0xff 0xe70a0000 0x0 0x10000>;
+			interrupts = <71 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&sdhci_clk>;
+			clock-names = "core";
+			status = "disabled";
+		};
+
 		timer0: timer@ffefc32000 {
 			compatible = "snps,dw-apb-timer";
 			reg = <0xff 0xefc32000 0x0 0x14>;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
  2023-12-06  8:09 ` [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520 Drew Fustini
  2023-12-06  8:09 ` [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock Drew Fustini
@ 2023-12-06  8:09 ` Drew Fustini
  2023-12-07  8:27   ` Guo Ren
  2023-12-06  8:09 ` [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Drew Fustini @ 2023-12-06  8:09 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree, Drew Fustini

Add emmc node properties for the eMMC device and add sdio0 node
properties for the microSD slot. Set the frequency for the sdhci
reference clock.

Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
 arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
index 70e8042c8304..d9b4de9e4757 100644
--- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
+++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
@@ -48,6 +48,10 @@ &apb_clk {
 	clock-frequency = <62500000>;
 };
 
+&sdhci_clk {
+	clock-frequency = <198000000>;
+};
+
 &uart_sclk {
 	clock-frequency = <100000000>;
 };
@@ -56,6 +60,22 @@ &dmac0 {
 	status = "okay";
 };
 
+&emmc {
+	bus-width = <8>;
+	max-frequency = <198000000>;
+	mmc-hs400-1_8v;
+	non-removable;
+	no-sdio;
+	no-sd;
+	status = "okay";
+};
+
+&sdio0 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+};
+
 &uart0 {
 	status = "okay";
 };

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
                   ` (2 preceding siblings ...)
  2023-12-06  8:09 ` [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD Drew Fustini
@ 2023-12-06  8:09 ` Drew Fustini
  2023-12-07  8:25   ` Guo Ren
  2024-03-02 14:13   ` Xi Ruoyao
  2023-12-12  4:53 ` [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Jisheng Zhang
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Drew Fustini @ 2023-12-06  8:09 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree, Drew Fustini

Add emmc node properties for the eMMC device and add sdio0 node
properties for the microSD slot. Set the frequency for the sdhci
reference clock.

Signed-off-by: Drew Fustini <dfustini@baylibre.com>
---
 .../boot/dts/thead/th1520-lichee-module-4a.dtsi      | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
index a802ab110429..1365d3a512a3 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
@@ -29,6 +29,10 @@ &apb_clk {
 	clock-frequency = <62500000>;
 };
 
+&sdhci_clk {
+	clock-frequency = <198000000>;
+};
+
 &uart_sclk {
 	clock-frequency = <100000000>;
 };
@@ -36,3 +40,19 @@ &uart_sclk {
 &dmac0 {
 	status = "okay";
 };
+
+&emmc {
+	bus-width = <8>;
+	max-frequency = <198000000>;
+	mmc-hs400-1_8v;
+	non-removable;
+	no-sdio;
+	no-sd;
+	status = "okay";
+};
+
+&sdio0 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+};

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520
  2023-12-06  8:09 ` [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520 Drew Fustini
@ 2023-12-06 10:08   ` Emil Renner Berthing
  0 siblings, 0 replies; 19+ messages in thread
From: Emil Renner Berthing @ 2023-12-06 10:08 UTC (permalink / raw
  To: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Jisheng Zhang, Guo Ren, Fu Wei, Conor Dooley, Rob Herring,
	Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree

Drew Fustini wrote:
> Enable the mmc controller driver and dma controller driver needed for
> T-Head TH1520 based boards, like the LicheePi 4A and BeagleV-Ahead, to
> boot from eMMC storage.
>
> Reviewed-by: Guo Ren <guoren@kernel.org>
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>

Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>

> ---
>  arch/riscv/configs/defconfig | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
> index 905881282a7c..e635dc9d1997 100644
> --- a/arch/riscv/configs/defconfig
> +++ b/arch/riscv/configs/defconfig
> @@ -214,6 +214,7 @@ CONFIG_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_PLTFM=y
>  CONFIG_MMC_SDHCI_CADENCE=y
> +CONFIG_MMC_SDHCI_OF_DWCMSHC=y
>  CONFIG_MMC_SPI=y
>  CONFIG_MMC_DW=y
>  CONFIG_MMC_DW_STARFIVE=y
> @@ -223,6 +224,7 @@ CONFIG_RTC_CLASS=y
>  CONFIG_RTC_DRV_SUN6I=y
>  CONFIG_DMADEVICES=y
>  CONFIG_DMA_SUN6I=m
> +CONFIG_DW_AXI_DMAC=y
>  CONFIG_RZ_DMAC=y
>  CONFIG_VIRTIO_PCI=y
>  CONFIG_VIRTIO_BALLOON=y
>
> --
> 2.34.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
  2023-12-06  8:09 ` [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock Drew Fustini
@ 2023-12-06 10:10   ` Emil Renner Berthing
  2023-12-07  6:33     ` Drew Fustini
  2023-12-07  8:23   ` Guo Ren
  1 sibling, 1 reply; 19+ messages in thread
From: Emil Renner Berthing @ 2023-12-06 10:10 UTC (permalink / raw
  To: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Jisheng Zhang, Guo Ren, Fu Wei, Conor Dooley, Rob Herring,
	Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree

Drew Fustini wrote:
> Add node for the fixed reference clock used for emmc and sdio nodes.
> Add emmc node for the 1st dwcmshc instance which is typically connected
> to an eMMC device. Add sdio0 node for the 2nd dwcmshc instance which is
> typically connected to microSD slot. Add sdio1 node for the 3rd dwcmshc
> instance which is typically connected to an SDIO WiFi module. The node
> names are based on Table 1-2 C910/C906 memory map in the TH1520 System
> User Manual.
>
> Link: https://git.beagleboard.org/beaglev-ahead/beaglev-ahead/-/tree/main/docs
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>

Thanks! The rest of the patches look good too, but I don't really have
a schematic
to do proper review.

Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>

> ---
>  arch/riscv/boot/dts/thead/th1520.dtsi | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
> index ba4d2c673ac8..8b915e206f3a 100644
> --- a/arch/riscv/boot/dts/thead/th1520.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520.dtsi
> @@ -146,6 +146,13 @@ uart_sclk: uart-sclk-clock {
>  		#clock-cells = <0>;
>  	};
>
> +	sdhci_clk: sdhci-clock {
> +		compatible = "fixed-clock";
> +		clock-frequency = <198000000>;
> +		clock-output-names = "sdhci_clk";
> +		#clock-cells = <0>;
> +	};
> +
>  	soc {
>  		compatible = "simple-bus";
>  		interrupt-parent = <&plic>;
> @@ -304,6 +311,33 @@ dmac0: dma-controller@ffefc00000 {
>  			status = "disabled";
>  		};
>
> +		emmc: mmc@ffe7080000 {
> +			compatible = "thead,th1520-dwcmshc";
> +			reg = <0xff 0xe7080000 0x0 0x10000>;
> +			interrupts = <62 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&sdhci_clk>;
> +			clock-names = "core";
> +			status = "disabled";
> +		};
> +
> +		sdio0: mmc@ffe7090000 {
> +			compatible = "thead,th1520-dwcmshc";
> +			reg = <0xff 0xe7090000 0x0 0x10000>;
> +			interrupts = <64 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&sdhci_clk>;
> +			clock-names = "core";
> +			status = "disabled";
> +		};
> +
> +		sdio1: mmc@ffe70a0000 {
> +			compatible = "thead,th1520-dwcmshc";
> +			reg = <0xff 0xe70a0000 0x0 0x10000>;
> +			interrupts = <71 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&sdhci_clk>;
> +			clock-names = "core";
> +			status = "disabled";
> +		};
> +
>  		timer0: timer@ffefc32000 {
>  			compatible = "snps,dw-apb-timer";
>  			reg = <0xff 0xefc32000 0x0 0x14>;
>
> --
> 2.34.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
  2023-12-06 10:10   ` Emil Renner Berthing
@ 2023-12-07  6:33     ` Drew Fustini
  0 siblings, 0 replies; 19+ messages in thread
From: Drew Fustini @ 2023-12-07  6:33 UTC (permalink / raw
  To: Emil Renner Berthing
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski,
	Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree

On Wed, Dec 06, 2023 at 04:10:28AM -0600, Emil Renner Berthing wrote:
> Drew Fustini wrote:
> > Add node for the fixed reference clock used for emmc and sdio nodes.
> > Add emmc node for the 1st dwcmshc instance which is typically connected
> > to an eMMC device. Add sdio0 node for the 2nd dwcmshc instance which is
> > typically connected to microSD slot. Add sdio1 node for the 3rd dwcmshc
> > instance which is typically connected to an SDIO WiFi module. The node
> > names are based on Table 1-2 C910/C906 memory map in the TH1520 System
> > User Manual.
> >
> > Link: https://git.beagleboard.org/beaglev-ahead/beaglev-ahead/-/tree/main/docs
> > Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> 
> Thanks! The rest of the patches look good too, but I don't really have
> a schematic
> to do proper review.
> 
> Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>

Thanks for reviewing. The BeagleV-Ahead board is open source hardware so
there is the full schematic and PCB layout in:
https://git.beagleboard.org/beaglev-ahead/beaglev-ahead

Drew

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
  2023-12-06  8:09 ` [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock Drew Fustini
  2023-12-06 10:10   ` Emil Renner Berthing
@ 2023-12-07  8:23   ` Guo Ren
  1 sibling, 0 replies; 19+ messages in thread
From: Guo Ren @ 2023-12-07  8:23 UTC (permalink / raw
  To: Drew Fustini
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Fu Wei,
	Conor Dooley, Rob Herring, Krzysztof Kozlowski, Jason Kridner,
	Robert Nelson, linux-riscv, linux-kernel, devicetree

On Wed, Dec 6, 2023 at 4:09 PM Drew Fustini <dfustini@baylibre.com> wrote:
>
> Add node for the fixed reference clock used for emmc and sdio nodes.
> Add emmc node for the 1st dwcmshc instance which is typically connected
> to an eMMC device. Add sdio0 node for the 2nd dwcmshc instance which is
> typically connected to microSD slot. Add sdio1 node for the 3rd dwcmshc
> instance which is typically connected to an SDIO WiFi module. The node
> names are based on Table 1-2 C910/C906 memory map in the TH1520 System
> User Manual.
>
> Link: https://git.beagleboard.org/beaglev-ahead/beaglev-ahead/-/tree/main/docs
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> ---
>  arch/riscv/boot/dts/thead/th1520.dtsi | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520.dtsi b/arch/riscv/boot/dts/thead/th1520.dtsi
> index ba4d2c673ac8..8b915e206f3a 100644
> --- a/arch/riscv/boot/dts/thead/th1520.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520.dtsi
> @@ -146,6 +146,13 @@ uart_sclk: uart-sclk-clock {
>                 #clock-cells = <0>;
>         };
>
> +       sdhci_clk: sdhci-clock {
> +               compatible = "fixed-clock";
> +               clock-frequency = <198000000>;
> +               clock-output-names = "sdhci_clk";
> +               #clock-cells = <0>;
> +       };
> +
>         soc {
>                 compatible = "simple-bus";
>                 interrupt-parent = <&plic>;
> @@ -304,6 +311,33 @@ dmac0: dma-controller@ffefc00000 {
>                         status = "disabled";
>                 };
>
> +               emmc: mmc@ffe7080000 {
> +                       compatible = "thead,th1520-dwcmshc";
> +                       reg = <0xff 0xe7080000 0x0 0x10000>;
> +                       interrupts = <62 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&sdhci_clk>;
> +                       clock-names = "core";
> +                       status = "disabled";
> +               };
> +
> +               sdio0: mmc@ffe7090000 {
> +                       compatible = "thead,th1520-dwcmshc";
> +                       reg = <0xff 0xe7090000 0x0 0x10000>;
> +                       interrupts = <64 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&sdhci_clk>;
> +                       clock-names = "core";
> +                       status = "disabled";
> +               };
> +
> +               sdio1: mmc@ffe70a0000 {
> +                       compatible = "thead,th1520-dwcmshc";
> +                       reg = <0xff 0xe70a0000 0x0 0x10000>;
> +                       interrupts = <71 IRQ_TYPE_LEVEL_HIGH>;
> +                       clocks = <&sdhci_clk>;
> +                       clock-names = "core";
> +                       status = "disabled";
> +               };
> +
>                 timer0: timer@ffefc32000 {
>                         compatible = "snps,dw-apb-timer";
>                         reg = <0xff 0xefc32000 0x0 0x14>;
>
> --
> 2.34.1
>
Reviewed-by: Guo Ren <guoren@kernel.org>

-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
  2023-12-06  8:09 ` [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
@ 2023-12-07  8:25   ` Guo Ren
  2024-03-02 14:13   ` Xi Ruoyao
  1 sibling, 0 replies; 19+ messages in thread
From: Guo Ren @ 2023-12-07  8:25 UTC (permalink / raw
  To: Drew Fustini
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Fu Wei,
	Conor Dooley, Rob Herring, Krzysztof Kozlowski, Jason Kridner,
	Robert Nelson, linux-riscv, linux-kernel, devicetree

On Wed, Dec 6, 2023 at 4:09 PM Drew Fustini <dfustini@baylibre.com> wrote:
>
> Add emmc node properties for the eMMC device and add sdio0 node
> properties for the microSD slot. Set the frequency for the sdhci
> reference clock.
>
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> ---
>  .../boot/dts/thead/th1520-lichee-module-4a.dtsi      | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> index a802ab110429..1365d3a512a3 100644
> --- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> @@ -29,6 +29,10 @@ &apb_clk {
>         clock-frequency = <62500000>;
>  };
>
> +&sdhci_clk {
> +       clock-frequency = <198000000>;
> +};
> +
>  &uart_sclk {
>         clock-frequency = <100000000>;
>  };
> @@ -36,3 +40,19 @@ &uart_sclk {
>  &dmac0 {
>         status = "okay";
>  };
> +
> +&emmc {
> +       bus-width = <8>;
> +       max-frequency = <198000000>;
> +       mmc-hs400-1_8v;
> +       non-removable;
> +       no-sdio;
> +       no-sd;
> +       status = "okay";
> +};
> +
> +&sdio0 {
> +       bus-width = <4>;
> +       max-frequency = <198000000>;
> +       status = "okay";
> +};
>
> --
> 2.34.1
>
Reviewed-by: Guo Ren <guoren@kernel.org>

-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
  2023-12-06  8:09 ` [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD Drew Fustini
@ 2023-12-07  8:27   ` Guo Ren
  0 siblings, 0 replies; 19+ messages in thread
From: Guo Ren @ 2023-12-07  8:27 UTC (permalink / raw
  To: Drew Fustini
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Fu Wei,
	Conor Dooley, Rob Herring, Krzysztof Kozlowski, Jason Kridner,
	Robert Nelson, linux-riscv, linux-kernel, devicetree

On Wed, Dec 6, 2023 at 4:09 PM Drew Fustini <dfustini@baylibre.com> wrote:
>
> Add emmc node properties for the eMMC device and add sdio0 node
> properties for the microSD slot. Set the frequency for the sdhci
> reference clock.
>
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> ---
>  arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> index 70e8042c8304..d9b4de9e4757 100644
> --- a/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> +++ b/arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts
> @@ -48,6 +48,10 @@ &apb_clk {
>         clock-frequency = <62500000>;
>  };
>
> +&sdhci_clk {
> +       clock-frequency = <198000000>;
> +};
> +
>  &uart_sclk {
>         clock-frequency = <100000000>;
>  };
> @@ -56,6 +60,22 @@ &dmac0 {
>         status = "okay";
>  };
>
> +&emmc {
> +       bus-width = <8>;
> +       max-frequency = <198000000>;
> +       mmc-hs400-1_8v;
> +       non-removable;
> +       no-sdio;
> +       no-sd;
> +       status = "okay";
> +};
> +
> +&sdio0 {
> +       bus-width = <4>;
> +       max-frequency = <198000000>;
> +       status = "okay";
> +};
> +
>  &uart0 {
>         status = "okay";
>  };
>
> --
> 2.34.1
>
Maybe, we could share some parts with th1520-lichee-module-4a.dtsi.
Others, LGTM.|

Reviewed-by: Guo Ren <guoren@kernel.org>

-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
                   ` (3 preceding siblings ...)
  2023-12-06  8:09 ` [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
@ 2023-12-12  4:53 ` Jisheng Zhang
  2023-12-12 19:13 ` (subset) " Conor Dooley
  2024-02-22 20:20 ` patchwork-bot+linux-riscv
  6 siblings, 0 replies; 19+ messages in thread
From: Jisheng Zhang @ 2023-12-12  4:53 UTC (permalink / raw
  To: Drew Fustini
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Guo Ren, Fu Wei,
	Conor Dooley, Rob Herring, Krzysztof Kozlowski, Jason Kridner,
	Robert Nelson, linux-riscv, linux-kernel, devicetree

On Wed, Dec 06, 2023 at 12:09:20AM -0800, Drew Fustini wrote:
> This series enables the MMC controller in the T-Head TH1520 SoC and
> enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
> LicheePi 4A.
> 
> The drivers/mmc/host patches from v6 were applied by Ulf and are already
> in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
> only a defconfig patch and three device tree patches. This v8 is a
> followup to change the dwcmshc node names to match the documentation.
> 
> Jisheng - can you apply the dts patches to your for-next tree?
> 
> I tested with the riscv defconfig on the Ahead [4] and LPi4a [5]. I only
> tested eMMC and microSD and plan to enable SDIO WiFi in the future.

Thank Drew, for this patch series:

Reviewed-by: Jisheng Zhang <jszhang@kernel.org>

I asked Conor's help to take T-HEAD SoC dts patches.
> 
> References:
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=49f23745b064cdb6270402403ef58125d78ba183
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=aff35fbc7830510ef7cbcf8e32a041a55de3dc51
> [3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=af076680db846ed54b00b9a763473d1043446993
> [4] https://gist.github.com/pdp7/881342620ec1509685f23a387e2fc8d7
> [5] https://gist.github.com/pdp7/97017ad88d83fccac18eba69bff817b7
> 
> Changes in PATCH v8:
> - change dwcmshc node labels to match TH1520 System Reference Manual:
>   emmc, sdio0, sdio1
> 
> Changes in PATCH v7:
> //lore.kernel.org/r/20231129-th1520_mmc_dts-v7-0-c77fc19caa6f@baylibre.com
> - fix sorting of DT properties in the mmc nodes
> 
> Changes in PATCH v6:
> https://lore.kernel.org/linux-riscv/20231114-th1520-mmc-v6-0-3273c661a571@baylibre.com/
> - set the mmc nodes to disabled in the th1520.dtsi
> 
> Changes in PATCH v5:
> https://lore.kernel.org/r/20231109-th1520-mmc-v5-0-018bd039cf17@baylibre.com
> - fix logic in th1520_sdhci_set_phy() to correctly check that both
>   MMC_CAP2_NO_SD and MMC_CAP2_NO_SDIO are set in host->mmc->caps2
> - add Acked-by's from Adrian
> 
> Changes in PATCH v4:
> https://lore.kernel.org/linux-riscv/20231101-th1520-mmc-v4-0-86e0216b5994@baylibre.com/
> - set DWCMSHC_CARD_IS_EMMC when (MMC_CAP2_NO_SD | MMC_CAP2_NO_SDIO)
>   as checking MMC_CAP_NONREMOVABLE is not sufficient
> - change prefix of phy functions from th1520 to dwcmshc as they are not
>   th1520 specific
> - remove unneeded check of priv in dwcmshc_phy_1_8v_init()
> - remove unneeded check of auto-tuning in th1520_execute_tuning()
> - fix order of new nodes in th1520-beaglev-ahead.dts: move sdhci_clk
>   before uart_sclk, move mmc0 and mmc1 before uart0
> - fix comment typos pointed out by Adrian
> - add trailers that I missed from v2
> 
> Changes in PATCH v3:
> https://lore.kernel.org/r/20231023-th1520-mmc-v3-0-abc5e7491166@baylibre.com
> - always call th1520_sdhci_set_phy() in th1520_set_uhs_signaling()
>   and not only when timing is MMC_TIMING_MMC_HS400. This allows the
>   microSD slot to work as th1520_phy_3_3v_init() is called from
>   th1520_sdhci_set_phy().
> - add mmc1 node for mmc controller connected to the microSD slot
> - add enable mmc1 and add properties for microSD on the Ahead and LPi4A
> 
> Changes in PATCH v2:
> https://lore.kernel.org/r/20231017-th1520-mmc-v2-0-4678c8cc4048@baylibre.com
> - make use of BIT(), GENMASK(), FIELD_PREP(), FIELD_GET()
> - add EXPORT_SYMBOL_GPL(__sdhci_execute_tuning)
> - call th1520_phy_1_8v_init() when FLAG_IO_FIXED_1V8 is set
> - set DWCMSHC_CARD_IS_EMMC when mmc caps contains MMC_CAP_NONREMOVABLE
> - remove manipulation of AT_CTRL_AT_EN from th1520_set_uhs_signaling()
> - remove unneccessary cycle of enabling and disabling AT_CTRL_AT_EN in
>   th1520_execute_tuning()
> - remove th1520_phy_1_8v_init_no_pull()
> - remove th1520_phy_3_3v_init_no_pull()
> - remove FLAG_PULL_UP_EN from priv->flags
> - remove thead,phy-pull-up device tree property
> 
> Changes in PACH v1:
> https://lore.kernel.org/all/20230921-th1520-mmc-v1-0-49f76c274fb3@baylibre.com/
> - ADMA mode now works correctly due to a patch from Jisheng on the list
>   ("riscv: dts: thead: set dma-noncoherent to soc bus") and this commit
>   from Icenowy that is now merged: 8eb8fe67e2c8 ("riscv: errata: fix
>   T-Head dcache.cva encoding").
> - Expose __sdhci_execute_tuning from sdhci.c so that it can be called
>   from th1520_execute_tuning()
> - Refactor the define macros for all the PHY related registers to make
>   it easier to understand the bit fields that the code is manipulating
> - Replace magic numbers in the PHY register writes with proper defines
> - Replace non_removable in dwcmshc_priv with check of mmc_host.caps
> - Drop dt prop "thead,io-fixed-1v8" and instead check for existing
>   properties: "mmc-ddr-1_8v", "mmc-hs200-1_8v", or "mmc-hs400-1_8v"
> - Rename dt prop from "thead,pull-up" to "thead,phy-pull-up" and
>   improve the description in the dt binding
> - Replace pull_up_en in dwcmshc_priv with bit field in new flags field
> - Create th1520_set_uhs_signaling() and call dwcmshc_set_uhs_signaling()
>   from it instead of adding th1520 code to dwcmshc_set_uhs_signaling()
> - Return -EIO instead of -1 upon errors in th1520_execute_tuning()
> 
> Changes in RFC v2:
> https://lore.kernel.org/linux-riscv/20230724-th1520-emmc-v2-0-132ed2e2171e@baylibre.com/
> - Expand dwcmshc_priv based on driver in the T-Head 5.10 kernel:
>   delay_line, non_removable, pull_up_en, io_fixed_1v8
> - New boolean property "thead,pull-up" indicates phy pull-up config
> - New boolean property "thead,io-fixed-1v8" indicates that io voltage
>   should be set to 1.8V during reset
> - Add th1520_phy_1_8v_init() as voltage_switch op
> - Add th1520_execute_tuning() as the platform_execute_tuning op
> - Added th1520_sdhci_reset() as the .reset op. This function will set
>   io voltage to 1.8V after calling the standard sdhci_reset() function.
> - Modified dwcmshc_set_uhs_signaling() to enable SDHCI_CTRL_VDD_180 when
>   io_fixed_1v8 is true
> - Add many defines for register offsets and settings based on the mmc
>   support in the T-Head downstream v5.10 kernel
> 
> RFC v1 series:
> https://lore.kernel.org/r/20230724-th1520-emmc-v1-0-cca1b2533da2@baylibre.com
> 
> Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> ---
> Drew Fustini (4):
>       riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520
>       riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
>       riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
>       riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
> 
>  arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts | 20 +++++++++++++
>  .../boot/dts/thead/th1520-lichee-module-4a.dtsi    | 20 +++++++++++++
>  arch/riscv/boot/dts/thead/th1520.dtsi              | 34 ++++++++++++++++++++++
>  arch/riscv/configs/defconfig                       |  2 ++
>  4 files changed, 76 insertions(+)
> ---
> base-commit: 1f5c003694fab4b1ba6cbdcc417488b975c088d0
> change-id: 20231129-th1520_mmc_dts-e472bcc70d0d
> 
> Best regards,
> -- 
> Drew Fustini <dfustini@baylibre.com>
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: (subset) [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
                   ` (4 preceding siblings ...)
  2023-12-12  4:53 ` [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Jisheng Zhang
@ 2023-12-12 19:13 ` Conor Dooley
  2024-02-12  4:51   ` Drew Fustini
  2024-02-16 19:06   ` Palmer Dabbelt
  2024-02-22 20:20 ` patchwork-bot+linux-riscv
  6 siblings, 2 replies; 19+ messages in thread
From: Conor Dooley @ 2023-12-12 19:13 UTC (permalink / raw
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Conor Dooley, Rob Herring, Krzysztof Kozlowski,
	Drew Fustini
  Cc: Conor Dooley, Jason Kridner, Robert Nelson, linux-riscv,
	linux-kernel, devicetree

From: Conor Dooley <conor.dooley@microchip.com>

On Wed, 06 Dec 2023 00:09:20 -0800, Drew Fustini wrote:
> This series enables the MMC controller in the T-Head TH1520 SoC and
> enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
> LicheePi 4A.
> 
> The drivers/mmc/host patches from v6 were applied by Ulf and are already
> in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
> only a defconfig patch and three device tree patches. This v8 is a
> followup to change the dwcmshc node names to match the documentation.
> 
> [...]

Applied to riscv-dt-for-next, thanks! The defconfig patch is Palmer's
to take :)

[2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
      https://git.kernel.org/conor/c/a77f02e84896
[3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
      https://git.kernel.org/conor/c/18d92a03b319
[4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
      https://git.kernel.org/conor/c/b6b5028473ce

Thanks,
Conor.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: (subset) [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
  2023-12-12 19:13 ` (subset) " Conor Dooley
@ 2024-02-12  4:51   ` Drew Fustini
  2024-02-16 19:06   ` Palmer Dabbelt
  1 sibling, 0 replies; 19+ messages in thread
From: Drew Fustini @ 2024-02-12  4:51 UTC (permalink / raw
  To: Palmer Dabbelt
  Cc: Conor Dooley, Paul Walmsley, Albert Ou, Jisheng Zhang, Guo Ren,
	Fu Wei, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree

On Tue, Dec 12, 2023 at 07:13:25PM +0000, Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
> 
> On Wed, 06 Dec 2023 00:09:20 -0800, Drew Fustini wrote:
> > This series enables the MMC controller in the T-Head TH1520 SoC and
> > enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
> > LicheePi 4A.
> > 
> > The drivers/mmc/host patches from v6 were applied by Ulf and are already
> > in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
> > only a defconfig patch and three device tree patches. This v8 is a
> > followup to change the dwcmshc node names to match the documentation.
> > 
> > [...]
> 
> Applied to riscv-dt-for-next, thanks! The defconfig patch is Palmer's
> to take :)
> 
> [2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
>       https://git.kernel.org/conor/c/a77f02e84896
> [3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
>       https://git.kernel.org/conor/c/18d92a03b319
> [4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
>       https://git.kernel.org/conor/c/b6b5028473ce

Hi Palmer,

I don't see this in fixes or for-next. Could you pick it up please?

I've tested that Lichee Pi 4a and Ahead boot okay on 6.8-rc4 once
'CONFIG_MMC_SDHCI_OF_DWCMSHC=y' is set.

Thanks,
Drew

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: (subset) [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
  2023-12-12 19:13 ` (subset) " Conor Dooley
  2024-02-12  4:51   ` Drew Fustini
@ 2024-02-16 19:06   ` Palmer Dabbelt
  1 sibling, 0 replies; 19+ messages in thread
From: Palmer Dabbelt @ 2024-02-16 19:06 UTC (permalink / raw
  To: Conor Dooley
  Cc: Paul Walmsley, aou, jszhang, guoren, wefu, Conor Dooley, robh+dt,
	krzysztof.kozlowski+dt, dfustini, Conor Dooley, jkridner,
	robertcnelson, linux-riscv, linux-kernel, devicetree

On Tue, 12 Dec 2023 11:13:25 PST (-0800), Conor Dooley wrote:
> From: Conor Dooley <conor.dooley@microchip.com>
>
> On Wed, 06 Dec 2023 00:09:20 -0800, Drew Fustini wrote:
>> This series enables the MMC controller in the T-Head TH1520 SoC and
>> enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
>> LicheePi 4A.
>>
>> The drivers/mmc/host patches from v6 were applied by Ulf and are already
>> in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
>> only a defconfig patch and three device tree patches. This v8 is a
>> followup to change the dwcmshc node names to match the documentation.
>>
>> [...]
>
> Applied to riscv-dt-for-next, thanks! The defconfig patch is Palmer's
> to take :)

Sorry I missed this.  It's on my staging branch, but I'm still debugging 
some boot hangs post-merge so it might take a bit to show up on 
linux-next...

>
> [2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
>       https://git.kernel.org/conor/c/a77f02e84896
> [3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
>       https://git.kernel.org/conor/c/18d92a03b319
> [4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
>       https://git.kernel.org/conor/c/b6b5028473ce
>
> Thanks,
> Conor.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards
  2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
                   ` (5 preceding siblings ...)
  2023-12-12 19:13 ` (subset) " Conor Dooley
@ 2024-02-22 20:20 ` patchwork-bot+linux-riscv
  6 siblings, 0 replies; 19+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-02-22 20:20 UTC (permalink / raw
  To: Drew Fustini
  Cc: linux-riscv, paul.walmsley, palmer, aou, jszhang, guoren, wefu,
	conor, robh+dt, krzysztof.kozlowski+dt, jkridner, robertcnelson,
	linux-kernel, devicetree

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 06 Dec 2023 00:09:20 -0800 you wrote:
> This series enables the MMC controller in the T-Head TH1520 SoC and
> enables the eMMC and microSD on both the BeagleV Ahead and the Sipeed
> LicheePi 4A.
> 
> The drivers/mmc/host patches from v6 were applied by Ulf and are already
> in the linux-next [1][2] as well as the bindings patch [3]. Thus v7 was
> only a defconfig patch and three device tree patches. This v8 is a
> followup to change the dwcmshc node names to match the documentation.
> 
> [...]

Here is the summary with links:
  - [v8,1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520
    https://git.kernel.org/riscv/c/45e0b0fd6dc5
  - [v8,2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock
    (no matching commit)
  - [v8,3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD
    (no matching commit)
  - [v8,4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
  2023-12-06  8:09 ` [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
  2023-12-07  8:25   ` Guo Ren
@ 2024-03-02 14:13   ` Xi Ruoyao
  2024-03-02 16:25     ` Drew Fustini
  1 sibling, 1 reply; 19+ messages in thread
From: Xi Ruoyao @ 2024-03-02 14:13 UTC (permalink / raw
  To: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Jisheng Zhang, Guo Ren, Fu Wei, Conor Dooley, Rob Herring,
	Krzysztof Kozlowski
  Cc: Jason Kridner, Robert Nelson, linux-riscv, linux-kernel,
	devicetree

On Wed, 2023-12-06 at 00:09 -0800, Drew Fustini wrote:
> Add emmc node properties for the eMMC device and add sdio0 node
> properties for the microSD slot. Set the frequency for the sdhci
> reference clock.

Hi Drew,

I've been using the emmc on LicheePi 4A for a while without any problem,
but when I try the microSD slot I get:

[    0.531804] mmc1: SDHCI controller on ffe7090000.mmc [ffe7090000.mmc] using ADMA 64-bit
[    0.842674] mmc1: Tuning failed, falling back to fixed sampling clock
[    0.855139] mmc1: tuning execution failed: -5
[    0.859609] mmc1: error -5 whilst initialising SD card
[   11.359879] mmc1: Timeout waiting for hardware cmd interrupt.
[   11.365661] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
[   11.372105] mmc1: sdhci: Sys addr:  0x00000001 | Version:  0x00000005
[   11.378547] mmc1: sdhci: Blk size:  0x00007040 | Blk cnt:  0x00000000
[   11.384989] mmc1: sdhci: Argument:  0x00000000 | Trn mode: 0x00000010
[   11.391432] mmc1: sdhci: Present:   0x03ff0000 | Host ctl: 0x00000017
[   11.397873] mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
[   11.404312] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000000f
[   11.410753] mmc1: sdhci: Timeout:   0x00000004 | Int stat: 0x00000000
[   11.417192] mmc1: sdhci: Int enab:  0x00000020 | Sig enab: 0x00000020
[   11.423633] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   11.430073] mmc1: sdhci: Caps:      0x3f69c881 | Caps_1:   0x08008177
[   11.436513] mmc1: sdhci: Cmd:       0x00000102 | Max curr: 0x00191919
[   11.442954] mmc1: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x07725f7f
[   11.449394] mmc1: sdhci: Resp[2]:   0x32db7900 | Resp[3]:  0x00400e00
[   11.455835] mmc1: sdhci: Host ctl2: 0x0000300b
[   11.460280] mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x0000000000882220
[   11.467416] mmc1: sdhci: ============================================
[   11.563828] mmc1: Tuning failed, falling back to fixed sampling clock
[   11.576053] mmc1: tuning execution failed: -5
[   11.646438] mmc1: new high speed SDXC card at address aaaa
[   11.653170] mmcblk1: mmc1:aaaa SR256 238 GiB

I can write something into the SD card and read it back though.  But
this makes me reluctant to use the SD card for "some real thing" afraid
of a data loss.

The SD card is a SanDisk Extreme Pro 256GB (rated "U3, A2, V30").

Any idea how to debug this issue further?  (Maybe I should try change
the SD card first but I'd like to discuss the issue before paying money
for another card.)

> Signed-off-by: Drew Fustini <dfustini@baylibre.com>
> ---
>  .../boot/dts/thead/th1520-lichee-module-4a.dtsi      | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> index a802ab110429..1365d3a512a3 100644
> --- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> +++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
> @@ -29,6 +29,10 @@ &apb_clk {
>  	clock-frequency = <62500000>;
>  };
>  
> +&sdhci_clk {
> +	clock-frequency = <198000000>;
> +};
> +
>  &uart_sclk {
>  	clock-frequency = <100000000>;
>  };
> @@ -36,3 +40,19 @@ &uart_sclk {
>  &dmac0 {
>  	status = "okay";
>  };
> +
> +&emmc {
> +	bus-width = <8>;
> +	max-frequency = <198000000>;
> +	mmc-hs400-1_8v;
> +	non-removable;
> +	no-sdio;
> +	no-sd;
> +	status = "okay";
> +};
> +
> +&sdio0 {
> +	bus-width = <4>;
> +	max-frequency = <198000000>;
> +	status = "okay";
> +};

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
  2024-03-02 14:13   ` Xi Ruoyao
@ 2024-03-02 16:25     ` Drew Fustini
  2024-03-03  8:48       ` Xi Ruoyao
  0 siblings, 1 reply; 19+ messages in thread
From: Drew Fustini @ 2024-03-02 16:25 UTC (permalink / raw
  To: Xi Ruoyao
  Cc: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Jisheng Zhang, Guo Ren, Fu Wei, Conor Dooley, Rob Herring,
	Krzysztof Kozlowski, Jason Kridner, Robert Nelson, linux-riscv,
	linux-kernel, devicetree

On Sat, Mar 02, 2024 at 10:13:55PM +0800, Xi Ruoyao wrote:
> On Wed, 2023-12-06 at 00:09 -0800, Drew Fustini wrote:
> > Add emmc node properties for the eMMC device and add sdio0 node
> > properties for the microSD slot. Set the frequency for the sdhci
> > reference clock.
> 
> Hi Drew,
> 
> I've been using the emmc on LicheePi 4A for a while without any problem,
> but when I try the microSD slot I get:
> 
> [    0.531804] mmc1: SDHCI controller on ffe7090000.mmc [ffe7090000.mmc] using ADMA 64-bit
> [    0.842674] mmc1: Tuning failed, falling back to fixed sampling clock
> [    0.855139] mmc1: tuning execution failed: -5
> [    0.859609] mmc1: error -5 whilst initialising SD card
> [   11.359879] mmc1: Timeout waiting for hardware cmd interrupt.
> [   11.365661] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
> [   11.372105] mmc1: sdhci: Sys addr:  0x00000001 | Version:  0x00000005
> [   11.378547] mmc1: sdhci: Blk size:  0x00007040 | Blk cnt:  0x00000000
> [   11.384989] mmc1: sdhci: Argument:  0x00000000 | Trn mode: 0x00000010
> [   11.391432] mmc1: sdhci: Present:   0x03ff0000 | Host ctl: 0x00000017
> [   11.397873] mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
> [   11.404312] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000000f
> [   11.410753] mmc1: sdhci: Timeout:   0x00000004 | Int stat: 0x00000000
> [   11.417192] mmc1: sdhci: Int enab:  0x00000020 | Sig enab: 0x00000020
> [   11.423633] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
> [   11.430073] mmc1: sdhci: Caps:      0x3f69c881 | Caps_1:   0x08008177
> [   11.436513] mmc1: sdhci: Cmd:       0x00000102 | Max curr: 0x00191919
> [   11.442954] mmc1: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x07725f7f
> [   11.449394] mmc1: sdhci: Resp[2]:   0x32db7900 | Resp[3]:  0x00400e00
> [   11.455835] mmc1: sdhci: Host ctl2: 0x0000300b
> [   11.460280] mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x0000000000882220
> [   11.467416] mmc1: sdhci: ============================================
> [   11.563828] mmc1: Tuning failed, falling back to fixed sampling clock
> [   11.576053] mmc1: tuning execution failed: -5
> [   11.646438] mmc1: new high speed SDXC card at address aaaa
> [   11.653170] mmcblk1: mmc1:aaaa SR256 238 GiB
> 
> I can write something into the SD card and read it back though.  But
> this makes me reluctant to use the SD card for "some real thing" afraid
> of a data loss.
> 
> The SD card is a SanDisk Extreme Pro 256GB (rated "U3, A2, V30").
> 
> Any idea how to debug this issue further?  (Maybe I should try change
> the SD card first but I'd like to discuss the issue before paying money
> for another card.)

Revy informed me that downclocking from 198 MHz to 100 MHz [1] has been
observed to solve this problem. Could you try the following dts patch?

Also, I have noticed the T-Head's 5.10 vendor kernel does have some
updates in sdhci-of-dwcmshc.c related to tuning. I'll look at porting
those to the upstream driving.

Thanks,
Drew

[1] https://github.com/revyos/thead-kernel/pull/62
[2] https://github.com/revyos/thead-kernel/commit/afef388b8e26f0d77f9d2261b6e57991941a213f#diff-ba729b399f3cb86d6a2503890c3626a6426c1572a54f24cd7ab3337f5fc75674

------ [cut here] --------
From db4d406fc15c76317993a39a72061d3df47e86f0 Mon Sep 17 00:00:00 2001
From: Drew Fustini <dfustini@tenstorrent.com>
Date: Sat, 2 Mar 2024 08:21:50 -0800
Subject: [PATCH] riscv: dts: thead: downgrade microSD to 100 MHz max

Downgrade max freq for microSD controller from 198 MHz to 100 MHz to
avoid timeout errors.

Signed-off-by: Drew Fustini <dfustini@tenstorrent.com>
---
 arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
index 1365d3a512a3..d6ae671f94a9 100644
--- a/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
+++ b/arch/riscv/boot/dts/thead/th1520-lichee-module-4a.dtsi
@@ -53,6 +53,6 @@ &emmc {

 &sdio0 {
        bus-width = <4>;
-       max-frequency = <198000000>;
+       max-frequency = <100000000>;
        status = "okay";
 };
--
2.34.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD
  2024-03-02 16:25     ` Drew Fustini
@ 2024-03-03  8:48       ` Xi Ruoyao
  0 siblings, 0 replies; 19+ messages in thread
From: Xi Ruoyao @ 2024-03-03  8:48 UTC (permalink / raw
  To: Drew Fustini
  Cc: Drew Fustini, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Jisheng Zhang, Guo Ren, Fu Wei, Conor Dooley, Rob Herring,
	Krzysztof Kozlowski, Jason Kridner, Robert Nelson, linux-riscv,
	linux-kernel, devicetree

On Sat, 2024-03-02 at 08:25 -0800, Drew Fustini wrote:
> On Sat, Mar 02, 2024 at 10:13:55PM +0800, Xi Ruoyao wrote:
> > On Wed, 2023-12-06 at 00:09 -0800, Drew Fustini wrote:
> > > Add emmc node properties for the eMMC device and add sdio0 node
> > > properties for the microSD slot. Set the frequency for the sdhci
> > > reference clock.
> > 
> > Hi Drew,
> > 
> > I've been using the emmc on LicheePi 4A for a while without any problem,
> > but when I try the microSD slot I get:
> > 
> > [    0.531804] mmc1: SDHCI controller on ffe7090000.mmc [ffe7090000.mmc] using ADMA 64-bit
> > [    0.842674] mmc1: Tuning failed, falling back to fixed sampling clock
> > [    0.855139] mmc1: tuning execution failed: -5
> > [    0.859609] mmc1: error -5 whilst initialising SD card
> > [   11.359879] mmc1: Timeout waiting for hardware cmd interrupt.
> > [   11.365661] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
> > [   11.372105] mmc1: sdhci: Sys addr:  0x00000001 | Version:  0x00000005
> > [   11.378547] mmc1: sdhci: Blk size:  0x00007040 | Blk cnt:  0x00000000
> > [   11.384989] mmc1: sdhci: Argument:  0x00000000 | Trn mode: 0x00000010
> > [   11.391432] mmc1: sdhci: Present:   0x03ff0000 | Host ctl: 0x00000017
> > [   11.397873] mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000000
> > [   11.404312] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000000f
> > [   11.410753] mmc1: sdhci: Timeout:   0x00000004 | Int stat: 0x00000000
> > [   11.417192] mmc1: sdhci: Int enab:  0x00000020 | Sig enab: 0x00000020
> > [   11.423633] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
> > [   11.430073] mmc1: sdhci: Caps:      0x3f69c881 | Caps_1:   0x08008177
> > [   11.436513] mmc1: sdhci: Cmd:       0x00000102 | Max curr: 0x00191919
> > [   11.442954] mmc1: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x07725f7f
> > [   11.449394] mmc1: sdhci: Resp[2]:   0x32db7900 | Resp[3]:  0x00400e00
> > [   11.455835] mmc1: sdhci: Host ctl2: 0x0000300b
> > [   11.460280] mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x0000000000882220
> > [   11.467416] mmc1: sdhci: ============================================
> > [   11.563828] mmc1: Tuning failed, falling back to fixed sampling clock
> > [   11.576053] mmc1: tuning execution failed: -5
> > [   11.646438] mmc1: new high speed SDXC card at address aaaa
> > [   11.653170] mmcblk1: mmc1:aaaa SR256 238 GiB
> > 
> > I can write something into the SD card and read it back though.  But
> > this makes me reluctant to use the SD card for "some real thing" afraid
> > of a data loss.
> > 
> > The SD card is a SanDisk Extreme Pro 256GB (rated "U3, A2, V30").
> > 
> > Any idea how to debug this issue further?  (Maybe I should try change
> > the SD card first but I'd like to discuss the issue before paying money
> > for another card.)
> 
> Revy informed me that downclocking from 198 MHz to 100 MHz [1] has been
> observed to solve this problem. Could you try the following dts patch?

I'm still getting the same error.

> Also, I have noticed the T-Head's 5.10 vendor kernel does have some
> updates in sdhci-of-dwcmshc.c related to tuning. I'll look at porting
> those to the upstream driving.

Maybe to solve the problem we need both the downclocking and these
changes then...

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2024-03-03  8:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-06  8:09 [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Drew Fustini
2023-12-06  8:09 ` [PATCH v8 1/4] riscv: defconfig: Enable mmc and dma drivers for T-Head TH1520 Drew Fustini
2023-12-06 10:08   ` Emil Renner Berthing
2023-12-06  8:09 ` [PATCH v8 2/4] riscv: dts: thead: Add TH1520 mmc controllers and sdhci clock Drew Fustini
2023-12-06 10:10   ` Emil Renner Berthing
2023-12-07  6:33     ` Drew Fustini
2023-12-07  8:23   ` Guo Ren
2023-12-06  8:09 ` [PATCH v8 3/4] riscv: dts: thead: Enable BeagleV Ahead eMMC and microSD Drew Fustini
2023-12-07  8:27   ` Guo Ren
2023-12-06  8:09 ` [PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A " Drew Fustini
2023-12-07  8:25   ` Guo Ren
2024-03-02 14:13   ` Xi Ruoyao
2024-03-02 16:25     ` Drew Fustini
2024-03-03  8:48       ` Xi Ruoyao
2023-12-12  4:53 ` [PATCH v8 0/4] RISC-V: Add MMC support for TH1520 boards Jisheng Zhang
2023-12-12 19:13 ` (subset) " Conor Dooley
2024-02-12  4:51   ` Drew Fustini
2024-02-16 19:06   ` Palmer Dabbelt
2024-02-22 20:20 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).