Skip to contentSkip to conversation

rockchip: rk3328: sync dts and add ROC-RK3328-CC board

PATCH Superseded Chen-Yu Tsai 3 participants 12 messages Apr 5, 2020 – Apr 24, 2020 1 message not in the archive

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC-RK3328-CC single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi
dt-bindings: clock: rk3328: sync from upstream Linux kernel
dt-bindings: power: rk3328-power: sync from upstream Linux kernel
rockchip: dts: rk3328: Sync device tree files from Linux
rockchip: rk3328: Add support for ROC-RK3328-CC board

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/rk3328-evb-u-boot.dtsi           |   39 +
 arch/arm/dts/rk3328-evb.dts                   |  220 +--
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        |   38 +
 .../{rk3328-rock64.dts => rk3328-roc-cc.dts}  |  135 +-
 arch/arm/dts/rk3328-rock64.dts                |  132 +-
 arch/arm/dts/rk3328.dtsi                      | 1420 +++++++++++------
 board/rockchip/evb_rk3328/MAINTAINERS         |    7 +
 configs/roc-cc-rk3328_defconfig               |  103 ++
 doc/README.rockchip                           |    4 +-
 include/dt-bindings/clock/rk3328-cru.h        |  212 +--
 include/dt-bindings/power/rk3328-power.h      |   19 +
 12 files changed, 1578 insertions(+), 752 deletions(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%)
 create mode 100644 configs/roc-cc-rk3328_defconfig
 create mode 100644 include/dt-bindings/power/rk3328-power.h
Signature · 1 line
2.26.0
#1 lore raw

PATCH v2 1/6 rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi

From: Chen-Yu Tsai <[email protected]>

USB 3.0 is only supported in U-boot, not in the Linux kernel where the device tree files are ultimately synced from. While the xhci node was moved, the external vbus regulator was not.

Move it as well.

Fixes 2e91e2025c1b ("rockchip: rk3328: migrate u-boot node to -u-boot.dtsi")

---
Changes since v1:
- Added Kever's reviewed-by

---
 arch/arm/dts/rk3328-evb-u-boot.dtsi | 11 +++++++++++
 arch/arm/dts/rk3328-evb.dts         |  9 ---------
 2 files changed, 11 insertions(+), 9 deletions(-)
arch/arm/dts/rk3328-evb-u-boot.dtsi +11 -0
index 4a827063c555..5679897279aa 100644
@@ -6,6 +6,17 @@
 #include "rk3328-u-boot.dtsi"
 #include "rk3328-sdram-ddr3-666.dtsi"
 
+/{
+	vcc5v0_host_xhci: vcc5v0-host-xhci-drv {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>;
+		regulator-name = "vcc5v0_host_xhci";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+	};
+};
+
 &usb_host0_xhci {
 	vbus-supply = <&vcc5v0_host_xhci>;
 	status = "okay";
arch/arm/dts/rk3328-evb.dts +0 -9
index a2ee838fcd6b..e9bc849f8c23 100644
@@ -38,15 +38,6 @@
 		regulator-max-microvolt = <5000000>;
 	};
 
-	vcc5v0_host_xhci: vcc5v0-host-xhci-drv {
-		compatible = "regulator-fixed";
-		enable-active-high;
-		regulator-name = "vcc5v0_host_xhci";
-		gpio = <&gpio0 0 GPIO_ACTIVE_HIGH>;
-		regulator-min-microvolt = <5000000>;
-		regulator-max-microvolt = <5000000>;
-	};
-
 	vcc_phy: vcc-phy-regulator {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc_phy";
Signature · 1 line
2.26.0
#2 lore raw

PATCH v2 2/6 rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The device tree file for rk3328-evb in the Linux kernel does not have gmac2io enabled. Instead, gmac2phy is enabled, but that is not supported in U-boot.

Move the gmac2io related nodes to rk3328-evb-u-boot.dtsi to preserve the current functionality. When the device tree files are synced, gmac2phy should be marked as "broken" in -u-boot.dtsi files.

---
Changes since v1:
- Added Kever's reviewed-by

---
 arch/arm/dts/rk3328-evb-u-boot.dtsi | 23 +++++++++++++++++++++++
 arch/arm/dts/rk3328-evb.dts         | 23 -----------------------
 2 files changed, 23 insertions(+), 23 deletions(-)
arch/arm/dts/rk3328-evb-u-boot.dtsi +23 -0
index 5679897279aa..8ba53cf8f44b 100644
@@ -7,6 +7,13 @@
 #include "rk3328-sdram-ddr3-666.dtsi"
 
 /{
+	gmac_clkin: external-gmac-clock {
+		compatible = "fixed-clock";
+		clock-frequency = <125000000>;
+		clock-output-names = "gmac_clkin";
+		#clock-cells = <0>;
+	};
+
 	vcc5v0_host_xhci: vcc5v0-host-xhci-drv {
 		compatible = "regulator-fixed";
 		enable-active-high;
@@ -17,6 +24,22 @@
 	};
 };
 
+&gmac2io {
+	phy-supply = <&vcc_phy>;
+	phy-mode = "rgmii";
+	clock_in_out = "input";
+	snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
+	snps,reset-active-low;
+	snps,reset-delays-us = <0 10000 50000>;
+	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
+	assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&rgmiim1_pins>;
+	tx_delay = <0x26>;
+	rx_delay = <0x11>;
+	status = "okay";
+};
+
 &usb_host0_xhci {
 	vbus-supply = <&vcc5v0_host_xhci>;
 	status = "okay";
arch/arm/dts/rk3328-evb.dts +0 -23
index e9bc849f8c23..97bef37cf610 100644
@@ -14,13 +14,6 @@
 		stdout-path = &uart2;
 	};
 
-	gmac_clkin: external-gmac-clock {
-		compatible = "fixed-clock";
-		clock-frequency = <125000000>;
-		clock-output-names = "gmac_clkin";
-		#clock-cells = <0>;
-	};
-
 	vcc3v3_sdmmc: sdmmc-pwren {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc3v3";
@@ -78,22 +71,6 @@
 	status = "okay";
 };
 
-&gmac2io {
-	phy-supply = <&vcc_phy>;
-	phy-mode = "rgmii";
-	clock_in_out = "input";
-	snps,reset-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_LOW>;
-	snps,reset-active-low;
-	snps,reset-delays-us = <0 10000 50000>;
-	assigned-clocks = <&cru SCLK_MAC2IO>, <&cru SCLK_MAC2IO_EXT>;
-	assigned-clock-parents = <&gmac_clkin>, <&gmac_clkin>;
-	pinctrl-names = "default";
-	pinctrl-0 = <&rgmiim1_pins>;
-	tx_delay = <0x26>;
-	rx_delay = <0x11>;
-	status = "okay";
-};
-
 &usb_host0_ehci {
 	status = "okay";
 };
Signature · 1 line
2.26.0
#3 lore raw

PATCH v2 3/6 dt-bindings: clock: rk3328: sync from upstream Linux kernel

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

This syncs the rk3328 clock header file from Linux kernel next-20200324, to support newer hardware blocks when syncing the device tree files.

The last non-merge commit to touch it was

0dc14b013f79 ("clk: rockchip: add clock id for watchdog pclk on rk3328")

---
Changes since v1:
- Added Kever's reviewed-by

---
 include/dt-bindings/clock/rk3328-cru.h | 212 ++++++++++++-------------
 1 file changed, 106 insertions(+), 106 deletions(-)
include/dt-bindings/clock/rk3328-cru.h +106 -106
index cde61ed8830b..555b4ff660ae 100644
@@ -1,6 +1,7 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
+ * Author: Elaine <[email protected]>
  */
 
 #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3328_H
@@ -90,119 +91,118 @@
 #define SCLK_MAC2IO_EXT		102
 
 /* dclk gates */
-#define DCLK_LCDC		180
-#define DCLK_HDMIPHY		181
-#define HDMIPHY			182
-#define USB480M			183
-#define DCLK_LCDC_SRC		184
+#define DCLK_LCDC		120
+#define DCLK_HDMIPHY		121
+#define HDMIPHY			122
+#define USB480M			123
+#define DCLK_LCDC_SRC		124
 
 /* aclk gates */
-#define ACLK_AXISRAM		190
-#define ACLK_VOP_PRE		191
-#define ACLK_USB3OTG		192
-#define ACLK_RGA_PRE		193
-#define ACLK_DMAC		194
-#define ACLK_GPU		195
-#define ACLK_BUS_PRE		196
-#define ACLK_PERI_PRE		197
-#define ACLK_RKVDEC_PRE		198
-#define ACLK_RKVDEC		199
-#define ACLK_RKVENC		200
-#define ACLK_VPU_PRE		201
-#define ACLK_VIO_PRE		202
-#define ACLK_VPU		203
-#define ACLK_VIO		204
-#define ACLK_VOP		205
-#define ACLK_GMAC		206
-#define ACLK_H265		207
-#define ACLK_H264		208
-#define ACLK_MAC2PHY		209
-#define ACLK_MAC2IO		210
-#define ACLK_DCF		211
-#define ACLK_TSP		212
-#define ACLK_PERI		213
-#define ACLK_RGA		214
-#define ACLK_IEP		215
-#define ACLK_CIF		216
-#define ACLK_HDCP		217
+#define ACLK_AXISRAM		130
+#define ACLK_VOP_PRE		131
+#define ACLK_USB3OTG		132
+#define ACLK_RGA_PRE		133
+#define ACLK_DMAC		134
+#define ACLK_GPU		135
+#define ACLK_BUS_PRE		136
+#define ACLK_PERI_PRE		137
+#define ACLK_RKVDEC_PRE		138
+#define ACLK_RKVDEC		139
+#define ACLK_RKVENC		140
+#define ACLK_VPU_PRE		141
+#define ACLK_VIO_PRE		142
+#define ACLK_VPU		143
+#define ACLK_VIO		144
+#define ACLK_VOP		145
+#define ACLK_GMAC		146
+#define ACLK_H265		147
+#define ACLK_H264		148
+#define ACLK_MAC2PHY		149
+#define ACLK_MAC2IO		150
+#define ACLK_DCF		151
+#define ACLK_TSP		152
+#define ACLK_PERI		153
+#define ACLK_RGA		154
+#define ACLK_IEP		155
+#define ACLK_CIF		156
+#define ACLK_HDCP		157
 
 /* pclk gates */
-#define PCLK_GPIO0		300
-#define PCLK_GPIO1		301
-#define PCLK_GPIO2		302
-#define PCLK_GPIO3		303
-#define PCLK_GRF		304
-#define PCLK_I2C0		305
-#define PCLK_I2C1		306
-#define PCLK_I2C2		307
-#define PCLK_I2C3		308
-#define PCLK_SPI		309
-#define PCLK_UART0		310
-#define PCLK_UART1		311
-#define PCLK_UART2		312
-#define PCLK_TSADC		313
-#define PCLK_PWM		314
-#define PCLK_TIMER		315
-#define PCLK_BUS_PRE		316
-#define PCLK_PERI_PRE		317
-#define PCLK_HDMI_CTRL		318
-#define PCLK_HDMI_PHY		319
-#define PCLK_GMAC		320
-#define PCLK_H265		321
-#define PCLK_MAC2PHY		322
-#define PCLK_MAC2IO		323
-#define PCLK_USB3PHY_OTG	324
-#define PCLK_USB3PHY_PIPE	325
-#define PCLK_USB3_GRF		326
-#define PCLK_USB2_GRF		327
-#define PCLK_HDMIPHY		328
-#define PCLK_DDR		329
-#define PCLK_PERI		330
-#define PCLK_HDMI		331
-#define PCLK_HDCP		332
-#define PCLK_DCF		333
-#define PCLK_SARADC		334
+#define PCLK_GPIO0		200
+#define PCLK_GPIO1		201
+#define PCLK_GPIO2		202
+#define PCLK_GPIO3		203
+#define PCLK_GRF		204
+#define PCLK_I2C0		205
+#define PCLK_I2C1		206
+#define PCLK_I2C2		207
+#define PCLK_I2C3		208
+#define PCLK_SPI		209
+#define PCLK_UART0		210
+#define PCLK_UART1		211
+#define PCLK_UART2		212
+#define PCLK_TSADC		213
+#define PCLK_PWM		214
+#define PCLK_TIMER		215
+#define PCLK_BUS_PRE		216
+#define PCLK_PERI_PRE		217
+#define PCLK_HDMI_CTRL		218
+#define PCLK_HDMI_PHY		219
+#define PCLK_GMAC		220
+#define PCLK_H265		221
+#define PCLK_MAC2PHY		222
+#define PCLK_MAC2IO		223
+#define PCLK_USB3PHY_OTG	224
+#define PCLK_USB3PHY_PIPE	225
+#define PCLK_USB3_GRF		226
+#define PCLK_USB2_GRF		227
+#define PCLK_HDMIPHY		228
+#define PCLK_DDR		229
+#define PCLK_PERI		230
+#define PCLK_HDMI		231
+#define PCLK_HDCP		232
+#define PCLK_DCF		233
+#define PCLK_SARADC		234
+#define PCLK_ACODECPHY		235
+#define PCLK_WDT		236
 
 /* hclk gates */
-#define HCLK_PERI		408
-#define HCLK_TSP		409
-#define HCLK_GMAC		410
-#define HCLK_I2S0_8CH		411
-#define HCLK_I2S1_8CH		413
-#define HCLK_I2S2_2CH		413
-#define HCLK_SPDIF_8CH		414
-#define HCLK_VOP		415
-#define HCLK_NANDC		416
-#define HCLK_SDMMC		417
-#define HCLK_SDIO		418
-#define HCLK_EMMC		419
-#define HCLK_SDMMC_EXT		420
-#define HCLK_RKVDEC_PRE		421
-#define HCLK_RKVDEC		422
-#define HCLK_RKVENC		423
-#define HCLK_VPU_PRE		424
-#define HCLK_VIO_PRE		425
-#define HCLK_VPU		426
-#define HCLK_VIO		427
-#define HCLK_BUS_PRE		428
-#define HCLK_PERI_PRE		429
-#define HCLK_H264		430
-#define HCLK_CIF		431
-#define HCLK_OTG_PMU		432
-#define HCLK_OTG		433
-#define HCLK_HOST0		434
-#define HCLK_HOST0_ARB		435
-#define HCLK_CRYPTO_MST		436
-#define HCLK_CRYPTO_SLV		437
-#define HCLK_PDM		438
-#define HCLK_IEP		439
-#define HCLK_RGA		440
-#define HCLK_HDCP		441
+#define HCLK_PERI		308
+#define HCLK_TSP		309
+#define HCLK_GMAC		310
+#define HCLK_I2S0_8CH		311
+#define HCLK_I2S1_8CH		312
+#define HCLK_I2S2_2CH		313
+#define HCLK_SPDIF_8CH		314
+#define HCLK_VOP		315
+#define HCLK_NANDC		316
+#define HCLK_SDMMC		317
+#define HCLK_SDIO		318
+#define HCLK_EMMC		319
+#define HCLK_SDMMC_EXT		320
+#define HCLK_RKVDEC_PRE		321
+#define HCLK_RKVDEC		322
+#define HCLK_RKVENC		323
+#define HCLK_VPU_PRE		324
+#define HCLK_VIO_PRE		325
+#define HCLK_VPU		326
+#define HCLK_BUS_PRE		328
+#define HCLK_PERI_PRE		329
+#define HCLK_H264		330
+#define HCLK_CIF		331
+#define HCLK_OTG_PMU		332
+#define HCLK_OTG		333
+#define HCLK_HOST0		334
+#define HCLK_HOST0_ARB		335
+#define HCLK_CRYPTO_MST		336
+#define HCLK_CRYPTO_SLV		337
+#define HCLK_PDM		338
+#define HCLK_IEP		339
+#define HCLK_RGA		340
+#define HCLK_HDCP		341
 
 #define CLK_NR_CLKS		(HCLK_HDCP + 1)
 
-#define CLKGRF_NR_CLKS		(SCLK_MAC2PHY + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0_PO		0
 #define SRST_CORE1_PO		1
Signature · 1 line
2.26.0
#4 lore raw

PATCH v2 4/6 dt-bindings: power: rk3328-power: sync from upstream Linux kernel

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

This syncs the rk3328 power domain header file from Linux kernel next-20200324, to support newer hardware blocks when syncing the device tree files.

The last non-merge commit to touch it was

b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier to files with no license")

---
Changes since v1:
- Added Kever's reviewed-by

---
 include/dt-bindings/power/rk3328-power.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 include/dt-bindings/power/rk3328-power.h
include/dt-bindings/power/rk3328-power.h new file +19 -0
new file mode 100644
index 000000000000..02e3d7fc1cce
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __DT_BINDINGS_POWER_RK3328_POWER_H__
+#define __DT_BINDINGS_POWER_RK3328_POWER_H__
+
+/**
+ * RK3328 idle id Summary.
+ */
+#define RK3328_PD_CORE		0
+#define RK3328_PD_GPU		1
+#define RK3328_PD_BUS		2
+#define RK3328_PD_MSCH		3
+#define RK3328_PD_PERI		4
+#define RK3328_PD_VIDEO		5
+#define RK3328_PD_HEVC		6
+#define RK3328_PD_SYS		7
+#define RK3328_PD_VPU		8
+#define RK3328_PD_VIO		9
+
+#endif
Signature · 1 line
2.26.0
#5 lore raw

PATCH v2 5/6 rockchip: dts: rk3328: Sync device tree files from Linux

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

This syncs rk3328 device tree files from the Linux kernel next-20200324. The last commit to touch these files is:

b2411befed60 ("arm64: dts: add bus to rockchip amba nodenames")

Additional changes not yet in the Linux kernel include:

arm64: dts: rockchip: rk3328: drop #address-cells, #size-cells from grf node
arm64: dts: rockchip: rk3328: drop non-existent gmac2phy pinmux options
arm64: dts: rockchip: rk3328: Replace RK805 PMIC node name with "pmic"

Changes include:

- conversion of raw pin numbers to macros
- removal of deprecated RK_FUNC_* macros
- update of device tree binding headers
- new devices
- device tree cleanups
- gmac2phy disabled in -u-boot.dtsi as it is not supported in U-boot

---
Changes since v1:
- Added Kever's reviewed-by

---
 arch/arm/dts/rk3328-evb-u-boot.dtsi |    5 +
 arch/arm/dts/rk3328-evb.dts         |  196 ++--
 arch/arm/dts/rk3328-rock64.dts      |  132 ++-
 arch/arm/dts/rk3328.dtsi            | 1420 +++++++++++++++++----------
 4 files changed, 1164 insertions(+), 589 deletions(-)
arch/arm/dts/rk3328-evb-u-boot.dtsi +5 -0
index 8ba53cf8f44b..4bfa0c2330ba 100644
@@ -40,6 +40,11 @@
 	status = "okay";
 };
 
+&gmac2phy {
+	/* Integrated PHY unsupported by U-boot */
+	status = "broken";
+};
+
 &usb_host0_xhci {
 	vbus-supply = <&vcc5v0_host_xhci>;
 	status = "okay";
arch/arm/dts/rk3328-evb.dts +132 -64

310 lines not on this page · raw message

arch/arm/dts/rk3328-rock64.dts +129 -3

202 lines not on this page · raw message

arch/arm/dts/rk3328.dtsi +898 -522

2,141 lines not on this page · raw message

Signature · 1 line
2.26.0
#6 lore raw

PATCH v2 6/6 rockchip: rk3328: Add support for ROC-RK3328-CC board

In reply to Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

The ROC-RK3328-CC has the enable pin of the SD card power switch tied to GPIO_0_D6. This pin also has the function SDMMC0_PWREN, which is muxed by default. SDMMC0_PWREN is an active high signal controlled by the MMC controller, however the switch enable is active low, and pulled low (enabled) by default to make things work on boot.

As such, we need to mux away from SDMMC0_PWREN and use GPIO to enable power to the card. The default GPIO state for the pin is pull-down and input, which doesn't require extra configuration when paired with the external pull-down and active low switch.

Deal with this by enabling regulator support in SPL, and setting "u-boot,dm-spl" for the regulator and other device nodes needed for muxing the pin.

The device tree file is synced from the Linux kernel next-20200324.

---
Changes since v1:

- Drop custom target; use pinctrl and regulators in SPL

---
 arch/arm/dts/Makefile                  |   1 +
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi |  38 +++
 arch/arm/dts/rk3328-roc-cc.dts         | 354 +++++++++++++++++++++++++
 board/rockchip/evb_rk3328/MAINTAINERS  |   7 +
 configs/roc-cc-rk3328_defconfig        | 103 +++++++
 doc/README.rockchip                    |   4 +-
 6 files changed, 506 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3328-roc-cc.dts
 create mode 100644 configs/roc-cc-rk3328_defconfig
arch/arm/dts/Makefile +1 -0
index 9c593b2c986a..023cb010532d 100644
@@ -104,6 +104,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3308) += \
 
 dtb-$(CONFIG_ROCKCHIP_RK3328) += \
 	rk3328-evb.dtb \
+	rk3328-roc-cc.dtb \
 	rk3328-rock64.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RK3368) += \
arch/arm/dts/rk3328-roc-cc-u-boot.dtsi new file +38 -0
new file mode 100644
index 000000000000..c268fbb9b5b6
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2018-2019 Rockchip Electronics Co., Ltd
+ */
+
+#include "rk3328-u-boot.dtsi"
+#include "rk3328-sdram-ddr4-666.dtsi"
+/ {
+	chosen {
+		u-boot,spl-boot-order = "same-as-spl", &sdmmc, &emmc;
+	};
+};
+
+&gpio0 {
+	u-boot,dm-spl;
+};
+
+&pinctrl {
+	u-boot,dm-spl;
+};
+
+&sdmmc0m1_gpio {
+	u-boot,dm-spl;
+};
+
+&pcfg_pull_up_4ma {
+	u-boot,dm-spl;
+};
+
+&usb_host0_xhci {
+	vbus-supply = <&vcc_host1_5v>;
+	status = "okay";
+};
+
+/* Need this and all the pinctrl/gpio stuff above to set pinmux */
+&vcc_sd {
+	u-boot,dm-spl;
+};
arch/arm/dts/rk3328-roc-cc.dts new file +354 -0

354 lines not on this page · raw message

board/rockchip/evb_rk3328/MAINTAINERS +7 -0
index c661d2e06ae3..c6c22a373df5 100644
@@ -5,6 +5,13 @@ F:      board/rockchip/evb_rk3328
 F:      include/configs/evb_rk3328.h
 F:      configs/evb-rk3328_defconfig
 
+ROC-RK3328-CC
+M:      Loic Devulder <[email protected]>
+M:      Chen-Yu Tsai <[email protected]>
+S:      Maintained
+F:      configs/roc-rk3328-cc_defconfig
+F:      arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
+
 ROCK64-RK3328
 M:      Matwey V. Kornilov <[email protected]>
 S:      Maintained
configs/roc-cc-rk3328_defconfig new file +103 -0

103 lines not on this page · raw message

doc/README.rockchip +3 -1
index 9b699b9ae5d3..70c8798ed2d0 100644
@@ -52,10 +52,12 @@ Two RK3308 boards are supported:
    - EVB RK3308 - use evb-rk3308 configuration
    - ROC-CC-RK3308 - use roc-cc-rk3308 configuration
 
-Two RK3328 board are supported:
+Three RK3328 boards are supported:
 
    - EVB RK3328 - use evb-rk3328_defconfig
    - Pine64 Rock64 board - use rock64-rk3328_defconfig
+   - Firefly / Libre Computer Project ROC-RK3328-CC board -
+     use roc-cc-rk3328_defconfig
 
 Size RK3399 boards are supported (aarch64):
 
Signature · 1 line
2.26.0
#7 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

In reply to Chen-Yu Tsai
Quoted 72 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC-RK3328-CC single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

? - 1/2/4 GB DDR4 DRAM
? - eMMC connector for optional module
? - micro SD card slot
? - 1 x USB 3.0 host port
? - 2 x USB 2.0 host port
? - 1 x USB 2.0 OTG port
? - HDMI video output
? - TRRS connector with audio and composite video output ? - gigabit Ethernet
? - consumer IR receiver
? - debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
? rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-boot.dtsi ? rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-boot.dtsi ? dt-bindings: clock: rk3328: sync from upstream Linux kernel ? dt-bindings: power: rk3328-power: sync from upstream Linux kernel ? rockchip: dts: rk3328: Sync device tree files from Linux
? rockchip: rk3328: Add support for ROC-RK3328-CC board

?arch/arm/dts/Makefile?????????????????????????|????1 +
?arch/arm/dts/rk3328-evb-u-boot.dtsi???????????|???39 +
?arch/arm/dts/rk3328-evb.dts???????????????????|??220 +--
?arch/arm/dts/rk3328-roc-cc-u-boot.dtsi????????|???38 +
?.../{rk3328-rock64.dts => rk3328-roc-cc.dts}??|??135 +-
?arch/arm/dts/rk3328-rock64.dts????????????????|??132 +-
?arch/arm/dts/rk3328.dtsi??????????????????????| 1420 +++++++++++------
?board/rockchip/evb_rk3328/MAINTAINERS?????????|????7 +
?configs/roc-cc-rk3328_defconfig???????????????|??103 ++
?doc/README.rockchip???????????????????????????|????4 +-
?include/dt-bindings/clock/rk3328-cru.h????????|??212 +--
?include/dt-bindings/power/rk3328-power.h??????|???19 +
Quoted 6 lines

?12 files changed, 1578 insertions(+), 752 deletions(-) ?create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi ?copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%) ?create mode 100644 configs/roc-cc-rk3328_defconfig ?create mode 100644 include/dt-bindings/power/rk3328-power.h

Hi ChenYu,

I needed to apply the following additional diff to your patchset to allow the Rock64 v3 board to boot through SPL. I copied the same approach from your?ROC-RK3328-CC changes. While it works it needs expert review.

arch/arm/dts/rk3328-rock64-u-boot.dtsi +0 -0
index e5946d2d2d..7d4ae66834 100644
@@ -11,6 +11,27 @@

? };
?};
?
+&gpio0 {
+???????u-boot,dm-spl;
+};
+
+&pinctrl {
+???????u-boot,dm-spl;
+};
+
+&sdmmc0m1_gpio {
+???????u-boot,dm-spl;
+};
+
+&pcfg_pull_up_4ma {
+???????u-boot,dm-spl;
+};
+
?&usb_host0_xhci {
? status = "okay";
?};
+
+/* Need this and all the pinctrl/gpio stuff above to set pinmux */ +&vcc_sd {
+???????u-boot,dm-spl;
+};

configs/rock64-rk3328_defconfig +0 -0
index 826c7a6917..5e4516635e 100644
@@ -1,6 +1,7 @@

?CONFIG_ARM=y
?CONFIG_ARCH_ROCKCHIP=y
?CONFIG_SYS_TEXT_BASE=0x00200000
+CONFIG_SPL_GPIO_SUPPORT=y
?CONFIG_ENV_OFFSET=0x3F8000
?CONFIG_ROCKCHIP_RK3328=y
?CONFIG_TPL_ROCKCHIP_COMMON_BOARD=y
@@ -25,6 +26,8 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
?# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
?CONFIG_TPL_SYS_MALLOC_SIMPLE=y
?CONFIG_SPL_STACK_R=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_POWER_SUPPORT=y
?CONFIG_SPL_ATF=y
?CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
?CONFIG_CMD_BOOTZ=y
@@ -36,7 +39,7 @@ CONFIG_CMD_TIME=y
?CONFIG_SPL_OF_CONTROL=y
?CONFIG_TPL_OF_CONTROL=y
?CONFIG_DEFAULT_DEVICE_TREE="rk3328-rock64"
-CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ?CONFIG_TPL_OF_PLATDATA=y
?CONFIG_ENV_IS_IN_MMC=y
?CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -65,7 +68,9 @@ CONFIG_PINCTRL=y
?CONFIG_SPL_PINCTRL=y
?CONFIG_DM_PMIC=y
?CONFIG_PMIC_RK8XX=y
+CONFIG_SPL_DM_REGULATOR=y
?CONFIG_REGULATOR_PWM=y
+CONFIG_SPL_DM_REGULATOR_FIXED=y
?CONFIG_DM_REGULATOR_FIXED=y
?CONFIG_REGULATOR_RK8XX=y
?CONFIG_PWM_ROCKCHIP=y

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

Quoted 109 lines · Loic Devulder

Hi Chen,

I tested your patches and all work pretty well. I just had issues with USB2 that doesn't recognize any of my USB keys (it's OK on USB3).

I also had these issues with XHCI driver:
=> usb reset
resetting USB...
BUG at drivers/usb/host/xhci-mem.c:84/xhci_ring_free()! BUG!
?esetting ...

=> usb stop
stopping USB..
Host not halted after 16000 microseconds.
XHCI: failed to set VBus supply
device_remove: Device 'usb at ff600000' failed to remove, but children are gone

But for the whole series: Tested-by: Loic Devulder <[email protected]>

Quoted 77 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC- RK3328-CC
single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect
the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only
recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that
showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-
boot.dtsi
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-
boot.dtsi
dt-bindings: clock: rk3328: sync from upstream Linux kernel
dt-bindings: power: rk3328-power: sync from upstream Linux kernel
rockchip: dts: rk3328: Sync device tree files from Linux
rockchip: rk3328: Add support for ROC-RK3328-CC board

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/rk3328-evb-u-boot.dtsi           |   39 +
 arch/arm/dts/rk3328-evb.dts                   |  220 +--
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        |   38 +
 .../{rk3328-rock64.dts => rk3328-roc-cc.dts}  |  135 +-
 arch/arm/dts/rk3328-rock64.dts                |  132 +-
 arch/arm/dts/rk3328.dtsi                      | 1420 +++++++++++--
----
 board/rockchip/evb_rk3328/MAINTAINERS         |    7 +
 configs/roc-cc-rk3328_defconfig               |  103 ++
Quoted 9 lines
 doc/README.rockchip                           |    4 +-
 include/dt-bindings/clock/rk3328-cru.h        |  212 +--
 include/dt-bindings/power/rk3328-power.h      |   19 +
 12 files changed, 1578 insertions(+), 752 deletions(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%)
 create mode 100644 configs/roc-cc-rk3328_defconfig
 create mode 100644 include/dt-bindings/power/rk3328-power.h
Quoted 8 lines

--
Loic Devulder <[email protected]> | ldevulder at irc 0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55 Senior QA Engineer | Container & Storage Solutions Quality Assurance team (qa-css)
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah HRB, 21284 (AG Nuernberg)

Good Afternoon,

I have tested this patch set against u-boot git as of 20 April 2020 and have some feedback.
The issue of booting off the sdmmc is fixed, thanks!

The USB issues above come from a few issues:
vcc_host1_5v is set to regulator-always-on, which prevents USB from resetting properly, remove this option allows xhci to clean up. USB 2.0 Host does not work because there is no rockchip,rk3328-usb2phy yet. This causes the generic ohci and ehci drivers to fail, removing CONFIG_PHY from your defconfig resolves this.
The USB-OTG port appears to not work because it's stuck in peripheral mode. The vbus-supply = <&vcc_host1_5v> should be on all three USB controllers, as it powers all three ports.

Overall, excellent work!
For the whole series: Tested-by: Peter Geis <[email protected]>

#10 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

Hi,

Quoted 122 lines · Peter Geis
Quoted 109 lines · Loic Devulder

Hi Chen,

I tested your patches and all work pretty well. I just had issues with USB2 that doesn't recognize any of my USB keys (it's OK on USB3).

I also had these issues with XHCI driver:
=> usb reset
resetting USB...
BUG at drivers/usb/host/xhci-mem.c:84/xhci_ring_free()! BUG!
?esetting ...

=> usb stop
stopping USB..
Host not halted after 16000 microseconds.
XHCI: failed to set VBus supply
device_remove: Device 'usb at ff600000' failed to remove, but children are gone

But for the whole series: Tested-by: Loic Devulder <[email protected]>

Quoted 77 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC- RK3328-CC
single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect
the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only
recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that
showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-
boot.dtsi
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-
boot.dtsi
dt-bindings: clock: rk3328: sync from upstream Linux kernel
dt-bindings: power: rk3328-power: sync from upstream Linux kernel
rockchip: dts: rk3328: Sync device tree files from Linux
rockchip: rk3328: Add support for ROC-RK3328-CC board

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/rk3328-evb-u-boot.dtsi           |   39 +
 arch/arm/dts/rk3328-evb.dts                   |  220 +--
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        |   38 +
 .../{rk3328-rock64.dts => rk3328-roc-cc.dts}  |  135 +-
 arch/arm/dts/rk3328-rock64.dts                |  132 +-
 arch/arm/dts/rk3328.dtsi                      | 1420 +++++++++++--
----
 board/rockchip/evb_rk3328/MAINTAINERS         |    7 +
 configs/roc-cc-rk3328_defconfig               |  103 ++
Quoted 9 lines
 doc/README.rockchip                           |    4 +-
 include/dt-bindings/clock/rk3328-cru.h        |  212 +--
 include/dt-bindings/power/rk3328-power.h      |   19 +
 12 files changed, 1578 insertions(+), 752 deletions(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%)
 create mode 100644 configs/roc-cc-rk3328_defconfig
 create mode 100644 include/dt-bindings/power/rk3328-power.h
Quoted 8 lines

--
Loic Devulder <[email protected]> | ldevulder at irc 0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55 Senior QA Engineer | Container & Storage Solutions Quality Assurance team (qa-css)
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah HRB, 21284 (AG Nuernberg)

Good Afternoon,

Quoted 7 lines

I have tested this patch set against u-boot git as of 20 April 2020 and have some feedback.
The issue of booting off the sdmmc is fixed, thanks!

The USB issues above come from a few issues:
vcc_host1_5v is set to regulator-always-on, which prevents USB from resetting properly, remove this option allows xhci to clean up.

This seems a little odd. I suppose it's because of how U-boot's USB stack works. On Linux, the XHCI is not supported. There seems to be an issue in that the controller never detects disconnects.

Quoted 3 lines

USB 2.0 Host does not work because there is no rockchip,rk3328-usb2phy yet. This causes the generic ohci and ehci drivers to fail, removing CONFIG_PHY from your defconfig resolves this.

Removing CONFIG_PHY stops XHCI from working.

It seems easier to remove the phy properties using the -u-boot.dtsi file.

Quoted 3 lines

The USB-OTG port appears to not work because it's stuck in peripheral mode. The vbus-supply = <&vcc_host1_5v> should be on all three USB controllers, as it powers all three ports.

I tried setting dr_mode = "host" in the device tree but it still timeouts. Setting vbus-supply doesn't help either as it is timing out during the initializing phase in the driver, before vbus is enabled. Since it worked before my patchset, I'm guessing it might be related to the assigned-clocks changes. I have to do some more tests to narrow it down.

Some thoughts carried over from Linux regarding the always-on setting:

For this particular board, since all ports share the same GPIO to control USB VCC, having it not always-on might result in other devices getting power cycled, since U-boot doesn't do reference counting for regulators.

Another thing is that the bindings only allow the VBUS regulator to be tied to the USB PHY, which is not supported in U-boot, and not the host.

To me it seems to make more sense to make enable/disable no-ops for always-on regulators, instead of returning errors.

Regards
ChenYu

Quoted 2 lines

Overall, excellent work!
For the whole series: Tested-by: Peter Geis <[email protected]>

#11 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

Quoted 130 lines · Chen-Yu Tsai

Hi,

Quoted 126 lines · Peter Geis
Quoted 109 lines · Loic Devulder

Hi Chen,

I tested your patches and all work pretty well. I just had issues with USB2 that doesn't recognize any of my USB keys (it's OK on USB3).

I also had these issues with XHCI driver:
=> usb reset
resetting USB...
BUG at drivers/usb/host/xhci-mem.c:84/xhci_ring_free()! BUG!
?esetting ...

=> usb stop
stopping USB..
Host not halted after 16000 microseconds.
XHCI: failed to set VBus supply
device_remove: Device 'usb at ff600000' failed to remove, but children are gone

But for the whole series: Tested-by: Loic Devulder <[email protected]>

Quoted 77 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC- RK3328-CC
single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect
the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only
recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that
showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-
boot.dtsi
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-
boot.dtsi
dt-bindings: clock: rk3328: sync from upstream Linux kernel
dt-bindings: power: rk3328-power: sync from upstream Linux kernel
rockchip: dts: rk3328: Sync device tree files from Linux
rockchip: rk3328: Add support for ROC-RK3328-CC board

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/rk3328-evb-u-boot.dtsi           |   39 +
 arch/arm/dts/rk3328-evb.dts                   |  220 +--
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        |   38 +
 .../{rk3328-rock64.dts => rk3328-roc-cc.dts}  |  135 +-
 arch/arm/dts/rk3328-rock64.dts                |  132 +-
 arch/arm/dts/rk3328.dtsi                      | 1420 +++++++++++--
----
 board/rockchip/evb_rk3328/MAINTAINERS         |    7 +
 configs/roc-cc-rk3328_defconfig               |  103 ++
Quoted 9 lines
 doc/README.rockchip                           |    4 +-
 include/dt-bindings/clock/rk3328-cru.h        |  212 +--
 include/dt-bindings/power/rk3328-power.h      |   19 +
 12 files changed, 1578 insertions(+), 752 deletions(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%)
 create mode 100644 configs/roc-cc-rk3328_defconfig
 create mode 100644 include/dt-bindings/power/rk3328-power.h
Quoted 8 lines

--
Loic Devulder <[email protected]> | ldevulder at irc 0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55 Senior QA Engineer | Container & Storage Solutions Quality Assurance team (qa-css)
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah HRB, 21284 (AG Nuernberg)

Good Afternoon,

I have tested this patch set against u-boot git as of 20 April 2020 and have some feedback.
The issue of booting off the sdmmc is fixed, thanks!

Quoted 7 lines
Quoted 3 lines

The USB issues above come from a few issues:
vcc_host1_5v is set to regulator-always-on, which prevents USB from resetting properly, remove this option allows xhci to clean up.

This seems a little odd. I suppose it's because of how U-boot's USB stack works. On Linux, the XHCI is not supported. There seems to be an issue in that the controller never detects disconnects.

Mainline Linux is missing the PHY driver, so you can enable the USB3 controller, but yes, connects/disconnects are not detected. I've tried to port the downstream driver, but it is a mess and doesn't trigger interrupts for 3.0 devices.

Quoted 6 lines
Quoted 4 lines

USB 2.0 Host does not work because there is no rockchip,rk3328-usb2phy yet. This causes the generic ohci and ehci drivers to fail, removing CONFIG_PHY from your defconfig resolves this.

Removing CONFIG_PHY stops XHCI from working.

Odd, I never encountered that issue, maybe because I tagged all of the phys to all of their devices.

Quoted 7 lines

It seems easier to remove the phy properties using the -u-boot.dtsi file.

Quoted 3 lines

The USB-OTG port appears to not work because it's stuck in peripheral mode. The vbus-supply = <&vcc_host1_5v> should be on all three USB controllers, as it powers all three ports.

Quoted 5 lines

I tried setting dr_mode = "host" in the device tree but it still timeouts. Setting vbus-supply doesn't help either as it is timing out during the initializing phase in the driver, before vbus is enabled. Since it worked before my patchset, I'm guessing it might be related to the assigned-clocks changes. I have to do some more tests to narrow it down.

I didn't test it, but it seemed to be the logical place to check.

Quoted 8 lines

Some thoughts carried over from Linux regarding the always-on setting:

For this particular board, since all ports share the same GPIO to control USB VCC, having it not always-on might result in other devices getting power cycled, since U-boot doesn't do reference counting for regulators.

Quoted 5 lines

Another thing is that the bindings only allow the VBUS regulator to be tied to the USB PHY, which is not supported in U-boot, and not the host.

To me it seems to make more sense to make enable/disable no-ops for always-on regulators, instead of returning errors.

Yes, but at least from my limited testing it seems U-Boot enables them all en-mass during usb start.
It then shuts them all down during usb reset or usb stop. It doesn't appear to implement runtime power management.

If you implement no-ops does that solve the issue of it not cleaning up xhci on shutdown?

Quoted 9 lines

Regards
ChenYu

Quoted 2 lines

Overall, excellent work!
For the whole series: Tested-by: Peter Geis <[email protected]>

#12 lore raw

v2 cover rockchip: rk3328: sync dts and add ROC-RK3328-CC board

Quoted 136 lines · Peter Geis
Quoted 134 lines · Chen-Yu Tsai

Hi,

Quoted 129 lines · Peter Geis
Quoted 109 lines · Loic Devulder

Hi Chen,

I tested your patches and all work pretty well. I just had issues with USB2 that doesn't recognize any of my USB keys (it's OK on USB3).

I also had these issues with XHCI driver:
=> usb reset
resetting USB...
BUG at drivers/usb/host/xhci-mem.c:84/xhci_ring_free()! BUG!
?esetting ...

=> usb stop
stopping USB..
Host not halted after 16000 microseconds.
XHCI: failed to set VBus supply
device_remove: Device 'usb at ff600000' failed to remove, but children are gone

But for the whole series: Tested-by: Loic Devulder <[email protected]>

Quoted 77 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

Hi everyone,

This is v2 of my ROC-RK3328-CC series. Changes from v1 are mainly dropping the custom board target, and dealing with the pinmuxing through proper use of DM regulators / GPIO / pinctrl in SPL.

This series adds proper support for Firefly / Libre Computer ROC- RK3328-CC
single board computer.

The ROC-RK3328-CC from Firefly and Libre Computer Project is a credit card size development board based on the Rockchip RK3328 SoC, with:

- 1/2/4 GB DDR4 DRAM
- eMMC connector for optional module
- micro SD card slot
- 1 x USB 3.0 host port
- 2 x USB 2.0 host port
- 1 x USB 2.0 OTG port
- HDMI video output
- TRRS connector with audio and composite video output
- gigabit Ethernet
- consumer IR receiver
- debug UART pins

Originally I started with Loic's patches, and syncing the device tree files from Linux. That didn't get very far, with SPL failing to detect
the SD card. Examining the schematics and internal state of GRF and GPIOs, I realized that the logic for the SD card power enable switch is opposite that of what the SD card controller's SDMMC0_PWREN pin would use. Instead, directly using the GPIO is required.

To deal with this, DM regulator and GPIO are enabled in SPL, and various device nodes are marked with u-boot,dm-spl to have them work. pinctrl properties are not stripped, so as to have the SDMMC0_PWREN pin muxed over to GPIO.

Along the way, there are some clean-ups of existing dts files, moving U-boot only features to -u-boot.dtsi files, and then a wholesale sync from Linux. Only boards already existing in U-boot are synced. DT binding header files are synced separately as there is already one patch floating around. The DT sync also includes clean-up changes only
recently posted, and likely won't make it in for at least a few weeks.

Please have a look, and test if possible. I cc-ed a couple people that
showed interest in this board on mailing lists recently.

Regards
ChenYu

Chen-Yu Tsai (6):
rockchip: dts: rk3328-evb: Move vcc5v0-host-xhci-drv to -u-
boot.dtsi
rockchip: dts: rk3328-evb: Move gmac2io related nodes to -u-
boot.dtsi
dt-bindings: clock: rk3328: sync from upstream Linux kernel
dt-bindings: power: rk3328-power: sync from upstream Linux kernel
rockchip: dts: rk3328: Sync device tree files from Linux
rockchip: rk3328: Add support for ROC-RK3328-CC board

 arch/arm/dts/Makefile                         |    1 +
 arch/arm/dts/rk3328-evb-u-boot.dtsi           |   39 +
 arch/arm/dts/rk3328-evb.dts                   |  220 +--
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        |   38 +
 .../{rk3328-rock64.dts => rk3328-roc-cc.dts}  |  135 +-
 arch/arm/dts/rk3328-rock64.dts                |  132 +-
 arch/arm/dts/rk3328.dtsi                      | 1420 +++++++++++--
----
 board/rockchip/evb_rk3328/MAINTAINERS         |    7 +
 configs/roc-cc-rk3328_defconfig               |  103 ++
Quoted 9 lines
 doc/README.rockchip                           |    4 +-
 include/dt-bindings/clock/rk3328-cru.h        |  212 +--
 include/dt-bindings/power/rk3328-power.h      |   19 +
 12 files changed, 1578 insertions(+), 752 deletions(-)
 create mode 100644 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi
 copy arch/arm/dts/{rk3328-rock64.dts => rk3328-roc-cc.dts} (68%)
 create mode 100644 configs/roc-cc-rk3328_defconfig
 create mode 100644 include/dt-bindings/power/rk3328-power.h
Quoted 8 lines

--
Loic Devulder <[email protected]> | ldevulder at irc 0x175A963893C85F55 | D220 DEF5 56A3 DE00 9DAA 78BA 175A 9638 93C8 5F55 Senior QA Engineer | Container & Storage Solutions Quality Assurance team (qa-css)
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nuernberg, Germany
GF: Felix Imend?rffer, Mary Higgins, Sri Rasiah HRB, 21284 (AG Nuernberg)

Good Afternoon,

I have tested this patch set against u-boot git as of 20 April 2020 and have some feedback.
The issue of booting off the sdmmc is fixed, thanks!

The USB issues above come from a few issues:
vcc_host1_5v is set to regulator-always-on, which prevents USB from resetting properly, remove this option allows xhci to clean up.

Quoted 8 lines
Quoted 3 lines

This seems a little odd. I suppose it's because of how U-boot's USB stack works. On Linux, the XHCI is not supported. There seems to be an issue in that the controller never detects disconnects.

Mainline Linux is missing the PHY driver, so you can enable the USB3 controller, but yes, connects/disconnects are not detected. I've tried to port the downstream driver, but it is a mess and doesn't trigger interrupts for 3.0 devices.

OK. I figured out the failure pattern was that the USB 3.0 port only gets USB 2.0 working.

At this point it's starting to get weird. If I only tie the regulator to XHCI, then the OTG 2.0 port doesn't detect anything. If I tie the regulator to all three hosts (EHCI+OHCI counted as one), or only the OTG device, then the USB 3.0 port only works with USB 2.0 devices.

This seems like a preexisting issue.

On the Rock64 the regulator is set to "always-on" and the same issue with XHCI not working with USB 3.0 exists as well.

Given the trade off, I believe having USB 3.0 is more useful than USB OTG in host mode.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

USB 2.0 Host does not work because there is no rockchip,rk3328-usb2phy yet. This causes the generic ohci and ehci drivers to fail, removing CONFIG_PHY from your defconfig resolves this.

Removing CONFIG_PHY stops XHCI from working.

Odd, I never encountered that issue, maybe because I tagged all of the phys to all of their devices.

Ah, it looks like some other issue, unrelated to CONFIG_PHY.

Quoted 6 lines
Quoted 6 lines

It seems easier to remove the phy properties using the -u-boot.dtsi file.

Quoted 3 lines

The USB-OTG port appears to not work because it's stuck in peripheral mode. The vbus-supply = <&vcc_host1_5v> should be on all three USB controllers, as it powers all three ports.

Quoted 7 lines
Quoted 5 lines

I tried setting dr_mode = "host" in the device tree but it still timeouts. Setting vbus-supply doesn't help either as it is timing out during the initializing phase in the driver, before vbus is enabled. Since it worked before my patchset, I'm guessing it might be related to the assigned-clocks changes. I have to do some more tests to narrow it down.

I didn't test it, but it seemed to be the logical place to check.

Looks like it just needed "hnp-srp-disable" set in the OTG node.

Quoted 14 lines
Quoted 8 lines

Some thoughts carried over from Linux regarding the always-on setting:

For this particular board, since all ports share the same GPIO to control USB VCC, having it not always-on might result in other devices getting power cycled, since U-boot doesn't do reference counting for regulators.

Quoted 5 lines

Another thing is that the bindings only allow the VBUS regulator to be tied to the USB PHY, which is not supported in U-boot, and not the host.

To me it seems to make more sense to make enable/disable no-ops for always-on regulators, instead of returning errors.

Quoted 7 lines

Yes, but at least from my limited testing it seems U-Boot enables them all en-mass during usb start.
It then shuts them all down during usb reset or usb stop. It doesn't appear to implement runtime power management.

If you implement no-ops does that solve the issue of it not cleaning up xhci on shutdown?

I'd prefer not changing core behavior that requires a whole lot of testing.

Regards
ChenYu

Quoted 9 lines
Quoted 9 lines

Regards
ChenYu

Quoted 2 lines

Overall, excellent work!
For the whole series: Tested-by: Peter Geis <[email protected]>