diff options
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r-- | drivers/net/bnx2x/bnx2x.h | 35 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 70 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.h | 6 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_dcb.c | 137 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_dcb.h | 5 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 58 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_hsi.h | 114 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.c | 2527 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.h | 34 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_main.c | 598 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_reg.h | 1 |
11 files changed, 2186 insertions, 1399 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 8849699c66c4..b7ff87b35fbb 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -22,8 +22,8 @@ | |||
22 | * (you will need to reboot afterwards) */ | 22 | * (you will need to reboot afterwards) */ |
23 | /* #define BNX2X_STOP_ON_ERROR */ | 23 | /* #define BNX2X_STOP_ON_ERROR */ |
24 | 24 | ||
25 | #define DRV_MODULE_VERSION "1.62.00-6" | 25 | #define DRV_MODULE_VERSION "1.62.11-0" |
26 | #define DRV_MODULE_RELDATE "2011/01/30" | 26 | #define DRV_MODULE_RELDATE "2011/01/31" |
27 | #define BNX2X_BC_VER 0x040200 | 27 | #define BNX2X_BC_VER 0x040200 |
28 | 28 | ||
29 | #define BNX2X_MULTI_QUEUE | 29 | #define BNX2X_MULTI_QUEUE |
@@ -31,7 +31,7 @@ | |||
31 | #define BNX2X_NEW_NAPI | 31 | #define BNX2X_NEW_NAPI |
32 | 32 | ||
33 | #if defined(CONFIG_DCB) | 33 | #if defined(CONFIG_DCB) |
34 | #define BCM_DCB | 34 | #define BCM_DCBNL |
35 | #endif | 35 | #endif |
36 | #if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) | 36 | #if defined(CONFIG_CNIC) || defined(CONFIG_CNIC_MODULE) |
37 | #define BCM_CNIC 1 | 37 | #define BCM_CNIC 1 |
@@ -129,6 +129,7 @@ void bnx2x_panic_dump(struct bnx2x *bp); | |||
129 | #endif | 129 | #endif |
130 | 130 | ||
131 | #define bnx2x_mc_addr(ha) ((ha)->addr) | 131 | #define bnx2x_mc_addr(ha) ((ha)->addr) |
132 | #define bnx2x_uc_addr(ha) ((ha)->addr) | ||
132 | 133 | ||
133 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) | 134 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) |
134 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) | 135 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) |
@@ -341,6 +342,8 @@ struct bnx2x_fastpath { | |||
341 | /* chip independed shortcut into rx_prods_offset memory */ | 342 | /* chip independed shortcut into rx_prods_offset memory */ |
342 | u32 ustorm_rx_prods_offset; | 343 | u32 ustorm_rx_prods_offset; |
343 | 344 | ||
345 | u32 rx_buf_size; | ||
346 | |||
344 | dma_addr_t status_blk_mapping; | 347 | dma_addr_t status_blk_mapping; |
345 | 348 | ||
346 | struct sw_tx_bd *tx_buf_ring; | 349 | struct sw_tx_bd *tx_buf_ring; |
@@ -428,6 +431,10 @@ struct bnx2x_fastpath { | |||
428 | }; | 431 | }; |
429 | 432 | ||
430 | #define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) | 433 | #define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) |
434 | |||
435 | /* Use 2500 as a mini-jumbo MTU for FCoE */ | ||
436 | #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 | ||
437 | |||
431 | #ifdef BCM_CNIC | 438 | #ifdef BCM_CNIC |
432 | /* FCoE L2 `fastpath' is right after the eth entries */ | 439 | /* FCoE L2 `fastpath' is right after the eth entries */ |
433 | #define FCOE_IDX BNX2X_NUM_ETH_QUEUES(bp) | 440 | #define FCOE_IDX BNX2X_NUM_ETH_QUEUES(bp) |
@@ -810,6 +817,7 @@ struct bnx2x_slowpath { | |||
810 | struct eth_stats_query fw_stats; | 817 | struct eth_stats_query fw_stats; |
811 | struct mac_configuration_cmd mac_config; | 818 | struct mac_configuration_cmd mac_config; |
812 | struct mac_configuration_cmd mcast_config; | 819 | struct mac_configuration_cmd mcast_config; |
820 | struct mac_configuration_cmd uc_mac_config; | ||
813 | struct client_init_ramrod_data client_init_data; | 821 | struct client_init_ramrod_data client_init_data; |
814 | 822 | ||
815 | /* used by dmae command executer */ | 823 | /* used by dmae command executer */ |
@@ -911,7 +919,6 @@ struct bnx2x { | |||
911 | int tx_ring_size; | 919 | int tx_ring_size; |
912 | 920 | ||
913 | u32 rx_csum; | 921 | u32 rx_csum; |
914 | u32 rx_buf_size; | ||
915 | /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */ | 922 | /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */ |
916 | #define ETH_OVREHEAD (ETH_HLEN + 8 + 8) | 923 | #define ETH_OVREHEAD (ETH_HLEN + 8 + 8) |
917 | #define ETH_MIN_PACKET_SIZE 60 | 924 | #define ETH_MIN_PACKET_SIZE 60 |
@@ -939,7 +946,7 @@ struct bnx2x { | |||
939 | struct eth_spe *spq_prod_bd; | 946 | struct eth_spe *spq_prod_bd; |
940 | struct eth_spe *spq_last_bd; | 947 | struct eth_spe *spq_last_bd; |
941 | __le16 *dsb_sp_prod; | 948 | __le16 *dsb_sp_prod; |
942 | atomic_t spq_left; /* serialize spq */ | 949 | atomic_t cq_spq_left; /* ETH_XXX ramrods credit */ |
943 | /* used to synchronize spq accesses */ | 950 | /* used to synchronize spq accesses */ |
944 | spinlock_t spq_lock; | 951 | spinlock_t spq_lock; |
945 | 952 | ||
@@ -949,6 +956,7 @@ struct bnx2x { | |||
949 | u16 eq_prod; | 956 | u16 eq_prod; |
950 | u16 eq_cons; | 957 | u16 eq_cons; |
951 | __le16 *eq_cons_sb; | 958 | __le16 *eq_cons_sb; |
959 | atomic_t eq_spq_left; /* COMMON_XXX ramrods credit */ | ||
952 | 960 | ||
953 | /* Flags for marking that there is a STAT_QUERY or | 961 | /* Flags for marking that there is a STAT_QUERY or |
954 | SET_MAC ramrod pending */ | 962 | SET_MAC ramrod pending */ |
@@ -976,8 +984,12 @@ struct bnx2x { | |||
976 | #define MF_FUNC_DIS 0x1000 | 984 | #define MF_FUNC_DIS 0x1000 |
977 | #define FCOE_MACS_SET 0x2000 | 985 | #define FCOE_MACS_SET 0x2000 |
978 | #define NO_FCOE_FLAG 0x4000 | 986 | #define NO_FCOE_FLAG 0x4000 |
987 | #define NO_ISCSI_OOO_FLAG 0x8000 | ||
988 | #define NO_ISCSI_FLAG 0x10000 | ||
979 | 989 | ||
980 | #define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG) | 990 | #define NO_FCOE(bp) ((bp)->flags & NO_FCOE_FLAG) |
991 | #define NO_ISCSI(bp) ((bp)->flags & NO_ISCSI_FLAG) | ||
992 | #define NO_ISCSI_OOO(bp) ((bp)->flags & NO_ISCSI_OOO_FLAG) | ||
981 | 993 | ||
982 | int pf_num; /* absolute PF number */ | 994 | int pf_num; /* absolute PF number */ |
983 | int pfid; /* per-path PF number */ | 995 | int pfid; /* per-path PF number */ |
@@ -1064,6 +1076,7 @@ struct bnx2x { | |||
1064 | int num_queues; | 1076 | int num_queues; |
1065 | int disable_tpa; | 1077 | int disable_tpa; |
1066 | int int_mode; | 1078 | int int_mode; |
1079 | u32 *rx_indir_table; | ||
1067 | 1080 | ||
1068 | struct tstorm_eth_mac_filter_config mac_filters; | 1081 | struct tstorm_eth_mac_filter_config mac_filters; |
1069 | #define BNX2X_ACCEPT_NONE 0x0000 | 1082 | #define BNX2X_ACCEPT_NONE 0x0000 |
@@ -1110,7 +1123,7 @@ struct bnx2x { | |||
1110 | #define BNX2X_CNIC_FLAG_MAC_SET 1 | 1123 | #define BNX2X_CNIC_FLAG_MAC_SET 1 |
1111 | void *t2; | 1124 | void *t2; |
1112 | dma_addr_t t2_mapping; | 1125 | dma_addr_t t2_mapping; |
1113 | struct cnic_ops *cnic_ops; | 1126 | struct cnic_ops __rcu *cnic_ops; |
1114 | void *cnic_data; | 1127 | void *cnic_data; |
1115 | u32 cnic_tag; | 1128 | u32 cnic_tag; |
1116 | struct cnic_eth_dev cnic_eth_dev; | 1129 | struct cnic_eth_dev cnic_eth_dev; |
@@ -1125,13 +1138,12 @@ struct bnx2x { | |||
1125 | u16 cnic_kwq_pending; | 1138 | u16 cnic_kwq_pending; |
1126 | u16 cnic_spq_pending; | 1139 | u16 cnic_spq_pending; |
1127 | struct mutex cnic_mutex; | 1140 | struct mutex cnic_mutex; |
1128 | u8 iscsi_mac[ETH_ALEN]; | ||
1129 | u8 fip_mac[ETH_ALEN]; | 1141 | u8 fip_mac[ETH_ALEN]; |
1130 | #endif | 1142 | #endif |
1131 | 1143 | ||
1132 | int dmae_ready; | 1144 | int dmae_ready; |
1133 | /* used to synchronize dmae accesses */ | 1145 | /* used to synchronize dmae accesses */ |
1134 | struct mutex dmae_mutex; | 1146 | spinlock_t dmae_lock; |
1135 | 1147 | ||
1136 | /* used to protect the FW mail box */ | 1148 | /* used to protect the FW mail box */ |
1137 | struct mutex fw_mb_mutex; | 1149 | struct mutex fw_mb_mutex; |
@@ -1448,6 +1460,12 @@ u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param); | |||
1448 | void bnx2x_calc_fc_adv(struct bnx2x *bp); | 1460 | void bnx2x_calc_fc_adv(struct bnx2x *bp); |
1449 | int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, | 1461 | int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, |
1450 | u32 data_hi, u32 data_lo, int common); | 1462 | u32 data_hi, u32 data_lo, int common); |
1463 | |||
1464 | /* Clears multicast and unicast list configuration in the chip. */ | ||
1465 | void bnx2x_invalidate_e1_mc_list(struct bnx2x *bp); | ||
1466 | void bnx2x_invalidate_e1h_mc_list(struct bnx2x *bp); | ||
1467 | void bnx2x_invalidate_uc_list(struct bnx2x *bp); | ||
1468 | |||
1451 | void bnx2x_update_coalesce(struct bnx2x *bp); | 1469 | void bnx2x_update_coalesce(struct bnx2x *bp); |
1452 | int bnx2x_get_link_cfg_idx(struct bnx2x *bp); | 1470 | int bnx2x_get_link_cfg_idx(struct bnx2x *bp); |
1453 | 1471 | ||
@@ -1787,5 +1805,6 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | |||
1787 | BNX2X_EXTERN int load_count[2][3]; /* per path: 0-common, 1-port0, 2-port1 */ | 1805 | BNX2X_EXTERN int load_count[2][3]; /* per path: 0-common, 1-port0, 2-port1 */ |
1788 | 1806 | ||
1789 | extern void bnx2x_set_ethtool_ops(struct net_device *netdev); | 1807 | extern void bnx2x_set_ethtool_ops(struct net_device *netdev); |
1808 | void bnx2x_push_indir_table(struct bnx2x *bp); | ||
1790 | 1809 | ||
1791 | #endif /* bnx2x.h */ | 1810 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index a71b32940533..e83ac6dd6fc0 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -232,7 +232,7 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, | |||
232 | /* move empty skb from pool to prod and map it */ | 232 | /* move empty skb from pool to prod and map it */ |
233 | prod_rx_buf->skb = fp->tpa_pool[queue].skb; | 233 | prod_rx_buf->skb = fp->tpa_pool[queue].skb; |
234 | mapping = dma_map_single(&bp->pdev->dev, fp->tpa_pool[queue].skb->data, | 234 | mapping = dma_map_single(&bp->pdev->dev, fp->tpa_pool[queue].skb->data, |
235 | bp->rx_buf_size, DMA_FROM_DEVICE); | 235 | fp->rx_buf_size, DMA_FROM_DEVICE); |
236 | dma_unmap_addr_set(prod_rx_buf, mapping, mapping); | 236 | dma_unmap_addr_set(prod_rx_buf, mapping, mapping); |
237 | 237 | ||
238 | /* move partial skb from cons to pool (don't unmap yet) */ | 238 | /* move partial skb from cons to pool (don't unmap yet) */ |
@@ -367,13 +367,13 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
367 | struct sw_rx_bd *rx_buf = &fp->tpa_pool[queue]; | 367 | struct sw_rx_bd *rx_buf = &fp->tpa_pool[queue]; |
368 | struct sk_buff *skb = rx_buf->skb; | 368 | struct sk_buff *skb = rx_buf->skb; |
369 | /* alloc new skb */ | 369 | /* alloc new skb */ |
370 | struct sk_buff *new_skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size); | 370 | struct sk_buff *new_skb = netdev_alloc_skb(bp->dev, fp->rx_buf_size); |
371 | 371 | ||
372 | /* Unmap skb in the pool anyway, as we are going to change | 372 | /* Unmap skb in the pool anyway, as we are going to change |
373 | pool entry status to BNX2X_TPA_STOP even if new skb allocation | 373 | pool entry status to BNX2X_TPA_STOP even if new skb allocation |
374 | fails. */ | 374 | fails. */ |
375 | dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(rx_buf, mapping), | 375 | dma_unmap_single(&bp->pdev->dev, dma_unmap_addr(rx_buf, mapping), |
376 | bp->rx_buf_size, DMA_FROM_DEVICE); | 376 | fp->rx_buf_size, DMA_FROM_DEVICE); |
377 | 377 | ||
378 | if (likely(new_skb)) { | 378 | if (likely(new_skb)) { |
379 | /* fix ip xsum and give it to the stack */ | 379 | /* fix ip xsum and give it to the stack */ |
@@ -385,10 +385,10 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
385 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); | 385 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); |
386 | 386 | ||
387 | #ifdef BNX2X_STOP_ON_ERROR | 387 | #ifdef BNX2X_STOP_ON_ERROR |
388 | if (pad + len > bp->rx_buf_size) { | 388 | if (pad + len > fp->rx_buf_size) { |
389 | BNX2X_ERR("skb_put is about to fail... " | 389 | BNX2X_ERR("skb_put is about to fail... " |
390 | "pad %d len %d rx_buf_size %d\n", | 390 | "pad %d len %d rx_buf_size %d\n", |
391 | pad, len, bp->rx_buf_size); | 391 | pad, len, fp->rx_buf_size); |
392 | bnx2x_panic(); | 392 | bnx2x_panic(); |
393 | return; | 393 | return; |
394 | } | 394 | } |
@@ -618,7 +618,7 @@ int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | |||
618 | if (likely(bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0)) { | 618 | if (likely(bnx2x_alloc_rx_skb(bp, fp, bd_prod) == 0)) { |
619 | dma_unmap_single(&bp->pdev->dev, | 619 | dma_unmap_single(&bp->pdev->dev, |
620 | dma_unmap_addr(rx_buf, mapping), | 620 | dma_unmap_addr(rx_buf, mapping), |
621 | bp->rx_buf_size, | 621 | fp->rx_buf_size, |
622 | DMA_FROM_DEVICE); | 622 | DMA_FROM_DEVICE); |
623 | skb_reserve(skb, pad); | 623 | skb_reserve(skb, pad); |
624 | skb_put(skb, len); | 624 | skb_put(skb, len); |
@@ -858,19 +858,16 @@ void bnx2x_init_rx_rings(struct bnx2x *bp) | |||
858 | u16 ring_prod; | 858 | u16 ring_prod; |
859 | int i, j; | 859 | int i, j; |
860 | 860 | ||
861 | bp->rx_buf_size = bp->dev->mtu + ETH_OVREHEAD + BNX2X_RX_ALIGN + | ||
862 | IP_HEADER_ALIGNMENT_PADDING; | ||
863 | |||
864 | DP(NETIF_MSG_IFUP, | ||
865 | "mtu %d rx_buf_size %d\n", bp->dev->mtu, bp->rx_buf_size); | ||
866 | |||
867 | for_each_rx_queue(bp, j) { | 861 | for_each_rx_queue(bp, j) { |
868 | struct bnx2x_fastpath *fp = &bp->fp[j]; | 862 | struct bnx2x_fastpath *fp = &bp->fp[j]; |
869 | 863 | ||
864 | DP(NETIF_MSG_IFUP, | ||
865 | "mtu %d rx_buf_size %d\n", bp->dev->mtu, fp->rx_buf_size); | ||
866 | |||
870 | if (!fp->disable_tpa) { | 867 | if (!fp->disable_tpa) { |
871 | for (i = 0; i < max_agg_queues; i++) { | 868 | for (i = 0; i < max_agg_queues; i++) { |
872 | fp->tpa_pool[i].skb = | 869 | fp->tpa_pool[i].skb = |
873 | netdev_alloc_skb(bp->dev, bp->rx_buf_size); | 870 | netdev_alloc_skb(bp->dev, fp->rx_buf_size); |
874 | if (!fp->tpa_pool[i].skb) { | 871 | if (!fp->tpa_pool[i].skb) { |
875 | BNX2X_ERR("Failed to allocate TPA " | 872 | BNX2X_ERR("Failed to allocate TPA " |
876 | "skb pool for queue[%d] - " | 873 | "skb pool for queue[%d] - " |
@@ -978,7 +975,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp) | |||
978 | 975 | ||
979 | dma_unmap_single(&bp->pdev->dev, | 976 | dma_unmap_single(&bp->pdev->dev, |
980 | dma_unmap_addr(rx_buf, mapping), | 977 | dma_unmap_addr(rx_buf, mapping), |
981 | bp->rx_buf_size, DMA_FROM_DEVICE); | 978 | fp->rx_buf_size, DMA_FROM_DEVICE); |
982 | 979 | ||
983 | rx_buf->skb = NULL; | 980 | rx_buf->skb = NULL; |
984 | dev_kfree_skb(skb); | 981 | dev_kfree_skb(skb); |
@@ -1303,6 +1300,31 @@ static inline int bnx2x_set_real_num_queues(struct bnx2x *bp) | |||
1303 | return rc; | 1300 | return rc; |
1304 | } | 1301 | } |
1305 | 1302 | ||
1303 | static inline void bnx2x_set_rx_buf_size(struct bnx2x *bp) | ||
1304 | { | ||
1305 | int i; | ||
1306 | |||
1307 | for_each_queue(bp, i) { | ||
1308 | struct bnx2x_fastpath *fp = &bp->fp[i]; | ||
1309 | |||
1310 | /* Always use a mini-jumbo MTU for the FCoE L2 ring */ | ||
1311 | if (IS_FCOE_IDX(i)) | ||
1312 | /* | ||
1313 | * Although there are no IP frames expected to arrive to | ||
1314 | * this ring we still want to add an | ||
1315 | * IP_HEADER_ALIGNMENT_PADDING to prevent a buffer | ||
1316 | * overrun attack. | ||
1317 | */ | ||
1318 | fp->rx_buf_size = | ||
1319 | BNX2X_FCOE_MINI_JUMBO_MTU + ETH_OVREHEAD + | ||
1320 | BNX2X_RX_ALIGN + IP_HEADER_ALIGNMENT_PADDING; | ||
1321 | else | ||
1322 | fp->rx_buf_size = | ||
1323 | bp->dev->mtu + ETH_OVREHEAD + BNX2X_RX_ALIGN + | ||
1324 | IP_HEADER_ALIGNMENT_PADDING; | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1306 | /* must be called with rtnl_lock */ | 1328 | /* must be called with rtnl_lock */ |
1307 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | 1329 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
1308 | { | 1330 | { |
@@ -1326,6 +1348,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1326 | /* must be called before memory allocation and HW init */ | 1348 | /* must be called before memory allocation and HW init */ |
1327 | bnx2x_ilt_set_info(bp); | 1349 | bnx2x_ilt_set_info(bp); |
1328 | 1350 | ||
1351 | /* Set the receive queues buffer size */ | ||
1352 | bnx2x_set_rx_buf_size(bp); | ||
1353 | |||
1329 | if (bnx2x_alloc_mem(bp)) | 1354 | if (bnx2x_alloc_mem(bp)) |
1330 | return -ENOMEM; | 1355 | return -ENOMEM; |
1331 | 1356 | ||
@@ -1481,6 +1506,15 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1481 | 1506 | ||
1482 | bnx2x_set_eth_mac(bp, 1); | 1507 | bnx2x_set_eth_mac(bp, 1); |
1483 | 1508 | ||
1509 | /* Clear MC configuration */ | ||
1510 | if (CHIP_IS_E1(bp)) | ||
1511 | bnx2x_invalidate_e1_mc_list(bp); | ||
1512 | else | ||
1513 | bnx2x_invalidate_e1h_mc_list(bp); | ||
1514 | |||
1515 | /* Clear UC lists configuration */ | ||
1516 | bnx2x_invalidate_uc_list(bp); | ||
1517 | |||
1484 | if (bp->pending_max) { | 1518 | if (bp->pending_max) { |
1485 | bnx2x_update_max_mf_config(bp, bp->pending_max); | 1519 | bnx2x_update_max_mf_config(bp, bp->pending_max); |
1486 | bp->pending_max = 0; | 1520 | bp->pending_max = 0; |
@@ -1489,25 +1523,23 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1489 | if (bp->port.pmf) | 1523 | if (bp->port.pmf) |
1490 | bnx2x_initial_phy_init(bp, load_mode); | 1524 | bnx2x_initial_phy_init(bp, load_mode); |
1491 | 1525 | ||
1526 | /* Initialize Rx filtering */ | ||
1527 | bnx2x_set_rx_mode(bp->dev); | ||
1528 | |||
1492 | /* Start fast path */ | 1529 | /* Start fast path */ |
1493 | switch (load_mode) { | 1530 | switch (load_mode) { |
1494 | case LOAD_NORMAL: | 1531 | case LOAD_NORMAL: |
1495 | /* Tx queue should be only reenabled */ | 1532 | /* Tx queue should be only reenabled */ |
1496 | netif_tx_wake_all_queues(bp->dev); | 1533 | netif_tx_wake_all_queues(bp->dev); |
1497 | /* Initialize the receive filter. */ | 1534 | /* Initialize the receive filter. */ |
1498 | bnx2x_set_rx_mode(bp->dev); | ||
1499 | break; | 1535 | break; |
1500 | 1536 | ||
1501 | case LOAD_OPEN: | 1537 | case LOAD_OPEN: |
1502 | netif_tx_start_all_queues(bp->dev); | 1538 | netif_tx_start_all_queues(bp->dev); |
1503 | smp_mb__after_clear_bit(); | 1539 | smp_mb__after_clear_bit(); |
1504 | /* Initialize the receive filter. */ | ||
1505 | bnx2x_set_rx_mode(bp->dev); | ||
1506 | break; | 1540 | break; |
1507 | 1541 | ||
1508 | case LOAD_DIAG: | 1542 | case LOAD_DIAG: |
1509 | /* Initialize the receive filter. */ | ||
1510 | bnx2x_set_rx_mode(bp->dev); | ||
1511 | bp->state = BNX2X_STATE_DIAG; | 1543 | bp->state = BNX2X_STATE_DIAG; |
1512 | break; | 1544 | break; |
1513 | 1545 | ||
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index 85ea7f26b51f..ef37b98d6146 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -831,11 +831,11 @@ static inline int bnx2x_alloc_rx_skb(struct bnx2x *bp, | |||
831 | struct eth_rx_bd *rx_bd = &fp->rx_desc_ring[index]; | 831 | struct eth_rx_bd *rx_bd = &fp->rx_desc_ring[index]; |
832 | dma_addr_t mapping; | 832 | dma_addr_t mapping; |
833 | 833 | ||
834 | skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size); | 834 | skb = netdev_alloc_skb(bp->dev, fp->rx_buf_size); |
835 | if (unlikely(skb == NULL)) | 835 | if (unlikely(skb == NULL)) |
836 | return -ENOMEM; | 836 | return -ENOMEM; |
837 | 837 | ||
838 | mapping = dma_map_single(&bp->pdev->dev, skb->data, bp->rx_buf_size, | 838 | mapping = dma_map_single(&bp->pdev->dev, skb->data, fp->rx_buf_size, |
839 | DMA_FROM_DEVICE); | 839 | DMA_FROM_DEVICE); |
840 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { | 840 | if (unlikely(dma_mapping_error(&bp->pdev->dev, mapping))) { |
841 | dev_kfree_skb(skb); | 841 | dev_kfree_skb(skb); |
@@ -901,7 +901,7 @@ static inline void bnx2x_free_tpa_pool(struct bnx2x *bp, | |||
901 | if (fp->tpa_state[i] == BNX2X_TPA_START) | 901 | if (fp->tpa_state[i] == BNX2X_TPA_START) |
902 | dma_unmap_single(&bp->pdev->dev, | 902 | dma_unmap_single(&bp->pdev->dev, |
903 | dma_unmap_addr(rx_buf, mapping), | 903 | dma_unmap_addr(rx_buf, mapping), |
904 | bp->rx_buf_size, DMA_FROM_DEVICE); | 904 | fp->rx_buf_size, DMA_FROM_DEVICE); |
905 | 905 | ||
906 | dev_kfree_skb(skb); | 906 | dev_kfree_skb(skb); |
907 | rx_buf->skb = NULL; | 907 | rx_buf->skb = NULL; |
diff --git a/drivers/net/bnx2x/bnx2x_dcb.c b/drivers/net/bnx2x/bnx2x_dcb.c index fb60021f81fb..9a24d79c71d9 100644 --- a/drivers/net/bnx2x/bnx2x_dcb.c +++ b/drivers/net/bnx2x/bnx2x_dcb.c | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <linux/netdevice.h> | 19 | #include <linux/netdevice.h> |
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #ifdef BCM_DCBNL | ||
23 | #include <linux/dcbnl.h> | ||
24 | #endif | ||
22 | 25 | ||
23 | #include "bnx2x.h" | 26 | #include "bnx2x.h" |
24 | #include "bnx2x_cmn.h" | 27 | #include "bnx2x_cmn.h" |
@@ -508,13 +511,75 @@ static int bnx2x_dcbx_read_shmem_neg_results(struct bnx2x *bp) | |||
508 | return 0; | 511 | return 0; |
509 | } | 512 | } |
510 | 513 | ||
514 | |||
515 | #ifdef BCM_DCBNL | ||
516 | static inline | ||
517 | u8 bnx2x_dcbx_dcbnl_app_up(struct dcbx_app_priority_entry *ent) | ||
518 | { | ||
519 | u8 pri; | ||
520 | |||
521 | /* Choose the highest priority */ | ||
522 | for (pri = MAX_PFC_PRIORITIES - 1; pri > 0; pri--) | ||
523 | if (ent->pri_bitmap & (1 << pri)) | ||
524 | break; | ||
525 | return pri; | ||
526 | } | ||
527 | |||
528 | static inline | ||
529 | u8 bnx2x_dcbx_dcbnl_app_idtype(struct dcbx_app_priority_entry *ent) | ||
530 | { | ||
531 | return ((ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) == | ||
532 | DCBX_APP_SF_PORT) ? DCB_APP_IDTYPE_PORTNUM : | ||
533 | DCB_APP_IDTYPE_ETHTYPE; | ||
534 | } | ||
535 | |||
536 | static inline | ||
537 | void bnx2x_dcbx_invalidate_local_apps(struct bnx2x *bp) | ||
538 | { | ||
539 | int i; | ||
540 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) | ||
541 | bp->dcbx_local_feat.app.app_pri_tbl[i].appBitfield &= | ||
542 | ~DCBX_APP_ENTRY_VALID; | ||
543 | } | ||
544 | |||
545 | int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall) | ||
546 | { | ||
547 | int i, err = 0; | ||
548 | |||
549 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL && err == 0; i++) { | ||
550 | struct dcbx_app_priority_entry *ent = | ||
551 | &bp->dcbx_local_feat.app.app_pri_tbl[i]; | ||
552 | |||
553 | if (ent->appBitfield & DCBX_APP_ENTRY_VALID) { | ||
554 | u8 up = bnx2x_dcbx_dcbnl_app_up(ent); | ||
555 | |||
556 | /* avoid invalid user-priority */ | ||
557 | if (up) { | ||
558 | struct dcb_app app; | ||
559 | app.selector = bnx2x_dcbx_dcbnl_app_idtype(ent); | ||
560 | app.protocol = ent->app_id; | ||
561 | app.priority = delall ? 0 : up; | ||
562 | err = dcb_setapp(bp->dev, &app); | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | return err; | ||
567 | } | ||
568 | #endif | ||
569 | |||
511 | void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) | 570 | void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) |
512 | { | 571 | { |
513 | switch (state) { | 572 | switch (state) { |
514 | case BNX2X_DCBX_STATE_NEG_RECEIVED: | 573 | case BNX2X_DCBX_STATE_NEG_RECEIVED: |
515 | { | 574 | { |
516 | DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n"); | 575 | DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_NEG_RECEIVED\n"); |
517 | 576 | #ifdef BCM_DCBNL | |
577 | /** | ||
578 | * Delete app tlvs from dcbnl before reading new | ||
579 | * negotiation results | ||
580 | */ | ||
581 | bnx2x_dcbnl_update_applist(bp, true); | ||
582 | #endif | ||
518 | /* Read neg results if dcbx is in the FW */ | 583 | /* Read neg results if dcbx is in the FW */ |
519 | if (bnx2x_dcbx_read_shmem_neg_results(bp)) | 584 | if (bnx2x_dcbx_read_shmem_neg_results(bp)) |
520 | return; | 585 | return; |
@@ -526,10 +591,24 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) | |||
526 | bp->dcbx_error); | 591 | bp->dcbx_error); |
527 | 592 | ||
528 | if (bp->state != BNX2X_STATE_OPENING_WAIT4_LOAD) { | 593 | if (bp->state != BNX2X_STATE_OPENING_WAIT4_LOAD) { |
594 | #ifdef BCM_DCBNL | ||
595 | /** | ||
596 | * Add new app tlvs to dcbnl | ||
597 | */ | ||
598 | bnx2x_dcbnl_update_applist(bp, false); | ||
599 | #endif | ||
529 | bnx2x_dcbx_stop_hw_tx(bp); | 600 | bnx2x_dcbx_stop_hw_tx(bp); |
530 | return; | 601 | return; |
531 | } | 602 | } |
532 | /* fall through */ | 603 | /* fall through */ |
604 | #ifdef BCM_DCBNL | ||
605 | /** | ||
606 | * Invalidate the local app tlvs if they are not added | ||
607 | * to the dcbnl app list to avoid deleting them from | ||
608 | * the list later on | ||
609 | */ | ||
610 | bnx2x_dcbx_invalidate_local_apps(bp); | ||
611 | #endif | ||
533 | } | 612 | } |
534 | case BNX2X_DCBX_STATE_TX_PAUSED: | 613 | case BNX2X_DCBX_STATE_TX_PAUSED: |
535 | DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_PAUSED\n"); | 614 | DP(NETIF_MSG_LINK, "BNX2X_DCBX_STATE_TX_PAUSED\n"); |
@@ -1505,8 +1584,7 @@ static void bnx2x_pfc_fw_struct_e2(struct bnx2x *bp) | |||
1505 | bnx2x_dcbx_print_cos_params(bp, pfc_fw_cfg); | 1584 | bnx2x_dcbx_print_cos_params(bp, pfc_fw_cfg); |
1506 | } | 1585 | } |
1507 | /* DCB netlink */ | 1586 | /* DCB netlink */ |
1508 | #ifdef BCM_DCB | 1587 | #ifdef BCM_DCBNL |
1509 | #include <linux/dcbnl.h> | ||
1510 | 1588 | ||
1511 | #define BNX2X_DCBX_CAPS (DCB_CAP_DCBX_LLD_MANAGED | \ | 1589 | #define BNX2X_DCBX_CAPS (DCB_CAP_DCBX_LLD_MANAGED | \ |
1512 | DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_STATIC) | 1590 | DCB_CAP_DCBX_VER_CEE | DCB_CAP_DCBX_STATIC) |
@@ -1816,32 +1894,6 @@ static void bnx2x_dcbnl_set_pfc_state(struct net_device *netdev, u8 state) | |||
1816 | bp->dcbx_config_params.admin_pfc_enable = (state ? 1 : 0); | 1894 | bp->dcbx_config_params.admin_pfc_enable = (state ? 1 : 0); |
1817 | } | 1895 | } |
1818 | 1896 | ||
1819 | static bool bnx2x_app_is_equal(struct dcbx_app_priority_entry *app_ent, | ||
1820 | u8 idtype, u16 idval) | ||
1821 | { | ||
1822 | if (!(app_ent->appBitfield & DCBX_APP_ENTRY_VALID)) | ||
1823 | return false; | ||
1824 | |||
1825 | switch (idtype) { | ||
1826 | case DCB_APP_IDTYPE_ETHTYPE: | ||
1827 | if ((app_ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) != | ||
1828 | DCBX_APP_SF_ETH_TYPE) | ||
1829 | return false; | ||
1830 | break; | ||
1831 | case DCB_APP_IDTYPE_PORTNUM: | ||
1832 | if ((app_ent->appBitfield & DCBX_APP_ENTRY_SF_MASK) != | ||
1833 | DCBX_APP_SF_PORT) | ||
1834 | return false; | ||
1835 | break; | ||
1836 | default: | ||
1837 | return false; | ||
1838 | } | ||
1839 | if (app_ent->app_id != idval) | ||
1840 | return false; | ||
1841 | |||
1842 | return true; | ||
1843 | } | ||
1844 | |||
1845 | static void bnx2x_admin_app_set_ent( | 1897 | static void bnx2x_admin_app_set_ent( |
1846 | struct bnx2x_admin_priority_app_table *app_ent, | 1898 | struct bnx2x_admin_priority_app_table *app_ent, |
1847 | u8 idtype, u16 idval, u8 up) | 1899 | u8 idtype, u16 idval, u8 up) |
@@ -1943,30 +1995,6 @@ static u8 bnx2x_dcbnl_set_app_up(struct net_device *netdev, u8 idtype, | |||
1943 | return bnx2x_set_admin_app_up(bp, idtype, idval, up); | 1995 | return bnx2x_set_admin_app_up(bp, idtype, idval, up); |
1944 | } | 1996 | } |
1945 | 1997 | ||
1946 | static u8 bnx2x_dcbnl_get_app_up(struct net_device *netdev, u8 idtype, | ||
1947 | u16 idval) | ||
1948 | { | ||
1949 | int i; | ||
1950 | u8 up = 0; | ||
1951 | |||
1952 | struct bnx2x *bp = netdev_priv(netdev); | ||
1953 | DP(NETIF_MSG_LINK, "app_type %d, app_id 0x%x\n", idtype, idval); | ||
1954 | |||
1955 | /* iterate over the app entries looking for idtype and idval */ | ||
1956 | for (i = 0; i < DCBX_MAX_APP_PROTOCOL; i++) | ||
1957 | if (bnx2x_app_is_equal(&bp->dcbx_local_feat.app.app_pri_tbl[i], | ||
1958 | idtype, idval)) | ||
1959 | break; | ||
1960 | |||
1961 | if (i < DCBX_MAX_APP_PROTOCOL) | ||
1962 | /* if found return up */ | ||
1963 | up = bp->dcbx_local_feat.app.app_pri_tbl[i].pri_bitmap; | ||
1964 | else | ||
1965 | DP(NETIF_MSG_LINK, "app not found\n"); | ||
1966 | |||
1967 | return up; | ||
1968 | } | ||
1969 | |||
1970 | static u8 bnx2x_dcbnl_get_dcbx(struct net_device *netdev) | 1998 | static u8 bnx2x_dcbnl_get_dcbx(struct net_device *netdev) |
1971 | { | 1999 | { |
1972 | struct bnx2x *bp = netdev_priv(netdev); | 2000 | struct bnx2x *bp = netdev_priv(netdev); |
@@ -2107,7 +2135,6 @@ const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = { | |||
2107 | .setnumtcs = bnx2x_dcbnl_set_numtcs, | 2135 | .setnumtcs = bnx2x_dcbnl_set_numtcs, |
2108 | .getpfcstate = bnx2x_dcbnl_get_pfc_state, | 2136 | .getpfcstate = bnx2x_dcbnl_get_pfc_state, |
2109 | .setpfcstate = bnx2x_dcbnl_set_pfc_state, | 2137 | .setpfcstate = bnx2x_dcbnl_set_pfc_state, |
2110 | .getapp = bnx2x_dcbnl_get_app_up, | ||
2111 | .setapp = bnx2x_dcbnl_set_app_up, | 2138 | .setapp = bnx2x_dcbnl_set_app_up, |
2112 | .getdcbx = bnx2x_dcbnl_get_dcbx, | 2139 | .getdcbx = bnx2x_dcbnl_get_dcbx, |
2113 | .setdcbx = bnx2x_dcbnl_set_dcbx, | 2140 | .setdcbx = bnx2x_dcbnl_set_dcbx, |
@@ -2115,4 +2142,4 @@ const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops = { | |||
2115 | .setfeatcfg = bnx2x_dcbnl_set_featcfg, | 2142 | .setfeatcfg = bnx2x_dcbnl_set_featcfg, |
2116 | }; | 2143 | }; |
2117 | 2144 | ||
2118 | #endif /* BCM_DCB */ | 2145 | #endif /* BCM_DCBNL */ |
diff --git a/drivers/net/bnx2x/bnx2x_dcb.h b/drivers/net/bnx2x/bnx2x_dcb.h index f650f98e4092..71b8eda43bd0 100644 --- a/drivers/net/bnx2x/bnx2x_dcb.h +++ b/drivers/net/bnx2x/bnx2x_dcb.h | |||
@@ -189,8 +189,9 @@ enum { | |||
189 | void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state); | 189 | void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state); |
190 | 190 | ||
191 | /* DCB netlink */ | 191 | /* DCB netlink */ |
192 | #ifdef BCM_DCB | 192 | #ifdef BCM_DCBNL |
193 | extern const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops; | 193 | extern const struct dcbnl_rtnl_ops bnx2x_dcbnl_ops; |
194 | #endif /* BCM_DCB */ | 194 | int bnx2x_dcbnl_update_applist(struct bnx2x *bp, bool delall); |
195 | #endif /* BCM_DCBNL */ | ||
195 | 196 | ||
196 | #endif /* BNX2X_DCB_H */ | 197 | #endif /* BNX2X_DCB_H */ |
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 7e92f9d0dcfd..f5050155c6b5 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -1617,7 +1617,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up) | |||
1617 | /* prepare the loopback packet */ | 1617 | /* prepare the loopback packet */ |
1618 | pkt_size = (((bp->dev->mtu < ETH_MAX_PACKET_SIZE) ? | 1618 | pkt_size = (((bp->dev->mtu < ETH_MAX_PACKET_SIZE) ? |
1619 | bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETH_HLEN); | 1619 | bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETH_HLEN); |
1620 | skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size); | 1620 | skb = netdev_alloc_skb(bp->dev, fp_rx->rx_buf_size); |
1621 | if (!skb) { | 1621 | if (!skb) { |
1622 | rc = -ENOMEM; | 1622 | rc = -ENOMEM; |
1623 | goto test_loopback_exit; | 1623 | goto test_loopback_exit; |
@@ -2131,6 +2131,59 @@ static int bnx2x_phys_id(struct net_device *dev, u32 data) | |||
2131 | return 0; | 2131 | return 0; |
2132 | } | 2132 | } |
2133 | 2133 | ||
2134 | static int bnx2x_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, | ||
2135 | void *rules __always_unused) | ||
2136 | { | ||
2137 | struct bnx2x *bp = netdev_priv(dev); | ||
2138 | |||
2139 | switch (info->cmd) { | ||
2140 | case ETHTOOL_GRXRINGS: | ||
2141 | info->data = BNX2X_NUM_ETH_QUEUES(bp); | ||
2142 | return 0; | ||
2143 | |||
2144 | default: | ||
2145 | return -EOPNOTSUPP; | ||
2146 | } | ||
2147 | } | ||
2148 | |||
2149 | static int bnx2x_get_rxfh_indir(struct net_device *dev, | ||
2150 | struct ethtool_rxfh_indir *indir) | ||
2151 | { | ||
2152 | struct bnx2x *bp = netdev_priv(dev); | ||
2153 | size_t copy_size = | ||
2154 | min_t(size_t, indir->size, TSTORM_INDIRECTION_TABLE_SIZE); | ||
2155 | |||
2156 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) | ||
2157 | return -EOPNOTSUPP; | ||
2158 | |||
2159 | indir->size = TSTORM_INDIRECTION_TABLE_SIZE; | ||
2160 | memcpy(indir->ring_index, bp->rx_indir_table, | ||
2161 | copy_size * sizeof(bp->rx_indir_table[0])); | ||
2162 | return 0; | ||
2163 | } | ||
2164 | |||
2165 | static int bnx2x_set_rxfh_indir(struct net_device *dev, | ||
2166 | const struct ethtool_rxfh_indir *indir) | ||
2167 | { | ||
2168 | struct bnx2x *bp = netdev_priv(dev); | ||
2169 | size_t i; | ||
2170 | |||
2171 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) | ||
2172 | return -EOPNOTSUPP; | ||
2173 | |||
2174 | /* Validate size and indices */ | ||
2175 | if (indir->size != TSTORM_INDIRECTION_TABLE_SIZE) | ||
2176 | return -EINVAL; | ||
2177 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | ||
2178 | if (indir->ring_index[i] >= BNX2X_NUM_ETH_QUEUES(bp)) | ||
2179 | return -EINVAL; | ||
2180 | |||
2181 | memcpy(bp->rx_indir_table, indir->ring_index, | ||
2182 | indir->size * sizeof(bp->rx_indir_table[0])); | ||
2183 | bnx2x_push_indir_table(bp); | ||
2184 | return 0; | ||
2185 | } | ||
2186 | |||
2134 | static const struct ethtool_ops bnx2x_ethtool_ops = { | 2187 | static const struct ethtool_ops bnx2x_ethtool_ops = { |
2135 | .get_settings = bnx2x_get_settings, | 2188 | .get_settings = bnx2x_get_settings, |
2136 | .set_settings = bnx2x_set_settings, | 2189 | .set_settings = bnx2x_set_settings, |
@@ -2167,6 +2220,9 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
2167 | .get_strings = bnx2x_get_strings, | 2220 | .get_strings = bnx2x_get_strings, |
2168 | .phys_id = bnx2x_phys_id, | 2221 | .phys_id = bnx2x_phys_id, |
2169 | .get_ethtool_stats = bnx2x_get_ethtool_stats, | 2222 | .get_ethtool_stats = bnx2x_get_ethtool_stats, |
2223 | .get_rxnfc = bnx2x_get_rxnfc, | ||
2224 | .get_rxfh_indir = bnx2x_get_rxfh_indir, | ||
2225 | .set_rxfh_indir = bnx2x_set_rxfh_indir, | ||
2170 | }; | 2226 | }; |
2171 | 2227 | ||
2172 | void bnx2x_set_ethtool_ops(struct net_device *netdev) | 2228 | void bnx2x_set_ethtool_ops(struct net_device *netdev) |
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h index 548f5631c0dc..be503cc0a50b 100644 --- a/drivers/net/bnx2x/bnx2x_hsi.h +++ b/drivers/net/bnx2x/bnx2x_hsi.h | |||
@@ -11,20 +11,27 @@ | |||
11 | 11 | ||
12 | #include "bnx2x_fw_defs.h" | 12 | #include "bnx2x_fw_defs.h" |
13 | 13 | ||
14 | #define FW_ENCODE_32BIT_PATTERN 0x1e1e1e1e | ||
15 | |||
14 | struct license_key { | 16 | struct license_key { |
15 | u32 reserved[6]; | 17 | u32 reserved[6]; |
16 | 18 | ||
17 | #if defined(__BIG_ENDIAN) | 19 | u32 max_iscsi_conn; |
18 | u16 max_iscsi_init_conn; | 20 | #define BNX2X_MAX_ISCSI_TRGT_CONN_MASK 0xFFFF |
19 | u16 max_iscsi_trgt_conn; | 21 | #define BNX2X_MAX_ISCSI_TRGT_CONN_SHIFT 0 |
20 | #elif defined(__LITTLE_ENDIAN) | 22 | #define BNX2X_MAX_ISCSI_INIT_CONN_MASK 0xFFFF0000 |
21 | u16 max_iscsi_trgt_conn; | 23 | #define BNX2X_MAX_ISCSI_INIT_CONN_SHIFT 16 |
22 | u16 max_iscsi_init_conn; | ||
23 | #endif | ||
24 | 24 | ||
25 | u32 reserved_a[6]; | 25 | u32 reserved_a; |
26 | }; | 26 | |
27 | u32 max_fcoe_conn; | ||
28 | #define BNX2X_MAX_FCOE_TRGT_CONN_MASK 0xFFFF | ||
29 | #define BNX2X_MAX_FCOE_TRGT_CONN_SHIFT 0 | ||
30 | #define BNX2X_MAX_FCOE_INIT_CONN_MASK 0xFFFF0000 | ||
31 | #define BNX2X_MAX_FCOE_INIT_CONN_SHIFT 16 | ||
27 | 32 | ||
33 | u32 reserved_b[4]; | ||
34 | }; | ||
28 | 35 | ||
29 | #define PORT_0 0 | 36 | #define PORT_0 0 |
30 | #define PORT_1 1 | 37 | #define PORT_1 1 |
@@ -237,8 +244,26 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ | |||
237 | #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT 16 | 244 | #define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT 16 |
238 | 245 | ||
239 | 246 | ||
240 | u32 Reserved0[16]; /* 0x158 */ | 247 | u32 Reserved0[3]; /* 0x158 */ |
241 | 248 | /* Controls the TX laser of the SFP+ module */ | |
249 | u32 sfp_ctrl; /* 0x164 */ | ||
250 | #define PORT_HW_CFG_TX_LASER_MASK 0x000000FF | ||
251 | #define PORT_HW_CFG_TX_LASER_SHIFT 0 | ||
252 | #define PORT_HW_CFG_TX_LASER_MDIO 0x00000000 | ||
253 | #define PORT_HW_CFG_TX_LASER_GPIO0 0x00000001 | ||
254 | #define PORT_HW_CFG_TX_LASER_GPIO1 0x00000002 | ||
255 | #define PORT_HW_CFG_TX_LASER_GPIO2 0x00000003 | ||
256 | #define PORT_HW_CFG_TX_LASER_GPIO3 0x00000004 | ||
257 | |||
258 | /* Controls the fault module LED of the SFP+ */ | ||
259 | #define PORT_HW_CFG_FAULT_MODULE_LED_MASK 0x0000FF00 | ||
260 | #define PORT_HW_CFG_FAULT_MODULE_LED_SHIFT 8 | ||
261 | #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO0 0x00000000 | ||
262 | #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO1 0x00000100 | ||
263 | #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO2 0x00000200 | ||
264 | #define PORT_HW_CFG_FAULT_MODULE_LED_GPIO3 0x00000300 | ||
265 | #define PORT_HW_CFG_FAULT_MODULE_LED_DISABLED 0x00000400 | ||
266 | u32 Reserved01[12]; /* 0x158 */ | ||
242 | /* for external PHY, or forced mode or during AN */ | 267 | /* for external PHY, or forced mode or during AN */ |
243 | u16 xgxs_config_rx[4]; /* 0x198 */ | 268 | u16 xgxs_config_rx[4]; /* 0x198 */ |
244 | 269 | ||
@@ -246,12 +271,78 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ | |||
246 | 271 | ||
247 | u32 Reserved1[56]; /* 0x1A8 */ | 272 | u32 Reserved1[56]; /* 0x1A8 */ |
248 | u32 default_cfg; /* 0x288 */ | 273 | u32 default_cfg; /* 0x288 */ |
274 | #define PORT_HW_CFG_GPIO0_CONFIG_MASK 0x00000003 | ||
275 | #define PORT_HW_CFG_GPIO0_CONFIG_SHIFT 0 | ||
276 | #define PORT_HW_CFG_GPIO0_CONFIG_NA 0x00000000 | ||
277 | #define PORT_HW_CFG_GPIO0_CONFIG_LOW 0x00000001 | ||
278 | #define PORT_HW_CFG_GPIO0_CONFIG_HIGH 0x00000002 | ||
279 | #define PORT_HW_CFG_GPIO0_CONFIG_INPUT 0x00000003 | ||
280 | |||
281 | #define PORT_HW_CFG_GPIO1_CONFIG_MASK 0x0000000C | ||
282 | #define PORT_HW_CFG_GPIO1_CONFIG_SHIFT 2 | ||
283 | #define PORT_HW_CFG_GPIO1_CONFIG_NA 0x00000000 | ||
284 | #define PORT_HW_CFG_GPIO1_CONFIG_LOW 0x00000004 | ||
285 | #define PORT_HW_CFG_GPIO1_CONFIG_HIGH 0x00000008 | ||
286 | #define PORT_HW_CFG_GPIO1_CONFIG_INPUT 0x0000000c | ||
287 | |||
288 | #define PORT_HW_CFG_GPIO2_CONFIG_MASK 0x00000030 | ||
289 | #define PORT_HW_CFG_GPIO2_CONFIG_SHIFT 4 | ||
290 | #define PORT_HW_CFG_GPIO2_CONFIG_NA 0x00000000 | ||
291 | #define PORT_HW_CFG_GPIO2_CONFIG_LOW 0x00000010 | ||
292 | #define PORT_HW_CFG_GPIO2_CONFIG_HIGH 0x00000020 | ||
293 | #define PORT_HW_CFG_GPIO2_CONFIG_INPUT 0x00000030 | ||
294 | |||
295 | #define PORT_HW_CFG_GPIO3_CONFIG_MASK 0x000000C0 | ||
296 | #define PORT_HW_CFG_GPIO3_CONFIG_SHIFT 6 | ||
297 | #define PORT_HW_CFG_GPIO3_CONFIG_NA 0x00000000 | ||
298 | #define PORT_HW_CFG_GPIO3_CONFIG_LOW 0x00000040 | ||
299 | #define PORT_HW_CFG_GPIO3_CONFIG_HIGH 0x00000080 | ||
300 | #define PORT_HW_CFG_GPIO3_CONFIG_INPUT 0x000000c0 | ||
301 | |||
302 | /* | ||
303 | * When KR link is required to be set to force which is not | ||
304 | * KR-compliant, this parameter determine what is the trigger for it. | ||
305 | * When GPIO is selected, low input will force the speed. Currently | ||
306 | * default speed is 1G. In the future, it may be widen to select the | ||
307 | * forced speed in with another parameter. Note when force-1G is | ||
308 | * enabled, it override option 56: Link Speed option. | ||
309 | */ | ||
310 | #define PORT_HW_CFG_FORCE_KR_ENABLER_MASK 0x00000F00 | ||
311 | #define PORT_HW_CFG_FORCE_KR_ENABLER_SHIFT 8 | ||
312 | #define PORT_HW_CFG_FORCE_KR_ENABLER_NOT_FORCED 0x00000000 | ||
313 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P0 0x00000100 | ||
314 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P0 0x00000200 | ||
315 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P0 0x00000300 | ||
316 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P0 0x00000400 | ||
317 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO0_P1 0x00000500 | ||
318 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO1_P1 0x00000600 | ||
319 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO2_P1 0x00000700 | ||
320 | #define PORT_HW_CFG_FORCE_KR_ENABLER_GPIO3_P1 0x00000800 | ||
321 | #define PORT_HW_CFG_FORCE_KR_ENABLER_FORCED 0x00000900 | ||
322 | /* Enable to determine with which GPIO to reset the external phy */ | ||
323 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_MASK 0x000F0000 | ||
324 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_SHIFT 16 | ||
325 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_PHY_TYPE 0x00000000 | ||
326 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0 0x00010000 | ||
327 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0 0x00020000 | ||
328 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0 0x00030000 | ||
329 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0 0x00040000 | ||
330 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1 0x00050000 | ||
331 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1 0x00060000 | ||
332 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1 0x00070000 | ||
333 | #define PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1 0x00080000 | ||
249 | /* Enable BAM on KR */ | 334 | /* Enable BAM on KR */ |
250 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000 | 335 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_MASK 0x00100000 |
251 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20 | 336 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_SHIFT 20 |
252 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000 | 337 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_DISABLED 0x00000000 |
253 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000 | 338 | #define PORT_HW_CFG_ENABLE_BAM_ON_KR_ENABLED 0x00100000 |
254 | 339 | ||
340 | /* Enable Common Mode Sense */ | ||
341 | #define PORT_HW_CFG_ENABLE_CMS_MASK 0x00200000 | ||
342 | #define PORT_HW_CFG_ENABLE_CMS_SHIFT 21 | ||
343 | #define PORT_HW_CFG_ENABLE_CMS_DISABLED 0x00000000 | ||
344 | #define PORT_HW_CFG_ENABLE_CMS_ENABLED 0x00200000 | ||
345 | |||
255 | u32 speed_capability_mask2; /* 0x28C */ | 346 | u32 speed_capability_mask2; /* 0x28C */ |
256 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF | 347 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_MASK 0x0000FFFF |
257 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0 | 348 | #define PORT_HW_CFG_SPEED_CAPABILITY2_D3_SHIFT 0 |
@@ -381,6 +472,7 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ | |||
381 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 0x00000900 | 472 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 0x00000900 |
382 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC 0x00000a00 | 473 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC 0x00000a00 |
383 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823 0x00000b00 | 474 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823 0x00000b00 |
475 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833 0x00000d00 | ||
384 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00 | 476 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE 0x0000fd00 |
385 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00 | 477 | #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN 0x0000ff00 |
386 | 478 | ||
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index dd1210fddfff..f2f367d4e74d 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright 2008-2009 Broadcom Corporation | 1 | /* Copyright 2008-2011 Broadcom Corporation |
2 | * | 2 | * |
3 | * Unless you and Broadcom execute a separate written software license | 3 | * Unless you and Broadcom execute a separate written software license |
4 | * agreement governing use of this software, this software is licensed to you | 4 | * agreement governing use of this software, this software is licensed to you |
@@ -28,12 +28,13 @@ | |||
28 | 28 | ||
29 | /********************************************************/ | 29 | /********************************************************/ |
30 | #define ETH_HLEN 14 | 30 | #define ETH_HLEN 14 |
31 | #define ETH_OVREHEAD (ETH_HLEN + 8 + 8)/* 16 for CRC + VLAN + LLC */ | 31 | /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */ |
32 | #define ETH_OVREHEAD (ETH_HLEN + 8 + 8) | ||
32 | #define ETH_MIN_PACKET_SIZE 60 | 33 | #define ETH_MIN_PACKET_SIZE 60 |
33 | #define ETH_MAX_PACKET_SIZE 1500 | 34 | #define ETH_MAX_PACKET_SIZE 1500 |
34 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 | 35 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 |
35 | #define MDIO_ACCESS_TIMEOUT 1000 | 36 | #define MDIO_ACCESS_TIMEOUT 1000 |
36 | #define BMAC_CONTROL_RX_ENABLE 2 | 37 | #define BMAC_CONTROL_RX_ENABLE 2 |
37 | 38 | ||
38 | /***********************************************************/ | 39 | /***********************************************************/ |
39 | /* Shortcut definitions */ | 40 | /* Shortcut definitions */ |
@@ -79,7 +80,7 @@ | |||
79 | 80 | ||
80 | #define AUTONEG_CL37 SHARED_HW_CFG_AN_ENABLE_CL37 | 81 | #define AUTONEG_CL37 SHARED_HW_CFG_AN_ENABLE_CL37 |
81 | #define AUTONEG_CL73 SHARED_HW_CFG_AN_ENABLE_CL73 | 82 | #define AUTONEG_CL73 SHARED_HW_CFG_AN_ENABLE_CL73 |
82 | #define AUTONEG_BAM SHARED_HW_CFG_AN_ENABLE_BAM | 83 | #define AUTONEG_BAM SHARED_HW_CFG_AN_ENABLE_BAM |
83 | #define AUTONEG_PARALLEL \ | 84 | #define AUTONEG_PARALLEL \ |
84 | SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION | 85 | SHARED_HW_CFG_AN_ENABLE_PARALLEL_DETECTION |
85 | #define AUTONEG_SGMII_FIBER_AUTODET \ | 86 | #define AUTONEG_SGMII_FIBER_AUTODET \ |
@@ -112,10 +113,10 @@ | |||
112 | #define GP_STATUS_10G_KX4 \ | 113 | #define GP_STATUS_10G_KX4 \ |
113 | MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_KX4 | 114 | MDIO_GP_STATUS_TOP_AN_STATUS1_ACTUAL_SPEED_10G_KX4 |
114 | 115 | ||
115 | #define LINK_10THD LINK_STATUS_SPEED_AND_DUPLEX_10THD | 116 | #define LINK_10THD LINK_STATUS_SPEED_AND_DUPLEX_10THD |
116 | #define LINK_10TFD LINK_STATUS_SPEED_AND_DUPLEX_10TFD | 117 | #define LINK_10TFD LINK_STATUS_SPEED_AND_DUPLEX_10TFD |
117 | #define LINK_100TXHD LINK_STATUS_SPEED_AND_DUPLEX_100TXHD | 118 | #define LINK_100TXHD LINK_STATUS_SPEED_AND_DUPLEX_100TXHD |
118 | #define LINK_100T4 LINK_STATUS_SPEED_AND_DUPLEX_100T4 | 119 | #define LINK_100T4 LINK_STATUS_SPEED_AND_DUPLEX_100T4 |
119 | #define LINK_100TXFD LINK_STATUS_SPEED_AND_DUPLEX_100TXFD | 120 | #define LINK_100TXFD LINK_STATUS_SPEED_AND_DUPLEX_100TXFD |
120 | #define LINK_1000THD LINK_STATUS_SPEED_AND_DUPLEX_1000THD | 121 | #define LINK_1000THD LINK_STATUS_SPEED_AND_DUPLEX_1000THD |
121 | #define LINK_1000TFD LINK_STATUS_SPEED_AND_DUPLEX_1000TFD | 122 | #define LINK_1000TFD LINK_STATUS_SPEED_AND_DUPLEX_1000TFD |
@@ -123,18 +124,18 @@ | |||
123 | #define LINK_2500THD LINK_STATUS_SPEED_AND_DUPLEX_2500THD | 124 | #define LINK_2500THD LINK_STATUS_SPEED_AND_DUPLEX_2500THD |
124 | #define LINK_2500TFD LINK_STATUS_SPEED_AND_DUPLEX_2500TFD | 125 | #define LINK_2500TFD LINK_STATUS_SPEED_AND_DUPLEX_2500TFD |
125 | #define LINK_2500XFD LINK_STATUS_SPEED_AND_DUPLEX_2500XFD | 126 | #define LINK_2500XFD LINK_STATUS_SPEED_AND_DUPLEX_2500XFD |
126 | #define LINK_10GTFD LINK_STATUS_SPEED_AND_DUPLEX_10GTFD | 127 | #define LINK_10GTFD LINK_STATUS_SPEED_AND_DUPLEX_10GTFD |
127 | #define LINK_10GXFD LINK_STATUS_SPEED_AND_DUPLEX_10GXFD | 128 | #define LINK_10GXFD LINK_STATUS_SPEED_AND_DUPLEX_10GXFD |
128 | #define LINK_12GTFD LINK_STATUS_SPEED_AND_DUPLEX_12GTFD | 129 | #define LINK_12GTFD LINK_STATUS_SPEED_AND_DUPLEX_12GTFD |
129 | #define LINK_12GXFD LINK_STATUS_SPEED_AND_DUPLEX_12GXFD | 130 | #define LINK_12GXFD LINK_STATUS_SPEED_AND_DUPLEX_12GXFD |
130 | #define LINK_12_5GTFD LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD | 131 | #define LINK_12_5GTFD LINK_STATUS_SPEED_AND_DUPLEX_12_5GTFD |
131 | #define LINK_12_5GXFD LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD | 132 | #define LINK_12_5GXFD LINK_STATUS_SPEED_AND_DUPLEX_12_5GXFD |
132 | #define LINK_13GTFD LINK_STATUS_SPEED_AND_DUPLEX_13GTFD | 133 | #define LINK_13GTFD LINK_STATUS_SPEED_AND_DUPLEX_13GTFD |
133 | #define LINK_13GXFD LINK_STATUS_SPEED_AND_DUPLEX_13GXFD | 134 | #define LINK_13GXFD LINK_STATUS_SPEED_AND_DUPLEX_13GXFD |
134 | #define LINK_15GTFD LINK_STATUS_SPEED_AND_DUPLEX_15GTFD | 135 | #define LINK_15GTFD LINK_STATUS_SPEED_AND_DUPLEX_15GTFD |
135 | #define LINK_15GXFD LINK_STATUS_SPEED_AND_DUPLEX_15GXFD | 136 | #define LINK_15GXFD LINK_STATUS_SPEED_AND_DUPLEX_15GXFD |
136 | #define LINK_16GTFD LINK_STATUS_SPEED_AND_DUPLEX_16GTFD | 137 | #define LINK_16GTFD LINK_STATUS_SPEED_AND_DUPLEX_16GTFD |
137 | #define LINK_16GXFD LINK_STATUS_SPEED_AND_DUPLEX_16GXFD | 138 | #define LINK_16GXFD LINK_STATUS_SPEED_AND_DUPLEX_16GXFD |
138 | 139 | ||
139 | #define PHY_XGXS_FLAG 0x1 | 140 | #define PHY_XGXS_FLAG 0x1 |
140 | #define PHY_SGMII_FLAG 0x2 | 141 | #define PHY_SGMII_FLAG 0x2 |
@@ -142,7 +143,7 @@ | |||
142 | 143 | ||
143 | /* */ | 144 | /* */ |
144 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 145 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
145 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 146 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
146 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 | 147 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 |
147 | 148 | ||
148 | 149 | ||
@@ -153,15 +154,15 @@ | |||
153 | 154 | ||
154 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 | 155 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 |
155 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 | 156 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 |
156 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE 0x8 | 157 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE 0x8 |
157 | 158 | ||
158 | #define SFP_EEPROM_OPTIONS_ADDR 0x40 | 159 | #define SFP_EEPROM_OPTIONS_ADDR 0x40 |
159 | #define SFP_EEPROM_OPTIONS_LINEAR_RX_OUT_MASK 0x1 | 160 | #define SFP_EEPROM_OPTIONS_LINEAR_RX_OUT_MASK 0x1 |
160 | #define SFP_EEPROM_OPTIONS_SIZE 2 | 161 | #define SFP_EEPROM_OPTIONS_SIZE 2 |
161 | 162 | ||
162 | #define EDC_MODE_LINEAR 0x0022 | 163 | #define EDC_MODE_LINEAR 0x0022 |
163 | #define EDC_MODE_LIMITING 0x0044 | 164 | #define EDC_MODE_LIMITING 0x0044 |
164 | #define EDC_MODE_PASSIVE_DAC 0x0055 | 165 | #define EDC_MODE_PASSIVE_DAC 0x0055 |
165 | 166 | ||
166 | 167 | ||
167 | #define ETS_BW_LIMIT_CREDIT_UPPER_BOUND (0x5000) | 168 | #define ETS_BW_LIMIT_CREDIT_UPPER_BOUND (0x5000) |
@@ -170,24 +171,18 @@ | |||
170 | /* INTERFACE */ | 171 | /* INTERFACE */ |
171 | /**********************************************************/ | 172 | /**********************************************************/ |
172 | 173 | ||
173 | #define CL45_WR_OVER_CL22(_bp, _phy, _bank, _addr, _val) \ | 174 | #define CL22_WR_OVER_CL45(_bp, _phy, _bank, _addr, _val) \ |
174 | bnx2x_cl45_write(_bp, _phy, \ | 175 | bnx2x_cl45_write(_bp, _phy, \ |
175 | (_phy)->def_md_devad, \ | 176 | (_phy)->def_md_devad, \ |
176 | (_bank + (_addr & 0xf)), \ | 177 | (_bank + (_addr & 0xf)), \ |
177 | _val) | 178 | _val) |
178 | 179 | ||
179 | #define CL45_RD_OVER_CL22(_bp, _phy, _bank, _addr, _val) \ | 180 | #define CL22_RD_OVER_CL45(_bp, _phy, _bank, _addr, _val) \ |
180 | bnx2x_cl45_read(_bp, _phy, \ | 181 | bnx2x_cl45_read(_bp, _phy, \ |
181 | (_phy)->def_md_devad, \ | 182 | (_phy)->def_md_devad, \ |
182 | (_bank + (_addr & 0xf)), \ | 183 | (_bank + (_addr & 0xf)), \ |
183 | _val) | 184 | _val) |
184 | 185 | ||
185 | static u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | ||
186 | u8 devad, u16 reg, u16 *ret_val); | ||
187 | |||
188 | static u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | ||
189 | u8 devad, u16 reg, u16 val); | ||
190 | |||
191 | static u32 bnx2x_bits_en(struct bnx2x *bp, u32 reg, u32 bits) | 186 | static u32 bnx2x_bits_en(struct bnx2x *bp, u32 reg, u32 bits) |
192 | { | 187 | { |
193 | u32 val = REG_RD(bp, reg); | 188 | u32 val = REG_RD(bp, reg); |
@@ -216,7 +211,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
216 | 211 | ||
217 | DP(NETIF_MSG_LINK, "ETS disabled configuration\n"); | 212 | DP(NETIF_MSG_LINK, "ETS disabled configuration\n"); |
218 | 213 | ||
219 | /** | 214 | /* |
220 | * mapping between entry priority to client number (0,1,2 -debug and | 215 | * mapping between entry priority to client number (0,1,2 -debug and |
221 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) | 216 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) |
222 | * 3bits client num. | 217 | * 3bits client num. |
@@ -225,7 +220,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
225 | */ | 220 | */ |
226 | 221 | ||
227 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, 0x4688); | 222 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, 0x4688); |
228 | /** | 223 | /* |
229 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 224 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
230 | * as strict. Bits 0,1,2 - debug and management entries, 3 - | 225 | * as strict. Bits 0,1,2 - debug and management entries, 3 - |
231 | * COS0 entry, 4 - COS1 entry. | 226 | * COS0 entry, 4 - COS1 entry. |
@@ -237,12 +232,12 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
237 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); | 232 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); |
238 | /* defines which entries (clients) are subjected to WFQ arbitration */ | 233 | /* defines which entries (clients) are subjected to WFQ arbitration */ |
239 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0); | 234 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0); |
240 | /** | 235 | /* |
241 | * For strict priority entries defines the number of consecutive | 236 | * For strict priority entries defines the number of consecutive |
242 | * slots for the highest priority. | 237 | * slots for the highest priority. |
243 | */ | 238 | */ |
244 | REG_WR(bp, NIG_REG_P0_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100); | 239 | REG_WR(bp, NIG_REG_P0_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100); |
245 | /** | 240 | /* |
246 | * mapping between the CREDIT_WEIGHT registers and actual client | 241 | * mapping between the CREDIT_WEIGHT registers and actual client |
247 | * numbers | 242 | * numbers |
248 | */ | 243 | */ |
@@ -255,7 +250,7 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
255 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, 0); | 250 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, 0); |
256 | /* ETS mode disable */ | 251 | /* ETS mode disable */ |
257 | REG_WR(bp, PBF_REG_ETS_ENABLED, 0); | 252 | REG_WR(bp, PBF_REG_ETS_ENABLED, 0); |
258 | /** | 253 | /* |
259 | * If ETS mode is enabled (there is no strict priority) defines a WFQ | 254 | * If ETS mode is enabled (there is no strict priority) defines a WFQ |
260 | * weight for COS0/COS1. | 255 | * weight for COS0/COS1. |
261 | */ | 256 | */ |
@@ -268,24 +263,24 @@ void bnx2x_ets_disabled(struct link_params *params) | |||
268 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); | 263 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); |
269 | } | 264 | } |
270 | 265 | ||
271 | void bnx2x_ets_bw_limit_common(const struct link_params *params) | 266 | static void bnx2x_ets_bw_limit_common(const struct link_params *params) |
272 | { | 267 | { |
273 | /* ETS disabled configuration */ | 268 | /* ETS disabled configuration */ |
274 | struct bnx2x *bp = params->bp; | 269 | struct bnx2x *bp = params->bp; |
275 | DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); | 270 | DP(NETIF_MSG_LINK, "ETS enabled BW limit configuration\n"); |
276 | /** | 271 | /* |
277 | * defines which entries (clients) are subjected to WFQ arbitration | 272 | * defines which entries (clients) are subjected to WFQ arbitration |
278 | * COS0 0x8 | 273 | * COS0 0x8 |
279 | * COS1 0x10 | 274 | * COS1 0x10 |
280 | */ | 275 | */ |
281 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0x18); | 276 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_SUBJECT2WFQ, 0x18); |
282 | /** | 277 | /* |
283 | * mapping between the ARB_CREDIT_WEIGHT registers and actual | 278 | * mapping between the ARB_CREDIT_WEIGHT registers and actual |
284 | * client numbers (WEIGHT_0 does not actually have to represent | 279 | * client numbers (WEIGHT_0 does not actually have to represent |
285 | * client 0) | 280 | * client 0) |
286 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 | 281 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 |
287 | * cos1-001 cos0-000 dbg1-100 dbg0-011 MCP-010 | 282 | * cos1-001 cos0-000 dbg1-100 dbg0-011 MCP-010 |
288 | */ | 283 | */ |
289 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP, 0x111A); | 284 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_CREDIT_MAP, 0x111A); |
290 | 285 | ||
291 | REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0, | 286 | REG_WR(bp, NIG_REG_P0_TX_ARB_CREDIT_UPPER_BOUND_0, |
@@ -298,14 +293,14 @@ void bnx2x_ets_bw_limit_common(const struct link_params *params) | |||
298 | 293 | ||
299 | /* Defines the number of consecutive slots for the strict priority */ | 294 | /* Defines the number of consecutive slots for the strict priority */ |
300 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); | 295 | REG_WR(bp, PBF_REG_NUM_STRICT_ARB_SLOTS, 0); |
301 | /** | 296 | /* |
302 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 297 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
303 | * as strict. Bits 0,1,2 - debug and management entries, 3 - COS0 | 298 | * as strict. Bits 0,1,2 - debug and management entries, 3 - COS0 |
304 | * entry, 4 - COS1 entry. | 299 | * entry, 4 - COS1 entry. |
305 | * COS1 | COS0 | DEBUG21 | DEBUG0 | MGMT | 300 | * COS1 | COS0 | DEBUG21 | DEBUG0 | MGMT |
306 | * bit4 bit3 bit2 bit1 bit0 | 301 | * bit4 bit3 bit2 bit1 bit0 |
307 | * MCP and debug are strict | 302 | * MCP and debug are strict |
308 | */ | 303 | */ |
309 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); | 304 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x7); |
310 | 305 | ||
311 | /* Upper bound that COS0_WEIGHT can reach in the WFQ arbiter.*/ | 306 | /* Upper bound that COS0_WEIGHT can reach in the WFQ arbiter.*/ |
@@ -329,8 +324,7 @@ void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw, | |||
329 | if ((0 == total_bw) || | 324 | if ((0 == total_bw) || |
330 | (0 == cos0_bw) || | 325 | (0 == cos0_bw) || |
331 | (0 == cos1_bw)) { | 326 | (0 == cos1_bw)) { |
332 | DP(NETIF_MSG_LINK, | 327 | DP(NETIF_MSG_LINK, "Total BW can't be zero\n"); |
333 | "bnx2x_ets_bw_limit: Total BW can't be zero\n"); | ||
334 | return; | 328 | return; |
335 | } | 329 | } |
336 | 330 | ||
@@ -355,7 +349,7 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
355 | u32 val = 0; | 349 | u32 val = 0; |
356 | 350 | ||
357 | DP(NETIF_MSG_LINK, "ETS enabled strict configuration\n"); | 351 | DP(NETIF_MSG_LINK, "ETS enabled strict configuration\n"); |
358 | /** | 352 | /* |
359 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves | 353 | * Bitmap of 5bits length. Each bit specifies whether the entry behaves |
360 | * as strict. Bits 0,1,2 - debug and management entries, | 354 | * as strict. Bits 0,1,2 - debug and management entries, |
361 | * 3 - COS0 entry, 4 - COS1 entry. | 355 | * 3 - COS0 entry, 4 - COS1 entry. |
@@ -364,7 +358,7 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
364 | * MCP and debug are strict | 358 | * MCP and debug are strict |
365 | */ | 359 | */ |
366 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x1F); | 360 | REG_WR(bp, NIG_REG_P0_TX_ARB_CLIENT_IS_STRICT, 0x1F); |
367 | /** | 361 | /* |
368 | * For strict priority entries defines the number of consecutive slots | 362 | * For strict priority entries defines the number of consecutive slots |
369 | * for the highest priority. | 363 | * for the highest priority. |
370 | */ | 364 | */ |
@@ -377,14 +371,14 @@ u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos) | |||
377 | /* Defines the number of consecutive slots for the strict priority */ | 371 | /* Defines the number of consecutive slots for the strict priority */ |
378 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, strict_cos); | 372 | REG_WR(bp, PBF_REG_HIGH_PRIORITY_COS_NUM, strict_cos); |
379 | 373 | ||
380 | /** | 374 | /* |
381 | * mapping between entry priority to client number (0,1,2 -debug and | 375 | * mapping between entry priority to client number (0,1,2 -debug and |
382 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) | 376 | * management clients, 3 - COS0 client, 4 - COS client)(HIGHEST) |
383 | * 3bits client num. | 377 | * 3bits client num. |
384 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 | 378 | * PRI4 | PRI3 | PRI2 | PRI1 | PRI0 |
385 | * dbg0-010 dbg1-001 cos1-100 cos0-011 MCP-000 | 379 | * dbg0-010 dbg1-001 cos1-100 cos0-011 MCP-000 |
386 | * dbg0-010 dbg1-001 cos0-011 cos1-100 MCP-000 | 380 | * dbg0-010 dbg1-001 cos0-011 cos1-100 MCP-000 |
387 | */ | 381 | */ |
388 | val = (0 == strict_cos) ? 0x2318 : 0x22E0; | 382 | val = (0 == strict_cos) ? 0x2318 : 0x22E0; |
389 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, val); | 383 | REG_WR(bp, NIG_REG_P0_TX_ARB_PRIORITY_CLIENT, val); |
390 | 384 | ||
@@ -471,7 +465,7 @@ void bnx2x_pfc_statistic(struct link_params *params, struct link_vars *vars, | |||
471 | /* MAC/PBF section */ | 465 | /* MAC/PBF section */ |
472 | /******************************************************************/ | 466 | /******************************************************************/ |
473 | static void bnx2x_emac_init(struct link_params *params, | 467 | static void bnx2x_emac_init(struct link_params *params, |
474 | struct link_vars *vars) | 468 | struct link_vars *vars) |
475 | { | 469 | { |
476 | /* reset and unreset the emac core */ | 470 | /* reset and unreset the emac core */ |
477 | struct bnx2x *bp = params->bp; | 471 | struct bnx2x *bp = params->bp; |
@@ -481,10 +475,10 @@ static void bnx2x_emac_init(struct link_params *params, | |||
481 | u16 timeout; | 475 | u16 timeout; |
482 | 476 | ||
483 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, | 477 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, |
484 | (MISC_REGISTERS_RESET_REG_2_RST_EMAC0_HARD_CORE << port)); | 478 | (MISC_REGISTERS_RESET_REG_2_RST_EMAC0_HARD_CORE << port)); |
485 | udelay(5); | 479 | udelay(5); |
486 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, | 480 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, |
487 | (MISC_REGISTERS_RESET_REG_2_RST_EMAC0_HARD_CORE << port)); | 481 | (MISC_REGISTERS_RESET_REG_2_RST_EMAC0_HARD_CORE << port)); |
488 | 482 | ||
489 | /* init emac - use read-modify-write */ | 483 | /* init emac - use read-modify-write */ |
490 | /* self clear reset */ | 484 | /* self clear reset */ |
@@ -515,7 +509,7 @@ static void bnx2x_emac_init(struct link_params *params, | |||
515 | } | 509 | } |
516 | 510 | ||
517 | static u8 bnx2x_emac_enable(struct link_params *params, | 511 | static u8 bnx2x_emac_enable(struct link_params *params, |
518 | struct link_vars *vars, u8 lb) | 512 | struct link_vars *vars, u8 lb) |
519 | { | 513 | { |
520 | struct bnx2x *bp = params->bp; | 514 | struct bnx2x *bp = params->bp; |
521 | u8 port = params->port; | 515 | u8 port = params->port; |
@@ -527,55 +521,33 @@ static u8 bnx2x_emac_enable(struct link_params *params, | |||
527 | /* enable emac and not bmac */ | 521 | /* enable emac and not bmac */ |
528 | REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + port*4, 1); | 522 | REG_WR(bp, NIG_REG_EGRESS_EMAC0_PORT + port*4, 1); |
529 | 523 | ||
530 | /* for paladium */ | ||
531 | if (CHIP_REV_IS_EMUL(bp)) { | ||
532 | /* Use lane 1 (of lanes 0-3) */ | ||
533 | REG_WR(bp, NIG_REG_XGXS_LANE_SEL_P0 + port*4, 1); | ||
534 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + | ||
535 | port*4, 1); | ||
536 | } | ||
537 | /* for fpga */ | ||
538 | else | ||
539 | |||
540 | if (CHIP_REV_IS_FPGA(bp)) { | ||
541 | /* Use lane 1 (of lanes 0-3) */ | ||
542 | DP(NETIF_MSG_LINK, "bnx2x_emac_enable: Setting FPGA\n"); | ||
543 | |||
544 | REG_WR(bp, NIG_REG_XGXS_LANE_SEL_P0 + port*4, 1); | ||
545 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, | ||
546 | 0); | ||
547 | } else | ||
548 | /* ASIC */ | 524 | /* ASIC */ |
549 | if (vars->phy_flags & PHY_XGXS_FLAG) { | 525 | if (vars->phy_flags & PHY_XGXS_FLAG) { |
550 | u32 ser_lane = ((params->lane_config & | 526 | u32 ser_lane = ((params->lane_config & |
551 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> | 527 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> |
552 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); | 528 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); |
553 | 529 | ||
554 | DP(NETIF_MSG_LINK, "XGXS\n"); | 530 | DP(NETIF_MSG_LINK, "XGXS\n"); |
555 | /* select the master lanes (out of 0-3) */ | 531 | /* select the master lanes (out of 0-3) */ |
556 | REG_WR(bp, NIG_REG_XGXS_LANE_SEL_P0 + | 532 | REG_WR(bp, NIG_REG_XGXS_LANE_SEL_P0 + port*4, ser_lane); |
557 | port*4, ser_lane); | ||
558 | /* select XGXS */ | 533 | /* select XGXS */ |
559 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + | 534 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, 1); |
560 | port*4, 1); | ||
561 | 535 | ||
562 | } else { /* SerDes */ | 536 | } else { /* SerDes */ |
563 | DP(NETIF_MSG_LINK, "SerDes\n"); | 537 | DP(NETIF_MSG_LINK, "SerDes\n"); |
564 | /* select SerDes */ | 538 | /* select SerDes */ |
565 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + | 539 | REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, 0); |
566 | port*4, 0); | ||
567 | } | 540 | } |
568 | 541 | ||
569 | bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_RX_MODE, | 542 | bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_RX_MODE, |
570 | EMAC_RX_MODE_RESET); | 543 | EMAC_RX_MODE_RESET); |
571 | bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_TX_MODE, | 544 | bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_TX_MODE, |
572 | EMAC_TX_MODE_RESET); | 545 | EMAC_TX_MODE_RESET); |
573 | 546 | ||
574 | if (CHIP_REV_IS_SLOW(bp)) { | 547 | if (CHIP_REV_IS_SLOW(bp)) { |
575 | /* config GMII mode */ | 548 | /* config GMII mode */ |
576 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MODE); | 549 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_MODE); |
577 | EMAC_WR(bp, EMAC_REG_EMAC_MODE, | 550 | EMAC_WR(bp, EMAC_REG_EMAC_MODE, (val | EMAC_MODE_PORT_GMII)); |
578 | (val | EMAC_MODE_PORT_GMII)); | ||
579 | } else { /* ASIC */ | 551 | } else { /* ASIC */ |
580 | /* pause enable/disable */ | 552 | /* pause enable/disable */ |
581 | bnx2x_bits_dis(bp, emac_base + EMAC_REG_EMAC_RX_MODE, | 553 | bnx2x_bits_dis(bp, emac_base + EMAC_REG_EMAC_RX_MODE, |
@@ -605,14 +577,14 @@ static u8 bnx2x_emac_enable(struct link_params *params, | |||
605 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_RX_MODE); | 577 | val = REG_RD(bp, emac_base + EMAC_REG_EMAC_RX_MODE); |
606 | val |= EMAC_RX_MODE_KEEP_VLAN_TAG | EMAC_RX_MODE_PROMISCUOUS; | 578 | val |= EMAC_RX_MODE_KEEP_VLAN_TAG | EMAC_RX_MODE_PROMISCUOUS; |
607 | 579 | ||
608 | /** | 580 | /* |
609 | * Setting this bit causes MAC control frames (except for pause | 581 | * Setting this bit causes MAC control frames (except for pause |
610 | * frames) to be passed on for processing. This setting has no | 582 | * frames) to be passed on for processing. This setting has no |
611 | * affect on the operation of the pause frames. This bit effects | 583 | * affect on the operation of the pause frames. This bit effects |
612 | * all packets regardless of RX Parser packet sorting logic. | 584 | * all packets regardless of RX Parser packet sorting logic. |
613 | * Turn the PFC off to make sure we are in Xon state before | 585 | * Turn the PFC off to make sure we are in Xon state before |
614 | * enabling it. | 586 | * enabling it. |
615 | */ | 587 | */ |
616 | EMAC_WR(bp, EMAC_REG_RX_PFC_MODE, 0); | 588 | EMAC_WR(bp, EMAC_REG_RX_PFC_MODE, 0); |
617 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { | 589 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) { |
618 | DP(NETIF_MSG_LINK, "PFC is enabled\n"); | 590 | DP(NETIF_MSG_LINK, "PFC is enabled\n"); |
@@ -666,16 +638,7 @@ static u8 bnx2x_emac_enable(struct link_params *params, | |||
666 | REG_WR(bp, NIG_REG_EMAC0_PAUSE_OUT_EN + port*4, val); | 638 | REG_WR(bp, NIG_REG_EMAC0_PAUSE_OUT_EN + port*4, val); |
667 | REG_WR(bp, NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0x1); | 639 | REG_WR(bp, NIG_REG_EGRESS_EMAC0_OUT_EN + port*4, 0x1); |
668 | 640 | ||
669 | if (CHIP_REV_IS_EMUL(bp)) { | 641 | REG_WR(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4, 0x0); |
670 | /* take the BigMac out of reset */ | ||
671 | REG_WR(bp, | ||
672 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, | ||
673 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | ||
674 | |||
675 | /* enable access for bmac registers */ | ||
676 | REG_WR(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4, 0x1); | ||
677 | } else | ||
678 | REG_WR(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4, 0x0); | ||
679 | 642 | ||
680 | vars->mac_type = MAC_TYPE_EMAC; | 643 | vars->mac_type = MAC_TYPE_EMAC; |
681 | return 0; | 644 | return 0; |
@@ -731,8 +694,7 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, | |||
731 | val |= (1<<5); | 694 | val |= (1<<5); |
732 | wb_data[0] = val; | 695 | wb_data[0] = val; |
733 | wb_data[1] = 0; | 696 | wb_data[1] = 0; |
734 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_CONTROL, | 697 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_CONTROL, wb_data, 2); |
735 | wb_data, 2); | ||
736 | udelay(30); | 698 | udelay(30); |
737 | 699 | ||
738 | /* Tx control */ | 700 | /* Tx control */ |
@@ -768,12 +730,12 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, | |||
768 | 730 | ||
769 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_PFC_CONTROL, wb_data, 2); | 731 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_PFC_CONTROL, wb_data, 2); |
770 | 732 | ||
771 | /** | 733 | /* |
772 | * Set Time (based unit is 512 bit time) between automatic | 734 | * Set Time (based unit is 512 bit time) between automatic |
773 | * re-sending of PP packets amd enable automatic re-send of | 735 | * re-sending of PP packets amd enable automatic re-send of |
774 | * Per-Priroity Packet as long as pp_gen is asserted and | 736 | * Per-Priroity Packet as long as pp_gen is asserted and |
775 | * pp_disable is low. | 737 | * pp_disable is low. |
776 | */ | 738 | */ |
777 | val = 0x8000; | 739 | val = 0x8000; |
778 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | 740 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) |
779 | val |= (1<<16); /* enable automatic re-send */ | 741 | val |= (1<<16); /* enable automatic re-send */ |
@@ -781,7 +743,7 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, | |||
781 | wb_data[0] = val; | 743 | wb_data[0] = val; |
782 | wb_data[1] = 0; | 744 | wb_data[1] = 0; |
783 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_PAUSE_CONTROL, | 745 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_PAUSE_CONTROL, |
784 | wb_data, 2); | 746 | wb_data, 2); |
785 | 747 | ||
786 | /* mac control */ | 748 | /* mac control */ |
787 | val = 0x3; /* Enable RX and TX */ | 749 | val = 0x3; /* Enable RX and TX */ |
@@ -795,8 +757,7 @@ static void bnx2x_update_pfc_bmac2(struct link_params *params, | |||
795 | 757 | ||
796 | wb_data[0] = val; | 758 | wb_data[0] = val; |
797 | wb_data[1] = 0; | 759 | wb_data[1] = 0; |
798 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, | 760 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, wb_data, 2); |
799 | wb_data, 2); | ||
800 | } | 761 | } |
801 | 762 | ||
802 | static void bnx2x_update_pfc_brb(struct link_params *params, | 763 | static void bnx2x_update_pfc_brb(struct link_params *params, |
@@ -825,17 +786,25 @@ static void bnx2x_update_pfc_brb(struct link_params *params, | |||
825 | full_xon_th = | 786 | full_xon_th = |
826 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; | 787 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; |
827 | } | 788 | } |
828 | /* The number of free blocks below which the pause signal to class 0 | 789 | /* |
829 | of MAC #n is asserted. n=0,1 */ | 790 | * The number of free blocks below which the pause signal to class 0 |
791 | * of MAC #n is asserted. n=0,1 | ||
792 | */ | ||
830 | REG_WR(bp, BRB1_REG_PAUSE_0_XOFF_THRESHOLD_0 , pause_xoff_th); | 793 | REG_WR(bp, BRB1_REG_PAUSE_0_XOFF_THRESHOLD_0 , pause_xoff_th); |
831 | /* The number of free blocks above which the pause signal to class 0 | 794 | /* |
832 | of MAC #n is de-asserted. n=0,1 */ | 795 | * The number of free blocks above which the pause signal to class 0 |
796 | * of MAC #n is de-asserted. n=0,1 | ||
797 | */ | ||
833 | REG_WR(bp, BRB1_REG_PAUSE_0_XON_THRESHOLD_0 , pause_xon_th); | 798 | REG_WR(bp, BRB1_REG_PAUSE_0_XON_THRESHOLD_0 , pause_xon_th); |
834 | /* The number of free blocks below which the full signal to class 0 | 799 | /* |
835 | of MAC #n is asserted. n=0,1 */ | 800 | * The number of free blocks below which the full signal to class 0 |
801 | * of MAC #n is asserted. n=0,1 | ||
802 | */ | ||
836 | REG_WR(bp, BRB1_REG_FULL_0_XOFF_THRESHOLD_0 , full_xoff_th); | 803 | REG_WR(bp, BRB1_REG_FULL_0_XOFF_THRESHOLD_0 , full_xoff_th); |
837 | /* The number of free blocks above which the full signal to class 0 | 804 | /* |
838 | of MAC #n is de-asserted. n=0,1 */ | 805 | * The number of free blocks above which the full signal to class 0 |
806 | * of MAC #n is de-asserted. n=0,1 | ||
807 | */ | ||
839 | REG_WR(bp, BRB1_REG_FULL_0_XON_THRESHOLD_0 , full_xon_th); | 808 | REG_WR(bp, BRB1_REG_FULL_0_XON_THRESHOLD_0 , full_xon_th); |
840 | 809 | ||
841 | if (set_pfc && pfc_params) { | 810 | if (set_pfc && pfc_params) { |
@@ -859,25 +828,25 @@ static void bnx2x_update_pfc_brb(struct link_params *params, | |||
859 | full_xon_th = | 828 | full_xon_th = |
860 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; | 829 | PFC_BRB_MAC_FULL_XON_THRESHOLD_NON_PAUSEABLE; |
861 | } | 830 | } |
862 | /** | 831 | /* |
863 | * The number of free blocks below which the pause signal to | 832 | * The number of free blocks below which the pause signal to |
864 | * class 1 of MAC #n is asserted. n=0,1 | 833 | * class 1 of MAC #n is asserted. n=0,1 |
865 | **/ | 834 | */ |
866 | REG_WR(bp, BRB1_REG_PAUSE_1_XOFF_THRESHOLD_0, pause_xoff_th); | 835 | REG_WR(bp, BRB1_REG_PAUSE_1_XOFF_THRESHOLD_0, pause_xoff_th); |
867 | /** | 836 | /* |
868 | * The number of free blocks above which the pause signal to | 837 | * The number of free blocks above which the pause signal to |
869 | * class 1 of MAC #n is de-asserted. n=0,1 | 838 | * class 1 of MAC #n is de-asserted. n=0,1 |
870 | **/ | 839 | */ |
871 | REG_WR(bp, BRB1_REG_PAUSE_1_XON_THRESHOLD_0, pause_xon_th); | 840 | REG_WR(bp, BRB1_REG_PAUSE_1_XON_THRESHOLD_0, pause_xon_th); |
872 | /** | 841 | /* |
873 | * The number of free blocks below which the full signal to | 842 | * The number of free blocks below which the full signal to |
874 | * class 1 of MAC #n is asserted. n=0,1 | 843 | * class 1 of MAC #n is asserted. n=0,1 |
875 | **/ | 844 | */ |
876 | REG_WR(bp, BRB1_REG_FULL_1_XOFF_THRESHOLD_0, full_xoff_th); | 845 | REG_WR(bp, BRB1_REG_FULL_1_XOFF_THRESHOLD_0, full_xoff_th); |
877 | /** | 846 | /* |
878 | * The number of free blocks above which the full signal to | 847 | * The number of free blocks above which the full signal to |
879 | * class 1 of MAC #n is de-asserted. n=0,1 | 848 | * class 1 of MAC #n is de-asserted. n=0,1 |
880 | **/ | 849 | */ |
881 | REG_WR(bp, BRB1_REG_FULL_1_XON_THRESHOLD_0, full_xon_th); | 850 | REG_WR(bp, BRB1_REG_FULL_1_XON_THRESHOLD_0, full_xon_th); |
882 | } | 851 | } |
883 | } | 852 | } |
@@ -896,7 +865,7 @@ static void bnx2x_update_pfc_nig(struct link_params *params, | |||
896 | FEATURE_CONFIG_PFC_ENABLED; | 865 | FEATURE_CONFIG_PFC_ENABLED; |
897 | DP(NETIF_MSG_LINK, "updating pfc nig parameters\n"); | 866 | DP(NETIF_MSG_LINK, "updating pfc nig parameters\n"); |
898 | 867 | ||
899 | /** | 868 | /* |
900 | * When NIG_LLH0_XCM_MASK_REG_LLHX_XCM_MASK_BCN bit is set | 869 | * When NIG_LLH0_XCM_MASK_REG_LLHX_XCM_MASK_BCN bit is set |
901 | * MAC control frames (that are not pause packets) | 870 | * MAC control frames (that are not pause packets) |
902 | * will be forwarded to the XCM. | 871 | * will be forwarded to the XCM. |
@@ -904,7 +873,7 @@ static void bnx2x_update_pfc_nig(struct link_params *params, | |||
904 | xcm_mask = REG_RD(bp, | 873 | xcm_mask = REG_RD(bp, |
905 | port ? NIG_REG_LLH1_XCM_MASK : | 874 | port ? NIG_REG_LLH1_XCM_MASK : |
906 | NIG_REG_LLH0_XCM_MASK); | 875 | NIG_REG_LLH0_XCM_MASK); |
907 | /** | 876 | /* |
908 | * nig params will override non PFC params, since it's possible to | 877 | * nig params will override non PFC params, since it's possible to |
909 | * do transition from PFC to SAFC | 878 | * do transition from PFC to SAFC |
910 | */ | 879 | */ |
@@ -994,7 +963,7 @@ void bnx2x_update_pfc(struct link_params *params, | |||
994 | struct link_vars *vars, | 963 | struct link_vars *vars, |
995 | struct bnx2x_nig_brb_pfc_port_params *pfc_params) | 964 | struct bnx2x_nig_brb_pfc_port_params *pfc_params) |
996 | { | 965 | { |
997 | /** | 966 | /* |
998 | * The PFC and pause are orthogonal to one another, meaning when | 967 | * The PFC and pause are orthogonal to one another, meaning when |
999 | * PFC is enabled, the pause are disabled, and when PFC is | 968 | * PFC is enabled, the pause are disabled, and when PFC is |
1000 | * disabled, pause are set according to the pause result. | 969 | * disabled, pause are set according to the pause result. |
@@ -1035,7 +1004,7 @@ void bnx2x_update_pfc(struct link_params *params, | |||
1035 | 1004 | ||
1036 | static u8 bnx2x_bmac1_enable(struct link_params *params, | 1005 | static u8 bnx2x_bmac1_enable(struct link_params *params, |
1037 | struct link_vars *vars, | 1006 | struct link_vars *vars, |
1038 | u8 is_lb) | 1007 | u8 is_lb) |
1039 | { | 1008 | { |
1040 | struct bnx2x *bp = params->bp; | 1009 | struct bnx2x *bp = params->bp; |
1041 | u8 port = params->port; | 1010 | u8 port = params->port; |
@@ -1049,9 +1018,8 @@ static u8 bnx2x_bmac1_enable(struct link_params *params, | |||
1049 | /* XGXS control */ | 1018 | /* XGXS control */ |
1050 | wb_data[0] = 0x3c; | 1019 | wb_data[0] = 0x3c; |
1051 | wb_data[1] = 0; | 1020 | wb_data[1] = 0; |
1052 | REG_WR_DMAE(bp, bmac_addr + | 1021 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_XGXS_CONTROL, |
1053 | BIGMAC_REGISTER_BMAC_XGXS_CONTROL, | 1022 | wb_data, 2); |
1054 | wb_data, 2); | ||
1055 | 1023 | ||
1056 | /* tx MAC SA */ | 1024 | /* tx MAC SA */ |
1057 | wb_data[0] = ((params->mac_addr[2] << 24) | | 1025 | wb_data[0] = ((params->mac_addr[2] << 24) | |
@@ -1060,8 +1028,7 @@ static u8 bnx2x_bmac1_enable(struct link_params *params, | |||
1060 | params->mac_addr[5]); | 1028 | params->mac_addr[5]); |
1061 | wb_data[1] = ((params->mac_addr[0] << 8) | | 1029 | wb_data[1] = ((params->mac_addr[0] << 8) | |
1062 | params->mac_addr[1]); | 1030 | params->mac_addr[1]); |
1063 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_TX_SOURCE_ADDR, | 1031 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_TX_SOURCE_ADDR, wb_data, 2); |
1064 | wb_data, 2); | ||
1065 | 1032 | ||
1066 | /* mac control */ | 1033 | /* mac control */ |
1067 | val = 0x3; | 1034 | val = 0x3; |
@@ -1071,43 +1038,30 @@ static u8 bnx2x_bmac1_enable(struct link_params *params, | |||
1071 | } | 1038 | } |
1072 | wb_data[0] = val; | 1039 | wb_data[0] = val; |
1073 | wb_data[1] = 0; | 1040 | wb_data[1] = 0; |
1074 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL, | 1041 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL, wb_data, 2); |
1075 | wb_data, 2); | ||
1076 | 1042 | ||
1077 | /* set rx mtu */ | 1043 | /* set rx mtu */ |
1078 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; | 1044 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; |
1079 | wb_data[1] = 0; | 1045 | wb_data[1] = 0; |
1080 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_MAX_SIZE, | 1046 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_MAX_SIZE, wb_data, 2); |
1081 | wb_data, 2); | ||
1082 | 1047 | ||
1083 | bnx2x_update_pfc_bmac1(params, vars); | 1048 | bnx2x_update_pfc_bmac1(params, vars); |
1084 | 1049 | ||
1085 | /* set tx mtu */ | 1050 | /* set tx mtu */ |
1086 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; | 1051 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; |
1087 | wb_data[1] = 0; | 1052 | wb_data[1] = 0; |
1088 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_TX_MAX_SIZE, | 1053 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_TX_MAX_SIZE, wb_data, 2); |
1089 | wb_data, 2); | ||
1090 | 1054 | ||
1091 | /* set cnt max size */ | 1055 | /* set cnt max size */ |
1092 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; | 1056 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; |
1093 | wb_data[1] = 0; | 1057 | wb_data[1] = 0; |
1094 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_CNT_MAX_SIZE, | 1058 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_CNT_MAX_SIZE, wb_data, 2); |
1095 | wb_data, 2); | ||
1096 | 1059 | ||
1097 | /* configure safc */ | 1060 | /* configure safc */ |
1098 | wb_data[0] = 0x1000200; | 1061 | wb_data[0] = 0x1000200; |
1099 | wb_data[1] = 0; | 1062 | wb_data[1] = 0; |
1100 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_LLFC_MSG_FLDS, | 1063 | REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_RX_LLFC_MSG_FLDS, |
1101 | wb_data, 2); | 1064 | wb_data, 2); |
1102 | /* fix for emulation */ | ||
1103 | if (CHIP_REV_IS_EMUL(bp)) { | ||
1104 | wb_data[0] = 0xf000; | ||
1105 | wb_data[1] = 0; | ||
1106 | REG_WR_DMAE(bp, | ||
1107 | bmac_addr + BIGMAC_REGISTER_TX_PAUSE_THRESHOLD, | ||
1108 | wb_data, 2); | ||
1109 | } | ||
1110 | |||
1111 | 1065 | ||
1112 | return 0; | 1066 | return 0; |
1113 | } | 1067 | } |
@@ -1126,16 +1080,14 @@ static u8 bnx2x_bmac2_enable(struct link_params *params, | |||
1126 | 1080 | ||
1127 | wb_data[0] = 0; | 1081 | wb_data[0] = 0; |
1128 | wb_data[1] = 0; | 1082 | wb_data[1] = 0; |
1129 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, | 1083 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_CONTROL, wb_data, 2); |
1130 | wb_data, 2); | ||
1131 | udelay(30); | 1084 | udelay(30); |
1132 | 1085 | ||
1133 | /* XGXS control: Reset phy HW, MDIO registers, PHY PLL and BMAC */ | 1086 | /* XGXS control: Reset phy HW, MDIO registers, PHY PLL and BMAC */ |
1134 | wb_data[0] = 0x3c; | 1087 | wb_data[0] = 0x3c; |
1135 | wb_data[1] = 0; | 1088 | wb_data[1] = 0; |
1136 | REG_WR_DMAE(bp, bmac_addr + | 1089 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_BMAC_XGXS_CONTROL, |
1137 | BIGMAC2_REGISTER_BMAC_XGXS_CONTROL, | 1090 | wb_data, 2); |
1138 | wb_data, 2); | ||
1139 | 1091 | ||
1140 | udelay(30); | 1092 | udelay(30); |
1141 | 1093 | ||
@@ -1147,7 +1099,7 @@ static u8 bnx2x_bmac2_enable(struct link_params *params, | |||
1147 | wb_data[1] = ((params->mac_addr[0] << 8) | | 1099 | wb_data[1] = ((params->mac_addr[0] << 8) | |
1148 | params->mac_addr[1]); | 1100 | params->mac_addr[1]); |
1149 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_SOURCE_ADDR, | 1101 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_SOURCE_ADDR, |
1150 | wb_data, 2); | 1102 | wb_data, 2); |
1151 | 1103 | ||
1152 | udelay(30); | 1104 | udelay(30); |
1153 | 1105 | ||
@@ -1155,27 +1107,24 @@ static u8 bnx2x_bmac2_enable(struct link_params *params, | |||
1155 | wb_data[0] = 0x1000200; | 1107 | wb_data[0] = 0x1000200; |
1156 | wb_data[1] = 0; | 1108 | wb_data[1] = 0; |
1157 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_LLFC_MSG_FLDS, | 1109 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_LLFC_MSG_FLDS, |
1158 | wb_data, 2); | 1110 | wb_data, 2); |
1159 | udelay(30); | 1111 | udelay(30); |
1160 | 1112 | ||
1161 | /* set rx mtu */ | 1113 | /* set rx mtu */ |
1162 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; | 1114 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; |
1163 | wb_data[1] = 0; | 1115 | wb_data[1] = 0; |
1164 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_MAX_SIZE, | 1116 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_RX_MAX_SIZE, wb_data, 2); |
1165 | wb_data, 2); | ||
1166 | udelay(30); | 1117 | udelay(30); |
1167 | 1118 | ||
1168 | /* set tx mtu */ | 1119 | /* set tx mtu */ |
1169 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; | 1120 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; |
1170 | wb_data[1] = 0; | 1121 | wb_data[1] = 0; |
1171 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_MAX_SIZE, | 1122 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_TX_MAX_SIZE, wb_data, 2); |
1172 | wb_data, 2); | ||
1173 | udelay(30); | 1123 | udelay(30); |
1174 | /* set cnt max size */ | 1124 | /* set cnt max size */ |
1175 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD - 2; | 1125 | wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD - 2; |
1176 | wb_data[1] = 0; | 1126 | wb_data[1] = 0; |
1177 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_CNT_MAX_SIZE, | 1127 | REG_WR_DMAE(bp, bmac_addr + BIGMAC2_REGISTER_CNT_MAX_SIZE, wb_data, 2); |
1178 | wb_data, 2); | ||
1179 | udelay(30); | 1128 | udelay(30); |
1180 | bnx2x_update_pfc_bmac2(params, vars, is_lb); | 1129 | bnx2x_update_pfc_bmac2(params, vars, is_lb); |
1181 | 1130 | ||
@@ -1191,11 +1140,11 @@ static u8 bnx2x_bmac_enable(struct link_params *params, | |||
1191 | u32 val; | 1140 | u32 val; |
1192 | /* reset and unreset the BigMac */ | 1141 | /* reset and unreset the BigMac */ |
1193 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, | 1142 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, |
1194 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | 1143 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); |
1195 | msleep(1); | 1144 | msleep(1); |
1196 | 1145 | ||
1197 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, | 1146 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_SET, |
1198 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | 1147 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); |
1199 | 1148 | ||
1200 | /* enable access for bmac registers */ | 1149 | /* enable access for bmac registers */ |
1201 | REG_WR(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4, 0x1); | 1150 | REG_WR(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4, 0x1); |
@@ -1230,15 +1179,14 @@ static void bnx2x_update_mng(struct link_params *params, u32 link_status) | |||
1230 | struct bnx2x *bp = params->bp; | 1179 | struct bnx2x *bp = params->bp; |
1231 | 1180 | ||
1232 | REG_WR(bp, params->shmem_base + | 1181 | REG_WR(bp, params->shmem_base + |
1233 | offsetof(struct shmem_region, | 1182 | offsetof(struct shmem_region, |
1234 | port_mb[params->port].link_status), | 1183 | port_mb[params->port].link_status), link_status); |
1235 | link_status); | ||
1236 | } | 1184 | } |
1237 | 1185 | ||
1238 | static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) | 1186 | static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) |
1239 | { | 1187 | { |
1240 | u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM : | 1188 | u32 bmac_addr = port ? NIG_REG_INGRESS_BMAC1_MEM : |
1241 | NIG_REG_INGRESS_BMAC0_MEM; | 1189 | NIG_REG_INGRESS_BMAC0_MEM; |
1242 | u32 wb_data[2]; | 1190 | u32 wb_data[2]; |
1243 | u32 nig_bmac_enable = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4); | 1191 | u32 nig_bmac_enable = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port*4); |
1244 | 1192 | ||
@@ -1250,12 +1198,12 @@ static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) | |||
1250 | if (CHIP_IS_E2(bp)) { | 1198 | if (CHIP_IS_E2(bp)) { |
1251 | /* Clear Rx Enable bit in BMAC_CONTROL register */ | 1199 | /* Clear Rx Enable bit in BMAC_CONTROL register */ |
1252 | REG_RD_DMAE(bp, bmac_addr + | 1200 | REG_RD_DMAE(bp, bmac_addr + |
1253 | BIGMAC2_REGISTER_BMAC_CONTROL, | 1201 | BIGMAC2_REGISTER_BMAC_CONTROL, |
1254 | wb_data, 2); | 1202 | wb_data, 2); |
1255 | wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; | 1203 | wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; |
1256 | REG_WR_DMAE(bp, bmac_addr + | 1204 | REG_WR_DMAE(bp, bmac_addr + |
1257 | BIGMAC2_REGISTER_BMAC_CONTROL, | 1205 | BIGMAC2_REGISTER_BMAC_CONTROL, |
1258 | wb_data, 2); | 1206 | wb_data, 2); |
1259 | } else { | 1207 | } else { |
1260 | /* Clear Rx Enable bit in BMAC_CONTROL register */ | 1208 | /* Clear Rx Enable bit in BMAC_CONTROL register */ |
1261 | REG_RD_DMAE(bp, bmac_addr + | 1209 | REG_RD_DMAE(bp, bmac_addr + |
@@ -1271,7 +1219,7 @@ static void bnx2x_bmac_rx_disable(struct bnx2x *bp, u8 port) | |||
1271 | } | 1219 | } |
1272 | 1220 | ||
1273 | static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, | 1221 | static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, |
1274 | u32 line_speed) | 1222 | u32 line_speed) |
1275 | { | 1223 | { |
1276 | struct bnx2x *bp = params->bp; | 1224 | struct bnx2x *bp = params->bp; |
1277 | u8 port = params->port; | 1225 | u8 port = params->port; |
@@ -1308,7 +1256,7 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, | |||
1308 | /* update threshold */ | 1256 | /* update threshold */ |
1309 | REG_WR(bp, PBF_REG_P0_ARB_THRSH + port*4, 0); | 1257 | REG_WR(bp, PBF_REG_P0_ARB_THRSH + port*4, 0); |
1310 | /* update init credit */ | 1258 | /* update init credit */ |
1311 | init_crd = 778; /* (800-18-4) */ | 1259 | init_crd = 778; /* (800-18-4) */ |
1312 | 1260 | ||
1313 | } else { | 1261 | } else { |
1314 | u32 thresh = (ETH_MAX_JUMBO_PACKET_SIZE + | 1262 | u32 thresh = (ETH_MAX_JUMBO_PACKET_SIZE + |
@@ -1353,6 +1301,23 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl, | |||
1353 | return 0; | 1301 | return 0; |
1354 | } | 1302 | } |
1355 | 1303 | ||
1304 | /* | ||
1305 | * get_emac_base | ||
1306 | * | ||
1307 | * @param cb | ||
1308 | * @param mdc_mdio_access | ||
1309 | * @param port | ||
1310 | * | ||
1311 | * @return u32 | ||
1312 | * | ||
1313 | * This function selects the MDC/MDIO access (through emac0 or | ||
1314 | * emac1) depend on the mdc_mdio_access, port, port swapped. Each | ||
1315 | * phy has a default access mode, which could also be overridden | ||
1316 | * by nvram configuration. This parameter, whether this is the | ||
1317 | * default phy configuration, or the nvram overrun | ||
1318 | * configuration, is passed here as mdc_mdio_access and selects | ||
1319 | * the emac_base for the CL45 read/writes operations | ||
1320 | */ | ||
1356 | static u32 bnx2x_get_emac_base(struct bnx2x *bp, | 1321 | static u32 bnx2x_get_emac_base(struct bnx2x *bp, |
1357 | u32 mdc_mdio_access, u8 port) | 1322 | u32 mdc_mdio_access, u8 port) |
1358 | { | 1323 | { |
@@ -1385,13 +1350,16 @@ static u32 bnx2x_get_emac_base(struct bnx2x *bp, | |||
1385 | 1350 | ||
1386 | } | 1351 | } |
1387 | 1352 | ||
1388 | u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | 1353 | /******************************************************************/ |
1389 | u8 devad, u16 reg, u16 val) | 1354 | /* CL45 access functions */ |
1355 | /******************************************************************/ | ||
1356 | static u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | ||
1357 | u8 devad, u16 reg, u16 val) | ||
1390 | { | 1358 | { |
1391 | u32 tmp, saved_mode; | 1359 | u32 tmp, saved_mode; |
1392 | u8 i, rc = 0; | 1360 | u8 i, rc = 0; |
1393 | 1361 | /* | |
1394 | /* set clause 45 mode, slow down the MDIO clock to 2.5MHz | 1362 | * Set clause 45 mode, slow down the MDIO clock to 2.5MHz |
1395 | * (a value of 49==0x31) and make sure that the AUTO poll is off | 1363 | * (a value of 49==0x31) and make sure that the AUTO poll is off |
1396 | */ | 1364 | */ |
1397 | 1365 | ||
@@ -1414,8 +1382,7 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1414 | for (i = 0; i < 50; i++) { | 1382 | for (i = 0; i < 50; i++) { |
1415 | udelay(10); | 1383 | udelay(10); |
1416 | 1384 | ||
1417 | tmp = REG_RD(bp, phy->mdio_ctrl + | 1385 | tmp = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_COMM); |
1418 | EMAC_REG_EMAC_MDIO_COMM); | ||
1419 | if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { | 1386 | if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { |
1420 | udelay(5); | 1387 | udelay(5); |
1421 | break; | 1388 | break; |
@@ -1423,6 +1390,7 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1423 | } | 1390 | } |
1424 | if (tmp & EMAC_MDIO_COMM_START_BUSY) { | 1391 | if (tmp & EMAC_MDIO_COMM_START_BUSY) { |
1425 | DP(NETIF_MSG_LINK, "write phy register failed\n"); | 1392 | DP(NETIF_MSG_LINK, "write phy register failed\n"); |
1393 | netdev_err(bp->dev, "MDC/MDIO access timeout\n"); | ||
1426 | rc = -EFAULT; | 1394 | rc = -EFAULT; |
1427 | } else { | 1395 | } else { |
1428 | /* data */ | 1396 | /* data */ |
@@ -1435,7 +1403,7 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1435 | udelay(10); | 1403 | udelay(10); |
1436 | 1404 | ||
1437 | tmp = REG_RD(bp, phy->mdio_ctrl + | 1405 | tmp = REG_RD(bp, phy->mdio_ctrl + |
1438 | EMAC_REG_EMAC_MDIO_COMM); | 1406 | EMAC_REG_EMAC_MDIO_COMM); |
1439 | if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { | 1407 | if (!(tmp & EMAC_MDIO_COMM_START_BUSY)) { |
1440 | udelay(5); | 1408 | udelay(5); |
1441 | break; | 1409 | break; |
@@ -1443,6 +1411,7 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1443 | } | 1411 | } |
1444 | if (tmp & EMAC_MDIO_COMM_START_BUSY) { | 1412 | if (tmp & EMAC_MDIO_COMM_START_BUSY) { |
1445 | DP(NETIF_MSG_LINK, "write phy register failed\n"); | 1413 | DP(NETIF_MSG_LINK, "write phy register failed\n"); |
1414 | netdev_err(bp->dev, "MDC/MDIO access timeout\n"); | ||
1446 | rc = -EFAULT; | 1415 | rc = -EFAULT; |
1447 | } | 1416 | } |
1448 | } | 1417 | } |
@@ -1453,20 +1422,20 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1453 | return rc; | 1422 | return rc; |
1454 | } | 1423 | } |
1455 | 1424 | ||
1456 | u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | 1425 | static u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, |
1457 | u8 devad, u16 reg, u16 *ret_val) | 1426 | u8 devad, u16 reg, u16 *ret_val) |
1458 | { | 1427 | { |
1459 | u32 val, saved_mode; | 1428 | u32 val, saved_mode; |
1460 | u16 i; | 1429 | u16 i; |
1461 | u8 rc = 0; | 1430 | u8 rc = 0; |
1462 | 1431 | /* | |
1463 | /* set clause 45 mode, slow down the MDIO clock to 2.5MHz | 1432 | * Set clause 45 mode, slow down the MDIO clock to 2.5MHz |
1464 | * (a value of 49==0x31) and make sure that the AUTO poll is off | 1433 | * (a value of 49==0x31) and make sure that the AUTO poll is off |
1465 | */ | 1434 | */ |
1466 | 1435 | ||
1467 | saved_mode = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); | 1436 | saved_mode = REG_RD(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); |
1468 | val = saved_mode & ~((EMAC_MDIO_MODE_AUTO_POLL | | 1437 | val = saved_mode & ~((EMAC_MDIO_MODE_AUTO_POLL | |
1469 | EMAC_MDIO_MODE_CLOCK_CNT)); | 1438 | EMAC_MDIO_MODE_CLOCK_CNT)); |
1470 | val |= (EMAC_MDIO_MODE_CLAUSE_45 | | 1439 | val |= (EMAC_MDIO_MODE_CLAUSE_45 | |
1471 | (49L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT)); | 1440 | (49L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT)); |
1472 | REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val); | 1441 | REG_WR(bp, phy->mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val); |
@@ -1490,7 +1459,7 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1490 | } | 1459 | } |
1491 | if (val & EMAC_MDIO_COMM_START_BUSY) { | 1460 | if (val & EMAC_MDIO_COMM_START_BUSY) { |
1492 | DP(NETIF_MSG_LINK, "read phy register failed\n"); | 1461 | DP(NETIF_MSG_LINK, "read phy register failed\n"); |
1493 | 1462 | netdev_err(bp->dev, "MDC/MDIO access timeout\n"); | |
1494 | *ret_val = 0; | 1463 | *ret_val = 0; |
1495 | rc = -EFAULT; | 1464 | rc = -EFAULT; |
1496 | 1465 | ||
@@ -1505,7 +1474,7 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1505 | udelay(10); | 1474 | udelay(10); |
1506 | 1475 | ||
1507 | val = REG_RD(bp, phy->mdio_ctrl + | 1476 | val = REG_RD(bp, phy->mdio_ctrl + |
1508 | EMAC_REG_EMAC_MDIO_COMM); | 1477 | EMAC_REG_EMAC_MDIO_COMM); |
1509 | if (!(val & EMAC_MDIO_COMM_START_BUSY)) { | 1478 | if (!(val & EMAC_MDIO_COMM_START_BUSY)) { |
1510 | *ret_val = (u16)(val & EMAC_MDIO_COMM_DATA); | 1479 | *ret_val = (u16)(val & EMAC_MDIO_COMM_DATA); |
1511 | break; | 1480 | break; |
@@ -1513,7 +1482,7 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, struct bnx2x_phy *phy, | |||
1513 | } | 1482 | } |
1514 | if (val & EMAC_MDIO_COMM_START_BUSY) { | 1483 | if (val & EMAC_MDIO_COMM_START_BUSY) { |
1515 | DP(NETIF_MSG_LINK, "read phy register failed\n"); | 1484 | DP(NETIF_MSG_LINK, "read phy register failed\n"); |
1516 | 1485 | netdev_err(bp->dev, "MDC/MDIO access timeout\n"); | |
1517 | *ret_val = 0; | 1486 | *ret_val = 0; |
1518 | rc = -EFAULT; | 1487 | rc = -EFAULT; |
1519 | } | 1488 | } |
@@ -1529,7 +1498,7 @@ u8 bnx2x_phy_read(struct link_params *params, u8 phy_addr, | |||
1529 | u8 devad, u16 reg, u16 *ret_val) | 1498 | u8 devad, u16 reg, u16 *ret_val) |
1530 | { | 1499 | { |
1531 | u8 phy_index; | 1500 | u8 phy_index; |
1532 | /** | 1501 | /* |
1533 | * Probe for the phy according to the given phy_addr, and execute | 1502 | * Probe for the phy according to the given phy_addr, and execute |
1534 | * the read request on it | 1503 | * the read request on it |
1535 | */ | 1504 | */ |
@@ -1547,7 +1516,7 @@ u8 bnx2x_phy_write(struct link_params *params, u8 phy_addr, | |||
1547 | u8 devad, u16 reg, u16 val) | 1516 | u8 devad, u16 reg, u16 val) |
1548 | { | 1517 | { |
1549 | u8 phy_index; | 1518 | u8 phy_index; |
1550 | /** | 1519 | /* |
1551 | * Probe for the phy according to the given phy_addr, and execute | 1520 | * Probe for the phy according to the given phy_addr, and execute |
1552 | * the write request on it | 1521 | * the write request on it |
1553 | */ | 1522 | */ |
@@ -1576,16 +1545,15 @@ static void bnx2x_set_aer_mmd_xgxs(struct link_params *params, | |||
1576 | aer_val = 0x3800 + offset - 1; | 1545 | aer_val = 0x3800 + offset - 1; |
1577 | else | 1546 | else |
1578 | aer_val = 0x3800 + offset; | 1547 | aer_val = 0x3800 + offset; |
1579 | CL45_WR_OVER_CL22(bp, phy, | 1548 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
1580 | MDIO_REG_BANK_AER_BLOCK, | 1549 | MDIO_AER_BLOCK_AER_REG, aer_val); |
1581 | MDIO_AER_BLOCK_AER_REG, aer_val); | ||
1582 | } | 1550 | } |
1583 | static void bnx2x_set_aer_mmd_serdes(struct bnx2x *bp, | 1551 | static void bnx2x_set_aer_mmd_serdes(struct bnx2x *bp, |
1584 | struct bnx2x_phy *phy) | 1552 | struct bnx2x_phy *phy) |
1585 | { | 1553 | { |
1586 | CL45_WR_OVER_CL22(bp, phy, | 1554 | CL22_WR_OVER_CL45(bp, phy, |
1587 | MDIO_REG_BANK_AER_BLOCK, | 1555 | MDIO_REG_BANK_AER_BLOCK, |
1588 | MDIO_AER_BLOCK_AER_REG, 0x3800); | 1556 | MDIO_AER_BLOCK_AER_REG, 0x3800); |
1589 | } | 1557 | } |
1590 | 1558 | ||
1591 | /******************************************************************/ | 1559 | /******************************************************************/ |
@@ -1621,9 +1589,8 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port) | |||
1621 | 1589 | ||
1622 | bnx2x_set_serdes_access(bp, port); | 1590 | bnx2x_set_serdes_access(bp, port); |
1623 | 1591 | ||
1624 | REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_DEVAD + | 1592 | REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_DEVAD + port*0x10, |
1625 | port*0x10, | 1593 | DEFAULT_PHY_DEV_ADDR); |
1626 | DEFAULT_PHY_DEV_ADDR); | ||
1627 | } | 1594 | } |
1628 | 1595 | ||
1629 | static void bnx2x_xgxs_deassert(struct link_params *params) | 1596 | static void bnx2x_xgxs_deassert(struct link_params *params) |
@@ -1641,23 +1608,22 @@ static void bnx2x_xgxs_deassert(struct link_params *params) | |||
1641 | udelay(500); | 1608 | udelay(500); |
1642 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); | 1609 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); |
1643 | 1610 | ||
1644 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + | 1611 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0); |
1645 | port*0x18, 0); | ||
1646 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, | 1612 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, |
1647 | params->phy[INT_PHY].def_md_devad); | 1613 | params->phy[INT_PHY].def_md_devad); |
1648 | } | 1614 | } |
1649 | 1615 | ||
1650 | 1616 | ||
1651 | void bnx2x_link_status_update(struct link_params *params, | 1617 | void bnx2x_link_status_update(struct link_params *params, |
1652 | struct link_vars *vars) | 1618 | struct link_vars *vars) |
1653 | { | 1619 | { |
1654 | struct bnx2x *bp = params->bp; | 1620 | struct bnx2x *bp = params->bp; |
1655 | u8 link_10g; | 1621 | u8 link_10g; |
1656 | u8 port = params->port; | 1622 | u8 port = params->port; |
1657 | 1623 | ||
1658 | vars->link_status = REG_RD(bp, params->shmem_base + | 1624 | vars->link_status = REG_RD(bp, params->shmem_base + |
1659 | offsetof(struct shmem_region, | 1625 | offsetof(struct shmem_region, |
1660 | port_mb[port].link_status)); | 1626 | port_mb[port].link_status)); |
1661 | 1627 | ||
1662 | vars->link_up = (vars->link_status & LINK_STATUS_LINK_UP); | 1628 | vars->link_up = (vars->link_status & LINK_STATUS_LINK_UP); |
1663 | 1629 | ||
@@ -1667,7 +1633,7 @@ void bnx2x_link_status_update(struct link_params *params, | |||
1667 | vars->phy_link_up = 1; | 1633 | vars->phy_link_up = 1; |
1668 | vars->duplex = DUPLEX_FULL; | 1634 | vars->duplex = DUPLEX_FULL; |
1669 | switch (vars->link_status & | 1635 | switch (vars->link_status & |
1670 | LINK_STATUS_SPEED_AND_DUPLEX_MASK) { | 1636 | LINK_STATUS_SPEED_AND_DUPLEX_MASK) { |
1671 | case LINK_10THD: | 1637 | case LINK_10THD: |
1672 | vars->duplex = DUPLEX_HALF; | 1638 | vars->duplex = DUPLEX_HALF; |
1673 | /* fall thru */ | 1639 | /* fall thru */ |
@@ -1779,20 +1745,20 @@ static void bnx2x_set_master_ln(struct link_params *params, | |||
1779 | { | 1745 | { |
1780 | struct bnx2x *bp = params->bp; | 1746 | struct bnx2x *bp = params->bp; |
1781 | u16 new_master_ln, ser_lane; | 1747 | u16 new_master_ln, ser_lane; |
1782 | ser_lane = ((params->lane_config & | 1748 | ser_lane = ((params->lane_config & |
1783 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> | 1749 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> |
1784 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); | 1750 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); |
1785 | 1751 | ||
1786 | /* set the master_ln for AN */ | 1752 | /* set the master_ln for AN */ |
1787 | CL45_RD_OVER_CL22(bp, phy, | 1753 | CL22_RD_OVER_CL45(bp, phy, |
1788 | MDIO_REG_BANK_XGXS_BLOCK2, | 1754 | MDIO_REG_BANK_XGXS_BLOCK2, |
1789 | MDIO_XGXS_BLOCK2_TEST_MODE_LANE, | 1755 | MDIO_XGXS_BLOCK2_TEST_MODE_LANE, |
1790 | &new_master_ln); | 1756 | &new_master_ln); |
1791 | 1757 | ||
1792 | CL45_WR_OVER_CL22(bp, phy, | 1758 | CL22_WR_OVER_CL45(bp, phy, |
1793 | MDIO_REG_BANK_XGXS_BLOCK2 , | 1759 | MDIO_REG_BANK_XGXS_BLOCK2 , |
1794 | MDIO_XGXS_BLOCK2_TEST_MODE_LANE, | 1760 | MDIO_XGXS_BLOCK2_TEST_MODE_LANE, |
1795 | (new_master_ln | ser_lane)); | 1761 | (new_master_ln | ser_lane)); |
1796 | } | 1762 | } |
1797 | 1763 | ||
1798 | static u8 bnx2x_reset_unicore(struct link_params *params, | 1764 | static u8 bnx2x_reset_unicore(struct link_params *params, |
@@ -1802,17 +1768,16 @@ static u8 bnx2x_reset_unicore(struct link_params *params, | |||
1802 | struct bnx2x *bp = params->bp; | 1768 | struct bnx2x *bp = params->bp; |
1803 | u16 mii_control; | 1769 | u16 mii_control; |
1804 | u16 i; | 1770 | u16 i; |
1805 | 1771 | CL22_RD_OVER_CL45(bp, phy, | |
1806 | CL45_RD_OVER_CL22(bp, phy, | 1772 | MDIO_REG_BANK_COMBO_IEEE0, |
1807 | MDIO_REG_BANK_COMBO_IEEE0, | 1773 | MDIO_COMBO_IEEE0_MII_CONTROL, &mii_control); |
1808 | MDIO_COMBO_IEEE0_MII_CONTROL, &mii_control); | ||
1809 | 1774 | ||
1810 | /* reset the unicore */ | 1775 | /* reset the unicore */ |
1811 | CL45_WR_OVER_CL22(bp, phy, | 1776 | CL22_WR_OVER_CL45(bp, phy, |
1812 | MDIO_REG_BANK_COMBO_IEEE0, | 1777 | MDIO_REG_BANK_COMBO_IEEE0, |
1813 | MDIO_COMBO_IEEE0_MII_CONTROL, | 1778 | MDIO_COMBO_IEEE0_MII_CONTROL, |
1814 | (mii_control | | 1779 | (mii_control | |
1815 | MDIO_COMBO_IEEO_MII_CONTROL_RESET)); | 1780 | MDIO_COMBO_IEEO_MII_CONTROL_RESET)); |
1816 | if (set_serdes) | 1781 | if (set_serdes) |
1817 | bnx2x_set_serdes_access(bp, params->port); | 1782 | bnx2x_set_serdes_access(bp, params->port); |
1818 | 1783 | ||
@@ -1821,10 +1786,10 @@ static u8 bnx2x_reset_unicore(struct link_params *params, | |||
1821 | udelay(5); | 1786 | udelay(5); |
1822 | 1787 | ||
1823 | /* the reset erased the previous bank value */ | 1788 | /* the reset erased the previous bank value */ |
1824 | CL45_RD_OVER_CL22(bp, phy, | 1789 | CL22_RD_OVER_CL45(bp, phy, |
1825 | MDIO_REG_BANK_COMBO_IEEE0, | 1790 | MDIO_REG_BANK_COMBO_IEEE0, |
1826 | MDIO_COMBO_IEEE0_MII_CONTROL, | 1791 | MDIO_COMBO_IEEE0_MII_CONTROL, |
1827 | &mii_control); | 1792 | &mii_control); |
1828 | 1793 | ||
1829 | if (!(mii_control & MDIO_COMBO_IEEO_MII_CONTROL_RESET)) { | 1794 | if (!(mii_control & MDIO_COMBO_IEEO_MII_CONTROL_RESET)) { |
1830 | udelay(5); | 1795 | udelay(5); |
@@ -1832,6 +1797,9 @@ static u8 bnx2x_reset_unicore(struct link_params *params, | |||
1832 | } | 1797 | } |
1833 | } | 1798 | } |
1834 | 1799 | ||
1800 | netdev_err(bp->dev, "Warning: PHY was not initialized," | ||
1801 | " Port %d\n", | ||
1802 | params->port); | ||
1835 | DP(NETIF_MSG_LINK, "BUG! XGXS is still in reset!\n"); | 1803 | DP(NETIF_MSG_LINK, "BUG! XGXS is still in reset!\n"); |
1836 | return -EINVAL; | 1804 | return -EINVAL; |
1837 | 1805 | ||
@@ -1841,43 +1809,45 @@ static void bnx2x_set_swap_lanes(struct link_params *params, | |||
1841 | struct bnx2x_phy *phy) | 1809 | struct bnx2x_phy *phy) |
1842 | { | 1810 | { |
1843 | struct bnx2x *bp = params->bp; | 1811 | struct bnx2x *bp = params->bp; |
1844 | /* Each two bits represents a lane number: | 1812 | /* |
1845 | No swap is 0123 => 0x1b no need to enable the swap */ | 1813 | * Each two bits represents a lane number: |
1814 | * No swap is 0123 => 0x1b no need to enable the swap | ||
1815 | */ | ||
1846 | u16 ser_lane, rx_lane_swap, tx_lane_swap; | 1816 | u16 ser_lane, rx_lane_swap, tx_lane_swap; |
1847 | 1817 | ||
1848 | ser_lane = ((params->lane_config & | 1818 | ser_lane = ((params->lane_config & |
1849 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> | 1819 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> |
1850 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); | 1820 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_SHIFT); |
1851 | rx_lane_swap = ((params->lane_config & | 1821 | rx_lane_swap = ((params->lane_config & |
1852 | PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK) >> | 1822 | PORT_HW_CFG_LANE_SWAP_CFG_RX_MASK) >> |
1853 | PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT); | 1823 | PORT_HW_CFG_LANE_SWAP_CFG_RX_SHIFT); |
1854 | tx_lane_swap = ((params->lane_config & | 1824 | tx_lane_swap = ((params->lane_config & |
1855 | PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK) >> | 1825 | PORT_HW_CFG_LANE_SWAP_CFG_TX_MASK) >> |
1856 | PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT); | 1826 | PORT_HW_CFG_LANE_SWAP_CFG_TX_SHIFT); |
1857 | 1827 | ||
1858 | if (rx_lane_swap != 0x1b) { | 1828 | if (rx_lane_swap != 0x1b) { |
1859 | CL45_WR_OVER_CL22(bp, phy, | 1829 | CL22_WR_OVER_CL45(bp, phy, |
1860 | MDIO_REG_BANK_XGXS_BLOCK2, | 1830 | MDIO_REG_BANK_XGXS_BLOCK2, |
1861 | MDIO_XGXS_BLOCK2_RX_LN_SWAP, | 1831 | MDIO_XGXS_BLOCK2_RX_LN_SWAP, |
1862 | (rx_lane_swap | | 1832 | (rx_lane_swap | |
1863 | MDIO_XGXS_BLOCK2_RX_LN_SWAP_ENABLE | | 1833 | MDIO_XGXS_BLOCK2_RX_LN_SWAP_ENABLE | |
1864 | MDIO_XGXS_BLOCK2_RX_LN_SWAP_FORCE_ENABLE)); | 1834 | MDIO_XGXS_BLOCK2_RX_LN_SWAP_FORCE_ENABLE)); |
1865 | } else { | 1835 | } else { |
1866 | CL45_WR_OVER_CL22(bp, phy, | 1836 | CL22_WR_OVER_CL45(bp, phy, |
1867 | MDIO_REG_BANK_XGXS_BLOCK2, | 1837 | MDIO_REG_BANK_XGXS_BLOCK2, |
1868 | MDIO_XGXS_BLOCK2_RX_LN_SWAP, 0); | 1838 | MDIO_XGXS_BLOCK2_RX_LN_SWAP, 0); |
1869 | } | 1839 | } |
1870 | 1840 | ||
1871 | if (tx_lane_swap != 0x1b) { | 1841 | if (tx_lane_swap != 0x1b) { |
1872 | CL45_WR_OVER_CL22(bp, phy, | 1842 | CL22_WR_OVER_CL45(bp, phy, |
1873 | MDIO_REG_BANK_XGXS_BLOCK2, | 1843 | MDIO_REG_BANK_XGXS_BLOCK2, |
1874 | MDIO_XGXS_BLOCK2_TX_LN_SWAP, | 1844 | MDIO_XGXS_BLOCK2_TX_LN_SWAP, |
1875 | (tx_lane_swap | | 1845 | (tx_lane_swap | |
1876 | MDIO_XGXS_BLOCK2_TX_LN_SWAP_ENABLE)); | 1846 | MDIO_XGXS_BLOCK2_TX_LN_SWAP_ENABLE)); |
1877 | } else { | 1847 | } else { |
1878 | CL45_WR_OVER_CL22(bp, phy, | 1848 | CL22_WR_OVER_CL45(bp, phy, |
1879 | MDIO_REG_BANK_XGXS_BLOCK2, | 1849 | MDIO_REG_BANK_XGXS_BLOCK2, |
1880 | MDIO_XGXS_BLOCK2_TX_LN_SWAP, 0); | 1850 | MDIO_XGXS_BLOCK2_TX_LN_SWAP, 0); |
1881 | } | 1851 | } |
1882 | } | 1852 | } |
1883 | 1853 | ||
@@ -1886,66 +1856,66 @@ static void bnx2x_set_parallel_detection(struct bnx2x_phy *phy, | |||
1886 | { | 1856 | { |
1887 | struct bnx2x *bp = params->bp; | 1857 | struct bnx2x *bp = params->bp; |
1888 | u16 control2; | 1858 | u16 control2; |
1889 | CL45_RD_OVER_CL22(bp, phy, | 1859 | CL22_RD_OVER_CL45(bp, phy, |
1890 | MDIO_REG_BANK_SERDES_DIGITAL, | 1860 | MDIO_REG_BANK_SERDES_DIGITAL, |
1891 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL2, | 1861 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL2, |
1892 | &control2); | 1862 | &control2); |
1893 | if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) | 1863 | if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) |
1894 | control2 |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; | 1864 | control2 |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; |
1895 | else | 1865 | else |
1896 | control2 &= ~MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; | 1866 | control2 &= ~MDIO_SERDES_DIGITAL_A_1000X_CONTROL2_PRL_DT_EN; |
1897 | DP(NETIF_MSG_LINK, "phy->speed_cap_mask = 0x%x, control2 = 0x%x\n", | 1867 | DP(NETIF_MSG_LINK, "phy->speed_cap_mask = 0x%x, control2 = 0x%x\n", |
1898 | phy->speed_cap_mask, control2); | 1868 | phy->speed_cap_mask, control2); |
1899 | CL45_WR_OVER_CL22(bp, phy, | 1869 | CL22_WR_OVER_CL45(bp, phy, |
1900 | MDIO_REG_BANK_SERDES_DIGITAL, | 1870 | MDIO_REG_BANK_SERDES_DIGITAL, |
1901 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL2, | 1871 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL2, |
1902 | control2); | 1872 | control2); |
1903 | 1873 | ||
1904 | if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && | 1874 | if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && |
1905 | (phy->speed_cap_mask & | 1875 | (phy->speed_cap_mask & |
1906 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) { | 1876 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) { |
1907 | DP(NETIF_MSG_LINK, "XGXS\n"); | 1877 | DP(NETIF_MSG_LINK, "XGXS\n"); |
1908 | 1878 | ||
1909 | CL45_WR_OVER_CL22(bp, phy, | 1879 | CL22_WR_OVER_CL45(bp, phy, |
1910 | MDIO_REG_BANK_10G_PARALLEL_DETECT, | 1880 | MDIO_REG_BANK_10G_PARALLEL_DETECT, |
1911 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK, | 1881 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK, |
1912 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK_CNT); | 1882 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_LINK_CNT); |
1913 | 1883 | ||
1914 | CL45_RD_OVER_CL22(bp, phy, | 1884 | CL22_RD_OVER_CL45(bp, phy, |
1915 | MDIO_REG_BANK_10G_PARALLEL_DETECT, | 1885 | MDIO_REG_BANK_10G_PARALLEL_DETECT, |
1916 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, | 1886 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, |
1917 | &control2); | 1887 | &control2); |
1918 | 1888 | ||
1919 | 1889 | ||
1920 | control2 |= | 1890 | control2 |= |
1921 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL_PARDET10G_EN; | 1891 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL_PARDET10G_EN; |
1922 | 1892 | ||
1923 | CL45_WR_OVER_CL22(bp, phy, | 1893 | CL22_WR_OVER_CL45(bp, phy, |
1924 | MDIO_REG_BANK_10G_PARALLEL_DETECT, | 1894 | MDIO_REG_BANK_10G_PARALLEL_DETECT, |
1925 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, | 1895 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_CONTROL, |
1926 | control2); | 1896 | control2); |
1927 | 1897 | ||
1928 | /* Disable parallel detection of HiG */ | 1898 | /* Disable parallel detection of HiG */ |
1929 | CL45_WR_OVER_CL22(bp, phy, | 1899 | CL22_WR_OVER_CL45(bp, phy, |
1930 | MDIO_REG_BANK_XGXS_BLOCK2, | 1900 | MDIO_REG_BANK_XGXS_BLOCK2, |
1931 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G, | 1901 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G, |
1932 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_CX4_XGXS | | 1902 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_CX4_XGXS | |
1933 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_HIGIG_XGXS); | 1903 | MDIO_XGXS_BLOCK2_UNICORE_MODE_10G_HIGIG_XGXS); |
1934 | } | 1904 | } |
1935 | } | 1905 | } |
1936 | 1906 | ||
1937 | static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | 1907 | static void bnx2x_set_autoneg(struct bnx2x_phy *phy, |
1938 | struct link_params *params, | 1908 | struct link_params *params, |
1939 | struct link_vars *vars, | 1909 | struct link_vars *vars, |
1940 | u8 enable_cl73) | 1910 | u8 enable_cl73) |
1941 | { | 1911 | { |
1942 | struct bnx2x *bp = params->bp; | 1912 | struct bnx2x *bp = params->bp; |
1943 | u16 reg_val; | 1913 | u16 reg_val; |
1944 | 1914 | ||
1945 | /* CL37 Autoneg */ | 1915 | /* CL37 Autoneg */ |
1946 | CL45_RD_OVER_CL22(bp, phy, | 1916 | CL22_RD_OVER_CL45(bp, phy, |
1947 | MDIO_REG_BANK_COMBO_IEEE0, | 1917 | MDIO_REG_BANK_COMBO_IEEE0, |
1948 | MDIO_COMBO_IEEE0_MII_CONTROL, ®_val); | 1918 | MDIO_COMBO_IEEE0_MII_CONTROL, ®_val); |
1949 | 1919 | ||
1950 | /* CL37 Autoneg Enabled */ | 1920 | /* CL37 Autoneg Enabled */ |
1951 | if (vars->line_speed == SPEED_AUTO_NEG) | 1921 | if (vars->line_speed == SPEED_AUTO_NEG) |
@@ -1954,15 +1924,15 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
1954 | reg_val &= ~(MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | | 1924 | reg_val &= ~(MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | |
1955 | MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN); | 1925 | MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN); |
1956 | 1926 | ||
1957 | CL45_WR_OVER_CL22(bp, phy, | 1927 | CL22_WR_OVER_CL45(bp, phy, |
1958 | MDIO_REG_BANK_COMBO_IEEE0, | 1928 | MDIO_REG_BANK_COMBO_IEEE0, |
1959 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); | 1929 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); |
1960 | 1930 | ||
1961 | /* Enable/Disable Autodetection */ | 1931 | /* Enable/Disable Autodetection */ |
1962 | 1932 | ||
1963 | CL45_RD_OVER_CL22(bp, phy, | 1933 | CL22_RD_OVER_CL45(bp, phy, |
1964 | MDIO_REG_BANK_SERDES_DIGITAL, | 1934 | MDIO_REG_BANK_SERDES_DIGITAL, |
1965 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, ®_val); | 1935 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, ®_val); |
1966 | reg_val &= ~(MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_SIGNAL_DETECT_EN | | 1936 | reg_val &= ~(MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_SIGNAL_DETECT_EN | |
1967 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_INVERT_SIGNAL_DETECT); | 1937 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_INVERT_SIGNAL_DETECT); |
1968 | reg_val |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_FIBER_MODE; | 1938 | reg_val |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_FIBER_MODE; |
@@ -1971,14 +1941,14 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
1971 | else | 1941 | else |
1972 | reg_val &= ~MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_AUTODET; | 1942 | reg_val &= ~MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_AUTODET; |
1973 | 1943 | ||
1974 | CL45_WR_OVER_CL22(bp, phy, | 1944 | CL22_WR_OVER_CL45(bp, phy, |
1975 | MDIO_REG_BANK_SERDES_DIGITAL, | 1945 | MDIO_REG_BANK_SERDES_DIGITAL, |
1976 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, reg_val); | 1946 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, reg_val); |
1977 | 1947 | ||
1978 | /* Enable TetonII and BAM autoneg */ | 1948 | /* Enable TetonII and BAM autoneg */ |
1979 | CL45_RD_OVER_CL22(bp, phy, | 1949 | CL22_RD_OVER_CL45(bp, phy, |
1980 | MDIO_REG_BANK_BAM_NEXT_PAGE, | 1950 | MDIO_REG_BANK_BAM_NEXT_PAGE, |
1981 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL, | 1951 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL, |
1982 | ®_val); | 1952 | ®_val); |
1983 | if (vars->line_speed == SPEED_AUTO_NEG) { | 1953 | if (vars->line_speed == SPEED_AUTO_NEG) { |
1984 | /* Enable BAM aneg Mode and TetonII aneg Mode */ | 1954 | /* Enable BAM aneg Mode and TetonII aneg Mode */ |
@@ -1989,20 +1959,20 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
1989 | reg_val &= ~(MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_BAM_MODE | | 1959 | reg_val &= ~(MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_BAM_MODE | |
1990 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_TETON_AN); | 1960 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL_TETON_AN); |
1991 | } | 1961 | } |
1992 | CL45_WR_OVER_CL22(bp, phy, | 1962 | CL22_WR_OVER_CL45(bp, phy, |
1993 | MDIO_REG_BANK_BAM_NEXT_PAGE, | 1963 | MDIO_REG_BANK_BAM_NEXT_PAGE, |
1994 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL, | 1964 | MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL, |
1995 | reg_val); | 1965 | reg_val); |
1996 | 1966 | ||
1997 | if (enable_cl73) { | 1967 | if (enable_cl73) { |
1998 | /* Enable Cl73 FSM status bits */ | 1968 | /* Enable Cl73 FSM status bits */ |
1999 | CL45_WR_OVER_CL22(bp, phy, | 1969 | CL22_WR_OVER_CL45(bp, phy, |
2000 | MDIO_REG_BANK_CL73_USERB0, | 1970 | MDIO_REG_BANK_CL73_USERB0, |
2001 | MDIO_CL73_USERB0_CL73_UCTRL, | 1971 | MDIO_CL73_USERB0_CL73_UCTRL, |
2002 | 0xe); | 1972 | 0xe); |
2003 | 1973 | ||
2004 | /* Enable BAM Station Manager*/ | 1974 | /* Enable BAM Station Manager*/ |
2005 | CL45_WR_OVER_CL22(bp, phy, | 1975 | CL22_WR_OVER_CL45(bp, phy, |
2006 | MDIO_REG_BANK_CL73_USERB0, | 1976 | MDIO_REG_BANK_CL73_USERB0, |
2007 | MDIO_CL73_USERB0_CL73_BAM_CTRL1, | 1977 | MDIO_CL73_USERB0_CL73_BAM_CTRL1, |
2008 | MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_EN | | 1978 | MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_EN | |
@@ -2010,10 +1980,10 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
2010 | MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_NP_AFTER_BP_EN); | 1980 | MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_NP_AFTER_BP_EN); |
2011 | 1981 | ||
2012 | /* Advertise CL73 link speeds */ | 1982 | /* Advertise CL73 link speeds */ |
2013 | CL45_RD_OVER_CL22(bp, phy, | 1983 | CL22_RD_OVER_CL45(bp, phy, |
2014 | MDIO_REG_BANK_CL73_IEEEB1, | 1984 | MDIO_REG_BANK_CL73_IEEEB1, |
2015 | MDIO_CL73_IEEEB1_AN_ADV2, | 1985 | MDIO_CL73_IEEEB1_AN_ADV2, |
2016 | ®_val); | 1986 | ®_val); |
2017 | if (phy->speed_cap_mask & | 1987 | if (phy->speed_cap_mask & |
2018 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) | 1988 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) |
2019 | reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4; | 1989 | reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4; |
@@ -2021,10 +1991,10 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
2021 | PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) | 1991 | PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) |
2022 | reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX; | 1992 | reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX; |
2023 | 1993 | ||
2024 | CL45_WR_OVER_CL22(bp, phy, | 1994 | CL22_WR_OVER_CL45(bp, phy, |
2025 | MDIO_REG_BANK_CL73_IEEEB1, | 1995 | MDIO_REG_BANK_CL73_IEEEB1, |
2026 | MDIO_CL73_IEEEB1_AN_ADV2, | 1996 | MDIO_CL73_IEEEB1_AN_ADV2, |
2027 | reg_val); | 1997 | reg_val); |
2028 | 1998 | ||
2029 | /* CL73 Autoneg Enabled */ | 1999 | /* CL73 Autoneg Enabled */ |
2030 | reg_val = MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN; | 2000 | reg_val = MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN; |
@@ -2032,37 +2002,39 @@ static void bnx2x_set_autoneg(struct bnx2x_phy *phy, | |||
2032 | } else /* CL73 Autoneg Disabled */ | 2002 | } else /* CL73 Autoneg Disabled */ |
2033 | reg_val = 0; | 2003 | reg_val = 0; |
2034 | 2004 | ||
2035 | CL45_WR_OVER_CL22(bp, phy, | 2005 | CL22_WR_OVER_CL45(bp, phy, |
2036 | MDIO_REG_BANK_CL73_IEEEB0, | 2006 | MDIO_REG_BANK_CL73_IEEEB0, |
2037 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, reg_val); | 2007 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, reg_val); |
2038 | } | 2008 | } |
2039 | 2009 | ||
2040 | /* program SerDes, forced speed */ | 2010 | /* program SerDes, forced speed */ |
2041 | static void bnx2x_program_serdes(struct bnx2x_phy *phy, | 2011 | static void bnx2x_program_serdes(struct bnx2x_phy *phy, |
2042 | struct link_params *params, | 2012 | struct link_params *params, |
2043 | struct link_vars *vars) | 2013 | struct link_vars *vars) |
2044 | { | 2014 | { |
2045 | struct bnx2x *bp = params->bp; | 2015 | struct bnx2x *bp = params->bp; |
2046 | u16 reg_val; | 2016 | u16 reg_val; |
2047 | 2017 | ||
2048 | /* program duplex, disable autoneg and sgmii*/ | 2018 | /* program duplex, disable autoneg and sgmii*/ |
2049 | CL45_RD_OVER_CL22(bp, phy, | 2019 | CL22_RD_OVER_CL45(bp, phy, |
2050 | MDIO_REG_BANK_COMBO_IEEE0, | 2020 | MDIO_REG_BANK_COMBO_IEEE0, |
2051 | MDIO_COMBO_IEEE0_MII_CONTROL, ®_val); | 2021 | MDIO_COMBO_IEEE0_MII_CONTROL, ®_val); |
2052 | reg_val &= ~(MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX | | 2022 | reg_val &= ~(MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX | |
2053 | MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | | 2023 | MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | |
2054 | MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_MASK); | 2024 | MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_MASK); |
2055 | if (phy->req_duplex == DUPLEX_FULL) | 2025 | if (phy->req_duplex == DUPLEX_FULL) |
2056 | reg_val |= MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX; | 2026 | reg_val |= MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX; |
2057 | CL45_WR_OVER_CL22(bp, phy, | 2027 | CL22_WR_OVER_CL45(bp, phy, |
2058 | MDIO_REG_BANK_COMBO_IEEE0, | 2028 | MDIO_REG_BANK_COMBO_IEEE0, |
2059 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); | 2029 | MDIO_COMBO_IEEE0_MII_CONTROL, reg_val); |
2060 | 2030 | ||
2061 | /* program speed | 2031 | /* |
2062 | - needed only if the speed is greater than 1G (2.5G or 10G) */ | 2032 | * program speed |
2063 | CL45_RD_OVER_CL22(bp, phy, | 2033 | * - needed only if the speed is greater than 1G (2.5G or 10G) |
2064 | MDIO_REG_BANK_SERDES_DIGITAL, | 2034 | */ |
2065 | MDIO_SERDES_DIGITAL_MISC1, ®_val); | 2035 | CL22_RD_OVER_CL45(bp, phy, |
2036 | MDIO_REG_BANK_SERDES_DIGITAL, | ||
2037 | MDIO_SERDES_DIGITAL_MISC1, ®_val); | ||
2066 | /* clearing the speed value before setting the right speed */ | 2038 | /* clearing the speed value before setting the right speed */ |
2067 | DP(NETIF_MSG_LINK, "MDIO_REG_BANK_SERDES_DIGITAL = 0x%x\n", reg_val); | 2039 | DP(NETIF_MSG_LINK, "MDIO_REG_BANK_SERDES_DIGITAL = 0x%x\n", reg_val); |
2068 | 2040 | ||
@@ -2083,9 +2055,9 @@ static void bnx2x_program_serdes(struct bnx2x_phy *phy, | |||
2083 | MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_13G; | 2055 | MDIO_SERDES_DIGITAL_MISC1_FORCE_SPEED_13G; |
2084 | } | 2056 | } |
2085 | 2057 | ||
2086 | CL45_WR_OVER_CL22(bp, phy, | 2058 | CL22_WR_OVER_CL45(bp, phy, |
2087 | MDIO_REG_BANK_SERDES_DIGITAL, | 2059 | MDIO_REG_BANK_SERDES_DIGITAL, |
2088 | MDIO_SERDES_DIGITAL_MISC1, reg_val); | 2060 | MDIO_SERDES_DIGITAL_MISC1, reg_val); |
2089 | 2061 | ||
2090 | } | 2062 | } |
2091 | 2063 | ||
@@ -2102,13 +2074,13 @@ static void bnx2x_set_brcm_cl37_advertisment(struct bnx2x_phy *phy, | |||
2102 | val |= MDIO_OVER_1G_UP1_2_5G; | 2074 | val |= MDIO_OVER_1G_UP1_2_5G; |
2103 | if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) | 2075 | if (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) |
2104 | val |= MDIO_OVER_1G_UP1_10G; | 2076 | val |= MDIO_OVER_1G_UP1_10G; |
2105 | CL45_WR_OVER_CL22(bp, phy, | 2077 | CL22_WR_OVER_CL45(bp, phy, |
2106 | MDIO_REG_BANK_OVER_1G, | 2078 | MDIO_REG_BANK_OVER_1G, |
2107 | MDIO_OVER_1G_UP1, val); | 2079 | MDIO_OVER_1G_UP1, val); |
2108 | 2080 | ||
2109 | CL45_WR_OVER_CL22(bp, phy, | 2081 | CL22_WR_OVER_CL45(bp, phy, |
2110 | MDIO_REG_BANK_OVER_1G, | 2082 | MDIO_REG_BANK_OVER_1G, |
2111 | MDIO_OVER_1G_UP3, 0x400); | 2083 | MDIO_OVER_1G_UP3, 0x400); |
2112 | } | 2084 | } |
2113 | 2085 | ||
2114 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | 2086 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, |
@@ -2116,22 +2088,21 @@ static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | |||
2116 | { | 2088 | { |
2117 | struct bnx2x *bp = params->bp; | 2089 | struct bnx2x *bp = params->bp; |
2118 | *ieee_fc = MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX; | 2090 | *ieee_fc = MDIO_COMBO_IEEE0_AUTO_NEG_ADV_FULL_DUPLEX; |
2119 | /* resolve pause mode and advertisement | 2091 | /* |
2120 | * Please refer to Table 28B-3 of the 802.3ab-1999 spec */ | 2092 | * Resolve pause mode and advertisement. |
2093 | * Please refer to Table 28B-3 of the 802.3ab-1999 spec | ||
2094 | */ | ||
2121 | 2095 | ||
2122 | switch (phy->req_flow_ctrl) { | 2096 | switch (phy->req_flow_ctrl) { |
2123 | case BNX2X_FLOW_CTRL_AUTO: | 2097 | case BNX2X_FLOW_CTRL_AUTO: |
2124 | if (params->req_fc_auto_adv == BNX2X_FLOW_CTRL_BOTH) { | 2098 | if (params->req_fc_auto_adv == BNX2X_FLOW_CTRL_BOTH) |
2125 | *ieee_fc |= | 2099 | *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; |
2126 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; | 2100 | else |
2127 | } else { | ||
2128 | *ieee_fc |= | 2101 | *ieee_fc |= |
2129 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; | 2102 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; |
2130 | } | ||
2131 | break; | 2103 | break; |
2132 | case BNX2X_FLOW_CTRL_TX: | 2104 | case BNX2X_FLOW_CTRL_TX: |
2133 | *ieee_fc |= | 2105 | *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; |
2134 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; | ||
2135 | break; | 2106 | break; |
2136 | 2107 | ||
2137 | case BNX2X_FLOW_CTRL_RX: | 2108 | case BNX2X_FLOW_CTRL_RX: |
@@ -2149,23 +2120,23 @@ static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | |||
2149 | 2120 | ||
2150 | static void bnx2x_set_ieee_aneg_advertisment(struct bnx2x_phy *phy, | 2121 | static void bnx2x_set_ieee_aneg_advertisment(struct bnx2x_phy *phy, |
2151 | struct link_params *params, | 2122 | struct link_params *params, |
2152 | u16 ieee_fc) | 2123 | u16 ieee_fc) |
2153 | { | 2124 | { |
2154 | struct bnx2x *bp = params->bp; | 2125 | struct bnx2x *bp = params->bp; |
2155 | u16 val; | 2126 | u16 val; |
2156 | /* for AN, we are always publishing full duplex */ | 2127 | /* for AN, we are always publishing full duplex */ |
2157 | 2128 | ||
2158 | CL45_WR_OVER_CL22(bp, phy, | 2129 | CL22_WR_OVER_CL45(bp, phy, |
2159 | MDIO_REG_BANK_COMBO_IEEE0, | 2130 | MDIO_REG_BANK_COMBO_IEEE0, |
2160 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV, ieee_fc); | 2131 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV, ieee_fc); |
2161 | CL45_RD_OVER_CL22(bp, phy, | 2132 | CL22_RD_OVER_CL45(bp, phy, |
2162 | MDIO_REG_BANK_CL73_IEEEB1, | 2133 | MDIO_REG_BANK_CL73_IEEEB1, |
2163 | MDIO_CL73_IEEEB1_AN_ADV1, &val); | 2134 | MDIO_CL73_IEEEB1_AN_ADV1, &val); |
2164 | val &= ~MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_BOTH; | 2135 | val &= ~MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_BOTH; |
2165 | val |= ((ieee_fc<<3) & MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_MASK); | 2136 | val |= ((ieee_fc<<3) & MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_MASK); |
2166 | CL45_WR_OVER_CL22(bp, phy, | 2137 | CL22_WR_OVER_CL45(bp, phy, |
2167 | MDIO_REG_BANK_CL73_IEEEB1, | 2138 | MDIO_REG_BANK_CL73_IEEEB1, |
2168 | MDIO_CL73_IEEEB1_AN_ADV1, val); | 2139 | MDIO_CL73_IEEEB1_AN_ADV1, val); |
2169 | } | 2140 | } |
2170 | 2141 | ||
2171 | static void bnx2x_restart_autoneg(struct bnx2x_phy *phy, | 2142 | static void bnx2x_restart_autoneg(struct bnx2x_phy *phy, |
@@ -2179,67 +2150,67 @@ static void bnx2x_restart_autoneg(struct bnx2x_phy *phy, | |||
2179 | /* Enable and restart BAM/CL37 aneg */ | 2150 | /* Enable and restart BAM/CL37 aneg */ |
2180 | 2151 | ||
2181 | if (enable_cl73) { | 2152 | if (enable_cl73) { |
2182 | CL45_RD_OVER_CL22(bp, phy, | 2153 | CL22_RD_OVER_CL45(bp, phy, |
2183 | MDIO_REG_BANK_CL73_IEEEB0, | 2154 | MDIO_REG_BANK_CL73_IEEEB0, |
2184 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, | 2155 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, |
2185 | &mii_control); | 2156 | &mii_control); |
2186 | 2157 | ||
2187 | CL45_WR_OVER_CL22(bp, phy, | 2158 | CL22_WR_OVER_CL45(bp, phy, |
2188 | MDIO_REG_BANK_CL73_IEEEB0, | 2159 | MDIO_REG_BANK_CL73_IEEEB0, |
2189 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, | 2160 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, |
2190 | (mii_control | | 2161 | (mii_control | |
2191 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN | | 2162 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN | |
2192 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_RESTART_AN)); | 2163 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_RESTART_AN)); |
2193 | } else { | 2164 | } else { |
2194 | 2165 | ||
2195 | CL45_RD_OVER_CL22(bp, phy, | 2166 | CL22_RD_OVER_CL45(bp, phy, |
2196 | MDIO_REG_BANK_COMBO_IEEE0, | 2167 | MDIO_REG_BANK_COMBO_IEEE0, |
2197 | MDIO_COMBO_IEEE0_MII_CONTROL, | 2168 | MDIO_COMBO_IEEE0_MII_CONTROL, |
2198 | &mii_control); | 2169 | &mii_control); |
2199 | DP(NETIF_MSG_LINK, | 2170 | DP(NETIF_MSG_LINK, |
2200 | "bnx2x_restart_autoneg mii_control before = 0x%x\n", | 2171 | "bnx2x_restart_autoneg mii_control before = 0x%x\n", |
2201 | mii_control); | 2172 | mii_control); |
2202 | CL45_WR_OVER_CL22(bp, phy, | 2173 | CL22_WR_OVER_CL45(bp, phy, |
2203 | MDIO_REG_BANK_COMBO_IEEE0, | 2174 | MDIO_REG_BANK_COMBO_IEEE0, |
2204 | MDIO_COMBO_IEEE0_MII_CONTROL, | 2175 | MDIO_COMBO_IEEE0_MII_CONTROL, |
2205 | (mii_control | | 2176 | (mii_control | |
2206 | MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | | 2177 | MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | |
2207 | MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN)); | 2178 | MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN)); |
2208 | } | 2179 | } |
2209 | } | 2180 | } |
2210 | 2181 | ||
2211 | static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy, | 2182 | static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy, |
2212 | struct link_params *params, | 2183 | struct link_params *params, |
2213 | struct link_vars *vars) | 2184 | struct link_vars *vars) |
2214 | { | 2185 | { |
2215 | struct bnx2x *bp = params->bp; | 2186 | struct bnx2x *bp = params->bp; |
2216 | u16 control1; | 2187 | u16 control1; |
2217 | 2188 | ||
2218 | /* in SGMII mode, the unicore is always slave */ | 2189 | /* in SGMII mode, the unicore is always slave */ |
2219 | 2190 | ||
2220 | CL45_RD_OVER_CL22(bp, phy, | 2191 | CL22_RD_OVER_CL45(bp, phy, |
2221 | MDIO_REG_BANK_SERDES_DIGITAL, | 2192 | MDIO_REG_BANK_SERDES_DIGITAL, |
2222 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, | 2193 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, |
2223 | &control1); | 2194 | &control1); |
2224 | control1 |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_INVERT_SIGNAL_DETECT; | 2195 | control1 |= MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_INVERT_SIGNAL_DETECT; |
2225 | /* set sgmii mode (and not fiber) */ | 2196 | /* set sgmii mode (and not fiber) */ |
2226 | control1 &= ~(MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_FIBER_MODE | | 2197 | control1 &= ~(MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_FIBER_MODE | |
2227 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_AUTODET | | 2198 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_AUTODET | |
2228 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_MSTR_MODE); | 2199 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1_MSTR_MODE); |
2229 | CL45_WR_OVER_CL22(bp, phy, | 2200 | CL22_WR_OVER_CL45(bp, phy, |
2230 | MDIO_REG_BANK_SERDES_DIGITAL, | 2201 | MDIO_REG_BANK_SERDES_DIGITAL, |
2231 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, | 2202 | MDIO_SERDES_DIGITAL_A_1000X_CONTROL1, |
2232 | control1); | 2203 | control1); |
2233 | 2204 | ||
2234 | /* if forced speed */ | 2205 | /* if forced speed */ |
2235 | if (!(vars->line_speed == SPEED_AUTO_NEG)) { | 2206 | if (!(vars->line_speed == SPEED_AUTO_NEG)) { |
2236 | /* set speed, disable autoneg */ | 2207 | /* set speed, disable autoneg */ |
2237 | u16 mii_control; | 2208 | u16 mii_control; |
2238 | 2209 | ||
2239 | CL45_RD_OVER_CL22(bp, phy, | 2210 | CL22_RD_OVER_CL45(bp, phy, |
2240 | MDIO_REG_BANK_COMBO_IEEE0, | 2211 | MDIO_REG_BANK_COMBO_IEEE0, |
2241 | MDIO_COMBO_IEEE0_MII_CONTROL, | 2212 | MDIO_COMBO_IEEE0_MII_CONTROL, |
2242 | &mii_control); | 2213 | &mii_control); |
2243 | mii_control &= ~(MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | | 2214 | mii_control &= ~(MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | |
2244 | MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_MASK| | 2215 | MDIO_COMBO_IEEO_MII_CONTROL_MAN_SGMII_SP_MASK| |
2245 | MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX); | 2216 | MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX); |
@@ -2267,10 +2238,10 @@ static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy, | |||
2267 | if (phy->req_duplex == DUPLEX_FULL) | 2238 | if (phy->req_duplex == DUPLEX_FULL) |
2268 | mii_control |= | 2239 | mii_control |= |
2269 | MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX; | 2240 | MDIO_COMBO_IEEO_MII_CONTROL_FULL_DUPLEX; |
2270 | CL45_WR_OVER_CL22(bp, phy, | 2241 | CL22_WR_OVER_CL45(bp, phy, |
2271 | MDIO_REG_BANK_COMBO_IEEE0, | 2242 | MDIO_REG_BANK_COMBO_IEEE0, |
2272 | MDIO_COMBO_IEEE0_MII_CONTROL, | 2243 | MDIO_COMBO_IEEE0_MII_CONTROL, |
2273 | mii_control); | 2244 | mii_control); |
2274 | 2245 | ||
2275 | } else { /* AN mode */ | 2246 | } else { /* AN mode */ |
2276 | /* enable and restart AN */ | 2247 | /* enable and restart AN */ |
@@ -2285,19 +2256,19 @@ static void bnx2x_initialize_sgmii_process(struct bnx2x_phy *phy, | |||
2285 | 2256 | ||
2286 | static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result) | 2257 | static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result) |
2287 | { /* LD LP */ | 2258 | { /* LD LP */ |
2288 | switch (pause_result) { /* ASYM P ASYM P */ | 2259 | switch (pause_result) { /* ASYM P ASYM P */ |
2289 | case 0xb: /* 1 0 1 1 */ | 2260 | case 0xb: /* 1 0 1 1 */ |
2290 | vars->flow_ctrl = BNX2X_FLOW_CTRL_TX; | 2261 | vars->flow_ctrl = BNX2X_FLOW_CTRL_TX; |
2291 | break; | 2262 | break; |
2292 | 2263 | ||
2293 | case 0xe: /* 1 1 1 0 */ | 2264 | case 0xe: /* 1 1 1 0 */ |
2294 | vars->flow_ctrl = BNX2X_FLOW_CTRL_RX; | 2265 | vars->flow_ctrl = BNX2X_FLOW_CTRL_RX; |
2295 | break; | 2266 | break; |
2296 | 2267 | ||
2297 | case 0x5: /* 0 1 0 1 */ | 2268 | case 0x5: /* 0 1 0 1 */ |
2298 | case 0x7: /* 0 1 1 1 */ | 2269 | case 0x7: /* 0 1 1 1 */ |
2299 | case 0xd: /* 1 1 0 1 */ | 2270 | case 0xd: /* 1 1 0 1 */ |
2300 | case 0xf: /* 1 1 1 1 */ | 2271 | case 0xf: /* 1 1 1 1 */ |
2301 | vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH; | 2272 | vars->flow_ctrl = BNX2X_FLOW_CTRL_BOTH; |
2302 | break; | 2273 | break; |
2303 | 2274 | ||
@@ -2317,24 +2288,24 @@ static u8 bnx2x_direct_parallel_detect_used(struct bnx2x_phy *phy, | |||
2317 | u16 pd_10g, status2_1000x; | 2288 | u16 pd_10g, status2_1000x; |
2318 | if (phy->req_line_speed != SPEED_AUTO_NEG) | 2289 | if (phy->req_line_speed != SPEED_AUTO_NEG) |
2319 | return 0; | 2290 | return 0; |
2320 | CL45_RD_OVER_CL22(bp, phy, | 2291 | CL22_RD_OVER_CL45(bp, phy, |
2321 | MDIO_REG_BANK_SERDES_DIGITAL, | 2292 | MDIO_REG_BANK_SERDES_DIGITAL, |
2322 | MDIO_SERDES_DIGITAL_A_1000X_STATUS2, | 2293 | MDIO_SERDES_DIGITAL_A_1000X_STATUS2, |
2323 | &status2_1000x); | 2294 | &status2_1000x); |
2324 | CL45_RD_OVER_CL22(bp, phy, | 2295 | CL22_RD_OVER_CL45(bp, phy, |
2325 | MDIO_REG_BANK_SERDES_DIGITAL, | 2296 | MDIO_REG_BANK_SERDES_DIGITAL, |
2326 | MDIO_SERDES_DIGITAL_A_1000X_STATUS2, | 2297 | MDIO_SERDES_DIGITAL_A_1000X_STATUS2, |
2327 | &status2_1000x); | 2298 | &status2_1000x); |
2328 | if (status2_1000x & MDIO_SERDES_DIGITAL_A_1000X_STATUS2_AN_DISABLED) { | 2299 | if (status2_1000x & MDIO_SERDES_DIGITAL_A_1000X_STATUS2_AN_DISABLED) { |
2329 | DP(NETIF_MSG_LINK, "1G parallel detect link on port %d\n", | 2300 | DP(NETIF_MSG_LINK, "1G parallel detect link on port %d\n", |
2330 | params->port); | 2301 | params->port); |
2331 | return 1; | 2302 | return 1; |
2332 | } | 2303 | } |
2333 | 2304 | ||
2334 | CL45_RD_OVER_CL22(bp, phy, | 2305 | CL22_RD_OVER_CL45(bp, phy, |
2335 | MDIO_REG_BANK_10G_PARALLEL_DETECT, | 2306 | MDIO_REG_BANK_10G_PARALLEL_DETECT, |
2336 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_STATUS, | 2307 | MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_STATUS, |
2337 | &pd_10g); | 2308 | &pd_10g); |
2338 | 2309 | ||
2339 | if (pd_10g & MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_STATUS_PD_LINK) { | 2310 | if (pd_10g & MDIO_10G_PARALLEL_DETECT_PAR_DET_10G_STATUS_PD_LINK) { |
2340 | DP(NETIF_MSG_LINK, "10G parallel detect link on port %d\n", | 2311 | DP(NETIF_MSG_LINK, "10G parallel detect link on port %d\n", |
@@ -2373,14 +2344,14 @@ static void bnx2x_flow_ctrl_resolve(struct bnx2x_phy *phy, | |||
2373 | (MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_AUTONEG_COMPLETE | | 2344 | (MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_AUTONEG_COMPLETE | |
2374 | MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_MR_LP_NP_AN_ABLE)) { | 2345 | MDIO_GP_STATUS_TOP_AN_STATUS1_CL73_MR_LP_NP_AN_ABLE)) { |
2375 | 2346 | ||
2376 | CL45_RD_OVER_CL22(bp, phy, | 2347 | CL22_RD_OVER_CL45(bp, phy, |
2377 | MDIO_REG_BANK_CL73_IEEEB1, | 2348 | MDIO_REG_BANK_CL73_IEEEB1, |
2378 | MDIO_CL73_IEEEB1_AN_ADV1, | 2349 | MDIO_CL73_IEEEB1_AN_ADV1, |
2379 | &ld_pause); | 2350 | &ld_pause); |
2380 | CL45_RD_OVER_CL22(bp, phy, | 2351 | CL22_RD_OVER_CL45(bp, phy, |
2381 | MDIO_REG_BANK_CL73_IEEEB1, | 2352 | MDIO_REG_BANK_CL73_IEEEB1, |
2382 | MDIO_CL73_IEEEB1_AN_LP_ADV1, | 2353 | MDIO_CL73_IEEEB1_AN_LP_ADV1, |
2383 | &lp_pause); | 2354 | &lp_pause); |
2384 | pause_result = (ld_pause & | 2355 | pause_result = (ld_pause & |
2385 | MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_MASK) | 2356 | MDIO_CL73_IEEEB1_AN_ADV1_PAUSE_MASK) |
2386 | >> 8; | 2357 | >> 8; |
@@ -2390,18 +2361,18 @@ static void bnx2x_flow_ctrl_resolve(struct bnx2x_phy *phy, | |||
2390 | DP(NETIF_MSG_LINK, "pause_result CL73 0x%x\n", | 2361 | DP(NETIF_MSG_LINK, "pause_result CL73 0x%x\n", |
2391 | pause_result); | 2362 | pause_result); |
2392 | } else { | 2363 | } else { |
2393 | CL45_RD_OVER_CL22(bp, phy, | 2364 | CL22_RD_OVER_CL45(bp, phy, |
2394 | MDIO_REG_BANK_COMBO_IEEE0, | 2365 | MDIO_REG_BANK_COMBO_IEEE0, |
2395 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV, | 2366 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV, |
2396 | &ld_pause); | 2367 | &ld_pause); |
2397 | CL45_RD_OVER_CL22(bp, phy, | 2368 | CL22_RD_OVER_CL45(bp, phy, |
2398 | MDIO_REG_BANK_COMBO_IEEE0, | 2369 | MDIO_REG_BANK_COMBO_IEEE0, |
2399 | MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1, | 2370 | MDIO_COMBO_IEEE0_AUTO_NEG_LINK_PARTNER_ABILITY1, |
2400 | &lp_pause); | 2371 | &lp_pause); |
2401 | pause_result = (ld_pause & | 2372 | pause_result = (ld_pause & |
2402 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>5; | 2373 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>5; |
2403 | pause_result |= (lp_pause & | 2374 | pause_result |= (lp_pause & |
2404 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>7; | 2375 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_MASK)>>7; |
2405 | DP(NETIF_MSG_LINK, "pause_result CL37 0x%x\n", | 2376 | DP(NETIF_MSG_LINK, "pause_result CL37 0x%x\n", |
2406 | pause_result); | 2377 | pause_result); |
2407 | } | 2378 | } |
@@ -2417,25 +2388,25 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, | |||
2417 | u16 rx_status, ustat_val, cl37_fsm_recieved; | 2388 | u16 rx_status, ustat_val, cl37_fsm_recieved; |
2418 | DP(NETIF_MSG_LINK, "bnx2x_check_fallback_to_cl37\n"); | 2389 | DP(NETIF_MSG_LINK, "bnx2x_check_fallback_to_cl37\n"); |
2419 | /* Step 1: Make sure signal is detected */ | 2390 | /* Step 1: Make sure signal is detected */ |
2420 | CL45_RD_OVER_CL22(bp, phy, | 2391 | CL22_RD_OVER_CL45(bp, phy, |
2421 | MDIO_REG_BANK_RX0, | 2392 | MDIO_REG_BANK_RX0, |
2422 | MDIO_RX0_RX_STATUS, | 2393 | MDIO_RX0_RX_STATUS, |
2423 | &rx_status); | 2394 | &rx_status); |
2424 | if ((rx_status & MDIO_RX0_RX_STATUS_SIGDET) != | 2395 | if ((rx_status & MDIO_RX0_RX_STATUS_SIGDET) != |
2425 | (MDIO_RX0_RX_STATUS_SIGDET)) { | 2396 | (MDIO_RX0_RX_STATUS_SIGDET)) { |
2426 | DP(NETIF_MSG_LINK, "Signal is not detected. Restoring CL73." | 2397 | DP(NETIF_MSG_LINK, "Signal is not detected. Restoring CL73." |
2427 | "rx_status(0x80b0) = 0x%x\n", rx_status); | 2398 | "rx_status(0x80b0) = 0x%x\n", rx_status); |
2428 | CL45_WR_OVER_CL22(bp, phy, | 2399 | CL22_WR_OVER_CL45(bp, phy, |
2429 | MDIO_REG_BANK_CL73_IEEEB0, | 2400 | MDIO_REG_BANK_CL73_IEEEB0, |
2430 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, | 2401 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, |
2431 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN); | 2402 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN); |
2432 | return; | 2403 | return; |
2433 | } | 2404 | } |
2434 | /* Step 2: Check CL73 state machine */ | 2405 | /* Step 2: Check CL73 state machine */ |
2435 | CL45_RD_OVER_CL22(bp, phy, | 2406 | CL22_RD_OVER_CL45(bp, phy, |
2436 | MDIO_REG_BANK_CL73_USERB0, | 2407 | MDIO_REG_BANK_CL73_USERB0, |
2437 | MDIO_CL73_USERB0_CL73_USTAT1, | 2408 | MDIO_CL73_USERB0_CL73_USTAT1, |
2438 | &ustat_val); | 2409 | &ustat_val); |
2439 | if ((ustat_val & | 2410 | if ((ustat_val & |
2440 | (MDIO_CL73_USERB0_CL73_USTAT1_LINK_STATUS_CHECK | | 2411 | (MDIO_CL73_USERB0_CL73_USTAT1_LINK_STATUS_CHECK | |
2441 | MDIO_CL73_USERB0_CL73_USTAT1_AN_GOOD_CHECK_BAM37)) != | 2412 | MDIO_CL73_USERB0_CL73_USTAT1_AN_GOOD_CHECK_BAM37)) != |
@@ -2445,12 +2416,14 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, | |||
2445 | "ustat_val(0x8371) = 0x%x\n", ustat_val); | 2416 | "ustat_val(0x8371) = 0x%x\n", ustat_val); |
2446 | return; | 2417 | return; |
2447 | } | 2418 | } |
2448 | /* Step 3: Check CL37 Message Pages received to indicate LP | 2419 | /* |
2449 | supports only CL37 */ | 2420 | * Step 3: Check CL37 Message Pages received to indicate LP |
2450 | CL45_RD_OVER_CL22(bp, phy, | 2421 | * supports only CL37 |
2451 | MDIO_REG_BANK_REMOTE_PHY, | 2422 | */ |
2452 | MDIO_REMOTE_PHY_MISC_RX_STATUS, | 2423 | CL22_RD_OVER_CL45(bp, phy, |
2453 | &cl37_fsm_recieved); | 2424 | MDIO_REG_BANK_REMOTE_PHY, |
2425 | MDIO_REMOTE_PHY_MISC_RX_STATUS, | ||
2426 | &cl37_fsm_recieved); | ||
2454 | if ((cl37_fsm_recieved & | 2427 | if ((cl37_fsm_recieved & |
2455 | (MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_OVER1G_MSG | | 2428 | (MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_OVER1G_MSG | |
2456 | MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_BRCM_OUI_MSG)) != | 2429 | MDIO_REMOTE_PHY_MISC_RX_STATUS_CL37_FSM_RECEIVED_BRCM_OUI_MSG)) != |
@@ -2461,14 +2434,18 @@ static void bnx2x_check_fallback_to_cl37(struct bnx2x_phy *phy, | |||
2461 | cl37_fsm_recieved); | 2434 | cl37_fsm_recieved); |
2462 | return; | 2435 | return; |
2463 | } | 2436 | } |
2464 | /* The combined cl37/cl73 fsm state information indicating that we are | 2437 | /* |
2465 | connected to a device which does not support cl73, but does support | 2438 | * The combined cl37/cl73 fsm state information indicating that |
2466 | cl37 BAM. In this case we disable cl73 and restart cl37 auto-neg */ | 2439 | * we are connected to a device which does not support cl73, but |
2440 | * does support cl37 BAM. In this case we disable cl73 and | ||
2441 | * restart cl37 auto-neg | ||
2442 | */ | ||
2443 | |||
2467 | /* Disable CL73 */ | 2444 | /* Disable CL73 */ |
2468 | CL45_WR_OVER_CL22(bp, phy, | 2445 | CL22_WR_OVER_CL45(bp, phy, |
2469 | MDIO_REG_BANK_CL73_IEEEB0, | 2446 | MDIO_REG_BANK_CL73_IEEEB0, |
2470 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, | 2447 | MDIO_CL73_IEEEB0_CL73_AN_CONTROL, |
2471 | 0); | 2448 | 0); |
2472 | /* Restart CL37 autoneg */ | 2449 | /* Restart CL37 autoneg */ |
2473 | bnx2x_restart_autoneg(phy, params, 0); | 2450 | bnx2x_restart_autoneg(phy, params, 0); |
2474 | DP(NETIF_MSG_LINK, "Disabling CL73, and restarting CL37 autoneg\n"); | 2451 | DP(NETIF_MSG_LINK, "Disabling CL73, and restarting CL37 autoneg\n"); |
@@ -2493,14 +2470,14 @@ static u8 bnx2x_link_settings_status(struct bnx2x_phy *phy, | |||
2493 | struct link_vars *vars) | 2470 | struct link_vars *vars) |
2494 | { | 2471 | { |
2495 | struct bnx2x *bp = params->bp; | 2472 | struct bnx2x *bp = params->bp; |
2496 | u16 new_line_speed , gp_status; | 2473 | u16 new_line_speed, gp_status; |
2497 | u8 rc = 0; | 2474 | u8 rc = 0; |
2498 | 2475 | ||
2499 | /* Read gp_status */ | 2476 | /* Read gp_status */ |
2500 | CL45_RD_OVER_CL22(bp, phy, | 2477 | CL22_RD_OVER_CL45(bp, phy, |
2501 | MDIO_REG_BANK_GP_STATUS, | 2478 | MDIO_REG_BANK_GP_STATUS, |
2502 | MDIO_GP_STATUS_TOP_AN_STATUS1, | 2479 | MDIO_GP_STATUS_TOP_AN_STATUS1, |
2503 | &gp_status); | 2480 | &gp_status); |
2504 | 2481 | ||
2505 | if (phy->req_line_speed == SPEED_AUTO_NEG) | 2482 | if (phy->req_line_speed == SPEED_AUTO_NEG) |
2506 | vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_ENABLED; | 2483 | vars->link_status |= LINK_STATUS_AUTO_NEGOTIATE_ENABLED; |
@@ -2637,9 +2614,9 @@ static void bnx2x_set_gmii_tx_driver(struct link_params *params) | |||
2637 | u16 bank; | 2614 | u16 bank; |
2638 | 2615 | ||
2639 | /* read precomp */ | 2616 | /* read precomp */ |
2640 | CL45_RD_OVER_CL22(bp, phy, | 2617 | CL22_RD_OVER_CL45(bp, phy, |
2641 | MDIO_REG_BANK_OVER_1G, | 2618 | MDIO_REG_BANK_OVER_1G, |
2642 | MDIO_OVER_1G_LP_UP2, &lp_up2); | 2619 | MDIO_OVER_1G_LP_UP2, &lp_up2); |
2643 | 2620 | ||
2644 | /* bits [10:7] at lp_up2, positioned at [15:12] */ | 2621 | /* bits [10:7] at lp_up2, positioned at [15:12] */ |
2645 | lp_up2 = (((lp_up2 & MDIO_OVER_1G_LP_UP2_PREEMPHASIS_MASK) >> | 2622 | lp_up2 = (((lp_up2 & MDIO_OVER_1G_LP_UP2_PREEMPHASIS_MASK) >> |
@@ -2651,18 +2628,18 @@ static void bnx2x_set_gmii_tx_driver(struct link_params *params) | |||
2651 | 2628 | ||
2652 | for (bank = MDIO_REG_BANK_TX0; bank <= MDIO_REG_BANK_TX3; | 2629 | for (bank = MDIO_REG_BANK_TX0; bank <= MDIO_REG_BANK_TX3; |
2653 | bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0)) { | 2630 | bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0)) { |
2654 | CL45_RD_OVER_CL22(bp, phy, | 2631 | CL22_RD_OVER_CL45(bp, phy, |
2655 | bank, | 2632 | bank, |
2656 | MDIO_TX0_TX_DRIVER, &tx_driver); | 2633 | MDIO_TX0_TX_DRIVER, &tx_driver); |
2657 | 2634 | ||
2658 | /* replace tx_driver bits [15:12] */ | 2635 | /* replace tx_driver bits [15:12] */ |
2659 | if (lp_up2 != | 2636 | if (lp_up2 != |
2660 | (tx_driver & MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK)) { | 2637 | (tx_driver & MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK)) { |
2661 | tx_driver &= ~MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK; | 2638 | tx_driver &= ~MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK; |
2662 | tx_driver |= lp_up2; | 2639 | tx_driver |= lp_up2; |
2663 | CL45_WR_OVER_CL22(bp, phy, | 2640 | CL22_WR_OVER_CL45(bp, phy, |
2664 | bank, | 2641 | bank, |
2665 | MDIO_TX0_TX_DRIVER, tx_driver); | 2642 | MDIO_TX0_TX_DRIVER, tx_driver); |
2666 | } | 2643 | } |
2667 | } | 2644 | } |
2668 | } | 2645 | } |
@@ -2676,10 +2653,10 @@ static u8 bnx2x_emac_program(struct link_params *params, | |||
2676 | 2653 | ||
2677 | DP(NETIF_MSG_LINK, "setting link speed & duplex\n"); | 2654 | DP(NETIF_MSG_LINK, "setting link speed & duplex\n"); |
2678 | bnx2x_bits_dis(bp, GRCBASE_EMAC0 + port*0x400 + | 2655 | bnx2x_bits_dis(bp, GRCBASE_EMAC0 + port*0x400 + |
2679 | EMAC_REG_EMAC_MODE, | 2656 | EMAC_REG_EMAC_MODE, |
2680 | (EMAC_MODE_25G_MODE | | 2657 | (EMAC_MODE_25G_MODE | |
2681 | EMAC_MODE_PORT_MII_10M | | 2658 | EMAC_MODE_PORT_MII_10M | |
2682 | EMAC_MODE_HALF_DUPLEX)); | 2659 | EMAC_MODE_HALF_DUPLEX)); |
2683 | switch (vars->line_speed) { | 2660 | switch (vars->line_speed) { |
2684 | case SPEED_10: | 2661 | case SPEED_10: |
2685 | mode |= EMAC_MODE_PORT_MII_10M; | 2662 | mode |= EMAC_MODE_PORT_MII_10M; |
@@ -2707,8 +2684,8 @@ static u8 bnx2x_emac_program(struct link_params *params, | |||
2707 | if (vars->duplex == DUPLEX_HALF) | 2684 | if (vars->duplex == DUPLEX_HALF) |
2708 | mode |= EMAC_MODE_HALF_DUPLEX; | 2685 | mode |= EMAC_MODE_HALF_DUPLEX; |
2709 | bnx2x_bits_en(bp, | 2686 | bnx2x_bits_en(bp, |
2710 | GRCBASE_EMAC0 + port*0x400 + EMAC_REG_EMAC_MODE, | 2687 | GRCBASE_EMAC0 + port*0x400 + EMAC_REG_EMAC_MODE, |
2711 | mode); | 2688 | mode); |
2712 | 2689 | ||
2713 | bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed); | 2690 | bnx2x_set_led(params, vars, LED_MODE_OPER, vars->line_speed); |
2714 | return 0; | 2691 | return 0; |
@@ -2723,7 +2700,7 @@ static void bnx2x_set_preemphasis(struct bnx2x_phy *phy, | |||
2723 | 2700 | ||
2724 | for (bank = MDIO_REG_BANK_RX0, i = 0; bank <= MDIO_REG_BANK_RX3; | 2701 | for (bank = MDIO_REG_BANK_RX0, i = 0; bank <= MDIO_REG_BANK_RX3; |
2725 | bank += (MDIO_REG_BANK_RX1-MDIO_REG_BANK_RX0), i++) { | 2702 | bank += (MDIO_REG_BANK_RX1-MDIO_REG_BANK_RX0), i++) { |
2726 | CL45_WR_OVER_CL22(bp, phy, | 2703 | CL22_WR_OVER_CL45(bp, phy, |
2727 | bank, | 2704 | bank, |
2728 | MDIO_RX0_RX_EQ_BOOST, | 2705 | MDIO_RX0_RX_EQ_BOOST, |
2729 | phy->rx_preemphasis[i]); | 2706 | phy->rx_preemphasis[i]); |
@@ -2731,7 +2708,7 @@ static void bnx2x_set_preemphasis(struct bnx2x_phy *phy, | |||
2731 | 2708 | ||
2732 | for (bank = MDIO_REG_BANK_TX0, i = 0; bank <= MDIO_REG_BANK_TX3; | 2709 | for (bank = MDIO_REG_BANK_TX0, i = 0; bank <= MDIO_REG_BANK_TX3; |
2733 | bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0), i++) { | 2710 | bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0), i++) { |
2734 | CL45_WR_OVER_CL22(bp, phy, | 2711 | CL22_WR_OVER_CL45(bp, phy, |
2735 | bank, | 2712 | bank, |
2736 | MDIO_TX0_TX_DRIVER, | 2713 | MDIO_TX0_TX_DRIVER, |
2737 | phy->tx_preemphasis[i]); | 2714 | phy->tx_preemphasis[i]); |
@@ -2754,7 +2731,7 @@ static void bnx2x_init_internal_phy(struct bnx2x_phy *phy, | |||
2754 | /* forced speed requested? */ | 2731 | /* forced speed requested? */ |
2755 | if (vars->line_speed != SPEED_AUTO_NEG || | 2732 | if (vars->line_speed != SPEED_AUTO_NEG || |
2756 | (SINGLE_MEDIA_DIRECT(params) && | 2733 | (SINGLE_MEDIA_DIRECT(params) && |
2757 | params->loopback_mode == LOOPBACK_EXT)) { | 2734 | params->loopback_mode == LOOPBACK_EXT)) { |
2758 | DP(NETIF_MSG_LINK, "not SGMII, no AN\n"); | 2735 | DP(NETIF_MSG_LINK, "not SGMII, no AN\n"); |
2759 | 2736 | ||
2760 | /* disable autoneg */ | 2737 | /* disable autoneg */ |
@@ -2771,7 +2748,7 @@ static void bnx2x_init_internal_phy(struct bnx2x_phy *phy, | |||
2771 | 2748 | ||
2772 | /* program duplex & pause advertisement (for aneg) */ | 2749 | /* program duplex & pause advertisement (for aneg) */ |
2773 | bnx2x_set_ieee_aneg_advertisment(phy, params, | 2750 | bnx2x_set_ieee_aneg_advertisment(phy, params, |
2774 | vars->ieee_fc); | 2751 | vars->ieee_fc); |
2775 | 2752 | ||
2776 | /* enable autoneg */ | 2753 | /* enable autoneg */ |
2777 | bnx2x_set_autoneg(phy, params, vars, enable_cl73); | 2754 | bnx2x_set_autoneg(phy, params, vars, enable_cl73); |
@@ -2842,7 +2819,8 @@ static u8 bnx2x_init_xgxs(struct bnx2x_phy *phy, | |||
2842 | } | 2819 | } |
2843 | 2820 | ||
2844 | static u16 bnx2x_wait_reset_complete(struct bnx2x *bp, | 2821 | static u16 bnx2x_wait_reset_complete(struct bnx2x *bp, |
2845 | struct bnx2x_phy *phy) | 2822 | struct bnx2x_phy *phy, |
2823 | struct link_params *params) | ||
2846 | { | 2824 | { |
2847 | u16 cnt, ctrl; | 2825 | u16 cnt, ctrl; |
2848 | /* Wait for soft reset to get cleared upto 1 sec */ | 2826 | /* Wait for soft reset to get cleared upto 1 sec */ |
@@ -2853,6 +2831,11 @@ static u16 bnx2x_wait_reset_complete(struct bnx2x *bp, | |||
2853 | break; | 2831 | break; |
2854 | msleep(1); | 2832 | msleep(1); |
2855 | } | 2833 | } |
2834 | |||
2835 | if (cnt == 1000) | ||
2836 | netdev_err(bp->dev, "Warning: PHY was not initialized," | ||
2837 | " Port %d\n", | ||
2838 | params->port); | ||
2856 | DP(NETIF_MSG_LINK, "control reg 0x%x (after %d ms)\n", ctrl, cnt); | 2839 | DP(NETIF_MSG_LINK, "control reg 0x%x (after %d ms)\n", ctrl, cnt); |
2857 | return cnt; | 2840 | return cnt; |
2858 | } | 2841 | } |
@@ -2863,9 +2846,7 @@ static void bnx2x_link_int_enable(struct link_params *params) | |||
2863 | u32 mask; | 2846 | u32 mask; |
2864 | struct bnx2x *bp = params->bp; | 2847 | struct bnx2x *bp = params->bp; |
2865 | 2848 | ||
2866 | /* setting the status to report on link up | 2849 | /* Setting the status to report on link up for either XGXS or SerDes */ |
2867 | for either XGXS or SerDes */ | ||
2868 | |||
2869 | if (params->switch_cfg == SWITCH_CFG_10G) { | 2850 | if (params->switch_cfg == SWITCH_CFG_10G) { |
2870 | mask = (NIG_MASK_XGXS0_LINK10G | | 2851 | mask = (NIG_MASK_XGXS0_LINK10G | |
2871 | NIG_MASK_XGXS0_LINK_STATUS); | 2852 | NIG_MASK_XGXS0_LINK_STATUS); |
@@ -2908,7 +2889,7 @@ static void bnx2x_rearm_latch_signal(struct bnx2x *bp, u8 port, | |||
2908 | { | 2889 | { |
2909 | u32 latch_status = 0; | 2890 | u32 latch_status = 0; |
2910 | 2891 | ||
2911 | /** | 2892 | /* |
2912 | * Disable the MI INT ( external phy int ) by writing 1 to the | 2893 | * Disable the MI INT ( external phy int ) by writing 1 to the |
2913 | * status register. Link down indication is high-active-signal, | 2894 | * status register. Link down indication is high-active-signal, |
2914 | * so in this case we need to write the status to clear the XOR | 2895 | * so in this case we need to write the status to clear the XOR |
@@ -2933,27 +2914,30 @@ static void bnx2x_rearm_latch_signal(struct bnx2x *bp, u8 port, | |||
2933 | 2914 | ||
2934 | /* For all latched-signal=up : Re-Arm Latch signals */ | 2915 | /* For all latched-signal=up : Re-Arm Latch signals */ |
2935 | REG_WR(bp, NIG_REG_LATCH_STATUS_0 + port*8, | 2916 | REG_WR(bp, NIG_REG_LATCH_STATUS_0 + port*8, |
2936 | (latch_status & 0xfffe) | (latch_status & 1)); | 2917 | (latch_status & 0xfffe) | (latch_status & 1)); |
2937 | } | 2918 | } |
2938 | /* For all latched-signal=up,Write original_signal to status */ | 2919 | /* For all latched-signal=up,Write original_signal to status */ |
2939 | } | 2920 | } |
2940 | 2921 | ||
2941 | static void bnx2x_link_int_ack(struct link_params *params, | 2922 | static void bnx2x_link_int_ack(struct link_params *params, |
2942 | struct link_vars *vars, u8 is_10g) | 2923 | struct link_vars *vars, u8 is_10g) |
2943 | { | 2924 | { |
2944 | struct bnx2x *bp = params->bp; | 2925 | struct bnx2x *bp = params->bp; |
2945 | u8 port = params->port; | 2926 | u8 port = params->port; |
2946 | 2927 | ||
2947 | /* first reset all status | 2928 | /* |
2948 | * we assume only one line will be change at a time */ | 2929 | * First reset all status we assume only one line will be |
2930 | * change at a time | ||
2931 | */ | ||
2949 | bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, | 2932 | bnx2x_bits_dis(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, |
2950 | (NIG_STATUS_XGXS0_LINK10G | | 2933 | (NIG_STATUS_XGXS0_LINK10G | |
2951 | NIG_STATUS_XGXS0_LINK_STATUS | | 2934 | NIG_STATUS_XGXS0_LINK_STATUS | |
2952 | NIG_STATUS_SERDES0_LINK_STATUS)); | 2935 | NIG_STATUS_SERDES0_LINK_STATUS)); |
2953 | if (vars->phy_link_up) { | 2936 | if (vars->phy_link_up) { |
2954 | if (is_10g) { | 2937 | if (is_10g) { |
2955 | /* Disable the 10G link interrupt | 2938 | /* |
2956 | * by writing 1 to the status register | 2939 | * Disable the 10G link interrupt by writing 1 to the |
2940 | * status register | ||
2957 | */ | 2941 | */ |
2958 | DP(NETIF_MSG_LINK, "10G XGXS phy link up\n"); | 2942 | DP(NETIF_MSG_LINK, "10G XGXS phy link up\n"); |
2959 | bnx2x_bits_en(bp, | 2943 | bnx2x_bits_en(bp, |
@@ -2961,9 +2945,9 @@ static void bnx2x_link_int_ack(struct link_params *params, | |||
2961 | NIG_STATUS_XGXS0_LINK10G); | 2945 | NIG_STATUS_XGXS0_LINK10G); |
2962 | 2946 | ||
2963 | } else if (params->switch_cfg == SWITCH_CFG_10G) { | 2947 | } else if (params->switch_cfg == SWITCH_CFG_10G) { |
2964 | /* Disable the link interrupt | 2948 | /* |
2965 | * by writing 1 to the relevant lane | 2949 | * Disable the link interrupt by writing 1 to the |
2966 | * in the status register | 2950 | * relevant lane in the status register |
2967 | */ | 2951 | */ |
2968 | u32 ser_lane = ((params->lane_config & | 2952 | u32 ser_lane = ((params->lane_config & |
2969 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> | 2953 | PORT_HW_CFG_LANE_SWAP_CFG_MASTER_MASK) >> |
@@ -2978,8 +2962,9 @@ static void bnx2x_link_int_ack(struct link_params *params, | |||
2978 | 2962 | ||
2979 | } else { /* SerDes */ | 2963 | } else { /* SerDes */ |
2980 | DP(NETIF_MSG_LINK, "SerDes phy link up\n"); | 2964 | DP(NETIF_MSG_LINK, "SerDes phy link up\n"); |
2981 | /* Disable the link interrupt | 2965 | /* |
2982 | * by writing 1 to the status register | 2966 | * Disable the link interrupt by writing 1 to the status |
2967 | * register | ||
2983 | */ | 2968 | */ |
2984 | bnx2x_bits_en(bp, | 2969 | bnx2x_bits_en(bp, |
2985 | NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, | 2970 | NIG_REG_STATUS_INTERRUPT_PORT0 + port*4, |
@@ -3059,8 +3044,7 @@ u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, | |||
3059 | } | 3044 | } |
3060 | if ((params->num_phys == MAX_PHYS) && | 3045 | if ((params->num_phys == MAX_PHYS) && |
3061 | (params->phy[EXT_PHY2].ver_addr != 0)) { | 3046 | (params->phy[EXT_PHY2].ver_addr != 0)) { |
3062 | spirom_ver = REG_RD(bp, | 3047 | spirom_ver = REG_RD(bp, params->phy[EXT_PHY2].ver_addr); |
3063 | params->phy[EXT_PHY2].ver_addr); | ||
3064 | if (params->phy[EXT_PHY2].format_fw_ver) { | 3048 | if (params->phy[EXT_PHY2].format_fw_ver) { |
3065 | *ver_p = '/'; | 3049 | *ver_p = '/'; |
3066 | ver_p++; | 3050 | ver_p++; |
@@ -3089,29 +3073,27 @@ static void bnx2x_set_xgxs_loopback(struct bnx2x_phy *phy, | |||
3089 | 3073 | ||
3090 | /* change the uni_phy_addr in the nig */ | 3074 | /* change the uni_phy_addr in the nig */ |
3091 | md_devad = REG_RD(bp, (NIG_REG_XGXS0_CTRL_MD_DEVAD + | 3075 | md_devad = REG_RD(bp, (NIG_REG_XGXS0_CTRL_MD_DEVAD + |
3092 | port*0x18)); | 3076 | port*0x18)); |
3093 | 3077 | ||
3094 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, 0x5); | 3078 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, 0x5); |
3095 | 3079 | ||
3096 | bnx2x_cl45_write(bp, phy, | 3080 | bnx2x_cl45_write(bp, phy, |
3097 | 5, | 3081 | 5, |
3098 | (MDIO_REG_BANK_AER_BLOCK + | 3082 | (MDIO_REG_BANK_AER_BLOCK + |
3099 | (MDIO_AER_BLOCK_AER_REG & 0xf)), | 3083 | (MDIO_AER_BLOCK_AER_REG & 0xf)), |
3100 | 0x2800); | 3084 | 0x2800); |
3101 | 3085 | ||
3102 | bnx2x_cl45_write(bp, phy, | 3086 | bnx2x_cl45_write(bp, phy, |
3103 | 5, | 3087 | 5, |
3104 | (MDIO_REG_BANK_CL73_IEEEB0 + | 3088 | (MDIO_REG_BANK_CL73_IEEEB0 + |
3105 | (MDIO_CL73_IEEEB0_CL73_AN_CONTROL & 0xf)), | 3089 | (MDIO_CL73_IEEEB0_CL73_AN_CONTROL & 0xf)), |
3106 | 0x6041); | 3090 | 0x6041); |
3107 | msleep(200); | 3091 | msleep(200); |
3108 | /* set aer mmd back */ | 3092 | /* set aer mmd back */ |
3109 | bnx2x_set_aer_mmd_xgxs(params, phy); | 3093 | bnx2x_set_aer_mmd_xgxs(params, phy); |
3110 | 3094 | ||
3111 | /* and md_devad */ | 3095 | /* and md_devad */ |
3112 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, | 3096 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, md_devad); |
3113 | md_devad); | ||
3114 | |||
3115 | } else { | 3097 | } else { |
3116 | u16 mii_ctrl; | 3098 | u16 mii_ctrl; |
3117 | DP(NETIF_MSG_LINK, "XGXS 1G loopback enable\n"); | 3099 | DP(NETIF_MSG_LINK, "XGXS 1G loopback enable\n"); |
@@ -3152,26 +3134,26 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3152 | case LED_MODE_OFF: | 3134 | case LED_MODE_OFF: |
3153 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 0); | 3135 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 0); |
3154 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, | 3136 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, |
3155 | SHARED_HW_CFG_LED_MAC1); | 3137 | SHARED_HW_CFG_LED_MAC1); |
3156 | 3138 | ||
3157 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 3139 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
3158 | EMAC_WR(bp, EMAC_REG_EMAC_LED, (tmp | EMAC_LED_OVERRIDE)); | 3140 | EMAC_WR(bp, EMAC_REG_EMAC_LED, (tmp | EMAC_LED_OVERRIDE)); |
3159 | break; | 3141 | break; |
3160 | 3142 | ||
3161 | case LED_MODE_OPER: | 3143 | case LED_MODE_OPER: |
3162 | /** | 3144 | /* |
3163 | * For all other phys, OPER mode is same as ON, so in case | 3145 | * For all other phys, OPER mode is same as ON, so in case |
3164 | * link is down, do nothing | 3146 | * link is down, do nothing |
3165 | **/ | 3147 | */ |
3166 | if (!vars->link_up) | 3148 | if (!vars->link_up) |
3167 | break; | 3149 | break; |
3168 | case LED_MODE_ON: | 3150 | case LED_MODE_ON: |
3169 | if (params->phy[EXT_PHY1].type == | 3151 | if (params->phy[EXT_PHY1].type == |
3170 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 && | 3152 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 && |
3171 | CHIP_IS_E2(bp) && params->num_phys == 2) { | 3153 | CHIP_IS_E2(bp) && params->num_phys == 2) { |
3172 | /** | 3154 | /* |
3173 | * This is a work-around for E2+8727 Configurations | 3155 | * This is a work-around for E2+8727 Configurations |
3174 | */ | 3156 | */ |
3175 | if (mode == LED_MODE_ON || | 3157 | if (mode == LED_MODE_ON || |
3176 | speed == SPEED_10000){ | 3158 | speed == SPEED_10000){ |
3177 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 3159 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
@@ -3183,41 +3165,40 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3183 | return rc; | 3165 | return rc; |
3184 | } | 3166 | } |
3185 | } else if (SINGLE_MEDIA_DIRECT(params)) { | 3167 | } else if (SINGLE_MEDIA_DIRECT(params)) { |
3186 | /** | 3168 | /* |
3187 | * This is a work-around for HW issue found when link | 3169 | * This is a work-around for HW issue found when link |
3188 | * is up in CL73 | 3170 | * is up in CL73 |
3189 | */ | 3171 | */ |
3190 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 3172 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
3191 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); | 3173 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); |
3192 | } else { | 3174 | } else { |
3193 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, | 3175 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, hw_led_mode); |
3194 | hw_led_mode); | ||
3195 | } | 3176 | } |
3196 | 3177 | ||
3197 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + | 3178 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 + port*4, 0); |
3198 | port*4, 0); | ||
3199 | /* Set blinking rate to ~15.9Hz */ | 3179 | /* Set blinking rate to ~15.9Hz */ |
3200 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_P0 + port*4, | 3180 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_P0 + port*4, |
3201 | LED_BLINK_RATE_VAL); | 3181 | LED_BLINK_RATE_VAL); |
3202 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + | 3182 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + |
3203 | port*4, 1); | 3183 | port*4, 1); |
3204 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 3184 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
3205 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | 3185 | EMAC_WR(bp, EMAC_REG_EMAC_LED, (tmp & (~EMAC_LED_OVERRIDE))); |
3206 | (tmp & (~EMAC_LED_OVERRIDE))); | ||
3207 | 3186 | ||
3208 | if (CHIP_IS_E1(bp) && | 3187 | if (CHIP_IS_E1(bp) && |
3209 | ((speed == SPEED_2500) || | 3188 | ((speed == SPEED_2500) || |
3210 | (speed == SPEED_1000) || | 3189 | (speed == SPEED_1000) || |
3211 | (speed == SPEED_100) || | 3190 | (speed == SPEED_100) || |
3212 | (speed == SPEED_10))) { | 3191 | (speed == SPEED_10))) { |
3213 | /* On Everest 1 Ax chip versions for speeds less than | 3192 | /* |
3214 | 10G LED scheme is different */ | 3193 | * On Everest 1 Ax chip versions for speeds less than |
3194 | * 10G LED scheme is different | ||
3195 | */ | ||
3215 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 | 3196 | REG_WR(bp, NIG_REG_LED_CONTROL_OVERRIDE_TRAFFIC_P0 |
3216 | + port*4, 1); | 3197 | + port*4, 1); |
3217 | REG_WR(bp, NIG_REG_LED_CONTROL_TRAFFIC_P0 + | 3198 | REG_WR(bp, NIG_REG_LED_CONTROL_TRAFFIC_P0 + |
3218 | port*4, 0); | 3199 | port*4, 0); |
3219 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_TRAFFIC_P0 + | 3200 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_TRAFFIC_P0 + |
3220 | port*4, 1); | 3201 | port*4, 1); |
3221 | } | 3202 | } |
3222 | break; | 3203 | break; |
3223 | 3204 | ||
@@ -3231,7 +3212,7 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3231 | 3212 | ||
3232 | } | 3213 | } |
3233 | 3214 | ||
3234 | /** | 3215 | /* |
3235 | * This function comes to reflect the actual link state read DIRECTLY from the | 3216 | * This function comes to reflect the actual link state read DIRECTLY from the |
3236 | * HW | 3217 | * HW |
3237 | */ | 3218 | */ |
@@ -3243,10 +3224,10 @@ u8 bnx2x_test_link(struct link_params *params, struct link_vars *vars, | |||
3243 | u8 ext_phy_link_up = 0, serdes_phy_type; | 3224 | u8 ext_phy_link_up = 0, serdes_phy_type; |
3244 | struct link_vars temp_vars; | 3225 | struct link_vars temp_vars; |
3245 | 3226 | ||
3246 | CL45_RD_OVER_CL22(bp, ¶ms->phy[INT_PHY], | 3227 | CL22_RD_OVER_CL45(bp, ¶ms->phy[INT_PHY], |
3247 | MDIO_REG_BANK_GP_STATUS, | 3228 | MDIO_REG_BANK_GP_STATUS, |
3248 | MDIO_GP_STATUS_TOP_AN_STATUS1, | 3229 | MDIO_GP_STATUS_TOP_AN_STATUS1, |
3249 | &gp_status); | 3230 | &gp_status); |
3250 | /* link is up only if both local phy and external phy are up */ | 3231 | /* link is up only if both local phy and external phy are up */ |
3251 | if (!(gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS)) | 3232 | if (!(gp_status & MDIO_GP_STATUS_TOP_AN_STATUS1_LINK_STATUS)) |
3252 | return -ESRCH; | 3233 | return -ESRCH; |
@@ -3290,15 +3271,15 @@ static u8 bnx2x_link_initialize(struct link_params *params, | |||
3290 | u8 rc = 0; | 3271 | u8 rc = 0; |
3291 | u8 phy_index, non_ext_phy; | 3272 | u8 phy_index, non_ext_phy; |
3292 | struct bnx2x *bp = params->bp; | 3273 | struct bnx2x *bp = params->bp; |
3293 | /** | 3274 | /* |
3294 | * In case of external phy existence, the line speed would be the | 3275 | * In case of external phy existence, the line speed would be the |
3295 | * line speed linked up by the external phy. In case it is direct | 3276 | * line speed linked up by the external phy. In case it is direct |
3296 | * only, then the line_speed during initialization will be | 3277 | * only, then the line_speed during initialization will be |
3297 | * equal to the req_line_speed | 3278 | * equal to the req_line_speed |
3298 | */ | 3279 | */ |
3299 | vars->line_speed = params->phy[INT_PHY].req_line_speed; | 3280 | vars->line_speed = params->phy[INT_PHY].req_line_speed; |
3300 | 3281 | ||
3301 | /** | 3282 | /* |
3302 | * Initialize the internal phy in case this is a direct board | 3283 | * Initialize the internal phy in case this is a direct board |
3303 | * (no external phys), or this board has external phy which requires | 3284 | * (no external phys), or this board has external phy which requires |
3304 | * to first. | 3285 | * to first. |
@@ -3326,17 +3307,16 @@ static u8 bnx2x_link_initialize(struct link_params *params, | |||
3326 | if (!non_ext_phy) | 3307 | if (!non_ext_phy) |
3327 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 3308 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
3328 | phy_index++) { | 3309 | phy_index++) { |
3329 | /** | 3310 | /* |
3330 | * No need to initialize second phy in case of first | 3311 | * No need to initialize second phy in case of first |
3331 | * phy only selection. In case of second phy, we do | 3312 | * phy only selection. In case of second phy, we do |
3332 | * need to initialize the first phy, since they are | 3313 | * need to initialize the first phy, since they are |
3333 | * connected. | 3314 | * connected. |
3334 | **/ | 3315 | */ |
3335 | if (phy_index == EXT_PHY2 && | 3316 | if (phy_index == EXT_PHY2 && |
3336 | (bnx2x_phy_selection(params) == | 3317 | (bnx2x_phy_selection(params) == |
3337 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY)) { | 3318 | PORT_HW_CFG_PHY_SELECTION_FIRST_PHY)) { |
3338 | DP(NETIF_MSG_LINK, "Not initializing" | 3319 | DP(NETIF_MSG_LINK, "Ignoring second phy\n"); |
3339 | "second phy\n"); | ||
3340 | continue; | 3320 | continue; |
3341 | } | 3321 | } |
3342 | params->phy[phy_index].config_init( | 3322 | params->phy[phy_index].config_init( |
@@ -3358,9 +3338,8 @@ static void bnx2x_int_link_reset(struct bnx2x_phy *phy, | |||
3358 | struct link_params *params) | 3338 | struct link_params *params) |
3359 | { | 3339 | { |
3360 | /* reset the SerDes/XGXS */ | 3340 | /* reset the SerDes/XGXS */ |
3361 | REG_WR(params->bp, GRCBASE_MISC + | 3341 | REG_WR(params->bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, |
3362 | MISC_REGISTERS_RESET_REG_3_CLEAR, | 3342 | (0x1ff << (params->port*16))); |
3363 | (0x1ff << (params->port*16))); | ||
3364 | } | 3343 | } |
3365 | 3344 | ||
3366 | static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy, | 3345 | static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy, |
@@ -3374,11 +3353,11 @@ static void bnx2x_common_ext_link_reset(struct bnx2x_phy *phy, | |||
3374 | else | 3353 | else |
3375 | gpio_port = params->port; | 3354 | gpio_port = params->port; |
3376 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | 3355 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
3377 | MISC_REGISTERS_GPIO_OUTPUT_LOW, | 3356 | MISC_REGISTERS_GPIO_OUTPUT_LOW, |
3378 | gpio_port); | 3357 | gpio_port); |
3379 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 3358 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
3380 | MISC_REGISTERS_GPIO_OUTPUT_LOW, | 3359 | MISC_REGISTERS_GPIO_OUTPUT_LOW, |
3381 | gpio_port); | 3360 | gpio_port); |
3382 | DP(NETIF_MSG_LINK, "reset external PHY\n"); | 3361 | DP(NETIF_MSG_LINK, "reset external PHY\n"); |
3383 | } | 3362 | } |
3384 | 3363 | ||
@@ -3409,9 +3388,8 @@ static u8 bnx2x_update_link_down(struct link_params *params, | |||
3409 | 3388 | ||
3410 | /* reset BigMac */ | 3389 | /* reset BigMac */ |
3411 | bnx2x_bmac_rx_disable(bp, params->port); | 3390 | bnx2x_bmac_rx_disable(bp, params->port); |
3412 | REG_WR(bp, GRCBASE_MISC + | 3391 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, |
3413 | MISC_REGISTERS_RESET_REG_2_CLEAR, | 3392 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); |
3414 | (MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port)); | ||
3415 | return 0; | 3393 | return 0; |
3416 | } | 3394 | } |
3417 | 3395 | ||
@@ -3462,7 +3440,7 @@ static u8 bnx2x_update_link_up(struct link_params *params, | |||
3462 | msleep(20); | 3440 | msleep(20); |
3463 | return rc; | 3441 | return rc; |
3464 | } | 3442 | } |
3465 | /** | 3443 | /* |
3466 | * The bnx2x_link_update function should be called upon link | 3444 | * The bnx2x_link_update function should be called upon link |
3467 | * interrupt. | 3445 | * interrupt. |
3468 | * Link is considered up as follows: | 3446 | * Link is considered up as follows: |
@@ -3501,12 +3479,11 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3501 | REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4)); | 3479 | REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4)); |
3502 | 3480 | ||
3503 | is_mi_int = (u8)(REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + | 3481 | is_mi_int = (u8)(REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + |
3504 | port*0x18) > 0); | 3482 | port*0x18) > 0); |
3505 | DP(NETIF_MSG_LINK, "int_mask 0x%x MI_INT %x, SERDES_LINK %x\n", | 3483 | DP(NETIF_MSG_LINK, "int_mask 0x%x MI_INT %x, SERDES_LINK %x\n", |
3506 | REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4), | 3484 | REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4), |
3507 | is_mi_int, | 3485 | is_mi_int, |
3508 | REG_RD(bp, | 3486 | REG_RD(bp, NIG_REG_SERDES0_STATUS_LINK_STATUS + port*0x3c)); |
3509 | NIG_REG_SERDES0_STATUS_LINK_STATUS + port*0x3c)); | ||
3510 | 3487 | ||
3511 | DP(NETIF_MSG_LINK, " 10G %x, XGXS_LINK %x\n", | 3488 | DP(NETIF_MSG_LINK, " 10G %x, XGXS_LINK %x\n", |
3512 | REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK10G + port*0x68), | 3489 | REG_RD(bp, NIG_REG_XGXS0_STATUS_LINK10G + port*0x68), |
@@ -3515,14 +3492,14 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3515 | /* disable emac */ | 3492 | /* disable emac */ |
3516 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0); | 3493 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 0); |
3517 | 3494 | ||
3518 | /** | 3495 | /* |
3519 | * Step 1: | 3496 | * Step 1: |
3520 | * Check external link change only for external phys, and apply | 3497 | * Check external link change only for external phys, and apply |
3521 | * priority selection between them in case the link on both phys | 3498 | * priority selection between them in case the link on both phys |
3522 | * is up. Note that the instead of the common vars, a temporary | 3499 | * is up. Note that the instead of the common vars, a temporary |
3523 | * vars argument is used since each phy may have different link/ | 3500 | * vars argument is used since each phy may have different link/ |
3524 | * speed/duplex result | 3501 | * speed/duplex result |
3525 | */ | 3502 | */ |
3526 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 3503 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
3527 | phy_index++) { | 3504 | phy_index++) { |
3528 | struct bnx2x_phy *phy = ¶ms->phy[phy_index]; | 3505 | struct bnx2x_phy *phy = ¶ms->phy[phy_index]; |
@@ -3547,22 +3524,22 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3547 | switch (bnx2x_phy_selection(params)) { | 3524 | switch (bnx2x_phy_selection(params)) { |
3548 | case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT: | 3525 | case PORT_HW_CFG_PHY_SELECTION_HARDWARE_DEFAULT: |
3549 | case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY: | 3526 | case PORT_HW_CFG_PHY_SELECTION_FIRST_PHY_PRIORITY: |
3550 | /** | 3527 | /* |
3551 | * In this option, the first PHY makes sure to pass the | 3528 | * In this option, the first PHY makes sure to pass the |
3552 | * traffic through itself only. | 3529 | * traffic through itself only. |
3553 | * Its not clear how to reset the link on the second phy | 3530 | * Its not clear how to reset the link on the second phy |
3554 | **/ | 3531 | */ |
3555 | active_external_phy = EXT_PHY1; | 3532 | active_external_phy = EXT_PHY1; |
3556 | break; | 3533 | break; |
3557 | case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY: | 3534 | case PORT_HW_CFG_PHY_SELECTION_SECOND_PHY_PRIORITY: |
3558 | /** | 3535 | /* |
3559 | * In this option, the first PHY makes sure to pass the | 3536 | * In this option, the first PHY makes sure to pass the |
3560 | * traffic through the second PHY. | 3537 | * traffic through the second PHY. |
3561 | **/ | 3538 | */ |
3562 | active_external_phy = EXT_PHY2; | 3539 | active_external_phy = EXT_PHY2; |
3563 | break; | 3540 | break; |
3564 | default: | 3541 | default: |
3565 | /** | 3542 | /* |
3566 | * Link indication on both PHYs with the following cases | 3543 | * Link indication on both PHYs with the following cases |
3567 | * is invalid: | 3544 | * is invalid: |
3568 | * - FIRST_PHY means that second phy wasn't initialized, | 3545 | * - FIRST_PHY means that second phy wasn't initialized, |
@@ -3570,7 +3547,7 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3570 | * - SECOND_PHY means that first phy should not be able | 3547 | * - SECOND_PHY means that first phy should not be able |
3571 | * to link up by itself (using configuration) | 3548 | * to link up by itself (using configuration) |
3572 | * - DEFAULT should be overriden during initialiazation | 3549 | * - DEFAULT should be overriden during initialiazation |
3573 | **/ | 3550 | */ |
3574 | DP(NETIF_MSG_LINK, "Invalid link indication" | 3551 | DP(NETIF_MSG_LINK, "Invalid link indication" |
3575 | "mpc=0x%x. DISABLING LINK !!!\n", | 3552 | "mpc=0x%x. DISABLING LINK !!!\n", |
3576 | params->multi_phy_config); | 3553 | params->multi_phy_config); |
@@ -3580,18 +3557,18 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3580 | } | 3557 | } |
3581 | } | 3558 | } |
3582 | prev_line_speed = vars->line_speed; | 3559 | prev_line_speed = vars->line_speed; |
3583 | /** | 3560 | /* |
3584 | * Step 2: | 3561 | * Step 2: |
3585 | * Read the status of the internal phy. In case of | 3562 | * Read the status of the internal phy. In case of |
3586 | * DIRECT_SINGLE_MEDIA board, this link is the external link, | 3563 | * DIRECT_SINGLE_MEDIA board, this link is the external link, |
3587 | * otherwise this is the link between the 577xx and the first | 3564 | * otherwise this is the link between the 577xx and the first |
3588 | * external phy | 3565 | * external phy |
3589 | */ | 3566 | */ |
3590 | if (params->phy[INT_PHY].read_status) | 3567 | if (params->phy[INT_PHY].read_status) |
3591 | params->phy[INT_PHY].read_status( | 3568 | params->phy[INT_PHY].read_status( |
3592 | ¶ms->phy[INT_PHY], | 3569 | ¶ms->phy[INT_PHY], |
3593 | params, vars); | 3570 | params, vars); |
3594 | /** | 3571 | /* |
3595 | * The INT_PHY flow control reside in the vars. This include the | 3572 | * The INT_PHY flow control reside in the vars. This include the |
3596 | * case where the speed or flow control are not set to AUTO. | 3573 | * case where the speed or flow control are not set to AUTO. |
3597 | * Otherwise, the active external phy flow control result is set | 3574 | * Otherwise, the active external phy flow control result is set |
@@ -3601,13 +3578,13 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3601 | */ | 3578 | */ |
3602 | if (active_external_phy > INT_PHY) { | 3579 | if (active_external_phy > INT_PHY) { |
3603 | vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; | 3580 | vars->flow_ctrl = phy_vars[active_external_phy].flow_ctrl; |
3604 | /** | 3581 | /* |
3605 | * Link speed is taken from the XGXS. AN and FC result from | 3582 | * Link speed is taken from the XGXS. AN and FC result from |
3606 | * the external phy. | 3583 | * the external phy. |
3607 | */ | 3584 | */ |
3608 | vars->link_status |= phy_vars[active_external_phy].link_status; | 3585 | vars->link_status |= phy_vars[active_external_phy].link_status; |
3609 | 3586 | ||
3610 | /** | 3587 | /* |
3611 | * if active_external_phy is first PHY and link is up - disable | 3588 | * if active_external_phy is first PHY and link is up - disable |
3612 | * disable TX on second external PHY | 3589 | * disable TX on second external PHY |
3613 | */ | 3590 | */ |
@@ -3643,7 +3620,7 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3643 | DP(NETIF_MSG_LINK, "vars->flow_ctrl = 0x%x, vars->link_status = 0x%x," | 3620 | DP(NETIF_MSG_LINK, "vars->flow_ctrl = 0x%x, vars->link_status = 0x%x," |
3644 | " ext_phy_line_speed = %d\n", vars->flow_ctrl, | 3621 | " ext_phy_line_speed = %d\n", vars->flow_ctrl, |
3645 | vars->link_status, ext_phy_line_speed); | 3622 | vars->link_status, ext_phy_line_speed); |
3646 | /** | 3623 | /* |
3647 | * Upon link speed change set the NIG into drain mode. Comes to | 3624 | * Upon link speed change set the NIG into drain mode. Comes to |
3648 | * deals with possible FIFO glitch due to clk change when speed | 3625 | * deals with possible FIFO glitch due to clk change when speed |
3649 | * is decreased without link down indicator | 3626 | * is decreased without link down indicator |
@@ -3658,8 +3635,8 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3658 | ext_phy_line_speed); | 3635 | ext_phy_line_speed); |
3659 | vars->phy_link_up = 0; | 3636 | vars->phy_link_up = 0; |
3660 | } else if (prev_line_speed != vars->line_speed) { | 3637 | } else if (prev_line_speed != vars->line_speed) { |
3661 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE | 3638 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, |
3662 | + params->port*4, 0); | 3639 | 0); |
3663 | msleep(1); | 3640 | msleep(1); |
3664 | } | 3641 | } |
3665 | } | 3642 | } |
@@ -3674,14 +3651,14 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3674 | 3651 | ||
3675 | bnx2x_link_int_ack(params, vars, link_10g); | 3652 | bnx2x_link_int_ack(params, vars, link_10g); |
3676 | 3653 | ||
3677 | /** | 3654 | /* |
3678 | * In case external phy link is up, and internal link is down | 3655 | * In case external phy link is up, and internal link is down |
3679 | * (not initialized yet probably after link initialization, it | 3656 | * (not initialized yet probably after link initialization, it |
3680 | * needs to be initialized. | 3657 | * needs to be initialized. |
3681 | * Note that after link down-up as result of cable plug, the xgxs | 3658 | * Note that after link down-up as result of cable plug, the xgxs |
3682 | * link would probably become up again without the need | 3659 | * link would probably become up again without the need |
3683 | * initialize it | 3660 | * initialize it |
3684 | */ | 3661 | */ |
3685 | if (!(SINGLE_MEDIA_DIRECT(params))) { | 3662 | if (!(SINGLE_MEDIA_DIRECT(params))) { |
3686 | DP(NETIF_MSG_LINK, "ext_phy_link_up = %d, int_link_up = %d," | 3663 | DP(NETIF_MSG_LINK, "ext_phy_link_up = %d, int_link_up = %d," |
3687 | " init_preceding = %d\n", ext_phy_link_up, | 3664 | " init_preceding = %d\n", ext_phy_link_up, |
@@ -3701,9 +3678,9 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3701 | vars); | 3678 | vars); |
3702 | } | 3679 | } |
3703 | } | 3680 | } |
3704 | /** | 3681 | /* |
3705 | * Link is up only if both local phy and external phy (in case of | 3682 | * Link is up only if both local phy and external phy (in case of |
3706 | * non-direct board) are up | 3683 | * non-direct board) are up |
3707 | */ | 3684 | */ |
3708 | vars->link_up = (vars->phy_link_up && | 3685 | vars->link_up = (vars->phy_link_up && |
3709 | (ext_phy_link_up || | 3686 | (ext_phy_link_up || |
@@ -3724,10 +3701,10 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
3724 | void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port) | 3701 | void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port) |
3725 | { | 3702 | { |
3726 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | 3703 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
3727 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); | 3704 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); |
3728 | msleep(1); | 3705 | msleep(1); |
3729 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | 3706 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
3730 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, port); | 3707 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, port); |
3731 | } | 3708 | } |
3732 | 3709 | ||
3733 | static void bnx2x_save_spirom_version(struct bnx2x *bp, u8 port, | 3710 | static void bnx2x_save_spirom_version(struct bnx2x *bp, u8 port, |
@@ -3747,9 +3724,9 @@ static void bnx2x_save_bcm_spirom_ver(struct bnx2x *bp, | |||
3747 | u16 fw_ver1, fw_ver2; | 3724 | u16 fw_ver1, fw_ver2; |
3748 | 3725 | ||
3749 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, | 3726 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, |
3750 | MDIO_PMA_REG_ROM_VER1, &fw_ver1); | 3727 | MDIO_PMA_REG_ROM_VER1, &fw_ver1); |
3751 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, | 3728 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, |
3752 | MDIO_PMA_REG_ROM_VER2, &fw_ver2); | 3729 | MDIO_PMA_REG_ROM_VER2, &fw_ver2); |
3753 | bnx2x_save_spirom_version(bp, port, (u32)(fw_ver1<<16 | fw_ver2), | 3730 | bnx2x_save_spirom_version(bp, port, (u32)(fw_ver1<<16 | fw_ver2), |
3754 | phy->ver_addr); | 3731 | phy->ver_addr); |
3755 | } | 3732 | } |
@@ -3770,7 +3747,7 @@ static void bnx2x_ext_phy_set_pause(struct link_params *params, | |||
3770 | if ((vars->ieee_fc & | 3747 | if ((vars->ieee_fc & |
3771 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC) == | 3748 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC) == |
3772 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC) { | 3749 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC) { |
3773 | val |= MDIO_AN_REG_ADV_PAUSE_ASYMMETRIC; | 3750 | val |= MDIO_AN_REG_ADV_PAUSE_ASYMMETRIC; |
3774 | } | 3751 | } |
3775 | if ((vars->ieee_fc & | 3752 | if ((vars->ieee_fc & |
3776 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) == | 3753 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) == |
@@ -3801,11 +3778,11 @@ static u8 bnx2x_ext_phy_resolve_fc(struct bnx2x_phy *phy, | |||
3801 | else if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { | 3778 | else if (vars->link_status & LINK_STATUS_AUTO_NEGOTIATE_COMPLETE) { |
3802 | ret = 1; | 3779 | ret = 1; |
3803 | bnx2x_cl45_read(bp, phy, | 3780 | bnx2x_cl45_read(bp, phy, |
3804 | MDIO_AN_DEVAD, | 3781 | MDIO_AN_DEVAD, |
3805 | MDIO_AN_REG_ADV_PAUSE, &ld_pause); | 3782 | MDIO_AN_REG_ADV_PAUSE, &ld_pause); |
3806 | bnx2x_cl45_read(bp, phy, | 3783 | bnx2x_cl45_read(bp, phy, |
3807 | MDIO_AN_DEVAD, | 3784 | MDIO_AN_DEVAD, |
3808 | MDIO_AN_REG_LP_AUTO_NEG, &lp_pause); | 3785 | MDIO_AN_REG_LP_AUTO_NEG, &lp_pause); |
3809 | pause_result = (ld_pause & | 3786 | pause_result = (ld_pause & |
3810 | MDIO_AN_REG_ADV_PAUSE_MASK) >> 8; | 3787 | MDIO_AN_REG_ADV_PAUSE_MASK) >> 8; |
3811 | pause_result |= (lp_pause & | 3788 | pause_result |= (lp_pause & |
@@ -3881,31 +3858,31 @@ static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, | |||
3881 | /* Boot port from external ROM */ | 3858 | /* Boot port from external ROM */ |
3882 | /* EDC grst */ | 3859 | /* EDC grst */ |
3883 | bnx2x_cl45_write(bp, phy, | 3860 | bnx2x_cl45_write(bp, phy, |
3884 | MDIO_PMA_DEVAD, | 3861 | MDIO_PMA_DEVAD, |
3885 | MDIO_PMA_REG_GEN_CTRL, | 3862 | MDIO_PMA_REG_GEN_CTRL, |
3886 | 0x0001); | 3863 | 0x0001); |
3887 | 3864 | ||
3888 | /* ucode reboot and rst */ | 3865 | /* ucode reboot and rst */ |
3889 | bnx2x_cl45_write(bp, phy, | 3866 | bnx2x_cl45_write(bp, phy, |
3890 | MDIO_PMA_DEVAD, | 3867 | MDIO_PMA_DEVAD, |
3891 | MDIO_PMA_REG_GEN_CTRL, | 3868 | MDIO_PMA_REG_GEN_CTRL, |
3892 | 0x008c); | 3869 | 0x008c); |
3893 | 3870 | ||
3894 | bnx2x_cl45_write(bp, phy, | 3871 | bnx2x_cl45_write(bp, phy, |
3895 | MDIO_PMA_DEVAD, | 3872 | MDIO_PMA_DEVAD, |
3896 | MDIO_PMA_REG_MISC_CTRL1, 0x0001); | 3873 | MDIO_PMA_REG_MISC_CTRL1, 0x0001); |
3897 | 3874 | ||
3898 | /* Reset internal microprocessor */ | 3875 | /* Reset internal microprocessor */ |
3899 | bnx2x_cl45_write(bp, phy, | 3876 | bnx2x_cl45_write(bp, phy, |
3900 | MDIO_PMA_DEVAD, | 3877 | MDIO_PMA_DEVAD, |
3901 | MDIO_PMA_REG_GEN_CTRL, | 3878 | MDIO_PMA_REG_GEN_CTRL, |
3902 | MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET); | 3879 | MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET); |
3903 | 3880 | ||
3904 | /* Release srst bit */ | 3881 | /* Release srst bit */ |
3905 | bnx2x_cl45_write(bp, phy, | 3882 | bnx2x_cl45_write(bp, phy, |
3906 | MDIO_PMA_DEVAD, | 3883 | MDIO_PMA_DEVAD, |
3907 | MDIO_PMA_REG_GEN_CTRL, | 3884 | MDIO_PMA_REG_GEN_CTRL, |
3908 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); | 3885 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); |
3909 | 3886 | ||
3910 | /* Delay 100ms per the PHY specifications */ | 3887 | /* Delay 100ms per the PHY specifications */ |
3911 | msleep(100); | 3888 | msleep(100); |
@@ -3936,8 +3913,8 @@ static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, | |||
3936 | 3913 | ||
3937 | /* Clear ser_boot_ctl bit */ | 3914 | /* Clear ser_boot_ctl bit */ |
3938 | bnx2x_cl45_write(bp, phy, | 3915 | bnx2x_cl45_write(bp, phy, |
3939 | MDIO_PMA_DEVAD, | 3916 | MDIO_PMA_DEVAD, |
3940 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); | 3917 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); |
3941 | bnx2x_save_bcm_spirom_ver(bp, phy, port); | 3918 | bnx2x_save_bcm_spirom_ver(bp, phy, port); |
3942 | 3919 | ||
3943 | DP(NETIF_MSG_LINK, | 3920 | DP(NETIF_MSG_LINK, |
@@ -3958,8 +3935,8 @@ static u8 bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
3958 | 3935 | ||
3959 | /* Read 8073 HW revision*/ | 3936 | /* Read 8073 HW revision*/ |
3960 | bnx2x_cl45_read(bp, phy, | 3937 | bnx2x_cl45_read(bp, phy, |
3961 | MDIO_PMA_DEVAD, | 3938 | MDIO_PMA_DEVAD, |
3962 | MDIO_PMA_REG_8073_CHIP_REV, &val); | 3939 | MDIO_PMA_REG_8073_CHIP_REV, &val); |
3963 | 3940 | ||
3964 | if (val != 1) { | 3941 | if (val != 1) { |
3965 | /* No need to workaround in 8073 A1 */ | 3942 | /* No need to workaround in 8073 A1 */ |
@@ -3967,8 +3944,8 @@ static u8 bnx2x_8073_is_snr_needed(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
3967 | } | 3944 | } |
3968 | 3945 | ||
3969 | bnx2x_cl45_read(bp, phy, | 3946 | bnx2x_cl45_read(bp, phy, |
3970 | MDIO_PMA_DEVAD, | 3947 | MDIO_PMA_DEVAD, |
3971 | MDIO_PMA_REG_ROM_VER2, &val); | 3948 | MDIO_PMA_REG_ROM_VER2, &val); |
3972 | 3949 | ||
3973 | /* SNR should be applied only for version 0x102 */ | 3950 | /* SNR should be applied only for version 0x102 */ |
3974 | if (val != 0x102) | 3951 | if (val != 0x102) |
@@ -3982,8 +3959,8 @@ static u8 bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
3982 | u16 val, cnt, cnt1 ; | 3959 | u16 val, cnt, cnt1 ; |
3983 | 3960 | ||
3984 | bnx2x_cl45_read(bp, phy, | 3961 | bnx2x_cl45_read(bp, phy, |
3985 | MDIO_PMA_DEVAD, | 3962 | MDIO_PMA_DEVAD, |
3986 | MDIO_PMA_REG_8073_CHIP_REV, &val); | 3963 | MDIO_PMA_REG_8073_CHIP_REV, &val); |
3987 | 3964 | ||
3988 | if (val > 0) { | 3965 | if (val > 0) { |
3989 | /* No need to workaround in 8073 A1 */ | 3966 | /* No need to workaround in 8073 A1 */ |
@@ -3991,26 +3968,32 @@ static u8 bnx2x_8073_xaui_wa(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
3991 | } | 3968 | } |
3992 | /* XAUI workaround in 8073 A0: */ | 3969 | /* XAUI workaround in 8073 A0: */ |
3993 | 3970 | ||
3994 | /* After loading the boot ROM and restarting Autoneg, | 3971 | /* |
3995 | poll Dev1, Reg $C820: */ | 3972 | * After loading the boot ROM and restarting Autoneg, poll |
3973 | * Dev1, Reg $C820: | ||
3974 | */ | ||
3996 | 3975 | ||
3997 | for (cnt = 0; cnt < 1000; cnt++) { | 3976 | for (cnt = 0; cnt < 1000; cnt++) { |
3998 | bnx2x_cl45_read(bp, phy, | 3977 | bnx2x_cl45_read(bp, phy, |
3999 | MDIO_PMA_DEVAD, | 3978 | MDIO_PMA_DEVAD, |
4000 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, | 3979 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, |
4001 | &val); | 3980 | &val); |
4002 | /* If bit [14] = 0 or bit [13] = 0, continue on with | 3981 | /* |
4003 | system initialization (XAUI work-around not required, | 3982 | * If bit [14] = 0 or bit [13] = 0, continue on with |
4004 | as these bits indicate 2.5G or 1G link up). */ | 3983 | * system initialization (XAUI work-around not required, as |
3984 | * these bits indicate 2.5G or 1G link up). | ||
3985 | */ | ||
4005 | if (!(val & (1<<14)) || !(val & (1<<13))) { | 3986 | if (!(val & (1<<14)) || !(val & (1<<13))) { |
4006 | DP(NETIF_MSG_LINK, "XAUI work-around not required\n"); | 3987 | DP(NETIF_MSG_LINK, "XAUI work-around not required\n"); |
4007 | return 0; | 3988 | return 0; |
4008 | } else if (!(val & (1<<15))) { | 3989 | } else if (!(val & (1<<15))) { |
4009 | DP(NETIF_MSG_LINK, "clc bit 15 went off\n"); | 3990 | DP(NETIF_MSG_LINK, "bit 15 went off\n"); |
4010 | /* If bit 15 is 0, then poll Dev1, Reg $C841 until | 3991 | /* |
4011 | it's MSB (bit 15) goes to 1 (indicating that the | 3992 | * If bit 15 is 0, then poll Dev1, Reg $C841 until it's |
4012 | XAUI workaround has completed), | 3993 | * MSB (bit15) goes to 1 (indicating that the XAUI |
4013 | then continue on with system initialization.*/ | 3994 | * workaround has completed), then continue on with |
3995 | * system initialization. | ||
3996 | */ | ||
4014 | for (cnt1 = 0; cnt1 < 1000; cnt1++) { | 3997 | for (cnt1 = 0; cnt1 < 1000; cnt1++) { |
4015 | bnx2x_cl45_read(bp, phy, | 3998 | bnx2x_cl45_read(bp, phy, |
4016 | MDIO_PMA_DEVAD, | 3999 | MDIO_PMA_DEVAD, |
@@ -4093,10 +4076,10 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4093 | gpio_port = params->port; | 4076 | gpio_port = params->port; |
4094 | /* Restore normal power mode*/ | 4077 | /* Restore normal power mode*/ |
4095 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 4078 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
4096 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port); | 4079 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port); |
4097 | 4080 | ||
4098 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | 4081 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
4099 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port); | 4082 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, gpio_port); |
4100 | 4083 | ||
4101 | /* enable LASI */ | 4084 | /* enable LASI */ |
4102 | bnx2x_cl45_write(bp, phy, | 4085 | bnx2x_cl45_write(bp, phy, |
@@ -4114,10 +4097,6 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4114 | 4097 | ||
4115 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); | 4098 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); |
4116 | 4099 | ||
4117 | /** | ||
4118 | * If this is forced speed, set to KR or KX (all other are not | ||
4119 | * supported) | ||
4120 | */ | ||
4121 | /* Swap polarity if required - Must be done only in non-1G mode */ | 4100 | /* Swap polarity if required - Must be done only in non-1G mode */ |
4122 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | 4101 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { |
4123 | /* Configure the 8073 to swap _P and _N of the KR lines */ | 4102 | /* Configure the 8073 to swap _P and _N of the KR lines */ |
@@ -4160,8 +4139,10 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4160 | val = (1<<7); | 4139 | val = (1<<7); |
4161 | } else if (phy->req_line_speed == SPEED_2500) { | 4140 | } else if (phy->req_line_speed == SPEED_2500) { |
4162 | val = (1<<5); | 4141 | val = (1<<5); |
4163 | /* Note that 2.5G works only | 4142 | /* |
4164 | when used with 1G advertisment */ | 4143 | * Note that 2.5G works only when used with 1G |
4144 | * advertisment | ||
4145 | */ | ||
4165 | } else | 4146 | } else |
4166 | val = (1<<5); | 4147 | val = (1<<5); |
4167 | } else { | 4148 | } else { |
@@ -4170,8 +4151,7 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4170 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) | 4151 | PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) |
4171 | val |= (1<<7); | 4152 | val |= (1<<7); |
4172 | 4153 | ||
4173 | /* Note that 2.5G works only when | 4154 | /* Note that 2.5G works only when used with 1G advertisment */ |
4174 | used with 1G advertisment */ | ||
4175 | if (phy->speed_cap_mask & | 4155 | if (phy->speed_cap_mask & |
4176 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | | 4156 | (PORT_HW_CFG_SPEED_CAPABILITY_D0_1G | |
4177 | PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) | 4157 | PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G)) |
@@ -4211,9 +4191,11 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4211 | /* Add support for CL37 (passive mode) III */ | 4191 | /* Add support for CL37 (passive mode) III */ |
4212 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); | 4192 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); |
4213 | 4193 | ||
4214 | /* The SNR will improve about 2db by changing | 4194 | /* |
4215 | BW and FEE main tap. Rest commands are executed | 4195 | * The SNR will improve about 2db by changing BW and FEE main |
4216 | after link is up*/ | 4196 | * tap. Rest commands are executed after link is up |
4197 | * Change FFE main cursor to 5 in EDC register | ||
4198 | */ | ||
4217 | if (bnx2x_8073_is_snr_needed(bp, phy)) | 4199 | if (bnx2x_8073_is_snr_needed(bp, phy)) |
4218 | bnx2x_cl45_write(bp, phy, | 4200 | bnx2x_cl45_write(bp, phy, |
4219 | MDIO_PMA_DEVAD, MDIO_PMA_REG_EDC_FFE_MAIN, | 4201 | MDIO_PMA_DEVAD, MDIO_PMA_REG_EDC_FFE_MAIN, |
@@ -4297,12 +4279,11 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4297 | 4279 | ||
4298 | link_up = (((val1 & 4) == 4) || (an1000_status & (1<<1))); | 4280 | link_up = (((val1 & 4) == 4) || (an1000_status & (1<<1))); |
4299 | if (link_up && bnx2x_8073_is_snr_needed(bp, phy)) { | 4281 | if (link_up && bnx2x_8073_is_snr_needed(bp, phy)) { |
4300 | /* The SNR will improve about 2dbby | 4282 | /* |
4301 | changing the BW and FEE main tap.*/ | 4283 | * The SNR will improve about 2dbby changing the BW and FEE main |
4302 | /* The 1st write to change FFE main | 4284 | * tap. The 1st write to change FFE main tap is set before |
4303 | tap is set before restart AN */ | 4285 | * restart AN. Change PLL Bandwidth in EDC register |
4304 | /* Change PLL Bandwidth in EDC | 4286 | */ |
4305 | register */ | ||
4306 | bnx2x_cl45_write(bp, phy, | 4287 | bnx2x_cl45_write(bp, phy, |
4307 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PLL_BANDWIDTH, | 4288 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PLL_BANDWIDTH, |
4308 | 0x26BC); | 4289 | 0x26BC); |
@@ -4346,10 +4327,10 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4346 | bnx2x_cl45_read(bp, phy, | 4327 | bnx2x_cl45_read(bp, phy, |
4347 | MDIO_XS_DEVAD, | 4328 | MDIO_XS_DEVAD, |
4348 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); | 4329 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); |
4349 | /** | 4330 | /* |
4350 | * Set bit 3 to invert Rx in 1G mode and clear this bit | 4331 | * Set bit 3 to invert Rx in 1G mode and clear this bit |
4351 | * when it`s in 10G mode. | 4332 | * when it`s in 10G mode. |
4352 | */ | 4333 | */ |
4353 | if (vars->line_speed == SPEED_1000) { | 4334 | if (vars->line_speed == SPEED_1000) { |
4354 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" | 4335 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" |
4355 | "the 8073\n"); | 4336 | "the 8073\n"); |
@@ -4381,8 +4362,8 @@ static void bnx2x_8073_link_reset(struct bnx2x_phy *phy, | |||
4381 | DP(NETIF_MSG_LINK, "Setting 8073 port %d into low power mode\n", | 4362 | DP(NETIF_MSG_LINK, "Setting 8073 port %d into low power mode\n", |
4382 | gpio_port); | 4363 | gpio_port); |
4383 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 4364 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
4384 | MISC_REGISTERS_GPIO_OUTPUT_LOW, | 4365 | MISC_REGISTERS_GPIO_OUTPUT_LOW, |
4385 | gpio_port); | 4366 | gpio_port); |
4386 | } | 4367 | } |
4387 | 4368 | ||
4388 | /******************************************************************/ | 4369 | /******************************************************************/ |
@@ -4396,11 +4377,11 @@ static u8 bnx2x_8705_config_init(struct bnx2x_phy *phy, | |||
4396 | DP(NETIF_MSG_LINK, "init 8705\n"); | 4377 | DP(NETIF_MSG_LINK, "init 8705\n"); |
4397 | /* Restore normal power mode*/ | 4378 | /* Restore normal power mode*/ |
4398 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 4379 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
4399 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | 4380 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); |
4400 | /* HW reset */ | 4381 | /* HW reset */ |
4401 | bnx2x_ext_phy_hw_reset(bp, params->port); | 4382 | bnx2x_ext_phy_hw_reset(bp, params->port); |
4402 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); | 4383 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); |
4403 | bnx2x_wait_reset_complete(bp, phy); | 4384 | bnx2x_wait_reset_complete(bp, phy, params); |
4404 | 4385 | ||
4405 | bnx2x_cl45_write(bp, phy, | 4386 | bnx2x_cl45_write(bp, phy, |
4406 | MDIO_PMA_DEVAD, MDIO_PMA_REG_MISC_CTRL, 0x8288); | 4387 | MDIO_PMA_DEVAD, MDIO_PMA_REG_MISC_CTRL, 0x8288); |
@@ -4451,35 +4432,79 @@ static u8 bnx2x_8705_read_status(struct bnx2x_phy *phy, | |||
4451 | /******************************************************************/ | 4432 | /******************************************************************/ |
4452 | /* SFP+ module Section */ | 4433 | /* SFP+ module Section */ |
4453 | /******************************************************************/ | 4434 | /******************************************************************/ |
4454 | static void bnx2x_sfp_set_transmitter(struct bnx2x *bp, | 4435 | static u8 bnx2x_get_gpio_port(struct link_params *params) |
4436 | { | ||
4437 | u8 gpio_port; | ||
4438 | u32 swap_val, swap_override; | ||
4439 | struct bnx2x *bp = params->bp; | ||
4440 | if (CHIP_IS_E2(bp)) | ||
4441 | gpio_port = BP_PATH(bp); | ||
4442 | else | ||
4443 | gpio_port = params->port; | ||
4444 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); | ||
4445 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | ||
4446 | return gpio_port ^ (swap_val && swap_override); | ||
4447 | } | ||
4448 | static void bnx2x_sfp_set_transmitter(struct link_params *params, | ||
4455 | struct bnx2x_phy *phy, | 4449 | struct bnx2x_phy *phy, |
4456 | u8 port, | ||
4457 | u8 tx_en) | 4450 | u8 tx_en) |
4458 | { | 4451 | { |
4459 | u16 val; | 4452 | u16 val; |
4453 | u8 port = params->port; | ||
4454 | struct bnx2x *bp = params->bp; | ||
4455 | u32 tx_en_mode; | ||
4460 | 4456 | ||
4461 | DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x\n", | ||
4462 | tx_en, port); | ||
4463 | /* Disable/Enable transmitter ( TX laser of the SFP+ module.)*/ | 4457 | /* Disable/Enable transmitter ( TX laser of the SFP+ module.)*/ |
4464 | bnx2x_cl45_read(bp, phy, | 4458 | tx_en_mode = REG_RD(bp, params->shmem_base + |
4465 | MDIO_PMA_DEVAD, | 4459 | offsetof(struct shmem_region, |
4466 | MDIO_PMA_REG_PHY_IDENTIFIER, | 4460 | dev_info.port_hw_config[port].sfp_ctrl)) & |
4467 | &val); | 4461 | PORT_HW_CFG_TX_LASER_MASK; |
4462 | DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x " | ||
4463 | "mode = %x\n", tx_en, port, tx_en_mode); | ||
4464 | switch (tx_en_mode) { | ||
4465 | case PORT_HW_CFG_TX_LASER_MDIO: | ||
4468 | 4466 | ||
4469 | if (tx_en) | 4467 | bnx2x_cl45_read(bp, phy, |
4470 | val &= ~(1<<15); | 4468 | MDIO_PMA_DEVAD, |
4471 | else | 4469 | MDIO_PMA_REG_PHY_IDENTIFIER, |
4472 | val |= (1<<15); | 4470 | &val); |
4473 | 4471 | ||
4474 | bnx2x_cl45_write(bp, phy, | 4472 | if (tx_en) |
4475 | MDIO_PMA_DEVAD, | 4473 | val &= ~(1<<15); |
4476 | MDIO_PMA_REG_PHY_IDENTIFIER, | 4474 | else |
4477 | val); | 4475 | val |= (1<<15); |
4476 | |||
4477 | bnx2x_cl45_write(bp, phy, | ||
4478 | MDIO_PMA_DEVAD, | ||
4479 | MDIO_PMA_REG_PHY_IDENTIFIER, | ||
4480 | val); | ||
4481 | break; | ||
4482 | case PORT_HW_CFG_TX_LASER_GPIO0: | ||
4483 | case PORT_HW_CFG_TX_LASER_GPIO1: | ||
4484 | case PORT_HW_CFG_TX_LASER_GPIO2: | ||
4485 | case PORT_HW_CFG_TX_LASER_GPIO3: | ||
4486 | { | ||
4487 | u16 gpio_pin; | ||
4488 | u8 gpio_port, gpio_mode; | ||
4489 | if (tx_en) | ||
4490 | gpio_mode = MISC_REGISTERS_GPIO_OUTPUT_HIGH; | ||
4491 | else | ||
4492 | gpio_mode = MISC_REGISTERS_GPIO_OUTPUT_LOW; | ||
4493 | |||
4494 | gpio_pin = tx_en_mode - PORT_HW_CFG_TX_LASER_GPIO0; | ||
4495 | gpio_port = bnx2x_get_gpio_port(params); | ||
4496 | bnx2x_set_gpio(bp, gpio_pin, gpio_mode, gpio_port); | ||
4497 | break; | ||
4498 | } | ||
4499 | default: | ||
4500 | DP(NETIF_MSG_LINK, "Invalid TX_LASER_MDIO 0x%x\n", tx_en_mode); | ||
4501 | break; | ||
4502 | } | ||
4478 | } | 4503 | } |
4479 | 4504 | ||
4480 | static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 4505 | static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
4481 | struct link_params *params, | 4506 | struct link_params *params, |
4482 | u16 addr, u8 byte_cnt, u8 *o_buf) | 4507 | u16 addr, u8 byte_cnt, u8 *o_buf) |
4483 | { | 4508 | { |
4484 | struct bnx2x *bp = params->bp; | 4509 | struct bnx2x *bp = params->bp; |
4485 | u16 val = 0; | 4510 | u16 val = 0; |
@@ -4492,23 +4517,23 @@ static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4492 | /* Set the read command byte count */ | 4517 | /* Set the read command byte count */ |
4493 | bnx2x_cl45_write(bp, phy, | 4518 | bnx2x_cl45_write(bp, phy, |
4494 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_BYTE_CNT, | 4519 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_BYTE_CNT, |
4495 | (byte_cnt | 0xa000)); | 4520 | (byte_cnt | 0xa000)); |
4496 | 4521 | ||
4497 | /* Set the read command address */ | 4522 | /* Set the read command address */ |
4498 | bnx2x_cl45_write(bp, phy, | 4523 | bnx2x_cl45_write(bp, phy, |
4499 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_MEM_ADDR, | 4524 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_MEM_ADDR, |
4500 | addr); | 4525 | addr); |
4501 | 4526 | ||
4502 | /* Activate read command */ | 4527 | /* Activate read command */ |
4503 | bnx2x_cl45_write(bp, phy, | 4528 | bnx2x_cl45_write(bp, phy, |
4504 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, | 4529 | MDIO_PMA_DEVAD, MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, |
4505 | 0x2c0f); | 4530 | 0x2c0f); |
4506 | 4531 | ||
4507 | /* Wait up to 500us for command complete status */ | 4532 | /* Wait up to 500us for command complete status */ |
4508 | for (i = 0; i < 100; i++) { | 4533 | for (i = 0; i < 100; i++) { |
4509 | bnx2x_cl45_read(bp, phy, | 4534 | bnx2x_cl45_read(bp, phy, |
4510 | MDIO_PMA_DEVAD, | 4535 | MDIO_PMA_DEVAD, |
4511 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); | 4536 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); |
4512 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == | 4537 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
4513 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_COMPLETE) | 4538 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_COMPLETE) |
4514 | break; | 4539 | break; |
@@ -4526,15 +4551,15 @@ static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4526 | /* Read the buffer */ | 4551 | /* Read the buffer */ |
4527 | for (i = 0; i < byte_cnt; i++) { | 4552 | for (i = 0; i < byte_cnt; i++) { |
4528 | bnx2x_cl45_read(bp, phy, | 4553 | bnx2x_cl45_read(bp, phy, |
4529 | MDIO_PMA_DEVAD, | 4554 | MDIO_PMA_DEVAD, |
4530 | MDIO_PMA_REG_8726_TWO_WIRE_DATA_BUF + i, &val); | 4555 | MDIO_PMA_REG_8726_TWO_WIRE_DATA_BUF + i, &val); |
4531 | o_buf[i] = (u8)(val & MDIO_PMA_REG_8726_TWO_WIRE_DATA_MASK); | 4556 | o_buf[i] = (u8)(val & MDIO_PMA_REG_8726_TWO_WIRE_DATA_MASK); |
4532 | } | 4557 | } |
4533 | 4558 | ||
4534 | for (i = 0; i < 100; i++) { | 4559 | for (i = 0; i < 100; i++) { |
4535 | bnx2x_cl45_read(bp, phy, | 4560 | bnx2x_cl45_read(bp, phy, |
4536 | MDIO_PMA_DEVAD, | 4561 | MDIO_PMA_DEVAD, |
4537 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); | 4562 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); |
4538 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == | 4563 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
4539 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) | 4564 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) |
4540 | return 0; | 4565 | return 0; |
@@ -4545,7 +4570,7 @@ static u8 bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4545 | 4570 | ||
4546 | static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 4571 | static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
4547 | struct link_params *params, | 4572 | struct link_params *params, |
4548 | u16 addr, u8 byte_cnt, u8 *o_buf) | 4573 | u16 addr, u8 byte_cnt, u8 *o_buf) |
4549 | { | 4574 | { |
4550 | struct bnx2x *bp = params->bp; | 4575 | struct bnx2x *bp = params->bp; |
4551 | u16 val, i; | 4576 | u16 val, i; |
@@ -4558,41 +4583,43 @@ static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4558 | 4583 | ||
4559 | /* Need to read from 1.8000 to clear it */ | 4584 | /* Need to read from 1.8000 to clear it */ |
4560 | bnx2x_cl45_read(bp, phy, | 4585 | bnx2x_cl45_read(bp, phy, |
4561 | MDIO_PMA_DEVAD, | 4586 | MDIO_PMA_DEVAD, |
4562 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, | 4587 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, |
4563 | &val); | 4588 | &val); |
4564 | 4589 | ||
4565 | /* Set the read command byte count */ | 4590 | /* Set the read command byte count */ |
4566 | bnx2x_cl45_write(bp, phy, | 4591 | bnx2x_cl45_write(bp, phy, |
4567 | MDIO_PMA_DEVAD, | 4592 | MDIO_PMA_DEVAD, |
4568 | MDIO_PMA_REG_SFP_TWO_WIRE_BYTE_CNT, | 4593 | MDIO_PMA_REG_SFP_TWO_WIRE_BYTE_CNT, |
4569 | ((byte_cnt < 2) ? 2 : byte_cnt)); | 4594 | ((byte_cnt < 2) ? 2 : byte_cnt)); |
4570 | 4595 | ||
4571 | /* Set the read command address */ | 4596 | /* Set the read command address */ |
4572 | bnx2x_cl45_write(bp, phy, | 4597 | bnx2x_cl45_write(bp, phy, |
4573 | MDIO_PMA_DEVAD, | 4598 | MDIO_PMA_DEVAD, |
4574 | MDIO_PMA_REG_SFP_TWO_WIRE_MEM_ADDR, | 4599 | MDIO_PMA_REG_SFP_TWO_WIRE_MEM_ADDR, |
4575 | addr); | 4600 | addr); |
4576 | /* Set the destination address */ | 4601 | /* Set the destination address */ |
4577 | bnx2x_cl45_write(bp, phy, | 4602 | bnx2x_cl45_write(bp, phy, |
4578 | MDIO_PMA_DEVAD, | 4603 | MDIO_PMA_DEVAD, |
4579 | 0x8004, | 4604 | 0x8004, |
4580 | MDIO_PMA_REG_8727_TWO_WIRE_DATA_BUF); | 4605 | MDIO_PMA_REG_8727_TWO_WIRE_DATA_BUF); |
4581 | 4606 | ||
4582 | /* Activate read command */ | 4607 | /* Activate read command */ |
4583 | bnx2x_cl45_write(bp, phy, | 4608 | bnx2x_cl45_write(bp, phy, |
4584 | MDIO_PMA_DEVAD, | 4609 | MDIO_PMA_DEVAD, |
4585 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, | 4610 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, |
4586 | 0x8002); | 4611 | 0x8002); |
4587 | /* Wait appropriate time for two-wire command to finish before | 4612 | /* |
4588 | polling the status register */ | 4613 | * Wait appropriate time for two-wire command to finish before |
4614 | * polling the status register | ||
4615 | */ | ||
4589 | msleep(1); | 4616 | msleep(1); |
4590 | 4617 | ||
4591 | /* Wait up to 500us for command complete status */ | 4618 | /* Wait up to 500us for command complete status */ |
4592 | for (i = 0; i < 100; i++) { | 4619 | for (i = 0; i < 100; i++) { |
4593 | bnx2x_cl45_read(bp, phy, | 4620 | bnx2x_cl45_read(bp, phy, |
4594 | MDIO_PMA_DEVAD, | 4621 | MDIO_PMA_DEVAD, |
4595 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); | 4622 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); |
4596 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == | 4623 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
4597 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_COMPLETE) | 4624 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_COMPLETE) |
4598 | break; | 4625 | break; |
@@ -4604,21 +4631,21 @@ static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4604 | DP(NETIF_MSG_LINK, | 4631 | DP(NETIF_MSG_LINK, |
4605 | "Got bad status 0x%x when reading from SFP+ EEPROM\n", | 4632 | "Got bad status 0x%x when reading from SFP+ EEPROM\n", |
4606 | (val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK)); | 4633 | (val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK)); |
4607 | return -EINVAL; | 4634 | return -EFAULT; |
4608 | } | 4635 | } |
4609 | 4636 | ||
4610 | /* Read the buffer */ | 4637 | /* Read the buffer */ |
4611 | for (i = 0; i < byte_cnt; i++) { | 4638 | for (i = 0; i < byte_cnt; i++) { |
4612 | bnx2x_cl45_read(bp, phy, | 4639 | bnx2x_cl45_read(bp, phy, |
4613 | MDIO_PMA_DEVAD, | 4640 | MDIO_PMA_DEVAD, |
4614 | MDIO_PMA_REG_8727_TWO_WIRE_DATA_BUF + i, &val); | 4641 | MDIO_PMA_REG_8727_TWO_WIRE_DATA_BUF + i, &val); |
4615 | o_buf[i] = (u8)(val & MDIO_PMA_REG_8727_TWO_WIRE_DATA_MASK); | 4642 | o_buf[i] = (u8)(val & MDIO_PMA_REG_8727_TWO_WIRE_DATA_MASK); |
4616 | } | 4643 | } |
4617 | 4644 | ||
4618 | for (i = 0; i < 100; i++) { | 4645 | for (i = 0; i < 100; i++) { |
4619 | bnx2x_cl45_read(bp, phy, | 4646 | bnx2x_cl45_read(bp, phy, |
4620 | MDIO_PMA_DEVAD, | 4647 | MDIO_PMA_DEVAD, |
4621 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); | 4648 | MDIO_PMA_REG_SFP_TWO_WIRE_CTRL, &val); |
4622 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == | 4649 | if ((val & MDIO_PMA_REG_SFP_TWO_WIRE_CTRL_STATUS_MASK) == |
4623 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) | 4650 | MDIO_PMA_REG_SFP_TWO_WIRE_STATUS_IDLE) |
4624 | return 0; | 4651 | return 0; |
@@ -4628,22 +4655,22 @@ static u8 bnx2x_8727_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
4628 | return -EINVAL; | 4655 | return -EINVAL; |
4629 | } | 4656 | } |
4630 | 4657 | ||
4631 | static u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 4658 | u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
4632 | struct link_params *params, u16 addr, | 4659 | struct link_params *params, u16 addr, |
4633 | u8 byte_cnt, u8 *o_buf) | 4660 | u8 byte_cnt, u8 *o_buf) |
4634 | { | 4661 | { |
4635 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) | 4662 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) |
4636 | return bnx2x_8726_read_sfp_module_eeprom(phy, params, addr, | 4663 | return bnx2x_8726_read_sfp_module_eeprom(phy, params, addr, |
4637 | byte_cnt, o_buf); | 4664 | byte_cnt, o_buf); |
4638 | else if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) | 4665 | else if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) |
4639 | return bnx2x_8727_read_sfp_module_eeprom(phy, params, addr, | 4666 | return bnx2x_8727_read_sfp_module_eeprom(phy, params, addr, |
4640 | byte_cnt, o_buf); | 4667 | byte_cnt, o_buf); |
4641 | return -EINVAL; | 4668 | return -EINVAL; |
4642 | } | 4669 | } |
4643 | 4670 | ||
4644 | static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, | 4671 | static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, |
4645 | struct link_params *params, | 4672 | struct link_params *params, |
4646 | u16 *edc_mode) | 4673 | u16 *edc_mode) |
4647 | { | 4674 | { |
4648 | struct bnx2x *bp = params->bp; | 4675 | struct bnx2x *bp = params->bp; |
4649 | u8 val, check_limiting_mode = 0; | 4676 | u8 val, check_limiting_mode = 0; |
@@ -4664,8 +4691,10 @@ static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
4664 | { | 4691 | { |
4665 | u8 copper_module_type; | 4692 | u8 copper_module_type; |
4666 | 4693 | ||
4667 | /* Check if its active cable( includes SFP+ module) | 4694 | /* |
4668 | of passive cable*/ | 4695 | * Check if its active cable (includes SFP+ module) |
4696 | * of passive cable | ||
4697 | */ | ||
4669 | if (bnx2x_read_sfp_module_eeprom(phy, | 4698 | if (bnx2x_read_sfp_module_eeprom(phy, |
4670 | params, | 4699 | params, |
4671 | SFP_EEPROM_FC_TX_TECH_ADDR, | 4700 | SFP_EEPROM_FC_TX_TECH_ADDR, |
@@ -4724,8 +4753,10 @@ static u8 bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
4724 | DP(NETIF_MSG_LINK, "EDC mode is set to 0x%x\n", *edc_mode); | 4753 | DP(NETIF_MSG_LINK, "EDC mode is set to 0x%x\n", *edc_mode); |
4725 | return 0; | 4754 | return 0; |
4726 | } | 4755 | } |
4727 | /* This function read the relevant field from the module ( SFP+ ), | 4756 | /* |
4728 | and verify it is compliant with this board */ | 4757 | * This function read the relevant field from the module (SFP+), and verify it |
4758 | * is compliant with this board | ||
4759 | */ | ||
4729 | static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, | 4760 | static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, |
4730 | struct link_params *params) | 4761 | struct link_params *params) |
4731 | { | 4762 | { |
@@ -4774,24 +4805,24 @@ static u8 bnx2x_verify_sfp_module(struct bnx2x_phy *phy, | |||
4774 | /* format the warning message */ | 4805 | /* format the warning message */ |
4775 | if (bnx2x_read_sfp_module_eeprom(phy, | 4806 | if (bnx2x_read_sfp_module_eeprom(phy, |
4776 | params, | 4807 | params, |
4777 | SFP_EEPROM_VENDOR_NAME_ADDR, | 4808 | SFP_EEPROM_VENDOR_NAME_ADDR, |
4778 | SFP_EEPROM_VENDOR_NAME_SIZE, | 4809 | SFP_EEPROM_VENDOR_NAME_SIZE, |
4779 | (u8 *)vendor_name)) | 4810 | (u8 *)vendor_name)) |
4780 | vendor_name[0] = '\0'; | 4811 | vendor_name[0] = '\0'; |
4781 | else | 4812 | else |
4782 | vendor_name[SFP_EEPROM_VENDOR_NAME_SIZE] = '\0'; | 4813 | vendor_name[SFP_EEPROM_VENDOR_NAME_SIZE] = '\0'; |
4783 | if (bnx2x_read_sfp_module_eeprom(phy, | 4814 | if (bnx2x_read_sfp_module_eeprom(phy, |
4784 | params, | 4815 | params, |
4785 | SFP_EEPROM_PART_NO_ADDR, | 4816 | SFP_EEPROM_PART_NO_ADDR, |
4786 | SFP_EEPROM_PART_NO_SIZE, | 4817 | SFP_EEPROM_PART_NO_SIZE, |
4787 | (u8 *)vendor_pn)) | 4818 | (u8 *)vendor_pn)) |
4788 | vendor_pn[0] = '\0'; | 4819 | vendor_pn[0] = '\0'; |
4789 | else | 4820 | else |
4790 | vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0'; | 4821 | vendor_pn[SFP_EEPROM_PART_NO_SIZE] = '\0'; |
4791 | 4822 | ||
4792 | netdev_info(bp->dev, "Warning: Unqualified SFP+ module detected," | 4823 | netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," |
4793 | " Port %d from %s part number %s\n", | 4824 | " Port %d from %s part number %s\n", |
4794 | params->port, vendor_name, vendor_pn); | 4825 | params->port, vendor_name, vendor_pn); |
4795 | phy->flags |= FLAGS_SFP_NOT_APPROVED; | 4826 | phy->flags |= FLAGS_SFP_NOT_APPROVED; |
4796 | return -EINVAL; | 4827 | return -EINVAL; |
4797 | } | 4828 | } |
@@ -4803,8 +4834,11 @@ static u8 bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
4803 | u8 val; | 4834 | u8 val; |
4804 | struct bnx2x *bp = params->bp; | 4835 | struct bnx2x *bp = params->bp; |
4805 | u16 timeout; | 4836 | u16 timeout; |
4806 | /* Initialization time after hot-plug may take up to 300ms for some | 4837 | /* |
4807 | phys type ( e.g. JDSU ) */ | 4838 | * Initialization time after hot-plug may take up to 300ms for |
4839 | * some phys type ( e.g. JDSU ) | ||
4840 | */ | ||
4841 | |||
4808 | for (timeout = 0; timeout < 60; timeout++) { | 4842 | for (timeout = 0; timeout < 60; timeout++) { |
4809 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) | 4843 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) |
4810 | == 0) { | 4844 | == 0) { |
@@ -4823,16 +4857,14 @@ static void bnx2x_8727_power_module(struct bnx2x *bp, | |||
4823 | /* Make sure GPIOs are not using for LED mode */ | 4857 | /* Make sure GPIOs are not using for LED mode */ |
4824 | u16 val; | 4858 | u16 val; |
4825 | /* | 4859 | /* |
4826 | * In the GPIO register, bit 4 is use to detemine if the GPIOs are | 4860 | * In the GPIO register, bit 4 is use to determine if the GPIOs are |
4827 | * operating as INPUT or as OUTPUT. Bit 1 is for input, and 0 for | 4861 | * operating as INPUT or as OUTPUT. Bit 1 is for input, and 0 for |
4828 | * output | 4862 | * output |
4829 | * Bits 0-1 determine the gpios value for OUTPUT in case bit 4 val is 0 | 4863 | * Bits 0-1 determine the gpios value for OUTPUT in case bit 4 val is 0 |
4830 | * Bits 8-9 determine the gpios value for INPUT in case bit 4 val is 1 | 4864 | * Bits 8-9 determine the gpios value for INPUT in case bit 4 val is 1 |
4831 | * where the 1st bit is the over-current(only input), and 2nd bit is | 4865 | * where the 1st bit is the over-current(only input), and 2nd bit is |
4832 | * for power( only output ) | 4866 | * for power( only output ) |
4833 | */ | 4867 | * |
4834 | |||
4835 | /* | ||
4836 | * In case of NOC feature is disabled and power is up, set GPIO control | 4868 | * In case of NOC feature is disabled and power is up, set GPIO control |
4837 | * as input to enable listening of over-current indication | 4869 | * as input to enable listening of over-current indication |
4838 | */ | 4870 | */ |
@@ -4861,15 +4893,14 @@ static u8 bnx2x_8726_set_limiting_mode(struct bnx2x *bp, | |||
4861 | u16 cur_limiting_mode; | 4893 | u16 cur_limiting_mode; |
4862 | 4894 | ||
4863 | bnx2x_cl45_read(bp, phy, | 4895 | bnx2x_cl45_read(bp, phy, |
4864 | MDIO_PMA_DEVAD, | 4896 | MDIO_PMA_DEVAD, |
4865 | MDIO_PMA_REG_ROM_VER2, | 4897 | MDIO_PMA_REG_ROM_VER2, |
4866 | &cur_limiting_mode); | 4898 | &cur_limiting_mode); |
4867 | DP(NETIF_MSG_LINK, "Current Limiting mode is 0x%x\n", | 4899 | DP(NETIF_MSG_LINK, "Current Limiting mode is 0x%x\n", |
4868 | cur_limiting_mode); | 4900 | cur_limiting_mode); |
4869 | 4901 | ||
4870 | if (edc_mode == EDC_MODE_LIMITING) { | 4902 | if (edc_mode == EDC_MODE_LIMITING) { |
4871 | DP(NETIF_MSG_LINK, | 4903 | DP(NETIF_MSG_LINK, "Setting LIMITING MODE\n"); |
4872 | "Setting LIMITING MODE\n"); | ||
4873 | bnx2x_cl45_write(bp, phy, | 4904 | bnx2x_cl45_write(bp, phy, |
4874 | MDIO_PMA_DEVAD, | 4905 | MDIO_PMA_DEVAD, |
4875 | MDIO_PMA_REG_ROM_VER2, | 4906 | MDIO_PMA_REG_ROM_VER2, |
@@ -4878,62 +4909,63 @@ static u8 bnx2x_8726_set_limiting_mode(struct bnx2x *bp, | |||
4878 | 4909 | ||
4879 | DP(NETIF_MSG_LINK, "Setting LRM MODE\n"); | 4910 | DP(NETIF_MSG_LINK, "Setting LRM MODE\n"); |
4880 | 4911 | ||
4881 | /* Changing to LRM mode takes quite few seconds. | 4912 | /* |
4882 | So do it only if current mode is limiting | 4913 | * Changing to LRM mode takes quite few seconds. So do it only |
4883 | ( default is LRM )*/ | 4914 | * if current mode is limiting (default is LRM) |
4915 | */ | ||
4884 | if (cur_limiting_mode != EDC_MODE_LIMITING) | 4916 | if (cur_limiting_mode != EDC_MODE_LIMITING) |
4885 | return 0; | 4917 | return 0; |
4886 | 4918 | ||
4887 | bnx2x_cl45_write(bp, phy, | 4919 | bnx2x_cl45_write(bp, phy, |
4888 | MDIO_PMA_DEVAD, | 4920 | MDIO_PMA_DEVAD, |
4889 | MDIO_PMA_REG_LRM_MODE, | 4921 | MDIO_PMA_REG_LRM_MODE, |
4890 | 0); | 4922 | 0); |
4891 | bnx2x_cl45_write(bp, phy, | 4923 | bnx2x_cl45_write(bp, phy, |
4892 | MDIO_PMA_DEVAD, | 4924 | MDIO_PMA_DEVAD, |
4893 | MDIO_PMA_REG_ROM_VER2, | 4925 | MDIO_PMA_REG_ROM_VER2, |
4894 | 0x128); | 4926 | 0x128); |
4895 | bnx2x_cl45_write(bp, phy, | 4927 | bnx2x_cl45_write(bp, phy, |
4896 | MDIO_PMA_DEVAD, | 4928 | MDIO_PMA_DEVAD, |
4897 | MDIO_PMA_REG_MISC_CTRL0, | 4929 | MDIO_PMA_REG_MISC_CTRL0, |
4898 | 0x4008); | 4930 | 0x4008); |
4899 | bnx2x_cl45_write(bp, phy, | 4931 | bnx2x_cl45_write(bp, phy, |
4900 | MDIO_PMA_DEVAD, | 4932 | MDIO_PMA_DEVAD, |
4901 | MDIO_PMA_REG_LRM_MODE, | 4933 | MDIO_PMA_REG_LRM_MODE, |
4902 | 0xaaaa); | 4934 | 0xaaaa); |
4903 | } | 4935 | } |
4904 | return 0; | 4936 | return 0; |
4905 | } | 4937 | } |
4906 | 4938 | ||
4907 | static u8 bnx2x_8727_set_limiting_mode(struct bnx2x *bp, | 4939 | static u8 bnx2x_8727_set_limiting_mode(struct bnx2x *bp, |
4908 | struct bnx2x_phy *phy, | 4940 | struct bnx2x_phy *phy, |
4909 | u16 edc_mode) | 4941 | u16 edc_mode) |
4910 | { | 4942 | { |
4911 | u16 phy_identifier; | 4943 | u16 phy_identifier; |
4912 | u16 rom_ver2_val; | 4944 | u16 rom_ver2_val; |
4913 | bnx2x_cl45_read(bp, phy, | 4945 | bnx2x_cl45_read(bp, phy, |
4914 | MDIO_PMA_DEVAD, | 4946 | MDIO_PMA_DEVAD, |
4915 | MDIO_PMA_REG_PHY_IDENTIFIER, | 4947 | MDIO_PMA_REG_PHY_IDENTIFIER, |
4916 | &phy_identifier); | 4948 | &phy_identifier); |
4917 | 4949 | ||
4918 | bnx2x_cl45_write(bp, phy, | 4950 | bnx2x_cl45_write(bp, phy, |
4919 | MDIO_PMA_DEVAD, | 4951 | MDIO_PMA_DEVAD, |
4920 | MDIO_PMA_REG_PHY_IDENTIFIER, | 4952 | MDIO_PMA_REG_PHY_IDENTIFIER, |
4921 | (phy_identifier & ~(1<<9))); | 4953 | (phy_identifier & ~(1<<9))); |
4922 | 4954 | ||
4923 | bnx2x_cl45_read(bp, phy, | 4955 | bnx2x_cl45_read(bp, phy, |
4924 | MDIO_PMA_DEVAD, | 4956 | MDIO_PMA_DEVAD, |
4925 | MDIO_PMA_REG_ROM_VER2, | 4957 | MDIO_PMA_REG_ROM_VER2, |
4926 | &rom_ver2_val); | 4958 | &rom_ver2_val); |
4927 | /* Keep the MSB 8-bits, and set the LSB 8-bits with the edc_mode */ | 4959 | /* Keep the MSB 8-bits, and set the LSB 8-bits with the edc_mode */ |
4928 | bnx2x_cl45_write(bp, phy, | 4960 | bnx2x_cl45_write(bp, phy, |
4929 | MDIO_PMA_DEVAD, | 4961 | MDIO_PMA_DEVAD, |
4930 | MDIO_PMA_REG_ROM_VER2, | 4962 | MDIO_PMA_REG_ROM_VER2, |
4931 | (rom_ver2_val & 0xff00) | (edc_mode & 0x00ff)); | 4963 | (rom_ver2_val & 0xff00) | (edc_mode & 0x00ff)); |
4932 | 4964 | ||
4933 | bnx2x_cl45_write(bp, phy, | 4965 | bnx2x_cl45_write(bp, phy, |
4934 | MDIO_PMA_DEVAD, | 4966 | MDIO_PMA_DEVAD, |
4935 | MDIO_PMA_REG_PHY_IDENTIFIER, | 4967 | MDIO_PMA_REG_PHY_IDENTIFIER, |
4936 | (phy_identifier | (1<<9))); | 4968 | (phy_identifier | (1<<9))); |
4937 | 4969 | ||
4938 | return 0; | 4970 | return 0; |
4939 | } | 4971 | } |
@@ -4946,11 +4978,11 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, | |||
4946 | 4978 | ||
4947 | switch (action) { | 4979 | switch (action) { |
4948 | case DISABLE_TX: | 4980 | case DISABLE_TX: |
4949 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 4981 | bnx2x_sfp_set_transmitter(params, phy, 0); |
4950 | break; | 4982 | break; |
4951 | case ENABLE_TX: | 4983 | case ENABLE_TX: |
4952 | if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) | 4984 | if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) |
4953 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 1); | 4985 | bnx2x_sfp_set_transmitter(params, phy, 1); |
4954 | break; | 4986 | break; |
4955 | default: | 4987 | default: |
4956 | DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n", | 4988 | DP(NETIF_MSG_LINK, "Function 0x%x not supported by 8727\n", |
@@ -4959,6 +4991,38 @@ static void bnx2x_8727_specific_func(struct bnx2x_phy *phy, | |||
4959 | } | 4991 | } |
4960 | } | 4992 | } |
4961 | 4993 | ||
4994 | static void bnx2x_set_sfp_module_fault_led(struct link_params *params, | ||
4995 | u8 gpio_mode) | ||
4996 | { | ||
4997 | struct bnx2x *bp = params->bp; | ||
4998 | |||
4999 | u32 fault_led_gpio = REG_RD(bp, params->shmem_base + | ||
5000 | offsetof(struct shmem_region, | ||
5001 | dev_info.port_hw_config[params->port].sfp_ctrl)) & | ||
5002 | PORT_HW_CFG_FAULT_MODULE_LED_MASK; | ||
5003 | switch (fault_led_gpio) { | ||
5004 | case PORT_HW_CFG_FAULT_MODULE_LED_DISABLED: | ||
5005 | return; | ||
5006 | case PORT_HW_CFG_FAULT_MODULE_LED_GPIO0: | ||
5007 | case PORT_HW_CFG_FAULT_MODULE_LED_GPIO1: | ||
5008 | case PORT_HW_CFG_FAULT_MODULE_LED_GPIO2: | ||
5009 | case PORT_HW_CFG_FAULT_MODULE_LED_GPIO3: | ||
5010 | { | ||
5011 | u8 gpio_port = bnx2x_get_gpio_port(params); | ||
5012 | u16 gpio_pin = fault_led_gpio - | ||
5013 | PORT_HW_CFG_FAULT_MODULE_LED_GPIO0; | ||
5014 | DP(NETIF_MSG_LINK, "Set fault module-detected led " | ||
5015 | "pin %x port %x mode %x\n", | ||
5016 | gpio_pin, gpio_port, gpio_mode); | ||
5017 | bnx2x_set_gpio(bp, gpio_pin, gpio_mode, gpio_port); | ||
5018 | } | ||
5019 | break; | ||
5020 | default: | ||
5021 | DP(NETIF_MSG_LINK, "Error: Invalid fault led mode 0x%x\n", | ||
5022 | fault_led_gpio); | ||
5023 | } | ||
5024 | } | ||
5025 | |||
4962 | static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, | 5026 | static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, |
4963 | struct link_params *params) | 5027 | struct link_params *params) |
4964 | { | 5028 | { |
@@ -4976,15 +5040,14 @@ static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, | |||
4976 | if (bnx2x_get_edc_mode(phy, params, &edc_mode) != 0) { | 5040 | if (bnx2x_get_edc_mode(phy, params, &edc_mode) != 0) { |
4977 | DP(NETIF_MSG_LINK, "Failed to get valid module type\n"); | 5041 | DP(NETIF_MSG_LINK, "Failed to get valid module type\n"); |
4978 | return -EINVAL; | 5042 | return -EINVAL; |
4979 | } else if (bnx2x_verify_sfp_module(phy, params) != | 5043 | } else if (bnx2x_verify_sfp_module(phy, params) != 0) { |
4980 | 0) { | ||
4981 | /* check SFP+ module compatibility */ | 5044 | /* check SFP+ module compatibility */ |
4982 | DP(NETIF_MSG_LINK, "Module verification failed!!\n"); | 5045 | DP(NETIF_MSG_LINK, "Module verification failed!!\n"); |
4983 | rc = -EINVAL; | 5046 | rc = -EINVAL; |
4984 | /* Turn on fault module-detected led */ | 5047 | /* Turn on fault module-detected led */ |
4985 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, | 5048 | bnx2x_set_sfp_module_fault_led(params, |
4986 | MISC_REGISTERS_GPIO_HIGH, | 5049 | MISC_REGISTERS_GPIO_HIGH); |
4987 | params->port); | 5050 | |
4988 | if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) && | 5051 | if ((phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) && |
4989 | ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | 5052 | ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == |
4990 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN)) { | 5053 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_POWER_DOWN)) { |
@@ -4995,18 +5058,17 @@ static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, | |||
4995 | } | 5058 | } |
4996 | } else { | 5059 | } else { |
4997 | /* Turn off fault module-detected led */ | 5060 | /* Turn off fault module-detected led */ |
4998 | DP(NETIF_MSG_LINK, "Turn off fault module-detected led\n"); | 5061 | bnx2x_set_sfp_module_fault_led(params, MISC_REGISTERS_GPIO_LOW); |
4999 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, | ||
5000 | MISC_REGISTERS_GPIO_LOW, | ||
5001 | params->port); | ||
5002 | } | 5062 | } |
5003 | 5063 | ||
5004 | /* power up the SFP module */ | 5064 | /* power up the SFP module */ |
5005 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) | 5065 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727) |
5006 | bnx2x_8727_power_module(bp, phy, 1); | 5066 | bnx2x_8727_power_module(bp, phy, 1); |
5007 | 5067 | ||
5008 | /* Check and set limiting mode / LRM mode on 8726. | 5068 | /* |
5009 | On 8727 it is done automatically */ | 5069 | * Check and set limiting mode / LRM mode on 8726. On 8727 it |
5070 | * is done automatically | ||
5071 | */ | ||
5010 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) | 5072 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) |
5011 | bnx2x_8726_set_limiting_mode(bp, phy, edc_mode); | 5073 | bnx2x_8726_set_limiting_mode(bp, phy, edc_mode); |
5012 | else | 5074 | else |
@@ -5018,9 +5080,9 @@ static u8 bnx2x_sfp_module_detection(struct bnx2x_phy *phy, | |||
5018 | if (rc == 0 || | 5080 | if (rc == 0 || |
5019 | (val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) != | 5081 | (val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) != |
5020 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) | 5082 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) |
5021 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 1); | 5083 | bnx2x_sfp_set_transmitter(params, phy, 1); |
5022 | else | 5084 | else |
5023 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 5085 | bnx2x_sfp_set_transmitter(params, phy, 0); |
5024 | 5086 | ||
5025 | return rc; | 5087 | return rc; |
5026 | } | 5088 | } |
@@ -5033,11 +5095,9 @@ void bnx2x_handle_module_detect_int(struct link_params *params) | |||
5033 | u8 port = params->port; | 5095 | u8 port = params->port; |
5034 | 5096 | ||
5035 | /* Set valid module led off */ | 5097 | /* Set valid module led off */ |
5036 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, | 5098 | bnx2x_set_sfp_module_fault_led(params, MISC_REGISTERS_GPIO_HIGH); |
5037 | MISC_REGISTERS_GPIO_HIGH, | ||
5038 | params->port); | ||
5039 | 5099 | ||
5040 | /* Get current gpio val refelecting module plugged in / out*/ | 5100 | /* Get current gpio val reflecting module plugged in / out*/ |
5041 | gpio_val = bnx2x_get_gpio(bp, MISC_REGISTERS_GPIO_3, port); | 5101 | gpio_val = bnx2x_get_gpio(bp, MISC_REGISTERS_GPIO_3, port); |
5042 | 5102 | ||
5043 | /* Call the handling function in case module is detected */ | 5103 | /* Call the handling function in case module is detected */ |
@@ -5053,18 +5113,20 @@ void bnx2x_handle_module_detect_int(struct link_params *params) | |||
5053 | DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n"); | 5113 | DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n"); |
5054 | } else { | 5114 | } else { |
5055 | u32 val = REG_RD(bp, params->shmem_base + | 5115 | u32 val = REG_RD(bp, params->shmem_base + |
5056 | offsetof(struct shmem_region, dev_info. | 5116 | offsetof(struct shmem_region, dev_info. |
5057 | port_feature_config[params->port]. | 5117 | port_feature_config[params->port]. |
5058 | config)); | 5118 | config)); |
5059 | 5119 | ||
5060 | bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3, | 5120 | bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3, |
5061 | MISC_REGISTERS_GPIO_INT_OUTPUT_SET, | 5121 | MISC_REGISTERS_GPIO_INT_OUTPUT_SET, |
5062 | port); | 5122 | port); |
5063 | /* Module was plugged out. */ | 5123 | /* |
5064 | /* Disable transmit for this module */ | 5124 | * Module was plugged out. |
5125 | * Disable transmit for this module | ||
5126 | */ | ||
5065 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | 5127 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == |
5066 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) | 5128 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) |
5067 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 5129 | bnx2x_sfp_set_transmitter(params, phy, 0); |
5068 | } | 5130 | } |
5069 | } | 5131 | } |
5070 | 5132 | ||
@@ -5100,9 +5162,9 @@ static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy, | |||
5100 | 5162 | ||
5101 | DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps" | 5163 | DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x pcs_status 0x%x 1Gbps" |
5102 | " link_status 0x%x\n", rx_sd, pcs_status, val2); | 5164 | " link_status 0x%x\n", rx_sd, pcs_status, val2); |
5103 | /* link is up if both bit 0 of pmd_rx_sd and | 5165 | /* |
5104 | * bit 0 of pcs_status are set, or if the autoneg bit | 5166 | * link is up if both bit 0 of pmd_rx_sd and bit 0 of pcs_status |
5105 | * 1 is set | 5167 | * are set, or if the autoneg bit 1 is set |
5106 | */ | 5168 | */ |
5107 | link_up = ((rx_sd & pcs_status & 0x1) || (val2 & (1<<1))); | 5169 | link_up = ((rx_sd & pcs_status & 0x1) || (val2 & (1<<1))); |
5108 | if (link_up) { | 5170 | if (link_up) { |
@@ -5123,14 +5185,15 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy, | |||
5123 | struct link_params *params, | 5185 | struct link_params *params, |
5124 | struct link_vars *vars) | 5186 | struct link_vars *vars) |
5125 | { | 5187 | { |
5126 | u16 cnt, val; | 5188 | u32 tx_en_mode; |
5189 | u16 cnt, val, tmp1; | ||
5127 | struct bnx2x *bp = params->bp; | 5190 | struct bnx2x *bp = params->bp; |
5128 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 5191 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
5129 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | 5192 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); |
5130 | /* HW reset */ | 5193 | /* HW reset */ |
5131 | bnx2x_ext_phy_hw_reset(bp, params->port); | 5194 | bnx2x_ext_phy_hw_reset(bp, params->port); |
5132 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); | 5195 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 0xa040); |
5133 | bnx2x_wait_reset_complete(bp, phy); | 5196 | bnx2x_wait_reset_complete(bp, phy, params); |
5134 | 5197 | ||
5135 | /* Wait until fw is loaded */ | 5198 | /* Wait until fw is loaded */ |
5136 | for (cnt = 0; cnt < 100; cnt++) { | 5199 | for (cnt = 0; cnt < 100; cnt++) { |
@@ -5197,6 +5260,26 @@ static u8 bnx2x_8706_config_init(struct bnx2x_phy *phy, | |||
5197 | 0x0004); | 5260 | 0x0004); |
5198 | } | 5261 | } |
5199 | bnx2x_save_bcm_spirom_ver(bp, phy, params->port); | 5262 | bnx2x_save_bcm_spirom_ver(bp, phy, params->port); |
5263 | |||
5264 | /* | ||
5265 | * If TX Laser is controlled by GPIO_0, do not let PHY go into low | ||
5266 | * power mode, if TX Laser is disabled | ||
5267 | */ | ||
5268 | |||
5269 | tx_en_mode = REG_RD(bp, params->shmem_base + | ||
5270 | offsetof(struct shmem_region, | ||
5271 | dev_info.port_hw_config[params->port].sfp_ctrl)) | ||
5272 | & PORT_HW_CFG_TX_LASER_MASK; | ||
5273 | |||
5274 | if (tx_en_mode == PORT_HW_CFG_TX_LASER_GPIO0) { | ||
5275 | DP(NETIF_MSG_LINK, "Enabling TXONOFF_PWRDN_DIS\n"); | ||
5276 | bnx2x_cl45_read(bp, phy, | ||
5277 | MDIO_PMA_DEVAD, MDIO_PMA_REG_DIGITAL_CTRL, &tmp1); | ||
5278 | tmp1 |= 0x1; | ||
5279 | bnx2x_cl45_write(bp, phy, | ||
5280 | MDIO_PMA_DEVAD, MDIO_PMA_REG_DIGITAL_CTRL, tmp1); | ||
5281 | } | ||
5282 | |||
5200 | return 0; | 5283 | return 0; |
5201 | } | 5284 | } |
5202 | 5285 | ||
@@ -5231,26 +5314,26 @@ static void bnx2x_8726_external_rom_boot(struct bnx2x_phy *phy, | |||
5231 | 5314 | ||
5232 | /* Set soft reset */ | 5315 | /* Set soft reset */ |
5233 | bnx2x_cl45_write(bp, phy, | 5316 | bnx2x_cl45_write(bp, phy, |
5234 | MDIO_PMA_DEVAD, | 5317 | MDIO_PMA_DEVAD, |
5235 | MDIO_PMA_REG_GEN_CTRL, | 5318 | MDIO_PMA_REG_GEN_CTRL, |
5236 | MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET); | 5319 | MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET); |
5237 | 5320 | ||
5238 | bnx2x_cl45_write(bp, phy, | 5321 | bnx2x_cl45_write(bp, phy, |
5239 | MDIO_PMA_DEVAD, | 5322 | MDIO_PMA_DEVAD, |
5240 | MDIO_PMA_REG_MISC_CTRL1, 0x0001); | 5323 | MDIO_PMA_REG_MISC_CTRL1, 0x0001); |
5241 | 5324 | ||
5242 | bnx2x_cl45_write(bp, phy, | 5325 | bnx2x_cl45_write(bp, phy, |
5243 | MDIO_PMA_DEVAD, | 5326 | MDIO_PMA_DEVAD, |
5244 | MDIO_PMA_REG_GEN_CTRL, | 5327 | MDIO_PMA_REG_GEN_CTRL, |
5245 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); | 5328 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); |
5246 | 5329 | ||
5247 | /* wait for 150ms for microcode load */ | 5330 | /* wait for 150ms for microcode load */ |
5248 | msleep(150); | 5331 | msleep(150); |
5249 | 5332 | ||
5250 | /* Disable serial boot control, tristates pins SS_N, SCK, MOSI, MISO */ | 5333 | /* Disable serial boot control, tristates pins SS_N, SCK, MOSI, MISO */ |
5251 | bnx2x_cl45_write(bp, phy, | 5334 | bnx2x_cl45_write(bp, phy, |
5252 | MDIO_PMA_DEVAD, | 5335 | MDIO_PMA_DEVAD, |
5253 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); | 5336 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); |
5254 | 5337 | ||
5255 | msleep(200); | 5338 | msleep(200); |
5256 | bnx2x_save_bcm_spirom_ver(bp, phy, params->port); | 5339 | bnx2x_save_bcm_spirom_ver(bp, phy, params->port); |
@@ -5285,23 +5368,18 @@ static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, | |||
5285 | u32 val; | 5368 | u32 val; |
5286 | u32 swap_val, swap_override, aeu_gpio_mask, offset; | 5369 | u32 swap_val, swap_override, aeu_gpio_mask, offset; |
5287 | DP(NETIF_MSG_LINK, "Initializing BCM8726\n"); | 5370 | DP(NETIF_MSG_LINK, "Initializing BCM8726\n"); |
5288 | /* Restore normal power mode*/ | ||
5289 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | ||
5290 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | ||
5291 | |||
5292 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | ||
5293 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | ||
5294 | 5371 | ||
5295 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); | 5372 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); |
5296 | bnx2x_wait_reset_complete(bp, phy); | 5373 | bnx2x_wait_reset_complete(bp, phy, params); |
5297 | 5374 | ||
5298 | bnx2x_8726_external_rom_boot(phy, params); | 5375 | bnx2x_8726_external_rom_boot(phy, params); |
5299 | 5376 | ||
5300 | /* Need to call module detected on initialization since | 5377 | /* |
5301 | the module detection triggered by actual module | 5378 | * Need to call module detected on initialization since the module |
5302 | insertion might occur before driver is loaded, and when | 5379 | * detection triggered by actual module insertion might occur before |
5303 | driver is loaded, it reset all registers, including the | 5380 | * driver is loaded, and when driver is loaded, it reset all |
5304 | transmitter */ | 5381 | * registers, including the transmitter |
5382 | */ | ||
5305 | bnx2x_sfp_module_detection(phy, params); | 5383 | bnx2x_sfp_module_detection(phy, params); |
5306 | 5384 | ||
5307 | if (phy->req_line_speed == SPEED_1000) { | 5385 | if (phy->req_line_speed == SPEED_1000) { |
@@ -5334,8 +5412,10 @@ static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, | |||
5334 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); | 5412 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1000); |
5335 | bnx2x_cl45_write(bp, phy, | 5413 | bnx2x_cl45_write(bp, phy, |
5336 | MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); | 5414 | MDIO_AN_DEVAD, MDIO_AN_REG_CTRL, 0x1200); |
5337 | /* Enable RX-ALARM control to receive | 5415 | /* |
5338 | interrupt for 1G speed change */ | 5416 | * Enable RX-ALARM control to receive interrupt for 1G speed |
5417 | * change | ||
5418 | */ | ||
5339 | bnx2x_cl45_write(bp, phy, | 5419 | bnx2x_cl45_write(bp, phy, |
5340 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x4); | 5420 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x4); |
5341 | bnx2x_cl45_write(bp, phy, | 5421 | bnx2x_cl45_write(bp, phy, |
@@ -5367,7 +5447,7 @@ static u8 bnx2x_8726_config_init(struct bnx2x_phy *phy, | |||
5367 | 5447 | ||
5368 | /* Set GPIO3 to trigger SFP+ module insertion/removal */ | 5448 | /* Set GPIO3 to trigger SFP+ module insertion/removal */ |
5369 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, | 5449 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, |
5370 | MISC_REGISTERS_GPIO_INPUT_HI_Z, params->port); | 5450 | MISC_REGISTERS_GPIO_INPUT_HI_Z, params->port); |
5371 | 5451 | ||
5372 | /* The GPIO should be swapped if the swap register is set and active */ | 5452 | /* The GPIO should be swapped if the swap register is set and active */ |
5373 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); | 5453 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); |
@@ -5458,7 +5538,7 @@ static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy, | |||
5458 | struct link_params *params) { | 5538 | struct link_params *params) { |
5459 | u32 swap_val, swap_override; | 5539 | u32 swap_val, swap_override; |
5460 | u8 port; | 5540 | u8 port; |
5461 | /** | 5541 | /* |
5462 | * The PHY reset is controlled by GPIO 1. Fake the port number | 5542 | * The PHY reset is controlled by GPIO 1. Fake the port number |
5463 | * to cancel the swap done in set_gpio() | 5543 | * to cancel the swap done in set_gpio() |
5464 | */ | 5544 | */ |
@@ -5467,20 +5547,21 @@ static void bnx2x_8727_hw_reset(struct bnx2x_phy *phy, | |||
5467 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | 5547 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); |
5468 | port = (swap_val && swap_override) ^ 1; | 5548 | port = (swap_val && swap_override) ^ 1; |
5469 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, | 5549 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, |
5470 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); | 5550 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); |
5471 | } | 5551 | } |
5472 | 5552 | ||
5473 | static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | 5553 | static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, |
5474 | struct link_params *params, | 5554 | struct link_params *params, |
5475 | struct link_vars *vars) | 5555 | struct link_vars *vars) |
5476 | { | 5556 | { |
5477 | u16 tmp1, val, mod_abs; | 5557 | u32 tx_en_mode; |
5558 | u16 tmp1, val, mod_abs, tmp2; | ||
5478 | u16 rx_alarm_ctrl_val; | 5559 | u16 rx_alarm_ctrl_val; |
5479 | u16 lasi_ctrl_val; | 5560 | u16 lasi_ctrl_val; |
5480 | struct bnx2x *bp = params->bp; | 5561 | struct bnx2x *bp = params->bp; |
5481 | /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */ | 5562 | /* Enable PMD link, MOD_ABS_FLT, and 1G link alarm */ |
5482 | 5563 | ||
5483 | bnx2x_wait_reset_complete(bp, phy); | 5564 | bnx2x_wait_reset_complete(bp, phy, params); |
5484 | rx_alarm_ctrl_val = (1<<2) | (1<<5) ; | 5565 | rx_alarm_ctrl_val = (1<<2) | (1<<5) ; |
5485 | lasi_ctrl_val = 0x0004; | 5566 | lasi_ctrl_val = 0x0004; |
5486 | 5567 | ||
@@ -5493,14 +5574,17 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5493 | bnx2x_cl45_write(bp, phy, | 5574 | bnx2x_cl45_write(bp, phy, |
5494 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, lasi_ctrl_val); | 5575 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, lasi_ctrl_val); |
5495 | 5576 | ||
5496 | /* Initially configure MOD_ABS to interrupt when | 5577 | /* |
5497 | module is presence( bit 8) */ | 5578 | * Initially configure MOD_ABS to interrupt when module is |
5579 | * presence( bit 8) | ||
5580 | */ | ||
5498 | bnx2x_cl45_read(bp, phy, | 5581 | bnx2x_cl45_read(bp, phy, |
5499 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); | 5582 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); |
5500 | /* Set EDC off by setting OPTXLOS signal input to low | 5583 | /* |
5501 | (bit 9). | 5584 | * Set EDC off by setting OPTXLOS signal input to low (bit 9). |
5502 | When the EDC is off it locks onto a reference clock and | 5585 | * When the EDC is off it locks onto a reference clock and avoids |
5503 | avoids becoming 'lost'.*/ | 5586 | * becoming 'lost' |
5587 | */ | ||
5504 | mod_abs &= ~(1<<8); | 5588 | mod_abs &= ~(1<<8); |
5505 | if (!(phy->flags & FLAGS_NOC)) | 5589 | if (!(phy->flags & FLAGS_NOC)) |
5506 | mod_abs &= ~(1<<9); | 5590 | mod_abs &= ~(1<<9); |
@@ -5515,7 +5599,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5515 | if (phy->flags & FLAGS_NOC) | 5599 | if (phy->flags & FLAGS_NOC) |
5516 | val |= (3<<5); | 5600 | val |= (3<<5); |
5517 | 5601 | ||
5518 | /** | 5602 | /* |
5519 | * Set 8727 GPIOs to input to allow reading from the 8727 GPIO0 | 5603 | * Set 8727 GPIOs to input to allow reading from the 8727 GPIO0 |
5520 | * status which reflect SFP+ module over-current | 5604 | * status which reflect SFP+ module over-current |
5521 | */ | 5605 | */ |
@@ -5542,7 +5626,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5542 | bnx2x_cl45_read(bp, phy, | 5626 | bnx2x_cl45_read(bp, phy, |
5543 | MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1); | 5627 | MDIO_PMA_DEVAD, MDIO_PMA_REG_10G_CTRL2, &tmp1); |
5544 | DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); | 5628 | DP(NETIF_MSG_LINK, "1.7 = 0x%x\n", tmp1); |
5545 | /** | 5629 | /* |
5546 | * Power down the XAUI until link is up in case of dual-media | 5630 | * Power down the XAUI until link is up in case of dual-media |
5547 | * and 1G | 5631 | * and 1G |
5548 | */ | 5632 | */ |
@@ -5568,7 +5652,7 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5568 | bnx2x_cl45_write(bp, phy, | 5652 | bnx2x_cl45_write(bp, phy, |
5569 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300); | 5653 | MDIO_AN_DEVAD, MDIO_AN_REG_CL37_AN, 0x1300); |
5570 | } else { | 5654 | } else { |
5571 | /** | 5655 | /* |
5572 | * Since the 8727 has only single reset pin, need to set the 10G | 5656 | * Since the 8727 has only single reset pin, need to set the 10G |
5573 | * registers although it is default | 5657 | * registers although it is default |
5574 | */ | 5658 | */ |
@@ -5584,7 +5668,8 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5584 | 0x0008); | 5668 | 0x0008); |
5585 | } | 5669 | } |
5586 | 5670 | ||
5587 | /* Set 2-wire transfer rate of SFP+ module EEPROM | 5671 | /* |
5672 | * Set 2-wire transfer rate of SFP+ module EEPROM | ||
5588 | * to 100Khz since some DACs(direct attached cables) do | 5673 | * to 100Khz since some DACs(direct attached cables) do |
5589 | * not work at 400Khz. | 5674 | * not work at 400Khz. |
5590 | */ | 5675 | */ |
@@ -5607,6 +5692,26 @@ static u8 bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
5607 | phy->tx_preemphasis[1]); | 5692 | phy->tx_preemphasis[1]); |
5608 | } | 5693 | } |
5609 | 5694 | ||
5695 | /* | ||
5696 | * If TX Laser is controlled by GPIO_0, do not let PHY go into low | ||
5697 | * power mode, if TX Laser is disabled | ||
5698 | */ | ||
5699 | tx_en_mode = REG_RD(bp, params->shmem_base + | ||
5700 | offsetof(struct shmem_region, | ||
5701 | dev_info.port_hw_config[params->port].sfp_ctrl)) | ||
5702 | & PORT_HW_CFG_TX_LASER_MASK; | ||
5703 | |||
5704 | if (tx_en_mode == PORT_HW_CFG_TX_LASER_GPIO0) { | ||
5705 | |||
5706 | DP(NETIF_MSG_LINK, "Enabling TXONOFF_PWRDN_DIS\n"); | ||
5707 | bnx2x_cl45_read(bp, phy, | ||
5708 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, &tmp2); | ||
5709 | tmp2 |= 0x1000; | ||
5710 | tmp2 &= 0xFFEF; | ||
5711 | bnx2x_cl45_write(bp, phy, | ||
5712 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); | ||
5713 | } | ||
5714 | |||
5610 | return 0; | 5715 | return 0; |
5611 | } | 5716 | } |
5612 | 5717 | ||
@@ -5620,46 +5725,49 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5620 | port_feature_config[params->port]. | 5725 | port_feature_config[params->port]. |
5621 | config)); | 5726 | config)); |
5622 | bnx2x_cl45_read(bp, phy, | 5727 | bnx2x_cl45_read(bp, phy, |
5623 | MDIO_PMA_DEVAD, | 5728 | MDIO_PMA_DEVAD, |
5624 | MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); | 5729 | MDIO_PMA_REG_PHY_IDENTIFIER, &mod_abs); |
5625 | if (mod_abs & (1<<8)) { | 5730 | if (mod_abs & (1<<8)) { |
5626 | 5731 | ||
5627 | /* Module is absent */ | 5732 | /* Module is absent */ |
5628 | DP(NETIF_MSG_LINK, "MOD_ABS indication " | 5733 | DP(NETIF_MSG_LINK, "MOD_ABS indication " |
5629 | "show module is absent\n"); | 5734 | "show module is absent\n"); |
5630 | 5735 | ||
5631 | /* 1. Set mod_abs to detect next module | 5736 | /* |
5632 | presence event | 5737 | * 1. Set mod_abs to detect next module |
5633 | 2. Set EDC off by setting OPTXLOS signal input to low | 5738 | * presence event |
5634 | (bit 9). | 5739 | * 2. Set EDC off by setting OPTXLOS signal input to low |
5635 | When the EDC is off it locks onto a reference clock and | 5740 | * (bit 9). |
5636 | avoids becoming 'lost'.*/ | 5741 | * When the EDC is off it locks onto a reference clock and |
5742 | * avoids becoming 'lost'. | ||
5743 | */ | ||
5637 | mod_abs &= ~(1<<8); | 5744 | mod_abs &= ~(1<<8); |
5638 | if (!(phy->flags & FLAGS_NOC)) | 5745 | if (!(phy->flags & FLAGS_NOC)) |
5639 | mod_abs &= ~(1<<9); | 5746 | mod_abs &= ~(1<<9); |
5640 | bnx2x_cl45_write(bp, phy, | 5747 | bnx2x_cl45_write(bp, phy, |
5641 | MDIO_PMA_DEVAD, | 5748 | MDIO_PMA_DEVAD, |
5642 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); | 5749 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); |
5643 | 5750 | ||
5644 | /* Clear RX alarm since it stays up as long as | 5751 | /* |
5645 | the mod_abs wasn't changed */ | 5752 | * Clear RX alarm since it stays up as long as |
5753 | * the mod_abs wasn't changed | ||
5754 | */ | ||
5646 | bnx2x_cl45_read(bp, phy, | 5755 | bnx2x_cl45_read(bp, phy, |
5647 | MDIO_PMA_DEVAD, | 5756 | MDIO_PMA_DEVAD, |
5648 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); | 5757 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); |
5649 | 5758 | ||
5650 | } else { | 5759 | } else { |
5651 | /* Module is present */ | 5760 | /* Module is present */ |
5652 | DP(NETIF_MSG_LINK, "MOD_ABS indication " | 5761 | DP(NETIF_MSG_LINK, "MOD_ABS indication " |
5653 | "show module is present\n"); | 5762 | "show module is present\n"); |
5654 | /* First thing, disable transmitter, | 5763 | /* |
5655 | and if the module is ok, the | 5764 | * First disable transmitter, and if the module is ok, the |
5656 | module_detection will enable it*/ | 5765 | * module_detection will enable it |
5657 | 5766 | * 1. Set mod_abs to detect next module absent event ( bit 8) | |
5658 | /* 1. Set mod_abs to detect next module | 5767 | * 2. Restore the default polarity of the OPRXLOS signal and |
5659 | absent event ( bit 8) | 5768 | * this signal will then correctly indicate the presence or |
5660 | 2. Restore the default polarity of the OPRXLOS signal and | 5769 | * absence of the Rx signal. (bit 9) |
5661 | this signal will then correctly indicate the presence or | 5770 | */ |
5662 | absence of the Rx signal. (bit 9) */ | ||
5663 | mod_abs |= (1<<8); | 5771 | mod_abs |= (1<<8); |
5664 | if (!(phy->flags & FLAGS_NOC)) | 5772 | if (!(phy->flags & FLAGS_NOC)) |
5665 | mod_abs |= (1<<9); | 5773 | mod_abs |= (1<<9); |
@@ -5667,10 +5775,12 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5667 | MDIO_PMA_DEVAD, | 5775 | MDIO_PMA_DEVAD, |
5668 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); | 5776 | MDIO_PMA_REG_PHY_IDENTIFIER, mod_abs); |
5669 | 5777 | ||
5670 | /* Clear RX alarm since it stays up as long as | 5778 | /* |
5671 | the mod_abs wasn't changed. This is need to be done | 5779 | * Clear RX alarm since it stays up as long as the mod_abs |
5672 | before calling the module detection, otherwise it will clear | 5780 | * wasn't changed. This is need to be done before calling the |
5673 | the link update alarm */ | 5781 | * module detection, otherwise it will clear* the link update |
5782 | * alarm | ||
5783 | */ | ||
5674 | bnx2x_cl45_read(bp, phy, | 5784 | bnx2x_cl45_read(bp, phy, |
5675 | MDIO_PMA_DEVAD, | 5785 | MDIO_PMA_DEVAD, |
5676 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); | 5786 | MDIO_PMA_REG_RX_ALARM, &rx_alarm_status); |
@@ -5678,7 +5788,7 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5678 | 5788 | ||
5679 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == | 5789 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) == |
5680 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) | 5790 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLE_TX_LASER) |
5681 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 5791 | bnx2x_sfp_set_transmitter(params, phy, 0); |
5682 | 5792 | ||
5683 | if (bnx2x_wait_for_sfp_module_initialized(phy, params) == 0) | 5793 | if (bnx2x_wait_for_sfp_module_initialized(phy, params) == 0) |
5684 | bnx2x_sfp_module_detection(phy, params); | 5794 | bnx2x_sfp_module_detection(phy, params); |
@@ -5687,9 +5797,8 @@ static void bnx2x_8727_handle_mod_abs(struct bnx2x_phy *phy, | |||
5687 | } | 5797 | } |
5688 | 5798 | ||
5689 | DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", | 5799 | DP(NETIF_MSG_LINK, "8727 RX_ALARM_STATUS 0x%x\n", |
5690 | rx_alarm_status); | 5800 | rx_alarm_status); |
5691 | /* No need to check link status in case of | 5801 | /* No need to check link status in case of module plugged in/out */ |
5692 | module plugged in/out */ | ||
5693 | } | 5802 | } |
5694 | 5803 | ||
5695 | static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | 5804 | static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, |
@@ -5725,7 +5834,7 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5725 | bnx2x_cl45_read(bp, phy, | 5834 | bnx2x_cl45_read(bp, phy, |
5726 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &val1); | 5835 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &val1); |
5727 | 5836 | ||
5728 | /** | 5837 | /* |
5729 | * If a module is present and there is need to check | 5838 | * If a module is present and there is need to check |
5730 | * for over current | 5839 | * for over current |
5731 | */ | 5840 | */ |
@@ -5745,12 +5854,8 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5745 | " Please remove the SFP+ module and" | 5854 | " Please remove the SFP+ module and" |
5746 | " restart the system to clear this" | 5855 | " restart the system to clear this" |
5747 | " error.\n", | 5856 | " error.\n", |
5748 | params->port); | 5857 | params->port); |
5749 | 5858 | /* Disable all RX_ALARMs except for mod_abs */ | |
5750 | /* | ||
5751 | * Disable all RX_ALARMs except for | ||
5752 | * mod_abs | ||
5753 | */ | ||
5754 | bnx2x_cl45_write(bp, phy, | 5859 | bnx2x_cl45_write(bp, phy, |
5755 | MDIO_PMA_DEVAD, | 5860 | MDIO_PMA_DEVAD, |
5756 | MDIO_PMA_REG_RX_ALARM_CTRL, (1<<5)); | 5861 | MDIO_PMA_REG_RX_ALARM_CTRL, (1<<5)); |
@@ -5793,11 +5898,15 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5793 | MDIO_PMA_DEVAD, | 5898 | MDIO_PMA_DEVAD, |
5794 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, &link_status); | 5899 | MDIO_PMA_REG_8073_SPEED_LINK_STATUS, &link_status); |
5795 | 5900 | ||
5796 | /* Bits 0..2 --> speed detected, | 5901 | /* |
5797 | bits 13..15--> link is down */ | 5902 | * Bits 0..2 --> speed detected, |
5903 | * Bits 13..15--> link is down | ||
5904 | */ | ||
5798 | if ((link_status & (1<<2)) && (!(link_status & (1<<15)))) { | 5905 | if ((link_status & (1<<2)) && (!(link_status & (1<<15)))) { |
5799 | link_up = 1; | 5906 | link_up = 1; |
5800 | vars->line_speed = SPEED_10000; | 5907 | vars->line_speed = SPEED_10000; |
5908 | DP(NETIF_MSG_LINK, "port %x: External link up in 10G\n", | ||
5909 | params->port); | ||
5801 | } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) { | 5910 | } else if ((link_status & (1<<0)) && (!(link_status & (1<<13)))) { |
5802 | link_up = 1; | 5911 | link_up = 1; |
5803 | vars->line_speed = SPEED_1000; | 5912 | vars->line_speed = SPEED_1000; |
@@ -5819,7 +5928,7 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5819 | bnx2x_cl45_read(bp, phy, | 5928 | bnx2x_cl45_read(bp, phy, |
5820 | MDIO_PMA_DEVAD, | 5929 | MDIO_PMA_DEVAD, |
5821 | MDIO_PMA_REG_8727_PCS_GP, &val1); | 5930 | MDIO_PMA_REG_8727_PCS_GP, &val1); |
5822 | /** | 5931 | /* |
5823 | * In case of dual-media board and 1G, power up the XAUI side, | 5932 | * In case of dual-media board and 1G, power up the XAUI side, |
5824 | * otherwise power it down. For 10G it is done automatically | 5933 | * otherwise power it down. For 10G it is done automatically |
5825 | */ | 5934 | */ |
@@ -5839,7 +5948,7 @@ static void bnx2x_8727_link_reset(struct bnx2x_phy *phy, | |||
5839 | { | 5948 | { |
5840 | struct bnx2x *bp = params->bp; | 5949 | struct bnx2x *bp = params->bp; |
5841 | /* Disable Transmitter */ | 5950 | /* Disable Transmitter */ |
5842 | bnx2x_sfp_set_transmitter(bp, phy, params->port, 0); | 5951 | bnx2x_sfp_set_transmitter(params, phy, 0); |
5843 | /* Clear LASI */ | 5952 | /* Clear LASI */ |
5844 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0); | 5953 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0); |
5845 | 5954 | ||
@@ -5851,19 +5960,23 @@ static void bnx2x_8727_link_reset(struct bnx2x_phy *phy, | |||
5851 | static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | 5960 | static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, |
5852 | struct link_params *params) | 5961 | struct link_params *params) |
5853 | { | 5962 | { |
5854 | u16 val, fw_ver1, fw_ver2, cnt; | 5963 | u16 val, fw_ver1, fw_ver2, cnt, adj; |
5855 | struct bnx2x *bp = params->bp; | 5964 | struct bnx2x *bp = params->bp; |
5856 | 5965 | ||
5966 | adj = 0; | ||
5967 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | ||
5968 | adj = -1; | ||
5969 | |||
5857 | /* For the 32 bits registers in 848xx, access via MDIO2ARM interface.*/ | 5970 | /* For the 32 bits registers in 848xx, access via MDIO2ARM interface.*/ |
5858 | /* (1) set register 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ | 5971 | /* (1) set register 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ |
5859 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819, 0x0014); | 5972 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819 + adj, 0x0014); |
5860 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A, 0xc200); | 5973 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A + adj, 0xc200); |
5861 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81B, 0x0000); | 5974 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81B + adj, 0x0000); |
5862 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81C, 0x0300); | 5975 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81C + adj, 0x0300); |
5863 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817, 0x0009); | 5976 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817 + adj, 0x0009); |
5864 | 5977 | ||
5865 | for (cnt = 0; cnt < 100; cnt++) { | 5978 | for (cnt = 0; cnt < 100; cnt++) { |
5866 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818, &val); | 5979 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818 + adj, &val); |
5867 | if (val & 1) | 5980 | if (val & 1) |
5868 | break; | 5981 | break; |
5869 | udelay(5); | 5982 | udelay(5); |
@@ -5877,11 +5990,11 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
5877 | 5990 | ||
5878 | 5991 | ||
5879 | /* 2) read register 0xc200_0000 (SPI_FW_STATUS) */ | 5992 | /* 2) read register 0xc200_0000 (SPI_FW_STATUS) */ |
5880 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819, 0x0000); | 5993 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA819 + adj, 0x0000); |
5881 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A, 0xc200); | 5994 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA81A + adj, 0xc200); |
5882 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817, 0x000A); | 5995 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, 0xA817 + adj, 0x000A); |
5883 | for (cnt = 0; cnt < 100; cnt++) { | 5996 | for (cnt = 0; cnt < 100; cnt++) { |
5884 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818, &val); | 5997 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA818 + adj, &val); |
5885 | if (val & 1) | 5998 | if (val & 1) |
5886 | break; | 5999 | break; |
5887 | udelay(5); | 6000 | udelay(5); |
@@ -5894,9 +6007,9 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
5894 | } | 6007 | } |
5895 | 6008 | ||
5896 | /* lower 16 bits of the register SPI_FW_STATUS */ | 6009 | /* lower 16 bits of the register SPI_FW_STATUS */ |
5897 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81B, &fw_ver1); | 6010 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81B + adj, &fw_ver1); |
5898 | /* upper 16 bits of register SPI_FW_STATUS */ | 6011 | /* upper 16 bits of register SPI_FW_STATUS */ |
5899 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81C, &fw_ver2); | 6012 | bnx2x_cl45_read(bp, phy, MDIO_PMA_DEVAD, 0xA81C + adj, &fw_ver2); |
5900 | 6013 | ||
5901 | bnx2x_save_spirom_version(bp, params->port, (fw_ver2<<16) | fw_ver1, | 6014 | bnx2x_save_spirom_version(bp, params->port, (fw_ver2<<16) | fw_ver1, |
5902 | phy->ver_addr); | 6015 | phy->ver_addr); |
@@ -5905,49 +6018,53 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
5905 | static void bnx2x_848xx_set_led(struct bnx2x *bp, | 6018 | static void bnx2x_848xx_set_led(struct bnx2x *bp, |
5906 | struct bnx2x_phy *phy) | 6019 | struct bnx2x_phy *phy) |
5907 | { | 6020 | { |
5908 | u16 val; | 6021 | u16 val, adj; |
6022 | |||
6023 | adj = 0; | ||
6024 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | ||
6025 | adj = -1; | ||
5909 | 6026 | ||
5910 | /* PHYC_CTL_LED_CTL */ | 6027 | /* PHYC_CTL_LED_CTL */ |
5911 | bnx2x_cl45_read(bp, phy, | 6028 | bnx2x_cl45_read(bp, phy, |
5912 | MDIO_PMA_DEVAD, | 6029 | MDIO_PMA_DEVAD, |
5913 | MDIO_PMA_REG_8481_LINK_SIGNAL, &val); | 6030 | MDIO_PMA_REG_8481_LINK_SIGNAL + adj, &val); |
5914 | val &= 0xFE00; | 6031 | val &= 0xFE00; |
5915 | val |= 0x0092; | 6032 | val |= 0x0092; |
5916 | 6033 | ||
5917 | bnx2x_cl45_write(bp, phy, | 6034 | bnx2x_cl45_write(bp, phy, |
5918 | MDIO_PMA_DEVAD, | 6035 | MDIO_PMA_DEVAD, |
5919 | MDIO_PMA_REG_8481_LINK_SIGNAL, val); | 6036 | MDIO_PMA_REG_8481_LINK_SIGNAL + adj, val); |
5920 | 6037 | ||
5921 | bnx2x_cl45_write(bp, phy, | 6038 | bnx2x_cl45_write(bp, phy, |
5922 | MDIO_PMA_DEVAD, | 6039 | MDIO_PMA_DEVAD, |
5923 | MDIO_PMA_REG_8481_LED1_MASK, | 6040 | MDIO_PMA_REG_8481_LED1_MASK + adj, |
5924 | 0x80); | 6041 | 0x80); |
5925 | 6042 | ||
5926 | bnx2x_cl45_write(bp, phy, | 6043 | bnx2x_cl45_write(bp, phy, |
5927 | MDIO_PMA_DEVAD, | 6044 | MDIO_PMA_DEVAD, |
5928 | MDIO_PMA_REG_8481_LED2_MASK, | 6045 | MDIO_PMA_REG_8481_LED2_MASK + adj, |
5929 | 0x18); | 6046 | 0x18); |
5930 | 6047 | ||
5931 | /* Select activity source by Tx and Rx, as suggested by PHY AE */ | 6048 | /* Select activity source by Tx and Rx, as suggested by PHY AE */ |
5932 | bnx2x_cl45_write(bp, phy, | 6049 | bnx2x_cl45_write(bp, phy, |
5933 | MDIO_PMA_DEVAD, | 6050 | MDIO_PMA_DEVAD, |
5934 | MDIO_PMA_REG_8481_LED3_MASK, | 6051 | MDIO_PMA_REG_8481_LED3_MASK + adj, |
5935 | 0x0006); | 6052 | 0x0006); |
5936 | 6053 | ||
5937 | /* Select the closest activity blink rate to that in 10/100/1000 */ | 6054 | /* Select the closest activity blink rate to that in 10/100/1000 */ |
5938 | bnx2x_cl45_write(bp, phy, | 6055 | bnx2x_cl45_write(bp, phy, |
5939 | MDIO_PMA_DEVAD, | 6056 | MDIO_PMA_DEVAD, |
5940 | MDIO_PMA_REG_8481_LED3_BLINK, | 6057 | MDIO_PMA_REG_8481_LED3_BLINK + adj, |
5941 | 0); | 6058 | 0); |
5942 | 6059 | ||
5943 | bnx2x_cl45_read(bp, phy, | 6060 | bnx2x_cl45_read(bp, phy, |
5944 | MDIO_PMA_DEVAD, | 6061 | MDIO_PMA_DEVAD, |
5945 | MDIO_PMA_REG_84823_CTL_LED_CTL_1, &val); | 6062 | MDIO_PMA_REG_84823_CTL_LED_CTL_1 + adj, &val); |
5946 | val |= MDIO_PMA_REG_84823_LED3_STRETCH_EN; /* stretch_en for LED3*/ | 6063 | val |= MDIO_PMA_REG_84823_LED3_STRETCH_EN; /* stretch_en for LED3*/ |
5947 | 6064 | ||
5948 | bnx2x_cl45_write(bp, phy, | 6065 | bnx2x_cl45_write(bp, phy, |
5949 | MDIO_PMA_DEVAD, | 6066 | MDIO_PMA_DEVAD, |
5950 | MDIO_PMA_REG_84823_CTL_LED_CTL_1, val); | 6067 | MDIO_PMA_REG_84823_CTL_LED_CTL_1 + adj, val); |
5951 | 6068 | ||
5952 | /* 'Interrupt Mask' */ | 6069 | /* 'Interrupt Mask' */ |
5953 | bnx2x_cl45_write(bp, phy, | 6070 | bnx2x_cl45_write(bp, phy, |
@@ -5961,7 +6078,11 @@ static u8 bnx2x_848xx_cmn_config_init(struct bnx2x_phy *phy, | |||
5961 | { | 6078 | { |
5962 | struct bnx2x *bp = params->bp; | 6079 | struct bnx2x *bp = params->bp; |
5963 | u16 autoneg_val, an_1000_val, an_10_100_val; | 6080 | u16 autoneg_val, an_1000_val, an_10_100_val; |
5964 | 6081 | /* | |
6082 | * This phy uses the NIG latch mechanism since link indication | ||
6083 | * arrives through its LED4 and not via its LASI signal, so we | ||
6084 | * get steady signal instead of clear on read | ||
6085 | */ | ||
5965 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, | 6086 | bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, |
5966 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); | 6087 | 1 << NIG_LATCH_BC_ENABLE_MI_INT); |
5967 | 6088 | ||
@@ -6086,11 +6207,11 @@ static u8 bnx2x_8481_config_init(struct bnx2x_phy *phy, | |||
6086 | struct bnx2x *bp = params->bp; | 6207 | struct bnx2x *bp = params->bp; |
6087 | /* Restore normal power mode*/ | 6208 | /* Restore normal power mode*/ |
6088 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 6209 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
6089 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | 6210 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); |
6090 | 6211 | ||
6091 | /* HW reset */ | 6212 | /* HW reset */ |
6092 | bnx2x_ext_phy_hw_reset(bp, params->port); | 6213 | bnx2x_ext_phy_hw_reset(bp, params->port); |
6093 | bnx2x_wait_reset_complete(bp, phy); | 6214 | bnx2x_wait_reset_complete(bp, phy, params); |
6094 | 6215 | ||
6095 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); | 6216 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); |
6096 | return bnx2x_848xx_cmn_config_init(phy, params, vars); | 6217 | return bnx2x_848xx_cmn_config_init(phy, params, vars); |
@@ -6102,12 +6223,15 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6102 | { | 6223 | { |
6103 | struct bnx2x *bp = params->bp; | 6224 | struct bnx2x *bp = params->bp; |
6104 | u8 port, initialize = 1; | 6225 | u8 port, initialize = 1; |
6105 | u16 val; | 6226 | u16 val, adj; |
6106 | u16 temp; | 6227 | u16 temp; |
6107 | u32 actual_phy_selection; | 6228 | u32 actual_phy_selection, cms_enable; |
6108 | u8 rc = 0; | 6229 | u8 rc = 0; |
6109 | 6230 | ||
6110 | /* This is just for MDIO_CTL_REG_84823_MEDIA register. */ | 6231 | /* This is just for MDIO_CTL_REG_84823_MEDIA register. */ |
6232 | adj = 0; | ||
6233 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | ||
6234 | adj = 3; | ||
6111 | 6235 | ||
6112 | msleep(1); | 6236 | msleep(1); |
6113 | if (CHIP_IS_E2(bp)) | 6237 | if (CHIP_IS_E2(bp)) |
@@ -6117,11 +6241,12 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6117 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, | 6241 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, |
6118 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, | 6242 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, |
6119 | port); | 6243 | port); |
6120 | bnx2x_wait_reset_complete(bp, phy); | 6244 | bnx2x_wait_reset_complete(bp, phy, params); |
6121 | /* Wait for GPHY to come out of reset */ | 6245 | /* Wait for GPHY to come out of reset */ |
6122 | msleep(50); | 6246 | msleep(50); |
6123 | /* BCM84823 requires that XGXS links up first @ 10G for normal | 6247 | /* |
6124 | behavior */ | 6248 | * BCM84823 requires that XGXS links up first @ 10G for normal behavior |
6249 | */ | ||
6125 | temp = vars->line_speed; | 6250 | temp = vars->line_speed; |
6126 | vars->line_speed = SPEED_10000; | 6251 | vars->line_speed = SPEED_10000; |
6127 | bnx2x_set_autoneg(¶ms->phy[INT_PHY], params, vars, 0); | 6252 | bnx2x_set_autoneg(¶ms->phy[INT_PHY], params, vars, 0); |
@@ -6131,7 +6256,7 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6131 | /* Set dual-media configuration according to configuration */ | 6256 | /* Set dual-media configuration according to configuration */ |
6132 | 6257 | ||
6133 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, | 6258 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, |
6134 | MDIO_CTL_REG_84823_MEDIA, &val); | 6259 | MDIO_CTL_REG_84823_MEDIA + adj, &val); |
6135 | val &= ~(MDIO_CTL_REG_84823_MEDIA_MAC_MASK | | 6260 | val &= ~(MDIO_CTL_REG_84823_MEDIA_MAC_MASK | |
6136 | MDIO_CTL_REG_84823_MEDIA_LINE_MASK | | 6261 | MDIO_CTL_REG_84823_MEDIA_LINE_MASK | |
6137 | MDIO_CTL_REG_84823_MEDIA_COPPER_CORE_DOWN | | 6262 | MDIO_CTL_REG_84823_MEDIA_COPPER_CORE_DOWN | |
@@ -6164,7 +6289,7 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6164 | val |= MDIO_CTL_REG_84823_MEDIA_FIBER_1G; | 6289 | val |= MDIO_CTL_REG_84823_MEDIA_FIBER_1G; |
6165 | 6290 | ||
6166 | bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, | 6291 | bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, |
6167 | MDIO_CTL_REG_84823_MEDIA, val); | 6292 | MDIO_CTL_REG_84823_MEDIA + adj, val); |
6168 | DP(NETIF_MSG_LINK, "Multi_phy config = 0x%x, Media control = 0x%x\n", | 6293 | DP(NETIF_MSG_LINK, "Multi_phy config = 0x%x, Media control = 0x%x\n", |
6169 | params->multi_phy_config, val); | 6294 | params->multi_phy_config, val); |
6170 | 6295 | ||
@@ -6172,23 +6297,43 @@ static u8 bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
6172 | rc = bnx2x_848xx_cmn_config_init(phy, params, vars); | 6297 | rc = bnx2x_848xx_cmn_config_init(phy, params, vars); |
6173 | else | 6298 | else |
6174 | bnx2x_save_848xx_spirom_version(phy, params); | 6299 | bnx2x_save_848xx_spirom_version(phy, params); |
6300 | cms_enable = REG_RD(bp, params->shmem_base + | ||
6301 | offsetof(struct shmem_region, | ||
6302 | dev_info.port_hw_config[params->port].default_cfg)) & | ||
6303 | PORT_HW_CFG_ENABLE_CMS_MASK; | ||
6304 | |||
6305 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, | ||
6306 | MDIO_CTL_REG_84823_USER_CTRL_REG, &val); | ||
6307 | if (cms_enable) | ||
6308 | val |= MDIO_CTL_REG_84823_USER_CTRL_CMS; | ||
6309 | else | ||
6310 | val &= ~MDIO_CTL_REG_84823_USER_CTRL_CMS; | ||
6311 | bnx2x_cl45_write(bp, phy, MDIO_CTL_DEVAD, | ||
6312 | MDIO_CTL_REG_84823_USER_CTRL_REG, val); | ||
6313 | |||
6314 | |||
6175 | return rc; | 6315 | return rc; |
6176 | } | 6316 | } |
6177 | 6317 | ||
6178 | static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, | 6318 | static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, |
6179 | struct link_params *params, | 6319 | struct link_params *params, |
6180 | struct link_vars *vars) | 6320 | struct link_vars *vars) |
6181 | { | 6321 | { |
6182 | struct bnx2x *bp = params->bp; | 6322 | struct bnx2x *bp = params->bp; |
6183 | u16 val, val1, val2; | 6323 | u16 val, val1, val2, adj; |
6184 | u8 link_up = 0; | 6324 | u8 link_up = 0; |
6185 | 6325 | ||
6326 | /* Reg offset adjustment for 84833 */ | ||
6327 | adj = 0; | ||
6328 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | ||
6329 | adj = -1; | ||
6330 | |||
6186 | /* Check 10G-BaseT link status */ | 6331 | /* Check 10G-BaseT link status */ |
6187 | /* Check PMD signal ok */ | 6332 | /* Check PMD signal ok */ |
6188 | bnx2x_cl45_read(bp, phy, | 6333 | bnx2x_cl45_read(bp, phy, |
6189 | MDIO_AN_DEVAD, 0xFFFA, &val1); | 6334 | MDIO_AN_DEVAD, 0xFFFA, &val1); |
6190 | bnx2x_cl45_read(bp, phy, | 6335 | bnx2x_cl45_read(bp, phy, |
6191 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_PMD_SIGNAL, | 6336 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8481_PMD_SIGNAL + adj, |
6192 | &val2); | 6337 | &val2); |
6193 | DP(NETIF_MSG_LINK, "BCM848xx: PMD_SIGNAL 1.a811 = 0x%x\n", val2); | 6338 | DP(NETIF_MSG_LINK, "BCM848xx: PMD_SIGNAL 1.a811 = 0x%x\n", val2); |
6194 | 6339 | ||
@@ -6273,9 +6418,9 @@ static void bnx2x_8481_hw_reset(struct bnx2x_phy *phy, | |||
6273 | struct link_params *params) | 6418 | struct link_params *params) |
6274 | { | 6419 | { |
6275 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, | 6420 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, |
6276 | MISC_REGISTERS_GPIO_OUTPUT_LOW, 0); | 6421 | MISC_REGISTERS_GPIO_OUTPUT_LOW, 0); |
6277 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, | 6422 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, |
6278 | MISC_REGISTERS_GPIO_OUTPUT_LOW, 1); | 6423 | MISC_REGISTERS_GPIO_OUTPUT_LOW, 1); |
6279 | } | 6424 | } |
6280 | 6425 | ||
6281 | static void bnx2x_8481_link_reset(struct bnx2x_phy *phy, | 6426 | static void bnx2x_8481_link_reset(struct bnx2x_phy *phy, |
@@ -6297,8 +6442,8 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, | |||
6297 | else | 6442 | else |
6298 | port = params->port; | 6443 | port = params->port; |
6299 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, | 6444 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3, |
6300 | MISC_REGISTERS_GPIO_OUTPUT_LOW, | 6445 | MISC_REGISTERS_GPIO_OUTPUT_LOW, |
6301 | port); | 6446 | port); |
6302 | } | 6447 | } |
6303 | 6448 | ||
6304 | static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | 6449 | static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, |
@@ -6353,24 +6498,24 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6353 | 6498 | ||
6354 | /* Set LED masks */ | 6499 | /* Set LED masks */ |
6355 | bnx2x_cl45_write(bp, phy, | 6500 | bnx2x_cl45_write(bp, phy, |
6356 | MDIO_PMA_DEVAD, | 6501 | MDIO_PMA_DEVAD, |
6357 | MDIO_PMA_REG_8481_LED1_MASK, | 6502 | MDIO_PMA_REG_8481_LED1_MASK, |
6358 | 0x0); | 6503 | 0x0); |
6359 | 6504 | ||
6360 | bnx2x_cl45_write(bp, phy, | 6505 | bnx2x_cl45_write(bp, phy, |
6361 | MDIO_PMA_DEVAD, | 6506 | MDIO_PMA_DEVAD, |
6362 | MDIO_PMA_REG_8481_LED2_MASK, | 6507 | MDIO_PMA_REG_8481_LED2_MASK, |
6363 | 0x0); | 6508 | 0x0); |
6364 | 6509 | ||
6365 | bnx2x_cl45_write(bp, phy, | 6510 | bnx2x_cl45_write(bp, phy, |
6366 | MDIO_PMA_DEVAD, | 6511 | MDIO_PMA_DEVAD, |
6367 | MDIO_PMA_REG_8481_LED3_MASK, | 6512 | MDIO_PMA_REG_8481_LED3_MASK, |
6368 | 0x0); | 6513 | 0x0); |
6369 | 6514 | ||
6370 | bnx2x_cl45_write(bp, phy, | 6515 | bnx2x_cl45_write(bp, phy, |
6371 | MDIO_PMA_DEVAD, | 6516 | MDIO_PMA_DEVAD, |
6372 | MDIO_PMA_REG_8481_LED5_MASK, | 6517 | MDIO_PMA_REG_8481_LED5_MASK, |
6373 | 0x20); | 6518 | 0x20); |
6374 | 6519 | ||
6375 | } else { | 6520 | } else { |
6376 | bnx2x_cl45_write(bp, phy, | 6521 | bnx2x_cl45_write(bp, phy, |
@@ -6394,35 +6539,35 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6394 | val |= 0x2492; | 6539 | val |= 0x2492; |
6395 | 6540 | ||
6396 | bnx2x_cl45_write(bp, phy, | 6541 | bnx2x_cl45_write(bp, phy, |
6397 | MDIO_PMA_DEVAD, | 6542 | MDIO_PMA_DEVAD, |
6398 | MDIO_PMA_REG_8481_LINK_SIGNAL, | 6543 | MDIO_PMA_REG_8481_LINK_SIGNAL, |
6399 | val); | 6544 | val); |
6400 | 6545 | ||
6401 | /* Set LED masks */ | 6546 | /* Set LED masks */ |
6402 | bnx2x_cl45_write(bp, phy, | 6547 | bnx2x_cl45_write(bp, phy, |
6403 | MDIO_PMA_DEVAD, | 6548 | MDIO_PMA_DEVAD, |
6404 | MDIO_PMA_REG_8481_LED1_MASK, | 6549 | MDIO_PMA_REG_8481_LED1_MASK, |
6405 | 0x0); | 6550 | 0x0); |
6406 | 6551 | ||
6407 | bnx2x_cl45_write(bp, phy, | 6552 | bnx2x_cl45_write(bp, phy, |
6408 | MDIO_PMA_DEVAD, | 6553 | MDIO_PMA_DEVAD, |
6409 | MDIO_PMA_REG_8481_LED2_MASK, | 6554 | MDIO_PMA_REG_8481_LED2_MASK, |
6410 | 0x20); | 6555 | 0x20); |
6411 | 6556 | ||
6412 | bnx2x_cl45_write(bp, phy, | 6557 | bnx2x_cl45_write(bp, phy, |
6413 | MDIO_PMA_DEVAD, | 6558 | MDIO_PMA_DEVAD, |
6414 | MDIO_PMA_REG_8481_LED3_MASK, | 6559 | MDIO_PMA_REG_8481_LED3_MASK, |
6415 | 0x20); | 6560 | 0x20); |
6416 | 6561 | ||
6417 | bnx2x_cl45_write(bp, phy, | 6562 | bnx2x_cl45_write(bp, phy, |
6418 | MDIO_PMA_DEVAD, | 6563 | MDIO_PMA_DEVAD, |
6419 | MDIO_PMA_REG_8481_LED5_MASK, | 6564 | MDIO_PMA_REG_8481_LED5_MASK, |
6420 | 0x0); | 6565 | 0x0); |
6421 | } else { | 6566 | } else { |
6422 | bnx2x_cl45_write(bp, phy, | 6567 | bnx2x_cl45_write(bp, phy, |
6423 | MDIO_PMA_DEVAD, | 6568 | MDIO_PMA_DEVAD, |
6424 | MDIO_PMA_REG_8481_LED1_MASK, | 6569 | MDIO_PMA_REG_8481_LED1_MASK, |
6425 | 0x20); | 6570 | 0x20); |
6426 | } | 6571 | } |
6427 | break; | 6572 | break; |
6428 | 6573 | ||
@@ -6440,9 +6585,9 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6440 | &val); | 6585 | &val); |
6441 | 6586 | ||
6442 | if (!((val & | 6587 | if (!((val & |
6443 | MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_MASK) | 6588 | MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_MASK) |
6444 | >> MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_SHIFT)){ | 6589 | >> MDIO_PMA_REG_8481_LINK_SIGNAL_LED4_ENABLE_SHIFT)) { |
6445 | DP(NETIF_MSG_LINK, "Seting LINK_SIGNAL\n"); | 6590 | DP(NETIF_MSG_LINK, "Setting LINK_SIGNAL\n"); |
6446 | bnx2x_cl45_write(bp, phy, | 6591 | bnx2x_cl45_write(bp, phy, |
6447 | MDIO_PMA_DEVAD, | 6592 | MDIO_PMA_DEVAD, |
6448 | MDIO_PMA_REG_8481_LINK_SIGNAL, | 6593 | MDIO_PMA_REG_8481_LINK_SIGNAL, |
@@ -6451,24 +6596,24 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6451 | 6596 | ||
6452 | /* Set LED masks */ | 6597 | /* Set LED masks */ |
6453 | bnx2x_cl45_write(bp, phy, | 6598 | bnx2x_cl45_write(bp, phy, |
6454 | MDIO_PMA_DEVAD, | 6599 | MDIO_PMA_DEVAD, |
6455 | MDIO_PMA_REG_8481_LED1_MASK, | 6600 | MDIO_PMA_REG_8481_LED1_MASK, |
6456 | 0x10); | 6601 | 0x10); |
6457 | 6602 | ||
6458 | bnx2x_cl45_write(bp, phy, | 6603 | bnx2x_cl45_write(bp, phy, |
6459 | MDIO_PMA_DEVAD, | 6604 | MDIO_PMA_DEVAD, |
6460 | MDIO_PMA_REG_8481_LED2_MASK, | 6605 | MDIO_PMA_REG_8481_LED2_MASK, |
6461 | 0x80); | 6606 | 0x80); |
6462 | 6607 | ||
6463 | bnx2x_cl45_write(bp, phy, | 6608 | bnx2x_cl45_write(bp, phy, |
6464 | MDIO_PMA_DEVAD, | 6609 | MDIO_PMA_DEVAD, |
6465 | MDIO_PMA_REG_8481_LED3_MASK, | 6610 | MDIO_PMA_REG_8481_LED3_MASK, |
6466 | 0x98); | 6611 | 0x98); |
6467 | 6612 | ||
6468 | bnx2x_cl45_write(bp, phy, | 6613 | bnx2x_cl45_write(bp, phy, |
6469 | MDIO_PMA_DEVAD, | 6614 | MDIO_PMA_DEVAD, |
6470 | MDIO_PMA_REG_8481_LED5_MASK, | 6615 | MDIO_PMA_REG_8481_LED5_MASK, |
6471 | 0x40); | 6616 | 0x40); |
6472 | 6617 | ||
6473 | } else { | 6618 | } else { |
6474 | bnx2x_cl45_write(bp, phy, | 6619 | bnx2x_cl45_write(bp, phy, |
@@ -6513,10 +6658,10 @@ static u8 bnx2x_7101_config_init(struct bnx2x_phy *phy, | |||
6513 | 6658 | ||
6514 | /* Restore normal power mode*/ | 6659 | /* Restore normal power mode*/ |
6515 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 6660 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
6516 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); | 6661 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, params->port); |
6517 | /* HW reset */ | 6662 | /* HW reset */ |
6518 | bnx2x_ext_phy_hw_reset(bp, params->port); | 6663 | bnx2x_ext_phy_hw_reset(bp, params->port); |
6519 | bnx2x_wait_reset_complete(bp, phy); | 6664 | bnx2x_wait_reset_complete(bp, phy, params); |
6520 | 6665 | ||
6521 | bnx2x_cl45_write(bp, phy, | 6666 | bnx2x_cl45_write(bp, phy, |
6522 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x1); | 6667 | MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_CTRL, 0x1); |
@@ -6563,9 +6708,7 @@ static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy, | |||
6563 | DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", | 6708 | DP(NETIF_MSG_LINK, "10G-base-T PMA status 0x%x->0x%x\n", |
6564 | val2, val1); | 6709 | val2, val1); |
6565 | link_up = ((val1 & 4) == 4); | 6710 | link_up = ((val1 & 4) == 4); |
6566 | /* if link is up | 6711 | /* if link is up print the AN outcome of the SFX7101 PHY */ |
6567 | * print the AN outcome of the SFX7101 PHY | ||
6568 | */ | ||
6569 | if (link_up) { | 6712 | if (link_up) { |
6570 | bnx2x_cl45_read(bp, phy, | 6713 | bnx2x_cl45_read(bp, phy, |
6571 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, | 6714 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, |
@@ -6599,20 +6742,20 @@ void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy) | |||
6599 | u16 val, cnt; | 6742 | u16 val, cnt; |
6600 | 6743 | ||
6601 | bnx2x_cl45_read(bp, phy, | 6744 | bnx2x_cl45_read(bp, phy, |
6602 | MDIO_PMA_DEVAD, | 6745 | MDIO_PMA_DEVAD, |
6603 | MDIO_PMA_REG_7101_RESET, &val); | 6746 | MDIO_PMA_REG_7101_RESET, &val); |
6604 | 6747 | ||
6605 | for (cnt = 0; cnt < 10; cnt++) { | 6748 | for (cnt = 0; cnt < 10; cnt++) { |
6606 | msleep(50); | 6749 | msleep(50); |
6607 | /* Writes a self-clearing reset */ | 6750 | /* Writes a self-clearing reset */ |
6608 | bnx2x_cl45_write(bp, phy, | 6751 | bnx2x_cl45_write(bp, phy, |
6609 | MDIO_PMA_DEVAD, | 6752 | MDIO_PMA_DEVAD, |
6610 | MDIO_PMA_REG_7101_RESET, | 6753 | MDIO_PMA_REG_7101_RESET, |
6611 | (val | (1<<15))); | 6754 | (val | (1<<15))); |
6612 | /* Wait for clear */ | 6755 | /* Wait for clear */ |
6613 | bnx2x_cl45_read(bp, phy, | 6756 | bnx2x_cl45_read(bp, phy, |
6614 | MDIO_PMA_DEVAD, | 6757 | MDIO_PMA_DEVAD, |
6615 | MDIO_PMA_REG_7101_RESET, &val); | 6758 | MDIO_PMA_REG_7101_RESET, &val); |
6616 | 6759 | ||
6617 | if ((val & (1<<15)) == 0) | 6760 | if ((val & (1<<15)) == 0) |
6618 | break; | 6761 | break; |
@@ -6623,10 +6766,10 @@ static void bnx2x_7101_hw_reset(struct bnx2x_phy *phy, | |||
6623 | struct link_params *params) { | 6766 | struct link_params *params) { |
6624 | /* Low power mode is controlled by GPIO 2 */ | 6767 | /* Low power mode is controlled by GPIO 2 */ |
6625 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_2, | 6768 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_2, |
6626 | MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); | 6769 | MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); |
6627 | /* The PHY reset is controlled by GPIO 1 */ | 6770 | /* The PHY reset is controlled by GPIO 1 */ |
6628 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, | 6771 | bnx2x_set_gpio(params->bp, MISC_REGISTERS_GPIO_1, |
6629 | MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); | 6772 | MISC_REGISTERS_GPIO_OUTPUT_LOW, params->port); |
6630 | } | 6773 | } |
6631 | 6774 | ||
6632 | static void bnx2x_7101_set_link_led(struct bnx2x_phy *phy, | 6775 | static void bnx2x_7101_set_link_led(struct bnx2x_phy *phy, |
@@ -6668,9 +6811,9 @@ static struct bnx2x_phy phy_null = { | |||
6668 | .supported = 0, | 6811 | .supported = 0, |
6669 | .media_type = ETH_PHY_NOT_PRESENT, | 6812 | .media_type = ETH_PHY_NOT_PRESENT, |
6670 | .ver_addr = 0, | 6813 | .ver_addr = 0, |
6671 | .req_flow_ctrl = 0, | 6814 | .req_flow_ctrl = 0, |
6672 | .req_line_speed = 0, | 6815 | .req_line_speed = 0, |
6673 | .speed_cap_mask = 0, | 6816 | .speed_cap_mask = 0, |
6674 | .req_duplex = 0, | 6817 | .req_duplex = 0, |
6675 | .rsrv = 0, | 6818 | .rsrv = 0, |
6676 | .config_init = (config_init_t)NULL, | 6819 | .config_init = (config_init_t)NULL, |
@@ -6705,8 +6848,8 @@ static struct bnx2x_phy phy_serdes = { | |||
6705 | .media_type = ETH_PHY_UNSPECIFIED, | 6848 | .media_type = ETH_PHY_UNSPECIFIED, |
6706 | .ver_addr = 0, | 6849 | .ver_addr = 0, |
6707 | .req_flow_ctrl = 0, | 6850 | .req_flow_ctrl = 0, |
6708 | .req_line_speed = 0, | 6851 | .req_line_speed = 0, |
6709 | .speed_cap_mask = 0, | 6852 | .speed_cap_mask = 0, |
6710 | .req_duplex = 0, | 6853 | .req_duplex = 0, |
6711 | .rsrv = 0, | 6854 | .rsrv = 0, |
6712 | .config_init = (config_init_t)bnx2x_init_serdes, | 6855 | .config_init = (config_init_t)bnx2x_init_serdes, |
@@ -6742,8 +6885,8 @@ static struct bnx2x_phy phy_xgxs = { | |||
6742 | .media_type = ETH_PHY_UNSPECIFIED, | 6885 | .media_type = ETH_PHY_UNSPECIFIED, |
6743 | .ver_addr = 0, | 6886 | .ver_addr = 0, |
6744 | .req_flow_ctrl = 0, | 6887 | .req_flow_ctrl = 0, |
6745 | .req_line_speed = 0, | 6888 | .req_line_speed = 0, |
6746 | .speed_cap_mask = 0, | 6889 | .speed_cap_mask = 0, |
6747 | .req_duplex = 0, | 6890 | .req_duplex = 0, |
6748 | .rsrv = 0, | 6891 | .rsrv = 0, |
6749 | .config_init = (config_init_t)bnx2x_init_xgxs, | 6892 | .config_init = (config_init_t)bnx2x_init_xgxs, |
@@ -6773,8 +6916,8 @@ static struct bnx2x_phy phy_7101 = { | |||
6773 | .media_type = ETH_PHY_BASE_T, | 6916 | .media_type = ETH_PHY_BASE_T, |
6774 | .ver_addr = 0, | 6917 | .ver_addr = 0, |
6775 | .req_flow_ctrl = 0, | 6918 | .req_flow_ctrl = 0, |
6776 | .req_line_speed = 0, | 6919 | .req_line_speed = 0, |
6777 | .speed_cap_mask = 0, | 6920 | .speed_cap_mask = 0, |
6778 | .req_duplex = 0, | 6921 | .req_duplex = 0, |
6779 | .rsrv = 0, | 6922 | .rsrv = 0, |
6780 | .config_init = (config_init_t)bnx2x_7101_config_init, | 6923 | .config_init = (config_init_t)bnx2x_7101_config_init, |
@@ -6804,9 +6947,9 @@ static struct bnx2x_phy phy_8073 = { | |||
6804 | SUPPORTED_Asym_Pause), | 6947 | SUPPORTED_Asym_Pause), |
6805 | .media_type = ETH_PHY_UNSPECIFIED, | 6948 | .media_type = ETH_PHY_UNSPECIFIED, |
6806 | .ver_addr = 0, | 6949 | .ver_addr = 0, |
6807 | .req_flow_ctrl = 0, | 6950 | .req_flow_ctrl = 0, |
6808 | .req_line_speed = 0, | 6951 | .req_line_speed = 0, |
6809 | .speed_cap_mask = 0, | 6952 | .speed_cap_mask = 0, |
6810 | .req_duplex = 0, | 6953 | .req_duplex = 0, |
6811 | .rsrv = 0, | 6954 | .rsrv = 0, |
6812 | .config_init = (config_init_t)bnx2x_8073_config_init, | 6955 | .config_init = (config_init_t)bnx2x_8073_config_init, |
@@ -7015,6 +7158,43 @@ static struct bnx2x_phy phy_84823 = { | |||
7015 | .phy_specific_func = (phy_specific_func_t)NULL | 7158 | .phy_specific_func = (phy_specific_func_t)NULL |
7016 | }; | 7159 | }; |
7017 | 7160 | ||
7161 | static struct bnx2x_phy phy_84833 = { | ||
7162 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833, | ||
7163 | .addr = 0xff, | ||
7164 | .flags = FLAGS_FAN_FAILURE_DET_REQ | | ||
7165 | FLAGS_REARM_LATCH_SIGNAL, | ||
7166 | .def_md_devad = 0, | ||
7167 | .reserved = 0, | ||
7168 | .rx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | ||
7169 | .tx_preemphasis = {0xffff, 0xffff, 0xffff, 0xffff}, | ||
7170 | .mdio_ctrl = 0, | ||
7171 | .supported = (SUPPORTED_10baseT_Half | | ||
7172 | SUPPORTED_10baseT_Full | | ||
7173 | SUPPORTED_100baseT_Half | | ||
7174 | SUPPORTED_100baseT_Full | | ||
7175 | SUPPORTED_1000baseT_Full | | ||
7176 | SUPPORTED_10000baseT_Full | | ||
7177 | SUPPORTED_TP | | ||
7178 | SUPPORTED_Autoneg | | ||
7179 | SUPPORTED_Pause | | ||
7180 | SUPPORTED_Asym_Pause), | ||
7181 | .media_type = ETH_PHY_BASE_T, | ||
7182 | .ver_addr = 0, | ||
7183 | .req_flow_ctrl = 0, | ||
7184 | .req_line_speed = 0, | ||
7185 | .speed_cap_mask = 0, | ||
7186 | .req_duplex = 0, | ||
7187 | .rsrv = 0, | ||
7188 | .config_init = (config_init_t)bnx2x_848x3_config_init, | ||
7189 | .read_status = (read_status_t)bnx2x_848xx_read_status, | ||
7190 | .link_reset = (link_reset_t)bnx2x_848x3_link_reset, | ||
7191 | .config_loopback = (config_loopback_t)NULL, | ||
7192 | .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, | ||
7193 | .hw_reset = (hw_reset_t)NULL, | ||
7194 | .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, | ||
7195 | .phy_specific_func = (phy_specific_func_t)NULL | ||
7196 | }; | ||
7197 | |||
7018 | /*****************************************************************/ | 7198 | /*****************************************************************/ |
7019 | /* */ | 7199 | /* */ |
7020 | /* Populate the phy according. Main function: bnx2x_populate_phy */ | 7200 | /* Populate the phy according. Main function: bnx2x_populate_phy */ |
@@ -7028,7 +7208,7 @@ static void bnx2x_populate_preemphasis(struct bnx2x *bp, u32 shmem_base, | |||
7028 | /* Get the 4 lanes xgxs config rx and tx */ | 7208 | /* Get the 4 lanes xgxs config rx and tx */ |
7029 | u32 rx = 0, tx = 0, i; | 7209 | u32 rx = 0, tx = 0, i; |
7030 | for (i = 0; i < 2; i++) { | 7210 | for (i = 0; i < 2; i++) { |
7031 | /** | 7211 | /* |
7032 | * INT_PHY and EXT_PHY1 share the same value location in the | 7212 | * INT_PHY and EXT_PHY1 share the same value location in the |
7033 | * shmem. When num_phys is greater than 1, than this value | 7213 | * shmem. When num_phys is greater than 1, than this value |
7034 | * applies only to EXT_PHY1 | 7214 | * applies only to EXT_PHY1 |
@@ -7036,19 +7216,19 @@ static void bnx2x_populate_preemphasis(struct bnx2x *bp, u32 shmem_base, | |||
7036 | if (phy_index == INT_PHY || phy_index == EXT_PHY1) { | 7216 | if (phy_index == INT_PHY || phy_index == EXT_PHY1) { |
7037 | rx = REG_RD(bp, shmem_base + | 7217 | rx = REG_RD(bp, shmem_base + |
7038 | offsetof(struct shmem_region, | 7218 | offsetof(struct shmem_region, |
7039 | dev_info.port_hw_config[port].xgxs_config_rx[i<<1])); | 7219 | dev_info.port_hw_config[port].xgxs_config_rx[i<<1])); |
7040 | 7220 | ||
7041 | tx = REG_RD(bp, shmem_base + | 7221 | tx = REG_RD(bp, shmem_base + |
7042 | offsetof(struct shmem_region, | 7222 | offsetof(struct shmem_region, |
7043 | dev_info.port_hw_config[port].xgxs_config_tx[i<<1])); | 7223 | dev_info.port_hw_config[port].xgxs_config_tx[i<<1])); |
7044 | } else { | 7224 | } else { |
7045 | rx = REG_RD(bp, shmem_base + | 7225 | rx = REG_RD(bp, shmem_base + |
7046 | offsetof(struct shmem_region, | 7226 | offsetof(struct shmem_region, |
7047 | dev_info.port_hw_config[port].xgxs_config2_rx[i<<1])); | 7227 | dev_info.port_hw_config[port].xgxs_config2_rx[i<<1])); |
7048 | 7228 | ||
7049 | tx = REG_RD(bp, shmem_base + | 7229 | tx = REG_RD(bp, shmem_base + |
7050 | offsetof(struct shmem_region, | 7230 | offsetof(struct shmem_region, |
7051 | dev_info.port_hw_config[port].xgxs_config2_rx[i<<1])); | 7231 | dev_info.port_hw_config[port].xgxs_config2_rx[i<<1])); |
7052 | } | 7232 | } |
7053 | 7233 | ||
7054 | phy->rx_preemphasis[i << 1] = ((rx>>16) & 0xffff); | 7234 | phy->rx_preemphasis[i << 1] = ((rx>>16) & 0xffff); |
@@ -7168,6 +7348,9 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, | |||
7168 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823: | 7348 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823: |
7169 | *phy = phy_84823; | 7349 | *phy = phy_84823; |
7170 | break; | 7350 | break; |
7351 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833: | ||
7352 | *phy = phy_84833; | ||
7353 | break; | ||
7171 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: | 7354 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: |
7172 | *phy = phy_7101; | 7355 | *phy = phy_7101; |
7173 | break; | 7356 | break; |
@@ -7182,21 +7365,21 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, | |||
7182 | phy->addr = XGXS_EXT_PHY_ADDR(ext_phy_config); | 7365 | phy->addr = XGXS_EXT_PHY_ADDR(ext_phy_config); |
7183 | bnx2x_populate_preemphasis(bp, shmem_base, phy, port, phy_index); | 7366 | bnx2x_populate_preemphasis(bp, shmem_base, phy, port, phy_index); |
7184 | 7367 | ||
7185 | /** | 7368 | /* |
7186 | * The shmem address of the phy version is located on different | 7369 | * The shmem address of the phy version is located on different |
7187 | * structures. In case this structure is too old, do not set | 7370 | * structures. In case this structure is too old, do not set |
7188 | * the address | 7371 | * the address |
7189 | */ | 7372 | */ |
7190 | config2 = REG_RD(bp, shmem_base + offsetof(struct shmem_region, | 7373 | config2 = REG_RD(bp, shmem_base + offsetof(struct shmem_region, |
7191 | dev_info.shared_hw_config.config2)); | 7374 | dev_info.shared_hw_config.config2)); |
7192 | if (phy_index == EXT_PHY1) { | 7375 | if (phy_index == EXT_PHY1) { |
7193 | phy->ver_addr = shmem_base + offsetof(struct shmem_region, | 7376 | phy->ver_addr = shmem_base + offsetof(struct shmem_region, |
7194 | port_mb[port].ext_phy_fw_version); | 7377 | port_mb[port].ext_phy_fw_version); |
7195 | 7378 | ||
7196 | /* Check specific mdc mdio settings */ | 7379 | /* Check specific mdc mdio settings */ |
7197 | if (config2 & SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK) | 7380 | if (config2 & SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK) |
7198 | mdc_mdio_access = config2 & | 7381 | mdc_mdio_access = config2 & |
7199 | SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK; | 7382 | SHARED_HW_CFG_MDC_MDIO_ACCESS1_MASK; |
7200 | } else { | 7383 | } else { |
7201 | u32 size = REG_RD(bp, shmem2_base); | 7384 | u32 size = REG_RD(bp, shmem2_base); |
7202 | 7385 | ||
@@ -7215,7 +7398,7 @@ static u8 bnx2x_populate_ext_phy(struct bnx2x *bp, | |||
7215 | } | 7398 | } |
7216 | phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); | 7399 | phy->mdio_ctrl = bnx2x_get_emac_base(bp, mdc_mdio_access, port); |
7217 | 7400 | ||
7218 | /** | 7401 | /* |
7219 | * In case mdc/mdio_access of the external phy is different than the | 7402 | * In case mdc/mdio_access of the external phy is different than the |
7220 | * mdc/mdio access of the XGXS, a HW lock must be taken in each access | 7403 | * mdc/mdio access of the XGXS, a HW lock must be taken in each access |
7221 | * to prevent one port interfere with another port's CL45 operations. | 7404 | * to prevent one port interfere with another port's CL45 operations. |
@@ -7250,18 +7433,20 @@ static void bnx2x_phy_def_cfg(struct link_params *params, | |||
7250 | /* Populate the default phy configuration for MF mode */ | 7433 | /* Populate the default phy configuration for MF mode */ |
7251 | if (phy_index == EXT_PHY2) { | 7434 | if (phy_index == EXT_PHY2) { |
7252 | link_config = REG_RD(bp, params->shmem_base + | 7435 | link_config = REG_RD(bp, params->shmem_base + |
7253 | offsetof(struct shmem_region, dev_info. | 7436 | offsetof(struct shmem_region, dev_info. |
7254 | port_feature_config[params->port].link_config2)); | 7437 | port_feature_config[params->port].link_config2)); |
7255 | phy->speed_cap_mask = REG_RD(bp, params->shmem_base + | 7438 | phy->speed_cap_mask = REG_RD(bp, params->shmem_base + |
7256 | offsetof(struct shmem_region, dev_info. | 7439 | offsetof(struct shmem_region, |
7440 | dev_info. | ||
7257 | port_hw_config[params->port].speed_capability_mask2)); | 7441 | port_hw_config[params->port].speed_capability_mask2)); |
7258 | } else { | 7442 | } else { |
7259 | link_config = REG_RD(bp, params->shmem_base + | 7443 | link_config = REG_RD(bp, params->shmem_base + |
7260 | offsetof(struct shmem_region, dev_info. | 7444 | offsetof(struct shmem_region, dev_info. |
7261 | port_feature_config[params->port].link_config)); | 7445 | port_feature_config[params->port].link_config)); |
7262 | phy->speed_cap_mask = REG_RD(bp, params->shmem_base + | 7446 | phy->speed_cap_mask = REG_RD(bp, params->shmem_base + |
7263 | offsetof(struct shmem_region, dev_info. | 7447 | offsetof(struct shmem_region, |
7264 | port_hw_config[params->port].speed_capability_mask)); | 7448 | dev_info. |
7449 | port_hw_config[params->port].speed_capability_mask)); | ||
7265 | } | 7450 | } |
7266 | DP(NETIF_MSG_LINK, "Default config phy idx %x cfg 0x%x speed_cap_mask" | 7451 | DP(NETIF_MSG_LINK, "Default config phy idx %x cfg 0x%x speed_cap_mask" |
7267 | " 0x%x\n", phy_index, link_config, phy->speed_cap_mask); | 7452 | " 0x%x\n", phy_index, link_config, phy->speed_cap_mask); |
@@ -7408,7 +7593,7 @@ static void set_phy_vars(struct link_params *params) | |||
7408 | else if (phy_index == EXT_PHY2) | 7593 | else if (phy_index == EXT_PHY2) |
7409 | actual_phy_idx = EXT_PHY1; | 7594 | actual_phy_idx = EXT_PHY1; |
7410 | } | 7595 | } |
7411 | params->phy[actual_phy_idx].req_flow_ctrl = | 7596 | params->phy[actual_phy_idx].req_flow_ctrl = |
7412 | params->req_flow_ctrl[link_cfg_idx]; | 7597 | params->req_flow_ctrl[link_cfg_idx]; |
7413 | 7598 | ||
7414 | params->phy[actual_phy_idx].req_line_speed = | 7599 | params->phy[actual_phy_idx].req_line_speed = |
@@ -7461,57 +7646,6 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7461 | set_phy_vars(params); | 7646 | set_phy_vars(params); |
7462 | 7647 | ||
7463 | DP(NETIF_MSG_LINK, "Num of phys on board: %d\n", params->num_phys); | 7648 | DP(NETIF_MSG_LINK, "Num of phys on board: %d\n", params->num_phys); |
7464 | if (CHIP_REV_IS_FPGA(bp)) { | ||
7465 | |||
7466 | vars->link_up = 1; | ||
7467 | vars->line_speed = SPEED_10000; | ||
7468 | vars->duplex = DUPLEX_FULL; | ||
7469 | vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; | ||
7470 | vars->link_status = (LINK_STATUS_LINK_UP | LINK_10GTFD); | ||
7471 | /* enable on E1.5 FPGA */ | ||
7472 | if (CHIP_IS_E1H(bp)) { | ||
7473 | vars->flow_ctrl |= | ||
7474 | (BNX2X_FLOW_CTRL_TX | | ||
7475 | BNX2X_FLOW_CTRL_RX); | ||
7476 | vars->link_status |= | ||
7477 | (LINK_STATUS_TX_FLOW_CONTROL_ENABLED | | ||
7478 | LINK_STATUS_RX_FLOW_CONTROL_ENABLED); | ||
7479 | } | ||
7480 | |||
7481 | bnx2x_emac_enable(params, vars, 0); | ||
7482 | if (!(CHIP_IS_E2(bp))) | ||
7483 | bnx2x_pbf_update(params, vars->flow_ctrl, | ||
7484 | vars->line_speed); | ||
7485 | /* disable drain */ | ||
7486 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); | ||
7487 | |||
7488 | /* update shared memory */ | ||
7489 | bnx2x_update_mng(params, vars->link_status); | ||
7490 | |||
7491 | return 0; | ||
7492 | |||
7493 | } else | ||
7494 | if (CHIP_REV_IS_EMUL(bp)) { | ||
7495 | |||
7496 | vars->link_up = 1; | ||
7497 | vars->line_speed = SPEED_10000; | ||
7498 | vars->duplex = DUPLEX_FULL; | ||
7499 | vars->flow_ctrl = BNX2X_FLOW_CTRL_NONE; | ||
7500 | vars->link_status = (LINK_STATUS_LINK_UP | LINK_10GTFD); | ||
7501 | |||
7502 | bnx2x_bmac_enable(params, vars, 0); | ||
7503 | |||
7504 | bnx2x_pbf_update(params, vars->flow_ctrl, vars->line_speed); | ||
7505 | /* Disable drain */ | ||
7506 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE | ||
7507 | + params->port*4, 0); | ||
7508 | |||
7509 | /* update shared memory */ | ||
7510 | bnx2x_update_mng(params, vars->link_status); | ||
7511 | |||
7512 | return 0; | ||
7513 | |||
7514 | } else | ||
7515 | if (params->loopback_mode == LOOPBACK_BMAC) { | 7649 | if (params->loopback_mode == LOOPBACK_BMAC) { |
7516 | 7650 | ||
7517 | vars->link_up = 1; | 7651 | vars->link_up = 1; |
@@ -7527,8 +7661,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7527 | /* set bmac loopback */ | 7661 | /* set bmac loopback */ |
7528 | bnx2x_bmac_enable(params, vars, 1); | 7662 | bnx2x_bmac_enable(params, vars, 1); |
7529 | 7663 | ||
7530 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + | 7664 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
7531 | params->port*4, 0); | ||
7532 | 7665 | ||
7533 | } else if (params->loopback_mode == LOOPBACK_EMAC) { | 7666 | } else if (params->loopback_mode == LOOPBACK_EMAC) { |
7534 | 7667 | ||
@@ -7544,8 +7677,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7544 | /* set bmac loopback */ | 7677 | /* set bmac loopback */ |
7545 | bnx2x_emac_enable(params, vars, 1); | 7678 | bnx2x_emac_enable(params, vars, 1); |
7546 | bnx2x_emac_program(params, vars); | 7679 | bnx2x_emac_program(params, vars); |
7547 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + | 7680 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); |
7548 | params->port*4, 0); | ||
7549 | 7681 | ||
7550 | } else if ((params->loopback_mode == LOOPBACK_XGXS) || | 7682 | } else if ((params->loopback_mode == LOOPBACK_XGXS) || |
7551 | (params->loopback_mode == LOOPBACK_EXT_PHY)) { | 7683 | (params->loopback_mode == LOOPBACK_EXT_PHY)) { |
@@ -7568,8 +7700,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7568 | bnx2x_emac_program(params, vars); | 7700 | bnx2x_emac_program(params, vars); |
7569 | bnx2x_emac_enable(params, vars, 0); | 7701 | bnx2x_emac_enable(params, vars, 0); |
7570 | } else | 7702 | } else |
7571 | bnx2x_bmac_enable(params, vars, 0); | 7703 | bnx2x_bmac_enable(params, vars, 0); |
7572 | |||
7573 | if (params->loopback_mode == LOOPBACK_XGXS) { | 7704 | if (params->loopback_mode == LOOPBACK_XGXS) { |
7574 | /* set 10G XGXS loopback */ | 7705 | /* set 10G XGXS loopback */ |
7575 | params->phy[INT_PHY].config_loopback( | 7706 | params->phy[INT_PHY].config_loopback( |
@@ -7587,9 +7718,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7587 | params); | 7718 | params); |
7588 | } | 7719 | } |
7589 | } | 7720 | } |
7590 | 7721 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0); | |
7591 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + | ||
7592 | params->port*4, 0); | ||
7593 | 7722 | ||
7594 | bnx2x_set_led(params, vars, | 7723 | bnx2x_set_led(params, vars, |
7595 | LED_MODE_OPER, vars->line_speed); | 7724 | LED_MODE_OPER, vars->line_speed); |
@@ -7608,7 +7737,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
7608 | return 0; | 7737 | return 0; |
7609 | } | 7738 | } |
7610 | u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | 7739 | u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, |
7611 | u8 reset_ext_phy) | 7740 | u8 reset_ext_phy) |
7612 | { | 7741 | { |
7613 | struct bnx2x *bp = params->bp; | 7742 | struct bnx2x *bp = params->bp; |
7614 | u8 phy_index, port = params->port, clear_latch_ind = 0; | 7743 | u8 phy_index, port = params->port, clear_latch_ind = 0; |
@@ -7617,10 +7746,10 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | |||
7617 | vars->link_status = 0; | 7746 | vars->link_status = 0; |
7618 | bnx2x_update_mng(params, vars->link_status); | 7747 | bnx2x_update_mng(params, vars->link_status); |
7619 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, | 7748 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, |
7620 | (NIG_MASK_XGXS0_LINK_STATUS | | 7749 | (NIG_MASK_XGXS0_LINK_STATUS | |
7621 | NIG_MASK_XGXS0_LINK10G | | 7750 | NIG_MASK_XGXS0_LINK10G | |
7622 | NIG_MASK_SERDES0_LINK_STATUS | | 7751 | NIG_MASK_SERDES0_LINK_STATUS | |
7623 | NIG_MASK_MI_INT)); | 7752 | NIG_MASK_MI_INT)); |
7624 | 7753 | ||
7625 | /* activate nig drain */ | 7754 | /* activate nig drain */ |
7626 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); | 7755 | REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + port*4, 1); |
@@ -7719,21 +7848,22 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7719 | /* disable attentions */ | 7848 | /* disable attentions */ |
7720 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + | 7849 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + |
7721 | port_of_path*4, | 7850 | port_of_path*4, |
7722 | (NIG_MASK_XGXS0_LINK_STATUS | | 7851 | (NIG_MASK_XGXS0_LINK_STATUS | |
7723 | NIG_MASK_XGXS0_LINK10G | | 7852 | NIG_MASK_XGXS0_LINK10G | |
7724 | NIG_MASK_SERDES0_LINK_STATUS | | 7853 | NIG_MASK_SERDES0_LINK_STATUS | |
7725 | NIG_MASK_MI_INT)); | 7854 | NIG_MASK_MI_INT)); |
7726 | 7855 | ||
7727 | /* Need to take the phy out of low power mode in order | 7856 | /* Need to take the phy out of low power mode in order |
7728 | to write to access its registers */ | 7857 | to write to access its registers */ |
7729 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 7858 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
7730 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, port); | 7859 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, |
7860 | port); | ||
7731 | 7861 | ||
7732 | /* Reset the phy */ | 7862 | /* Reset the phy */ |
7733 | bnx2x_cl45_write(bp, &phy[port], | 7863 | bnx2x_cl45_write(bp, &phy[port], |
7734 | MDIO_PMA_DEVAD, | 7864 | MDIO_PMA_DEVAD, |
7735 | MDIO_PMA_REG_CTRL, | 7865 | MDIO_PMA_REG_CTRL, |
7736 | 1<<15); | 7866 | 1<<15); |
7737 | } | 7867 | } |
7738 | 7868 | ||
7739 | /* Add delay of 150ms after reset */ | 7869 | /* Add delay of 150ms after reset */ |
@@ -7762,18 +7892,20 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7762 | 7892 | ||
7763 | /* Only set bit 10 = 1 (Tx power down) */ | 7893 | /* Only set bit 10 = 1 (Tx power down) */ |
7764 | bnx2x_cl45_read(bp, phy_blk[port], | 7894 | bnx2x_cl45_read(bp, phy_blk[port], |
7765 | MDIO_PMA_DEVAD, | 7895 | MDIO_PMA_DEVAD, |
7766 | MDIO_PMA_REG_TX_POWER_DOWN, &val); | 7896 | MDIO_PMA_REG_TX_POWER_DOWN, &val); |
7767 | 7897 | ||
7768 | /* Phase1 of TX_POWER_DOWN reset */ | 7898 | /* Phase1 of TX_POWER_DOWN reset */ |
7769 | bnx2x_cl45_write(bp, phy_blk[port], | 7899 | bnx2x_cl45_write(bp, phy_blk[port], |
7770 | MDIO_PMA_DEVAD, | 7900 | MDIO_PMA_DEVAD, |
7771 | MDIO_PMA_REG_TX_POWER_DOWN, | 7901 | MDIO_PMA_REG_TX_POWER_DOWN, |
7772 | (val | 1<<10)); | 7902 | (val | 1<<10)); |
7773 | } | 7903 | } |
7774 | 7904 | ||
7775 | /* Toggle Transmitter: Power down and then up with 600ms | 7905 | /* |
7776 | delay between */ | 7906 | * Toggle Transmitter: Power down and then up with 600ms delay |
7907 | * between | ||
7908 | */ | ||
7777 | msleep(600); | 7909 | msleep(600); |
7778 | 7910 | ||
7779 | /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */ | 7911 | /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */ |
@@ -7781,25 +7913,25 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7781 | /* Phase2 of POWER_DOWN_RESET */ | 7913 | /* Phase2 of POWER_DOWN_RESET */ |
7782 | /* Release bit 10 (Release Tx power down) */ | 7914 | /* Release bit 10 (Release Tx power down) */ |
7783 | bnx2x_cl45_read(bp, phy_blk[port], | 7915 | bnx2x_cl45_read(bp, phy_blk[port], |
7784 | MDIO_PMA_DEVAD, | 7916 | MDIO_PMA_DEVAD, |
7785 | MDIO_PMA_REG_TX_POWER_DOWN, &val); | 7917 | MDIO_PMA_REG_TX_POWER_DOWN, &val); |
7786 | 7918 | ||
7787 | bnx2x_cl45_write(bp, phy_blk[port], | 7919 | bnx2x_cl45_write(bp, phy_blk[port], |
7788 | MDIO_PMA_DEVAD, | 7920 | MDIO_PMA_DEVAD, |
7789 | MDIO_PMA_REG_TX_POWER_DOWN, (val & (~(1<<10)))); | 7921 | MDIO_PMA_REG_TX_POWER_DOWN, (val & (~(1<<10)))); |
7790 | msleep(15); | 7922 | msleep(15); |
7791 | 7923 | ||
7792 | /* Read modify write the SPI-ROM version select register */ | 7924 | /* Read modify write the SPI-ROM version select register */ |
7793 | bnx2x_cl45_read(bp, phy_blk[port], | 7925 | bnx2x_cl45_read(bp, phy_blk[port], |
7794 | MDIO_PMA_DEVAD, | 7926 | MDIO_PMA_DEVAD, |
7795 | MDIO_PMA_REG_EDC_FFE_MAIN, &val); | 7927 | MDIO_PMA_REG_EDC_FFE_MAIN, &val); |
7796 | bnx2x_cl45_write(bp, phy_blk[port], | 7928 | bnx2x_cl45_write(bp, phy_blk[port], |
7797 | MDIO_PMA_DEVAD, | 7929 | MDIO_PMA_DEVAD, |
7798 | MDIO_PMA_REG_EDC_FFE_MAIN, (val | (1<<12))); | 7930 | MDIO_PMA_REG_EDC_FFE_MAIN, (val | (1<<12))); |
7799 | 7931 | ||
7800 | /* set GPIO2 back to LOW */ | 7932 | /* set GPIO2 back to LOW */ |
7801 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, | 7933 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, |
7802 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); | 7934 | MISC_REGISTERS_GPIO_OUTPUT_LOW, port); |
7803 | } | 7935 | } |
7804 | return 0; | 7936 | return 0; |
7805 | } | 7937 | } |
@@ -7846,32 +7978,90 @@ static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, | |||
7846 | 7978 | ||
7847 | /* Set fault module detected LED on */ | 7979 | /* Set fault module detected LED on */ |
7848 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, | 7980 | bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, |
7849 | MISC_REGISTERS_GPIO_HIGH, | 7981 | MISC_REGISTERS_GPIO_HIGH, |
7850 | port); | 7982 | port); |
7851 | } | 7983 | } |
7852 | 7984 | ||
7853 | return 0; | 7985 | return 0; |
7854 | } | 7986 | } |
7987 | static void bnx2x_get_ext_phy_reset_gpio(struct bnx2x *bp, u32 shmem_base, | ||
7988 | u8 *io_gpio, u8 *io_port) | ||
7989 | { | ||
7990 | |||
7991 | u32 phy_gpio_reset = REG_RD(bp, shmem_base + | ||
7992 | offsetof(struct shmem_region, | ||
7993 | dev_info.port_hw_config[PORT_0].default_cfg)); | ||
7994 | switch (phy_gpio_reset) { | ||
7995 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P0: | ||
7996 | *io_gpio = 0; | ||
7997 | *io_port = 0; | ||
7998 | break; | ||
7999 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P0: | ||
8000 | *io_gpio = 1; | ||
8001 | *io_port = 0; | ||
8002 | break; | ||
8003 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P0: | ||
8004 | *io_gpio = 2; | ||
8005 | *io_port = 0; | ||
8006 | break; | ||
8007 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P0: | ||
8008 | *io_gpio = 3; | ||
8009 | *io_port = 0; | ||
8010 | break; | ||
8011 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO0_P1: | ||
8012 | *io_gpio = 0; | ||
8013 | *io_port = 1; | ||
8014 | break; | ||
8015 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO1_P1: | ||
8016 | *io_gpio = 1; | ||
8017 | *io_port = 1; | ||
8018 | break; | ||
8019 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO2_P1: | ||
8020 | *io_gpio = 2; | ||
8021 | *io_port = 1; | ||
8022 | break; | ||
8023 | case PORT_HW_CFG_EXT_PHY_GPIO_RST_GPIO3_P1: | ||
8024 | *io_gpio = 3; | ||
8025 | *io_port = 1; | ||
8026 | break; | ||
8027 | default: | ||
8028 | /* Don't override the io_gpio and io_port */ | ||
8029 | break; | ||
8030 | } | ||
8031 | } | ||
7855 | static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, | 8032 | static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, |
7856 | u32 shmem_base_path[], | 8033 | u32 shmem_base_path[], |
7857 | u32 shmem2_base_path[], u8 phy_index, | 8034 | u32 shmem2_base_path[], u8 phy_index, |
7858 | u32 chip_id) | 8035 | u32 chip_id) |
7859 | { | 8036 | { |
7860 | s8 port; | 8037 | s8 port, reset_gpio; |
7861 | u32 swap_val, swap_override; | 8038 | u32 swap_val, swap_override; |
7862 | struct bnx2x_phy phy[PORT_MAX]; | 8039 | struct bnx2x_phy phy[PORT_MAX]; |
7863 | struct bnx2x_phy *phy_blk[PORT_MAX]; | 8040 | struct bnx2x_phy *phy_blk[PORT_MAX]; |
7864 | s8 port_of_path; | 8041 | s8 port_of_path; |
7865 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); | 8042 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); |
7866 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | 8043 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); |
7867 | 8044 | ||
8045 | reset_gpio = MISC_REGISTERS_GPIO_1; | ||
7868 | port = 1; | 8046 | port = 1; |
7869 | 8047 | ||
7870 | bnx2x_ext_phy_hw_reset(bp, port ^ (swap_val && swap_override)); | 8048 | /* |
8049 | * Retrieve the reset gpio/port which control the reset. | ||
8050 | * Default is GPIO1, PORT1 | ||
8051 | */ | ||
8052 | bnx2x_get_ext_phy_reset_gpio(bp, shmem_base_path[0], | ||
8053 | (u8 *)&reset_gpio, (u8 *)&port); | ||
7871 | 8054 | ||
7872 | /* Calculate the port based on port swap */ | 8055 | /* Calculate the port based on port swap */ |
7873 | port ^= (swap_val && swap_override); | 8056 | port ^= (swap_val && swap_override); |
7874 | 8057 | ||
8058 | /* Initiate PHY reset*/ | ||
8059 | bnx2x_set_gpio(bp, reset_gpio, MISC_REGISTERS_GPIO_OUTPUT_LOW, | ||
8060 | port); | ||
8061 | msleep(1); | ||
8062 | bnx2x_set_gpio(bp, reset_gpio, MISC_REGISTERS_GPIO_OUTPUT_HIGH, | ||
8063 | port); | ||
8064 | |||
7875 | msleep(5); | 8065 | msleep(5); |
7876 | 8066 | ||
7877 | /* PART1 - Reset both phys */ | 8067 | /* PART1 - Reset both phys */ |
@@ -7907,9 +8097,7 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, | |||
7907 | 8097 | ||
7908 | /* Reset the phy */ | 8098 | /* Reset the phy */ |
7909 | bnx2x_cl45_write(bp, &phy[port], | 8099 | bnx2x_cl45_write(bp, &phy[port], |
7910 | MDIO_PMA_DEVAD, | 8100 | MDIO_PMA_DEVAD, MDIO_PMA_REG_CTRL, 1<<15); |
7911 | MDIO_PMA_REG_CTRL, | ||
7912 | 1<<15); | ||
7913 | } | 8101 | } |
7914 | 8102 | ||
7915 | /* Add delay of 150ms after reset */ | 8103 | /* Add delay of 150ms after reset */ |
@@ -7923,7 +8111,7 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, | |||
7923 | } | 8111 | } |
7924 | /* PART2 - Download firmware to both phys */ | 8112 | /* PART2 - Download firmware to both phys */ |
7925 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { | 8113 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { |
7926 | if (CHIP_IS_E2(bp)) | 8114 | if (CHIP_IS_E2(bp)) |
7927 | port_of_path = 0; | 8115 | port_of_path = 0; |
7928 | else | 8116 | else |
7929 | port_of_path = port; | 8117 | port_of_path = port; |
@@ -7958,8 +8146,10 @@ static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], | |||
7958 | break; | 8146 | break; |
7959 | 8147 | ||
7960 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: | 8148 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: |
7961 | /* GPIO1 affects both ports, so there's need to pull | 8149 | /* |
7962 | it for single port alone */ | 8150 | * GPIO1 affects both ports, so there's need to pull |
8151 | * it for single port alone | ||
8152 | */ | ||
7963 | rc = bnx2x_8726_common_init_phy(bp, shmem_base_path, | 8153 | rc = bnx2x_8726_common_init_phy(bp, shmem_base_path, |
7964 | shmem2_base_path, | 8154 | shmem2_base_path, |
7965 | phy_index, chip_id); | 8155 | phy_index, chip_id); |
@@ -7969,11 +8159,15 @@ static u8 bnx2x_ext_phy_common_init(struct bnx2x *bp, u32 shmem_base_path[], | |||
7969 | break; | 8159 | break; |
7970 | default: | 8160 | default: |
7971 | DP(NETIF_MSG_LINK, | 8161 | DP(NETIF_MSG_LINK, |
7972 | "bnx2x_common_init_phy: ext_phy 0x%x not required\n", | 8162 | "ext_phy 0x%x common init not required\n", |
7973 | ext_phy_type); | 8163 | ext_phy_type); |
7974 | break; | 8164 | break; |
7975 | } | 8165 | } |
7976 | 8166 | ||
8167 | if (rc != 0) | ||
8168 | netdev_err(bp->dev, "Warning: PHY was not initialized," | ||
8169 | " Port %d\n", | ||
8170 | 0); | ||
7977 | return rc; | 8171 | return rc; |
7978 | } | 8172 | } |
7979 | 8173 | ||
@@ -7986,9 +8180,6 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], | |||
7986 | u32 ext_phy_type, ext_phy_config; | 8180 | u32 ext_phy_type, ext_phy_config; |
7987 | DP(NETIF_MSG_LINK, "Begin common phy init\n"); | 8181 | DP(NETIF_MSG_LINK, "Begin common phy init\n"); |
7988 | 8182 | ||
7989 | if (CHIP_REV_IS_EMUL(bp)) | ||
7990 | return 0; | ||
7991 | |||
7992 | /* Check if common init was already done */ | 8183 | /* Check if common init was already done */ |
7993 | phy_ver = REG_RD(bp, shmem_base_path[0] + | 8184 | phy_ver = REG_RD(bp, shmem_base_path[0] + |
7994 | offsetof(struct shmem_region, | 8185 | offsetof(struct shmem_region, |
diff --git a/drivers/net/bnx2x/bnx2x_link.h b/drivers/net/bnx2x/bnx2x_link.h index bedab1a942c4..92f36b6950dc 100644 --- a/drivers/net/bnx2x/bnx2x_link.h +++ b/drivers/net/bnx2x/bnx2x_link.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright 2008-2010 Broadcom Corporation | 1 | /* Copyright 2008-2011 Broadcom Corporation |
2 | * | 2 | * |
3 | * Unless you and Broadcom execute a separate written software license | 3 | * Unless you and Broadcom execute a separate written software license |
4 | * agreement governing use of this software, this software is licensed to you | 4 | * agreement governing use of this software, this software is licensed to you |
@@ -33,7 +33,7 @@ | |||
33 | #define BNX2X_FLOW_CTRL_BOTH PORT_FEATURE_FLOW_CONTROL_BOTH | 33 | #define BNX2X_FLOW_CTRL_BOTH PORT_FEATURE_FLOW_CONTROL_BOTH |
34 | #define BNX2X_FLOW_CTRL_NONE PORT_FEATURE_FLOW_CONTROL_NONE | 34 | #define BNX2X_FLOW_CTRL_NONE PORT_FEATURE_FLOW_CONTROL_NONE |
35 | 35 | ||
36 | #define SPEED_AUTO_NEG 0 | 36 | #define SPEED_AUTO_NEG 0 |
37 | #define SPEED_12000 12000 | 37 | #define SPEED_12000 12000 |
38 | #define SPEED_12500 12500 | 38 | #define SPEED_12500 12500 |
39 | #define SPEED_13000 13000 | 39 | #define SPEED_13000 13000 |
@@ -44,8 +44,8 @@ | |||
44 | #define SFP_EEPROM_VENDOR_NAME_SIZE 16 | 44 | #define SFP_EEPROM_VENDOR_NAME_SIZE 16 |
45 | #define SFP_EEPROM_VENDOR_OUI_ADDR 0x25 | 45 | #define SFP_EEPROM_VENDOR_OUI_ADDR 0x25 |
46 | #define SFP_EEPROM_VENDOR_OUI_SIZE 3 | 46 | #define SFP_EEPROM_VENDOR_OUI_SIZE 3 |
47 | #define SFP_EEPROM_PART_NO_ADDR 0x28 | 47 | #define SFP_EEPROM_PART_NO_ADDR 0x28 |
48 | #define SFP_EEPROM_PART_NO_SIZE 16 | 48 | #define SFP_EEPROM_PART_NO_SIZE 16 |
49 | #define PWR_FLT_ERR_MSG_LEN 250 | 49 | #define PWR_FLT_ERR_MSG_LEN 250 |
50 | 50 | ||
51 | #define XGXS_EXT_PHY_TYPE(ext_phy_config) \ | 51 | #define XGXS_EXT_PHY_TYPE(ext_phy_config) \ |
@@ -62,7 +62,7 @@ | |||
62 | #define SINGLE_MEDIA(params) (params->num_phys == 2) | 62 | #define SINGLE_MEDIA(params) (params->num_phys == 2) |
63 | /* Dual Media board contains two external phy with different media */ | 63 | /* Dual Media board contains two external phy with different media */ |
64 | #define DUAL_MEDIA(params) (params->num_phys == 3) | 64 | #define DUAL_MEDIA(params) (params->num_phys == 3) |
65 | #define FW_PARAM_MDIO_CTRL_OFFSET 16 | 65 | #define FW_PARAM_MDIO_CTRL_OFFSET 16 |
66 | #define FW_PARAM_SET(phy_addr, phy_type, mdio_access) \ | 66 | #define FW_PARAM_SET(phy_addr, phy_type, mdio_access) \ |
67 | (phy_addr | phy_type | mdio_access << FW_PARAM_MDIO_CTRL_OFFSET) | 67 | (phy_addr | phy_type | mdio_access << FW_PARAM_MDIO_CTRL_OFFSET) |
68 | 68 | ||
@@ -201,12 +201,14 @@ struct link_params { | |||
201 | 201 | ||
202 | /* Default / User Configuration */ | 202 | /* Default / User Configuration */ |
203 | u8 loopback_mode; | 203 | u8 loopback_mode; |
204 | #define LOOPBACK_NONE 0 | 204 | #define LOOPBACK_NONE 0 |
205 | #define LOOPBACK_EMAC 1 | 205 | #define LOOPBACK_EMAC 1 |
206 | #define LOOPBACK_BMAC 2 | 206 | #define LOOPBACK_BMAC 2 |
207 | #define LOOPBACK_XGXS 3 | 207 | #define LOOPBACK_XGXS 3 |
208 | #define LOOPBACK_EXT_PHY 4 | 208 | #define LOOPBACK_EXT_PHY 4 |
209 | #define LOOPBACK_EXT 5 | 209 | #define LOOPBACK_EXT 5 |
210 | #define LOOPBACK_UMAC 6 | ||
211 | #define LOOPBACK_XMAC 7 | ||
210 | 212 | ||
211 | /* Device parameters */ | 213 | /* Device parameters */ |
212 | u8 mac_addr[6]; | 214 | u8 mac_addr[6]; |
@@ -230,10 +232,11 @@ struct link_params { | |||
230 | /* Phy register parameter */ | 232 | /* Phy register parameter */ |
231 | u32 chip_id; | 233 | u32 chip_id; |
232 | 234 | ||
235 | /* features */ | ||
233 | u32 feature_config_flags; | 236 | u32 feature_config_flags; |
234 | #define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0) | 237 | #define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0) |
235 | #define FEATURE_CONFIG_PFC_ENABLED (1<<1) | 238 | #define FEATURE_CONFIG_PFC_ENABLED (1<<1) |
236 | #define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2) | 239 | #define FEATURE_CONFIG_BC_SUPPORTS_OPT_MDL_VRFY (1<<2) |
237 | #define FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY (1<<3) | 240 | #define FEATURE_CONFIG_BC_SUPPORTS_DUAL_PHY_OPT_MDL_VRFY (1<<3) |
238 | /* Will be populated during common init */ | 241 | /* Will be populated during common init */ |
239 | struct bnx2x_phy phy[MAX_PHYS]; | 242 | struct bnx2x_phy phy[MAX_PHYS]; |
@@ -334,6 +337,11 @@ void bnx2x_ext_phy_hw_reset(struct bnx2x *bp, u8 port); | |||
334 | /* Reset the external of SFX7101 */ | 337 | /* Reset the external of SFX7101 */ |
335 | void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy); | 338 | void bnx2x_sfx7101_sp_sw_reset(struct bnx2x *bp, struct bnx2x_phy *phy); |
336 | 339 | ||
340 | /* Read "byte_cnt" bytes from address "addr" from the SFP+ EEPROM */ | ||
341 | u8 bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | ||
342 | struct link_params *params, u16 addr, | ||
343 | u8 byte_cnt, u8 *o_buf); | ||
344 | |||
337 | void bnx2x_hw_reset_phy(struct link_params *params); | 345 | void bnx2x_hw_reset_phy(struct link_params *params); |
338 | 346 | ||
339 | /* Checks if HW lock is required for this phy/board type */ | 347 | /* Checks if HW lock is required for this phy/board type */ |
@@ -379,7 +387,7 @@ void bnx2x_ets_disabled(struct link_params *params); | |||
379 | 387 | ||
380 | /* Used to configure the ETS to BW limited */ | 388 | /* Used to configure the ETS to BW limited */ |
381 | void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw, | 389 | void bnx2x_ets_bw_limit(const struct link_params *params, const u32 cos0_bw, |
382 | const u32 cos1_bw); | 390 | const u32 cos1_bw); |
383 | 391 | ||
384 | /* Used to configure the ETS to strict */ | 392 | /* Used to configure the ETS to strict */ |
385 | u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos); | 393 | u8 bnx2x_ets_strict(const struct link_params *params, const u8 strict_cos); |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index aa032339e321..bba21d5f708b 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -586,7 +586,7 @@ static int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, | |||
586 | bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]); | 586 | bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]); |
587 | 587 | ||
588 | /* lock the dmae channel */ | 588 | /* lock the dmae channel */ |
589 | mutex_lock(&bp->dmae_mutex); | 589 | spin_lock_bh(&bp->dmae_lock); |
590 | 590 | ||
591 | /* reset completion */ | 591 | /* reset completion */ |
592 | *wb_comp = 0; | 592 | *wb_comp = 0; |
@@ -617,7 +617,7 @@ static int bnx2x_issue_dmae_with_comp(struct bnx2x *bp, | |||
617 | bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]); | 617 | bp->slowpath->wb_data[2], bp->slowpath->wb_data[3]); |
618 | 618 | ||
619 | unlock: | 619 | unlock: |
620 | mutex_unlock(&bp->dmae_mutex); | 620 | spin_unlock_bh(&bp->dmae_lock); |
621 | return rc; | 621 | return rc; |
622 | } | 622 | } |
623 | 623 | ||
@@ -1397,7 +1397,7 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, | |||
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | smp_mb__before_atomic_inc(); | 1399 | smp_mb__before_atomic_inc(); |
1400 | atomic_inc(&bp->spq_left); | 1400 | atomic_inc(&bp->cq_spq_left); |
1401 | /* push the change in fp->state and towards the memory */ | 1401 | /* push the change in fp->state and towards the memory */ |
1402 | smp_wmb(); | 1402 | smp_wmb(); |
1403 | 1403 | ||
@@ -2484,8 +2484,14 @@ static void bnx2x_pf_rx_cl_prep(struct bnx2x *bp, | |||
2484 | rxq_init->sge_map = fp->rx_sge_mapping; | 2484 | rxq_init->sge_map = fp->rx_sge_mapping; |
2485 | rxq_init->rcq_map = fp->rx_comp_mapping; | 2485 | rxq_init->rcq_map = fp->rx_comp_mapping; |
2486 | rxq_init->rcq_np_map = fp->rx_comp_mapping + BCM_PAGE_SIZE; | 2486 | rxq_init->rcq_np_map = fp->rx_comp_mapping + BCM_PAGE_SIZE; |
2487 | rxq_init->mtu = bp->dev->mtu; | 2487 | |
2488 | rxq_init->buf_sz = bp->rx_buf_size; | 2488 | /* Always use mini-jumbo MTU for FCoE L2 ring */ |
2489 | if (IS_FCOE_FP(fp)) | ||
2490 | rxq_init->mtu = BNX2X_FCOE_MINI_JUMBO_MTU; | ||
2491 | else | ||
2492 | rxq_init->mtu = bp->dev->mtu; | ||
2493 | |||
2494 | rxq_init->buf_sz = fp->rx_buf_size; | ||
2489 | rxq_init->cl_qzone_id = fp->cl_qzone_id; | 2495 | rxq_init->cl_qzone_id = fp->cl_qzone_id; |
2490 | rxq_init->cl_id = fp->cl_id; | 2496 | rxq_init->cl_id = fp->cl_id; |
2491 | rxq_init->spcl_id = fp->cl_id; | 2497 | rxq_init->spcl_id = fp->cl_id; |
@@ -2737,11 +2743,18 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, | |||
2737 | 2743 | ||
2738 | spin_lock_bh(&bp->spq_lock); | 2744 | spin_lock_bh(&bp->spq_lock); |
2739 | 2745 | ||
2740 | if (!atomic_read(&bp->spq_left)) { | 2746 | if (common) { |
2741 | BNX2X_ERR("BUG! SPQ ring full!\n"); | 2747 | if (!atomic_read(&bp->eq_spq_left)) { |
2742 | spin_unlock_bh(&bp->spq_lock); | 2748 | BNX2X_ERR("BUG! EQ ring full!\n"); |
2743 | bnx2x_panic(); | 2749 | spin_unlock_bh(&bp->spq_lock); |
2744 | return -EBUSY; | 2750 | bnx2x_panic(); |
2751 | return -EBUSY; | ||
2752 | } | ||
2753 | } else if (!atomic_read(&bp->cq_spq_left)) { | ||
2754 | BNX2X_ERR("BUG! SPQ ring full!\n"); | ||
2755 | spin_unlock_bh(&bp->spq_lock); | ||
2756 | bnx2x_panic(); | ||
2757 | return -EBUSY; | ||
2745 | } | 2758 | } |
2746 | 2759 | ||
2747 | spe = bnx2x_sp_get_next(bp); | 2760 | spe = bnx2x_sp_get_next(bp); |
@@ -2772,20 +2785,26 @@ int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, | |||
2772 | spe->data.update_data_addr.lo = cpu_to_le32(data_lo); | 2785 | spe->data.update_data_addr.lo = cpu_to_le32(data_lo); |
2773 | 2786 | ||
2774 | /* stats ramrod has it's own slot on the spq */ | 2787 | /* stats ramrod has it's own slot on the spq */ |
2775 | if (command != RAMROD_CMD_ID_COMMON_STAT_QUERY) | 2788 | if (command != RAMROD_CMD_ID_COMMON_STAT_QUERY) { |
2776 | /* It's ok if the actual decrement is issued towards the memory | 2789 | /* It's ok if the actual decrement is issued towards the memory |
2777 | * somewhere between the spin_lock and spin_unlock. Thus no | 2790 | * somewhere between the spin_lock and spin_unlock. Thus no |
2778 | * more explict memory barrier is needed. | 2791 | * more explict memory barrier is needed. |
2779 | */ | 2792 | */ |
2780 | atomic_dec(&bp->spq_left); | 2793 | if (common) |
2794 | atomic_dec(&bp->eq_spq_left); | ||
2795 | else | ||
2796 | atomic_dec(&bp->cq_spq_left); | ||
2797 | } | ||
2798 | |||
2781 | 2799 | ||
2782 | DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/, | 2800 | DP(BNX2X_MSG_SP/*NETIF_MSG_TIMER*/, |
2783 | "SPQE[%x] (%x:%x) command %d hw_cid %x data (%x:%x) " | 2801 | "SPQE[%x] (%x:%x) command %d hw_cid %x data (%x:%x) " |
2784 | "type(0x%x) left %x\n", | 2802 | "type(0x%x) left (ETH, COMMON) (%x,%x)\n", |
2785 | bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping), | 2803 | bp->spq_prod_idx, (u32)U64_HI(bp->spq_mapping), |
2786 | (u32)(U64_LO(bp->spq_mapping) + | 2804 | (u32)(U64_LO(bp->spq_mapping) + |
2787 | (void *)bp->spq_prod_bd - (void *)bp->spq), command, | 2805 | (void *)bp->spq_prod_bd - (void *)bp->spq), command, |
2788 | HW_CID(bp, cid), data_hi, data_lo, type, atomic_read(&bp->spq_left)); | 2806 | HW_CID(bp, cid), data_hi, data_lo, type, |
2807 | atomic_read(&bp->cq_spq_left), atomic_read(&bp->eq_spq_left)); | ||
2789 | 2808 | ||
2790 | bnx2x_sp_prod_update(bp); | 2809 | bnx2x_sp_prod_update(bp); |
2791 | spin_unlock_bh(&bp->spq_lock); | 2810 | spin_unlock_bh(&bp->spq_lock); |
@@ -3697,8 +3716,8 @@ static void bnx2x_eq_int(struct bnx2x *bp) | |||
3697 | sw_cons = bp->eq_cons; | 3716 | sw_cons = bp->eq_cons; |
3698 | sw_prod = bp->eq_prod; | 3717 | sw_prod = bp->eq_prod; |
3699 | 3718 | ||
3700 | DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->spq_left %u\n", | 3719 | DP(BNX2X_MSG_SP, "EQ: hw_cons %u sw_cons %u bp->cq_spq_left %u\n", |
3701 | hw_cons, sw_cons, atomic_read(&bp->spq_left)); | 3720 | hw_cons, sw_cons, atomic_read(&bp->eq_spq_left)); |
3702 | 3721 | ||
3703 | for (; sw_cons != hw_cons; | 3722 | for (; sw_cons != hw_cons; |
3704 | sw_prod = NEXT_EQ_IDX(sw_prod), sw_cons = NEXT_EQ_IDX(sw_cons)) { | 3723 | sw_prod = NEXT_EQ_IDX(sw_prod), sw_cons = NEXT_EQ_IDX(sw_cons)) { |
@@ -3763,13 +3782,15 @@ static void bnx2x_eq_int(struct bnx2x *bp) | |||
3763 | case (EVENT_RING_OPCODE_SET_MAC | BNX2X_STATE_OPEN): | 3782 | case (EVENT_RING_OPCODE_SET_MAC | BNX2X_STATE_OPEN): |
3764 | case (EVENT_RING_OPCODE_SET_MAC | BNX2X_STATE_DIAG): | 3783 | case (EVENT_RING_OPCODE_SET_MAC | BNX2X_STATE_DIAG): |
3765 | DP(NETIF_MSG_IFUP, "got set mac ramrod\n"); | 3784 | DP(NETIF_MSG_IFUP, "got set mac ramrod\n"); |
3766 | bp->set_mac_pending = 0; | 3785 | if (elem->message.data.set_mac_event.echo) |
3786 | bp->set_mac_pending = 0; | ||
3767 | break; | 3787 | break; |
3768 | 3788 | ||
3769 | case (EVENT_RING_OPCODE_SET_MAC | | 3789 | case (EVENT_RING_OPCODE_SET_MAC | |
3770 | BNX2X_STATE_CLOSING_WAIT4_HALT): | 3790 | BNX2X_STATE_CLOSING_WAIT4_HALT): |
3771 | DP(NETIF_MSG_IFDOWN, "got (un)set mac ramrod\n"); | 3791 | DP(NETIF_MSG_IFDOWN, "got (un)set mac ramrod\n"); |
3772 | bp->set_mac_pending = 0; | 3792 | if (elem->message.data.set_mac_event.echo) |
3793 | bp->set_mac_pending = 0; | ||
3773 | break; | 3794 | break; |
3774 | default: | 3795 | default: |
3775 | /* unknown event log error and continue */ | 3796 | /* unknown event log error and continue */ |
@@ -3781,7 +3802,7 @@ next_spqe: | |||
3781 | } /* for */ | 3802 | } /* for */ |
3782 | 3803 | ||
3783 | smp_mb__before_atomic_inc(); | 3804 | smp_mb__before_atomic_inc(); |
3784 | atomic_add(spqe_cnt, &bp->spq_left); | 3805 | atomic_add(spqe_cnt, &bp->eq_spq_left); |
3785 | 3806 | ||
3786 | bp->eq_cons = sw_cons; | 3807 | bp->eq_cons = sw_cons; |
3787 | bp->eq_prod = sw_prod; | 3808 | bp->eq_prod = sw_prod; |
@@ -4214,7 +4235,7 @@ void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4214 | static void bnx2x_init_sp_ring(struct bnx2x *bp) | 4235 | static void bnx2x_init_sp_ring(struct bnx2x *bp) |
4215 | { | 4236 | { |
4216 | spin_lock_init(&bp->spq_lock); | 4237 | spin_lock_init(&bp->spq_lock); |
4217 | atomic_set(&bp->spq_left, MAX_SPQ_PENDING); | 4238 | atomic_set(&bp->cq_spq_left, MAX_SPQ_PENDING); |
4218 | 4239 | ||
4219 | bp->spq_prod_idx = 0; | 4240 | bp->spq_prod_idx = 0; |
4220 | bp->dsb_sp_prod = BNX2X_SP_DSB_INDEX; | 4241 | bp->dsb_sp_prod = BNX2X_SP_DSB_INDEX; |
@@ -4239,9 +4260,12 @@ static void bnx2x_init_eq_ring(struct bnx2x *bp) | |||
4239 | bp->eq_cons = 0; | 4260 | bp->eq_cons = 0; |
4240 | bp->eq_prod = NUM_EQ_DESC; | 4261 | bp->eq_prod = NUM_EQ_DESC; |
4241 | bp->eq_cons_sb = BNX2X_EQ_INDEX; | 4262 | bp->eq_cons_sb = BNX2X_EQ_INDEX; |
4263 | /* we want a warning message before it gets rought... */ | ||
4264 | atomic_set(&bp->eq_spq_left, | ||
4265 | min_t(int, MAX_SP_DESC_CNT - MAX_SPQ_PENDING, NUM_EQ_DESC) - 1); | ||
4242 | } | 4266 | } |
4243 | 4267 | ||
4244 | static void bnx2x_init_ind_table(struct bnx2x *bp) | 4268 | void bnx2x_push_indir_table(struct bnx2x *bp) |
4245 | { | 4269 | { |
4246 | int func = BP_FUNC(bp); | 4270 | int func = BP_FUNC(bp); |
4247 | int i; | 4271 | int i; |
@@ -4249,13 +4273,20 @@ static void bnx2x_init_ind_table(struct bnx2x *bp) | |||
4249 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) | 4273 | if (bp->multi_mode == ETH_RSS_MODE_DISABLED) |
4250 | return; | 4274 | return; |
4251 | 4275 | ||
4252 | DP(NETIF_MSG_IFUP, | ||
4253 | "Initializing indirection table multi_mode %d\n", bp->multi_mode); | ||
4254 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | 4276 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) |
4255 | REG_WR8(bp, BAR_TSTRORM_INTMEM + | 4277 | REG_WR8(bp, BAR_TSTRORM_INTMEM + |
4256 | TSTORM_INDIRECTION_TABLE_OFFSET(func) + i, | 4278 | TSTORM_INDIRECTION_TABLE_OFFSET(func) + i, |
4257 | bp->fp->cl_id + (i % (bp->num_queues - | 4279 | bp->fp->cl_id + bp->rx_indir_table[i]); |
4258 | NONE_ETH_CONTEXT_USE))); | 4280 | } |
4281 | |||
4282 | static void bnx2x_init_ind_table(struct bnx2x *bp) | ||
4283 | { | ||
4284 | int i; | ||
4285 | |||
4286 | for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++) | ||
4287 | bp->rx_indir_table[i] = i % BNX2X_NUM_ETH_QUEUES(bp); | ||
4288 | |||
4289 | bnx2x_push_indir_table(bp); | ||
4259 | } | 4290 | } |
4260 | 4291 | ||
4261 | void bnx2x_set_storm_rx_mode(struct bnx2x *bp) | 4292 | void bnx2x_set_storm_rx_mode(struct bnx2x *bp) |
@@ -5851,7 +5882,7 @@ int bnx2x_init_hw(struct bnx2x *bp, u32 load_code) | |||
5851 | BP_ABS_FUNC(bp), load_code); | 5882 | BP_ABS_FUNC(bp), load_code); |
5852 | 5883 | ||
5853 | bp->dmae_ready = 0; | 5884 | bp->dmae_ready = 0; |
5854 | mutex_init(&bp->dmae_mutex); | 5885 | spin_lock_init(&bp->dmae_lock); |
5855 | rc = bnx2x_gunzip_init(bp); | 5886 | rc = bnx2x_gunzip_init(bp); |
5856 | if (rc) | 5887 | if (rc) |
5857 | return rc; | 5888 | return rc; |
@@ -6003,6 +6034,8 @@ void bnx2x_free_mem(struct bnx2x *bp) | |||
6003 | BNX2X_PCI_FREE(bp->eq_ring, bp->eq_mapping, | 6034 | BNX2X_PCI_FREE(bp->eq_ring, bp->eq_mapping, |
6004 | BCM_PAGE_SIZE * NUM_EQ_PAGES); | 6035 | BCM_PAGE_SIZE * NUM_EQ_PAGES); |
6005 | 6036 | ||
6037 | BNX2X_FREE(bp->rx_indir_table); | ||
6038 | |||
6006 | #undef BNX2X_PCI_FREE | 6039 | #undef BNX2X_PCI_FREE |
6007 | #undef BNX2X_KFREE | 6040 | #undef BNX2X_KFREE |
6008 | } | 6041 | } |
@@ -6133,6 +6166,9 @@ int bnx2x_alloc_mem(struct bnx2x *bp) | |||
6133 | /* EQ */ | 6166 | /* EQ */ |
6134 | BNX2X_PCI_ALLOC(bp->eq_ring, &bp->eq_mapping, | 6167 | BNX2X_PCI_ALLOC(bp->eq_ring, &bp->eq_mapping, |
6135 | BCM_PAGE_SIZE * NUM_EQ_PAGES); | 6168 | BCM_PAGE_SIZE * NUM_EQ_PAGES); |
6169 | |||
6170 | BNX2X_ALLOC(bp->rx_indir_table, sizeof(bp->rx_indir_table[0]) * | ||
6171 | TSTORM_INDIRECTION_TABLE_SIZE); | ||
6136 | return 0; | 6172 | return 0; |
6137 | 6173 | ||
6138 | alloc_mem_err: | 6174 | alloc_mem_err: |
@@ -6186,12 +6222,14 @@ static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, const u8 *mac, | |||
6186 | int ramrod_flags = WAIT_RAMROD_COMMON; | 6222 | int ramrod_flags = WAIT_RAMROD_COMMON; |
6187 | 6223 | ||
6188 | bp->set_mac_pending = 1; | 6224 | bp->set_mac_pending = 1; |
6189 | smp_wmb(); | ||
6190 | 6225 | ||
6191 | config->hdr.length = 1; | 6226 | config->hdr.length = 1; |
6192 | config->hdr.offset = cam_offset; | 6227 | config->hdr.offset = cam_offset; |
6193 | config->hdr.client_id = 0xff; | 6228 | config->hdr.client_id = 0xff; |
6194 | config->hdr.reserved1 = 0; | 6229 | /* Mark the single MAC configuration ramrod as opposed to a |
6230 | * UC/MC list configuration). | ||
6231 | */ | ||
6232 | config->hdr.echo = 1; | ||
6195 | 6233 | ||
6196 | /* primary MAC */ | 6234 | /* primary MAC */ |
6197 | config->config_table[0].msb_mac_addr = | 6235 | config->config_table[0].msb_mac_addr = |
@@ -6223,6 +6261,8 @@ static void bnx2x_set_mac_addr_gen(struct bnx2x *bp, int set, const u8 *mac, | |||
6223 | config->config_table[0].middle_mac_addr, | 6261 | config->config_table[0].middle_mac_addr, |
6224 | config->config_table[0].lsb_mac_addr, BP_FUNC(bp), cl_bit_vec); | 6262 | config->config_table[0].lsb_mac_addr, BP_FUNC(bp), cl_bit_vec); |
6225 | 6263 | ||
6264 | mb(); | ||
6265 | |||
6226 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, | 6266 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, |
6227 | U64_HI(bnx2x_sp_mapping(bp, mac_config)), | 6267 | U64_HI(bnx2x_sp_mapping(bp, mac_config)), |
6228 | U64_LO(bnx2x_sp_mapping(bp, mac_config)), 1); | 6268 | U64_LO(bnx2x_sp_mapping(bp, mac_config)), 1); |
@@ -6287,20 +6327,15 @@ static u8 bnx2x_e1h_cam_offset(struct bnx2x *bp, u8 rel_offset) | |||
6287 | if (CHIP_IS_E1H(bp)) | 6327 | if (CHIP_IS_E1H(bp)) |
6288 | return E1H_FUNC_MAX * rel_offset + BP_FUNC(bp); | 6328 | return E1H_FUNC_MAX * rel_offset + BP_FUNC(bp); |
6289 | else if (CHIP_MODE_IS_4_PORT(bp)) | 6329 | else if (CHIP_MODE_IS_4_PORT(bp)) |
6290 | return BP_FUNC(bp) * 32 + rel_offset; | 6330 | return E2_FUNC_MAX * rel_offset + BP_FUNC(bp); |
6291 | else | 6331 | else |
6292 | return BP_VN(bp) * 32 + rel_offset; | 6332 | return E2_FUNC_MAX * rel_offset + BP_VN(bp); |
6293 | } | 6333 | } |
6294 | 6334 | ||
6295 | /** | 6335 | /** |
6296 | * LLH CAM line allocations: currently only iSCSI and ETH macs are | 6336 | * LLH CAM line allocations: currently only iSCSI and ETH macs are |
6297 | * relevant. In addition, current implementation is tuned for a | 6337 | * relevant. In addition, current implementation is tuned for a |
6298 | * single ETH MAC. | 6338 | * single ETH MAC. |
6299 | * | ||
6300 | * When multiple unicast ETH MACs PF configuration in switch | ||
6301 | * independent mode is required (NetQ, multiple netdev MACs, | ||
6302 | * etc.), consider better utilisation of 16 per function MAC | ||
6303 | * entries in the LLH memory. | ||
6304 | */ | 6339 | */ |
6305 | enum { | 6340 | enum { |
6306 | LLH_CAM_ISCSI_ETH_LINE = 0, | 6341 | LLH_CAM_ISCSI_ETH_LINE = 0, |
@@ -6375,14 +6410,37 @@ void bnx2x_set_eth_mac(struct bnx2x *bp, int set) | |||
6375 | bnx2x_set_mac_addr_gen(bp, set, bcast, 0, cam_offset + 1, 1); | 6410 | bnx2x_set_mac_addr_gen(bp, set, bcast, 0, cam_offset + 1, 1); |
6376 | } | 6411 | } |
6377 | } | 6412 | } |
6378 | static void bnx2x_set_e1_mc_list(struct bnx2x *bp, u8 offset) | 6413 | |
6414 | static inline u8 bnx2x_e1_cam_mc_offset(struct bnx2x *bp) | ||
6415 | { | ||
6416 | return CHIP_REV_IS_SLOW(bp) ? | ||
6417 | (BNX2X_MAX_EMUL_MULTI * (1 + BP_PORT(bp))) : | ||
6418 | (BNX2X_MAX_MULTICAST * (1 + BP_PORT(bp))); | ||
6419 | } | ||
6420 | |||
6421 | /* set mc list, do not wait as wait implies sleep and | ||
6422 | * set_rx_mode can be invoked from non-sleepable context. | ||
6423 | * | ||
6424 | * Instead we use the same ramrod data buffer each time we need | ||
6425 | * to configure a list of addresses, and use the fact that the | ||
6426 | * list of MACs is changed in an incremental way and that the | ||
6427 | * function is called under the netif_addr_lock. A temporary | ||
6428 | * inconsistent CAM configuration (possible in case of a very fast | ||
6429 | * sequence of add/del/add on the host side) will shortly be | ||
6430 | * restored by the handler of the last ramrod. | ||
6431 | */ | ||
6432 | static int bnx2x_set_e1_mc_list(struct bnx2x *bp) | ||
6379 | { | 6433 | { |
6380 | int i = 0, old; | 6434 | int i = 0, old; |
6381 | struct net_device *dev = bp->dev; | 6435 | struct net_device *dev = bp->dev; |
6436 | u8 offset = bnx2x_e1_cam_mc_offset(bp); | ||
6382 | struct netdev_hw_addr *ha; | 6437 | struct netdev_hw_addr *ha; |
6383 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, mcast_config); | 6438 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, mcast_config); |
6384 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, mcast_config); | 6439 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, mcast_config); |
6385 | 6440 | ||
6441 | if (netdev_mc_count(dev) > BNX2X_MAX_MULTICAST) | ||
6442 | return -EINVAL; | ||
6443 | |||
6386 | netdev_for_each_mc_addr(ha, dev) { | 6444 | netdev_for_each_mc_addr(ha, dev) { |
6387 | /* copy mac */ | 6445 | /* copy mac */ |
6388 | config_cmd->config_table[i].msb_mac_addr = | 6446 | config_cmd->config_table[i].msb_mac_addr = |
@@ -6423,32 +6481,47 @@ static void bnx2x_set_e1_mc_list(struct bnx2x *bp, u8 offset) | |||
6423 | } | 6481 | } |
6424 | } | 6482 | } |
6425 | 6483 | ||
6484 | wmb(); | ||
6485 | |||
6426 | config_cmd->hdr.length = i; | 6486 | config_cmd->hdr.length = i; |
6427 | config_cmd->hdr.offset = offset; | 6487 | config_cmd->hdr.offset = offset; |
6428 | config_cmd->hdr.client_id = 0xff; | 6488 | config_cmd->hdr.client_id = 0xff; |
6429 | config_cmd->hdr.reserved1 = 0; | 6489 | /* Mark that this ramrod doesn't use bp->set_mac_pending for |
6490 | * synchronization. | ||
6491 | */ | ||
6492 | config_cmd->hdr.echo = 0; | ||
6430 | 6493 | ||
6431 | bp->set_mac_pending = 1; | 6494 | mb(); |
6432 | smp_wmb(); | ||
6433 | 6495 | ||
6434 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, | 6496 | return bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, |
6435 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); | 6497 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); |
6436 | } | 6498 | } |
6437 | static void bnx2x_invlidate_e1_mc_list(struct bnx2x *bp) | 6499 | |
6500 | void bnx2x_invalidate_e1_mc_list(struct bnx2x *bp) | ||
6438 | { | 6501 | { |
6439 | int i; | 6502 | int i; |
6440 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, mcast_config); | 6503 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, mcast_config); |
6441 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, mcast_config); | 6504 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, mcast_config); |
6442 | int ramrod_flags = WAIT_RAMROD_COMMON; | 6505 | int ramrod_flags = WAIT_RAMROD_COMMON; |
6506 | u8 offset = bnx2x_e1_cam_mc_offset(bp); | ||
6443 | 6507 | ||
6444 | bp->set_mac_pending = 1; | 6508 | for (i = 0; i < BNX2X_MAX_MULTICAST; i++) |
6445 | smp_wmb(); | ||
6446 | |||
6447 | for (i = 0; i < config_cmd->hdr.length; i++) | ||
6448 | SET_FLAG(config_cmd->config_table[i].flags, | 6509 | SET_FLAG(config_cmd->config_table[i].flags, |
6449 | MAC_CONFIGURATION_ENTRY_ACTION_TYPE, | 6510 | MAC_CONFIGURATION_ENTRY_ACTION_TYPE, |
6450 | T_ETH_MAC_COMMAND_INVALIDATE); | 6511 | T_ETH_MAC_COMMAND_INVALIDATE); |
6451 | 6512 | ||
6513 | wmb(); | ||
6514 | |||
6515 | config_cmd->hdr.length = BNX2X_MAX_MULTICAST; | ||
6516 | config_cmd->hdr.offset = offset; | ||
6517 | config_cmd->hdr.client_id = 0xff; | ||
6518 | /* We'll wait for a completion this time... */ | ||
6519 | config_cmd->hdr.echo = 1; | ||
6520 | |||
6521 | bp->set_mac_pending = 1; | ||
6522 | |||
6523 | mb(); | ||
6524 | |||
6452 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, | 6525 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, |
6453 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); | 6526 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); |
6454 | 6527 | ||
@@ -6458,6 +6531,44 @@ static void bnx2x_invlidate_e1_mc_list(struct bnx2x *bp) | |||
6458 | 6531 | ||
6459 | } | 6532 | } |
6460 | 6533 | ||
6534 | /* Accept one or more multicasts */ | ||
6535 | static int bnx2x_set_e1h_mc_list(struct bnx2x *bp) | ||
6536 | { | ||
6537 | struct net_device *dev = bp->dev; | ||
6538 | struct netdev_hw_addr *ha; | ||
6539 | u32 mc_filter[MC_HASH_SIZE]; | ||
6540 | u32 crc, bit, regidx; | ||
6541 | int i; | ||
6542 | |||
6543 | memset(mc_filter, 0, 4 * MC_HASH_SIZE); | ||
6544 | |||
6545 | netdev_for_each_mc_addr(ha, dev) { | ||
6546 | DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n", | ||
6547 | bnx2x_mc_addr(ha)); | ||
6548 | |||
6549 | crc = crc32c_le(0, bnx2x_mc_addr(ha), | ||
6550 | ETH_ALEN); | ||
6551 | bit = (crc >> 24) & 0xff; | ||
6552 | regidx = bit >> 5; | ||
6553 | bit &= 0x1f; | ||
6554 | mc_filter[regidx] |= (1 << bit); | ||
6555 | } | ||
6556 | |||
6557 | for (i = 0; i < MC_HASH_SIZE; i++) | ||
6558 | REG_WR(bp, MC_HASH_OFFSET(bp, i), | ||
6559 | mc_filter[i]); | ||
6560 | |||
6561 | return 0; | ||
6562 | } | ||
6563 | |||
6564 | void bnx2x_invalidate_e1h_mc_list(struct bnx2x *bp) | ||
6565 | { | ||
6566 | int i; | ||
6567 | |||
6568 | for (i = 0; i < MC_HASH_SIZE; i++) | ||
6569 | REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); | ||
6570 | } | ||
6571 | |||
6461 | #ifdef BCM_CNIC | 6572 | #ifdef BCM_CNIC |
6462 | /** | 6573 | /** |
6463 | * Set iSCSI MAC(s) at the next enties in the CAM after the ETH | 6574 | * Set iSCSI MAC(s) at the next enties in the CAM after the ETH |
@@ -6476,12 +6587,13 @@ static int bnx2x_set_iscsi_eth_mac_addr(struct bnx2x *bp, int set) | |||
6476 | u32 iscsi_l2_cl_id = BNX2X_ISCSI_ETH_CL_ID + | 6587 | u32 iscsi_l2_cl_id = BNX2X_ISCSI_ETH_CL_ID + |
6477 | BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; | 6588 | BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; |
6478 | u32 cl_bit_vec = (1 << iscsi_l2_cl_id); | 6589 | u32 cl_bit_vec = (1 << iscsi_l2_cl_id); |
6590 | u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac; | ||
6479 | 6591 | ||
6480 | /* Send a SET_MAC ramrod */ | 6592 | /* Send a SET_MAC ramrod */ |
6481 | bnx2x_set_mac_addr_gen(bp, set, bp->iscsi_mac, cl_bit_vec, | 6593 | bnx2x_set_mac_addr_gen(bp, set, iscsi_mac, cl_bit_vec, |
6482 | cam_offset, 0); | 6594 | cam_offset, 0); |
6483 | 6595 | ||
6484 | bnx2x_set_mac_in_nig(bp, set, bp->iscsi_mac, LLH_CAM_ISCSI_ETH_LINE); | 6596 | bnx2x_set_mac_in_nig(bp, set, iscsi_mac, LLH_CAM_ISCSI_ETH_LINE); |
6485 | 6597 | ||
6486 | return 0; | 6598 | return 0; |
6487 | } | 6599 | } |
@@ -7123,20 +7235,15 @@ void bnx2x_chip_cleanup(struct bnx2x *bp, int unload_mode) | |||
7123 | /* Give HW time to discard old tx messages */ | 7235 | /* Give HW time to discard old tx messages */ |
7124 | msleep(1); | 7236 | msleep(1); |
7125 | 7237 | ||
7126 | if (CHIP_IS_E1(bp)) { | 7238 | bnx2x_set_eth_mac(bp, 0); |
7127 | /* invalidate mc list, | ||
7128 | * wait and poll (interrupts are off) | ||
7129 | */ | ||
7130 | bnx2x_invlidate_e1_mc_list(bp); | ||
7131 | bnx2x_set_eth_mac(bp, 0); | ||
7132 | |||
7133 | } else { | ||
7134 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); | ||
7135 | 7239 | ||
7136 | bnx2x_set_eth_mac(bp, 0); | 7240 | bnx2x_invalidate_uc_list(bp); |
7137 | 7241 | ||
7138 | for (i = 0; i < MC_HASH_SIZE; i++) | 7242 | if (CHIP_IS_E1(bp)) |
7139 | REG_WR(bp, MC_HASH_OFFSET(bp, i), 0); | 7243 | bnx2x_invalidate_e1_mc_list(bp); |
7244 | else { | ||
7245 | bnx2x_invalidate_e1h_mc_list(bp); | ||
7246 | REG_WR(bp, NIG_REG_LLH0_FUNC_EN + port*8, 0); | ||
7140 | } | 7247 | } |
7141 | 7248 | ||
7142 | #ifdef BCM_CNIC | 7249 | #ifdef BCM_CNIC |
@@ -8405,11 +8512,47 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp) | |||
8405 | bp->common.shmem2_base); | 8512 | bp->common.shmem2_base); |
8406 | } | 8513 | } |
8407 | 8514 | ||
8515 | #ifdef BCM_CNIC | ||
8516 | static void __devinit bnx2x_get_cnic_info(struct bnx2x *bp) | ||
8517 | { | ||
8518 | u32 max_iscsi_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, | ||
8519 | drv_lic_key[BP_PORT(bp)].max_iscsi_conn); | ||
8520 | u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, | ||
8521 | drv_lic_key[BP_PORT(bp)].max_fcoe_conn); | ||
8522 | |||
8523 | /* Get the number of maximum allowed iSCSI and FCoE connections */ | ||
8524 | bp->cnic_eth_dev.max_iscsi_conn = | ||
8525 | (max_iscsi_conn & BNX2X_MAX_ISCSI_INIT_CONN_MASK) >> | ||
8526 | BNX2X_MAX_ISCSI_INIT_CONN_SHIFT; | ||
8527 | |||
8528 | bp->cnic_eth_dev.max_fcoe_conn = | ||
8529 | (max_fcoe_conn & BNX2X_MAX_FCOE_INIT_CONN_MASK) >> | ||
8530 | BNX2X_MAX_FCOE_INIT_CONN_SHIFT; | ||
8531 | |||
8532 | BNX2X_DEV_INFO("max_iscsi_conn 0x%x max_fcoe_conn 0x%x\n", | ||
8533 | bp->cnic_eth_dev.max_iscsi_conn, | ||
8534 | bp->cnic_eth_dev.max_fcoe_conn); | ||
8535 | |||
8536 | /* If mamimum allowed number of connections is zero - | ||
8537 | * disable the feature. | ||
8538 | */ | ||
8539 | if (!bp->cnic_eth_dev.max_iscsi_conn) | ||
8540 | bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG; | ||
8541 | |||
8542 | if (!bp->cnic_eth_dev.max_fcoe_conn) | ||
8543 | bp->flags |= NO_FCOE_FLAG; | ||
8544 | } | ||
8545 | #endif | ||
8546 | |||
8408 | static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | 8547 | static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) |
8409 | { | 8548 | { |
8410 | u32 val, val2; | 8549 | u32 val, val2; |
8411 | int func = BP_ABS_FUNC(bp); | 8550 | int func = BP_ABS_FUNC(bp); |
8412 | int port = BP_PORT(bp); | 8551 | int port = BP_PORT(bp); |
8552 | #ifdef BCM_CNIC | ||
8553 | u8 *iscsi_mac = bp->cnic_eth_dev.iscsi_mac; | ||
8554 | u8 *fip_mac = bp->fip_mac; | ||
8555 | #endif | ||
8413 | 8556 | ||
8414 | if (BP_NOMCP(bp)) { | 8557 | if (BP_NOMCP(bp)) { |
8415 | BNX2X_ERROR("warning: random MAC workaround active\n"); | 8558 | BNX2X_ERROR("warning: random MAC workaround active\n"); |
@@ -8422,7 +8565,9 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |||
8422 | bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); | 8565 | bnx2x_set_mac_buf(bp->dev->dev_addr, val, val2); |
8423 | 8566 | ||
8424 | #ifdef BCM_CNIC | 8567 | #ifdef BCM_CNIC |
8425 | /* iSCSI NPAR MAC */ | 8568 | /* iSCSI and FCoE NPAR MACs: if there is no either iSCSI or |
8569 | * FCoE MAC then the appropriate feature should be disabled. | ||
8570 | */ | ||
8426 | if (IS_MF_SI(bp)) { | 8571 | if (IS_MF_SI(bp)) { |
8427 | u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); | 8572 | u32 cfg = MF_CFG_RD(bp, func_ext_config[func].func_cfg); |
8428 | if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) { | 8573 | if (cfg & MACP_FUNC_CFG_FLAGS_ISCSI_OFFLOAD) { |
@@ -8430,8 +8575,39 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |||
8430 | iscsi_mac_addr_upper); | 8575 | iscsi_mac_addr_upper); |
8431 | val = MF_CFG_RD(bp, func_ext_config[func]. | 8576 | val = MF_CFG_RD(bp, func_ext_config[func]. |
8432 | iscsi_mac_addr_lower); | 8577 | iscsi_mac_addr_lower); |
8433 | bnx2x_set_mac_buf(bp->iscsi_mac, val, val2); | 8578 | BNX2X_DEV_INFO("Read iSCSI MAC: " |
8434 | } | 8579 | "0x%x:0x%04x\n", val2, val); |
8580 | bnx2x_set_mac_buf(iscsi_mac, val, val2); | ||
8581 | |||
8582 | /* Disable iSCSI OOO if MAC configuration is | ||
8583 | * invalid. | ||
8584 | */ | ||
8585 | if (!is_valid_ether_addr(iscsi_mac)) { | ||
8586 | bp->flags |= NO_ISCSI_OOO_FLAG | | ||
8587 | NO_ISCSI_FLAG; | ||
8588 | memset(iscsi_mac, 0, ETH_ALEN); | ||
8589 | } | ||
8590 | } else | ||
8591 | bp->flags |= NO_ISCSI_OOO_FLAG | NO_ISCSI_FLAG; | ||
8592 | |||
8593 | if (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD) { | ||
8594 | val2 = MF_CFG_RD(bp, func_ext_config[func]. | ||
8595 | fcoe_mac_addr_upper); | ||
8596 | val = MF_CFG_RD(bp, func_ext_config[func]. | ||
8597 | fcoe_mac_addr_lower); | ||
8598 | BNX2X_DEV_INFO("Read FCoE MAC to " | ||
8599 | "0x%x:0x%04x\n", val2, val); | ||
8600 | bnx2x_set_mac_buf(fip_mac, val, val2); | ||
8601 | |||
8602 | /* Disable FCoE if MAC configuration is | ||
8603 | * invalid. | ||
8604 | */ | ||
8605 | if (!is_valid_ether_addr(fip_mac)) { | ||
8606 | bp->flags |= NO_FCOE_FLAG; | ||
8607 | memset(bp->fip_mac, 0, ETH_ALEN); | ||
8608 | } | ||
8609 | } else | ||
8610 | bp->flags |= NO_FCOE_FLAG; | ||
8435 | } | 8611 | } |
8436 | #endif | 8612 | #endif |
8437 | } else { | 8613 | } else { |
@@ -8445,7 +8621,7 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |||
8445 | iscsi_mac_upper); | 8621 | iscsi_mac_upper); |
8446 | val = SHMEM_RD(bp, dev_info.port_hw_config[port]. | 8622 | val = SHMEM_RD(bp, dev_info.port_hw_config[port]. |
8447 | iscsi_mac_lower); | 8623 | iscsi_mac_lower); |
8448 | bnx2x_set_mac_buf(bp->iscsi_mac, val, val2); | 8624 | bnx2x_set_mac_buf(iscsi_mac, val, val2); |
8449 | #endif | 8625 | #endif |
8450 | } | 8626 | } |
8451 | 8627 | ||
@@ -8453,14 +8629,12 @@ static void __devinit bnx2x_get_mac_hwinfo(struct bnx2x *bp) | |||
8453 | memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); | 8629 | memcpy(bp->dev->perm_addr, bp->dev->dev_addr, ETH_ALEN); |
8454 | 8630 | ||
8455 | #ifdef BCM_CNIC | 8631 | #ifdef BCM_CNIC |
8456 | /* Inform the upper layers about FCoE MAC */ | 8632 | /* Set the FCoE MAC in modes other then MF_SI */ |
8457 | if (!CHIP_IS_E1x(bp)) { | 8633 | if (!CHIP_IS_E1x(bp)) { |
8458 | if (IS_MF_SD(bp)) | 8634 | if (IS_MF_SD(bp)) |
8459 | memcpy(bp->fip_mac, bp->dev->dev_addr, | 8635 | memcpy(fip_mac, bp->dev->dev_addr, ETH_ALEN); |
8460 | sizeof(bp->fip_mac)); | 8636 | else if (!IS_MF(bp)) |
8461 | else | 8637 | memcpy(fip_mac, iscsi_mac, ETH_ALEN); |
8462 | memcpy(bp->fip_mac, bp->iscsi_mac, | ||
8463 | sizeof(bp->fip_mac)); | ||
8464 | } | 8638 | } |
8465 | #endif | 8639 | #endif |
8466 | } | 8640 | } |
@@ -8623,6 +8797,10 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp) | |||
8623 | /* Get MAC addresses */ | 8797 | /* Get MAC addresses */ |
8624 | bnx2x_get_mac_hwinfo(bp); | 8798 | bnx2x_get_mac_hwinfo(bp); |
8625 | 8799 | ||
8800 | #ifdef BCM_CNIC | ||
8801 | bnx2x_get_cnic_info(bp); | ||
8802 | #endif | ||
8803 | |||
8626 | return rc; | 8804 | return rc; |
8627 | } | 8805 | } |
8628 | 8806 | ||
@@ -8837,12 +9015,197 @@ static int bnx2x_close(struct net_device *dev) | |||
8837 | return 0; | 9015 | return 0; |
8838 | } | 9016 | } |
8839 | 9017 | ||
9018 | #define E1_MAX_UC_LIST 29 | ||
9019 | #define E1H_MAX_UC_LIST 30 | ||
9020 | #define E2_MAX_UC_LIST 14 | ||
9021 | static inline u8 bnx2x_max_uc_list(struct bnx2x *bp) | ||
9022 | { | ||
9023 | if (CHIP_IS_E1(bp)) | ||
9024 | return E1_MAX_UC_LIST; | ||
9025 | else if (CHIP_IS_E1H(bp)) | ||
9026 | return E1H_MAX_UC_LIST; | ||
9027 | else | ||
9028 | return E2_MAX_UC_LIST; | ||
9029 | } | ||
9030 | |||
9031 | |||
9032 | static inline u8 bnx2x_uc_list_cam_offset(struct bnx2x *bp) | ||
9033 | { | ||
9034 | if (CHIP_IS_E1(bp)) | ||
9035 | /* CAM Entries for Port0: | ||
9036 | * 0 - prim ETH MAC | ||
9037 | * 1 - BCAST MAC | ||
9038 | * 2 - iSCSI L2 ring ETH MAC | ||
9039 | * 3-31 - UC MACs | ||
9040 | * | ||
9041 | * Port1 entries are allocated the same way starting from | ||
9042 | * entry 32. | ||
9043 | */ | ||
9044 | return 3 + 32 * BP_PORT(bp); | ||
9045 | else if (CHIP_IS_E1H(bp)) { | ||
9046 | /* CAM Entries: | ||
9047 | * 0-7 - prim ETH MAC for each function | ||
9048 | * 8-15 - iSCSI L2 ring ETH MAC for each function | ||
9049 | * 16 till 255 UC MAC lists for each function | ||
9050 | * | ||
9051 | * Remark: There is no FCoE support for E1H, thus FCoE related | ||
9052 | * MACs are not considered. | ||
9053 | */ | ||
9054 | return E1H_FUNC_MAX * (CAM_ISCSI_ETH_LINE + 1) + | ||
9055 | bnx2x_max_uc_list(bp) * BP_FUNC(bp); | ||
9056 | } else { | ||
9057 | /* CAM Entries (there is a separate CAM per engine): | ||
9058 | * 0-4 - prim ETH MAC for each function | ||
9059 | * 4-7 - iSCSI L2 ring ETH MAC for each function | ||
9060 | * 8-11 - FIP ucast L2 MAC for each function | ||
9061 | * 12-15 - ALL_ENODE_MACS mcast MAC for each function | ||
9062 | * 16 till 71 UC MAC lists for each function | ||
9063 | */ | ||
9064 | u8 func_idx = | ||
9065 | (CHIP_MODE_IS_4_PORT(bp) ? BP_FUNC(bp) : BP_VN(bp)); | ||
9066 | |||
9067 | return E2_FUNC_MAX * (CAM_MAX_PF_LINE + 1) + | ||
9068 | bnx2x_max_uc_list(bp) * func_idx; | ||
9069 | } | ||
9070 | } | ||
9071 | |||
9072 | /* set uc list, do not wait as wait implies sleep and | ||
9073 | * set_rx_mode can be invoked from non-sleepable context. | ||
9074 | * | ||
9075 | * Instead we use the same ramrod data buffer each time we need | ||
9076 | * to configure a list of addresses, and use the fact that the | ||
9077 | * list of MACs is changed in an incremental way and that the | ||
9078 | * function is called under the netif_addr_lock. A temporary | ||
9079 | * inconsistent CAM configuration (possible in case of very fast | ||
9080 | * sequence of add/del/add on the host side) will shortly be | ||
9081 | * restored by the handler of the last ramrod. | ||
9082 | */ | ||
9083 | static int bnx2x_set_uc_list(struct bnx2x *bp) | ||
9084 | { | ||
9085 | int i = 0, old; | ||
9086 | struct net_device *dev = bp->dev; | ||
9087 | u8 offset = bnx2x_uc_list_cam_offset(bp); | ||
9088 | struct netdev_hw_addr *ha; | ||
9089 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, uc_mac_config); | ||
9090 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, uc_mac_config); | ||
9091 | |||
9092 | if (netdev_uc_count(dev) > bnx2x_max_uc_list(bp)) | ||
9093 | return -EINVAL; | ||
9094 | |||
9095 | netdev_for_each_uc_addr(ha, dev) { | ||
9096 | /* copy mac */ | ||
9097 | config_cmd->config_table[i].msb_mac_addr = | ||
9098 | swab16(*(u16 *)&bnx2x_uc_addr(ha)[0]); | ||
9099 | config_cmd->config_table[i].middle_mac_addr = | ||
9100 | swab16(*(u16 *)&bnx2x_uc_addr(ha)[2]); | ||
9101 | config_cmd->config_table[i].lsb_mac_addr = | ||
9102 | swab16(*(u16 *)&bnx2x_uc_addr(ha)[4]); | ||
9103 | |||
9104 | config_cmd->config_table[i].vlan_id = 0; | ||
9105 | config_cmd->config_table[i].pf_id = BP_FUNC(bp); | ||
9106 | config_cmd->config_table[i].clients_bit_vector = | ||
9107 | cpu_to_le32(1 << BP_L_ID(bp)); | ||
9108 | |||
9109 | SET_FLAG(config_cmd->config_table[i].flags, | ||
9110 | MAC_CONFIGURATION_ENTRY_ACTION_TYPE, | ||
9111 | T_ETH_MAC_COMMAND_SET); | ||
9112 | |||
9113 | DP(NETIF_MSG_IFUP, | ||
9114 | "setting UCAST[%d] (%04x:%04x:%04x)\n", i, | ||
9115 | config_cmd->config_table[i].msb_mac_addr, | ||
9116 | config_cmd->config_table[i].middle_mac_addr, | ||
9117 | config_cmd->config_table[i].lsb_mac_addr); | ||
9118 | |||
9119 | i++; | ||
9120 | |||
9121 | /* Set uc MAC in NIG */ | ||
9122 | bnx2x_set_mac_in_nig(bp, 1, bnx2x_uc_addr(ha), | ||
9123 | LLH_CAM_ETH_LINE + i); | ||
9124 | } | ||
9125 | old = config_cmd->hdr.length; | ||
9126 | if (old > i) { | ||
9127 | for (; i < old; i++) { | ||
9128 | if (CAM_IS_INVALID(config_cmd-> | ||
9129 | config_table[i])) { | ||
9130 | /* already invalidated */ | ||
9131 | break; | ||
9132 | } | ||
9133 | /* invalidate */ | ||
9134 | SET_FLAG(config_cmd->config_table[i].flags, | ||
9135 | MAC_CONFIGURATION_ENTRY_ACTION_TYPE, | ||
9136 | T_ETH_MAC_COMMAND_INVALIDATE); | ||
9137 | } | ||
9138 | } | ||
9139 | |||
9140 | wmb(); | ||
9141 | |||
9142 | config_cmd->hdr.length = i; | ||
9143 | config_cmd->hdr.offset = offset; | ||
9144 | config_cmd->hdr.client_id = 0xff; | ||
9145 | /* Mark that this ramrod doesn't use bp->set_mac_pending for | ||
9146 | * synchronization. | ||
9147 | */ | ||
9148 | config_cmd->hdr.echo = 0; | ||
9149 | |||
9150 | mb(); | ||
9151 | |||
9152 | return bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, | ||
9153 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); | ||
9154 | |||
9155 | } | ||
9156 | |||
9157 | void bnx2x_invalidate_uc_list(struct bnx2x *bp) | ||
9158 | { | ||
9159 | int i; | ||
9160 | struct mac_configuration_cmd *config_cmd = bnx2x_sp(bp, uc_mac_config); | ||
9161 | dma_addr_t config_cmd_map = bnx2x_sp_mapping(bp, uc_mac_config); | ||
9162 | int ramrod_flags = WAIT_RAMROD_COMMON; | ||
9163 | u8 offset = bnx2x_uc_list_cam_offset(bp); | ||
9164 | u8 max_list_size = bnx2x_max_uc_list(bp); | ||
9165 | |||
9166 | for (i = 0; i < max_list_size; i++) { | ||
9167 | SET_FLAG(config_cmd->config_table[i].flags, | ||
9168 | MAC_CONFIGURATION_ENTRY_ACTION_TYPE, | ||
9169 | T_ETH_MAC_COMMAND_INVALIDATE); | ||
9170 | bnx2x_set_mac_in_nig(bp, 0, NULL, LLH_CAM_ETH_LINE + 1 + i); | ||
9171 | } | ||
9172 | |||
9173 | wmb(); | ||
9174 | |||
9175 | config_cmd->hdr.length = max_list_size; | ||
9176 | config_cmd->hdr.offset = offset; | ||
9177 | config_cmd->hdr.client_id = 0xff; | ||
9178 | /* We'll wait for a completion this time... */ | ||
9179 | config_cmd->hdr.echo = 1; | ||
9180 | |||
9181 | bp->set_mac_pending = 1; | ||
9182 | |||
9183 | mb(); | ||
9184 | |||
9185 | bnx2x_sp_post(bp, RAMROD_CMD_ID_COMMON_SET_MAC, 0, | ||
9186 | U64_HI(config_cmd_map), U64_LO(config_cmd_map), 1); | ||
9187 | |||
9188 | /* Wait for a completion */ | ||
9189 | bnx2x_wait_ramrod(bp, 0, 0, &bp->set_mac_pending, | ||
9190 | ramrod_flags); | ||
9191 | |||
9192 | } | ||
9193 | |||
9194 | static inline int bnx2x_set_mc_list(struct bnx2x *bp) | ||
9195 | { | ||
9196 | /* some multicasts */ | ||
9197 | if (CHIP_IS_E1(bp)) { | ||
9198 | return bnx2x_set_e1_mc_list(bp); | ||
9199 | } else { /* E1H and newer */ | ||
9200 | return bnx2x_set_e1h_mc_list(bp); | ||
9201 | } | ||
9202 | } | ||
9203 | |||
8840 | /* called with netif_tx_lock from dev_mcast.c */ | 9204 | /* called with netif_tx_lock from dev_mcast.c */ |
8841 | void bnx2x_set_rx_mode(struct net_device *dev) | 9205 | void bnx2x_set_rx_mode(struct net_device *dev) |
8842 | { | 9206 | { |
8843 | struct bnx2x *bp = netdev_priv(dev); | 9207 | struct bnx2x *bp = netdev_priv(dev); |
8844 | u32 rx_mode = BNX2X_RX_MODE_NORMAL; | 9208 | u32 rx_mode = BNX2X_RX_MODE_NORMAL; |
8845 | int port = BP_PORT(bp); | ||
8846 | 9209 | ||
8847 | if (bp->state != BNX2X_STATE_OPEN) { | 9210 | if (bp->state != BNX2X_STATE_OPEN) { |
8848 | DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state); | 9211 | DP(NETIF_MSG_IFUP, "state is %x, returning\n", bp->state); |
@@ -8853,47 +9216,16 @@ void bnx2x_set_rx_mode(struct net_device *dev) | |||
8853 | 9216 | ||
8854 | if (dev->flags & IFF_PROMISC) | 9217 | if (dev->flags & IFF_PROMISC) |
8855 | rx_mode = BNX2X_RX_MODE_PROMISC; | 9218 | rx_mode = BNX2X_RX_MODE_PROMISC; |
8856 | else if ((dev->flags & IFF_ALLMULTI) || | 9219 | else if (dev->flags & IFF_ALLMULTI) |
8857 | ((netdev_mc_count(dev) > BNX2X_MAX_MULTICAST) && | ||
8858 | CHIP_IS_E1(bp))) | ||
8859 | rx_mode = BNX2X_RX_MODE_ALLMULTI; | 9220 | rx_mode = BNX2X_RX_MODE_ALLMULTI; |
8860 | else { /* some multicasts */ | 9221 | else { |
8861 | if (CHIP_IS_E1(bp)) { | 9222 | /* some multicasts */ |
8862 | /* | 9223 | if (bnx2x_set_mc_list(bp)) |
8863 | * set mc list, do not wait as wait implies sleep | 9224 | rx_mode = BNX2X_RX_MODE_ALLMULTI; |
8864 | * and set_rx_mode can be invoked from non-sleepable | ||
8865 | * context | ||
8866 | */ | ||
8867 | u8 offset = (CHIP_REV_IS_SLOW(bp) ? | ||
8868 | BNX2X_MAX_EMUL_MULTI*(1 + port) : | ||
8869 | BNX2X_MAX_MULTICAST*(1 + port)); | ||
8870 | |||
8871 | bnx2x_set_e1_mc_list(bp, offset); | ||
8872 | } else { /* E1H */ | ||
8873 | /* Accept one or more multicasts */ | ||
8874 | struct netdev_hw_addr *ha; | ||
8875 | u32 mc_filter[MC_HASH_SIZE]; | ||
8876 | u32 crc, bit, regidx; | ||
8877 | int i; | ||
8878 | |||
8879 | memset(mc_filter, 0, 4 * MC_HASH_SIZE); | ||
8880 | |||
8881 | netdev_for_each_mc_addr(ha, dev) { | ||
8882 | DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n", | ||
8883 | bnx2x_mc_addr(ha)); | ||
8884 | |||
8885 | crc = crc32c_le(0, bnx2x_mc_addr(ha), | ||
8886 | ETH_ALEN); | ||
8887 | bit = (crc >> 24) & 0xff; | ||
8888 | regidx = bit >> 5; | ||
8889 | bit &= 0x1f; | ||
8890 | mc_filter[regidx] |= (1 << bit); | ||
8891 | } | ||
8892 | 9225 | ||
8893 | for (i = 0; i < MC_HASH_SIZE; i++) | 9226 | /* some unicasts */ |
8894 | REG_WR(bp, MC_HASH_OFFSET(bp, i), | 9227 | if (bnx2x_set_uc_list(bp)) |
8895 | mc_filter[i]); | 9228 | rx_mode = BNX2X_RX_MODE_PROMISC; |
8896 | } | ||
8897 | } | 9229 | } |
8898 | 9230 | ||
8899 | bp->rx_mode = rx_mode; | 9231 | bp->rx_mode = rx_mode; |
@@ -8974,7 +9306,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
8974 | .ndo_stop = bnx2x_close, | 9306 | .ndo_stop = bnx2x_close, |
8975 | .ndo_start_xmit = bnx2x_start_xmit, | 9307 | .ndo_start_xmit = bnx2x_start_xmit, |
8976 | .ndo_select_queue = bnx2x_select_queue, | 9308 | .ndo_select_queue = bnx2x_select_queue, |
8977 | .ndo_set_multicast_list = bnx2x_set_rx_mode, | 9309 | .ndo_set_rx_mode = bnx2x_set_rx_mode, |
8978 | .ndo_set_mac_address = bnx2x_change_mac_addr, | 9310 | .ndo_set_mac_address = bnx2x_change_mac_addr, |
8979 | .ndo_validate_addr = eth_validate_addr, | 9311 | .ndo_validate_addr = eth_validate_addr, |
8980 | .ndo_do_ioctl = bnx2x_ioctl, | 9312 | .ndo_do_ioctl = bnx2x_ioctl, |
@@ -9120,7 +9452,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
9120 | dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); | 9452 | dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); |
9121 | dev->vlan_features |= NETIF_F_TSO6; | 9453 | dev->vlan_features |= NETIF_F_TSO6; |
9122 | 9454 | ||
9123 | #ifdef BCM_DCB | 9455 | #ifdef BCM_DCBNL |
9124 | dev->dcbnl_ops = &bnx2x_dcbnl_ops; | 9456 | dev->dcbnl_ops = &bnx2x_dcbnl_ops; |
9125 | #endif | 9457 | #endif |
9126 | 9458 | ||
@@ -9527,6 +9859,11 @@ static void __devexit bnx2x_remove_one(struct pci_dev *pdev) | |||
9527 | } | 9859 | } |
9528 | #endif | 9860 | #endif |
9529 | 9861 | ||
9862 | #ifdef BCM_DCBNL | ||
9863 | /* Delete app tlvs from dcbnl */ | ||
9864 | bnx2x_dcbnl_update_applist(bp, true); | ||
9865 | #endif | ||
9866 | |||
9530 | unregister_netdev(dev); | 9867 | unregister_netdev(dev); |
9531 | 9868 | ||
9532 | /* Delete all NAPI objects */ | 9869 | /* Delete all NAPI objects */ |
@@ -9800,15 +10137,21 @@ static void bnx2x_cnic_sp_post(struct bnx2x *bp, int count) | |||
9800 | HW_CID(bp, BNX2X_ISCSI_ETH_CID)); | 10137 | HW_CID(bp, BNX2X_ISCSI_ETH_CID)); |
9801 | } | 10138 | } |
9802 | 10139 | ||
9803 | /* There may be not more than 8 L2 and COMMON SPEs and not more | 10140 | /* There may be not more than 8 L2 and not more than 8 L5 SPEs |
9804 | * than 8 L5 SPEs in the air. | 10141 | * We also check that the number of outstanding |
10142 | * COMMON ramrods is not more than the EQ and SPQ can | ||
10143 | * accommodate. | ||
9805 | */ | 10144 | */ |
9806 | if ((type == NONE_CONNECTION_TYPE) || | 10145 | if (type == ETH_CONNECTION_TYPE) { |
9807 | (type == ETH_CONNECTION_TYPE)) { | 10146 | if (!atomic_read(&bp->cq_spq_left)) |
9808 | if (!atomic_read(&bp->spq_left)) | ||
9809 | break; | 10147 | break; |
9810 | else | 10148 | else |
9811 | atomic_dec(&bp->spq_left); | 10149 | atomic_dec(&bp->cq_spq_left); |
10150 | } else if (type == NONE_CONNECTION_TYPE) { | ||
10151 | if (!atomic_read(&bp->eq_spq_left)) | ||
10152 | break; | ||
10153 | else | ||
10154 | atomic_dec(&bp->eq_spq_left); | ||
9812 | } else if ((type == ISCSI_CONNECTION_TYPE) || | 10155 | } else if ((type == ISCSI_CONNECTION_TYPE) || |
9813 | (type == FCOE_CONNECTION_TYPE)) { | 10156 | (type == FCOE_CONNECTION_TYPE)) { |
9814 | if (bp->cnic_spq_pending >= | 10157 | if (bp->cnic_spq_pending >= |
@@ -9886,7 +10229,8 @@ static int bnx2x_cnic_ctl_send(struct bnx2x *bp, struct cnic_ctl_info *ctl) | |||
9886 | int rc = 0; | 10229 | int rc = 0; |
9887 | 10230 | ||
9888 | mutex_lock(&bp->cnic_mutex); | 10231 | mutex_lock(&bp->cnic_mutex); |
9889 | c_ops = bp->cnic_ops; | 10232 | c_ops = rcu_dereference_protected(bp->cnic_ops, |
10233 | lockdep_is_held(&bp->cnic_mutex)); | ||
9890 | if (c_ops) | 10234 | if (c_ops) |
9891 | rc = c_ops->cnic_ctl(bp->cnic_data, ctl); | 10235 | rc = c_ops->cnic_ctl(bp->cnic_data, ctl); |
9892 | mutex_unlock(&bp->cnic_mutex); | 10236 | mutex_unlock(&bp->cnic_mutex); |
@@ -10000,7 +10344,7 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl) | |||
10000 | int count = ctl->data.credit.credit_count; | 10344 | int count = ctl->data.credit.credit_count; |
10001 | 10345 | ||
10002 | smp_mb__before_atomic_inc(); | 10346 | smp_mb__before_atomic_inc(); |
10003 | atomic_add(count, &bp->spq_left); | 10347 | atomic_add(count, &bp->cq_spq_left); |
10004 | smp_mb__after_atomic_inc(); | 10348 | smp_mb__after_atomic_inc(); |
10005 | break; | 10349 | break; |
10006 | } | 10350 | } |
@@ -10096,6 +10440,13 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) | |||
10096 | struct bnx2x *bp = netdev_priv(dev); | 10440 | struct bnx2x *bp = netdev_priv(dev); |
10097 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; | 10441 | struct cnic_eth_dev *cp = &bp->cnic_eth_dev; |
10098 | 10442 | ||
10443 | /* If both iSCSI and FCoE are disabled - return NULL in | ||
10444 | * order to indicate CNIC that it should not try to work | ||
10445 | * with this device. | ||
10446 | */ | ||
10447 | if (NO_ISCSI(bp) && NO_FCOE(bp)) | ||
10448 | return NULL; | ||
10449 | |||
10099 | cp->drv_owner = THIS_MODULE; | 10450 | cp->drv_owner = THIS_MODULE; |
10100 | cp->chip_id = CHIP_ID(bp); | 10451 | cp->chip_id = CHIP_ID(bp); |
10101 | cp->pdev = bp->pdev; | 10452 | cp->pdev = bp->pdev; |
@@ -10116,6 +10467,15 @@ struct cnic_eth_dev *bnx2x_cnic_probe(struct net_device *dev) | |||
10116 | BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; | 10467 | BP_E1HVN(bp) * NONE_ETH_CONTEXT_USE; |
10117 | cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID; | 10468 | cp->iscsi_l2_cid = BNX2X_ISCSI_ETH_CID; |
10118 | 10469 | ||
10470 | if (NO_ISCSI_OOO(bp)) | ||
10471 | cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI_OOO; | ||
10472 | |||
10473 | if (NO_ISCSI(bp)) | ||
10474 | cp->drv_state |= CNIC_DRV_STATE_NO_ISCSI; | ||
10475 | |||
10476 | if (NO_FCOE(bp)) | ||
10477 | cp->drv_state |= CNIC_DRV_STATE_NO_FCOE; | ||
10478 | |||
10119 | DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, " | 10479 | DP(BNX2X_MSG_SP, "page_size %d, tbl_offset %d, tbl_lines %d, " |
10120 | "starting cid %d\n", | 10480 | "starting cid %d\n", |
10121 | cp->ctx_blk_size, | 10481 | cp->ctx_blk_size, |
diff --git a/drivers/net/bnx2x/bnx2x_reg.h b/drivers/net/bnx2x/bnx2x_reg.h index e01330bb36c7..1c89f19a4425 100644 --- a/drivers/net/bnx2x/bnx2x_reg.h +++ b/drivers/net/bnx2x/bnx2x_reg.h | |||
@@ -6083,6 +6083,7 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6083 | #define MDIO_PMA_REG_8727_PCS_OPT_CTRL 0xc808 | 6083 | #define MDIO_PMA_REG_8727_PCS_OPT_CTRL 0xc808 |
6084 | #define MDIO_PMA_REG_8727_GPIO_CTRL 0xc80e | 6084 | #define MDIO_PMA_REG_8727_GPIO_CTRL 0xc80e |
6085 | #define MDIO_PMA_REG_8727_PCS_GP 0xc842 | 6085 | #define MDIO_PMA_REG_8727_PCS_GP 0xc842 |
6086 | #define MDIO_PMA_REG_8727_OPT_CFG_REG 0xc8e4 | ||
6086 | 6087 | ||
6087 | #define MDIO_AN_REG_8727_MISC_CTRL 0x8309 | 6088 | #define MDIO_AN_REG_8727_MISC_CTRL 0x8309 |
6088 | 6089 | ||