Browse Source

atheros: don't try to enable pci on AR2317 (fixes #3533)

SVN-Revision: 12633
Felix Fietkau 17 years ago
parent
commit
e5dc717d22

+ 12 - 22
target/linux/atheros/files/arch/mips/atheros/ar5315/board.c

@@ -219,23 +219,6 @@ int __init ar5315_init_devices(void)
 	ar531x_find_config(ar5315_flash_limit());
 	ar531x_find_config(ar5315_flash_limit());
 	bcfg = (struct ar531x_boarddata *) board_config;
 	bcfg = (struct ar531x_boarddata *) board_config;
 
 
-#if 0
-	{
-	/* Detect the hardware based on the device ID */
-	u32 devid = sysRegRead(AR5315_SREV) & AR5315_REV_MAJ >> AR5315_REV_MAJ_S;
-		switch(devid) {
-		case 0x9:
-			mips_machtype = MACH_ATHEROS_AR2317;
-			break;
-		/* FIXME: how can we detect AR2316? */
-		case 0x8:
-		default:
-			mips_machtype = MACH_ATHEROS_AR2315;
-			break;
-		}
-	}
-#endif
-
 	config = (struct ar531x_config *) kzalloc(sizeof(struct ar531x_config), GFP_KERNEL);
 	config = (struct ar531x_config *) kzalloc(sizeof(struct ar531x_config), GFP_KERNEL);
 	config->board = board_config;
 	config->board = board_config;
 	config->radio = radio_config;
 	config->radio = radio_config;
@@ -296,7 +279,6 @@ static void ar5315_power_off(void)
 
 
 static void ar5315_restart(char *command)
 static void ar5315_restart(char *command)
 {
 {
-	unsigned int reg;
 	for(;;) {
 	for(;;) {
 		/* reset the system */
 		/* reset the system */
 		sysRegWrite(AR5315_COLD_RESET,AR5317_RESET_SYSTEM);
 		sysRegWrite(AR5315_COLD_RESET,AR5317_RESET_SYSTEM);
@@ -380,7 +362,7 @@ static void __init ar5315_time_init(void)
 
 
 void __init ar5315_prom_init(void)
 void __init ar5315_prom_init(void)
 {
 {
-	u32 memsize, memcfg;
+	u32 memsize, memcfg, devid;
 
 
 	is_5315 = 1;
 	is_5315 = 1;
 	memcfg = sysRegRead(AR5315_MEM_CFG);
 	memcfg = sysRegRead(AR5315_MEM_CFG);
@@ -390,9 +372,17 @@ void __init ar5315_prom_init(void)
 	memsize <<= 3;
 	memsize <<= 3;
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 	add_memory_region(0, memsize, BOOT_MEM_RAM);
 
 
-	/* Initialize it to AR2315 for now. Real detection will be done
-	 * in ar5315_init_devices() */
-	mips_machtype = MACH_ATHEROS_AR2315;
+	/* Detect the hardware based on the device ID */
+	devid = sysRegRead(AR5315_SREV) & AR5315_REV_CHIP;
+	switch(devid) {
+		case 0x90:
+		case 0x91:
+			mips_machtype = MACH_ATHEROS_AR2317;
+			break;
+		default:
+			mips_machtype = MACH_ATHEROS_AR2315;
+			break;
+	}
 }
 }
 
 
 void __init ar5315_plat_setup(void)
 void __init ar5315_plat_setup(void)

+ 4 - 0
target/linux/atheros/files/arch/mips/atheros/ar5315/pci.c

@@ -22,6 +22,7 @@
 #include <linux/spinlock.h>
 #include <linux/spinlock.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
+#include <asm/bootinfo.h>
 #include <asm/paccess.h>
 #include <asm/paccess.h>
 #include <asm/irq_cpu.h>
 #include <asm/irq_cpu.h>
 #include <asm/io.h>
 #include <asm/io.h>
@@ -186,6 +187,9 @@ int __init ar5315_pci_init(void)
 {
 {
 	u32 reg;
 	u32 reg;
 
 
+	if (mips_machtype != MACH_ATHEROS_AR2315)
+		return -ENODEV;
+
 	printk("AR531x PCI init... \n");
 	printk("AR531x PCI init... \n");
 
 
 	cfgaddr = (u32) ioremap_nocache(0x80000000, 1*1024*1024); /* Remap PCI config space */
 	cfgaddr = (u32) ioremap_nocache(0x80000000, 1*1024*1024); /* Remap PCI config space */