--- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c @@ -122,6 +122,7 @@ struct rockchip_combphy_grfcfg { struct combphy_reg pipe_xpcs_phy_ready; struct combphy_reg pipe_pcie1l0_sel; struct combphy_reg pipe_pcie1l1_sel; + struct combphy_reg pipe_sgmii_mac_sel; struct combphy_reg u3otg0_port_en; struct combphy_reg u3otg1_port_en; }; @@ -276,6 +277,7 @@ static struct phy *rockchip_combphy_xlat static int rockchip_combphy_parse_dt(struct device *dev, struct rockchip_combphy_priv *priv) { + int mac_id; int i; priv->num_clks = devm_clk_bulk_get_all(dev, &priv->clks); @@ -311,6 +313,11 @@ static int rockchip_combphy_parse_dt(str priv->ext_refclk = device_property_present(dev, "rockchip,ext-refclk"); + if (!device_property_read_u32(dev, "rockchip,sgmii-mac-sel", &mac_id)) { + rockchip_combphy_param_write(priv->pipe_grf, &priv->cfg->grfcfg->pipe_sgmii_mac_sel, + (mac_id > 0) ? true : false); + } + priv->phy_rst = devm_reset_control_get_exclusive(dev, "phy"); /* fallback to old behaviour */ if (PTR_ERR(priv->phy_rst) == -ENOENT) @@ -584,6 +591,7 @@ static const struct rockchip_combphy_grf /* pipe-grf */ .pipe_con0_for_sata = { 0x0000, 15, 0, 0x00, 0x2220 }, .pipe_xpcs_phy_ready = { 0x0040, 2, 2, 0x00, 0x01 }, + .pipe_sgmii_mac_sel = { 0x0040, 1, 1, 0x00, 0x01 }, .u3otg0_port_en = { 0x0104, 15, 0, 0x0181, 0x1100 }, .u3otg1_port_en = { 0x0144, 15, 0, 0x0181, 0x1100 }, };