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 <gch981213@gmail.com>
int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np);
void ag71xx_ar7240_cleanup(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);
int ag71xx_mdio_init(struct ag71xx *ag);
void ag71xx_mdio_cleanup(struct ag71xx *ag);
-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)
static int
ar7240_set_vid(struct switch_dev *dev, const struct switch_attr *attr,
struct switch_val *val)
-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;
int ag71xx_ar7240_init(struct ag71xx *ag, struct device_node *np)
{
struct ar7240sw *as;
ag->phy_priv = as;
ar7240sw_reset(as);
ag->phy_priv = as;
ar7240sw_reset(as);
+ ar7240_hw_apply(&as->swdev);
rwlock_init(&as->stats_lock);
rwlock_init(&as->stats_lock);
- ag71xx_ar7240_start(ag);
phy_start(ag->phy_dev);
return 0;
phy_start(ag->phy_dev);
return 0;