diff --git a/config/boards/tinkerboard-2.wip b/config/boards/tinkerboard-2.wip new file mode 100644 index 0000000000..b76c656c48 --- /dev/null +++ b/config/boards/tinkerboard-2.wip @@ -0,0 +1,8 @@ +# Rockchip RK3399 hexa core 2GB SoC GBe eMMC USB3 WiFi/BT +BOARD_NAME="Tinker Board 2" +BOARDFAMILY="rockchip64" +BOOTCONFIG="tinker-2-rk3399_defconfig" +KERNEL_TARGET="current" +FULL_DESKTOP="yes" +BOOT_LOGO="desktop" +BOOT_FDT_FILE="rockchip/rk3399-tinker-2.dtb" diff --git a/config/kernel/linux-rockchip64-current.config b/config/kernel/linux-rockchip64-current.config index fc75dba66f..a777730dba 100644 --- a/config/kernel/linux-rockchip64-current.config +++ b/config/kernel/linux-rockchip64-current.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 5.10.48 Kernel Configuration +# Linux/arm64 5.10.50 Kernel Configuration # CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36)) 8.3.0" CONFIG_CC_IS_GCC=y @@ -743,10 +743,6 @@ CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y # end of GCOV-based kernel profiling CONFIG_HAVE_GCC_PLUGINS=y -CONFIG_GCC_PLUGINS=y -# CONFIG_GCC_PLUGIN_CYC_COMPLEXITY is not set -# CONFIG_GCC_PLUGIN_LATENT_ENTROPY is not set -# CONFIG_GCC_PLUGIN_RANDSTRUCT is not set # end of General architecture-dependent options CONFIG_RT_MUTEXES=y @@ -3212,10 +3208,16 @@ CONFIG_RTLBTCOEXIST=m CONFIG_RTL8XXXU=m # CONFIG_RTL8XXXU_UNTESTED is not set CONFIG_RTW88=m -# CONFIG_RTW88_8822BE is not set -# CONFIG_RTW88_8822CE is not set +CONFIG_RTW88_CORE=m +CONFIG_RTW88_PCI=m +CONFIG_RTW88_8822B=m +CONFIG_RTW88_8822C=m +CONFIG_RTW88_8822BE=m +CONFIG_RTW88_8822CE=m # CONFIG_RTW88_8723DE is not set # CONFIG_RTW88_8821CE is not set +CONFIG_RTW88_DEBUG=y +CONFIG_RTW88_DEBUGFS=y CONFIG_WLAN_VENDOR_RSI=y CONFIG_RSI_91X=m # CONFIG_RSI_DEBUGFS is not set @@ -4527,6 +4529,7 @@ CONFIG_REGULATOR_BD71828=m # CONFIG_REGULATOR_DA9211 is not set CONFIG_REGULATOR_FAN53555=y # CONFIG_REGULATOR_FAN53880 is not set +CONFIG_REGULATOR_FAN53200=y CONFIG_REGULATOR_GPIO=y # CONFIG_REGULATOR_ISL9305 is not set # CONFIG_REGULATOR_ISL6271A is not set @@ -8278,7 +8281,6 @@ CONFIG_PSTORE_COMPRESS_DEFAULT="deflate" # CONFIG_PSTORE_CONSOLE is not set # CONFIG_PSTORE_PMSG is not set CONFIG_PSTORE_RAM=m -# CONFIG_PSTORE_BLK is not set CONFIG_SYSV_FS=m CONFIG_UFS_FS=m CONFIG_UFS_FS_WRITE=y @@ -8511,10 +8513,6 @@ CONFIG_LSM="lockdown,yama,integrity,apparmor" # Memory initialization # CONFIG_INIT_STACK_NONE=y -# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF is not set -# CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL is not set -# CONFIG_GCC_PLUGIN_STACKLEAK is not set CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y # CONFIG_INIT_ON_FREE_DEFAULT_ON is not set # end of Memory initialization diff --git a/config/sources/families/include/rockchip64_common.inc b/config/sources/families/include/rockchip64_common.inc index c4891a1d39..b59d97af8f 100644 --- a/config/sources/families/include/rockchip64_common.inc +++ b/config/sources/families/include/rockchip64_common.inc @@ -55,7 +55,7 @@ elif [[ $BOOTCONFIG == *3328* ]]; then BOOT_RK3328_USE_AYUFAN_ATF=yes -elif [[ $BOARD == pinebook-pro ]]; then +elif [[ $BOARD == pinebook-pro || $BOARD == tinkerboard-2 ]]; then BOOT_USE_MAINLINE_ATF=yes BOOT_SOC=rk3399 diff --git a/patch/kernel/archive/rockchip64-5.10/add-board-tinker-board-2.patch b/patch/kernel/archive/rockchip64-5.10/add-board-tinker-board-2.patch new file mode 100644 index 0000000000..060c175565 --- /dev/null +++ b/patch/kernel/archive/rockchip64-5.10/add-board-tinker-board-2.patch @@ -0,0 +1,785 @@ +From 98250da85549f89a889424926d3552f4abd09a1f Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Tue, 2 Mar 2021 15:50:01 -0500 +Subject: [PATCH] Patching something + +Signed-off-by: tonymac32 +--- + arch/arm64/boot/dts/rockchip/Makefile | 1 + + .../boot/dts/rockchip/rk3399-tinker-2.dts | 613 ++++++++++++++++++ + 3 files changed, 687 insertions(+) + create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-tinker-2.dts + +diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile +index 3fb6d6e9f..3863109a5 100644 +--- a/arch/arm64/boot/dts/rockchip/Makefile ++++ b/arch/arm64/boot/dts/rockchip/Makefile +@@ -56,6 +56,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64-v2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb ++dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-tinker-2.dtb + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399pro-rock-pi-n10.dtb + + subdir-y := $(dts-dirs) overlay + +diff --git a/arch/arm64/boot/dts/rockchip/rk3399-tinker-2.dts b/arch/arm64/boot/dts/rockchip/rk3399-tinker-2.dts +new file mode 100644 +index 000000000..dc337bee0 +--- /dev/null ++++ b/arch/arm64/boot/dts/rockchip/rk3399-tinker-2.dts +@@ -0,0 +1,751 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ * Copyright (c) 2021 Thomas McKahan ++ */ ++ ++/dts-v1/; ++#include ++#include ++#include "rk3399.dtsi" ++#include "rk3399-op1-opp.dtsi" ++ ++/ { ++ model = "Asus Tinker Board 2"; ++ compatible = "rockchip,rk3399-evb", "rockchip,rk3399"; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ board_info: board-info { ++ compatible = "board-info"; ++ ++ hw-id0 = <&gpio4 RK_PA7 GPIO_ACTIVE_HIGH>; ++ hw-id1 = <&gpio4 RK_PA6 GPIO_ACTIVE_HIGH>; ++ hw-id2 = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; ++ ++ pid-id0 = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>; ++ pid-id1 = <&gpio2 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pid-id2 = <&gpio2 RK_PA2 GPIO_ACTIVE_HIGH>; ++ ++ ddr-id1 = <&gpio4 RK_PA4 GPIO_ACTIVE_HIGH>; ++ ddr-id2 = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; ++ ++ pmic-reset = <&gpio1 RK_PA6 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ gpio-leds { ++ compatible = "gpio-leds"; ++ ++ pwr-led { ++ gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger = "default-on"; ++ retain-state-suspended = <1>; ++ }; ++ ++ act-led { ++ gpios = <&gpio0 RK_PA3 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger="mmc0"; ++ }; ++ ++ rsv-led { ++ gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>; ++ linux,default-trigger="heartbeat"; ++ }; ++ }; ++ ++ vcc_lcd: vcc-lcd { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_lcd"; ++ gpio = <&gpio4 30 GPIO_ACTIVE_HIGH>; ++ startup-delay-us = <20000>; ++ enable-active-high; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vbus_typec: vbus-5vout { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_typec0_en_pin>; ++ regulator-name = "vbus_5vout"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc5v0_sys>; ++ ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <900000>; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++}; ++ ++&cdn_dp { ++ status = "okay"; ++ extcon = <&fusb0>; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&cru SCLK_MAC>; ++ clock_in_out = "input"; ++ assigned-clock-rates = <125000000>; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 16000 72000>; ++ tx_delay = <0x25>; ++ rx_delay = <0x20>; ++ wakeup-enable = "0"; ++ status = "okay"; ++}; ++&gpu { ++ mali-supply = <&vdd_gpu>; ++ status = "okay"; ++}; ++ ++&hdmi { ++ ddc-i2c-bus = <&i2c3>; ++ status = "okay"; ++}; ++ ++&hdmi_sound { ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <18 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "rk808-clkout1", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc1v8_pmu>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc3v3_dsi: LDO_REG1 { ++ regulator-name = "vcc3v3_dsi"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcca1v8_hdmi: LDO_REG2 { ++ regulator-name = "vcca1v8_hdmi"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vccio_sd: LDO_REG4 { ++ regulator-name = "vccio_sd"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_csi: LDO_REG5 { ++ regulator-name = "vcc3v3_csi"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-name = "vcca0v9_hdmi"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-name = "vcc3v3_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++ ++ vdd_cpu_b: vdd_cpu_b { ++ compatible = "fcs,fan53200"; ++ reg = <0x60>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-regulator"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1250000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ status = "okay"; ++ ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++&i2c3 { ++ status = "okay"; ++}; ++ ++&i2c4 { ++ ++ status = "okay"; ++ i2c-scl-rising-time-ns = <475>; ++ i2c-scl-falling-time-ns = <26>; ++ fusb0: fusb30x@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ interrupt-parent = <&gpio1>; ++ interrupts = ; ++ vbus-supply = <&vbus_typec>; ++ status = "okay"; ++ ++ connector { ++ compatible = "usb-c-connector"; ++ data-role = "dual"; ++ label = "USB-C"; ++ op-sink-microwatt = <1000000>; ++ power-role = "dual"; ++ sink-pdos = ++ ; ++ source-pdos = ++ ; ++ try-power-role = "sink"; ++ ++ extcon-cables = <1 2 5 6 9 10 12 44>; ++ typec-altmodes = <0xff01 1 0x001c0000 1>; ++ ++ ports { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ port@0 { ++ reg = <0>; ++ ++ usbc_hs: endpoint { ++ remote-endpoint = ++ <&u2phy0_typec_hs>; ++ }; ++ }; ++ ++ port@1 { ++ reg = <1>; ++ ++ usbc_ss: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_ss>; ++ }; ++ }; ++ ++ port@2 { ++ reg = <2>; ++ ++ usbc_dp: endpoint { ++ remote-endpoint = ++ <&tcphy0_typec_dp>; ++ }; ++ }; ++ }; ++ }; ++ ++ ++ ++ ++ }; ++ ++ vdd_gpu: vdd_gpu { ++ compatible = "fcs,fan53200"; ++ reg = <0x60>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-regulator"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ status = "okay"; ++ ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++&i2c8 { ++ ++ m24c08: m24c08@50 { ++ compatible = "atmel,24c08"; ++ reg = <0x50>; ++ }; ++}; ++ ++&i2s0 { ++ rockchip,playback-channels = <8>; ++ rockchip,capture-channels = <8>; ++ status = "okay"; ++}; ++ ++&i2s2 { ++ status = "okay"; ++}; ++ ++&pcie_phy { ++ status = "okay"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "okay"; ++}; ++ ++&pwm0 { ++ status = "disabled"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++&pwm3 { ++ status = "disabled"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ mmc-hs400-enhanced-strobe; ++ non-removable; ++ keep-power-in-suspend; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <150000000>; ++ clock-freq-min-max = <100000 150000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vmmc-supply = <&vcc3v3_s3>; ++ vqmmc-supply = <&vccio_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&tcphy0 { ++ extcon = <&fusb0>; ++ status = "okay"; ++}; ++ ++&tcphy0_dp { ++ port { ++ tcphy0_typec_dp: endpoint { ++ remote-endpoint = <&usbc_dp>; ++ }; ++ }; ++}; ++ ++&tcphy0_usb3 { ++ port { ++ tcphy0_typec_ss: endpoint { ++ remote-endpoint = <&usbc_ss>; ++ }; ++ }; ++}; ++ ++&tcphy1 { ++ status = "okay"; ++}; ++ ++&tsadc { ++ /* tshut mode 0:CRU 1:GPIO */ ++ rockchip,hw-tshut-mode = <1>; ++ /* tshut polarity 0:LOW 1:HIGH */ ++ rockchip,hw-tshut-polarity = <1>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++ ++ u2phy0_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy0_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++ ++ port { ++ u2phy0_typec_hs: endpoint { ++ remote-endpoint = <&usbc_hs>; ++ }; ++ }; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++ ++ u2phy1_otg: otg-port { ++ status = "okay"; ++ }; ++ ++ u2phy1_host: host-port { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++ }; ++}; ++ ++&usbdrd3_0 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_0 { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ status = "okay"; ++ dr_mode = "host"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_up>, ++ <0 9 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO0_B1 */ ++ }; ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 17 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = ++ <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ usb-typec { ++ vcc5v0_typec0_en_pin: vcc5v0-typec0-en-pin { ++ rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&vopl { ++ status = "okay"; ++}; ++ ++&vopl_mmu { ++ status = "okay"; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; +-- +Created with Armbian build tools https://github.com/armbian/build + diff --git a/patch/kernel/archive/rockchip64-5.10/regulator-add-fan53200-driver.patch b/patch/kernel/archive/rockchip64-5.10/regulator-add-fan53200-driver.patch new file mode 100644 index 0000000000..4c34199a20 --- /dev/null +++ b/patch/kernel/archive/rockchip64-5.10/regulator-add-fan53200-driver.patch @@ -0,0 +1,594 @@ +From 43231f566634df693fa20b677a84850750829d3d Mon Sep 17 00:00:00 2001 +From: Rock Shen +Date: Tue, 27 Apr 2021 11:13:25 +0800 +Subject: [PATCH] regulator: add fan53200 regulator driver for Tinekr Board 2 + +1. Add fan53200 regulator support for vdd_cpu_b & vdd_gpu +2. By Tinker2 HW design, Vsel gpio pin polarity was reversed, switch + sleep_reg & vol_reg at fan53200_voltages_setup_fairchild +3. Use vsel0 as suspend source, vsel1 as normal source + +Signed-off-by: Rock Shen +--- + arch/arm64/configs/defconfig | 1 + + drivers/regulator/Kconfig | 11 + + drivers/regulator/Makefile | 1 + + drivers/regulator/fan53200.c | 519 +++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 532 insertions(+) + create mode 100644 drivers/regulator/fan53200.c + +diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig +index 5cfe3cf..38cbba4 100644 +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -583,6 +583,7 @@ CONFIG_REGULATOR_AXP20X=y + CONFIG_REGULATOR_BD718XX=y + CONFIG_REGULATOR_BD9571MWV=y + CONFIG_REGULATOR_FAN53555=y ++CONFIG_REGULATOR_FAN53200=y + CONFIG_REGULATOR_GPIO=y + CONFIG_REGULATOR_HI6421V530=y + CONFIG_REGULATOR_HI655X=y +diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig +index 020a00d..4ec41c5 100644 +--- a/drivers/regulator/Kconfig ++++ b/drivers/regulator/Kconfig +@@ -356,6 +356,17 @@ config REGULATOR_FAN53880 + (PMIC), it is controlled by I2C and provides one BUCK, one BOOST + and four LDO outputs. + ++config REGULATOR_FAN53200 ++ tristate "Fairchild FAN53200 Regulator" ++ depends on I2C ++ select REGMAP_I2C ++ help ++ This driver supports Fairchild FAN53200 Digitally Programmable ++ TinyBuck Regulator. The FAN53200 is a step-down switching voltage ++ regulator that delivers a digitally programmable output from an ++ input voltage supply of 2.5V to 5.5V. The output voltage is ++ programmed through an I2C interface. ++ + config REGULATOR_GPIO + tristate "GPIO regulator support" + depends on GPIOLIB || COMPILE_TEST +diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile +index 6ebae51..9d6ea41 100644 +--- a/drivers/regulator/Makefile ++++ b/drivers/regulator/Makefile +@@ -44,6 +44,7 @@ obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o + obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o + obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o + obj-$(CONFIG_REGULATOR_FAN53880) += fan53880.o ++obj-$(CONFIG_REGULATOR_FAN53555) += fan53200.o + obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o + obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o + obj-$(CONFIG_REGULATOR_HI6421V530) += hi6421v530-regulator.o +diff --git a/drivers/regulator/fan53200.c b/drivers/regulator/fan53200.c +new file mode 100644 +index 0000000..e40570b +--- /dev/null ++++ b/drivers/regulator/fan53200.c +@@ -0,0 +1,519 @@ ++/* ++ * FAN53200 Fairchild Digitally Programmable TinyBuck Regulator Driver. ++ * ++ * Supported Part Numbers: ++ * FAN53200UC35X/44X ++ * ++ * Copyright (c) 2021 ASUSTeK Computer Inc. ++ * Rock Shen ++ * ++ * This package is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Voltage setting */ ++#define FAN53200_VSEL0 0x00 ++#define FAN53200_VSEL1 0x01 ++ ++/* Control register */ ++#define FAN53200_CONTROL 0x02 ++/* IC Type */ ++#define FAN53200_ID1 0x03 ++/* IC mask version */ ++#define FAN53200_ID2 0x04 ++ ++/* VSEL bit definitions */ ++#define VSEL_BUCK_EN (1 << 7) ++#define VSEL_MODE (1 << 6) ++#define VSEL_NSEL_MASK 0x3F ++/* Chip ID and Verison */ ++#define DIE_ID 0x0F /* ID1 */ ++#define DIE_REV 0x0F /* ID2 */ ++/* Control bit definitions */ ++#define CTL_OUTPUT_DISCHG (1 << 7) ++#define CTL_SLEW_MASK (0x7 << 4) ++#define CTL_SLEW_SHIFT 4 ++#define CTL_RESET (1 << 2) ++ ++#define TCS_VSEL_NSEL_MASK 0x7f ++#define TCS_VSEL0_MODE (1 << 7) ++#define TCS_VSEL1_MODE (1 << 6) ++ ++#define TCS_SLEW_SHIFT 3 ++#define TCS_SLEW_MASK (0x3 < 3) ++ ++#define FAN53200_NVOLTAGES 64 /* Numbers of voltages */ ++ ++enum fan53200_vendor { ++ FAN53200_VENDOR_FAIRCHILD = 0, ++}; ++ ++/* VSEL ID */ ++enum { ++ FAN53200_VSEL_ID_0 = 0, ++ FAN53200_VSEL_ID_1, ++}; ++ ++enum { ++ FAN53200_CHIP_ID_00 = 0x8001, ++ FAN53200_CHIP_ID_01 = 0x8101, ++}; ++ ++struct fan53200_platform_data { ++ struct regulator_init_data *regulator; ++ unsigned int slew_rate; ++ /* Sleep VSEL ID */ ++ unsigned int sleep_vsel_id; ++ struct gpio_desc *vsel_gpio; ++}; ++ ++struct fan53200_device_info { ++ enum fan53200_vendor vendor; ++ struct regmap *regmap; ++ struct device *dev; ++ struct regulator_desc desc; ++ struct regulator_dev *rdev; ++ struct regulator_init_data *regulator; ++ /* IC Type and Rev */ ++ int chip_id; ++ int chip_rev; ++ /* Voltage setting register */ ++ unsigned int vol_reg; ++ unsigned int sleep_reg; ++ unsigned int mode_reg; ++ unsigned int vol_mask; ++ unsigned int mode_mask; ++ unsigned int slew_reg; ++ unsigned int slew_mask; ++ unsigned int slew_shift; ++ /* Voltage range and step(linear) */ ++ unsigned int vsel_min; ++ unsigned int vsel_step; ++ unsigned int n_voltages; ++ /* Voltage slew rate limiting */ ++ unsigned int slew_rate; ++ /* Sleep voltage cache */ ++ unsigned int sleep_vol_cache; ++ struct gpio_desc *vsel_gpio; ++ unsigned int sleep_vsel_id; ++}; ++ ++static unsigned int fan53200_map_mode(unsigned int mode) ++{ ++ return mode == REGULATOR_MODE_FAST ? ++ REGULATOR_MODE_FAST : REGULATOR_MODE_NORMAL; ++} ++ ++static int fan53200_set_suspend_voltage(struct regulator_dev *rdev, int uV) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ int ret; ++ ++ if (di->sleep_vol_cache == uV) ++ return 0; ++ ret = regulator_map_voltage_linear(rdev, uV, uV); ++ if (ret < 0) ++ return ret; ++ ret = regmap_update_bits(di->regmap, di->sleep_reg, ++ di->vol_mask, ret); ++ if (ret < 0) ++ return ret; ++ /* Cache the sleep voltage setting. ++ * Might not be the real voltage which is rounded */ ++ di->sleep_vol_cache = uV; ++ ++ return 0; ++} ++ ++static int fan53200_set_suspend_enable(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ ++ return regmap_update_bits(di->regmap, di->sleep_reg, ++ VSEL_BUCK_EN, VSEL_BUCK_EN); ++} ++ ++static int fan53200_set_suspend_disable(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ ++ return regmap_update_bits(di->regmap, di->sleep_reg, ++ VSEL_BUCK_EN, 0); ++} ++ ++static int fan53200_set_enable(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ ++ if (di->vsel_gpio) { ++ gpiod_set_raw_value(di->vsel_gpio, !di->sleep_vsel_id); ++ return 0; ++ } ++ ++ return regmap_update_bits(di->regmap, di->vol_reg, ++ VSEL_BUCK_EN, VSEL_BUCK_EN); ++} ++ ++static int fan53200_set_disable(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ ++ if (di->vsel_gpio) { ++ gpiod_set_raw_value(di->vsel_gpio, di->sleep_vsel_id); ++ return 0; ++ } ++ ++ return regmap_update_bits(di->regmap, di->vol_reg, ++ VSEL_BUCK_EN, 0); ++} ++ ++static int fan53200_is_enabled(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ unsigned int val; ++ int ret = 0; ++ ++ if (di->vsel_gpio) { ++ if (di->sleep_vsel_id) ++ return !gpiod_get_raw_value(di->vsel_gpio); ++ else ++ return gpiod_get_raw_value(di->vsel_gpio); ++ } ++ ++ ret = regmap_read(di->regmap, di->vol_reg, &val); ++ if (ret < 0) ++ return ret; ++ if (val & VSEL_BUCK_EN) ++ return 1; ++ else ++ return 0; ++} ++ ++static int fan53200_set_mode(struct regulator_dev *rdev, unsigned int mode) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ ++ switch (mode) { ++ case REGULATOR_MODE_FAST: ++ regmap_update_bits(di->regmap, di->mode_reg, ++ di->mode_mask, di->mode_mask); ++ break; ++ case REGULATOR_MODE_NORMAL: ++ regmap_update_bits(di->regmap, di->mode_reg, di->mode_mask, 0); ++ break; ++ default: ++ return -EINVAL; ++ } ++ return 0; ++} ++ ++static unsigned int fan53200_get_mode(struct regulator_dev *rdev) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ unsigned int val; ++ int ret = 0; ++ ++ ret = regmap_read(di->regmap, di->mode_reg, &val); ++ if (ret < 0) ++ return ret; ++ if (val & di->mode_mask) ++ return REGULATOR_MODE_FAST; ++ else ++ return REGULATOR_MODE_NORMAL; ++} ++ ++static const int slew_rates[] = { ++ 80000, ++ 40000, ++ 20000, ++ 10000, ++ 5000, ++ 2500, ++ 1250, ++ 625, ++}; ++ ++static int fan53200_set_ramp(struct regulator_dev *rdev, int ramp) ++{ ++ struct fan53200_device_info *di = rdev_get_drvdata(rdev); ++ int regval = -1, i; ++ ++ for (i = 0; i < ARRAY_SIZE(slew_rates); i++) { ++ if (ramp <= slew_rates[i]) ++ regval = i; ++ else ++ break; ++ } ++ ++ if (regval < 0) { ++ dev_err(di->dev, "unsupported ramp value %d\n", ramp); ++ return -EINVAL; ++ } ++ ++ return regmap_update_bits(di->regmap, di->slew_reg, ++ di->slew_mask, regval << di->slew_shift); ++} ++ ++static struct regulator_ops fan53200_regulator_ops = { ++ .set_voltage_sel = regulator_set_voltage_sel_regmap, ++ .get_voltage_sel = regulator_get_voltage_sel_regmap, ++ .set_voltage_time_sel = regulator_set_voltage_time_sel, ++ .map_voltage = regulator_map_voltage_linear, ++ .list_voltage = regulator_list_voltage_linear, ++ .set_suspend_voltage = fan53200_set_suspend_voltage, ++ .enable = fan53200_set_enable, ++ .disable = fan53200_set_disable, ++ .is_enabled = fan53200_is_enabled, ++ .set_mode = fan53200_set_mode, ++ .get_mode = fan53200_get_mode, ++ .set_ramp_delay = fan53200_set_ramp, ++ .set_suspend_enable = fan53200_set_suspend_enable, ++ .set_suspend_disable = fan53200_set_suspend_disable, ++}; ++ ++static int fan53200_voltages_setup_fairchild(struct fan53200_device_info *di) ++{ ++ ++ if (di->sleep_vsel_id) { ++ di->sleep_reg = FAN53200_VSEL0; ++ di->vol_reg = FAN53200_VSEL1; ++ } else { ++ di->sleep_reg = FAN53200_VSEL1; ++ di->vol_reg = FAN53200_VSEL0; ++ } ++ ++ /* Init voltage range and step */ ++ di->vsel_min = 600000; ++ di->vsel_step = 12500; ++ di->vol_mask = VSEL_NSEL_MASK; ++ di->mode_reg = di->vol_reg; ++ di->mode_mask = VSEL_MODE; ++ di->slew_reg = FAN53200_CONTROL; ++ di->slew_mask = CTL_SLEW_MASK; ++ di->slew_shift = CTL_SLEW_SHIFT; ++ di->n_voltages = FAN53200_NVOLTAGES; ++ ++ return 0; ++} ++ ++/* For 00,01,03,05 options: ++ * VOUT = 0.60V + NSELx * 10mV, from 0.60 to 1.23V. ++ * For 04 option: ++ * VOUT = 0.603V + NSELx * 12.826mV, from 0.603 to 1.411V. ++ * */ ++static int fan53200_device_setup(struct fan53200_device_info *di, ++ struct fan53200_platform_data *pdata) ++{ ++ int ret = 0; ++ ++ ret = fan53200_voltages_setup_fairchild(di); ++ ++ return ret; ++} ++ ++static int fan53200_regulator_register(struct fan53200_device_info *di, ++ struct regulator_config *config) ++{ ++ struct regulator_desc *rdesc = &di->desc; ++ ++ rdesc->name = "fan53200-reg"; ++ rdesc->supply_name = "vin"; ++ rdesc->ops = &fan53200_regulator_ops; ++ rdesc->type = REGULATOR_VOLTAGE; ++ rdesc->n_voltages = di->n_voltages; ++ rdesc->enable_reg = di->vol_reg; ++ rdesc->enable_mask = VSEL_BUCK_EN; ++ rdesc->min_uV = di->vsel_min; ++ rdesc->uV_step = di->vsel_step; ++ rdesc->vsel_reg = di->vol_reg; ++ rdesc->vsel_mask = di->vol_mask; ++ rdesc->owner = THIS_MODULE; ++ rdesc->enable_time = 400; ++ ++ di->rdev = devm_regulator_register(di->dev, &di->desc, config); ++ return PTR_ERR_OR_ZERO(di->rdev); ++} ++ ++static const struct regmap_config fan53200_regmap_config = { ++ .reg_bits = 8, ++ .val_bits = 8, ++}; ++ ++static struct fan53200_platform_data *fan53200_parse_dt(struct device *dev, ++ struct device_node *np, ++ const struct regulator_desc *desc) ++{ ++ struct fan53200_platform_data *pdata; ++ int ret, flag; ++ u32 tmp; ++ ++ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); ++ if (!pdata) ++ return NULL; ++ ++ pdata->regulator = of_get_regulator_init_data(dev, np, desc); ++ pdata->regulator->constraints.initial_state = PM_SUSPEND_MEM; ++ ++ ret = of_property_read_u32(np, "fcs,suspend-voltage-selector", ++ &tmp); ++ if (!ret) ++ pdata->sleep_vsel_id = tmp; ++ ++ if (pdata->sleep_vsel_id) ++ flag = GPIOD_OUT_LOW; ++ else ++ flag = GPIOD_OUT_HIGH; ++ ++ pdata->vsel_gpio = ++ devm_gpiod_get_index_optional(dev, "vsel", 0, ++ flag); ++ if (IS_ERR(pdata->vsel_gpio)) { ++ ret = PTR_ERR(pdata->vsel_gpio); ++ dev_err(dev, "failed to get vesl gpio (%d)\n", ret); ++ } ++ ++ return pdata; ++} ++ ++static const struct of_device_id fan53200_dt_ids[] = { ++ { ++ .compatible = "fcs,fan53200", ++ .data = (void *)FAN53200_VENDOR_FAIRCHILD, ++ }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, fan53200_dt_ids); ++ ++static int fan53200_regulator_probe(struct i2c_client *client, ++ const struct i2c_device_id *id) ++{ ++ struct device_node *np = client->dev.of_node; ++ struct fan53200_device_info *di; ++ struct fan53200_platform_data *pdata; ++ struct regulator_config config = { }; ++ unsigned int val; ++ int ret; ++ ++ di = devm_kzalloc(&client->dev, sizeof(struct fan53200_device_info), ++ GFP_KERNEL); ++ if (!di) ++ return -ENOMEM; ++ ++ di->desc.of_map_mode = fan53200_map_mode; ++ ++ pdata = dev_get_platdata(&client->dev); ++ if (!pdata) ++ pdata = fan53200_parse_dt(&client->dev, np, &di->desc); ++ ++ if (!pdata || !pdata->regulator) { ++ dev_err(&client->dev, "Platform data not found!\n"); ++ return -ENODEV; ++ } ++ ++ di->vsel_gpio = pdata->vsel_gpio; ++ di->sleep_vsel_id = pdata->sleep_vsel_id; ++ ++ di->regulator = pdata->regulator; ++ if (client->dev.of_node) { ++ const struct of_device_id *match; ++ ++ match = of_match_device(of_match_ptr(fan53200_dt_ids), ++ &client->dev); ++ if (!match) ++ return -ENODEV; ++ ++ di->vendor = (unsigned long) match->data; ++ } else { ++ /* if no ramp constraint set, get the pdata ramp_delay */ ++ if (!di->regulator->constraints.ramp_delay) { ++ int slew_idx = (pdata->slew_rate & 0x7) ++ ? pdata->slew_rate : 0; ++ ++ di->regulator->constraints.ramp_delay ++ = slew_rates[slew_idx]; ++ } ++ ++ di->vendor = id->driver_data; ++ } ++ ++ di->regmap = devm_regmap_init_i2c(client, &fan53200_regmap_config); ++ if (IS_ERR(di->regmap)) { ++ dev_err(&client->dev, "Failed to allocate regmap!\n"); ++ return PTR_ERR(di->regmap); ++ } ++ di->dev = &client->dev; ++ i2c_set_clientdata(client, di); ++ /* Get chip ID */ ++ ret = regmap_read(di->regmap, FAN53200_ID1, &val); ++ if (ret < 0) { ++ dev_err(&client->dev, "Failed to get chip ID!\n"); ++ return ret; ++ } ++ di->chip_id = val & DIE_ID; ++ /* Get chip revision */ ++ ret = regmap_read(di->regmap, FAN53200_ID2, &val); ++ if (ret < 0) { ++ dev_err(&client->dev, "Failed to get chip Rev!\n"); ++ return ret; ++ } ++ di->chip_rev = val & DIE_REV; ++ dev_info(&client->dev, "FAN53200 Option[%d] Rev[%d] Detected!\n", ++ di->chip_id, di->chip_rev); ++ /* Device init */ ++ ret = fan53200_device_setup(di, pdata); ++ if (ret < 0) { ++ dev_err(&client->dev, "Failed to setup device!\n"); ++ return ret; ++ } ++ /* Register regulator */ ++ config.dev = di->dev; ++ config.init_data = di->regulator; ++ config.regmap = di->regmap; ++ config.driver_data = di; ++ config.of_node = np; ++ ++ ret = fan53200_regulator_register(di, &config); ++ if (ret < 0) ++ dev_err(&client->dev, "Failed to register regulator!\n"); ++ return ret; ++ ++} ++ ++static const struct i2c_device_id fan53200_id[] = { ++ { ++ .name = "fan53200", ++ .driver_data = FAN53200_VENDOR_FAIRCHILD ++ }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(i2c, fan53200_id); ++ ++static struct i2c_driver fan53200_regulator_driver = { ++ .driver = { ++ .name = "fan53200-regulator", ++ .of_match_table = of_match_ptr(fan53200_dt_ids), ++ }, ++ .probe = fan53200_regulator_probe, ++ .id_table = fan53200_id, ++}; ++ ++module_i2c_driver(fan53200_regulator_driver); ++ ++MODULE_AUTHOR("Rock Shen "); ++MODULE_DESCRIPTION("FAN53200 regulator driver"); ++MODULE_LICENSE("GPL v2"); +-- +2.7.4 + + diff --git a/patch/u-boot/u-boot-rockchip64-mainline/add-board-tinker-board-2.patch b/patch/u-boot/u-boot-rockchip64-mainline/add-board-tinker-board-2.patch new file mode 100644 index 0000000000..9d2472ff89 --- /dev/null +++ b/patch/u-boot/u-boot-rockchip64-mainline/add-board-tinker-board-2.patch @@ -0,0 +1,897 @@ +From 967e0da33c720f06e59473680e2ba08eb9fa769d Mon Sep 17 00:00:00 2001 +From: tonymac32 +Date: Tue, 2 Mar 2021 15:49:01 -0500 +Subject: [PATCH] Patching something + +Signed-off-by: tonymac32 +--- + arch/arm/dts/Makefile | 1 + + arch/arm/dts/rk3399-tinker-2-u-boot.dtsi | 60 ++ + arch/arm/dts/rk3399-tinker-2.dts | 511 ++++++++++++++++++ + arch/arm/mach-rockchip/rk3399/Kconfig | 8 +- + board/rockchip/tinker-2_rk3399/Kconfig | 15 + + board/rockchip/tinker-2_rk3399/Makefile | 7 + + .../tinker-2_rk3399/tinker-2-rk3399.c | 56 ++ + configs/tinker-2-rk3399_defconfig | 79 +++ + drivers/power/pmic/fan53555.c | 1 + + drivers/power/regulator/fan53555.c | 2 + + include/configs/tinker-2_rk3399.h | 22 + + include/power/fan53555.h | 1 + + 14 files changed, 767 insertions(+), 3 deletions(-) + create mode 100644 arch/arm/dts/rk3399-tinker-2-u-boot.dtsi + create mode 100644 arch/arm/dts/rk3399-tinker-2.dts + create mode 100644 board/rockchip/tinker-2_rk3399/Kconfig + create mode 100644 board/rockchip/tinker-2_rk3399/Makefile + create mode 100644 board/rockchip/tinker-2_rk3399/tinker-2-rk3399.c + create mode 100644 configs/tinker-2-rk3399_defconfig + create mode 100644 include/configs/tinker-2_rk3399.h + +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index 06ccc03e..2919b8b2 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -145,6 +145,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ + rk3399-rock-pi-4c.dtb \ + rk3399-rock960.dtb \ + rk3399-rockpro64.dtb \ ++ rk3399-tinker-2.dtb \ + rk3399pro-rock-pi-n10.dtb + + dtb-$(CONFIG_ROCKCHIP_RV1108) += \ +diff --git a/arch/arm/dts/rk3399-tinker-2-u-boot.dtsi b/arch/arm/dts/rk3399-tinker-2-u-boot.dtsi +new file mode 100644 +index 00000000..02a8f9f5 +--- /dev/null ++++ b/arch/arm/dts/rk3399-tinker-2-u-boot.dtsi +@@ -0,0 +1,60 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2021 Thomas McKahan ++ */ ++ ++#include "rk3399-u-boot.dtsi" ++#include "rk3399-sdram-lpddr4-100.dtsi" ++ ++/ { ++ chosen { ++ u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc ; ++ }; ++}; ++ ++ ++ ++&i2c0 { ++ u-boot,dm-pre-reloc; ++}; ++ ++&i2c2 { ++ u-boot,dm-pre-reloc; ++ ++}; ++ ++&rk808 { ++ u-boot,dm-pre-reloc; ++}; ++ ++&rng { ++ status = "okay"; ++}; ++ ++&sdhci { ++ max-frequency = <25000000>; ++ u-boot,dm-pre-reloc; ++}; ++ ++&sdmmc { ++ max-frequency = <20000000>; ++ u-boot,dm-pre-reloc; ++}; ++ ++&usbdrd3_1 { ++ status = "okay"; ++}; ++ ++&usbdrd_dwc3_1 { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ ++&vdd_center { ++ regulator-min-microvolt = <950000>; ++ regulator-max-microvolt = <950000>; ++}; ++ ++&vdd_log { ++ regulator-init-microvolt = <950000>; ++}; +diff --git a/arch/arm/dts/rk3399-tinker-2.dts b/arch/arm/dts/rk3399-tinker-2.dts +new file mode 100644 +index 00000000..7372f25a +--- /dev/null ++++ b/arch/arm/dts/rk3399-tinker-2.dts +@@ -0,0 +1,511 @@ ++// SPDX-License-Identifier: (GPL-2.0+ OR MIT) ++/* ++ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd ++ */ ++ ++/dts-v1/; ++#include ++#include "rk3399.dtsi" ++#include "rk3399-op1-opp.dtsi" ++ ++/ { ++ model = "Asus Tinker Board 2"; ++ compatible = "rockchip,rk3399-evb", "rockchip,rk3399"; ++ ++ chosen { ++ stdout-path = "serial2:1500000n8"; ++ }; ++ ++ clkin_gmac: external-gmac-clock { ++ compatible = "fixed-clock"; ++ clock-frequency = <125000000>; ++ clock-output-names = "clkin_gmac"; ++ #clock-cells = <0>; ++ }; ++ ++ vcc3v3_sys: vcc3v3-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ vcc5v0_host: vcc5v0-host-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vcc5v0_host_en>; ++ regulator-name = "vcc5v0_host"; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ ++ vcc5v0_sys: vcc5v0-sys { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc5v0_sys"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ }; ++ ++ vcc_phy: vcc-phy-regulator { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc_phy"; ++ regulator-always-on; ++ regulator-boot-on; ++ }; ++ ++ vdd_log: vdd-log { ++ compatible = "pwm-regulator"; ++ pwms = <&pwm2 0 25000 1>; ++ regulator-name = "vdd_log"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1400000>; ++ regulator-always-on; ++ regulator-boot-on; ++ ++ /* for rockchip boot on */ ++ rockchip,pwm_id= <2>; ++ rockchip,pwm_voltage = <900000>; ++ }; ++ ++ xin32k: xin32k { ++ compatible = "fixed-clock"; ++ clock-frequency = <32768>; ++ clock-output-names = "xin32k"; ++ #clock-cells = <0>; ++ }; ++}; ++ ++&cpu_l0 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l1 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l2 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_l3 { ++ cpu-supply = <&vdd_cpu_l>; ++}; ++ ++&cpu_b0 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&cpu_b1 { ++ cpu-supply = <&vdd_cpu_b>; ++}; ++ ++&emmc_phy { ++ status = "okay"; ++}; ++ ++&gmac { ++ assigned-clocks = <&cru SCLK_RMII_SRC>; ++ assigned-clock-parents = <&clkin_gmac>; ++ clock_in_out = "input"; ++ phy-supply = <&vcc_phy>; ++ phy-mode = "rgmii"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rgmii_pins>; ++ snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; ++ snps,reset-active-low; ++ snps,reset-delays-us = <0 16000 72000>; ++ tx_delay = <0x25>; ++ rx_delay = <0x20>; ++ wakeup-enable = "0"; ++ status = "okay"; ++}; ++ ++&i2c0 { ++ status = "okay"; ++ ++ rk808: pmic@1b { ++ compatible = "rockchip,rk808"; ++ reg = <0x1b>; ++ interrupt-parent = <&gpio1>; ++ interrupts = <18 IRQ_TYPE_LEVEL_LOW>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pmic_int_l>; ++ rockchip,system-power-controller; ++ wakeup-source; ++ #clock-cells = <1>; ++ clock-output-names = "rk808-clkout1", "rk808-clkout2"; ++ ++ vcc1-supply = <&vcc3v3_sys>; ++ vcc2-supply = <&vcc3v3_sys>; ++ vcc3-supply = <&vcc3v3_sys>; ++ vcc4-supply = <&vcc3v3_sys>; ++ vcc6-supply = <&vcc3v3_sys>; ++ vcc7-supply = <&vcc3v3_sys>; ++ vcc8-supply = <&vcc3v3_sys>; ++ vcc9-supply = <&vcc3v3_sys>; ++ vcc10-supply = <&vcc3v3_sys>; ++ vcc11-supply = <&vcc3v3_sys>; ++ vcc12-supply = <&vcc3v3_sys>; ++ vddio-supply = <&vcc1v8_pmu>; ++ ++ regulators { ++ vdd_center: DCDC_REG1 { ++ regulator-name = "vdd_center"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <900000>; ++ }; ++ }; ++ ++ vdd_cpu_l: DCDC_REG2 { ++ regulator-name = "vdd_cpu_l"; ++ regulator-min-microvolt = <750000>; ++ regulator-max-microvolt = <1350000>; ++ regulator-ramp-delay = <6001>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_ddr: DCDC_REG3 { ++ regulator-name = "vcc_ddr"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc_1v8: DCDC_REG4 { ++ regulator-name = "vcc_1v8"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vcc3v3_dsi: LDO_REG1 { ++ regulator-name = "vcc3v3_dsi"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcca1v8_hdmi: LDO_REG2 { ++ regulator-name = "vcca1v8_hdmi"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc1v8_pmu: LDO_REG3 { ++ regulator-name = "vcc1v8_pmu"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1800000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1800000>; ++ }; ++ }; ++ ++ vccio_sd: LDO_REG4 { ++ regulator-name = "vccio_sd"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_csi: LDO_REG5 { ++ regulator-name = "vcc3v3_csi"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_1v5: LDO_REG6 { ++ regulator-name = "vcc_1v5"; ++ regulator-min-microvolt = <1500000>; ++ regulator-max-microvolt = <1500000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <1500000>; ++ }; ++ }; ++ ++ vcca0v9_hdmi: LDO_REG7 { ++ regulator-name = "vcca0v9_hdmi"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <900000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ ++ vcc_3v0: LDO_REG8 { ++ regulator-name = "vcc_3v0"; ++ regulator-min-microvolt = <3000000>; ++ regulator-max-microvolt = <3000000>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ regulator-suspend-microvolt = <3000000>; ++ }; ++ }; ++ ++ vcc3v3_s3: SWITCH_REG1 { ++ regulator-name = "vcc3v3_s3"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-on-in-suspend; ++ }; ++ }; ++ ++ vcc3v3_s0: SWITCH_REG2 { ++ regulator-name = "vcc3v3_s0"; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++ }; ++ }; ++ ++ vdd_cpu_b: vdd_cpu_b { ++ compatible = "fcs,fan53200"; ++ reg = <0x60>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-regulator"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel1_gpio>; ++ vsel-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_cpu_b"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1250000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ status = "okay"; ++ ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++&i2c4 { ++ ++ status = "okay"; ++ i2c-scl-rising-time-ns = <475>; ++ i2c-scl-falling-time-ns = <26>; ++ fusb0: fusb30x@22 { ++ compatible = "fairchild,fusb302"; ++ reg = <0x22>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&fusb0_int>; ++ int-n-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; ++ //vbus-5v-gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; ++ status = "okay"; ++ }; ++ ++ vdd_gpu: vdd_gpu { ++ compatible = "fcs,fan53200"; ++ reg = <0x60>; ++ vin-supply = <&vcc5v0_sys>; ++ regulator-compatible = "fan53555-regulator"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vsel2_gpio>; ++ vsel-gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>; ++ regulator-name = "vdd_gpu"; ++ regulator-min-microvolt = <800000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-ramp-delay = <1000>; ++ fcs,suspend-voltage-selector = <1>; ++ regulator-always-on; ++ regulator-boot-on; ++ status = "okay"; ++ ++ regulator-initial-state = <3>; ++ regulator-state-mem { ++ regulator-off-in-suspend; ++ }; ++ }; ++}; ++ ++&pcie_phy { ++ status = "disabled"; ++}; ++ ++&pcie0 { ++ ep-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>; ++ num-lanes = <4>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie_clkreqn_cpm>; ++ status = "disabled"; ++}; ++ ++&pwm0 { ++ status = "disabled"; ++}; ++ ++&pwm2 { ++ status = "okay"; ++ pinctrl-names = "active"; ++ pinctrl-0 = <&pwm2_pin_pull_down>; ++}; ++ ++&pwm3 { ++ status = "disabled"; ++}; ++ ++&saradc { ++ status = "okay"; ++}; ++ ++&sdhci { ++ bus-width = <8>; ++ mmc-hs400-1_8v; ++ supports-emmc; ++ mmc-hs400-enhanced-strobe; ++ non-removable; ++ keep-power-in-suspend; ++ status = "okay"; ++}; ++ ++&sdmmc { ++ clock-frequency = <150000000>; ++ clock-freq-min-max = <100000 150000000>; ++ supports-sd; ++ bus-width = <4>; ++ cap-mmc-highspeed; ++ cap-sd-highspeed; ++ disable-wp; ++ num-slots = <1>; ++ //sd-uhs-sdr104; ++ vmmc-supply = <&vcc3v3_s3>; ++ vqmmc-supply = <&vccio_sd>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>; ++ status = "okay"; ++}; ++ ++&u2phy0 { ++ status = "okay"; ++}; ++ ++&u2phy0_host { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_host { ++ phy-supply = <&vcc5v0_host>; ++ status = "okay"; ++}; ++ ++&uart2 { ++ status = "okay"; ++}; ++ ++&usb_host0_ehci { ++ status = "okay"; ++}; ++ ++&usb_host0_ohci { ++ status = "okay"; ++}; ++ ++&usb_host1_ehci { ++ status = "okay"; ++}; ++ ++&usb_host1_ohci { ++ status = "okay"; ++}; ++ ++&pinctrl { ++ ++ pmic { ++ pmic_int_l: pmic-int-l { ++ rockchip,pins = ++ <1 18 RK_FUNC_GPIO &pcfg_pull_up>, ++ <0 9 RK_FUNC_GPIO &pcfg_pull_none>; /* GPIO0_B1 */ ++ }; ++ vsel1_gpio: vsel1-gpio { ++ rockchip,pins = ++ <1 17 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ vsel2_gpio: vsel2-gpio { ++ rockchip,pins = ++ <1 14 RK_FUNC_GPIO &pcfg_pull_down>; ++ }; ++ }; ++ ++ usb2 { ++ vcc5v0_host_en: vcc5v0-host-en { ++ rockchip,pins = ++ <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ }; ++ ++ fusb30x { ++ fusb0_int: fusb0-int { ++ rockchip,pins = <1 2 RK_FUNC_GPIO &pcfg_pull_up>; ++ }; ++ }; ++}; ++ ++&vopb { ++ status = "okay"; ++}; ++ ++&vopb_mmu { ++ status = "okay"; ++}; +diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig +index 7890bafe..8215116e 100644 +--- a/arch/arm/mach-rockchip/rk3399/Kconfig ++++ b/arch/arm/mach-rockchip/rk3399/Kconfig +@@ -105,7 +105,12 @@ config TARGET_ROCKPRO64_RK3399 + * USB Type C power and data + * GPIO expansion ports + * DC 12V/2A +- ++ ++config TARGET_TINKER-2_RK3399 ++ bool "Asus Tinker Board 2" ++ help ++ Tinker Board 2 ++ + config TARGET_ROC_PC_RK3399 + bool "Firefly ROC-RK3399-PC board" + help +@@ -175,5 +180,6 @@ source "board/pine64/rockpro64_rk3399/Kconfig" + source "board/rockchip/evb_rk3399/Kconfig" + source "board/theobroma-systems/puma_rk3399/Kconfig" + source "board/vamrs/rock960_rk3399/Kconfig" ++source "board/rockchip/tinker-2_rk3399/Kconfig" + + endif +diff --git a/board/rockchip/tinker-2_rk3399/Kconfig b/board/rockchip/tinker-2_rk3399/Kconfig +new file mode 100644 +index 00000000..ce5d8b18 +--- /dev/null ++++ b/board/rockchip/tinker-2_rk3399/Kconfig +@@ -0,0 +1,15 @@ ++if TARGET_TINKER-2_RK3399 ++ ++config SYS_BOARD ++ default "tinker-2_rk3399" ++ ++config SYS_VENDOR ++ default "rockchip" ++ ++config SYS_CONFIG_NAME ++ default "tinker-2_rk3399" ++ ++config BOARD_SPECIFIC_OPTIONS # dummy ++ def_bool y ++ ++endif +diff --git a/board/rockchip/tinker-2_rk3399/Makefile b/board/rockchip/tinker-2_rk3399/Makefile +new file mode 100644 +index 00000000..21218f2a +--- /dev/null ++++ b/board/rockchip/tinker-2_rk3399/Makefile +@@ -0,0 +1,7 @@ ++# ++# (C) Copyright 2019 Vasily Khoruzhick ++# ++# SPDX-License-Identifier: GPL-2.0+ ++# ++ ++obj-y += tinker-2-rk3399.o +diff --git a/board/rockchip/tinker-2_rk3399/tinker-2-rk3399.c b/board/rockchip/tinker-2_rk3399/tinker-2-rk3399.c +new file mode 100644 +index 00000000..d7908461 +--- /dev/null ++++ b/board/rockchip/tinker-2_rk3399/tinker-2-rk3399.c +@@ -0,0 +1,56 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (C) Copyright 2019 Vasily Khoruzhick ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define GRF_IO_VSEL_BT565_SHIFT 0 ++#define PMUGRF_CON0_VSEL_SHIFT 8 ++ ++#ifdef CONFIG_MISC_INIT_R ++static void setup_iodomain(void) ++{ ++ struct rk3399_grf_regs *grf = ++ syscon_get_first_range(ROCKCHIP_SYSCON_GRF); ++ struct rk3399_pmugrf_regs *pmugrf = ++ syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); ++ ++ /* BT565 is in 1.8v domain */ ++ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); ++ ++ /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ ++ rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); ++} ++ ++int misc_init_r(void) ++{ ++ const u32 cpuid_offset = 0x7; ++ const u32 cpuid_length = 0x10; ++ u8 cpuid[cpuid_length]; ++ int ret; ++ ++ setup_iodomain(); ++ ++ ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid); ++ if (ret) ++ return ret; ++ ++ ret = rockchip_cpuid_set(cpuid, cpuid_length); ++ if (ret) ++ return ret; ++ ++ ret = rockchip_setup_macaddr(); ++ ++ return ret; ++} ++ ++#endif +diff --git a/configs/tinker-2-rk3399_defconfig b/configs/tinker-2-rk3399_defconfig +new file mode 100644 +index 00000000..de9c2692 +--- /dev/null ++++ b/configs/tinker-2-rk3399_defconfig +@@ -0,0 +1,79 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_ROCKCHIP=y ++CONFIG_SYS_TEXT_BASE=0x00200000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x8000 ++CONFIG_ENV_OFFSET=0x3F8000 ++CONFIG_ROCKCHIP_RK3399=y ++CONFIG_TARGET_TINKER-2_RK3399=y ++CONFIG_DEBUG_UART_BASE=0xFF1A0000 ++CONFIG_DEBUG_UART_CLOCK=24000000 ++ ++CONFIG_DEFAULT_DEVICE_TREE="rk3399-tinker-2" ++CONFIG_DEBUG_UART=y ++CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-tinker-2.dtb" ++CONFIG_MISC_INIT_R=y ++CONFIG_DISPLAY_BOARDINFO_LATE=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 ++ ++CONFIG_TPL=y ++CONFIG_CMD_BOOTZ=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PCI=y ++CONFIG_CMD_USB=y ++CONFIG_LED=y ++CONFIG_LED_GPIO=y ++CONFIG_CMD_LED=y ++CONFIG_CMD_ROCKUSB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_TIME=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_MMC_SDHCI=y ++CONFIG_MMC_SDHCI_ROCKCHIP=y ++CONFIG_DM_ETH=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PHY_ROCKCHIP_INNO_USB2=y ++CONFIG_PHY_ROCKCHIP_TYPEC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_REGULATOR_PWM=y ++CONFIG_DM_PMIC_FAN53555=y ++CONFIG_REGULATOR_RK8XX=y ++CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM_RK3399_LPDDR4=y ++CONFIG_DM_RESET=y ++CONFIG_BAUDRATE=1500000 ++CONFIG_DEBUG_UART_SHIFT=2 ++CONFIG_SYSRESET=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_OHCI_HCD=y ++CONFIG_USB_OHCI_GENERIC=y ++CONFIG_USB_DWC3=y ++CONFIG_USB_DWC3_GENERIC=y ++CONFIG_USB_HOST_ETHER=y ++CONFIG_USB_ETHER_ASIX=y ++CONFIG_USB_ETHER_ASIX88179=y ++CONFIG_USB_ETHER_MCS7830=y ++CONFIG_USB_ETHER_RTL8152=y ++CONFIG_USB_ETHER_SMSC95XX=y ++CONFIG_DM_VIDEO=y ++# CONFIG_VIDEO_BPP8 is not set ++CONFIG_DISPLAY=y ++CONFIG_VIDEO_ROCKCHIP=y ++CONFIG_DISPLAY_ROCKCHIP_HDMI=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_ERRNO_STR=y +diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c +index 4d1e686d..8fba05ff 100644 +--- a/drivers/power/pmic/fan53555.c ++++ b/drivers/power/pmic/fan53555.c +@@ -73,6 +73,7 @@ static struct dm_pmic_ops pmic_fan53555_ops = { + + static const struct udevice_id pmic_fan53555_match[] = { + { .compatible = "fcs,fan53555", .data = FAN53555_VENDOR_FAIRCHILD, }, ++ { .compatible = "fcs,fan53200", .data = FAN53200_VENDOR_FAIRCHILD, }, + { .compatible = "silergy,syr827", .data = FAN53555_VENDOR_SILERGY, }, + { .compatible = "silergy,syr828", .data = FAN53555_VENDOR_SILERGY, }, + { }, +diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c +index b407f555..89ba851f 100644 +--- a/drivers/power/regulator/fan53555.c ++++ b/drivers/power/regulator/fan53555.c +@@ -55,6 +55,8 @@ static const struct { + { FAN53555_VENDOR_FAIRCHILD, 0x8, 0x1, true, 600000, 10000 }, + /* Option 08 */ + { FAN53555_VENDOR_FAIRCHILD, 0x8, 0xf, true, 600000, 10000 }, ++ /* FAN53200 */ ++ { FAN53200_VENDOR_FAIRCHILD, 0x0, 0x0, false, 600000, 12500 }, + /* Option 09 */ + { FAN53555_VENDOR_FAIRCHILD, 0xc, 0xf, true, 603000, 12826 }, + /* SYL82X */ +diff --git a/include/configs/tinker-2_rk3399.h b/include/configs/tinker-2_rk3399.h +new file mode 100644 +index 00000000..36315602 +--- /dev/null ++++ b/include/configs/tinker-2_rk3399.h +@@ -0,0 +1,22 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * (C) Copyright 2021 Thomas McKahan ++ */ ++ ++#ifndef __TINKER_2_RK3399_H ++#define __TINKER_2_RK3399_H ++ ++#define ROCKCHIP_DEVICE_SETTINGS \ ++ "stdin=serial,usbkbd\0" \ ++ "stdout=serial,vidconsole\0" \ ++ "stderr=serial,vidconsole\0" ++ ++#include ++ ++#define SDRAM_BANK_SIZE (2UL << 30) ++ ++#define CONFIG_USB_OHCI_NEW ++#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 ++ ++ ++#endif +diff --git a/include/power/fan53555.h b/include/power/fan53555.h +index c039f060..8a50593c 100644 +--- a/include/power/fan53555.h ++++ b/include/power/fan53555.h +@@ -7,6 +7,7 @@ + #define _FAN53555_H_ + + enum fan53555_vendor { ++ FAN53200_VENDOR_FAIRCHILD, + FAN53555_VENDOR_FAIRCHILD, + FAN53555_VENDOR_SILERGY, + }; +-- +Created with Armbian build tools https://github.com/armbian/build +