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

As procfs shouldn't be used as a module to user interface,
switch to sysfs.

Signed-off-by: John Jacques <john.jacq...@lsi.com>
---
 arch/arm/mach-axxia/Makefile           |    1 +
 arch/arm/mach-axxia/axxia.c            |    3 +
 arch/arm/mach-axxia/ddr_retention.c    |   13 +-
 arch/arm/mach-axxia/include/mach/ncr.h |   44 +++
 arch/arm/mach-axxia/ncr.c              |  488 ++++++++++++++++++++++++++++++++
 drivers/misc/Kconfig                   |    2 +-
 drivers/misc/lsi-smmon.c               |  130 ++++-----
 drivers/net/ethernet/lsi/lsi_acp_net.c |    9 +-
 8 files changed, 619 insertions(+), 71 deletions(-)
 create mode 100644 arch/arm/mach-axxia/include/mach/ncr.h
 create mode 100644 arch/arm/mach-axxia/ncr.c

diff --git a/arch/arm/mach-axxia/Makefile b/arch/arm/mach-axxia/Makefile
index 2e9ddf7..85cee8f 100644
--- a/arch/arm/mach-axxia/Makefile
+++ b/arch/arm/mach-axxia/Makefile
@@ -5,6 +5,7 @@ obj-y                                   += wrappers.o
 obj-y                                  += axxia.o
 obj-y                                  += clock.o
 obj-y                                   += io.o
+obj-y                                  += ncr.o
 obj-y                                  += timers.o
 obj-y                                  += pci.o
 obj-y                                  += ddr_retention.o
diff --git a/arch/arm/mach-axxia/axxia.c b/arch/arm/mach-axxia/axxia.c
index d87bb61..0e368a4 100644
--- a/arch/arm/mach-axxia/axxia.c
+++ b/arch/arm/mach-axxia/axxia.c
@@ -49,6 +49,7 @@
 #include <mach/hardware.h>
 #include <mach/timers.h>
 #include <mach/axxia-gic.h>
+#include <mach/ncr.h>
 #include "axxia.h"
 #include "pci.h"
 #include "i2c.h"
@@ -273,6 +274,8 @@ void __init axxia_dt_init(void)
                             axxia_auxdata_lookup, NULL);
        pm_power_off = NULL; /* TBD */
 
+       ncr_init();
+
        spi_register_board_info(spi_devs, ARRAY_SIZE(spi_devs));
 
        /*
diff --git a/arch/arm/mach-axxia/ddr_retention.c 
b/arch/arm/mach-axxia/ddr_retention.c
index 988d361..1e4ba34 100644
--- a/arch/arm/mach-axxia/ddr_retention.c
+++ b/arch/arm/mach-axxia/ddr_retention.c
@@ -32,7 +32,7 @@
 
 #include <asm/io.h>
 #include <asm/cacheflush.h>
-#include <../../../drivers/misc/lsi-ncr.h>
++#include <mach/ncr.h>
 
 extern void flush_l3(void);
 static void __iomem *nca_address;
@@ -195,6 +195,7 @@ void initiate_retention_reset(void)
 
        if (NULL == nca_address)
                nca_address = ioremap(0x002020100000ULL, 0x20000);
+               BUG();
 
        /* send stop message to other CPUs */
        local_irq_disable();
@@ -215,8 +216,7 @@ void initiate_retention_reset(void)
        ncr_write(NCP_REGION_ID(15, 0), 0x414, 4, &value);
 
        /* unlock reset register for later */
-       apb_base = ioremap(0x2010000000, 0x40000);
-       writel(0x000000ab, apb_base + 0x31000); /* Access Key */
+       writel(0x000000ab, apb_base + 0x31000); /* Access Key */
 
        /* prepare to put DDR in self refresh power-down mode */
        /* first read the CTL_244 register and OR in the LP_CMD value */
@@ -246,6 +246,7 @@ void initiate_retention_reset(void)
        ncp_ddr_shutdown();
 
 }
+EXPORT_SYMBOL(initiate_retention_reset);
 
 static ssize_t axxia_ddr_retention_trigger(struct file *file,
                                           const char __user *buf,
@@ -268,9 +269,13 @@ void axxia_ddr_retention_init(void)
                printk(KERN_INFO
                        "Failed to register DDR retention proc interface\n");
 #endif
+
+       apb_base = ioremap(0x2010000000, 0x40000);
+       nca_address = ioremap(0x002020100000ULL, 0x20000);
+
+       printk("ddr_retention: ready\n");
 }
 
-EXPORT_SYMBOL(initiate_retention_reset);
 
 #else
 
diff --git a/arch/arm/mach-axxia/include/mach/ncr.h 
b/arch/arm/mach-axxia/include/mach/ncr.h
new file mode 100644
index 0000000..926d366
--- /dev/null
+++ b/arch/arm/mach-axxia/include/mach/ncr.h
@@ -0,0 +1,44 @@
+/*
+ * arch/arm/mach-axxia/include/mach/ncr.h
+ *
+ * Copyright (C) 2010 LSI
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307        
 USA
+ */
+
+#ifndef __ARCH_ARM_MACH_AXXIA_NCR_H
+#define __ARCH_ARM_MACH_AXXIA_NCR_H
+
+#ifndef NCP_REGION_ID
+#define NCP_REGION_ID(node, target) \
+((unsigned long) ((((node) & 0xffff) << 16) | ((target) & 0xffff)))
+#endif
+
+#ifndef NCP_NODE_ID
+#define NCP_NODE_ID(region) (((region) >> 16) & 0xffff)
+#endif
+
+#ifndef NCP_TARGET_ID
+#define NCP_TARGET_ID(region) ((region) & 0xffff)
+#endif
+
+unsigned long ncr_register_read(unsigned *);
+void ncr_register_write(const unsigned, unsigned *);
+int ncr_read(unsigned long, unsigned long, int, void *);
+int ncr_write(unsigned long, unsigned long, int, void *);
+int ncr_init(void);
+void ncr_exit(void);
+
+#endif /* __ARCH_ARM_MACH_AXXIA_NCR_H */
diff --git a/arch/arm/mach-axxia/ncr.c b/arch/arm/mach-axxia/ncr.c
new file mode 100644
index 0000000..84c260f
--- /dev/null
+++ b/arch/arm/mach-axxia/ncr.c
@@ -0,0 +1,488 @@
+/*
+ *  Copyright (C) 2009 LSI Corporation
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <linux/module.h>
+
+#include <asm/io.h>
+
+#include <mach/ncr.h>
+
+#ifdef CONFIG_ARCH_AXXIA
+#define NCA_PHYS_ADDRESS         0x002020100000ULL
+#define APB2SER_PHY_PHYS_ADDRESS 0x002010000000ULL
+#else
+#define NCA_PHYS_ADDRESS         0x002000520000ULL
+#endif
+
+static void __iomem *nca_address;
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+static void __iomem *apb2ser0_address;
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+
+#define WFC_TIMEOUT (400000)
+
+#define LOCK_DOMAIN 0
+
+typedef union {
+       unsigned long raw;
+       struct {
+#ifdef __BIG_ENDIAN
+               unsigned long start_done:1;
+               unsigned long unused:6;
+               unsigned long local_bit:1;
+               unsigned long status:2;
+               unsigned long byte_swap_enable:1;
+               unsigned long cfg_cmpl_int_enable:1;
+               unsigned long cmd_type:4;
+               unsigned long dbs:16;
+#else
+               unsigned long dbs:16;
+               unsigned long cmd_type:4;
+               unsigned long cfg_cmpl_int_enable:1;
+               unsigned long byte_swap_enable:1;
+               unsigned long status:2;
+               unsigned long local_bit:1;
+               unsigned long unused:6;
+               unsigned long start_done:1;
+#endif
+       } __attribute__ ((packed)) bits;
+} __attribute__ ((packed)) command_data_register_0_t;
+
+typedef union {
+       unsigned long raw;
+       struct {
+               unsigned long target_address:32;
+       } __attribute__ ((packed)) bits;
+} __attribute__ ((packed)) command_data_register_1_t;
+
+typedef union {
+       unsigned long raw;
+       struct {
+#ifdef __BIG_ENDIAN
+               unsigned long unused:16;
+               unsigned long target_node_id:8;
+               unsigned long target_id_address_upper:8;
+#else
+               unsigned long target_id_address_upper:8;
+               unsigned long target_node_id:8;
+               unsigned long unused:16;
+#endif
+       } __attribute__ ((packed)) bits;
+} __attribute__ ((packed)) command_data_register_2_t;
+
+#ifdef CONFIG_ARM
+
+/*
+  ----------------------------------------------------------------------
+  ncr_register_read
+*/
+
+unsigned long
+ncr_register_read(unsigned *address)
+{
+       unsigned long value;
+
+       value = ioread32be(address);
+
+       return value;
+}
+
+/*
+  ----------------------------------------------------------------------
+  ncr_register_write
+*/
+
+void
+ncr_register_write(const unsigned value, unsigned *address)
+{
+       iowrite32be(value, address);
+
+       return;
+}
+
+#else
+
+/*
+  ----------------------------------------------------------------------
+  ncr_register_read
+*/
+
+unsigned long
+ncr_register_read(unsigned *address)
+{
+       unsigned long value;
+
+       value = in_be32((unsigned *)address);
+
+       return value;
+}
+
+/*
+  ----------------------------------------------------------------------
+  ncr_register_write
+*/
+
+void
+ncr_register_write(const unsigned value, unsigned *address)
+{
+       out_be32(address, value);
+
+       return;
+}
+
+#endif
+
+/*
+  
------------------------------------------------------------------------------
+  ncr_lock
+*/
+
+static int
+ncr_lock(int domain)
+{
+       unsigned long offset;
+       unsigned long value;
+       int loops = 10000;
+
+       offset = (0xff80 + (domain * 4));
+
+       do {
+               value = ncr_register_read((unsigned *)(nca_address + offset));
+       } while ((0 != value) && (0 < --loops));
+
+       if (0 == loops)
+               return -1;
+
+       return 0;
+}
+
+/*
+  
------------------------------------------------------------------------------
+  ncr_unlock
+*/
+
+static void
+ncr_unlock(int domain)
+{
+       unsigned long offset;
+
+       offset = (0xff80 + (domain * 4));
+       ncr_register_write(0, (unsigned *)(nca_address + offset));
+
+       return;
+}
+
+/*
+  ======================================================================
+  ======================================================================
+  Public Interface
+  ======================================================================
+  ======================================================================
+*/
+
+/*
+  ----------------------------------------------------------------------
+  ncr_read
+*/
+
+int
+ncr_read(unsigned long region, unsigned long address, int number,
+        void *buffer)
+{
+       command_data_register_0_t cdr0;
+       command_data_register_1_t cdr1;
+       command_data_register_2_t cdr2;
+       int wfc_timeout = WFC_TIMEOUT;
+
+       if (NULL == nca_address)
+               return -1;
+
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+       if (NULL == apb2ser0_address)
+               return -1;
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+
+       if (0 != ncr_lock(LOCK_DOMAIN))
+               return -1;
+
+       if (NCP_NODE_ID(region) != 0x0153) {
+               /*
+               * Set up the read command.
+               */
+
+               cdr2.raw = 0;
+               cdr2.bits.target_node_id = NCP_NODE_ID(region);
+               cdr2.bits.target_id_address_upper = NCP_TARGET_ID(region);
+               ncr_register_write(cdr2.raw, (unsigned *) (nca_address + 0xf8));
+
+               cdr1.raw = 0;
+               cdr1.bits.target_address = (address >> 2);
+               ncr_register_write(cdr1.raw, (unsigned *) (nca_address + 0xf4));
+
+               cdr0.raw = 0;
+               cdr0.bits.start_done = 1;
+
+               if (0xff == cdr2.bits.target_id_address_upper)
+                       cdr0.bits.local_bit = 1;
+
+               cdr0.bits.cmd_type = 4;
+               /* TODO: Verify number... */
+               cdr0.bits.dbs = (number - 1);
+               ncr_register_write(cdr0.raw, (unsigned *) (nca_address + 0xf0));
+               mb();
+
+               /*
+               * Wait for completion.
+               */
+
+               do {
+                       --wfc_timeout;
+               } while ((0x80000000UL ==
+                               ncr_register_read((unsigned *)(nca_address + 
0xf0))) &&
+                               0 < wfc_timeout);
+
+               if (0 == wfc_timeout) {
+                       ncr_unlock(LOCK_DOMAIN);
+                       return -1;
+               }
+
+               /*
+               * Copy data words to the buffer.
+               */
+
+               address = (unsigned long)(nca_address + 0x1000);
+               while (4 <= number) {
+                       *((unsigned long *) buffer) =
+                               ncr_register_read((unsigned *) address);
+                       address += 4;
+                       number -= 4;
+               }
+
+               if (0 < number) {
+                       unsigned long temp =
+                               ncr_register_read((unsigned *) address);
+                       memcpy((void *) buffer, &temp, number);
+               }
+       } else {
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+               void __iomem *targ_address = apb2ser0_address +
+                                            (address & (~0x3));
+               /*
+               * Copy data words to the buffer.
+               */
+
+               while (4 <= number) {
+                       *((unsigned long *) buffer) =
+                               *((unsigned long *) targ_address);
+                       targ_address += 4;
+                       number -= 4;
+               }
+#else
+               ncr_unlock(LOCK_DOMAIN);
+               return -1;
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+       }
+
+       ncr_unlock(LOCK_DOMAIN);
+
+       return 0;
+}
+EXPORT_SYMBOL(ncr_read);
+
+/*
+  ----------------------------------------------------------------------
+  ncr_write
+*/
+
+int
+ncr_write(unsigned long region, unsigned long address, int number,
+         void *buffer)
+{
+       command_data_register_0_t cdr0;
+       command_data_register_1_t cdr1;
+       command_data_register_2_t cdr2;
+       unsigned long data_word_base;
+       int dbs = (number - 1);
+       int wfc_timeout = WFC_TIMEOUT;
+
+       if (NULL == nca_address)
+               return -1;
+
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+       if (NULL == apb2ser0_address)
+               return -1;
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+
+       if (0 != ncr_lock(LOCK_DOMAIN))
+               return -1;
+
+       if (NCP_NODE_ID(region) != 0x0153) {
+               /*
+                 Set up the write.
+               */
+
+               cdr2.raw = 0;
+               cdr2.bits.target_node_id = NCP_NODE_ID(region);
+               cdr2.bits.target_id_address_upper = NCP_TARGET_ID(region);
+               ncr_register_write(cdr2.raw, (unsigned *) (nca_address + 0xf8));
+
+               cdr1.raw = 0;
+               cdr1.bits.target_address = (address >> 2);
+               ncr_register_write(cdr1.raw, (unsigned *) (nca_address + 0xf4));
+
+               /*
+                 Copy from buffer to the data words.
+               */
+
+               data_word_base = (unsigned long)(nca_address + 0x1000);
+
+               while (4 <= number) {
+                       ncr_register_write(*((unsigned long *) buffer),
+                                       (unsigned *) data_word_base);
+                       data_word_base += 4;
+                       buffer += 4;
+                       number -= 4;
+               }
+
+               if (0 < number) {
+                       unsigned long temp = 0;
+
+                       memcpy((void *) &temp, (void *) buffer, number);
+                       ncr_register_write(temp, (unsigned *) data_word_base);
+                       data_word_base += number;
+                       buffer += number;
+                       number = 0;
+               }
+
+               cdr0.raw = 0;
+               cdr0.bits.start_done = 1;
+
+               if (0xff == cdr2.bits.target_id_address_upper)
+                       cdr0.bits.local_bit = 1;
+
+               cdr0.bits.cmd_type = 5;
+               /* TODO: Verify number... */
+               cdr0.bits.dbs = dbs;
+               ncr_register_write(cdr0.raw, (unsigned *) (nca_address + 0xf0));
+               mb();
+
+               /*
+               * Wait for completion.
+               */
+
+               do {
+                       --wfc_timeout;
+               } while ((0x80000000UL ==
+                               ncr_register_read((unsigned *) (nca_address + 
0xf0)))
+                               && 0 < wfc_timeout);
+
+               if (0 == wfc_timeout) {
+                       ncr_unlock(LOCK_DOMAIN);
+                       return -1;
+               }
+
+               /*
+               Check status.
+               */
+
+               if (0x3 !=
+                               ((ncr_register_read((unsigned *)
+                                               (nca_address + 0xf0)) &
+                                               0x00c00000) >> 22)) {
+                       unsigned long status;
+
+                       status = ncr_register_read((unsigned *)(nca_address +
+                                                               0xe4));
+                       ncr_unlock(LOCK_DOMAIN);
+
+                       return status;
+               }
+       } else {
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+               void __iomem *targ_address = apb2ser0_address +
+                                            (address & (~0x3));
+               /*
+                 Copy from buffer to the data words.
+               */
+
+               while (4 <= number) {
+                       *((unsigned long *) targ_address) =
+                               *((unsigned long *) buffer);
+                       targ_address += 4;
+                       number -= 4;
+               }
+#else
+               ncr_unlock(LOCK_DOMAIN);
+               return -1;
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+       }
+
+       ncr_unlock(LOCK_DOMAIN);
+
+       return 0;
+}
+EXPORT_SYMBOL(ncr_write);
+
+/*
+  ----------------------------------------------------------------------
+  ncr_init
+*/
+
+int
+ncr_init(void)
+{
+       nca_address = ioremap(NCA_PHYS_ADDRESS, 0x20000);
+
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+       apb2ser0_address = ioremap(APB2SER_PHY_PHYS_ADDRESS, 0x10000);
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+
+       printk(KERN_INFO "ncr: available\n");
+
+       return 0;
+}
+EXPORT_SYMBOL(ncr_init);
+
+/*
+  ----------------------------------------------------------------------
+  ncr_exit
+*/
+
+void __exit
+ncr_exit(void)
+{
+       /* Unmap the NCA. */
+       if (NULL != nca_address)
+               iounmap(nca_address);
+
+#ifdef APB2SER_PHY_PHYS_ADDRESS
+       /* Unmap the APB2SER0 PHY. */
+       if (NULL != apb2ser0_address)
+               iounmap(apb2ser0_address);
+#endif /* APB2SER_PHY_PHYS_ADDRESS */
+
+       return;
+}
+EXPORT_SYMBOL(ncr_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Register Ring access for LSI's ACP board");
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 93f5634..8e86fc6 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -508,7 +508,7 @@ config LSI_MTC
 
 config LSI_NCR
        tristate "LSI NCR Access"
-       depends on ARCH_AXXIA || ACP
+       depends on ACP
        help
          Provides access to the LSI Axxia NCR bus.
 
diff --git a/drivers/misc/lsi-smmon.c b/drivers/misc/lsi-smmon.c
index 33c52cf..c73e745 100644
--- a/drivers/misc/lsi-smmon.c
+++ b/drivers/misc/lsi-smmon.c
@@ -15,16 +15,16 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
-#include <linux/proc_fs.h>
+#include <linux/slab.h>
 
-#include "lsi-ncr.h"
+#include <mach/ncr.h>
 
 #ifndef CONFIG_ARCH_AXXIA
 #error "Only AXM55xx is Supported At Present!"
 #endif
 
 static int log = 1;
-module_param(log, int, 0755);
+module_param(log, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
 MODULE_PARM_DESC(log, "Log each error on the console.");
 
 /*
@@ -86,7 +86,54 @@ struct smmon_counts {
 
 static struct smmon_counts counts;
 
-DEFINE_SPINLOCK(counts_lock);
+DEFINE_RAW_SPINLOCK(counts_lock);
+
+#define SUMMARY_SIZE 512
+static char *summary;
+module_param(summary, charp, S_IRUGO);
+MODULE_PARM_DESC(summary, "A Summary of the Current Error Counts.");
+
+/*
+  
------------------------------------------------------------------------------
+  update_summary
+*/
+
+static void
+update_summary(void)
+{
+       memset(summary, 0, SUMMARY_SIZE);
+       sprintf(summary,
+               "------------ Counts for SM0/SM1 ----------\n"
+               "                   Illegal Access: %lu/%lu\n"
+               "        Multiple Illegal Accesses: %lu/%lu\n"
+               "            Correctable ECC Error: %lu/%lu\n"
+               "  Multiple Correctable ECC Errors: %lu/%lu\n"
+               "          Uncorrectable ECC Error: %lu/%lu\n"
+               "Multiple Uncorrectable ECC Errors: %lu/%lu\n"
+               "                      Port Errors: %lu/%lu\n"
+               "                      Wrap Errors: %lu/%lu\n"
+               "                    Parity Errors: %lu/%lu\n",
+               counts.illegal_access[0],
+               counts.illegal_access[1],
+               counts.multiple_illegal_access[0],
+               counts.multiple_illegal_access[1],
+               counts.correctable_ecc[0],
+               counts.correctable_ecc[1],
+               counts.multiple_correctable_ecc[0],
+               counts.multiple_correctable_ecc[1],
+               counts.uncorrectable_ecc[0],
+               counts.uncorrectable_ecc[1],
+               counts.multiple_uncorrectable_ecc[0],
+               counts.multiple_uncorrectable_ecc[1],
+               counts.port_error[0],
+               counts.port_error[1],
+               counts.wrap_error[0],
+               counts.wrap_error[1],
+               counts.parity_error[0],
+               counts.parity_error[1]);
+
+       return;
+}
 
 /*
   
------------------------------------------------------------------------------
@@ -119,7 +166,7 @@ static irqreturn_t smmon_isr(int interrupt, void *device)
                return IRQ_NONE;
        }
 
-       spin_lock(&counts_lock);
+       raw_spin_lock(&counts_lock);
 
        if (0 != (0x00000002 & status) || 0 != (0x00000004 & status))
                printk(KERN_ERR
@@ -179,7 +226,9 @@ static irqreturn_t smmon_isr(int interrupt, void *device)
                               "smmon(%d): Parity Error!\n", sm);
        }
 
-       spin_unlock(&counts_lock);
+       update_summary();
+
+       raw_spin_unlock(&counts_lock);
 
        ncr_write(region, 0x548, 4, &status);
 
@@ -187,56 +236,6 @@ static irqreturn_t smmon_isr(int interrupt, void *device)
 }
 
 /*
-  
------------------------------------------------------------------------------
-  smmon_read_proc
-*/
-
-static int
-smmon_read_proc(char *page, char **start, off_t offset, int count,
-               int *eof, void *data)
-{
-       int length;
-       unsigned long flags;
-
-       spin_lock_irqsave(&counts_lock, flags);
-
-       length = sprintf(page,
-                        "------------ Counts for SM0/SM1 ----------\n"
-                        "                   Illegal Access: %lu/%lu\n"
-                        "        Multiple Illegal Accesses: %lu/%lu\n"
-                        "            Correctable ECC Error: %lu/%lu\n"
-                        "  Multiple Correctable ECC Errors: %lu/%lu\n"
-                        "          Uncorrectable ECC Error: %lu/%lu\n"
-                        "Multiple Uncorrectable ECC Errors: %lu/%lu\n"
-                        "                      Port Errors: %lu/%lu\n"
-                        "                      Wrap Errors: %lu/%lu\n"
-                        "                    Parity Errors: %lu/%lu\n",
-                        counts.illegal_access[0],
-                        counts.illegal_access[1],
-                        counts.multiple_illegal_access[0],
-                        counts.multiple_illegal_access[1],
-                        counts.correctable_ecc[0],
-                        counts.correctable_ecc[1],
-                        counts.multiple_correctable_ecc[0],
-                        counts.multiple_correctable_ecc[1],
-                        counts.uncorrectable_ecc[0],
-                        counts.uncorrectable_ecc[1],
-                        counts.multiple_uncorrectable_ecc[0],
-                        counts.multiple_uncorrectable_ecc[1],
-                        counts.port_error[0],
-                        counts.port_error[1],
-                        counts.wrap_error[0],
-                        counts.wrap_error[1],
-                        counts.parity_error[0], counts.parity_error[1]);
-
-       spin_unlock_irqrestore(&counts_lock, flags);
-
-       *eof = 1;
-
-       return length;
-}
-
-/*
   
==============================================================================
   
==============================================================================
   Linux Interface
@@ -254,8 +253,13 @@ static int __init smmon_init(void)
        int rc;
        int mask;
 
-       printk("smmon: log=%d\n", log);
-       create_proc_read_entry("smmon", 0, NULL, smmon_read_proc, NULL);
+       summary = kmalloc(SUMMARY_SIZE, GFP_KERNEL);
+
+       if (NULL == summary)
+               return -ENOMEM;
+
+       update_summary();
+
        memset(&counts, 0, sizeof(struct smmon_counts));
 
        /*
@@ -271,12 +275,10 @@ static int __init smmon_init(void)
        rc |= request_irq(32 + 160, smmon_isr, IRQF_ONESHOT,
                        "smmon_1", NULL);
 
-       if (0 != rc) {
-               printk(KERN_ERR "smmon: Couldn't connect interrupt handler!\n");
+       if (0 != rc)
                return -EBUSY;
-       }
 
-       printk(KERN_INFO "smmon: Monitoring System Memory\n");
+       printk(KERN_INFO "lsi smmon: Monitoring System Memory\n");
 
        return 0;
 }
@@ -293,9 +295,9 @@ static void __exit smmon_exit(void)
        free_irq(32 + 161, NULL);
        free_irq(32 + 160, NULL);
 
-       remove_proc_entry("smmon", NULL);
+       kfree(summary);
 
-       printk(KERN_INFO "smmon: Not Monitoring System Memory\n");
+       printk(KERN_INFO "lsi smmon: Not Monitoring System Memory\n");
 
        return;
 }
diff --git a/drivers/net/ethernet/lsi/lsi_acp_net.c 
b/drivers/net/ethernet/lsi/lsi_acp_net.c
index c74bef1..5684779 100644
--- a/drivers/net/ethernet/lsi/lsi_acp_net.c
+++ b/drivers/net/ethernet/lsi/lsi_acp_net.c
@@ -82,13 +82,18 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/dma-mapping.h>
-
 #include <linux/uaccess.h>
 #include <linux/io.h>
+
 #include <asm/dma.h>
 
-#include "lsi_acp_net.h"
+#ifdef CONFIG_AXXIA
+#include <mach/ncr.h>
+#else
 #include "../../../misc/lsi-ncr.h"
+#endif
+
+#include "lsi_acp_net.h"
 
 extern int acp_mdio_read(unsigned long, unsigned long, unsigned short *, int);
 extern int acp_mdio_write(unsigned long, unsigned long, unsigned short, int);
-- 
1.7.9.5

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

Reply via email to