X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=target%2Flinux%2Far71xx%2Ffiles%2Farch%2Fmips%2Fath79%2Fmach-rb750.c;h=5656d3c1f17dad24d5033b6a926d03f27479fda9;hb=c48e95915fbd7623a6119b9f3f02d81fe772dde2;hp=7a24b57fb5023bcc95a90043423a44f3eb31641c;hpb=a17e6cf40e384cbc78d6c02163548ef8443bf624;p=openwrt.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 7a24b57fb5..5656d3c1f1 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -14,10 +14,11 @@ #include #include #include +#include +#include #include #include -#include #include #include @@ -26,6 +27,7 @@ #include "dev-usb.h" #include "dev-eth.h" #include "machtypes.h" +#include "routerboot.h" static struct rb750_led_data rb750_leds[] = { { @@ -182,9 +184,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, @@ -259,6 +261,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); @@ -277,45 +280,18 @@ static void __init rb750gr3_setup(void) MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", rb750gr3_setup); -static int decode_rle(char *output, int len, char *in) -{ - char *ptr = output; - char *end = output + len; - - if (!output || !in) - return -EINVAL; - - while (*in) { - if (*in < 0) { - int i = -*in++; - while (i-- > 0) { - if (ptr >= end) - return -EINVAL; - *ptr++ = *in++; - } - } else if (*in > 0) { - int i = *in++; - while (i-- > 0) { - if (ptr >= end) - return -EINVAL; - *ptr++ = *in; - } - in++; - } - } - - return ptr - output; -} - -#define RB751_HARDCONFIG 0x1f00b000 -#define RB751_MAC_ADDRESS_OFFSET 0xE80 -#define RB751_CALDATA_OFFSET 0x27C +#define RB751_HARDCONFIG 0x1f00b000 +#define RB751_HARDCONFIG_SIZE 0x1000 static void __init rb751_wlan_setup(void) { u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); struct ath9k_platform_data *wmac_data; - int dec_size; + u16 tag_len; + u8 *tag; + u16 mac_len; + u8 *mac; + int err; wmac_data = ap9x_pci_get_wmac_data(0); if (!wmac_data) { @@ -323,15 +299,30 @@ static void __init rb751_wlan_setup(void) return; } - dec_size = decode_rle((char *) wmac_data->eeprom_data, - sizeof(wmac_data->eeprom_data), - hardconfig + RB751_CALDATA_OFFSET); - if (dec_size != sizeof(wmac_data->eeprom_data)) { + ap9x_pci_setup_wmac_led_pin(0, 9); + + 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; + } + + 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; } - ap91_pci_init(NULL, hardconfig + RB751_MAC_ADDRESS_OFFSET); + 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)