diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2019-05-22 00:09:45 -0700 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2019-06-01 13:33:17 -0500 |
commit | a5e3d2350b271d6281c01ae7ad0dd7290ba66aee (patch) | |
tree | e88eab50b5cc1e00fcd174ee33cac62a83c2a157 | |
parent | 49191d259f433f8341a71ab6f821c1d89e2f5092 (diff) |
dm: net: macb: Update macb_linkspd_cb() signature
This updates DM version macb_linkspd_cb() signature for future
expansion, eg: adding an implementation for link speed changes.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r-- | drivers/net/macb.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 72614164e9..b7f404e857 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -488,15 +488,23 @@ static int macb_phy_find(struct macb_device *macb, const char *name) /** * macb_linkspd_cb - Linkspeed change callback function - * @regs: Base Register of MACB devices + * @dev/@regs: MACB udevice (DM version) or + * Base Register of MACB devices (non-DM version) * @speed: Linkspeed * Returns 0 when operation success and negative errno number * when operation failed. */ +#ifdef CONFIG_DM_ETH +int __weak macb_linkspd_cb(struct udevice *dev, unsigned int speed) +{ + return 0; +} +#else int __weak macb_linkspd_cb(void *regs, unsigned int speed) { return 0; } +#endif #ifdef CONFIG_DM_ETH static int macb_phy_init(struct udevice *dev, const char *name) @@ -589,7 +597,11 @@ static int macb_phy_init(struct macb_device *macb, const char *name) macb_writel(macb, NCFGR, ncfgr); +#ifdef CONFIG_DM_ETH + ret = macb_linkspd_cb(dev, _1000BASET); +#else ret = macb_linkspd_cb(macb->regs, _1000BASET); +#endif if (ret) return ret; @@ -614,9 +626,17 @@ static int macb_phy_init(struct macb_device *macb, const char *name) ncfgr &= ~(MACB_BIT(SPD) | MACB_BIT(FD) | GEM_BIT(GBE)); if (speed) { ncfgr |= MACB_BIT(SPD); +#ifdef CONFIG_DM_ETH + ret = macb_linkspd_cb(dev, _100BASET); +#else ret = macb_linkspd_cb(macb->regs, _100BASET); +#endif } else { +#ifdef CONFIG_DM_ETH + ret = macb_linkspd_cb(dev, _10BASET); +#else ret = macb_linkspd_cb(macb->regs, _10BASET); +#endif } if (ret) |