Skip to contentSkip to conversation

pci: pcie_dw_rockchip: Add rk3588 compatible

PATCH Superseded Eugen Hristev 3 participants 15 messages Apr 17, 2023 – Apr 21, 2023

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/7 pci: pcie_dw_rockchip: Add rk3588 compatible

From: Jon Lin <[email protected]>

Add compatible for RK3588 SoC.

---
 drivers/pci/pcie_dw_rockchip.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pcie_dw_rockchip.c +1 -0
index 6155710a9f5f..ff121046604a 100644
@@ -468,6 +468,7 @@ static const struct dm_pci_ops rockchip_pcie_ops = {
 
 static const struct udevice_id rockchip_pcie_ids[] = {
 	{ .compatible = "rockchip,rk3568-pcie" },
+	{ .compatible = "rockchip,rk3588-pcie" },
 	{ }
 };
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/7 pci: pcie_dw_rockchip: Support max_link_speed dts property

From: Jon Lin <[email protected]>

Add support for max_link_speed specified in the PCI DT binding.

[[email protected]: port to latest API, set default correctly, align to 80 chars]

---
 drivers/pci/pcie_dw_rockchip.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/pci/pcie_dw_rockchip.c +10 -1
index ff121046604a..6a2a5e15646e 100644
@@ -42,6 +42,7 @@ struct rk_pcie {
 	struct clk_bulk	clks;
 	struct reset_ctl_bulk	rsts;
 	struct gpio_desc	rst_gpio;
+	u32		gen;
 };
 
 /* Parameters for the waiting for iATU enabled routine */
@@ -331,7 +332,7 @@ static int rockchip_pcie_init_port(struct udevice *dev)
 	rk_pcie_writel_apb(priv, 0x0, 0xf00040);
 	pcie_dw_setup_host(&priv->dw);
 
-	ret = rk_pcie_link_up(priv, LINK_SPEED_GEN_3);
+	ret = rk_pcie_link_up(priv, priv->gen);
 	if (ret < 0)
 		goto err_link_up;
 
@@ -351,6 +352,7 @@ err_exit_phy:
 static int rockchip_pcie_parse_dt(struct udevice *dev)
 {
 	struct rk_pcie *priv = dev_get_priv(dev);
+	u32 max_link_speed;
 	int ret;
 
 	priv->dw.dbi_base = (void *)dev_read_addr_index(dev, 0);
@@ -397,6 +399,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)
 		goto rockchip_pcie_parse_dt_err_phy_get_by_index;
 	}
 
+	ret = ofnode_read_u32(dev_ofnode(dev), "max-link-speed",
+			      &max_link_speed);
+	if (ret < 0 || max_link_speed > 4)
+		priv->gen = LINK_SPEED_GEN_3;
+	else
+		priv->gen = max_link_speed;
+
 	return 0;
 
 rockchip_pcie_parse_dt_err_phy_get_by_index:
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 2/7] pci: pcie_dw_rockchip: Support max_link_speed dts property

Hi Eugen,

Quoted 42 lines · Eugen Hristev

From: Jon Lin <[email protected]>

Add support for max_link_speed specified in the PCI DT binding.

[[email protected]: port to latest API, set default correctly, align to 80 chars]

---
 drivers/pci/pcie_dw_rockchip.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/pci/pcie_dw_rockchip.c +3 -1
index ff121046604a..6a2a5e15646e 100644
@@ -42,6 +42,7 @@ struct rk_pcie {
 	struct clk_bulk	clks;
 	struct reset_ctl_bulk	rsts;
 	struct gpio_desc	rst_gpio;
+	u32		gen;
 };
 
 /* Parameters for the waiting for iATU enabled routine */
@@ -331,7 +332,7 @@ static int rockchip_pcie_init_port(struct udevice *dev)
 	rk_pcie_writel_apb(priv, 0x0, 0xf00040);
 	pcie_dw_setup_host(&priv->dw);
 
-	ret = rk_pcie_link_up(priv, LINK_SPEED_GEN_3);
+	ret = rk_pcie_link_up(priv, priv->gen);
 	if (ret < 0)
 		goto err_link_up;
 
@@ -351,6 +352,7 @@ err_exit_phy:
 static int rockchip_pcie_parse_dt(struct udevice *dev)
 {
 	struct rk_pcie *priv = dev_get_priv(dev);
+	u32 max_link_speed;
 	int ret;
 
 	priv->dw.dbi_base = (void *)dev_read_addr_index(dev, 0);

drivers/pci/pcie_dw_rockchip.c static int rockchip_pcie_parse_dt(struct udevice *dev) · line 403

Quoted 5 lines
drivers/pci/pcie_dw_rockchip.c +2 -0
@@ -397,6 +399,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)
 		goto rockchip_pcie_parse_dt_err_phy_get_by_index;
 	}
 
+	ret = ofnode_read_u32(dev_ofnode(dev), "max-link-speed",
+			      &max_link_speed);

I would recommend to use the related dev_read function here, possible something like this:

  priv->gen = dev_read_u32_default(dev, "max-link-speed", LINK_SPEED_GEN_3);

Regards,
Jonas

Quoted 8 lines
drivers/pci/pcie_dw_rockchip.c +5 -0
+	if (ret < 0 || max_link_speed > 4)
+		priv->gen = LINK_SPEED_GEN_3;
+	else
+		priv->gen = max_link_speed;
+
 	return 0;
 
 rockchip_pcie_parse_dt_err_phy_get_by_index:
#3 lore raw

PATCH 3/7 phy: rockchip: naneng-combphy: Add support for multiple resets

In reply to Eugen Hristev

Some variants of the PHY have more than just one reset. To cover all cases, request the rests in bulk rather than just the reset at index 0.

---
 drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +4 -4
index 78da5fe79700..b673a8da9f8e 100644
@@ -76,7 +76,7 @@ struct rockchip_combphy_priv {
 	struct regmap *pipe_grf;
 	struct regmap *phy_grf;
 	struct phy *phy;
-	struct reset_ctl phy_rst;
+	struct reset_ctl_bulk phy_rsts;
 	struct clk ref_clk;
 	const struct rockchip_combphy_cfg *cfg;
 };
@@ -189,7 +189,7 @@ static int rockchip_combphy_init(struct phy *phy)
 	if (ret)
 		goto err_clk;
 
-	reset_deassert(&priv->phy_rst);
+	reset_deassert_bulk(&priv->phy_rsts);
 
 	return 0;
 
@@ -204,7 +204,7 @@ 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);
+	reset_assert_bulk(&priv->phy_rsts);
 
 	return 0;
 }
@@ -255,7 +255,7 @@ static int rockchip_combphy_parse_dt(struct udevice *dev,
 		return PTR_ERR(&priv->ref_clk);
 	}
 
-	ret = reset_get_by_index(dev, 0, &priv->phy_rst);
+	ret = reset_get_bulk(dev, &priv->phy_rsts);
 	if (ret) {
 		dev_err(dev, "no phy reset control specified\n");
 		return ret;
Signature · 1 line
2.34.1
Reviewed-by on v1 3/7
#4 lore raw

Re: [PATCH 3/7] phy: rockchip: naneng-combphy: Add support for multiple resets

Quoted 7 lines · Eugen Hristev

Some variants of the PHY have more than just one reset. To cover all cases, request the rests in bulk rather than just the reset at index 0.

Thanks,
- Kever

Quoted 44 lines
---
  drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +4 -4
index 78da5fe79700..b673a8da9f8e 100644
@@ -76,7 +76,7 @@ struct rockchip_combphy_priv {
  	struct regmap *pipe_grf;
  	struct regmap *phy_grf;
  	struct phy *phy;
-	struct reset_ctl phy_rst;
+	struct reset_ctl_bulk phy_rsts;
  	struct clk ref_clk;
  	const struct rockchip_combphy_cfg *cfg;
  };
@@ -189,7 +189,7 @@ static int rockchip_combphy_init(struct phy *phy)
  	if (ret)
  		goto err_clk;
 
-	reset_deassert(&priv->phy_rst);
+	reset_deassert_bulk(&priv->phy_rsts);
 
  	return 0;
 
@@ -204,7 +204,7 @@ 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);
+	reset_assert_bulk(&priv->phy_rsts);
 
  	return 0;
  }
@@ -255,7 +255,7 @@ static int rockchip_combphy_parse_dt(struct udevice *dev,
  		return PTR_ERR(&priv->ref_clk);
  	}
 
-	ret = reset_get_by_index(dev, 0, &priv->phy_rst);
+	ret = reset_get_bulk(dev, &priv->phy_rsts);
  	if (ret) {
  		dev_err(dev, "no phy reset control specified\n");
  		return ret;
#5 lore raw

PATCH 4/7 phy: rockchip: naneng-combphy: Support rk3588

In reply to Eugen Hristev

From: Jon Lin <[email protected]>

Add support for rk3588 phy variant.
The PHY clock is fixed at 100MHz.

[[email protected]: update pcie pll parameters]
[[email protected]: squashed, tidy up]
---
 .../rockchip/phy-rockchip-naneng-combphy.c    | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +95 -0
index b673a8da9f8e..d5408ccac976 100644
@@ -58,6 +58,7 @@ struct rockchip_combphy_grfcfg {
 	struct combphy_reg con2_for_sata;
 	struct combphy_reg con3_for_sata;
 	struct combphy_reg pipe_con0_for_sata;
+	struct combphy_reg pipe_con1_for_sata;
 	struct combphy_reg pipe_sgmii_mac_sel;
 	struct combphy_reg pipe_xpcs_phy_ready;
 	struct combphy_reg u3otg0_port_en;
@@ -423,11 +424,105 @@ static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = {
 	.combphy_cfg	= rk3568_combphy_cfg,
 };
 
+static int rk3588_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:
+		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:
+		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) {
+		/* PLL KVCO tuning fine */
+		val = readl(priv->mmio + (0x20 << 2));
+		val &= ~GENMASK(4, 2);
+		val |= 0x4 << 2;
+		writel(val, priv->mmio + (0x20 << 2));
+
+		/* Set up rx_trim: PLL LPF C1 85pf R1 1.25kohm */
+		val = 0x4c;
+		writel(val, priv->mmio + (0x1b << 2));
+
+		/* Set up su_trim: T3 */
+		val = 0xb0;
+		writel(val, priv->mmio + (0xa << 2));
+		val = 0x47;
+		writel(val, priv->mmio + (0xb << 2));
+		val = 0x57;
+		writel(val, priv->mmio + (0xd << 2));
+	}
+
+	return 0;
+}
+
+static const struct rockchip_combphy_grfcfg rk3588_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_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, 0x0040 },
+	.con2_for_sata		= { 0x0008, 15, 0, 0x00, 0x80c1 },
+	.con3_for_sata		= { 0x000c, 15, 0, 0x00, 0x0407 },
+	/* pipe-grf */
+	.pipe_con0_for_sata	= { 0x0000, 11, 5, 0x00, 0x22 },
+	.pipe_con1_for_sata	= { 0x0000, 2, 0, 0x00, 0x2 },
+};
+
+static const struct rockchip_combphy_cfg rk3588_combphy_cfgs = {
+	.grfcfg		= &rk3588_combphy_grfcfgs,
+	.combphy_cfg	= rk3588_combphy_cfg,
+};
+
 static const struct udevice_id rockchip_combphy_ids[] = {
 	{
 		.compatible = "rockchip,rk3568-naneng-combphy",
 		.data = (ulong)&rk3568_combphy_cfgs
 	},
+	{
+		.compatible = "rockchip,rk3588-naneng-combphy",
+		.data = (ulong)&rk3588_combphy_cfgs
+	},
 	{ }
 };
 
Signature · 1 line
2.34.1
Reviewed-by on v1 4/7
#6 lore raw

Re: [PATCH 4/7] phy: rockchip: naneng-combphy: Support rk3588

Quoted 11 lines · Eugen Hristev

From: Jon Lin <[email protected]>

Add support for rk3588 phy variant.
The PHY clock is fixed at 100MHz.

[[email protected]: update pcie pll parameters]
[[email protected]: squashed, tidy up]

Thanks,
- Kever

Quoted 122 lines
---
  .../rockchip/phy-rockchip-naneng-combphy.c    | 95 +++++++++++++++++++
  1 file changed, 95 insertions(+)
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +95 -0
index b673a8da9f8e..d5408ccac976 100644
@@ -58,6 +58,7 @@ struct rockchip_combphy_grfcfg {
  	struct combphy_reg con2_for_sata;
  	struct combphy_reg con3_for_sata;
  	struct combphy_reg pipe_con0_for_sata;
+	struct combphy_reg pipe_con1_for_sata;
  	struct combphy_reg pipe_sgmii_mac_sel;
  	struct combphy_reg pipe_xpcs_phy_ready;
  	struct combphy_reg u3otg0_port_en;
@@ -423,11 +424,105 @@ static const struct rockchip_combphy_cfg rk3568_combphy_cfgs = {
  	.combphy_cfg	= rk3568_combphy_cfg,
  };
 
+static int rk3588_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:
+		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:
+		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) {
+		/* PLL KVCO tuning fine */
+		val = readl(priv->mmio + (0x20 << 2));
+		val &= ~GENMASK(4, 2);
+		val |= 0x4 << 2;
+		writel(val, priv->mmio + (0x20 << 2));
+
+		/* Set up rx_trim: PLL LPF C1 85pf R1 1.25kohm */
+		val = 0x4c;
+		writel(val, priv->mmio + (0x1b << 2));
+
+		/* Set up su_trim: T3 */
+		val = 0xb0;
+		writel(val, priv->mmio + (0xa << 2));
+		val = 0x47;
+		writel(val, priv->mmio + (0xb << 2));
+		val = 0x57;
+		writel(val, priv->mmio + (0xd << 2));
+	}
+
+	return 0;
+}
+
+static const struct rockchip_combphy_grfcfg rk3588_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_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, 0x0040 },
+	.con2_for_sata		= { 0x0008, 15, 0, 0x00, 0x80c1 },
+	.con3_for_sata		= { 0x000c, 15, 0, 0x00, 0x0407 },
+	/* pipe-grf */
+	.pipe_con0_for_sata	= { 0x0000, 11, 5, 0x00, 0x22 },
+	.pipe_con1_for_sata	= { 0x0000, 2, 0, 0x00, 0x2 },
+};
+
+static const struct rockchip_combphy_cfg rk3588_combphy_cfgs = {
+	.grfcfg		= &rk3588_combphy_grfcfgs,
+	.combphy_cfg	= rk3588_combphy_cfg,
+};
+
  static const struct udevice_id rockchip_combphy_ids[] = {
  	{
  		.compatible = "rockchip,rk3568-naneng-combphy",
  		.data = (ulong)&rk3568_combphy_cfgs
  	},
+	{
+		.compatible = "rockchip,rk3588-naneng-combphy",
+		.data = (ulong)&rk3588_combphy_cfgs
+	},
  	{ }
  };
 
#7 lore raw

PATCH 5/7 ARM: dts: rockchip: rk3588s-u-boot: add pcie2x1l2 with PHY

In reply to Eugen Hristev

From: Joseph Chen <[email protected]>

Add the node for pciE 2x1l 2 device together with the corresponding combphy.

[[email protected]: moved to -u-boot.dtsi, minor adaptations]

---
 arch/arm/dts/rk3588s-u-boot.dtsi | 73 ++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +73 -0
index f23112bf7ab6..17348c8f9789 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include <dt-bindings/phy/phy.h>
 
 / {
 	dmc {
@@ -58,6 +59,11 @@
 		reg = <0x0 0xfd58a000 0x0 0x2000>;
 	};
 
+	pipe_phy0_grf: syscon@fd5bc000 {
+		compatible = "rockchip,pipe-phy-grf", "syscon";
+		reg = <0x0 0xfd5bc000 0x0 0x100>;
+	};
+
 	usb2phy2_grf: syscon@fd5d8000 {
 		compatible = "rockchip,rk3588-usb2phy-grf", "syscon",
 			     "simple-mfd";
@@ -104,6 +110,58 @@
 		};
 	};
 
+	pcie2x1l2: pcie@fe190000 {
+		compatible = "rockchip,rk3588-pcie", "snps,dw-pcie";
+		#address-cells = <3>;
+		#size-cells = <2>;
+		bus-range = <0x40 0x4f>;
+		clocks = <&cru ACLK_PCIE_1L2_MSTR>, <&cru ACLK_PCIE_1L2_SLV>,
+			 <&cru ACLK_PCIE_1L2_DBI>, <&cru PCLK_PCIE_1L2>,
+			 <&cru CLK_PCIE_AUX4>;
+		clock-names = "aclk_mst", "aclk_slv",
+			      "aclk_dbi", "pclk", "aux";
+		device_type = "pci";
+		interrupts = <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH 0>;
+		interrupt-names = "sys", "pmc", "msg", "legacy", "err";
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie2x1l2_intc 0>,
+				<0 0 0 2 &pcie2x1l2_intc 1>,
+				<0 0 0 3 &pcie2x1l2_intc 2>,
+				<0 0 0 4 &pcie2x1l2_intc 3>;
+		linux,pci-domain = <4>;
+		num-ib-windows = <8>;
+		num-ob-windows = <8>;
+		max-link-speed = <2>;
+		msi-map = <0x4000 &gic 0x4000 0x1000>;
+		num-lanes = <1>;
+		phys = <&combphy0_ps PHY_TYPE_PCIE>;
+		phy-names = "pcie-phy";
+		power-domains = <&power RK3588_PD_PHP>;
+		ranges = <0x00000800 0x0 0xf4000000 0x0 0xf4000000 0x0 0x100000
+			  0x81000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x100000
+			  0x82000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0xe00000
+			  0xc3000000 0xa 0x00000000 0xa 0x00000000 0x0 0x40000000>;
+		reg = <0xa 0x41000000 0x0 0x400000>,
+		      <0x0 0xfe190000 0x0 0x10000>;
+		reg-names = "pcie-dbi", "pcie-apb";
+		resets = <&cru SRST_PCIE4_POWER_UP>;
+		reset-names = "pipe";
+		status = "disabled";
+
+		pcie2x1l2_intc: legacy-interrupt-controller {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 250 IRQ_TYPE_EDGE_RISING 0>;
+		};
+	};
+
 	sfc: spi@fe2b0000 {
 		compatible = "rockchip,sfc";
 		reg = <0x0 0xfe2b0000 0x0 0x4000>;
@@ -128,6 +186,21 @@
 			reg = <0x07 0x10>;
 		};
 	};
+
+	combphy0_ps: phy@fee00000 {
+		compatible = "rockchip,rk3588-naneng-combphy";
+		reg = <0x0 0xfee00000 0x0 0x100>;
+		#phy-cells = <1>;
+		clocks = <&cru CLK_REF_PIPE_PHY0>, <&cru PCLK_PCIE_COMBO_PIPE_PHY0>;
+		clock-names = "refclk", "apbclk";
+		assigned-clocks = <&cru CLK_REF_PIPE_PHY0>;
+		assigned-clock-rates = <100000000>;
+		resets = <&cru SRST_P_PCIE2_PHY0>, <&cru SRST_REF_PIPE_PHY0>;
+		reset-names = "combphy-apb", "combphy";
+		rockchip,pipe-grf = <&php_grf>;
+		rockchip,pipe-phy-grf = <&pipe_phy0_grf>;
+		status = "disabled";
+	};
 };
 
 &xin24m {
Signature · 1 line
2.34.1
#8 lore raw

Re: [PATCH 5/7] ARM: dts: rockchip: rk3588s-u-boot: add pcie2x1l2 with PHY

Hi Eugen,

Quoted 70 lines · Eugen Hristev

From: Joseph Chen <[email protected]>

Add the node for pciE 2x1l 2 device together with the corresponding combphy.

[[email protected]: moved to -u-boot.dtsi, minor adaptations]

---
 arch/arm/dts/rk3588s-u-boot.dtsi | 73 ++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +35 -0
index f23112bf7ab6..17348c8f9789 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include <dt-bindings/phy/phy.h>
 
 / {
 	dmc {
@@ -58,6 +59,11 @@
 		reg = <0x0 0xfd58a000 0x0 0x2000>;
 	};
 
+	pipe_phy0_grf: syscon@fd5bc000 {
+		compatible = "rockchip,pipe-phy-grf", "syscon";
+		reg = <0x0 0xfd5bc000 0x0 0x100>;
+	};
+
 	usb2phy2_grf: syscon@fd5d8000 {
 		compatible = "rockchip,rk3588-usb2phy-grf", "syscon",
 			     "simple-mfd";
@@ -104,6 +110,58 @@
 		};
 	};
 
+	pcie2x1l2: pcie@fe190000 {
+		compatible = "rockchip,rk3588-pcie", "snps,dw-pcie";
+		#address-cells = <3>;
+		#size-cells = <2>;
+		bus-range = <0x40 0x4f>;
+		clocks = <&cru ACLK_PCIE_1L2_MSTR>, <&cru ACLK_PCIE_1L2_SLV>,
+			 <&cru ACLK_PCIE_1L2_DBI>, <&cru PCLK_PCIE_1L2>,
+			 <&cru CLK_PCIE_AUX4>;
+		clock-names = "aclk_mst", "aclk_slv",
+			      "aclk_dbi", "pclk", "aux";
+		device_type = "pci";
+		interrupts = <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH 0>;
+		interrupt-names = "sys", "pmc", "msg", "legacy", "err";
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie2x1l2_intc 0>,
+				<0 0 0 2 &pcie2x1l2_intc 1>,
+				<0 0 0 3 &pcie2x1l2_intc 2>,
+				<0 0 0 4 &pcie2x1l2_intc 3>;
+		linux,pci-domain = <4>;
+		num-ib-windows = <8>;
+		num-ob-windows = <8>;
+		max-link-speed = <2>;
+		msi-map = <0x4000 &gic 0x4000 0x1000>;
+		num-lanes = <1>;

arch/arm/dts/rk3588s-u-boot.dtsi line 151

Quoted 10 lines
arch/arm/dts/rk3588s-u-boot.dtsi +10 -0
+		phys = <&combphy0_ps PHY_TYPE_PCIE>;
+		phy-names = "pcie-phy";
+		power-domains = <&power RK3588_PD_PHP>;
+		ranges = <0x00000800 0x0 0xf4000000 0x0 0xf4000000 0x0 0x100000
+			  0x81000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x100000
+			  0x82000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0xe00000
+			  0xc3000000 0xa 0x00000000 0xa 0x00000000 0x0 0x40000000>;
+		reg = <0xa 0x41000000 0x0 0x400000>,
+		      <0x0 0xfe190000 0x0 0x10000>;
+		reg-names = "pcie-dbi", "pcie-apb";

These reg-names are not fully compatible with the mainline linux binding for the rk3568 variant, see [1]. Please use the reg-names as defined in the mainline binding: dbi and apb.

In a pending patch to fix pcie/nvme on rk3568 I am planing to change to get reg addr by name instead of index, as part of the fix to use correct cfg_base.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml#n37

Regards,
Jonas

Quoted 38 lines
arch/arm/dts/rk3588s-u-boot.dtsi +28 -0
+		resets = <&cru SRST_PCIE4_POWER_UP>;
+		reset-names = "pipe";
+		status = "disabled";
+
+		pcie2x1l2_intc: legacy-interrupt-controller {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 250 IRQ_TYPE_EDGE_RISING 0>;
+		};
+	};
+
 	sfc: spi@fe2b0000 {
 		compatible = "rockchip,sfc";
 		reg = <0x0 0xfe2b0000 0x0 0x4000>;
@@ -128,6 +186,21 @@
 			reg = <0x07 0x10>;
 		};
 	};
+
+	combphy0_ps: phy@fee00000 {
+		compatible = "rockchip,rk3588-naneng-combphy";
+		reg = <0x0 0xfee00000 0x0 0x100>;
+		#phy-cells = <1>;
+		clocks = <&cru CLK_REF_PIPE_PHY0>, <&cru PCLK_PCIE_COMBO_PIPE_PHY0>;
+		clock-names = "refclk", "apbclk";
+		assigned-clocks = <&cru CLK_REF_PIPE_PHY0>;
+		assigned-clock-rates = <100000000>;
+		resets = <&cru SRST_P_PCIE2_PHY0>, <&cru SRST_REF_PIPE_PHY0>;
+		reset-names = "combphy-apb", "combphy";
+		rockchip,pipe-grf = <&php_grf>;
+		rockchip,pipe-phy-grf = <&pipe_phy0_grf>;
+		status = "disabled";
+	};
 };
 
 &xin24m {
#9 lore raw

Re: [PATCH 5/7] ARM: dts: rockchip: rk3588s-u-boot: add pcie2x1l2 with PHY

Quoted 88 lines · Jonas Karlman

Hi Eugen,

Quoted 70 lines · Eugen Hristev

From: Joseph Chen <[email protected]>

Add the node for pciE 2x1l 2 device together with the corresponding combphy.

[[email protected]: moved to -u-boot.dtsi, minor adaptations]

---
 arch/arm/dts/rk3588s-u-boot.dtsi | 73 ++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +35 -0
index f23112bf7ab6..17348c8f9789 100644
@@ -4,6 +4,7 @@
  */
 
 #include "rockchip-u-boot.dtsi"
+#include <dt-bindings/phy/phy.h>
 
 / {
 	dmc {
@@ -58,6 +59,11 @@
 		reg = <0x0 0xfd58a000 0x0 0x2000>;
 	};
 
+	pipe_phy0_grf: syscon@fd5bc000 {
+		compatible = "rockchip,pipe-phy-grf", "syscon";
+		reg = <0x0 0xfd5bc000 0x0 0x100>;
+	};
+
 	usb2phy2_grf: syscon@fd5d8000 {
 		compatible = "rockchip,rk3588-usb2phy-grf", "syscon",
 			     "simple-mfd";
@@ -104,6 +110,58 @@
 		};
 	};
 
+	pcie2x1l2: pcie@fe190000 {
+		compatible = "rockchip,rk3588-pcie", "snps,dw-pcie";
+		#address-cells = <3>;
+		#size-cells = <2>;
+		bus-range = <0x40 0x4f>;
+		clocks = <&cru ACLK_PCIE_1L2_MSTR>, <&cru ACLK_PCIE_1L2_SLV>,
+			 <&cru ACLK_PCIE_1L2_DBI>, <&cru PCLK_PCIE_1L2>,
+			 <&cru CLK_PCIE_AUX4>;
+		clock-names = "aclk_mst", "aclk_slv",
+			      "aclk_dbi", "pclk", "aux";
+		device_type = "pci";
+		interrupts = <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH 0>;
+		interrupt-names = "sys", "pmc", "msg", "legacy", "err";
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie2x1l2_intc 0>,
+				<0 0 0 2 &pcie2x1l2_intc 1>,
+				<0 0 0 3 &pcie2x1l2_intc 2>,
+				<0 0 0 4 &pcie2x1l2_intc 3>;
+		linux,pci-domain = <4>;
+		num-ib-windows = <8>;
+		num-ob-windows = <8>;
+		max-link-speed = <2>;
+		msi-map = <0x4000 &gic 0x4000 0x1000>;
+		num-lanes = <1>;

arch/arm/dts/rk3588s-u-boot.dtsi line 151

Quoted 10 lines
arch/arm/dts/rk3588s-u-boot.dtsi +10 -0
+		phys = <&combphy0_ps PHY_TYPE_PCIE>;
+		phy-names = "pcie-phy";
+		power-domains = <&power RK3588_PD_PHP>;
+		ranges = <0x00000800 0x0 0xf4000000 0x0 0xf4000000 0x0 0x100000
+			  0x81000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x100000
+			  0x82000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0xe00000
+			  0xc3000000 0xa 0x00000000 0xa 0x00000000 0x0 0x40000000>;
+		reg = <0xa 0x41000000 0x0 0x400000>,
+		      <0x0 0xfe190000 0x0 0x10000>;
+		reg-names = "pcie-dbi", "pcie-apb";

These reg-names are not fully compatible with the mainline linux binding for the rk3568 variant, see [1]. Please use the reg-names as defined in the mainline binding: dbi and apb.

Quoted 3 lines

In a pending patch to fix pcie/nvme on rk3568 I am planing to change to get reg addr by name instead of index, as part of the fix to use correct cfg_base.

I tested this series together with work-in-progress patches for rk3568, see [1], still an issue with BARs from the RC claiming the entire memory region to work around on rk3568.

Made small fixups for this series to base the device tree node on mainline node at [3]. I also made a small adjustment to the ranges so that the memory region falls within a 32-bit address space. Please feel free to squash the fixups if you agree with them :-)

On my ROCK 5 Model B:

=> pci enum
PCI Autoconfig: Bus Memory region: [40000000-7fffffff],

                  Physical Memory [a00000000-a3fffffff]
  PCI Autoconfig: Bus I/O region: [f4100000-f41fffff],
                  Physical Memory [f4100000-f41fffff]

PCI Autoconfig: ROM, size=0x10000, address=0x40000000 bus_lower=0x40010000 PCI Autoconfig: BAR 0, I/O, size=0x100, address=0xf4100000 bus_lower=0xf4100100 PCI Autoconfig: BAR 1, Mem64, size=0x10000, address=0x40100000 bus_lower=0x40110000 PCI Autoconfig: BAR 2, Mem64, size=0x4000, address=0x40110000 bus_lower=0x40114000

=> pci
BusDevFun VendorId DeviceId Device Class Sub-Class
_____________________________________________________________

  00.00.00   0x1d87     0x3588     Bridge device           0x04
  01.00.00   0x10ec     0x8125     Network controller      0x00

[2] https://github.com/Kwiboo/u-boot-rockchip/commits/rk3568-pcie-v1
[3] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/

Regards,
Jonas

Quoted 45 lines

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml#n37

Regards,
Jonas

Quoted 38 lines
arch/arm/dts/rk3588s-u-boot.dtsi +28 -0
+		resets = <&cru SRST_PCIE4_POWER_UP>;
+		reset-names = "pipe";
+		status = "disabled";
+
+		pcie2x1l2_intc: legacy-interrupt-controller {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 250 IRQ_TYPE_EDGE_RISING 0>;
+		};
+	};
+
 	sfc: spi@fe2b0000 {
 		compatible = "rockchip,sfc";
 		reg = <0x0 0xfe2b0000 0x0 0x4000>;
@@ -128,6 +186,21 @@
 			reg = <0x07 0x10>;
 		};
 	};
+
+	combphy0_ps: phy@fee00000 {
+		compatible = "rockchip,rk3588-naneng-combphy";
+		reg = <0x0 0xfee00000 0x0 0x100>;
+		#phy-cells = <1>;
+		clocks = <&cru CLK_REF_PIPE_PHY0>, <&cru PCLK_PCIE_COMBO_PIPE_PHY0>;
+		clock-names = "refclk", "apbclk";
+		assigned-clocks = <&cru CLK_REF_PIPE_PHY0>;
+		assigned-clock-rates = <100000000>;
+		resets = <&cru SRST_P_PCIE2_PHY0>, <&cru SRST_REF_PIPE_PHY0>;
+		reset-names = "combphy-apb", "combphy";
+		rockchip,pipe-grf = <&php_grf>;
+		rockchip,pipe-phy-grf = <&pipe_phy0_grf>;
+		status = "disabled";
+	};
 };
 
 &xin24m {
#10 lore raw

Re: [PATCH 5/7] ARM: dts: rockchip: rk3588s-u-boot: add pcie2x1l2 with PHY

In reply to Eugen Hristev
Quoted 38 lines · Eugen Hristev

From: Joseph Chen <[email protected]>

Add the node for pciE 2x1l 2 device together with the corresponding combphy.

[[email protected]: moved to -u-boot.dtsi, minor adaptations]

---
  arch/arm/dts/rk3588s-u-boot.dtsi | 73 ++++++++++++++++++++++++++++++++
  1 file changed, 73 insertions(+)
arch/arm/dts/rk3588s-u-boot.dtsi +6 -0
index f23112bf7ab6..17348c8f9789 100644
@@ -4,6 +4,7 @@
   */
 
  #include "rockchip-u-boot.dtsi"
+#include <dt-bindings/phy/phy.h>
 
  / {
  	dmc {
@@ -58,6 +59,11 @@
  		reg = <0x0 0xfd58a000 0x0 0x2000>;
  	};
 
+	pipe_phy0_grf: syscon@fd5bc000 {
+		compatible = "rockchip,pipe-phy-grf", "syscon";
+		reg = <0x0 0xfd5bc000 0x0 0x100>;
+	};
+
  	usb2phy2_grf: syscon@fd5d8000 {
  		compatible = "rockchip,rk3588-usb2phy-grf", "syscon",
  			     "simple-mfd";

arch/arm/dts/rk3588s-u-boot.dtsi line 114

Quoted 5 lines
arch/arm/dts/rk3588s-u-boot.dtsi +2 -0
@@ -104,6 +110,58 @@
  		};
  	};
 
+	pcie2x1l2: pcie@fe190000 {
+		compatible = "rockchip,rk3588-pcie", "snps,dw-pcie";

The mainline kernel should have this node, we should sync with kernel?

Thanks,

- Kever

Quoted 75 lines
arch/arm/dts/rk3588s-u-boot.dtsi +65 -0
+		#address-cells = <3>;
+		#size-cells = <2>;
+		bus-range = <0x40 0x4f>;
+		clocks = <&cru ACLK_PCIE_1L2_MSTR>, <&cru ACLK_PCIE_1L2_SLV>,
+			 <&cru ACLK_PCIE_1L2_DBI>, <&cru PCLK_PCIE_1L2>,
+			 <&cru CLK_PCIE_AUX4>;
+		clock-names = "aclk_mst", "aclk_slv",
+			      "aclk_dbi", "pclk", "aux";
+		device_type = "pci";
+		interrupts = <GIC_SPI 253 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 252 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 251 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 250 IRQ_TYPE_LEVEL_HIGH 0>,
+			     <GIC_SPI 249 IRQ_TYPE_LEVEL_HIGH 0>;
+		interrupt-names = "sys", "pmc", "msg", "legacy", "err";
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-map = <0 0 0 1 &pcie2x1l2_intc 0>,
+				<0 0 0 2 &pcie2x1l2_intc 1>,
+				<0 0 0 3 &pcie2x1l2_intc 2>,
+				<0 0 0 4 &pcie2x1l2_intc 3>;
+		linux,pci-domain = <4>;
+		num-ib-windows = <8>;
+		num-ob-windows = <8>;
+		max-link-speed = <2>;
+		msi-map = <0x4000 &gic 0x4000 0x1000>;
+		num-lanes = <1>;
+		phys = <&combphy0_ps PHY_TYPE_PCIE>;
+		phy-names = "pcie-phy";
+		power-domains = <&power RK3588_PD_PHP>;
+		ranges = <0x00000800 0x0 0xf4000000 0x0 0xf4000000 0x0 0x100000
+			  0x81000000 0x0 0xf4100000 0x0 0xf4100000 0x0 0x100000
+			  0x82000000 0x0 0xf4200000 0x0 0xf4200000 0x0 0xe00000
+			  0xc3000000 0xa 0x00000000 0xa 0x00000000 0x0 0x40000000>;
+		reg = <0xa 0x41000000 0x0 0x400000>,
+		      <0x0 0xfe190000 0x0 0x10000>;
+		reg-names = "pcie-dbi", "pcie-apb";
+		resets = <&cru SRST_PCIE4_POWER_UP>;
+		reset-names = "pipe";
+		status = "disabled";
+
+		pcie2x1l2_intc: legacy-interrupt-controller {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-parent = <&gic>;
+			interrupts = <GIC_SPI 250 IRQ_TYPE_EDGE_RISING 0>;
+		};
+	};
+
  	sfc: spi@fe2b0000 {
  		compatible = "rockchip,sfc";
  		reg = <0x0 0xfe2b0000 0x0 0x4000>;
@@ -128,6 +186,21 @@
  			reg = <0x07 0x10>;
  		};
  	};
+
+	combphy0_ps: phy@fee00000 {
+		compatible = "rockchip,rk3588-naneng-combphy";
+		reg = <0x0 0xfee00000 0x0 0x100>;
+		#phy-cells = <1>;
+		clocks = <&cru CLK_REF_PIPE_PHY0>, <&cru PCLK_PCIE_COMBO_PIPE_PHY0>;
+		clock-names = "refclk", "apbclk";
+		assigned-clocks = <&cru CLK_REF_PIPE_PHY0>;
+		assigned-clock-rates = <100000000>;
+		resets = <&cru SRST_P_PCIE2_PHY0>, <&cru SRST_REF_PIPE_PHY0>;
+		reset-names = "combphy-apb", "combphy";
+		rockchip,pipe-grf = <&php_grf>;
+		rockchip,pipe-phy-grf = <&pipe_phy0_grf>;
+		status = "disabled";
+	};
  };
 
  &xin24m {
#11 lore raw

PATCH 6/7 ARM: dts: rockchip: rock5b: enable pcie2x1l2 and associated combphy

In reply to Eugen Hristev

From: Christopher Obbard <[email protected]>

Enable the pciE 2x1l 2 device and associated combphy. On this bus, the Rock5B has an Ethernet transceiver connected.

---
 arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +17 -0
index 8a5b0ce42034..8293738407c4 100644
@@ -31,10 +31,21 @@
 	};
 };
 
+&combphy0_ps {
+	status = "okay";
+};
+
 &fspim2_pins {
 	bootph-all;
 };
 
+&pcie2x1l2 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie_reset_h>;
+	reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_HIGH>;
+	status = "okay";
+};
+
 &sdmmc {
 	bus-width = <4>;
 	bootph-all;
@@ -45,6 +56,12 @@
 &pinctrl {
 	bootph-all;
 
+	pcie {
+		pcie_reset_h: pcie-reset-h {
+			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
 	usb {
 		vcc5v0_host_en: vcc5v0-host-en {
 			rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
Signature · 1 line
2.34.1
#12 lore raw

PATCH 7/7 configs: rock5b-rk3588: add pci drivers and command

In reply to Eugen Hristev

Add drivers for pciE , phy, and command.

---
 configs/rock5b-rk3588_defconfig | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configs/rock5b-rk3588_defconfig +5 -1
index 8c097ab3a109..a14fcd2ee924 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_ATF=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 # CONFIG_CMD_SETEXPR is not set
@@ -71,7 +72,10 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_ROCKCHIP=y
 CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_REGULATOR_PWM=y
 CONFIG_DM_REGULATOR_FIXED=y
@@ -81,7 +85,6 @@ CONFIG_BAUDRATE=1500000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_ROCKCHIP_SFC=y
 CONFIG_SYSRESET=y
-# CONFIG_BINMAN_FDT is not set
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
@@ -95,4 +98,5 @@ CONFIG_USB_ETHER_LAN78XX=y
 CONFIG_USB_ETHER_MCS7830=y
 CONFIG_USB_ETHER_RTL8152=y
 CONFIG_USB_ETHER_SMSC95XX=y
+# CONFIG_BINMAN_FDT is not set
 CONFIG_ERRNO_STR=y
Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH 7/7] configs: rock5b-rk3588: add pci drivers and command

Hi Eugen,

Quoted 20 lines · Eugen Hristev

Add drivers for pciE , phy, and command.

---
  configs/rock5b-rk3588_defconfig | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
configs/rock5b-rk3588_defconfig +1 -0
index 8c097ab3a109..a14fcd2ee924 100644
@@ -47,6 +47,7 @@ CONFIG_SPL_ATF=y
  CONFIG_CMD_GPIO=y
  CONFIG_CMD_GPT=y
  CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
  CONFIG_CMD_SPI=y
  CONFIG_CMD_USB=y
  # CONFIG_CMD_SETEXPR is not set

configs/rock5b-rk3588_defconfig CONFIG_MMC_SDHCI_ROCKCHIP=y · line 78

Quoted 7 lines
configs/rock5b-rk3588_defconfig +3 -0
@@ -71,7 +72,10 @@ CONFIG_MMC_SDHCI_ROCKCHIP=y
  CONFIG_SPI_FLASH_MACRONIX=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PCI=y
+CONFIG_PCIE_DW_ROCKCHIP=y
  CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y

Does this board have pcie2 interface and need to enable in U-Boot?

Quoted 12 lines
configs/rock5b-rk3588_defconfig +0 -1
  CONFIG_SPL_PINCTRL=y
  CONFIG_REGULATOR_PWM=y
  CONFIG_DM_REGULATOR_FIXED=y
@@ -81,7 +85,6 @@ CONFIG_BAUDRATE=1500000
  CONFIG_DEBUG_UART_SHIFT=2
  CONFIG_ROCKCHIP_SFC=y
  CONFIG_SYSRESET=y
-# CONFIG_BINMAN_FDT is not set
  CONFIG_USB=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y

configs/rock5b-rk3588_defconfig CONFIG_USB_ETHER_LAN78XX=y · line 101

Quoted 4 lines
configs/rock5b-rk3588_defconfig +1 -0
@@ -95,4 +98,5 @@ CONFIG_USB_ETHER_LAN78XX=y
  CONFIG_USB_ETHER_MCS7830=y
  CONFIG_USB_ETHER_RTL8152=y
  CONFIG_USB_ETHER_SMSC95XX=y
+# CONFIG_BINMAN_FDT is not set

This should have been removed after [1]

Thanks,

- Kever

[1]https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Quoted 1 line
configs/rock5b-rk3588_defconfig +0 -0
  CONFIG_ERRNO_STR=y
Reviewed-by on v1 1/7
#14 lore raw
In reply to Eugen Hristev
Quoted 5 lines · Eugen Hristev

From: Jon Lin <[email protected]>

Add compatible for RK3588 SoC.

Thanks,
- Kever

Quoted 16 lines
---
  drivers/pci/pcie_dw_rockchip.c | 1 +
  1 file changed, 1 insertion(+)
drivers/pci/pcie_dw_rockchip.c +1 -0
index 6155710a9f5f..ff121046604a 100644
@@ -468,6 +468,7 @@ static const struct dm_pci_ops rockchip_pcie_ops = {
 
  static const struct udevice_id rockchip_pcie_ids[] = {
  	{ .compatible = "rockchip,rk3568-pcie" },
+	{ .compatible = "rockchip,rk3588-pcie" },
  	{ }
  };