rtl8221 fix:test 1

This commit is contained in:
padavanonly 2025-03-16 21:22:56 +08:00
parent 6ab6b73c29
commit 988cda089f
2 changed files with 22 additions and 18 deletions

View File

@ -169,11 +169,9 @@ static int rtl822x_init(struct mtk_eth *eth, int addr)
msleep(500);
dev_info(eth->dev, "RTL822x init success!\n");
dev_info(eth->dev, "RTL822x first init success!\n");
Rtl8226b_phy_init((HANDLE){eth, addr}, NULL, 1);
return 0;
return Rtl8226b_phy_init((HANDLE){eth, addr}, NULL, 1);
}
static struct mtk_extphy_id extphy_tbl[] = {
@ -230,26 +228,21 @@ int mtk_soc_extphy_init(struct mtk_eth *eth, int addr)
int i;
u32 phy_id;
struct mtk_extphy_id *extphy;
int init_result = 0;
for (i = 0; i < ARRAY_SIZE(extphy_tbl); i++)
{
extphy = &extphy_tbl[i];
if (extphy->is_c45)
{
{
phy_id = get_cl45_phy_id(eth, addr);
}
else
{
else{
phy_id = get_cl22_phy_id(eth, addr);
}
if (phy_id_is_match(phy_id, extphy))
{extphy->init(eth, addr);}
if (phy_id_is_match(phy_id, extphy)){
init_result = extphy->init(eth, addr);
}
}
return 0;
return init_result;
}

View File

@ -3758,12 +3758,23 @@ static int mtk_probe(struct platform_device *pdev)
if (!ext_init){
for_each_child_of_node(pdev->dev.of_node, mac_np) {
unsigned int ext_phy_reg = 0;
int err = -1;
int err= -1;
int ext_reset_pin =-1;
err = of_property_read_u32_index(mac_np, "ext-phy-reg", 0, &ext_phy_reg);
if (err >= 0){
dev_info(&pdev->dev, "Ext-phy reg : %d\n", ext_phy_reg);
mtk_soc_extphy_init(eth, ext_phy_reg);
err = mtk_soc_extphy_init(eth, ext_phy_reg);
ext_reset_pin = of_get_named_gpio(mac_np, "ext-phy-reset-gpios", 0);
if ((ext_reset_pin >= 0) && (err != 1)){
dev_info(&pdev->dev, "Init Failed.Reset Ext-phy gpio : %d\n", ext_reset_pin);
gpio_direction_output(ext_reset_pin, 0);
msleep(300);
gpio_set_value(ext_reset_pin, 1);
msleep(500);
err = mtk_soc_extphy_init(eth, ext_phy_reg);
}
dev_info(&pdev->dev, "Init RTL8221 Result : %d\n", err);
}
}
ext_init = 1;