diff mbox series

mmc: meson-gx: increase power-up delay

Message ID 11a8a0c8-a5b1-8f38-a139-97172ab7be68@free.fr
State New
Headers show
Series mmc: meson-gx: increase power-up delay | expand

Commit Message

Marc Gonzalez March 14, 2023, 5:24 p.m. UTC
With the default power-up delay, on small kernels, the host probes
too soon, and mmc_send_io_op_cond() times out.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
---
Stress-tested with 80 cold boots, checking every time
mmc2: new ultra high speed SDR50 SDIO card at address 0001
IIUC, this will also slow down SD & MMC probing,
but an additional 20 ms seems acceptable?
---
 drivers/mmc/host/meson-gx-mmc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Marc Gonzalez March 15, 2023, 10:20 a.m. UTC | #1
On 14/03/2023 20:45, Heiner Kallweit wrote:

> On 14.03.2023 18:24, Marc Gonzalez wrote:
> 
>> With the default power-up delay, on small kernels, the host probes
>> too soon, and mmc_send_io_op_cond() times out.
> 
> Looking at mmc_power_up() and how power_delay_ms is used
> I wonder what you mean with "host probes too soon".

Hello Heiner,

Thanks for your interest in my patch! :)

I should have added a link to the thread that led to the patch.
https://patchwork.kernel.org/project/linux-wireless/patch/c1a215cf-94be-871b-2a8a-3cc381588f83@free.fr/
Start at "I have run into another issue."

Basically, I have an S905X2-based board.
I built a small kernel for it (with only a few drivers), that boots really fast.

mmc2 (SDIO controller hooked to WiFi chip) would not probe at all,
unless I added lots of printks.
Basically, calling mmc_send_io_op_cond() too soon after the controller
has been reset leads to the CMD5 request timing out.


> Are you sure that the additional delay is needed for the Amlogic MMC
> block IP in general? Or could it be that your issue is caused by
> a specific regulator and you need to add a delay there?

The eternal question...

I have only one type of board. (Actually, I have a reference design
that is slightly different, so I should test on that one as well.)

In vendor kernels, they add delays to the WiFi drivers.
Maybe they have run into the issue, and they're just fixing the symptom?

Default value for ios.power_delay_ms is 10 ms.
msleep(ios.power_delay_ms) is called twice in mmc_power_up().
So raising the delay from 10 to 20 adds 20 ms
to the latency of initializing SDIO/SD/MMC controllers.

Would you be willing to test if the problem manifests on your board?

Regards
Jerome Brunet March 15, 2023, 3:27 p.m. UTC | #2
On Wed 15 Mar 2023 at 11:20, Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:

> On 14/03/2023 20:45, Heiner Kallweit wrote:
>
>> On 14.03.2023 18:24, Marc Gonzalez wrote:
>> 
>>> With the default power-up delay, on small kernels, the host probes
>>> too soon, and mmc_send_io_op_cond() times out.
>> 
>> Looking at mmc_power_up() and how power_delay_ms is used
>> I wonder what you mean with "host probes too soon".
>
> Hello Heiner,
>
> Thanks for your interest in my patch! :)
>
> I should have added a link to the thread that led to the patch.
> https://patchwork.kernel.org/project/linux-wireless/patch/c1a215cf-94be-871b-2a8a-3cc381588f83@free.fr/
> Start at "I have run into another issue."
>
> Basically, I have an S905X2-based board.
> I built a small kernel for it (with only a few drivers), that boots really fast.
>
> mmc2 (SDIO controller hooked to WiFi chip) would not probe at all,
> unless I added lots of printks.
> Basically, calling mmc_send_io_op_cond() too soon after the controller
> has been reset leads to the CMD5 request timing out.
>
>

I tend to agree with Heiner here.
This patch is backing a contraint only reported on your design in the
driver of every AML SoC supported, for every MMC controller.

I think you should look first in your vmmc and vqmmc regulators and
their setup times.

"fixed-regulator" have properties which might be interesting to you,
like
 * startup-delay-us
 * off-on-delay-us

>> Are you sure that the additional delay is needed for the Amlogic MMC
>> block IP in general? Or could it be that your issue is caused by
>> a specific regulator and you need to add a delay there?
>
> The eternal question...
>
> I have only one type of board. (Actually, I have a reference design
> that is slightly different, so I should test on that one as well.)
>
> In vendor kernels, they add delays to the WiFi drivers.
> Maybe they have run into the issue, and they're just fixing the symptom?
>
> Default value for ios.power_delay_ms is 10 ms.
> msleep(ios.power_delay_ms) is called twice in mmc_power_up().
> So raising the delay from 10 to 20 adds 20 ms
> to the latency of initializing SDIO/SD/MMC controllers.
>
> Would you be willing to test if the problem manifests on your board?
>
> Regards
Ulf Hansson March 16, 2023, 11:59 a.m. UTC | #3
On Wed, 15 Mar 2023 at 16:31, Jerome Brunet <jbrunet@baylibre.com> wrote:
>
>
> On Wed 15 Mar 2023 at 11:20, Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:
>
> > On 14/03/2023 20:45, Heiner Kallweit wrote:
> >
> >> On 14.03.2023 18:24, Marc Gonzalez wrote:
> >>
> >>> With the default power-up delay, on small kernels, the host probes
> >>> too soon, and mmc_send_io_op_cond() times out.
> >>
> >> Looking at mmc_power_up() and how power_delay_ms is used
> >> I wonder what you mean with "host probes too soon".
> >
> > Hello Heiner,
> >
> > Thanks for your interest in my patch! :)
> >
> > I should have added a link to the thread that led to the patch.
> > https://patchwork.kernel.org/project/linux-wireless/patch/c1a215cf-94be-871b-2a8a-3cc381588f83@free.fr/
> > Start at "I have run into another issue."
> >
> > Basically, I have an S905X2-based board.
> > I built a small kernel for it (with only a few drivers), that boots really fast.
> >
> > mmc2 (SDIO controller hooked to WiFi chip) would not probe at all,
> > unless I added lots of printks.
> > Basically, calling mmc_send_io_op_cond() too soon after the controller
> > has been reset leads to the CMD5 request timing out.
> >
> >
>
> I tend to agree with Heiner here.
> This patch is backing a contraint only reported on your design in the
> driver of every AML SoC supported, for every MMC controller.
>
> I think you should look first in your vmmc and vqmmc regulators and
> their setup times.
>
> "fixed-regulator" have properties which might be interesting to you,
> like
>  * startup-delay-us
>  * off-on-delay-us

If the problem is regulator specific, this would be the correct thing to do.

Although, if the problem is pwrseq specific, like that we need a delay
after enabling the clock and asserting the GPIO enable pin for the
WiFi chip, then we have the "post-power-on-delay-ms" of the pwrseq
node to play with instead.

>
> >> Are you sure that the additional delay is needed for the Amlogic MMC
> >> block IP in general? Or could it be that your issue is caused by
> >> a specific regulator and you need to add a delay there?
> >
> > The eternal question...
> >
> > I have only one type of board. (Actually, I have a reference design
> > that is slightly different, so I should test on that one as well.)
> >
> > In vendor kernels, they add delays to the WiFi drivers.
> > Maybe they have run into the issue, and they're just fixing the symptom?
> >
> > Default value for ios.power_delay_ms is 10 ms.
> > msleep(ios.power_delay_ms) is called twice in mmc_power_up().
> > So raising the delay from 10 to 20 adds 20 ms
> > to the latency of initializing SDIO/SD/MMC controllers.
> >
> > Would you be willing to test if the problem manifests on your board?
> >
> > Regards
>

Kind regards
Uffe
Marc Gonzalez March 16, 2023, 4:32 p.m. UTC | #4
On 16/03/2023 12:59, Ulf Hansson wrote:

> If the problem is regulator specific, this would be the correct thing to do.
> 
> Although, if the problem is pwrseq specific, like that we need a delay
> after enabling the clock and asserting the GPIO enable pin for the
> WiFi chip, then we have the "post-power-on-delay-ms" of the pwrseq
> node to play with instead.

Heiner, Jerome, Uffe, Amlogic DT maintainers,

Perhaps tweaking the driver for every user is too intrusive.

Another solution would be to factorize all boards that implement
the reference design SDIO-based RF (WiFi + BT using brcm).

Then we can add post-power-on-delay-ms = 20 in sdio_pwrseq.

NB: there's vddio_ao1v8 vs vddao_1v8 in sei510.
Is my addition OK?

RFC prototype:

diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
index e3bb6df42ff3e..42b5dcf358912 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include "meson-g12a-ref-design-brcm-rf.dtsi"
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
 
@@ -53,13 +54,6 @@ emmc_pwrseq: emmc-pwrseq {
 		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
 	};
 
-	sdio_pwrseq: sdio-pwrseq {
-		compatible = "mmc-pwrseq-simple";
-		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
-		clocks = <&wifi32k>;
-		clock-names = "ext_clock";
-	};
-
 	ao_5v: regulator-ao_5v {
 		compatible = "regulator-fixed";
 		regulator-name = "AO_5V";
@@ -182,13 +176,6 @@ codec {
 			};
 		};
 	};
-
-	wifi32k: wifi32k {
-		compatible = "pwm-clock";
-		#clock-cells = <0>;
-		clock-frequency = <32768>;
-		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
-	};
 };
 
 &arb {
@@ -299,37 +286,6 @@ &saradc {
 	vref-supply = <&vddao_1v8>;
 };
 
-/* SDIO */
-&sd_emmc_a {
-	status = "okay";
-	pinctrl-0 = <&sdio_pins>;
-	pinctrl-1 = <&sdio_clk_gate_pins>;
-	pinctrl-names = "default", "clk-gate";
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	bus-width = <4>;
-	cap-sd-highspeed;
-	sd-uhs-sdr50;
-	max-frequency = <100000000>;
-
-	non-removable;
-	disable-wp;
-
-	/* WiFi firmware requires power to be kept while in suspend */
-	keep-power-in-suspend;
-
-	mmc-pwrseq = <&sdio_pwrseq>;
-
-	vmmc-supply = <&vddao_3v3>;
-	vqmmc-supply = <&vddao_1v8>;
-
-	brcmf: wifi@1 {
-		reg = <1>;
-		compatible = "brcm,bcm4329-fmac";
-	};
-};
-
 /* SD card */
 &sd_emmc_b {
 	status = "okay";
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi
new file mode 100644
index 0000000000000..e462324596964
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
+ */
+
+#include <dt-bindings/gpio/meson-g12a-gpio.h>
+
+/ {
+	sdio_pwrseq: sdio-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
+		clocks = <&wifi32k>;
+		clock-names = "ext_clock";
+	};
+
+	wifi32k: wifi32k {
+		compatible = "pwm-clock";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
+	};
+};
+
+/* SDIO */
+&sd_emmc_a {
+	status = "okay";
+	pinctrl-0 = <&sdio_pins>;
+	pinctrl-1 = <&sdio_clk_gate_pins>;
+	pinctrl-names = "default", "clk-gate";
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	bus-width = <4>;
+	cap-sd-highspeed;
+	sd-uhs-sdr50;
+	max-frequency = <100000000>;
+
+	non-removable;
+	disable-wp;
+
+	/* WiFi firmware requires power to be kept while in suspend */
+	keep-power-in-suspend;
+
+	mmc-pwrseq = <&sdio_pwrseq>;
+
+	vmmc-supply = <&vddao_3v3>;
+	vqmmc-supply = <&vddao_1v8>;
+
+	brcmf: wifi@1 {
+		reg = <1>;
+		compatible = "brcm,bcm4329-fmac";
+	};
+};
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
index 23b790c6469d3..e12aeb956b7d7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include "meson-g12a-ref-design-brcm-rf.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
@@ -96,6 +97,15 @@ emmc_1v8: regulator-emmc_1v8 {
 		regulator-always-on;
 	};
 
+	vddao_1v8: regulator-vddao_1v8 {
+		compatible = "regulator-fixed";
+		regulator-name = "VDDAO_1V8";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vddao_3v3>;
+		regulator-always-on;
+	};
+
 	vddao_3v3: regulator-vddao_3v3 {
 		compatible = "regulator-fixed";
 		regulator-name = "VDDAO_3V3";
@@ -143,20 +153,6 @@ vddio_ao1v8: regulator-vddio_ao1v8 {
 		regulator-always-on;
 	};
 
-	sdio_pwrseq: sdio-pwrseq {
-		compatible = "mmc-pwrseq-simple";
-		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
-		clocks = <&wifi32k>;
-		clock-names = "ext_clock";
-	};
-
-	wifi32k: wifi32k {
-		compatible = "pwm-clock";
-		#clock-cells = <0>;
-		clock-frequency = <32768>;
-		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
-	};
-
 	sound {
 		compatible = "amlogic,axg-sound-card";
 		model = "SEI510";
@@ -375,37 +371,6 @@ &saradc {
 	vref-supply = <&vddio_ao1v8>;
 };
 
-/* SDIO */
-&sd_emmc_a {
-	status = "okay";
-	pinctrl-0 = <&sdio_pins>;
-	pinctrl-1 = <&sdio_clk_gate_pins>;
-	pinctrl-names = "default", "clk-gate";
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	bus-width = <4>;
-	cap-sd-highspeed;
-	sd-uhs-sdr50;
-	max-frequency = <100000000>;
-
-	non-removable;
-	disable-wp;
-
-	/* WiFi firmware requires power to be kept while in suspend */
-	keep-power-in-suspend;
-
-	mmc-pwrseq = <&sdio_pwrseq>;
-
-	vmmc-supply = <&vddao_3v3>;
-	vqmmc-supply = <&vddio_ao1v8>;
-
-	brcmf: wifi@1 {
-		reg = <1>;
-		compatible = "brcm,bcm4329-fmac";
-	};
-};
-
 /* SD card */
 &sd_emmc_b {
 	status = "okay";
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
index b2bb94981838f..68a8876386115 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "meson-g12a.dtsi"
+#include "meson-g12a-ref-design-brcm-rf.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/gpio/meson-g12a-gpio.h>
 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
@@ -60,13 +61,6 @@ emmc_pwrseq: emmc-pwrseq {
 		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
 	};
 
-	sdio_pwrseq: sdio-pwrseq {
-		compatible = "mmc-pwrseq-simple";
-		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
-		clocks = <&wifi32k>;
-		clock-names = "ext_clock";
-	};
-
 	flash_1v8: regulator-flash_1v8 {
 		compatible = "regulator-fixed";
 		regulator-name = "FLASH_1V8";
@@ -226,13 +220,6 @@ codec {
 			};
 		};
 	};
-
-	wifi32k: wifi32k {
-		compatible = "pwm-clock";
-		#clock-cells = <0>;
-		clock-frequency = <32768>;
-		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
-	};
 };
 
 &arb {
@@ -391,37 +378,6 @@ &usb {
 	dr_mode = "host";
 };
 
-/* SDIO */
-&sd_emmc_a {
-	status = "okay";
-	pinctrl-0 = <&sdio_pins>;
-	pinctrl-1 = <&sdio_clk_gate_pins>;
-	pinctrl-names = "default", "clk-gate";
-	#address-cells = <1>;
-	#size-cells = <0>;
-
-	bus-width = <4>;
-	cap-sd-highspeed;
-	sd-uhs-sdr50;
-	max-frequency = <100000000>;
-
-	non-removable;
-	disable-wp;
-
-	/* WiFi firmware requires power to be kept while in suspend */
-	keep-power-in-suspend;
-
-	mmc-pwrseq = <&sdio_pwrseq>;
-
-	vmmc-supply = <&vddao_3v3>;
-	vqmmc-supply = <&vddao_1v8>;
-
-	brcmf: wifi@1 {
-		reg = <1>;
-		compatible = "brcm,bcm4329-fmac";
-	};
-};
-
 /* SD card */
 &sd_emmc_b {
 	status = "okay";
Christian Hewitt March 17, 2023, 11:28 a.m. UTC | #5
> On 16 Mar 2023, at 8:32 pm, Marc Gonzalez <marc.w.gonzalez@free.fr> wrote:
> 
> On 16/03/2023 12:59, Ulf Hansson wrote:
> 
>> If the problem is regulator specific, this would be the correct thing to do.
>> 
>> Although, if the problem is pwrseq specific, like that we need a delay
>> after enabling the clock and asserting the GPIO enable pin for the
>> WiFi chip, then we have the "post-power-on-delay-ms" of the pwrseq
>> node to play with instead.
> 
> Heiner, Jerome, Uffe, Amlogic DT maintainers,
> 
> Perhaps tweaking the driver for every user is too intrusive.
> 
> Another solution would be to factorize all boards that implement
> the reference design SDIO-based RF (WiFi + BT using brcm).
> 
> Then we can add post-power-on-delay-ms = 20 in sdio_pwrseq.
> 
> NB: there's vddio_ao1v8 vs vddao_1v8 in sei510.
> Is my addition OK?

In LibreELEC we use a fairly minimal kernel defconfig; things are booting fast
compared to most desktop distro configs. I see occasional wireless issues with
cheap STB boards where SDIO speeds need to be reduced or UHS modes need to be
removed to keep things stable, but I don’t see SDIO probe issues with any of
the 30+ boards I do random testing with. The only SDIO drama in recent times
have been Heiner's IRQ changes (which are now resolved).

Are you using a real SEI510 board? ..I ask because we get lots of users with
random no-name Android boxes who try lots of dtb files until they come across
something that works; and there is a recurring trend where users have been
using SEI510 or SEI620 with poor results, and odd issues magically go away
once they are persuaded to use something else. So I have the impression those
specific device-trees aren’t well suited to typical reference design clones.

FWIW, I’ve also had thoughts about factoring aspects of WiFi support into a
few common dtsi files as there are increasing numbers of boxes/boards that
use Realtek or Qualcomm chips in circulation (due to post-covid chip supply
and pricing troubles). I would leave the sd_mmc_a node in the board files
since this is common (and in my experience works the same everywhere) while
moving the BT bits that need ‘compatible’ and GPIO details and the SDIO ID
poke and compatible (which isn’t really needed) to dtsi files. My goal would
be to make the copy/paste assembly of a new Android box dts even easier than
it already is.

If you don’t have an SEI510 board I have a hunch you’d be better off with
another device-tree as the source/base for your board. If you’re able to
share the schematics (privately if preferred) I’d be interested in seeing
what other dtb's could be used; and perhaps getting you to boot a LibreELEC
test image on your board to see whether my codebase gives same or different
results?

Christian

> RFC prototype:
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
> index e3bb6df42ff3e..42b5dcf358912 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-radxa-zero.dts
> @@ -6,6 +6,7 @@
> /dts-v1/;
> 
> #include "meson-g12a.dtsi"
> +#include "meson-g12a-ref-design-brcm-rf.dtsi"
> #include <dt-bindings/gpio/meson-g12a-gpio.h>
> #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
> 
> @@ -53,13 +54,6 @@ emmc_pwrseq: emmc-pwrseq {
> 		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
> 	};
> 
> -	sdio_pwrseq: sdio-pwrseq {
> -		compatible = "mmc-pwrseq-simple";
> -		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
> -		clocks = <&wifi32k>;
> -		clock-names = "ext_clock";
> -	};
> -
> 	ao_5v: regulator-ao_5v {
> 		compatible = "regulator-fixed";
> 		regulator-name = "AO_5V";
> @@ -182,13 +176,6 @@ codec {
> 			};
> 		};
> 	};
> -
> -	wifi32k: wifi32k {
> -		compatible = "pwm-clock";
> -		#clock-cells = <0>;
> -		clock-frequency = <32768>;
> -		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
> -	};
> };
> 
> &arb {
> @@ -299,37 +286,6 @@ &saradc {
> 	vref-supply = <&vddao_1v8>;
> };
> 
> -/* SDIO */
> -&sd_emmc_a {
> -	status = "okay";
> -	pinctrl-0 = <&sdio_pins>;
> -	pinctrl-1 = <&sdio_clk_gate_pins>;
> -	pinctrl-names = "default", "clk-gate";
> -	#address-cells = <1>;
> -	#size-cells = <0>;
> -
> -	bus-width = <4>;
> -	cap-sd-highspeed;
> -	sd-uhs-sdr50;
> -	max-frequency = <100000000>;
> -
> -	non-removable;
> -	disable-wp;
> -
> -	/* WiFi firmware requires power to be kept while in suspend */
> -	keep-power-in-suspend;
> -
> -	mmc-pwrseq = <&sdio_pwrseq>;
> -
> -	vmmc-supply = <&vddao_3v3>;
> -	vqmmc-supply = <&vddao_1v8>;
> -
> -	brcmf: wifi@1 {
> -		reg = <1>;
> -		compatible = "brcm,bcm4329-fmac";
> -	};
> -};
> -
> /* SD card */
> &sd_emmc_b {
> 	status = "okay";
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi
> new file mode 100644
> index 0000000000000..e462324596964
> --- /dev/null
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-ref-design-brcm-rf.dtsi
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> +/*
> + * Copyright (c) 2018 Amlogic, Inc. All rights reserved.
> + */
> +
> +#include <dt-bindings/gpio/meson-g12a-gpio.h>
> +
> +/ {
> +	sdio_pwrseq: sdio-pwrseq {
> +		compatible = "mmc-pwrseq-simple";
> +		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
> +		clocks = <&wifi32k>;
> +		clock-names = "ext_clock";
> +	};
> +
> +	wifi32k: wifi32k {
> +		compatible = "pwm-clock";
> +		#clock-cells = <0>;
> +		clock-frequency = <32768>;
> +		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
> +	};
> +};
> +
> +/* SDIO */
> +&sd_emmc_a {
> +	status = "okay";
> +	pinctrl-0 = <&sdio_pins>;
> +	pinctrl-1 = <&sdio_clk_gate_pins>;
> +	pinctrl-names = "default", "clk-gate";
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	bus-width = <4>;
> +	cap-sd-highspeed;
> +	sd-uhs-sdr50;
> +	max-frequency = <100000000>;
> +
> +	non-removable;
> +	disable-wp;
> +
> +	/* WiFi firmware requires power to be kept while in suspend */
> +	keep-power-in-suspend;
> +
> +	mmc-pwrseq = <&sdio_pwrseq>;
> +
> +	vmmc-supply = <&vddao_3v3>;
> +	vqmmc-supply = <&vddao_1v8>;
> +
> +	brcmf: wifi@1 {
> +		reg = <1>;
> +		compatible = "brcm,bcm4329-fmac";
> +	};
> +};
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
> index 23b790c6469d3..e12aeb956b7d7 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts
> @@ -6,6 +6,7 @@
> /dts-v1/;
> 
> #include "meson-g12a.dtsi"
> +#include "meson-g12a-ref-design-brcm-rf.dtsi"
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/input/input.h>
> #include <dt-bindings/gpio/meson-g12a-gpio.h>
> @@ -96,6 +97,15 @@ emmc_1v8: regulator-emmc_1v8 {
> 		regulator-always-on;
> 	};
> 
> +	vddao_1v8: regulator-vddao_1v8 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "VDDAO_1V8";
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +		vin-supply = <&vddao_3v3>;
> +		regulator-always-on;
> +	};
> +
> 	vddao_3v3: regulator-vddao_3v3 {
> 		compatible = "regulator-fixed";
> 		regulator-name = "VDDAO_3V3";
> @@ -143,20 +153,6 @@ vddio_ao1v8: regulator-vddio_ao1v8 {
> 		regulator-always-on;
> 	};
> 
> -	sdio_pwrseq: sdio-pwrseq {
> -		compatible = "mmc-pwrseq-simple";
> -		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
> -		clocks = <&wifi32k>;
> -		clock-names = "ext_clock";
> -	};
> -
> -	wifi32k: wifi32k {
> -		compatible = "pwm-clock";
> -		#clock-cells = <0>;
> -		clock-frequency = <32768>;
> -		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
> -	};
> -
> 	sound {
> 		compatible = "amlogic,axg-sound-card";
> 		model = "SEI510";
> @@ -375,37 +371,6 @@ &saradc {
> 	vref-supply = <&vddio_ao1v8>;
> };
> 
> -/* SDIO */
> -&sd_emmc_a {
> -	status = "okay";
> -	pinctrl-0 = <&sdio_pins>;
> -	pinctrl-1 = <&sdio_clk_gate_pins>;
> -	pinctrl-names = "default", "clk-gate";
> -	#address-cells = <1>;
> -	#size-cells = <0>;
> -
> -	bus-width = <4>;
> -	cap-sd-highspeed;
> -	sd-uhs-sdr50;
> -	max-frequency = <100000000>;
> -
> -	non-removable;
> -	disable-wp;
> -
> -	/* WiFi firmware requires power to be kept while in suspend */
> -	keep-power-in-suspend;
> -
> -	mmc-pwrseq = <&sdio_pwrseq>;
> -
> -	vmmc-supply = <&vddao_3v3>;
> -	vqmmc-supply = <&vddio_ao1v8>;
> -
> -	brcmf: wifi@1 {
> -		reg = <1>;
> -		compatible = "brcm,bcm4329-fmac";
> -	};
> -};
> -
> /* SD card */
> &sd_emmc_b {
> 	status = "okay";
> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> index b2bb94981838f..68a8876386115 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-g12a-x96-max.dts
> @@ -6,6 +6,7 @@
> /dts-v1/;
> 
> #include "meson-g12a.dtsi"
> +#include "meson-g12a-ref-design-brcm-rf.dtsi"
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/gpio/meson-g12a-gpio.h>
> #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
> @@ -60,13 +61,6 @@ emmc_pwrseq: emmc-pwrseq {
> 		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
> 	};
> 
> -	sdio_pwrseq: sdio-pwrseq {
> -		compatible = "mmc-pwrseq-simple";
> -		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
> -		clocks = <&wifi32k>;
> -		clock-names = "ext_clock";
> -	};
> -
> 	flash_1v8: regulator-flash_1v8 {
> 		compatible = "regulator-fixed";
> 		regulator-name = "FLASH_1V8";
> @@ -226,13 +220,6 @@ codec {
> 			};
> 		};
> 	};
> -
> -	wifi32k: wifi32k {
> -		compatible = "pwm-clock";
> -		#clock-cells = <0>;
> -		clock-frequency = <32768>;
> -		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
> -	};
> };
> 
> &arb {
> @@ -391,37 +378,6 @@ &usb {
> 	dr_mode = "host";
> };
> 
> -/* SDIO */
> -&sd_emmc_a {
> -	status = "okay";
> -	pinctrl-0 = <&sdio_pins>;
> -	pinctrl-1 = <&sdio_clk_gate_pins>;
> -	pinctrl-names = "default", "clk-gate";
> -	#address-cells = <1>;
> -	#size-cells = <0>;
> -
> -	bus-width = <4>;
> -	cap-sd-highspeed;
> -	sd-uhs-sdr50;
> -	max-frequency = <100000000>;
> -
> -	non-removable;
> -	disable-wp;
> -
> -	/* WiFi firmware requires power to be kept while in suspend */
> -	keep-power-in-suspend;
> -
> -	mmc-pwrseq = <&sdio_pwrseq>;
> -
> -	vmmc-supply = <&vddao_3v3>;
> -	vqmmc-supply = <&vddao_1v8>;
> -
> -	brcmf: wifi@1 {
> -		reg = <1>;
> -		compatible = "brcm,bcm4329-fmac";
> -	};
> -};
> -
> /* SD card */
> &sd_emmc_b {
> 	status = "okay";
> 
> 
> _______________________________________________
> linux-amlogic mailing list
> linux-amlogic@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-amlogic
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 6e5ea0213b477..73ecbcf588c65 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -1182,6 +1182,7 @@  static int meson_mmc_probe(struct platform_device *pdev)
 	mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev);
 	if (!mmc)
 		return -ENOMEM;
+	mmc->ios.power_delay_ms = 20;
 	host = mmc_priv(mmc);
 	host->mmc = mmc;
 	host->dev = &pdev->dev;