[linux-yocto] [PATCH 03/35] arch/arm/mach-axxia: Make Sure SRIO is Enabled Before Accessing

Daniel Dragomir daniel.dragomir at windriver.com
Thu Nov 13 09:19:30 PST 2014


From: John Jacques <john.jacques at lsi.com>

Signed-off-by: John Jacques <john.jacques at lsi.com>
---
 arch/arm/mach-axxia/rapidio.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-axxia/rapidio.c b/arch/arm/mach-axxia/rapidio.c
index 8e8961f..4de8787 100644
--- a/arch/arm/mach-axxia/rapidio.c
+++ b/arch/arm/mach-axxia/rapidio.c
@@ -32,6 +32,7 @@
 #include <linux/io.h>
 #include <linux/signal.h>
 
+#include <mach/ncr.h>
 #include <mach/rio.h>
 
 /**
@@ -45,10 +46,9 @@
  *
  * Returns 0 on success or an error code.
  */
-int axxia_rapidio_board_init(
-	struct platform_device *dev,
-	int dev_num,
-	int *port_ndx)
+
+int
+axxia_rapidio_board_init(struct platform_device *dev, int dev_num, int *port_ndx)
 {
 	/* Reset the RIO port id to zero for this device */
 	void __iomem *gpreg_base = ioremap(0x2010094000, 0x1000);
@@ -65,33 +65,45 @@ int axxia_rapidio_board_init(
 
 	(*port_ndx) = 0;
 
+	/* Verify that this device is actually enabled */
+	if (NULL !=
+	    of_find_compatible_node(NULL, NULL, "lsi,axm5500-amarillo")) {
+		ncr_read(NCP_REGION_ID(0x115, 0), 0x23c, 4, &reg);
+
+		if ((reg & (1 << (21+(dev_num*4)))) == 0) {
+			dev_dbg(&dev->dev, "%s: SRIO%d link not ready\n",
+				dev->dev.of_node->full_name, dev_num);
+			return -ENXIO;
+		}
+	}
+
 	iounmap(gpreg_base);
 
 	return 0;
 }
 
-
 /**
  * axxia_rio_fault -
  *   Intercept SRIO bus faults due to unimplemented register locations.
  *   Return 0 to keep 'reads' alive.
  */
-static int axxia_rio_fault(unsigned long addr,
-	unsigned int fsr, struct pt_regs *regs)
+
+static int
+axxia_rio_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
 {
 	/* unsigned long pc = instruction_pointer(regs); */
 	/* unsigned long instr = *(unsigned long *)pc; */
 	return 0;
 }
 
-
 /**
  * axxia_rapidio_init -
  *   Perform board-specific initialization to support use of RapidIO busses
  *
  * Returns 0 on success or an error code.
  */
-int __init axxia_rapidio_init(void)
+int __init
+axxia_rapidio_init(void)
 {
 	hook_fault_code(0x11, axxia_rio_fault, SIGBUS, 0,
 			"asynchronous external abort");
-- 
1.8.1.4



More information about the linux-yocto mailing list