PabloPL / linux

Linux kernel source tree
Other
17 stars 0 forks source link

SDHCI ADMA Error #42

Closed xc-racer99 closed 3 years ago

xc-racer99 commented 4 years ago

As originally reported in #41 by @kwizart (and reproduced by myself several times, without a good method of doing so, although it seems to happen in disk-heavy workloads), the MMC controller can give errors like

[ 141.533993] mmc2: ADMA error: 0x02000000
[ 141.535137] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[ 141.540246] mmc2: sdhci: Sys addr: 0x347e4cc4 | Version: 0x00002401
[ 141.545358] mmc2: sdhci: Blk size: 0x00007004 | Blk cnt: 0x0000fffc
[ 141.550470] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013
[ 141.555583] mmc2: sdhci: Present: 0x01fa0000 | Host ctl: 0x00000012
[ 141.560696] mmc2: sdhci: Power: 0x00000000 | Blk gap: 0x00000000
[ 141.565809] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x0000010f
[ 141.570921] mmc2: sdhci: Timeout: 0x0000000a | Int stat: 0x00000003
[ 141.576034] mmc2: sdhci: Int enab: 0x03ff004b | Sig enab: 0x03ff004b
[ 141.581147] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001
[ 141.586259] mmc2: sdhci: Caps: 0x05e80080 | Caps_1: 0x00000000
[ 141.591372] mmc2: sdhci: Cmd: 0x0000163a | Max curr: 0x00000000
[ 141.596485] mmc2: sdhci: Resp[0]: 0x00000920 | Resp[1]: 0x00000000
[ 141.601597] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000
[ 141.606710] mmc2: sdhci: Host ctl2: 0x00000000
[ 141.609831] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x349a3208
[ 141.614942] mmc2: sdhci: ============================================
[ 141.620057] mmc2: sdhci: 349a3200: DMA 0x347e4cc0, LEN 0x0004, Attr=0x23

I believe this is related to clocking issues, and a patch like

From fc9f477c992d4370905cb7e24990e9e2f0a9fabd Mon Sep 17 00:00:00 2001
From: Jonathan Bakker <xc-racer2@live.ca>
Date: Tue, 11 Feb 2020 15:30:14 -0800
Subject: [PATCH] arm: dts: s5pv210: Assign clocks to MMC devices

The SHDCI controller on aries devices is a little bit peculiar about
the clocks and with a slightly off clock can run into errors such as

[ 141.533993] mmc2: ADMA error: 0x02000000
[ 141.535137] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[ 141.540246] mmc2: sdhci: Sys addr: 0x347e4cc4 | Version: 0x00002401
[ 141.545358] mmc2: sdhci: Blk size: 0x00007004 | Blk cnt: 0x0000fffc
[ 141.550470] mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013
[ 141.555583] mmc2: sdhci: Present: 0x01fa0000 | Host ctl: 0x00000012
[ 141.560696] mmc2: sdhci: Power: 0x00000000 | Blk gap: 0x00000000
[ 141.565809] mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x0000010f
[ 141.570921] mmc2: sdhci: Timeout: 0x0000000a | Int stat: 0x00000003
[ 141.576034] mmc2: sdhci: Int enab: 0x03ff004b | Sig enab: 0x03ff004b
[ 141.581147] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001
[ 141.586259] mmc2: sdhci: Caps: 0x05e80080 | Caps_1: 0x00000000
[ 141.591372] mmc2: sdhci: Cmd: 0x0000163a | Max curr: 0x00000000
[ 141.596485] mmc2: sdhci: Resp[0]: 0x00000920 | Resp[1]: 0x00000000
[ 141.601597] mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000
[ 141.606710] mmc2: sdhci: Host ctl2: 0x00000000
[ 141.609831] mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x349a3208
[ 141.614942] mmc2: sdhci: ============================================
[ 141.620057] mmc2: sdhci: 349a3200: DMA 0x347e4cc0, LEN 0x0004, Attr=0x23

Specifically assign the mmc sclks to be parented from MPLL with specific
rates that match the vendor kernel.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 arch/arm/boot/dts/s5pv210-aries.dtsi  | 8 ++++++++
 arch/arm/boot/dts/s5pv210-galaxys.dts | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/s5pv210-aries.dtsi b/arch/arm/boot/dts/s5pv210-aries.dtsi
index 13cd7899497c..f1dd5ff9a965 100644
--- a/arch/arm/boot/dts/s5pv210-aries.dtsi
+++ b/arch/arm/boot/dts/s5pv210-aries.dtsi
@@ -1019,6 +1019,10 @@
    non-removable;
    status = "okay";

+   assigned-clocks = <&clocks MOUT_MMC1>, <&clocks SCLK_MMC1>;
+   assigned-clock-rates = <0>, <50000000>;
+   assigned-clock-parents = <&clocks MOUT_MPLL>;
+
    wlan@1 {
        reg = <1>;
        compatible = "brcm,bcm4329-fmac";
@@ -1035,6 +1039,10 @@
    pinctrl-0 = <&sd2_clk &sd2_cmd &sd2_bus4 &tf_detect>;
    pinctrl-names = "default";
    status = "okay";
+
+   assigned-clocks = <&clocks MOUT_MMC2>, <&clocks SCLK_MMC2>;
+   assigned-clock-rates = <0>, <50000000>;
+   assigned-clock-parents = <&clocks MOUT_MPLL>;
 };

 &uart0 {
diff --git a/arch/arm/boot/dts/s5pv210-galaxys.dts b/arch/arm/boot/dts/s5pv210-galaxys.dts
index fa4ad4dfa8af..abea15c0e892 100644
--- a/arch/arm/boot/dts/s5pv210-galaxys.dts
+++ b/arch/arm/boot/dts/s5pv210-galaxys.dts
@@ -613,6 +613,10 @@
    pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>;
    pinctrl-names = "default";
    status = "okay";
+
+   assigned-clocks = <&clocks MOUT_MMC0>, <&clocks SCLK_MMC0>;
+   assigned-clock-rates = <0>, <52000000>;
+   assigned-clock-parents = <&clocks MOUT_MPLL>;
 };

 &uart3 {
-- 
2.20.1

appears to solve things. This matches the clock configuration from the vendor kernel.

kwizart commented 4 years ago

I have experienced another ADMA error using 5.5.1-i9000+ kernel mmc2: ADMA error: 0x02000000 mmc2: sdhci: ============ SDHCI REGISTER DUMP =========== mmc2: sdhci: Sys addr: 0x34862a04 | Version: 0x00002401 mmc2: sdhci: Blk size: 0x00007004 | Blk cnt: 0x0000fffc mmc2: sdhci: Argument: 0x00000000 | Trn mode: 0x00000013 mmc2: sdhci: Present: 0x01fa0000 | Host ctl: 0x00000012 mmc2: sdhci: Power: 0x00000000 | Blk gap: 0x00000000 mmc2: sdhci: Wake-up: 0x00000000 | Clock: 0x0000000f mmc2: sdhci: Timeout: 0x0000000a | Int stat: 0x00000002 mmc2: sdhci: Int enab: 0x03ff004b | Sig enab: 0x03ff004b mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000001 mmc2: sdhci: Caps: 0x05e80080 | Caps_1: 0x00000000 mmc2: sdhci: Cmd: 0x0000163a | Max curr: 0x00000000 mmc2: sdhci: Resp[0]: 0x00000920 | Resp[1]: 0x00000000 mmc2: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000 mmc2: sdhci: Host ctl2: 0x00000000 mmc2: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x54f7e208 mmc2: sdhci: ============================================ mmc2: sdhci: 54f7e200: DMA 0x34862a00, LEN 0x0004, Attr=0x23

xc-racer99 commented 4 years ago

Alright, the clock changes have been submitted (and accepted) upstream. I've yet to been able to reproduce the issue with the clock patch, despite some pretty disk intensive workloads where it used to appear all of the time. I'll leave this open for now, until we can confirm that it is/isn't happening to more than just @kwizart

xc-racer99 commented 3 years ago

I've yet to see this issue reappear since the clock changes, so I'm going to call it fixed.

kwizart commented 3 years ago

I may retry with newer 5.9+ kernel at some point.

As a side note, I still monitor: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=s3c-multiplatform and https://patchwork.ozlabs.org/project/linux-tegra/list/?series=197929 (IIRC, that the same BCM4329 chip).

kwizart commented 3 years ago

Is it possible to have a rebase on top on 5.9 kernel ? (with and without powervr) Thanks in advances.

xc-racer99 commented 3 years ago

Is it possible to have a rebase on top on 5.9 kernel ? (with and without powervr)

I'll try to get that done later this week, I want to submit the DTS changes for the audio driver before working on rebasing everything.

xc-racer99 commented 3 years ago

Is it possible to have a rebase on top on 5.9 kernel ? (with and without powervr)

@kwizart I've now pushed https://github.com/xc-racer99/linux/tree/v5.9-rc2-all-devices - this has everything except the max17040 rcomp settings and the power domains. The vast majority of these patches are related to PVR. The ones that are due to land in v5.10 are the audio DTS, the FIMC patches (not the sensor drivers, haven't submitted those), and the charger-manager patches.

Edit: Of the 146 patches, 19 are due to land in v5.10, 3 are camera related, 6 are onenand related, 5 are drm related (fimc, tvout, and g2d), 11 are modem related, 87 are PowerVR, and the rest are a mixture of various driver fixups and DTS changes.