diff options
author | Rasesh Mody <rmody@brocade.com> | 2011-07-22 04:07:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-22 20:01:13 -0400 |
commit | d4e16d4285d93ea0c284a3cf547e61472f79f8d2 (patch) | |
tree | b6539602e3e956909e49dfde757e48276fecc005 | |
parent | f374b36103cf22c9416f1004b0302b03fad79547 (diff) |
bna: Add HW Semaphore Unlock Logic
Change details:
- Added logic to unlock hw semaphore if the previos FW boot was from boot
code (flash based) and the current FW initialization attempt is from OS
driver.
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bna/bfa_ioc.c | 25 | ||||
-rw-r--r-- | drivers/net/bna/bfi.h | 6 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/bna/bfa_ioc.c b/drivers/net/bna/bfa_ioc.c index da56c2fe51b5..c3b62a3753f9 100644 --- a/drivers/net/bna/bfa_ioc.c +++ b/drivers/net/bna/bfa_ioc.c | |||
@@ -58,6 +58,7 @@ static bool bfa_nw_auto_recover = true; | |||
58 | /* | 58 | /* |
59 | * forward declarations | 59 | * forward declarations |
60 | */ | 60 | */ |
61 | static void bfa_ioc_hw_sem_init(struct bfa_ioc *ioc); | ||
61 | static void bfa_ioc_hw_sem_get(struct bfa_ioc *ioc); | 62 | static void bfa_ioc_hw_sem_get(struct bfa_ioc *ioc); |
62 | static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc *ioc); | 63 | static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc *ioc); |
63 | static void bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force); | 64 | static void bfa_ioc_hwinit(struct bfa_ioc *ioc, bool force); |
@@ -590,6 +591,7 @@ bfa_iocpf_sm_reset(struct bfa_iocpf *iocpf, enum iocpf_event event) | |||
590 | static void | 591 | static void |
591 | bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf *iocpf) | 592 | bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf *iocpf) |
592 | { | 593 | { |
594 | bfa_ioc_hw_sem_init(iocpf->ioc); | ||
593 | bfa_ioc_hw_sem_get(iocpf->ioc); | 595 | bfa_ioc_hw_sem_get(iocpf->ioc); |
594 | } | 596 | } |
595 | 597 | ||
@@ -1176,6 +1178,29 @@ bfa_nw_ioc_sem_release(void __iomem *sem_reg) | |||
1176 | } | 1178 | } |
1177 | 1179 | ||
1178 | static void | 1180 | static void |
1181 | bfa_ioc_hw_sem_init(struct bfa_ioc *ioc) | ||
1182 | { | ||
1183 | struct bfi_ioc_image_hdr fwhdr; | ||
1184 | u32 fwstate = readl(ioc->ioc_regs.ioc_fwstate); | ||
1185 | |||
1186 | if (fwstate == BFI_IOC_UNINIT) | ||
1187 | return; | ||
1188 | |||
1189 | bfa_nw_ioc_fwver_get(ioc, &fwhdr); | ||
1190 | |||
1191 | if (swab32(fwhdr.exec) == BFI_FWBOOT_TYPE_NORMAL) | ||
1192 | return; | ||
1193 | |||
1194 | writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate); | ||
1195 | |||
1196 | /* | ||
1197 | * Try to lock and then unlock the semaphore. | ||
1198 | */ | ||
1199 | readl(ioc->ioc_regs.ioc_sem_reg); | ||
1200 | writel(1, ioc->ioc_regs.ioc_sem_reg); | ||
1201 | } | ||
1202 | |||
1203 | static void | ||
1179 | bfa_ioc_hw_sem_get(struct bfa_ioc *ioc) | 1204 | bfa_ioc_hw_sem_get(struct bfa_ioc *ioc) |
1180 | { | 1205 | { |
1181 | u32 r32; | 1206 | u32 r32; |
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h index 683a7d7acc38..088211c2724f 100644 --- a/drivers/net/bna/bfi.h +++ b/drivers/net/bna/bfi.h | |||
@@ -289,6 +289,12 @@ struct bfi_ioc_image_hdr { | |||
289 | u32 md5sum[BFI_IOC_MD5SUM_SZ]; | 289 | u32 md5sum[BFI_IOC_MD5SUM_SZ]; |
290 | }; | 290 | }; |
291 | 291 | ||
292 | enum bfi_fwboot_type { | ||
293 | BFI_FWBOOT_TYPE_NORMAL = 0, | ||
294 | BFI_FWBOOT_TYPE_FLASH = 1, | ||
295 | BFI_FWBOOT_TYPE_MEMTEST = 2, | ||
296 | }; | ||
297 | |||
292 | /** | 298 | /** |
293 | * BFI_IOC_I2H_READY_EVENT message | 299 | * BFI_IOC_I2H_READY_EVENT message |
294 | */ | 300 | */ |