From 9b3461e885fe4434568d804f42b41dea6557beea Mon Sep 17 00:00:00 2001
From: florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Thu, 19 Aug 2010 14:56:16 +0000
Subject: [ar7] remove fixed phy support, enable most ar7 switch drivers.

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22727 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 target/linux/ar7/config-2.6.32                     | 19 ++---
 .../ar7/patches-2.6.32/970-remove_fixed_phy.patch  | 89 ++++++++++++++++++++++
 2 files changed, 99 insertions(+), 9 deletions(-)
 create mode 100644 target/linux/ar7/patches-2.6.32/970-remove_fixed_phy.patch

(limited to 'target/linux/ar7')

diff --git a/target/linux/ar7/config-2.6.32 b/target/linux/ar7/config-2.6.32
index 59fa6e2dd..3e7fb4edd 100644
--- a/target/linux/ar7/config-2.6.32
+++ b/target/linux/ar7/config-2.6.32
@@ -1,9 +1,10 @@
 CONFIG_32BIT=y
 # CONFIG_64BIT is not set
+CONFIG_ADM6996_PHY=y
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+CONFIG_AR7=y
 CONFIG_AR7_GPIO=y
 CONFIG_AR7_WDT=y
-CONFIG_AR7=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
@@ -17,8 +18,8 @@ CONFIG_BITREVERSE=y
 CONFIG_BOOT_ELF32=y
 # CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
 # CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
-CONFIG_CEVT_R4K_LIB=y
 CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
 CONFIG_CFG80211_DEFAULT_PS_VALUE=0
 CONFIG_CMDLINE="rootfstype=squashfs,jffs2"
 CONFIG_CPMAC=y
@@ -28,9 +29,9 @@ CONFIG_CPU_HAS_PREFETCH=y
 CONFIG_CPU_HAS_SYNC=y
 CONFIG_CPU_LITTLE_ENDIAN=y
 # CONFIG_CPU_LOONGSON2E is not set
+CONFIG_CPU_MIPS32=y
 CONFIG_CPU_MIPS32_R1=y
 # CONFIG_CPU_MIPS32_R2 is not set
-CONFIG_CPU_MIPS32=y
 # CONFIG_CPU_MIPS64_R1 is not set
 # CONFIG_CPU_MIPS64_R2 is not set
 CONFIG_CPU_MIPSR1=y
@@ -52,17 +53,16 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y
 # CONFIG_CPU_TX39XX is not set
 # CONFIG_CPU_TX49XX is not set
 # CONFIG_CPU_VR41XX is not set
-CONFIG_CSRC_R4K_LIB=y
 CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
 CONFIG_DECOMPRESS_LZMA=y
 # CONFIG_DM9000 is not set
 CONFIG_DMA_NEED_PCI_MAP_STATE=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_EARLY_PRINTK=y
-CONFIG_FIXED_PHY=y
 # CONFIG_FSNOTIFY is not set
-CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 CONFIG_GENERIC_CMOS_UPDATE=y
 CONFIG_GENERIC_FIND_LAST_BIT=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
@@ -78,6 +78,7 @@ CONFIG_HAVE_IDE=y
 CONFIG_HAVE_OPROFILE=y
 CONFIG_HW_RANDOM=y
 CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IP17XX_PHY=y
 CONFIG_IRQ_CPU=y
 CONFIG_KALLSYMS=y
 CONFIG_LEDS_GPIO=y
@@ -89,6 +90,7 @@ CONFIG_LEDS_GPIO=y
 # CONFIG_MACH_TX49XX is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_MIKROTIK_RB532 is not set
+CONFIG_MIPS=y
 # CONFIG_MIPS_COBALT is not set
 CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_MACHINE is not set
@@ -97,22 +99,20 @@ CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_MT_SMP is not set
 # CONFIG_MIPS_MT_SMTC is not set
 # CONFIG_MIPS_SIM is not set
-CONFIG_MIPS=y
 CONFIG_MTD_AR7_PARTS=y
 CONFIG_MTD_CFI_STAA=y
 CONFIG_MTD_PHYSMAP=y
+CONFIG_MVSWITCH_PHY=y
 CONFIG_NO_EXCEPT_FILL=y
 # CONFIG_NO_IOPORT is not set
 # CONFIG_NXP_STB220 is not set
 # CONFIG_NXP_STB225 is not set
 CONFIG_PAGEFLAGS_EXTENDED=y
-# CONFIG_PCI is not set
 CONFIG_PHYLIB=y
 # CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_PROBE_INITRD_HEADER is not set
 CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SCSI_DMA is not set
 # CONFIG_SERIAL_8250_EXTENDED is not set
@@ -129,6 +129,7 @@ CONFIG_SCHED_OMIT_FRAME_POINTER=y
 # CONFIG_SIBYTE_SENTOSA is not set
 # CONFIG_SIBYTE_SWARM is not set
 CONFIG_SWAP_IO_SPACE=y
+CONFIG_SWCONFIG=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_SYS_HAS_EARLY_PRINTK=y
 CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
diff --git a/target/linux/ar7/patches-2.6.32/970-remove_fixed_phy.patch b/target/linux/ar7/patches-2.6.32/970-remove_fixed_phy.patch
new file mode 100644
index 000000000..289be1731
--- /dev/null
+++ b/target/linux/ar7/patches-2.6.32/970-remove_fixed_phy.patch
@@ -0,0 +1,89 @@
+--- a/arch/mips/ar7/platform.c
++++ b/arch/mips/ar7/platform.c
+@@ -33,7 +33,6 @@
+ #include <linux/string.h>
+ #include <linux/etherdevice.h>
+ #include <linux/phy.h>
+-#include <linux/phy_fixed.h>
+ 
+ #include <asm/addrspace.h>
+ #include <asm/mach-ar7/ar7.h>
+@@ -294,12 +293,6 @@ static struct physmap_flash_data physmap
+ 	.width = 2,
+ };
+ 
+-static struct fixed_phy_status fixed_phy_status __initdata = {
+-	.link = 1,
+-	.speed = 100,
+-	.duplex = 1,
+-};
+-
+ static struct plat_cpmac_data cpmac_low_data = {
+ 	.reset_bit = 17,
+ 	.power_bit = 20,
+@@ -716,11 +709,6 @@ static int __init ar7_register_devices(v
+ 	}
+ 
+ 	if (ar7_has_high_cpmac()) {
+-		res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_high_titan.id : cpmac_high.id,
+-						&fixed_phy_status);
+-		if (res && res != -ENODEV)
+-			return res;
+-
+ 		cpmac_get_mac(1, ar7_is_titan() ? cpmac_high_data_titan.dev_addr :
+ 						cpmac_high_data.dev_addr);
+ 		res = platform_device_register(ar7_is_titan() ? &cpmac_high_titan :
+@@ -736,11 +724,6 @@ static int __init ar7_register_devices(v
+ 
+ 	}
+ 
+-	res = fixed_phy_add(PHY_POLL, ar7_is_titan() ? cpmac_low_titan.id :
+-			cpmac_low.id, &fixed_phy_status);
+-	if (res && res != -ENODEV)
+-		return res;
+-
+ 	cpmac_get_mac(0, ar7_is_titan() ? cpmac_low_data_titan.dev_addr :
+ 			cpmac_low_data.dev_addr);
+ 	res = platform_device_register(ar7_is_titan() ? &cpmac_low_titan :
+--- a/drivers/net/cpmac.c
++++ b/drivers/net/cpmac.c
+@@ -1117,21 +1117,17 @@ static int __devinit cpmac_probe(struct 
+ 
+ 	pdata = pdev->dev.platform_data;
+ 
+-	if (external_switch || dumb_switch) {
+-		strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
+-		phy_id = pdev->id;
+-	} else {
+-		for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
+-			if (!(pdata->phy_mask & (1 << phy_id)))
+-				continue;
+-			if (!cpmac_mii->phy_map[phy_id])
+-				continue;
+-			strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
+-			break;
+-		}
++	for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
++		if (!(pdata->phy_mask & (1 << phy_id)))
++			continue;
++		if (!cpmac_mii->phy_map[phy_id])
++			continue;
++		strncpy(mdio_bus_id, cpmac_mii->id, MII_BUS_ID_SIZE);
++		break;
+ 	}
+-
++	
+ 	if (phy_id == PHY_MAX_ADDR) {
++		//This probably wont work as no fixed bus anymore.
+ 		dev_err(&pdev->dev, "no PHY present, falling back to switch mode\n");
+ 		strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); /* fixed phys bus */
+ 		phy_id = pdev->id;
+@@ -1268,7 +1264,7 @@ int __devinit cpmac_init(void)
+ 	}
+ 
+ 	cpmac_mii->phy_mask = ar7_is_titan()? ~(mask | 0x80000000 | 0x40000000):
+-		~(mask | 0x80000000);
++		~(mask | 0x80000001);
+ 	snprintf(cpmac_mii->id, MII_BUS_ID_SIZE, "1");
+ 
+ 	res = mdiobus_register(cpmac_mii);
-- 
cgit v1.2.3