diff options
author | Eilon Greenstein <eilong@broadcom.com> | 2008-08-13 18:47:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-13 19:01:13 -0400 |
commit | 19680c4850c1e5c2b4371388637c7ce86b8570b6 (patch) | |
tree | e280a0a8de89dfb9996086a7dd12db48c0596035 | |
parent | d4766692e72422f3b0f0e9ac6773d92baad07d51 (diff) |
bnx2x: FW (bootcode) interface fixes
FW (bootcode) interface fixes
- Making sure that the device will not cause kernel panic of the
bootcode is corrupted or missing
- Removing module debug parameter "nomcp" since no one should work
without the bootcode (this is a left over from the chip bring up days)
- Instead of waiting fix amount of time for bootcode response, sample it
every 10ms (usually the answer is ready after less than 10ms)
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bnx2x_main.c | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 272a4bd25953..9eb8a3e6d629 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -76,23 +76,21 @@ MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710 Driver"); | |||
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
77 | MODULE_VERSION(DRV_MODULE_VERSION); | 77 | MODULE_VERSION(DRV_MODULE_VERSION); |
78 | 78 | ||
79 | static int disable_tpa; | ||
79 | static int use_inta; | 80 | static int use_inta; |
80 | static int poll; | 81 | static int poll; |
81 | static int debug; | 82 | static int debug; |
82 | static int disable_tpa; | ||
83 | static int nomcp; | ||
84 | static int load_count[3]; /* 0-common, 1-port0, 2-port1 */ | 83 | static int load_count[3]; /* 0-common, 1-port0, 2-port1 */ |
85 | static int use_multi; | 84 | static int use_multi; |
86 | 85 | ||
86 | module_param(disable_tpa, int, 0); | ||
87 | module_param(use_inta, int, 0); | 87 | module_param(use_inta, int, 0); |
88 | module_param(poll, int, 0); | 88 | module_param(poll, int, 0); |
89 | module_param(debug, int, 0); | 89 | module_param(debug, int, 0); |
90 | module_param(disable_tpa, int, 0); | 90 | MODULE_PARM_DESC(disable_tpa, "disable the TPA (LRO) feature"); |
91 | module_param(nomcp, int, 0); | ||
92 | MODULE_PARM_DESC(use_inta, "use INT#A instead of MSI-X"); | 91 | MODULE_PARM_DESC(use_inta, "use INT#A instead of MSI-X"); |
93 | MODULE_PARM_DESC(poll, "use polling (for debug)"); | 92 | MODULE_PARM_DESC(poll, "use polling (for debug)"); |
94 | MODULE_PARM_DESC(debug, "default debug msglevel"); | 93 | MODULE_PARM_DESC(debug, "default debug msglevel"); |
95 | MODULE_PARM_DESC(nomcp, "ignore management CPU"); | ||
96 | 94 | ||
97 | #ifdef BNX2X_MULTI | 95 | #ifdef BNX2X_MULTI |
98 | module_param(use_multi, int, 0); | 96 | module_param(use_multi, int, 0); |
@@ -1940,37 +1938,47 @@ static void bnx2x_link_report(struct bnx2x *bp) | |||
1940 | 1938 | ||
1941 | static u8 bnx2x_initial_phy_init(struct bnx2x *bp) | 1939 | static u8 bnx2x_initial_phy_init(struct bnx2x *bp) |
1942 | { | 1940 | { |
1943 | u8 rc; | 1941 | if (!BP_NOMCP(bp)) { |
1942 | u8 rc; | ||
1944 | 1943 | ||
1945 | /* Initialize link parameters structure variables */ | 1944 | /* Initialize link parameters structure variables */ |
1946 | bp->link_params.mtu = bp->dev->mtu; | 1945 | bp->link_params.mtu = bp->dev->mtu; |
1947 | 1946 | ||
1948 | bnx2x_phy_hw_lock(bp); | 1947 | bnx2x_phy_hw_lock(bp); |
1949 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 1948 | rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
1950 | bnx2x_phy_hw_unlock(bp); | 1949 | bnx2x_phy_hw_unlock(bp); |
1951 | 1950 | ||
1952 | if (bp->link_vars.link_up) | 1951 | if (bp->link_vars.link_up) |
1953 | bnx2x_link_report(bp); | 1952 | bnx2x_link_report(bp); |
1954 | 1953 | ||
1955 | bnx2x_calc_fc_adv(bp); | 1954 | bnx2x_calc_fc_adv(bp); |
1956 | 1955 | ||
1957 | return rc; | 1956 | return rc; |
1957 | } | ||
1958 | BNX2X_ERR("Bootcode is missing -not initializing link\n"); | ||
1959 | return -EINVAL; | ||
1958 | } | 1960 | } |
1959 | 1961 | ||
1960 | static void bnx2x_link_set(struct bnx2x *bp) | 1962 | static void bnx2x_link_set(struct bnx2x *bp) |
1961 | { | 1963 | { |
1962 | bnx2x_phy_hw_lock(bp); | 1964 | if (!BP_NOMCP(bp)) { |
1963 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); | 1965 | bnx2x_phy_hw_lock(bp); |
1964 | bnx2x_phy_hw_unlock(bp); | 1966 | bnx2x_phy_init(&bp->link_params, &bp->link_vars); |
1967 | bnx2x_phy_hw_unlock(bp); | ||
1965 | 1968 | ||
1966 | bnx2x_calc_fc_adv(bp); | 1969 | bnx2x_calc_fc_adv(bp); |
1970 | } else | ||
1971 | BNX2X_ERR("Bootcode is missing -not setting link\n"); | ||
1967 | } | 1972 | } |
1968 | 1973 | ||
1969 | static void bnx2x__link_reset(struct bnx2x *bp) | 1974 | static void bnx2x__link_reset(struct bnx2x *bp) |
1970 | { | 1975 | { |
1971 | bnx2x_phy_hw_lock(bp); | 1976 | if (!BP_NOMCP(bp)) { |
1972 | bnx2x_link_reset(&bp->link_params, &bp->link_vars); | 1977 | bnx2x_phy_hw_lock(bp); |
1973 | bnx2x_phy_hw_unlock(bp); | 1978 | bnx2x_link_reset(&bp->link_params, &bp->link_vars); |
1979 | bnx2x_phy_hw_unlock(bp); | ||
1980 | } else | ||
1981 | BNX2X_ERR("Bootcode is missing -not resetting link\n"); | ||
1974 | } | 1982 | } |
1975 | 1983 | ||
1976 | static u8 bnx2x_link_test(struct bnx2x *bp) | 1984 | static u8 bnx2x_link_test(struct bnx2x *bp) |
@@ -2374,7 +2382,7 @@ static int bnx2x_lock_alr(struct bnx2x *bp) | |||
2374 | msleep(5); | 2382 | msleep(5); |
2375 | } | 2383 | } |
2376 | if (!(val & (1L << 31))) { | 2384 | if (!(val & (1L << 31))) { |
2377 | BNX2X_ERR("Cannot acquire nvram interface\n"); | 2385 | BNX2X_ERR("Cannot acquire MCP access lock register\n"); |
2378 | rc = -EBUSY; | 2386 | rc = -EBUSY; |
2379 | } | 2387 | } |
2380 | 2388 | ||
@@ -5638,18 +5646,23 @@ static u32 bnx2x_fw_command(struct bnx2x *bp, u32 command) | |||
5638 | int func = BP_FUNC(bp); | 5646 | int func = BP_FUNC(bp); |
5639 | u32 seq = ++bp->fw_seq; | 5647 | u32 seq = ++bp->fw_seq; |
5640 | u32 rc = 0; | 5648 | u32 rc = 0; |
5649 | u32 cnt = 1; | ||
5650 | u8 delay = CHIP_REV_IS_SLOW(bp) ? 100 : 10; | ||
5641 | 5651 | ||
5642 | SHMEM_WR(bp, func_mb[func].drv_mb_header, (command | seq)); | 5652 | SHMEM_WR(bp, func_mb[func].drv_mb_header, (command | seq)); |
5643 | DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", (command | seq)); | 5653 | DP(BNX2X_MSG_MCP, "wrote command (%x) to FW MB\n", (command | seq)); |
5644 | 5654 | ||
5645 | /* let the FW do it's magic ... */ | 5655 | do { |
5646 | msleep(100); /* TBD */ | 5656 | /* let the FW do it's magic ... */ |
5657 | msleep(delay); | ||
5658 | |||
5659 | rc = SHMEM_RD(bp, func_mb[func].fw_mb_header); | ||
5647 | 5660 | ||
5648 | if (CHIP_REV_IS_SLOW(bp)) | 5661 | /* Give the FW up to 2 second (200*10ms) */ |
5649 | msleep(900); | 5662 | } while ((seq != (rc & FW_MSG_SEQ_NUMBER_MASK)) && (cnt++ < 200)); |
5650 | 5663 | ||
5651 | rc = SHMEM_RD(bp, func_mb[func].fw_mb_header); | 5664 | DP(BNX2X_MSG_MCP, "[after %d ms] read (%x) seq is (%x) from FW MB\n", |
5652 | DP(BNX2X_MSG_MCP, "read (%x) seq is (%x) from FW MB\n", rc, seq); | 5665 | cnt*delay, rc, seq); |
5653 | 5666 | ||
5654 | /* is this a reply to our command? */ | 5667 | /* is this a reply to our command? */ |
5655 | if (seq == (rc & FW_MSG_SEQ_NUMBER_MASK)) { | 5668 | if (seq == (rc & FW_MSG_SEQ_NUMBER_MASK)) { |
@@ -7337,9 +7350,6 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
7337 | int func = BP_FUNC(bp); | 7350 | int func = BP_FUNC(bp); |
7338 | int rc; | 7351 | int rc; |
7339 | 7352 | ||
7340 | if (nomcp) | ||
7341 | bp->flags |= NO_MCP_FLAG; | ||
7342 | |||
7343 | mutex_init(&bp->port.phy_mutex); | 7353 | mutex_init(&bp->port.phy_mutex); |
7344 | 7354 | ||
7345 | INIT_WORK(&bp->sp_task, bnx2x_sp_task); | 7355 | INIT_WORK(&bp->sp_task, bnx2x_sp_task); |