diff mbox series

[v3] ARM: dts: imx7d-remarkable2: Add WiFi support

Message ID 20210706114028.132-1-alistair@alistair23.me (mailing list archive)
State New, archived
Headers show
Series [v3] ARM: dts: imx7d-remarkable2: Add WiFi support | expand

Commit Message

Alistair Francis July 6, 2021, 11:40 a.m. UTC
Add support for the bcm4329-fmac WiFi in the reMarkable 2, connected via SDHC.

Signed-off-by: Alistair Francis <alistair@alistair23.me>
---
V3:
 - Remove the duplicate pinctrl-2

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

Comments

Fabio Estevam July 6, 2021, 12:29 p.m. UTC | #1
Hi Alistair,

On Tue, Jul 6, 2021 at 8:40 AM Alistair Francis <alistair@alistair23.me> 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>;
};
Alistair Francis July 8, 2021, 9:16 a.m. UTC | #2
On Tue, Jul 6, 2021 at 10:29 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Alistair,
>
> On Tue, Jul 6, 2021 at 8:40 AM Alistair Francis <alistair@alistair23.me> 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
Fabio Estevam July 8, 2021, 12:05 p.m. UTC | #3
Hi Alistair,

On Thu, Jul 8, 2021 at 6:16 AM Alistair Francis <alistair23@gmail.com> 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 <festevam@gmail.com>
Shawn Guo July 23, 2021, 2:46 a.m. UTC | #4
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 <alistair@alistair23.me>

Applied, thanks!
diff mbox series

Patch

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
+		>;
+	};
 };