board: rockchip: Add ArmSoM Sige5
Subsystems (5)
v3 cover board: rockchip: Add ArmSoM Sige5
This series add support for the ArmSoM Sige5 board and is a split from the "rockchip: rk3576: Add rng, checkboard() and ArmSoM Sige5" v1 [1] series.
Changes in v3:
- Ensure USB3OTG U3 port is enabled when USB3 PHY is used
- Drop device tree patches merged with the v6.16-dts sync
Changes in v2:
- Pick dts/upstream commits to add PCIe nodes
- Add support for RK3576 to the naneng-combphy driver
- Enable PCIe, NVMe and USB Kconfig options
This series depends on the "rockchip: rk3576: Add rng, checkboard() and generic board" v3 [1] series for a clean apply.
[1] https://patchwork.ozlabs.org/cover/2118071/
Jon Lin (1):
phy: rockchip: naneng-combphy: Add support for RK3576
Jonas Karlman (2):
rockchip: clk: clk_rk3576: Add dummy CLK_REF_PCIEx_PHY support
board: rockchip: Add ArmSoM Sige5
arch/arm/dts/rk3576-armsom-sige5-u-boot.dtsi | 18 +++ arch/arm/mach-rockchip/rk3576/MAINTAINERS | 6 + configs/sige5-rk3576_defconfig | 66 ++++++++ doc/board/rockchip/rockchip.rst | 1 + drivers/clk/rockchip/clk_rk3576.c | 2 + .../rockchip/phy-rockchip-naneng-combphy.c | 147 ++++++++++++++++++ 6 files changed, 240 insertions(+) create mode 100644 arch/arm/dts/rk3576-armsom-sige5-u-boot.dtsi create mode 100644 configs/sige5-rk3576_defconfig
Signature · 1 line
2.50.1
PATCH v3 1/3 rockchip: clk: clk_rk3576: Add dummy CLK_REF_PCIEx_PHY support
Add dummy support for the CLK_REF_PCIEx_PHY clocks to allow probe of the phy-rockchip-naneng-combphy driver on RK3576.
---
v3: No change
v2: New patch
--- drivers/clk/rockchip/clk_rk3576.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/rockchip/clk_rk3576.c +2 -0
@@ -2168,6 +2168,8 @@ static ulong rk3576_clk_set_rate(struct clk *clk, ulong rate)case CLK_CPLL_DIV10 :case FCLK_DDR_CM0_CORE :case ACLK_PHP_ROOT : +case CLK_REF_PCIE0_PHY : +case CLK_REF_PCIE1_PHY : ret =0 ;break ;#ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.50.1
Re: [PATCH v3 1/3] rockchip: clk: clk_rk3576: Add dummy CLK_REF_PCIEx_PHY support
Quoted 4 lines · Jonas Karlman
Add dummy support for the
CLK_REF_PCIEx_PHYclocks to allow probe of the phy-rockchip-naneng-combphy driver on RK3576.Signed-off-by Jonas Karlman <[email protected]>
Thanks,
- Kever
Quoted 20 lines
---
v3: No change
v2: New patch--- drivers/clk/rockchip/clk_rk3576.c | 2 ++ 1 file changed, 2 insertions(+)drivers/clk/rockchip/clk_rk3576.c +2
-0@@ -2168,6 +2168,8 @@ static ulong rk3576_clk_set_rate(struct clk *clk, ulong rate)case CLK_CPLL_DIV10 :case FCLK_DDR_CM0_CORE :case ACLK_PHP_ROOT : +case CLK_REF_PCIE0_PHY : +case CLK_REF_PCIE1_PHY : ret =0 ;break ;#ifndef CONFIG_SPL_BUILD
PATCH v3 2/3 phy: rockchip: naneng-combphy: Add support for RK3576
In reply to Jonas KarlmanFrom: Jon Lin <[email protected]>
Add support for the PCIe/USB3/SATA combo PHYs used in the RK3576 SoC.
Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.
---
v3: Ensure USB3OTG U3 port is enabled when USB3 PHY is used
v2: New patch
I have only verified that the PCIe and USB3 mode config works.
--- .../rockchip/phy-rockchip-naneng-combphy.c | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +147 -0
@@ -388,6 +388,149 @@ static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = { .combphy_cfg = rk3568_combphy_cfg, }; +static int rk3576_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 : +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 )); + +/* Set Rx squelch input filler bandwidth */ +writel (0x0d , priv->mmio + (0x14 <<2 )); + +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); +param_write (priv->pipe_grf, &cfg->u3otg1_port_en, true); +break ; +case PHY_TYPE_SATA : +/* Enable adaptive CTLE for SATA Rx */ + val =readl (priv->mmio + (0x0e <<2 )); + val &= ~GENMASK (0 ,0 ); + val |=0x01 ; +writel (val, priv->mmio + (0x0e <<2 )); +/* Set tx_rterm = 50 ohm and rx_rterm = 43.5 ohm */ +writel (0x8F , priv->mmio + (0x06 <<2 )); + +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); +param_write (priv->pipe_grf, &cfg->pipe_con1_for_sata, true); +break ; +case PHY_TYPE_SGMII : +case PHY_TYPE_QSGMII : +default : +dev_err (priv->dev,"incompatible PHY type\n" ); +return -EINVAL ; + } + +/* 100MHz refclock signal is good */ +clk_set_rate (&priv->ref_clk,100000000 ); +param_write (priv->phy_grf, &cfg->pipe_clk_100m, true); +if (priv->mode ==PHY_TYPE_PCIE ) { +/* gate_tx_pck_sel length select work for L1SS */ +writel (0xc0 , priv->mmio +0x74 ); + +/* PLL KVCO tuning fine */ + val =readl (priv->mmio + (0x20 <<2 )); + val &= ~(0x7 <<2 ); + val |=0x2 <<2 ; +writel (val, priv->mmio + (0x20 <<2 )); + +/* Set up rx_trim: PLL LPF C1 85pf R1 1.25kohm */ +writel (0x4c , priv->mmio + (0x1b <<2 )); + +/* Set up su_trim: T3_P1 650mv */ +writel (0x90 , priv->mmio + (0xa <<2 )); +writel (0x43 , priv->mmio + (0xb <<2 )); +writel (0x88 , priv->mmio + (0xc <<2 )); +writel (0x56 , priv->mmio + (0xd <<2 )); + } + +return 0 ; +} + +static const struct rockchip_combphy_grfcfg rk3576_combphy_grfcfgs = { +/* pipe-phy-grf */ + .pcie_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x11 }, + .usb_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x04 }, + .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_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 ,0x0129 }, + .con1_for_sata = {0x0004 ,15 ,0 ,0x00 ,0x0000 }, + .con2_for_sata = {0x0008 ,15 ,0 ,0x00 ,0x80c1 }, + .con3_for_sata = {0x000c ,15 ,0 ,0x00 ,0x0407 }, +/* php-grf */ + .pipe_con0_for_sata = {0x001C ,2 ,0 ,0x00 ,0x2 }, + .pipe_con1_for_sata = {0x0020 ,2 ,0 ,0x00 ,0x2 }, + .u3otg1_port_en = {0x0038 ,15 ,0 ,0x0181 ,0x1100 }, +}; + +static const struct rockchip_combphy_cfg rk3576_combphy_cfgs = { + .num_phys =2 , + .phy_ids = { +0x2b050000 , +0x2b060000 , + }, + .grfcfg = &rk3576_combphy_grfcfgs, + .combphy_cfg = rk3576_combphy_cfg, +}; +static int rk3588_combphy_cfg (struct rockchip_combphy_priv *priv) {const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg;
@@ -499,6 +642,10 @@ static const struct udevice_id rockchip_combphy_ids[] = { .compatible = "rockchip,rk3568-naneng-combphy", .data = (ulong)&rk3568_combphy_cfgs }, + { + .compatible = "rockchip,rk3576-naneng-combphy", + .data = (ulong)&rk3576_combphy_cfgs + }, { .compatible = "rockchip,rk3588-naneng-combphy", .data = (ulong)&rk3588_combphy_cfgs
Signature · 1 line
2.50.1
Re: [PATCH v3 2/3] phy: rockchip: naneng-combphy: Add support for RK3576
Quoted 8 lines · Jonas Karlman
From: Jon Lin <[email protected]>
Add support for the PCIe/USB3/SATA combo PHYs used in the RK3576 SoC.
Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.
Signed-off-by Jon Lin <[email protected]>Signed-off-by Jonas Karlman <[email protected]>
Thanks,
- Kever
Quoted 174 lines
---
v3: Ensure USB3OTG U3 port is enabled when USB3 PHY is used
v2: New patchI have only verified that the PCIe and USB3 mode config works.
--- .../rockchip/phy-rockchip-naneng-combphy.c | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+)drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +147
-0@@ -388,6 +388,149 @@ static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = { .combphy_cfg = rk3568_combphy_cfg, }; +static int rk3576_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 : +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 )); + +/* Set Rx squelch input filler bandwidth */ +writel (0x0d , priv->mmio + (0x14 <<2 )); + +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); +param_write (priv->pipe_grf, &cfg->u3otg1_port_en, true); +break ; +case PHY_TYPE_SATA : +/* Enable adaptive CTLE for SATA Rx */ + val =readl (priv->mmio + (0x0e <<2 )); + val &= ~GENMASK (0 ,0 ); + val |=0x01 ; +writel (val, priv->mmio + (0x0e <<2 )); +/* Set tx_rterm = 50 ohm and rx_rterm = 43.5 ohm */ +writel (0x8F , priv->mmio + (0x06 <<2 )); + +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); +param_write (priv->pipe_grf, &cfg->pipe_con1_for_sata, true); +break ; +case PHY_TYPE_SGMII : +case PHY_TYPE_QSGMII : +default : +dev_err (priv->dev,"incompatible PHY type\n" ); +return -EINVAL ; + } + +/* 100MHz refclock signal is good */ +clk_set_rate (&priv->ref_clk,100000000 ); +param_write (priv->phy_grf, &cfg->pipe_clk_100m, true); +if (priv->mode ==PHY_TYPE_PCIE ) { +/* gate_tx_pck_sel length select work for L1SS */ +writel (0xc0 , priv->mmio +0x74 ); + +/* PLL KVCO tuning fine */ + val =readl (priv->mmio + (0x20 <<2 )); + val &= ~(0x7 <<2 ); + val |=0x2 <<2 ; +writel (val, priv->mmio + (0x20 <<2 )); + +/* Set up rx_trim: PLL LPF C1 85pf R1 1.25kohm */ +writel (0x4c , priv->mmio + (0x1b <<2 )); + +/* Set up su_trim: T3_P1 650mv */ +writel (0x90 , priv->mmio + (0xa <<2 )); +writel (0x43 , priv->mmio + (0xb <<2 )); +writel (0x88 , priv->mmio + (0xc <<2 )); +writel (0x56 , priv->mmio + (0xd <<2 )); + } + +return 0 ; +} + +static const struct rockchip_combphy_grfcfg rk3576_combphy_grfcfgs = { +/* pipe-phy-grf */ + .pcie_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x11 }, + .usb_mode_set = {0x0000 ,5 ,0 ,0x00 ,0x04 }, + .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_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 ,0x0129 }, + .con1_for_sata = {0x0004 ,15 ,0 ,0x00 ,0x0000 }, + .con2_for_sata = {0x0008 ,15 ,0 ,0x00 ,0x80c1 }, + .con3_for_sata = {0x000c ,15 ,0 ,0x00 ,0x0407 }, +/* php-grf */ + .pipe_con0_for_sata = {0x001C ,2 ,0 ,0x00 ,0x2 }, + .pipe_con1_for_sata = {0x0020 ,2 ,0 ,0x00 ,0x2 }, + .u3otg1_port_en = {0x0038 ,15 ,0 ,0x0181 ,0x1100 }, +}; + +static const struct rockchip_combphy_cfg rk3576_combphy_cfgs = { + .num_phys =2 , + .phy_ids = { +0x2b050000 , +0x2b060000 , + }, + .grfcfg = &rk3576_combphy_grfcfgs, + .combphy_cfg = rk3576_combphy_cfg, +}; +static int rk3588_combphy_cfg (struct rockchip_combphy_priv *priv) {const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg;@@ -499,6 +642,10 @@ static const struct udevice_id rockchip_combphy_ids[] = { .compatible = "rockchip,rk3568-naneng-combphy", .data = (ulong)&rk3568_combphy_cfgs }, + { + .compatible = "rockchip,rk3576-naneng-combphy", + .data = (ulong)&rk3576_combphy_cfgs + }, { .compatible = "rockchip,rk3588-naneng-combphy", .data = (ulong)&rk3588_combphy_cfgs
PATCH v3 3/3 board: rockchip: Add ArmSoM Sige5
In reply to Jonas KarlmanArmSoM-Sige5 adopts the second-generation 8nm high-performance AIOT platform Rockchip RK3576, with a 6 TOPS computing power NPU and support for up to 16GB of large memory. It supports 4K video encoding and decoding, offers rich interfaces including dual gigabit Ethernet ports, WiFi 6 & BT5, and various video outputs.
Features tested on a ArmSoM Sige5 v1.1:
- SD-card boot
- eMMC boot
- Ethernet
- PCIe NVMe
---
Changes in v3:
- No change
Changes in v2:
- Enable PCIe, NVMe and USB Kconfig options
- Collect r-b tag
--- arch/arm/dts/rk3576-armsom-sige5-u-boot.dtsi | 18 ++++++ arch/arm/mach-rockchip/rk3576/MAINTAINERS | 6 ++ configs/sige5-rk3576_defconfig | 66 ++++++++++++++++++++ doc/board/rockchip/rockchip.rst | 1 + 4 files changed, 91 insertions(+) create mode 100644 arch/arm/dts/rk3576-armsom-sige5-u-boot.dtsi create mode 100644 configs/sige5-rk3576_defconfig
arch/arm/dts/rk3576-armsom-sige5-u-boot.dtsi new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +#include "rk3576-u-boot.dtsi" + +/ { + aliases { + mmc0 = &sdhci; + mmc1 = &sdmmc; + }; +}; + +&red_led { + default-state = "on"; +}; + +&sdhci { + cap-mmc-highspeed; +};
arch/arm/mach-rockchip/rk3576/MAINTAINERS +6 -0
@@ -3,3 +3,9 @@ M: Jonas Karlman <[email protected]> S: Maintained F: arch/arm/dts/rk3576-generic* F: configs/generic-rk3576_defconfig + +SIGE5-RK3576 +M: Jonas Karlman <[email protected]> +S: Maintained +F: arch/arm/dts/rk3576-armsom-sige5* +F: configs/sige5-rk3576_defconfig
configs/sige5-rk3576_defconfig new file +66 -0
66 lines not on this page · raw message
doc/board/rockchip/rockchip.rst +1 -0
@@ -134,6 +134,7 @@ List of mainline supported Rockchip boards: - Radxa ROCK 3B (rock-3b-rk3568) * rk3576 + - ArmSoM Sige5 (sige5-rk3576) - Firefly ROC-RK3576-PC (roc-pc-rk3576) - Generic RK3576 (generic-rk3576)
Signature · 1 line
2.50.1