diff options
author | Ron Mercer <ron.mercer@qlogic.com> | 2009-02-26 05:08:33 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-27 01:28:07 -0500 |
commit | a2e809bb1b2174af66bf9798444f7e90892f45a9 (patch) | |
tree | a5384c861c5dfbbcb88f3321a47a2cea5cc2edd6 /drivers/net/qlge/qlge_mpi.c | |
parent | b82808b759ffb8f4db2a1f8989195d95c8625cfe (diff) |
qlge: Clean up firmware reset path.
Add function for performing the reset rather than in-line. This function
may later be called by a core dump process.
Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlge/qlge_mpi.c')
-rw-r--r-- | drivers/net/qlge/qlge_mpi.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index fa31891b6e62..f9db78697e2b 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "qlge.h" | 1 | #include "qlge.h" |
2 | 2 | ||
3 | static int ql_read_mbox_reg(struct ql_adapter *qdev, u32 reg, u32 *data) | 3 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data) |
4 | { | 4 | { |
5 | int status; | 5 | int status; |
6 | /* wait for reg to come ready */ | 6 | /* wait for reg to come ready */ |
@@ -19,6 +19,32 @@ exit: | |||
19 | return status; | 19 | return status; |
20 | } | 20 | } |
21 | 21 | ||
22 | int ql_write_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 data) | ||
23 | { | ||
24 | int status = 0; | ||
25 | /* wait for reg to come ready */ | ||
26 | status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR); | ||
27 | if (status) | ||
28 | goto exit; | ||
29 | /* write the data to the data reg */ | ||
30 | ql_write32(qdev, PROC_DATA, data); | ||
31 | /* trigger the write */ | ||
32 | ql_write32(qdev, PROC_ADDR, reg); | ||
33 | /* wait for reg to come ready */ | ||
34 | status = ql_wait_reg_rdy(qdev, PROC_ADDR, PROC_ADDR_RDY, PROC_ADDR_ERR); | ||
35 | if (status) | ||
36 | goto exit; | ||
37 | exit: | ||
38 | return status; | ||
39 | } | ||
40 | |||
41 | int ql_soft_reset_mpi_risc(struct ql_adapter *qdev) | ||
42 | { | ||
43 | int status; | ||
44 | status = ql_write_mpi_reg(qdev, 0x00001010, 1); | ||
45 | return status; | ||
46 | } | ||
47 | |||
22 | static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) | 48 | static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) |
23 | { | 49 | { |
24 | int i, status; | 50 | int i, status; |
@@ -28,7 +54,7 @@ static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
28 | return -EBUSY; | 54 | return -EBUSY; |
29 | for (i = 0; i < mbcp->out_count; i++) { | 55 | for (i = 0; i < mbcp->out_count; i++) { |
30 | status = | 56 | status = |
31 | ql_read_mbox_reg(qdev, qdev->mailbox_out + i, | 57 | ql_read_mpi_reg(qdev, qdev->mailbox_out + i, |
32 | &mbcp->mbox_out[i]); | 58 | &mbcp->mbox_out[i]); |
33 | if (status) { | 59 | if (status) { |
34 | QPRINTK(qdev, DRV, ERR, "Failed mailbox read.\n"); | 60 | QPRINTK(qdev, DRV, ERR, "Failed mailbox read.\n"); |
@@ -142,9 +168,5 @@ void ql_mpi_reset_work(struct work_struct *work) | |||
142 | { | 168 | { |
143 | struct ql_adapter *qdev = | 169 | struct ql_adapter *qdev = |
144 | container_of(work, struct ql_adapter, mpi_reset_work.work); | 170 | container_of(work, struct ql_adapter, mpi_reset_work.work); |
145 | QPRINTK(qdev, DRV, ERR, | 171 | ql_soft_reset_mpi_risc(qdev); |
146 | "Enter, qdev = %p..\n", qdev); | ||
147 | ql_write32(qdev, CSR, CSR_CMD_SET_RST); | ||
148 | msleep(50); | ||
149 | ql_write32(qdev, CSR, CSR_CMD_CLR_RST); | ||
150 | } | 172 | } |