rockchip: Add Radxa CM3 support
Subsystems (6)
v4 cover rockchip: Add Radxa CM3 support
From: Jagan Teki <[email protected]>
This series support Radxa CM3 with USB2.0 and USB3.0.
Changes for v4:
- drop BINMAN_FDT unset
- usb3.0
- config additions
changes for v3:
- linux-next dts tags
Changes for v2:
- collect RB from kever
Jagan Teki (9):
rockchip: rk3568: Move DM_RESET in arch kconfig
dt-bindings: rockchip: Sync rockchip, vop2.h from Linux
arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3
arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO
board: rockchip: Add Radxa Compute Module 3 IO Board
phy: rockchip: inno-usb2: Add support #address_cells = 2
drivers: phy: add naneng combphy for rk3568
arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates
rockchip: rk3568: add rk3568 pinctrl driver
Manoj Sai (3):
phy: rockchip-inno-usb2: Add USB2 PHY for rk3568
rockchip: rk3568: Select DM_REGULATOR_FIXED
rk3566: radxa-cm3: Enable USB2.0, USB3.0 support
arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi | 18 + arch/arm/dts/rk3566-radxa-cm3-io.dts | 272 +++++++++++ arch/arm/dts/rk3566-radxa-cm3.dtsi | 425 +++++++++++++++++ arch/arm/dts/rk356x-u-boot.dtsi | 5 + arch/arm/mach-rockchip/Kconfig | 2 + board/rockchip/evb_rk3568/MAINTAINERS | 5 + configs/evb-rk3568_defconfig | 1 - configs/radxa-cm3-io-rk3566_defconfig | 77 +++ drivers/phy/rockchip/Kconfig | 7 + drivers/phy/rockchip/Makefile | 1 + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 65 ++- .../rockchip/phy-rockchip-naneng-combphy.c | 441 ++++++++++++++++++ drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3568.c | 362 ++++++++++++++ include/dt-bindings/soc/rockchip,vop2.h | 14 + 16 files changed, 1695 insertions(+), 2 deletions(-) create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io.dts create mode 100644 arch/arm/dts/rk3566-radxa-cm3.dtsi create mode 100644 configs/radxa-cm3-io-rk3566_defconfig create mode 100644 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3568.c create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
Signature · 1 line
2.25.1
PATCH v4 2/12 dt-bindings: rockchip: Sync rockchip, vop2.h from Linux
Sync rockchip,vop2.h from linux-next, and the last commit is
commit <604be85547ce> ("drm/rockchip: Add VOP2 driver")
--- include/dt-bindings/soc/rockchip,vop2.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/dt-bindings/soc/rockchip,vop2.h
include/dt-bindings/soc/rockchip,vop2.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ + +#ifndef __DT_BINDINGS_ROCKCHIP_VOP2_H +#define __DT_BINDINGS_ROCKCHIP_VOP2_H + +#define ROCKCHIP_VOP2_EP_RGB0 1 +#define ROCKCHIP_VOP2_EP_HDMI0 2 +#define ROCKCHIP_VOP2_EP_EDP0 3 +#define ROCKCHIP_VOP2_EP_MIPI0 4 +#define ROCKCHIP_VOP2_EP_LVDS0 5 +#define ROCKCHIP_VOP2_EP_MIPI1 6 +#define ROCKCHIP_VOP2_EP_LVDS1 7 + +#endif /* __DT_BINDINGS_ROCKCHIP_VOP2_H */
Signature · 1 line
2.25.1
PATCH v4 1/12 rockchip: rk3568: Move DM_RESET in arch kconfig
In reply to Jagan TekiLike other rockchip SoCs, DM_RESET is useful across rk3568 platform.
Select it from arch kconfig.
--- arch/arm/mach-rockchip/Kconfig | 1 + configs/evb-rk3568_defconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568 select REGMAP select SYSCON select BOARD_LATE_INIT + select DM_RESET imply ROCKCHIP_COMMON_BOARD help The Rockchip RK3568 is a ARM-based SoC with quad-core Cortex-A55,
configs/evb-rk3568_defconfig +0 -1
@@ -60,7 +60,6 @@ CONFIG_GMAC_ROCKCHIP=y CONFIG_REGULATOR_PWM=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=y -CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550_MEM32=y
Signature · 1 line
2.25.1
PATCH v4 3/12 arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3
In reply to Jagan TekiRadxa Compute Module 3(CM3) is one of the modules from a series System On Module based on the Radxa ROCK 3 series and is compatible with Raspberry Pi CM4 pinout and form factor.
Specification:
- Rockchip RK3566
- up to 8GB LPDDR4
- up to 128GB high performance eMMC
- Optional wireless LAN, 2.4GHz and 5.0GHz IEEE 802.11b/g/n/ac wireless, BT 5.0, BLE with onboard and external antenna.
- Gigabit Ethernet PHY
Radxa CM3 needs to mount on top of this IO board in order to create complete Radxa CM3 IO board platform.
Since Radxa CM3 is compatible with Raspberry Pi CM4 pinout so it is possible to mount Radxa CM3 on top of the Rasberry Pi CM4 IO board.
linux-next commit for the same,
commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa CM3")
Add support for Radxa CM3.
--- arch/arm/dts/rk3566-radxa-cm3.dtsi | 425 +++++++++++++++++++++++++++++ 1 file changed, 425 insertions(+) create mode 100644 arch/arm/dts/rk3566-radxa-cm3.dtsi
arch/arm/dts/rk3566-radxa-cm3.dtsi new file +425 -0
@@ -0,0 +1,425 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Radxa Limited + * Copyright (c) 2022 Amarula Solutions(India) + */ + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/leds/common.h> + +/ { + compatible = "radxa,cm3", "rockchip,rk3566"; + + aliases { + mmc0 = &sdhci; + }; + + leds { + compatible = "gpio-leds"; + + led-0 { + gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_STATUS; + linux,default-trigger = "timer"; + default-state = "on"; + pinctrl-names = "default"; + pinctrl-0 = <&user_led2>; + }; + }; + + vcc_sys: vcc-sys-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + }; + + vcc_1v8: vcc-1v8-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vcc_3v3: vcc-3v3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_3v3"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&vcc3v3_sys>; + }; + + vcca_1v8: vcca-1v8-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcca_1v8"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + sdio_pwrseq: pwrseq-sdio { + compatible = "mmc-pwrseq-simple"; + clocks = <&rk817 1>; + clock-names = "ext_clock"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_reg_on_h>; + reset-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_LOW>; + }; +}; + +&cpu0 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu1 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu2 { + cpu-supply = <&vdd_cpu>; +}; + +&cpu3 { + cpu-supply = <&vdd_cpu>; +}; + +&gpu { + mali-supply = <&vdd_gpu_npu>; + status = "okay"; +}; + +&i2c0 { + status = "okay"; + + vdd_cpu: regulator@1c { + compatible = "tcs,tcs4525"; + reg = <0x1c>; + fcs,suspend-voltage-selector = <1>; + regulator-name = "vdd_cpu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <712500>; + regulator-max-microvolt = <1390000>; + regulator-ramp-delay = <2300>; + vin-supply = <&vcc_sys>; + + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + #clock-cells = <1>; + clock-output-names = "rk817-clkout1", "rk817-clkout2"; + interrupt-parent = <&gpio0>; + interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int_l>; + rockchip,system-power-controller; + wakeup-source; + + vcc1-supply = <&vcc_sys>; + vcc2-supply = <&vcc_sys>; + vcc3-supply = <&vcc_sys>; + vcc4-supply = <&vcc_sys>; + vcc5-supply = <&vcc_sys>; + vcc6-supply = <&vcc_sys>; + vcc7-supply = <&vcc_sys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vdd_gpu_npu: DCDC_REG2 { + regulator-name = "vdd_gpu_npu"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc3v3_sys: DCDC_REG4 { + regulator-name = "vcc3v3_sys"; + regulator-always-on; + regulator-boot-on; + regulator-initial-mode = <0x2>; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcca1v8_pmu: LDO_REG1 { + regulator-name = "vcca1v8_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdda_0v9: LDO_REG2 { + regulator-name = "vdda_0v9"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vdda0v9_pmu: LDO_REG3 { + regulator-name = "vdda0v9_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <900000>; + }; + }; + + vccio_acodec: LDO_REG4 { + regulator-name = "vccio_acodec"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc3v3_pmu: LDO_REG6 { + regulator-name = "vcc3v3_pmu"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8_p: LDO_REG7 { + regulator-name = "vcc_1v8_p"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc1v8_dvp: LDO_REG8 { + regulator-name = "vcc1v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + vcc2v8_dvp: LDO_REG9 { + regulator-name = "vcc2v8_dvp"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-state-mem { + regulator-off-in-suspend; + }; + }; + + }; + }; +}; + +&pinctrl { + bluetooth { + bt_host_wake_h: bt-host-wake-h { + rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_reg_on_h: bt-reg-on-h { + rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + bt_wake_host_h: bt-wake-host-h { + rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + pmic { + pmic_int_l: pmic-int-l { + rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; + }; + }; + + leds { + user_led2: user-led2 { + rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + wifi { + wifi_reg_on_h: wifi-reg-on-h { + rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>; + }; + + wifi_host_wake_h: wifi-host-wake-h { + rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&pmu_io_domains { + pmuio1-supply = <&vcc3v3_pmu>; + pmuio2-supply = <&vcc_3v3>; + vccio1-supply = <&vccio_acodec>; + vccio2-supply = <&vcc_1v8>; + vccio3-supply = <&vccio_sd>; + vccio4-supply = <&vcc_1v8>; + vccio5-supply = <&vcc_3v3>; + vccio6-supply = <&vcc_3v3>; + vccio7-supply = <&vcc_3v3>; + status = "okay"; +}; + +&saradc { + vref-supply = <&vcca_1v8>; + status = "okay"; +}; + +&sdmmc1 { + #address-cells = <1>; + #size-cells = <0>; + bus-width = <4>; + disable-wp; + cap-sd-highspeed; + cap-sdio-irq; + keep-power-in-suspend; + mmc-pwrseq = <&sdio_pwrseq>; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_clk &sdmmc1_cmd>; + sd-uhs-sdr104; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; + + wifi@1 { + compatible = "brcm,bcm43455-fmac"; + reg = <1>; + interrupt-parent = <&gpio2>; + interrupts = <RK_PC1 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "host-wake"; + pinctrl-names = "default"; + pinctrl-0 = <&wifi_host_wake_h>; + }; +}; + +&sdhci { + bus-width = <8>; + max-frequency = <200000000>; + mmc-hs200-1_8v; + non-removable; + pinctrl-names = "default"; + pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>; + vmmc-supply = <&vcc_3v3>; + vqmmc-supply = <&vcc_1v8>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1m0_ctsn &uart1m0_rtsn &uart1m0_xfer>; + status = "okay"; + + bluetooth { + compatible = "brcm,bcm4345c5"; + clocks = <&rk817 1>; + clock-names = "lpo"; + device-wakeup-gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_HIGH>; + host-wakeup-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_LOW>; + pinctrl-names = "default"; + pinctrl-0 = <&bt_host_wake_h &bt_reg_on_h &bt_wake_host_h>; + vbat-supply = <&vcc_3v3>; + vddio-supply = <&vcc_1v8>; + }; +}; + +&usb2phy0 { + status = "okay"; +}; + +&usb2phy1 { + status = "okay"; +}; + +&tsadc { + rockchip,hw-tshut-mode = <1>; + rockchip,hw-tshut-polarity = <0>; + status = "okay"; +};
Signature · 1 line
2.25.1
PATCH v4 7/12 phy: rockchip-inno-usb2: Add USB2 PHY for rk3568
In reply to Jagan TekiFrom: Manoj Sai <[email protected]>
RK3568 has two USB 2.0 PHYs, and each PHY has two ports, the OTG port of PHY0 support OTG mode with charging detection function, they are similar to previous Rockchip SoCs.
However, there are three different designs for RK3568 USB 2.0 PHY.
1. RK3568 uses independent USB GRF module for each USB 2.0 PHY.
2. RK3568 accesses the registers of USB 2.0 PHY IP directly by APB.
3. The two ports of USB 2.0 PHY share one interrupt.
This patch only PHY1 with necessary attributes required to function USBPHY1 on U-Boot.
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +54 -0
@@ -298,11 +298,65 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { {/* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + { + .reg =0xfe8a0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x0000 ,8 ,0 ,0x052 ,0x1d1 }, + .bvalid_det_en = {0x0080 ,2 ,2 ,0 ,1 }, + .bvalid_det_st = {0x0084 ,2 ,2 ,0 ,1 }, + .bvalid_det_clr = {0x0088 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_avalid = {0x00c0 ,10 ,10 ,0 ,1 }, + .utmi_bvalid = {0x00c0 ,9 ,9 ,0 ,1 }, + .utmi_ls = {0x00c0 ,5 ,4 ,0 ,1 }, + }, + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0004 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,1 ,1 ,0 ,1 }, + .ls_det_st = {0x0084 ,1 ,1 ,0 ,1 }, + .ls_det_clr = {0x0088 ,1 ,1 ,0 ,1 }, + .utmi_ls = {0x00c0 ,17 ,16 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,19 ,19 ,0 ,1 } + } + }, + }, + { + .reg =0xfe8b0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x0000 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,5 ,4 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,7 ,7 ,0 ,1 } + }, + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0004 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,1 ,1 ,0 ,1 }, + .ls_det_st = {0x0084 ,1 ,1 ,0 ,1 }, + .ls_det_clr = {0x0088 ,1 ,1 ,0 ,1 }, + .utmi_ls = {0x00c0 ,17 ,16 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,19 ,19 ,0 ,1 } + } + }, + }, + {/* sentinel */ } +}; +static const struct udevice_id rockchip_usb2phy_ids[] = { { .compatible ="rockchip,rk3399-usb2phy" , .data = (ulong)&rk3399_usb2phy_cfgs, }, + { + .compatible ="rockchip,rk3568-usb2phy" , + .data = (ulong)&rk3568_phy_cfgs, + }, {/* sentinel */ } };
Signature · 1 line
2.25.1
PATCH v4 5/12 board: rockchip: Add Radxa Compute Module 3 IO Board
In reply to Jagan TekiRadxa Compute Module 3(CM3) IO board an application board from Radxa and is compatible with Raspberry Pi CM4 IO form factor.
Radxa CM3 needs to mount on top of this IO board in order to create complete Radxa CM3 IO board platform.
Add support for Radxa CM3 IO Board defconfig and -u-boot.dtsi
--- arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi | 18 ++++++ board/rockchip/evb_rk3568/MAINTAINERS | 5 ++ configs/radxa-cm3-io-rk3566_defconfig | 66 ++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi create mode 100644 configs/radxa-cm3-io-rk3566_defconfig
arch/arm/dts/rk3566-radxa-cm3-io-u-boot.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2021 Rockchip Electronics Co., Ltd + */ + +#include "rk356x-u-boot.dtsi" + +/ { + chosen { + stdout-path = &uart2; + }; +}; + +&uart2 { + clock-frequency = <24000000>; + u-boot,dm-spl; + status = "okay"; +};
board/rockchip/evb_rk3568/MAINTAINERS +5 -0
@@ -4,3 +4,8 @@ S: Maintained F: board/rockchip/evb_rk3568 F: include/configs/evb_rk3568.h F: configs/evb-rk3568_defconfig + +RADXA-CM3 +M: Jagan Teki <[email protected]> +S: Maintained +F: configs/radxa-cm3-io-rk3566_defconfig
configs/radxa-cm3-io-rk3566_defconfig new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 9/12 arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
combphy1 is failing to probe due to unhandled assigned-clocks and assigned-clocks-rates.
=> usb start
starting USB...
Bus usb@fd000000: Failed to get PHY1 for usb@fd000000 Port not available.
Bus usb@fd800000: USB EHCI 1.00
There is no real requirement for them in U-Boot to handle, hence mark them as deleted-properties for the probe to success
--- arch/arm/dts/rk356x-u-boot.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +5 -0
@@ -22,6 +22,11 @@ }; }; +&combphy1 { + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-rates; +}; + &cru { u-boot,dm-pre-reloc; status = "okay";
Signature · 1 line
2.25.1
PATCH v4 4/12 arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO
In reply to Jagan TekiRadxa Compute Module 3(CM3) IO board an application board from Radxa and is compatible with Raspberry Pi CM4 IO form factor.
Specification:
- 1x HDMI,
- 2x MIPI DSI
- 2x MIPI CSI2
- 1x eDP
- 1x PCIe card
- 2x SATA
- 2x USB 2.0 Host
- 1x USB 3.0
- 1x USB 2.0 OTG
- Phone jack
- microSD slot
- 40-pin GPIO expansion header
- 12V DC
Radxa CM3 needs to mount on top of this IO board in order to create complete Radxa CM3 IO board platform.
linux-next commit for the same,
commit <8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa CM3")
Add support for Radxa CM3 IO Board.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3566-radxa-cm3-io.dts | 272 +++++++++++++++++++++++++++ 2 files changed, 273 insertions(+) create mode 100644 arch/arm/dts/rk3566-radxa-cm3-io.dts
arch/arm/dts/Makefile +1 -0
@@ -165,6 +165,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ rk3399pro-rock-pi-n10.dtb dtb-$(CONFIG_ROCKCHIP_RK3568) += \ + rk3566-radxa-cm3-io.dtb \ rk3568-evb.dtb dtb-$(CONFIG_ROCKCHIP_RV1108) += \
arch/arm/dts/rk3566-radxa-cm3-io.dts new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 6/12 phy: rockchip: inno-usb2: Add support #address_cells = 2
In reply to Jagan TekiNew Rockchip devices have the usb phy nodes as standalone devices. These nodes have register nodes with #address_cells = 2, but only use 32 bit addresses.
Adjust the driver to check if the returned address is "0", and adjust the index in that case.
Derived and adjusted the similar change from linux-next with below
commit <9c19c531dc98> ("phy: phy-rockchip-inno-usb2: support #address_cells = 2")
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +10 -1
@@ -179,12 +179,21 @@ static int rockchip_usb2phy_probe(struct udevice *dev)if (IS_ERR (priv->reg_base))return PTR_ERR (priv->reg_base); - ret =ofnode_read_u32 (dev_ofnode (dev),"reg" , ®); + ret =ofnode_read_u32_index (dev_ofnode (dev),"reg" ,0 , ®);if (ret) {dev_err (dev,"failed to read reg property (ret = %d)\n" , ret);return ret; } +/* support address_cells=2 */ +if (reg ==0 ) { +if (ofnode_read_u32_index (dev_ofnode (dev),"reg" ,1 , ®)) { +dev_err (dev,"%s must have reg[1]\n" , +ofnode_get_name (dev_ofnode (dev))); +return -EINVAL ; + } + } + phy_cfgs = (const struct rockchip_usb2phy_cfg *)dev_get_driver_data (dev);if (!phy_cfgs)
Signature · 1 line
2.25.1
PATCH v4 8/12 drivers: phy: add naneng combphy for rk3568
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
RK3568 has three combo phys, and PCIe/USB3/SATA/QSGMII controllers share one pipe interface for each combo phy, here is the diagram of the complex connection.
+----------------+
| | +------+
| USB3 OTG CTRL0 |---->| |
| | | | +------------+
+----------------+ | PIPE | | |
| MUX |---->| Combo PHY0 |
+----------------+ | | | |
| | | | +------------+
| SATA CTRL0 |---->| |
| | +------+
+----------------++----------------+
| | +------+
| USB3 HOST CTRL1|---->| |
| | | | +------------+
+----------------+ | PIPE | | |
| MUX |---->| Combo PHY1 |
+----------------+ | | | |
| |---->| | +------------+
| SATA CTRL1 | -->| |
| | | +------+
+----------------+ |
|
+----------------+ |
| | | +------+
| QSGMII CTRL |---->| |
| | | | +------------+
+----------------+ | PIPE | | |
| MUX |---->| Combo PHY2 |
+----------------+ | | | |
| |---->| | +------------+
| SATA CTRL2 | -->| |
| | | +------+
+----------------+ |
|
+----------------+ |
| | |
| PCIe2 1-Lane |---
| |
+----------------+--- drivers/phy/rockchip/Kconfig | 7 + drivers/phy/rockchip/Makefile | 1 + .../rockchip/phy-rockchip-naneng-combphy.c | 441 ++++++++++++++++++ 3 files changed, 449 insertions(+) create mode 100644 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
drivers/phy/rockchip/Kconfig +7 -0
@@ -11,6 +11,13 @@ config PHY_ROCKCHIP_INNO_USB2 help Support for Rockchip USB2.0 PHY with Innosilicon IP block. +config PHY_ROCKCHIP_NANENG_COMBOPHY + bool "Support Rockchip NANENG combo PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Enable this to support the Rockchip NANENG combo PHY. + config PHY_ROCKCHIP_PCIE bool "Rockchip PCIe PHY Driver" depends on ARCH_ROCKCHIP
drivers/phy/rockchip/Makefile +1 -0
@@ -4,6 +4,7 @@ # obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.o
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c new file +441 -0
441 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v4 11/12 rockchip: rk3568: Select DM_REGULATOR_FIXED
In reply to Jagan TekiFrom: Manoj Sai <[email protected]>
Select the DM_REGULATOR_FIXED on RK3568 platform.
--- arch/arm/mach-rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568 select REGMAP select SYSCON select BOARD_LATE_INIT + select DM_REGULATOR_FIXED select DM_RESET imply ROCKCHIP_COMMON_BOARD help
Signature · 1 line
2.25.1
PATCH v4 12/12 rk3566: radxa-cm3: Enable USB2.0, USB3.0 support
In reply to Jagan TekiFrom: Manoj Sai <[email protected]>
=> usb start
starting USB...
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
scanning bus usb@fd000000 for devices... cannot reset port 1!? 2 USB Device(s) found
scanning bus usb@fd800000 for devices... 4 USB Device(s) found
scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:
1 Hub (5 Gb/s, 0mA)
| U-Boot XHCI Host Controller
|
+-2 Mass Storage (5 Gb/s, 224mA)
SanDisk Dual Drive 04019c9b2e1a58f24ee318c3c123aa5
1 Hub (480 Mb/s, 0mA)
| u-boot EHCI Host Controller
|
+-2 Hub (480 Mb/s, 100mA)
| USB 2.0 Hub
|
+-3 Mass Storage (480 Mb/s, 500mA)
| JetFlash Mass Storage Device 19M7I4ZQFTSC08SU
|
+-4 Human Interface (12 Mb/s, 98mA)Logitech USB Receiver
--- configs/radxa-cm3-io-rk3566_defconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)
configs/radxa-cm3-io-rk3566_defconfig +11 -0
@@ -38,6 +38,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_ATF=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_OF_CONTROL=y
@@ -57,10 +58,20 @@ CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_GPIO=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=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_DWC3=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_ERRNO_STR=y
Signature · 1 line
2.25.1
PATCH v4 10/12 rockchip: rk3568: add rk3568 pinctrl driver
In reply to Jagan TekiFrom: Jagan Teki <[email protected]>
Add driver supporting pin multiplexing on rk3568 platform.
--- drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3568.c | 362 ++++++++++++++++++++++ 2 files changed, 363 insertions(+) create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3568.c
drivers/pinctrl/rockchip/Makefile +1 -0
@@ -14,5 +14,6 @@ obj-$(CONFIG_ROCKCHIP_RK3308) += pinctrl-rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) += pinctrl-rk3328.o obj-$(CONFIG_ROCKCHIP_RK3368) += pinctrl-rk3368.o obj-$(CONFIG_ROCKCHIP_RK3399) += pinctrl-rk3399.o +obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rk3568.c new file +362 -0
362 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH v4 01/12] rockchip: rk3568: Move DM_RESET in arch kconfig
In reply to Jagan TekiQuoted 6 lines · Jagan Teki
Like other rockchip SoCs,
DM_RESETis useful across rk3568 platform.Select it from arch kconfig.
Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 29 lines
--- arch/arm/mach-rockchip/Kconfig | 1 + configs/evb-rk3568_defconfig | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-rockchip/Kconfig +1
-0@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568 select REGMAP select SYSCON select BOARD_LATE_INIT + select DM_RESET imply ROCKCHIP_COMMON_BOARD help The Rockchip RK3568 is a ARM-based SoC with quad-core Cortex-A55,configs/evb-rk3568_defconfig +0
-1@@ -60,7 +60,6 @@ CONFIG_GMAC_ROCKCHIP=y CONFIG_REGULATOR_PWM=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=y -CONFIG_DM_RESET=y CONFIG_BAUDRATE=1500000 CONFIG_DEBUG_UART_SHIFT=2 CONFIG_SYS_NS16550_MEM32=y
Re: [PATCH v4 04/12] arm64: dts: rockchip: rk3566: Add Radxa Compute Module 3 IO
In reply to Jagan TekiQuoted 26 lines · Jagan Teki
Radxa Compute Module 3(CM3) IO board an application board from Radxa and is compatible with Raspberry Pi CM4 IO form factor.
Specification:
- 1x HDMI,
- 2x MIPI DSI
- 2x MIPI CSI2
- 1x eDP
- 1x PCIe card
- 2x SATA
- 2x USB 2.0 Host
- 1x USB 3.0
- 1x USB 2.0 OTG
- Phone jack
- microSD slot
- 40-pin GPIO expansion header
- 12V DCRadxa CM3 needs to mount on top of this IO board in order to create complete Radxa CM3 IO board platform.
linux-next commit for the same,
commit <
8f19828844f2> ("arm64: dts: rockchip: Fix compatible for Radxa CM3")
Quoted 7 lines
Add support for Radxa CM3 IO Board.
Co-developed-by FUKAUMI Naoki <[email protected]>Signed-off-by FUKAUMI Naoki <[email protected]>Co-developed-by Manoj Sai <[email protected]>Signed-off-by Manoj Sai <[email protected]>Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 296 lines
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rk3566-radxa-cm3-io.dts | 272 +++++++++++++++++++++++++++ 2 files changed, 273 insertions(+)create mode 100644
arch/arm/dts/rk3566-radxa-cm3-io.dtsarch/arm/dts/Makefile +1
-0@@ -165,6 +165,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3399) += \ rk3399pro-rock-pi-n10.dtb dtb-$(CONFIG_ROCKCHIP_RK3568) += \ + rk3566-radxa-cm3-io.dtb \ rk3568-evb.dtb dtb-$(CONFIG_ROCKCHIP_RV1108) += \arch/arm/dts/rk3566-radxa-cm3-io.dts new file +272
-0@@ -0,0 +1,272 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2022 Radxa Limited + * Copyright (c) 2022 Amarula Solutions(India) + */ + +/dts-v1/; +#include <dt-bindings/soc/rockchip,vop2.h> +#include "rk3566.dtsi" +#include "rk3566-radxa-cm3.dtsi" + +/ { + model = "Radxa Compute Module 3(CM3) IO Board"; + compatible = "radxa,cm3-io", "radxa,cm3", "rockchip,rk3566"; + + aliases { + mmc1 = &sdmmc0; + }; + + chosen: chosen { + stdout-path = "serial2:1500000n8"; + }; + + gmac1_clkin: external-gmac1-clock { + compatible = "fixed-clock"; + clock-frequency = <125000000>; + clock-output-names = "gmac1_clkin"; + #clock-cells = <0>; + }; + + hdmi-con { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led-1 { + gpios = <&gpio4 RK_PA4 GPIO_ACTIVE_LOW>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_ACTIVITY; + linux,default-trigger = "heartbeat"; + pinctrl-names = "default"; + pinctrl-0 = <&pi_nled_activity>; + }; + }; + + vcc5v0_usb30: vcc5v0-usb30-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_usb30"; + enable-active-high; + gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&vcc5v0_usb30_en_h>; + regulator-always-on; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&vcc_sys>; + }; + + vcca1v8_image: vcca1v8-image-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcca1v8_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + vin-supply = <&vcc_1v8_p>; + }; + + vdda0v9_image: vdda0v9-image-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcca0v9_image"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <900000>; + regulator-max-microvolt = <900000>; + vin-supply = <&vdda_0v9>; + }; +}; + +&combphy1 { + status = "okay"; +}; + +&gmac1 { + assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>; + assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>; + assigned-clock-rates = <0>, <125000000>; + clock_in_out = "input"; + phy-handle = <&rgmii_phy1>; + phy-mode = "rgmii"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1m0_miim + &gmac1m0_tx_bus2 + &gmac1m0_rx_bus2 + &gmac1m0_rgmii_clk + &gmac1m0_rgmii_bus + &gmac1m0_clkinout>; + snps,reset-gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_LOW>; + snps,reset-active-low; + /* Reset time is 20ms, 100ms for rtl8211f */ + snps,reset-delays-us = <0 20000 100000>; + tx_delay = <0x46>; + rx_delay = <0x2e>; + status = "okay"; +}; + +&hdmi { + avdd-0v9-supply = <&vdda0v9_image>; + avdd-1v8-supply = <&vcca1v8_image>; + status = "okay"; +}; + +&hdmi_in { + hdmi_in_vp0: endpoint { + remote-endpoint = <&vp0_out_hdmi>; + }; +}; + +&hdmi_out { + hdmi_out_con: endpoint { + remote-endpoint = <&hdmi_con_in>; + }; +}; + +&hdmi_sound { + status = "okay"; +}; + +&mdio1 { + rgmii_phy1: ethernet-phy@0 { + compatible="ethernet-phy-ieee802.3-c22"; + reg= <0x0>; + }; +}; + +&pinctrl { + gmac1 { + gmac1m0_miim: gmac1m0-miim { + rockchip,pins = + /* gmac1_mdcm0 */ + <3 RK_PC4 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_mdiom0 */ + <3 RK_PC5 3 &pcfg_pull_none_drv_level_15>; + }; + + gmac1m0_rx_bus2: gmac1m0-rx-bus2 { + rockchip,pins = + /* gmac1_rxd0m0 */ + <3 RK_PB1 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_rxd1m0 */ + <3 RK_PB2 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_rxdvcrsm0 */ + <3 RK_PB3 3 &pcfg_pull_none_drv_level_15>; + }; + + gmac1m0_tx_bus2: gmac1m0-tx-bus2 { + rockchip,pins = + /* gmac1_txd0m0 */ + <3 RK_PB5 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_txd1m0 */ + <3 RK_PB6 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_txenm0 */ + <3 RK_PB7 3 &pcfg_pull_none_drv_level_15>; + }; + + gmac1m0_rgmii_clk: gmac1m0-rgmii-clk { + rockchip,pins = + /* gmac1_rxclkm0 */ + <3 RK_PA7 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_txclkm0 */ + <3 RK_PA6 3 &pcfg_pull_none_drv_level_15>; + }; + + gmac1m0_rgmii_bus: gmac1m0-rgmii-bus { + rockchip,pins = + /* gmac1_rxd2m0 */ + <3 RK_PA4 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_rxd3m0 */ + <3 RK_PA5 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_txd2m0 */ + <3 RK_PA2 3 &pcfg_pull_none_drv_level_15>, + /* gmac1_txd3m0 */ + <3 RK_PA3 3 &pcfg_pull_none_drv_level_15>; + }; + + gmac1m0_clkinout: gmac1m0-clkinout { + rockchip,pins = + /* gmac1_mclkinoutm0 */ + <3 RK_PC0 3 &pcfg_pull_none_drv_level_15>; + }; + }; + + leds { + pi_nled_activity: pi-nled-activity { + rockchip,pins = <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + sdcard { + sdmmc_pwren: sdmmc-pwren { + rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + + usb { + vcc5v0_usb30_en_h: vcc5v0-host-en-h { + rockchip,pins = <3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; +}; + +&sdmmc0 { + bus-width = <4>; + cap-mmc-highspeed; + cap-sd-highspeed; + disable-wp; + vqmmc-supply = <&vccio_sd>; + pinctrl-names = "default"; + pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det &sdmmc0_pwren>; + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&usb2phy0_host { + phy-supply = <&vcc5v0_usb30>; + status = "okay"; +}; + +&usb2phy1_host { + status = "okay"; +}; + +&usb2phy1_otg { + status = "okay"; +}; + +&usb_host0_ehci { + status = "okay"; +}; + +&usb_host1_xhci { + status = "okay"; +}; + +&vop { + assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>; + assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>; + status = "okay"; +}; + +&vop_mmu { + status = "okay"; +}; + +&vp0 { + vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 { + reg = <ROCKCHIP_VOP2_EP_HDMI0>; + remote-endpoint = <&hdmi_in_vp0>; + }; +};
Re: [PATCH v4 06/12] phy: rockchip: inno-usb2: Add support #address_cells = 2
In reply to Jagan TekiQuoted 7 lines · Jagan Teki
New Rockchip devices have the usb phy nodes as standalone devices. These nodes have register nodes with #address_cells = 2, but only use 32 bit addresses.
Adjust the driver to check if the returned address is "0", and adjust the index in that case.
Quoted 7 lines
Derived and adjusted the similar change from linux-next with below
commit <9c19c531dc98> ("phy: phy-rockchip-inno-usb2: support #address_cells = 2")Co-developed-by Manoj Sai <[email protected]>Signed-off-by Manoj Sai <[email protected]>Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 31 lines
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/phy/rockchip/phy-rockchip-inno-usb2.c +10
-1@@ -179,12 +179,21 @@ static int rockchip_usb2phy_probe(struct udevice *dev)if (IS_ERR (priv->reg_base))return PTR_ERR (priv->reg_base); - ret =ofnode_read_u32 (dev_ofnode (dev),"reg" , ®); + ret =ofnode_read_u32_index (dev_ofnode (dev),"reg" ,0 , ®);if (ret) {dev_err (dev,"failed to read reg property (ret = %d)\n" , ret);return ret; } +/* support address_cells=2 */ +if (reg ==0 ) { +if (ofnode_read_u32_index (dev_ofnode (dev),"reg" ,1 , ®)) { +dev_err (dev,"%s must have reg[1]\n" , +ofnode_get_name (dev_ofnode (dev))); +return -EINVAL ; + } + } + phy_cfgs = (const struct rockchip_usb2phy_cfg *)dev_get_driver_data (dev);if (!phy_cfgs)
Re: [PATCH v4 07/12] phy: rockchip-inno-usb2: Add USB2 PHY for rk3568
In reply to Jagan TekiQuoted 11 lines · Jagan Teki
From: Manoj Sai <[email protected]>
RK3568 has two USB 2.0 PHYs, and each PHY has two ports, the OTG port of PHY0 support OTG mode with charging detection function, they are similar to previous Rockchip SoCs.
However, there are three different designs for RK3568 USB 2.0 PHY.
1. RK3568 uses independent USB GRF module for each USB 2.0 PHY.
2. RK3568 accesses the registers of USB 2.0 PHY IP directly by APB.
3. The two ports of USB 2.0 PHY share one interrupt.
Quoted 8 lines
This patch only PHY1 with necessary attributes required to function USBPHY1 on U-Boot.
Co-developed-by Ren Jianing <[email protected]>Signed-off-by Ren Jianing <[email protected]>Co-developed-by Jagan Teki <[email protected]>Signed-off-by Jagan Teki <[email protected]>Signed-off-by Manoj Sai <[email protected]>
Thanks,
- Kever
Quoted 74 lines
--- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+)drivers/phy/rockchip/phy-rockchip-inno-usb2.c +54
-0@@ -298,11 +298,65 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { {/* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + { + .reg =0xfe8a0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x0000 ,8 ,0 ,0x052 ,0x1d1 }, + .bvalid_det_en = {0x0080 ,2 ,2 ,0 ,1 }, + .bvalid_det_st = {0x0084 ,2 ,2 ,0 ,1 }, + .bvalid_det_clr = {0x0088 ,2 ,2 ,0 ,1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_avalid = {0x00c0 ,10 ,10 ,0 ,1 }, + .utmi_bvalid = {0x00c0 ,9 ,9 ,0 ,1 }, + .utmi_ls = {0x00c0 ,5 ,4 ,0 ,1 }, + }, + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0004 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,1 ,1 ,0 ,1 }, + .ls_det_st = {0x0084 ,1 ,1 ,0 ,1 }, + .ls_det_clr = {0x0088 ,1 ,1 ,0 ,1 }, + .utmi_ls = {0x00c0 ,17 ,16 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,19 ,19 ,0 ,1 } + } + }, + }, + { + .reg =0xfe8b0000 , + .port_cfgs = { + [USB2PHY_PORT_OTG ] = { + .phy_sus = {0x0000 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,0 ,0 ,0 ,1 }, + .ls_det_st = {0x0084 ,0 ,0 ,0 ,1 }, + .ls_det_clr = {0x0088 ,0 ,0 ,0 ,1 }, + .utmi_ls = {0x00c0 ,5 ,4 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,7 ,7 ,0 ,1 } + }, + [USB2PHY_PORT_HOST ] = { + .phy_sus = {0x0004 ,8 ,0 ,0x1d2 ,0x1d1 }, + .ls_det_en = {0x0080 ,1 ,1 ,0 ,1 }, + .ls_det_st = {0x0084 ,1 ,1 ,0 ,1 }, + .ls_det_clr = {0x0088 ,1 ,1 ,0 ,1 }, + .utmi_ls = {0x00c0 ,17 ,16 ,0 ,1 }, + .utmi_hstdet = {0x00c0 ,19 ,19 ,0 ,1 } + } + }, + }, + {/* sentinel */ } +}; +static const struct udevice_id rockchip_usb2phy_ids[] = { { .compatible ="rockchip,rk3399-usb2phy" , .data = (ulong)&rk3399_usb2phy_cfgs, }, + { + .compatible ="rockchip,rk3568-usb2phy" , + .data = (ulong)&rk3568_phy_cfgs, + }, {/* sentinel */ } };
Re: [PATCH v4 08/12] drivers: phy: add naneng combphy for rk3568
In reply to Jagan TekiQuoted 48 lines · Jagan Teki
From: Jagan Teki <[email protected]>
RK3568 has three combo phys, and PCIe/USB3/SATA/QSGMII controllers share one pipe interface for each combo phy, here is the diagram of the complex connection.
+----------------+ | | +------+ | USB3 OTG CTRL0 |---->| | | | | | +------------+ +----------------+ | PIPE | | | | MUX |---->| Combo PHY0 | +----------------+ | | | | | | | | +------------+ | SATA CTRL0 |---->| | | | +------+ +----------------++----------------+ | | +------+ | USB3 HOST CTRL1|---->| | | | | | +------------+ +----------------+ | PIPE | | | | MUX |---->| Combo PHY1 | +----------------+ | | | | | |---->| | +------------+ | SATA CTRL1 | -->| | | | | +------+ +----------------+ | | +----------------+ | | | | +------+ | QSGMII CTRL |---->| | | | | | +------------+ +----------------+ | PIPE | | | | MUX |---->| Combo PHY2 | +----------------+ | | | | | |---->| | +------------+ | SATA CTRL2 | -->| | | | | +------+ +----------------+ | | +----------------+ | | | | | PCIe2 1-Lane |--- | | +----------------+
Quoted 5 lines
Co-developed-by Manoj Sai <[email protected]>Signed-off-by Manoj Sai <[email protected]>Co-developed-by Yifeng Zhao <[email protected]>Signed-off-by Yifeng Zhao <[email protected]>Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 484 lines
--- drivers/phy/rockchip/Kconfig | 7 + drivers/phy/rockchip/Makefile | 1 + .../rockchip/phy-rockchip-naneng-combphy.c | 441 ++++++++++++++++++ 3 files changed, 449 insertions(+)create mode 100644
drivers/phy/rockchip/phy-rockchip-naneng-combphy.cdrivers/phy/rockchip/Kconfig +7
-0@@ -11,6 +11,13 @@ config PHY_ROCKCHIP_INNO_USB2 help Support for Rockchip USB2.0 PHY with Innosilicon IP block. +config PHY_ROCKCHIP_NANENG_COMBOPHY + bool "Support Rockchip NANENG combo PHY Driver" + depends on ARCH_ROCKCHIP + select PHY + help + Enable this to support the Rockchip NANENG combo PHY. + config PHY_ROCKCHIP_PCIE bool "Rockchip PCIe PHY Driver" depends on ARCH_ROCKCHIPdrivers/phy/rockchip/Makefile +1
-0@@ -4,6 +4,7 @@ # obj-$(CONFIG_PHY_ROCKCHIP_INNO_USB2) += phy-rockchip-inno-usb2.o +obj-$(CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY) += phy-rockchip-naneng-combphy.o obj-$(CONFIG_PHY_ROCKCHIP_PCIE) += phy-rockchip-pcie.o obj-$(CONFIG_PHY_ROCKCHIP_SNPS_PCIE3) += phy-rockchip-snps-pcie3.o obj-$(CONFIG_PHY_ROCKCHIP_TYPEC) += phy-rockchip-typec.odrivers/phy/rockchip/phy-rockchip-naneng-combphy.c new file +441
-0@@ -0,0 +1,441 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Rockchip USB3.0/PCIe Gen2/SATA/SGMII combphy driver +* +* Copyright (C) 2021 Rockchip Electronics Co., Ltd. +*/ + +#include <common.h> +#include <clk.h> +#include <dm.h> +#include <dm/lists.h> +#include <dt-bindings/phy/phy.h> +#include <generic-phy.h> +#include <syscon.h> +#include <asm/io.h> +#include <asm/arch-rockchip/clock.h> +#include <regmap.h> +#include <reset-uclass.h> +#include <dm/device_compat.h> + +#define BIT_WRITEABLE_SHIFT 16 + +struct rockchip_combphy_priv ; + +struct combphy_reg { +u16 offset; +u16 bitend; +u16 bitstart; +u16 disable; +u16 enable; +}; + +struct rockchip_combphy_grfcfg { +struct combphy_reg pcie_mode_set; +struct combphy_reg usb_mode_set; +struct combphy_reg sgmii_mode_set; +struct combphy_reg qsgmii_mode_set; +struct combphy_reg pipe_rxterm_set; +struct combphy_reg pipe_txelec_set; +struct combphy_reg pipe_txcomp_set; +struct combphy_reg pipe_clk_25m; +struct combphy_reg pipe_clk_100m; +struct combphy_reg pipe_phymode_sel; +struct combphy_reg pipe_rate_sel; +struct combphy_reg pipe_rxterm_sel; +struct combphy_reg pipe_txelec_sel; +struct combphy_reg pipe_txcomp_sel; +struct combphy_reg pipe_clk_ext; +struct combphy_reg pipe_sel_usb; +struct combphy_reg pipe_sel_qsgmii; +struct combphy_reg pipe_phy_status; +struct combphy_reg con0_for_pcie; +struct combphy_reg con1_for_pcie; +struct combphy_reg con2_for_pcie; +struct combphy_reg con3_for_pcie; +struct combphy_reg con0_for_sata; +struct combphy_reg con1_for_sata; +struct combphy_reg con2_for_sata; +struct combphy_reg con3_for_sata; +struct combphy_reg pipe_con0_for_sata; +struct combphy_reg pipe_sgmii_mac_sel; +struct combphy_reg pipe_xpcs_phy_ready; +struct combphy_reg u3otg0_port_en; +struct combphy_reg u3otg1_port_en; +}; + +struct rockchip_combphy_cfg { +const struct rockchip_combphy_grfcfg *grfcfg; +int (*combphy_cfg)(struct rockchip_combphy_priv *priv); +}; + +struct rockchip_combphy_priv { +u32 mode; +void __iomem *mmio; +struct udevice *dev; +struct regmap *pipe_grf; +struct regmap *phy_grf; +struct phy *phy; +struct reset_ctl phy_rst; +struct clk ref_clk; +const struct rockchip_combphy_cfg *cfg; +}; + +static int param_write (struct regmap *base, +const struct combphy_reg *reg,bool en) +{ +u32 val, mask, tmp; + + tmp = en ? reg->enable : reg->disable; + mask =GENMASK (reg->bitend, reg->bitstart); + val = (tmp << reg->bitstart) | (mask <<BIT_WRITEABLE_SHIFT ); + +return regmap_write (base, reg->offset, val); +} + +static int rockchip_combphy_pcie_init (struct rockchip_combphy_priv *priv) +{ +int ret =0 ; + +if (priv->cfg->combphy_cfg) { + ret = priv->cfg->combphy_cfg (priv); +if (ret) { +dev_err (priv->dev,"failed to init phy for pcie\n" ); +return ret; + } + } + +return ret; +} + +static int rockchip_combphy_usb3_init (struct rockchip_combphy_priv *priv) +{ +int ret =0 ; + +if (priv->cfg->combphy_cfg) { + ret = priv->cfg->combphy_cfg (priv); +if (ret) { +dev_err (priv->dev,"failed to init phy for usb3\n" ); +return ret; + } + } + +return ret; +} + +static int rockchip_combphy_sata_init (struct rockchip_combphy_priv *priv) +{ +int ret =0 ; + +if (priv->cfg->combphy_cfg) { + ret = priv->cfg->combphy_cfg (priv); +if (ret) { +dev_err (priv->dev,"failed to init phy for sata\n" ); +return ret; + } + } + +return ret; +} + +static int rockchip_combphy_sgmii_init (struct rockchip_combphy_priv *priv) +{ +int ret =0 ; + +if (priv->cfg->combphy_cfg) { + ret = priv->cfg->combphy_cfg (priv); +if (ret) { +dev_err (priv->dev,"failed to init phy for sgmii\n" ); +return ret; + } + } + +return ret; +} + +static int rockchip_combphy_set_mode (struct rockchip_combphy_priv *priv) +{ +switch (priv->mode) { +case PHY_TYPE_PCIE : +rockchip_combphy_pcie_init (priv); +break ; +case PHY_TYPE_USB3 : +rockchip_combphy_usb3_init (priv); +break ; +case PHY_TYPE_SATA : +rockchip_combphy_sata_init (priv); +break ; +case PHY_TYPE_SGMII : +case PHY_TYPE_QSGMII : +return rockchip_combphy_sgmii_init (priv); +default : +dev_err (priv->dev,"incompatible PHY type\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static int rockchip_combphy_init (struct phy *phy) +{ +struct rockchip_combphy_priv *priv =dev_get_priv (phy->dev); +int ret; + + ret =clk_enable (&priv->ref_clk); +if (ret <0 && ret != -ENOSYS ) +return ret; + + ret =rockchip_combphy_set_mode (priv); +if (ret) + goto err_clk; + +reset_deassert (&priv->phy_rst); + +return 0 ; + +err_clk: +clk_disable (&priv->ref_clk); + +return ret; +} + +static int rockchip_combphy_exit (struct phy *phy) +{ +struct rockchip_combphy_priv *priv =dev_get_priv (phy->dev); + +clk_disable (&priv->ref_clk); +reset_assert (&priv->phy_rst); + +return 0 ; +} + +static int rockchip_combphy_xlate (struct phy *phy,struct ofnode_phandle_args *args) +{ +struct rockchip_combphy_priv *priv =dev_get_priv (phy->dev); + +if (args->args_count !=1 ) { +pr_err ("invalid number of arguments\n" ); +return -EINVAL ; + } + + priv->mode = args->args[0 ]; + +return 0 ; +} + +static const struct phy_ops rochchip_combphy_ops = { + .init = rockchip_combphy_init, + .exit = rockchip_combphy_exit, + .of_xlate = rockchip_combphy_xlate, +}; + +static int rockchip_combphy_parse_dt (struct udevice *dev, +struct rockchip_combphy_priv *priv) +{ +struct udevice *syscon; +int ret; + + ret =uclass_get_device_by_phandle (UCLASS_SYSCON , dev,"rockchip,pipe-grf" , &syscon); +if (ret) { +dev_err (dev,"failed to find peri_ctrl pipe-grf regmap" ); +return ret; + } + priv->pipe_grf =syscon_get_regmap (syscon); + + ret =uclass_get_device_by_phandle (UCLASS_SYSCON , dev,"rockchip,pipe-phy-grf" , &syscon); +if (ret) { +dev_err (dev,"failed to find peri_ctrl pipe-phy-grf regmap\n" ); +return ret; + } + priv->phy_grf =syscon_get_regmap (syscon); + + ret =clk_get_by_index (dev,0 , &priv->ref_clk); +if (ret) { +dev_err (dev,"failed to find ref clock\n" ); +return PTR_ERR (&priv->ref_clk); + } + + ret =reset_get_by_index (dev,0 , &priv->phy_rst); +if (ret) { +dev_err (dev,"no phy reset control specified\n" ); +return ret; + } + +return 0 ; +} + +static int rockchip_combphy_probe (struct udevice *udev) +{ +struct rockchip_combphy_priv *priv =dev_get_priv (udev); +const struct rockchip_combphy_cfg *phy_cfg; + + priv->mmio = (void __iomem *)dev_read_addr (udev); +if (IS_ERR (priv->mmio)) +return PTR_ERR (priv->mmio); + + phy_cfg = (const struct rockchip_combphy_cfg *)dev_get_driver_data (udev); +if (!phy_cfg) { +dev_err (udev,"No OF match data provided\n" ); +return -EINVAL ; + } + + priv->dev = udev; + priv->mode =PHY_TYPE_SATA ; + priv->cfg = phy_cfg; + +return rockchip_combphy_parse_dt (udev, priv); +} + +static int rk3568_combphy_cfg (struct rockchip_combphy_priv *priv) +{ +const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg; +u32 val; + +switch (priv->mode) { +case PHY_TYPE_PCIE : +/* Set SSC downward spread spectrum */ + val =readl (priv->mmio + (0x1f <<2 )); + val &= ~GENMASK (5 ,4 ); + val |=0x01 <<4 ; +writel (val, priv->mmio +0x7c ); + +param_write (priv->phy_grf, &cfg->con0_for_pcie, true); +param_write (priv->phy_grf, &cfg->con1_for_pcie, true); +param_write (priv->phy_grf, &cfg->con2_for_pcie, true); +param_write (priv->phy_grf, &cfg->con3_for_pcie, true); +break ; +case PHY_TYPE_USB3 : +/* Set SSC downward spread spectrum */ + val =readl (priv->mmio + (0x1f <<2 )); + val &= ~GENMASK (5 ,4 ); + val |=0x01 <<4 ; +writel (val, priv->mmio +0x7c ); + +/* Enable adaptive CTLE for USB3.0 Rx */ + val =readl (priv->mmio + (0x0e <<2 )); + val &= ~GENMASK (0 ,0 ); + val |=0x01 ; +writel (val, priv->mmio + (0x0e <<2 )); + +/* Set PLL KVCO fine tuning signals */ + val =readl (priv->mmio + (0x20 <<2 )); + val &= ~(0x7 <<2 ); + val |=0x2 <<2 ; +writel (val, priv->mmio + (0x20 <<2 )); + +/* Set PLL LPF R1 to su_trim[10:7]=1001 */ +writel (0x4 , priv->mmio + (0xb <<2 )); + +/* Set PLL input clock divider 1/2 */ + val =readl (priv->mmio + (0x5 <<2 )); + val &= ~(0x3 <<6 ); + val |=0x1 <<6 ; +writel (val, priv->mmio + (0x5 <<2 )); + +/* Set PLL loop divider */ +writel (0x32 , priv->mmio + (0x11 <<2 )); + +/* Set PLL KVCO to min and set PLL charge pump current to max */ +writel (0xf0 , priv->mmio + (0xa <<2 )); + +param_write (priv->phy_grf, &cfg->pipe_sel_usb, true); +param_write (priv->phy_grf, &cfg->pipe_txcomp_sel, false); +param_write (priv->phy_grf, &cfg->pipe_txelec_sel, false); +param_write (priv->phy_grf, &cfg->usb_mode_set, true); +break ; +case PHY_TYPE_SATA : +writel (0x41 , priv->mmio +0x38 ); +writel (0x8F , priv->mmio +0x18 ); +param_write (priv->phy_grf, &cfg->con0_for_sata, true); +param_write (priv->phy_grf, &cfg->con1_for_sata, true); +param_write (priv->phy_grf, &cfg->con2_for_sata, true); +param_write (priv->phy_grf, &cfg->con3_for_sata, true); +param_write (priv->pipe_grf, &cfg->pipe_con0_for_sata, true); +break ; +case PHY_TYPE_SGMII : +param_write (priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, true); +param_write (priv->phy_grf, &cfg->pipe_phymode_sel, true); +param_write (priv->phy_grf, &cfg->pipe_sel_qsgmii, true); +param_write (priv->phy_grf, &cfg->sgmii_mode_set, true); +break ; +case PHY_TYPE_QSGMII : +param_write (priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, true); +param_write (priv->phy_grf, &cfg->pipe_phymode_sel, true); +param_write (priv->phy_grf, &cfg->pipe_rate_sel, true); +param_write (priv->phy_grf, &cfg->pipe_sel_qsgmii, true); +param_write (priv->phy_grf, &cfg->qsgmii_mode_set, true); +break ; +default : +pr_err ("%s, phy-type %d\n" , __func__, priv->mode); +return -EINVAL ; + } + +/* The default ref clock is 25Mhz */ +param_write (priv->phy_grf, &cfg->pipe_clk_25m, true); + +if (dev_read_bool (priv->dev,"rockchip,enable-ssc" )) { + val =readl (priv->mmio + (0x7 <<2 )); + val |=BIT (4 ); +writel (val, priv->mmio + (0x7 <<2 )); + } + +return 0 ; +} + +static const struct rockchip_combphy_grfcfg rk3568_combphy_grfcfgs = { +/* pipe-phy-grf */ + .pcie_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x11 }, + .usb_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x04 }, + .sgmii_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x01 }, + .qsgmii_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x21 }, + .pipe_rxterm_set = {0x0000 ,12 ,12 ,0x00 ,0x01 }, + .pipe_txelec_set = {0x0004 ,1 ,1 ,0x00 ,0x01 }, + .pipe_txcomp_set = {0x0004 ,4 ,4 ,0x00 ,0x01 }, + .pipe_clk_25m = {0x0004 ,14 ,13 ,0x00 ,0x01 }, + .pipe_clk_100m = {0x0004 ,14 ,13 ,0x00 ,0x02 }, + .pipe_phymode_sel = {0x0008 ,1 ,1 ,0x00 ,0x01 }, + .pipe_rate_sel = {0x0008 ,2 ,2 ,0x00 ,0x01 }, + .pipe_rxterm_sel = {0x0008 ,8 ,8 ,0x00 ,0x01 }, + .pipe_txelec_sel = {0x0008 ,12 ,12 ,0x00 ,0x01 }, + .pipe_txcomp_sel = {0x0008 ,15 ,15 ,0x00 ,0x01 }, + .pipe_clk_ext = {0x000c ,9 ,8 ,0x02 ,0x01 }, + .pipe_sel_usb = {0x000c ,14 ,13 ,0x00 ,0x01 }, + .pipe_sel_qsgmii = {0x000c ,15 ,13 ,0x00 ,0x07 }, + .pipe_phy_status = {0x0034 ,6 ,6 ,0x01 ,0x00 }, + .con0_for_pcie = {0x0000 ,15 ,0 ,0x00 ,0x1000 }, + .con1_for_pcie = {0x0004 ,15 ,0 ,0x00 ,0x0000 }, + .con2_for_pcie = {0x0008 ,15 ,0 ,0x00 ,0x0101 }, + .con3_for_pcie = {0x000c ,15 ,0 ,0x00 ,0x0200 }, + .con0_for_sata = {0x0000 ,15 ,0 ,0x00 ,0x0119 }, + .con1_for_sata = {0x0004 ,15 ,0 ,0x00 ,0x0040 }, + .con2_for_sata = {0x0008 ,15 ,0 ,0x00 ,0x80c3 }, + .con3_for_sata = {0x000c ,15 ,0 ,0x00 ,0x4407 }, +/* pipe-grf */ + .pipe_con0_for_sata = {0x0000 ,15 ,0 ,0x00 ,0x2220 }, + .pipe_sgmii_mac_sel = {0x0040 ,1 ,1 ,0x00 ,0x01 }, + .pipe_xpcs_phy_ready = {0x0040 ,2 ,2 ,0x00 ,0x01 }, + .u3otg0_port_en = {0x0104 ,15 ,0 ,0x0181 ,0x1100 }, + .u3otg1_port_en = {0x0144 ,15 ,0 ,0x0181 ,0x1100 }, +}; + +static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = { + .grfcfg = &rk3568_combphy_grfcfgs, + .combphy_cfg = rk3568_combphy_cfg, +}; + +static const struct udevice_id rockchip_combphy_ids[] = { + { + .compatible ="rockchip,rk3568-naneng-combphy" , + .data = (ulong)&rk3568_combphy_cfgs + }, + { } +}; + +U_BOOT_DRIVER (rockchip_naneng_combphy) = { + .name ="naneng-combphy" , + .id =UCLASS_PHY , + .of_match = rockchip_combphy_ids, + .ops = &rochchip_combphy_ops, + .probe = rockchip_combphy_probe, + .priv_auto =sizeof (struct rockchip_combphy_priv ), +};
Re: [PATCH v4 09/12] arm64: dts: rk356x-u-boot: Drop combphy1 assigned-clocks/rates
In reply to Jagan TekiQuoted 11 lines · Jagan Teki
From: Jagan Teki <[email protected]>
combphy1 is failing to probe due to unhandled assigned-clocks and assigned-clocks-rates.
=> usb start
starting USB...
Bus usb@fd000000: Failed to get PHY1 for usb@fd000000 Port not available.
Bus usb@fd800000: USB EHCI 1.00
Quoted 4 lines
There is no real requirement for them in U-Boot to handle, hence mark them as deleted-properties for the probe to success
Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 20 lines
--- arch/arm/dts/rk356x-u-boot.dtsi | 5 +++++ 1 file changed, 5 insertions(+)arch/arm/dts/rk356x-u-boot.dtsi +5
-0@@ -22,6 +22,11 @@ }; }; +&combphy1 { + /delete-property/ assigned-clocks; + /delete-property/ assigned-clock-rates; +}; + &cru { u-boot,dm-pre-reloc; status = "okay";
Re: [PATCH v4 10/12] rockchip: rk3568: add rk3568 pinctrl driver
In reply to Jagan TekiQuoted 9 lines · Jagan Teki
From: Jagan Teki <[email protected]>
Add driver supporting pin multiplexing on rk3568 platform.
Co-developed-by Manoj Sai <[email protected]>Signed-off-by Manoj Sai <[email protected]>Co-developed-by Jianqun Xu <[email protected]>Signed-off-by Jianqun Xu <[email protected]>Signed-off-by Jagan Teki <[email protected]>
Thanks,
- Kever
Quoted 385 lines
--- drivers/pinctrl/rockchip/Makefile | 1 + drivers/pinctrl/rockchip/pinctrl-rk3568.c | 362 ++++++++++++++++++++++ 2 files changed, 363 insertions(+)create mode 100644
drivers/pinctrl/rockchip/pinctrl-rk3568.cdrivers/pinctrl/rockchip/Makefile +1
-0@@ -14,5 +14,6 @@ obj-$(CONFIG_ROCKCHIP_RK3308) += pinctrl-rk3308.o obj-$(CONFIG_ROCKCHIP_RK3328) += pinctrl-rk3328.o obj-$(CONFIG_ROCKCHIP_RK3368) += pinctrl-rk3368.o obj-$(CONFIG_ROCKCHIP_RK3399) += pinctrl-rk3399.o +obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.odrivers/pinctrl/rockchip/pinctrl-rk3568.c new file +362
-0@@ -0,0 +1,362 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* (C) Copyright 2020 Rockchip Electronics Co., Ltd +*/ + +#include <common.h> +#include <dm.h> +#include <dm/pinctrl.h> +#include <regmap.h> +#include <syscon.h> +#include <dt-bindings/pinctrl/rockchip.h> + +#include "pinctrl-rockchip.h" + +static struct rockchip_mux_route_data rk3568_mux_route_data[] = { +MR_TOPGRF (RK_GPIO0 ,RK_PB3 ,RK_FUNC_2 ,0x0300 ,RK_GENMASK_VAL (0 ,0 ,0 )),/* CAN0 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PA1 ,RK_FUNC_4 ,0x0300 ,RK_GENMASK_VAL (0 ,0 ,1 )),/* CAN0 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA1 ,RK_FUNC_3 ,0x0300 ,RK_GENMASK_VAL (2 ,2 ,0 )),/* CAN1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC3 ,RK_FUNC_3 ,0x0300 ,RK_GENMASK_VAL (2 ,2 ,1 )),/* CAN1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PB5 ,RK_FUNC_3 ,0x0300 ,RK_GENMASK_VAL (4 ,4 ,0 )),/* CAN2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PB2 ,RK_FUNC_4 ,0x0300 ,RK_GENMASK_VAL (4 ,4 ,1 )),/* CAN2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC4 ,RK_FUNC_1 ,0x0300 ,RK_GENMASK_VAL (6 ,6 ,0 )),/* EDPDP_HPDIN IO mux selection M0 */ +MR_TOPGRF (RK_GPIO0 ,RK_PC2 ,RK_FUNC_2 ,0x0300 ,RK_GENMASK_VAL (6 ,6 ,1 )),/* EDPDP_HPDIN IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PB1 ,RK_FUNC_3 ,0x0300 ,RK_GENMASK_VAL (8 ,8 ,0 )),/* GMAC1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PA7 ,RK_FUNC_3 ,0x0300 ,RK_GENMASK_VAL (8 ,8 ,1 )),/* GMAC1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PD1 ,RK_FUNC_1 ,0x0300 ,RK_GENMASK_VAL (10 ,10 ,0 )),/* HDMITX IO mux selection M0 */ +MR_TOPGRF (RK_GPIO0 ,RK_PC7 ,RK_FUNC_1 ,0x0300 ,RK_GENMASK_VAL (10 ,10 ,1 )),/* HDMITX IO mux selection M1 */ +MR_TOPGRF (RK_GPIO0 ,RK_PB6 ,RK_FUNC_1 ,0x0300 ,RK_GENMASK_VAL (14 ,14 ,0 )),/* I2C2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PB4 ,RK_FUNC_1 ,0x0300 ,RK_GENMASK_VAL (14 ,14 ,1 )),/* I2C2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA0 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (0 ,0 ,0 )),/* I2C3 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PB6 ,RK_FUNC_4 ,0x0304 ,RK_GENMASK_VAL (0 ,0 ,1 )),/* I2C3 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PB2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (2 ,2 ,0 )),/* I2C4 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PB1 ,RK_FUNC_2 ,0x0304 ,RK_GENMASK_VAL (2 ,2 ,1 )),/* I2C4 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PB4 ,RK_FUNC_4 ,0x0304 ,RK_GENMASK_VAL (4 ,4 ,0 )),/* I2C5 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PD0 ,RK_FUNC_2 ,0x0304 ,RK_GENMASK_VAL (4 ,4 ,1 )),/* I2C5 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (6 ,6 ,0 )),/* PWM4 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (6 ,6 ,1 )),/* PWM4 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (8 ,8 ,0 )),/* PWM5 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (8 ,8 ,1 )),/* PWM5 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (10 ,10 ,0 )),/* PWM6 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (10 ,10 ,1 )),/* PWM6 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (12 ,12 ,0 )),/* PWM7 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (12 ,12 ,1 )),/* PWM7 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (14 ,14 ,0 )),/* PWM8 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0304 ,RK_GENMASK_VAL (14 ,14 ,1 )),/* PWM8 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (0 ,0 ,0 )),/* PWM9 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (0 ,0 ,1 )),/* PWM9 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (2 ,2 ,0 )),/* PWM10 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (2 ,2 ,1 )),/* PWM10 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (4 ,4 ,0 )),/* PWM11 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (4 ,4 ,1 )),/* PWM11 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (6 ,6 ,0 )),/* PWM12 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (6 ,6 ,1 )),/* PWM12 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (8 ,8 ,0 )),/* PWM13 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (8 ,8 ,1 )),/* PWM13 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (10 ,10 ,0 )),/* PWM14 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (10 ,10 ,1 )),/* PWM14 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (12 ,12 ,0 )),/* PWM15 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0308 ,RK_GENMASK_VAL (12 ,12 ,1 )),/* PWM15 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_3 ,0x0308 ,RK_GENMASK_VAL (14 ,14 ,0 )),/* SDMMC2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PA5 ,RK_FUNC_5 ,0x0308 ,RK_GENMASK_VAL (14 ,14 ,1 )),/* SDMMC2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO0 ,RK_PB5 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (0 ,0 ,0 )),/* SPI0 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD3 ,RK_FUNC_3 ,0x030c ,RK_GENMASK_VAL (0 ,0 ,1 )),/* SPI0 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PB5 ,RK_FUNC_3 ,0x030c ,RK_GENMASK_VAL (2 ,2 ,0 )),/* SPI1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PC3 ,RK_FUNC_3 ,0x030c ,RK_GENMASK_VAL (2 ,2 ,1 )),/* SPI1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PC1 ,RK_FUNC_4 ,0x030c ,RK_GENMASK_VAL (4 ,4 ,0 )),/* SPI2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PA0 ,RK_FUNC_3 ,0x030c ,RK_GENMASK_VAL (4 ,4 ,1 )),/* SPI2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PB3 ,RK_FUNC_4 ,0x030c ,RK_GENMASK_VAL (6 ,6 ,0 )),/* SPI3 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC2 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (6 ,6 ,1 )),/* SPI3 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PB4 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (8 ,8 ,0 )),/* UART1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO0 ,RK_PD1 ,RK_FUNC_1 ,0x030c ,RK_GENMASK_VAL (8 ,8 ,1 )),/* UART1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO0 ,RK_PD1 ,RK_FUNC_1 ,0x030c ,RK_GENMASK_VAL (10 ,10 ,0 )),/* UART2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO1 ,RK_PD5 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (10 ,10 ,1 )),/* UART2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA1 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (12 ,12 ,0 )),/* UART3 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PB7 ,RK_FUNC_4 ,0x030c ,RK_GENMASK_VAL (12 ,12 ,1 )),/* UART3 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA6 ,RK_FUNC_2 ,0x030c ,RK_GENMASK_VAL (14 ,14 ,0 )),/* UART4 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PB2 ,RK_FUNC_4 ,0x030c ,RK_GENMASK_VAL (14 ,14 ,1 )),/* UART4 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PA2 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (0 ,0 ,0 )),/* UART5 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PC2 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (0 ,0 ,1 )),/* UART5 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PA4 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (2 ,2 ,0 )),/* UART6 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO1 ,RK_PD5 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (2 ,2 ,1 )),/* UART6 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PA6 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (5 ,4 ,0 )),/* UART7 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PC4 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (5 ,4 ,1 )),/* UART7 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD2 ,RK_FUNC_1 ,0x0310 ,RK_GENMASK_VAL (5 ,4 ,2 )),/* UART7 IO mux selection M2 */ +MR_TOPGRF (RK_GPIO2 ,RK_PC5 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (6 ,6 ,0 )),/* UART8 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD7 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (6 ,6 ,1 )),/* UART8 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PB0 ,RK_FUNC_3 ,0x0310 ,RK_GENMASK_VAL (9 ,8 ,0 )),/* UART9 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC5 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (9 ,8 ,1 )),/* UART9 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PA4 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (9 ,8 ,2 )),/* UART9 IO mux selection M2 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA2 ,RK_FUNC_1 ,0x0310 ,RK_GENMASK_VAL (11 ,10 ,0 )),/* I2S1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PC6 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (11 ,10 ,1 )),/* I2S1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD0 ,RK_FUNC_5 ,0x0310 ,RK_GENMASK_VAL (11 ,10 ,2 )),/* I2S1 IO mux selection M2 */ +MR_TOPGRF (RK_GPIO2 ,RK_PC1 ,RK_FUNC_1 ,0x0310 ,RK_GENMASK_VAL (12 ,12 ,0 )),/* I2S2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PB6 ,RK_FUNC_5 ,0x0310 ,RK_GENMASK_VAL (12 ,12 ,1 )),/* I2S2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO3 ,RK_PA2 ,RK_FUNC_4 ,0x0310 ,RK_GENMASK_VAL (14 ,14 ,0 )),/* I2S3 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC2 ,RK_FUNC_5 ,0x0310 ,RK_GENMASK_VAL (14 ,14 ,1 )),/* I2S3 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA6 ,RK_FUNC_3 ,0x0314 ,RK_GENMASK_VAL (0 ,0 ,0 )),/* PDM IO mux selection M0 */ +MR_TOPGRF (RK_GPIO3 ,RK_PD6 ,RK_FUNC_5 ,0x0314 ,RK_GENMASK_VAL (0 ,0 ,1 )),/* PDM IO mux selection M1 */ +MR_TOPGRF (RK_GPIO0 ,RK_PA5 ,RK_FUNC_3 ,0x0314 ,RK_GENMASK_VAL (3 ,2 ,0 )),/* PCIE20 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD0 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (3 ,2 ,1 )),/* PCIE20 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PB0 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (3 ,2 ,2 )),/* PCIE20 IO mux selection M2 */ +MR_TOPGRF (RK_GPIO0 ,RK_PA4 ,RK_FUNC_3 ,0x0314 ,RK_GENMASK_VAL (5 ,4 ,0 )),/* PCIE30X1 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD2 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (5 ,4 ,1 )),/* PCIE30X1 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO1 ,RK_PA5 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (5 ,4 ,2 )),/* PCIE30X1 IO mux selection M2 */ +MR_TOPGRF (RK_GPIO0 ,RK_PA6 ,RK_FUNC_2 ,0x0314 ,RK_GENMASK_VAL (7 ,6 ,0 )),/* PCIE30X2 IO mux selection M0 */ +MR_TOPGRF (RK_GPIO2 ,RK_PD4 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (7 ,6 ,1 )),/* PCIE30X2 IO mux selection M1 */ +MR_TOPGRF (RK_GPIO4 ,RK_PC2 ,RK_FUNC_4 ,0x0314 ,RK_GENMASK_VAL (7 ,6 ,2 )),/* PCIE30X2 IO mux selection M2 */ +}; + +static int rk3568_set_mux (struct rockchip_pin_bank *bank,int pin,int mux) +{ +struct rockchip_pinctrl_priv *priv = bank->priv; +int iomux_num = (pin /8 ); +struct regmap *regmap; +int reg, ret, mask; +u8 bit; +u32 data; + +debug ("setting mux of GPIO%d-%d to %d\n" , bank->bank_num, pin, mux); + +if (bank->iomux[iomux_num].type &IOMUX_SOURCE_PMU ) + regmap = priv->regmap_pmu; +else + regmap = priv->regmap_base; + + reg = bank->iomux[iomux_num].offset; +if ((pin %8 ) >=4 ) + reg +=0x4 ; + bit = (pin %4 ) *4 ; + mask =0xf ; + + data = (mask << (bit +16 )); + data |= (mux & mask) << bit; + ret =regmap_write (regmap, reg, data); + +return ret; +} + +#define RK3568_PULL_PMU_OFFSET 0x20 +#define RK3568_PULL_GRF_OFFSET 0x80 +#define RK3568_PULL_BITS_PER_PIN 2 +#define RK3568_PULL_PINS_PER_REG 8 +#define RK3568_PULL_BANK_STRIDE 0x10 + +static void rk3568_calc_pull_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num,struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *info = bank->priv; + +if (bank->bank_num ==0 ) { + *regmap = info->regmap_pmu; + *reg =RK3568_PULL_PMU_OFFSET ; + *reg += bank->bank_num *RK3568_PULL_BANK_STRIDE ; + }else { + *regmap = info->regmap_base; + *reg =RK3568_PULL_GRF_OFFSET ; + *reg += (bank->bank_num -1 ) *RK3568_PULL_BANK_STRIDE ; + } + + *reg += ((pin_num /RK3568_PULL_PINS_PER_REG ) *4 ); + *bit = (pin_num %RK3568_PULL_PINS_PER_REG ); + *bit *=RK3568_PULL_BITS_PER_PIN ; +} + +#define RK3568_DRV_PMU_OFFSET 0x70 +#define RK3568_DRV_GRF_OFFSET 0x200 +#define RK3568_DRV_BITS_PER_PIN 8 +#define RK3568_DRV_PINS_PER_REG 2 +#define RK3568_DRV_BANK_STRIDE 0x40 + +static void rk3568_calc_drv_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num,struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *info = bank->priv; + +/* The first 32 pins of the first bank are located in PMU */ +if (bank->bank_num ==0 ) { + *regmap = info->regmap_pmu; + *reg =RK3568_DRV_PMU_OFFSET ; + }else { + *regmap = info->regmap_base; + *reg =RK3568_DRV_GRF_OFFSET ; + *reg += (bank->bank_num -1 ) *RK3568_DRV_BANK_STRIDE ; + } + + *reg += ((pin_num /RK3568_DRV_PINS_PER_REG ) *4 ); + *bit = (pin_num %RK3568_DRV_PINS_PER_REG ); + *bit *=RK3568_DRV_BITS_PER_PIN ; +} + +#define RK3568_SCHMITT_BITS_PER_PIN 2 +#define RK3568_SCHMITT_PINS_PER_REG 8 +#define RK3568_SCHMITT_BANK_STRIDE 0x10 +#define RK3568_SCHMITT_GRF_OFFSET 0xc0 +#define RK3568_SCHMITT_PMUGRF_OFFSET 0x30 + +static int rk3568_calc_schmitt_reg_and_bit (struct rockchip_pin_bank *bank, +int pin_num,struct regmap **regmap, +int *reg,u8 *bit) +{ +struct rockchip_pinctrl_priv *info = bank->priv; + +if (bank->bank_num ==0 ) { + *regmap = info->regmap_pmu; + *reg =RK3568_SCHMITT_PMUGRF_OFFSET ; + }else { + *regmap = info->regmap_base; + *reg =RK3568_SCHMITT_GRF_OFFSET ; + *reg += (bank->bank_num -1 ) *RK3568_SCHMITT_BANK_STRIDE ; + } + + *reg += ((pin_num /RK3568_SCHMITT_PINS_PER_REG ) *4 ); + *bit = pin_num %RK3568_SCHMITT_PINS_PER_REG ; + *bit *=RK3568_SCHMITT_BITS_PER_PIN ; + +return 0 ; +} + +static int rk3568_set_pull (struct rockchip_pin_bank *bank, +int pin_num,int pull) +{ +struct regmap *regmap; +int reg, ret; +u8 bit, type; +u32 data; + +if (pull ==PIN_CONFIG_BIAS_PULL_PIN_DEFAULT ) +return -ENOTSUPP ; + +rk3568_calc_pull_reg_and_bit (bank, pin_num, ®map, ®, &bit); + type = bank->pull_type[pin_num /8 ]; + ret =rockchip_translate_pull_value (type, pull); +if (ret <0 ) { +debug ("unsupported pull setting %d\n" , pull); +return ret; + } + +/* enable the write to the equivalent lower bits */ + data = ((1 <<ROCKCHIP_PULL_BITS_PER_PIN ) -1 ) << (bit +16 ); + + data |= (ret << bit); + ret =regmap_write (regmap, reg, data); + +return ret; +} + +static int rk3568_set_drive (struct rockchip_pin_bank *bank, +int pin_num,int strength) +{ +struct regmap *regmap; +int reg; +u32 data; +u8 bit; +int drv = (1 << (strength +1 )) -1 ; +int ret =0 ; + +rk3568_calc_drv_reg_and_bit (bank, pin_num, ®map, ®, &bit); + +/* enable the write to the equivalent lower bits */ + data = ((1 <<RK3568_DRV_BITS_PER_PIN ) -1 ) << (bit +16 ); + data |= (drv << bit); + + ret =regmap_write (regmap, reg, data); +if (ret) +return ret; + +if (bank->bank_num ==1 && pin_num ==21 ) + reg =0x0840 ; +else if (bank->bank_num ==2 && pin_num ==2 ) + reg =0x0844 ; +else if (bank->bank_num ==2 && pin_num ==8 ) + reg =0x0848 ; +else if (bank->bank_num ==3 && pin_num ==0 ) + reg =0x084c ; +else if (bank->bank_num ==3 && pin_num ==6 ) + reg =0x0850 ; +else if (bank->bank_num ==4 && pin_num ==0 ) + reg =0x0854 ; +else +return 0 ; + + data = ((1 <<RK3568_DRV_BITS_PER_PIN ) -1 ) <<16 ; + data |= drv; + +return regmap_write (regmap, reg, data); +} + +static int rk3568_set_schmitt (struct rockchip_pin_bank *bank, +int pin_num,int enable) +{ +struct regmap *regmap; +int reg; +u32 data; +u8 bit; + +rk3568_calc_schmitt_reg_and_bit (bank, pin_num, ®map, ®, &bit); + +/* enable the write to the equivalent lower bits */ + data = ((1 <<RK3568_SCHMITT_BITS_PER_PIN ) -1 ) << (bit +16 ); + data |= (enable << bit); + +return regmap_write (regmap, reg, data); +} + +static struct rockchip_pin_bank rk3568_pin_banks[] = { +PIN_BANK_IOMUX_FLAGS (0 ,32 ,"gpio0" ,IOMUX_SOURCE_PMU |IOMUX_WIDTH_4BIT , +IOMUX_SOURCE_PMU |IOMUX_WIDTH_4BIT , +IOMUX_SOURCE_PMU |IOMUX_WIDTH_4BIT , +IOMUX_SOURCE_PMU |IOMUX_WIDTH_4BIT ), +PIN_BANK_IOMUX_FLAGS (1 ,32 ,"gpio1" ,IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT ), +PIN_BANK_IOMUX_FLAGS (2 ,32 ,"gpio2" ,IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT ), +PIN_BANK_IOMUX_FLAGS (3 ,32 ,"gpio3" ,IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT ), +PIN_BANK_IOMUX_FLAGS (4 ,32 ,"gpio4" ,IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT , +IOMUX_WIDTH_4BIT ), +}; + +static const struct rockchip_pin_ctrl rk3568_pin_ctrl = { + .pin_banks = rk3568_pin_banks, + .nr_banks =ARRAY_SIZE (rk3568_pin_banks), + .nr_pins =160 , + .grf_mux_offset =0x0 , + .pmu_mux_offset =0x0 , + .iomux_routes = rk3568_mux_route_data, + .niomux_routes =ARRAY_SIZE (rk3568_mux_route_data), + .set_mux = rk3568_set_mux, + .set_pull = rk3568_set_pull, + .set_drive = rk3568_set_drive, + .set_schmitt = rk3568_set_schmitt, +}; + +static const struct udevice_id rk3568_pinctrl_ids[] = { + { + .compatible ="rockchip,rk3568-pinctrl" , + .data = (ulong)&rk3568_pin_ctrl + }, + { } +}; + +U_BOOT_DRIVER (pinctrl_rk3568) = { + .name ="rockchip_rk3568_pinctrl" , + .id =UCLASS_PINCTRL , + .of_match = rk3568_pinctrl_ids, + .priv_auto =sizeof (struct rockchip_pinctrl_priv ), + .ops = &rockchip_pinctrl_ops, +#if CONFIG_IS_ENABLED(OF_REAL) + .bind = dm_scan_fdt_dev, +#endif + .probe = rockchip_pinctrl_probe, +};
Re: [PATCH v4 11/12] rockchip: rk3568: Select DM_REGULATOR_FIXED
In reply to Jagan TekiQuoted 7 lines · Jagan Teki
From: Manoj Sai <[email protected]>
Select the
DM_REGULATOR_FIXEDon RK3568 platform.Co-developed-by Suniel Mahesh <[email protected]>Signed-off-by Suniel Mahesh <[email protected]>Signed-off-by Manoj Sai <[email protected]>
Thanks,
- Kever
Quoted 16 lines
--- arch/arm/mach-rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm/mach-rockchip/Kconfig +1
-0@@ -286,6 +286,7 @@ config ROCKCHIP_RK3568 select REGMAP select SYSCON select BOARD_LATE_INIT + select DM_REGULATOR_FIXED select DM_RESET imply ROCKCHIP_COMMON_BOARD help
Re: [PATCH v4 12/12] rk3566: radxa-cm3: Enable USB2.0, USB3.0 support
In reply to Jagan TekiQuoted 32 lines · Jagan Teki
From: Manoj Sai <[email protected]>
=> usb start
starting USB...
Bus usb@fd000000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@fd800000: USB EHCI 1.00
scanning bus usb@fd000000 for devices... cannot reset port 1!? 2 USB Device(s) found
scanning bus usb@fd800000 for devices... 4 USB Device(s) found
scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:1 Hub (5 Gb/s, 0mA) | U-Boot XHCI Host Controller | +-2 Mass Storage (5 Gb/s, 224mA) SanDisk Dual Drive 04019c9b2e1a58f24ee318c3c123aa5 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Hub (480 Mb/s, 100mA) | USB 2.0 Hub | +-3 Mass Storage (480 Mb/s, 500mA) | JetFlash Mass Storage Device 19M7I4ZQFTSC08SU | +-4 Human Interface (12 Mb/s, 98mA) Logitech USB Receiver
Quoted 3 lines
Co-developed-by Suniel Mahesh <[email protected]>Signed-off-by Suniel Mahesh <[email protected]>Signed-off-by Manoj Sai <[email protected]>
Thanks,
- Kever
Quoted 37 lines
--- configs/radxa-cm3-io-rk3566_defconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)configs/radxa-cm3-io-rk3566_defconfig +11
-0@@ -38,6 +38,7 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_ATF=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set # CONFIG_SPL_DOS_PARTITION is not set CONFIG_SPL_OF_CONTROL=y@@ -57,10 +58,20 @@ CONFIG_MMC_SDHCI_SDMA=y CONFIG_MMC_SDHCI_ROCKCHIP=y CONFIG_ETH_DESIGNWARE=y CONFIG_GMAC_ROCKCHIP=y +CONFIG_PHY_ROCKCHIP_INNO_USB2=y +CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y CONFIG_REGULATOR_PWM=y +CONFIG_DM_REGULATOR_GPIO=y CONFIG_PWM_ROCKCHIP=y CONFIG_SPL_RAM=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_DWC3=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_ERRNO_STR=y