[OpenWrt-Devel] [PATCH V2] ar71xx: add support for TP-LINK TL-WA860RE v1

2014-07-12 Thread Cezary Jackiewicz
New router/repeater from TP-LINK

- CPU: Atheros AR9341-DL3A (AP123)
- Flash: 4MB
- Ram: 32MB

Similar to TL-WA850RE

Signed-off-by: Cezary Jackiewicz 
---

Index: target/linux/ar71xx/base-files/etc/diag.sh
===
--- target/linux/ar71xx/base-files/etc/diag.sh  (revision 41592)
+++ target/linux/ar71xx/base-files/etc/diag.sh  (working copy)
@@ -167,6 +167,9 @@
tl-wa850re)
status_led="tp-link:blue:re"
;;
+   tl-wa860re)
+   status_led="tp-link:green:power"
+   ;;
tl-mr3220 | \
tl-mr3220-v2 | \
tl-mr3420 | \
Index: target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
===
--- target/linux/ar71xx/base-files/etc/uci-defaults/01_leds (revision 41592)
+++ target/linux/ar71xx/base-files/etc/uci-defaults/01_leds (working copy)
@@ -234,6 +234,11 @@
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "tp-link:blue:signal5" 
"wlan0" "80" "100" "-79" "13"
;;
 
+tl-wa860re)
+   ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
+   ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+   ;;
+
 tl-wa901nd)
ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
;;
Index: target/linux/ar71xx/base-files/etc/uci-defaults/02_network
===
--- target/linux/ar71xx/base-files/etc/uci-defaults/02_network  (revision 41592)
+++ target/linux/ar71xx/base-files/etc/uci-defaults/02_network  (working copy)
@@ -269,6 +269,7 @@
 tl-mr3040-v2 |\
 tl-wa750re |\
 tl-wa850re |\
+tl-wa860re |\
 tl-wa801nd-v2 |\
 tl-wa901nd |\
 tl-wa901nd-v2 |\
Index: target/linux/ar71xx/base-files/lib/ar71xx.sh
===
--- target/linux/ar71xx/base-files/lib/ar71xx.sh(revision 41592)
+++ target/linux/ar71xx/base-files/lib/ar71xx.sh(working copy)
@@ -145,6 +145,9 @@
"085000"*)
model="TP-Link TL-WA850RE"
;;
+   "086000"*)
+   model="TP-Link TL-WA860RE"
+   ;;
"090100"*)
model="TP-Link TL-WA901N/ND"
;;
@@ -541,6 +544,9 @@
*TL-WA850RE)
name="tl-wa850re"
;;
+   *TL-WA860RE)
+   name="tl-wa860re"
+   ;;
*"TL-WA801ND v2")
name="tl-wa801nd-v2"
;;
Index: target/linux/ar71xx/base-files/lib/upgrade/platform.sh
===
--- target/linux/ar71xx/base-files/lib/upgrade/platform.sh  (revision 41592)
+++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh  (working copy)
@@ -240,6 +240,7 @@
tl-wa7510n | \
tl-wa750re | \
tl-wa850re | \
+   tl-wa860re | \
tl-wa801nd-v2 | \
tl-wa901nd | \
tl-wa901nd-v2 | \
Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c
===
--- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c (revision 41592)
+++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wax50re.c (working copy)
@@ -33,6 +33,12 @@
 #define TL_WAX50RE_GPIO_LED_SIGNAL43
 #define TL_WAX50RE_GPIO_LED_SIGNAL54
 
+#define TL_WA860RE_GPIO_LED_WLAN_ORANGE0
+#define TL_WA860RE_GPIO_LED_WLAN_GREEN 2
+#define TL_WA860RE_GPIO_LED_POWER_ORANGE   12
+#define TL_WA860RE_GPIO_LED_POWER_GREEN14
+#define TL_WA860RE_GPIO_LED_LAN20
+
 #define TL_WA801ND_V2_GPIO_LED_LAN 18
 #define TL_WA801ND_V2_GPIO_LED_SYSTEM  14
 
@@ -39,6 +45,10 @@
 #define TL_WAX50RE_GPIO_BTN_RESET  17
 #define TL_WAX50RE_GPIO_BTN_WPS16
 
+#define TL_WA860RE_GPIO_BTN_RESET  17
+#define TL_WA860RE_GPIO_BTN_WPS16
+#define TL_WA860RE_GPIO_BTN_ONOFF  11
+
 #define TL_WAX50RE_KEYS_POLL_INTERVAL  20  /* msecs */
 #define TL_WAX50RE_KEYS_DEBOUNCE_INTERVAL (3 * TL_WAX50RE_KEYS_POLL_INTERVAL)
 
@@ -123,7 +133,31 @@
},
 };
 
+static struct gpio_led tl_wa860re_leds_gpio[] __initdata = {
+   {
+   .name   = "tp-link:green:lan",
+   .gpio   = TL_WA860RE_GPIO_LED_LAN,
+   .active_low = 1,
+   }, {
+   .name   = "tp-link:green:power",
+   .gpio   = TL_WA860RE_GPIO_LED_POWER_GREEN,
+   .active_low = 1,
+   }, {
+   .name   = "tp-link:orange:power",
+   .gpio   = TL_WA860RE_GPIO_LED_POWER_ORANGE,
+   .active_low = 1,
+   }, {
+   .name   = "tp-link:green:wlan",
+   .gpio   = TL_WA860RE_GPIO_LED_WLAN_GREEN,
+   .active_low = 1,
+   }, {
+   .name   = "t

Re: [OpenWrt-Devel] How to properly add an unreachable route?

2014-07-12 Thread Gui Iribarren
On 12/07/14 20:10, Dave Taht wrote:
> I have been trying to simplify my babel setup. I have
> 8 /27s out of a single /24 that I would like not
> to have to expose to the universe.
> 
> I have 172.21.2.0/27, 172.21.2.64/27 etc
> on each of the 8 devices I have.
> 
> But there is no need to export each /27, as these
> are out of a single /24.
> 
> The way to do that is to setup /etc/babel.conf to only
> let /24s out...
> 
> redistribute ip 0.0.0.0/0 le 24 allow
> redistribute local deny
> 
> (this can also easily be expressed in the /etc/config/babeld
>  file)
> 
> And at the moment, I add this to /etc/firewall.user
> to add the covering route locally. 
> 
> ip route add unreachable 172.21.2.0/24 proto static
> 
> Boom, I go from exporting 16 routes to 1.
> 
> Where I'm stuck is on how to express the above line
> inside of uci and luci. Luci demands both a specific
> interface name and a numeric destination, if you are
> trying this via the route method.
> 
> If you try the otherwise promising uci newfangled "rule" method
> by adding something like this to /etc/config/network
> 
> config rule
>   option dest   '172.21.2.0/24'
>   option action 'unreachable'
> 
> You end up bricking the router's network setup.

mmh..

this is how i set it up with "ip" on a debian system

ip -6 route add unreachable 2a00:1508:1:f000::/52

and then i add the smaller, more specific prefixes (/64) that i actually
use.

maybe adding a *rule* with action unreachable has an earlier precedence,
and more specific routes will never be read?

citing openwrt wiki: "action unreachable: When reaching the rule,
respond with ICMP unreachable messages and abort route lookup"

sadly, i don't see how an "unreachable" type route could be configured
via uci. It seems the "config route" section is limited to "unicast"
type routes.

$ ip -6 route help
Usage:
[snip]
 ip route { add | del | change | append | replace } ROUTE
[snip]
TYPE := [ unicast | local | broadcast | multicast | throw |
  unreachable | prohibit | blackhole | nat ]

so, going back to the "rule" way, maybe try adding first specific rules
that allow routes to be looked up, and add the "unreachable" action at
the end?

config rule
option dest   '172.21.2.32/27'
option lookup 'main'

config rule
option dest   '172.21.2.0/24'
option action 'unreachable'

i'm just hypothesizing, tho

cheers!!

> 
> http://wiki.openwrt.org/doc/uci/network#routing.actions
> ___
> 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] Squirrel instead of Lua?

2014-07-12 Thread Paul Sokolovsky
Hello,

On Sat, 12 Jul 2014 23:13:37 +0200
"valent.turko...@gmail.com"  wrote:

> Hi devs,
> after listening to Amp Hour podcast ep 202 [1], interview With Brandon
> Harris from Electric Imp, which was impressive I heard something
> really alarming.
> 
> Whey were using Lua in their product previous to launch, but they were
> so strongly againgst shipping it with Lua because they realized that
> it would hold them down too much that they scrapped EVERYTHING one
> week before shipping and started looking for a better alternative.
> 
> They found Squirrel [2], so first question that popped into my mind
> was - is there Squirrel for OpenWrt. And from what I have seen so far
> there is not.
> 
> Has anybody used Squirrel? Would it make sense to look into it and
> would it be benificial to OpenWrt as a project to also switch from Lua
> to Squirrel?

Squirrel was on my radar for 3-4 years as unbloated scripting language.
A year ago, after failing to get a Stockholm syndrome for Lua's
ugliness, I started a project to make Squirrel a general purpose
scripting language (Squirrel on its own is "marketed" as embedded
language (as in "embedded in another application")):

https://github.com/pfalcon/squirrel-modules
http://forum.squirrel-lang.org/mainsite/forums/default.aspx?g=posts&t=3122

I found that there's lack of momentum and interest in making Squirrel
something more than it currently is. The maintainer in particular not
interested in making much, if at all, changes to the language, and
people who hack on the language core are fragmented in both space and
time.

> My sense is that it is not that critical because OpenWrt hardvare is
> so limited as one used by Electric Imp, but still it would be nice to
> have a more optimal language so that OpenWrt can ce used more in
> Internet Of Things arena...

Yes, definitely. But based on the above experience, as soon as I heard
about MicroPython project, I put on hold any Squirrel activity, instead
motivating MicroPython author to release it as OpenSource sooner rather
than latter, and since the code was released, I'm fervently hacking on
it instead. Python has active and wide community, and MicroPython is
pretty good technically. So, if you're interested in good, unbloated
high-level language, please consider looking at MicroPython - I now
posted an announcement in separate thread.

> 
> Cheers,
> Valent.
> 
> [1]
> http://www.theamphour.com/202-an-interview-with-brandon-harris-impish-internet-iamatology/
> [2] https://en.wikipedia.org/wiki/Squirrel_%28programming_language%29
> ___ openwrt-devel mailing
> list openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



-- 
Best regards,
 Paul  mailto:pmis...@gmail.com
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] How to properly add an unreachable route?

2014-07-12 Thread Dave Taht
I have been trying to simplify my babel setup. I have
8 /27s out of a single /24 that I would like not
to have to expose to the universe.

I have 172.21.2.0/27, 172.21.2.64/27 etc
on each of the 8 devices I have.

But there is no need to export each /27, as these
are out of a single /24.

The way to do that is to setup /etc/babel.conf to only
let /24s out...

redistribute ip 0.0.0.0/0 le 24 allow
redistribute local deny

(this can also easily be expressed in the /etc/config/babeld
 file)

And at the moment, I add this to /etc/firewall.user
to add the covering route locally. 

ip route add unreachable 172.21.2.0/24 proto static

Boom, I go from exporting 16 routes to 1.

Where I'm stuck is on how to express the above line
inside of uci and luci. Luci demands both a specific
interface name and a numeric destination, if you are
trying this via the route method.

If you try the otherwise promising uci newfangled "rule" method
by adding something like this to /etc/config/network

config rule
option dest   '172.21.2.0/24'
option action 'unreachable'

You end up bricking the router's network setup.

http://wiki.openwrt.org/doc/uci/network#routing.actions
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Squirrel instead of Lua?

2014-07-12 Thread Rafał Miłecki
On 12 July 2014 23:13, valent.turko...@gmail.com
 wrote:
> They found Squirrel [2], so first question that popped into my mind
> was - is there Squirrel for OpenWrt. And from what I have seen so far
> there is not.
>
> Has anybody used Squirrel? Would it make sense to look into it and
> would it be benificial to OpenWrt as a project to also switch from Lua
> to Squirrel?

AFAIK lua is used for LuCI only, and there is LuCI2 project which
doesn't use lua anymore. So if you want to spend some time on killing
lua, I suggest working on LuCI2.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] brcm63xx: Add support for ZyXEL P870HW-51a v2

2014-07-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
index aa32099..964f5ba 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -85,7 +85,8 @@ DVG3810BN)
 96368M-1541N |\
 96368MVNgr |\
 "F@ST2504n" |\
-"F@ST2704V2")
+"F@ST2704V2" |\
+P870HW-51a_v2)
ucidef_set_interface_lan "eth0.1"
ucidef_add_switch "eth0" "1" "1"
ucidef_add_switch_vlan "eth0" "1" "0 1 2 3 8t"
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index 9c966e7..560bb20 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -27,6 +27,7 @@ case "$board_name" in
CPVA642 |\
CT6373-1 |\
MAGIC |\
+   P870HW-51a_v2 |\
RTA770BW |\
RTA770W |\
V2110 |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh 
b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 74e6a0d..1029fe3 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -135,6 +135,11 @@ brcm63xx_detect() {
brcm63xx_has_reset_button="true"
ifname=eth0
;;
+   P870HW-51a_v2)
+   brcm63xx_has_reset_button="true"
+   status_led="P870HW-51a:green:power"
+   ifname="eth0"
+   ;;
RTA770BW)
brcm63xx_has_reset_button="true"
status_led="RTA770BW:green:diag"
diff --git a/target/linux/brcm63xx/image/Makefile 
b/target/linux/brcm63xx/image/Makefile
index f36d182..689b3c6 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -111,6 +111,20 @@ define Image/Build/SPW303V
rm -f $(BIN_DIR)/openwrt-$(4)-$(1)-cfe.bin.tmp
 endef
 
+define Image/Build/ZyXEL
+   # Generate the tagged image
+   $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f 
$(KDIR)/root.$(1) \
+   --output $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
+   --boardid $(2) --chipid $(4) --entry $(KERNEL_ENTRY) \
+   --load-addr $(LOADADDR) --rsa-signature "$(6)" \
+   --info1 "+$(call Image/LimitName16,$(3))" --info2 $(1) \
+   $(7) $(8) $(9) $(10)
+   # Fix up header
+   $(STAGING_DIR_HOST)/bin/zyxbcm -i $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
+   -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin
+   #rm -f $(BIN_DIR)/openwrt-$(5)-$(1).tmp
+endef
+
 define Image/Build/CFEOLD
$(TOPDIR)/scripts/brcmImage.pl -t -p\
-b $(2) -c $(3) \
@@ -215,6 +229,8 @@ define Image/Build
$(call Image/Build/CFEFIXUP,$(1),96348GW,GW6200,6348,GW6200,$(shell 
printf '\x99'))
# Neufbox4
$(call Image/Build/CFE,$(1),96358VW,6358,NEUFBOX4,OpenWRT-$(REVISION))
+   # Zyxel P870HW-51a v2
+   $(call 
Image/Build/ZyXEL,$(1),96368VVW,P870HW-51a_v2,6368,P870HW-51a_v2,ZyXEL,--signature
 "ZyXEL_0001")
 
# Neufbox6
$(call 
Image/Build/CFE,$(1),NB6-SER-r0,6362,NEUFBOX6,OpenWRT-$(REVISION))
diff --git a/target/linux/brcm63xx/patches-3.10/564-board_P870HW-51a_v2.patch 
b/target/linux/brcm63xx/patches-3.10/564-board_P870HW-51a_v2.patch
new file mode 100644
index 000..2492e5e
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.10/564-board_P870HW-51a_v2.patch
@@ -0,0 +1,100 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -4450,6 +4450,89 @@ static struct board_info __initdata boar
+   .has_ehci0 = 1,
+ };
+ 
++static struct board_info __initdata board_P870HW51A_V2 = {
++  .name   = "P870HW-51a_v2",
++  .expected_cpu_id= 0x6368,
++
++  .has_uart0  = 1,
++  .has_pci= 1,
++  .has_ohci0  = 1,
++  .has_ehci0  = 1,
++
++  .has_enetsw = 1,
++  .enetsw = {
++  .used_ports = {
++  [0] = {
++  .used   = 1,
++  .phy_id = 1,
++  .name   = "port1",
++  },
++  [1] = {
++  .used   = 1,
++  .phy_id = 2,
++  .name   = "port2",
++  },
++  [2] = {
++  .used   = 1,
++  .phy_id = 3,
++  .name   = "port3",
++  },
++  [3] = {
++  .used   = 1,
++  

[OpenWrt-Devel] [PATCH 1/2] firmware-utils: add new tool for fixing headers on ZyXEL devices (brcm63xx)

2014-07-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 64eccdd..d5cfdaa 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -49,6 +49,7 @@ define Host/Compile
$(call cc,mkchkimg)
$(call cc,mkzcfw cyg_crc32)
$(call cc,spw303v)
+   $(call cc,zyxbcm)
$(call cc,trx2edips)
$(call cc,xorimage)
$(call cc,buffalo-enc buffalo-lib, -Wall)
diff --git a/tools/firmware-utils/src/zyxbcm.c 
b/tools/firmware-utils/src/zyxbcm.c
new file mode 100644
index 000..96630e5
--- /dev/null
+++ b/tools/firmware-utils/src/zyxbcm.c
@@ -0,0 +1,269 @@
+/*
+ * zyxbcm.c - based on Jonas Gorski's spw303v.c
+ *
+ * Copyright (C) 2014 Álvaro Fernández Rojas 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define TAGVER_LEN 4   /* Length of Tag 
Version */
+#define TAGLAYOUT_LEN 4/* Length of 
FlashLayoutVer */
+#define SIG1_LEN 20/* Company 
Signature 1 Length */
+#define SIG2_LEN 14/* Company 
Signature 2 Lenght */
+#define BOARDID_LEN 16 /* Length of BoardId */
+#define ENDIANFLAG_LEN 2   /* Endian Flag Length */
+#define CHIPID_LEN 6   /* Chip Id Length */
+#define IMAGE_LEN 10   /* Length of Length 
Field */
+#define ADDRESS_LEN 12 /* Length of Address 
field */
+#define DUALFLAG_LEN 2 /* Dual Image flag 
Length */
+#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length 
*/
+#define RSASIG_LEN 20  /* Length of RSA 
Signature in tag */
+#define TAGINFO1_LEN 30/* Length of 
vendor information field1 in tag */
+#define ZYX_TAGINFO1_LEN 20/* Length of vendor 
information field1 in tag */
+#define FLASHLAYOUTVER_LEN 4   /* Length of Flash Layout 
Version String tag */
+#define ZYX_FLASHLAYOUTVER_LEN 2   /* Length of Flash Layout 
Version String tag */
+#define TAGINFO2_LEN 16/* Length of 
vendor information field2 in tag */
+#define CRC_LEN 4  /* Length of 
CRC in bytes */
+#define ALTTAGINFO_LEN 54  /* Alternate length for 
vendor information; Pirelli */
+
+#define IMAGETAG_CRC_START 0x
+
+struct bcm_tag {
+   char tagVersion[TAGVER_LEN];// 0-3: 
Version of the image tag
+   char sig_1[SIG1_LEN];   
// 4-23: Company Line 1
+   char sig_2[SIG2_LEN];   
// 24-37: Company Line 2
+   char chipid[CHIPID_LEN];
// 38-43: Chip this image is for
+   char boardid[BOARDID_LEN];  
// 44-59: Board name
+   char big_endian[ENDIANFLAG_LEN];// 
60-61: Map endianness -- 1 BE 0 LE
+   char totalLength[IMAGE_LEN];// 
62-71: Total length of image
+   char cfeAddress[ADDRESS_LEN];   // 
72-83: Address in memory of CFE
+   char cfeLength[IMAGE_LEN];  
// 84-93: Size of CFE
+   char flashImageStart[ADDRESS_LEN];  // 
94-105: Address in memory of image start (kernel for OpenWRT, rootfs for stock 
firmware)
+   char flashRootLength[IMAGE_LEN];// 
106-115: Size of rootfs for flashing
+   char kernelAddress[ADDRESS_LEN];// 
116-127: Address in memory of kernel
+   char kernelLength[IMAGE_LEN];   // 
128-137: Size of kernel
+   char dualImage[DUALFLAG_LEN];   //

[OpenWrt-Devel] [PATCH V2 2/2] brcm63xx: Add support for Comtrend VR-3025un

2014-07-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Signed off by: José Vázquez Fernández 
---
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
index 1d42d47..aa32099 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -81,6 +81,7 @@ DVG3810BN)
 96328A-1441N1 |\
 963281TAN |\
 963281T_TEF |\
+96368M-1341N |\
 96368M-1541N |\
 96368MVNgr |\
 "F@ST2504n" |\
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index 7d9a6f7..9c966e7 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -19,6 +19,7 @@ case "$board_name" in
963281TAN |\
963281T_TEF |\
96358-502V |\
+   96368M-1341N |\
96368M-1541N |\
96369R-1231N |\
AW4339U |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh 
b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 85d499e..74e6a0d 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -57,6 +57,11 @@ brcm63xx_detect() {
brcm63xx_has_reset_button="true"
ifname=eth0
;;
+   96368M-1341N)
+   brcm63xx_has_reset_button="true"
+   status_led="VR-3025un:green:power"
+   ifname="eth0"
+   ;;
96368M-1541N)
brcm63xx_has_reset_button="true"
status_led="VR-3025u:green:power"
diff --git a/target/linux/brcm63xx/image/Makefile 
b/target/linux/brcm63xx/image/Makefile
index 01235e4..f36d182 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -232,6 +232,8 @@ define Image/Build
$(call Image/Build/CFE,$(1),96328A-1441N1,6328,AR-5387un,,--pad 8)
# Comtrend VR-3025u
$(call Image/Build/CFE,$(1),96368M-1541N,6368,VR-3025u,,--pad 16)
+   # Comtrend VR-3025un
+   $(call Image/Build/CFE,$(1),96368M-1341N,6368,VR-3025un,,--pad 4)
# Comtrend WAP-5813n
$(call Image/Build/CFE,$(1),96369R-1231N,6368,WAP-5813n,,--pad 4)
# Davolink DV201AMR
diff --git a/target/linux/brcm63xx/patches-3.10/563-board_VR-3025un.patch 
b/target/linux/brcm63xx/patches-3.10/563-board_VR-3025un.patch
new file mode 100644
index 000..73d95e5
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.10/563-board_VR-3025un.patch
@@ -0,0 +1,109 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -4542,6 +4542,98 @@ static struct board_info __initdata boar
+   },
+ };
+ 
++static struct board_info __initdata board_VR3025un = {
++  .name   = "96368M-1341N",
++  .expected_cpu_id= 0x6368,
++
++  .has_uart0  = 1,
++  .has_pci= 1,
++  .has_ohci0  = 1,
++  .has_ehci0  = 1,
++
++  .has_enetsw = 1,
++  .enetsw = {
++  .used_ports = {
++  [0] = {
++  .used   = 1,
++  .phy_id = 1,
++  .name   = "port1",
++  },
++  [1] = {
++  .used   = 1,
++  .phy_id = 2,
++  .name   = "port2",
++  },
++  [2] = {
++  .used   = 1,
++  .phy_id = 3,
++  .name   = "port3",
++  },
++  [3] = {
++  .used   = 1,
++  .phy_id = 4,
++  .name   = "port4",
++  },
++  },
++  },
++
++  .leds = {
++  {
++  .name   = "VR-3025un:green:dsl",
++  .gpio   = 2,
++  .active_low = 1,
++  },
++  {
++  .name   = "VR-3025un:green:inet",
++  .gpio   = 5,
++  },
++  {
++  .name   = "VR-3025un:green:lan1",
++  .gpio   = 6,
++  .active_low = 1,
++  },
++  {
++  .name   = "VR-3025un:green:lan2",
++  .gpio   = 7,
++  .active_low = 1,
++  },
++   

[OpenWrt-Devel] [PATCH V2 1/2] brcm63xx: Add support for Comtrend VR-3025u

2014-07-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
Signed off by: José Vázquez Fernández 
---
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
index a04f4a5..1d42d47 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/02_network
@@ -81,6 +81,7 @@ DVG3810BN)
 96328A-1441N1 |\
 963281TAN |\
 963281T_TEF |\
+96368M-1541N |\
 96368MVNgr |\
 "F@ST2504n" |\
 "F@ST2704V2")
diff --git a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc 
b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
index 2f5e09b..7d9a6f7 100755
--- a/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
+++ b/target/linux/brcm63xx/base-files/etc/uci-defaults/09_fix_crc
@@ -19,6 +19,7 @@ case "$board_name" in
963281TAN |\
963281T_TEF |\
96358-502V |\
+   96368M-1541N |\
96369R-1231N |\
AW4339U |\
"CPVA502+" |\
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh 
b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index fcd9281..85d499e 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -57,6 +57,11 @@ brcm63xx_detect() {
brcm63xx_has_reset_button="true"
ifname=eth0
;;
+   96368M-1541N)
+   brcm63xx_has_reset_button="true"
+   status_led="VR-3025u:green:power"
+   ifname="eth0"
+   ;;
96369R-1231N)
brcm63xx_has_reset_button="true"
status_led="WAP-5813n:green:power"
diff --git a/target/linux/brcm63xx/image/Makefile 
b/target/linux/brcm63xx/image/Makefile
index 11d7678..01235e4 100755
--- a/target/linux/brcm63xx/image/Makefile
+++ b/target/linux/brcm63xx/image/Makefile
@@ -230,6 +230,8 @@ define Image/Build
$(call Image/Build/CFE,$(1),96328A-1241N,6328,AR-5381u,,--pad 8)
# Comtrend AR-5387un
$(call Image/Build/CFE,$(1),96328A-1441N1,6328,AR-5387un,,--pad 8)
+   # Comtrend VR-3025u
+   $(call Image/Build/CFE,$(1),96368M-1541N,6368,VR-3025u,,--pad 16)
# Comtrend WAP-5813n
$(call Image/Build/CFE,$(1),96369R-1231N,6368,WAP-5813n,,--pad 4)
# Davolink DV201AMR
diff --git a/target/linux/brcm63xx/patches-3.10/562-board_VR-3025u.patch 
b/target/linux/brcm63xx/patches-3.10/562-board_VR-3025u.patch
new file mode 100644
index 000..83b607f
--- /dev/null
+++ b/target/linux/brcm63xx/patches-3.10/562-board_VR-3025u.patch
@@ -0,0 +1,109 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -4450,6 +4450,98 @@ static struct board_info __initdata boar
+   .has_ehci0 = 1,
+ };
+ 
++static struct board_info __initdata board_VR3025u = {
++  .name   = "96368M-1541N",
++  .expected_cpu_id= 0x6368,
++
++  .has_uart0  = 1,
++  .has_pci= 1,
++  .has_ohci0  = 1,
++  .has_ehci0  = 1,
++
++  .has_enetsw = 1,
++  .enetsw = {
++  .used_ports = {
++  [0] = {
++  .used   = 1,
++  .phy_id = 1,
++  .name   = "port1",
++  },
++  [1] = {
++  .used   = 1,
++  .phy_id = 2,
++  .name   = "port2",
++  },
++  [2] = {
++  .used   = 1,
++  .phy_id = 3,
++  .name   = "port3",
++  },
++  [3] = {
++  .used   = 1,
++  .phy_id = 4,
++  .name   = "port4",
++  },
++  },
++  },
++
++  .leds = {
++  {
++  .name   = "VR-3025u:green:dsl",
++  .gpio   = 2,
++  .active_low = 1,
++  },
++  {
++  .name   = "VR-3025u:green:inet",
++  .gpio   = 5,
++  },
++  {
++  .name   = "VR-3025u:green:lan1",
++  .gpio   = 6,
++  .active_low = 1,
++  },
++  {
++  .name   = "VR-3025u:green:lan2",
++  .gpio   = 7,
++  .active_low = 1,
++  },
++   

[OpenWrt-Devel] Squirrel instead of Lua?

2014-07-12 Thread valent.turko...@gmail.com
Hi devs,
after listening to Amp Hour podcast ep 202 [1], interview With Brandon
Harris from Electric Imp, which was impressive I heard something
really alarming.

Whey were using Lua in their product previous to launch, but they were
so strongly againgst shipping it with Lua because they realized that
it would hold them down too much that they scrapped EVERYTHING one
week before shipping and started looking for a better alternative.

They found Squirrel [2], so first question that popped into my mind
was - is there Squirrel for OpenWrt. And from what I have seen so far
there is not.

Has anybody used Squirrel? Would it make sense to look into it and
would it be benificial to OpenWrt as a project to also switch from Lua
to Squirrel?

My sense is that it is not that critical because OpenWrt hardvare is
so limited as one used by Electric Imp, but still it would be nice to
have a more optimal language so that OpenWrt can ce used more in
Internet Of Things arena...

Cheers,
Valent.

[1] 
http://www.theamphour.com/202-an-interview-with-brandon-harris-impish-internet-iamatology/
[2] https://en.wikipedia.org/wiki/Squirrel_%28programming_language%29
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 14/17] atheros[ar231x-eth]: pass PHY I/O memory via device resources

2014-07-12 Thread Felix Fietkau
On 2014-07-12 17:16, Sergey Ryazanov wrote:
> 2014-07-12 18:37 GMT+04:00 Felix Fietkau :
>> On 2014-07-12 15:33, Sergey Ryazanov wrote:
>>> Pass PHY I/O memory region via platform resources and remap them
>>> unconditionally.
>>>
>>> Signed-off-by: Sergey Ryazanov 
>>
>>> diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
>>> b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>>> index 0e158d4..a9dcab2 100644
>>> --- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>>> +++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>>> @@ -266,17 +266,19 @@
>>>  +/**
>>>  + * When there's only one MAC, PHY regs are typically on ENET0,
>>>  + * even though the MAC might be on ENET1.
>>> -+ * Needto remap PHY regs separately in this case
>>> ++ * So remap PHY regs separately.
>>>  + */
>>> -+if (ar_eth_base == sp->cfg->phy_base)
>>> -+sp->phy_regs = sp->eth_regs;
>>> -+else {
>>> -+sp->phy_regs = ioremap_nocache(sp->cfg->phy_base,
>>> -+   sizeof(*sp->phy_regs));
>>> -+if (!sp->phy_regs) {
>>> -+printk("Can't remap phy registers\n");
>>> -+return -ENXIO;
>>> -+}
>>> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii");
>>> ++if (!res) {
>>> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>>> ++   "eth1_mii");
>>> ++if (!res)
>>> ++return -ENODEV;
>> Wouldn't it be better to remove the eth0_/eth1_ prefix from the resource
>> names instead of making the driver search for both?
>>
> Yes, I know this code is ugly, but I can't find better solution and
> prefer to keep this one for two reasons.
> 
> First, AR5312 SoC have two ethernet blocks and arch code register
> devices for each of them, so we need different names.
> 
> Second reason is nicer /proc/iomem look:
> 
>  * for ar2315 based board:
> root@OpenWrt:~# cat /proc/iomem | grep eth
> 1050-10501fff : eth0_membase
>   10500014-1050001b : eth0_mii
> 
>  * for ar2313 based board:
> root@OpenWrt:~# cat /proc/iomem | grep eth
> 18100014-1810001b : eth0_mii
> 1820-18201fff : eth1_membase
Makes sense, thanks for the explanation.

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


Re: [OpenWrt-Devel] [PATCH 14/17] atheros[ar231x-eth]: pass PHY I/O memory via device resources

2014-07-12 Thread Sergey Ryazanov
2014-07-12 18:37 GMT+04:00 Felix Fietkau :
> On 2014-07-12 15:33, Sergey Ryazanov wrote:
>> Pass PHY I/O memory region via platform resources and remap them
>> unconditionally.
>>
>> Signed-off-by: Sergey Ryazanov 
>
>> diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
>> b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>> index 0e158d4..a9dcab2 100644
>> --- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>> +++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
>> @@ -266,17 +266,19 @@
>>  +/**
>>  + * When there's only one MAC, PHY regs are typically on ENET0,
>>  + * even though the MAC might be on ENET1.
>> -+ * Needto remap PHY regs separately in this case
>> ++ * So remap PHY regs separately.
>>  + */
>> -+if (ar_eth_base == sp->cfg->phy_base)
>> -+sp->phy_regs = sp->eth_regs;
>> -+else {
>> -+sp->phy_regs = ioremap_nocache(sp->cfg->phy_base,
>> -+   sizeof(*sp->phy_regs));
>> -+if (!sp->phy_regs) {
>> -+printk("Can't remap phy registers\n");
>> -+return -ENXIO;
>> -+}
>> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii");
>> ++if (!res) {
>> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
>> ++   "eth1_mii");
>> ++if (!res)
>> ++return -ENODEV;
> Wouldn't it be better to remove the eth0_/eth1_ prefix from the resource
> names instead of making the driver search for both?
>
Yes, I know this code is ugly, but I can't find better solution and
prefer to keep this one for two reasons.

First, AR5312 SoC have two ethernet blocks and arch code register
devices for each of them, so we need different names.

Second reason is nicer /proc/iomem look:

 * for ar2315 based board:
root@OpenWrt:~# cat /proc/iomem | grep eth
1050-10501fff : eth0_membase
  10500014-1050001b : eth0_mii

 * for ar2313 based board:
root@OpenWrt:~# cat /proc/iomem | grep eth
18100014-1810001b : eth0_mii
1820-18201fff : eth1_membase


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


Re: [OpenWrt-Devel] Symmetric MultiProcessing broken for IXP4xx arch.

2014-07-12 Thread Carlos Ferreira
Well, like I said, beyond Linux 3.14 kernel version, the field is defined
if CONFIG_SYSFS is active.
I will contact the netmap developers to see if they are available to update
the source.



On 12 July 2014 15:58, Felix Fietkau  wrote:

> On 2014-07-12 16:51, Carlos Ferreira wrote:
> > Yes I know that, but the thing is, for the 3.10 kernel, CONFIG_RPS
> > depends on CONFIG_SMP.
> > CONFIG_RPS enables the definition of  real_num_rx_queues field for the
> > netdev_rx_queue struct (netdevice.h). Netmap requires the existence of
> > the real_num_rx_queues field. I cannot compile it CONFIG_RPS is not
> active.
> > Beyond 3.13 (I think), the real_num_rx_queues field is defined if
> > CONFIG_SYSFS is defined.
> I would suggest that you fix this in netmap instead. Especially for
> something as trivial as this, it makes no sense to try to enable SMP on
> a non-SMP device.
>
> - Felix
>



-- 

Carlos Miguel Ferreira
Researcher at Telecommunications Institute
Aveiro - Portugal
Work E-mail - c...@av.it.pt
Skype & GTalk -> carlosmf...@gmail.com
LinkedIn -> http://www.linkedin.com/in/carlosmferreira
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Symmetric MultiProcessing broken for IXP4xx arch.

2014-07-12 Thread Felix Fietkau
On 2014-07-12 16:51, Carlos Ferreira wrote:
> Yes I know that, but the thing is, for the 3.10 kernel, CONFIG_RPS
> depends on CONFIG_SMP.
> CONFIG_RPS enables the definition of  real_num_rx_queues field for the
> netdev_rx_queue struct (netdevice.h). Netmap requires the existence of
> the real_num_rx_queues field. I cannot compile it CONFIG_RPS is not active.
> Beyond 3.13 (I think), the real_num_rx_queues field is defined if
> CONFIG_SYSFS is defined.
I would suggest that you fix this in netmap instead. Especially for
something as trivial as this, it makes no sense to try to enable SMP on
a non-SMP device.

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


Re: [OpenWrt-Devel] Symmetric MultiProcessing broken for IXP4xx arch.

2014-07-12 Thread Carlos Ferreira
Yes I know that, but the thing is, for the 3.10 kernel, CONFIG_RPS depends
on CONFIG_SMP.
CONFIG_RPS enables the definition of  real_num_rx_queues field for the
netdev_rx_queue struct (netdevice.h). Netmap requires the existence of the
real_num_rx_queues field. I cannot compile it CONFIG_RPS is not active.
Beyond 3.13 (I think), the real_num_rx_queues field is defined if
CONFIG_SYSFS is defined.



On 12 July 2014 15:40, Felix Fietkau  wrote:

> On 2014-07-12 16:29, Carlos Ferreira wrote:
> > I'm having an issue with OpenWRT trunk where it seems
> > that SMP (Symmetric MultiProcessing) is marked as being Broken, for the
> > IXP4xx arch and I'm trying to compile netmap
> >  for the Cambria SBC. Netmap
> > requires the kernel to have SMP active.
> > Can anyone tell me if there is a reason for the SMP being broken
> > (incompatibility issues or other reasons)?
> >
> > Thanks for the Info!
> It's not a multiprocessor SoC, so enabling SMP for it makes no sense.
>
> - Felix
>



-- 

Carlos Miguel Ferreira
Researcher at Telecommunications Institute
Aveiro - Portugal
Work E-mail - c...@av.it.pt
Skype & GTalk -> carlosmf...@gmail.com
LinkedIn -> http://www.linkedin.com/in/carlosmferreira
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Symmetric MultiProcessing broken for IXP4xx arch.

2014-07-12 Thread Felix Fietkau
On 2014-07-12 16:29, Carlos Ferreira wrote:
> I'm having an issue with OpenWRT trunk where it seems
> that SMP (Symmetric MultiProcessing) is marked as being Broken, for the
> IXP4xx arch and I'm trying to compile netmap
>  for the Cambria SBC. Netmap
> requires the kernel to have SMP active.
> Can anyone tell me if there is a reason for the SMP being broken
> (incompatibility issues or other reasons)?
> 
> Thanks for the Info!
It's not a multiprocessor SoC, so enabling SMP for it makes no sense.

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


Re: [OpenWrt-Devel] [PATCH 14/17] atheros[ar231x-eth]: pass PHY I/O memory via device resources

2014-07-12 Thread Felix Fietkau
On 2014-07-12 15:33, Sergey Ryazanov wrote:
> Pass PHY I/O memory region via platform resources and remap them
> unconditionally.
> 
> Signed-off-by: Sergey Ryazanov 

> diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
> b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
> index 0e158d4..a9dcab2 100644
> --- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
> +++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
> @@ -266,17 +266,19 @@
>  +/**
>  + * When there's only one MAC, PHY regs are typically on ENET0,
>  + * even though the MAC might be on ENET1.
> -+ * Needto remap PHY regs separately in this case
> ++ * So remap PHY regs separately.
>  + */
> -+if (ar_eth_base == sp->cfg->phy_base)
> -+sp->phy_regs = sp->eth_regs;
> -+else {
> -+sp->phy_regs = ioremap_nocache(sp->cfg->phy_base,
> -+   sizeof(*sp->phy_regs));
> -+if (!sp->phy_regs) {
> -+printk("Can't remap phy registers\n");
> -+return -ENXIO;
> -+}
> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eth0_mii");
> ++if (!res) {
> ++res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> ++   "eth1_mii");
> ++if (!res)
> ++return -ENODEV;
Wouldn't it be better to remove the eth0_/eth1_ prefix from the resource
names instead of making the driver search for both?

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


[OpenWrt-Devel] Symmetric MultiProcessing broken for IXP4xx arch.

2014-07-12 Thread Carlos Ferreira
I'm having an issue with OpenWRT trunk where it seems that SMP (Symmetric
MultiProcessing) is marked as being Broken, for the IXP4xx arch and I'm
trying to compile netmap  for the
Cambria SBC. Netmap requires the kernel to have SMP active.
Can anyone tell me if there is a reason for the SMP being broken
(incompatibility issues or other reasons)?

Thanks for the Info!

-- 

Carlos Miguel Ferreira
Researcher at Telecommunications Institute
Aveiro - Portugal
Work E-mail - c...@av.it.pt
Skype & GTalk -> carlosmf...@gmail.com
LinkedIn -> http://www.linkedin.com/in/carlosmferreira
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 00/17] atheros: I/O cleanups

2014-07-12 Thread Sergey Ryazanov
2014-07-12 17:33 GMT+04:00 Sergey Ryazanov :
> Main goals of this series:
>  * Simplify interface between arch code and SoC drivers
>  * Simplify internal realization of arch code
>  * Make code consistent with mainstream kernel rules and practice
>
Forgot to say, that this series extensively tested with FON2202
(ar2315 based) and D-Link DWL-2100AP (ar2313 based), but tests are not
done with AR2317/8 and AR5312, since I have no access to such boards
now :(

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


[OpenWrt-Devel] [Patch] [ar71xx] added support for TL-WA830RE V2

2014-07-12 Thread Fredrik Jonson
Corrected patch ath79 insted of auth79. Sorry.

Signed-off-by: Fredrik Jonson 
---
 target/linux/ar71xx/base-files/etc/diag.sh |   1 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   5 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-3.10|   1 +
 .../files/arch/mips/ath79/mach-tl-wa830re-v2.c | 132 +
 target/linux/ar71xx/image/Makefile |   3 +-
 target/linux/ar71xx/mikrotik/config-default|   1 +
 .../714-MIPS-ath79-add-TL-WA830REv2-support.patch  |  42 +++
 10 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c
 create mode 100644 
target/linux/ar71xx/patches-3.10/714-MIPS-ath79-add-TL-WA830REv2-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index ef172b4..d2e4937 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -184,6 +184,7 @@ get_status_led() {
tl-wr841n-v1 | \
tl-wr841n-v7 | \
tl-wr841n-v8 | \
+   tl-wa830re-v2 | \
tl-wr842n-v2 | \
tl-wr941nd)
status_led="tp-link:green:system"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds 
b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index fe5ff93..ebc8942 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -286,6 +286,11 @@ tl-wr841n-v8)
ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
;;
 
+tl-wa830re-v2)
+   ucidef_set_led_netdev "lan" "LAN" "tp-link:green:lan" "eth0"
+   ucidef_set_led_wlan "wlan" "WLAN" "tp-link:green:wlan" "phy0tpt"
+   ;;
+
 tl-wr841n-v9)
ucidef_set_led_netdev "wan" "WAN" "tp-link:green:wan" "eth1"
ucidef_set_led_switch "lan1" "LAN1" "tp-link:green:lan1" "switch0" 
"0x10"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network 
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 646425c..6a43d03 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -269,6 +269,7 @@ tl-mr3040 |\
 tl-mr3040-v2 |\
 tl-wa750re |\
 tl-wa850re |\
+tl-wa830re-v2 |\
 tl-wa801nd-v2 |\
 tl-wa901nd |\
 tl-wa901nd-v2 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index bd277ab..88a1c86 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -541,6 +541,9 @@ ar71xx_board_detect() {
*TL-WA850RE)
name="tl-wa850re"
;;
+   *"TL-WA830RE v2")
+   name="tl-wa830re-v2"
+   ;;
*"TL-WA801ND v2")
name="tl-wa801nd-v2"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh 
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8af9580..8f3b563 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -253,6 +253,7 @@ platform_check_image() {
tl-wr741nd | \
tl-wr741nd-v4 | \
tl-wr841n-v1 | \
+   tl-wa830re-v2 | \
tl-wr841n-v7 | \
tl-wr841n-v8 | \
tl-wr841n-v9 | \
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 4e30a44..fbd22b9 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -82,6 +82,7 @@ CONFIG_ATH79_MACH_TL_MR11U=y
 CONFIG_ATH79_MACH_TL_MR13U=y
 CONFIG_ATH79_MACH_TL_MR3020=y
 CONFIG_ATH79_MACH_TL_MR3X20=y
+CONFIG_ATH79_MACH_TL_WA830RE_V2=y
 CONFIG_ATH79_MACH_TL_WA901ND=y
 CONFIG_ATH79_MACH_TL_WA901ND_V2=y
 CONFIG_ATH79_MACH_TL_WAX50RE=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c 
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c
new file mode 100644
index 000..1c74fed
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wa830re-v2.c
@@ -0,0 +1,132 @@
+/*
+ *  TP-LINK TL-WA830RE v2 board support
+ *
+ *  Copyright (C) 2014 Fredrik Jonson 
+ *
+ *  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 "common.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define TL_WA830REV2_GPIO_LED_WLAN 13
+#define TL_WA830REV2_GPIO_LED_QSS  15
+#define TL_WA8

[OpenWrt-Devel] [PATCH 17/17] atheros: update macroses names

2014-07-12 Thread Sergey Ryazanov
Use AR2315_ prefix for macroses specific to AR2315/AR2316/AR2317 chips,
use AR5312_ prefix for macroses specific to AR5312/AR2312/AR2313 chips,
and use AR231X_ prefix for common macroses.

This patch should not cause any functional changes, only make clear
which macros is common and which macros is specific.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 528 ++---
 .../patches-3.10/101-early-printk-support.patch|   2 +-
 .../atheros/patches-3.10/105-ar2315_pci.patch  |  22 +-
 3 files changed, 276 insertions(+), 276 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 611d7cc..4a9f31b 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -42,7 +42,7 @@
 +++ b/arch/mips/ar231x/Platform
 @@ -0,0 +1,6 @@
 +#
-+# Atheros AR5312/AR2312 WiSoC
++# Atheros AR531X/AR231X WiSoC
 +#
 +platform-$(CONFIG_ATHEROS_AR231X)  += ar231x/
 +cflags-$(CONFIG_ATHEROS_AR231X)+= 
-I$(srctree)/arch/mips/include/asm/mach-ar231x
@@ -131,7 +131,7 @@
 +check_board_data(u8 *flash_limit, u8 *addr, bool broken)
 +{
 +  /* config magic found */
-+  if (*((u32 *)addr) == AR531X_BD_MAGIC)
++  if (*((u32 *)addr) == AR231X_BD_MAGIC)
 +  return 1;
 +
 +  if (!broken)
@@ -362,7 +362,7 @@
 + */
 +
 +/*
-+ * Prom setup file for ar531x
++ * Prom setup file for ar231x
 + */
 +
 +#include 
@@ -389,8 +389,8 @@
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
 @@ -0,0 +1,83 @@
-+#ifndef __AR531X_PLATFORM_H
-+#define __AR531X_PLATFORM_H
++#ifndef __ASM_MACH_AR231X_PLATFORM_H
++#define __ASM_MACH_AR231X_PLATFORM_H
 +
 +/*
 + * This is board-specific data that is stored in a "fixed" location in flash.
@@ -400,7 +400,7 @@
 + */
 +struct ar231x_boarddata {
 +  u32 magic;   /* board data is valid */
-+#define AR531X_BD_MAGIC 0x35333131   /* "5311", for all 531x platforms */
++#define AR231X_BD_MAGIC 0x35333131   /* "5311", for all 531x/231x platforms */
 +  u16 cksum;   /* checksum (starting with BD_REV 2) */
 +  u16 rev; /* revision of this struct */
 +#define BD_REV 4
@@ -471,12 +471,12 @@
 +  char *macaddr;
 +};
 +
-+#endif /* __AR531X_PLATFORM_H */
++#endif /* __ASM_MACH_AR231X_PLATFORM_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/cpu-feature-overrides.h
 @@ -0,0 +1,84 @@
 +/*
-+ *  Atheros SoC specific CPU feature overrides
++ *  Atheros AR231x/AR531x SoC specific CPU feature overrides
 + *
 + *  Copyright (C) 2008 Gabor Juhos 
 + *
@@ -489,11 +489,11 @@
 + *  by the Free Software Foundation.
 + *
 + */
-+#ifndef __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H
-+#define __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H
++#ifndef __ASM_MACH_AR231X_CPU_FEATURE_OVERRIDES_H
++#define __ASM_MACH_AR231X_CPU_FEATURE_OVERRIDES_H
 +
 +/*
-+ * The ATHEROS SoCs have MIPS 4Kc/4KEc core.
++ * The Atheros AR531x/AR231x SoCs have MIPS 4Kc/4KEc core.
 + */
 +#define cpu_has_tlb   1
 +#define cpu_has_4kex  1
@@ -558,7 +558,7 @@
 +/* #define cpu_dcache_line_size() ? */
 +/* #define cpu_icache_line_size() ? */
 +
-+#endif /* __ASM_MACH_ATHEROS_CPU_FEATURE_OVERRIDES_H */
++#endif /* __ASM_MACH_AR231X_CPU_FEATURE_OVERRIDES_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/dma-coherence.h
 @@ -0,0 +1,79 @@
@@ -571,8 +571,8 @@
 + * Copyright (C) 2007  Felix Fietkau 
 + *
 + */
-+#ifndef __ASM_MACH_GENERIC_DMA_COHERENCE_H
-+#define __ASM_MACH_GENERIC_DMA_COHERENCE_H
++#ifndef __ASM_MACH_AR231X_DMA_COHERENCE_H
++#define __ASM_MACH_AR231X_DMA_COHERENCE_H
 +
 +#define PCI_DMA_OFFSET0x2000
 +
@@ -640,12 +640,12 @@
 +#endif
 +}
 +
-+#endif /* __ASM_MACH_GENERIC_DMA_COHERENCE_H */
++#endif /* __ASM_MACH_AR231X_DMA_COHERENCE_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/gpio.h
 @@ -0,0 +1,30 @@
-+#ifndef _ATHEROS_GPIO_H_
-+#define _ATHEROS_GPIO_H_
++#ifndef __ASM_MACH_AR231X_GPIO_H
++#define __ASM_MACH_AR231X_GPIO_H
 +
 +#include 
 +
@@ -662,27 +662,27 @@
 +/* Returns IRQ to attach for gpio.  Unchecked function */
 +static inline int gpio_to_irq(unsigned gpio)
 +{
-+  return AR531X_GPIO_IRQ(gpio);
++  return AR231X_GPIO_IRQ(gpio);
 +}
 +
 +/* Returns gpio for IRQ attached.  Unchecked function */
 +static inline int irq_to_gpio(unsigned irq)
 +{
-+  return irq - AR531X_GPIO_IRQ(0);
++  return irq - AR231X_GPIO_IRQ(0);
 +}
 +
 +#include  /* cansleep wrappers */
 +
-+#endif
++#endif/* __ASM_MACH_AR231X_GPIO_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/reset.h
 @@ -0,0 +1,6 @@
-+#ifndef __AR531X_RESET_H
-+#define __AR531X_RESET_H
++#ifndef __ASM_MACH_AR231X_RESET_H
++#define __ASM_MACH_AR231X_RESET_H
 +
-+void ar531x_disable_reset_button(void);
++void ar231x_disable_reset_button(void);
 +
-+#endif /* __AR531X_RESET_H *

[OpenWrt-Devel] [PATCH 16/17] atheros[uart]: pass only physical I/O mem address to 8250 driver

2014-07-12 Thread Sergey Ryazanov
Pass only physical address to 8250 serial port driver and set flag to
remap I/O memory inside the driver. Also fix AR5312 UART base address
definition, which seems specified already mapped.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index b9d3719..611d7cc 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1384,8 +1384,8 @@
 +#define AR531X_SDRAMCTL 0x1830
 +#define AR531X_FLASHCTL 0x1840
 +#define AR531X_APBBASE0x1c00
++#define AR531X_UART00x1c00  /* UART MMR */
 +#define AR531X_FLASH0x1e00
-+#define AR531X_UART00xbc00  /* UART MMR */
 +
 +/*
 + * AR531X_NUM_ENET_MAC defines the number of ethernet MACs that
@@ -2126,7 +2126,7 @@
 +  ar231x_write_reg(AR531X_WD_CTRL, AR531X_WD_CTRL_IGNORE_EXPIRATION);
 +
 +  _machine_restart = ar5312_restart;
-+  ar231x_serial_setup(KSEG1ADDR(AR531X_UART0), AR531X_MISC_IRQ_UART0,
++  ar231x_serial_setup(AR531X_UART0, AR531X_MISC_IRQ_UART0,
 +  ar5312_sys_frequency());
 +}
 +
@@ -2686,7 +2686,7 @@
 +  ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION);
 +
 +  _machine_restart = ar2315_restart;
-+  ar231x_serial_setup(KSEG1ADDR(AR2315_UART0), AR2315_MISC_IRQ_UART0,
++  ar231x_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0,
 +  ar2315_apb_frequency());
 +}
 --- /dev/null
@@ -2859,7 +2859,7 @@
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.c
-@@ -0,0 +1,181 @@
+@@ -0,0 +1,180 @@
 +#include 
 +#include 
 +#include 
@@ -3006,13 +3006,12 @@
 +
 +  memset(&s, 0, sizeof(s));
 +
-+  s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
++  s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP;
 +  s.iotype = UPIO_MEM32;
 +  s.irq = irq;
 +  s.regshift = 2;
 +  s.mapbase = mapbase;
 +  s.uartclk = uartclk;
-+  s.membase = (void __iomem *)s.mapbase;
 +
 +  early_serial_setup(&s);
 +}
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 09/17] atheros: rename some interrupt control handlers

2014-07-12 Thread Sergey Ryazanov
Rename interrupt control handlers to be consistent with operation names
and add IRQ chips names.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch | 45 ---
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index bf7e30c..9e38c04 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1550,7 +1550,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,601 @@
+@@ -0,0 +1,602 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1631,7 +1631,7 @@
 +
 +/* Enable the specified AR531X_MISC_IRQ interrupt */
 +static void
-+ar5312_misc_intr_enable(struct irq_data *d)
++ar5312_misc_irq_unmask(struct irq_data *d)
 +{
 +  unsigned int imr;
 +
@@ -1642,7 +1642,7 @@
 +
 +/* Disable the specified AR531X_MISC_IRQ interrupt */
 +static void
-+ar5312_misc_intr_disable(struct irq_data *d)
++ar5312_misc_irq_mask(struct irq_data *d)
 +{
 +  unsigned int imr;
 +
@@ -1652,9 +1652,10 @@
 +  ar231x_read_reg(AR531X_IMR); /* flush write buffer */
 +}
 +
-+static struct irq_chip ar5312_misc_intr_controller = {
-+  .irq_mask = ar5312_misc_intr_disable,
-+  .irq_unmask   = ar5312_misc_intr_enable,
++static struct irq_chip ar5312_misc_irq_chip = {
++  .name   = "AR5312-MISC",
++  .irq_unmask = ar5312_misc_irq_unmask,
++  .irq_mask   = ar5312_misc_irq_mask,
 +};
 +
 +
@@ -1695,8 +1696,8 @@
 +  ar231x_irq_dispatch = ar5312_irq_dispatch;
 +  for (i = 0; i < AR531X_MISC_IRQ_COUNT; i++) {
 +  int irq = AR531X_MISC_IRQ_BASE + i;
-+  irq_set_chip_and_handler(irq, &ar5312_misc_intr_controller,
-+  handle_level_irq);
++  irq_set_chip_and_handler(irq, &ar5312_misc_irq_chip,
++   handle_level_irq);
 +  }
 +  setup_irq(AR531X_MISC_IRQ_AHB_PROC, &ar5312_ahb_proc_interrupt);
 +  setup_irq(AR5312_IRQ_MISC_INTRS, &cascade);
@@ -2154,7 +2155,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,661 @@
+@@ -0,0 +1,663 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2278,7 +2279,7 @@
 +  ar231x_write_reg(AR2315_GPIO_INT, reg);
 +}
 +
-+static void ar2315_gpio_intr_enable(struct irq_data *d)
++static void ar2315_gpio_irq_unmask(struct irq_data *d)
 +{
 +  unsigned int gpio = d->irq - AR531X_GPIO_IRQ_BASE;
 +
@@ -2291,7 +2292,7 @@
 +  ar2315_set_gpiointmask(gpio, 3);
 +}
 +
-+static void ar2315_gpio_intr_disable(struct irq_data *d)
++static void ar2315_gpio_irq_mask(struct irq_data *d)
 +{
 +  unsigned int gpio = d->irq - AR531X_GPIO_IRQ_BASE;
 +
@@ -2300,13 +2301,14 @@
 +  ar2315_set_gpiointmask(gpio, 0);
 +}
 +
-+static struct irq_chip ar2315_gpio_intr_controller = {
-+  .irq_mask = ar2315_gpio_intr_disable,
-+  .irq_unmask   = ar2315_gpio_intr_enable,
++static struct irq_chip ar2315_gpio_irq_chip = {
++  .name   = "AR2315-GPIO",
++  .irq_unmask = ar2315_gpio_irq_unmask,
++  .irq_mask   = ar2315_gpio_irq_mask,
 +};
 +
 +static void
-+ar2315_misc_intr_enable(struct irq_data *d)
++ar2315_misc_irq_unmask(struct irq_data *d)
 +{
 +  unsigned int imr;
 +
@@ -2337,7 +2339,7 @@
 +}
 +
 +static void
-+ar2315_misc_intr_disable(struct irq_data *d)
++ar2315_misc_irq_mask(struct irq_data *d)
 +{
 +  unsigned int imr;
 +
@@ -2367,9 +2369,10 @@
 +  ar231x_write_reg(AR2315_IMR, imr);
 +}
 +
-+static struct irq_chip ar2315_misc_intr_controller = {
-+  .irq_mask = ar2315_misc_intr_disable,
-+  .irq_unmask   = ar2315_misc_intr_enable,
++static struct irq_chip ar2315_misc_irq_chip = {
++  .name   = "AR2315-MISC",
++  .irq_unmask = ar2315_misc_irq_unmask,
++  .irq_mask   = ar2315_misc_irq_mask,
 +};
 +
 +static irqreturn_t ar2315_ahb_proc_handler(int cpl, void *dev_id)
@@ -2405,12 +2408,12 @@
 +  gpiointval = ar231x_read_reg(AR2315_GPIO_DI);
 +  for (i = 0; i < AR531X_MISC_IRQ_COUNT; i++) {
 +  int irq = AR531X_MISC_IRQ_BASE + i;
-+  irq_set_chip_and_handler(irq, &ar2315_misc_intr_controller,
++  irq_set_chip_and_handler(irq, &ar2315_misc_irq_chip,
 +  handle_level_irq);
 +  }
 +  for (i = 0; i < AR531X_GPIO_IRQ_COUNT; i++) {
 +  int irq = AR531X_GPIO_IRQ_BASE + i;
-+  irq_set_chip_and_handler(irq, &ar2315_gpio_intr_controller,
++  irq_set_chip_and_handler(irq, &ar2315_gpio_irq_chip,
 +  handle_level_irq);
 +  }
 +  setup_irq(AR531X_MISC_IRQ_GPIO, &cascade);
-- 
1.8.1.5
_

[OpenWrt-Devel] [PATCH 12/17] atheros: simplify gpiolib realization

2014-07-12 Thread Sergey Ryazanov
Each SoCs generation has own independent gpiolib realization, so we
have no reason to keep these realizations in semiuniversal form.
Following modifications are made:
 * Remove valid_mask field
 * Remove ar231x_gpio_chip structure
 * Rename AR2315_GPIO_CR to AR2315_GPIO_DIR
 * Fix count of AR5312 GPIOs
 * Simplify gpio_chip methods realization

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch | 234 ++
 1 file changed, 57 insertions(+), 177 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index b702d2b..8fbd250 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1050,12 +1050,12 @@
 + */
 +#define AR2315_GPIO_DI  (AR2315_DSLBASE + 0x0088)
 +#define AR2315_GPIO_DO  (AR2315_DSLBASE + 0x0090)
-+#define AR2315_GPIO_CR  (AR2315_DSLBASE + 0x0098)
++#define AR2315_GPIO_DIR (AR2315_DSLBASE + 0x0098)
 +#define AR2315_GPIO_INT (AR2315_DSLBASE + 0x00a0)
 +
-+#define AR2315_GPIO_CR_M(x)(1 << (x))   /* mask for i/o */
-+#define AR2315_GPIO_CR_O(x)(1 << (x))   /* output */
-+#define AR2315_GPIO_CR_I(x)(0)  /* input */
++#define AR2315_GPIO_DIR_M(x)   (1 << (x))   /* mask for i/o */
++#define AR2315_GPIO_DIR_O(x)   (1 << (x))   /* output */
++#define AR2315_GPIO_DIR_I(x)   (0)  /* input */
 +
 +#define AR2315_GPIO_INT_S(x)  (x) /* interrupt enable */
 +#define AR2315_GPIO_INT_M (0x3F)  /* mask for int */
@@ -1583,7 +1583,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,596 @@
+@@ -0,0 +1,540 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1730,100 +1730,46 @@
 +  irq_set_chained_handler(AR5312_IRQ_MISC_INTRS, ar5312_misc_irq_handler);
 +}
 +
-+static u32
-+ar5312_gpio_set_output(u32 mask, u32 val)
-+{
-+  u32 reg;
-+
-+  reg = ar231x_read_reg(AR531X_GPIO_CR);
-+  reg |= mask;
-+  reg &= ~val;
-+  ar231x_write_reg(AR531X_GPIO_CR, reg);
-+  return reg;
-+}
-+
-+static u32
-+ar5312_gpio_get(u32 valid_mask)
-+{
-+  u32 reg;
-+  reg = ar231x_read_reg(AR531X_GPIO_DI);
-+  reg &= valid_mask;
-+  return reg;
-+}
-+
-+static u32
-+ar5312_gpio_set(u32 mask, u32 value)
-+{
-+  u32 reg;
-+  reg = ar231x_read_reg(AR531X_GPIO_DO);
-+  reg &= ~mask;
-+  reg |= value;
-+  ar231x_write_reg(AR531X_GPIO_DO, reg);
-+  return reg;
-+}
-+
 +/*
-+ * gpiolib implementations. Original mask based methods preserved
++ * gpiolib implementations
 + */
 +static int
 +ar5312_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
 +{
-+  struct ar231x_gpio_chip *gpch =
-+  container_of(chip, struct ar231x_gpio_chip, chip);
-+  u32 mask = 1 << gpio;
-+  u32 rett;
-+  if (!(gpch->valid_mask & mask))
-+  return 0;
-+  rett = ar5312_gpio_get(gpch->valid_mask);
-+  return !!(rett & mask);
++  return (ar231x_read_reg(AR531X_GPIO_DI) >> gpio) & 1;
 +}
 +
 +static void
 +ar5312_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 +{
-+  struct ar231x_gpio_chip *gpch =
-+  container_of(chip, struct ar231x_gpio_chip, chip);
-+  u32 mask = 1 << gpio;
-+  if (!(gpch->valid_mask & mask))
-+  return;
-+  ar5312_gpio_set(mask, (!!value) * mask);
++  u32 reg = ar231x_read_reg(AR531X_GPIO_DO);
++  reg = value ? reg | (1 << gpio) : reg & ~(1 << gpio);
++  ar231x_write_reg(AR531X_GPIO_DO, reg);
 +}
 +
 +static int
 +ar5312_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 +{
-+  struct ar231x_gpio_chip *gpch =
-+  container_of(chip, struct ar231x_gpio_chip, chip);
-+  u32 mask = 1 << gpio;
-+  if (!(gpch->valid_mask & mask))
-+  return -ENXIO;
-+  ar5312_gpio_set_output(mask, 0);
++  ar231x_mask_reg(AR531X_GPIO_CR, 0, 1 << gpio);
 +  return 0;
 +}
++
 +static int
 +ar5312_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value)
 +{
-+  struct ar231x_gpio_chip *gpch =
-+  container_of(chip, struct ar231x_gpio_chip, chip);
-+  u32 mask = 1 << gpio;
-+  if (!(gpch->valid_mask & mask))
-+  return -ENXIO;
-+  ar5312_gpio_set_output(mask, mask);
-+  ar5312_gpio_set(mask, (!!value) * mask);
++  ar231x_mask_reg(AR531X_GPIO_CR, 1 << gpio, 0);
++  ar5312_gpio_set_value(chip, gpio, value);
 +  return 0;
 +}
 +
-+static struct ar231x_gpio_chip ar5312_gpio_chip = {
-+  .valid_mask = (1 << 22) - 1,
-+  .chip = {
-+  .label  = "ar5312-gpio",
-+  .direction_input= ar5312_gpio_direction_input,
-+   

[OpenWrt-Devel] [PATCH 14/17] atheros[ar231x-eth]: pass PHY I/O memory via device resources

2014-07-12 Thread Sergey Ryazanov
Pass PHY I/O memory region via platform resources and remap them
unconditionally.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 57 ++
 .../atheros/patches-3.10/110-ar2313_ethernet.patch | 48 +++---
 .../patches-3.10/220-enet_micrel_workaround.patch  |  8 +--
 3 files changed, 72 insertions(+), 41 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index b9a88a1..4fdf435 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -388,7 +388,7 @@
 +}
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,84 @@
+@@ -0,0 +1,83 @@
 +#ifndef __AR531X_PLATFORM_H
 +#define __AR531X_PLATFORM_H
 +
@@ -467,7 +467,6 @@
 +  void (*reset_clear)(u32);
 +  u32 reset_mac;
 +  u32 reset_phy;
-+  u32 phy_base;
 +  struct ar231x_board_config *config;
 +  char *macaddr;
 +};
@@ -714,7 +713,7 @@
 +#endif /* __ASM_MIPS_MACH_ATHEROS_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,614 @@
+@@ -0,0 +1,617 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -771,6 +770,9 @@
 +#define AR2315_SPI_MMR  0x1130  /* SPI FLASH MMR */
 +#define AR2315_PCIEXT   0x8000  /* pci external */
 +
++/* MII registers offset inside Ethernet MMR region */
++#define AR2315_ENET0_MII  (AR2315_ENET0 + 0x14)
++
 +/*
 + * Reset Register
 + */
@@ -1331,7 +1333,7 @@
 +#endif /* __AR2315_REG_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,249 @@
+@@ -0,0 +1,253 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1401,6 +1403,10 @@
 +#define AR5212_AR5312_REV7  0x0057  /* AR5312 WMAC (AP30-040) */
 +#define AR5212_AR2313_REV8  0x0058  /* AR2313 WMAC (AP43-030) */
 +
++/* MII registers offset inside Ethernet MMR region */
++#define AR531X_ENET0_MII  (AR531X_ENET0 + 0x14)
++#define AR531X_ENET1_MII  (AR531X_ENET1 + 0x14)
++
 +/*
 + * AR531X_NUM_WMAC defines the number of Wireless MACs that\
 + * should be considered available.
@@ -1805,7 +1811,6 @@
 +  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET0,
 +  .reset_phy = AR531X_RESET_EPHY0,
-+  .phy_base = AR531X_ENET0,
 +  .config = &ar231x_board,
 +};
 +
@@ -1814,7 +1819,6 @@
 +  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET1,
 +  .reset_phy = AR531X_RESET_EPHY1,
-+  .phy_base = AR531X_ENET1,
 +  .config = &ar231x_board,
 +};
 +
@@ -1936,11 +1940,13 @@
 +  switch (ar231x_devtype) {
 +  case DEV_TYPE_AR5312:
 +  ar5312_eth0_data.macaddr = config->enet0_mac;
-+  ar231x_add_ethernet(0, AR531X_ENET0, AR5312_IRQ_ENET0_INTRS,
++  ar231x_add_ethernet(0, AR531X_ENET0, "eth0_mii",
++  AR531X_ENET0_MII, AR5312_IRQ_ENET0_INTRS,
 +  &ar5312_eth0_data);
 +
 +  ar5312_eth1_data.macaddr = config->enet1_mac;
-+  ar231x_add_ethernet(1, AR531X_ENET1, AR5312_IRQ_ENET1_INTRS,
++  ar231x_add_ethernet(1, AR531X_ENET1, "eth1_mii",
++  AR531X_ENET1_MII, AR5312_IRQ_ENET1_INTRS,
 +  &ar5312_eth1_data);
 +
 +  if (!ar231x_board.radio)
@@ -1957,11 +1963,11 @@
 +   */
 +  case DEV_TYPE_AR2312:
 +  case DEV_TYPE_AR2313:
-+  ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
 +  ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
 +  ar5312_eth1_data.macaddr = config->enet0_mac;
-+  ar231x_add_ethernet(0, AR531X_ENET1,
-+  AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
++  ar231x_add_ethernet(1, AR531X_ENET1, "eth0_mii",
++  AR531X_ENET0_MII, AR5312_IRQ_ENET1_INTRS,
++  &ar5312_eth1_data);
 +
 +  if (!ar231x_board.radio)
 +  return 0;
@@ -2126,7 +2132,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,557 @@
+@@ -0,0 +1,556 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2409,7 +2415,6 @@
 +  .reset_clear = ar2315_device_reset_clear,
 +  .reset_mac = AR2315_RESET_ENET0,
 +  .reset_phy = AR2315_RESET_EPHY0,
-+  .phy_base = AR2315_ENET0,
 +  .config = &ar231x_board,
 +};
 +
@@ -2523,8 +2528,8 @@
 +  ar2315_init_gpio_leds();
 +  platform_device_register(&ar2315_wdt);
 +  platform_device_register(&ar2315_spiflash);
-+  ar231x_add_ethernet(0, AR

[OpenWrt-Devel] [PATCH 15/17] atheros[uart]: use 32-bit aligned I/O

2014-07-12 Thread Sergey Ryazanov
Use 32-bit aligned I/O and update base UART address (remove +3 offset).

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch| 6 +++---
 target/linux/atheros/patches-3.10/101-early-printk-support.patch | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 4fdf435..b9d3719 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -766,7 +766,7 @@
 +#define AR2315_LOCAL0x1040  /* LOCAL BUS MMR */
 +#define AR2315_ENET00x1050  /* ETHERNET MMR */
 +#define AR2315_DSLBASE  0x1100  /* RESET CONTROL MMR */
-+#define AR2315_UART00x1113  /* UART MMR */
++#define AR2315_UART00x1110  /* UART MMR */
 +#define AR2315_SPI_MMR  0x1130  /* SPI FLASH MMR */
 +#define AR2315_PCIEXT   0x8000  /* pci external */
 +
@@ -1385,7 +1385,7 @@
 +#define AR531X_FLASHCTL 0x1840
 +#define AR531X_APBBASE0x1c00
 +#define AR531X_FLASH0x1e00
-+#define AR531X_UART00xbc03  /* UART MMR */
++#define AR531X_UART00xbc00  /* UART MMR */
 +
 +/*
 + * AR531X_NUM_ENET_MAC defines the number of ethernet MACs that
@@ -3007,7 +3007,7 @@
 +  memset(&s, 0, sizeof(s));
 +
 +  s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-+  s.iotype = UPIO_MEM;
++  s.iotype = UPIO_MEM32;
 +  s.irq = irq;
 +  s.regshift = 2;
 +  s.mapbase = mapbase;
diff --git a/target/linux/atheros/patches-3.10/101-early-printk-support.patch 
b/target/linux/atheros/patches-3.10/101-early-printk-support.patch
index 3daa011..be68025 100644
--- a/target/linux/atheros/patches-3.10/101-early-printk-support.patch
+++ b/target/linux/atheros/patches-3.10/101-early-printk-support.patch
@@ -21,12 +21,12 @@
 +static inline void prom_uart_wr(void __iomem *base, unsigned reg,
 +  unsigned char ch)
 +{
-+  __raw_writeb(ch, base + 4 * reg);
++  __raw_writel(ch, base + 4 * reg);
 +}
 +
 +static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
 +{
-+  return __raw_readb(base + 4 * reg);
++  return __raw_readl(base + 4 * reg);
 +}
 +
 +void prom_putchar(unsigned char ch)
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 13/17] atheros[ar231x-eth]: pass phys address of I/O memory via platform res

2014-07-12 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch| 20 ++--
 .../atheros/patches-3.10/110-ar2313_ethernet.patch   | 19 ---
 .../patches-3.10/220-enet_micrel_workaround.patch|  6 +++---
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 8fbd250..b9a88a1 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1805,7 +1805,7 @@
 +  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET0,
 +  .reset_phy = AR531X_RESET_EPHY0,
-+  .phy_base = KSEG1ADDR(AR531X_ENET0),
++  .phy_base = AR531X_ENET0,
 +  .config = &ar231x_board,
 +};
 +
@@ -1814,7 +1814,7 @@
 +  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET1,
 +  .reset_phy = AR531X_RESET_EPHY1,
-+  .phy_base = KSEG1ADDR(AR531X_ENET1),
++  .phy_base = AR531X_ENET1,
 +  .config = &ar231x_board,
 +};
 +
@@ -1936,12 +1936,12 @@
 +  switch (ar231x_devtype) {
 +  case DEV_TYPE_AR5312:
 +  ar5312_eth0_data.macaddr = config->enet0_mac;
-+  ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET0),
-+  AR5312_IRQ_ENET0_INTRS, &ar5312_eth0_data);
++  ar231x_add_ethernet(0, AR531X_ENET0, AR5312_IRQ_ENET0_INTRS,
++  &ar5312_eth0_data);
 +
 +  ar5312_eth1_data.macaddr = config->enet1_mac;
-+  ar231x_add_ethernet(1, KSEG1ADDR(AR531X_ENET1),
-+  AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
++  ar231x_add_ethernet(1, AR531X_ENET1, AR5312_IRQ_ENET1_INTRS,
++  &ar5312_eth1_data);
 +
 +  if (!ar231x_board.radio)
 +  return 0;
@@ -1960,7 +1960,7 @@
 +  ar5312_eth1_data.phy_base = ar5312_eth0_data.phy_base;
 +  ar5312_eth1_data.reset_phy = ar5312_eth0_data.reset_phy;
 +  ar5312_eth1_data.macaddr = config->enet0_mac;
-+  ar231x_add_ethernet(0, KSEG1ADDR(AR531X_ENET1),
++  ar231x_add_ethernet(0, AR531X_ENET1,
 +  AR5312_IRQ_ENET1_INTRS, &ar5312_eth1_data);
 +
 +  if (!ar231x_board.radio)
@@ -2409,7 +2409,7 @@
 +  .reset_clear = ar2315_device_reset_clear,
 +  .reset_mac = AR2315_RESET_ENET0,
 +  .reset_phy = AR2315_RESET_EPHY0,
-+  .phy_base = KSEG1ADDR(AR2315_ENET0),
++  .phy_base = AR2315_ENET0,
 +  .config = &ar231x_board,
 +};
 +
@@ -2523,8 +2523,8 @@
 +  ar2315_init_gpio_leds();
 +  platform_device_register(&ar2315_wdt);
 +  platform_device_register(&ar2315_spiflash);
-+  ar231x_add_ethernet(0, KSEG1ADDR(AR2315_ENET0), AR2315_IRQ_ENET0_INTRS,
-+  &ar2315_eth_data);
++  ar231x_add_ethernet(0, AR2315_ENET0, AR2315_IRQ_ENET0_INTRS,
++  &ar2315_eth_data);
 +  ar231x_add_wmac(0, AR2315_WLAN0, AR2315_IRQ_WLAN0_INTRS);
 +
 +  return 0;
diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
index 5f743b4..0e158d4 100644
--- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
@@ -33,7 +33,7 @@
 +obj-$(CONFIG_NET_AR231X) += ar231x.o
 --- /dev/null
 +++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
-@@ -0,0 +1,1249 @@
+@@ -0,0 +1,1246 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -257,8 +257,7 @@
 +  tasklet_init(&sp->rx_tasklet, rx_tasklet_func, (unsigned long) dev);
 +  tasklet_disable(&sp->rx_tasklet);
 +
-+  sp->eth_regs = ioremap_nocache(virt_to_phys(ar_eth_base),
-+ sizeof(*sp->eth_regs));
++  sp->eth_regs = ioremap_nocache(ar_eth_base, sizeof(*sp->eth_regs));
 +  if (!sp->eth_regs) {
 +  printk("Can't remap eth registers\n");
 +  return -ENXIO;
@@ -269,26 +268,24 @@
 +   * even though the MAC might be on ENET1.
 +   * Needto remap PHY regs separately in this case
 +   */
-+  if (virt_to_phys(ar_eth_base) == virt_to_phys(sp->phy_regs))
++  if (ar_eth_base == sp->cfg->phy_base)
 +  sp->phy_regs = sp->eth_regs;
 +  else {
-+  sp->phy_regs =
-+  ioremap_nocache(virt_to_phys(sp->cfg->phy_base),
-+  sizeof(*sp->phy_regs));
++  sp->phy_regs = ioremap_nocache(sp->cfg->phy_base,
++ sizeof(*sp->phy_regs));
 +  if (!sp->phy_regs) {
 +  printk("Can't remap phy registers\n");
 +  return -ENXIO;
 +  }
 +  }
 +
-+  sp->dma_regs =
-+  iorem

[OpenWrt-Devel] [PATCH 10/17] atheros: simplify AR2315 misc IRQ (un)masking

2014-07-12 Thread Sergey Ryazanov
Currently AR5312 misc IRQ numbers are used for AR2315+ chips, what cause
us to use switch-case to map IRQ number to ISR bit. Introduce AR2315
specific misc IRQs set and simplify interrupt (un)mask operation.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 124 +
 .../atheros/patches-3.10/105-ar2315_pci.patch  |   2 +-
 2 files changed, 52 insertions(+), 74 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 9e38c04..6e3d633 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -714,7 +714,7 @@
 +#endif /* __ASM_MIPS_MACH_ATHEROS_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,597 @@
+@@ -0,0 +1,614 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -740,6 +740,23 @@
 +#define AR2315_IRQ_LCBUS_PCI(MIPS_CPU_IRQ_BASE+5) /* C0_CAUSE: 0x2000 */
 +#define AR2315_IRQ_WLAN0_POLL   (MIPS_CPU_IRQ_BASE+6) /* C0_CAUSE: 0x4000 */
 +
++
++/*
++ * Miscellaneous interrupts, which share IP2.
++ */
++#define AR2315_MISC_IRQ_NONE  (AR531X_MISC_IRQ_BASE+0)
++#define AR2315_MISC_IRQ_UART0 (AR531X_MISC_IRQ_BASE+1)
++#define AR2315_MISC_IRQ_I2C_RSVD  (AR531X_MISC_IRQ_BASE+2)
++#define AR2315_MISC_IRQ_SPI   (AR531X_MISC_IRQ_BASE+3)
++#define AR2315_MISC_IRQ_AHB   (AR531X_MISC_IRQ_BASE+4)
++#define AR2315_MISC_IRQ_APB   (AR531X_MISC_IRQ_BASE+5)
++#define AR2315_MISC_IRQ_TIMER (AR531X_MISC_IRQ_BASE+6)
++#define AR2315_MISC_IRQ_GPIO  (AR531X_MISC_IRQ_BASE+7)
++#define AR2315_MISC_IRQ_WATCHDOG  (AR531X_MISC_IRQ_BASE+8)
++#define AR2315_MISC_IRQ_IR_RSVD   (AR531X_MISC_IRQ_BASE+9)
++#define AR2315_MISC_IRQ_COUNT 10
++
++
 +/*
 + * Address map
 + */
@@ -1314,7 +1331,7 @@
 +#endif /* __AR2315_REG_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,233 @@
+@@ -0,0 +1,249 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1341,6 +1358,22 @@
 +#define AR5312_IRQ_MISC_INTRS   (MIPS_CPU_IRQ_BASE+6) /* C0_CAUSE: 0x4000 */
 +
 +
++/*
++ * Miscellaneous interrupts, which share IP6.
++ */
++#define AR531X_MISC_IRQ_NONE  (AR531X_MISC_IRQ_BASE+0)
++#define AR531X_MISC_IRQ_TIMER (AR531X_MISC_IRQ_BASE+1)
++#define AR531X_MISC_IRQ_AHB_PROC  (AR531X_MISC_IRQ_BASE+2)
++#define AR531X_MISC_IRQ_AHB_DMA   (AR531X_MISC_IRQ_BASE+3)
++#define AR531X_MISC_IRQ_GPIO  (AR531X_MISC_IRQ_BASE+4)
++#define AR531X_MISC_IRQ_UART0 (AR531X_MISC_IRQ_BASE+5)
++#define AR531X_MISC_IRQ_UART0_DMA (AR531X_MISC_IRQ_BASE+6)
++#define AR531X_MISC_IRQ_WATCHDOG  (AR531X_MISC_IRQ_BASE+7)
++#define AR531X_MISC_IRQ_LOCAL (AR531X_MISC_IRQ_BASE+8)
++#define AR531X_MISC_IRQ_SPI   (AR531X_MISC_IRQ_BASE+9)
++#define AR531X_MISC_IRQ_COUNT 10
++
++
 +/* Address Map */
 +#define AR531X_WLAN00x1800
 +#define AR531X_WLAN10x1850
@@ -2155,7 +2188,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,663 @@
+@@ -0,0 +1,621 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2230,20 +2263,20 @@
 +   ar231x_read_reg(AR2315_IMR);
 +
 +  if (misc_intr & AR2315_ISR_SPI)
-+  do_IRQ(AR531X_MISC_IRQ_SPI);
++  do_IRQ(AR2315_MISC_IRQ_SPI);
 +  else if (misc_intr & AR2315_ISR_TIMER)
-+  do_IRQ(AR531X_MISC_IRQ_TIMER);
++  do_IRQ(AR2315_MISC_IRQ_TIMER);
 +  else if (misc_intr & AR2315_ISR_AHB)
-+  do_IRQ(AR531X_MISC_IRQ_AHB_PROC);
++  do_IRQ(AR2315_MISC_IRQ_AHB);
 +  else if (misc_intr & AR2315_ISR_GPIO)
 +  ar2315_gpio_irq();
 +  else if (misc_intr & AR2315_ISR_UART0)
-+  do_IRQ(AR531X_MISC_IRQ_UART0);
++  do_IRQ(AR2315_MISC_IRQ_UART0);
 +  else if (misc_intr & AR2315_ISR_WD) {
 +  ar231x_write_reg(AR2315_ISR, AR2315_ISR_WD);
-+  do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
++  do_IRQ(AR2315_MISC_IRQ_WATCHDOG);
 +  } else
-+  do_IRQ(AR531X_MISC_IRQ_NONE);
++  do_IRQ(AR2315_MISC_IRQ_NONE);
 +}
 +
 +/*
@@ -2313,28 +2346,7 @@
 +  unsigned int imr;
 +
 +  imr = ar231x_read_reg(AR2315_IMR);
-+  switch (d->irq) {
-+  case AR531X_MISC_IRQ_SPI:
-+  imr |= AR2315_ISR_SPI;
-+  break;
-+  case AR531X_MISC_IRQ_TIMER:
-+  imr |= AR2315_ISR_TIMER;
-+  break;
-+  case AR531X_MISC_IRQ_AHB_PROC:
-+  imr |= AR2315_ISR_AHB;
-+  break;
-+  case AR531X_MISC_IRQ_GPIO:
-+  imr |= A

[OpenWrt-Devel] [PATCH 08/17] atheros: move AR2315 misc IRQ dispatching to separate function

2014-07-12 Thread Sergey Ryazanov
Align code with AR5312 realization.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 47 --
 .../atheros/patches-3.10/105-ar2315_pci.patch  | 15 +++
 2 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index bc6d5d8..bf7e30c 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -2154,7 +2154,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,656 @@
+@@ -0,0 +1,661 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -,6 +,28 @@
 +  do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
 +}
 +
++static void
++ar2315_misc_irq_dispatch(void)
++{
++  unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) &
++   ar231x_read_reg(AR2315_IMR);
++
++  if (misc_intr & AR2315_ISR_SPI)
++  do_IRQ(AR531X_MISC_IRQ_SPI);
++  else if (misc_intr & AR2315_ISR_TIMER)
++  do_IRQ(AR531X_MISC_IRQ_TIMER);
++  else if (misc_intr & AR2315_ISR_AHB)
++  do_IRQ(AR531X_MISC_IRQ_AHB_PROC);
++  else if (misc_intr & AR2315_ISR_GPIO)
++  ar2315_gpio_irq();
++  else if (misc_intr & AR2315_ISR_UART0)
++  do_IRQ(AR531X_MISC_IRQ_UART0);
++  else if (misc_intr & AR2315_ISR_WD) {
++  ar231x_write_reg(AR2315_ISR, AR2315_ISR_WD);
++  do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
++  } else
++  do_IRQ(AR531X_MISC_IRQ_NONE);
++}
 +
 +/*
 + * Called when an interrupt is received, this function
@@ -2240,26 +2262,9 @@
 +  do_IRQ(AR2315_IRQ_WLAN0_INTRS);
 +  else if (pending & CAUSEF_IP4)
 +  do_IRQ(AR2315_IRQ_ENET0_INTRS);
-+  else if (pending & CAUSEF_IP2) {
-+  unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) &
-+   ar231x_read_reg(AR2315_IMR);
-+
-+  if (misc_intr & AR2315_ISR_SPI)
-+  do_IRQ(AR531X_MISC_IRQ_SPI);
-+  else if (misc_intr & AR2315_ISR_TIMER)
-+  do_IRQ(AR531X_MISC_IRQ_TIMER);
-+  else if (misc_intr & AR2315_ISR_AHB)
-+  do_IRQ(AR531X_MISC_IRQ_AHB_PROC);
-+  else if (misc_intr & AR2315_ISR_GPIO)
-+  ar2315_gpio_irq();
-+  else if (misc_intr & AR2315_ISR_UART0)
-+  do_IRQ(AR531X_MISC_IRQ_UART0);
-+  else if (misc_intr & AR2315_ISR_WD) {
-+  ar231x_write_reg(AR2315_ISR, AR2315_ISR_WD);
-+  do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
-+  } else
-+  do_IRQ(AR531X_MISC_IRQ_NONE);
-+  } else if (pending & CAUSEF_IP7)
++  else if (pending & CAUSEF_IP2)
++  ar2315_misc_irq_dispatch();
++  else if (pending & CAUSEF_IP7)
 +  do_IRQ(AR531X_IRQ_CPU_CLOCK);
 +}
 +
diff --git a/target/linux/atheros/patches-3.10/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
index 733d6ad..8b080d8 100644
--- a/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
@@ -257,8 +257,8 @@
 +  default y
 --- a/arch/mips/ar231x/ar2315.c
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -65,6 +65,27 @@ static inline void ar2315_gpio_irq(void)
-   do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
+@@ -88,6 +88,28 @@ ar2315_misc_irq_dispatch(void)
+   do_IRQ(AR531X_MISC_IRQ_NONE);
  }
  
 +#ifdef CONFIG_ATHEROS_AR2315_PCI
@@ -282,10 +282,11 @@
 +  }
 +}
 +#endif /* CONFIG_ATHEROS_AR2315_PCI */
- 
++
  /*
   * Called when an interrupt is received, this function
-@@ -83,6 +104,10 @@ ar2315_irq_dispatch(void)
+  * determines exactly which interrupt it was, and it
+@@ -105,6 +127,10 @@ ar2315_irq_dispatch(void)
do_IRQ(AR2315_IRQ_WLAN0_INTRS);
else if (pending & CAUSEF_IP4)
do_IRQ(AR2315_IRQ_ENET0_INTRS);
@@ -293,6 +294,6 @@
 +  else if (pending & CAUSEF_IP5)
 +  ar2315_pci_irq(AR2315_IRQ_LCBUS_PCI);
 +#endif
-   else if (pending & CAUSEF_IP2) {
-   unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) &
-ar231x_read_reg(AR2315_IMR);
+   else if (pending & CAUSEF_IP2)
+   ar2315_misc_irq_dispatch();
+   else if (pending & CAUSEF_IP7)
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 11/17] atheros: use irq_set_chained_handler()

2014-07-12 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 34 +++---
 .../atheros/patches-3.10/105-ar2315_pci.patch  |  6 ++--
 2 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 6e3d633..b702d2b 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1583,7 +1583,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,602 @@
+@@ -0,0 +1,596 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1623,8 +1623,7 @@
 +#include "devices.h"
 +#include "ar5312.h"
 +
-+static void
-+ar5312_misc_irq_dispatch(void)
++static void ar5312_misc_irq_handler(unsigned irq, struct irq_desc *desc)
 +{
 +  unsigned int ar231x_misc_intrs = ar231x_read_reg(AR531X_ISR) &
 +   ar231x_read_reg(AR531X_IMR);
@@ -1656,7 +1655,7 @@
 +  else if (pending & CAUSEF_IP5)
 +  do_IRQ(AR5312_IRQ_WLAN1_INTRS);
 +  else if (pending & CAUSEF_IP6)
-+  ar5312_misc_irq_dispatch();
++  do_IRQ(AR5312_IRQ_MISC_INTRS);
 +  else if (pending & CAUSEF_IP7)
 +  do_IRQ(AR531X_IRQ_CPU_CLOCK);
 +}
@@ -1714,11 +1713,6 @@
 +};
 +
 +
-+static struct irqaction cascade  = {
-+  .handler = no_action,
-+  .name= "cascade",
-+};
-+
 +void __init ar5312_irq_init(void)
 +{
 +  int i;
@@ -1733,7 +1727,7 @@
 +   handle_level_irq);
 +  }
 +  setup_irq(AR531X_MISC_IRQ_AHB_PROC, &ar5312_ahb_proc_interrupt);
-+  setup_irq(AR5312_IRQ_MISC_INTRS, &cascade);
++  irq_set_chained_handler(AR5312_IRQ_MISC_INTRS, ar5312_misc_irq_handler);
 +}
 +
 +static u32
@@ -2188,7 +2182,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,621 @@
+@@ -0,0 +1,615 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2230,7 +2224,7 @@
 +
 +static u32 gpiointmask, gpiointval;
 +
-+static inline void ar2315_gpio_irq(void)
++static void ar2315_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 +{
 +  u32 pend;
 +  int bit = -1;
@@ -2256,8 +2250,7 @@
 +  do_IRQ(AR531X_GPIO_IRQ_BASE + bit);
 +}
 +
-+static void
-+ar2315_misc_irq_dispatch(void)
++static void ar2315_misc_irq_handler(unsigned irq, struct irq_desc *desc)
 +{
 +  unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) &
 +   ar231x_read_reg(AR2315_IMR);
@@ -2269,7 +2262,7 @@
 +  else if (misc_intr & AR2315_ISR_AHB)
 +  do_IRQ(AR2315_MISC_IRQ_AHB);
 +  else if (misc_intr & AR2315_ISR_GPIO)
-+  ar2315_gpio_irq();
++  do_IRQ(AR2315_MISC_IRQ_GPIO);
 +  else if (misc_intr & AR2315_ISR_UART0)
 +  do_IRQ(AR2315_MISC_IRQ_UART0);
 +  else if (misc_intr & AR2315_ISR_WD) {
@@ -2297,7 +2290,7 @@
 +  else if (pending & CAUSEF_IP4)
 +  do_IRQ(AR2315_IRQ_ENET0_INTRS);
 +  else if (pending & CAUSEF_IP2)
-+  ar2315_misc_irq_dispatch();
++  do_IRQ(AR2315_IRQ_MISC_INTRS);
 +  else if (pending & CAUSEF_IP7)
 +  do_IRQ(AR531X_IRQ_CPU_CLOCK);
 +}
@@ -2382,11 +2375,6 @@
 +  .name   = "ar2315_ahb_proc_interrupt",
 +};
 +
-+static struct irqaction cascade  = {
-+  .handler= no_action,
-+  .name   = "cascade",
-+};
-+
 +void
 +ar2315_irq_init(void)
 +{
@@ -2407,9 +2395,9 @@
 +  irq_set_chip_and_handler(irq, &ar2315_gpio_irq_chip,
 +  handle_level_irq);
 +  }
-+  setup_irq(AR2315_MISC_IRQ_GPIO, &cascade);
++  irq_set_chained_handler(AR2315_MISC_IRQ_GPIO, ar2315_gpio_irq_handler);
 +  setup_irq(AR2315_MISC_IRQ_AHB, &ar2315_ahb_proc_interrupt);
-+  setup_irq(AR2315_IRQ_MISC_INTRS, &cascade);
++  irq_set_chained_handler(AR2315_IRQ_MISC_INTRS, ar2315_misc_irq_handler);
 +}
 +
 +static u32
diff --git a/target/linux/atheros/patches-3.10/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
index 95db399..20bf669 100644
--- a/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.10/105-ar2315_pci.patch
@@ -257,7 +257,7 @@
 +  default y
 --- a/arch/mips/ar231x/ar2315.c
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -88,6 +88,28 @@ ar2315_misc_irq_dispatch(void)
+@@ -87,6 +87,28 @@ static void ar2315_misc_irq_handler(unsi
do_IRQ(AR2315_MISC_IRQ_NONE);
  }
  
@@ -286,7 +286,7 @@
  /*
   * Called when an interrupt is received, this function
   * determines exactly which interrupt it was, and it
-@@ -105,6 +127,10 @@ ar2315_irq_dispatch(void)
+@@ -104,6 +126,10 @@ ar2315_irq_dispatch(void)
  

[OpenWrt-Devel] [PATCH 04/17] atheros[ar2315-wdt]: update I/O handling

2014-07-12 Thread Sergey Ryazanov
 * Pass iomem and IRQ via platform device resources
 * Remap iomem and use iowrite32 accessor function

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 17 +++-
 .../linux/atheros/patches-3.10/130-watchdog.patch  | 45 --
 2 files changed, 50 insertions(+), 12 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 3169827..28c93be 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -2134,7 +2134,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,624 @@
+@@ -0,0 +1,639 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2524,9 +2524,24 @@
 +  .num_resources = ARRAY_SIZE(ar2315_spiflash_res)
 +};
 +
++static struct resource ar2315_wdt_res[] = {
++  {
++  .flags = IORESOURCE_MEM,
++  .start = AR2315_WD,
++  .end = AR2315_WD + 8 - 1,
++  },
++  {
++  .flags = IORESOURCE_IRQ,
++  .start = AR531X_MISC_IRQ_WATCHDOG,
++  .end = AR531X_MISC_IRQ_WATCHDOG,
++  }
++};
++
 +static struct platform_device ar2315_wdt = {
 +  .id = 0,
 +  .name = "ar2315-wdt",
++  .resource = ar2315_wdt_res,
++  .num_resources = ARRAY_SIZE(ar2315_wdt_res)
 +};
 +
 +/*
diff --git a/target/linux/atheros/patches-3.10/130-watchdog.patch 
b/target/linux/atheros/patches-3.10/130-watchdog.patch
index 06c8d44..13eca59 100644
--- a/target/linux/atheros/patches-3.10/130-watchdog.patch
+++ b/target/linux/atheros/patches-3.10/130-watchdog.patch
@@ -1,6 +1,6 @@
 --- /dev/null
 +++ b/drivers/watchdog/ar2315-wtd.c
-@@ -0,0 +1,186 @@
+@@ -0,0 +1,209 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -35,23 +35,32 @@
 +#include 
 +#include 
 +
-+#include 
-+#include 
-+#include 
-+
 +#define DRIVER_NAME   "ar2315-wdt"
 +
 +#define CLOCK_RATE 4000
 +#define HEARTBEAT(x) (x < 1 || x > 90 ? 20 : x)
 +
++#define WDT_REG_TIMER 0x00
++#define WDT_REG_CTRL  0x04
++
++#define WDT_CTRL_ACT_NONE 0x  /* No action */
++#define WDT_CTRL_ACT_NMI  0x0001  /* NMI on watchdog */
++#define WDT_CTRL_ACT_RESET0x0002  /* reset on watchdog */
++
 +static int wdt_timeout = 20;
 +static int started;
 +static int in_use;
++static void __iomem *wdt_base;
++
++static inline void ar2315_wdt_wr(unsigned reg, u32 val)
++{
++  iowrite32(val, wdt_base + reg);
++}
 +
 +static void
 +ar2315_wdt_enable(void)
 +{
-+  ar231x_write_reg(AR2315_WD, wdt_timeout * CLOCK_RATE);
++  ar2315_wdt_wr(WDT_REG_TIMER, wdt_timeout * CLOCK_RATE);
 +}
 +
 +static ssize_t
@@ -89,8 +98,8 @@
 +  dev_crit(&pdev->dev, "watchdog expired, rebooting system\n");
 +  emergency_restart();
 +  } else {
-+  ar231x_write_reg(AR2315_WDC, 0);
-+  ar231x_write_reg(AR2315_WD, 0);
++  ar2315_wdt_wr(WDT_REG_CTRL, 0);
++  ar2315_wdt_wr(WDT_REG_TIMER, 0);
 +  }
 +  return IRQ_HANDLED;
 +}
@@ -147,10 +156,25 @@
 +static int
 +ar2315_wdt_probe(struct platform_device *dev)
 +{
++  struct resource *mem_res, *irq_res;
 +  int ret = 0;
 +
-+  ret = request_irq(AR531X_MISC_IRQ_WATCHDOG, ar2315_wdt_interrupt,
-+IRQF_DISABLED, DRIVER_NAME, dev);
++  if (wdt_base)
++  return -EBUSY;
++
++  irq_res = platform_get_resource(dev, IORESOURCE_IRQ, 0);
++  if (!irq_res) {
++  dev_err(&dev->dev, "no IRQ resource\n");
++  return -ENOENT;
++  }
++
++  mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
++  wdt_base = devm_ioremap_resource(&dev->dev, mem_res);
++  if (IS_ERR(wdt_base))
++  return PTR_ERR(wdt_base);
++
++  ret = devm_request_irq(&dev->dev, irq_res->start, ar2315_wdt_interrupt,
++ IRQF_DISABLED, DRIVER_NAME, dev);
 +  if (ret) {
 +  dev_err(&dev->dev, "failed to register inetrrupt\n");
 +  goto out;
@@ -168,7 +192,6 @@
 +ar2315_wdt_remove(struct platform_device *dev)
 +{
 +  misc_deregister(&ar2315_wdt_miscdev);
-+  free_irq(AR531X_MISC_IRQ_WATCHDOG, NULL);
 +  return 0;
 +}
 +
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 03/17] atheros[ar2315-wdt]: update interrupt handling

2014-07-12 Thread Sergey Ryazanov
Acknowledge watchdog interrupt in arch irq dispatcher and remove odd
watchdog enable call from probe function.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch| 7 ---
 target/linux/atheros/patches-3.10/130-watchdog.patch | 5 +
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 02ab943..3169827 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -2134,7 +2134,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,623 @@
+@@ -0,0 +1,624 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2234,9 +2234,10 @@
 +  ar2315_gpio_irq();
 +  else if (misc_intr & AR2315_ISR_UART0)
 +  do_IRQ(AR531X_MISC_IRQ_UART0);
-+  else if (misc_intr & AR2315_ISR_WD)
++  else if (misc_intr & AR2315_ISR_WD) {
++  ar231x_write_reg(AR2315_ISR, AR2315_ISR_WD);
 +  do_IRQ(AR531X_MISC_IRQ_WATCHDOG);
-+  else
++  } else
 +  do_IRQ(AR531X_MISC_IRQ_NONE);
 +  } else if (pending & CAUSEF_IP7)
 +  do_IRQ(AR531X_IRQ_CPU_CLOCK);
diff --git a/target/linux/atheros/patches-3.10/130-watchdog.patch 
b/target/linux/atheros/patches-3.10/130-watchdog.patch
index b0284e7..06c8d44 100644
--- a/target/linux/atheros/patches-3.10/130-watchdog.patch
+++ b/target/linux/atheros/patches-3.10/130-watchdog.patch
@@ -1,6 +1,6 @@
 --- /dev/null
 +++ b/drivers/watchdog/ar2315-wtd.c
-@@ -0,0 +1,189 @@
+@@ -0,0 +1,186 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
@@ -52,7 +52,6 @@
 +ar2315_wdt_enable(void)
 +{
 +  ar231x_write_reg(AR2315_WD, wdt_timeout * CLOCK_RATE);
-+  ar231x_write_reg(AR2315_ISR, 0x80);
 +}
 +
 +static ssize_t
@@ -92,7 +91,6 @@
 +  } else {
 +  ar231x_write_reg(AR2315_WDC, 0);
 +  ar231x_write_reg(AR2315_WD, 0);
-+  ar231x_write_reg(AR2315_ISR, 0x80);
 +  }
 +  return IRQ_HANDLED;
 +}
@@ -151,7 +149,6 @@
 +{
 +  int ret = 0;
 +
-+  ar2315_wdt_enable();
 +  ret = request_irq(AR531X_MISC_IRQ_WATCHDOG, ar2315_wdt_interrupt,
 +IRQF_DISABLED, DRIVER_NAME, dev);
 +  if (ret) {
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 06/17] atheros[ar231x-eth]: move driver to atheros subdirectory

2014-07-12 Thread Sergey Ryazanov
Move driver code to respective vendor subdirectory and fix config
symbol name.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/config-3.10   |  2 +-
 .../atheros/patches-3.10/110-ar2313_ethernet.patch | 59 +++---
 .../patches-3.10/220-enet_micrel_workaround.patch  |  4 +-
 3 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/target/linux/atheros/config-3.10 b/target/linux/atheros/config-3.10
index ccbb592..08c4087 100644
--- a/target/linux/atheros/config-3.10
+++ b/target/linux/atheros/config-3.10
@@ -100,7 +100,7 @@ CONFIG_MTD_REDBOOT_PARTS=y
 CONFIG_MVSWITCH_PHY=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
-CONFIG_NET_VENDOR_AR231X=y
+CONFIG_NET_AR231X=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PCI=y
diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
index a0c4115..5f743b4 100644
--- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
@@ -1,37 +1,38 @@
 a/drivers/net/ethernet/Kconfig
-+++ b/drivers/net/ethernet/Kconfig
-@@ -22,6 +22,7 @@ source "drivers/net/ethernet/adaptec/Kco
- source "drivers/net/ethernet/aeroflex/Kconfig"
- source "drivers/net/ethernet/alteon/Kconfig"
- source "drivers/net/ethernet/amd/Kconfig"
-+source "drivers/net/ethernet/ar231x/Kconfig"
- source "drivers/net/ethernet/apple/Kconfig"
- source "drivers/net/ethernet/atheros/Kconfig"
- source "drivers/net/ethernet/cadence/Kconfig"
 a/drivers/net/ethernet/Makefile
-+++ b/drivers/net/ethernet/Makefile
-@@ -9,6 +9,7 @@ obj-$(CONFIG_GRETH) += aeroflex/
- obj-$(CONFIG_NET_VENDOR_ALTEON) += alteon/
- obj-$(CONFIG_NET_VENDOR_AMD) += amd/
- obj-$(CONFIG_NET_VENDOR_APPLE) += apple/
-+obj-$(CONFIG_NET_VENDOR_AR231X) += ar231x/
- obj-$(CONFIG_NET_VENDOR_ATHEROS) += atheros/
- obj-$(CONFIG_NET_CADENCE) += cadence/
- obj-$(CONFIG_NET_BFIN) += adi/
 /dev/null
-+++ b/drivers/net/ethernet/ar231x/Kconfig
-@@ -0,0 +1,5 @@
-+config NET_VENDOR_AR231X
-+  tristate "AR231X Ethernet support"
+--- a/drivers/net/ethernet/atheros/Makefile
 b/drivers/net/ethernet/atheros/Makefile
+@@ -7,3 +7,4 @@ obj-$(CONFIG_ATL2) += atlx/
+ obj-$(CONFIG_ATL1E) += atl1e/
+ obj-$(CONFIG_ATL1C) += atl1c/
+ obj-$(CONFIG_ALX) += alx/
++obj-$(CONFIG_NET_AR231X) += ar231x/
+--- a/drivers/net/ethernet/atheros/Kconfig
 b/drivers/net/ethernet/atheros/Kconfig
+@@ -5,7 +5,7 @@
+ config NET_VENDOR_ATHEROS
+   bool "Atheros devices"
+   default y
+-  depends on PCI
++  depends on (PCI || ATHEROS_AR231X)
+   ---help---
+ If you have a network (Ethernet) card belonging to this class, say Y
+ and read the Ethernet-HOWTO, available from
+@@ -85,4 +85,10 @@ config ALX
+ To compile this driver as a module, choose M here.  The module
+ will be called alx.
+ 
++config NET_AR231X
++  tristate "Atheros AR231X built-in Ethernet support"
 +  depends on ATHEROS_AR231X
 +  help
 +Support for the AR231x/531x ethernet controller
++
+ endif # NET_VENDOR_ATHEROS
 --- /dev/null
-+++ b/drivers/net/ethernet/ar231x/Makefile
 b/drivers/net/ethernet/atheros/ar231x/Makefile
 @@ -0,0 +1 @@
-+obj-$(CONFIG_NET_VENDOR_AR231X) += ar231x.o
++obj-$(CONFIG_NET_AR231X) += ar231x.o
 --- /dev/null
-+++ b/drivers/net/ethernet/ar231x/ar231x.c
 b/drivers/net/ethernet/atheros/ar231x/ar231x.c
 @@ -0,0 +1,1249 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
@@ -1283,7 +1284,7 @@
 +}
 +
 --- /dev/null
-+++ b/drivers/net/ethernet/ar231x/ar231x.h
 b/drivers/net/ethernet/atheros/ar231x/ar231x.h
 @@ -0,0 +1,287 @@
 +/*
 + * ar231x.h: Linux driver for the Atheros AR231x Ethernet device.
diff --git a/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch 
b/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
index ada0a76..cc3a74e 100644
--- a/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
+++ b/target/linux/atheros/patches-3.10/220-enet_micrel_workaround.patch
@@ -1,5 +1,5 @@
 a/drivers/net/ethernet/ar231x/ar231x.c
-+++ b/drivers/net/ethernet/ar231x/ar231x.c
+--- a/drivers/net/ethernet/atheros/ar231x/ar231x.c
 b/drivers/net/ethernet/atheros/ar231x/ar231x.c
 @@ -148,6 +148,7 @@ static int ar231x_mdiobus_write(struct m
  static int ar231x_mdiobus_reset(struct mii_bus *bus);
  static int ar231x_mdiobus_probe(struct net_device *dev);
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 02/17] atheros: use correct address space and pointer type for register access

2014-07-12 Thread Sergey Ryazanov
Make sparse happy :)

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 36ad7c8..02ab943 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -2876,13 +2876,13 @@
 +static inline u32
 +ar231x_read_reg(u32 reg)
 +{
-+  return __raw_readl((u32 *)KSEG1ADDR(reg));
++  return __raw_readl((void __iomem *)KSEG1ADDR(reg));
 +}
 +
 +static inline void
 +ar231x_write_reg(u32 reg, u32 val)
 +{
-+  __raw_writel(val, (u32 *)KSEG1ADDR(reg));
++  __raw_writel(val, (void __iomem *)KSEG1ADDR(reg));
 +}
 +
 +static inline u32
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 07/17] atheros: pass UART IRQ number via function argument

2014-07-12 Thread Sergey Ryazanov
UART IRQ number could be different for different SoCs, so make them
configurable.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index ab5e6bb..bc6d5d8 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -1550,7 +1550,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,600 @@
+@@ -0,0 +1,601 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2148,12 +2148,13 @@
 +  ar231x_write_reg(AR531X_WD_CTRL, AR531X_WD_CTRL_IGNORE_EXPIRATION);
 +
 +  _machine_restart = ar5312_restart;
-+  ar231x_serial_setup(KSEG1ADDR(AR531X_UART0), ar5312_sys_frequency());
++  ar231x_serial_setup(KSEG1ADDR(AR531X_UART0), AR531X_MISC_IRQ_UART0,
++  ar5312_sys_frequency());
 +}
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,655 @@
+@@ -0,0 +1,656 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2807,7 +2808,8 @@
 +  ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION);
 +
 +  _machine_restart = ar2315_restart;
-+  ar231x_serial_setup(KSEG1ADDR(AR2315_UART0), ar2315_apb_frequency());
++  ar231x_serial_setup(KSEG1ADDR(AR2315_UART0), AR531X_MISC_IRQ_UART0,
++  ar2315_apb_frequency());
 +}
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.h
@@ -2976,7 +2978,7 @@
 +extern asmlinkage void (*ar231x_irq_dispatch)(void);
 +
 +extern int ar231x_find_config(u8 *flash_limit);
-+extern void ar231x_serial_setup(u32 mapbase, unsigned int uartclk);
++extern void ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
 +extern int ar231x_add_wmac(int nr, u32 base, int irq);
 +extern int ar231x_add_ethernet(int nr, u32 base, int irq, void *pdata);
 +
@@ -3125,7 +3127,7 @@
 +}
 +
 +void __init
-+ar231x_serial_setup(u32 mapbase, unsigned int uartclk)
++ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk)
 +{
 +  struct uart_port s;
 +
@@ -3133,7 +3135,7 @@
 +
 +  s.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
 +  s.iotype = UPIO_MEM;
-+  s.irq = AR531X_MISC_IRQ_UART0;
++  s.irq = irq;
 +  s.regshift = 2;
 +  s.mapbase = mapbase;
 +  s.uartclk = uartclk;
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 01/17] atheros[ar2315-wdt]: rename config symbol

2014-07-12 Thread Sergey Ryazanov
Rename config symbol to AR2315_WDT to avoid confusion with other Atheros
SoCs.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/config-3.10 |  2 +-
 target/linux/atheros/patches-3.10/130-watchdog.patch | 11 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/target/linux/atheros/config-3.10 b/target/linux/atheros/config-3.10
index e6ab73b..ccbb592 100644
--- a/target/linux/atheros/config-3.10
+++ b/target/linux/atheros/config-3.10
@@ -12,7 +12,7 @@ CONFIG_ATHEROS_AR2315=y
 CONFIG_ATHEROS_AR2315_PCI=y
 CONFIG_ATHEROS_AR231X=y
 CONFIG_ATHEROS_AR5312=y
-CONFIG_ATHEROS_WDT=y
+CONFIG_AR2315_WDT=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_CEVT_R4K=y
 CONFIG_CLONE_BACKWARDS=y
diff --git a/target/linux/atheros/patches-3.10/130-watchdog.patch 
b/target/linux/atheros/patches-3.10/130-watchdog.patch
index 5dd0e75..b0284e7 100644
--- a/target/linux/atheros/patches-3.10/130-watchdog.patch
+++ b/target/linux/atheros/patches-3.10/130-watchdog.patch
@@ -192,15 +192,16 @@
 +MODULE_ALIAS("platform:" DRIVER_NAME);
 --- a/drivers/watchdog/Kconfig
 +++ b/drivers/watchdog/Kconfig
-@@ -1113,6 +1113,12 @@ config LANTIQ_WDT
+@@ -1113,6 +1113,13 @@ config LANTIQ_WDT
help
  Hardware driver for the Lantiq SoC Watchdog Timer.
  
-+config ATHEROS_WDT
-+  tristate "Atheros wisoc Watchdog Timer"
++config AR2315_WDT
++  tristate "Atheros AR2315+ WiSoCs Watchdog Timer"
 +  depends on ATHEROS_AR231X
 +  help
-+Hardware driver for the Atheros wisoc Watchdog Timer.
++Hardware driver for the built-in watchdog timer on the Atheros
++AR2315/AR2316 WiSoCs.
 +
  # PARISC Architecture
  
@@ -211,7 +212,7 @@
  obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o
  obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
  obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
-+obj-$(CONFIG_ATHEROS_WDT) += ar2315-wtd.o
++obj-$(CONFIG_AR2315_WDT) += ar2315-wtd.o
  obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
  obj-$(CONFIG_OCTEON_WDT) += octeon-wdt.o
  octeon-wdt-y := octeon-wdt-main.o octeon-wdt-nmi.o
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 05/17] atheros[ar231x-eth]: update MAC and PHY reset method

2014-07-12 Thread Sergey Ryazanov
Pass reset_set and reset_clear callback functions pointers via
platform_data instead of reset register address.

Signed-off-by: Sergey Ryazanov 
---
 target/linux/atheros/patches-3.10/100-board.patch  | 49 ++
 .../atheros/patches-3.10/110-ar2313_ethernet.patch | 24 ---
 .../patches-3.10/220-enet_micrel_workaround.patch  |  6 +--
 3 files changed, 54 insertions(+), 25 deletions(-)

diff --git a/target/linux/atheros/patches-3.10/100-board.patch 
b/target/linux/atheros/patches-3.10/100-board.patch
index 28c93be..ab5e6bb 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -388,7 +388,7 @@
 +}
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,83 @@
+@@ -0,0 +1,84 @@
 +#ifndef __AR531X_PLATFORM_H
 +#define __AR531X_PLATFORM_H
 +
@@ -463,7 +463,8 @@
 + * Platform device information for the Ethernet MAC
 + */
 +struct ar231x_eth {
-+  u32 reset_base;
++  void (*reset_set)(u32);
++  void (*reset_clear)(u32);
 +  u32 reset_mac;
 +  u32 reset_phy;
 +  u32 phy_base;
@@ -1549,7 +1550,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,582 @@
+@@ -0,0 +1,600 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -1799,6 +1800,22 @@
 +
 +/* end of gpiolib */
 +
++static void ar5312_device_reset_set(u32 mask)
++{
++  u32 val;
++
++  val = ar231x_read_reg(AR531X_RESET);
++  ar231x_write_reg(AR531X_RESET, val | mask);
++}
++
++static void ar5312_device_reset_clear(u32 mask)
++{
++  u32 val;
++
++  val = ar231x_read_reg(AR531X_RESET);
++  ar231x_write_reg(AR531X_RESET, val & ~mask);
++}
++
 +static struct physmap_flash_data ar5312_flash_data = {
 +  .width = 2,
 +};
@@ -1810,7 +1827,8 @@
 +};
 +
 +static struct ar231x_eth ar5312_eth0_data = {
-+  .reset_base = AR531X_RESET,
++  .reset_set = ar5312_device_reset_set,
++  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET0,
 +  .reset_phy = AR531X_RESET_EPHY0,
 +  .phy_base = KSEG1ADDR(AR531X_ENET0),
@@ -1818,7 +1836,8 @@
 +};
 +
 +static struct ar231x_eth ar5312_eth1_data = {
-+  .reset_base = AR531X_RESET,
++  .reset_set = ar5312_device_reset_set,
++  .reset_clear = ar5312_device_reset_clear,
 +  .reset_mac = AR531X_RESET_ENET1,
 +  .reset_phy = AR531X_RESET_EPHY1,
 +  .phy_base = KSEG1ADDR(AR531X_ENET1),
@@ -2134,7 +2153,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,639 @@
+@@ -0,0 +1,655 @@
 +/*
 + * This file is subject to the terms and conditions of the GNU General Public
 + * License.  See the file "COPYING" in the main directory of this archive
@@ -2493,9 +2512,25 @@
 +
 +/* end of gpiolib */
 +
++static void ar2315_device_reset_set(u32 mask)
++{
++  u32 val;
++
++  val = ar231x_read_reg(AR2315_RESET);
++  ar231x_write_reg(AR2315_RESET, val | mask);
++}
++
++static void ar2315_device_reset_clear(u32 mask)
++{
++  u32 val;
++
++  val = ar231x_read_reg(AR2315_RESET);
++  ar231x_write_reg(AR2315_RESET, val & ~mask);
++}
 +
 +static struct ar231x_eth ar2315_eth_data = {
-+  .reset_base = AR2315_RESET,
++  .reset_set = ar2315_device_reset_set,
++  .reset_clear = ar2315_device_reset_clear,
 +  .reset_mac = AR2315_RESET_ENET0,
 +  .reset_phy = AR2315_RESET_EPHY0,
 +  .phy_base = KSEG1ADDR(AR2315_ENET0),
diff --git a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
index 5532a5f..a0c4115 100644
--- a/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.10/110-ar2313_ethernet.patch
@@ -32,7 +32,7 @@
 +obj-$(CONFIG_NET_VENDOR_AR231X) += ar231x.o
 --- /dev/null
 +++ b/drivers/net/ethernet/ar231x/ar231x.c
-@@ -0,0 +1,1254 @@
+@@ -0,0 +1,1249 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -289,12 +289,6 @@
 +  return -ENXIO;
 +  }
 +
-+  sp->int_regs = ioremap_nocache(virt_to_phys(sp->cfg->reset_base), 4);
-+  if (!sp->int_regs) {
-+  printk("Can't remap INTERRUPT registers\n");
-+  return -ENXIO;
-+  }
-+
 +  strncpy(sp->name, "Atheros AR231x", sizeof(sp->name) - 1);
 +  sp->name[sizeof(sp->name) - 1] = '\0';
 +  memcpy(dev->dev_addr, sp->cfg->macaddr, 6);
@@ -609,13 +603,13 @@
 +  unsigned int ethsal, ethsah;
 +  unsigned int flags;
 +
-+  *sp->int_regs |= sp->cfg->reset_mac;
++  sp->cfg->reset_set(sp->cfg->reset_mac);
 +  mdelay(10);
-+  *sp->int_regs &= ~sp->cfg->reset_mac;
++  sp->cfg->reset_clear(sp->cfg->reset_mac);
 +  mdelay(10);
-+  *sp->int_regs |= sp->cfg->reset_phy;
++  sp->cfg->reset_set(sp->cfg->reset_phy);
 +  mdelay(10);
-+  *sp->int_regs &= ~sp->cfg->res

[OpenWrt-Devel] [PATCH 00/17] atheros: I/O cleanups

2014-07-12 Thread Sergey Ryazanov
Main goals of this series:
 * Simplify interface between arch code and SoC drivers
 * Simplify internal realization of arch code
 * Make code consistent with mainstream kernel rules and practice

Sergey Ryazanov (17):
  atheros[ar2315-wdt]: rename config symbol
  atheros: use correct address space and pointer type for register
access
  atheros[ar2315-wdt]: update interrupt handling
  atheros[ar2315-wdt]: update I/O handling
  atheros[ar231x-eth]: update MAC and PHY reset method
  atheros[ar231x-eth]: move driver to atheros subdirectory
  atheros: pass UART IRQ number via function argument
  atheros: move AR2315 misc IRQ dispatching to separate function
  atheros: rename some interrupt control handlers
  atheros: simplify AR2315 misc IRQ (un)masking
  atheros: use irq_set_chained_handler()
  atheros: simplify gpiolib realization
  atheros[ar231x-eth]: pass phys address of I/O memory via platform res
  atheros[ar231x-eth]: pass PHY I/O memory via device resources
  atheros[uart]: use 32-bit aligned I/O
  atheros[uart]: pass only physical I/O mem address to 8250 driver
  atheros: update macroses names

 target/linux/atheros/config-3.10   |4 +-
 target/linux/atheros/patches-3.10/100-board.patch  | 1021 +---
 .../patches-3.10/101-early-printk-support.patch|6 +-
 .../atheros/patches-3.10/105-ar2315_pci.patch  |   37 +-
 .../atheros/patches-3.10/110-ar2313_ethernet.patch |  138 +--
 .../linux/atheros/patches-3.10/130-watchdog.patch  |   59 +-
 .../patches-3.10/220-enet_micrel_workaround.patch  |   12 +-
 7 files changed, 614 insertions(+), 663 deletions(-)

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


[OpenWrt-Devel] [PATCH] lantiq: configure uboot-envtools on BTHOMEHUBV2B and make it work correctly on other lantiq boards

2014-07-12 Thread Ben Mulvihill
Generate the configuration file for uboot-envtools
on BTHOMEHUBV2B. Adds the specific parameters for the
BTHOMEHUBV2B and also fixes an incorrect path which
would have affected other lantiq boards as well
(currently only the GIGASX76X).

Signed-off-by: Ben Mulvihill 
---

--- a/package/boot/uboot-envtools/files/lantiq  2014-07-12 12:21:37.981335005 
+0200
+++ b/package/boot/uboot-envtools/files/lantiq  2014-07-12 12:21:02.024497834 
+0200
@@ -7,7 +7,7 @@
 
 touch /etc/config/ubootenv
 
-. /lib/lantiq.sh
+. /lib/functions/lantiq.sh
 . /lib/uboot-envtools.sh
 . /lib/functions.sh
 
@@ -17,6 +17,9 @@ case "$board" in
 GIGASX76X)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1" "1"
;;
+BTHOMEHUBV2B)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1" "1"
+   ;;
 esac
 
 config_load ubootenv
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [Patch] [ar71xx] added support for TL-WA830RE V2

2014-07-12 Thread John Crispin


On 12/07/2014 11:20, Fredrik Jonson wrote:
> Hello,
> 
> I'm sorry John, I do not understand what you mean, with your
> comment.
> 
> /Fjonson ___ 
> openwrt-devel mailing list openwrt-devel@lists.openwrt.org 
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
Hi,

a patch with the number 700 exists. use 714 please, that would be the
next free ath79 support patch.

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


Re: [OpenWrt-Devel] [Patch] [ar71xx] added support for TL-WA830RE V2

2014-07-12 Thread Fredrik Jonson
Hello,

I'm sorry John, I do not understand what you mean, with your comment.

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