From 24cbe27bb7ff83b9bb3a2640904bced1a2d14a8d Mon Sep 17 00:00:00 2001 From: Chuanhong Guo Date: Tue, 17 Jul 2018 17:09:13 +0800 Subject: [PATCH] ath79: ag71xx: Remove ar7240_set_addr and ag71xx_ar7240_start The builtin switch has it's initial valid mac address(00:00:01:00:00:00). Since the builtin switch is an independent device, setting mac address of gmac1 to builtin switch isn't a good idea and this makes it impossilbe to split builtin switch apart as an independent platform device. Remove these functions and apply default VLAN during initialization as a preparation for further driver splitting. Signed-off-by: Chuanhong Guo --- .../net/ethernet/atheros/ag71xx/ag71xx.h | 1 - .../ethernet/atheros/ag71xx/ag71xx_ar7240.c | 28 +------------------ .../net/ethernet/atheros/ag71xx/ag71xx_main.c | 1 - 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index b0780a1ba9..d154bbec9e 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h @@ -440,7 +440,6 @@ static inline void ag71xx_debugfs_update_napi_stats(struct ag71xx *ag, int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np); void ag71xx_ar7240_cleanup(struct ag71xx *ag); -void ag71xx_ar7240_start(struct ag71xx *ag); int ag71xx_mdio_init(struct ag71xx *ag); void ag71xx_mdio_cleanup(struct ag71xx *ag); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c index 52c0f964cf..741f48e9cf 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c @@ -753,20 +753,6 @@ static void ar7240sw_setup_port(struct ar7240sw *as, unsigned port, u8 portmask) } } -static int ar7240_set_addr(struct ar7240sw *as, u8 *addr) -{ - struct mii_bus *mii = as->mii_bus; - u32 t; - - t = (addr[4] << 8) | addr[5]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR0, t); - - t = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]; - ar7240sw_reg_write(mii, AR7240_REG_MAC_ADDR1, t); - - return 0; -} - static int ar7240_set_vid(struct switch_dev *dev, const struct switch_attr *attr, struct switch_val *val) @@ -1298,19 +1284,6 @@ err_free: return NULL; } -void ag71xx_ar7240_start(struct ag71xx *ag) -{ - struct ar7240sw *as = ag->phy_priv; - - if (!as) - return; - - ar7240sw_reset(as); - - ar7240_set_addr(as, ag->dev->dev_addr); - ar7240_hw_apply(&as->swdev); -} - int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np) { struct ar7240sw *as; @@ -1321,6 +1294,7 @@ int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np) ag->phy_priv = as; ar7240sw_reset(as); + ar7240_hw_apply(&as->swdev); rwlock_init(&as->stats_lock); diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index acc0f089d0..72cfd6cf15 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -735,7 +735,6 @@ static int ag71xx_open(struct net_device *dev) if (ret) goto err; - ag71xx_ar7240_start(ag); phy_start(ag->phy_dev); return 0;