1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-25 03:32:25 +02:00

[ar71xx] change ag71xx platform device registration

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12997 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2008-10-17 07:12:44 +00:00
parent 6070f6ddff
commit 3af3950aff
5 changed files with 61 additions and 27 deletions

View File

@ -50,8 +50,15 @@ static void __init ar71xx_generic_init(void)
ARRAY_SIZE(ar71xx_generic_spi_info));
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_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0x000f0000;
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ar71xx_eth1_data.phy_mask = 0x00100000;
ar71xx_add_device_eth(0);
ar71xx_add_device_eth(1);
ar71xx_add_device_usb();

View File

@ -155,7 +155,11 @@ 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);
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0x00000001;
ar71xx_add_device_eth(0);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
rb4xx_leds_gpio);
@ -176,8 +180,15 @@ static void __init rb433_setup(void)
rb433_add_device_spi();
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);
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0x00000003;
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ar71xx_eth1_data.phy_mask = 0x00000010;
ar71xx_add_device_eth(1);
ar71xx_add_device_eth(0);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
rb4xx_leds_gpio);
@ -198,8 +209,15 @@ static void __init rb450_setup(void)
rb4xx_add_device_spi();
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);
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0x0000000f;
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ar71xx_eth1_data.phy_mask = 0x00000010;
ar71xx_add_device_eth(1);
ar71xx_add_device_eth(0);
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
rb4xx_leds_gpio);
@ -217,10 +235,19 @@ static void __init rb493_setup(void)
{
rb4xx_add_device_spi();
#if 0
ar71xx_add_device_mdio(0x3fffff00);
ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000000);
ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000001);
#if 0
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0;
ar71xx_eth0_data.speed = SPEED_100;
ar71xx_eth0_data.duplex = DUPLEX_FULL;
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
ar71xx_eth1_data.phy_mask = 0x00000001;
ar71xx_add_device_eth(0);
ar71xx_add_device_eth(1);
#endif
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),

View File

@ -124,7 +124,10 @@ static void __init wp543_setup(void)
ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info));
ar71xx_add_device_mdio(0xfffffff7);
ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000008);
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ar71xx_eth0_data.phy_mask = 0x00000008;
ar71xx_add_device_eth(0);
ar71xx_add_device_usb();

View File

@ -196,7 +196,7 @@ static struct resource ar71xx_eth0_resources[] = {
},
};
static struct ag71xx_platform_data ar71xx_eth0_data = {
struct ag71xx_platform_data ar71xx_eth0_data = {
.reset_bit = RESET_MODULE_GE0_MAC,
.flush_reg = DDR_REG_FLUSH_GE0,
};
@ -235,7 +235,7 @@ static struct resource ar71xx_eth1_resources[] = {
},
};
static struct ag71xx_platform_data ar71xx_eth1_data = {
struct ag71xx_platform_data ar71xx_eth1_data = {
.reset_bit = RESET_MODULE_GE1_MAC,
.flush_reg = DDR_REG_FLUSH_GE1,
};
@ -251,14 +251,13 @@ 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)
void __init ar71xx_add_device_eth(unsigned int id)
{
struct platform_device *pdev;
switch (id) {
case 0:
switch (phy_if_mode) {
switch (ar71xx_eth0_data.phy_if_mode) {
case PHY_INTERFACE_MODE_MII:
ar71xx_eth0_data.mii_if = MII0_CTRL_IF_MII;
break;
@ -276,12 +275,10 @@ void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
}
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;
break;
case 1:
switch (phy_if_mode) {
switch (ar71xx_eth1_data.phy_if_mode) {
case PHY_INTERFACE_MODE_RMII:
ar71xx_eth1_data.mii_if = MII1_CTRL_IF_RMII;
break;
@ -293,8 +290,6 @@ void __init ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
}
memcpy(ar71xx_eth1_data.mac_addr, ar71xx_mac_base, ETH_ALEN);
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;
break;
default:

View File

@ -20,13 +20,13 @@
#include <linux/gpio_buttons.h>
struct ag71xx_platform_data {
u32 reset_bit;
u32 flush_reg;
u32 phy_mask;
phy_interface_t phy_if_mode;
u32 mii_if;
u32 phy_mask;
int speed;
int duplex;
u32 reset_bit;
u32 flush_reg;
u32 mii_if;
u8 mac_addr[ETH_ALEN];
};
@ -49,8 +49,10 @@ extern void ar71xx_add_device_spi(struct ar71xx_spi_platform_data *pdata,
extern void ar71xx_set_mac_base(unsigned char *mac) __init;
extern void ar71xx_parse_mac_addr(char *mac_str) __init;
extern void ar71xx_add_device_eth(unsigned int id, phy_interface_t phy_if_mode,
u32 phy_mask) __init;
extern struct ag71xx_platform_data ar71xx_eth0_data;
extern struct ag71xx_platform_data ar71xx_eth1_data;
extern void ar71xx_add_device_eth(unsigned int id) __init;
extern void ar71xx_add_device_mdio(u32 phy_mask) __init;