sync 8.09 with ar71xx changes from trunk
authorFelix Fietkau <nbd@openwrt.org>
Thu, 23 Oct 2008 20:38:22 +0000 (20:38 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 23 Oct 2008 20:38:22 +0000 (20:38 +0000)
SVN-Revision: 13042

target/linux/ar71xx/files/arch/mips/ar71xx/mach-generic.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb-4xx.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wp543.c
target/linux/ar71xx/files/arch/mips/ar71xx/platform.c
target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx.h
target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_phy.c
target/linux/ar71xx/files/include/asm-mips/mach-ar71xx/platform.h
target/linux/ar71xx/patches-2.6.26/001-ar71xx_core.patch
target/linux/ar71xx/patches-2.6.26/300-mips_fw_myloader.patch
target/linux/ar71xx/patches-2.6.26/900-mips_multi_machine_support.patch

index 42b5e026782eb0ea0a41435a83911ea28ac3f4b0..55fc61c92eb96286e4535935ed014ec4e5493c13 100644 (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();
 
index 7193849f3572ef1565cb60c07b0fdea0189187b4..8e63acac41e19b91498e9df6afcee0b0ebb04ace 100644 (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);
@@ -212,3 +230,35 @@ static void __init rb450_setup(void)
 }
 
 MIPS_MACHINE(MACH_AR71XX_RB_450, "MikroTik RouterBOARD 450", rb450_setup);
+
+static void __init rb493_setup(void)
+{
+       rb4xx_add_device_spi();
+
+       ar71xx_add_device_mdio(0x3fffff00);
+
+#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),
+                                       rb4xx_leds_gpio);
+
+       ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL,
+                                       ARRAY_SIZE(rb4xx_gpio_buttons),
+                                       rb4xx_gpio_buttons);
+
+       platform_device_register(&rb4xx_nand_device);
+}
+
+MIPS_MACHINE(MACH_AR71XX_RB_493, "MikroTik RouterBOARD 493/AH", rb493_setup);
+
index 4abecd8a02ea675cdf318fc6f10d66674f0df84c..ef2ef05759a2c2b54fef9a8bd6df169f093ab827 100644 (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();
 
index b131ec1e27f7b2ebc45575dc53b4e552f92c3bf3..aa4711d34e48f126ad251e6a4eb413bb338830e3 100644 (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:
index d2d055d5569847bfd4ec260c7430c3b4a63fe68b..2f60d19b5f7c2320dfebd6820504a6e2a3c3c52b 100644 (file)
@@ -37,7 +37,7 @@
 #define ETH_FCS_LEN    4
 
 #define AG71XX_DRV_NAME                "ag71xx"
-#define AG71XX_DRV_VERSION     "0.4.1"
+#define AG71XX_DRV_VERSION     "0.4.2"
 
 #define AG71XX_NAPI_TX         1
 
index 086de22291852fe4ac776217f48e5090c9af649f..512b42eb5cb9f5fc8063b69a8d878bb7c9f1decf 100644 (file)
@@ -193,8 +193,10 @@ void ag71xx_phy_start(struct ag71xx *ag)
        if (ag->phy_dev) {
                phy_start(ag->phy_dev);
        } else {
-               ag->duplex = DUPLEX_FULL;
-               ag->speed = SPEED_100;
+               struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag);
+
+               ag->duplex = pdata->duplex;
+               ag->speed = pdata->speed;
                ag->link = 1;
                ag71xx_phy_link_update(ag);
        }
@@ -220,8 +222,8 @@ int ag71xx_phy_connect(struct ag71xx *ag)
        int phy_count = 0;
        int phy_addr;
 
-       if (ag->mii_bus) {
-               /* TODO: use mutex of the mdio bus */
+       if (ag->mii_bus && pdata->phy_mask) {
+               /* TODO: use mutex of the mdio bus? */
                for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) {
                        if (!(pdata->phy_mask & (1 << phy_addr)))
                                continue;
@@ -242,9 +244,6 @@ int ag71xx_phy_connect(struct ag71xx *ag)
        }
 
        switch (phy_count) {
-       case 0:
-               printk(KERN_ERR "%s: no PHY found\n", dev->name);
-               return -ENODEV;
        case 1:
                ag->phy_dev = phy_connect(dev, phydev->dev.bus_id,
                        &ag71xx_phy_link_adjust, 0, pdata->phy_if_mode);
@@ -275,9 +274,10 @@ int ag71xx_phy_connect(struct ag71xx *ag)
                ag->speed = 0;
                ag->duplex = -1;
                break;
+
        default:
                ag->phy_dev = NULL;
-               printk(KERN_DEBUG "%s: connected to multiple PHYs (%d)\n",
+               printk(KERN_DEBUG "%s: connected to %d PHYs\n",
                        dev->name, phy_count);
                break;
        }
index 5b00e00be7403e42f7a080457d96cadbfc342f07..53ac555c7be0cebaaaa7b4804c2a37f91e1c84b0 100644 (file)
 #include <linux/gpio_buttons.h>
 
 struct ag71xx_platform_data {
+       phy_interface_t phy_if_mode;
+       u32             phy_mask;
+       int             speed;
+       int             duplex;
        u32             reset_bit;
        u32             flush_reg;
-       u32             phy_mask;
-       phy_interface_t phy_if_mode;
        u32             mii_if;
        u8              mac_addr[ETH_ALEN];
 };
@@ -47,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;
 
index 229387c1ab16bf3707af7b82da9bb31a917b920b..ebf8d60394642463642ed0e48718918f44456c09 100644 (file)
@@ -16,7 +16,7 @@
  
 --- a/include/asm-mips/bootinfo.h
 +++ b/include/asm-mips/bootinfo.h
-@@ -79,6 +79,15 @@
+@@ -79,6 +79,16 @@
  #define  MACH_LASAT_200               1       /* Masquerade PRO/SP200 */
  
  /*
 + */
 +#define MACH_AR71XX_GENERIC   0
 +#define MACH_AR71XX_WP543     1       /* Compex WP543 */
-+#define MACH_AR71XX_RB_411    2       /* MikroTik RouterBOARD 411 */
++#define MACH_AR71XX_RB_411    2       /* MikroTik RouterBOARD 411/411A/411AH */
 +#define MACH_AR71XX_RB_433    3       /* MikroTik RouterBOARD 433/433AH */
 +#define MACH_AR71XX_RB_450    4       /* MikroTik RouterBOARD 450 */
++#define MACH_AR71XX_RB_493    5       /* Mikrotik RouterBOARD 493/493AH */
 +
 +/*
   * Valid machtype for group NEC EMMA2RH
  config BASLER_EXCITE
        bool "Basler eXcite smart camera"
        select CEVT_R4K
+@@ -687,6 +705,7 @@
+ endchoice
++source "arch/mips/ar71xx/Kconfig"
+ source "arch/mips/au1000/Kconfig"
+ source "arch/mips/basler/excite/Kconfig"
+ source "arch/mips/jazz/Kconfig"
index 4ab8b75213dad7837e267967cdabaea4cb7639fe..e8af1eeb879a03d380e10f5dbc6e60cb44b79ada 100644 (file)
@@ -10,7 +10,7 @@
  libs-$(CONFIG_SIBYTE_CFE)     += arch/mips/sibyte/cfe/
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -873,6 +873,9 @@
+@@ -874,6 +874,9 @@
  config MIPS_DISABLE_OBSOLETE_IDE
        bool
  
index a1e82808c7689747636a78658da65e42626746f8..755b920e411cf6fcf1809a87b5bd17283befbb70 100644 (file)
  
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
-@@ -705,6 +705,7 @@
- endchoice
-+source "arch/mips/ar71xx/Kconfig"
- source "arch/mips/au1000/Kconfig"
- source "arch/mips/basler/excite/Kconfig"
- source "arch/mips/jazz/Kconfig"
-@@ -879,6 +880,9 @@
+@@ -880,6 +880,9 @@
  config SYNC_R4K
        bool