ar71xx: merge ap91_eth removal from r23439
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-rb750.c
index 06f48328e4e1235cfef5eef75ba5d423ca5608bb..41a184e358f9d8cf4a7b8ac77190af725b31e4f8 100644 (file)
@@ -8,11 +8,57 @@
  *  by the Free Software Foundation.
  */
 
+#include <linux/platform_device.h>
 #include <asm/mach-ar71xx/ar71xx.h>
 #include <asm/mach-ar71xx/mach-rb750.h>
 
+#include "devices.h"
 #include "machtype.h"
-#include "dev-ap91-eth.h"
+
+static struct rb750_led_data rb750_leds[] = {
+       {
+               .name           = "rb750:green:act",
+               .mask           = RB750_LED_ACT,
+               .active_low     = 1,
+       }, {
+               .name           = "rb750:green:port1",
+               .mask           = RB750_LED_PORT5,
+               .active_low     = 1,
+       }, {
+               .name           = "rb750:green:port2",
+               .mask           = RB750_LED_PORT4,
+               .active_low     = 1,
+       }, {
+               .name           = "rb750:green:port3",
+               .mask           = RB750_LED_PORT3,
+               .active_low     = 1,
+       }, {
+               .name           = "rb750:green:port4",
+               .mask           = RB750_LED_PORT2,
+               .active_low     = 1,
+       }, {
+               .name           = "rb750:green:port5",
+               .mask           = RB750_LED_PORT1,
+               .active_low     = 1,
+       }
+};
+
+static struct rb750_led_platform_data rb750_leds_data = {
+       .num_leds       = ARRAY_SIZE(rb750_leds),
+       .leds           = rb750_leds,
+};
+
+static struct platform_device rb750_leds_device = {
+       .name   = "leds-rb750",
+       .dev    = {
+               .platform_data = &rb750_leds_data,
+       }
+};
+
+static struct platform_device rb750_nand_device = {
+       .name   = "rb750-nand",
+       .id     = -1,
+};
 
 int rb750_latch_change(u32 mask_clr, u32 mask_set)
 {
@@ -65,7 +111,29 @@ EXPORT_SYMBOL_GPL(rb750_latch_change);
 
 static void __init rb750_setup(void)
 {
-       ap91_eth_init(NULL);
+       ar71xx_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+                                    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+                                    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+                                    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+                                    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+       /* WAN port */
+       ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth0_data.speed = SPEED_100;
+       ar71xx_eth0_data.duplex = DUPLEX_FULL;
+
+       /* LAN ports */
+       ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
+       ar71xx_eth1_data.speed = SPEED_1000;
+       ar71xx_eth1_data.duplex = DUPLEX_FULL;
+       ar71xx_eth1_data.has_ar7240_switch = 1;
+
+       ar71xx_add_device_mdio(0x0);
+       ar71xx_add_device_eth(1);
+       ar71xx_add_device_eth(0);
+
+       platform_device_register(&rb750_leds_device);
+       platform_device_register(&rb750_nand_device);
 }
 
 MIPS_MACHINE(AR71XX_MACH_RB_750, "750i", "MikroTik RouterBOARD 750",