aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ti/cpsw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/ti/cpsw.c')
-rw-r--r--drivers/net/ethernet/ti/cpsw.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index bde63e3af96f..ffd4d12acf6d 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -554,7 +554,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
554 * common for both the interface as the interface shares 554 * common for both the interface as the interface shares
555 * the same hardware resource. 555 * the same hardware resource.
556 */ 556 */
557 for (i = 0; i <= priv->data.slaves; i++) 557 for (i = 0; i < priv->data.slaves; i++)
558 if (priv->slaves[i].ndev->flags & IFF_PROMISC) 558 if (priv->slaves[i].ndev->flags & IFF_PROMISC)
559 flag = true; 559 flag = true;
560 560
@@ -578,7 +578,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
578 unsigned long timeout = jiffies + HZ; 578 unsigned long timeout = jiffies + HZ;
579 579
580 /* Disable Learn for all ports */ 580 /* Disable Learn for all ports */
581 for (i = 0; i <= priv->data.slaves; i++) { 581 for (i = 0; i < priv->data.slaves; i++) {
582 cpsw_ale_control_set(ale, i, 582 cpsw_ale_control_set(ale, i,
583 ALE_PORT_NOLEARN, 1); 583 ALE_PORT_NOLEARN, 1);
584 cpsw_ale_control_set(ale, i, 584 cpsw_ale_control_set(ale, i,
@@ -606,7 +606,7 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
606 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); 606 cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0);
607 607
608 /* Enable Learn for all ports */ 608 /* Enable Learn for all ports */
609 for (i = 0; i <= priv->data.slaves; i++) { 609 for (i = 0; i < priv->data.slaves; i++) {
610 cpsw_ale_control_set(ale, i, 610 cpsw_ale_control_set(ale, i,
611 ALE_PORT_NOLEARN, 0); 611 ALE_PORT_NOLEARN, 0);
612 cpsw_ale_control_set(ale, i, 612 cpsw_ale_control_set(ale, i,
@@ -1164,11 +1164,17 @@ static void cpsw_init_host_port(struct cpsw_priv *priv)
1164 1164
1165static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv) 1165static void cpsw_slave_stop(struct cpsw_slave *slave, struct cpsw_priv *priv)
1166{ 1166{
1167 u32 slave_port;
1168
1169 slave_port = cpsw_get_slave_port(priv, slave->slave_num);
1170
1167 if (!slave->phy) 1171 if (!slave->phy)
1168 return; 1172 return;
1169 phy_stop(slave->phy); 1173 phy_stop(slave->phy);
1170 phy_disconnect(slave->phy); 1174 phy_disconnect(slave->phy);
1171 slave->phy = NULL; 1175 slave->phy = NULL;
1176 cpsw_ale_control_set(priv->ale, slave_port,
1177 ALE_PORT_STATE, ALE_PORT_STATE_DISABLE);
1172} 1178}
1173 1179
1174static int cpsw_ndo_open(struct net_device *ndev) 1180static int cpsw_ndo_open(struct net_device *ndev)
@@ -1878,14 +1884,29 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
1878 mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); 1884 mdio_node = of_find_node_by_phandle(be32_to_cpup(parp));
1879 phyid = be32_to_cpup(parp+1); 1885 phyid = be32_to_cpup(parp+1);
1880 mdio = of_find_device_by_node(mdio_node); 1886 mdio = of_find_device_by_node(mdio_node);
1881 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), 1887
1882 PHY_ID_FMT, mdio->name, phyid); 1888 if (strncmp(mdio->name, "gpio", 4) == 0) {
1889 /* GPIO bitbang MDIO driver attached */
1890 struct mii_bus *bus = dev_get_drvdata(&mdio->dev);
1891
1892 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
1893 PHY_ID_FMT, bus->id, phyid);
1894 } else {
1895 /* davinci MDIO driver attached */
1896 snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
1897 PHY_ID_FMT, mdio->name, phyid);
1898 }
1883 1899
1884 mac_addr = of_get_mac_address(slave_node); 1900 mac_addr = of_get_mac_address(slave_node);
1885 if (mac_addr) 1901 if (mac_addr)
1886 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); 1902 memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
1887 1903
1888 slave_data->phy_if = of_get_phy_mode(slave_node); 1904 slave_data->phy_if = of_get_phy_mode(slave_node);
1905 if (slave_data->phy_if < 0) {
1906 pr_err("Missing or malformed slave[%d] phy-mode property\n",
1907 i);
1908 return slave_data->phy_if;
1909 }
1889 1910
1890 if (data->dual_emac) { 1911 if (data->dual_emac) {
1891 if (of_property_read_u32(slave_node, "dual_emac_res_vlan", 1912 if (of_property_read_u32(slave_node, "dual_emac_res_vlan",