X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Ffiles%2Farch%2Fmips%2Fath79%2Fmach-rb750.c;h=c308f9521de4646e167788a393022b21191b8487;hb=9fec39a03388677ce5c8e56de8f049391b8c4ed7;hp=3e4a5527f80eb5be99284c81fb437ebc17690075;hpb=e295a077cea86adad6d897b72b2b8b371a3d7fc4;p=openwrt%2Fopenwrt.git diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c index 3e4a5527f8..c308f9521d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -14,19 +14,20 @@ #include #include #include +#include +#include #include #include -#include #include #include #include "common.h" +#include "dev-ap9x-pci.h" #include "dev-usb.h" #include "dev-eth.h" #include "machtypes.h" -#include "pci-ath9k-fixup.h" -#include "pci.h" +#include "routerboot.h" static struct rb750_led_data rb750_leds[] = { { @@ -168,6 +169,9 @@ static void __init rb750_setup(void) rb750_nand_data.disable_pins = rb750_nand_disable_pins; rb750_nand_data.latch_change = rb750_latch_change; platform_device_register(&rb750_nand_device); + + /* USB */ + ath79_register_usb(); } MIPS_MACHINE(ATH79_MACH_RB_750, "750i", "MikroTik RouterBOARD 750", @@ -183,9 +187,9 @@ static struct ar8327_pad_cfg rb750gr3_ar8327_pad0_cfg = { static struct ar8327_platform_data rb750gr3_ar8327_data = { .pad0_cfg = &rb750gr3_ar8327_pad0_cfg, - .cpuport_cfg = { + .port0_cfg = { .force_link = 1, - .speed = AR8327_PORT_SPEED_100, + .speed = AR8327_PORT_SPEED_1000, .duplex = 1, .txpause = 1, .rxpause = 1, @@ -260,6 +264,7 @@ static void __init rb750gr3_setup(void) ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; ath79_eth0_data.phy_mask = BIT(0); + ath79_eth0_pll_data.pll_1000 = 0x62000000; ath79_register_eth(0); @@ -278,77 +283,56 @@ static void __init rb750gr3_setup(void) MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", rb750gr3_setup); -static struct ath9k_platform_data rb751_wmac_data = { - .led_pin = -1, -}; +#define RB751_HARDCONFIG 0x1f00b000 +#define RB751_HARDCONFIG_SIZE 0x1000 -static u8 rb751_wmac_mac[6]; - -static int rb751_pci_plat_dev_init(struct pci_dev *dev) +static void __init rb751_wlan_setup(void) { - switch (PCI_SLOT(dev->devfn)) { - case 0: - dev->dev.platform_data = &rb751_wmac_data; - break; + u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); + struct ath9k_platform_data *wmac_data; + u16 tag_len; + u8 *tag; + u16 mac_len; + u8 *mac; + int err; + + wmac_data = ap9x_pci_get_wmac_data(0); + if (!wmac_data) { + pr_err("rb75x: unable to get address of wlan data\n"); + return; } - return 0; -} + ap9x_pci_setup_wmac_led_pin(0, 9); -static int decode_rle(char *output, int len, char *in) -{ - char *ptr = output; - char *end = output + len; - while (*in) { - if (*in < 0) { - int i = -*in++; - while (i-- > 0) { - if (ptr >= end) - return -1; - *ptr++ = *in++; - } - } else if (*in > 0) { - int i = *in++; - while (i-- > 0) { - if (ptr >= end) - return -1; - *ptr++ = *in; - } - in++; - } + err = routerboot_find_tag(hardconfig, RB751_HARDCONFIG_SIZE, + RB_ID_WLAN_DATA, &tag, &tag_len); + if (err) { + pr_err("rb75x: no calibration data found\n"); + return; } - return ptr - output; -} -#define RB751_HARDCONFIG 0x1f00b000 -#define RB751_MAC_ADDRESS_OFFSET 0xE80 -#define RB751_CALDATA_OFFSET 0x27C - -static void __init rb751_wlan_and_usb_setup(void) -{ - u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); - - ath79_register_usb(); - - ath79_pci_set_plat_dev_init(rb751_pci_plat_dev_init); - ath79_register_pci(); - - rb751_wmac_data.macaddr = memcpy(rb751_wmac_mac, - hardconfig + RB751_MAC_ADDRESS_OFFSET, 6); + err = rle_decode(tag, tag_len, (unsigned char *) wmac_data->eeprom_data, + sizeof(wmac_data->eeprom_data), NULL, NULL); + if (err) { + pr_err("rb75x: unable to decode wlan eeprom data\n"); + return; + } - if (decode_rle((char *)rb751_wmac_data.eeprom_data, - sizeof(rb751_wmac_data.eeprom_data), - hardconfig + RB751_CALDATA_OFFSET) == - sizeof(rb751_wmac_data.eeprom_data)) { - pr_info("rb7xx: calibration data found\n"); - pci_enable_ath9k_fixup(0, rb751_wmac_data.eeprom_data); + err = routerboot_find_tag(hardconfig, RB751_HARDCONFIG_SIZE, + RB_ID_MAC_ADDRESS_PACK, &mac, &mac_len); + if (err) { + pr_err("rb75x: no mac address found\n"); + return; } + + ap91_pci_init(NULL, mac); } static void __init rb751_setup(void) { rb750_setup(); - rb751_wlan_and_usb_setup(); + ath79_register_usb(); + rb751_wlan_setup(); } MIPS_MACHINE(ATH79_MACH_RB_751, "751", "MikroTik RouterBOARD 751", @@ -357,7 +341,8 @@ MIPS_MACHINE(ATH79_MACH_RB_751, "751", "MikroTik RouterBOARD 751", static void __init rb751g_setup(void) { rb750gr3_setup(); - rb751_wlan_and_usb_setup(); + ath79_register_usb(); + rb751_wlan_setup(); } MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G",