Re: [OpenWrt-Devel] [PATCH v2 1/3] ar71xx: add kernel support for the EnGenius ESR900
efhq 发自我的手机18610461647 在 2014年6月24日,下午9:01,John Crispin j...@phrozen.org 写道: Hi, On 22/06/2014 22:20, Forest Crossman wrote: diff --git a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c index 43911b8..41c3542 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c @@ -16,6 +16,21 @@ #include nvram.h +char *ath79_nvram_sanitize_mac(char *input) +{ +int i,j; +char *output=input; +for (i = 0, j = 0; istrlen(input); i++,j++) +{ + if (input[i]!='\') +output[j]=input[i]; +else + j--; +} + output[j]=0; +return output; +} + char *ath79_nvram_find_var(const char *name, const char *buf, unsigned buf_len) { unsigned len = strlen(name); this loop is a bit weird. ca you tell us in what way the mac is broken on your board ? John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v2 1/3] ar71xx: add kernel support for the EnGenius ESR900
Hi, On 22/06/2014 22:20, Forest Crossman wrote: diff --git a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c index 43911b8..41c3542 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c @@ -16,6 +16,21 @@ #include nvram.h +char *ath79_nvram_sanitize_mac(char *input) +{ + int i,j; + char *output=input; + for (i = 0, j = 0; istrlen(input); i++,j++) + { + if (input[i]!='\') + output[j]=input[i]; + else + j--; + } + output[j]=0; + return output; +} + char *ath79_nvram_find_var(const char *name, const char *buf, unsigned buf_len) { unsigned len = strlen(name); this loop is a bit weird. ca you tell us in what way the mac is broken on your board ? John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH v2 1/3] ar71xx: add kernel support for the EnGenius ESR900
The MAC as it's stored the u-boot environment looks like 'ethaddr=XX:XX:XX:XX:XX:XX', so to get the other functions to parse the MAC correctly, I had to get rid of the quotes before and after the MAC. There might be a better way to do it, but this method didn't seem too horrible. All this function does is loop through each char in the string to check if it's a quotation mark. If it is, it skips over it and puts the next char in the place the quote would go, effectively doing a `tr -d '\'` on the MAC string. It then fills the rest of the output array with null bytes before returning it. If the MAC string doesn't have any quotes in it, it just returns the input string. I suppose I could have just checked to make sure the first and last chars were quotes and then returned the MAC string sans those chars, but that didn't occur to me at the time I was writing that function. -- Forest Crossman On Tue, Jun 24, 2014 at 9:01 AM, John Crispin j...@phrozen.org wrote: Hi, On 22/06/2014 22:20, Forest Crossman wrote: diff --git a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c index 43911b8..41c3542 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/nvram.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/nvram.c @@ -16,6 +16,21 @@ #include nvram.h +char *ath79_nvram_sanitize_mac(char *input) +{ + int i,j; + char *output=input; + for (i = 0, j = 0; istrlen(input); i++,j++) + { + if (input[i]!='\') + output[j]=input[i]; + else + j--; + } + output[j]=0; + return output; +} + char *ath79_nvram_find_var(const char *name, const char *buf, unsigned buf_len) { unsigned len = strlen(name); this loop is a bit weird. ca you tell us in what way the mac is broken on your board ? John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH v2 1/3] ar71xx: add kernel support for the EnGenius ESR900
Signed-off-by: Forest Crossman cyro...@gmail.com --- target/linux/ar71xx/config-3.10| 1 + .../ar71xx/files/arch/mips/ath79/mach-esr900.c | 222 + target/linux/ar71xx/files/arch/mips/ath79/nvram.c | 16 ++ .../610-MIPS-ath79-openwrt-machines.patch | 18 +- 4 files changed, 254 insertions(+), 3 deletions(-) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10 index c294cd8..78d5359 100644 --- a/target/linux/ar71xx/config-3.10 +++ b/target/linux/ar71xx/config-3.10 @@ -47,6 +47,7 @@ CONFIG_ATH79_MACH_DIR_825_B1=y CONFIG_ATH79_MACH_DIR_825_C1=y CONFIG_ATH79_MACH_DRAGINO2=y CONFIG_ATH79_MACH_EAP7660D=y +CONFIG_ATH79_MACH_ESR900=y CONFIG_ATH79_MACH_EW_DORIN=y CONFIG_ATH79_MACH_GS_OOLITE=y CONFIG_ATH79_MACH_HORNET_UB=y diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c new file mode 100644 index 000..0ef3dd1 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-esr900.c @@ -0,0 +1,222 @@ +/* + * EnGenius ESR900 board support + * + * Copyright (C) 2008-2012 Gabor Juhos juh...@openwrt.org + * Copyright (C) 2008 Imre Kaloz ka...@openwrt.org + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include linux/platform_device.h +#include linux/ar8216_platform.h + +#include asm/mach-ath79/ar71xx_regs.h + +#include common.h +#include pci.h +#include dev-ap9x-pci.h +#include dev-gpio-buttons.h +#include dev-eth.h +#include dev-leds-gpio.h +#include dev-m25p80.h +#include dev-usb.h +#include dev-wmac.h +#include machtypes.h +#include nvram.h + +#define ESR900_GPIO_LED_POWER 2 +#define ESR900_GPIO_LED_WLAN_2G 13 +#define ESR900_GPIO_LED_WPS_BLUE19 +#define ESR900_GPIO_LED_WPS_AMBER 22 +#define ESR900_GPIO_LED_WLAN_5G 23 + +#define ESR900_GPIO_BTN_WPS 16 +#define ESR900_GPIO_BTN_RESET 17 + +#define ESR900_KEYS_POLL_INTERVAL 20 /* msecs */ +#define ESR900_KEYS_DEBOUNCE_INTERVAL (3 * ESR900_KEYS_POLL_INTERVAL) + +#define ESR900_CALDATA_ADDR 0x1fff +#define ESR900_WMAC_CALDATA_OFFSET 0x1000 +#define ESR900_PCIE_CALDATA_OFFSET 0x5000 + +#define ESR900_CONFIG_ADDR 0x1f03 +#define ESR900_CONFIG_SIZE 0x1 + +#define ESR900_LAN_PHYMASK BIT(0) +#define ESR900_WAN_PHYMASK BIT(5) +#define ESR900_MDIO_MASK(~(ESR900_LAN_PHYMASK | ESR900_WAN_PHYMASK)) + +static struct gpio_led esr900_leds_gpio[] __initdata = { + { + .name = engenius:amber:power, + .gpio = ESR900_GPIO_LED_POWER, + .active_low = 1, + }, + { + .name = engenius:blue:wlan-2g, + .gpio = ESR900_GPIO_LED_WLAN_2G, + .active_low = 1, + }, + { + .name = engenius:blue:wps, + .gpio = ESR900_GPIO_LED_WPS_BLUE, + .active_low = 1, + }, + { + .name = engenius:amber:wps, + .gpio = ESR900_GPIO_LED_WPS_AMBER, + .active_low = 1, + }, + { + .name = engenius:blue:wlan-5g, + .gpio = ESR900_GPIO_LED_WLAN_5G, + .active_low = 1, + } +}; + +static struct gpio_keys_button esr900_gpio_keys[] __initdata = { + { + .desc = WPS button, + .type = EV_KEY, + .code = KEY_WPS_BUTTON, + .debounce_interval = ESR900_KEYS_DEBOUNCE_INTERVAL, + .gpio = ESR900_GPIO_BTN_WPS, + .active_low = 1, + }, + { + .desc = Reset button, + .type = EV_KEY, + .code = KEY_RESTART, + .debounce_interval = ESR900_KEYS_DEBOUNCE_INTERVAL, + .gpio = ESR900_GPIO_BTN_RESET, + .active_low = 1, + }, +}; + +static struct ar8327_pad_cfg esr900_ar8327_pad0_cfg; +static struct ar8327_pad_cfg esr900_ar8327_pad6_cfg; + +static struct ar8327_platform_data esr900_ar8327_data = { + .pad0_cfg = esr900_ar8327_pad0_cfg, + .pad6_cfg = esr900_ar8327_pad6_cfg, + .port0_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, + .txpause = 1, + .rxpause = 1, + }, + .port6_cfg = { + .force_link = 1, + .speed = AR8327_PORT_SPEED_1000, + .duplex = 1, +