diff options
author | Stephen M. Cameron <scameron@beardog.cce.hp.com> | 2010-05-27 16:13:12 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-27 13:01:06 -0400 |
commit | 2c4c8c8b662286230a798c60408d217aeab55f7f (patch) | |
tree | 03bf7c1c2b8dd74056d0f6ce1cda8228a735db00 /drivers | |
parent | 3a7774ceb89f02f78e269b5c900096b066b66c3c (diff) |
[SCSI] hpsa: factor out hpsa_wait_for_board_ready
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/hpsa.c | 29 |
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 | ||
3305 | static 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 | |||
3305 | static int __devinit hpsa_pci_init(struct ctlr_info *h) | 3320 | static 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); |