Re: [OpenWrt-Devel] Factory reset implementation on x86 platform

2015-09-17 Thread Tavish Naruka
On Thu, Sep 17, 2015 at 11:30 AM, Chetan C R  wrote:
> Hi,
>
> I wanted to implement factory reset functionality on x86 platform.
> my rootfs is ext4
>

Failsafe and factory rest would work only with squashfs+jffs2 afaik,
in which case 'firstboot' just clears the jffs2 partition, which is
mounted as an overlay on the squashfs filesystem(which is read only,
failsafe mode uses only this).

-- 
Regards
Tavish Naruka
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] uqmi: Add proper IPv6 support

2015-09-17 Thread Antti Seppälä
On 10 September 2015 at 22:03, Matti Laakso  wrote:
> Use the new --ip-family option to start both IPv4 and IPv6 sessions
> by default. Autoconnect can't be used when starting two sessions,
> so revert back to using the client IDs and packet data handles for
> handling the network connection.
>
> Some modem firmwares do not implement a RA server, therefore by
> default use outband IP configuration and static addressing. Some
> other firmwares report bogus IP configuration with the WDS get
> current settings command. In this case inband configuration with
> DHCP/RA can be optionally enabled by setting option dhcp to 1.
>
> Per 3GPP standard a /64 prefix is served to all clients, which is
> extended to LAN as specified in RFC 7278.
>
> v2: Restrict the IPv6 gateway route source address
> Signed-off-by: Matti Laakso 

Hi Matti.

I built openwrt with uqmi built into the squashfs with your patch
applied and for some reason the qmi.sh does not get execute bit when
installed:

root@OpenWrt:~# ls -l /lib/netifd/proto/
-rwxr-xr-x1 root root  2430 Sep  16 20:30 3g.sh
-rwxr-xr-x1 root root  2165 Sep  16 20:30 dhcp.sh
-rwxr-xr-x1 root root  3508 Sep  16 20:30 dhcpv6.sh
-rwxr-xr-x1 root root  3393 Sep  16 20:30 openconnect.sh
-rwxr-xr-x1 root root  6945 Sep  16 20:30 ppp.sh
-rw-r--r--1 root root  6557 Sep  16 20:30 qmi.sh
-rwxr-xr-x1 root root  3325 Sep  16 20:30 wwan.sh

Apparently the protocol won't then load properly. Any idea why this
is? Applying chmod +x to the file makes the protocol work.

The other thing I was wondering is the tests for the new boolean
variables with -z. E.g if there now is an explicit config directive to
set dhcp off ("option dhcp 0") then dhcp would still be enabled.

I think the recommended design is to use something along the lines of:
if [ "${boolean_variable:-0}" -gt 0 ]; then whatever; fi
It looks like this should maybe apply to both dhcp and ipv6 variables?

Br,
-Antti
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] uboot_envtools: add P2812HNUF1

2015-09-17 Thread Florian Eckert
Add generation of /etc/fw_env.config for P2812HNUF1

Signed-off-by: Florian Eckert 
---
 package/boot/uboot-envtools/files/lantiq | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/package/boot/uboot-envtools/files/lantiq 
b/package/boot/uboot-envtools/files/lantiq
index 69b375d..b152061 100644
--- a/package/boot/uboot-envtools/files/lantiq
+++ b/package/boot/uboot-envtools/files/lantiq
@@ -20,6 +20,9 @@ GIGASX76X)
 BTHOMEHUBV2B)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1" "1"
;;
+P2812HNUF1)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x2000" "0x2" "1"
+   ;;
 esac
 
 config_load ubootenv
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Factory reset implementation on x86 platform

2015-09-17 Thread John Crispin


On 17/09/2015 09:06, Tavish Naruka wrote:
> On Thu, Sep 17, 2015 at 11:30 AM, Chetan C R  wrote:
>> Hi,
>>
>> I wanted to implement factory reset functionality on x86 platform.
>> my rootfs is ext4
>>
> 
> Failsafe and factory rest would work only with squashfs+jffs2 afaik,
> in which case 'firstboot' just clears the jffs2 partition, which is
> mounted as an overlay on the squashfs filesystem(which is read only,
> failsafe mode uses only this).
> 

you can use the block2mtd layer to create a squash+jffs2 overlay setup
even if you are running your installation on a block device. this will
then allow you to use features such as jffs2reset

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] uqmi: Add proper IPv6 support

2015-09-17 Thread Matti Laakso
Hi Antti,

> Date: Thu, 17 Sep 2015 10:15:21 +0300
> Subject: Re: [OpenWrt-Devel] [PATCH v2] uqmi: Add proper IPv6 support
> From: a.sepp...@gmail.com
> To: malaa...@elisanet.fi
> CC: openwrt-devel@lists.openwrt.org
> 
> On 10 September 2015 at 22:03, Matti Laakso  wrote:
> > Use the new --ip-family option to start both IPv4 and IPv6 sessions
> > by default. Autoconnect can't be used when starting two sessions,
> > so revert back to using the client IDs and packet data handles for
> > handling the network connection.
> >
> > Some modem firmwares do not implement a RA server, therefore by
> > default use outband IP configuration and static addressing. Some
> > other firmwares report bogus IP configuration with the WDS get
> > current settings command. In this case inband configuration with
> > DHCP/RA can be optionally enabled by setting option dhcp to 1.
> >
> > Per 3GPP standard a /64 prefix is served to all clients, which is
> > extended to LAN as specified in RFC 7278.
> >
> > v2: Restrict the IPv6 gateway route source address
> > Signed-off-by: Matti Laakso 
> 
> Hi Matti.
> 
> I built openwrt with uqmi built into the squashfs with your patch
> applied and for some reason the qmi.sh does not get execute bit when
> installed:
> 
> root@OpenWrt:~# ls -l /lib/netifd/proto/
> -rwxr-xr-x1 root root  2430 Sep  16 20:30 3g.sh
> -rwxr-xr-x1 root root  2165 Sep  16 20:30 dhcp.sh
> -rwxr-xr-x1 root root  3508 Sep  16 20:30 dhcpv6.sh
> -rwxr-xr-x1 root root  3393 Sep  16 20:30 openconnect.sh
> -rwxr-xr-x1 root root  6945 Sep  16 20:30 ppp.sh
> -rw-r--r--1 root root  6557 Sep  16 20:30 qmi.sh
> -rwxr-xr-x1 root root  3325 Sep  16 20:30 wwan.sh
> 
> Apparently the protocol won't then load properly. Any idea why this
> is? Applying chmod +x to the file makes the protocol work.
> 

Good catch, my patch accidentally contained an unintended mode change from 755 
to 644.

> The other thing I was wondering is the tests for the new boolean
> variables with -z. E.g if there now is an explicit config directive to
> set dhcp off ("option dhcp 0") then dhcp would still be enabled.
> 
> I think the recommended design is to use something along the lines of:
> if [ "${boolean_variable:-0}" -gt 0 ]; then whatever; fi
> It looks like this should maybe apply to both dhcp and ipv6 variables?
> 

That's true with the dhcp option, but ipv6 should work correctly since it is 
explicitely set to "" if ipv6=0.

I'll fix both the execute bit and the dhcp option handling later today. Thanks 
for reporting!

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


Re: [OpenWrt-Devel] Warning: ABI breakage - rebuild your ATM trees

2015-09-17 Thread David Woodhouse
On Wed, 2015-09-16 at 15:23 +0200, John Crispin wrote:
> how i hate this shitty dsl driver ... adding new sockopt is nort an
> option. that would involve editing the dsl driver and userland and even
> looking at the code causes permanent brain damage as can be seen by the
> patches and fixes ... i will find a different hack to make this only
> apply when lantiq is selected.

Does this actually need to be exposed to userspace?

-- 
dwmw2



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Warning: ABI breakage - rebuild your ATM trees

2015-09-17 Thread Kevin Darbyshire-Bryant


On 16/09/15 12:20, John Crispin wrote:
> Hi,
>
> i pushed a patch today that removes some serious ABI brain damage of the
> ATM layer that i introduced 1/2 a decade ago
>
> http://git.openwrt.org/?p=openwrt.git;a=commit;h=c5d4911448898f7fabdd2c4737ed0820ced4fc4d
>
> https://dev.openwrt.org/ticket/20523
>
> as a side effect you will need to rebuild your trees if you are using
> ATM. a "make clean" wont cut the cheese on this one, you need to do a
> full distclean to force the toolchain to rebuild, so that the new kernel
> headers are staged etc etc.
>

Would a 'make dirclean' be sufficiently forceful?  This forces a
toolchain rebuild as far as I can tell without losing an existing config.

Thanks,

Kevin



smime.p7s
Description: S/MIME Cryptographic Signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Warning: ABI breakage - rebuild your ATM trees

2015-09-17 Thread John Crispin


On 17/09/2015 10:54, David Woodhouse wrote:
> On Wed, 2015-09-16 at 15:23 +0200, John Crispin wrote:
>> how i hate this shitty dsl driver ... adding new sockopt is nort an
>> option. that would involve editing the dsl driver and userland and even
>> looking at the code causes permanent brain damage as can be seen by the
>> patches and fixes ... i will find a different hack to make this only
>> apply when lantiq is selected.
> 
> Does this actually need to be exposed to userspace?
> 

not just that it is not required but it is used by what seems like dead
code. hacking up a patch to de-fuck the atm driver just now
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] x86/platform: Fix Geode LX timekeeping in the generic x86 build

2015-09-17 Thread David Woodhouse
In 2007, commit 07190a08eef36 ("Mark TSC on GeodeLX reliable")
bypassed verification of the TSC on Geode LX. However, this code
(now in the check_system_tsc_reliable() function in
arch/x86/kernel/tsc.c) was only present if CONFIG_MGEODE_LX was
set.

OpenWRT has recently started building its generic Geode target
for Geode GX, not LX, to include support for additional
platforms. This broke the timekeeping on LX-based devices,
because the TSC wasn't marked as reliable:
https://dev.openwrt.org/ticket/20531

By adding a runtime check on is_geode_lx(), we can also include
the fix if CONFIG_MGEODEGX1 or CONFIG_X86_GENERIC are set, thus
fixing the problem.

Signed-off-by: David Woodhouse 
Signed-off-by: Ingo Molnar 
Closes #20531
---
We need this for CC and trunk, for the Geode kernel.

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 79055cf..51e62d6 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 unsigned int __read_mostly cpu_khz;/* TSC clocks / usec, not used here */
 EXPORT_SYMBOL(cpu_khz);
@@ -1015,15 +1016,17 @@ EXPORT_SYMBOL_GPL(mark_tsc_unstable);
 
 static void __init check_system_tsc_reliable(void)
 {
-#ifdef CONFIG_MGEODE_LX
-   /* RTSC counts during suspend */
+#if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || 
defined(CONFIG_X86_GENERIC)
+   if (is_geode_lx()) {
+   /* RTSC counts during suspend */
 #define RTSC_SUSP 0x100
-   unsigned long res_low, res_high;
+   unsigned long res_low, res_high;
 
-   rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
-   /* Geode_LX - the OLPC CPU has a very reliable TSC */
-   if (res_low & RTSC_SUSP)
-   tsc_clocksource_reliable = 1;
+   rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
+   /* Geode_LX - the OLPC CPU has a very reliable TSC */
+   if (res_low & RTSC_SUSP)
+   tsc_clocksource_reliable = 1;
+   }
 #endif
if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
tsc_clocksource_reliable = 1;
-- 
cgit v0.10.2

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] OpenWRT 15.05:bcm2708 device tree

2015-09-17 Thread Jernej Izak
Hi,



I'm trying to activate device tree on OpenWRT 15.05 released version with 
bcm2708 platform (raspberry pi).

I activated it in kernel_menuconfig, but after building there is no dtb file on 
boot partition of sd card.



Is there any patch to fix the issue, or device tree is really not jet supported?



Best Regards

Jernej Izak

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


Re: [OpenWrt-Devel] Warning: ABI breakage - rebuild your ATM trees

2015-09-17 Thread John Crispin


On 17/09/2015 11:11, John Crispin wrote:
> 
> 
> On 17/09/2015 10:54, David Woodhouse wrote:
>> On Wed, 2015-09-16 at 15:23 +0200, John Crispin wrote:
>>> how i hate this shitty dsl driver ... adding new sockopt is nort an
>>> option. that would involve editing the dsl driver and userland and even
>>> looking at the code causes permanent brain damage as can be seen by the
>>> patches and fixes ... i will find a different hack to make this only
>>> apply when lantiq is selected.
>>
>> Does this actually need to be exposed to userspace?
>>
> 
> not just that it is not required but it is used by what seems like dead
> code. hacking up a patch to de-fuck the atm driver just now
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 

felix just pushed a patch, please start testingng
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] geode: enable DMI and Geos support

2015-09-17 Thread David Woodhouse
Closes 20512

Signed-off-by: David Woodhouse 
---
For CC and trunk please.

 target/linux/x86/geode/config-default | 5 +
 1 file changed, 5 insertions(+)

diff --git a/target/linux/x86/geode/config-default 
b/target/linux/x86/geode/config-default
index f4efab0..a53d07c 100644
--- a/target/linux/x86/geode/config-default
+++ b/target/linux/x86/geode/config-default
@@ -10,9 +10,13 @@ CONFIG_ALIX=y
 CONFIG_CS5535_CLOCK_EVENT_SRC=y
 CONFIG_CS5535_MFGPT=y
 CONFIG_CS5535_MFGPT_DEFAULT_IRQ=7
+CONFIG_DMI=y
+# CONFIG_DMIID is not set
+# CONFIG_DMI_SYSFS is not set
 # CONFIG_EISA is not set
 # CONFIG_EL3 is not set
 CONFIG_GEODE_WDT=y
+CONFIG_GEOS=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_CS5535=y
 CONFIG_GPIO_DEVRES=y
@@ -29,6 +33,7 @@ CONFIG_I2C_BOARDINFO=y
 CONFIG_ISA=y
 # CONFIG_KEYBOARD_GPIO is not set
 # CONFIG_LANCE is not set
+# CONFIG_LEDS_CLEVO_MAIL is not set
 CONFIG_LEDS_GPIO=y
 # CONFIG_M486 is not set
 # CONFIG_MDA_CONSOLE is not set
-- 
2.4.3

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] solos-pci: Increase headroom on received packets

2015-09-17 Thread David Woodhouse
A comment in include/linux/skbuff.h says that:

 * Various parts of the networking layer expect at least 32 bytes of
 * headroom, you should not reduce this.

This was demonstrated by a panic when handling fragmented IPv6 packets:
http://marc.info/?l=linux-netdev&m=144236093519172&w=2

It's not entirely clear if that comment is still valid — and if it is,
perhaps netif_rx() ought to be enforcing it with a warning.

But either way, it is rather stupid from a performance point of view
for us to be receiving packets into a buffer which doesn't have enough
room to prepend an Ethernet header — it means that *every* incoming
packet is going to be need to be reallocated. So let's fix that.

Signed-off-by: David Woodhouse 
---
For CC and trunk please. Related to Trac #20532. This works around the
panic seen there, and potentially others that aren't yet fixed. But
really it *ought* to be just a performance fix to avoid buffer
reallocations.

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 74e18b0..3d7fb65 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -805,7 +805,12 @@ static void solos_bh(unsigned long card_arg)
continue;
}
 
-   skb = alloc_skb(size + 1, GFP_ATOMIC);
+   /* Use netdev_alloc_skb() because it adds 
NET_SKB_PAD of
+* headroom, and ensures we can route packets 
back out an
+* Ethernet interface (for example) without 
having to
+* reallocate. Adding NET_IP_ALIGN also ensures 
that both
+* PPPoATM and PPPoEoBR2684 packets end up 
aligned. */
+   skb = netdev_alloc_skb_ip_align(NULL, size + 1);
if (!skb) {
if (net_ratelimit())
dev_warn(&card->dev->dev, 
"Failed to allocate sk_buff for RX\n");
@@ -869,7 +874,10 @@ static void solos_bh(unsigned long card_arg)
/* Allocate RX skbs for any ports which need them */
if (card->using_dma && card->atmdev[port] &&
!card->rx_skb[port]) {
-   struct sk_buff *skb = alloc_skb(RX_DMA_SIZE, 
GFP_ATOMIC);
+   /* Unlike the MMIO case (qv) we can't add NET_IP_ALIGN
+* here; the FPGA can only DMA to addresses which are
+* aligned to 4 bytes. */
+   struct sk_buff *skb = dev_alloc_skb(RX_DMA_SIZE);
if (skb) {
SKB_CB(skb)->dma_addr =
dma_map_single(&card->dev->dev, 
skb->data,



-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ipv6: ip6_fragment: fix headroom tests and skb leak

2015-09-17 Thread David Woodhouse
From: Florian Westphal 

David Woodhouse reports skb_under_panic when we try to push ethernet
header to fragmented ipv6 skbs:

 skbuff: skb_under_panic: text:c1277f1e len:1294 put:14 head:dec98000
 data:dec97ffc tail:0xdec9850a end:0xdec98f40 dev:br-lan
[..]
ip6_finish_output2+0x196/0x4da

David further debugged this:
  [..] offending fragments were arriving here with skb_headroom(skb)==10.
  Which is reasonable, being the Solos ADSL card's header of 8 bytes
  followed by 2 bytes of PPP frame type.

The problem is that if netfilter ipv6 defragmentation is used, skb_cow()
in ip6_forward will only see reassembled skb.

Therefore, headroom is overestimated by 8 bytes (we pulled fragment
header) and we don't check the skbs in the frag_list either.

We can't do these checks in netfilter defrag since outdev isn't known yet.

Furthermore, existing tests in ip6_fragment did not consider the fragment
or ipv6 header size when checking headroom of the fraglist skbs.

While at it, also fix a skb leak on memory allocation -- ip6_fragment
must consume the skb.

I tested this e1000 driver hacked to not allocate additional headroom
(we end up in slowpath, since LL_RESERVED_SPACE is 16).

If 2 bytes of headroom are allocated, fastpath is taken (14 byte
ethernet header was pulled, so 16 byte headroom available in all
fragments).

Reported-by: David Woodhouse 
Diagnosed-by: David Woodhouse 
Signed-off-by: Florian Westphal 
Closes 20532
---
For CC and trunk, at least. In fact if I boot my router back into its
AA partition I can crash it the same way.

 net/ipv6/ip6_output.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 26ea479..92b1aa3 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -586,20 +586,22 @@ int ip6_fragment(struct sock *sk, struct sk_buff *skb,
frag_id = ipv6_select_ident(net, &ipv6_hdr(skb)->daddr,
&ipv6_hdr(skb)->saddr);
 
+   hroom = LL_RESERVED_SPACE(rt->dst.dev);
if (skb_has_frag_list(skb)) {
int first_len = skb_pagelen(skb);
struct sk_buff *frag2;
 
if (first_len - hlen > mtu ||
((first_len - hlen) & 7) ||
-   skb_cloned(skb))
+   skb_cloned(skb) ||
+   skb_headroom(skb) < (hroom + sizeof(struct frag_hdr)))
goto slow_path;
 
skb_walk_frags(skb, frag) {
/* Correct geometry. */
if (frag->len > mtu ||
((frag->len & 7) && frag->next) ||
-   skb_headroom(frag) < hlen)
+   skb_headroom(frag) < (hlen + hroom + sizeof(struct 
frag_hdr)))
goto slow_path_clean;
 
/* Partially cloned skb? */
@@ -616,8 +618,6 @@ int ip6_fragment(struct sock *sk, struct sk_buff *skb,
 
err = 0;
offset = 0;
-   frag = skb_shinfo(skb)->frag_list;
-   skb_frag_list_init(skb);
/* BUILD HEADER */
 
*prevhdr = NEXTHDR_FRAGMENT;
@@ -625,8 +625,11 @@ int ip6_fragment(struct sock *sk, struct sk_buff *skb,
if (!tmp_hdr) {
IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
  IPSTATS_MIB_FRAGFAILS);
-   return -ENOMEM;
+   err = -ENOMEM;
+   goto fail;
}
+   frag = skb_shinfo(skb)->frag_list;
+   skb_frag_list_init(skb);
 
__skb_pull(skb, hlen);
fh = (struct frag_hdr *)__skb_push(skb, sizeof(struct 
frag_hdr));
@@ -723,7 +726,6 @@ slow_path:
 */
 
*prevhdr = NEXTHDR_FRAGMENT;
-   hroom = LL_RESERVED_SPACE(rt->dst.dev);
troom = rt->dst.dev->needed_tailroom;
 
/*
-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] What happened to nut UPS config? (#20515)

2015-09-17 Thread David Woodhouse
In my old AA setup, the nut package had an init script which built
ups.conf and upsd.users from the configuration in /etc/config, before
starting the dæmons.

Having just upgraded to CC, this no longer happens, and the UPS isn't
configured. What happened? Is this just an oversight, and should I
submit a patch to reinstate the configuration handling? Or was there a
plan...?

There follows a few other patches to fix other breakage, and I've
worked around the config problem for now by editing the files in
/etc/nut in my (writeable) root file system.

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] luci/statistics: Fix nut UPS graphs

2015-09-17 Thread David Woodhouse
At some point since I last checked, the nut plugin for collectd changed the
names of the timeleft and percent datasets. Update the luci module to match
so that those graphs are generated correctly again.

Signed-off-by: David Woodhouse 
---
Trunk and CC please.

 .../luasrc/statistics/rrdtool/definitions/nut.lua   | 6 --
 1 file changed, 6 deletions(-)

diff --git 
a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua
 
b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua
index 6dc81bc..8b04ab8 100644
--- 
a/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua
+++ 
b/applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/nut.lua
@@ -44,9 +44,6 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
y_max = "100",
number_format = "%5.1lf%%",
data = {
-   sources = {
-   percent = { "percent" }
-   },
instances = {
percent = "charge"
},
@@ -77,9 +74,6 @@ function rrdargs( graph, plugin, plugin_instance, dtype )
vlabel = "Minutes",
number_format = "%.1lfm",
data = {
-   sources = {
-   timeleft = { "timeleft" }
-   },
instances = {
timeleft = { "battery" }
},
-- 
2.4.3

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] packages/nut: Install dev headers

2015-09-17 Thread David Woodhouse
The collectd plugin for nut needs these.

Signed-off-by: David Woodhouse 
---
For CC and trunk please.

 net/nut/Makefile | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/net/nut/Makefile b/net/nut/Makefile
index 32a3e13..855b0d1 100644
--- a/net/nut/Makefile
+++ b/net/nut/Makefile
@@ -269,6 +269,7 @@ $(eval $(call DriverDescription,usb,nutdrv_qx,\
Driver for Q* protocol serial and USB based UPS equipment))
 
 CONFIGURE_ARGS += \
+   --with-dev \
--$(if $(CONFIG_NUT_DRIVER_SERIAL),with,without)-serial \
--$(if $(CONFIG_NUT_DRIVER_USB),with,without)-usb \
--$(if $(CONFIG_NUT_DRIVER_SNMP),with,without)-snmp \
@@ -286,6 +287,19 @@ CONFIGURE_ARGS += \
--with-statepath=/var/run \
--datadir=/usr/share/nut
 
+define Build/InstallDev
+   $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
+   $(CP) \
+   $(PKG_INSTALL_DIR)/usr/lib/lib*.so* \
+   $(1)/usr/lib/
+   $(CP) \
+   $(PKG_INSTALL_DIR)/usr/include/*.h \
+   $(1)/usr/include/
+   $(CP) \
+   $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc \
+   $(1)/usr/lib/pkgconfig/
+endef
+
 $(eval $(call BuildPackage,nut))
 $(foreach d,$(filter-out 
$(SERIAL_DRIVERLIST_IGNORE),$(SERIAL_DRIVERLIST)),$(eval $(call 
BuildPackage,nut-driver-$(d
 $(foreach d,$(SNMP_DRIVERLIST),$(eval $(call BuildPackage,nut-driver-$(d
-- 
2.4.3

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] collectd: enable nut plugin

2015-09-17 Thread David Woodhouse
Signed-off-by: David Woodhouse 
---
For trunk; a separate patch has a minor change to make it apply to CC.

 utils/collectd/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile
index 03f3001..04b1e6d 100644
--- a/utils/collectd/Makefile
+++ b/utils/collectd/Makefile
@@ -60,7 +60,6 @@ COLLECTD_PLUGINS_DISABLED:= \
notify_desktop \
notify_email \
numa \
-   nut \
openldap \
openvz \
oracle \
@@ -126,6 +125,7 @@ COLLECTD_PLUGINS_SELECTED:= \
network \
nginx \
ntpd \
+   nut \
olsrd \
onewire \
openvpn \
@@ -318,7 +318,7 @@ $(eval $(call BuildPlugin,netlink,netlink 
input,netlink,+PACKAGE_collectd-mod-ne
 $(eval $(call BuildPlugin,network,network input/output,network))
 $(eval $(call BuildPlugin,nginx,nginx status 
input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
-#$(eval $(call BuildPlugin,nut,UPS monitoring 
input,nut,+PACKAGE_collectd-mod-nut:nut))
+$(eval $(call BuildPlugin,nut,UPS monitoring 
input,nut,+PACKAGE_collectd-mod-nut:nut))
 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
 $(eval $(call BuildPlugin,onewire,onewire sensor 
input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
-- 
2.4.3

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][CC] collectd: enable nut plugin

2015-09-17 Thread David Woodhouse
Signed-off-by: David Woodhouse 
---
For CC please.

diff --git a/utils/collectd/Makefile b/utils/collectd/Makefile
index 61b05a8..b638372 100644
--- a/utils/collectd/Makefile
+++ b/utils/collectd/Makefile
@@ -55,7 +55,6 @@ COLLECTD_PLUGINS_DISABLED:= \
notify_desktop \
notify_email \
numa \
-   nut \
openvz \
oracle \
perl \
@@ -112,6 +111,7 @@ COLLECTD_PLUGINS_SELECTED:= \
network \
nginx \
ntpd \
+   nut \
olsrd \
onewire \
openvpn \
@@ -303,7 +303,7 @@ $(eval $(call BuildPlugin,netlink,netlink 
input,netlink,+PACKAGE_collectd-mod-ne
 $(eval $(call BuildPlugin,network,network input/output,network))
 $(eval $(call BuildPlugin,nginx,nginx status 
input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
-#$(eval $(call BuildPlugin,nut,UPS monitoring 
input,nut,+PACKAGE_collectd-mod-nut:nut))
+$(eval $(call BuildPlugin,nut,UPS monitoring 
input,nut,+PACKAGE_collectd-mod-nut:nut))
 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
 $(eval $(call BuildPlugin,onewire,onewire sensor 
input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation



smime.p7s
Description: S/MIME cryptographic signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] OpenWRT 15.05:bcm2708 device tree

2015-09-17 Thread Álvaro Fernández Rojas

Hi Jernej,

Device tree is not supported on CC-15.05 release, but it is supported in 
trunk.


Regards,
Álvaro.

El 17/09/2015 a las 11:40, Jernej Izak escribió:


Hi,

I’m trying to activate device tree on OpenWRT 15.05 released version 
with bcm2708 platform (raspberry pi).


I activated it in kernel_menuconfig, but after building there is no 
dtb file on boot partition of sd card.


Is there any patch to fix the issue, or device tree is really not jet 
supported?


Best Regards

Jernej Izak



___
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] [PATCH procd] cmake: use CMAKE_INSTALL_* variables

2015-09-17 Thread Sergiy Kibrik
Replace hard-coded installation directories with cmake-provided
variables, which gives more flexibility on where to install
final binaries. Great simplification for usage with e.g. BitBake recipes.

Signed-off-by: Sergiy Kibrik 
---
 CMakeLists.txt | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6af17a3..78824e2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ ENDIF()
 
 ADD_LIBRARY(setlbf SHARED service/setlbf.c)
 INSTALL(TARGETS setlbf
-   LIBRARY DESTINATION lib
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
 )
 
 
@@ -39,7 +39,7 @@ ENDIF()
 ADD_EXECUTABLE(procd ${SOURCES})
 TARGET_LINK_LIBRARIES(procd ${LIBS})
 INSTALL(TARGETS procd
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 
 
@@ -47,19 +47,19 @@ ADD_EXECUTABLE(init initd/init.c initd/early.c 
initd/preinit.c initd/mkdev.c wat
utils/utils.c ${SOURCES_ZRAM})
 TARGET_LINK_LIBRARIES(init ${LIBS})
 INSTALL(TARGETS init
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 
 
 ADD_EXECUTABLE(udevtrigger plug/udevtrigger.c)
 INSTALL(TARGETS udevtrigger
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 
 
 ADD_EXECUTABLE(askfirst utils/askfirst.c)
 INSTALL(TARGETS askfirst
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 
 ADD_CUSTOM_COMMAND(
@@ -73,7 +73,7 @@ IF(SECCOMP_SUPPORT)
 ADD_LIBRARY(preload-seccomp SHARED jail/preload.c jail/seccomp.c)
 TARGET_LINK_LIBRARIES(preload-seccomp dl ubox blobmsg_json)
 INSTALL(TARGETS preload-seccomp
-   LIBRARY DESTINATION lib
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
 )
 ADD_DEPENDENCIES(preload-seccomp headers)
 endif()
@@ -82,19 +82,19 @@ IF(JAIL_SUPPORT)
 ADD_EXECUTABLE(ujail jail/jail.c jail/elf.c)
 TARGET_LINK_LIBRARIES(ujail ubox)
 INSTALL(TARGETS ujail
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 
 ADD_EXECUTABLE(utrace trace/trace.c)
 TARGET_LINK_LIBRARIES(utrace ubox ${json} blobmsg_json)
 INSTALL(TARGETS utrace
-   RUNTIME DESTINATION sbin
+   RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
 )
 ADD_DEPENDENCIES(utrace headers)
 
 ADD_LIBRARY(preload-trace SHARED trace/preload.c)
 TARGET_LINK_LIBRARIES(preload-trace dl)
 INSTALL(TARGETS preload-trace
-   LIBRARY DESTINATION lib
+   LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
 )
 endif()
-- 
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] base-files: fix ramoverlay function with kernels 3.18+

2015-09-17 Thread Helmut Schaa
Even though there are not many users left within the OpenWrt tree it seems
this function broke during the kernel 3.18 transition.

Fix it by providing a workdir as required by overlayfs.

Signed-off-by: Helmut Schaa 
---
 package/base-files/files/lib/functions/preinit.sh | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/lib/functions/preinit.sh 
b/package/base-files/files/lib/functions/preinit.sh
index db1f298..57862a1 100644
--- a/package/base-files/files/lib/functions/preinit.sh
+++ b/package/base-files/files/lib/functions/preinit.sh
@@ -75,13 +75,14 @@ pivot() { #  
}
 }
 
-fopivot() { #   
-   /bin/mount -o noatime,lowerdir=/,upperdir=$1 -t overlayfs 
"overlayfs:$1" /mnt
-   pivot /mnt $2
+fopivot() { #
+   /bin/mount -o noatime,lowerdir=/,upperdir=$1,workdir=$2 -t overlay 
"overlayfs:$1" /mnt
+   pivot /mnt $3
 }
 
 ramoverlay() {
mkdir -p /tmp/root
/bin/mount -t tmpfs -o noatime,mode=0755 root /tmp/root
-   fopivot /tmp/root /rom 1
+   mkdir -p /tmp/root/root /tmp/root/work
+   fopivot /tmp/root/root /tmp/root/work /rom 1
 }
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: Add eth rx delay for qca955x platforms

2015-09-17 Thread Chris Blake
This patch is to add support for qca955x_eth_rx_delay to work with the
qca955x SoC.

Signed-off-by: Chris R Blake 

---
--- a/arch/mips/ath79/dev-eth.c
+++ b/arch/mips/ath79/dev-eth.c
@@ -823,6 +825,32 @@
  iounmap(base);
 }

+void __init ath79_setup_qca955x_eth_rx_delay(unsigned int rxd,
+  unsigned int rxdv)
+{
+ void __iomem *base;
+ u32 t;
+
+ rxd &= QCA955X_ETH_CFG_RXD_DELAY_MASK;
+ rxdv &= QCA955X_ETH_CFG_RDV_DELAY_MASK;
+
+ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
+
+ t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
+
+ t &= ~(QCA955X_ETH_CFG_RXD_DELAY_MASK << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
+   QCA955X_ETH_CFG_RDV_DELAY_MASK << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
+
+ t |= (rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
+  rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
+
+ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
+ /* flush write */
+ __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
+
+ iounmap(base);
+}
+
 static int ath79_eth_instance __initdata;
 void __init ath79_register_eth(unsigned int id)
 {
--- a/arch/mips/ath79/dev-eth.h
+++ b/arch/mips/ath79/dev-eth.h
@@ -49,5 +49,6 @@
 void ath79_setup_ar934x_eth_cfg(u32 mask);
 void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
 void ath79_setup_qca955x_eth_cfg(u32 mask);
+void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);

 #endif /* _ATH79_DEV_ETH_H */
--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
@@ -1098,5 +1098,11 @@

 #define QCA955X_ETH_CFG_RGMII_EN BIT(0)
 #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
+#define QCA955X_ETH_CFG_RXD_DELAY BIT(14)
+#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3
+#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14
+#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
+#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
+#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16

 #endif /* __ASM_MACH_AR71XX_REGS_H */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: add support for qca955x sgmii/serdes calibration

2015-09-17 Thread Chris Blake
This patch is to add support for sgmii/serdes calibration from within the
OpenWRT environment. This is needed on boards that do not use u-boot or do
not have a pre-init process that runs calibration.

Signed-off-by: Chris R Blake 

---

--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
12:58:15.580496899 +0200
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
13:52:32.590857293 +0200
@@ -360,6 +360,7 @@
 #define QCA955X_PLL_CLK_CTRL_REG 0x08
 #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
 #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
+#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c

 #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
 #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
@@ -392,6 +393,10 @@
 #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
 #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)

+#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
+#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
+#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
+
 #define QCA956X_PLL_CPU_CONFIG_REG 0x00
 #define QCA956X_PLL_CPU_CONFIG1_REG 0x04
 #define QCA956X_PLL_DDR_CONFIG_REG 0x08
@@ -1104,5 +1109,11 @@
 #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
 #define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
 #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
+
+#define QCA955X_GMAC_REG_SGMII_SERDES 0x0018
+#define QCA955X_SGMII_SERDES_RES_CALIBRATION BIT(23)
+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
+#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
+#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)

 #endif /* __ASM_MACH_AR71XX_REGS_H */
--- a/arch/mips/ath79/dev-eth.c 2015-08-05 14:17:25.757504251 +0200
+++ b/arch/mips/ath79/dev-eth.c 2015-08-05 14:09:54.716333554 +0200
@@ -849,6 +849,37 @@ void __init ath79_setup_qca955x_eth_rx_d
  iounmap(base);
 }

+void __init ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value)
+{
+ void __iomem *ethbase, *pllbase;
+ u32 t;
+
+ ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
+ pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
+
+ /* To Check the locking of the SGMII PLL */
+ t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
+ t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK <<
+   QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
+ t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) <<
+ QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
+ __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
+
+ __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT |
+ QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK |
+ QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL,
+ pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG);
+
+ ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG);
+ ath79_device_reset_clear(QCA955X_RESET_SGMII);
+
+ while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) &
+ QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS));
+
+ iounmap(ethbase);
+ iounmap(pllbase);
+}
+
 static int ath79_eth_instance __initdata;
 void __init ath79_register_eth(unsigned int id)
 {
--- a/arch/mips/ath79/dev-eth.h 2015-08-05 14:17:25.757504251 +0200
+++ b/arch/mips/ath79/dev-eth.h 2015-08-05 13:58:20.292866210 +0200
@@ -50,5 +50,6 @@ void ath79_setup_ar934x_eth_cfg(u32 mask
 void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
 void ath79_setup_qca955x_eth_cfg(u32 mask);
 void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+void ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value);

 #endif /* _ATH79_DEV_ETH_H */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: add support for qca955x sgmii/serdes calibration

2015-09-17 Thread Chris Blake
Scratch this, this is suppose to be in a patch file in
./target/linux/ar71xx/patches-4.1/, will rebase later.

On Thu, Sep 17, 2015 at 7:38 AM, Chris Blake 
wrote:

> This patch is to add support for sgmii/serdes calibration from within the
> OpenWRT environment. This is needed on boards that do not use u-boot or do
> not have a pre-init process that runs calibration.
>
> Signed-off-by: Chris R Blake 
>
> ---
>
> --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
> 12:58:15.580496899 +0200
> +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
> 13:52:32.590857293 +0200
> @@ -360,6 +360,7 @@
>  #define QCA955X_PLL_CLK_CTRL_REG 0x08
>  #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
>  #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
> +#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
>
>  #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
>  #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
> @@ -392,6 +393,10 @@
>  #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
>  #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
>
> +#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
> +#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
> +#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
> +
>  #define QCA956X_PLL_CPU_CONFIG_REG 0x00
>  #define QCA956X_PLL_CPU_CONFIG1_REG 0x04
>  #define QCA956X_PLL_DDR_CONFIG_REG 0x08
> @@ -1104,5 +1109,11 @@
>  #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
>  #define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
>  #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
> +
> +#define QCA955X_GMAC_REG_SGMII_SERDES 0x0018
> +#define QCA955X_SGMII_SERDES_RES_CALIBRATION BIT(23)
> +#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
> +#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
> +#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
>
>  #endif /* __ASM_MACH_AR71XX_REGS_H */
> --- a/arch/mips/ath79/dev-eth.c 2015-08-05 14:17:25.757504251 +0200
> +++ b/arch/mips/ath79/dev-eth.c 2015-08-05 14:09:54.716333554 +0200
> @@ -849,6 +849,37 @@ void __init ath79_setup_qca955x_eth_rx_d
>   iounmap(base);
>  }
>
> +void __init ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value)
> +{
> + void __iomem *ethbase, *pllbase;
> + u32 t;
> +
> + ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
> + pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
> +
> + /* To Check the locking of the SGMII PLL */
> + t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
> + t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK <<
> +   QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
> + t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) <<
> + QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
> + __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
> +
> + __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT |
> + QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK |
> + QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL,
> + pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG);
> +
> + ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG);
> + ath79_device_reset_clear(QCA955X_RESET_SGMII);
> +
> + while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) &
> + QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS));
> +
> + iounmap(ethbase);
> + iounmap(pllbase);
> +}
> +
>  static int ath79_eth_instance __initdata;
>  void __init ath79_register_eth(unsigned int id)
>  {
> --- a/arch/mips/ath79/dev-eth.h 2015-08-05 14:17:25.757504251 +0200
> +++ b/arch/mips/ath79/dev-eth.h 2015-08-05 13:58:20.292866210 +0200
> @@ -50,5 +50,6 @@ void ath79_setup_ar934x_eth_cfg(u32 mask
>  void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
>  void ath79_setup_qca955x_eth_cfg(u32 mask);
>  void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int
> rxdv);
> +void ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value);
>
>  #endif /* _ATH79_DEV_ETH_H */
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ar71xx: Add eth rx delay for qca955x platforms

2015-09-17 Thread Chris Blake
Scratch this, this is suppose to be in a patch file in
./target/linux/ar71xx/patches-4.1/, will rebase later.

On Thu, Sep 17, 2015 at 7:30 AM, Chris Blake 
wrote:

> This patch is to add support for qca955x_eth_rx_delay to work with the
> qca955x SoC.
>
> Signed-off-by: Chris R Blake 
>
> ---
> --- a/arch/mips/ath79/dev-eth.c
> +++ b/arch/mips/ath79/dev-eth.c
> @@ -823,6 +825,32 @@
>   iounmap(base);
>  }
>
> +void __init ath79_setup_qca955x_eth_rx_delay(unsigned int rxd,
> +  unsigned int rxdv)
> +{
> + void __iomem *base;
> + u32 t;
> +
> + rxd &= QCA955X_ETH_CFG_RXD_DELAY_MASK;
> + rxdv &= QCA955X_ETH_CFG_RDV_DELAY_MASK;
> +
> + base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
> +
> + t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
> +
> + t &= ~(QCA955X_ETH_CFG_RXD_DELAY_MASK << QCA955X_ETH_CFG_RXD_DELAY_SHIFT
> |
> +   QCA955X_ETH_CFG_RDV_DELAY_MASK << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
> +
> + t |= (rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
> +  rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
> +
> + __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
> + /* flush write */
> + __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
> +
> + iounmap(base);
> +}
> +
>  static int ath79_eth_instance __initdata;
>  void __init ath79_register_eth(unsigned int id)
>  {
> --- a/arch/mips/ath79/dev-eth.h
> +++ b/arch/mips/ath79/dev-eth.h
> @@ -49,5 +49,6 @@
>  void ath79_setup_ar934x_eth_cfg(u32 mask);
>  void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
>  void ath79_setup_qca955x_eth_cfg(u32 mask);
> +void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int
> rxdv);
>
>  #endif /* _ATH79_DEV_ETH_H */
> --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
> @@ -1098,5 +1098,11 @@
>
>  #define QCA955X_ETH_CFG_RGMII_EN BIT(0)
>  #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
> +#define QCA955X_ETH_CFG_RXD_DELAY BIT(14)
> +#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3
> +#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14
> +#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
> +#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
> +#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
>
>  #endif /* __ASM_MACH_AR71XX_REGS_H */
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] libnl: split into smaller libraries

2015-09-17 Thread Alexandru Ardelean
From: Alexandru Ardelean 

The idea is that we may only need the libnl core, 
or libnl-route or libnl-nf libs, but maybe not all of them.

This way we can select which ones we need without bloating the
firmware image too much.

Signed-off-by: Alexandru Ardelean 
---
 package/libs/libnl/Makefile | 62 -
 1 file changed, 56 insertions(+), 6 deletions(-)

diff --git a/package/libs/libnl/Makefile b/package/libs/libnl/Makefile
index 995fda2..4cdcfba 100644
--- a/package/libs/libnl/Makefile
+++ b/package/libs/libnl/Makefile
@@ -18,16 +18,51 @@ PKG_LICENSE:=LGPL-2.1
 
 include $(INCLUDE_DIR)/package.mk
 
-define Package/libnl
+define Package/libnl/default
   SECTION:=libs
   CATEGORY:=Libraries
-  TITLE:=netlink socket library
-  DEPENDS:=+libpthread
   URL:=http://people.suug.ch/~tgr/libnl/
 endef
 
+define Package/libnl
+$(call Package/libnl/default)
+  TITLE:=Core Netlink Library
+  DEPENDS:=+libpthread
+endef
+
+define Package/libnl-genl
+$(call Package/libnl/default)
+  TITLE:=Generic Netlink Library
+  DEPENDS:=+libnl
+endef
+
+define Package/libnl-nf
+$(call Package/libnl/default)
+  TITLE:=Netfilter Netlink Library
+  DEPENDS:=+libnl
+endef
+
+define Package/libnl-route
+$(call Package/libnl/default)
+  TITLE:=Routing Netlink Library
+  DEPENDS:=+libnl
+endef
+
 define Package/libnl/description
- This package contains a library for applications dealing with netlink sockets
+ Socket handling, connection management, sending and receiving of data,
+ message construction and parsing, object caching system, etc.
+endef
+
+define Package/libnl-genl/description
+ Generic Netlink Library Functions
+endef
+
+define Package/libnl-nf/description
+ Netfilter Netlink Library Functions
+endef
+
+define Package/libnl-route/description
+ Routing Netlink Library Functions
 endef
 
 TARGET_CFLAGS += -ffunction-sections $(FPIC)
@@ -48,10 +83,25 @@ endef
 
 define Package/libnl/install
$(INSTALL_DIR) $(1)/usr/lib
-   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so.* $(1)/usr/lib/
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so.* $(1)/usr/lib/
+endef
+
+define Package/libnl-genl/install
+   $(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-genl-3.so.* $(1)/usr/lib/
+endef
+
+define Package/libnl-nf/install
+   $(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-nf-3.so.* $(1)/usr/lib/
-   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-3.so.* $(1)/usr/lib/
+endef
+
+define Package/libnl-route/install
+   $(INSTALL_DIR) $(1)/usr/lib
+   $(CP) $(PKG_INSTALL_DIR)/usr/lib/libnl-route-3.so.* $(1)/usr/lib/
 endef
 
 $(eval $(call BuildPackage,libnl))
+$(eval $(call BuildPackage,libnl-genl))
+$(eval $(call BuildPackage,libnl-nf))
+$(eval $(call BuildPackage,libnl-route))
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] ar71xx: add support for qca955x sgmii/serdes calibration

2015-09-17 Thread Chris Blake
This patch is to add support for sgmii/serdes calibration from within the
OpenWRT environment. This is needed on boards that do not use u-boot or do
not have a pre-init process that runs calibration.

Signed-off-by: Chris R Blake 

---

diff -rupN
a/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
---
a/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
1969-12-31 18:00:00.0 -0600
+++
b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
2015-09-17 07:49:54.0 -0500
@@ -0,0 +1,82 @@
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
12:58:15.580496899 +0200
 b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
13:52:32.590857293 +0200
+@@ -360,6 +360,7 @@
+ #define QCA955X_PLL_CLK_CTRL_REG 0x08
+ #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
+ #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
++#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
+
+ #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
+ #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
+@@ -392,6 +393,10 @@
+ #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
+ #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
+
++#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
++#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
++#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
++
+ #define QCA956X_PLL_CPU_CONFIG_REG 0x00
+ #define QCA956X_PLL_CPU_CONFIG1_REG 0x04
+ #define QCA956X_PLL_DDR_CONFIG_REG 0x08
+@@ -1104,5 +1109,11 @@
+ #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
+ #define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
+ #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
++
++#define QCA955X_GMAC_REG_SGMII_SERDES 0x0018
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION BIT(23)
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
++#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
+
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
+--- a/arch/mips/ath79/dev-eth.c 2015-08-05 14:17:25.757504251 +0200
 b/arch/mips/ath79/dev-eth.c 2015-08-05 14:09:54.716333554 +0200
+@@ -849,6 +849,37 @@ void __init ath79_setup_qca955x_eth_rx_d
+ iounmap(base);
+ }
+
++void __init ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value)
++{
++ void __iomem *ethbase, *pllbase;
++ u32 t;
++
++ ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
++ pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
++
++ /* To Check the locking of the SGMII PLL */
++ t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
++ t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK <<
++   QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
++ t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) <<
++ QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
++ __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
++
++ __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT |
++ QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK |
++ QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL,
++ pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG);
++
++ ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG);
++ ath79_device_reset_clear(QCA955X_RESET_SGMII);
++
++ while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) &
++ QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS));
++
++ iounmap(ethbase);
++ iounmap(pllbase);
++}
++
+ static int ath79_eth_instance __initdata;
+ void __init ath79_register_eth(unsigned int id)
+ {
+--- a/arch/mips/ath79/dev-eth.h 2015-08-05 14:17:25.757504251 +0200
 b/arch/mips/ath79/dev-eth.h 2015-08-05 13:58:20.292866210 +0200
+@@ -50,5 +50,6 @@ void ath79_setup_ar934x_eth_cfg(u32 mask
+ void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+ void ath79_setup_qca955x_eth_cfg(u32 mask);
+ void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int
rxdv);
++void ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value);
+
+ #endif /* _ATH79_DEV_ETH_H */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] dropbear: add respawn param in case dropbear crashes

2015-09-17 Thread Alexandru Ardelean
Signed-off-by: Alexandru Ardelean 
---
 package/network/services/dropbear/files/dropbear.init | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/dropbear/files/dropbear.init 
b/package/network/services/dropbear/files/dropbear.init
index 01d88af..03745c9 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -79,6 +79,7 @@ dropbear_instance()
[ "${IdleTimeout}" -ne 0 ] && procd_append_param command -I 
"${IdleTimeout}"
[ "${SSHKeepAlive}" -ne 0 ] && procd_append_param command -K 
"${SSHKeepAlive}"
[ "${mdns}" -ne 0 ] && procd_add_mdns "ssh" "tcp" "$Port" 
"daemon=dropbear"
+   procd_set_param respawn
procd_close_instance
 }
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] ar71xx: Add eth rx delay for qca955x platforms

2015-09-17 Thread Chris Blake
This patch is to add support for qca955x_eth_rx_delay to work with the
qca955x SoC.

Signed-off-by: Chris R Blake 

---
diff -rupN
a/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
---
a/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
1969-12-31 18:00:00.0 -0600
+++
b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
2015-09-17 07:50:06.0 -0500
@@ -0,0 +1,58 @@
+--- a/arch/mips/ath79/dev-eth.c
 b/arch/mips/ath79/dev-eth.c
+@@ -823,6 +825,32 @@
+ iounmap(base);
+ }
+
++void __init ath79_setup_qca955x_eth_rx_delay(unsigned int rxd,
++  unsigned int rxdv)
++{
++ void __iomem *base;
++ u32 t;
++
++ rxd &= QCA955X_ETH_CFG_RXD_DELAY_MASK;
++ rxdv &= QCA955X_ETH_CFG_RDV_DELAY_MASK;
++
++ base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
++
++ t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
++
++ t &= ~(QCA955X_ETH_CFG_RXD_DELAY_MASK << QCA955X_ETH_CFG_RXD_DELAY_SHIFT
|
++   QCA955X_ETH_CFG_RDV_DELAY_MASK << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
++
++ t |= (rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
++  rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
++
++ __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
++ /* flush write */
++ __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
++
++ iounmap(base);
++}
++
+ static int ath79_eth_instance __initdata;
+ void __init ath79_register_eth(unsigned int id)
+ {
+--- a/arch/mips/ath79/dev-eth.h
 b/arch/mips/ath79/dev-eth.h
+@@ -49,5 +49,6 @@
+ void ath79_setup_ar934x_eth_cfg(u32 mask);
+ void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+ void ath79_setup_qca955x_eth_cfg(u32 mask);
++void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int
rxdv);
+
+ #endif /* _ATH79_DEV_ETH_H */
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -1098,5 +1098,11 @@
+
+ #define QCA955X_ETH_CFG_RGMII_EN BIT(0)
+ #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
++#define QCA955X_ETH_CFG_RXD_DELAY BIT(14)
++#define QCA955X_ETH_CFG_RXD_DELAY_MASK 0x3
++#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT 14
++#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
++#define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
++#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
+
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] ar71xx: add support for qca955x sgmii/serdes calibration

2015-09-17 Thread John Crispin
Hi,

both patches are whitespace broken.

John

On 17/09/2015 15:08, Chris Blake wrote:
> This patch is to add support for sgmii/serdes calibration from within
> the OpenWRT environment. This is needed on boards that do not use u-boot
> or do not have a pre-init process that runs calibration.
> 
> Signed-off-by: Chris R Blake  >
> 
> ---
> 
> diff -rupN
> a/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
> b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
> ---
> a/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
> 1969-12-31 18:00:00.0 -0600
> +++
> b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
> 2015-09-17 07:49:54.0 -0500
> @@ -0,0 +1,82 @@
> +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
> 12:58:15.580496899 +0200
>  b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h 2015-08-05
> 13:52:32.590857293 +0200
> +@@ -360,6 +360,7 @@
> + #define QCA955X_PLL_CLK_CTRL_REG 0x08
> + #define QCA955X_PLL_ETH_XMII_CONTROL_REG 0x28
> + #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
> ++#define QCA955X_PLL_ETH_SGMII_SERDES_REG 0x4c
> +
> + #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT 0
> + #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
> +@@ -392,6 +393,10 @@
> + #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL BIT(21)
> + #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL BIT(24)
> +
> ++#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT BIT(2)
> ++#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK BIT(1)
> ++#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL BIT(0)
> ++
> + #define QCA956X_PLL_CPU_CONFIG_REG 0x00
> + #define QCA956X_PLL_CPU_CONFIG1_REG 0x04
> + #define QCA956X_PLL_DDR_CONFIG_REG 0x08
> +@@ -1104,5 +1109,11 @@
> + #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
> + #define QCA955X_ETH_CFG_RDV_DELAY_MASK 0x3
> + #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT 16
> ++
> ++#define QCA955X_GMAC_REG_SGMII_SERDES 0x0018
> ++#define QCA955X_SGMII_SERDES_RES_CALIBRATION BIT(23)
> ++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
> ++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT 23
> ++#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS BIT(15)
> +
> + #endif /* __ASM_MACH_AR71XX_REGS_H */
> +--- a/arch/mips/ath79/dev-eth.c 2015-08-05 14:17:25.757504251 +0200
>  b/arch/mips/ath79/dev-eth.c 2015-08-05 14:09:54.716333554 +0200
> +@@ -849,6 +849,37 @@ void __init ath79_setup_qca955x_eth_rx_d
> + iounmap(base);
> + }
> +
> ++void __init ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value)
> ++{
> ++ void __iomem *ethbase, *pllbase;
> ++ u32 t;
> ++
> ++ ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
> ++ pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
> ++
> ++ /* To Check the locking of the SGMII PLL */
> ++ t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
> ++ t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK <<
> ++   QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
> ++ t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) <<
> ++ QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
> ++ __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
> ++
> ++ __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT |
> ++ QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK |
> ++ QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL,
> ++ pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG);
> ++
> ++ ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG);
> ++ ath79_device_reset_clear(QCA955X_RESET_SGMII);
> ++
> ++ while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) &
> ++ QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS));
> ++
> ++ iounmap(ethbase);
> ++ iounmap(pllbase);
> ++}
> ++
> + static int ath79_eth_instance __initdata;
> + void __init ath79_register_eth(unsigned int id)
> + {
> +--- a/arch/mips/ath79/dev-eth.h 2015-08-05 14:17:25.757504251 +0200
>  b/arch/mips/ath79/dev-eth.h 2015-08-05 13:58:20.292866210 +0200
> +@@ -50,5 +50,6 @@ void ath79_setup_ar934x_eth_cfg(u32 mask
> + void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
> + void ath79_setup_qca955x_eth_cfg(u32 mask);
> + void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int
> rxdv);
> ++void ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value);
> +
> + #endif /* _ATH79_DEV_ETH_H */
> 
> 
> ___
> 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] libnl: split into smaller libraries

2015-09-17 Thread Felix Fietkau
On 2015-09-17 15:05, Alexandru Ardelean wrote:
> From: Alexandru Ardelean 
> 
> The idea is that we may only need the libnl core, 
> or libnl-route or libnl-nf libs, but maybe not all of them.
> 
> This way we can select which ones we need without bloating the
> firmware image too much.
> 
> Signed-off-by: Alexandru Ardelean 
Maybe it would be better to have libnl as a metapackage selecting
libnl-core + the other ones. The way you split the package, you might be
breaking some packages that depend on it.

Or did you review all of the packages to ensure that they only need the
core?

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


Re: [OpenWrt-Devel] [PATCH] libnl: split into smaller libraries

2015-09-17 Thread Alexandru Ardelean
On Thu, Sep 17, 2015 at 4:50 PM, Felix Fietkau  wrote:

> On 2015-09-17 15:05, Alexandru Ardelean wrote:
> > From: Alexandru Ardelean 
> >
> > The idea is that we may only need the libnl core,
> > or libnl-route or libnl-nf libs, but maybe not all of them.
> >
> > This way we can select which ones we need without bloating the
> > firmware image too much.
> >
> > Signed-off-by: Alexandru Ardelean 
> Maybe it would be better to have libnl as a metapackage selecting
> libnl-core + the other ones. The way you split the package, you might be
> breaking some packages that depend on it.
>
> Or did you review all of the packages to ensure that they only need the
> core?
>
> - Felix
>

Good point.
I only took a look at base packages.

Looking through the packages feed, there's keepalived , ibrcommon, kismet,
bmon and aircrack-ng that depend on libnl.
Other feeds don't have libnl deps.

I'll check if libnl is sufficient and if not, implement your suggestion.

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


[OpenWrt-Devel] [PATCH v3 1/5] ar71xx: add eth rx delay for qca955x platforms

2015-09-17 Thread Chris R Blake
From: Chris R Blake 

This patch is to add support for qca955x_eth_rx_delay
to work with the qca955x SoC.

Signed-off-by: Chris R Blake 
---
 ...42-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch | 58 ++
 1 file changed, 58 insertions(+)
 create mode 100644 
target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch

diff --git 
a/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
 
b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
new file mode 100644
index 000..75e216e
--- /dev/null
+++ 
b/target/linux/ar71xx/patches-4.1/742-MIPS-ath79-add-qca955x-mac-tx-rx-delay.patch
@@ -0,0 +1,58 @@
+--- a/arch/mips/ath79/dev-eth.c
 b/arch/mips/ath79/dev-eth.c
+@@ -823,6 +825,32 @@
+   iounmap(base);
+ }
+
++void __init ath79_setup_qca955x_eth_rx_delay(unsigned int rxd,
++unsigned int rxdv)
++{
++  void __iomem *base;
++  u32 t;
++
++  rxd &= QCA955X_ETH_CFG_RXD_DELAY_MASK;
++  rxdv &= QCA955X_ETH_CFG_RDV_DELAY_MASK;
++
++  base = ioremap(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
++
++  t = __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
++
++  t &= ~(QCA955X_ETH_CFG_RXD_DELAY_MASK << 
QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
++ QCA955X_ETH_CFG_RDV_DELAY_MASK << 
QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
++
++  t |= (rxd << QCA955X_ETH_CFG_RXD_DELAY_SHIFT |
++rxdv << QCA955X_ETH_CFG_RDV_DELAY_SHIFT);
++
++  __raw_writel(t, base + QCA955X_GMAC_REG_ETH_CFG);
++  /* flush write */
++  __raw_readl(base + QCA955X_GMAC_REG_ETH_CFG);
++
++  iounmap(base);
++}
++
+ static int ath79_eth_instance __initdata;
+ void __init ath79_register_eth(unsigned int id)
+ {
+--- a/arch/mips/ath79/dev-eth.h
 b/arch/mips/ath79/dev-eth.h
+@@ -49,5 +49,6 @@
+ void ath79_setup_ar934x_eth_cfg(u32 mask);
+ void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+ void ath79_setup_qca955x_eth_cfg(u32 mask);
++void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+
+ #endif /* _ATH79_DEV_ETH_H */
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
 b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+@@ -1098,5 +1098,11 @@
+
+ #define QCA955X_ETH_CFG_RGMII_EN  BIT(0)
+ #define QCA955X_ETH_CFG_GE0_SGMII BIT(6)
++#define QCA955X_ETH_CFG_RXD_DELAY BIT(14)
++#define QCA955X_ETH_CFG_RXD_DELAY_MASK0x3
++#define QCA955X_ETH_CFG_RXD_DELAY_SHIFT   14
++#define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
++#define QCA955X_ETH_CFG_RDV_DELAY_MASK0x3
++#define QCA955X_ETH_CFG_RDV_DELAY_SHIFT   16
+
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
-- 
2.5.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC 3/5] firmware-utils mkmerakifw: firmware generator for MR18

2015-09-17 Thread Thomas Hebb
From: Thomas Hebb 

This patch adds firmware generation tool for Cisco's MR18

Signed-off-by: Thomas Hebb 
---
 tools/firmware-utils/Makefile |   1 +
 tools/firmware-utils/src/mkmerakifw.c | 263 ++
 2 files changed, 264 insertions(+)
 create mode 100644 tools/firmware-utils/src/mkmerakifw.c

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index bd69cb4..dc922b0 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -73,6 +73,7 @@ define Host/Compile
$(call cc,mkrtn56uimg, -lz)
$(call cc,dgn3500sum)
$(call cc,edimax_fw_header, -Wall)
+   $(call cc,mkmerakifw sha1, -Wall)
 endef
 
 define Host/Install
diff --git a/tools/firmware-utils/src/mkmerakifw.c 
b/tools/firmware-utils/src/mkmerakifw.c
new file mode 100644
index 000..241bb33
--- /dev/null
+++ b/tools/firmware-utils/src/mkmerakifw.c
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2015 Thomas Hebb 
+ *
+ * The format of the header this tool generates was first documented by
+ * Chris Blake  in a shell script of the
+ * same purpose. I have created this reimplementation at his request. The
+ * original script can be found at:
+ * 
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "sha1.h"
+
+#define PADDING_BYTE   0xff
+
+#define HDR_LENGTH 0x0400
+#define HDR_OFF_MAGIC1 0
+#define HDR_OFF_HDRLEN 4
+#define HDR_OFF_IMAGELEN   8
+#define HDR_OFF_CHECKSUM   12
+#define HDR_OFF_MAGIC2 32
+#define HDR_OFF_FILLER 36
+#define HDR_OFF_STATICHASH 40
+
+struct board_info {
+   uint32_t magic;
+   uint32_t imagelen;
+   unsigned char statichash[20];
+   char *id;
+   char *description;
+};
+
+/*
+ * Globals
+ */
+static char *progname;
+
+static char *board_id;
+static const struct board_info *board;
+
+static const struct board_info boards[] = {
+   {
+   .id = "mr18",
+   .description= "Meraki MR18 Access Point",
+   .magic  = 0x8e73ed8a,
+   .imagelen   = 0x0080,
+   .statichash = {0xda, 0x39, 0xa3, 0xee, 0x5e,
+  0x6b, 0x4b, 0x0d, 0x32, 0x55,
+  0xbf, 0xef, 0x95, 0x60, 0x18,
+  0x90, 0xaf, 0xd8, 0x07, 0x09},
+   }, {
+   /* terminating entry */
+   }
+};
+
+/*
+ * Message macros
+ */
+#define ERR(fmt, ...) do { \
+   fflush(0); \
+   fprintf(stderr, "[%s] *** error: " fmt "\n", \
+   progname, ## __VA_ARGS__); \
+} while (0)
+
+#define ERRS(fmt, ...) do { \
+   int save = errno; \
+   fflush(0); \
+   fprintf(stderr, "[%s] *** error: " fmt "\n", \
+   progname, ## __VA_ARGS__, strerror(save)); \
+} while (0)
+
+static const struct board_info *find_board(const char *id)
+{
+   const struct board_info *ret;
+   const struct board_info *board;
+
+   ret = NULL;
+   for (board = boards; board->id != NULL; board++) {
+   if (strcasecmp(id, board->id) == 0) {
+   ret = board;
+   break;
+   }
+   }
+
+   return ret;
+}
+
+static void usage(int status)
+{
+   FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
+   const struct board_info *board;
+
+   fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
+   fprintf(stream,
+"\n"
+"Options:\n"
+"  -B   create image for the board specified with \n"
+"  -iread kernel image from the file \n"
+"  -owrite output to the file \n"
+"  -s  strip padding from the end of the image\n"
+"  -h  show this screen\n"
+   );
+
+   fprintf(stream, "\nBoards:\n");
+   for (board = boards; board->id != NULL; board++)
+   fprintf(stream, "  %-16s%s\n", board->id, board->description);
+
+   exit(status);
+}
+
+void writel(unsigned char *buf, size_t offset, uint32_t value)
+{
+   value = htonl(value);
+   memcpy(buf + offset, &value, sizeof(uint32_t));
+}
+
+int main(int argc, char *argv[])
+{
+   int ret = EXIT_FAILURE;
+   long klen;
+   size_t kspace;
+   unsigned char *kernel;
+   size_t buflen;
+   unsigned char *buf;
+   bool strip_padding = false;
+   char *ofname = NULL, *ifname = NULL;
+   FILE *out, *in;
+
+   progname = basename(argv[0]);
+
+   while (1) {
+   int c;
+
+   c = getopt(argc, argv, "B:i:o:sh");
+   if (c == -1)
+   break;
+
+   switch (c) {
+  

[OpenWrt-Devel] [PATCH v3 2/5] ar71xx: add support for qca955x sgmii/serdes calibration

2015-09-17 Thread Chris R Blake
From: Chris R Blake 

This patch is to add support for sgmii/serdes calibration from
within the OpenWRT environment. This is needed on boards that
do not use u-boot or do not have a pre-init process that runs
calibration.

Signed-off-by: Chris R Blake 
---
 ...S-ath79-add-qca955x-mac-sgmii-calibration.patch | 82 ++
 1 file changed, 82 insertions(+)
 create mode 100644 
target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch

diff --git 
a/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
 
b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
new file mode 100644
index 000..eb7c5de
--- /dev/null
+++ 
b/target/linux/ar71xx/patches-4.1/743-MIPS-ath79-add-qca955x-mac-sgmii-calibration.patch
@@ -0,0 +1,82 @@
+--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h   2015-08-05 
12:58:15.580496899 +0200
 b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h   2015-08-05 
13:52:32.590857293 +0200
+@@ -360,6 +360,7 @@
+ #define QCA955X_PLL_CLK_CTRL_REG  0x08
+ #define QCA955X_PLL_ETH_XMII_CONTROL_REG  0x28
+ #define QCA955X_PLL_ETH_SGMII_CONTROL_REG 0x48
++#define QCA955X_PLL_ETH_SGMII_SERDES_REG  0x4c
+
+ #define QCA955X_PLL_CPU_CONFIG_NFRAC_SHIFT0
+ #define QCA955X_PLL_CPU_CONFIG_NFRAC_MASK 0x3f
+@@ -392,6 +393,10 @@
+ #define QCA955X_PLL_CLK_CTRL_DDRCLK_FROM_DDRPLL   BIT(21)
+ #define QCA955X_PLL_CLK_CTRL_AHBCLK_FROM_DDRPLL   BIT(24)
+
++#define QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT  BIT(2)
++#define QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK   BIT(1)
++#define QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL   BIT(0)
++
+ #define QCA956X_PLL_CPU_CONFIG_REG0x00
+ #define QCA956X_PLL_CPU_CONFIG1_REG   0x04
+ #define QCA956X_PLL_DDR_CONFIG_REG0x08
+@@ -1104,5 +1109,11 @@
+ #define QCA955X_ETH_CFG_RDV_DELAY BIT(16)
+ #define QCA955X_ETH_CFG_RDV_DELAY_MASK0x3
+ #define QCA955X_ETH_CFG_RDV_DELAY_SHIFT   16
++
++#define QCA955X_GMAC_REG_SGMII_SERDES 0x0018
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION  BIT(23)
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK 0xf
++#define QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT23
++#define QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS   BIT(15)
+
+ #endif /* __ASM_MACH_AR71XX_REGS_H */
+--- a/arch/mips/ath79/dev-eth.c2015-08-05 14:17:25.757504251 +0200
 b/arch/mips/ath79/dev-eth.c2015-08-05 14:09:54.716333554 +0200
+@@ -849,6 +849,37 @@ void __init ath79_setup_qca955x_eth_rx_d
+   iounmap(base);
+ }
+
++void __init ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value)
++{
++  void __iomem *ethbase, *pllbase;
++  u32 t;
++
++  ethbase = ioremap_nocache(QCA955X_GMAC_BASE, QCA955X_GMAC_SIZE);
++  pllbase = ioremap_nocache(AR71XX_PLL_BASE, AR71XX_PLL_SIZE);
++
++  /* To Check the locking of the SGMII PLL */
++  t = __raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
++  t &= ~(QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK <<
++ QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT);
++  t |= (sgmii_value & QCA955X_SGMII_SERDES_RES_CALIBRATION_MASK) <<
++   QCA955X_SGMII_SERDES_RES_CALIBRATION_SHIFT;
++  __raw_writel(t, ethbase + QCA955X_GMAC_REG_SGMII_SERDES);
++
++  __raw_writel(QCA955X_PLL_ETH_SGMII_SERDES_LOCK_DETECT |
++   QCA955X_PLL_ETH_SGMII_SERDES_PLL_REFCLK |
++   QCA955X_PLL_ETH_SGMII_SERDES_EN_PLL,
++   pllbase + QCA955X_PLL_ETH_SGMII_SERDES_REG);
++
++  ath79_device_reset_clear(QCA955X_RESET_SGMII_ANALOG);
++  ath79_device_reset_clear(QCA955X_RESET_SGMII);
++
++  while (!(__raw_readl(ethbase + QCA955X_GMAC_REG_SGMII_SERDES) &
++  QCA955X_SGMII_SERDES_LOCK_DETECT_STATUS));
++
++  iounmap(ethbase);
++  iounmap(pllbase);
++}
++
+ static int ath79_eth_instance __initdata;
+ void __init ath79_register_eth(unsigned int id)
+ {
+--- a/arch/mips/ath79/dev-eth.h2015-08-05 14:17:25.757504251 +0200
 b/arch/mips/ath79/dev-eth.h2015-08-05 13:58:20.292866210 +0200
+@@ -50,5 +50,6 @@ void ath79_setup_ar934x_eth_cfg(u32 mask
+ void ath79_setup_ar934x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
+ void ath79_setup_qca955x_eth_cfg(u32 mask);
+ void ath79_setup_qca955x_eth_rx_delay(unsigned int rxd, unsigned int rxdv);
++void ath79_setup_qca955x_eth_serdes_cal(unsigned int sgmii_value);
+
+ #endif /* _ATH79_DEV_ETH_H */
-- 
2.5.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC 4/5] ar71xx: add LED driver NU801

2015-09-17 Thread Chris R Blake
From: Chris R Blake 

The MR18 uses a 3-channel 16-bit PWM Constant Current Driver
for its status LED.

Signed-off-by: Chris R Blake 
---
 package/base-files/files/etc/init.d/led|   2 +-
 .../linux/ar71xx/files/drivers/leds/leds-nu801.c   | 396 +
 .../linux/ar71xx/files/include/linux/leds-nu801.h  |  38 ++
 target/linux/ar71xx/modules.mk |  16 +
 .../818-MIPS-ath79-add-nu801-led-driver.patch  |  26 ++
 5 files changed, 477 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ar71xx/files/drivers/leds/leds-nu801.c
 create mode 100644 target/linux/ar71xx/files/include/linux/leds-nu801.h
 create mode 100644 
target/linux/ar71xx/patches-4.1/818-MIPS-ath79-add-nu801-led-driver.patch

diff --git a/package/base-files/files/etc/init.d/led 
b/package/base-files/files/etc/init.d/led
index 3f45732..84cd028 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -44,7 +44,7 @@ load_led() {
ret="$?"
 
[ $default = 1 ] &&
-   echo 1 >/sys/class/leds/${sysfs}/brightness
+   cat /sys/class/leds/${sysfs}/max_brightness > 
/sys/class/leds/${sysfs}/brightness
 
[ $ret = 0 ] || {
echo >&2 "Skipping trigger '$trigger' for led '$name' 
due to missing kernel module"
diff --git a/target/linux/ar71xx/files/drivers/leds/leds-nu801.c 
b/target/linux/ar71xx/files/drivers/leds/leds-nu801.c
new file mode 100644
index 000..0dfc015
--- /dev/null
+++ b/target/linux/ar71xx/files/drivers/leds/leds-nu801.c
@@ -0,0 +1,396 @@
+/*
+ * LED driver for NU801
+ *
+ * Kevin Paul Herbert
+ * Copyright (c) 2012, Meraki, Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define MAX_NAME_LENGTH 24
+#define NUM_COLORS 3
+
+static const char * const led_nu801_colors[] = { "blue", "green", "red" };
+
+struct led_nu801_led_data {
+   struct led_classdev cdev;
+   struct led_nu801_data *controller;
+   enum led_brightness level;
+   char name[MAX_NAME_LENGTH];
+};
+
+struct led_nu801_data {
+   unsigned cki;
+   unsigned sdi;
+   int lei;
+   struct delayed_work work;
+   struct led_nu801_led_data *led_chain;
+   int num_leds;
+   const char *device_name;
+   const char *name;
+   u32 ndelay;
+   atomic_t pending;
+};
+
+static void led_nu801_work(struct work_struct *work)
+{
+   struct led_nu801_data   *controller =
+   container_of(work, struct led_nu801_data, work.work);
+   struct led_nu801_led_data *led;
+   u16 bit;
+   u16 brightness;
+   int index;
+
+   for (index = 0; index < controller->num_leds; index++) {
+   led = &controller->led_chain[index];
+   brightness = led->level << 8; /* To do: gamma correction */
+   for (bit = 0x8000; bit; bit = bit >> 1) {
+   gpio_set_value(controller->sdi,
+  (brightness & bit) != 0);
+   gpio_set_value(controller->cki, 1);
+   if (unlikely(((index == (controller->num_leds - 1)) &&
+ (bit == 1) &&
+ (controller->lei < 0 {
+   udelay(600);
+   } else {
+   ndelay(controller->ndelay);
+   }
+   gpio_set_value(controller->cki, 0);
+   ndelay(controller->ndelay);
+   }
+   }
+   if (controller->lei >= 0) {
+   gpio_set_value(controller->lei, 1);
+   ndelay(controller->ndelay);
+   gpio_set_value(controller->lei, 0);
+   }
+   atomic_set(&controller->pending, 1);
+}
+
+static void led_nu801_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
+{
+   struct led_nu801_led_data *led_dat =
+   container_of(led_cdev, struct led_nu801_led_data, cdev);
+   struct led_nu801_data *controller = led_dat->controller;
+
+   if (led_dat->level != value) {
+   led_dat->level = value;
+   if (atomic_dec_and_test(&controller->pending))
+   schedule_delayed_work(&led_dat->controller->work,
+ (HZ/1000) + 1);
+   }
+}
+
+static int __init led_nu801_create(struct led_nu801_data *controller,
+   struct device *parent,
+   int index,
+   enum led_brightness brightness,
+#ifdef CONFIG_LEDS_TRIGGERS
+  

[OpenWrt-Devel] [RFC 5/5] ar71xx: add support for Cisco's MR18

2015-09-17 Thread Chris R Blake
From: Chris R Blake 

This patch adds support for Cisco's MR18.
Detailed instructions for the flashing the device can
be found in the OpenWrt forum thread:


Signed-off-by: Chris R Blake 
---
 package/base-files/files/lib/functions/system.sh   |  17 ++
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 .../etc/hotplug.d/firmware/10-ath9k-eeprom |  39 +++-
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../base-files/lib/preinit/05_set_iface_mac_ar71xx |   4 +
 .../ar71xx/base-files/lib/upgrade/merakinand.sh| 136 +++
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   4 +
 target/linux/ar71xx/config-4.1 |   1 +
 .../linux/ar71xx/files/arch/mips/ath79/mach-mr18.c | 254 +
 target/linux/ar71xx/image/Makefile |  34 +++
 target/linux/ar71xx/nand/config-default|   1 +
 target/linux/ar71xx/nand/profiles/meraki.mk|  17 ++
 .../817-MIPS-ath79-add-meraki-mr18-support.patch   |  41 
 15 files changed, 558 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ar71xx/base-files/lib/upgrade/merakinand.sh
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-mr18.c
 create mode 100644 target/linux/ar71xx/nand/profiles/meraki.mk
 create mode 100644 
target/linux/ar71xx/patches-4.1/817-MIPS-ath79-add-meraki-mr18-support.patch

diff --git a/package/base-files/files/lib/functions/system.sh 
b/package/base-files/files/lib/functions/system.sh
index 8d75a5a..2f5d063 100644
--- a/package/base-files/files/lib/functions/system.sh
+++ b/package/base-files/files/lib/functions/system.sh
@@ -41,6 +41,23 @@ mtd_get_mac_binary() {
dd bs=1 skip=$offset count=6 if=$part 2>/dev/null | hexdump -v -n 6 -e 
'5/1 "%02x:" 1/1 "%02x"'
 }
 
+mtd_get_mac_binary_ubi() {
+   local mtdname="$1"
+   local offset="$2"
+
+   . /lib/upgrade/nand.sh
+
+   local ubidev=$(nand_find_ubi $CI_UBIPART)
+   local part="$(nand_find_volume $ubidev $mtdname)"
+
+   if [ -z "$part" ]; then
+   echo "mtd_get_mac_binary: ubi partition $mtdname not found!" >&2
+   return
+   fi
+
+   dd bs=1 skip=$offset count=6 if=/dev/$part 2>/dev/null | hexdump -v -n 
6 -e '5/1 "%02x:" 1/1 "%02x"'
+}
+
 mtd_get_part_size() {
local part_name=$1
local first dev size erasesize name
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index cfba6b4..d6cc23f 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -144,6 +144,9 @@ get_status_led() {
mr16)
status_led="mr16:green:power"
;;
+   mr18)
+   status_led="mr18:green:tricolor0"
+   ;;
mr600)
status_led="mr600:orange:power"
;;
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index b5f0588..381ff55 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -9,11 +9,14 @@ ath9k_eeprom_extract() {
local part=$1
local offset=$2
local count=$3
+   local ubidev=$(nand_find_ubi $CI_UBIPART)
local mtd
 
mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || \
-   ath9k_eeprom_die "no mtd device found for partition $part"
+   mtd="/dev/$(nand_find_volume $ubidev $part)"
+   [ -n "$mtd" ] || \
+   ath9k_eeprom_die "no mtd device found for partition 
$part"
 
dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
ath9k_eeprom_die "failed to extract from $mtd"
@@ -29,15 +32,25 @@ ath9k_patch_firmware_mac() {
 
 [ -e /lib/firmware/$FIRMWARE ] && exit 0
 
+
 . /lib/ar71xx.sh
 . /lib/functions.sh
 . /lib/functions/system.sh
+. /lib/upgrade/nand.sh
 
 board=$(ar71xx_board_name)
 
 case "$FIRMWARE" in
 "soc_wmac.eeprom")
case $board in
+   mr18)
+   if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+   ath9k_eeprom_extract "caldata" 4096 2048
+   else
+   ath9k_eeprom_extract "odm-caldata" 4096 2048
+   fi
+   ath9k_patch_firmware_mac $(macaddr_add $(mtd_get_mac_binary_ubi 
board-config 102) +1)
+   ;;
r6100 | \
wndr3700v4 | \
wndr4300)
@@ -52,6 +65,14 @@ case "$FIRMWARE" in
 
 "pci_wmac0.eeprom")
case $board in
+   mr18)
+   if [ -n "$(nand_find_volume ubi0 caldata)" ]; then
+   ath9k_eeprom_extract "caldata" 20480 

[OpenWrt-Devel] Fwd: how to build two models simulatenouly

2015-09-17 Thread punith kumar
Dear Openwrt-devel,

I want to know if it is possible to setup build environment to compile
two models simultaneously which will use same toolchain configuration
and etc,
Simultaneously mean both models should be configurable

One possible solution would be to create new package under main model
and try to build sub-model under this package(main model toolchain can
be used as external toolchain for submodel).
==

Thanks in advance for any sort of suggestion and direction

Regards,
Punith Kumar
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] uqmi: Add qmi.sh executable bit and fix option dhcp

2015-09-17 Thread Matti Laakso
Using protocol qmi does not work since qmi.sh is not executable.
Setting option dhcp explicitely to 0 actually enables it.
This patch fixes both problems.

Signed-off-by: Matti Laakso 
---
 package/network/utils/uqmi/Makefile  | 2 +-
 package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 
package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh

diff --git a/package/network/utils/uqmi/Makefile 
b/package/network/utils/uqmi/Makefile
index 16e7fea..7ccf549 100644
--- a/package/network/utils/uqmi/Makefile
+++ b/package/network/utils/uqmi/Makefile
@@ -1,7 +1,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=uqmi
-PKG_VERSION:=2015-08-13
+PKG_VERSION:=2015-09-17
 PKG_RELEASE=$(PKG_SOURCE_VERSION)
 
 PKG_SOURCE_PROTO:=git
diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh 
b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
old mode 100644
new mode 100755
index 8ee7dbd..48864be
--- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
+++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh
@@ -140,7 +140,7 @@ proto_qmi_setup() {
return 1
}
 
-   if [ -z "$dhcp" ]; then
+   if [ -z "$dhcp" -o "$dhcp" = 0 ]; then
echo "Setting up $ifname"
[ -n "$ipv4" ] && {
json_load "$(uqmi -s -d $device --set-client-id 
wds,$cid_4 --get-current-settings)"
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Stefan Hellermann
While porting the Unison File Synchronizer to openwrt I added the
OCaml compiler to openwrt toolchain.
Cross-compiling OCaml seems to be only tested for windows mingw
targets. I had to add a patch to the OCaml configure scripts, to feed
it with a few bits of the target. I hope i did it right for all
targets.
Cross-compiling OCaml needs a bootstrap OCaml installed on the host,
so I actually added OCaml twice, one time in tools and one time in
toolchain.
I discovered a bug when trying to cross-compile on a 64 bit host for
a 32 bit target, the resulting binaries won't work on the target.
For this case I added a workaround in tools/ocaml to compile a
32 bit bootstrap OCaml on x86_64 hosts when building for 32 bit
targets. This workaround is tested for a x86_64 host when
compiling for ar71xx and x86_64 targets.
This workaround is probably buggy when switching from x86_64 to
ar71xx targets without make dirclean, as tools/ocaml is not
rebuild in this case.

Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:
Stripping unison won't work!
Better solutions and comments are appreciated!

Signed-off-by: Stefan Hellermann 
---
 toolchain/Config.in|  6 +++
 toolchain/Makefile |  3 +-
 toolchain/ocaml/Makefile   | 55 +
 toolchain/ocaml/patches/001-crosscompile.patch | 57 ++
 tools/Makefile |  1 +
 tools/ocaml/Makefile   | 35 
 6 files changed, 156 insertions(+), 1 deletion(-)
 create mode 100644 toolchain/ocaml/Makefile
 create mode 100644 toolchain/ocaml/patches/001-crosscompile.patch
 create mode 100644 tools/ocaml/Makefile

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 474a14f..88bbe98 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -206,6 +206,12 @@ comment "Compiler"
 
 source "toolchain/gcc/Config.in"
 
+config OCAML
+   bool
+   prompt "Build OCaml Compiler" if TOOLCHAINOPTS
+   help
+ Enable if you want to build the OCaml Compiler.
+
 comment "C Library"
depends on TOOLCHAINOPTS
 
diff --git a/toolchain/Makefile b/toolchain/Makefile
index cd5399e..92c6f82 100644
--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -28,7 +28,7 @@
 curdir:=toolchain
 
 # subdirectories to descend into
-$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) 
$(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal 
gcc/initial gcc/final $(LIBC)/headers $(LIBC) fortify-headers)
+$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) 
$(if $(CONFIG_OCAML),ocaml) $(if 
$(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal 
gcc/initial gcc/final $(LIBC)/headers $(LIBC) fortify-headers)
 ifdef CONFIG_USE_UCLIBC
   $(curdir)/builddirs += $(LIBC)/utils
 endif
@@ -49,6 +49,7 @@ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
   $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
   $(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
   $(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
+  $(curdir)/ocaml/prepare:=$(curdir)/gcc/final/install
 endif
 
 ifndef DUMP_TARGET_DB
diff --git a/toolchain/ocaml/Makefile b/toolchain/ocaml/Makefile
new file mode 100644
index 000..dfb4135
--- /dev/null
+++ b/toolchain/ocaml/Makefile
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ocaml
+PKG_VERSION:=4.02.3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://caml.inria.fr/pub/distrib/$(PKG_NAME)-$(word 1,$(subst 
., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION)))/
+PKG_MD5SUM:=ef1a324608c97031cbd92a442d685ab7
+
+include $(INCLUDE_DIR)/toolchain-build.mk
+
+# custom configure script
+HOST_CONFIGURE_VARS =
+HOST_CONFIGURE_ARGS = \
+   -prefix $(TOOLCHAIN_DIR) \
+   -target-bindir $(TOOLCHAIN_DIR)/bin \
+   -target $(REAL_GNU_TARGET_NAME) \
+   -cc "$(TARGET_CC) $(TARGET_CFLAGS)" \
+   -as "$(TARGET_AS) $(TARGET_ASFLAGS)" \
+   -no-pthread -no-shared-libs \
+   -no-debugger -no-ocamldoc -no-graph -no-cfi
+
+ifneq ($(CONFIG_BIG_ENDIAN),)
+HOST_CONFIGURE_ARGS += -big-endian
+endif
+
+# OCaml applications for 32 bit targets need to be cross-compiled on a 32 bit 
host OCaml.
+# The following catches x86_64 hosts only. Tested on x86_64 for ar71xx and 
x86_64 targets.
+ifeq ($(HOST_ARCH)$(CONFIG_ARCH_64BIT),x86_64)
+HOST_CONFIGURE_ARGS += -host i386-linux
+else
+HOST_CONFIGURE_ARGS += -host $(GNU_HOST_NAME)
+endif
+
+define Host/Compile
+$(MAKE) -C $(HOST_BUILD_DIR) world
+endef
+
+define Host/Install
+   $(call Host/Install/Default)
+   mv $(TOOLCHAIN_DIR)/bin/ocamlc 
$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)ocamlc
+endef
+
+define Host/Clean
+   $(call

[OpenWrt-Devel] [Patch 1/3] Update uboot-omap to 15.07

2015-09-17 Thread Tara Lorenz

Hello everybody,

the old uboot-omap package fails to compile when using gcc 5.x.
Therefore i made a patch using a more recent version of u-boot.
I decided to choose 15.07, the same version as currently used for the
sunxi based boards.

So far i only tested that the package can now be compiled using
gcc 5.x.  I can test functionality for beagle-board, beagle-bone
and panda-board during the weekend, if that's needed.

I hope it's helpful somehow.

Cheers, Tara

>From 9bba92b8ab7d78dd04036be6445da116c0d343c3 Mon Sep 17 00:00:00 2001
From: Tara Lorenz 
Date: Thu, 17 Sep 2015 15:54:13 +0200
Subject: [PATCH 1/3] uboot-omap 2015.07: remove old patches


The removed patches functionality is already contained in newer U-Boot
versions.
---
 .../boot/uboot-omap/patches/002-fix_jffs2.patch| 34 --
 .../uboot-omap/patches/003-fix_findfdt_C4.patch| 11 ---
 2 files changed, 45 deletions(-)
 delete mode 100644 package/boot/uboot-omap/patches/002-fix_jffs2.patch
 delete mode 100644 package/boot/uboot-omap/patches/003-fix_findfdt_C4.patch

diff --git a/package/boot/uboot-omap/patches/002-fix_jffs2.patch 
b/package/boot/uboot-omap/patches/002-fix_jffs2.patch
deleted file mode 100644
index cba0e25..000
--- a/package/boot/uboot-omap/patches/002-fix_jffs2.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Building boards that have JFFS2 support enabled will fail when using
-U-Boot's builtin GCC library, for example like this:
-
-USE_PRIVATE_LIBGCC=yes ./MAKEALL omap3_evm
-...
-fs/jffs2/libjffs2.o: In function `jffs2_1pass_build_lists':
-fs/jffs2/jffs2_1pass.c:1441: undefined reference to `__aeabi_uldivmod'
-
-This is caused by a u64 / u32 division in jffs2_1pass.c; the problem
-can be avoided by using do_div() instead of plain division.
-
-Signed-off-by: Wolfgang Denk 
-Reported-by: Chris Ruehl 
-Cc: Chris Ruehl 
-

- fs/jffs2/jffs2_1pass.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
-index c856983..a7dbe79 100644
 a/fs/jffs2/jffs2_1pass.c
-+++ b/fs/jffs2/jffs2_1pass.c
-@@ -1438,7 +1438,7 @@ jffs2_1pass_build_lists(struct part_info * part)
- {
-   struct b_lists *pL;
-   struct jffs2_unknown_node *node;
--  u32 nr_sectors = part->size/part->sector_size;
-+  u32 nr_sectors = do_div(part->size, part->sector_size);
-   u32 i;
-   u32 counter4 = 0;
-   u32 counterF = 0;
---
-1.8.3.1
diff --git a/package/boot/uboot-omap/patches/003-fix_findfdt_C4.patch 
b/package/boot/uboot-omap/patches/003-fix_findfdt_C4.patch
deleted file mode 100644
index b0b85e5..000
--- a/package/boot/uboot-omap/patches/003-fix_findfdt_C4.patch
+++ /dev/null
@@ -1,11 +0,0 @@
 a/include/configs/omap3_beagle.h
-+++ b/include/configs/omap3_beagle.h
-@@ -242,6 +242,8 @@
-   "setenv fdtfile omap3-beagle.dtb; fi; " \
-   "if test $beaglerev = Cx; then " \
-   "setenv fdtfile omap3-beagle.dtb; fi; " \
-+  "if test $beaglerev = C4; then " \
-+  "setenv fdtfile omap3-beagle.dtb; fi; " \
-   "if test $beaglerev = xMAB; then " \
-   "setenv fdtfile omap3-beagle-xm.dtb; fi; " \
-   "if test $beaglerev = xMC; then " \
-- 
2.5.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [Patch 1/3] Update uboot-omap to 15.07

2015-09-17 Thread Tara Lorenz
>From 290412c95aa2c67406f54b12128c502bbdab9d69 Mon Sep 17 00:00:00 2001
From: Tara Lorenz 
Date: Thu, 17 Sep 2015 15:58:01 +0200
Subject: [PATCH 2/3] uboot-omap 2015.07: adjust patch


Adjusted patch 001-switch_omap4_ext4.patch so it cleanly applies to new
U-Boot version.
---
 package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch 
b/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
index d741c08..785a750 100644
--- a/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
+++ b/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
@@ -1,6 +1,6 @@
 a/include/configs/omap4_common
-+++ b/include/configs/omap4_common.h
-@@ -143,7 +143,7 @@
+--- a/include/configs/ti_omap4_common.h
 b/include/configs/ti_omap4_common.h
+@@ -92,7 +92,7 @@
"vram=16M\0" \
"mmcdev=0\0" \
"mmcroot=/dev/mmcblk0p2 rw\0" \
-- 
2.5.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [Patch 2/3] Update uboot-omap to 15.07

2015-09-17 Thread Tara Lorenz
>From 290412c95aa2c67406f54b12128c502bbdab9d69 Mon Sep 17 00:00:00 2001
From: Tara Lorenz 
Date: Thu, 17 Sep 2015 15:58:01 +0200
Subject: [PATCH 2/3] uboot-omap 2015.07: adjust patch


Adjusted patch 001-switch_omap4_ext4.patch so it cleanly applies to new
U-Boot version.
---
 package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch 
b/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
index d741c08..785a750 100644
--- a/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
+++ b/package/boot/uboot-omap/patches/001-switch_omap4_ext4.patch
@@ -1,6 +1,6 @@
 a/include/configs/omap4_common
-+++ b/include/configs/omap4_common.h
-@@ -143,7 +143,7 @@
+--- a/include/configs/ti_omap4_common.h
 b/include/configs/ti_omap4_common.h
+@@ -92,7 +92,7 @@
"vram=16M\0" \
"mmcdev=0\0" \
"mmcroot=/dev/mmcblk0p2 rw\0" \
-- 
2.5.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [Patch 3/3] Update uboot-omap to 15.07

2015-09-17 Thread Tara Lorenz
>From 984486a72e7a20f4c3c85d75ef49126cee14ea89 Mon Sep 17 00:00:00 2001
From: Tara Lorenz 
Date: Thu, 17 Sep 2015 15:59:36 +0200
Subject: [PATCH 3/3] uboot-omap: Update to U-Boot 2015.07


The old U-Boot 2013.10 couldn't be build with GCC 5.x; so this update seems
appropiate.
---
 package/boot/uboot-omap/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/boot/uboot-omap/Makefile b/package/boot/uboot-omap/Makefile
index e21e2e1..40f6d09 100644
--- a/package/boot/uboot-omap/Makefile
+++ b/package/boot/uboot-omap/Makefile
@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=u-boot
-PKG_VERSION:=2013.10
+PKG_VERSION:=2015.07
 PKG_RELEASE:=1
 
 
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
@@ -16,7 +16,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
http://mirror2.openwrt.org/sources \
ftp://ftp.denx.de/pub/u-boot
-PKG_MD5SUM:=a076a044b64371edc52f7e562b13f6b2
+PKG_MD5SUM:=3dac9a0b46fed77fc768ad3bd2d68c05
 
 PKG_LICENSE:=GPL-2.0 GPL-2.0+
 PKG_LICENSE_FILES:=Licenses/README
-- 
2.5.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Bastian Bittorf
* Stefan Hellermann  [17.09.2015 20:00]:
> Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:
> Stripping unison won't work!
> Better solutions and comments are appreciated!
> 
> Signed-off-by: Stefan Hellermann 

thank you!

tested and works for me on ar71xx.
the resulting unison-binary is a little
bit fat (~2mb gzipped) but thats not your fault 8-)

bye, bastian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Bastian Bittorf
* Stefan Hellermann  [17.09.2015 20:00]:
> Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:

tested on kirkwood here, and it builds the toolchain/ocaml,
but fails to compile unison:

[...]
arm-openwrt-linux-muslgnueabi-ocamlc -verbose -g -I lwt -I ubase -I
system -I fsmonitor -I fsmonitor/linux -I fsmonitor/windows -I
system/generic -I lwt/generic -custom -g -o unison  unix.cma str.cma
bigarray.cma ubase/rx.cmo unicode_tables.cmo unicode.cmo bytearray.cmo
system/system_generic.cmo system/generic/system_impl.cmo system.cmo
ubase/projectInfo.cmo ubase/myMap.cmo ubase/safelist.cmo ubase/util.cmo
ubase/uarg.cmo ubase/prefs.cmo ubase/trace.cmo ubase/proplist.cmo
lwt/pqueue.cmo lwt/lwt.cmo lwt/lwt_util.cmo
lwt/generic/lwt_unix_impl.cmo lwt/lwt_unix.cmo uutil.cmo case.cmo
pred.cmo fileutil.cmo name.cmo path.cmo fspath.cmo fs.cmo
fingerprint.cmo abort.cmo osx.cmo external.cmo fswatch.cmo props.cmo
fileinfo.cmo os.cmo lock.cmo clroot.cmo common.cmo tree.cmo checksum.cmo
terminal.cmo transfer.cmo xferhint.cmo remote.cmo globals.cmo
fswatchold.cmo fpcache.cmo update.cmo copy.cmo stasher.cmo files.cmo
sortri.cmo recon.cmo transport.cmo strings.cmo uicommon.cmo uitext.cmo
test.cmo main.cmo linktext.cmo osxsupport.o pty.o bytearray_stubs.o
-cclib -lutil
+ arm-openwrt-linux-muslgnueabi-gcc -Os -pipe -march=armv5te
-mtune=xscale -fno-caller-saves -fhonour-copts
-Wno-error=unused-but-set-variable -mfloat-abi=soft -o 'unison'
'-Llwt' '-Lubase' '-Lsystem' '-Lfsmonitor' '-Lfsmonitor/linux'
'-Lfsmonitor/windows' '-Lsystem/generic' '-Llwt/generic'
'-L/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/lib/ocaml'
'/tmp/uml/camlprime736ee.c' '-lbigarray' '-lcamlstr' '-lunix'
'osxsupport.o' 'pty.o' 'bytearray_stubs.o' '-lutil' '-lcamlrun'
-I'/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/lib/ocaml'
-lm
arm-openwrt-linux-muslgnueabi-ocamlopt: fsmonitor/linux/inotify_stubs.c
---> fsmonitor/linux/inotify_stubs.o
arm-openwrt-linux-muslgnueabi-ocamlc -g -I lwt -I ubase -I system -I
fsmonitor -I fsmonitor/linux -I fsmonitor/windows -I system/generic -I
lwt/generic -custom -g -ccopt "-o
"/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.o
-c
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c
In file included from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:0:
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_compat.h:76:0:
warning: "__NR_inotify_init" redefined [enabled by default]
 # define __NR_inotify_init (__NR_SYSCALL_BASE+316)
 ^
In file included from
/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/include/sys/syscall.h:4:0,
 from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_compat.h:13,
 from
/home/bastian/openwrt/build_dir/target-arm_xscale_musl-1.1.11_eabi/unison-2.48.3/fsmonitor/linux/inotify_stubs.c:41:
/home/bastian/openwrt/staging_dir/toolchain-arm_xscale_gcc-4.8-linaro_musl-1.1.11_eabi/include/bits/syscall.h:272:0:
note: this is the location of the previous definition
 #define __NR_inotify_init 316
 i^

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


[OpenWrt-Devel] [PATCH] hostapd: check for banned client on association event

2015-09-17 Thread Rafał Miłecki
When using FullMAC drivers (e.g. brcmfmac) we don't get mgmt frames so
check for banned client in probe request handler won't ever be used.
Since cfg80211 provides us info about STA associating let's put a check
there.

Signed-off-by: Rafał Miłecki 
---
 .../hostapd/patches/600-ubus_support.patch | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/package/network/services/hostapd/patches/600-ubus_support.patch 
b/package/network/services/hostapd/patches/600-ubus_support.patch
index 1efe84e..df2eac8 100644
--- a/package/network/services/hostapd/patches/600-ubus_support.patch
+++ b/package/network/services/hostapd/patches/600-ubus_support.patch
@@ -830,3 +830,29 @@
  int ieee802_11_set_beacon(struct hostapd_data *hapd);
  int ieee802_11_set_beacons(struct hostapd_iface *iface);
  int ieee802_11_update_beacons(struct hostapd_iface *iface);
+--- a/src/ap/drv_callbacks.c
 b/src/ap/drv_callbacks.c
+@@ -49,6 +49,10 @@ int hostapd_notif_assoc(struct hostapd_d
+   u16 reason = WLAN_REASON_UNSPECIFIED;
+   u16 status = WLAN_STATUS_SUCCESS;
+   const u8 *p2p_dev_addr = NULL;
++  struct hostapd_ubus_request req = {
++  .type = HOSTAPD_UBUS_ASSOC_REQ,
++  .addr = addr,
++  };
+ 
+   if (addr == NULL) {
+   /*
+@@ -113,6 +117,12 @@ int hostapd_notif_assoc(struct hostapd_d
+   }
+   sta->flags &= ~(WLAN_STA_WPS | WLAN_STA_MAYBE_WPS | WLAN_STA_WPS2);
+ 
++  if (hostapd_ubus_handle_event(hapd, &req)) {
++  wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by 
ubus handler.\n",
++ MAC2STR(req.addr));
++  goto fail;
++  }
++
+ #ifdef CONFIG_P2P
+   if (elems.p2p) {
+   wpabuf_free(sta->p2p_ie);
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC] netifd: backport support of checkup_interval option

2015-09-17 Thread Yousong Zhou
This is needed for L2TP with xl2tpd daemon.

Signed-off-by: Yousong Zhou 
---
Another option would be bump the netifd version to the lastest, but I am a bit
conservative now.  That said, I plan to backport xl2tpd from trunk to
packages;for-15.05 after this checkup_interval option will be available in CC
as the current version there does not work at all [1]

[1] please update xl2tpd package in 15.05 branch,
https://github.com/openwrt/packages/issues/1478

 ...-add-checkup-timeout-to-restart-interface.patch |  137 
 1 file changed, 137 insertions(+)
 create mode 100644 
package/network/config/netifd/patches/0001-proto-shell-add-checkup-timeout-to-restart-interface.patch

diff --git 
a/package/network/config/netifd/patches/0001-proto-shell-add-checkup-timeout-to-restart-interface.patch
 
b/package/network/config/netifd/patches/0001-proto-shell-add-checkup-timeout-to-restart-interface.patch
new file mode 100644
index 000..784ae7f
--- /dev/null
+++ 
b/package/network/config/netifd/patches/0001-proto-shell-add-checkup-timeout-to-restart-interface.patch
@@ -0,0 +1,137 @@
+From 6ed631e55686b909e6db25838e6e591316933c97 Mon Sep 17 00:00:00 2001
+From: Yousong Zhou 
+Date: Fri, 21 Aug 2015 10:11:57 +0800
+Subject: [PATCH] proto-shell: add checkup timeout to restart interface.
+
+This is mainly for protocols with no_proto_task set.  L2TP with xl2tpd
+is such a case and the issue this commit tries to address is that xl2tpd
+could fail redialing the connection (segfault or abort) without the
+notice of netifd causing the concerned interface being left down.
+
+This patch solves it by allowing users to configure an timeout value
+instructing netifd to check if the interface is in up state after its
+last attempt to setup it and try again if that is not the case.
+
+Signed-off-by: Yousong Zhou 
+---
+ proto-shell.c |   60 +
+ 1 file changed, 60 insertions(+)
+
+diff --git a/proto-shell.c b/proto-shell.c
+index e2e765f..8a3ff69 100644
+--- a/proto-shell.c
 b/proto-shell.c
+@@ -69,6 +69,15 @@ struct proto_shell_state {
+ 
+   struct uloop_timeout teardown_timeout;
+ 
++  /*
++   * Teardown and setup interface again if it is still not up (IFS_UP)
++   * after checkup_interval seconds since previous attempt.  This check
++   * will be disabled when the config option "checkup_interval" is
++   * missing or has a negative value
++   */
++  int checkup_interval;
++  struct uloop_timeout checkup_timeout;
++
+   struct netifd_process script_task;
+   struct netifd_process proto_task;
+ 
+@@ -303,6 +312,12 @@ proto_shell_task_finish(struct proto_shell_state *state,
+   proto_shell_handler(&state->proto,
+   PROTO_CMD_TEARDOWN,
+   false);
++
++  /* check up status after setup attempt by this 
script_task */
++  if (state->sm == S_SETUP && state->checkup_interval > 
0) {
++  uloop_timeout_set(&state->checkup_timeout,
++state->checkup_interval * 
1000);
++  }
+   }
+   break;
+ 
+@@ -311,7 +326,9 @@ proto_shell_task_finish(struct proto_shell_state *state,
+   state->proto_task.uloop.pending)
+   break;
+ 
++  /* completed aborting all tasks, now idle */
+   uloop_timeout_cancel(&state->teardown_timeout);
++  uloop_timeout_cancel(&state->checkup_timeout);
+   state->sm = S_IDLE;
+   proto_shell_handler(&state->proto, PROTO_CMD_TEARDOWN, false);
+   break;
+@@ -326,7 +343,9 @@ proto_shell_task_finish(struct proto_shell_state *state,
+   break;
+   }
+ 
++  /* completed tearing down all tasks, now idle */
+   uloop_timeout_cancel(&state->teardown_timeout);
++  uloop_timeout_cancel(&state->checkup_timeout);
+   state->sm = S_IDLE;
+   state->proto.proto_event(&state->proto, IFPEV_DOWN);
+   break;
+@@ -374,6 +393,7 @@ proto_shell_free(struct interface_proto_state *proto)
+ 
+   state = container_of(proto, struct proto_shell_state, proto);
+   uloop_timeout_cancel(&state->teardown_timeout);
++  uloop_timeout_cancel(&state->checkup_timeout);
+   proto_shell_clear_host_dep(state);
+   netifd_kill_process(&state->script_task);
+   netifd_kill_process(&state->proto_task);
+@@ -768,6 +788,45 @@ proto_shell_notify(struct interface_proto_state *proto, 
struct blob_attr *attr)
+   }
+ }
+ 
++static void
++proto_shell_checkup_timeout_cb(struct uloop_timeout *timeout)
++{
++  struct proto_shell_state *state = container_of(timeout, struct
++  proto_shell_state, checkup_timeout);

Re: [OpenWrt-Devel] iproute2/tc does not apply or show filters

2015-09-17 Thread Neutron Soutmun
Hello,

I'm facing this problem in ramips target (mt7620) - linux 3.18.17
and found that it's related to this bug [1].

The tc filter applied, I have tested and it's working properly but the
tc filter show is not.

With this patch [2], the tc filter show back to work again.

Cheers,
Neutron Soutmun

[1] https://bugzilla.kernel.org/show_bug.cgi?id=84661
[2] https://bugzilla.kernel.org/attachment.cgi?id=174081
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [RFC] add unison-2.48.3

2015-09-17 Thread Stefan Hellermann
should probably be sent to the packages repo on github.

Signed-of-by: Stefan Hellermann 
---
 package/network/utils/unison/Makefile  |  36 
 .../utils/unison/patches/100-ocamlopt.patch| 225 +
 2 files changed, 261 insertions(+)
 create mode 100644 package/network/utils/unison/Makefile
 create mode 100644 package/network/utils/unison/patches/100-ocamlopt.patch

diff --git a/package/network/utils/unison/Makefile 
b/package/network/utils/unison/Makefile
new file mode 100644
index 000..91d9516
--- /dev/null
+++ b/package/network/utils/unison/Makefile
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2009-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=unison
+PKG_VERSION:=2.48.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.seas.upenn.edu/~bcpierce/unison//download/releases/$(PKG_NAME)-$(PKG_VERSION)/
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/unison
+  SECTION:=utilities
+  CATEGORY:=Utilities
+  TITLE:=Unison file synchronizer
+  URL:=http://www.cis.upenn.edu/~bcpierce/unison/
+  DEPENDS:= libncurses
+endef
+
+Stripping OCaml binaries is not possible
+RSTRIP:=:
+STRIP:=:
+
+define Package/unison/install
+   $(INSTALL_DIR) $(1)/usr/bin
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/unison $(1)/usr/bin
+endef
+
+$(eval $(call BuildPackage,unison))
diff --git a/package/network/utils/unison/patches/100-ocamlopt.patch 
b/package/network/utils/unison/patches/100-ocamlopt.patch
new file mode 100644
index 000..a8132e2
--- /dev/null
+++ b/package/network/utils/unison/patches/100-ocamlopt.patch
@@ -0,0 +1,225 @@
+--- /dev/null  2015-08-24 10:52:13.18000 +0200
 unison-2.48.3/fsmonitor/linux/inotify_compat.h 2015-09-11 
22:59:01.05600 +0200
+@@ -0,0 +1,167 @@
++/*
++ * This header is used if  cannot be found.
++ *
++ * Inode based directory notification for Linux
++ *
++ * Copyright (C) 2005 John McCutchan
++ */
++
++#ifndef _LINUX_INOTIFY_H
++#define _LINUX_INOTIFY_H
++
++#include 
++#include 
++#include 
++
++/*
++ * struct inotify_event - structure read from the inotify device for each 
event
++ *
++ * When you are watching a directory, you will receive the filename for events
++ * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
++ */
++struct inotify_event {
++  int wd; /* watch descriptor */
++  uint32_tmask;   /* watch mask */
++  uint32_tcookie; /* cookie to synchronize two 
events */
++  uint32_tlen;/* length (including nulls) of 
name */
++  charname __flexarr; /* stub for possible name */
++};
++
++/* the following are legal, implemented events that user-space can watch for 
*/
++#define IN_ACCESS 0x0001  /* File was accessed */
++#define IN_MODIFY 0x0002  /* File was modified */
++#define IN_ATTRIB 0x0004  /* Metadata changed */
++#define IN_CLOSE_WRITE0x0008  /* Writtable file was 
closed */
++#define IN_CLOSE_NOWRITE  0x0010  /* Unwrittable file closed */
++#define IN_OPEN   0x0020  /* File was opened */
++#define IN_MOVED_FROM 0x0040  /* File was moved from X */
++#define IN_MOVED_TO   0x0080  /* File was moved to Y */
++#define IN_CREATE 0x0100  /* Subfile was created */
++#define IN_DELETE 0x0200  /* Subfile was deleted */
++#define IN_DELETE_SELF0x0400  /* Self was deleted */
++#define IN_MOVE_SELF  0x0800  /* Self was moved */
++
++/* the following are legal events.  they are sent as needed to any watch */
++#define IN_UNMOUNT0x2000  /* Backing fs was unmounted */
++#define IN_Q_OVERFLOW 0x4000  /* Event queued overflowed */
++#define IN_IGNORED0x8000  /* File was ignored */
++
++/* helper events */
++#define IN_CLOSE  (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
++#define IN_MOVE   (IN_MOVED_FROM | IN_MOVED_TO) /* moves 
*/
++
++/* special flags */
++#define IN_ONLYDIR0x0100  /* only watch the path if it is 
a directory */
++#define IN_DONT_FOLLOW0x0200  /* don't follow a sym 
link */
++#define IN_MASK_ADD   0x2000  /* add to the mask of an 
already existing watch */
++#define IN_ISDIR  0x4000  /* event occurred against dir */
++#define IN_ONESHOT0x8000  /* only send event once */
++
++/*
++ * All of the events - we build the list by hand so that we can add flags in
++ * the future and not break backward compatibility.  Apps will get only the
++ * events that they originally wanted.  Be s

Re: [OpenWrt-Devel] [PATCH] [RFC] add unison-2.48.3

2015-09-17 Thread Stefan Hellermann
two comments to my own patch:

2015-09-18 7:13 GMT+02:00 Stefan Hellermann :

> should probably be sent to the packages repo on github.
>
> Signed-of-by: Stefan Hellermann 
> ---
>  package/network/utils/unison/Makefile  |  36 
>  .../utils/unison/patches/100-ocamlopt.patch| 225
> +
>  2 files changed, 261 insertions(+)
>  create mode 100644 package/network/utils/unison/Makefile
>  create mode 100644 package/network/utils/unison/patches/100-ocamlopt.patch
>
> diff --git a/package/network/utils/unison/Makefile
> b/package/network/utils/unison/Makefile
> new file mode 100644
> index 000..91d9516
> --- /dev/null
> +++ b/package/network/utils/unison/Makefile
> @@ -0,0 +1,36 @@
> +#
> +# Copyright (C) 2009-2011 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +include $(TOPDIR)/rules.mk
> +
> +PKG_NAME:=unison
> +PKG_VERSION:=2.48.3
> +PKG_RELEASE:=1
> +
> +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
> +PKG_SOURCE_URL:=
> http://www.seas.upenn.edu/~bcpierce/unison//download/releases/$(PKG_NAME)-$(PKG_VERSION)/
> +
> +include $(INCLUDE_DIR)/package.mk
> +
> +define Package/unison
> +  SECTION:=utilities
> +  CATEGORY:=Utilities
> +  TITLE:=Unison file synchronizer
> +  URL:=http://www.cis.upenn.edu/~bcpierce/unison/
> +  DEPENDS:= libncurses
> +endef
> +
>

There is a # missing in front of next line


> +Stripping OCaml binaries is not possible
> +RSTRIP:=:
> +STRIP:=:
> +
> +define Package/unison/install
> +   $(INSTALL_DIR) $(1)/usr/bin
> +   $(INSTALL_BIN) $(PKG_BUILD_DIR)/unison $(1)/usr/bin
> +endef
> +
> +$(eval $(call BuildPackage,unison))
> diff --git a/package/network/utils/unison/patches/100-ocamlopt.patch
> b/package/network/utils/unison/patches/100-ocamlopt.patch
> new file mode 100644
> index 000..a8132e2
>

inotify_compat.h is missing in unison, this is known upstream.
https://www.marc.info/?l=unison-hackers&m=138390422022273&w=2
Another option is to remove fsmonitor from unison, as the binary
"unison-fsmonitor" is not currently installed onto the target.

--- /dev/null
> +++ b/package/network/utils/unison/patches/100-ocamlopt.patch
> @@ -0,0 +1,225 @@
> +--- /dev/null  2015-08-24 10:52:13.18000 +0200
>  unison-2.48.3/fsmonitor/linux/inotify_compat.h 2015-09-11
> 22:59:01.05600 +0200
> +@@ -0,0 +1,167 @@
> ++/*
> ++ * This header is used if  cannot be found.
> ++ *
> ++ * Inode based directory notification for Linux
> ++ *
> ++ * Copyright (C) 2005 John McCutchan
> ++ */
> ++
> ++#ifndef _LINUX_INOTIFY_H
> ++#define _LINUX_INOTIFY_H
> ++
> ++#include 
> ++#include 
> ++#include 
> ++
> ++/*
> ++ * struct inotify_event - structure read from the inotify device for
> each event
> ++ *
> ++ * When you are watching a directory, you will receive the filename for
> events
> ++ * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the
> wd.
> ++ */
> ++struct inotify_event {
> ++  int wd; /* watch descriptor */
> ++  uint32_tmask;   /* watch mask */
> ++  uint32_tcookie; /* cookie to synchronize
> two events */
> ++  uint32_tlen;/* length (including
> nulls) of name */
> ++  charname __flexarr; /* stub for possible name */
> ++};
> ++
> ++/* the following are legal, implemented events that user-space can watch
> for */
> ++#define IN_ACCESS 0x0001  /* File was accessed */
> ++#define IN_MODIFY 0x0002  /* File was modified */
> ++#define IN_ATTRIB 0x0004  /* Metadata changed */
> ++#define IN_CLOSE_WRITE0x0008  /* Writtable file
> was closed */
> ++#define IN_CLOSE_NOWRITE  0x0010  /* Unwrittable file closed
> */
> ++#define IN_OPEN   0x0020  /* File was opened
> */
> ++#define IN_MOVED_FROM 0x0040  /* File was moved from X */
> ++#define IN_MOVED_TO   0x0080  /* File was moved to Y */
> ++#define IN_CREATE 0x0100  /* Subfile was created */
> ++#define IN_DELETE 0x0200  /* Subfile was deleted */
> ++#define IN_DELETE_SELF0x0400  /* Self was
> deleted */
> ++#define IN_MOVE_SELF  0x0800  /* Self was moved */
> ++
> ++/* the following are legal events.  they are sent as needed to any watch
> */
> ++#define IN_UNMOUNT0x2000  /* Backing fs was
> unmounted */
> ++#define IN_Q_OVERFLOW 0x4000  /* Event queued overflowed
> */
> ++#define IN_IGNORED0x8000  /* File was ignored */
> ++
> ++/* helper events */
> ++#define IN_CLOSE  (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /*
> close */
> ++#define IN_MOVE   (IN_MOVED_FROM | IN_MOVED_TO) /*
> moves */
> ++
> ++/* special flags */
> ++#define

Re: [OpenWrt-Devel] [PATCH] [RFC] toolchain: add OCaml compiler

2015-09-17 Thread Stefan Hellermann
A few ideas about the large binaries compiled with OCaml:

- Currently each OCaml binary contains the OCaml bytecode and the full
OCaml interpreter. This is okay if there is only one binary (in my case
unison), but wasteful in case of multiple binaries on the target. It should
be possible to create a package ocaml-runtime for the target. This would
allow to strip the binaries, which removes the interpreter but leaves the
bytecode.

- There is a patch in debian to allow stipping of OCaml binaries with
included OCaml interpreter:
http://patches.osdyson.org/patch/series/view/ocaml/4.01.0-3+dyson1/0008-Embed-bytecode-in-C-object-when-using-custom.patch
Sadly I haven't got it to work on openwrt.

- OCaml allows native code compilation to get more performance and smaller
binaries. But this is only supported on a few archs (x86, arm, powerpc and
sparc) so I haven't implemented it.

Stefan

2015-09-17 22:40 GMT+02:00 Bastian Bittorf :

> * Stefan Hellermann  [17.09.2015 20:00]:
> > Tested with Unison File Synchronizer on ar71xx and x86_64. Beware:
> > Stripping unison won't work!
> > Better solutions and comments are appreciated!
> >
> > Signed-off-by: Stefan Hellermann 
>
> thank you!
>
> tested and works for me on ar71xx.
> the resulting unison-binary is a little
> bit fat (~2mb gzipped) but thats not your fault 8-)
>
> bye, bastian
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel