@Jonathan
OK, great. Thanks for the confirmation.
Next step is to test the patch. The 2.6.37 kernel may be enough; some
commentary in the OpenWrt trunk suggest the 2.6.38 kernel may be
experimental and as such not used.
I will test your patch on the 1650 and 2611P which, looking at the if
statements in your code, should confirm two of your code paths.

@ jow
 I copied you into this as this patch successfully determines board type via
radio in a ath5k usage situation, the situation we have found it difficult
for iwinfo to produce some meaningful output, when used in conjunction with
ath5k rather than madwifi. The variables and structures used in this patch
are quite different from the ones used in iwinfo. Might this be a better
approach to determine the device/board in a th5k scenario? Also, the current
iwinfo only recognises Ubiquiti and some Fonera devices (from memeory) here
are some useful vendor and device ids for Engenius which would be great to
add. Your thoughts?

Cheers

Hanno Schupp


-----Original Message-----
From: Jonathan Bither [mailto:jonbit...@gmail.com] 
Sent: Monday, 6 February 2012 3:39 p.m.
To: Hanno Schupp; openwrt-devel@lists.openwrt.org
Subject: Re: [OpenWrt-Devel] [PATCH] Add EnGenius ar231x support

Hano,
        Thank you for reviewing the patch, especially since it was my first
submission. This patch was based off of the trunk branch. I have tested this
patch with both Madwifi as well as ath5k. Since this patch was my first
submission I only submitted the version for 2.6.37. I was hoping for
feedback or suggestions so that I could clean it up and submit a V2 with
2.6.38. I have tested this patch with the following boards: "ECB-3500,
EAP-3660, EOA-3630, EOC-2611P, EOC-1650, EOC-5611P". EnGenius had provided
me with one of each to test with. The radio information can be actually be
pulled from the boardconfig, so that the device can be checked in the kernel
regardless of radio driver. Unfortunately the "ECB-3500, EAP-3660, EOA-3630,
EOC-2611P" all share the same radio information while having different GPIO
outputs for their leds. As of yet I have not found a way to identify them
apart as to properly register the correct GPIOs to leds. If you are
interested I am happy to try to clean up the patch for a resubmission.


On 02/05/2012 12:26 AM, Hanno Schupp wrote:
> Hi Jonathan,
> 
> Thank you for this patch. I am currently using a simplified version of 
> what you are doing in an approach that relies on compiling a specific 
> version of the firmware for the different models 
> (https://dev.openwrt.org/attachment/ticket/6202/100-board-trunk-b18541
> .patch
> ) as it hard codes the different value. 
> 
> Your patch is of course much more elegant, but I wonder what OpenWrt 
> version and what wireless driver you are using, as in my experience 
> the radio information is only available when using the madwifi driver, not
with ath5k.
> 
> Q: Which wireless river are you using, ath5k or madwifi?
> Q: Are you compiling in trunk or with backfire?
> 
> Also, the Atheros platform seems to hold patches both for 2.6.37 and 
> 2.6.38 kernels. It is not clear to me when what kernel is used.
> Q: Your patch addresses 2.6.37 kernel only; is that sufficient?
> 
> Last but not least, my patch works with 1650 only. 2611p still does 
> not recover from soft reboot and hangs although AR2315_RESET_GPIO is 
> set to 0 just as much as for EOC-1650.
> Q: Which of the units ECB-3500, EAP-3660, EOA-3630, EOC-2611P, 
> EOC-1650, EOC-5611P have you actually tested?
> Q: In particular, can you confirm your patch works with EOC-2611P?
> 
> Thanks very much in advance for your input.
> 
> Hanno
> 
> -----Original Message-----
> From: openwrt-devel-boun...@lists.openwrt.org
> [mailto:openwrt-devel-boun...@lists.openwrt.org] On Behalf Of Jonathan 
> Bither
> Sent: Friday, 23 December 2011 9:32 a.m.
> To: openwrt-devel@lists.openwrt.org
> Subject: [OpenWrt-Devel] [PATCH] Add EnGenius ar231x support
> 
> Attached is a patch for trunk which fixes gpio assignments for 
> EnGenius devies on the ar231x platform. This patch fixes rebooting as 
> well the reset button for the following devices:
>       ECB-3500, EAP-3660, EOA-3630, EOC-2611P, EOC-1650, EOC-5611P
>       
> Signed-off-by: Jonathan Bither <jonbit...@gmail.com>
> 
> Index: target/linux/atheros/patches-2.6.37/400-engenius-support.patch
> ===================================================================
> --- target/linux/atheros/patches-2.6.37/400-engenius-support.patch
> (revision 0)
> +++ target/linux/atheros/patches-2.6.37/400-engenius-support.patch
> (revision 0)
> @@ -0,0 +1,159 @@
> +--- a/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
> ++++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
> +@@ -66,6 +66,15 @@
> +
> +     /* radio calibration data */
> +     const char *radio;
> ++
> ++    /* Reset GPIO */
> ++    u32 resetGpio;
> ++
> ++    /* Reset Button GPIO */
> ++    u32 resetButtonGpio;
> ++
> ++    /* EnGenius AP Workaround */
> ++    int EnGenius;
> + };
> +
> + /*
> +--- a/arch/mips/ar231x/ar2315.c
> ++++ b/arch/mips/ar231x/ar2315.c
> +@@ -554,8 +554,8 @@
> +     ar2315_led_data.num_leds = 0;
> +     for(i = 1; i < 8; i++)
> +     {
> +-            if((i == AR2315_RESET_GPIO) ||
> +-               (i == ar231x_board.config->resetConfigGpio))
> ++            if((i == ar231x_board.resetGpio) ||
> ++               (i == ar231x_board.resetButtonGpio))
> +                     continue;
> +
> +             if(i == ar231x_board.config->sysLedGpio) @@ -610,11 +610,11
> @@
> +     /* Cold reset does not work on the AR2315/6, use the GPIO reset 
> + bits
> a workaround.
> +      * give it some time to attempt a gpio based hardware reset
> +      * (atheros reference design workaround) */
> +-    gpio_direction_output(AR2315_RESET_GPIO, 0);
> ++    gpio_request(ar231x_board.resetGpio, "");
> ++    gpio_direction_output(ar231x_board.resetGpio, 0);
> +     mdelay(100);
> +
> +-    /* Some boards (e.g. Senao EOC-2610) don't implement the reset logic
> +-     * workaround. Attempt to jump to the mips reset location -
> ++    /* Attempt to jump to the mips reset location -
> +      * the boot loader itself might be able to recover the system */
> +     mips_reset_vec();
> + }
> +--- a/arch/mips/ar231x/reset.c
> ++++ b/arch/mips/ar231x/reset.c
> +@@ -13,12 +13,12 @@
> + #include <ar231x.h>
> + #include "devices.h"
> +
> +-#define AR531X_RESET_GPIO_IRQ
> (AR531X_GPIO_IRQ(ar231x_board.config->resetConfigGpio))
> ++#define AR531X_RESET_GPIO_IRQ
> (AR531X_GPIO_IRQ(ar231x_board.resetButtonGpio))
> +
> + struct event_t {
> +     struct work_struct wq;
> +     int set;
> +-    unsigned long jiffies;
> ++    unsigned long jiffies, jiffies_prev;
> + };
> +
> + static struct timer_list rst_button_timer; @@ -68,8 +68,14 @@
> +     add_msg(skb, "PATH=/sbin:/bin:/usr/sbin:/usr/bin");
> +     add_msg(skb, "SUBSYSTEM=button");
> +     add_msg(skb, "BUTTON=reset");
> +-    add_msg(skb, (event->set ? "ACTION=pressed" : "ACTION=released"));
> +-    sprintf(buf, "SEEN=%ld", (event->jiffies - seen)/HZ);
> ++
> ++    /* EnGenius input level is reversed */
> ++    if (ar231x_board.EnGenius)
> ++            add_msg(skb, (event->set ? "ACTION=released" :
> "ACTION=pressed"));
> ++    else
> ++            add_msg(skb, (event->set ? "ACTION=pressed" :
> "ACTION=released"));
> ++
> ++    sprintf(buf, "SEEN=%lu", (event->jiffies - 
> ++event->jiffies_prev)/HZ);
> +     add_msg(skb, buf);
> +     snprintf(buf, 128, "SEQNUM=%llu", uevent_next_seqnum());
> +     add_msg(skb, buf);
> +@@ -103,6 +109,7 @@
> +
> +     event->set = 0;
> +     event->jiffies = jiffies;
> ++    event->jiffies_prev = seen;
> +     INIT_WORK(&event->wq, hotplug_button);
> +     schedule_work(&event->wq);
> + }
> +@@ -144,7 +151,7 @@
> + {
> +     seen = jiffies;
> +
> +-    if (ar231x_board.config->resetConfigGpio == 0xffff)
> ++    if (ar231x_board.resetButtonGpio == 0xffff)
> +             return -ENODEV;
> +
> +     init_timer(&rst_button_timer);
> +--- a/arch/mips/ar231x/board.c
> ++++ b/arch/mips/ar231x/board.c
> +@@ -23,6 +23,7 @@
> + #include <asm/io.h>
> +
> + #include <ar231x_platform.h>
> ++#include <ar2315_regs.h>
> + #include "devices.h"
> + #include "ar5312.h"
> + #include "ar2315.h"
> +@@ -138,6 +139,8 @@
> +     u8 *board_data;
> +     u8 *radio_data;
> +     u8 *mac_addr;
> ++    u16 *radio_info;
> ++    u16 vendor, id, subvendor, subid;
> +     u32 offset;
> +
> +     ar231x_board.config = NULL;
> +@@ -190,11 +193,42 @@
> +
> +     radio_data = board_data + 0x100 + ((rcfg - bcfg) & 0xfff);
> +     ar231x_board.radio = radio_data;
> ++    ar231x_board.EnGenius = 0;
> ++    ar231x_board.resetGpio = AR2315_RESET_GPIO;
> ++    ar231x_board.resetButtonGpio = 
> ++ar231x_board.config->resetConfigGpio;
> +     offset = radio_data - board_data;
> +     printk(KERN_INFO "Radio config found at offset 0x%x(0x%x)\n", rcfg 
> + -
> bcfg, offset);
> +     rcfg_size = BOARD_CONFIG_BUFSZ - offset;
> +     memcpy(radio_data, rcfg, rcfg_size);
> +
> ++    /* If we have radio information try to identify the board */
> ++    radio_info = (u16 *) ar231x_board.radio;
> ++    if (radio_info) {
> ++            vendor = radio_info[1];
> ++            id = radio_info[0];
> ++            subid = radio_info[7];
> ++            subvendor = radio_info[8];
> ++
> ++            if ((vendor == 0x168c) && (id == 0x13) &&
> ++                (subid == 0xa051) && (subvendor == 0x168c)) {
> ++                    /* ECB-3500, EAP-3660, EOA-3630, EOC-2611P */
> ++                    ar231x_board.EnGenius = 1;
> ++                    ar231x_board.resetGpio = 0;
> ++                    ar231x_board.resetButtonGpio = 5;
> ++            } else if ((vendor == 0x168c) && (id == 0x13) &&
> ++                       (subid == 0xa052) && (subvendor == 0x168c)) {
> ++                            /* EOC-1650 */
> ++                            ar231x_board.EnGenius = 1;
> ++                            ar231x_board.resetGpio = 0;
> ++                            ar231x_board.resetButtonGpio = 5;
> ++            } else if ((vendor == 0x168c) && (id == 0xa017) &&
> ++                       (subid == 0xa048) && (subvendor == 0x168c)) {
> ++                            /* EOC-5611P */
> ++                            ar231x_board.EnGenius = 1;
> ++                            ar231x_board.resetButtonGpio = 6;
> ++            }
> ++    }
> ++
> +     mac_addr = &radio_data[0x1d * 2];
> +     if (is_broadcast_ether_addr(mac_addr)) {
> +             printk(KERN_INFO "Radio MAC is blank; using board-data\n");
> 

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to