Re: [OpenWrt-Devel] [PATCH] libnl: Install include files into libnl3

2015-10-02 Thread Paul Fertser
Bruno Randolf  writes:
> Install header files into same location as pkgconfig/libnl-3.0.pc says:
>   Cflags: -I${includedir}/libnl3

For the reference, I've sent a similar patch [1] but have forgotten to
modify the INSTALL_DIR line.

[1] http://patchwork.ozlabs.org/patch/524877/

-- 
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercer...@gmail.com
___
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] ramips: Add DTS files for HiWiFi HC5x61 models

2015-10-02 Thread

Hi,  Merging 3 dts into one dtsi has been done in patch V3 ,



Sorry I don't quite understand your question ,  do you mean how to flash on 
those devices? 


At 2015-10-02 05:31:08, "Piotr Dymacz"  wrote:
>Hello,
>
>I don't have more comments, it looks good now. Maybe just think about
>my suggestion with common dtsi for all 3 models.
>And just one question - how does it look with flashing process on those 
>devices?
>
>Cheers,
>Piotr
>
>
>2015-09-29 18:13 GMT+02:00 Kang Xiaoning :
>>
>>
>> On Tue, Sep 29, 2015 at 4:31 AM, Piotr Dymacz  wrote:
>>>
>>> Hello,
>>>
>>> Just some small, cosmetic things... see inline, below.
>>>
>>> BTW.
>>> I see that these models are very similar (most of the dts files are
>>> just copy).
>>> Maybe it would be better to make for them one, common dtsi file and
>>> separated dts files per model (take Lenovo Y1/Y1S as example).
>>>
>>> Cheers,
>>> Piotr
>>>
>>> 2015-09-28 16:42 GMT+02:00 Comman Kang :
>>> > HiWiFi HC5661/5761/5861 models are manufactured by
>>> > http://www.hiwifi.com. These models have similar hardware specs(MT7620A +
>>> > 128M DDR2 + 16M flash). This patch adds support for them.
>>> >
>>> > The original author is Justin Liu (rss...@gmail.com). I ported the patch
>>> > to trunk and submitted it here with his approval.
>>> >
>>> > v2 fix
>>> >   1: Renamed files to remove manufacturer’s name.
>>> >   2: styling work
>>> >
>>> > Signed-off-by: Xiaoning Kang 
>>> >
>>> >
>>> > diff --git a/target/linux/ramips/dts/HC5661.dts
>>> > b/target/linux/ramips/dts/HC5661.dts
>>> > new file mode 100644
>>> > index 000..b5b9d1a
>>> > --- /dev/null
>>> > +++ b/target/linux/ramips/dts/HC5661.dts
>>> > @@ -0,0 +1,172 @@
>>> > +/dts-v1/;
>>> > +
>>> > +/include/ "mt7620a.dtsi"
>>> > +
>>> > +/ {
>>> > +   compatible = "HC5661", "ralink,mt7620a-soc";
>>> > +   model = "HiWiFi HC5661";
>>> > +
>>> > +   chosen {
>>> > +   bootargs = "console=ttyS0,115200";
>>> > +   };
>>> > +
>>> > +   palmbus@1000 {
>>> > +   sysc@0 {
>>> > +   ralink,gpiomux = "i2c", "jtag";
>>> > +   ralink,uartmux = "gpio";
>>> > +   ralink,wdtmux = <1>;
>>> > +   };
>>> > +
>>> > +   gpio0: gpio@600 {
>>> > +   status = "okay";
>>> > +   };
>>> > +
>>> > +   gpio2: gpio@660 {
>>> > +   status = "okay";
>>> > +   };
>>> > +
>>> > +   gpio3: gpio@688 {
>>> > +   status = "okay";
>>> > +   };
>>> > +
>>> > +   spi@b00 {
>>> > +   status = "okay";
>>> > +
>>> > +   m25p80@0 {
>>> > +   #address-cells = <1>;
>>> > +   #size-cells = <1>;
>>> > +   compatible = "w25q128";
>>> > +   reg = <0 0>;
>>> > +   linux,modalias = "m25p80", "w25q128";
>>> > +   spi-max-frequency = <1000>;
>>> > +
>>> > +   partition@0 {
>>> > +   label = "u-boot";
>>> > +   reg = <0x0 0x3>;
>>> > +   };
>>> > +
>>> > +   partition@3 {
>>> > +   label = "u-boot-env";
>>> > +   reg = <0x3 0x1>;
>>> > +   read-only;
>>> > +   };
>>> > +
>>> > +   factory: partition@4 {
>>> > +   label = "factory";
>>> > +   reg = <0x4 0x1>;
>>> > +   };
>>> > +
>>> > +   partition@5 {
>>> > +   label = "firmware";
>>> > +   reg = <0x5 0xf8>;
>>> > +   };
>>> > +
>>> > +   partition@fd {
>>> > +   label = "hwf_config";
>>> > +   reg = <0xfd 0x1>;
>>> > +   };
>>> > +
>>> > +   bdinfo: partition@fe {
>>> > +   label = "bdinfo";
>>> > +   reg = <0xfe 0x1>;
>>> > +   };
>>> > +
>>> > +   partition@ff {
>>> > +   label = "backup";
>>> > +   reg = <0xff 0x1>;
>>> > +   };
>>> > +   };
>>> > +  

Re: [OpenWrt-Devel] [PATCH] Support broadcast sockets in usock

2015-10-02 Thread John Crispin
Hi,

comments inline

On 02/10/2015 14:13, javier...@gmail.com wrote:
> From: Javier Domingo Cansino 
> 
> Signed-off-by: Javier Domingo Cansino 
> ---
>  usock.c | 5 -
>  usock.h | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/usock.c b/usock.c
> index 6748ef3..58f16da 100644
> --- a/usock.c
> +++ b/usock.c
> @@ -43,16 +43,19 @@ static void usock_set_flags(int sock, unsigned int type)
>  static int usock_connect(int type, struct sockaddr *sa, int sa_len, int 
> family, int socktype, bool server)
>  {
>   int sock;
> + int flags = SO_REUSEADDR;
>  

people tend to sort these by alphabetic order or line width. your patch
does neither of the 2.

>   sock = socket(family, socktype, 0);
>   if (sock < 0)
>   return -1;
>  
>   usock_set_flags(sock, type);
> + if (flags & USOCK_BROADCAST)
> + flags |= SO_BROADCAST;
>  

this should be guarded by "socktype != SOCK_STREAM" or similar. check
what the rest of the code does and change the patch accordingly please.

John



>   if (server) {
>   const int one = 1;
> - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, , sizeof(one));
> + setsockopt(sock, SOL_SOCKET, flags, , sizeof(one));
>  
>   if (!bind(sock, sa, sa_len) &&
>   (socktype != SOCK_STREAM || !listen(sock, SOMAXCONN)))
> diff --git a/usock.h b/usock.h
> index b0b952b..3471f2a 100644
> --- a/usock.h
> +++ b/usock.h
> @@ -26,6 +26,7 @@
>  #define USOCK_NOCLOEXEC  0x0200
>  #define USOCK_NONBLOCK   0x0400
>  #define USOCK_NUMERIC0x0800
> +#define USOCK_BROADCAST  0x1000
>  #define USOCK_IPV6ONLY   0x2000
>  #define USOCK_IPV4ONLY   0x4000
>  #define USOCK_UNIX   0x8000
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH libubox v2] Support broadcast sockets in usock

2015-10-02 Thread Javier Domingo Cansino
Signed-off-by: Javier Domingo Cansino 
---
 usock.c | 4 +++-
 usock.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/usock.c b/usock.c
index 6748ef3..3dd9957 100644
--- a/usock.c
+++ b/usock.c
@@ -42,6 +42,7 @@ static void usock_set_flags(int sock, unsigned int type)
 
 static int usock_connect(int type, struct sockaddr *sa, int sa_len, int 
family, int socktype, bool server)
 {
+   const int one = 1;
int sock;
 
sock = socket(family, socktype, 0);
@@ -49,9 +50,10 @@ static int usock_connect(int type, struct sockaddr *sa, int 
sa_len, int family,
return -1;
 
usock_set_flags(sock, type);
+   if (socktype != SOCK_STREAM && type & USOCK_BROADCAST)
+   setsockopt(sock, SOL_SOCKET, SO_BROADCAST, , sizeof(one));
 
if (server) {
-   const int one = 1;
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, , sizeof(one));
 
if (!bind(sock, sa, sa_len) &&
diff --git a/usock.h b/usock.h
index b0b952b..3471f2a 100644
--- a/usock.h
+++ b/usock.h
@@ -26,6 +26,7 @@
 #define USOCK_NOCLOEXEC0x0200
 #define USOCK_NONBLOCK 0x0400
 #define USOCK_NUMERIC  0x0800
+#define USOCK_BROADCAST0x1000
 #define USOCK_IPV6ONLY 0x2000
 #define USOCK_IPV4ONLY 0x4000
 #define USOCK_UNIX 0x8000
-- 
2.6.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Support broadcast sockets in usock

2015-10-02 Thread javierdo1
From: Javier Domingo Cansino 

Signed-off-by: Javier Domingo Cansino 
---
 usock.c | 5 -
 usock.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/usock.c b/usock.c
index 6748ef3..58f16da 100644
--- a/usock.c
+++ b/usock.c
@@ -43,16 +43,19 @@ static void usock_set_flags(int sock, unsigned int type)
 static int usock_connect(int type, struct sockaddr *sa, int sa_len, int 
family, int socktype, bool server)
 {
int sock;
+   int flags = SO_REUSEADDR;
 
sock = socket(family, socktype, 0);
if (sock < 0)
return -1;
 
usock_set_flags(sock, type);
+   if (flags & USOCK_BROADCAST)
+   flags |= SO_BROADCAST;
 
if (server) {
const int one = 1;
-   setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, , sizeof(one));
+   setsockopt(sock, SOL_SOCKET, flags, , sizeof(one));
 
if (!bind(sock, sa, sa_len) &&
(socktype != SOCK_STREAM || !listen(sock, SOMAXCONN)))
diff --git a/usock.h b/usock.h
index b0b952b..3471f2a 100644
--- a/usock.h
+++ b/usock.h
@@ -26,6 +26,7 @@
 #define USOCK_NOCLOEXEC0x0200
 #define USOCK_NONBLOCK 0x0400
 #define USOCK_NUMERIC  0x0800
+#define USOCK_BROADCAST0x1000
 #define USOCK_IPV6ONLY 0x2000
 #define USOCK_IPV4ONLY 0x4000
 #define USOCK_UNIX 0x8000
-- 
2.6.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] openvpn: add handling for route-pre-down option

2015-10-02 Thread Jeffery To
(resending as I wasn't subscribed to the list before, my apologies)

OpenVPN 2.3 added a route-pre-down option, to run a command before
routes are removed upon disconnection.

Signed-off-by: Jeffery To 
---
 package/network/services/openvpn/files/openvpn.init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/network/services/openvpn/files/openvpn.init 
b/package/network/services/openvpn/files/openvpn.init
index 861d0d6..994973b 100644
--- a/package/network/services/openvpn/files/openvpn.init
+++ b/package/network/services/openvpn/files/openvpn.init
@@ -120,7 +120,7 @@ start_instance() {
redirect_gateway remap_usr1 remote remote_cert_eku 
remote_cert_ku remote_cert_tls \
reneg_bytes reneg_pkts reneg_sec \
replay_persist replay_window resolv_retry route route_delay 
route_gateway \
-   route_metric route_up rport script_security secret server 
server_bridge setenv shaper sndbuf \
+   route_metric route_pre_down route_up rport script_security 
secret server server_bridge setenv shaper sndbuf \
socks_proxy status status_version syslog tcp_queue_limit 
tls_auth \
tls_cipher tls_remote tls_timeout tls_verify tmp_dir topology 
tran_window \
tun_mtu tun_mtu_extra txqueuelen user verb down push up \
-- 
2.1.0
___
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] ramips: Add DTS files for HiWiFi HC5x61 models

2015-10-02 Thread Yousong Zhou
On 29 September 2015 at 23:45, Kang Xiaoning  wrote:
> Hi Yousong
>
> Thanks for helping. Your questions are both valid..
>
> My initiative is to put basic support into trunk, and try to solve those
> problems later.
>
> Regarding #1,  I'm not comfortable enough to make a function in dts driver
> solely for those particular devices. Maybe a hack script to update wireless
> uci config files at firstboot is better?

It's just an ancient idea from me.  The intention is that since we
already have mtd-mac-address for binary ones, why not also include
those ascii variants.  Maybe some other boards also suffer from this
issue too and can benefit from the change.  Anyway there are ramips
maintainers to make the decision.

>
> For #2,  I can write the wiki page, though it is would be complicated.
> HiWiFi provides an "official" way to unlock the U-Boot now, at the cost of
> voiding warranty.  However, you have to follow a procedure which requires a
> Chinese cellphone number, and a WeChat(a whatsapp clone app) account.
> Understanding of Chinese is also a requirement.  Anyway, since HiWiFi
> routers are sold in Chinese market only, I believe it won't be a big problem
> for non-Chinese users.
>

Maybe... back in Oct. 2014, information about a mt7620 dev board [1]
was sought.  Looks like the case was removed but the style of board
layout made me think that it could be a board by HiWiFi.  I think I
can somehow understand why the pubkey firmware verification was added
later.  But personally I think those technical facts and details
should be collected and documented.

 [1] desperately seeking info on this weird MT7620A/MT7610EN dev
board, 
https://lists.openwrt.org/pipermail/openwrt-devel/2014-October/028516.html

Regards,

yousong


> Thanks again!
>
> On Tue, Sep 29, 2015 at 10:10 AM, Yousong Zhou 
> wrote:
>>
>> Hi,
>>
>> Previously this year, there were 2 attempts to add support for HC5661
>> and HC5761 to OpenWrt trunk [1,2].  I only had a HC5661 and it was
>> quite a while ago but the issues then should still remain.
>>
>> The first is about how MAC address is to be read.  The
>> "mtd-mac-address" DTS directives apparently won't work.  And if I
>> remember correctly simply reading and setting it for lan and wan also
>> has flaws that the WiFi interface still get the default hardcoded MAC
>> address by the driver.  The best way I can think of to workaround this
>> is to add a directive similar to what "mtd-mac-address" does for
>> binary-encoded MACs.
>>
>> "target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch"
>> can work as a reference.
>
>
>
>
>>
>>
>> The second is about how the generated the firmwares is to be flashed
>> to the those devices.  Are there plans to create wiki pages to clarify
>> the details?  Again if I remember correctly, the U-Boot of HC5661 at
>> least utilised pubkey firmware verification (though ...).  How regular
>> users are supposed to workaround this?
>>
>>  [1] HiWiFi HC5661 Support for Openwrt,
>> https://lists.openwrt.org/pipermail/openwrt-devel/2015-April/032640.html
>>  [2] ramips:Add support for HiWiFi HC5761,
>> https://lists.openwrt.org/pipermail/openwrt-devel/2015-April/032643.html
>>
>> Regard,
>>
>> yousong
>>
>> On 28 September 2015 at 22:42, Comman Kang  wrote:
>> > HiWiFi HC5661/5761/5861 models are manufactured by
>> > http://www.hiwifi.com. These models have similar hardware specs(MT7620A +
>> > 128M DDR2 + 16M flash). This patch adds support for them.
>> >
>> > The original author is Justin Liu (rss...@gmail.com). I ported the patch
>> > to trunk and submitted it here with his approval.
>> >
>> > v2 fix
>> >   1: Renamed files to remove manufacturer’s name.
>> >   2: styling work
>> >
>> > Signed-off-by: Xiaoning Kang 
>> >
>> >
>> > diff --git a/target/linux/ramips/dts/HC5661.dts
>> > b/target/linux/ramips/dts/HC5661.dts
>> > new file mode 100644
>> > index 000..b5b9d1a
>> > --- /dev/null
>> > +++ b/target/linux/ramips/dts/HC5661.dts
>> > @@ -0,0 +1,172 @@
>> > +/dts-v1/;
>> > +
>> > +/include/ "mt7620a.dtsi"
>> > +
>> > +/ {
>> > +   compatible = "HC5661", "ralink,mt7620a-soc";
>> > +   model = "HiWiFi HC5661";
>> > +
>> > +   chosen {
>> > +   bootargs = "console=ttyS0,115200";
>> > +   };
>> > +
>> > +   palmbus@1000 {
>> > +   sysc@0 {
>> > +   ralink,gpiomux = "i2c", "jtag";
>> > +   ralink,uartmux = "gpio";
>> > +   ralink,wdtmux = <1>;
>> > +   };
>> > +
>> > +   gpio0: gpio@600 {
>> > +   status = "okay";
>> > +   };
>> > +
>> > +   gpio2: gpio@660 {
>> > +   status = "okay";
>> > +   };
>> > +
>> > +   gpio3: gpio@688 {
>> > +   status = "okay";
>> > +   };
>> > +
>> > +  

Re: [OpenWrt-Devel] [PATCH v2 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-10-02 Thread Piotr Dymacz
Hello,

2015-10-02 15:53 GMT+02:00 康 :
>
> Hi,  Merging 3 dts into one dtsi has been done in patch V3 ,

Sorry, I missed that.

> Sorry I don't quite understand your question ,  do you mean how to flash on
> those devices?

Yes and I got the answer from your mail to Yousong:

> For #2,  I can write the wiki page, though it is would be complicated.
> HiWiFi provides an "official" way to unlock the U-Boot now, at the cost of
> voiding warranty.  However, you have to follow a procedure which requires a
> Chinese cellphone number, and a WeChat(a whatsapp clone app) account.
> Understanding of Chinese is also a requirement.  Anyway, since HiWiFi
> routers are sold in Chinese market only, I believe it won't be a big problem
> for non-Chinese users.

There are dozen ways to have devices for CN market in other parts of
the the world.
If there is no easier/ready way to switch from official firmware to
OpenWrt on those devices, I'm not convinced about keeping official
support for them in OpenWrt repository, but it's just mine opinion.

Cheers,
Piotr

[snip]
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] lantiq: Add target TP-Link TD-W8980

2015-10-02 Thread Mathias Kresin
The device is similar to the TD-W8970, beside a different Atheros 2.4 GHz
wireless chip and the additional, PCI connected, WAVE300 5 GHz wireless.

Signed-off-by: Mathias Kresin 
---

The DTS should work for a TD-W9980 as well. But due to lack of the
appropriate hardware, it has not been tested.

 .../lantiq/base-files/etc/uci-defaults/02_network  |   2 +-
 target/linux/lantiq/dts/TDW8970.dts| 251 +---
 target/linux/lantiq/dts/TDW8980.dts|  31 +++
 target/linux/lantiq/dts/TDW89X0.dtsi   | 252 +
 target/linux/lantiq/image/Makefile |   3 +
 target/linux/lantiq/xrx200/profiles/tplink.mk  |   7 +
 tools/firmware-utils/src/mktplinkfw2.c |   5 +
 7 files changed, 300 insertions(+), 251 deletions(-)
 create mode 100644 target/linux/lantiq/dts/TDW8980.dts
 create mode 100644 target/linux/lantiq/dts/TDW89X0.dtsi

diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/02_network 
b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
index ff21e02..85d0eba 100644
--- a/target/linux/lantiq/base-files/etc/uci-defaults/02_network
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
@@ -151,7 +151,7 @@ P2812HNUF*)
ucidef_add_switch_vlan "switch0" "1" "0 1 2 4 5 6t"
;;
 
-TDW8970)
+TDW8970|TDW8980)
lan_mac=$(mtd_get_mac_binary boardconfig 61696)
wan_mac=$(macaddr_add "$lan_mac" 1)
ucidef_set_interface_lan 'eth0.1'
diff --git a/target/linux/lantiq/dts/TDW8970.dts 
b/target/linux/lantiq/dts/TDW8970.dts
index d8dcb5d..172c46c 100644
--- a/target/linux/lantiq/dts/TDW8970.dts
+++ b/target/linux/lantiq/dts/TDW8970.dts
@@ -1,256 +1,7 @@
 /dts-v1/;
 
-/include/ "vr9.dtsi"
+/include/ "TDW89X0.dtsi"
 
 / {
model = "TDW8970 - TP-LINK TD-W8970";
-
-   chosen {
-   bootargs = "console=ttyLTQ0,115200 init=/etc/preinit";
-   };
-
-   memory@0 {
-   reg = <0x0 0x400>;
-   };
-
-   fpi@1000 {
-   gpio: pinmux@E100B10 {
-   pinctrl-names = "default";
-   pinctrl-0 = <_default>;
-
-   state_default: pinmux {
-   mdio {
-   lantiq,groups = "mdio";
-   lantiq,function = "mdio";
-   };
-   gphy-leds {
-   lantiq,groups = "gphy0 led1", "gphy1 
led1";
-   lantiq,function = "gphy";
-   lantiq,pull = <2>;
-   lantiq,open-drain = <0>;
-   lantiq,output = <1>;
-   };
-   phy-rst {
-   lantiq,pins = "io42";
-   lantiq,pull = <0>;
-   lantiq,open-drain = <0>;
-   lantiq,output = <1>;
-   };
-   spi-in {
-   lantiq,pins = "io16";
-   lantiq,open-drain = <1>;
-   lantiq,pull = <2>;
-   };
-   spi-out {
-   lantiq,pins = "io10", "io17", "io18", 
"io21";
-   lantiq,open-drain = <0>;
-   lantiq,pull = <2>;
-   };
-   pcie-rst {
-   lantiq,pins = "io38";
-   lantiq,pull = <0>;
-   lantiq,output = <1>;
-   };
-   };
-   };
-
-   eth@E108000 {
-   #address-cells = <1>;
-   #size-cells = <0>;
-   compatible = "lantiq,xrx200-net";
-   reg = < 0xE108000 0x3000 /* switch */
-   0xE10B100 0x70 /* mdio */
-   0xE10B1D8 0x30 /* mii */
-   0xE10B308 0x30 /* pmac */
-   >;
-   interrupt-parent = <>;
-   interrupts = <73 72>;
-
-   lan: interface@0 {
-   compatible = "lantiq,xrx200-pdi";
-   #address-cells = <1>;
-   #size-cells = <0>;
-   reg = <0>;
-   mtd-mac-address = <_cal 0xf100>;
-   lantiq,switch;
-
-   ethernet@0 {
-

[OpenWrt-Devel] [PATCH 1/2] lantiq: fix ath_pci_fixup hang on bridged devices

2015-10-02 Thread Mathias Kresin
Port of r41856.

In contrast to the brcm63xx target, it isn't sufficient to enable/disable
the bridge. The device needs to be enabled/disabled to fix the hang. The
bridge will be automatically enabled by the time the connected device is
enabled.

Fixes boot on TD-W8980.

Signed-off-by: Mathias Kresin 
Signed-off-by: Martin Blumenstingl 
---
 .../0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch  | 11 ++-
 .../0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch  | 11 ++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git 
a/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
 
b/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
index ec769ccf..2fc4db3 100644
--- 
a/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ 
b/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -415,7 +415,7 @@ Signed-off-by: John Crispin 
 +device_initcall(of_eth_mac_init);
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/pci-ath-fixup.c
-@@ -0,0 +1,109 @@
+@@ -0,0 +1,118 @@
 +/*
 + *  Atheros AP94 reference board PCI initialization
 + *
@@ -442,6 +442,7 @@ Signed-off-by: John Crispin 
 +static void ath_pci_fixup(struct pci_dev *dev)
 +{
 +  void __iomem *mem;
++  struct pci_dev *bridge = pci_upstream_bridge(dev); 
 +  u16 *cal_data = NULL;
 +  u16 cmd;
 +  u32 bar0;
@@ -477,6 +478,10 @@ Signed-off-by: John Crispin 
 +  return;
 +  }
 +
++  if (bridge) {
++  pci_enable_device(dev);
++  }
++
 +  pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, );
 +  pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, base);
 +  pci_read_config_word(dev, PCI_COMMAND, );
@@ -512,6 +517,10 @@ Signed-off-by: John Crispin 
 +
 +  pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0);
 +
++  if (bridge) {
++  pci_disable_device(dev);
++  }
++
 +  iounmap(mem);
 +}
 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath_pci_fixup);
diff --git 
a/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
 
b/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
index 72ae1c9..6d53cd9 100644
--- 
a/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ 
b/target/linux/lantiq/patches-4.1/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -415,7 +415,7 @@ Signed-off-by: John Crispin 
 +device_initcall(of_eth_mac_init);
 --- /dev/null
 +++ b/arch/mips/lantiq/xway/pci-ath-fixup.c
-@@ -0,0 +1,109 @@
+@@ -0,0 +1,118 @@
 +/*
 + *  Atheros AP94 reference board PCI initialization
 + *
@@ -442,6 +442,7 @@ Signed-off-by: John Crispin 
 +static void ath_pci_fixup(struct pci_dev *dev)
 +{
 +  void __iomem *mem;
++  struct pci_dev *bridge = pci_upstream_bridge(dev); 
 +  u16 *cal_data = NULL;
 +  u16 cmd;
 +  u32 bar0;
@@ -477,6 +478,10 @@ Signed-off-by: John Crispin 
 +  return;
 +  }
 +
++  if (bridge) {
++  pci_enable_device(dev);
++  }
++
 +  pci_read_config_dword(dev, PCI_BASE_ADDRESS_0, );
 +  pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, base);
 +  pci_read_config_word(dev, PCI_COMMAND, );
@@ -512,6 +517,10 @@ Signed-off-by: John Crispin 
 +
 +  pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, bar0);
 +
++  if (bridge) {
++  pci_disable_device(dev);
++  }
++
 +  iounmap(mem);
 +}
 +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath_pci_fixup);
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] target: ar71xx: add support for Comfast CF-WR600N, CF-E325N and CF-E316Nv2

2015-10-02 Thread Gustavo Azambuja
This adds full support for the COMFAST routers  CF-WR600N, CF-E325N
and CF-E316Nv2

http://en.comfast.com.cn/product/WirelessRouter/item-168.html
http://en.comfast.com.cn/product/WirelessAP/item-171.html

Signed-off-by: Gustavo Azambuja 

---
 .../ar71xx/base-files/etc/uci-defaults/01_leds |  31 ++
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  49 +++
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |  12 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   8 +
 target/linux/ar71xx/config-3.18|   5 +
 target/linux/ar71xx/drivers.diff   | 404 +
 .../ar71xx/files/arch/mips/ath79/mach-comfast.c| 485 +
 target/linux/ar71xx/generic/profiles/comfast.mk|  49 +++
 target/linux/ar71xx/image/Makefile | 102 +
 .../610-MIPS-ath79-openwrt-machines.patch  |  32 +-
 .../patches-3.18/614-MIPS-ath79-wdt-timeout.patch  |  54 +++
 11 files changed, 1225 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/ar71xx/drivers.diff
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-comfast.c
 create mode 100644 target/linux/ar71xx/generic/profiles/comfast.mk
 create mode 100644
target/linux/ar71xx/patches-3.18/614-MIPS-ath79-wdt-timeout.patch

diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index d628f1a..969b97a 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -50,6 +50,37 @@ bsb)
  ucidef_set_led_default "sys" "SYS" "bsb:red:sys" "1"
  ;;

+ap9341fe)
+ ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
+ ;;
+
+ ucidef_set_led_netdev "wan" "WAN" "comfast:white:wan" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:white:lan" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:white:wifi" "phy0tpt"
+ ;;
+
+cf-e325n)
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth1"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth0"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
+ ;;
+
+cf-wr600n)
+ ucidef_set_led_netdev "wan1" "WAN1" "cf_wr600n:green:wan1" "eth0"
+ ucidef_set_led_switch "lan1" "LAN1" "cf_wr600n:green:lan1" "switch0" "0x04"
+ ucidef_set_led_switch "lan2" "LAN2" "cf_wr600n:green:lan2" "switch0" "0x08"
+ ucidef_set_led_switch "lan3" "LAN3" "cf_wr600n:green:lan3" "switch0" "0x10"
+# ucidef_set_led_switch "lan4" "LAN4" "cf_wr600n:green:lan4" "switch0" "0x02"
+# ucidef_set_led_default "lan" "LAN" "comfast:green" "1"
+ ucidef_set_led_netdev "wan" "WAN" "comfast:red" "eth0"
+ ucidef_set_led_netdev "lan" "LAN" "comfast:green" "eth1"
+ ucidef_set_led_wlan "wlan" "WLAN" "comfast:blue" "phy0tpt"
+ ;;
+
 bullet-m | \
 nanostation-m | \
 rocket-m | \
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 7e26886..2fb753e 100644
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -55,6 +55,55 @@ wzr-450hp2)
  ucidef_add_switch_vlan "switch0" "2" "5 6"
  ;;

+ap9341fe)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-e316nv2)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-e325n)
+ ucidef_set_interfaces_lan_wan "eth0" "eth1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth0/address)
+ wlan_mac=$(macaddr_add "$lan_mac" 1)
+ wan_mac=$(macaddr_add "$lan_mac" 2)
+ [ -n "$lan_mac" ] && ucidef_set_interface_macaddr lan $lan_mac
+ [ -n "$wlan_mac" ] && ucidef_set_wireless_macaddr radio0 $wlan_mac
+ [ -n "$wan_mac" ] && ucidef_set_interface_macaddr wan $wan_mac
+ ;;
+
+cf-wr600n)
+ ucidef_set_interfaces_lan_wan "eth1" "eth0"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
+ lan_mac=$(cat /sys/class/net/eth1/address)
+ 

[OpenWrt-Devel] [PATCH] [ar71xx] Send power to USB port on WNR2200

2015-10-02 Thread Riley Baird
This patch fixes ticket #15267 by enabling power on the
WNR2200's USB port. At present, the USB port on the WNR2200
is non-functional due to it not receiving power.

This patch defines an additional GPIO pin, but none of the
current GPIO definitions have been modified.

Signed-off-by: Riley Baird 

diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
index bf7f9ee..b98f7c7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-wnr2200.c
@@ -36,7 +36,7 @@
 #define WNR2200_GPIO_LED_LAN4_GREEN16
 #define WNR2200_GPIO_LED_PWR_AMBER 21
 #define WNR2200_GPIO_LED_PWR_GREEN 22
-
+#define WNR2200_GPIO_USB_5V4
 #define WNR2200_GPIO_USB_POWER 24
 
 #define WNR2200_KEYS_POLL_INTERVAL 20 /* msecs */
@@ -127,9 +127,10 @@ static void __init wnr2200_setup(void)
wnr2200_leds_gpio);
 
/* enable power for the USB port */
-   gpio_request_one(WNR2200_GPIO_USB_POWER,
-   GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
-   "USB power");
+   ap9x_pci_setup_wmac_gpio(0,
+   BIT(WNR2200_GPIO_USB_5V) |
+   BIT(WNR2200_GPIO_LED_PWR_AMBER) | 
BIT(WNR2200_GPIO_LED_PWR_GREEN),
+   BIT(WNR2200_GPIO_USB_5V) | BIT(WNR2200_GPIO_LED_PWR_AMBER));
 
ath79_register_usb();
 }
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel