linux-mips
[Top] [All Lists]

[PATCH 3/5] MIPS: Netlogic: Fix nlm_read_c2_status() definition

To: linux-mips@linux-mips.org, ralf@linux-mips.org, ddaney.cavm@gmail.com
Subject: [PATCH 3/5] MIPS: Netlogic: Fix nlm_read_c2_status() definition
From: "Jayachandran C" <jchandra@broadcom.com>
Date: Mon, 10 Jun 2013 13:00:02 +0530
Cc: "Jayachandran C" <jchandra@broadcom.com>
In-reply-to: <1370849404-4918-1-git-send-email-jchandra@broadcom.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1370849404-4918-1-git-send-email-jchandra@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
The sel argument os nlm_read_c2_status() was not used and the macro
returned the sel 0 in all cases. Fix this by defining two macros:
nlm_read_c2_status0() and nlm_read_c2_status1() to return the two
status registers.

Add functions to write to the status registers as well.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
---
 arch/mips/include/asm/netlogic/xlr/fmn.h |    8 ++++++--
 arch/mips/netlogic/xlr/fmn.c             |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/mips/include/asm/netlogic/xlr/fmn.h 
b/arch/mips/include/asm/netlogic/xlr/fmn.h
index 2a78929..56c7b85 100644
--- a/arch/mips/include/asm/netlogic/xlr/fmn.h
+++ b/arch/mips/include/asm/netlogic/xlr/fmn.h
@@ -175,6 +175,10 @@
 #define nlm_write_c2_cc14(s, v)                __write_32bit_c2_register($30, 
s, v)
 #define nlm_write_c2_cc15(s, v)                __write_32bit_c2_register($31, 
s, v)
 
+#define nlm_read_c2_status0()          __read_32bit_c2_register($2, 0)
+#define nlm_write_c2_status0(v)                __write_32bit_c2_register($2, 
0, v)
+#define nlm_read_c2_status1()          __read_32bit_c2_register($2, 1)
+#define nlm_write_c2_status1(v)                __write_32bit_c2_register($2, 
1, v)
 #define nlm_read_c2_status(sel)                __read_32bit_c2_register($2, 0)
 #define nlm_read_c2_config()           __read_32bit_c2_register($3, 0)
 #define nlm_write_c2_config(v)         __write_32bit_c2_register($3, 0, v)
@@ -296,7 +300,7 @@ static inline int nlm_fmn_send(unsigned int size, unsigned 
int code,
         */
        for (i = 0; i < 8; i++) {
                nlm_msgsnd(dest);
-               status = nlm_read_c2_status(0);
+               status = nlm_read_c2_status0();
                if ((status & 0x2) == 1)
                        pr_info("Send pending fail!\n");
                if ((status & 0x4) == 0)
@@ -316,7 +320,7 @@ static inline int nlm_fmn_receive(int bucket, int *size, 
int *code, int *stid,
 
        /* wait for load pending to clear */
        do {
-               status = nlm_read_c2_status(1);
+               status = nlm_read_c2_status0();
        } while ((status & 0x08) != 0);
 
        /* receive error bits */
diff --git a/arch/mips/netlogic/xlr/fmn.c b/arch/mips/netlogic/xlr/fmn.c
index 4d74f03..0fdce61 100644
--- a/arch/mips/netlogic/xlr/fmn.c
+++ b/arch/mips/netlogic/xlr/fmn.c
@@ -80,7 +80,7 @@ static irqreturn_t fmn_message_handler(int irq, void *data)
        while (1) {
                /* 8 bkts per core, [24:31] each bit represents one bucket
                 * Bit is Zero if bucket is not empty */
-               bkt_status = (nlm_read_c2_status() >> 24) & 0xff;
+               bkt_status = (nlm_read_c2_status0() >> 24) & 0xff;
                if (bkt_status == 0xff)
                        break;
                for (bucket = 0; bucket < 8; bucket++) {
-- 
1.7.9.5



<Prev in Thread] Current Thread [Next in Thread>