Re: [PATCH net-next v3 3/5] net: stmmac: dwmac-rk: Move integrated_phy_powerup/down functions
From: Jonas Karlman
Date: Wed Mar 19 2025 - 19:01:03 EST
Hi Andrew,
On 2025-03-19 23:39, Andrew Lunn wrote:
> On Wed, Mar 19, 2025 at 09:44:07PM +0000, Jonas Karlman wrote:
>> Rockchip RK3528 (and RV1106) has a different integrated PHY compared to
>> the integrated PHY on RK3228/RK3328. Current powerup/down operation is
>> not compatible with the integrated PHY found in these SoCs.
>>
>> Move the rk_gmac_integrated_phy_powerup/down functions to top of the
>> file to prepare for them to be called directly by a GMAC variant
>> specific powerup/down operation.
>>
>> Signed-off-by: Jonas Karlman <jonas@xxxxxxxxx>
>
> Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
>
>> +#define RK_GRF_CON2_MACPHY_ID HIWORD_UPDATE(0x1234, 0xffff, 0)
>> +#define RK_GRF_CON3_MACPHY_ID HIWORD_UPDATE(0x35, 0x3f, 0)
>> +
>> +static void rk_gmac_integrated_phy_powerup(struct rk_priv_data *priv)
>> +{
>> + if (priv->ops->integrated_phy_powerup)
>> + priv->ops->integrated_phy_powerup(priv);
>> +
>> + regmap_write(priv->grf, RK_GRF_MACPHY_CON0, RK_MACPHY_CFG_CLK_50M);
>> + regmap_write(priv->grf, RK_GRF_MACPHY_CON0, RK_GMAC2PHY_RMII_MODE);
>> +
>> + regmap_write(priv->grf, RK_GRF_MACPHY_CON2, RK_GRF_CON2_MACPHY_ID);
>> + regmap_write(priv->grf, RK_GRF_MACPHY_CON3, RK_GRF_CON3_MACPHY_ID);
>
> I know you are just moving code around....
>
> Do you know what these MACPHY_ID are? I hope it is not what you get
> when you read PHY registers 2 and 3?
I think it may be:
GRF_MACPHY_CON2
15:0 macphy_id / PHY ID Number, macphy_cfg_phy_id[15:0]
GRF_MACPHY_CON3
15:12 macphy_cfg_rev_nr / Manufacturer's Revision Number
11:6 macphy_model_nr / Manufacturer's Model Number
5:0 macphy_id / PHY ID Number, macphy_cfg_phy_id[21:16]
and
MACPHY_PHY_IDENTIFIER1 - Address: 02
15:0 PHY ID number / default:cfg_phy_id[15:0]
MACPHY_PHY_IDENTIFIER2 - Address: 03
15:10 PHY ID number / default:cfg_phy_id[21:16]
9:4 Model number / default:cfg_model_nr[5:0]
3:0 Revision number / default:cfg_rev_nr[3:0]
So likely what you get when you read PHY registers 2 and 3.
Regards,
Jonas
>
> Andrew