diff options
author | Iyappan Subramanian <isubramanian@apm.com> | 2014-10-13 20:05:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-14 16:09:21 -0400 |
commit | dc8385f0c0f46ca18c1c8ab59c9f565dc7cfa6bf (patch) | |
tree | 2c5b4cbff124612a69b1f8ce2b5793fea0a00495 /drivers/net/ethernet/apm | |
parent | 4c2e7f0954dcd9fbb47d065c654d44608dad38e0 (diff) |
drivers: net: xgene: Preparing for adding SGMII based 1GbE
- Added link_state function pointer to the xgene__mac_ops structure
- Moved ring manager (pdata->rm) assignment to xgene_enet_setup_ops
- Removed unused variable (pdata->phy_addr) and macro (FULL_DUPLEX)
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Signed-off-by: Keyur Chudgar <kchudgar@apm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/apm')
6 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index c8f3824f7606..63ea1941e973 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | |||
@@ -410,7 +410,6 @@ static void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata) | |||
410 | addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) | | 410 | addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) | |
411 | (dev_addr[1] << 8) | dev_addr[0]; | 411 | (dev_addr[1] << 8) | dev_addr[0]; |
412 | addr1 = (dev_addr[5] << 24) | (dev_addr[4] << 16); | 412 | addr1 = (dev_addr[5] << 24) | (dev_addr[4] << 16); |
413 | addr1 |= pdata->phy_addr & 0xFFFF; | ||
414 | 413 | ||
415 | xgene_enet_wr_mcx_mac(pdata, STATION_ADDR0_ADDR, addr0); | 414 | xgene_enet_wr_mcx_mac(pdata, STATION_ADDR0_ADDR, addr0); |
416 | xgene_enet_wr_mcx_mac(pdata, STATION_ADDR1_ADDR, addr1); | 415 | xgene_enet_wr_mcx_mac(pdata, STATION_ADDR1_ADDR, addr1); |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h index 15ec4267779c..2efc4d98d4a5 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | |||
@@ -179,7 +179,6 @@ enum xgene_enet_rm { | |||
179 | #define TUND_ADDR 0x4a | 179 | #define TUND_ADDR 0x4a |
180 | 180 | ||
181 | #define TSO_IPPROTO_TCP 1 | 181 | #define TSO_IPPROTO_TCP 1 |
182 | #define FULL_DUPLEX 2 | ||
183 | 182 | ||
184 | #define USERINFO_POS 0 | 183 | #define USERINFO_POS 0 |
185 | #define USERINFO_LEN 32 | 184 | #define USERINFO_LEN 32 |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 9b85239ceedf..9e251ecf6e33 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
@@ -833,11 +833,9 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) | |||
833 | if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { | 833 | if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) { |
834 | pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET; | 834 | pdata->mcx_mac_addr = base_addr + BLOCK_ETH_MAC_OFFSET; |
835 | pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET; | 835 | pdata->mcx_mac_csr_addr = base_addr + BLOCK_ETH_MAC_CSR_OFFSET; |
836 | pdata->rm = RM3; | ||
837 | } else { | 836 | } else { |
838 | pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET; | 837 | pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET; |
839 | pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET; | 838 | pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET; |
840 | pdata->rm = RM0; | ||
841 | } | 839 | } |
842 | pdata->rx_buff_cnt = NUM_PKT_BUF; | 840 | pdata->rx_buff_cnt = NUM_PKT_BUF; |
843 | 841 | ||
@@ -881,10 +879,12 @@ static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata) | |||
881 | case PHY_INTERFACE_MODE_RGMII: | 879 | case PHY_INTERFACE_MODE_RGMII: |
882 | pdata->mac_ops = &xgene_gmac_ops; | 880 | pdata->mac_ops = &xgene_gmac_ops; |
883 | pdata->port_ops = &xgene_gport_ops; | 881 | pdata->port_ops = &xgene_gport_ops; |
882 | pdata->rm = RM3; | ||
884 | break; | 883 | break; |
885 | default: | 884 | default: |
886 | pdata->mac_ops = &xgene_xgmac_ops; | 885 | pdata->mac_ops = &xgene_xgmac_ops; |
887 | pdata->port_ops = &xgene_xgport_ops; | 886 | pdata->port_ops = &xgene_xgport_ops; |
887 | pdata->rm = RM0; | ||
888 | break; | 888 | break; |
889 | } | 889 | } |
890 | } | 890 | } |
@@ -895,6 +895,7 @@ static int xgene_enet_probe(struct platform_device *pdev) | |||
895 | struct xgene_enet_pdata *pdata; | 895 | struct xgene_enet_pdata *pdata; |
896 | struct device *dev = &pdev->dev; | 896 | struct device *dev = &pdev->dev; |
897 | struct napi_struct *napi; | 897 | struct napi_struct *napi; |
898 | struct xgene_mac_ops *mac_ops; | ||
898 | int ret; | 899 | int ret; |
899 | 900 | ||
900 | ndev = alloc_etherdev(sizeof(struct xgene_enet_pdata)); | 901 | ndev = alloc_etherdev(sizeof(struct xgene_enet_pdata)); |
@@ -937,10 +938,11 @@ static int xgene_enet_probe(struct platform_device *pdev) | |||
937 | 938 | ||
938 | napi = &pdata->rx_ring->napi; | 939 | napi = &pdata->rx_ring->napi; |
939 | netif_napi_add(ndev, napi, xgene_enet_napi, NAPI_POLL_WEIGHT); | 940 | netif_napi_add(ndev, napi, xgene_enet_napi, NAPI_POLL_WEIGHT); |
941 | mac_ops = pdata->mac_ops; | ||
940 | if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) | 942 | if (pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) |
941 | ret = xgene_enet_mdio_config(pdata); | 943 | ret = xgene_enet_mdio_config(pdata); |
942 | else | 944 | else |
943 | INIT_DELAYED_WORK(&pdata->link_work, xgene_enet_link_state); | 945 | INIT_DELAYED_WORK(&pdata->link_work, mac_ops->link_state); |
944 | 946 | ||
945 | return ret; | 947 | return ret; |
946 | err: | 948 | err: |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h index 86cf68b65584..10b03a1f16e9 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h | |||
@@ -76,6 +76,7 @@ struct xgene_mac_ops { | |||
76 | void (*tx_disable)(struct xgene_enet_pdata *pdata); | 76 | void (*tx_disable)(struct xgene_enet_pdata *pdata); |
77 | void (*rx_disable)(struct xgene_enet_pdata *pdata); | 77 | void (*rx_disable)(struct xgene_enet_pdata *pdata); |
78 | void (*set_mac_addr)(struct xgene_enet_pdata *pdata); | 78 | void (*set_mac_addr)(struct xgene_enet_pdata *pdata); |
79 | void (*link_state)(struct work_struct *work); | ||
79 | }; | 80 | }; |
80 | 81 | ||
81 | struct xgene_port_ops { | 82 | struct xgene_port_ops { |
@@ -109,7 +110,6 @@ struct xgene_enet_pdata { | |||
109 | void __iomem *base_addr; | 110 | void __iomem *base_addr; |
110 | void __iomem *ring_csr_addr; | 111 | void __iomem *ring_csr_addr; |
111 | void __iomem *ring_cmd_addr; | 112 | void __iomem *ring_cmd_addr; |
112 | u32 phy_addr; | ||
113 | int phy_mode; | 113 | int phy_mode; |
114 | enum xgene_enet_rm rm; | 114 | enum xgene_enet_rm rm; |
115 | struct rtnl_link_stats64 stats; | 115 | struct rtnl_link_stats64 stats; |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c index cd64b9f18b58..67d07206b3c7 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | |||
@@ -284,7 +284,7 @@ static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata) | |||
284 | clk_disable_unprepare(pdata->clk); | 284 | clk_disable_unprepare(pdata->clk); |
285 | } | 285 | } |
286 | 286 | ||
287 | void xgene_enet_link_state(struct work_struct *work) | 287 | static void xgene_enet_link_state(struct work_struct *work) |
288 | { | 288 | { |
289 | struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work), | 289 | struct xgene_enet_pdata *pdata = container_of(to_delayed_work(work), |
290 | struct xgene_enet_pdata, link_work); | 290 | struct xgene_enet_pdata, link_work); |
@@ -322,6 +322,7 @@ struct xgene_mac_ops xgene_xgmac_ops = { | |||
322 | .rx_disable = xgene_xgmac_rx_disable, | 322 | .rx_disable = xgene_xgmac_rx_disable, |
323 | .tx_disable = xgene_xgmac_tx_disable, | 323 | .tx_disable = xgene_xgmac_tx_disable, |
324 | .set_mac_addr = xgene_xgmac_set_mac_addr, | 324 | .set_mac_addr = xgene_xgmac_set_mac_addr, |
325 | .link_state = xgene_enet_link_state | ||
325 | }; | 326 | }; |
326 | 327 | ||
327 | struct xgene_port_ops xgene_xgport_ops = { | 328 | struct xgene_port_ops xgene_xgport_ops = { |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h index d2d59e7ed9ab..dcb20879e82d 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.h | |||
@@ -50,7 +50,6 @@ | |||
50 | #define PHY_POLL_LINK_ON (10 * HZ) | 50 | #define PHY_POLL_LINK_ON (10 * HZ) |
51 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) | 51 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) |
52 | 52 | ||
53 | void xgene_enet_link_state(struct work_struct *work); | ||
54 | extern struct xgene_mac_ops xgene_xgmac_ops; | 53 | extern struct xgene_mac_ops xgene_xgmac_ops; |
55 | extern struct xgene_port_ops xgene_xgport_ops; | 54 | extern struct xgene_port_ops xgene_xgport_ops; |
56 | 55 | ||