aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWingMan Kwok2015-02-27 15:18:33 -0600
committerWingMan Kwok2015-03-10 09:20:18 -0500
commitefd468cfeeb35dbb843540d6bcc8c61231a054a7 (patch)
tree4fb93abfabe32bfe0313d3f1338f283b91126fdd
parente55b702ba52b4e43073cb33a7a4a95c1d55ddb53 (diff)
downloadlinux-efd468cfeeb35dbb843540d6bcc8c61231a054a7.tar.gz
linux-efd468cfeeb35dbb843540d6bcc8c61231a054a7.tar.xz
linux-efd468cfeeb35dbb843540d6bcc8c61231a054a7.zip
net: keystone: add support of additional 1G sgmii mode configurations
This patch adds support of 3 1G sgmii mode configurations 1. MAC-to-PHY master (SGMII_LINK_MAC_PHY_MASTER) 2. MAC-to-PHY master NO MDIO (SGMII_LINK_MAC_PHY_MASTER_NO_MDIO) - SGMII is in master mode and auto-nego enabled - use this mode to work around link down/up issue observed on K2E/L. - these 2 modes supports only gigabit fullduplex connections. 3. MAC-to-MAC Auto-negotiation Slave (SGMII_LINK_MAC_MAC_AN_SLAVE) - When connected 2 EVMs back-to-back and one side is configured as MAC-to-MAC Auto-negotiation master the other side needs to be configured as auto-nego slave. Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
-rw-r--r--drivers/net/ethernet/ti/keystone_ethss.c9
-rw-r--r--drivers/net/ethernet/ti/keystone_ethss2.c8
-rw-r--r--drivers/net/ethernet/ti/keystone_net.h3
-rw-r--r--drivers/net/ethernet/ti/keystone_sgmii.c3
4 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/ethernet/ti/keystone_ethss.c b/drivers/net/ethernet/ti/keystone_ethss.c
index 1e18fa4d27e..51a5bd7038e 100644
--- a/drivers/net/ethernet/ti/keystone_ethss.c
+++ b/drivers/net/ethernet/ti/keystone_ethss.c
@@ -161,6 +161,9 @@
161#define SGMII_BASE(s) \ 161#define SGMII_BASE(s) \
162 (((s) < 2) ? cpsw_dev->sgmii_port_regs : cpsw_dev->sgmii_port34_regs) 162 (((s) < 2) ? cpsw_dev->sgmii_port_regs : cpsw_dev->sgmii_port34_regs)
163 163
164#define IS_SGMII_MAC_PHY(i) \
165 (((i) == SGMII_LINK_MAC_PHY) || ((i) == SGMII_LINK_MAC_PHY_MASTER))
166
164/* CPSW SERDES */ 167/* CPSW SERDES */
165#define CPSW_SERDES_MAX_NUM 1 168#define CPSW_SERDES_MAX_NUM 1
166#define CPSW_LANE_NUM_PER_SERDES 4 169#define CPSW_LANE_NUM_PER_SERDES 4
@@ -2223,7 +2226,7 @@ static void cpsw_slave_link(struct cpsw_slave *slave,
2223 struct netcp_priv *netcp = netdev_priv(cpsw_intf->ndev); 2226 struct netcp_priv *netcp = netdev_priv(cpsw_intf->ndev);
2224 int sn = slave->slave_num; 2227 int sn = slave->slave_num;
2225 2228
2226 if (slave->link_interface == SGMII_LINK_MAC_PHY) { 2229 if (IS_SGMII_MAC_PHY(slave->link_interface)) {
2227 /* check only the bit in phy_link_state_mask 2230 /* check only the bit in phy_link_state_mask
2228 * that corresponds to the slave 2231 * that corresponds to the slave
2229 */ 2232 */
@@ -2271,7 +2274,7 @@ static void cpsw_slave_open(struct cpsw_slave *slave,
2271 cpsw_ale_add_mcast(priv->ale, cpsw_intf->ndev->broadcast, 2274 cpsw_ale_add_mcast(priv->ale, cpsw_intf->ndev->broadcast,
2272 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); 2275 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
2273 2276
2274 if (slave->link_interface == SGMII_LINK_MAC_PHY) { 2277 if (IS_SGMII_MAC_PHY(slave->link_interface)) {
2275 slave->phy = of_phy_connect(cpsw_intf->ndev, 2278 slave->phy = of_phy_connect(cpsw_intf->ndev,
2276 cpsw_intf->phy_node, 2279 cpsw_intf->phy_node,
2277 &cpsw_adjust_link, 0, 2280 &cpsw_adjust_link, 0,
@@ -2683,7 +2686,7 @@ static void cpsw_timer(unsigned long arg)
2683 */ 2686 */
2684 if (!cpsw_dev->multi_if || 2687 if (!cpsw_dev->multi_if ||
2685 (cpsw_dev->multi_if && 2688 (cpsw_dev->multi_if &&
2686 cpsw_intf->slaves->link_interface != SGMII_LINK_MAC_PHY)) { 2689 !IS_SGMII_MAC_PHY(cpsw_intf->slaves->link_interface))) {
2687 if (cpsw_intf->link_state) 2690 if (cpsw_intf->link_state)
2688 netif_carrier_on(cpsw_intf->ndev); 2691 netif_carrier_on(cpsw_intf->ndev);
2689 else 2692 else
diff --git a/drivers/net/ethernet/ti/keystone_ethss2.c b/drivers/net/ethernet/ti/keystone_ethss2.c
index b0f701f5289..e5fadee8c0f 100644
--- a/drivers/net/ethernet/ti/keystone_ethss2.c
+++ b/drivers/net/ethernet/ti/keystone_ethss2.c
@@ -164,6 +164,8 @@
164#define SGMII2_BASE(s) (((s) < 2) ? cpsw_dev->sgmii_port_regs : \ 164#define SGMII2_BASE(s) (((s) < 2) ? cpsw_dev->sgmii_port_regs : \
165 cpsw_dev->sgmii_port_regs + SGMII_REGS_SIZE * 2) 165 cpsw_dev->sgmii_port_regs + SGMII_REGS_SIZE * 2)
166 166
167#define IS_SGMII_MAC_PHY(i) \
168 (((i) == SGMII_LINK_MAC_PHY) || ((i) == SGMII_LINK_MAC_PHY_MASTER))
167 169
168/* CPSW Statistics register map size */ 170/* CPSW Statistics register map size */
169#define CPSW2_STATS_REGS_SIZE 0x200 171#define CPSW2_STATS_REGS_SIZE 0x200
@@ -2597,7 +2599,7 @@ static void cpsw2_slave_link(struct cpsw2_slave *slave,
2597 struct netcp_priv *netcp = netdev_priv(cpsw_intf->ndev); 2599 struct netcp_priv *netcp = netdev_priv(cpsw_intf->ndev);
2598 int sn = slave->slave_num; 2600 int sn = slave->slave_num;
2599 2601
2600 if (slave->link_interface == SGMII_LINK_MAC_PHY) { 2602 if (IS_SGMII_MAC_PHY(slave->link_interface)) {
2601 /* check only the bit in phy_link_state_mask 2603 /* check only the bit in phy_link_state_mask
2602 * that corresponds to the slave 2604 * that corresponds to the slave
2603 */ 2605 */
@@ -2640,7 +2642,7 @@ static void cpsw2_slave_open(struct cpsw2_slave *slave,
2640 cpsw_ale_add_mcast(cpsw_dev->ale, cpsw_intf->ndev->broadcast, 2642 cpsw_ale_add_mcast(cpsw_dev->ale, cpsw_intf->ndev->broadcast,
2641 1 << slave_port, 0, 0, ALE_MCAST_FWD_2); 2643 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
2642 2644
2643 if (slave->link_interface == SGMII_LINK_MAC_PHY) { 2645 if (IS_SGMII_MAC_PHY(slave->link_interface)) {
2644 slave->phy = of_phy_connect(cpsw_intf->ndev, 2646 slave->phy = of_phy_connect(cpsw_intf->ndev,
2645 cpsw_intf->phy_node, 2647 cpsw_intf->phy_node,
2646 &cpsw2_adjust_link, 0, 2648 &cpsw2_adjust_link, 0,
@@ -3044,7 +3046,7 @@ static void cpsw2_timer(unsigned long arg)
3044 */ 3046 */
3045 if (!cpsw_dev->multi_if || 3047 if (!cpsw_dev->multi_if ||
3046 (cpsw_dev->multi_if && 3048 (cpsw_dev->multi_if &&
3047 cpsw_intf->slaves->link_interface != SGMII_LINK_MAC_PHY)) { 3049 !IS_SGMII_MAC_PHY(cpsw_intf->slaves->link_interface))) {
3048 if (cpsw_intf->link_state) 3050 if (cpsw_intf->link_state)
3049 netif_carrier_on(cpsw_intf->ndev); 3051 netif_carrier_on(cpsw_intf->ndev);
3050 else 3052 else
diff --git a/drivers/net/ethernet/ti/keystone_net.h b/drivers/net/ethernet/ti/keystone_net.h
index 307db180a23..c6f62687da8 100644
--- a/drivers/net/ethernet/ti/keystone_net.h
+++ b/drivers/net/ethernet/ti/keystone_net.h
@@ -34,6 +34,9 @@
34#define SGMII_LINK_MAC_MAC_FORCED 2 34#define SGMII_LINK_MAC_MAC_FORCED 2
35#define SGMII_LINK_MAC_FIBER 3 35#define SGMII_LINK_MAC_FIBER 3
36#define SGMII_LINK_MAC_PHY_NO_MDIO 4 36#define SGMII_LINK_MAC_PHY_NO_MDIO 4
37#define SGMII_LINK_MAC_PHY_MASTER 5
38#define SGMII_LINK_MAC_PHY_MASTER_NO_MDIO 6
39#define SGMII_LINK_MAC_MAC_AN_SLAVE 7
37#define XGMII_LINK_MAC_PHY 10 40#define XGMII_LINK_MAC_PHY 10
38#define XGMII_LINK_MAC_MAC_FORCED 11 41#define XGMII_LINK_MAC_MAC_FORCED 11
39 42
diff --git a/drivers/net/ethernet/ti/keystone_sgmii.c b/drivers/net/ethernet/ti/keystone_sgmii.c
index 5591ea55d81..8d0538fb503 100644
--- a/drivers/net/ethernet/ti/keystone_sgmii.c
+++ b/drivers/net/ethernet/ti/keystone_sgmii.c
@@ -137,6 +137,8 @@ int keystone_sgmii_config(void __iomem *sgmii_ofs,
137 u32 control; 137 u32 control;
138 138
139 switch (interface) { 139 switch (interface) {
140 case SGMII_LINK_MAC_PHY_MASTER:
141 case SGMII_LINK_MAC_PHY_MASTER_NO_MDIO:
140 case SGMII_LINK_MAC_MAC_AUTONEG: 142 case SGMII_LINK_MAC_MAC_AUTONEG:
141 mr_adv_ability = 0x9801; 143 mr_adv_ability = 0x9801;
142 control = 0x21; 144 control = 0x21;
@@ -144,6 +146,7 @@ int keystone_sgmii_config(void __iomem *sgmii_ofs,
144 146
145 case SGMII_LINK_MAC_PHY: 147 case SGMII_LINK_MAC_PHY:
146 case SGMII_LINK_MAC_PHY_NO_MDIO: 148 case SGMII_LINK_MAC_PHY_NO_MDIO:
149 case SGMII_LINK_MAC_MAC_AN_SLAVE:
147 mr_adv_ability = 1; 150 mr_adv_ability = 1;
148 control = 1; 151 control = 1;
149 break; 152 break;