From: Gabor Juhos Date: Mon, 16 Dec 2013 10:11:02 +0000 (+0000) Subject: ar71xx: rb95x: use the rb_get_wlan_data helper X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=627651dfcaea574cfb59fa9a3865a7bc34fb0dab;p=openwrt%2Fstaging%2Fmans0n.git ar71xx: rb95x: use the rb_get_wlan_data helper Also remove unused RB_* defines. Signed-off-by: Gabor Juhos SVN-Revision: 39092 --- diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c index 1e5c477e3b..8213c47c10 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb95x.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -40,17 +39,6 @@ #define RB95X_GPIO_NAND_NCE 14 -#define RB_ROUTERBOOT_OFFSET 0x0000 -#define RB_ROUTERBOOT_SIZE 0xb000 -#define RB_HARD_CFG_OFFSET 0xc000 -#define RB_HARD_CFG_SIZE 0x1000 -#define RB_BIOS_OFFSET 0xd000 -#define RB_BIOS_SIZE 0x2000 -#define RB_SOFT_CFG_OFFSET 0xe000 -#define RB_SOFT_CFG_SIZE 0x1000 - -#define RB_ART_SIZE 0x10000 - static struct mtd_partition rb95x_nand_partitions[] = { { .name = "booter", @@ -99,37 +87,16 @@ static struct mdio_board_info rb95x_mdio0_info[] = { void __init rb95x_wlan_init(void) { - u8 *hard_cfg = (u8 *) KSEG1ADDR(0x1f000000 + RB_HARD_CFG_OFFSET); - u16 tag_len; - u8 *tag; char *art_buf; u8 wlan_mac[ETH_ALEN]; - int err; - err = routerboot_find_tag(hard_cfg, RB_HARD_CFG_SIZE, RB_ID_WLAN_DATA, - &tag, &tag_len); - if (err) { - pr_err("no calibration data found\n"); + art_buf = rb_get_wlan_data(); + if (art_buf == NULL) return; - } - - art_buf = kmalloc(RB_ART_SIZE, GFP_KERNEL); - if (art_buf == NULL) { - pr_err("no memory for calibration data\n"); - return; - } - - err = rle_decode((char *) tag, tag_len, art_buf, RB_ART_SIZE, - NULL, NULL); - if (err) { - pr_err("unable to decode calibration data\n"); - goto free; - } ath79_init_mac(wlan_mac, ath79_mac_base, 11); ath79_register_wmac(art_buf + 0x1000, wlan_mac); -free: kfree(art_buf); } @@ -180,8 +147,14 @@ void __init rb95x_nand_init(void) ath79_register_nfc(); } -static void __init rb95x_setup(void) +static int __init rb95x_setup(void) { + const struct rb_info *info; + + info = rb_init_info((void *)(KSEG1ADDR(0x1f00000)), 0x10000); + if (!info) + return -EINVAL; + rb95x_nand_init(); ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 | @@ -197,11 +170,15 @@ static void __init rb95x_setup(void) ath79_eth0_data.phy_mask = BIT(0); ath79_register_eth(0); + + return 0; } static void __init rb951g_setup(void) { - rb95x_setup(); + if (rb95x_setup()) + return; + rb95x_wlan_init(); ath79_register_usb(); }