2021-07-06 12:13:45

by Alistair Francis

[permalink] [raw]
Subject: [PATCH v3] ARM: dts: imx7d-remarkable2: Add WiFi support

Add support for the bcm4329-fmac WiFi in the reMarkable 2, connected via SDHC.

Signed-off-by: Alistair Francis <[email protected]>
---
V3:
- Remove the duplicate pinctrl-2

arch/arm/boot/dts/imx7d-remarkable2.dts | 91 +++++++++++++++++++++++++
1 file changed, 91 insertions(+)

diff --git a/arch/arm/boot/dts/imx7d-remarkable2.dts b/arch/arm/boot/dts/imx7d-remarkable2.dts
index 8cbae656395c..89cbf13097a4 100644
--- a/arch/arm/boot/dts/imx7d-remarkable2.dts
+++ b/arch/arm/boot/dts/imx7d-remarkable2.dts
@@ -21,6 +21,27 @@ memory@80000000 {
device_type = "memory";
reg = <0x80000000 0x40000000>;
};
+
+ reg_brcm: regulator-brcm {
+ compatible = "regulator-fixed";
+ regulator-name = "brcm_reg";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_brcm_reg>;
+ gpio = <&gpio6 13 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ startup-delay-us = <150>;
+ };
+
+ wifi_pwrseq: wifi_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_wifi>;
+ reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
+ clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;
+ clock-names = "ext_clock";
+ };
};

&clks {
@@ -56,6 +77,27 @@ &usbotg2 {
status = "okay";
};

+&usdhc2 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
+ pinctrl-0 = <&pinctrl_usdhc2>;
+ pinctrl-1 = <&pinctrl_usdhc2_100mhz>;
+ pinctrl-2 = <&pinctrl_usdhc2_200mhz>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ vmmc-supply = <&reg_brcm>;
+ bus-width = <4>;
+ non-removable;
+ keep-power-in-suspend;
+ cap-power-off-card;
+ status = "okay";
+
+ brcmf: bcrmf@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+};
+
&usdhc3 {
pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep";
pinctrl-0 = <&pinctrl_usdhc3>;
@@ -76,6 +118,13 @@ &wdog1 {
};

&iomuxc {
+ pinctrl_brcm_reg: brcmreggrp {
+ fsl,pins = <
+ /* WIFI_PWR_EN */
+ MX7D_PAD_SAI1_TX_BCLK__GPIO6_IO13 0x14
+ >;
+ };
+
pinctrl_uart1: uart1grp {
fsl,pins = <
MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79
@@ -90,6 +139,39 @@ MX7D_PAD_EPDC_DATA08__UART6_DCE_RX 0x79
>;
};

+ pinctrl_usdhc2: usdhc2grp {
+ fsl,pins = <
+ MX7D_PAD_SD2_CMD__SD2_CMD 0x59
+ MX7D_PAD_SD2_CLK__SD2_CLK 0x19
+ MX7D_PAD_SD2_DATA0__SD2_DATA0 0x59
+ MX7D_PAD_SD2_DATA1__SD2_DATA1 0x59
+ MX7D_PAD_SD2_DATA2__SD2_DATA2 0x59
+ MX7D_PAD_SD2_DATA3__SD2_DATA3 0x59
+ >;
+ };
+
+ pinctrl_usdhc2_100mhz: usdhc2grp_100mhz {
+ fsl,pins = <
+ MX7D_PAD_SD2_CMD__SD2_CMD 0x5a
+ MX7D_PAD_SD2_CLK__SD2_CLK 0x1a
+ MX7D_PAD_SD2_DATA0__SD2_DATA0 0x5a
+ MX7D_PAD_SD2_DATA1__SD2_DATA1 0x5a
+ MX7D_PAD_SD2_DATA2__SD2_DATA2 0x5a
+ MX7D_PAD_SD2_DATA3__SD2_DATA3 0x5a
+ >;
+ };
+
+ pinctrl_usdhc2_200mhz: usdhc2grp_200mhz {
+ fsl,pins = <
+ MX7D_PAD_SD2_CMD__SD2_CMD 0x5b
+ MX7D_PAD_SD2_CLK__SD2_CLK 0x1b
+ MX7D_PAD_SD2_DATA0__SD2_DATA0 0x5b
+ MX7D_PAD_SD2_DATA1__SD2_DATA1 0x5b
+ MX7D_PAD_SD2_DATA2__SD2_DATA2 0x5b
+ MX7D_PAD_SD2_DATA3__SD2_DATA3 0x5b
+ >;
+ };
+
pinctrl_usdhc3: usdhc3grp {
fsl,pins = <
MX7D_PAD_SD3_CMD__SD3_CMD 0x59
@@ -143,4 +225,13 @@ pinctrl_wdog: wdoggrp {
MX7D_PAD_ENET1_COL__WDOG1_WDOG_ANY 0x74
>;
};
+
+ pinctrl_wifi: wifigrp {
+ fsl,pins = <
+ /* WiFi Reg On */
+ MX7D_PAD_SD2_CD_B__GPIO5_IO9 0x00000014
+ /* WiFi Sleep 32k */
+ MX7D_PAD_SD1_WP__CCM_CLKO2 0x00000014
+ >;
+ };
};
--
2.31.1


2021-07-06 12:46:33

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH v3] ARM: dts: imx7d-remarkable2: Add WiFi support

Hi Alistair,

On Tue, Jul 6, 2021 at 8:40 AM Alistair Francis <[email protected]> wrote:

> + wifi_pwrseq: wifi_pwrseq {
> + compatible = "mmc-pwrseq-simple";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_wifi>;
> + reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
> + clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;

Don't you need to select the osc32 as the parent clock?

This is what we do on arch/arm/boot/dts/imx7d-pico.dtsi and
arch/arm/boot/dts/imx7d-nitrogen7.dts:

&clks {
assigned-clocks = <&clks IMX7D_CLKO2_ROOT_SRC>,
<&clks IMX7D_CLKO2_ROOT_DIV>;
assigned-clock-parents = <&clks IMX7D_CKIL>;
assigned-clock-rates = <0>, <32768>;
};

2021-07-08 09:20:11

by Alistair Francis

[permalink] [raw]
Subject: Re: [PATCH v3] ARM: dts: imx7d-remarkable2: Add WiFi support

On Tue, Jul 6, 2021 at 10:29 PM Fabio Estevam <[email protected]> wrote:
>
> Hi Alistair,
>
> On Tue, Jul 6, 2021 at 8:40 AM Alistair Francis <[email protected]> wrote:
>
> > + wifi_pwrseq: wifi_pwrseq {
> > + compatible = "mmc-pwrseq-simple";
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&pinctrl_wifi>;
> > + reset-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
> > + clocks = <&clks IMX7D_CLKO2_ROOT_DIV>;
>
> Don't you need to select the osc32 as the parent clock?
>
> This is what we do on arch/arm/boot/dts/imx7d-pico.dtsi and
> arch/arm/boot/dts/imx7d-nitrogen7.dts:
>
> &clks {
> assigned-clocks = <&clks IMX7D_CLKO2_ROOT_SRC>,
> <&clks IMX7D_CLKO2_ROOT_DIV>;
> assigned-clock-parents = <&clks IMX7D_CKIL>;
> assigned-clock-rates = <0>, <32768>;
> };

I'm not sure I follow, we do the same thing here with:

&clks {
assigned-clocks = <&clks IMX7D_CLKO2_ROOT_SRC>,
<&clks IMX7D_CLKO2_ROOT_DIV>;
assigned-clock-parents = <&clks IMX7D_CKIL>;
assigned-clock-rates = <0>, <32768>;
};

Alistair

2021-07-08 12:08:05

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH v3] ARM: dts: imx7d-remarkable2: Add WiFi support

Hi Alistair,

On Thu, Jul 8, 2021 at 6:16 AM Alistair Francis <[email protected]> wrote:

> I'm not sure I follow, we do the same thing here with:
>
> &clks {
> assigned-clocks = <&clks IMX7D_CLKO2_ROOT_SRC>,
> <&clks IMX7D_CLKO2_ROOT_DIV>;
> assigned-clock-parents = <&clks IMX7D_CKIL>;
> assigned-clock-rates = <0>, <32768>;
> };

Ah, got it. This was not in the patch context, so that's why I got confused.

Now I see it as part of the original file, so it looks good to me, thanks:

Reviewed-by: Fabio Estevam <[email protected]>

2021-07-23 02:49:05

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH v3] ARM: dts: imx7d-remarkable2: Add WiFi support

On Tue, Jul 06, 2021 at 09:40:28PM +1000, Alistair Francis wrote:
> Add support for the bcm4329-fmac WiFi in the reMarkable 2, connected via SDHC.
>
> Signed-off-by: Alistair Francis <[email protected]>

Applied, thanks!