aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlge/qlge_mpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/qlge/qlge_mpi.c')
-rw-r--r--drivers/net/qlge/qlge_mpi.c36
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
3static int ql_read_mbox_reg(struct ql_adapter *qdev, u32 reg, u32 *data) 3int 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
22int 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;
37exit:
38 return status;
39}
40
41int 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
22static int ql_get_mb_sts(struct ql_adapter *qdev, struct mbox_params *mbcp) 48static 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}