diff options
Diffstat (limited to 'target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch')
-rw-r--r-- | target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch b/target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch index 8084a17af1..b62dadd2f3 100644 --- a/target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch +++ b/target/linux/mvebu/patches-4.9/419-net-mvneta-convert-to-phylink.patch @@ -74,7 +74,18 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> struct mvneta_bm *bm_priv; struct mvneta_bm_pool *pool_long; -@@ -1241,44 +1244,6 @@ static void mvneta_set_other_mcast_table +@@ -1182,10 +1185,6 @@ static void mvneta_port_disable(struct m + val &= ~MVNETA_GMAC0_PORT_ENABLE; + mvreg_write(pp, MVNETA_GMAC_CTRL_0, val); + +- pp->link = 0; +- pp->duplex = -1; +- pp->speed = 0; +- + udelay(200); + } + +@@ -1245,44 +1244,6 @@ static void mvneta_set_other_mcast_table mvreg_write(pp, MVNETA_DA_FILT_OTH_MCAST + offset, val); } @@ -119,7 +130,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> static void mvneta_percpu_unmask_interrupt(void *arg) { struct mvneta_port *pp = arg; -@@ -1426,7 +1391,6 @@ static void mvneta_defaults_set(struct m +@@ -1430,7 +1391,6 @@ static void mvneta_defaults_set(struct m val &= ~MVNETA_PHY_POLLING_ENABLE; mvreg_write(pp, MVNETA_UNIT_CONTROL, val); @@ -127,7 +138,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> mvneta_set_ucast_table(pp, -1); mvneta_set_special_mcast_table(pp, -1); mvneta_set_other_mcast_table(pp, -1); -@@ -2631,26 +2595,11 @@ static irqreturn_t mvneta_isr(int irq, v +@@ -2635,26 +2595,11 @@ static irqreturn_t mvneta_isr(int irq, v return IRQ_HANDLED; } @@ -156,7 +167,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } /* NAPI handler -@@ -2666,7 +2615,6 @@ static int mvneta_poll(struct napi_struc +@@ -2670,7 +2615,6 @@ static int mvneta_poll(struct napi_struc u32 cause_rx_tx; int rx_queue; struct mvneta_port *pp = netdev_priv(napi->dev); @@ -164,7 +175,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> struct mvneta_pcpu_port *port = this_cpu_ptr(pp->ports); if (!netif_running(pp->dev)) { -@@ -2680,12 +2628,11 @@ static int mvneta_poll(struct napi_struc +@@ -2684,12 +2628,11 @@ static int mvneta_poll(struct napi_struc u32 cause_misc = mvreg_read(pp, MVNETA_INTR_MISC_CAUSE); mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0); @@ -182,7 +193,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } /* Release Tx descriptors */ -@@ -2981,7 +2928,6 @@ static int mvneta_setup_txqs(struct mvne +@@ -2985,7 +2928,6 @@ static int mvneta_setup_txqs(struct mvne static void mvneta_start_dev(struct mvneta_port *pp) { int cpu; @@ -190,7 +201,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> mvneta_max_rx_size_set(pp, pp->pkt_size); mvneta_txq_max_tx_size_set(pp, pp->pkt_size); -@@ -3004,16 +2950,15 @@ static void mvneta_start_dev(struct mvne +@@ -3008,16 +2950,15 @@ static void mvneta_start_dev(struct mvne MVNETA_CAUSE_LINK_CHANGE | MVNETA_CAUSE_PSC_SYNC_CHANGE); @@ -209,7 +220,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> for_each_online_cpu(cpu) { struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu); -@@ -3183,99 +3128,210 @@ static int mvneta_set_mac_addr(struct ne +@@ -3187,99 +3128,210 @@ static int mvneta_set_mac_addr(struct ne return 0; } @@ -252,15 +263,6 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> - struct phy_device *phydev = ndev->phydev; - int status_change = 0; + u32 gmac_stat; -+ -+ gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS); -+ -+ if (gmac_stat & MVNETA_GMAC_SPEED_1000) -+ state->speed = SPEED_1000; -+ else if (gmac_stat & MVNETA_GMAC_SPEED_100) -+ state->speed = SPEED_100; -+ else -+ state->speed = SPEED_10; - if (phydev->link) { - if ((pp->speed != phydev->speed) || @@ -279,17 +281,26 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> - val |= MVNETA_GMAC_CONFIG_GMII_SPEED; - else if (phydev->speed == SPEED_100) - val |= MVNETA_GMAC_CONFIG_MII_SPEED; -+ state->an_complete = !!(gmac_stat & MVNETA_GMAC_AN_COMPLETE); -+ state->link = !!(gmac_stat & MVNETA_GMAC_LINK_UP); -+ state->duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX); ++ gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS); - mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); -+ return 1; -+} ++ if (gmac_stat & MVNETA_GMAC_SPEED_1000) ++ state->speed = SPEED_1000; ++ else if (gmac_stat & MVNETA_GMAC_SPEED_100) ++ state->speed = SPEED_100; ++ else ++ state->speed = SPEED_10; - pp->duplex = phydev->duplex; - pp->speed = phydev->speed; - } ++ state->an_complete = !!(gmac_stat & MVNETA_GMAC_AN_COMPLETE); ++ state->link = !!(gmac_stat & MVNETA_GMAC_LINK_UP); ++ state->duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX); ++ ++ return 1; ++} ++ +static void mvneta_mac_an_restart(struct net_device *ndev, unsigned int mode) +{ + struct mvneta_port *pp = netdev_priv(ndev); @@ -490,7 +501,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } /* Electing a CPU must be done in an atomic way: it should be done -@@ -3533,10 +3589,9 @@ static int mvneta_stop(struct net_device +@@ -3537,10 +3589,9 @@ static int mvneta_stop(struct net_device static int mvneta_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { @@ -503,7 +514,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } /* Ethtool methods */ -@@ -3547,44 +3602,18 @@ mvneta_ethtool_set_link_ksettings(struct +@@ -3551,44 +3602,18 @@ mvneta_ethtool_set_link_ksettings(struct const struct ethtool_link_ksettings *cmd) { struct mvneta_port *pp = netdev_priv(ndev); @@ -557,7 +568,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } /* Set interrupt coalescing for ethtools */ -@@ -3692,26 +3721,28 @@ static void mvneta_ethtool_update_stats( +@@ -3696,26 +3721,28 @@ static void mvneta_ethtool_update_stats( { const struct mvneta_statistic *s; void __iomem *base = pp->base; @@ -591,7 +602,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } } -@@ -3871,7 +3902,7 @@ const struct ethtool_ops mvneta_eth_tool +@@ -3875,7 +3902,7 @@ const struct ethtool_ops mvneta_eth_tool .get_rxnfc = mvneta_ethtool_get_rxnfc, .get_rxfh = mvneta_ethtool_get_rxfh, .set_rxfh = mvneta_ethtool_set_rxfh, @@ -600,7 +611,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> .set_link_ksettings = mvneta_ethtool_set_link_ksettings, }; -@@ -3998,14 +4029,13 @@ static int mvneta_probe(struct platform_ +@@ -4002,14 +4029,13 @@ static int mvneta_probe(struct platform_ const struct mbus_dram_target_info *dram_target_info; struct resource *res; struct device_node *dn = pdev->dev.of_node; @@ -616,7 +627,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> int tx_csum_limit; int phy_mode; int err; -@@ -4021,31 +4051,11 @@ static int mvneta_probe(struct platform_ +@@ -4025,31 +4051,11 @@ static int mvneta_probe(struct platform_ goto err_free_netdev; } @@ -649,7 +660,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } dev->tx_queue_len = MVNETA_MAX_TXD; -@@ -4056,12 +4066,7 @@ static int mvneta_probe(struct platform_ +@@ -4060,12 +4066,7 @@ static int mvneta_probe(struct platform_ pp = netdev_priv(dev); spin_lock_init(&pp->lock); @@ -663,7 +674,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> pp->rxq_def = rxq_def; -@@ -4072,7 +4077,7 @@ static int mvneta_probe(struct platform_ +@@ -4076,7 +4077,7 @@ static int mvneta_probe(struct platform_ pp->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(pp->clk)) { err = PTR_ERR(pp->clk); @@ -672,7 +683,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> } clk_prepare_enable(pp->clk); -@@ -4180,6 +4185,14 @@ static int mvneta_probe(struct platform_ +@@ -4184,6 +4185,14 @@ static int mvneta_probe(struct platform_ dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; dev->gso_max_segs = MVNETA_MAX_TSO_SEGS; @@ -687,7 +698,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> err = register_netdev(dev); if (err < 0) { dev_err(&pdev->dev, "failed to register\n"); -@@ -4191,14 +4204,6 @@ static int mvneta_probe(struct platform_ +@@ -4195,14 +4204,6 @@ static int mvneta_probe(struct platform_ platform_set_drvdata(pdev, pp->dev); @@ -702,7 +713,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> return 0; err_netdev: -@@ -4209,16 +4214,14 @@ err_netdev: +@@ -4213,16 +4214,14 @@ err_netdev: 1 << pp->id); } err_free_stats: @@ -721,7 +732,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> err_free_irq: irq_dispose_mapping(dev->irq); err_free_netdev: -@@ -4230,7 +4233,6 @@ err_free_netdev: +@@ -4234,7 +4233,6 @@ err_free_netdev: static int mvneta_remove(struct platform_device *pdev) { struct net_device *dev = platform_get_drvdata(pdev); @@ -729,7 +740,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> struct mvneta_port *pp = netdev_priv(dev); unregister_netdev(dev); -@@ -4238,10 +4240,8 @@ static int mvneta_remove(struct platform +@@ -4242,10 +4240,8 @@ static int mvneta_remove(struct platform clk_disable_unprepare(pp->clk); free_percpu(pp->ports); free_percpu(pp->stats); |