summaryrefslogtreecommitdiff
path: root/polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c
diff options
context:
space:
mode:
Diffstat (limited to 'polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c')
-rw-r--r--polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c b/polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c
new file mode 100644
index 0000000000..498d0a3816
--- /dev/null
+++ b/polux/linux-2.6.10/arch/arm/mach-mse500/nvram.c
@@ -0,0 +1,82 @@
+/*
+ * arch/arm/mach-spc2XXc/nvram.c
+ *
+ * (C) Copyright 2009 SPiDCOM Technologies
+ *
+ * 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/vmalloc.h>
+#include <linux/proc_fs.h>
+#include <asm/arch/nvram.h>
+
+#ifdef CONFIG_MONA
+int proc_r_nvram (char *buf, char **start, off_t offset, int count, int *eof, void *data)
+{
+ char *p;
+ spidcom_nvram_t nvram, *nvram_ptr;
+ nvram_ptr = &nvram;
+ memcpy(&nvram, (void *)NVRAM_BASE_ADDRESS, sizeof(spidcom_nvram_t));
+
+ p = buf;
+ if(!NVRAM_IS_VALID(nvram_ptr))
+ {
+ p += sprintf(p, "Invalid NVRAM\n");
+ }
+ else
+ {
+ p += sprintf(p, "Serial Number: %s\n", nvram.serialNumber);
+ p += sprintf(p, "System description: %s\n", nvram.sysDescr);
+ p += sprintf(p, "ETH mac address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ nvram.ethPhysAddress[0], nvram.ethPhysAddress[1], nvram.ethPhysAddress[2],
+ nvram.ethPhysAddress[3], nvram.ethPhysAddress[4], nvram.ethPhysAddress[5]);
+ p += sprintf(p, "PLC mac address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ nvram.plcPhysAddress[0], nvram.plcPhysAddress[1], nvram.plcPhysAddress[2],
+ nvram.plcPhysAddress[3], nvram.plcPhysAddress[4], nvram.plcPhysAddress[5]);
+ if(NVRAM2_IS_VALID(nvram_ptr))
+ {
+ p += sprintf(p, "Board description: %s\n", nvram.boardDesc);
+ p += sprintf(p, "Board id: %d\n", nvram.boardId);
+ p += sprintf(p, "Vendor info: %s\n", nvram.vendorInfo);
+ p += sprintf(p, "SDRAM size: %d\n", nvram.sdramSize);
+ p += sprintf(p, "Image 0 offset: %08x\n", (unsigned int)nvram.imageOffset0);
+ p += sprintf(p, "Image 1 offset: %08x\n", (unsigned int)nvram.imageOffset1);
+ p += sprintf(p, "Eth port nb: %d\n", nvram.ethPortNum);
+ p += sprintf(p, "Manufactory info: %s\n", nvram.manufactoryInfo);
+ }
+ }
+ *eof = 1;
+ return p - buf + 1;
+}
+#else
+int proc_r_nvram (char *buf, char **start, off_t offset, int count, int *eof, void *data)
+{
+ return buf;
+}
+#endif /* CONFIG_MONA */
+
+
+/**
+ * Function: spc2XXc_init_nvram
+ * Parameters: void
+ * Purpose: Initialize SPC2XXC NVRAM proc info
+ * Return Value: void
+ */
+void spc2XXc_init_nvram(void)
+{
+ create_proc_read_entry ("nvram", 0, NULL, proc_r_nvram, NULL);
+}
+