[OpenWrt-Devel] [patch BB] Fix VLAN on Atheros AR8327N

2014-09-11 Thread Jiri Pirko
From: Álvaro Fernández Rojas nolt...@gmail.com

Commit 40842 reverted the fix for tagged+untagged VLANs on AR8327:
https://dev.openwrt.org/changeset/40777
https://dev.openwrt.org/changeset/40842

According to jow, some people experienced some issues on older devices. Can 
anyone tell me what were those issues?

Anyway, that patch modified some parts of the ar8216/ar8236, so I suppose any 
device with those switches were affected.
However, I've modified the patch keeping the ar8216/ar8236 as much untouched as 
possible.
Could anyone test it on those devices?

BTW, this works for me on a TP-Link WDR4300 (ar8327).

Jpirko: I tested this successfully on TP-Link WR1043NDv2.

Signed-off-by: Saverio Proto ziopr...@gmail.com
Signed-off-by: Álvaro Fernández Rojas nolt...@gmail.com
Tested-by: Jiri Pirko j...@resnulli.us
---
 .../linux/generic/files/drivers/net/phy/ar8216.c   | 155 +++--
 1 file changed, 111 insertions(+), 44 deletions(-)

diff --git a/target/linux/generic/files/drivers/net/phy/ar8216.c 
b/target/linux/generic/files/drivers/net/phy/ar8216.c
index 3846159..9eae624 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8216.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8216.c
@@ -78,7 +78,7 @@ struct ar8xxx_chip {
u32 (*read_port_status)(struct ar8xxx_priv *priv, int port);
int (*atu_flush)(struct ar8xxx_priv *priv);
void (*vtu_flush)(struct ar8xxx_priv *priv);
-   void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vid, u32 port_mask);
+   void (*vtu_load_vlan)(struct ar8xxx_priv *priv, u32 vlan);
 
const struct ar8xxx_mib_desc *mib_decs;
unsigned num_mibs;
@@ -112,7 +112,12 @@ struct ar8327_led {
enum ar8327_led_pattern pattern;
 };
 
+struct ar8216_data {
+   u8 vlan_tagged;
+};
+
 struct ar8327_data {
+   u8 vlan_tagged[AR8X16_MAX_VLANS];
u32 port0_status;
u32 port6_status;
 
@@ -138,6 +143,7 @@ struct ar8xxx_priv {
u8 chip_rev;
const struct ar8xxx_chip *chip;
union {
+   struct ar8216_data ar8216;
struct ar8327_data ar8327;
} chip_data;
bool initialized;
@@ -159,7 +165,6 @@ struct ar8xxx_priv {
bool vlan;
u16 vlan_id[AR8X16_MAX_VLANS];
u8 vlan_table[AR8X16_MAX_VLANS];
-   u8 vlan_tagged;
u16 pvid[AR8X16_MAX_PORTS];
 
/* mirroring */
@@ -641,7 +646,7 @@ ar8216_mangle_rx(struct net_device *dev, struct sk_buff 
*skb)
port = buf[0]  0xf;
 
/* no need to fix up packets coming from a tagged source */
-   if (priv-vlan_tagged  (1  port))
+   if (priv-chip_data.ar8216.vlan_tagged  BIT(port))
return;
 
/* lookup port vid from local table, the switch passes an invalid vlan 
id */
@@ -695,10 +700,13 @@ ar8216_vtu_flush(struct ar8xxx_priv *priv)
 }
 
 static void
-ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask)
+ar8216_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan)
 {
u32 op;
 
+   u32 vid = priv-vlan_id[vlan];
+   u32 port_mask = priv-vlan_table[vlan];
+
op = AR8216_VTU_OP_LOAD | (vid  AR8216_VTU_VID_S);
ar8216_vtu_op(priv, op, port_mask);
 }
@@ -1705,12 +1713,16 @@ ar8327_vtu_flush(struct ar8xxx_priv *priv)
 }
 
 static void
-ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, u32 port_mask)
+ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vlan)
 {
u32 op;
u32 val;
int i;
 
+   u32 vid = priv-vlan_id[vlan];
+   u32 port_mask = priv-vlan_table[vlan];
+   u32 tagged = priv-chip_data.ar8327.vlan_tagged[vlan];
+
op = AR8327_VTU_FUNC1_OP_LOAD | (vid  AR8327_VTU_FUNC1_VID_S);
val = AR8327_VTU_FUNC0_VALID | AR8327_VTU_FUNC0_IVL;
for (i = 0; i  AR8327_NUM_PORTS; i++) {
@@ -1720,7 +1732,7 @@ ar8327_vtu_load_vlan(struct ar8xxx_priv *priv, u32 vid, 
u32 port_mask)
mode = AR8327_VTU_FUNC0_EG_MODE_NOT;
else if (priv-vlan == 0)
mode = AR8327_VTU_FUNC0_EG_MODE_KEEP;
-   else if (priv-vlan_tagged  BIT(i))
+   else if (tagged  BIT(i))
mode = AR8327_VTU_FUNC0_EG_MODE_TAG;
else
mode = AR8327_VTU_FUNC0_EG_MODE_UNTAG;
@@ -1734,26 +1746,22 @@ static void
 ar8327_setup_port(struct ar8xxx_priv *priv, int port, u32 egress, u32 ingress,
  u32 members, u32 pvid)
 {
-   u32 t;
-   u32 mode;
+   u32 mode, t;
+
+   if (priv-vlan) {
+   pvid = priv-vlan_id[priv-pvid[port]];
+   mode = AR8327_PORT_VLAN1_OUT_MODE_UNMOD;
+   ingress = AR8216_IN_SECURE;
+   } else {
+   pvid = port;
+   mode = AR8327_PORT_VLAN1_OUT_MODE_UNTOUCH;
+   ingress = AR8216_IN_PORT_ONLY;
+   }
 
t = pvid  AR8327_PORT_VLAN0_DEF_SVID_S;
t |= pvid  AR8327_PORT_VLAN0_DEF_CVID_S;
priv-write(priv, 

[OpenWrt-Devel] picky questions about openwrt build structure

2014-09-11 Thread Robert P. J. Day

  just issues of curiosity as i continue to dig through the openwrt
build structure ... i notice numerous makefiles that define targets
using a FORCE target, which i'm assuming guarantees that that target
will always be processed. if that's the case, is there some reason
those targets simply aren't declared as PHONY targets? just
historical precedent?

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday

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


[OpenWrt-Devel] [PATCH] [RESEND] ar71xx: add qihoo 360 c301 router support

2014-09-11 Thread Weijie Gao
Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac.
Its chipset is AR9344 + AR9882 with two 16MB flashes.

This patch adds its initial support.

Signed-off-by: Weijie Gao hackpas...@gmail.com
---
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 .../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 +
 .../lib/preinit/81_load_ath10k_board_bin   |  23 +++
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-3.10|   1 +
 target/linux/ar71xx/config-3.14|   1 +
 .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 168 +
 target/linux/ar71xx/generic/profiles/qihoo.mk  |  16 ++
 target/linux/ar71xx/image/Makefile |   3 +
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 .../610-MIPS-ath79-openwrt-machines.patch  |  19 ++-
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 .../610-MIPS-ath79-openwrt-machines.patch  |  19 ++-
 15 files changed, 261 insertions(+), 8 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
 create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 1864b11..c16b7d7 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -166,6 +166,9 @@ get_status_led() {
oolite)
status_led=oolite:red:system
;;
+   qihoo-c301)
+   status_led=qihoo:green:status
+   ;;
tew-632brp)
status_led=tew-632brp:green:status
;;
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 d3b766d..872fc0d 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -191,6 +191,11 @@ om5p)
ucidef_set_led_netdev port2 port2 om5p:blue:lan eth1
;;
 
+qihoo-c301)
+   ucidef_set_led_wlan wlan2g WLAN2G qihoo:green:status phy1tpt
+   ucidef_set_led_wlan wlan5g WLAN5G qihoo:red:status phy0tpt
+   ;;
+
 smart-300)
ucidef_set_led_netdev wan WAN nc-link:green:wan eth0
ucidef_set_led_switch lan1 LAN1 nc-link:green:lan1 switch0 
0x04
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 c5cfd67..d5a43bd 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -346,6 +346,7 @@ hiwifi-hc6361 |\
 ja76pf |\
 mynet-n600 |\
 oolite |\
+qihoo-c301 |\
 rb-750 |\
 rb-751 |\
 tew-632brp |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 1e96b6d..1c685c6 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -430,6 +430,9 @@ ar71xx_board_detect() {
*PB92)
name=pb92
;;
+   *Qihoo 360 C301)
+   name=qihoo-c301
+   ;;
*RouterBOARD 411/A/AH)
name=rb-411
;;
diff --git 
a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin 
b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
index a28932f..66ccb1f 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
+++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
@@ -24,6 +24,29 @@ do_load_ath10k_board_bin() {
bs=1 skip=20492 count=2104  
/tmp/ath10k-board.bin
 
;;
+   qihoo-c301)
+   local mac
+   local tmp
+
+   dd if=/dev/mtdblock2 of=/tmp/c301-nvram /dev/null 
2/dev/null
+
+   tmp=$(cat /tmp/c301-nvram | grep 
'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)')
+
+   if [ $? == 0 ]; then
+   rm -f /tmp/c301-nvram
+   mac=$(echo ${tmp} | sed 
's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)/\1/g')
+   else
+   mac=$(macaddr_add $(cat 
/sys/class/net/eth0/address) -2)
+   fi
+
+   dd if=/dev/mtdblock10 \
+   bs=1 skip=20480 count=6 \
+   of=/tmp/ath10k-board.bin
+   macaddr_2bin $mac  /tmp/ath10k-board.bin
+   dd if=/dev/mtdblock10 \
+ 

Re: [OpenWrt-Devel] [PATCH] [RESEND] ar71xx: add qihoo 360 c301 router support

2014-09-11 Thread Yousong Zhou
Hi, Weijie

On 11 September 2014 17:58, Weijie Gao hackpas...@gmail.com wrote:
 Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac.
 Its chipset is AR9344 + AR9882 with two 16MB flashes.

 This patch adds its initial support.

Cool,


 Signed-off-by: Weijie Gao hackpas...@gmail.com
 ---

...

 diff --git 
 a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin 
 b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
 index a28932f..66ccb1f 100644
 --- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
 +++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
 @@ -24,6 +24,29 @@ do_load_ath10k_board_bin() {
 bs=1 skip=20492 count=2104  
 /tmp/ath10k-board.bin

 ;;
 +   qihoo-c301)
 +   local mac
 +   local tmp
 +
 +   dd if=/dev/mtdblock2 of=/tmp/c301-nvram /dev/null 
 2/dev/null
 +
 +   tmp=$(cat /tmp/c301-nvram | grep 
 'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)')
 +
 +   if [ $? == 0 ]; then
 +   rm -f /tmp/c301-nvram
 +   mac=$(echo ${tmp} | sed 
 's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)/\1/g')
 +   else
 +   mac=$(macaddr_add $(cat 
 /sys/class/net/eth0/address) -2)
 +   fi

mac address here can be fetched with mtd_get_mac_ascii, then test
its existence with [ -n $mac ] or [ -z $mac ]


Regards.

yousong

 +
 +   dd if=/dev/mtdblock10 \
 +   bs=1 skip=20480 count=6 \
 +   of=/tmp/ath10k-board.bin
 +   macaddr_2bin $mac  /tmp/ath10k-board.bin
 +   dd if=/dev/mtdblock10 \
 +   bs=1 skip=20492 count=2104  
 /tmp/ath10k-board.bin
 +
 +   ;;
 esac
 [ -f /tmp/ath10k-board.bin ] || {
 return
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] couple questions about downloading for a new build

2014-09-11 Thread Robert P. J. Day

  first, i created a local mirror with all the tarballs i downloaded
during an earlier build, and configured a new build to use that, and i
noticed that the download operation *copied* over the tarballs into
the dl/ directory. is there any reason that symlinks aren't used,
rather than doing actual copies? wouldn't symlinks work just as well?

  also, i wondered if building the host tools would take advantage of
already-installed host tools that match the exact version that openwrt
needs. in my new build, the version of patch required is ostensibly
2.7.1, which is precisely the version already installed on my host,
but it appears the patch-2.7.1.tar.xz tarball was still copied (from
the local mirror, admittedly) into the dl/ directory.

  i haven't followed the Makefile structures far enough yet to see
what should happen, but a comment in tools/Makefile reads:

# in case there is no patch tool on the host we need to make patch tool a
# dependency for tools which have patches directory

which *seems* to suggest that the build will look for patch already
installed on the host and take advantage of it if it's there.

  thoughts?

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday

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


Re: [OpenWrt-Devel] couple questions about downloading for a new build

2014-09-11 Thread Yousong Zhou
On 11 September 2014 20:30, Robert P. J. Day rpj...@crashcourse.ca wrote:

   first, i created a local mirror with all the tarballs i downloaded
 during an earlier build, and configured a new build to use that, and i
 noticed that the download operation *copied* over the tarballs into
 the dl/ directory. is there any reason that symlinks aren't used,
 rather than doing actual copies? wouldn't symlinks work just as well?


I take mirrors as places where the build system will try to fetch
those tarballs, into CONFIG_DOWNLOAD_FOLDER which defaults to
$(TOPDIR)/dl/ which in my local tree is a symbolic link to the
actually directory holding those tarballs.  It works quite well.

   also, i wondered if building the host tools would take advantage of
 already-installed host tools that match the exact version that openwrt
 needs. in my new build, the version of patch required is ostensibly
 2.7.1, which is precisely the version already installed on my host,
 but it appears the patch-2.7.1.tar.xz tarball was still copied (from
 the local mirror, admittedly) into the dl/ directory.


IMHO, for a build system complex like OpenWrt, it's better to be
self-contained and do things in a more predictable/controlled way.

   i haven't followed the Makefile structures far enough yet to see
 what should happen, but a comment in tools/Makefile reads:

 # in case there is no patch tool on the host we need to make patch tool a
 # dependency for tools which have patches directory

 which *seems* to suggest that the build will look for patch already
 installed on the host and take advantage of it if it's there.


No, it tries to handle the case that some host tools needs to be
patched (having patches/ directory) before getting compiled in which
case those tools/XXX/compile needs to have a dependence on
tools/patch/install.


Regards.

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


Re: [OpenWrt-Devel] couple questions about downloading for a new build

2014-09-11 Thread Robert P. J. Day
On Thu, 11 Sep 2014, Yousong Zhou wrote:

 On 11 September 2014 20:30, Robert P. J. Day rpj...@crashcourse.ca wrote:
 
first, i created a local mirror with all the tarballs i
  downloaded during an earlier build, and configured a new build to
  use that, and i noticed that the download operation *copied* over
  the tarballs into the dl/ directory. is there any reason that
  symlinks aren't used, rather than doing actual copies? wouldn't
  symlinks work just as well?

 I take mirrors as places where the build system will try to fetch
 those tarballs, into CONFIG_DOWNLOAD_FOLDER which defaults to
 $(TOPDIR)/dl/ which in my local tree is a symbolic link to the
 actually directory holding those tarballs.  It works quite well.

  i realize that's *one* way to do it, and it's how i did it
originally, but i chose instead to set up a single local mirror
directory that each build can fetch from into their personal dl/
directory, whereupon i noticed that fetching from that local mirror
really is doing a full copy, whereas it *seems* that just doing a
symlink would work just as well and not use up all that disk space.

  i'm just wondering why symlinks aren't used.

also, i wondered if building the host tools would take advantage
  of already-installed host tools that match the exact version that
  openwrt needs. in my new build, the version of patch required is
  ostensibly 2.7.1, which is precisely the version already installed
  on my host, but it appears the patch-2.7.1.tar.xz tarball was
  still copied (from the local mirror, admittedly) into the dl/
  directory.

 IMHO, for a build system complex like OpenWrt, it's better to be
 self-contained and do things in a more predictable/controlled way.

  i agree, it was just the way i was reading the comment below that i
think confused me.

i haven't followed the Makefile structures far enough yet to see
  what should happen, but a comment in tools/Makefile reads:
 
  # in case there is no patch tool on the host we need to make patch
  # tool a dependency for tools which have patches directory
 
  which *seems* to suggest that the build will look for patch already
  installed on the host and take advantage of it if it's there.

 No, it tries to handle the case that some host tools needs to be
 patched (having patches/ directory) before getting compiled in which
 case those tools/XXX/compile needs to have a dependence on
 tools/patch/install.

  ok, i think i see what that comment means ... if any tool needs
patching, then patch is registered as a necessary host tool and it
*will* be downloaded and built, even if it already exists on the host,
correct?

  however, assuming i understand that, there are now two new things
that puzzle me. first, i selected CONFIG_CCACHE and, as i read it,
that would normally mean i would need the ccache utility to be
downloaded and built as a host tool (even if it's already installed,
yes?). but it's not. even though:

CONFIG_CCACHE=y

i see no ccache tarball in my dl/ direectory. ccache is, in fact,
installed on my build host, but i thought we just agreed that that
shouldn't make a difference. so what would force ccache to be
downloaded and built?

  finally, mtd-utils -- the recipe specifies both a version number and
git info in the Makefile:

PKG_NAME:=mtd-utils
PKG_VERSION:=1.4.5

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=5319b84974fcb71504aed2d1b8285e9c0a4a4bb8
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_CAT:=zcat

  now, the first time i downloaded all the tools, git cloned the
mtd-utils repository, and created the tarball mtd-utils-1.4.5.tar.gz.
however, even though i added that to my local mirror directory, the
download uses a git clone every time. should it not look in my local
mirror, and notice that the tarball is there? or does that not apply
to source that is cloned from a git repo?

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday

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


Re: [OpenWrt-Devel] couple questions about downloading for a new build

2014-09-11 Thread Yousong Zhou
On 11 September 2014 21:12, Robert P. J. Day rpj...@crashcourse.ca wrote:
 On Thu, 11 Sep 2014, Yousong Zhou wrote:

 On 11 September 2014 20:30, Robert P. J. Day rpj...@crashcourse.ca wrote:
 
first, i created a local mirror with all the tarballs i
  downloaded during an earlier build, and configured a new build to
  use that, and i noticed that the download operation *copied* over
  the tarballs into the dl/ directory. is there any reason that
  symlinks aren't used, rather than doing actual copies? wouldn't
  symlinks work just as well?

 I take mirrors as places where the build system will try to fetch
 those tarballs, into CONFIG_DOWNLOAD_FOLDER which defaults to
 $(TOPDIR)/dl/ which in my local tree is a symbolic link to the
 actually directory holding those tarballs.  It works quite well.

   i realize that's *one* way to do it, and it's how i did it
 originally, but i chose instead to set up a single local mirror
 directory that each build can fetch from into their personal dl/
 directory, whereupon i noticed that fetching from that local mirror
 really is doing a full copy, whereas it *seems* that just doing a
 symlink would work just as well and not use up all that disk space.

   i'm just wondering why symlinks aren't used.

Well, the current design decision works for me and probably for many
others.  If it is not good enough and causing some inconvenience, then
patches are expected to enhance it.


also, i wondered if building the host tools would take advantage
  of already-installed host tools that match the exact version that
  openwrt needs. in my new build, the version of patch required is
  ostensibly 2.7.1, which is precisely the version already installed
  on my host, but it appears the patch-2.7.1.tar.xz tarball was
  still copied (from the local mirror, admittedly) into the dl/
  directory.

 IMHO, for a build system complex like OpenWrt, it's better to be
 self-contained and do things in a more predictable/controlled way.

   i agree, it was just the way i was reading the comment below that i
 think confused me.

i haven't followed the Makefile structures far enough yet to see
  what should happen, but a comment in tools/Makefile reads:
 
  # in case there is no patch tool on the host we need to make patch
  # tool a dependency for tools which have patches directory
 
  which *seems* to suggest that the build will look for patch already
  installed on the host and take advantage of it if it's there.

 No, it tries to handle the case that some host tools needs to be
 patched (having patches/ directory) before getting compiled in which
 case those tools/XXX/compile needs to have a dependence on
 tools/patch/install.

   ok, i think i see what that comment means ... if any tool needs
 patching, then patch is registered as a necessary host tool and it
 *will* be downloaded and built, even if it already exists on the host,
 correct?

   however, assuming i understand that, there are now two new things
 that puzzle me. first, i selected CONFIG_CCACHE and, as i read it,
 that would normally mean i would need the ccache utility to be
 downloaded and built as a host tool (even if it's already installed,
 yes?). but it's not. even though:

 CONFIG_CCACHE=y

 i see no ccache tarball in my dl/ direectory. ccache is, in fact,
 installed on my build host, but i thought we just agreed that that
 shouldn't make a difference. so what would force ccache to be
 downloaded and built?


Hmm, i haven't tried ccache myself, at least not in the way i am fully
aware of.  But as said above, I tend to think that the current shape
of OpenWrt is formed gradually by needs, of users or developers.  If
the then implementation or design decision does not work, patches are
applied to solve it, in trunk or in developers' local tree.

   finally, mtd-utils -- the recipe specifies both a version number and
 git info in the Makefile:

 PKG_NAME:=mtd-utils
 PKG_VERSION:=1.4.5

 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=git://git.infradead.org/mtd-utils.git
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_VERSION:=5319b84974fcb71504aed2d1b8285e9c0a4a4bb8
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_CAT:=zcat

   now, the first time i downloaded all the tools, git cloned the
 mtd-utils repository, and created the tarball mtd-utils-1.4.5.tar.gz.
 however, even though i added that to my local mirror directory, the
 download uses a git clone every time. should it not look in my local
 mirror, and notice that the tarball is there? or does that not apply
 to source that is cloned from a git repo?

Maybe it's just that the current code does not bother :)  as there are
(easy) ways to work around this.

The current build system only checks availabilities of tarballs in
CONFIG_DOWNLOAD_FOLDER.  Myabe mirrors are supposed to be remote.
Anyway, you can patch this in your local tree or try to convince
developers to accept the change into OpenWrt trunk.


   yousong

Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Linus Lüssing
On Wed, Sep 10, 2014 at 05:02:04PM +0200, Felix Fietkau wrote:
 I intentionally wanted to keep the implementation outside of mac80211,
 because there are other scenarios where this could be useful.
 I might have a dumb AP with no IGMP snooping capabilities connected to
 an Ethernet interface, and with this implementation I can simply enable
 multicast-unicast translation on the Ethernet device.

Ah! Right, that's a good use-case and reason to do it like that for
now, agreed. Thanks for clarifying :).

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


[OpenWrt-Devel] [PATCH v2] ar71xx: add qihoo 360 c301 router support

2014-09-11 Thread Weijie Gao
Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac.
Its chipset is AR9344 + AR9882 with two 16MB flashes.

This patch adds its initial support.

v2:
* use mtd_get_mac_ascii to fetch MAC address for ath10k.
* use ath79_register_pci to initialize AR9882.

Signed-off-by: Weijie Gao hackpas...@gmail.com
---
 target/linux/ar71xx/base-files/etc/diag.sh |   3 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds |   4 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |   3 +
 .../lib/preinit/81_load_ath10k_board_bin   |  17 +++
 .../ar71xx/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ar71xx/config-3.10|   1 +
 target/linux/ar71xx/config-3.14|   1 +
 .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 166 +
 target/linux/ar71xx/generic/profiles/qihoo.mk  |  16 ++
 target/linux/ar71xx/image/Makefile |   3 +
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 ...726-MIPS-ath79-add-qihoo-360-c301-support.patch |  40 +
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 ...726-MIPS-ath79-add-qihoo-360-c301-support.patch |  40 +
 15 files changed, 300 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
 create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk
 create mode 100644 
target/linux/ar71xx/patches-3.10/726-MIPS-ath79-add-qihoo-360-c301-support.patch
 create mode 100644 
target/linux/ar71xx/patches-3.14/726-MIPS-ath79-add-qihoo-360-c301-support.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh 
b/target/linux/ar71xx/base-files/etc/diag.sh
index 1864b11..c16b7d7 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -166,6 +166,9 @@ get_status_led() {
oolite)
status_led=oolite:red:system
;;
+   qihoo-c301)
+   status_led=qihoo:green:status
+   ;;
tew-632brp)
status_led=tew-632brp:green:status
;;
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 d3b766d..9d2cd41 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -191,6 +191,10 @@ om5p)
ucidef_set_led_netdev port2 port2 om5p:blue:lan eth1
;;
 
+qihoo-c301)
+   ucidef_set_led_wlan wlan2g WLAN2G qihoo:red:status phy1tpt
+   ;;
+
 smart-300)
ucidef_set_led_netdev wan WAN nc-link:green:wan eth0
ucidef_set_led_switch lan1 LAN1 nc-link:green:lan1 switch0 
0x04
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 c5cfd67..d5a43bd 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -346,6 +346,7 @@ hiwifi-hc6361 |\
 ja76pf |\
 mynet-n600 |\
 oolite |\
+qihoo-c301 |\
 rb-750 |\
 rb-751 |\
 tew-632brp |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 1e96b6d..1c685c6 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -430,6 +430,9 @@ ar71xx_board_detect() {
*PB92)
name=pb92
;;
+   *Qihoo 360 C301)
+   name=qihoo-c301
+   ;;
*RouterBOARD 411/A/AH)
name=rb-411
;;
diff --git 
a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin 
b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
index a28932f..2c06d7f 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
+++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
@@ -24,6 +24,23 @@ do_load_ath10k_board_bin() {
bs=1 skip=20492 count=2104  
/tmp/ath10k-board.bin
 
;;
+   qihoo-c301)
+   local mac
+
+   mac=$(mtd_get_mac_ascii devdata wlan5mac)
+
+   if [ -z $mac ]; then
+   mac=$(macaddr_add $(cat 
/sys/class/net/eth0/address) -2)
+   fi
+
+   dd if=/dev/mtdblock10 \
+   bs=1 skip=20480 count=6 \
+   of=/tmp/ath10k-board.bin
+   macaddr_2bin $mac  /tmp/ath10k-board.bin
+   dd if=/dev/mtdblock10 \
+   bs=1 skip=20492 count=2104  
/tmp/ath10k-board.bin
+
+   ;;
esac
[ -f /tmp/ath10k-board.bin ] || {
return
diff --git 

Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Linus Lüssing
On Wed, Sep 10, 2014 at 04:31:37PM +0200, Linus Lüssing wrote:
 Another approach would be
 to add a feature to mac80211 to disable the forwarding of
 IGMPv2/MLDv1 reports to other STAs, only forwarding it on the own
 AP interface so that the bridge would see all reports.

Hrm, on the other hand, if a querier is actually on one of the
other STAs then mac80211 would have to forward the report there.
Which would mean either needing query-snooping in mac80211 (or
netdev in general) or interaction between mac80211 and the
bridge-snooping code.

I really hate this IGMPv2/MLDv1 report suppression...
(that's where all the complexity in the batman-adv multicast
optimizations came from, too)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Felix Fietkau
On 2014-09-11 16:28, Linus Lüssing wrote:
 On Wed, Sep 10, 2014 at 04:31:37PM +0200, Linus Lüssing wrote:
 Another approach would be
 to add a feature to mac80211 to disable the forwarding of
 IGMPv2/MLDv1 reports to other STAs, only forwarding it on the own
 AP interface so that the bridge would see all reports.
 
 Hrm, on the other hand, if a querier is actually on one of the
 other STAs then mac80211 would have to forward the report there.
 Which would mean either needing query-snooping in mac80211 (or
 netdev in general) or interaction between mac80211 and the
 bridge-snooping code.
 
 I really hate this IGMPv2/MLDv1 report suppression...
 (that's where all the complexity in the batman-adv multicast
 optimizations came from, too)
How widely used is IGMPv2/MLDv1 compared to the newer version?

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


Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Steven Barth
Well it seems to be still somewhat used in embedded stuff, e.g. my 
5-year old HP ethernet/802.11g printer/scanner/whatever still uses MLDv1 
/ IGMPv2 to do its MDNS / SSDP business.


Another idea would maybe be to translate MLDv1 / IGMPv2 reports into 
appropriate MLDv2/IGMPv3 equivalents before sharing them on the bridge 
to prevent the suppression.

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


Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Linus Lüssing
On Thu, Sep 11, 2014 at 04:51:41PM +0200, Felix Fietkau wrote:
 On 2014-09-11 16:28, Linus Lüssing wrote:
  On Wed, Sep 10, 2014 at 04:31:37PM +0200, Linus Lüssing wrote:
  Another approach would be
  to add a feature to mac80211 to disable the forwarding of
  IGMPv2/MLDv1 reports to other STAs, only forwarding it on the own
  AP interface so that the bridge would see all reports.
  
  Hrm, on the other hand, if a querier is actually on one of the
  other STAs then mac80211 would have to forward the report there.
  Which would mean either needing query-snooping in mac80211 (or
  netdev in general) or interaction between mac80211 and the
  bridge-snooping code.
  
  I really hate this IGMPv2/MLDv1 report suppression...
  (that's where all the complexity in the batman-adv multicast
  optimizations came from, too)
 How widely used is IGMPv2/MLDv1 compared to the newer version?

According to Wikipedia, MLDv2 is present in operating systems
since:

* Windows Vista
* FreeBSD 8.0
* Linux 2.5.68

However, unfortunately, MLDv2 has a lot of MLDv1-compatibility
sections: A single MLDv1 listener/report can cause report
suppresion for MLDv2 listeners, too. An MLDv1 router/query leads
to MLDv2 listeners to switch to MLDv1 compatibility mode. The
querier code in the Linux bridge sends MLDv1 queries which is even
enabled by default in widely used kernels like 3.2 (and which you
enabled by default in OpenWRT Barrier Breaker, too).

In the Freifunk mesh networks in Hamburg and Lübeck we do have
MLDv1 reports, though it's hard to tell how many MLDv1-only
devices there are due to the suppressions and
MLDv1-compatibility-mode on MLDv2 hosts.

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


[OpenWrt-Devel] still remnants left around from deletion of LLVM back in 2013

2014-09-11 Thread Robert P. J. Day

  long story short: poking around llvm content in openwrt, which
looked really weird and eventually led me to this:

commit 9241c57193bb8af2c1f4944ee21249b927cfecff
Author: kaloz kaloz@3c298f89-4303-0410-b956-a3cf2f4a3e73
Date:   Mon Apr 1 15:08:38 2013 +

[toolchain/gcc]: llvm is marked broken for two and a half year now, nuke it

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36145 
3c298f89-4303-0410-b956-a3cf2f4a3e73

diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in
index f83f83c..6cfde54 100644
--- a/toolchain/gcc/Config.in
+++ b/toolchain/gcc/Config.in
@@ -26,16 +26,11 @@ choice
config GCC_VERSION_4_7_LINARO
bool gcc 4.7.x with Linaro enhancements

-   config GCC_VERSION_LLVM
-   bool llvm-gcc 4.2
-   depends BROKEN
-
... snip ...

  but there are still some references to llvm in the source tree:

$ grep -r LLVM *
package/utils/busybox/Makefile:ifdef CONFIG_GCC_VERSION_LLVM
toolchain/gcc/common.mk:$(if $(shell gcc --version 21 | grep LLVM), \
toolchain/Makefile:ifdef CONFIG_GCC_VERSION_LLVM
tools/Makefile:ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN)$(CONFIG_GCC_LLVM),)
$

  should those final remnants be removed? and what's with
CONFIG_GCC_LLVM, anyway? is that a typo?

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

Twitter:   http://twitter.com/rpjday
LinkedIn:   http://ca.linkedin.com/in/rpjday

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


[OpenWrt-Devel] [PATCH] include: remove file before overwritting it with replace_script

2014-09-11 Thread Mathieu Olivari
config.{sub,guess} could be symlinks to a shared common version of
this file (e.g. in staging). So we remove the destination file via
--remove-destination option of cp. This prevents replaceing the
common file that other packages could be build with if running at
the same time.

This fixes a class of errors where config.sub is missing, or
only partially present when running configure because a cp is
currently in progress

This is commonly seen building with a lot of parallel jobs and
on packages that use 'PKG_FIXUP:=autoreconf'

Signed-off-by: Matthew McClintock mmccl...@qca.qualcomm.com
Signed-off-by: Mathieu Olivari math...@qca.qualcomm.com
---
 include/package-defaults.mk |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/package-defaults.mk b/include/package-defaults.mk
index 61e495f..051cde5 100644
--- a/include/package-defaults.mk
+++ b/include/package-defaults.mk
@@ -98,7 +98,9 @@ CONFIGURE_VARS = \
 CONFIGURE_PATH = .
 CONFIGURE_CMD = ./configure
 
-replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; $(FIND) $(1) 
-name $(2) | $(XARGS) -n1 cp $(SCRIPT_DIR)/$(2);
+replace_script=$(FIND) $(1) -name $(2) | $(XARGS) chmod u+w; \
+  $(FIND) $(1) -name $(2) | $(XARGS) -n1 cp --remove-destination \
+  $(SCRIPT_DIR)/$(2);
 
 define Build/Configure/Default
(cd $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/$(strip $(3)); \
-- 
1.7.10.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Regarding bridge multicast-to-unicast patch

2014-09-11 Thread Linus Lüssing
On Thu, Sep 11, 2014 at 05:42:18PM +0200, Steven Barth wrote:
 Well it seems to be still somewhat used in embedded stuff, e.g. my
 5-year old HP ethernet/802.11g printer/scanner/whatever still uses
 MLDv1 / IGMPv2 to do its MDNS / SSDP business.

Yeah, that's probably because IGMPv2/MLDv1 is way easier to implement
than MLDv2, so as long as IGMPv2/MLDv1 aren't obsoleted by the
IETF, especially budget vendors will probably keep implementing it
even today.

 
 Another idea would maybe be to translate MLDv1 / IGMPv2 reports into
 appropriate MLDv2/IGMPv3 equivalents before sharing them on the
 bridge to prevent the suppression.

Hm, IGMPv2/MLDv1 to IGMPv3/MLDv2 should be relatively easy. But
I'm currently not sure whether a router/querier will make and take
some wrong assumptions and actions by thinking there is no
IGMPv2/MLDv1 listener. What if there is one MLDv2 listener which
included source specific state messages in its state change report?
The querier would respond with a Multicast Address and Source
Specific Query to learn whether there are listeners left for
this multicast and source addresses. Would the MLDv1 listener
interpret this query and process this message as a Multicast Address
Specific Query or would it ignore it?

What about the many MLDv1 queriers we have right now through the
bridge code? What if someone sneaks in an MLDv1 listener somewhere
in your bridged network over an ethernet cable? (You'd need
report translation both on the AP and on bridges and maybe query
translation, too)
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 00/32] atheros: various cleanups

2014-09-11 Thread Sergey Ryazanov
Final cleanup series before pushing code upstream. Cleanup all sparce errors
and almost all checkpatch warnings (have a few warnings agains config symbol
help). And many more cleanups.

Flash and ethernet drivers still need some work, especially ethernet driver.

Whole series tested with following boards:
  DWL-2100AP (AR2313 based)
  FON2202 (AR2315 based)
  LiteStation2 (AR2316 based)
  DIR-300 (AR2317 based)

Sergey Ryazanov (32):
  atheros: avoid extern prototypes
  atheros: add missing include
  atheros: use NULL instead of plain integer
  atheros: use static keywork for local code
  atheros: add blank line after declarations
  atheros: remove FSF mailing address
  atheros: remove useless return
  atheros: ar2315-spiflash: use devm_* API to simplify the code
  atheros: ar2315-spiflash: update initialization
  atheros: ar2315-spiflash: use mutex inplace of spinlock
  atheros: ar231x-eth: remove useless IOCTL handlers
  atheros: remove useless includes
  atheros: update ether addresses handling
  atheros: rework and cleanup board initialization
  atheros: various space related changes
  atheros: remove odd ATHEROS_AR2315 config symbol dependencies
  atheros: ar2315-pci: remove odd locking in PCI config space access
function
  atheros: ar2315-pci: cosmetic changes
  atheros: ar2315-pci: rework host controller initialization
  atheros: ar2315-pci: rework interrupt handling
  atheros: ar2315-pci: rework the configuration access code
  atheros: ar2315-pci: update host bridge resources
  atheros: ar2315-pci: update DMA offset macroses
  atheros: ar2315-pci: rename configuration symbol
  atheros: ar2315-pci: convert to platform driver
  atheros: add AR2316 and AR2318 SoCs detection
  atheros: rename SoCs config symbols
  atheros: convert gpio.h to stub
  atheros: rework chained interrupts handling
  atheros: convert AR5312 GPIO code to platform driver
  atheros: convert AR2315 GPIO code to platform driver
  atheros: refresh config

 target/linux/atheros/config-3.14   |  12 +-
 target/linux/atheros/patches-3.14/100-board.patch  | 700 +++--
 .../patches-3.14/101-early-printk-support.patch|   4 +-
 .../atheros/patches-3.14/102-ar5312_gpio.patch | 194 ++
 .../atheros/patches-3.14/103-ar2315_gpio.patch | 315 ++
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 440 -
 .../atheros/patches-3.14/110-ar2313_ethernet.patch |  89 +--
 .../linux/atheros/patches-3.14/120-spiflash.patch  | 161 ++---
 .../linux/atheros/patches-3.14/130-watchdog.patch  |   6 +-
 .../patches-3.14/220-enet_micrel_workaround.patch  |  17 +-
 10 files changed, 1074 insertions(+), 864 deletions(-)
 create mode 100644 target/linux/atheros/patches-3.14/102-ar5312_gpio.patch
 create mode 100644 target/linux/atheros/patches-3.14/103-ar2315_gpio.patch

-- 
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/32] atheros: avoid extern prototypes

2014-09-11 Thread Sergey Ryazanov
Avoid using of extern prototypes as suggested by checkpatch.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch | 33 +++
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index a45664a..0e1b6b5 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -2697,11 +2697,11 @@
 +
 +#ifdef CONFIG_ATHEROS_AR2315
 +
-+extern void ar2315_irq_init(void);
-+extern int ar2315_init_devices(void);
-+extern void ar2315_prom_init(void);
-+extern void ar2315_plat_setup(void);
-+extern void ar2315_time_init(void);
++void ar2315_irq_init(void);
++int ar2315_init_devices(void);
++void ar2315_prom_init(void);
++void ar2315_plat_setup(void);
++void ar2315_time_init(void);
 +
 +#else
 +
@@ -2731,18 +2731,17 @@
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.h
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,37 @@
 +#ifndef __AR5312_H
 +#define __AR5312_H
 +
 +#ifdef CONFIG_ATHEROS_AR5312
 +
-+extern void ar5312_irq_init(void);
-+extern int ar5312_init_devices(void);
-+extern void ar5312_prom_init(void);
-+extern void ar5312_plat_setup(void);
-+extern void ar5312_time_init(void);
-+extern void ar5312_time_init(void);
++void ar5312_irq_init(void);
++int ar5312_init_devices(void);
++void ar5312_prom_init(void);
++void ar5312_plat_setup(void);
++void ar5312_time_init(void);
 +
 +#else
 +
@@ -2840,11 +2839,11 @@
 +extern struct ar231x_board_config ar231x_board;
 +extern asmlinkage void (*ar231x_irq_dispatch)(void);
 +
-+extern int ar231x_find_config(u8 *flash_limit);
-+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, const char *mii_name,
-+ u32 mii_base, int irq, void *pdata);
++int ar231x_find_config(u8 *flash_limit);
++void ar231x_serial_setup(u32 mapbase, int irq, unsigned int uartclk);
++int ar231x_add_wmac(int nr, u32 base, int irq);
++int ar231x_add_ethernet(int nr, u32 base, const char *mii_name, u32 mii_base,
++  int irq, void *pdata);
 +
 +static inline bool is_2315(void)
 +{
-- 
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/32] atheros: use NULL instead of plain integer

2014-09-11 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 383ffa3..c60c9e3 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -212,7 +212,7 @@
 +
 +  if (!found) {
 +  pr_warn(WARNING: Could not find Radio Configuration data\n);
-+  radio_config = 0;
++  radio_config = NULL;
 +  }
 +
 +  return radio_config;
-- 
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 04/32] atheros: use static keywork for local code

2014-09-11 Thread Sergey Ryazanov
Make PCI IRQ handler and several structures static as suggested by
sparse.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 77c0e89..58e8f4b 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -108,7 +108,7 @@
 +  return config_access(devfn, where, size, value, 1);
 +}
 +
-+struct pci_ops ar231x_pci_ops = {
++static struct pci_ops ar231x_pci_ops = {
 +  .read   = ar231x_pci_read,
 +  .write  = ar231x_pci_write,
 +};
@@ -128,7 +128,7 @@
 +  .flags  = IORESOURCE_IO,
 +};
 +
-+struct pci_controller ar231x_pci_controller = {
++static struct pci_controller ar231x_pci_controller = {
 +  .pci_ops= ar231x_pci_ops,
 +  .mem_resource   = ar231x_mem_resource,
 +  .io_resource= ar231x_io_resource,
@@ -272,7 +272,7 @@
 +  ar231x_write_reg(AR2315_PCI_INT_STATUS, AR2315_PCI_EXT_INT);
 +}
 +
-+void ar2315_pci_irq(int irq)
++static void ar2315_pci_irq(int irq)
 +{
 +  if (ar231x_read_reg(AR2315_PCI_INT_STATUS) == AR2315_PCI_ABORT_INT)
 +  pci_abort_irq();
-- 
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/32] atheros: add missing include

2014-09-11 Thread Sergey Ryazanov
Missing this headers cause several sparse symbol 'foo' was not
declared. Should it be static? warnings.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 0e1b6b5..383ffa3 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -84,7 +84,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
 --- /dev/null
 +++ b/arch/mips/ar231x/board.c
-@@ -0,0 +1,261 @@
+@@ -0,0 +1,263 @@
 +/*
 + * 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
@@ -109,6 +109,8 @@
 +#include linux/io.h
 +#include asm/irq_cpu.h
 +#include asm/reboot.h
++#include asm/bootinfo.h
++#include asm/time.h
 +
 +#include ar231x_platform.h
 +#include devices.h
@@ -2858,13 +2860,15 @@
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.c
-@@ -0,0 +1,180 @@
+@@ -0,0 +1,182 @@
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/serial.h
 +#include linux/serial_core.h
 +#include linux/serial_8250.h
 +#include linux/platform_device.h
++#include asm/bootinfo.h
++
 +#include ar231x_platform.h
 +#include ar231x.h
 +#include devices.h
-- 
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/32] atheros: remove FSF mailing address

2014-09-11 Thread Sergey Ryazanov
Remove FSF mailing address as suggested by checkpach and place license
URL.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch | 5 ++---
 target/linux/atheros/patches-3.14/130-watchdog.patch   | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 58e8f4b..0ce670f 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,234 @@
+@@ -0,0 +1,233 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -20,8 +20,7 @@
 + * 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.
++ * along with this program; if not, see http://www.gnu.org/licenses/.
 + */
 +
 +#include linux/types.h
diff --git a/target/linux/atheros/patches-3.14/130-watchdog.patch 
b/target/linux/atheros/patches-3.14/130-watchdog.patch
index db824d0..149bd45 100644
--- a/target/linux/atheros/patches-3.14/130-watchdog.patch
+++ b/target/linux/atheros/patches-3.14/130-watchdog.patch
@@ -1,6 +1,6 @@
 --- /dev/null
 +++ b/drivers/watchdog/ar2315-wtd.c
-@@ -0,0 +1,209 @@
+@@ -0,0 +1,208 @@
 +/*
 + * 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
@@ -13,8 +13,7 @@
 + * 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
++ * along with this program; if not, see http://www.gnu.org/licenses/.
 + *
 + * Copyright (C) 2008 John Crispin blo...@openwrt.org
 + * Based on EP93xx and ifxmips wdt driver
-- 
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/32] atheros: add blank line after declarations

2014-09-11 Thread Sergey Ryazanov
as suggested by checkpach.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch   | 17 +++--
 .../atheros/patches-3.14/110-ar2313_ethernet.patch  |  6 +-
 .../patches-3.14/220-enet_micrel_workaround.patch   |  7 ---
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index c60c9e3..5fae3f3 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -1591,7 +1591,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,540 @@
+@@ -0,0 +1,542 @@
 +/*
 + * 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
@@ -1731,6 +1731,7 @@
 +  ar231x_irq_dispatch = ar5312_irq_dispatch;
 +  for (i = 0; i  AR5312_MISC_IRQ_COUNT; i++) {
 +  int irq = AR231X_MISC_IRQ_BASE + i;
++
 +  irq_set_chip_and_handler(irq, ar5312_misc_irq_chip,
 +   handle_level_irq);
 +  }
@@ -1751,6 +1752,7 @@
 +ar5312_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 +{
 +  u32 reg = ar231x_read_reg(AR5312_GPIO_DO);
++
 +  reg = value ? reg | (1  gpio) : reg  ~(1  gpio);
 +  ar231x_write_reg(AR5312_GPIO_DO, reg);
 +}
@@ -2080,8 +2082,8 @@
 +static int __init
 +ar5312_gpio_init(void)
 +{
-+  int ret;
-+  ret = gpiochip_add(ar5312_gpio_chip);
++  int ret = gpiochip_add(ar5312_gpio_chip);
++
 +  if (ret) {
 +  pr_err(%s: failed to add gpiochip\n, ar5312_gpio_chip.label);
 +  return ret;
@@ -2134,7 +2136,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,556 @@
+@@ -0,0 +1,559 @@
 +/*
 + * 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
@@ -2339,11 +2341,13 @@
 +  gpiointval = ar231x_read_reg(AR2315_GPIO_DI);
 +  for (i = 0; i  AR2315_MISC_IRQ_COUNT; i++) {
 +  int irq = AR231X_MISC_IRQ_BASE + i;
++
 +  irq_set_chip_and_handler(irq, ar2315_misc_irq_chip,
 +  handle_level_irq);
 +  }
 +  for (i = 0; i  AR2315_NUM_GPIO; i++) {
 +  int irq = AR231X_GPIO_IRQ_BASE + i;
++
 +  irq_set_chip_and_handler(irq, ar2315_gpio_irq_chip,
 +  handle_level_irq);
 +  }
@@ -2365,6 +2369,7 @@
 +ar2315_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 +{
 +  u32 reg = ar231x_read_reg(AR2315_GPIO_DO);
++
 +  reg = value ? reg | (1  gpio) : reg  ~(1  gpio);
 +  ar231x_write_reg(AR2315_GPIO_DO, reg);
 +}
@@ -2629,8 +2634,8 @@
 +static int __init
 +ar2315_gpio_init(void)
 +{
-+  int ret;
-+  ret = gpiochip_add(ar2315_gpio_chip);
++  int ret = gpiochip_add(ar2315_gpio_chip);
++
 +  if (ret) {
 +  pr_err(%s: failed to add gpiochip\n, ar2315_gpio_chip.label);
 +  return ret;
diff --git a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
index bda0ce3..42812ff 100644
--- a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.14/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,1250 @@
+@@ -0,0 +1,1254 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -375,6 +375,7 @@
 +{
 +  struct net_device *dev = platform_get_drvdata(pdev);
 +  struct ar231x_private *sp = netdev_priv(dev);
++
 +  rx_tasklet_cleanup(dev);
 +  ar231x_init_cleanup(dev);
 +  unregister_netdev(dev);
@@ -416,6 +417,7 @@
 +static void ar231x_free_descriptors(struct net_device *dev)
 +{
 +  struct ar231x_private *sp = netdev_priv(dev);
++
 +  if (sp-rx_ring != NULL) {
 +  kfree((void *)KSEG0ADDR(sp-rx_ring));
 +  sp-rx_ring = NULL;
@@ -458,6 +460,7 @@
 +  /* Initialize the transmit Descriptors */
 +  for (j = 0; j  AR2313_DESCR_ENTRIES; j++) {
 +  ar231x_descr_t *td = sp-tx_ring[j];
++
 +  td-status = 0;
 +  td-devcs = DMA_TX1_CHAINED;
 +  td-addr = 0;
@@ -945,6 +948,7 @@
 +  tasklet_hi_schedule(sp-rx_tasklet);
 +  } else {
 +  unsigned long flags;
++
 +  spin_lock_irqsave(sp-lock, flags);
 +  sp-dma_regs-intr_ena |= DMA_STATUS_RI;
 +  spin_unlock_irqrestore(sp-lock, flags);
diff --git a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch 
b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
index dade7ee..a110014 100644
--- 

[OpenWrt-Devel] [PATCH 07/32] atheros: remove useless return

2014-09-11 Thread Sergey Ryazanov
Remove useless void function return.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 3 +--
 target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch| 6 +-
 target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch | 2 +-
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 5fae3f3..a19e4b3 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -563,7 +563,7 @@
 +#endif /* __ASM_MACH_AR231X_CPU_FEATURE_OVERRIDES_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/dma-coherence.h
-@@ -0,0 +1,79 @@
+@@ -0,0 +1,78 @@
 +/*
 + * 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
@@ -623,7 +623,6 @@
 +
 +static inline void plat_extra_sync_for_device(struct device *dev)
 +{
-+  return;
 +}
 +
 +static inline int plat_dma_mapping_error(struct device *dev,
diff --git a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
index 42812ff..9bf9abb 100644
--- a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.14/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,1254 @@
+@@ -0,0 +1,1250 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -793,8 +793,6 @@
 +
 +  if (i)
 +  sp-rx_skbprd = idx;
-+
-+  return;
 +}
 +
 +#define AR2313_MAX_PKTS_PER_CALL64
@@ -931,8 +929,6 @@
 +  }
 +
 +  sp-tx_csm = idx;
-+
-+  return;
 +}
 +
 +
diff --git a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch 
b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
index a110014..abda9ce 100644
--- a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
+++ b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
@@ -79,7 +79,7 @@
kfree(dev);
return 0;
  }
-@@ -1108,6 +1155,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -1104,6 +1151,9 @@ static int ar231x_ioctl(struct net_devic
struct ar231x_private *sp = netdev_priv(dev);
int 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 08/32] atheros: ar2315-spiflash: use devm_* API to simplify the code

2014-09-11 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../linux/atheros/patches-3.14/120-spiflash.patch  | 48 +++---
 1 file changed, 15 insertions(+), 33 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/120-spiflash.patch 
b/target/linux/atheros/patches-3.14/120-spiflash.patch
index 9a55195..d61f368 100644
--- a/target/linux/atheros/patches-3.14/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.14/120-spiflash.patch
@@ -23,7 +23,7 @@
  
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,536 @@
+@@ -0,0 +1,518 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -452,41 +452,33 @@
 +  int index;
 +  int result = 0;
 +
-+  priv = kzalloc(sizeof(struct spiflash_priv), GFP_KERNEL);
++  priv = devm_kzalloc(pdev-dev, sizeof(*priv), GFP_KERNEL);
++  if (!priv)
++  return -ENOMEM;
++
 +  spin_lock_init(priv-lock);
 +  init_waitqueue_head(priv-wq);
 +  priv-state = FL_READY;
 +  mtd = priv-mtd;
 +
 +  res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-+  if (!res) {
-+  dev_err(pdev-dev, No MMR resource found\n);
-+  goto error;
-+  }
-+
-+  priv-mmraddr = ioremap_nocache(res-start, resource_size(res));
-+  if (!priv-mmraddr) {
-+  dev_warn(pdev-dev, SPIFLASH Failed to map flash device\n);
-+  goto error;
++  priv-mmraddr = devm_ioremap_resource(pdev-dev, res);
++  if (IS_ERR(priv-mmraddr)) {
++  dev_warn(pdev-dev, failed to map flash MMR\n);
++  return PTR_ERR(priv-mmraddr);
 +  }
 +
 +  index = spiflash_probe_chip(priv);
 +  if (!index) {
 +  dev_warn(pdev-dev, SPIFLASH Found no flash device\n);
-+  goto error;
++  return -ENODEV;
 +  }
 +
 +  res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-+  if (!res) {
-+  dev_err(pdev-dev, No flash readmem resource found\n);
-+  goto error;
-+  }
-+
-+  priv-readaddr = ioremap_nocache(res-start,
-+   flashconfig_tbl[index].byte_cnt);
-+  if (!priv-readaddr) {
-+  dev_warn(pdev-dev, SPIFLASH Failed to map flash device\n);
-+  goto error;
++  priv-readaddr = devm_ioremap_resource(pdev-dev, res);
++  if (IS_ERR(priv-readaddr)) {
++  dev_warn(pdev-dev, failed to map flash read mem\n);
++  return PTR_ERR(priv-readaddr);
 +  }
 +
 +  platform_set_drvdata(pdev, priv);
@@ -513,24 +505,14 @@
 +#endif
 +
 +  return result;
-+
-+error:
-+  if (priv-mmraddr)
-+  iounmap(priv-mmraddr);
-+  kfree(priv);
-+  return -ENXIO;
 +}
 +
 +static int
 +spiflash_remove(struct platform_device *pdev)
 +{
 +  struct spiflash_priv *priv = platform_get_drvdata(pdev);
-+  struct mtd_info *mtd = priv-mtd;
 +
-+  mtd_device_unregister(mtd);
-+  iounmap(priv-mmraddr);
-+  iounmap(priv-readaddr);
-+  kfree(priv);
++  mtd_device_unregister(priv-mtd);
 +
 +  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 09/32] atheros: ar2315-spiflash: update initialization

2014-09-11 Thread Sergey Ryazanov
  - fill module metadata
  - remove odd module_{init,exit}

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../linux/atheros/patches-3.14/120-spiflash.patch  | 35 --
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/120-spiflash.patch 
b/target/linux/atheros/patches-3.14/120-spiflash.patch
index d61f368..33f009b 100644
--- a/target/linux/atheros/patches-3.14/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.14/120-spiflash.patch
@@ -23,7 +23,7 @@
  
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,518 @@
+@@ -0,0 +1,507 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -56,8 +56,8 @@
 +
 +#include ar2315_spiflash.h
 +
++#define DRIVER_NAME ar2315-spiflash
 +
-+#define SPIFLASH spiflash: 
 +#define busy_wait(_priv, _condition, _wait) do { \
 +  while (_condition) { \
 +  spin_unlock_bh(_priv-lock); \
@@ -227,7 +227,7 @@
 + * and flashconfig_tbl array index for success.
 + */
 +static int
-+spiflash_probe_chip(struct spiflash_priv *priv)
++spiflash_probe_chip(struct platform_device *pdev, struct spiflash_priv *priv)
 +{
 +  u32 sig;
 +  int flash_size;
@@ -254,7 +254,7 @@
 +  flash_size = FLASH_16MB;
 +  break;
 +  default:
-+  pr_warn(SPIFLASH Read of flash device signature failed!\n);
++  dev_warn(pdev-dev, read of flash device signature 
failed!\n);
 +  return 0;
 +  }
 +
@@ -468,9 +468,9 @@
 +  return PTR_ERR(priv-mmraddr);
 +  }
 +
-+  index = spiflash_probe_chip(priv);
++  index = spiflash_probe_chip(pdev, priv);
 +  if (!index) {
-+  dev_warn(pdev-dev, SPIFLASH Found no flash device\n);
++  dev_warn(pdev-dev, found no flash device\n);
 +  return -ENODEV;
 +  }
 +
@@ -518,29 +518,18 @@
 +}
 +
 +static struct platform_driver spiflash_driver = {
-+  .driver.name = ar2315-spiflash,
++  .driver.name = DRIVER_NAME,
 +  .probe = spiflash_probe,
 +  .remove = spiflash_remove,
 +};
 +
-+static int __init
-+spiflash_init(void)
-+{
-+  return platform_driver_register(spiflash_driver);
-+}
-+
-+static void __exit
-+spiflash_exit(void)
-+{
-+  return platform_driver_unregister(spiflash_driver);
-+}
-+
-+module_init(spiflash_init);
-+module_exit(spiflash_exit);
++module_platform_driver(spiflash_driver);
 +
 +MODULE_LICENSE(GPL);
-+MODULE_AUTHOR(OpenWrt.org, Atheros Communications Inc);
-+MODULE_DESCRIPTION(MTD driver for SPI Flash on Atheros SOC);
++MODULE_AUTHOR(OpenWrt.org);
++MODULE_AUTHOR(Atheros Communications Inc);
++MODULE_DESCRIPTION(MTD driver for SPI Flash on Atheros AR2315+ SOC);
++MODULE_ALIAS(platform: DRIVER_NAME);
 +
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315_spiflash.h
-- 
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 10/32] atheros: ar2315-spiflash: use mutex inplace of spinlock

2014-09-11 Thread Sergey Ryazanov
Use mutex inplace of spinlock to make code simple, also call
mutex_{lock,unlock} explicitly to avoid sparse warning about context
imbalance.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../linux/atheros/patches-3.14/120-spiflash.patch  | 74 --
 1 file changed, 14 insertions(+), 60 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/120-spiflash.patch 
b/target/linux/atheros/patches-3.14/120-spiflash.patch
index 33f009b..8dbab10 100644
--- a/target/linux/atheros/patches-3.14/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.14/120-spiflash.patch
@@ -23,7 +23,7 @@
  
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,507 @@
+@@ -0,0 +1,461 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -53,6 +53,7 @@
 +#include linux/root_dev.h
 +#include linux/delay.h
 +#include linux/io.h
++#include linux/mutex.h
 +
 +#include ar2315_spiflash.h
 +
@@ -60,14 +61,12 @@
 +
 +#define busy_wait(_priv, _condition, _wait) do { \
 +  while (_condition) { \
-+  spin_unlock_bh(_priv-lock); \
 +  if (_wait  1) \
 +  msleep(_wait); \
 +  else if ((_wait == 1)  need_resched()) \
 +  schedule(); \
 +  else \
 +  udelay(1); \
-+  spin_lock_bh(_priv-lock); \
 +  } \
 +} while (0)
 +
@@ -141,9 +140,7 @@
 +  struct mtd_info mtd;
 +  void __iomem *readaddr; /* memory mapped data for read  */
 +  void __iomem *mmraddr;  /* memory mapped register space */
-+  wait_queue_head_t wq;
-+  spinlock_t lock;
-+  int state;
++  struct mutex lock;  /* serialize registers access */
 +};
 +
 +#define to_spiflash(_mtd) container_of(_mtd, struct spiflash_priv, mtd)
@@ -220,7 +217,6 @@
 +  return reg;
 +}
 +
-+
 +/*
 + * Probe SPI flash device
 + * Function returns 0 for failure.
@@ -229,14 +225,9 @@
 +static int
 +spiflash_probe_chip(struct platform_device *pdev, struct spiflash_priv *priv)
 +{
-+  u32 sig;
++  u32 sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0);
 +  int flash_size;
 +
-+  /* Read the signature on the flash device */
-+  spin_lock_bh(priv-lock);
-+  sig = spiflash_sendcmd(priv, SPI_RD_SIG, 0);
-+  spin_unlock_bh(priv-lock);
-+
 +  switch (sig) {
 +  case STM_8MBIT_SIGNATURE:
 +  flash_size = FLASH_1MB;
@@ -261,48 +252,13 @@
 +  return flash_size;
 +}
 +
-+
-+/* wait until the flash chip is ready and grab a lock */
-+static int spiflash_wait_ready(struct spiflash_priv *priv, int state)
-+{
-+  DECLARE_WAITQUEUE(wait, current);
-+
-+retry:
-+  spin_lock_bh(priv-lock);
-+  if (priv-state != FL_READY) {
-+  set_current_state(TASK_UNINTERRUPTIBLE);
-+  add_wait_queue(priv-wq, wait);
-+  spin_unlock_bh(priv-lock);
-+  schedule();
-+  remove_wait_queue(priv-wq, wait);
-+
-+  if (signal_pending(current))
-+  return 0;
-+
-+  goto retry;
-+  }
-+  priv-state = state;
-+
-+  return 1;
-+}
-+
-+static inline void spiflash_done(struct spiflash_priv *priv)
-+{
-+  priv-state = FL_READY;
-+  spin_unlock_bh(priv-lock);
-+  wake_up(priv-wq);
-+}
-+
 +static void
 +spiflash_wait_complete(struct spiflash_priv *priv, unsigned int timeout)
 +{
 +  busy_wait(priv, spiflash_sendcmd(priv, SPI_RD_STATUS, 0) 
 +  SPI_STATUS_WIP, timeout);
-+  spiflash_done(priv);
 +}
 +
-+
-+
 +static int
 +spiflash_erase(struct mtd_info *mtd, struct erase_info *instr)
 +{
@@ -313,8 +269,7 @@
 +  if (instr-addr + instr-len  mtd-size)
 +  return -EINVAL;
 +
-+  if (!spiflash_wait_ready(priv, FL_ERASING))
-+  return -EINTR;
++  mutex_lock(priv-lock);
 +
 +  spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
 +  reg = spiflash_wait_busy(priv);
@@ -329,6 +284,8 @@
 +
 +  spiflash_wait_complete(priv, 20);
 +
++  mutex_unlock(priv-lock);
++
 +  instr-state = MTD_ERASE_DONE;
 +  mtd_erase_callback(instr);
 +
@@ -349,11 +306,11 @@
 +
 +  *retlen = len;
 +
-+  if (!spiflash_wait_ready(priv, FL_READING))
-+  return -EINTR;
++  mutex_lock(priv-lock);
 +
 +  memcpy_fromio(buf, priv-readaddr + from, len);
-+  spiflash_done(priv);
++
++  mutex_unlock(priv-lock);
 +
 +  return 0;
 +}
@@ -391,8 +348,7 @@
 +  if (page_offset  STM_PAGE_SIZE)
 +  read_len -= (page_offset - STM_PAGE_SIZE);
 +
-+  if (!spiflash_wait_ready(priv, FL_WRITING))
-+  return -EINTR;
++  mutex_lock(priv-lock);
 +
 +  spiflash_sendcmd(priv, SPI_WRITE_ENABLE, 0);
 +  spi_data = 0;
@@ -425,6 +381,8 @@
 +
 +  spiflash_wait_complete(priv, 1);
 +
++  mutex_unlock(priv-lock);
++
 +  bytes_left -= read_len;
 +  to += read_len;
 +   

[OpenWrt-Devel] [PATCH 11/32] atheros: ar231x-eth: remove useless IOCTL handlers

2014-09-11 Thread Sergey Ryazanov
These IOCTLs handled in the core now.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../atheros/patches-3.14/110-ar2313_ethernet.patch  | 21 +
 .../patches-3.14/220-enet_micrel_workaround.patch   |  8 
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
index 9bf9abb..657f96c 100644
--- a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.14/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,1250 @@
+@@ -0,0 +1,1231 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -1138,27 +1138,8 @@
 +static int ar231x_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 +{
 +  struct ar231x_private *sp = netdev_priv(dev);
-+  int ret;
 +
 +  switch (cmd) {
-+  case SIOCETHTOOL:
-+  spin_lock_irq(sp-lock);
-+  ret = phy_ethtool_ioctl(sp-phy_dev, (void *)ifr-ifr_data);
-+  spin_unlock_irq(sp-lock);
-+  return ret;
-+
-+  case SIOCSIFHWADDR:
-+  if (copy_from_user
-+  (dev-dev_addr, ifr-ifr_data, sizeof(dev-dev_addr)))
-+  return -EFAULT;
-+  return 0;
-+
-+  case SIOCGIFHWADDR:
-+  if (copy_to_user
-+  (ifr-ifr_data, dev-dev_addr, sizeof(dev-dev_addr)))
-+  return -EFAULT;
-+  return 0;
-+
 +  case SIOCGMIIPHY:
 +  case SIOCGMIIREG:
 +  case SIOCSMIIREG:
diff --git a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch 
b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
index abda9ce..766ec8d 100644
--- a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
+++ b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
@@ -79,13 +79,13 @@
kfree(dev);
return 0;
  }
-@@ -1104,6 +1151,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -1103,6 +1150,9 @@ static int ar231x_ioctl(struct net_devic
+ {
struct ar231x_private *sp = netdev_priv(dev);
-   int ret;
  
 +  if (!sp-phy_dev)
 +  return -ENODEV;
 +
switch (cmd) {
-   case SIOCETHTOOL:
-   spin_lock_irq(sp-lock);
+   case SIOCGMIIPHY:
+   case SIOCGMIIREG:
-- 
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/32] atheros: update ether addresses handling

2014-09-11 Thread Sergey Ryazanov
 - use ether_foo() routines to work with addresses
 - use ETH_ALEN inplace of magic '6'

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch | 27 +++
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index a19e4b3..57831fa 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -84,7 +84,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
 --- /dev/null
 +++ b/arch/mips/ar231x/board.c
-@@ -0,0 +1,263 @@
+@@ -0,0 +1,260 @@
 +/*
 + * 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
@@ -255,7 +255,7 @@
 +  if (broken_boarddata) {
 +  pr_warn(WARNING: broken board data detected\n);
 +  config = ar231x_board.config;
-+  if (!memcmp(config-enet0_mac, \x00\x00\x00\x00\x00\x00, 6)) {
++  if (is_zero_ether_addr(config-enet0_mac)) {
 +  pr_info(Fixing up empty mac addresses\n);
 +  config-reset_config_gpio = 0x;
 +  config-sys_led_gpio = 0x;
@@ -266,7 +266,6 @@
 +  }
 +  }
 +
-+
 +  /* Radio config starts 0x100 bytes after board config, regardless
 +   * of what the physical layout on the flash chip looks like */
 +
@@ -289,7 +288,7 @@
 +  mac_addr = radio_data[0x1d * 2];
 +  if (is_broadcast_ether_addr(mac_addr)) {
 +  pr_info(Radio MAC is blank; using board-data\n);
-+  memcpy(mac_addr, ar231x_board.config-wlan0_mac, ETH_ALEN);
++  ether_addr_copy(mac_addr, ar231x_board.config-wlan0_mac);
 +  }
 +
 +  return 0;
@@ -316,7 +315,6 @@
 +  write_c0_watchlo0(0);
 +}
 +
-+
 +asmlinkage void
 +plat_irq_dispatch(void)
 +{
@@ -347,7 +345,6 @@
 +  ar2315_irq_init();
 +}
 +
-+
 --- /dev/null
 +++ b/arch/mips/ar231x/prom.c
 @@ -0,0 +1,37 @@
@@ -390,10 +387,12 @@
 +}
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x_platform.h
-@@ -0,0 +1,83 @@
+@@ -0,0 +1,85 @@
 +#ifndef __ASM_MACH_AR231X_PLATFORM_H
 +#define __ASM_MACH_AR231X_PLATFORM_H
 +
++#include linux/etherdevice.h
++
 +/*
 + * This is board-specific data that is stored in a fixed location in flash.
 + * It is shared across operating systems, so it should not be changed lightly.
@@ -435,15 +434,15 @@
 +  u32 sys_freq;/* System frequency in Hz */
 +  u32 cnt_freq;/* Calculated C0_COUNT frequency */
 +
-+  u8  wlan0_mac[6];
-+  u8  enet0_mac[6];
-+  u8  enet1_mac[6];
++  u8  wlan0_mac[ETH_ALEN];
++  u8  enet0_mac[ETH_ALEN];
++  u8  enet1_mac[ETH_ALEN];
 +
 +  u16 pci_id;  /* Pseudo PCIID for common code */
 +  u16 mem_cap; /* cap bank1 in MB */
 +
 +  /* version 3 */
-+  u8  wlan1_mac[6];/* (ar5212) */
++  u8  wlan1_mac[ETH_ALEN]; /* (ar5212) */
 +};
 +
 +#define BOARD_CONFIG_BUFSZ0x1000
@@ -1929,12 +1928,12 @@
 +#endif
 +
 +  /* Fix up MAC addresses if necessary */
-+  if (!memcmp(config-enet0_mac, \xff\xff\xff\xff\xff\xff, 6))
-+  memcpy(config-enet0_mac, config-enet1_mac, 6);
++  if (is_broadcast_ether_addr(config-enet0_mac))
++  ether_addr_copy(config-enet0_mac, config-enet1_mac);
 +
 +  /* If ENET0 and ENET1 have the same mac address,
 +   * increment the one from ENET1 */
-+  if (memcmp(config-enet0_mac, config-enet1_mac, 6) == 0) {
++  if (ether_addr_equal(config-enet0_mac, config-enet1_mac)) {
 +  c = config-enet1_mac + 5;
 +  while ((c = config-enet1_mac)  !(++(*c)))
 +  c--;
-- 
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 12/32] atheros: remove useless includes

2014-09-11 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../linux/atheros/patches-3.14/110-ar2313_ethernet.patch  | 15 +--
 target/linux/atheros/patches-3.14/120-spiflash.patch  |  4 +---
 .../atheros/patches-3.14/220-enet_micrel_workaround.patch | 10 +-
 3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch 
b/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
index 657f96c..1bd445b 100644
--- a/target/linux/atheros/patches-3.14/110-ar2313_ethernet.patch
+++ b/target/linux/atheros/patches-3.14/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,1231 @@
+@@ -0,0 +1,1218 @@
 +/*
 + * ar231x.c: Linux driver for the Atheros AR231x Ethernet device.
 + *
@@ -55,39 +55,26 @@
 + */
 +
 +#include linux/module.h
-+#include linux/version.h
 +#include linux/types.h
 +#include linux/errno.h
 +#include linux/ioport.h
-+#include linux/pci.h
 +#include linux/netdevice.h
 +#include linux/etherdevice.h
 +#include linux/interrupt.h
-+#include linux/hardirq.h
 +#include linux/skbuff.h
 +#include linux/init.h
 +#include linux/delay.h
 +#include linux/mm.h
-+#include linux/highmem.h
-+#include linux/sockios.h
-+#include linux/pkt_sched.h
 +#include linux/mii.h
 +#include linux/phy.h
-+#include linux/ethtool.h
-+#include linux/ctype.h
 +#include linux/platform_device.h
 +#include linux/io.h
-+#include linux/uaccess.h
-+
-+#include net/sock.h
-+#include net/ip.h
 +
 +#define AR2313_MTU 1692
 +#define AR2313_PRIOS   1
 +#define AR2313_QUEUES  (2*AR2313_PRIOS)
 +#define AR2313_DESCR_ENTRIES   64
 +
-+
 +#ifndef min
 +#define min(a, b) (((a)  (b)) ? (a) : (b))
 +#endif
diff --git a/target/linux/atheros/patches-3.14/120-spiflash.patch 
b/target/linux/atheros/patches-3.14/120-spiflash.patch
index 8dbab10..5fe86cb 100644
--- a/target/linux/atheros/patches-3.14/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.14/120-spiflash.patch
@@ -23,7 +23,7 @@
  
 --- /dev/null
 +++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,461 @@
+@@ -0,0 +1,459 @@
 +
 +/*
 + * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -43,14 +43,12 @@
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/types.h
-+#include linux/version.h
 +#include linux/errno.h
 +#include linux/slab.h
 +#include linux/mtd/mtd.h
 +#include linux/mtd/partitions.h
 +#include linux/platform_device.h
 +#include linux/sched.h
-+#include linux/root_dev.h
 +#include linux/delay.h
 +#include linux/io.h
 +#include linux/mutex.h
diff --git a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch 
b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
index 766ec8d..3d3949b 100644
--- a/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
+++ b/target/linux/atheros/patches-3.14/220-enet_micrel_workaround.patch
@@ -1,6 +1,6 @@
 --- 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
+@@ -135,6 +135,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);
  static void ar231x_adjust_link(struct net_device *dev);
@@ -8,7 +8,7 @@
  
  #ifndef ERR
  #define ERR(fmt, args...) printk(%s:  fmt, __func__, ##args)
-@@ -180,6 +181,32 @@ static const struct net_device_ops ar231
+@@ -167,6 +168,32 @@ static const struct net_device_ops ar231
  #endif
  };
  
@@ -41,7 +41,7 @@
  static int ar231x_probe(struct platform_device *pdev)
  {
struct net_device *dev;
-@@ -286,6 +313,24 @@ static int ar231x_probe(struct platform_
+@@ -273,6 +300,24 @@ static int ar231x_probe(struct platform_
  
mdiobus_register(sp-mii_bus);
  
@@ -66,7 +66,7 @@
if (ar231x_mdiobus_probe(dev) != 0) {
printk(KERN_ERR %s: mdiobus_probe failed\n, dev-name);
rx_tasklet_cleanup(dev);
-@@ -343,8 +388,10 @@ static int ar231x_remove(struct platform
+@@ -330,8 +375,10 @@ static int ar231x_remove(struct platform
rx_tasklet_cleanup(dev);
ar231x_init_cleanup(dev);
unregister_netdev(dev);
@@ -79,7 +79,7 @@
kfree(dev);
return 0;
  }
-@@ -1103,6 +1150,9 @@ static int ar231x_ioctl(struct net_devic
+@@ -1090,6 +1137,9 @@ static int ar231x_ioctl(struct net_devic
  {
struct ar231x_private *sp = netdev_priv(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 14/32] atheros: rework and cleanup board initialization

2014-09-11 Thread Sergey Ryazanov
  - remove odd flags and branching
  - add __init mark
  - make shorter variables names
  - returns true or false from boolean functions
  - unwrap short function declarations
  - unwrap quoted string
  - rename macroses with names in CamelCase

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch | 137 --
 1 file changed, 52 insertions(+), 85 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 57831fa..2453357 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -84,7 +84,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
 --- /dev/null
 +++ b/arch/mips/ar231x/board.c
-@@ -0,0 +1,260 @@
+@@ -0,0 +1,229 @@
 +/*
 + * 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
@@ -119,107 +119,82 @@
 +
 +void (*ar231x_irq_dispatch)(void);
 +
-+static inline bool
-+check_radio_magic(u8 *addr)
++static inline bool check_radio_magic(u8 *addr)
 +{
 +  addr += 0x7a; /* offset for flash magic */
-+  if ((addr[0] == 0x5a)  (addr[1] == 0xa5))
-+  return 1;
++  return (addr[0] == 0x5a)  (addr[1] == 0xa5);
++}
 +
-+  return 0;
++static inline bool check_notempty(u8 *addr)
++{
++  return *(u32 *)addr != 0x;
 +}
 +
-+static inline bool
-+check_board_data(u8 *flash_limit, u8 *addr, bool broken)
++static inline bool check_board_data(u8 *flash_limit, u8 *addr, bool broken)
 +{
 +  /* config magic found */
 +  if (*((u32 *)addr) == AR231X_BD_MAGIC)
-+  return 1;
++  return true;
 +
 +  if (!broken)
-+  return 0;
++  return false;
 +
 +  if (check_radio_magic(addr + 0xf8))
 +  ar231x_board.radio = addr + 0xf8;
 +  if ((addr  flash_limit + 0x1) 
-+   check_radio_magic(addr + 0x1))
++  check_radio_magic(addr + 0x1))
 +  ar231x_board.radio = addr + 0x1;
 +
 +  if (ar231x_board.radio) {
 +  /* broken board data detected, use radio data to find the
 +   * offset, user will fix this */
-+  return 1;
++  return true;
 +  }
-+  return 0;
++
++  return false;
 +}
 +
-+static u8 *
-+find_board_config(u8 *flash_limit, bool broken)
++static u8 * __init find_board_config(u8 *flash_limit, bool broken)
 +{
 +  u8 *addr;
-+  int found = 0;
++  u8 *begin = flash_limit - 0x1000;
++  u8 *end = flash_limit - 0x3;
 +
-+  for (addr = flash_limit - 0x1000;
-+  addr = flash_limit - 0x3;
-+  addr -= 0x1000) {
++  for (addr = begin; addr = end; addr -= 0x1000)
++  if (check_board_data(flash_limit, addr, broken))
++  return addr;
 +
-+  if (check_board_data(flash_limit, addr, broken)) {
-+  found = 1;
-+  break;
-+  }
-+  }
-+
-+  if (!found)
-+  addr = NULL;
-+
-+  return addr;
++  return NULL;
 +}
 +
-+static u8 *
-+find_radio_config(u8 *flash_limit, u8 *board_config)
++static u8 * __init find_radio_config(u8 *flash_limit, u8 *bcfg)
 +{
-+  int found;
-+  u8 *radio_config;
++  u8 *rcfg, *begin, *end;
 +
 +  /*
 +   * Now find the start of Radio Configuration data, using heuristics:
 +   * Search forward from Board Configuration data by 0x1000 bytes
 +   * at a time until we find non-0x.
 +   */
-+  found = 0;
-+  for (radio_config = board_config + 0x1000;
-+   (radio_config  flash_limit);
-+   radio_config += 0x1000) {
-+  if ((*(u32 *)radio_config != 0x) 
-+  check_radio_magic(radio_config)) {
-+  found = 1;
-+  break;
-+  }
-+  }
++  begin = bcfg + 0x1000;
++  end = flash_limit;
++  for (rcfg = begin; rcfg  end; rcfg += 0x1000)
++  if (check_notempty(rcfg)  check_radio_magic(rcfg))
++  return rcfg;
 +
 +  /* AR2316 relocates radio config to new location */
-+  if (!found) {
-+  for (radio_config = board_config + 0xf8;
-+   (radio_config  flash_limit - 0x1000 + 0xf8);
-+   radio_config += 0x1000) {
-+  if ((*(u32 *)radio_config != 0x) 
-+  check_radio_magic(radio_config)) {
-+  found = 1;
-+  break;
-+  }
-+  }
-+  }
++  begin = bcfg + 0xf8;
++  end = flash_limit - 0x1000 + 0xf8;
++  for (rcfg = begin; rcfg  end; rcfg += 0x1000)
++  if (check_notempty(rcfg)  check_radio_magic(rcfg))
++  return rcfg;
 +
-+   

[OpenWrt-Devel] [PATCH 16/32] atheros: remove odd ATHEROS_AR2315 config symbol dependencies

2014-09-11 Thread Sergey Ryazanov
Remove options which already selected by ATHEROS_AR231X on which
ATHEROS_AR2315 depends.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 9 +
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch | 6 +++---
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 4840813..7b1adbd 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -49,7 +49,7 @@
 +load-$(CONFIG_ATHEROS_AR231X)  += 0x80041000
 --- /dev/null
 +++ b/arch/mips/ar231x/Kconfig
-@@ -0,0 +1,16 @@
+@@ -0,0 +1,9 @@
 +config ATHEROS_AR5312
 +  bool Atheros 5312/2312+ support
 +  depends on ATHEROS_AR231X
@@ -58,13 +58,6 @@
 +config ATHEROS_AR2315
 +  bool Atheros 2315+ support
 +  depends on ATHEROS_AR231X
-+  select DMA_NONCOHERENT
-+  select CEVT_R4K
-+  select CSRC_R4K
-+  select IRQ_CPU
-+  select SYS_HAS_CPU_MIPS32_R1
-+  select SYS_SUPPORTS_32BIT_KERNEL
-+  select SYS_SUPPORTS_BIG_ENDIAN
 +  default y
 --- /dev/null
 +++ b/arch/mips/ar231x/Makefile
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 53222a1..14862c9 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -243,9 +243,9 @@
 +arch_initcall(ar2315_pci_init);
 --- a/arch/mips/ar231x/Kconfig
 +++ b/arch/mips/ar231x/Kconfig
-@@ -14,3 +14,10 @@ config ATHEROS_AR2315
-   select SYS_SUPPORTS_32BIT_KERNEL
-   select SYS_SUPPORTS_BIG_ENDIAN
+@@ -7,3 +7,10 @@ config ATHEROS_AR2315
+   bool Atheros 2315+ support
+   depends on ATHEROS_AR231X
default y
 +
 +config ATHEROS_AR2315_PCI
-- 
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 15/32] atheros: various space related changes

2014-09-11 Thread Sergey Ryazanov
 - remove odd blank lines
 - remove odd spaces after casts
 - fix alignment

 No functional changes.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 51 +++---
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 28 ++--
 .../atheros/patches-3.14/110-ar2313_ethernet.patch | 49 +++--
 .../linux/atheros/patches-3.14/120-spiflash.patch  |  4 +-
 .../linux/atheros/patches-3.14/130-watchdog.patch  |  5 ++-
 .../patches-3.14/220-enet_micrel_workaround.patch  |  4 +-
 6 files changed, 52 insertions(+), 89 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 2453357..4840813 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -681,7 +681,7 @@
 +#endif /* __ASM_MACH_AR231X_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,617 @@
+@@ -0,0 +1,614 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -707,7 +707,6 @@
 +#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.
 + */
@@ -723,7 +722,6 @@
 +#define AR2315_MISC_IRQ_IR_RSVD   (AR231X_MISC_IRQ_BASE+9)
 +#define AR2315_MISC_IRQ_COUNT 10
 +
-+
 +/*
 + * Address map
 + */
@@ -742,7 +740,7 @@
 +#define AR2315_ENET0_MII  (AR2315_ENET0 + 0x14)
 +
 +/*
-+ * Reset Register
++ * Cold reset register
 + */
 +#define AR2315_COLD_RESET   (AR2315_DSLBASE + 0x)
 +
@@ -756,7 +754,9 @@
 +   RESET_COLD_AHB)   /* full system */
 +#define AR2317_RESET_SYSTEM0x0010
 +
-+
++/*
++ * Reset register
++ */
 +#define AR2315_RESET(AR2315_DSLBASE + 0x0004)
 +
 +/* warm reset WLAN0 MAC */
@@ -837,7 +837,6 @@
 +#define AR2315_CONFIG_CPU_MMR  0x0004
 +#define AR2315_CONFIG_BIG  0x0400
 +
-+
 +/*
 + * NMI control
 + */
@@ -1173,7 +1172,6 @@
 +#define AR2315_PCI_HOST_OUT_DIS (AR2315_PCI + 0x0904)
 +#define AR2315_PCI_HOST_OUT_PTR (AR2315_PCI + 0x0908)
 +
-+
 +/*
 + * Local Bus Interface Registers
 + */
@@ -1220,7 +1218,6 @@
 +#define AR2315_LBM_TIMEOUT_SHFT 7
 +#define AR2315_LBM_PORTMUX  0x0700
 +
-+
 +#define AR2315_LB_RXTSOFF   (AR2315_LOCAL + 0x0010)
 +
 +#define AR2315_LB_TX_CHAIN_EN   (AR2315_LOCAL + 0x0100)
@@ -1301,7 +1298,7 @@
 +#endif /* __ASM_MACH_AR231X_AR2315_REGS_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,253 @@
+@@ -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
@@ -1320,14 +1317,12 @@
 +/*
 + * IRQs
 + */
-+
 +#define AR5312_IRQ_WLAN0_INTRS  (MIPS_CPU_IRQ_BASE+2) /* C0_CAUSE: 0x0400 */
 +#define AR5312_IRQ_ENET0_INTRS  (MIPS_CPU_IRQ_BASE+3) /* C0_CAUSE: 0x0800 */
 +#define AR5312_IRQ_ENET1_INTRS  (MIPS_CPU_IRQ_BASE+4) /* C0_CAUSE: 0x1000 */
 +#define AR5312_IRQ_WLAN1_INTRS  (MIPS_CPU_IRQ_BASE+5) /* C0_CAUSE: 0x2000 */
 +#define AR5312_IRQ_MISC_INTRS   (MIPS_CPU_IRQ_BASE+6) /* C0_CAUSE: 0x4000 */
 +
-+
 +/*
 + * Miscellaneous interrupts, which share IP6.
 + */
@@ -1343,8 +1338,9 @@
 +#define AR5312_MISC_IRQ_SPI   (AR231X_MISC_IRQ_BASE+9)
 +#define AR5312_MISC_IRQ_COUNT 10
 +
-+
-+/* Address Map */
++/*
++ * Address Map
++ */
 +#define AR5312_WLAN00x1800
 +#define AR5312_WLAN10x1850
 +#define AR5312_ENET00x1810
@@ -1465,7 +1461,6 @@
 +#define AR2313_CLOCKCTL1_MULTIPLIER_SHIFT  16
 +#define AR2313_CLOCKCTL1_DOUBLER_MASK  0x
 +
-+
 +/* AR5312_ENABLE register bit field definitions */
 +#define AR5312_ENABLE_WLAN0  0x0001
 +#define AR5312_ENABLE_ENET0  0x0002
@@ -1552,12 +1547,10 @@
 +#define AR5312_GPIO_CR_UART(x) (1  ((x)+16))  /* uart multiplex */
 +#define AR5312_NUM_GPIO   8
 +
-+
 +#endif/* __ASM_MACH_AR231X_AR5312_REGS_H */
-+
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,541 @@
+@@ -0,0 +1,534 @@
 +/*
 + * 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
@@ -1634,7 +1627,6 @@
 +  do_IRQ(AR231X_IRQ_CPU_CLOCK);
 +}
 +
-+
 +/* Enable the specified AR5312_MISC_IRQ interrupt */
 +static void
 +ar5312_misc_irq_unmask(struct irq_data *d)
@@ -1664,7 +1656,6 @@
 +  .irq_mask   = ar5312_misc_irq_mask,
 +};
 +
-+
 +static irqreturn_t ar5312_ahb_proc_handler(int cpl, void *dev_id)
 +{
 +  u32 proc1 = ar231x_read_reg(AR5312_PROC1);
@@ -1679,13 +1670,11 @@
 +  return IRQ_HANDLED;
 +}
 +
-+
 +static struct irqaction ar5312_ahb_proc_interrupt  = {
 +  

[OpenWrt-Devel] [PATCH 18/32] atheros: ar2315-pci: cosmetic changes

2014-09-11 Thread Sergey Ryazanov
 - add comment, which briefly describes PCI controller features and
   Fonera 2.0g schematics.
 - rename several functions and structures, to make it clear that this
   code only for AR2315 chips.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 69 +++---
 1 file changed, 47 insertions(+), 22 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index a4377eb..5487cdc 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,229 @@
+@@ -0,0 +1,254 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -23,6 +23,30 @@
 + * along with this program; if not, see http://www.gnu.org/licenses/.
 + */
 +
++/**
++ * Both AR2315 and AR2316 chips have PCI interface unit, which supports DMA
++ * and interrupt. PCI interface supports MMIO access method, but does not
++ * seem to support I/O ports.
++ *
++ * Read/write operation in the region 0x8000-0xBFFF causes
++ * a memory read/write command on the PCI bus. 30 LSBs of address on
++ * the bus are taken from memory read/write request and 2 MSBs are
++ * determined by PCI unit configuration.
++ *
++ * To work with the configuration space instead of memory is necessary set
++ * the CFG_SEL bit in the PCI_MISC_CONFIG register.
++ *
++ * Devices on the bus can perform DMA requests via chip BAR1. PCI host
++ * controller BARs are programmend as if an external device is programmed.
++ * Which means that during configuration, IDSEL pin of the chip should be
++ * asserted.
++ *
++ * We know (and support) only one board that uses the PCI interface -
++ * Fonera 2.0g (FON2202). It has a USB EHCI controller connected to the
++ * AR2315 PCI bus. IDSEL pin of USB controller is connected to AD[13] line
++ * and IDSEL pin of AR125 is connected to AD[16] line.
++ */
++
 +#include linux/types.h
 +#include linux/pci.h
 +#include linux/kernel.h
@@ -43,7 +67,8 @@
 +
 +static unsigned long configspace;
 +
-+static int config_access(int devfn, int where, int size, u32 *ptr, bool write)
++static int ar2315_pci_cfg_access(int devfn, int where, int size, u32 *ptr,
++   bool write)
 +{
 +  int func = PCI_FUNC(devfn);
 +  int dev = PCI_SLOT(devfn);
@@ -91,42 +116,42 @@
 +  return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
 +}
 +
-+static int ar231x_pci_read(struct pci_bus *bus, unsigned int devfn, int where,
-+ int size, u32 *value)
++static int ar2315_pci_cfg_read(struct pci_bus *bus, unsigned int devfn,
++ int where, int size, u32 *value)
 +{
-+  return config_access(devfn, where, size, value, 0);
++  return ar2315_pci_cfg_access(devfn, where, size, value, 0);
 +}
 +
-+static int ar231x_pci_write(struct pci_bus *bus, unsigned int devfn, int 
where,
-+  int size, u32 value)
++static int ar2315_pci_cfg_write(struct pci_bus *bus, unsigned int devfn,
++  int where, int size, u32 value)
 +{
-+  return config_access(devfn, where, size, value, 1);
++  return ar2315_pci_cfg_access(devfn, where, size, value, 1);
 +}
 +
-+static struct pci_ops ar231x_pci_ops = {
-+  .read   = ar231x_pci_read,
-+  .write  = ar231x_pci_write,
++static struct pci_ops ar2315_pci_ops = {
++  .read   = ar2315_pci_cfg_read,
++  .write  = ar2315_pci_cfg_write,
 +};
 +
-+static struct resource ar231x_mem_resource = {
-+  .name   = AR2315 PCI MEM,
++static struct resource ar2315_mem_resource = {
++  .name   = ar2315-pci-mem,
 +  .start  = AR2315_MEM_BASE,
 +  .end= AR2315_MEM_BASE + AR2315_MEM_SIZE - AR2315_IO_SIZE - 1 +
 +0x400,
 +  .flags  = IORESOURCE_MEM,
 +};
 +
-+static struct resource ar231x_io_resource = {
-+  .name   = AR2315 PCI I/O,
++static struct resource ar2315_io_resource = {
++  .name   = ar2315-pci-io,
 +  .start  = AR2315_MEM_BASE + AR2315_MEM_SIZE - AR2315_IO_SIZE,
 +  .end= AR2315_MEM_BASE + AR2315_MEM_SIZE - 1,
 +  .flags  = IORESOURCE_IO,
 +};
 +
-+static struct pci_controller ar231x_pci_controller = {
-+  .pci_ops= ar231x_pci_ops,
-+  .mem_resource   = ar231x_mem_resource,
-+  .io_resource= ar231x_io_resource,
++static struct pci_controller ar2315_pci_controller = {
++  .pci_ops= ar2315_pci_ops,
++  .mem_resource   = ar2315_mem_resource,
++  .io_resource= ar2315_io_resource,
 +  .mem_offset = 0xUL,
 +  .io_offset  = 0xUL,
 +};
@@ -187,10 +212,10 @@
 +  /* Remap PCI config space */
 +  configspace = (unsigned 

[OpenWrt-Devel] [PATCH 17/32] atheros: ar2315-pci: remove odd locking in PCI config space access function

2014-09-11 Thread Sergey Ryazanov
Caller (generic PCI code) already do proper locking so no need to add
another one here.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 14862c9..a4377eb 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,233 @@
+@@ -0,0 +1,229 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -28,7 +28,6 @@
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/mm.h
-+#include linux/spinlock.h
 +#include linux/delay.h
 +#include linux/irq.h
 +#include linux/io.h
@@ -46,7 +45,6 @@
 +
 +static int config_access(int devfn, int where, int size, u32 *ptr, bool write)
 +{
-+  unsigned long flags;
 +  int func = PCI_FUNC(devfn);
 +  int dev = PCI_SLOT(devfn);
 +  u32 value = 0;
@@ -57,7 +55,6 @@
 +  return PCIBIOS_DEVICE_NOT_FOUND;
 +
 +  /* Select Configuration access */
-+  local_irq_save(flags);
 +  ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, 0, AR2315_PCIMISC_CFG_SEL);
 +  mb();
 +
@@ -90,7 +87,6 @@
 +
 +  /* Select Memory access */
 +  ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_CFG_SEL, 0);
-+  local_irq_restore(flags);
 +
 +  return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
 +}
-- 
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 23/32] atheros: ar2315-pci: update DMA offset macroses

2014-09-11 Thread Sergey Ryazanov
Remove duplicated macroses, which define DMA offset (SDRAM baseaddress).

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 29 +-
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 11 +---
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 4512d55..4cc0246 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -524,7 +524,7 @@
 +#endif /* __ASM_MACH_AR231X_CPU_FEATURE_OVERRIDES_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/dma-coherence.h
-@@ -0,0 +1,77 @@
+@@ -0,0 +1,76 @@
 +/*
 + * 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
@@ -537,9 +537,8 @@
 +#ifndef __ASM_MACH_AR231X_DMA_COHERENCE_H
 +#define __ASM_MACH_AR231X_DMA_COHERENCE_H
 +
-+#define PCI_DMA_OFFSET0x2000
-+
 +#include linux/device.h
++#include ar2315_regs.h
 +
 +static inline dma_addr_t ar231x_dev_offset(struct device *dev)
 +{
@@ -547,7 +546,7 @@
 +  extern struct bus_type pci_bus_type;
 +
 +  if (dev  dev-bus == pci_bus_type)
-+  return PCI_DMA_OFFSET;
++  return AR2315_PCI_HOST_SDRAM_BASEADDR;
 +#endif
 +  return 0;
 +}
@@ -674,7 +673,7 @@
 +#endif /* __ASM_MACH_AR231X_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,625 @@
+@@ -0,0 +1,631 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -1291,13 +1290,19 @@
 +#define AR2315_IRCFG_SEQ_END_WIN_THRESH   0x001f
 +#define AR2315_IRCFG_NUM_BACKOFF_WORDS0x01e0
 +
-+#define HOST_PCI_DEV_ID 3
-+#define HOST_PCI_MBAR0  0x1000
-+#define HOST_PCI_MBAR1  0x2000
-+#define HOST_PCI_MBAR2  0x3000
-+
-+#define HOST_PCI_SDRAM_BASEADDR HOST_PCI_MBAR1
-+#define PCI_DEVICE_MEM_SPACE0x80
++/*
++ * We need some arbitrary non-zero value to be programmed to the BAR1 register
++ * of PCI host controller to enable DMA. The same value should be used as the
++ * offset to calculate the physical address of DMA buffer for PCI devices.
++ */
++#define AR2315_PCI_HOST_SDRAM_BASEADDR0x2000
++
++/* ??? access BAR */
++#define AR2315_PCI_HOST_MBAR0 0x1000
++/* RAM access BAR */
++#define AR2315_PCI_HOST_MBAR1 AR2315_PCI_HOST_SDRAM_BASEADDR
++/* ??? access BAR */
++#define AR2315_PCI_HOST_MBAR2 0x3000
 +
 +#endif /* __ASM_MACH_AR231X_AR2315_REGS_H */
 --- /dev/null
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 1460299..5c437dc 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,337 @@
+@@ -0,0 +1,340 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -198,9 +198,12 @@
 +  return -ENODEV;
 +
 +  /* Program MBARs */
-+  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_0, HOST_PCI_MBAR0);
-+  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_1, HOST_PCI_MBAR1);
-+  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_2, HOST_PCI_MBAR2);
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_0,
++  AR2315_PCI_HOST_MBAR0);
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_1,
++  AR2315_PCI_HOST_MBAR1);
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_2,
++  AR2315_PCI_HOST_MBAR2);
 +
 +  /* Run */
 +  ar2315_pci_local_cfg_wr(devfn, PCI_COMMAND, PCI_COMMAND_MEMORY |
-- 
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 21/32] atheros: ar2315-pci: rework the configuration access code

2014-09-11 Thread Sergey Ryazanov
Use __raw_{read,write}l accessors and use Abort interrupt to detect a
configuration space read/write errors. The second change improves errors
detection, what improves the device presence detection and helps us to
avoid following (and similar) errors:

pci :00:00.2: ignoring class 0x7e0200 (doesn't match header type 02)
pci :00:00.2: bridge configuration invalid ([bus 03-90]), reconfiguring
pci :00:00.2: not setting up bridge for bus :01

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 82 +-
 1 file changed, 48 insertions(+), 34 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 8009da0..6623dab 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,336 @@
+@@ -0,0 +1,350 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -65,55 +65,64 @@
 +#define AR2315_MEM_SIZE0x00ffUL
 +#define AR2315_IO_SIZE 0x7fffUL
 +
++/* Arbitrary size of memory region to access the configuration space */
++#define AR2315_PCI_CFG_SIZE   0x0010
++
 +#define AR2315_PCI_HOST_SLOT  3
 +#define AR2315_PCI_HOST_DEVID ((0xff18  16) | PCI_VENDOR_ID_ATHEROS)
 +
-+static unsigned long configspace;
++static void __iomem *ar2315_pci_cfg_mem;
 +
 +static int ar2315_pci_cfg_access(int devfn, int where, int size, u32 *ptr,
 +   bool write)
 +{
 +  int func = PCI_FUNC(devfn);
 +  int dev = PCI_SLOT(devfn);
-+  u32 value = 0;
-+  int err = 0;
-+  u32 addr;
++  u32 addr = (1  (13 + dev)) | (func  8) | (where  ~3);
++  u32 mask = 0x  8 * (4 - size);
++  u32 sh = (where  3) * 8;
++  u32 value, isr;
++
++  /* Prevent access past the remapped area */
++  if (addr = AR2315_PCI_CFG_SIZE || dev  18)
++  return PCIBIOS_DEVICE_NOT_FOUND;
 +
++  /* Clear pending errors */
++  ar231x_write_reg(AR2315_PCI_ISR, AR2315_PCI_INT_ABORT);
 +  /* Select Configuration access */
 +  ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, 0, AR2315_PCIMISC_CFG_SEL);
-+  mb();
 +
-+  addr = (u32)configspace + (1  (13 + dev)) + (func  8) + where;
-+  if (size == 1)
-+  addr ^= 0x3;
-+  else if (size == 2)
-+  addr ^= 0x2;
++  mb();   /* PCI must see space change before we begin */
++
++  value = __raw_readl(ar2315_pci_cfg_mem + addr);
++
++  isr = ar231x_read_reg(AR2315_PCI_ISR);
++  if (isr  AR2315_PCI_INT_ABORT)
++  goto exit_err;
 +
 +  if (write) {
-+  value = *ptr;
-+  if (size == 1)
-+  err = put_dbe(value, (u8 *)addr);
-+  else if (size == 2)
-+  err = put_dbe(value, (u16 *)addr);
-+  else if (size == 4)
-+  err = put_dbe(value, (u32 *)addr);
++  value = (value  ~(mask  sh)) | *ptr  sh;
++  __raw_writel(value, ar2315_pci_cfg_mem + addr);
++  isr = ar231x_read_reg(AR2315_PCI_ISR);
++  if (isr  AR2315_PCI_INT_ABORT)
++  goto exit_err;
 +  } else {
-+  if (size == 1)
-+  err = get_dbe(value, (u8 *)addr);
-+  else if (size == 2)
-+  err = get_dbe(value, (u16 *)addr);
-+  else if (size == 4)
-+  err = get_dbe(value, (u32 *)addr);
-+  if (err)
-+  *ptr = 0x;
-+  else
-+  *ptr = value;
++  *ptr = (value  sh)  mask;
 +  }
 +
++  goto exit;
++
++exit_err:
++  ar231x_write_reg(AR2315_PCI_ISR, AR2315_PCI_INT_ABORT);
++  if (!write)
++  *ptr = 0x;
++
++exit:
 +  /* Select Memory access */
 +  ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, AR2315_PCIMISC_CFG_SEL, 0);
 +
-+  return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
++  return isr  AR2315_PCI_INT_ABORT ? PCIBIOS_DEVICE_NOT_FOUND :
++  PCIBIOS_SUCCESSFUL;
 +}
 +
 +static inline int ar2315_pci_local_cfg_rd(unsigned devfn, int where, u32 *val)
@@ -129,7 +138,7 @@
 +static int ar2315_pci_cfg_read(struct pci_bus *bus, unsigned int devfn,
 + int where, int size, u32 *value)
 +{
-+  if ((PCI_SLOT(devfn) != 0) || (PCI_FUNC(devfn)  2))
++  if (PCI_SLOT(devfn) == AR2315_PCI_HOST_SLOT)
 +  return PCIBIOS_DEVICE_NOT_FOUND;
 +
 +  return ar2315_pci_cfg_access(devfn, where, size, value, 0);
@@ -138,7 +147,7 @@
 +static int ar2315_pci_cfg_write(struct pci_bus *bus, unsigned int devfn,
 +  

[OpenWrt-Devel] [PATCH 22/32] atheros: ar2315-pci: update host bridge resources

2014-09-11 Thread Sergey Ryazanov
It seems that the PCI controller does not support I/O ports, so remove
the ports range. Also correct the beginning of the memory range and its
size.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  |  3 ++-
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 25 ++
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index c87734b..4512d55 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -674,7 +674,7 @@
 +#endif /* __ASM_MACH_AR231X_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,624 @@
+@@ -0,0 +1,625 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -738,6 +738,7 @@
 +#define AR2315_UART00x1110  /* UART MMR */
 +#define AR2315_SPI_MMR  0x1130  /* SPI FLASH MMR */
 +#define AR2315_PCIEXT   0x8000  /* pci external */
++#define AR2315_PCIEXT_SZ  0x4000
 +
 +/* MII registers offset inside Ethernet MMR region */
 +#define AR2315_ENET0_MII  (AR2315_ENET0 + 0x14)
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 6623dab..1460299 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,350 @@
+@@ -0,0 +1,337 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -61,10 +61,6 @@
 +#include ar2315_regs.h
 +#include devices.h
 +
-+#define AR2315_MEM_BASE0x8080UL
-+#define AR2315_MEM_SIZE0x00ffUL
-+#define AR2315_IO_SIZE 0x7fffUL
-+
 +/* Arbitrary size of memory region to access the configuration space */
 +#define AR2315_PCI_CFG_SIZE   0x0010
 +
@@ -160,16 +156,16 @@
 +
 +static struct resource ar2315_mem_resource = {
 +  .name   = ar2315-pci-mem,
-+  .start  = AR2315_MEM_BASE,
-+  .end= AR2315_MEM_BASE + AR2315_MEM_SIZE - AR2315_IO_SIZE - 1 +
-+0x400,
++  .start  = AR2315_PCIEXT,
++  .end= AR2315_PCIEXT + AR2315_PCIEXT_SZ - 1,
 +  .flags  = IORESOURCE_MEM,
 +};
 +
++/* PCI controller does not support I/O ports */
 +static struct resource ar2315_io_resource = {
 +  .name   = ar2315-pci-io,
-+  .start  = AR2315_MEM_BASE + AR2315_MEM_SIZE - AR2315_IO_SIZE,
-+  .end= AR2315_MEM_BASE + AR2315_MEM_SIZE - 1,
++  .start  = 0,
++  .end= 0,
 +  .flags  = IORESOURCE_IO,
 +};
 +
@@ -298,11 +294,6 @@
 +  return -ENOMEM;
 +  }
 +
-+  ar2315_pci_controller.io_map_base =
-+  (unsigned long)ioremap_nocache(AR2315_MEM_BASE +
-+  AR2315_MEM_SIZE, AR2315_IO_SIZE);
-+  set_io_port_base(ar2315_pci_controller.io_map_base); /* PCI I/O space*/
-+
 +  /* Reset PCI DMA logic */
 +  reg = ar231x_mask_reg(AR2315_RESET, 0, AR2315_RESET_PCIDMA);
 +  msleep(20);
@@ -338,10 +329,6 @@
 +
 +  msleep(500);
 +
-+  /* dirty hack - anyone with a datasheet that knows the memory map ? */
-+  ioport_resource.start = 0x1000;
-+  ioport_resource.end = 0x;
-+
 +  res = ar2315_pci_host_setup();
 +  if (res)
 +  goto error;
-- 
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 26/32] atheros: add AR2316 and AR2318 SoCs detection

2014-09-11 Thread Sergey Ryazanov
Tested with AR2315, AR2316 and AR2317 SoCs, not tested with AR2318 but
changes seems correct: revision is one more than AR2317.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 16 
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 4cc0246..efbc241 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -2096,7 +2096,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,556 @@
+@@ -0,0 +1,562 @@
 +/*
 + * 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
@@ -2622,10 +2622,16 @@
 +  /* Detect the hardware based on the device ID */
 +  devid = ar231x_read_reg(AR2315_SREV)  AR2315_REV_CHIP;
 +  switch (devid) {
++  case 0x91:  /* Need to check */
++  ar231x_devtype = DEV_TYPE_AR2318;
++  break;
 +  case 0x90:
-+  case 0x91:
 +  ar231x_devtype = DEV_TYPE_AR2317;
 +  break;
++  case 0x87:
++  ar231x_devtype = DEV_TYPE_AR2316;
++  break;
++  case 0x86:
 +  default:
 +  ar231x_devtype = DEV_TYPE_AR2315;
 +  break;
@@ -2781,7 +2787,7 @@
 +#endif/* __ASM_MACH_AR231X_H */
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.h
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,39 @@
 +#ifndef __AR231X_DEVICES_H
 +#define __AR231X_DEVICES_H
 +
@@ -2795,6 +2801,7 @@
 +  DEV_TYPE_AR2315,
 +  DEV_TYPE_AR2316,
 +  DEV_TYPE_AR2317,
++  DEV_TYPE_AR2318,
 +
 +  DEV_TYPE_UNKNOWN
 +};
@@ -2822,7 +2829,7 @@
 +#endif
 --- /dev/null
 +++ b/arch/mips/ar231x/devices.c
-@@ -0,0 +1,180 @@
+@@ -0,0 +1,181 @@
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/serial.h
@@ -2931,6 +2938,7 @@
 +  [DEV_TYPE_AR2315] = Atheros AR2315,
 +  [DEV_TYPE_AR2316] = Atheros AR2316,
 +  [DEV_TYPE_AR2317] = Atheros AR2317,
++  [DEV_TYPE_AR2318] = Atheros AR2318,
 +  [DEV_TYPE_UNKNOWN] = Atheros (unknown),
 +};
 +
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 18529c8..2b7f5ed 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -382,7 +382,7 @@
else if (pending  CAUSEF_IP2)
do_IRQ(AR2315_IRQ_MISC_INTRS);
else if (pending  CAUSEF_IP7)
-@@ -554,3 +558,18 @@ ar2315_plat_setup(void)
+@@ -560,3 +564,18 @@ ar2315_plat_setup(void)
ar231x_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0,
ar2315_apb_frequency());
  }
-- 
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 31/32] atheros: convert AR2315 GPIO code to platform driver

2014-09-11 Thread Sergey Ryazanov
Convert gpiolib realization to platform driver and move to the
appropriate subdirectory. Misc GPIO interrupt acknowledgement placed
to the MISC IRQ handler since in fact we can detect only one GPIO state
change.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/config-3.14   |   1 +
 target/linux/atheros/patches-3.14/100-board.patch  | 175 +---
 .../atheros/patches-3.14/103-ar2315_gpio.patch | 315 +
 .../atheros/patches-3.14/105-ar2315_pci.patch  |   8 +-
 4 files changed, 327 insertions(+), 172 deletions(-)
 create mode 100644 target/linux/atheros/patches-3.14/103-ar2315_gpio.patch

diff --git a/target/linux/atheros/config-3.14 b/target/linux/atheros/config-3.14
index 5d1041a..8c6e68d 100644
--- a/target/linux/atheros/config-3.14
+++ b/target/linux/atheros/config-3.14
@@ -44,6 +44,7 @@ CONFIG_GENERIC_NET_UTILS=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_AR2315=y
 CONFIG_GPIO_AR5312=y
 CONFIG_GPIO_DEVRES=y
 CONFIG_GPIO_SYSFS=y
diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 8ffa91c..32b6dc8 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -659,7 +659,7 @@
 +#endif /* __ASM_MACH_AR231X_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,630 @@
+@@ -0,0 +1,608 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -1002,32 +1002,10 @@
 +#define AMBACLK_CLK_DIV_M   0x000c
 +#define AMBACLK_CLK_DIV_S   2
 +
-+/*
-+ * GPIO
-+ */
-+#define AR2315_GPIO_DI  (AR2315_DSLBASE + 0x0088)
-+#define AR2315_GPIO_DO  (AR2315_DSLBASE + 0x0090)
-+#define AR2315_GPIO_DIR (AR2315_DSLBASE + 0x0098)
-+#define AR2315_GPIO_INT (AR2315_DSLBASE + 0x00a0)
-+
-+#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 */
-+#define AR2315_GPIO_INT_LVL(x)((x)  6)  /* interrupt level */
-+#define AR2315_GPIO_INT_LVL_M ((0x3)  6)/* mask for int level */
-+
-+#define AR2315_GPIO_INT_MAX_Y 1   /* Maximum value of Y for
-+   * AR2315_GPIO_INT_* macros */
-+#define AR2315_GPIO_INT_LVL_OFF   0   /* Triggerring off */
-+#define AR2315_GPIO_INT_LVL_LOW   1   /* Low Level Triggered */
-+#define AR2315_GPIO_INT_LVL_HIGH  2   /* High Level Triggered */
-+#define AR2315_GPIO_INT_LVL_EDGE  3   /* Edge Triggered */
++/* GPIO MMR base address */
++#define AR2315_GPIO   (AR2315_DSLBASE + 0x0088)
 +
 +#define AR2315_RESET_GPIO   5
-+#define AR2315_NUM_GPIO 22
 +
 +/*
 + *  PCI Clock Control
@@ -2009,7 +1987,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,570 @@
+@@ -0,0 +1,431 @@
 +/*
 + * 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
@@ -2049,34 +2027,6 @@
 +#include devices.h
 +#include ar2315.h
 +
-+static u32 gpiointmask, gpiointval;
-+
-+static void ar2315_gpio_irq_handler(unsigned irq, struct irq_desc *desc)
-+{
-+  u32 pend;
-+  int bit = -1;
-+
-+  /* only do one gpio interrupt at a time */
-+  pend = (ar231x_read_reg(AR2315_GPIO_DI) ^ gpiointval)  gpiointmask;
-+
-+  if (pend) {
-+  bit = fls(pend) - 1;
-+  pend = ~(1  bit);
-+  gpiointval ^= (1  bit);
-+  }
-+
-+  if (!pend)
-+  ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO);
-+
-+  /* Enable interrupt with edge detection */
-+  if ((ar231x_read_reg(AR2315_GPIO_DIR)  AR2315_GPIO_DIR_M(bit)) !=
-+  AR2315_GPIO_DIR_I(bit))
-+  return;
-+
-+  if (bit = 0)
-+  generic_handle_irq(AR231X_GPIO_IRQ_BASE + bit);
-+}
-+
 +static void ar2315_misc_irq_handler(unsigned irq, struct irq_desc *desc)
 +{
 +  unsigned int misc_intr = ar231x_read_reg(AR2315_ISR) 
@@ -2088,9 +2038,10 @@
 +  generic_handle_irq(AR2315_MISC_IRQ_TIMER);
 +  else if (misc_intr  AR2315_ISR_AHB)
 +  generic_handle_irq(AR2315_MISC_IRQ_AHB);
-+  else if (misc_intr  AR2315_ISR_GPIO)
++  else if (misc_intr  AR2315_ISR_GPIO) {
++  ar231x_write_reg(AR2315_ISR, AR2315_ISR_GPIO);
 +  generic_handle_irq(AR2315_MISC_IRQ_GPIO);
-+  else if (misc_intr  AR2315_ISR_UART0)
++  } else if (misc_intr  AR2315_ISR_UART0)
 +  generic_handle_irq(AR2315_MISC_IRQ_UART0);
 +  else if (misc_intr  AR2315_ISR_WD) {
 +  

[OpenWrt-Devel] [PATCH 19/32] atheros: ar2315-pci: rework host controller initialization

2014-09-11 Thread Sergey Ryazanov
Explicitly configure PCI host controller, and do not expose it to PCI
subsystem. The PCI host controller acts as a usual PCI device connected
to the bus, but its configuration as a usual PCI device is senseless,
since the host controller provide access to _internal_ memory space for
_external_ device.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---

Fixup trick works only by a fluke. PCI subsystem calls fixups before the
memory regions allocation, and BAR1 (which is used for RAM access) has
not been reprogrammed just because PCI subsystem could not find suitable
address block: pci :00:03.0: BAR 1: can't assign mem
(size 0x400)
---
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 74 +++---
 1 file changed, 50 insertions(+), 24 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 5487cdc..45f9cdf 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -7,7 +7,7 @@
 +obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,254 @@
+@@ -0,0 +1,280 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -65,6 +65,9 @@
 +#define AR2315_MEM_SIZE0x00ffUL
 +#define AR2315_IO_SIZE 0x7fffUL
 +
++#define AR2315_PCI_HOST_SLOT  3
++#define AR2315_PCI_HOST_DEVID ((0xff18  16) | PCI_VENDOR_ID_ATHEROS)
++
 +static unsigned long configspace;
 +
 +static int ar2315_pci_cfg_access(int devfn, int where, int size, u32 *ptr,
@@ -76,9 +79,6 @@
 +  int err = 0;
 +  u32 addr;
 +
-+  if (((dev != 0)  (dev != 3)) || (func  2))
-+  return PCIBIOS_DEVICE_NOT_FOUND;
-+
 +  /* Select Configuration access */
 +  ar231x_mask_reg(AR2315_PCI_MISC_CONFIG, 0, AR2315_PCIMISC_CFG_SEL);
 +  mb();
@@ -116,15 +116,31 @@
 +  return err ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
 +}
 +
++static inline int ar2315_pci_local_cfg_rd(unsigned devfn, int where, u32 *val)
++{
++  return ar2315_pci_cfg_access(devfn, where, sizeof(u32), val, false);
++}
++
++static inline int ar2315_pci_local_cfg_wr(unsigned devfn, int where, u32 val)
++{
++  return ar2315_pci_cfg_access(devfn, where, sizeof(u32), val, true);
++}
++
 +static int ar2315_pci_cfg_read(struct pci_bus *bus, unsigned int devfn,
 + int where, int size, u32 *value)
 +{
++  if ((PCI_SLOT(devfn) != 0) || (PCI_FUNC(devfn)  2))
++  return PCIBIOS_DEVICE_NOT_FOUND;
++
 +  return ar2315_pci_cfg_access(devfn, where, size, value, 0);
 +}
 +
 +static int ar2315_pci_cfg_write(struct pci_bus *bus, unsigned int devfn,
 +  int where, int size, u32 value)
 +{
++  if ((PCI_SLOT(devfn) != 0) || (PCI_FUNC(devfn)  2))
++  return PCIBIOS_DEVICE_NOT_FOUND;
++
 +  return ar2315_pci_cfg_access(devfn, where, size, value, 1);
 +}
 +
@@ -178,33 +194,35 @@
 +  return 0;
 +}
 +
-+static void
-+ar2315_pci_fixup(struct pci_dev *dev)
++static int ar2315_pci_host_setup(void)
 +{
-+  unsigned int devfn = dev-devfn;
-+
-+  if (dev-bus-number != 0)
-+  return;
-+
-+  /* Only fix up the PCI host settings */
-+  if ((PCI_SLOT(devfn) != 3) || (PCI_FUNC(devfn) != 0))
-+  return;
-+
-+  /* Fix up MBARs */
-+  pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, HOST_PCI_MBAR0);
-+  pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, HOST_PCI_MBAR1);
-+  pci_write_config_dword(dev, PCI_BASE_ADDRESS_2, HOST_PCI_MBAR2);
-+  pci_write_config_dword(dev, PCI_COMMAND, PCI_COMMAND_MEMORY |
-+ PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL |
-+ PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY |
-+ PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK);
++  unsigned devfn = PCI_DEVFN(AR2315_PCI_HOST_SLOT, 0);
++  int res;
++  u32 id;
++
++  res = ar2315_pci_local_cfg_rd(devfn, PCI_VENDOR_ID, id);
++  if (res != PCIBIOS_SUCCESSFUL || id != AR2315_PCI_HOST_DEVID)
++  return -ENODEV;
++
++  /* Program MBARs */
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_0, HOST_PCI_MBAR0);
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_1, HOST_PCI_MBAR1);
++  ar2315_pci_local_cfg_wr(devfn, PCI_BASE_ADDRESS_2, HOST_PCI_MBAR2);
++
++  /* Run */
++  ar2315_pci_local_cfg_wr(devfn, PCI_COMMAND, PCI_COMMAND_MEMORY |
++  PCI_COMMAND_MASTER | PCI_COMMAND_SPECIAL |
++  PCI_COMMAND_INVALIDATE | PCI_COMMAND_PARITY |
++  PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK);
++
++  return 0;
 +}
-+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, ar2315_pci_fixup);
 +
 +static int __init
 +ar2315_pci_init(void)
 +{
 +  u32 reg;

[OpenWrt-Devel] [PATCH 28/32] atheros: convert gpio.h to stub

2014-09-11 Thread Sergey Ryazanov
Implement to_irq() handler for AR2315 GPIO chip and convert custom
gpio.h header to stub.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 36 --
 .../atheros/patches-3.14/105-ar2315_pci.patch  |  2 +-
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 7097cfd..1467fb8 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -603,36 +603,22 @@
 +#endif /* __ASM_MACH_AR231X_DMA_COHERENCE_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/gpio.h
-@@ -0,0 +1,30 @@
+@@ -0,0 +1,16 @@
 +#ifndef __ASM_MACH_AR231X_GPIO_H
 +#define __ASM_MACH_AR231X_GPIO_H
 +
-+#include ar231x.h
++#include asm-generic/gpio.h
 +
 +#define gpio_get_value __gpio_get_value
 +#define gpio_set_value __gpio_set_value
 +#define gpio_cansleep __gpio_cansleep
++#define gpio_to_irq __gpio_to_irq
 +
-+/*
-+ * Wrappers for the generic GPIO layer
-+ */
-+
-+/* not sure if these are used? */
-+
-+/* Returns IRQ to attach for gpio.  Unchecked function */
-+static inline int gpio_to_irq(unsigned gpio)
-+{
-+  return AR231X_GPIO_IRQ(gpio);
-+}
-+
-+/* Returns gpio for IRQ attached.  Unchecked function */
 +static inline int irq_to_gpio(unsigned irq)
 +{
-+  return irq - AR231X_GPIO_IRQ(0);
++  return -EINVAL;
 +}
 +
-+#include asm-generic/gpio.h /* cansleep wrappers */
-+
 +#endif/* __ASM_MACH_AR231X_GPIO_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/reset.h
@@ -2096,7 +2082,7 @@
 +
 --- /dev/null
 +++ b/arch/mips/ar231x/ar2315.c
-@@ -0,0 +1,562 @@
+@@ -0,0 +1,568 @@
 +/*
 + * 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
@@ -2349,12 +2335,18 @@
 +  return 0;
 +}
 +
++static int ar2315_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
++{
++  return AR231X_GPIO_IRQ_BASE + gpio;
++}
++
 +static struct gpio_chip ar2315_gpio_chip = {
 +  .label  = ar2315-gpio,
 +  .direction_input= ar2315_gpio_direction_input,
 +  .direction_output   = ar2315_gpio_direction_output,
 +  .set= ar2315_gpio_set_value,
 +  .get= ar2315_gpio_get_value,
++  .to_irq = ar2315_gpio_to_irq,
 +  .base   = 0,
 +  .ngpio  = AR2315_NUM_GPIO, /* 22 */
 +};
@@ -2741,7 +2733,7 @@
 +#endif
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar231x.h
-@@ -0,0 +1,43 @@
+@@ -0,0 +1,39 @@
 +#ifndef __ASM_MACH_AR231X_H
 +#define __ASM_MACH_AR231X_H
 +
@@ -2755,10 +2747,6 @@
 +#define AR231X_IRQ_NONE   (MIPS_CPU_IRQ_BASE+0)
 +#define AR231X_IRQ_CPU_CLOCK  (MIPS_CPU_IRQ_BASE+7) /* C0_CAUSE: 0x8000 */
 +
-+/* GPIO Interrupts, share AR_MISC_IRQ_GPIO */
-+#define AR231X_GPIO_IRQ_NONE(AR231X_GPIO_IRQ_BASE+0)
-+#define AR231X_GPIO_IRQ(n)  (AR231X_GPIO_IRQ_BASE+n)
-+
 +static inline u32
 +ar231x_read_reg(u32 reg)
 +{
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 7cbe629..5aeb9f4 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -382,7 +382,7 @@
else if (pending  CAUSEF_IP2)
do_IRQ(AR2315_IRQ_MISC_INTRS);
else if (pending  CAUSEF_IP7)
-@@ -560,3 +564,18 @@ ar2315_plat_setup(void)
+@@ -566,3 +570,18 @@ ar2315_plat_setup(void)
ar231x_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0,
ar2315_apb_frequency());
  }
-- 
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 25/32] atheros: ar2315-pci: convert to platform driver

2014-09-11 Thread Sergey Ryazanov
Convert the PCI controller support code to platform driver and move it to
appropriate subdirectory.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 .../atheros/patches-3.14/105-ar2315_pci.patch  | 92 ++
 1 file changed, 59 insertions(+), 33 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index ab87c6a..18529c8 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -1,14 +1,16 @@
 a/arch/mips/ar231x/Makefile
-+++ b/arch/mips/ar231x/Makefile
-@@ -14,3 +14,5 @@ obj-$(CONFIG_EARLY_PRINTK) += early_prin
+--- a/arch/mips/pci/Makefile
 b/arch/mips/pci/Makefile
+@@ -19,6 +19,7 @@ obj-$(CONFIG_BCM47XX)+= pci-bcm47xx.o
+ obj-$(CONFIG_BCM63XX) += pci-bcm63xx.o fixup-bcm63xx.o \
+   ops-bcm63xx.o
+ obj-$(CONFIG_MIPS_ALCHEMY)+= pci-alchemy.o
++obj-$(CONFIG_PCI_AR2315)  += pci-ar2315.o
+ obj-$(CONFIG_SOC_AR71XX)  += pci-ar71xx.o
+ obj-$(CONFIG_PCI_AR724X)  += pci-ar724x.o
  
- obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
- obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
-+obj-$(CONFIG_PCI_AR2315) += pci.o
-+
 --- /dev/null
-+++ b/arch/mips/ar231x/pci.c
-@@ -0,0 +1,340 @@
 b/arch/mips/pci/pci-ar2315.c
+@@ -0,0 +1,345 @@
 +/*
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -50,6 +52,7 @@
 +
 +#include linux/types.h
 +#include linux/pci.h
++#include linux/platform_device.h
 +#include linux/kernel.h
 +#include linux/init.h
 +#include linux/mm.h
@@ -60,7 +63,6 @@
 +#include ar231x_platform.h
 +#include ar231x.h
 +#include ar2315_regs.h
-+#include devices.h
 +
 +/* Arbitrary size of memory region to access the configuration space */
 +#define AR2315_PCI_CFG_SIZE   0x0010
@@ -178,16 +180,6 @@
 +  .io_offset  = 0xUL,
 +};
 +
-+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-+{
-+  return AR2315_PCI_IRQ_EXT;
-+}
-+
-+int pcibios_plat_dev_init(struct pci_dev *dev)
-+{
-+  return 0;
-+}
-+
 +static int ar2315_pci_host_setup(void)
 +{
 +  unsigned devfn = PCI_DEVFN(AR2315_PCI_HOST_SLOT, 0);
@@ -281,20 +273,17 @@
 +  ar231x_mask_reg(AR2315_PCI_IER, 0, AR2315_PCI_IER_ENABLE);
 +}
 +
-+static int __init
-+ar2315_pci_init(void)
++static int ar2315_pci_probe(struct platform_device *pdev)
 +{
++  struct device *dev = pdev-dev;
 +  u32 reg;
 +  int res;
 +
-+  if (ar231x_devtype != DEV_TYPE_AR2315)
-+  return -ENODEV;
-+
 +  /* Remap PCI config space */
-+  ar2315_pci_cfg_mem = ioremap_nocache(AR2315_PCIEXT,
-+   AR2315_PCI_CFG_SIZE);
++  ar2315_pci_cfg_mem = devm_ioremap_nocache(dev, AR2315_PCIEXT,
++AR2315_PCI_CFG_SIZE);
 +  if (!ar2315_pci_cfg_mem) {
-+  pr_err(ar2315-pci: failed to remap PCI config space\n);
++  dev_err(dev, failed to remap PCI config space\n);
 +  return -ENOMEM;
 +  }
 +
@@ -335,20 +324,38 @@
 +
 +  res = ar2315_pci_host_setup();
 +  if (res)
-+  goto error;
++  return res;
 +
 +  ar2315_pci_irq_init();
 +
 +  register_pci_controller(ar2315_pci_controller);
 +
 +  return 0;
-+
-+error:
-+  iounmap(ar2315_pci_cfg_mem);
-+  return res;
 +}
 +
++static struct platform_driver ar2315_pci_driver = {
++  .probe = ar2315_pci_probe,
++  .driver = {
++  .name = ar2315-pci,
++  .owner = THIS_MODULE,
++  },
++};
++
++static int __init ar2315_pci_init(void)
++{
++  return platform_driver_register(ar2315_pci_driver);
++}
 +arch_initcall(ar2315_pci_init);
++
++int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
++{
++  return AR2315_PCI_IRQ_EXT;
++}
++
++int pcibios_plat_dev_init(struct pci_dev *dev)
++{
++  return 0;
++}
 --- a/arch/mips/ar231x/Kconfig
 +++ b/arch/mips/ar231x/Kconfig
 @@ -7,3 +7,10 @@ config ATHEROS_AR2315
@@ -375,3 +382,22 @@
else if (pending  CAUSEF_IP2)
do_IRQ(AR2315_IRQ_MISC_INTRS);
else if (pending  CAUSEF_IP7)
+@@ -554,3 +558,18 @@ ar2315_plat_setup(void)
+   ar231x_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0,
+   ar2315_apb_frequency());
+ }
++
++#ifdef CONFIG_PCI_AR2315
++static int __init ar2315_pci_init(void)
++{
++  struct platform_device *pdev;
++
++  if (!is_2315() || ar231x_devtype != DEV_TYPE_AR2315)
++  return -ENODEV;
++
++  pdev = platform_device_register_simple(ar2315-pci, -1, NULL, 0);
++
++  return pdev ? 0 : -ENODEV;
++}
++arch_initcall(ar2315_pci_init);
++#endif
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

[OpenWrt-Devel] [PATCH 27/32] atheros: rename SoCs config symbols

2014-09-11 Thread Sergey Ryazanov
Rename config symbols to be consistent with other SoCs config symbols
supported by MIPS arch.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/config-3.14 |  4 ++--
 target/linux/atheros/patches-3.14/100-board.patch| 16 
 .../atheros/patches-3.14/101-early-printk-support.patch  |  4 ++--
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch   |  4 ++--
 target/linux/atheros/patches-3.14/120-spiflash.patch |  2 +-
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/target/linux/atheros/config-3.14 b/target/linux/atheros/config-3.14
index a0bb6e9..3f7c76a 100644
--- a/target/linux/atheros/config-3.14
+++ b/target/linux/atheros/config-3.14
@@ -11,9 +11,7 @@ CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
 CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
-CONFIG_ATHEROS_AR2315=y
 CONFIG_ATHEROS_AR231X=y
-CONFIG_ATHEROS_AR5312=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_CEVT_R4K=y
 CONFIG_CLONE_BACKWARDS=y
@@ -124,6 +122,8 @@ CONFIG_PHYLIB=y
 # CONFIG_SCSI_DMA is not set
 CONFIG_SERIAL_8250_NR_UARTS=1
 CONFIG_SERIAL_8250_RUNTIME_UARTS=1
+CONFIG_SOC_AR2315=y
+CONFIG_SOC_AR5312=y
 # CONFIG_SWAP is not set
 CONFIG_SWCONFIG=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index efbc241..7097cfd 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -50,12 +50,12 @@
 --- /dev/null
 +++ b/arch/mips/ar231x/Kconfig
 @@ -0,0 +1,9 @@
-+config ATHEROS_AR5312
++config SOC_AR5312
 +  bool Atheros 5312/2312+ support
 +  depends on ATHEROS_AR231X
 +  default y
 +
-+config ATHEROS_AR2315
++config SOC_AR2315
 +  bool Atheros 2315+ support
 +  depends on ATHEROS_AR231X
 +  default y
@@ -73,8 +73,8 @@
 +#
 +
 +obj-y += board.o prom.o devices.o
-+obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
-+obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
++obj-$(CONFIG_SOC_AR5312) += ar5312.o
++obj-$(CONFIG_SOC_AR2315) += ar2315.o
 --- /dev/null
 +++ b/arch/mips/ar231x/board.c
 @@ -0,0 +1,229 @@
@@ -476,7 +476,7 @@
 +/* #define cpu_has_mcheck ? */
 +#define cpu_has_ejtag 1
 +
-+#if !defined(CONFIG_ATHEROS_AR5312)
++#if !defined(CONFIG_SOC_AR5312)
 +#  define cpu_has_llsc1
 +#else
 +/*
@@ -500,7 +500,7 @@
 +
 +#define cpu_has_mips32r1  1
 +
-+#if !defined(CONFIG_ATHEROS_AR5312)
++#if !defined(CONFIG_SOC_AR5312)
 +#  define cpu_has_mips32r21
 +#endif
 +
@@ -2665,7 +2665,7 @@
 +#ifndef __AR2315_H
 +#define __AR2315_H
 +
-+#ifdef CONFIG_ATHEROS_AR2315
++#ifdef CONFIG_SOC_AR2315
 +
 +void ar2315_irq_init(void);
 +int ar2315_init_devices(void);
@@ -2705,7 +2705,7 @@
 +#ifndef __AR5312_H
 +#define __AR5312_H
 +
-+#ifdef CONFIG_ATHEROS_AR5312
++#ifdef CONFIG_SOC_AR5312
 +
 +void ar5312_irq_init(void);
 +int ar5312_init_devices(void);
diff --git a/target/linux/atheros/patches-3.14/101-early-printk-support.patch 
b/target/linux/atheros/patches-3.14/101-early-printk-support.patch
index d33c3f1..032ffe7 100644
--- a/target/linux/atheros/patches-3.14/101-early-printk-support.patch
+++ b/target/linux/atheros/patches-3.14/101-early-printk-support.patch
@@ -56,8 +56,8 @@
 +
 +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 +
- obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
- obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
+ obj-$(CONFIG_SOC_AR5312) += ar5312.o
+ obj-$(CONFIG_SOC_AR2315) += ar2315.o
 --- a/arch/mips/Kconfig
 +++ b/arch/mips/Kconfig
 @@ -154,6 +154,7 @@ config ATHEROS_AR231X
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 2b7f5ed..7cbe629 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -358,14 +358,14 @@
 +}
 --- a/arch/mips/ar231x/Kconfig
 +++ b/arch/mips/ar231x/Kconfig
-@@ -7,3 +7,10 @@ config ATHEROS_AR2315
+@@ -7,3 +7,10 @@ config SOC_AR2315
bool Atheros 2315+ support
depends on ATHEROS_AR231X
default y
 +
 +config PCI_AR2315
 +  bool AR2315 PCI controller support
-+  depends on ATHEROS_AR2315
++  depends on SOC_AR2315
 +  select HW_HAS_PCI
 +  select PCI
 +  default y
diff --git a/target/linux/atheros/patches-3.14/120-spiflash.patch 
b/target/linux/atheros/patches-3.14/120-spiflash.patch
index 94f8e40..fb62169 100644
--- a/target/linux/atheros/patches-3.14/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.14/120-spiflash.patch
@@ -6,7 +6,7 @@
  
 +config MTD_AR2315
 +  tristate Atheros AR2315+ SPI Flash support
-+  depends on ATHEROS_AR2315
++  depends on SOC_AR2315
 +
  config MTD_SLRAM
tristate Uncached system RAM
-- 
1.8.1.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org

[OpenWrt-Devel] [PATCH 24/32] atheros: ar2315-pci: rename configuration symbol

2014-09-11 Thread Sergey Ryazanov
Rename configuration symbol to be consistent with other MIPS machines.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/config-3.14   |  2 +-
 target/linux/atheros/patches-3.14/105-ar2315_pci.patch | 11 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/target/linux/atheros/config-3.14 b/target/linux/atheros/config-3.14
index f27d1c2..a0bb6e9 100644
--- a/target/linux/atheros/config-3.14
+++ b/target/linux/atheros/config-3.14
@@ -12,7 +12,6 @@ CONFIG_ARCH_REQUIRE_GPIOLIB=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_ATHEROS_AR2315=y
-CONFIG_ATHEROS_AR2315_PCI=y
 CONFIG_ATHEROS_AR231X=y
 CONFIG_ATHEROS_AR5312=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -115,6 +114,7 @@ CONFIG_NET_RX_BUSY_POLL=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PCI=y
+CONFIG_PCI_AR2315=y
 CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
 CONFIG_PCI_DOMAINS=y
 CONFIG_PERF_USE_VMALLOC=y
diff --git a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch 
b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
index 5c437dc..ab87c6a 100644
--- a/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
+++ b/target/linux/atheros/patches-3.14/105-ar2315_pci.patch
@@ -1,10 +1,11 @@
 --- a/arch/mips/ar231x/Makefile
 +++ b/arch/mips/ar231x/Makefile
-@@ -14,3 +14,4 @@ obj-$(CONFIG_EARLY_PRINTK) += early_prin
+@@ -14,3 +14,5 @@ obj-$(CONFIG_EARLY_PRINTK) += early_prin
  
  obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
  obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
-+obj-$(CONFIG_ATHEROS_AR2315_PCI) += pci.o
++obj-$(CONFIG_PCI_AR2315) += pci.o
++
 --- /dev/null
 +++ b/arch/mips/ar231x/pci.c
 @@ -0,0 +1,340 @@
@@ -355,8 +356,8 @@
depends on ATHEROS_AR231X
default y
 +
-+config ATHEROS_AR2315_PCI
-+  bool PCI support
++config PCI_AR2315
++  bool AR2315 PCI controller support
 +  depends on ATHEROS_AR2315
 +  select HW_HAS_PCI
 +  select PCI
@@ -367,7 +368,7 @@
do_IRQ(AR2315_IRQ_WLAN0_INTRS);
else if (pending  CAUSEF_IP4)
do_IRQ(AR2315_IRQ_ENET0_INTRS);
-+#ifdef CONFIG_ATHEROS_AR2315_PCI
++#ifdef CONFIG_PCI_AR2315
 +  else if (pending  CAUSEF_IP5)
 +  do_IRQ(AR2315_IRQ_LCBUS_PCI);
 +#endif
-- 
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 30/32] atheros: convert AR5312 GPIO code to platform driver

2014-09-11 Thread Sergey Ryazanov
Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/config-3.14   |   1 +
 target/linux/atheros/patches-3.14/100-board.patch  |  76 +---
 .../atheros/patches-3.14/102-ar5312_gpio.patch | 194 +
 .../atheros/patches-3.14/105-ar2315_pci.patch  |   2 +-
 4 files changed, 198 insertions(+), 75 deletions(-)
 create mode 100644 target/linux/atheros/patches-3.14/102-ar5312_gpio.patch

diff --git a/target/linux/atheros/config-3.14 b/target/linux/atheros/config-3.14
index 3f7c76a..5d1041a 100644
--- a/target/linux/atheros/config-3.14
+++ b/target/linux/atheros/config-3.14
@@ -44,6 +44,7 @@ CONFIG_GENERIC_NET_UTILS=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_AR5312=y
 CONFIG_GPIO_DEVRES=y
 CONFIG_GPIO_SYSFS=y
 # CONFIG_HAMRADIO is not set
diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 649ecf7..8ffa91c 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -1292,7 +1292,7 @@
 +#endif /* __ASM_MACH_AR231X_AR2315_REGS_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,247 @@
+@@ -0,0 +1,235 @@
 +/*
 + * 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
@@ -1525,24 +1525,12 @@
 +#define MEM_CFG1_AC10x7000  /* bank 1: SDRAM addr check (added) */
 +#define MEM_CFG1_AC1_S  12
 +
-+/* GPIO Address Map */
 +#define AR5312_GPIO (AR5312_APBBASE  + 0x2000)
-+#define AR5312_GPIO_DO  (AR5312_GPIO + 0x00)/* output register */
-+#define AR5312_GPIO_DI  (AR5312_GPIO + 0x04)/* intput register */
-+#define AR5312_GPIO_CR  (AR5312_GPIO + 0x08)/* control register */
-+
-+/* GPIO Control Register bit field definitions */
-+#define AR5312_GPIO_CR_M(x)(1  (x))   /* mask for i/o */
-+#define AR5312_GPIO_CR_O(x)(0  (x))   /* mask for output */
-+#define AR5312_GPIO_CR_I(x)(1  (x))   /* mask for input */
-+#define AR5312_GPIO_CR_INT(x)  (1  ((x)+8))   /* mask for 
interrupt*/
-+#define AR5312_GPIO_CR_UART(x) (1  ((x)+16))  /* uart multiplex */
-+#define AR5312_NUM_GPIO   8
 +
 +#endif/* __ASM_MACH_AR231X_AR5312_REGS_H */
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,536 @@
+@@ -0,0 +1,476 @@
 +/*
 + * 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
@@ -1687,51 +1675,6 @@
 +  irq_set_chained_handler(AR5312_IRQ_MISC_INTRS, ar5312_misc_irq_handler);
 +}
 +
-+/*
-+ * gpiolib implementations
-+ */
-+static int
-+ar5312_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
-+{
-+  return (ar231x_read_reg(AR5312_GPIO_DI)  gpio)  1;
-+}
-+
-+static void
-+ar5312_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
-+{
-+  u32 reg = ar231x_read_reg(AR5312_GPIO_DO);
-+
-+  reg = value ? reg | (1  gpio) : reg  ~(1  gpio);
-+  ar231x_write_reg(AR5312_GPIO_DO, reg);
-+}
-+
-+static int
-+ar5312_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
-+{
-+  ar231x_mask_reg(AR5312_GPIO_CR, 0, 1  gpio);
-+  return 0;
-+}
-+
-+static int
-+ar5312_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value)
-+{
-+  ar231x_mask_reg(AR5312_GPIO_CR, 1  gpio, 0);
-+  ar5312_gpio_set_value(chip, gpio, value);
-+  return 0;
-+}
-+
-+static struct gpio_chip ar5312_gpio_chip = {
-+  .label  = ar5312-gpio,
-+  .direction_input= ar5312_gpio_direction_input,
-+  .direction_output   = ar5312_gpio_direction_output,
-+  .set= ar5312_gpio_set_value,
-+  .get= ar5312_gpio_get_value,
-+  .base   = 0,
-+  .ngpio  = AR5312_NUM_GPIO, /* 8 */
-+};
-+
-+/* end of gpiolib */
-+
 +static void ar5312_device_reset_set(u32 mask)
 +{
 +  u32 val;
@@ -2024,20 +1967,6 @@
 +  mips_hpt_frequency = ar5312_cpu_frequency() / 2;
 +}
 +
-+static int __init
-+ar5312_gpio_init(void)
-+{
-+  int ret = gpiochip_add(ar5312_gpio_chip);
-+
-+  if (ret) {
-+  pr_err(%s: failed to add gpiochip\n, ar5312_gpio_chip.label);
-+  return ret;
-+  }
-+  pr_info(%s: registered %d GPIOs\n, ar5312_gpio_chip.label,
-+  ar5312_gpio_chip.ngpio);
-+  return ret;
-+}
-+
 +void __init
 +ar5312_prom_init(void)
 +{
@@ -2060,7 +1989,6 @@
 +  devid = AR5312_REV_WMAC_MIN_S;
 +  devid = AR5312_REV_CHIP;
 +  ar231x_board.devid = (u16)devid;
-+  ar5312_gpio_init();
 +}
 +
 +void __init
diff --git a/target/linux/atheros/patches-3.14/102-ar5312_gpio.patch 
b/target/linux/atheros/patches-3.14/102-ar5312_gpio.patch

[OpenWrt-Devel] [PATCH 32/32] atheros: refresh config

2014-09-11 Thread Sergey Ryazanov
Remove symbols that are now placed in the generic config.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/config-3.14 | 4 
 1 file changed, 4 deletions(-)

diff --git a/target/linux/atheros/config-3.14 b/target/linux/atheros/config-3.14
index 8c6e68d..cf64454 100644
--- a/target/linux/atheros/config-3.14
+++ b/target/linux/atheros/config-3.14
@@ -32,7 +32,6 @@ CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CSRC_R4K=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_EARLY_PRINTK=y
-# CONFIG_EARLY_PRINTK_8250 is not set
 CONFIG_ETHERNET_PACKET_MANGLE=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
@@ -96,7 +95,6 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5
 # CONFIG_MIPS_MACHINE is not set
 CONFIG_MIPS_MT_DISABLED=y
 # CONFIG_MIPS_O32_FP64_SUPPORT is not set
-# CONFIG_MLX5_CORE is not set
 CONFIG_MODULES_USE_ELF_REL=y
 CONFIG_MTD_AR2315=y
 CONFIG_MTD_CFI_ADV_OPTIONS=y
@@ -110,7 +108,6 @@ CONFIG_MVSWITCH_PHY=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NET_AR231X=y
-CONFIG_NET_RX_BUSY_POLL=y
 CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_PCI=y
@@ -135,5 +132,4 @@ CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
 CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
 CONFIG_TICK_CPU_ACCOUNTING=y
 CONFIG_USB_SUPPORT=y
-# CONFIG_ZBUD is not set
 CONFIG_ZONE_DMA_FLAG=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 29/32] atheros: rework chained interrupts handling

2014-09-11 Thread Sergey Ryazanov
Call generic_handle_irq() instead of do_IRQ() for chained interrupts,
remove XXX_NONE interrupts and call spurious_interrupt() when an interrupt
is unexpected.

Signed-off-by: Sergey Ryazanov ryazanov@gmail.com
---
 target/linux/atheros/patches-3.14/100-board.patch  | 92 +++---
 .../atheros/patches-3.14/105-ar2315_pci.patch  |  2 +-
 2 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/target/linux/atheros/patches-3.14/100-board.patch 
b/target/linux/atheros/patches-3.14/100-board.patch
index 1467fb8..649ecf7 100644
--- a/target/linux/atheros/patches-3.14/100-board.patch
+++ b/target/linux/atheros/patches-3.14/100-board.patch
@@ -659,7 +659,7 @@
 +#endif /* __ASM_MACH_AR231X_WAR_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar2315_regs.h
-@@ -0,0 +1,631 @@
+@@ -0,0 +1,630 @@
 +/*
 + * Register definitions for AR2315+
 + *
@@ -688,17 +688,16 @@
 +/*
 + * Miscellaneous interrupts, which share IP2.
 + */
-+#define AR2315_MISC_IRQ_NONE  (AR231X_MISC_IRQ_BASE+0)
-+#define AR2315_MISC_IRQ_UART0 (AR231X_MISC_IRQ_BASE+1)
-+#define AR2315_MISC_IRQ_I2C_RSVD  (AR231X_MISC_IRQ_BASE+2)
-+#define AR2315_MISC_IRQ_SPI   (AR231X_MISC_IRQ_BASE+3)
-+#define AR2315_MISC_IRQ_AHB   (AR231X_MISC_IRQ_BASE+4)
-+#define AR2315_MISC_IRQ_APB   (AR231X_MISC_IRQ_BASE+5)
-+#define AR2315_MISC_IRQ_TIMER (AR231X_MISC_IRQ_BASE+6)
-+#define AR2315_MISC_IRQ_GPIO  (AR231X_MISC_IRQ_BASE+7)
-+#define AR2315_MISC_IRQ_WATCHDOG  (AR231X_MISC_IRQ_BASE+8)
-+#define AR2315_MISC_IRQ_IR_RSVD   (AR231X_MISC_IRQ_BASE+9)
-+#define AR2315_MISC_IRQ_COUNT 10
++#define AR2315_MISC_IRQ_UART0 (AR231X_MISC_IRQ_BASE+0)
++#define AR2315_MISC_IRQ_I2C_RSVD  (AR231X_MISC_IRQ_BASE+1)
++#define AR2315_MISC_IRQ_SPI   (AR231X_MISC_IRQ_BASE+2)
++#define AR2315_MISC_IRQ_AHB   (AR231X_MISC_IRQ_BASE+3)
++#define AR2315_MISC_IRQ_APB   (AR231X_MISC_IRQ_BASE+4)
++#define AR2315_MISC_IRQ_TIMER (AR231X_MISC_IRQ_BASE+5)
++#define AR2315_MISC_IRQ_GPIO  (AR231X_MISC_IRQ_BASE+6)
++#define AR2315_MISC_IRQ_WATCHDOG  (AR231X_MISC_IRQ_BASE+7)
++#define AR2315_MISC_IRQ_IR_RSVD   (AR231X_MISC_IRQ_BASE+8)
++#define AR2315_MISC_IRQ_COUNT 9
 +
 +/*
 + * PCI interrupts, which share IP5
@@ -1293,7 +1292,7 @@
 +#endif /* __ASM_MACH_AR231X_AR2315_REGS_H */
 --- /dev/null
 +++ b/arch/mips/include/asm/mach-ar231x/ar5312_regs.h
-@@ -0,0 +1,249 @@
+@@ -0,0 +1,247 @@
 +/*
 + * 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
@@ -1321,17 +1320,16 @@
 +/*
 + * Miscellaneous interrupts, which share IP6.
 + */
-+#define AR5312_MISC_IRQ_NONE  (AR231X_MISC_IRQ_BASE+0)
-+#define AR5312_MISC_IRQ_TIMER (AR231X_MISC_IRQ_BASE+1)
-+#define AR5312_MISC_IRQ_AHB_PROC  (AR231X_MISC_IRQ_BASE+2)
-+#define AR5312_MISC_IRQ_AHB_DMA   (AR231X_MISC_IRQ_BASE+3)
-+#define AR5312_MISC_IRQ_GPIO  (AR231X_MISC_IRQ_BASE+4)
-+#define AR5312_MISC_IRQ_UART0 (AR231X_MISC_IRQ_BASE+5)
-+#define AR5312_MISC_IRQ_UART0_DMA (AR231X_MISC_IRQ_BASE+6)
-+#define AR5312_MISC_IRQ_WATCHDOG  (AR231X_MISC_IRQ_BASE+7)
-+#define AR5312_MISC_IRQ_LOCAL (AR231X_MISC_IRQ_BASE+8)
-+#define AR5312_MISC_IRQ_SPI   (AR231X_MISC_IRQ_BASE+9)
-+#define AR5312_MISC_IRQ_COUNT 10
++#define AR5312_MISC_IRQ_TIMER (AR231X_MISC_IRQ_BASE+0)
++#define AR5312_MISC_IRQ_AHB_PROC  (AR231X_MISC_IRQ_BASE+1)
++#define AR5312_MISC_IRQ_AHB_DMA   (AR231X_MISC_IRQ_BASE+2)
++#define AR5312_MISC_IRQ_GPIO  (AR231X_MISC_IRQ_BASE+3)
++#define AR5312_MISC_IRQ_UART0 (AR231X_MISC_IRQ_BASE+4)
++#define AR5312_MISC_IRQ_UART0_DMA (AR231X_MISC_IRQ_BASE+5)
++#define AR5312_MISC_IRQ_WATCHDOG  (AR231X_MISC_IRQ_BASE+6)
++#define AR5312_MISC_IRQ_LOCAL (AR231X_MISC_IRQ_BASE+7)
++#define AR5312_MISC_IRQ_SPI   (AR231X_MISC_IRQ_BASE+8)
++#define AR5312_MISC_IRQ_COUNT 9
 +
 +/*
 + * Address Map
@@ -1395,7 +1393,6 @@
 +#define AR5312_WD_CTRL_RESET 0x0002
 +
 +/* AR5312_ISR register bit field definitions */
-+#define AR5312_ISR_NONE   0x
 +#define AR5312_ISR_TIMER  0x0001
 +#define AR5312_ISR_AHBPROC0x0002
 +#define AR5312_ISR_AHBDMA 0x0004
@@ -1545,7 +1542,7 @@
 +#endif/* __ASM_MACH_AR231X_AR5312_REGS_H */
 --- /dev/null
 +++ b/arch/mips/ar231x/ar5312.c
-@@ -0,0 +1,534 @@
+@@ -0,0 +1,536 @@
 +/*
 + * 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
@@ -1591,16 +1588,16 @@
 +   ar231x_read_reg(AR5312_IMR);
 +
 +  if (ar231x_misc_intrs  AR5312_ISR_TIMER) {
-+  do_IRQ(AR5312_MISC_IRQ_TIMER);
++  generic_handle_irq(AR5312_MISC_IRQ_TIMER);
 +