aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/hpsa.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 0582f2fc11f0..66c4fc306f2c 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3302,9 +3302,23 @@ static int __devinit hpsa_pci_find_memory_BAR(struct ctlr_info *h,
3302 return -ENODEV; 3302 return -ENODEV;
3303} 3303}
3304 3304
3305static int __devinit hpsa_wait_for_board_ready(struct ctlr_info *h)
3306{
3307 int i;
3308 u32 scratchpad;
3309
3310 for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) {
3311 scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
3312 if (scratchpad == HPSA_FIRMWARE_READY)
3313 return 0;
3314 msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
3315 }
3316 dev_warn(&h->pdev->dev, "board not ready, timed out.\n");
3317 return -ENODEV;
3318}
3319
3305static int __devinit hpsa_pci_init(struct ctlr_info *h) 3320static int __devinit hpsa_pci_init(struct ctlr_info *h)
3306{ 3321{
3307 u32 scratchpad = 0;
3308 u64 cfg_offset; 3322 u64 cfg_offset;
3309 u32 cfg_base_addr; 3323 u32 cfg_base_addr;
3310 u64 cfg_base_addr_index; 3324 u64 cfg_base_addr_index;
@@ -3339,18 +3353,9 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
3339 goto err_out_free_res; 3353 goto err_out_free_res;
3340 h->vaddr = remap_pci_mem(h->paddr, 0x250); 3354 h->vaddr = remap_pci_mem(h->paddr, 0x250);
3341 3355
3342 /* Wait for the board to become ready. */ 3356 err = hpsa_wait_for_board_ready(h);
3343 for (i = 0; i < HPSA_BOARD_READY_ITERATIONS; i++) { 3357 if (err)
3344 scratchpad = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
3345 if (scratchpad == HPSA_FIRMWARE_READY)
3346 break;
3347 msleep(HPSA_BOARD_READY_POLL_INTERVAL_MSECS);
3348 }
3349 if (scratchpad != HPSA_FIRMWARE_READY) {
3350 dev_warn(&h->pdev->dev, "board not ready, timed out.\n");
3351 err = -ENODEV;
3352 goto err_out_free_res; 3358 goto err_out_free_res;
3353 }
3354 3359
3355 /* get the address index number */ 3360 /* get the address index number */
3356 cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET); 3361 cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET);