summaryrefslogtreecommitdiffstats
path: root/target/linux/atheros-2.6/files/arch/mips/atheros/prom.c
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-02-04 21:18:10 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-02-04 21:18:10 +0000
commit63b12ffd1bf4012ffb97802ca54a60a3d895903a (patch)
treefb5e795f44118b5a4b2408315c93cefae425682f /target/linux/atheros-2.6/files/arch/mips/atheros/prom.c
parent0634ad3b282481a980e7791af560491e662ec426 (diff)
update atheros 2.6 port - add support for the older chip generation
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6265 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/atheros-2.6/files/arch/mips/atheros/prom.c')
-rw-r--r--target/linux/atheros-2.6/files/arch/mips/atheros/prom.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/target/linux/atheros-2.6/files/arch/mips/atheros/prom.c b/target/linux/atheros-2.6/files/arch/mips/atheros/prom.c
new file mode 100644
index 000000000..6dfa13c77
--- /dev/null
+++ b/target/linux/atheros-2.6/files/arch/mips/atheros/prom.c
@@ -0,0 +1,67 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright MontaVista Software Inc
+ * Copyright (C) 2003 Atheros Communications, Inc., All Rights Reserved.
+ * Copyright (C) 2006 FON Technology, SL.
+ * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
+ */
+
+/*
+ * Prom setup file for ar531x
+ */
+
+#include <linux/init.h>
+#include <linux/autoconf.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/bootmem.h>
+
+#include <asm/bootinfo.h>
+#include <asm/addrspace.h>
+#include "ar531x.h"
+
+void __init prom_init(void)
+{
+ u32 memsize, memcfg;
+
+ mips_machgroup = MACH_GROUP_ATHEROS;
+ mips_machtype = -1;
+
+ /*
+ * Atheros CPUs before the AR2315 are using MIPS 4Kc core, later designs are
+ * using MIPS 4KEc R2 core. This makes it easy to determine the board at runtime.
+ */
+
+ if (current_cpu_data.cputype == CPU_4KEC) {
+ mips_machtype = MACH_ATHEROS_AR5315;
+
+ memcfg = sysRegRead(AR5315_MEM_CFG);
+ memsize = 1 + ((memcfg & SDRAM_DATA_WIDTH_M) >> SDRAM_DATA_WIDTH_S);
+ memsize <<= 1 + ((memcfg & SDRAM_COL_WIDTH_M) >> SDRAM_COL_WIDTH_S);
+ memsize <<= 1 + ((memcfg & SDRAM_ROW_WIDTH_M) >> SDRAM_ROW_WIDTH_S);
+ memsize <<= 3;
+ } else {
+ int bank0AC, bank1AC;
+
+ mips_machtype = MACH_ATHEROS_AR5312;
+
+ memcfg = sysRegRead(AR531X_MEM_CFG1);
+ bank0AC = (memcfg & MEM_CFG1_AC0) >> MEM_CFG1_AC0_S;
+ bank1AC = (memcfg & MEM_CFG1_AC1) >> MEM_CFG1_AC1_S;
+ memsize = (bank0AC ? (1 << (bank0AC+1)) : 0)
+ + (bank1AC ? (1 << (bank1AC+1)) : 0);
+ memsize <<= 20;
+ }
+
+ add_memory_region(0, memsize, BOOT_MEM_RAM);
+ strcpy(arcs_cmdline, "console=ttyS0,9600 rootfstype=squashfs,jffs2");
+}
+
+void __init prom_free_prom_memory(void)
+{
+}