Revision | a624251461bf9750d8a11545972fe575fc4cbf85 (tree) |
---|---|
Time | 2022-07-26 18:29:01 |
Author | Peng Fan <peng.fan@nxp....> |
Commiter | Stefano Babic |
net: dwc_eth_qos: introduce eqos hook eqos_get_enetaddr
i.MX has specific hook to get MAC address, so introduce a hook and move
i.MX code to its own driver
Signed-off-by: Peng Fan <peng.fan@nxp.com>
@@ -712,10 +712,13 @@ static int eqos_write_hwaddr(struct udevice *dev) | ||
712 | 712 | static int eqos_read_rom_hwaddr(struct udevice *dev) |
713 | 713 | { |
714 | 714 | struct eth_pdata *pdata = dev_get_plat(dev); |
715 | + struct eqos_priv *eqos = dev_get_priv(dev); | |
716 | + int ret; | |
717 | + | |
718 | + ret = eqos->config->ops->eqos_get_enetaddr(dev); | |
719 | + if (ret < 0) | |
720 | + return ret; | |
715 | 721 | |
716 | -#ifdef CONFIG_ARCH_IMX8M | |
717 | - imx_get_mac_from_fuse(dev_seq(dev), pdata->enetaddr); | |
718 | -#endif | |
719 | 722 | return !is_valid_ethaddr(pdata->enetaddr); |
720 | 723 | } |
721 | 724 |
@@ -240,6 +240,7 @@ struct eqos_ops { | ||
240 | 240 | int (*eqos_calibrate_pads)(struct udevice *dev); |
241 | 241 | int (*eqos_disable_calibration)(struct udevice *dev); |
242 | 242 | int (*eqos_set_tx_clk_speed)(struct udevice *dev); |
243 | + int (*eqos_get_enetaddr)(struct udevice *dev); | |
243 | 244 | ulong (*eqos_get_tick_clk_rate)(struct udevice *dev); |
244 | 245 | }; |
245 | 246 |
@@ -92,6 +92,15 @@ static int eqos_set_tx_clk_speed_imx(struct udevice *dev) | ||
92 | 92 | return 0; |
93 | 93 | } |
94 | 94 | |
95 | +static int eqos_get_enetaddr_imx(struct udevice *dev) | |
96 | +{ | |
97 | + struct eth_pdata *pdata = dev_get_plat(dev); | |
98 | + | |
99 | + imx_get_mac_from_fuse(dev_seq(dev), pdata->enetaddr); | |
100 | + | |
101 | + return 0; | |
102 | +} | |
103 | + | |
95 | 104 | static struct eqos_ops eqos_imx_ops = { |
96 | 105 | .eqos_inval_desc = eqos_inval_desc_generic, |
97 | 106 | .eqos_flush_desc = eqos_flush_desc_generic, |
@@ -106,7 +115,8 @@ static struct eqos_ops eqos_imx_ops = { | ||
106 | 115 | .eqos_calibrate_pads = eqos_null_ops, |
107 | 116 | .eqos_disable_calibration = eqos_null_ops, |
108 | 117 | .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, |
109 | - .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx | |
118 | + .eqos_get_enetaddr = eqos_get_enetaddr_imx, | |
119 | + .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx, | |
110 | 120 | }; |
111 | 121 | |
112 | 122 | struct eqos_config __maybe_unused eqos_imx_config = { |