Skip to contentSkip to conversation

NanoPC-T4 (and a bit of NanoPi M4) support

PATCH Superseded Robin Murphy 3 participants 17 messages Jan 8, 2019 – Jan 10, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover NanoPC-T4 (and a bit of NanoPi M4) support

Hi all,

Since I finally got to spend some quality time with my NanoPC-T4 over the holidays, I set to testing Tomeu's v4 patch, and ended up poring over the schematics of all 3 boards and doing a fair bit more hacking. I've taken the liberty of addressing the remaining review comments and posting it as v5 here so as to also start adding stuff on top. My current step is trying to get Wifi and Bluetooth working reliably...

Robin.

Robin Murphy (4):
arm64: dts: rockchip: Add DT for NanoPi M4
arm64: dts: rockchip: Refine nanopi4 differences
arm64: dts: rockchip: Add NanoPC-T4 IR receiver
arm64: dts: rockchip: Fix nanopi4 uSD card detect

Tomeu Vizoso (1):
arm64: dts: rockchip: Add DT for NanoPC-T4

 .../devicetree/bindings/arm/rockchip.yaml     |  10 +
 arch/arm64/boot/dts/rockchip/Makefile         |   2 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts    |  91 +++
 .../boot/dts/rockchip/rk3399-nanopi-m4.dts    |  66 ++
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi     | 677 ++++++++++++++++++
 5 files changed, 846 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
Signature · 1 line
2.17.1
#1 lore raw

PATCH v5 1/5 arm64: dts: rockchip: Add DT for NanoPC-T4

From: Tomeu Vizoso <[email protected]>

This adds a device tree for the NanoPC-T4 SBC, which is based on the Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

[rm: various further cleanup]

---

v5:
- Fix remaining unit address/node name errors (RobH)
- Rebase binding to DT-schema
- Prune redundant properties
- Rename a few things to correlate better with schematics
- Sort properties/nodes and tweak formatting
- Replace bogus volume up/down adc-keys with actual recovery key

 .../devicetree/bindings/arm/rockchip.yaml     |   5 +
 arch/arm64/boot/dts/rockchip/Makefile         |   1 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts    |  17 +
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi     | 725 ++++++++++++++++++
 4 files changed, 748 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
index b12958bda09c..bcc60c492a12 100644
@@ -87,6 +87,11 @@ properties:
           - const: firefly,roc-rk3399-pc
           - const: rockchip,rk3399
 
+      - description: FriendlyElec NanoPC-T4
+        items:
+          - const: friendlyarm,nanopc-t4
+          - const: rockchip,rk3399
+
       - description: GeekBuying GeekBox
         items:
           - const: geekbuying,geekbox
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index de0c406c20cc..1c7406111dfd 100644
@@ -16,6 +16,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-bob.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts new file +17 -0
new file mode 100644
index 000000000000..af0bb2544709
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPC-T4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPC-T4";
+	compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+};
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi new file +725 -0

725 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw

PATCH 2/5 arm64: dts: rockchip: Add DT for NanoPi M4

In reply to Robin Murphy

There are a number of subtle differences between the nanopi4 variants, and where they disagree, the common DTSI currently follows the details of NanoPi M4. In order to improve matters even more, let's add a separate DTS for the M4 to which we can start splitting things out appropriately. The third variant, NanoPi NEO4, is a lot closer to the M4 than either is to the larger T4, so arguably could get away with just sharing the M4 DT for now (plus I have neither of the smaller boards to actually test with).

---
 .../devicetree/bindings/arm/rockchip.yaml      |  5 +++++
 arch/arm64/boot/dts/rockchip/Makefile          |  1 +
 .../boot/dts/rockchip/rk3399-nanopi-m4.dts     | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
index bcc60c492a12..b4756e0cb7d0 100644
@@ -92,6 +92,11 @@ properties:
           - const: friendlyarm,nanopc-t4
           - const: rockchip,rk3399
 
+      - description: FriendlyElec NanoPi M4
+        items:
+          - const: friendlyarm,nanopi-m4
+          - const: rockchip,rk3399
+
       - description: GeekBuying GeekBox
         items:
           - const: geekbuying,geekbox
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 1c7406111dfd..91a669378605 100644
@@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts new file +18 -0
new file mode 100644
index 000000000000..8d3f0ba29c72
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPi M4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ * Copyright (c) 2019 Arm Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPi M4";
+	compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399";
+};
Signature · 1 line
2.17.1
#8 lore raw

PATCH 3/5 arm64: dts: rockchip: Refine nanopi4 differences

In reply to Robin Murphy

The nanopi4 boards differ primarily in their power trees, with the main 5V and 3.3V rails having very different topologies on the smaller USB-C powered boards vs. the 12V-powered T4, as well as minor variation in other regulators related to various external connectors.

Additionally, the recovery key is only present on the T4 - ADC_IN1 is simply pulled high and not exposed on the other boards - and the lowest common denominator for MMC speed is actually HS200 according to the vendor DTs.

---
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts    | 58 +++++++++++++++++++
 .../boot/dts/rockchip/rk3399-nanopi-m4.dts    | 48 +++++++++++++++
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi     | 55 +-----------------
 3 files changed, 107 insertions(+), 54 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +58 -0
index af0bb2544709..623a03f2548a 100644
@@ -14,4 +14,62 @@
 / {
 	model = "FriendlyElec NanoPC-T4";
 	compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+
+	vcc12v0_sys: vcc12v0-sys {
+		compatible = "regulator-fixed";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-max-microvolt = <12000000>;
+		regulator-min-microvolt = <12000000>;
+		regulator-name = "vcc12v0_sys";
+	};
+
+	vcc5v0_host0: vcc5v0-host0 {
+		compatible = "regulator-fixed";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-name = "vcc5v0_host0";
+		vin-supply = <&vcc5v0_sys>;
+	};
+
+	adc-keys {
+		compatible = "adc-keys";
+		io-channels = <&saradc 1>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <1800000>;
+		poll-interval = <100>;
+
+		recovery {
+			label = "Recovery";
+			linux,code = <KEY_VENDOR>;
+			press-threshold-microvolt = <18000>;
+		};
+	};
+};
+
+&sdhci {
+	mmc-hs400-1_8v;
+	mmc-hs400-enhanced-strobe;
+};
+
+&u2phy0_host {
+	phy-supply = <&vcc5v0_host0>;
+};
+
+&u2phy1_host {
+	phy-supply = <&vcc5v0_host0>;
+};
+
+&vcc5v0_sys {
+	vin-supply = <&vcc12v0_sys>;
+};
+
+&vcc3v3_sys {
+	vin-supply = <&vcc12v0_sys>;
+};
+
+&vbus_typec {
+	enable-active-high;
+	gpios = <&gpio4 RK_PD2 GPIO_ACTIVE_HIGH>;
+	vin-supply = <&vcc5v0_sys>;
 };
arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts +48 -0

52 lines not on this page · raw message

arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +1 -54

100 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH 4/5 arm64: dts: rockchip: Add NanoPC-T4 IR receiver

In reply to Robin Murphy

In common with most Rockchip reference designs, NanoPC-T4 has a passive IR receiver connected to PWM3. In lieu of a specialised driver for PWM-based IR pulse measurement, running the pin as a GPIO with the basic driver works perfectly well.

---
 .../arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts +16 -0
index 623a03f2548a..84433cf02be9 100644
@@ -45,6 +45,22 @@
 			press-threshold-microvolt = <18000>;
 		};
 	};
+
+	ir-receiver {
+		compatible = "gpio-ir-receiver";
+		gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&ir_rx>;
+	};
+};
+
+&pinctrl {
+	ir {
+		ir_rx: ir-rx {
+			/* external pullup to VCC3V3_SYS, despite being 1.8V :/ */
+			rockchip,pins = <0 RK_PA6 RK_FUNC_1 &pcfg_pull_none>;
+		};
+	};
 };
 
 &sdhci {
Signature · 1 line
2.17.1
#12 lore raw

PATCH 5/5 arm64: dts: rockchip: Fix nanopi4 uSD card detect

In reply to Robin Murphy

For whatever reason, the sdmmc_dectn function isn't working properly as-is, and microSD insertion and removal goes unnoticed. Flipping the pin into GPIO mode, however, does do the job, so let's just handle it that way for now until someone feels inclined to figure out what GRF voodoo or otherwise is needed for correct 'native' operation.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +6 -1
index 9c723038d8f8..2a183a6af150 100644
@@ -505,6 +505,10 @@
 		sdmmc0_pwr_h: sdmmc0-pwr-h {
 			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
+
+		sdmmc0_det_l: sdmmc0-det-l {
+			rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
 	};
 
 	sdio-pwrseq {
@@ -563,9 +567,10 @@
 	bus-width = <4>;
 	cap-sd-highspeed;
 	cap-mmc-highspeed;
+	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
 	disable-wp;
 	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc_bus4 &sdmmc_cd &sdmmc_clk &sdmmc_cmd>;
+	pinctrl-0 = <&sdmmc_bus4 &sdmmc0_det_l &sdmmc_clk &sdmmc_cmd>;
 	sd-uhs-sdr104;
 	vmmc-supply = <&vcc3v0_sd>;
 	vqmmc-supply = <&vcc_sdio>;
Signature · 1 line
2.17.1
maintainer
#6 lore raw

Re: [PATCH 2/5] arm64: dts: rockchip: Add DT for NanoPi M4

In reply to Robin Murphy

Hi Robin,

Am Dienstag, 8. Januar 2019, 22:57:24 CET schrieb Robin Murphy:

Quoted 10 lines

There are a number of subtle differences between the nanopi4 variants, and where they disagree, the common DTSI currently follows the details of NanoPi M4. In order to improve matters even more, let's add a separate DTS for the M4 to which we can start splitting things out appropriately. The third variant, NanoPi NEO4, is a lot closer to the M4 than either is to the larger T4, so arguably could get away with just sharing the M4 DT for now (plus I have neither of the smaller boards to actually test with).

I'm not sure if Rob actually checks the devicetree list or relies on patches Cc'ed directly to him for binding review, so you might want to add the 2 dt maintainers explicitly.

Quoted 12 lines
---
 .../devicetree/bindings/arm/rockchip.yaml      |  5 +++++
 arch/arm64/boot/dts/rockchip/Makefile          |  1 +
 .../boot/dts/rockchip/rk3399-nanopi-m4.dts     | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts
Documentation/devicetree/bindings/arm/rockchip.yaml +0 -0
index bcc60c492a12..b4756e0cb7d0 100644

Documentation/devicetree/bindings/arm/rockchip.yaml properties: · line 99

Quoted 8 lines
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
@@ -92,6 +92,11 @@ properties:
           - const: friendlyarm,nanopc-t4
           - const: rockchip,rk3399
 
+      - description: FriendlyElec NanoPi M4
+        items:
+          - const: friendlyarm,nanopi-m4
+          - const: rockchip,rk3399
+

When we hashed out the Rockchip yaml thingy, there also came up the possibility of grouping the similar boards together into an enum, see the rk3399-firefly or the rk3288-evb-* for example.

So the binding for both could possibly become:

- description: FriendlyElec NanoPi
items:
- enum:
- friendlyarm,nanopi-m4
- friendlyarm,nanopi-t4
- const: rockchip,rk3399

We didn't come up with a hard rule for all cases, but the Nano PI feels like it qualifies ;-)

Heiko

Quoted 40 lines
Documentation/devicetree/bindings/arm/rockchip.yaml +0 -0
       - description: GeekBuying GeekBox
         items:
           - const: geekbuying,geekbox
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 1c7406111dfd..91a669378605 100644
@@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-kevin.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-inx.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-gru-scarlet-kd.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-puma-haikou.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-roc-pc.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts new file +18 -0
new file mode 100644
index 000000000000..8d3f0ba29c72
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPi M4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ * Copyright (c) 2019 Arm Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPi M4";
+	compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399";
+};
#7 lore raw

Re: [PATCH 2/5] arm64: dts: rockchip: Add DT for NanoPi M4

Hi Heiko,

Quoted 12 lines · Heiko Stuebner

Hi Robin,

Am Dienstag, 8. Januar 2019, 22:57:24 CET schrieb Robin Murphy:

Quoted 9 lines

There are a number of subtle differences between the nanopi4 variants, and where they disagree, the common DTSI currently follows the details of NanoPi M4. In order to improve matters even more, let's add a separate DTS for the M4 to which we can start splitting things out appropriately. The third variant, NanoPi NEO4, is a lot closer to the M4 than either is to the larger T4, so arguably could get away with just sharing the M4 DT for now (plus I have neither of the smaller boards to actually test with).

Quoted 5 lines
Quoted 1 line

I'm not sure if Rob actually checks the devicetree list or relies on patches Cc'ed directly to him for binding review, so you might want to add the 2 dt maintainers explicitly.

Er, that's embarassing... I somehow failed to register that my mindless copy-paste job ends up adding a new binding that *isn't* the one Rob already reviewed :(

Quoted 34 lines
Quoted 12 lines
---
  .../devicetree/bindings/arm/rockchip.yaml      |  5 +++++
  arch/arm64/boot/dts/rockchip/Makefile          |  1 +
  .../boot/dts/rockchip/rk3399-nanopi-m4.dts     | 18 ++++++++++++++++++
  3 files changed, 24 insertions(+)

create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dts

Documentation/devicetree/bindings/arm/rockchip.yaml +0 -0
index bcc60c492a12..b4756e0cb7d0 100644

Documentation/devicetree/bindings/arm/rockchip.yaml properties: · line 99

Quoted 8 lines
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
@@ -92,6 +92,11 @@ properties:
            - const: friendlyarm,nanopc-t4
            - const: rockchip,rk3399
 
+      - description: FriendlyElec NanoPi M4
+        items:
+          - const: friendlyarm,nanopi-m4
+          - const: rockchip,rk3399
+

When we hashed out the Rockchip yaml thingy, there also came up the possibility of grouping the similar boards together into an enum, see the rk3399-firefly or the rk3288-evb-* for example.

So the binding for both could possibly become:

- description: FriendlyElec NanoPi
items:
- enum:
- friendlyarm,nanopi-m4
- friendlyarm,nanopi-t4
- const: rockchip,rk3399

Quoted 2 lines

We didn't come up with a hard rule for all cases, but the Nano PI feels like it qualifies ;-)

...but I completely agree with that idea anyway - as the commit log alludes to, this was really just somewhere to move the existing nodes to without much thought involved. I'll give it a day or two for any more comments, then respin at least this patch and make sure the binding update goes to the maintainers properly.

Cheers,
Robin.

maintainer
#13 lore raw

Re: [PATCH 5/5] arm64: dts: rockchip: Fix nanopi4 uSD card detect

In reply to Robin Murphy

Am Dienstag, 8. Januar 2019, 22:57:27 CET schrieb Robin Murphy:

Quoted 16 lines

For whatever reason, the sdmmc_dectn function isn't working properly as-is, and microSD insertion and removal goes unnoticed. Flipping the pin into GPIO mode, however, does do the job, so let's just handle it that way for now until someone feels inclined to figure out what GRF voodoo or otherwise is needed for correct 'native' operation.

---
 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +0 -0
index 9c723038d8f8..2a183a6af150 100644

arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi line 509

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +2 -0
@@ -505,6 +505,10 @@
 		sdmmc0_pwr_h: sdmmc0-pwr-h {
 			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
+
+		sdmmc0_det_l: sdmmc0-det-l {

alphabetically by node-name please,
aka sdmmc0-det-* should be above sdmmc0-pwr-*

If you're respinning the whole series this should be fixed, otherwise I can also do that when applying.

Heiko

Quoted 18 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +4 -1
+			rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
 	};
 
 	sdio-pwrseq {
@@ -563,9 +567,10 @@
 	bus-width = <4>;
 	cap-sd-highspeed;
 	cap-mmc-highspeed;
+	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
 	disable-wp;
 	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc_bus4 &sdmmc_cd &sdmmc_clk &sdmmc_cmd>;
+	pinctrl-0 = <&sdmmc_bus4 &sdmmc0_det_l &sdmmc_clk &sdmmc_cmd>;
 	sd-uhs-sdr104;
 	vmmc-supply = <&vcc3v0_sd>;
 	vqmmc-supply = <&vcc_sdio>;
#14 lore raw

Re: [PATCH 5/5] arm64: dts: rockchip: Fix nanopi4 uSD card detect

Quoted 12 lines · Heiko Stuebner

Am Dienstag, 8. Januar 2019, 22:57:27 CET schrieb Robin Murphy:

Quoted 11 lines

For whatever reason, the sdmmc_dectn function isn't working properly as-is, and microSD insertion and removal goes unnoticed. Flipping the pin into GPIO mode, however, does do the job, so let's just handle it that way for now until someone feels inclined to figure out what GRF voodoo or otherwise is needed for correct 'native' operation.

---
  arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 13 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi line 509

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +2 -0
index 9c723038d8f8..2a183a6af150 100644
@@ -505,6 +505,10 @@
  		sdmmc0_pwr_h: sdmmc0-pwr-h {
  			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
  		};
+
+		sdmmc0_det_l: sdmmc0-det-l {

alphabetically by node-name please,
aka sdmmc0-det-* should be above sdmmc0-pwr-*

Right you are, not sure how that one slipped through.

Quoted 2 lines

If you're respinning the whole series this should be fixed, otherwise I can also do that when applying.

I've fixed it up locally, although it might be worth holding off on this particular patch for the moment now that I've taken another look through the TRM and noticed those smoking-gun-looking bits in GRF_SIG_DETECT_CON{0,1} - I'll investigate...

[ side note - do you reckon there'd be any value in bolting a debugfs interface onto the GRF driver, or is the realistic answer to just use /dev/mem like everyone else and stop having silly ideas? ]

Thanks,
Robin.

Quoted 26 lines

Heiko

Quoted 18 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +4 -1
+			rockchip,pins = <0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
  	};
 
  	sdio-pwrseq {
@@ -563,9 +567,10 @@
  	bus-width = <4>;
  	cap-sd-highspeed;
  	cap-mmc-highspeed;
+	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
  	disable-wp;
  	pinctrl-names = "default";
-	pinctrl-0 = <&sdmmc_bus4 &sdmmc_cd &sdmmc_clk &sdmmc_cmd>;
+	pinctrl-0 = <&sdmmc_bus4 &sdmmc0_det_l &sdmmc_clk &sdmmc_cmd>;
  	sd-uhs-sdr104;
  	vmmc-supply = <&vcc3v0_sd>;
  	vqmmc-supply = <&vcc_sdio>;
maintainer
#15 lore raw

Re: [PATCH 5/5] arm64: dts: rockchip: Fix nanopi4 uSD card detect

Am Mittwoch, 9. Januar 2019, 00:22:01 CET schrieb Robin Murphy:

Quoted 29 lines · Heiko Stuebner
Quoted 12 lines

Am Dienstag, 8. Januar 2019, 22:57:27 CET schrieb Robin Murphy:

Quoted 11 lines

For whatever reason, the sdmmc_dectn function isn't working properly as-is, and microSD insertion and removal goes unnoticed. Flipping the pin into GPIO mode, however, does do the job, so let's just handle it that way for now until someone feels inclined to figure out what GRF voodoo or otherwise is needed for correct 'native' operation.

---
  arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 13 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi line 509

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +2 -0
index 9c723038d8f8..2a183a6af150 100644
@@ -505,6 +505,10 @@
  		sdmmc0_pwr_h: sdmmc0-pwr-h {
  			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
  		};
+
+		sdmmc0_det_l: sdmmc0-det-l {

alphabetically by node-name please,
aka sdmmc0-det-* should be above sdmmc0-pwr-*

Right you are, not sure how that one slipped through.

Quoted 7 lines
Quoted 2 lines

If you're respinning the whole series this should be fixed, otherwise I can also do that when applying.

I've fixed it up locally, although it might be worth holding off on this particular patch for the moment now that I've taken another look through the TRM and noticed those smoking-gun-looking bits in GRF_SIG_DETECT_CON{0,1} - I'll investigate...

Personally I'm very much fine with using a cd-gpio instead of trying to bring order to the GRF "chaos" ;-) as I'm also not really sure if we gain anything with the IP-internal detect mechanism.

But then do as you like :-D

Quoted 3 lines

[ side note - do you reckon there'd be any value in bolting a debugfs interface onto the GRF driver, or is the realistic answer to just use /dev/mem like everyone else and stop having silly ideas? ]

I don't think it would help much ... especially when it really only outputs the register contents in the same way as mem or so does.

Having to fiddle with GRF bits really should only happen in rare cases, so I guess mem should do the trick for that.

And the GRF driver also was a bit controversial anyway, with the title of "dumping ground" looming over it ... so I'd like to keep it small and simple ;-) .

Heiko

maintainer
#2 lore raw

Re: [PATCH v5 1/5] arm64: dts: rockchip: Add DT for NanoPC-T4

In reply to Robin Murphy

Am Dienstag, 8. Januar 2019, 22:57:23 CET schrieb Robin Murphy:

Quoted 12 lines

From: Tomeu Vizoso <[email protected]>

This adds a device tree for the NanoPC-T4 SBC, which is based on the Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

Quoted 7 lines

All of the interesting stuff is in a .dtsi because there are at least two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

[rm: various further cleanup]

nobody complained, the binding was reviewed and all looks good so I've gone forward and applied this one for 5.1 already.

Thanks
Heiko

#3 lore raw

Re: [PATCH v5 1/5] arm64: dts: rockchip: Add DT for NanoPC-T4

Quoted 16 lines · Heiko Stuebner

Am Dienstag, 8. Januar 2019, 22:57:23 CET schrieb Robin Murphy:

Quoted 15 lines

From: Tomeu Vizoso <[email protected]>

This adds a device tree for the NanoPC-T4 SBC, which is based on the Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

Quoted 7 lines
Quoted 4 lines
[rm: various further cleanup]

nobody complained, the binding was reviewed and all looks good so I've gone forward and applied this one for 5.1 already.

Awesome, thanks!

I'll probably follow up with a v2 of the rest of the patches next week, after I've had the chance to play some more over the weekend.

Cheers,
Robin.

maintainer
#9 lore raw

Re: [PATCH 3/5] arm64: dts: rockchip: Refine nanopi4 differences

In reply to Robin Murphy

Am Dienstag, 8. Januar 2019, 22:57:25 CET schrieb Robin Murphy:

Quoted 11 lines

The nanopi4 boards differ primarily in their power trees, with the main 5V and 3.3V rails having very different topologies on the smaller USB-C powered boards vs. the 12V-powered T4, as well as minor variation in other regulators related to various external connectors.

Additionally, the recovery key is only present on the T4 - ADC_IN1 is simply pulled high and not exposed on the other boards - and the lowest common denominator for MMC speed is actually HS200 according to the vendor DTs.

this looks good to me, so only need patch2 to adapt and get reviewed.

Heiko

maintainer
#11 lore raw

Re: [PATCH 4/5] arm64: dts: rockchip: Add NanoPC-T4 IR receiver

In reply to Robin Murphy

Am Dienstag, 8. Januar 2019, 22:57:26 CET schrieb Robin Murphy:

Quoted 6 lines

In common with most Rockchip reference designs, NanoPC-T4 has a passive IR receiver connected to PWM3. In lieu of a specialised driver for PWM-based IR pulse measurement, running the pin as a GPIO with the basic driver works perfectly well.

easy change and of course looks good.
As it doesn't apply due to coming after other changes, I'll have to wait for v2 though.

Heiko

#16 lore raw

Re: [PATCH 5/5] arm64: dts: rockchip: Fix nanopi4 uSD card detect

In reply to Heiko Stuebner
Quoted 38 lines · Heiko Stuebner

Am Mittwoch, 9. Januar 2019, 00:22:01 CET schrieb Robin Murphy:

Quoted 29 lines · Heiko Stuebner
Quoted 12 lines

Am Dienstag, 8. Januar 2019, 22:57:27 CET schrieb Robin Murphy:

Quoted 11 lines

For whatever reason, the sdmmc_dectn function isn't working properly as-is, and microSD insertion and removal goes unnoticed. Flipping the pin into GPIO mode, however, does do the job, so let's just handle it that way for now until someone feels inclined to figure out what GRF voodoo or otherwise is needed for correct 'native' operation.

---
   arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 7 ++++++-
   1 file changed, 6 insertions(+), 1 deletion(-)
Quoted 13 lines

arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi line 509

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi +2 -0
index 9c723038d8f8..2a183a6af150 100644
@@ -505,6 +505,10 @@
   		sdmmc0_pwr_h: sdmmc0-pwr-h {
   			rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_none>;
   		};
+
+		sdmmc0_det_l: sdmmc0-det-l {

alphabetically by node-name please,
aka sdmmc0-det-* should be above sdmmc0-pwr-*

Right you are, not sure how that one slipped through.

Quoted 7 lines
Quoted 2 lines

If you're respinning the whole series this should be fixed, otherwise I can also do that when applying.

I've fixed it up locally, although it might be worth holding off on this particular patch for the moment now that I've taken another look through the TRM and noticed those smoking-gun-looking bits in GRF_SIG_DETECT_CON{0,1} - I'll investigate...

Quoted 5 lines

Personally I'm very much fine with using a cd-gpio instead of trying to bring order to the GRF "chaos" ;-) as I'm also not really sure if we gain anything with the IP-internal detect mechanism.

But then do as you like :-D

I'm assuming from the wiring (and from how I recall my 3288/3328 boxes behaving) that the dedicated function implements its own debouncing - seems the switch in this particular socket is noisy enough that the GPIO interrupt is firing well over 100 times per physical event. Not a big deal really, I just need to scratch the itch of making things work 'properly' ;)

Quoted 7 lines
Quoted 3 lines

[ side note - do you reckon there'd be any value in bolting a debugfs interface onto the GRF driver, or is the realistic answer to just use /dev/mem like everyone else and stop having silly ideas? ]

I don't think it would help much ... especially when it really only outputs the register contents in the same way as mem or so does.

Quoted 6 lines

Having to fiddle with GRF bits really should only happen in rare cases, so I guess mem should do the trick for that.

And the GRF driver also was a bit controversial anyway, with the title of "dumping ground" looming over it ... so I'd like to keep it small and simple ;-) .

Yeah, it would end up being one of those things that's really handy for about 5 minutes every couple of years, and a massive pain to maintain the rest of the time. Plus I realise that I'd want to compare the behaviour of stock kernels anyway, and having to patch and rebuild those rather defeats the point.

Thanks,
Robin.

Tested-by
#4 lore raw

Re: [PATCH v5 1/5] arm64: dts: rockchip: Add DT for NanoPC-T4

In reply to Robin Murphy
Quoted 22 lines · Robin Murphy
Quoted 21 lines · Heiko Stuebner

Am Dienstag, 8. Januar 2019, 22:57:23 CET schrieb Robin Murphy:

Quoted 19 lines

From: Tomeu Vizoso <[email protected]>

This adds a device tree for the NanoPC-T4 SBC, which is based on the Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

[rm: various further cleanup]
Quoted 6 lines
Quoted 2 lines

nobody complained, the binding was reviewed and all looks good so I've gone forward and applied this one for 5.1 already.

Awesome, thanks!

I'll probably follow up with a v2 of the rest of the patches next week, after I've had the chance to play some more over the weekend.

Thanks a lot for picking this up!

Have given the whole series a try and haven't found any issues. I have booted with nfsroot and have only run a few OpenGL apps with panfrost, using ARM's GPU driver.

In case there's time for it:

Cheers,

Tomeu