From: Rasesh Mody <rmody@brocade.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <adapter_linux_open_src_team@brocade.com>,
Rasesh Mody <rmody@brocade.com>
Subject: [PATCH 08/10] bna: Add HW Semaphore Unlock Logic
Date: Fri, 22 Jul 2011 11:07:47 -0700 [thread overview]
Message-ID: <1311358069-32067-9-git-send-email-rmody@brocade.com> (raw)
In-Reply-To: <1311358069-32067-1-git-send-email-rmody@brocade.com>
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>
---
drivers/net/bna/bfa_ioc.c | 25 +++++++++++++++++++++++++
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 da56c2f..c3b62a3 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;
/*
* forward declarations
*/
+static void bfa_ioc_hw_sem_init(struct bfa_ioc *ioc);
static void bfa_ioc_hw_sem_get(struct bfa_ioc *ioc);
static void bfa_ioc_hw_sem_get_cancel(struct bfa_ioc *ioc);
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)
static void
bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf *iocpf)
{
+ bfa_ioc_hw_sem_init(iocpf->ioc);
bfa_ioc_hw_sem_get(iocpf->ioc);
}
@@ -1176,6 +1178,29 @@ bfa_nw_ioc_sem_release(void __iomem *sem_reg)
}
static void
+bfa_ioc_hw_sem_init(struct bfa_ioc *ioc)
+{
+ struct bfi_ioc_image_hdr fwhdr;
+ u32 fwstate = readl(ioc->ioc_regs.ioc_fwstate);
+
+ if (fwstate == BFI_IOC_UNINIT)
+ return;
+
+ bfa_nw_ioc_fwver_get(ioc, &fwhdr);
+
+ if (swab32(fwhdr.exec) == BFI_FWBOOT_TYPE_NORMAL)
+ return;
+
+ writel(BFI_IOC_UNINIT, ioc->ioc_regs.ioc_fwstate);
+
+ /*
+ * Try to lock and then unlock the semaphore.
+ */
+ readl(ioc->ioc_regs.ioc_sem_reg);
+ writel(1, ioc->ioc_regs.ioc_sem_reg);
+}
+
+static void
bfa_ioc_hw_sem_get(struct bfa_ioc *ioc)
{
u32 r32;
diff --git a/drivers/net/bna/bfi.h b/drivers/net/bna/bfi.h
index 683a7d7..088211c 100644
--- a/drivers/net/bna/bfi.h
+++ b/drivers/net/bna/bfi.h
@@ -289,6 +289,12 @@ struct bfi_ioc_image_hdr {
u32 md5sum[BFI_IOC_MD5SUM_SZ];
};
+enum bfi_fwboot_type {
+ BFI_FWBOOT_TYPE_NORMAL = 0,
+ BFI_FWBOOT_TYPE_FLASH = 1,
+ BFI_FWBOOT_TYPE_MEMTEST = 2,
+};
+
/**
* BFI_IOC_I2H_READY_EVENT message
*/
--
1.7.1
next prev parent reply other threads:[~2011-07-22 18:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-22 18:07 [PATCH 00/10] bna: driver fixes and cleanup Rasesh Mody
2011-07-22 18:07 ` [PATCH 01/10] bna: Print Driver Version Rasesh Mody
2011-07-22 18:07 ` [PATCH 02/10] bna: CheckPatch Cleanup Rasesh Mody
2011-07-22 18:07 ` [PATCH 03/10] bna: IOC Event Notification Enhancement Rasesh Mody
2011-07-22 18:07 ` [PATCH 04/10] bna: State Machine Fault Handling Cleanup Rasesh Mody
2011-07-22 18:07 ` [PATCH 05/10] bna: Minor IRQ Index and Definition Change Rasesh Mody
2011-07-22 18:07 ` [PATCH 06/10] bna: Mboxq Flush When IOC Disabled Rasesh Mody
2011-07-22 18:07 ` [PATCH 07/10] bna: IOC Event Name Change Rasesh Mody
2011-07-22 18:07 ` Rasesh Mody [this message]
2011-07-22 18:07 ` [PATCH 09/10] bna: HW Error Counter Fix Rasesh Mody
2011-07-22 18:07 ` [PATCH 10/10] bna: Header File Consolidation Rasesh Mody
2011-07-23 0:15 ` [PATCH 00/10] bna: driver fixes and cleanup David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1311358069-32067-9-git-send-email-rmody@brocade.com \
--to=rmody@brocade.com \
--cc=adapter_linux_open_src_team@brocade.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).