ar71xx: wpj588: add missing usb support
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-wpj558.c
index a8310a7..c7b120d 100644 (file)
@@ -2,7 +2,7 @@
  * Compex WPJ558 board support
  *
  * Copyright (c) 2012 Qualcomm Atheros
  * Compex WPJ558 board support
  *
  * Copyright (c) 2012 Qualcomm Atheros
- * Copyright (c) 2012 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (c) 2012-2013 Gabor Juhos <juhosg@openwrt.org>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
 #include <asm/mach-ath79/ar71xx_regs.h>
 
 #include "common.h"
 #include <asm/mach-ath79/ar71xx_regs.h>
 
 #include "common.h"
+#include "pci.h"
 #include "dev-ap9x-pci.h"
 #include "dev-ap9x-pci.h"
-#include "dev-eth.h"
 #include "dev-gpio-buttons.h"
 #include "dev-gpio-buttons.h"
+#include "dev-eth.h"
+#include "dev-usb.h"
 #include "dev-leds-gpio.h"
 #include "dev-m25p80.h"
 #include "dev-spi.h"
 #include "dev-leds-gpio.h"
 #include "dev-m25p80.h"
 #include "dev-spi.h"
-#include "dev-usb.h"
 #include "dev-wmac.h"
 #include "machtypes.h"
 #include "dev-wmac.h"
 #include "machtypes.h"
-#include "pci.h"
 
 
-#define WPJ558_GPIO_LED_SIG1    14
-#define WPJ558_GPIO_LED_SIG2    15
-#define WPJ558_GPIO_LED_SIG3    22
-#define WPJ558_GPIO_LED_SIG4    23
-#define WPJ558_GPIO_BUZZER      4
+#define WPJ558_GPIO_LED_SIG1   14
+#define WPJ558_GPIO_LED_SIG2   15
+#define WPJ558_GPIO_LED_SIG3   22
+#define WPJ558_GPIO_LED_SIG4   23
+#define WPJ558_GPIO_BUZZER             4
 
 
-#define WPJ558_GPIO_BTN_RESET   17
+#define WPJ558_GPIO_BTN_RESET  17
 
 #define WPJ558_KEYS_POLL_INTERVAL      20      /* msecs */
 #define WPJ558_KEYS_DEBOUNCE_INTERVAL  (3 * WPJ558_KEYS_POLL_INTERVAL)
 
 
 #define WPJ558_KEYS_POLL_INTERVAL      20      /* msecs */
 #define WPJ558_KEYS_DEBOUNCE_INTERVAL  (3 * WPJ558_KEYS_POLL_INTERVAL)
 
-#define WPJ558_MAC0_OFFSET             0x10
-#define WPJ558_MAC1_OFFSET             0x18
+#define WPJ558_MAC_OFFSET                      0x1002
 #define WPJ558_WMAC_CALDATA_OFFSET     0x1000
 #define WPJ558_WMAC_CALDATA_OFFSET     0x1000
-#define WPJ558_PCIE_CALDATA_OFFSET     0x5000
-
-#define WPJ558_ART_SIZE                0x8000
-#if 0
-static char *art_buf;
-#endif
 
 static struct gpio_led wpj558_leds_gpio[] __initdata = {
        {
 
 static struct gpio_led wpj558_leds_gpio[] __initdata = {
        {
@@ -141,26 +134,28 @@ static struct mdio_board_info wpj558_mdio0_info[] = {
 
 static void __init wpj558_setup(void)
 {
 
 static void __init wpj558_setup(void)
 {
-       u8 *mac = (u8 *) KSEG1ADDR(0x1f02e000);
        u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
        u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
-       u8 tmpmac[ETH_ALEN];
 
        ath79_register_m25p80(NULL);
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj558_leds_gpio),
 
        ath79_register_m25p80(NULL);
        ath79_register_leds_gpio(-1, ARRAY_SIZE(wpj558_leds_gpio),
-                                wpj558_leds_gpio);
+                                       wpj558_leds_gpio);
        ath79_register_gpio_keys_polled(-1, WPJ558_KEYS_POLL_INTERVAL,
                                        ARRAY_SIZE(wpj558_gpio_keys),
                                        wpj558_gpio_keys);
 
        ath79_register_gpio_keys_polled(-1, WPJ558_KEYS_POLL_INTERVAL,
                                        ARRAY_SIZE(wpj558_gpio_keys),
                                        wpj558_gpio_keys);
 
-       ath79_init_mac(tmpmac, mac, -1);
-       ath79_register_wmac(art + WPJ558_WMAC_CALDATA_OFFSET, tmpmac);
+       ath79_register_usb();
+
+       ath79_register_wmac(art + WPJ558_WMAC_CALDATA_OFFSET, NULL);
 
        ath79_register_pci();
 
        mdiobus_register_board_info(wpj558_mdio0_info,
 
        ath79_register_pci();
 
        mdiobus_register_board_info(wpj558_mdio0_info,
-                                   ARRAY_SIZE(wpj558_mdio0_info));
+                                       ARRAY_SIZE(wpj558_mdio0_info));
        ath79_register_mdio(0, 0x0);
        ath79_register_mdio(0, 0x0);
-       
+
+       ath79_init_mac(ath79_eth0_data.mac_addr, art + WPJ558_MAC_OFFSET, 0);
+       ath79_init_mac(ath79_eth1_data.mac_addr, art + WPJ558_MAC_OFFSET, 0);
+
        ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
 
        /* GMAC0 is connected to an AR8327 switch */
        ath79_setup_qca955x_eth_cfg(QCA955X_ETH_CFG_RGMII_EN);
 
        /* GMAC0 is connected to an AR8327 switch */
@@ -169,19 +164,14 @@ static void __init wpj558_setup(void)
        ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
        ath79_eth0_pll_data.pll_1000 = 0x56000000;
 
        ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
        ath79_eth0_pll_data.pll_1000 = 0x56000000;
 
-       ath79_init_mac(ath79_eth0_data.mac_addr, mac + WPJ558_MAC0_OFFSET, 0);
-       ath79_register_eth(0);
-
        /* GMAC1 is connected to the SGMII interface */
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
        ath79_eth1_data.speed = SPEED_1000;
        ath79_eth1_data.duplex = DUPLEX_FULL;
        ath79_eth1_pll_data.pll_1000 = 0x03000101;
 
        /* GMAC1 is connected to the SGMII interface */
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
        ath79_eth1_data.speed = SPEED_1000;
        ath79_eth1_data.duplex = DUPLEX_FULL;
        ath79_eth1_pll_data.pll_1000 = 0x03000101;
 
-       ath79_init_mac(ath79_eth1_data.mac_addr, mac + WPJ558_MAC1_OFFSET, 0);
+       ath79_register_eth(0);
        ath79_register_eth(1);
        ath79_register_eth(1);
-
-       ath79_register_usb();
 }
 
 MIPS_MACHINE(ATH79_MACH_WPJ558, "WPJ558", "Compex WPJ558", wpj558_setup);
 }
 
 MIPS_MACHINE(ATH79_MACH_WPJ558, "WPJ558", "Compex WPJ558", wpj558_setup);