From patchwork Fri Apr 10 20:09:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Miller X-Patchwork-Id: 237678 List-Id: U-Boot discussion From: kurt at intricatesoftware.com (Kurt Miller) Date: Fri, 10 Apr 2020 16:09:39 -0400 Subject: [PATCH v2 0/6] rockchip: rk3328: sync dts and add ROC-RK3328-CC board In-Reply-To: <20200405022544.31856-1-wens@kernel.org> References: <20200405022544.31856-1-wens@kernel.org> Message-ID: <1586549379.7640.91.camel@intricatesoftware.com> On Sun, 2020-04-05 at 10:25 +0800, Chen-Yu Tsai wrote: > From: Chen-Yu Tsai > > 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 > 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. ?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 diff --git a/arch/arm/dts/rk3328-rock64-u-boot.dtsi b/arch/arm/dts/rk3328-rock64-u-boot.dtsi index e5946d2d2d..7d4ae66834 100644 --- a/arch/arm/dts/rk3328-rock64-u-boot.dtsi +++ b/arch/arm/dts/rk3328-rock64-u-boot.dtsi @@ -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; +}; diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig index 826c7a6917..5e4516635e 100644 --- a/configs/rock64-rk3328_defconfig +++ b/configs/rock64-rk3328_defconfig @@ -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