Skip to content

Commit d00d81e

Browse files
committed
net: phy: mtk-2p5ge: extend priv for firmware loading
squashed: net: phy: mtk-2p5ge: fix struct name for 2p5g phy priv
1 parent 2de8b70 commit d00d81e

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

drivers/net/phy/mediatek/mtk-2p5ge.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ enum {
116116

117117
static int mt7987_2p5ge_phy_load_fw(struct phy_device *phydev)
118118
{
119-
struct mtk_i2p5ge_phy_priv *priv = phydev->priv;
119+
struct mtk_socphy_priv *priv = phydev->priv;
120120
struct device *dev = &phydev->mdio.dev;
121121
void __iomem *xbz_pcs_reg_base;
122122
void __iomem *xbz_pma_rx_base;
@@ -637,6 +637,14 @@ static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)
637637
struct pinctrl *pinctrl;
638638
int ret;
639639

640+
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct mtk_socphy_priv),
641+
GFP_KERNEL);
642+
if (!priv)
643+
return -ENOMEM;
644+
645+
priv->fw_loaded = false;
646+
phydev->priv = priv;
647+
640648
switch (phydev->drv->phy_id) {
641649
case MTK_2P5GPHY_ID_MT7987:
642650
case MTK_2P5GPHY_ID_MT7988:
@@ -690,22 +698,23 @@ static int mt798x_2p5ge_phy_probe(struct phy_device *phydev)
690698
if (IS_ERR(pinctrl))
691699
dev_err(&phydev->mdio.dev, "Fail to set LED pins!\n");
692700

693-
priv = devm_kzalloc(&phydev->mdio.dev, sizeof(struct mtk_socphy_priv),
694-
GFP_KERNEL);
695-
if (!priv)
696-
return -ENOMEM;
697-
phydev->priv = priv;
698-
699701
mtk_phy_leds_state_init(phydev);
700702

701703
return 0;
702704
}
703705

706+
static void mt798x_2p5ge_phy_remove(struct phy_device *phydev)
707+
{
708+
struct mtk_i2p5ge_phy_priv *priv = phydev->priv;
709+
kfree(priv);
710+
}
711+
704712
static struct phy_driver mtk_2p5gephy_driver[] = {
705713
{
706714
PHY_ID_MATCH_MODEL(MTK_2P5GPHY_ID_MT7987),
707715
.name = "MediaTek MT7987 2.5GbE PHY",
708716
.probe = mt798x_2p5ge_phy_probe,
717+
.remove = mt798x_2p5ge_phy_remove,
709718
.config_init = mt798x_2p5ge_phy_config_init,
710719
.config_aneg = mt798x_2p5ge_phy_config_aneg,
711720
.get_features = mt798x_2p5ge_phy_get_features,
@@ -720,6 +729,7 @@ static struct phy_driver mtk_2p5gephy_driver[] = {
720729
PHY_ID_MATCH_MODEL(MTK_2P5GPHY_ID_MT7988),
721730
.name = "MediaTek MT7988 2.5GbE PHY",
722731
.probe = mt798x_2p5ge_phy_probe,
732+
.remove = mt798x_2p5ge_phy_remove,
723733
.config_init = mt798x_2p5ge_phy_config_init,
724734
.config_aneg = mt798x_2p5ge_phy_config_aneg,
725735
.get_features = mt798x_2p5ge_phy_get_features,

drivers/net/phy/mediatek/mtk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
struct mtk_socphy_priv {
7272
unsigned long led_state;
73+
bool fw_loaded;
7374
};
7475

7576
void __mtk_tr_modify(struct phy_device *phydev, u8 ch_addr, u8 node_addr,

0 commit comments

Comments
 (0)