From: John Jacques <john.jacq...@intel.com>

Signed-off-by: John Jacques <john.jacq...@intel.com>
---
 drivers/misc/lsi-ncr.c | 104 ++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 90 insertions(+), 14 deletions(-)

diff --git a/drivers/misc/lsi-ncr.c b/drivers/misc/lsi-ncr.c
index 7c98018..3141b1c 100644
--- a/drivers/misc/lsi-ncr.c
+++ b/drivers/misc/lsi-ncr.c
@@ -371,17 +371,12 @@ ncr_0x115(unsigned int region, unsigned int offset, int 
write,
        indcmd.bits.htrans = 2;
        indcmd.bits.haddr = offset;
 
-       if (0 != is_5500) {
-               BUG();
-       } else {
-               if (0 == NCP_TARGET_ID(region))
-                       indcmd.bits.hsize = 2;
-               else
-                       indcmd.bits.hsize = 1;
-
-               base = 0x10000ULL * (0x14 + NCP_TARGET_ID(region));
-       }
+       if (0 == NCP_TARGET_ID(region))
+               indcmd.bits.hsize = 2;
+       else
+               indcmd.bits.hsize = 1;
 
+       base = 0x10000ULL * (0x14 + NCP_TARGET_ID(region));
        mdelay(50);
 
        if (0 != write)
@@ -410,6 +405,77 @@ ncr_0x115(unsigned int region, unsigned int offset, int 
write,
 
 /*
   
------------------------------------------------------------------------------
+  ncr_0x115_5500
+*/
+
+static int
+ncr_0x115_5500(unsigned int region, unsigned int offset, int write,
+              unsigned int *value)
+{
+       unsigned int control;
+       void __iomem *base;
+       unsigned wfc_timeout = 400000;
+
+       if (0xffff < offset)
+               return -1;
+
+       switch (NCP_TARGET_ID(region)) {
+       case 0:
+               base = (apb2ser0 + 0x1e0);
+               break;
+       case 1:
+               base = (apb2ser0 + 0x1f0);
+               break;
+       case 2:
+               base = (apb2ser0 + 0x200);
+               break;
+       case 3:
+               base = (apb2ser0 + 0x210);
+               break;
+       case 4:
+               base = (apb2ser0 + 0x220);
+               break;
+       case 5:
+               base = (apb2ser0 + 0x230);
+               break;
+       default:
+               return -1;
+       }
+
+       if ((NCP_TARGET_ID(region) == 0x1) ||
+           (NCP_TARGET_ID(region) == 0x4))
+               control = 0x84c00000;
+       else
+               control = 0x85400000;
+
+       if (0 != write)
+               control |= 0x40000000;
+
+       writel((control + offset), (base + 4));
+
+       do {
+               --wfc_timeout;
+               *((unsigned long *)value) = readl(base + 4);
+       } while (0 != (*((unsigned long *)value) & 0x80000000) &&
+                0 < wfc_timeout);
+
+       if (0 == wfc_timeout)
+               return -1;
+
+       if (0 == write) {
+               if ((NCP_TARGET_ID(region) == 0x1) ||
+                   (NCP_TARGET_ID(region) == 0x4)) {
+                       *((unsigned short *)value) = readl(base + 8);
+               } else {
+                       *((unsigned long *)value) = readl(base + 8);
+               }
+       }
+
+       return 0;
+}
+
+/*
+  
------------------------------------------------------------------------------
   ncr_axi2ser
 */
 
@@ -486,8 +552,13 @@ __ncr_read(struct ncr_io_fns *io_fn,
              region, NCP_NODE_ID(region), NCP_TARGET_ID(region));
 
        if (0x115 == NCP_NODE_ID(region)) {
-               if (0 != ncr_0x115(region, address, 0, buffer))
-                       return -1;
+               if (0 != is_5500) {
+                       if (0 != ncr_0x115_5500(region, address, 0, buffer))
+                               return -1;
+               } else {
+                       if (0 != ncr_0x115(region, address, 0, buffer))
+                               return -1;
+               }
        } else if (0x153 == NCP_NODE_ID(region) ||
                   0x155 == NCP_NODE_ID(region) ||
                   0x156 == NCP_NODE_ID(region) ||
@@ -643,8 +714,13 @@ __ncr_write(struct ncr_io_fns *io_fn,
                return -1;
 
        if (0x115 == NCP_NODE_ID(region)) {
-               if (0 != ncr_0x115(region, address, 1, buffer))
-                       return -1;
+               if (0 != is_5500) {
+                       if (0 != ncr_0x115_5500(region, address, 1, buffer))
+                               return -1;
+               } else {
+                       if (0 != ncr_0x115(region, address, 1, buffer))
+                               return -1;
+               }
        } else if (0x153 == NCP_NODE_ID(region) ||
                   0x155 == NCP_NODE_ID(region) ||
                   0x156 == NCP_NODE_ID(region) ||
-- 
2.7.4

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to