[PATCH v8 4/4] riscv: dts: thead: Enable LicheePi 4A eMMC and microSD

Xi Ruoyao xry111 at xry111.site
Sat Mar 2 06:13:55 PST 2024


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 at 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 at xry111.site>
School of Aerospace Science and Technology, Xidian University



More information about the linux-riscv mailing list