summaryrefslogtreecommitdiff
path: root/target/linux/adm5120-2.6/files/arch/mips
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-25 11:12:51 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-06-25 11:12:51 +0000
commitbc03d2d1845271b9732a1add2955946a95d48d61 (patch)
tree03b97b89749f77099b8c2cda13ff38cf32aaf4db /target/linux/adm5120-2.6/files/arch/mips
parent90dc2376551b65223e2b7a69bf1d4a12dc3a9924 (diff)
[adm5120]: from now on, the kernel parses parameters passed by our lzma-loader
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7730 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/adm5120-2.6/files/arch/mips')
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/adm5120_info.c201
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c28
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/pci/fixup-adm5120.c26
3 files changed, 196 insertions, 59 deletions
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/adm5120_info.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/adm5120_info.c
index 570244b24d..87e3d865a5 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/adm5120_info.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/adm5120_info.c
@@ -27,6 +27,7 @@
#include <asm/mach-adm5120/routerboot.h>
#include <asm/mach-adm5120/zynos.h>
+extern char *prom_getenv(char *envname);
/*
* Globals
*/
@@ -53,6 +54,63 @@ static char *boot_loader_names[BOOT_LOADER_LAST+1] = {
};
static struct adm5120_board __initdata adm5120_boards[] = {
+ /* FIXME: some boards have invalid fields */
+ {
+ .name = "Cellvision CAS-630/630W",
+ .mach_type = MACH_ADM5120_CAS630,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision CAS-670/670W",
+ .mach_type = MACH_ADM5120_CAS670,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision CAS-700/700W",
+ .mach_type = MACH_ADM5120_CAS700,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision CAS-771/771W",
+ .mach_type = MACH_ADM5120_CAS771,
+ .has_usb = 0,
+ .iface_num = 5,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision CAS-790",
+ .mach_type = MACH_ADM5120_CAS790,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision CAS-861/861W",
+ .mach_type = MACH_ADM5120_CAS861,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision NFS-101U/101WU",
+ .mach_type = MACH_ADM5120_NFS101U,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "Cellvision NFS-202U/202WU",
+ .mach_type = MACH_ADM5120_NFS202U,
+ .has_usb = 0,
+ .iface_num = 1,
+ .flash0_size = 4*1024*1024,
+ },
{
.name = "Compex NetPassage 27G",
.mach_type = MACH_ADM5120_NP27G,
@@ -117,6 +175,41 @@ static struct adm5120_board __initdata adm5120_boards[] = {
.flash0_size = 4*1024*1024,
},
{
+ .name = "Edimax BR-6104K",
+ .mach_type = MACH_ADM5120_BR6104K,
+ .has_usb = 0,
+ .iface_num = 5,
+ .flash0_size = 2*1024*1024,
+ },
+ {
+ .name = "Infineon EASY 5120",
+ .mach_type = MACH_ADM5120_EASY5120,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 2*1024*1024,
+ },
+ {
+ .name = "Infineon EASY 5120-RT",
+ .mach_type = MACH_ADM5120_EASY5120RT,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 2*1024*1024,
+ },
+ {
+ .name = "Infineon EASY 5120P-ATA",
+ .mach_type = MACH_ADM5120_EASY5120PATA,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 2*1024*1024,
+ },
+ {
+ .name = "Infineon EASY 83000",
+ .mach_type = MACH_ADM5120_EASY83000,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 4*1024*1024,
+ },
+ {
.name = "RouterBOARD 111",
.mach_type = MACH_ADM5120_RB_111,
.has_usb = 0,
@@ -159,6 +252,20 @@ static struct adm5120_board __initdata adm5120_boards[] = {
.flash0_size = 128*1024,
},
{
+ .name = "ZyXEL ES-2024A",
+ .mach_type = MACH_ADM5120_ES2024A,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 4*1024*1024,
+ },
+ {
+ .name = "ZyXEL ES-2024PWR",
+ .mach_type = MACH_ADM5120_ES2024PWR,
+ .has_usb = 0,
+ .iface_num = 0,
+ .flash0_size = 4*1024*1024,
+ },
+ {
.name = "ZyXEL ES-2108",
.mach_type = MACH_ADM5120_ES2108,
.has_usb = 0,
@@ -187,7 +294,7 @@ static struct adm5120_board __initdata adm5120_boards[] = {
.flash0_size = 4*1024*1024,
},
{
- .name = "ZyXEL ES-2108PWR",
+ .name = "ZyXEL ES-2108-PWR",
.mach_type = MACH_ADM5120_ES2108PWR,
.has_usb = 0,
.iface_num = 0,
@@ -288,7 +395,7 @@ struct mylo_board {
#define COMPEX_BOARD(d,mt) MYLO_BOARD(VENID_COMPEX,(d),VENID_COMPEX,(d),(mt))
-static struct mylo_board __initdata mylo_boards[] = {
+static struct mylo_board mylo_boards[] __initdata = {
COMPEX_BOARD(DEVID_COMPEX_NP27G, MACH_ADM5120_NP27G),
COMPEX_BOARD(DEVID_COMPEX_NP28G, MACH_ADM5120_NP28G),
COMPEX_BOARD(DEVID_COMPEX_NP28GHS, MACH_ADM5120_NP28GHS),
@@ -308,7 +415,7 @@ struct routerboard {
};
#define ROUTERBOARD(n, mt) { .name = (n), .mach_type = (mt) }
-static struct routerboard __initdata routerboards[] = {
+static struct routerboard routerboards[] __initdata = {
ROUTERBOARD("111", MACH_ADM5120_RB_111),
ROUTERBOARD("112", MACH_ADM5120_RB_112),
ROUTERBOARD("133", MACH_ADM5120_RB_133),
@@ -331,7 +438,7 @@ struct zynos_board {
#define DLINK_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_DLINK, bi, mt)
#define LUCENT_BOARD(bi, mt) ZYNOS_BOARD(ZYNOS_VENDOR_ID_LUCENT, bi, mt)
-static struct zynos_board __initdata zynos_boards[] = {
+static struct zynos_board zynos_boards[] __initdata = {
ZYXEL_BOARD(ZYNOS_BOARD_HS100, MACH_ADM5120_HS100),
ZYXEL_BOARD(ZYNOS_BOARD_P334, MACH_ADM5120_P334),
ZYXEL_BOARD(ZYNOS_BOARD_P334U, MACH_ADM5120_P334U),
@@ -345,6 +452,31 @@ static struct zynos_board __initdata zynos_boards[] = {
DUMMY_BOARD()
};
+struct common_board {
+ char *name;
+ unsigned long mach_type;
+};
+
+#define DEFBOARD(n, mt) { .name = (n), .mach_type = (mt) }
+static struct common_board common_boards[] __initdata = {
+ DEFBOARD("CAS-630", MACH_ADM5120_CAS630),
+ DEFBOARD("CAS-670", MACH_ADM5120_CAS670),
+ DEFBOARD("CAS-700", MACH_ADM5120_CAS700),
+ DEFBOARD("CAS-771", MACH_ADM5120_CAS771),
+ DEFBOARD("CAS-790", MACH_ADM5120_CAS790),
+ DEFBOARD("CAS-861", MACH_ADM5120_CAS861),
+ DEFBOARD("NFS-101U", MACH_ADM5120_NFS101U),
+ DEFBOARD("NFS-202U", MACH_ADM5120_NFS202U),
+ DEFBOARD("EASY 5120", MACH_ADM5120_EASY5120),
+ DEFBOARD("EASY 5120-RT", MACH_ADM5120_EASY5120RT),
+ DEFBOARD("EASY 5120P-ATA", MACH_ADM5120_EASY5120PATA),
+ DEFBOARD("EASY 83000", MACH_ADM5120_EASY83000),
+ DEFBOARD("BR-6104K", MACH_ADM5120_BR6104K),
+ DEFBOARD("WP54G-WRT", MACH_ADM5120_WP54G_WRT),
+ DEFBOARD("P-334WT", MACH_ADM5120_P334WT),
+ DEFBOARD("P-335", MACH_ADM5120_P335),
+};
+
/*
* Helper routines
*/
@@ -694,6 +826,34 @@ static unsigned long __init uboot_detect_board(void)
return MACH_ADM5120_UNKNOWN;
}
+/*
+ * Misc boards
+ */
+static unsigned long __init prom_detect_board(void)
+{
+ char *name;
+ unsigned long ret;
+ int i;
+
+ ret = MACH_ADM5120_UNKNOWN;
+ name = prom_getenv("board_name");
+ if (name == NULL)
+ goto out;
+
+ if (*name == '\0')
+ goto out;
+
+ for (i=0; i<ARRAY_SIZE(common_boards); i++) {
+ if (strcmp(common_boards[i].name, name) == 0) {
+ ret = common_boards[i].mach_type;
+ break;
+ }
+ }
+
+out:
+ return ret;
+}
+
static void __init adm5120_detect_board(void)
{
struct adm5120_board *board;
@@ -719,6 +879,8 @@ static void __init adm5120_detect_board(void)
adm5120_boot_loader = BOOT_LOADER_UBOOT;
if (t == MACH_ADM5120_UNKNOWN)
t = uboot_detect_board();
+ } else {
+ t = prom_detect_board();
}
for (board = adm5120_boards; board->mach_type != MACH_ADM5120_UNKNOWN;
@@ -793,7 +955,7 @@ static void __init adm5120_detect_memsize(void)
break;
}
- /* FIXME: need to disable buffers for both SDRAM bank? */
+ /* FIXME: need to disable buffers for both SDRAM banks? */
mem_dbg("checking for %ldMB chip\n",maxsize >> 20);
@@ -887,33 +1049,15 @@ out:
void __init adm5120_info_show(void)
{
/* FIXME: move this somewhere else */
- printk("ADM%04X%s revision %d, running at %ldMHz\n",
+ printk(KERN_INFO "ADM%04X%s revision %d, running at %ldMHz\n",
adm5120_product_code,
(adm5120_package == ADM5120_PACKAGE_BGA) ? "" : "P",
adm5120_revision, (adm5120_speed / 1000000)
);
- printk("Boot loader is: %s\n", boot_loader_names[adm5120_boot_loader]);
- printk("Booted from : %s flash\n", adm5120_nand_boot ? "NAND":"NOR");
- printk("Board is : %s\n", adm5120_board_name());
- printk("Memory size : %ldMB\n", adm5120_memsize >> 20);
-}
-
-void __init adm5120_swab_test(void)
-{
-#if CONFIG_ADM5120_HARDWARE_SWAB
- u32 t1,t2;
-
- t1 = 0x1234;
- t2 = __arch__swab16(t1);
- printk("hardware swab16 test %s, data:0x%04X, result:0x%04X\n",
- (t2 == 0x3412) ? "passed" :"failed", t1, t2);
-
- t1 = 0x12345678;
- t2 = __arch__swab32(t1);
- printk("hardware swab32 test %s, data:0x%08X, result:0x%08X\n",
- (t2 == 0x78563412) ? "passed" :"failed", t1, t2);
-
-#endif /* CONFIG_ADM5120_HARDWARE_SWAB */
+ printk(KERN_INFO "Boot loader is: %s\n", boot_loader_names[adm5120_boot_loader]);
+ printk(KERN_INFO "Booted from : %s flash\n", adm5120_nand_boot ? "NAND":"NOR");
+ printk(KERN_INFO "Board is : %s\n", adm5120_board_name());
+ printk(KERN_INFO "Memory size : %ldMB\n", adm5120_memsize >> 20);
}
void __init adm5120_info_init(void)
@@ -924,5 +1068,4 @@ void __init adm5120_info_init(void)
adm5120_detect_board();
adm5120_info_show();
- adm5120_swab_test();
}
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c
index 1cbbbc2de5..a288b073ca 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/prom.c
@@ -32,13 +32,12 @@
#include <asm/mach-adm5120/adm5120_info.h>
+static char **prom_envp;
+
void setup_prom_printf(int);
void prom_printf(char *, ...);
void prom_meminit(void);
-#define ADM5120_ENVC 1
-
-char *adm5120_envp[2*ADM5120_ENVC] = {"memsize","0x001000000"};
#define READCSR(r) *(volatile unsigned long *)(0xB2600000+(r))
#define WRITECSR(r,v) *(volatile unsigned long *)(0xB2600000+(r)) = v
@@ -81,25 +80,24 @@ void prom_printf(char *fmt, ...)
char *prom_getenv(char *envname)
{
- int i, index=0;
+ char **env;
+ char *ret;
- i = strlen(envname);
+ ret = NULL;
- printk(KERN_INFO "GETENV: envname is %s\n", envname);
+ if (prom_envp== NULL)
+ return NULL;
- while(index < (2*ADM5120_ENVC)) {
- if(strncmp(envname, adm5120_envp[index], i) == 0) {
- printk(KERN_INFO "GETENV: returning %s\n", adm5120_envp[index+1]);
- return(adm5120_envp[index+1]);
+ for (env = prom_envp; *env != NULL; env++) {
+ if (strcmp(envname, *env++) == 0) {
+ ret = *env;
+ break;
}
- index += 2;
}
- printk(KERN_INFO "GETENV: not found.\n");
- return(NULL);
+ return ret;
}
-
extern char _image_cmdline;
/*
* initialize the prom module.
@@ -108,6 +106,8 @@ void __init prom_init(void)
{
char *cmd;
+ prom_envp = (char **)fw_arg2;
+
adm5120_info_init();
/* you should these macros defined in include/asm/bootinfo.h */
diff --git a/target/linux/adm5120-2.6/files/arch/mips/pci/fixup-adm5120.c b/target/linux/adm5120-2.6/files/arch/mips/pci/fixup-adm5120.c
index e8389152b5..9326077caf 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/pci/fixup-adm5120.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/pci/fixup-adm5120.c
@@ -88,13 +88,13 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
int nr_irqs;
int i;
int irq;
-
+
irq = -1;
if (slot < 1 || slot > 3) {
printk("PCI: slot number %u is not supported\n", slot);
goto out;
}
-
+
GETMAP(default);
switch (mips_machtype) {
@@ -112,16 +112,10 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
case MACH_ADM5120_P334WT:
/* using default mapping */
break;
-#if 0
case MACH_ADM5120_CAS771:
- GETMAP(cas771)
+ GETMAP(cas771);
break;
- case MACH_ADM5120_CAS630:
- case MACH_ADM5120_CAS670:
- case MACH_ADM5120_CAS700:
- case MACH_ADM5120_CAS790:
- case MACH_ADM5120_CAS861:
-#endif
+
case MACH_ADM5120_NP27G:
case MACH_ADM5120_NP28GHS:
case MACH_ADM5120_WP54AG:
@@ -134,21 +128,21 @@ int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
adm5120_board_name());
break;
}
-
+
for (i=0; i<nr_irqs; i++, p++) {
- if ((p->slot == slot) && (PCI_FUNC(dev->devfn) == p->func) &&
+ if ((p->slot == slot) && (PCI_FUNC(dev->devfn) == p->func) &&
(p->pin == pin)) {
irq = p->irq;
break;
}
}
-
+
if (irq < 0) {
printk(KERN_INFO "PCI: no irq found for %s pin:%u\n",
pci_name(dev), pin);
} else {
printk(KERN_INFO "PCI: mapping irq for %s pin:%u, irq:%d\n",
- pci_name(dev), pin, irq);
+ pci_name(dev), pin, irq);
}
out:
@@ -161,7 +155,7 @@ static void adm5120_pci_fixup(struct pci_dev *dev)
return;
/* setup COMMAND register */
- pci_write_config_word(dev, PCI_COMMAND,
+ pci_write_config_word(dev, PCI_COMMAND,
(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER));
/* setup CACHE_LINE_SIZE register */
@@ -172,7 +166,7 @@ static void adm5120_pci_fixup(struct pci_dev *dev)
pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_ADM5120,
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_ADM5120,
adm5120_pci_fixup);
int pcibios_plat_dev_init(struct pci_dev *dev)