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 da716d94c3..c90dc2d4cd 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 @@ -160,6 +160,7 @@ struct ag71xx { u16 rx_buf_size; u8 rx_buf_offset; u8 tx_hang_workaround:1; + u8 builtin_switch:1; struct net_device *dev; struct platform_device *pdev; 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 8e387af27b..745a8d9ff4 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 @@ -868,6 +868,7 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update) u32 cfg2; u32 ifctl; u32 fifo5; + unsigned int speed; if (!ag->link && update) { ag71xx_hw_stop(ag); @@ -883,7 +884,7 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update) cfg2 = ag71xx_rr(ag, AG71XX_REG_MAC_CFG2); cfg2 &= ~(MAC_CFG2_IF_1000 | MAC_CFG2_IF_10_100 | MAC_CFG2_FDX); - cfg2 |= (ag->duplex) ? MAC_CFG2_FDX : 0; + cfg2 |= (ag->duplex || ag->builtin_switch) ? MAC_CFG2_FDX : 0; ifctl = ag71xx_rr(ag, AG71XX_REG_MAC_IFCTL); ifctl &= ~(MAC_IFCTL_SPEED); @@ -891,7 +892,11 @@ __ag71xx_link_adjust(struct ag71xx *ag, bool update) fifo5 = ag71xx_rr(ag, AG71XX_REG_FIFO_CFG5); fifo5 &= ~FIFO_CFG5_BM; - switch (ag->speed) { + speed = ag->speed; + if (ag->builtin_switch) + speed = SPEED_1000; + + switch (speed) { case SPEED_1000: cfg2 |= MAC_CFG2_IF_1000; fifo5 |= FIFO_CFG5_BM; @@ -1568,6 +1573,9 @@ static int ag71xx_probe(struct platform_device *pdev) ag->pllregmap = NULL; } + if (of_property_read_bool(np, "builtin-switch")) + ag->builtin_switch = 1; + ag->mac_base = devm_ioremap(&pdev->dev, res->start, res->end - res->start + 1); if (!ag->mac_base)