summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-29 18:22:38 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-07-29 18:22:38 +0000
commit52696b5d81d91be3b567e67bbc60ecfe125a4716 (patch)
tree8436d5d3e637e8ddd4bec5dc2c12476b25c039e3 /target/linux/ar71xx/files/arch
parent1468e6557266fd77a3522baeae7088709327071b (diff)
[ar71xx] ethernet driver updates
* new mii bus code, mac0 and mac1 can use the mac0's miii bus from now on * swap eth0 & eth1 on RB433/450 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11995 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/arch')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c5
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c11
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/platform.c51
4 files changed, 58 insertions, 10 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c
index 4a1200d52..42b5e0267 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c
@@ -49,8 +49,9 @@ static void __init ar71xx_generic_init(void)
ar71xx_add_device_spi(NULL, ar71xx_generic_spi_info,
ARRAY_SIZE(ar71xx_generic_spi_info));
- ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x001f0000);
- ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff);
+ ar71xx_add_device_mdio(0xffe0ffff);
+ ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x000f0000);
+ ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00100000);
ar71xx_add_device_usb();
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
index 7504c349a..a07f645d1 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
@@ -153,6 +153,7 @@ static void __init rb411_setup(void)
{
rb4xx_add_device_spi();
+ ar71xx_add_device_mdio(0xfffffffe);
ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
platform_device_register(&rb4xx_leds_gpio_device);
@@ -167,8 +168,9 @@ static void __init rb433_setup(void)
{
rb433_add_device_spi();
- ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
- ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff);
+ ar71xx_add_device_mdio(0xffffffec);
+ ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010);
+ ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000003);
platform_device_register(&rb4xx_leds_gpio_device);
platform_device_register(&rb4xx_nand_device);
@@ -182,8 +184,9 @@ static void __init rb450_setup(void)
{
rb4xx_add_device_spi();
- ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
- ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff);
+ ar71xx_add_device_mdio(0xffffffe0);
+ ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010);
+ ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x0000000f);
platform_device_register(&rb4xx_leds_gpio_device);
platform_device_register(&rb4xx_nand_device);
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
index 6f1f39b2a..21d9eb0b5 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
@@ -48,6 +48,7 @@ static void __init wp543_setup(void)
{
ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info));
+ ar71xx_add_device_mdio(0xfffffffe);
ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
ar71xx_pci_init(ARRAY_SIZE(wp543_pci_irqs), wp543_pci_irqs);
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c b/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c
index 07bec246b..208af8c8f 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/platform.c
@@ -143,12 +143,46 @@ static void __init ar71xx_add_device_uart(void)
}
#endif /* CONFIG_AR71XX_EARLY_SERIAL */
+static struct resource ar71xx_mdio_resources[] = {
+ {
+ .name = "mdio_base",
+ .flags = IORESOURCE_MEM,
+ .start = AR71XX_GE0_BASE + 0x20,
+ .end = AR71XX_GE0_BASE + 0x38 - 1,
+ }
+};
+
+static struct ag71xx_mdio_platform_data ar71xx_mdio_data = {
+ .phy_mask = 0xffffffff,
+};
+
+static struct platform_device ar71xx_mdio_device = {
+ .name = "ag71xx-mdio",
+ .id = -1,
+ .resource = ar71xx_mdio_resources,
+ .num_resources = ARRAY_SIZE(ar71xx_mdio_resources),
+ .dev = {
+ .platform_data = &ar71xx_mdio_data,
+ },
+};
+
+void __init ar71xx_add_device_mdio(u32 phy_mask)
+{
+ ar71xx_mdio_data.phy_mask = phy_mask;
+ platform_device_register(&ar71xx_mdio_device);
+}
+
static struct resource ar71xx_eth0_resources[] = {
{
.name = "mac_base",
.flags = IORESOURCE_MEM,
.start = AR71XX_GE0_BASE,
- .end = AR71XX_GE0_BASE + AR71XX_GE0_SIZE - 1,
+ .end = AR71XX_GE0_BASE + 0x20 - 1,
+ }, {
+ .name = "mac_base2",
+ .flags = IORESOURCE_MEM,
+ .start = AR71XX_GE0_BASE + 0x38,
+ .end = AR71XX_GE0_BASE + 0x200 - 1,
}, {
.name = "mii_ctrl",
.flags = IORESOURCE_MEM,
@@ -182,7 +216,12 @@ static struct resource ar71xx_eth1_resources[] = {
.name = "mac_base",
.flags = IORESOURCE_MEM,
.start = AR71XX_GE1_BASE,
- .end = AR71XX_GE1_BASE + AR71XX_GE1_SIZE - 1,
+ .end = AR71XX_GE1_BASE + 0x20 - 1,
+ }, {
+ .name = "mac_base2",
+ .flags = IORESOURCE_MEM,
+ .start = AR71XX_GE1_BASE + 0x38,
+ .end = AR71XX_GE1_BASE + 0x200 - 1,
}, {
.name = "mii_ctrl",
.flags = IORESOURCE_MEM,
@@ -211,6 +250,7 @@ static struct platform_device ar71xx_eth1_device = {
},
};
+static int ar71xx_eth_instance __initdata;
void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
u32 phy_mask)
{
@@ -235,6 +275,7 @@ void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
BUG();
}
memcpy(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, ETH_ALEN);
+ ar71xx_eth0_data.mac_addr[5] += ar71xx_eth_instance;
ar71xx_eth0_data.phy_if_mode = phy_if_mode;
ar71xx_eth0_data.phy_mask = phy_mask;
pdev = &ar71xx_eth0_device;
@@ -251,7 +292,7 @@ void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
BUG();
}
memcpy(ar71xx_eth1_data.mac_addr, ar71xx_mac_base, ETH_ALEN);
- ar71xx_eth1_data.mac_addr[5] += id;
+ ar71xx_eth1_data.mac_addr[5] += ar71xx_eth_instance;
ar71xx_eth1_data.phy_if_mode = phy_if_mode;
ar71xx_eth1_data.phy_mask = phy_mask;
pdev = &ar71xx_eth1_device;
@@ -261,8 +302,10 @@ void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
break;
}
- if (pdev)
+ if (pdev) {
platform_device_register(pdev);
+ ar71xx_eth_instance++;
+ }
}
static struct resource ar71xx_spi_resources[] = {