Michel Stempin schrieb:
>
> Le 30/04/2014 23:48, Hartmut Knaack a écrit :
>> maniac...@gmail.com schrieb:
>>> Hello,
>>>
>>> I didn't get ANY response on my previous version... here it is again.
>>> Please apply this patch to add support for the GL-iNet devices.
>>>
>>> I've updated a patch, available at
>>> https://github.com/alzhao/Openwrt-patches-for-GL.iNet/blob/master/001-gl-38300.patch
>>>  
>>>
>>> The patch (also at https://dev.openwrt.org/ticket/15632 ) includes
>>> support for the GL-Inet V1 devices. Which are mostly compatible with the
>>> TP-Link WR-703N boards.
>>>
>>> The devices have 64M ram, 16M flash and 2 ethernet interfaces.
>>>
>>> The original patch was written by alzhao <alz...@gmail.com> although as
>>> far as I can see he never bothered to get this patch included in the
>>> mainline.
>>>
>>> I currently have 20+ of these routers, so I would appreciate it if this
>>> patch was included into the mainline, as that would make life easier
>>> here.
>>>
>>> The patch adds the following files:
>>> target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c
>>> target/linux/ar71xx/generic/profiles/gl-connect.mk
>>> target/linux/ar71xx/patches-3.10/911-MIPS-ath79-gl-machine.patch
>>>
>>> And adds a few lines to the following:
>>> tools/firmware-utils/src/mktplinkfw.c
>>> target/linux/ar71xx/config-3.10
>>> target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>>> target/linux/ar71xx/base-files/lib/ar71xx.sh
>>> target/linux/ar71xx/base-files/etc/uci-defaults/02_network
>>>
>> On second thought, why don't you completely rewrite the patches? The biggest 
>> bunch seems to be the mach-gl-inet.c, which I think may be the wrong 
>> attempt. Since it is almost the same as the mach-tl-wr703n.c (only different 
>> LED-definition), just add the pieces for your board.
> See my attempt in a separate submission. For one reason, my MTA did not catch 
> the parent message ID.
>
> You can't easily, because there are 2 LEDs vs. a single one (and not with the 
> same prefix), and no GPIO to control the USB power, so this would add many 
> specific structures and tests or init functions to the mach-tl-wr703n.c file.
>
> It has not been done for the existing TL-MR3020 or GS-Oolite routers for 
> example, which are nevertheless TL-WR703N sister boards, probably not to 
> bloat the installed kernel with unrelated dead code/data.
>
> Otherwise, be prepared for consistency's sake to merge at least all related 
> mach-tl-mr*.c, mach-tl-wa*.c, mach-tl-wr*.c, etc.
>
> Time for a cleanup? I spotted some unordered boards into the target Bash 
> scripts too.
Good points, and the further I peek into it, the more mess I discover. But I 
don't have the time atm to do some cleanup.
>>> I myself do not claim any copyright on this, as I only rebased the
>>> patch. The original copyright statement included is/was:
>>>
>>> /*
>>> *  GL-CONNECT iNet board support
>>> *
>>> *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
>>> *  Copyright (C) 2011-2012 Gabor Juhos <juh...@openwrt.org>
>>> *  Copyright (C) 2013 alzhao <alz...@gmail.com>
>>> *
>>> *  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.
>>> */
>>>
>>> Signed-off-by: Mark Janssen <m...@sig-io.nl>
>>> Signed-off-by: alzhao <alz...@gmail.com>
>>>
>>>
>>> -------------------------- patch ------------------------------
>>>
>>> diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
>>> b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
>>> index 62373e4..ff6d4d7 100755
>>> --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
>>> +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
>>> @@ -268,6 +268,10 @@ dir-505-a1)
>>>     ucidef_set_interface_lan "eth1"
>>>     ;;
>>>  
>>> +gl-inet)
>>> +   ucidef_set_interfaces_lan_wan "eth1" "eth0"
>>> +   ;;
>>> +
>> Wrong attempt. The section below does the same, so just merge your board 
>> name in, at the right alphabetic position.
>>>  alfa-ap96 |\
>>>  alfa-nx |\
>>>  ap83 |\
>>> diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
>>> b/target/linux/ar71xx/base-files/lib/ar71xx.sh
>>> index 02c46f9..9099f45 100755
>>> --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
>>> +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
>>> @@ -214,6 +214,9 @@ ar71xx_board_detect() {
>>>     *"Oolite V1.0")
>>>             name="oolite"
>>>             ;;
>>> +   *"GL-CONNECT INET v1")
>>> +           name="gl-inet"
>>> +           ;;
>>>     *"AirRouter")
>>>             name="airrouter"
>>>             ;;
>>> diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
>>> b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>>> index 37ceea6..4760cd8 100755
>>> --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>>> +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
>>> @@ -242,6 +242,7 @@ platform_check_image() {
>>>     tl-wdr4300 | \
>>>     tl-wdr4900-v2 | \
>>>     tl-wr703n | \
>>> +   gl-inet | \
>>>     tl-wr710n | \
>>>     tl-wr720n-v3 | \
>>>     tl-wr741nd | \
>>> diff --git a/target/linux/ar71xx/config-3.10 
>>> b/target/linux/ar71xx/config-3.10
>>> index 4eb4b9f..f448f9d 100644
>>> --- a/target/linux/ar71xx/config-3.10
>>> +++ b/target/linux/ar71xx/config-3.10
>>> @@ -88,6 +88,7 @@ CONFIG_ATH79_MACH_TL_WR1043ND=y
>>>  CONFIG_ATH79_MACH_TL_WR1043ND_V2=y
>>>  CONFIG_ATH79_MACH_TL_WR2543N=y
>>>  CONFIG_ATH79_MACH_TL_WR703N=y
>>> +CONFIG_ATH79_MACH_GL_INET=y
>>>  CONFIG_ATH79_MACH_TL_WR720N_V3=y
>>>  CONFIG_ATH79_MACH_TL_WR741ND=y
>>>  CONFIG_ATH79_MACH_TL_WR741ND_V4=y
>>> diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c 
>>> b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c
>>> new file mode 100644
>>> index 0000000..0908918
>>> --- /dev/null
>>> +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-gl-inet.c
>>> @@ -0,0 +1,106 @@
>>> +/*
>>> + *  GL-CONNECT iNet board support
>>> + *
>>> + *  Copyright (C) 2011 dongyuqi <729650...@qq.com>
>>> + *  Copyright (C) 2011-2012 Gabor Juhos <juh...@openwrt.org>
>>> + *  Copyright (C) 2013 alzhao <alz...@gmail.com>
>>> + *
>>> + *  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/gpio.h>
>>> +
>>> +#include <asm/mach-ath79/ath79.h>
>>> +
>>> +#include "dev-eth.h"
>>> +#include "dev-gpio-buttons.h"
>>> +#include "dev-leds-gpio.h"
>>> +#include "dev-m25p80.h"
>>> +#include "dev-usb.h"
>>> +#include "dev-wmac.h"
>>> +#include "machtypes.h"
>>> +
>>> +#define GL_INET_GPIO_LED_WLAN      0
>>> +#define GL_INET_GPIO_LED_LAN       13
>>> +#define GL_INET_GPIO_BTN_RESET     11
>>> +
>>> +#define GL_INET_KEYS_POLL_INTERVAL 20      /* msecs */
>>> +#define GL_INET_KEYS_DEBOUNCE_INTERVAL     (3 * GL_INET_KEYS_POLL_INTERVAL)
>>> +
>>> +static const char *gl_inet_part_probes[] = {
>>> +           "tp-link", //dont change, this will use tplink parser
>>> +           NULL ,
>>> +};
>>> +
>>> +static struct flash_platform_data gl_inet_flash_data = {
>>> +           .part_probes = gl_inet_part_probes,
>>> +};
>>> +
>>> +static struct gpio_led gl_inet_leds_gpio[] __initdata = {
>>> +           {
>>> +                           .name = "gl-connect:red:wireless",
>>> +                           .gpio = GL_INET_GPIO_LED_WLAN,
>>> +                           .active_low = 0,
>>> +           },
>>> +           {
>>> +                           .name = "gl-connect:green:lan",
>>> +                           .gpio = GL_INET_GPIO_LED_LAN,
>>> +                           .active_low = 0,
>>> +                           .default_state = 1,
>>> +           },
>>> +};
>>> +
>>> +static struct gpio_keys_button gl_inet_gpio_keys[] __initdata = {
>>> +           {
>>> +                           .desc = "reset",
>>> +                           .type = EV_KEY,
>>> +                           .code = KEY_RESTART,
>>> +                           .debounce_interval = 
>>> GL_INET_KEYS_DEBOUNCE_INTERVAL,
>>> +                           .gpio = GL_INET_GPIO_BTN_RESET,
>>> +                           .active_low = 0,
>>> +           }
>>> +};
>>> +
>>> +static void __init gl_inet_setup(void) {
>>> +
>>> +   /* get the mac address which is stored in the 1st 64k uboot MTD */
>>> +   u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
>>> +   /* get the art address, which is the last 64k. by usng 0x1fff1000, it 
>>> doesn't matter it is 4M, 8M or 16M flash */
>>> +   u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
>>> +
>>> +   //Todo: what is this
>>> +   /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
>>> +   ath79_setup_ar933x_phy4_switch(false, false);
>>> +
>>> +   /* register flash. MTD will use tp-link parser to parser MTD*/
>>> +   ath79_register_m25p80(&gl_inet_flash_data);
>>> +
>>> +   /* register gpio LED and Key */
>>> +   ath79_register_leds_gpio(-1, ARRAY_SIZE(gl_inet_leds_gpio), 
>>> gl_inet_leds_gpio);
>>> +
>>> +   ath79_register_gpio_keys_polled(-1, GL_INET_KEYS_POLL_INTERVAL, 
>>> ARRAY_SIZE(gl_inet_gpio_keys),
>>> +                   gl_inet_gpio_keys);
>>> +
>>> +   /* enable usb */
>>> +   ath79_register_usb();
>>> +
>>> +   /* register eth0 as WAN, eth1 as LAN */
>>> +   ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
>>> +
>>> +   ath79_register_mdio(0, 0x0);
>>> +   ath79_register_eth(0);
>>> +   ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
>>> +   ath79_register_eth(1);
>>> +
>>> +   /* register wireless mac with cal data*/
>>> +   ath79_register_wmac(ee, mac);
>>> +
>>> +}
>>> +/* Important:
>>> + * $1: machtype, is used to identify profiles
>>> + * $2: machine id
>>> + * The init scripts will use the "Name" to detect which board, be sure to 
>>> modify the scripts
>>> + */
>>> +MIPS_MACHINE(ATH79_MACH_GL_INET, "GL-INET", "GL-CONNECT INET v1", 
>>> gl_inet_setup);
>>> diff --git a/target/linux/ar71xx/generic/profiles/gl-connect.mk 
>>> b/target/linux/ar71xx/generic/profiles/gl-connect.mk
>>> new file mode 100644
>>> index 0000000..0a09ff2
>>> --- /dev/null
>>> +++ b/target/linux/ar71xx/generic/profiles/gl-connect.mk
>>> @@ -0,0 +1,16 @@
>>> +#
>>> +# Copyright (C) 2009 OpenWrt.org
>>> +#
>>> +# This is free software, licensed under the GNU General Public License v2.
>>> +# See /LICENSE for more information.
>>> +#
>>> +
>>> +define Profile/GLINET
>>> +   NAME:=GL INET
>>> +   PACKAGES:=kmod-usb-core kmod-usb2
>>> +endef
>>> +
>>> +define Profile/GLINET/Description
>>> +   Package set optimized for the GL INET LITE 001.
>>> +endef
>>> +$(eval $(call Profile,GLINET))
>>> diff --git a/target/linux/ar71xx/image/Makefile 
>>> b/target/linux/ar71xx/image/Makefile
>>> index 8234f88..9aa47ce 100644
>>> --- a/target/linux/ar71xx/image/Makefile
>>> +++ b/target/linux/ar71xx/image/Makefile
>>> @@ -1122,6 +1122,7 @@ $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLMR3040V2,tl-mr3040-v2,TL-MR3040
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLMR3220V2,tl-mr3220-v2,TL-MR3220-v2,ttyATH0,115200,0x32200002,1,4Mlzma))
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLMR3420V2,tl-mr3420-v2,TL-MR3420-v2,ttyS0,115200,0x34200002,1,4Mlzma))
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLWR703,tl-wr703n-v1,TL-WR703N,ttyATH0,115200,0x07030101,1,4Mlzma))
>>> +$(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,GLINET,gl-inet-v1,GL-INET,ttyATH0,115200,0x08000001,1,8Mlzma))
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLWR710,tl-wr710n-v1,TL-WR710N,ttyATH0,115200,0x07100001,1,8Mlzma))
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLWR720NV3,tl-wr720n-v3,TL-WR720N-v3,ttyATH0,115200,0x07200103,1,4Mlzma))
>>>  $(eval $(call 
>>> SingleProfile,TPLINK-LZMA,64kraw,TLWR740NV4,tl-wr740n-v4,TL-WR741ND-v4,ttyATH0,115200,0x07400004,1,4Mlzma))
>>> diff --git 
>>> a/target/linux/ar71xx/patches-3.10/911-MIPS-ath79-gl-machine.patch 
>>> b/target/linux/ar71xx/patches-3.10/911-MIPS-ath79-gl-machine.patch
>>> new file mode 100644
>>> index 0000000..201104c
>>> --- /dev/null
>>> +++ b/target/linux/ar71xx/patches-3.10/911-MIPS-ath79-gl-machine.patch
>> Don't put a new patch in there, add your board infos to the existing 
>> 610-MIPS-ath79-openwrt-machines.patch.
> It is not possible here anymore too, since there have been some boards added 
> separately lately, including 706-MIPS-ath79-oolite-v1-support.patch which 
> would then be broken since the GL.iNet is right next to it in the 
> alphabetically ordered lists :(
>
> If this new machine is not in a file on its own like these, we will have to 
> undo all these patches to integrate them back properly into the 
> 610-MIPS-ath79-openwrt-machines.patch too.
>
>>> @@ -0,0 +1,40 @@
>>> +--- a/arch/mips/ath79/Kconfig
>>> ++++ b/arch/mips/ath79/Kconfig
>>> +@@ -586,6 +586,17 @@ config ATH79_MACH_TL_WR703N
>>> +   select ATH79_DEV_USB
>>> +   select ATH79_DEV_WMAC
>>> + 
>>> ++config ATH79_MACH_GL_INET
>>> ++        bool "GL-INET support"
>>> ++        select SOC_AR933X
>>> ++        select ATH79_DEV_ETH
>>> ++        select ATH79_DEV_GPIO_BUTTONS
>>> ++        select ATH79_DEV_LEDS_GPIO
>>> ++        select ATH79_DEV_M25P80
>>> ++        select ATH79_DEV_USB
>>> ++        select ATH79_DEV_WMAC
>>> ++
>>> ++
>>> + config ATH79_MACH_TL_WR720N_V3
>>> +   bool "TP-LINK TL-WR720N v3 support"
>>> +   select SOC_AR933X
>>> +--- a/arch/mips/ath79/machtypes.h
>>> ++++ b/arch/mips/ath79/machtypes.h
>>> +@@ -98,6 +98,7 @@ enum ath79_mach_type {
>>> +   ATH79_MACH_TL_WR1043ND,         /* TP-LINK TL-WR1043ND */
>>> +   ATH79_MACH_TL_WR2543N,          /* TP-LINK TL-WR2543N/ND */
>>> +   ATH79_MACH_TL_WR703N,           /* TP-LINK TL-WR703N */
>>> ++  ATH79_MACH_GL_INET,             /* GL-CONNECT GL-INET */
>>> +   ATH79_MACH_TL_WR710N,           /* TP-LINK TL-WR710N */
>>> +   ATH79_MACH_TL_WR720N_V3,        /* TP-LINK TL-WR720N v3 */
>>> +   ATH79_MACH_TL_WR741ND,          /* TP-LINK TL-WR741ND */
>>> +--- a/arch/mips/ath79/Makefile
>>> ++++ b/arch/mips/ath79/Makefile
>>> +@@ -94,6 +94,7 @@ obj-$(CONFIG_ATH79_MACH_TL_WR1041N_V2)   +
>>> + obj-$(CONFIG_ATH79_MACH_TL_WR1043ND)      += mach-tl-wr1043nd.o
>>> + obj-$(CONFIG_ATH79_MACH_TL_WR2543N)       += mach-tl-wr2543n.o
>>> + obj-$(CONFIG_ATH79_MACH_TL_WR703N)        += mach-tl-wr703n.o
>>> ++obj-$(CONFIG_ATH79_MACH_GL_INET)  += mach-gl-inet.o
>>> + obj-$(CONFIG_ATH79_MACH_TL_WR720N_V3)     += mach-tl-wr720n-v3.o
>>> + obj-$(CONFIG_ATH79_MACH_UBNT)             += mach-ubnt.o
>>> + obj-$(CONFIG_ATH79_MACH_UBNT_XM)  += mach-ubnt-xm.o
>>> diff --git a/tools/firmware-utils/src/mktplinkfw.c 
>>> b/tools/firmware-utils/src/mktplinkfw.c
>>> index f0b33a0..1bed464 100644
>>> --- a/tools/firmware-utils/src/mktplinkfw.c
>>> +++ b/tools/firmware-utils/src/mktplinkfw.c
>>> @@ -66,6 +66,7 @@
>>>  #define HWID_TL_WR1043ND_V2        0x10430002
>>>  #define HWID_TL_WR1041N_V2 0x10410002
>>>  #define HWID_TL_WR2543N_V1 0x25430001
>>> +#define HWID_GL_INET_V1    0x08000001
>>>  
>>>  #define MD5SUM_LEN 16
>>>  
>>> @@ -393,6 +394,11 @@ static struct board_info boards[] = {
>>>             .hw_rev         = 1,
>>>             .layout_id      = "16Mlzma",
>>>     }, {
>>> +           .id             = "GL-INETv1",
>>> +           .hw_id          = HWID_GL_INET_V1,
>>> +           .hw_rev         = 1,
>>> +           .layout_id      = "8Mlzma",
>>> +   }, {
>>>             /* terminating entry */
>>>     }
>>>  };
>>> _______________________________________________
>>> 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
>>
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to