[OpenWrt-Devel] [RESEND][PATCH] Fix uninitialised variable causing 1-wire to not bind to GPIO
--- package/kernel/w1-gpio-custom/src/w1-gpio-custom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c index fc2f842..2018f58 100644 --- a/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c +++ b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c @@ -113,6 +113,7 @@ static int __init w1_gpio_custom_add_one(unsigned int id, unsigned int *params) pdata.pin = params[BUS_PARAM_PIN]; pdata.is_open_drain = params[BUS_PARAM_OD] ? 1 : 0; pdata.enable_external_pullup = NULL; + pdata.ext_pullup_enable_pin = -1; err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); if (err) -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] kernel: fix uninitialised variable causing 1-wire to not bind to GPIO
This patch fixes a bug where 1-wire fails with an error instead of binding to the requested GPIO pin: "gpio_request_one (ext_pullup_enable_pin) failed" --- package/kernel/w1-gpio-custom/src/w1-gpio-custom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c index fc2f842..2018f58 100644 --- a/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c +++ b/package/kernel/w1-gpio-custom/src/w1-gpio-custom.c @@ -113,6 +113,7 @@ static int __init w1_gpio_custom_add_one(unsigned int id, unsigned int *params) pdata.pin = params[BUS_PARAM_PIN]; pdata.is_open_drain = params[BUS_PARAM_OD] ? 1 : 0; pdata.enable_external_pullup = NULL; + pdata.ext_pullup_enable_pin = -1; err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); if (err) -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] iwinfo: Fix incorrect buffer allocation in nl80211_get_ifcomb_cb()
This fixes a buffer overwrite, I found it when building with SSP enabled --- iwinfo_nl80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c index 2731b2b..be58c56 100644 --- a/iwinfo_nl80211.c +++ b/iwinfo_nl80211.c @@ -2446,15 +2446,15 @@ static int nl80211_get_ifcomb_cb(struct nl_msg *msg, void *arg) [NL80211_IFACE_COMB_LIMITS] = { .type = NLA_NESTED }, [NL80211_IFACE_COMB_MAXNUM] = { .type = NLA_U32 }, }; - struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB]; + struct nlattr *tb_comb[NUM_NL80211_IFACE_COMB+1]; static struct nla_policy iface_limit_policy[NUM_NL80211_IFACE_LIMIT] = { [NL80211_IFACE_LIMIT_TYPES] = { .type = NLA_NESTED }, [NL80211_IFACE_LIMIT_MAX] = { .type = NLA_U32 }, }; - struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT]; + struct nlattr *tb_limit[NUM_NL80211_IFACE_LIMIT+1]; struct nlattr *limit; - nla_parse_nested(tb_comb, NL80211_BAND_ATTR_MAX, comb, iface_combination_policy); + nla_parse_nested(tb_comb, NUM_NL80211_IFACE_COMB, comb, iface_combination_policy); if (!tb_comb[NL80211_IFACE_COMB_LIMITS]) continue; -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] OpenWRT and grsecurity experiments and ponderings
Hi all noticing that CC may be coming at some point, and whilst recently taking the latest turunk for a spin, I noticed that the kernel 3.14.25 matched the current grsecurity patch (which is in long term support against 3.14) so I thought I'd see what it would take to apply it to OpenWRT. It turned out to be easier than I'd hoped - although I've only tested it against ar71xx and the carambola2 specifically. The best way turned out to be to apply it after all the openwrt patches, then I had to fix about four rejects and some quirks introduced by other OpenWRT patches, the biggest challenge being something that OpenWRT does for MIPS in the module loading code needing to be fixed to work with grsec changes. The other main one is that compat wireless ath9k driver uses a macro that needs to be changed for grsec. Thereafter I was able to get my board to run with a -grsec kernel with the following caveats: * because OpenWRT turns off kernel MODVERSIONs, grsecurity requires RANDSTRUCT turned off * my particular config uncovered that openssl doesnt build with NX for mips and programs libcrypto.so were actually intercepted by grsec! So I had to fix that by adding a gnu-stack patch to several assembler-(generating) files So far I have managed to test the following features of grsec with success: * mount auditing * time change auditing * NX protection on MIPS (which doesnt have h/w support on my SOC) I'll end up pushing my modified OpenWRT build to github soonish This did the job for me, but I figured it was worth sharing as the buzzword "Internet of Things" looms large and openwrt is increasing adoption on products such as the vocore and wrtnode... I wonder what people feel the priority might be to get this tidied up and integrated into the main openwrt - or would it be infeasible to properly test and support? Noting that there will likely be other packages that I dont currently use that could need NX fixing on MIPS for starters, so wider implementation would depend on the priorities of other users of different packages. There is also the risk is that mixing the openwrt package suite with grsec may introduce inadvertent security holes - my changes "seem" OK but I havent yet done the deep research to know for sure. This can be mitigated by making an GRSEC config option optional with a big warning in menuconfig for those who want to do their own diligence. Perhaps the option in the config would also only be enabled for a limited subset of boards where people have made the effort to patch & test, as an 'experimental' feature. ar7240> bootm ## Booting image at 8300 ... Image Name: MIPS OpenWrt Linux-3.14.25 Created: 2014-12-04 13:48:17 UTC Image Type: MIPS Linux Kernel Image (lzma compressed) Data Size:4796179 Bytes = 4.6 MB Load Address: 8006 Entry Point: 8006 Verifying Checksum at 0x8340 ...OK Uncompressing Kernel Image ... OK Starting kernel ... [0.00] Linux version 3.14.25-grsec (andrew@atlantis4) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r43488) ) #6 Fri Dec 5 00:17:55 ACDT 2014 [0.00] bootconsole [early0] enabled [0.00] CPU0 revision is: 00019374 (MIPS 24Kc) [0.00] SoC: Atheros AR9330 rev 1 ... [ 21.562499] grsec: mount of devpts to /dev/pts by /sbin/procd[procd:1] uid/euid:0/0 gid/egid:0/0, parent /[swapper:0] uid/euid:0/0 gid/egid:0/0 ... [ 26.583332] grsec: time set by /bin/busybox[date:665] uid/euid:0/0 gid/egid:0/0, parent /etc/init.d/system[S10system:660] uid/euid:0/0 gid/egid:0/0 ... root@OpenWrt:/sbin# opkg search /wbin/wget2nand [ 306.541661] grsec: denied marking stack executable as requested by PT_GNU_STACK marking in /usr/lib/libcrypto.so.1.0.0 by /bin/opkg[opkg:1040] uid/euid:0/0 gid/egid:0/0, parent /bin/bus0 --A -- http://blog.oldcomputerjunk.net https://au.linkedin.com/in/amcdonnell https://launchpad.net/~andymc73 https://github.com/andymc73 Twitter: @pastcompute GPG: http://www.andrewmcdonnell.net/gpg.html ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] Missing 'noexecstack' in uClibc MIPS builds
True. Perhaps that makes it a moot issue for BB. But I dont think it would hurt to be ahead of the curve in this day and age... I am not the only one adding this latent protection to MIPS: https://webrtc-codereview.appspot.com/994006/ https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html (source of my patch submission which I emailed later when I finally cracked this) http://lists.busybox.net/pipermail/uclibc/2014-August/048474.html The trade-off might be giving people a false sense of protection, I guess. But that could happen anyway once the fix meanders tghrough gcc upstream. Then again, who else before me even bothered to scan their router files for this :-) Of lower priority for OpenWRT mainstream, is a determined user could also cherry-pick emulated NX protection from PAX. When they google this problem they will at least find my work. Which was a great learning exercise regardless. I blogged about it here --> http://blog.oldcomputerjunk.net/ Anyways, up to you I guess. I am still learning this stuff. Its not like the "experts" regularly get security stuff right... cheers, --Andrew On 04/10/14 02:54, Felix Fietkau wrote: On 2014-10-03 19:14, Catalin Patulea wrote: On Wed, Oct 1, 2014 at 6:42 PM, Andrew McDonnell wrote: It seems that OpenWRT sets the relevant flag to require uClibc to build with NOEXECSTACK set. This is good. (For one introduction to NOEXECSTACK, see http://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart ) Does anything actually enforce NX on MIPS? There are MIPS CPUs that support it, but my guess is that most of our MIPS targets don't have any hardware support for it. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH][toolchain] Fix broken implementation of NOEXECSTACK flag for MIPS architectures for gcc-linaro-4.8
This patch ensures that libgcc_s.so properly honours the NOEXECSTACK flag for MIPS builds, when gcc-linaro-4.8 is the chosen C compiler. Signed-off-by: Andrew McDonnell --- Extended Summary: NOEXECSTACK is a security hardening feature of Linux that prevents execution of arbitrary code for some classes of buffer overflow. When the binaries and libraries in a firmware image are scanned with the checksec tool [1,2] on x86 OpenWRT firmware all have the marking, but in MIPS firmware very few have the marking. To cut a long story short, libgcc_s.so is built in a way that causes it to have an executable stack, and because most other binaries and libraries are linked to this library, they in turn also have an executable stack. The fix for this is a backport patch against the development of gcc. [3,4] [1] https://github.com/slimm609/checksec.sh [2] http://www.trapkit.de/tools/checksec.html [3] http://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart [4] https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html This is probably required against gc 4.6 and gcc 4.8 as well. .../4.8-linaro/930-fix-mips-noexecstack.patch | 124 + 1 file changed, 124 insertions(+) create mode 100644 toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch diff --git a/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch new file mode 100644 index 000..81deda6 --- /dev/null +++ b/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch @@ -0,0 +1,124 @@ +From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 +From: Andrew McDonnell +Date: Fri, 3 Oct 2014 19:09:00 +0930 +Subject: Add .note.GNU-stack section + +See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html +Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html + +Re: [Patch, MIPS] Add .note.GNU-stack section + +From: Steve Ellcey + +On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: +> +> +> On Wed, Sep 10, 2014 at 9:27 AM, wrote: + +> This works except you did not update the assembly files in +> libgcc or glibc. We (Cavium) have the same patch in our tree +> for a few released versions. + +> Mind just checking yours in then Andrew? + +> Thanks! +> -eric + +I talked to Andrew about what files he changed in GCC and created and +tested this new patch. Andrew also mentioned changing some assembly +files in glibc but I don't see any use of '.section .note.GNU-stack' in +any assembly files in glibc (for any platform) so I wasn't planning on +creating a glibc to add them to mips glibc assembly language files. + +OK to check in this patch? + +Steve Ellcey +sell...@mips.com + + + +2014-09-26 Steve Ellcey +--- + gcc/config/mips/mips.c | 3 +++ + libgcc/config/mips/crti.S | 4 + libgcc/config/mips/crtn.S | 3 +++ + libgcc/config/mips/mips16.S | 4 + libgcc/config/mips/vr4120-div.S | 4 + 5 files changed, 18 insertions(+) + +diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c +index 41c5d6b..33d9793 100644 +--- a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c +@@ -18223,6 +18223,9 @@ mips_expand_vec_minmax (rtx target, rtx op0, rtx op1, + #undef TARGET_VECTORIZE_VEC_PERM_CONST_OK + #define TARGET_VECTORIZE_VEC_PERM_CONST_OK mips_vectorize_vec_perm_const_ok + ++#undef TARGET_ASM_FILE_END ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-mips.h" +diff --git a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S +index c7418db..e5f2762 100644 +--- a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S +@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++ ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. +Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +diff --git a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S +index 59d1a90..5cc03bf 100644 +--- a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S +@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++/* An executable stack is *not* required for these functions. */ ++.section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. +Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +diff --git a/libgcc/config/mips/mips16.S b/libgcc/config/mips/mips16
[OpenWrt-Devel] [PATCH][BB, toolchain] Fix broken implementation of NOEXECSTACK flag for MIPS architectures for gcc-linaro-4.8
This patch ensures that libgcc_s.so properly honours the NOEXECSTACK flag for MIPS builds, when gcc-linaro-4.8 is the chosen C compiler. Signed-off-by: Andrew McDonnell --- Extended Summary: NOEXECSTACK is a security hardening feature of Linux that prevents execution of arbitrary code for some classes of buffer overflow. When the binaries and libraries in a firmware image are scanned with the checksec tool [1,2] on x86 OpenWRT firmware all have the marking, but in MIPS firmware very few have the marking. To cut a long story short, libgcc_s.so is built in a way that causes it to have an executable stack, and because most other binaries and libraries are linked to this library, they in turn also have an executable stack. The fix for this is a backport patch against the development of gcc. [3,4] [1] https://github.com/slimm609/checksec.sh [2] http://www.trapkit.de/tools/checksec.html [3] http://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart [4] https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html This is probably required against gc 4.6 and gcc 4.8 as well. .../4.8-linaro/930-fix-mips-noexecstack.patch | 124 + 1 file changed, 124 insertions(+) create mode 100644 toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch diff --git a/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch new file mode 100644 index 000..81deda6 --- /dev/null +++ b/toolchain/gcc/patches/4.8-linaro/930-fix-mips-noexecstack.patch @@ -0,0 +1,124 @@ +From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 +From: Andrew McDonnell +Date: Fri, 3 Oct 2014 19:09:00 +0930 +Subject: Add .note.GNU-stack section + +See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html +Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html + +Re: [Patch, MIPS] Add .note.GNU-stack section + +From: Steve Ellcey + +On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: +> +> +> On Wed, Sep 10, 2014 at 9:27 AM, wrote: + +> This works except you did not update the assembly files in +> libgcc or glibc. We (Cavium) have the same patch in our tree +> for a few released versions. + +> Mind just checking yours in then Andrew? + +> Thanks! +> -eric + +I talked to Andrew about what files he changed in GCC and created and +tested this new patch. Andrew also mentioned changing some assembly +files in glibc but I don't see any use of '.section .note.GNU-stack' in +any assembly files in glibc (for any platform) so I wasn't planning on +creating a glibc to add them to mips glibc assembly language files. + +OK to check in this patch? + +Steve Ellcey +sell...@mips.com + + + +2014-09-26 Steve Ellcey +--- + gcc/config/mips/mips.c | 3 +++ + libgcc/config/mips/crti.S | 4 + libgcc/config/mips/crtn.S | 3 +++ + libgcc/config/mips/mips16.S | 4 + libgcc/config/mips/vr4120-div.S | 4 + 5 files changed, 18 insertions(+) + +diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c +index 41c5d6b..33d9793 100644 +--- a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c +@@ -18223,6 +18223,9 @@ mips_expand_vec_minmax (rtx target, rtx op0, rtx op1, + #undef TARGET_VECTORIZE_VEC_PERM_CONST_OK + #define TARGET_VECTORIZE_VEC_PERM_CONST_OK mips_vectorize_vec_perm_const_ok + ++#undef TARGET_ASM_FILE_END ++#define TARGET_ASM_FILE_END file_end_indicate_exec_stack ++ + struct gcc_target targetm = TARGET_INITIALIZER; + + #include "gt-mips.h" +diff --git a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S +index c7418db..e5f2762 100644 +--- a/libgcc/config/mips/crti.S b/libgcc/config/mips/crti.S +@@ -21,6 +21,10 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++ ++/* An executable stack is *not* required for these functions. */ ++ .section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. +Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +diff --git a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S +index 59d1a90..5cc03bf 100644 +--- a/libgcc/config/mips/crtn.S b/libgcc/config/mips/crtn.S +@@ -21,6 +21,9 @@ a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + ++/* An executable stack is *not* required for these functions. */ ++.section .note.GNU-stack,"",%progbits ++ + /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. +Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ + +diff --git a/libgcc/config/mips/mips16.S b/libgcc/config/mips/mips16
[OpenWrt-Devel] Missing 'noexecstack' in uClibc MIPS builds
Hi, I have been taking a look at some of the OpenWRT security hardening and discovered something puzzling. It seems that OpenWRT sets the relevant flag to require uClibc to build with NOEXECSTACK set. This is good. (For one introduction to NOEXECSTACK, see http://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart ) However on a MIPS build (specicially, a carambola2 target) on barrier breaker (and I think trunk, but I need to rerun my experiments there again) NX is missing from several uClibc .so files unless I hack an override in which is apparently the 'no-preferred' method. I had a chat on the uClibc list and they suggested I try different versions of binutils and of course the latest uClibc. So after much steep elarning curve I worked out how to do that with OpenWRT and the problem recurs. Currently the suspicision is now on gcc. In any case I thought at this point I would see if anyone else could repeat my findings before I delve much deeper. So I was hoping if some could take a MIPS build and do the following: * Download checksec from https://github.com/slimm609/checksec.sh * Run it over their generated rootfs as follows: cd taging_dir/target-x/root- ( in my case it was staging_dir/target-mips_34kc_uClibc-0.9.34-git/root-ar71xx ) for p in lib usr/lib sbin usr/sbin bin usr/bin ; do "$WRT_BUILDROOT_DIR"/checksec.sh/checksec.sh --dir $p ; done and see if NX is enable for at least all the uClibc libraries. It probably wont be for several of the packages at this stage, although I have a patch to force it without going through and fixing all the upstreams. When I ran the above test against x86 all uClibc libraries has NX set as expected. As an aside, I have a patch that will bring OpenWRT up to the September trunk of uClibc and the latest 2.24.51 binutils if anyone is interested cheers, --Andrew -- http://blog.oldcomputerjunk.net https://github.com/pastcompute Twitter: @pastcompute GPG: http://www.andrewmcdonnell.net/gpg.html ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Is this a bug? Busybox package can ignore TARGET_LDFLAGS
I noticed whilst playing with some settings that busybox seems to not honour any settings in the global TARGET_LDFLAGS variable (file: package/utils/busybox) I tested this by checking the build log and noting that an additional linker flag I patched into rules.mak was being ignored. I was wondering if this is actually an error, because in the situation where either CONFIG_BUSYBOX_USE_LIBRPC or CONFIG_BUSYBOX_CONFIG_PAM are set, LDFLAGS is exported as the value of $(TARGET_LDFLAGS) LDFLAGS is not passed through anywhere else in the file It should be noted that the busybox make also accepts EXTRA_LDFLAGS; possibly setting EXTRA_LDFLAGS=$(TARGET_LDFLAGS) might be a better way? (The reason I was doing this is because a linker flag I set in the TARGET_OPTIMIZATION config was being ignored by busybox and I discovered that busybox doesnt honour -Wl,-z, style flags) (Code extract:) ifdef CONFIG_BUSYBOX_USE_LIBRPC TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include export LDFLAGS=$(TARGET_LDFLAGS) LDLIBS += rpc endif ifdef CONFIG_BUSYBOX_CONFIG_PAM TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include export LDFLAGS=$(TARGET_LDFLAGS) LDLIBS += pam pam_misc pthread endif define Build/Compile +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \ CC="$(TARGET_CC)" \ CROSS_COMPILE="$(TARGET_CROSS)" \ KBUILD_HAVE_NLS=no \ EXTRA_CFLAGS="$(TARGET_CFLAGS)" \ ARCH="$(ARCH)" \ SKIP_STRIP=y \ LDLIBS="$(LDLIBS)" \ $(BB_MAKE_VERBOSE) \ all ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH][toolchain] Fix missing help text in DEVEL config menu
This patch completes missing help text for some options under CONFIG_DEVEL. Provides help for BINARY_FOLDER and DOWNLOAD_FOLDER, and reduces ambiguity in the help for BUILD_SUFFIX with an example. Signed-off-by: Andrew McDonnell --- Patch resend; this time with tab characters fixed and a component (toolchain) specified. Note, this should will also apply on Barrier Breaker. config/Config-devel.in | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/config/Config-devel.in b/config/Config-devel.in index 0931175..ab40091 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -15,10 +15,19 @@ menuconfig DEVEL config BINARY_FOLDER string "Binary folder" if DEVEL default "" + help + Store built firmware images and filesystem images in this directory. + If not set, uses './bin/$(BOARD)' config DOWNLOAD_FOLDER string "Download folder" if DEVEL default "" + help + Store downloaded source bundles in this directory. + If not set then defaults to './dl', which is removed by operations such as + 'git clean -xdf' or 'make distclean'. + This option is useful if you have a low bandwidth Internet connection, and by + setting a path outside the OpenWRT tree downloads will be saved. config LOCALMIRROR string "Local mirror for source packages" if DEVEL @@ -31,10 +40,12 @@ menuconfig DEVEL Automatically rebuild packages when their files change config BUILD_SUFFIX - string "Build suffix to append to the BUILD_DIR variable" if DEVEL + string "Build suffix to append to the target BUILD_DIR variable" if DEVEL default "" help - Build suffix to append to the BUILD_DIR variable, i.e: build_dir_suffix + Build suffix to append to the BUILD_DIR variable, i.e: './build_dir/{target-build-dir}_$(BUILD_SUFFIX)'. + This allows you to switch to a different .config whilst retaining all the build + objects generated by the first .config config TARGET_ROOTFS_DIR string "Override the default TARGET_ROOTFS_DIR variable" if DEVEL -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH/RFC] build: fix missing help text in DEVEL config menu
This patch completes missing help text for some options under CONFIG_DEVEL. Provides help for BINARY_FOLDER and DOWNLOAD_FOLDER, and reduces ambiguity in the help for BUILD_SUFFIX with an example. Signed-off-by: Andrew McDonnell --- Warning: my email client also seems to be munging tabs into spaces, can I resend this as an attachment instead? Question: This same patch also applies cleanly onto Barrier Breaker, do I need to resubmit it to backport it? config/Config-devel.in | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/config/Config-devel.in b/config/Config-devel.in index 0931175..ab40091 100644 --- a/config/Config-devel.in +++ b/config/Config-devel.in @@ -15,10 +15,19 @@ menuconfig DEVEL config BINARY_FOLDER string "Binary folder" if DEVEL default "" + help + Store built firmware images and filesystem images in this directory. + If not set, uses './bin/$(BOARD)' config DOWNLOAD_FOLDER string "Download folder" if DEVEL default "" + help + Store downloaded source bundles in this directory. + If not set then defaults to './dl', which is removed by operations such as + 'git clean -xdf' or 'make distclean'. + This option is useful if you have a low bandwidth Internet connection, and by + setting a path outside the OpenWRT tree downloads will be saved. config LOCALMIRROR string "Local mirror for source packages" if DEVEL @@ -31,10 +40,12 @@ menuconfig DEVEL Automatically rebuild packages when their files change config BUILD_SUFFIX - string "Build suffix to append to the BUILD_DIR variable" if DEVEL + string "Build suffix to append to the target BUILD_DIR variable" if DEVEL default "" help - Build suffix to append to the BUILD_DIR variable, i.e: build_dir_suffix + Build suffix to append to the BUILD_DIR variable, i.e: './build_dir/{target-build-dir}_$(BUILD_SUFFIX)'. + This allows you to switch to a different .config whilst retaining all the build + objects generated by the first .config config TARGET_ROOTFS_DIR string "Override the default TARGET_ROOTFS_DIR variable" if DEVEL ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Problem using 'dumpinfo' target
Hi, I seem to be hitting the bug described in detail here : https://dev.openwrt.org/ticket/14697 This is against Barrier Breaker latest git. Specifically, running any of the following : make DUMP=1 make DUMP=1 dumpinfo produces various error messages, because $(FIND_L) is never set to anything. If I fake it using make FIND_L="find -L" DUMP=1 dumpinfo I get a very large number of grep no such file or directory errors instead. All google yielded was the above ticket, and references into the OpenWRT source code. I would like to get the information that the dumpinfo target defined in target.mk produces, but I can't seem to find the right magic invocation needed... txia, Andrew -- http://blog.oldcomputerjunk.net https://github.com/pastcompute Twitter: @pastcompute ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: Allow for activation of second mdio bus in ar7242 / ag71xx driver
Hi Felix, I was wondering why there was something out on 18... if setting that to the phy mask makes everything work after all my debugging I will be very annoyed at myself for not posting my work sooner (and at DD-WRT!) Yes, this patch is not immediately needed for support for the rest of the DIR632 thanks again --Andrew On 14/05/13 23:03, Felix Fietkau wrote: > On 2013-05-14 3:22 PM, Andrew McDonnell wrote: >> Hi Felix >> >> at this stage I have had no luck getting eth1 to work so I have deliberately >> left out all the code attempting to make eth1 work. (I am intending to post >> my progress to my github but I am all coded out for tonight) >> >> But again, having no other point of reference I traced through the working >> DDWRT driver and discovered that eth1 in this board is connected to S26 >> internal switch and sends mdio commands over 0x1a00. >> >> An easy test is when the following is present in the mach-dir632-a1.c, and if >> you add debugging printks into the right places in ag71xx, you can see the >> kernel enumerating phys 0..8 and 18 in eth0 and phys 0..4 in eth1 and >> ag71xx_mdio.1.00 --> 05 shows up in /sys/class/mdio >> >> +ath79_register_mdio(1, 0); >> +ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; >> >> When I printk instrument the DD-WRT driver you can also see it writing to the >> mdio registers on 0x1a00 for eth1 >> >> I am new to how kernel ethernet drivers work so it is quite possible I am >> misunderstanding something or misinterpreting some output - and it is hard to >> find decent documentation on how all this works other than tracing kernel >> code >> and experimenting, and reading and instrumenting the working source code in >> DD-WRT. > With DD-WRT you have to keep in mind that it does not have proper > hardware/platform detection in the kernel. It simply registers a whole > bunch of stuff and then tries to fix up the mess in user space. You > should not use its register writes as a reference of what to do. > As for the changes enabling the second MDIO bus - I think we should hold > those back. It's more likely that your board shares the primary MDIO bus > between eth0 and eth1. You could try setting the PHY mask to BIT(18) for > eth1 (using mdio0) to make it attach to that PHY. > > - Felix > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: adds kernel target for the D-Link DIR-632-A1.
Hi Felix I can resubmit this without those, but I wont be able to test it for a couple of days and would prefer to wait until I have tested it, is that OK? thanks for the feedback --Andrew On 14/05/13 22:56, Felix Fietkau wrote: > On 2013-05-14 3:13 PM, Andrew McDonnell wrote: >> Hi Felix, >> >> Sorry, I'm still learning how this project works ... I have been trying to >> follow the patch submission checklist as best I can. >> >> Perhaps that adivce could be added to the guidelines on >> https://dev.openwrt.org/wiki/SubmittingPatches page, but I only worked out >> how >> to get edit access to other wiki http://wiki.openwrt.org/. Do you know where >> I can propose changes to the dev wiki? >> >> (I was confusing for quite a while when I started, being there is a forum and >> two wikis and a mailing list...) >> >> I think of the patches I have submmited just now, the MTD and the ring size >> are the only ones directly copied as such > What I mentioned is a general development issue that doesn't really fit > well into the SubmittingPatches howto. In general you should not submit > changes that are unnecessary and/or not well understood. > I wasn't objecting to copying stuff from DD-WRT per se, but more about > copying stuff from it without understanding it or knowing if it helps at > all. > I'm pretty sure that the MTD kernel config changes are wrong and not > needed for bringing up your board. > > - Felix > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: Allow for activation of second mdio bus in ar7242 / ag71xx driver
Hi Felix at this stage I have had no luck getting eth1 to work so I have deliberately left out all the code attempting to make eth1 work. (I am intending to post my progress to my github but I am all coded out for tonight) But again, having no other point of reference I traced through the working DDWRT driver and discovered that eth1 in this board is connected to S26 internal switch and sends mdio commands over 0x1a00. An easy test is when the following is present in the mach-dir632-a1.c, and if you add debugging printks into the right places in ag71xx, you can see the kernel enumerating phys 0..8 and 18 in eth0 and phys 0..4 in eth1 and ag71xx_mdio.1.00 --> 05 shows up in /sys/class/mdio + ath79_register_mdio(1, 0); + ath79_eth1_data.mii_bus_dev = &ath79_mdio1_device.dev; When I printk instrument the DD-WRT driver you can also see it writing to the mdio registers on 0x1a00 for eth1 I am new to how kernel ethernet drivers work so it is quite possible I am misunderstanding something or misinterpreting some output - and it is hard to find decent documentation on how all this works other than tracing kernel code and experimenting, and reading and instrumenting the working source code in DD-WRT. --Andrew On 14/05/13 22:39, Felix Fietkau wrote: > On 2013-05-14 2:30 PM, Andrew McDonnell wrote: >> >> This patch allows a board to enable the mdio bus on the second ethernet port >> provided by the AR7242 (as used in the D-Link DIR-632-A1.) The AR7242 (at >> least on the dir632) has two ethernet, eth0 at 0x1900 and eth1 at >> 0x1a00, and both have enumerable mdio busses. >> >> It further defaults to connecting eth1 to ag71xx-mdio.1 when registering eth1 >> with ath79 platform data. >> >> Please note this superseded prior email with missing subject(!) > Are you sure about this? In other AR724x SoCs one MDIO bus goes to the > built-in switch, and the other one is external. You don't seem to make > use of the second MDIO bus in your DIR-632-A1 patch either. > I think the AR7242 does not have the built-in switch, so it would > surprise me to see a second MDIO bus being used there. > > - Felix > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: adds kernel target for the D-Link DIR-632-A1.
Hi Felix, Sorry, I'm still learning how this project works ... I have been trying to follow the patch submission checklist as best I can. Perhaps that adivce could be added to the guidelines on https://dev.openwrt.org/wiki/SubmittingPatches page, but I only worked out how to get edit access to other wiki http://wiki.openwrt.org/. Do you know where I can propose changes to the dev wiki? (I was confusing for quite a while when I started, being there is a forum and two wikis and a mailing list...) I think of the patches I have submmited just now, the MTD and the ring size are the only ones directly copied as such --Andrew On 14/05/13 22:32, Felix Fietkau wrote: > On 2013-05-14 2:44 PM, Andrew McDonnell wrote: >> >> This patch adds a kernel target for the D-Link DIR-632-A1. >> >> Note that the CONFIG_MTD_CFI_I2 and BANK changes are duplicated from DD-WRT >> and the D-Link firmware; I think it is because this uses a different flash >> chip (mx25l6405d) from many of the other similar devices. > Please don't port random changes from DD-WRT that serve no real purpose > and aren't understood properly. The MTD related changes in that patch > are bogus and don't affect the SPI based flash chip in this board. > > - Felix > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: Allow platform configurable tx/rx ring size in ag71xx
Hi Felix, I am trying to port the DIR-632-A1 and made the most progress fixing the ag71xx to work on this board by following what the (working but differently architectured) DD-WRT driver for the AG7240 does. It sets ring sizes that are different from the defaults provided by OPenWRT. This was one of the changes I made early on before I finally got eth0 working, so it is possibly redundant, but I figured the developers chose those values for a reason and they work for me... Is the above too verbose? :-) Note, I am still gaining experience workng with Linux kernel ethernet drivers, so I dont deeply understand some of the code, but I am following proven working software and testing by transferring multiple large files. --Andrew On 14/05/13 22:28, Felix Fietkau wrote: > On 2013-05-14 2:33 PM, Andrew McDonnell wrote: >> >> This patch allows the platform to configure the default ethernet tx/rx ring >> size (specifcally, for the ar7242 ag7240 device as found in the D-Link >> DIR-632-A1). This patch only causes the platform data to be used if >> specifically initialised in the board specific support, otherwise the >> existing >> defaults remain in place. >> >> This change allows the DIR-632-A1 to set the ring sizes to the same values as >> is done in the DD-WRT ag7240 driver. > I can't think of any good reason to make the ring size platform specific > (and you didn't give one), so NACK from me. > > - Felix > > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Add platform machine support for the D-Link DIR-632-A1
This patch adds platform machine support for the D-Link DIR-632-A1. Currently eth1 is not supported as the ag71xx driver does not work with the AR7242 at least for all the configurations I have tested for this board. With this patch and the preceding patches, the DIR-632-A1 is fully usable for all use cases that do not require a separate WAN port. Tested succesfully: LEDs, 2x switches, wireless, eth0, USB2. Signed-off-by: Andrew McDonnell --- .../ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c | 391 1 files changed, 391 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c new file mode 100644 index 000..8744abf --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c @@ -0,0 +1,391 @@ +/* + * D-Link DIR-632 rev. A1 board support + * + * Copyright (C) 2013 Andrew McDonnell + * Copyright (C) 2010-2012 Gabor Juhos + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include "common.h" +#include "dev-common.h" +#include "dev-eth.h" +#include "dev-m25p80.h" +#include "dev-gpio-buttons.h" +#include "dev-leds-gpio.h" +#include "dev-ap9x-pci.h" +#include "dev-usb.h" +#include "machtypes.h" +#include "nvram.h" + +/* Set the following to zero to have a look at actual RAM when trying to find MAC addresses, etc. */ +#define DEBUG_CHECK_MEMORY_CONTENTS 1 + + /* Various in-memory items of interest: + * + * Memory Flash Description + * 1f04 04u-boot environment variables + * 1ffb0004 7b0004ASCII MAC address matching the case sticker. + * I suspect this is 'fixed' when you first execute + * setenv mac= in u-boot (which I inadvertently did) + * (mtd "MAC" partition) + * 1ffe 7eNVRAM (area prefix: "HSLF") + * (partway through factory mtd "LP" partition) + * 1fff 7fHardware MAC address for eth0, according to source + * code of DD-WRT and zRouter, except this MAC address + * is _different_ to the stickered MAC address. + * (mtd "ART" partition) + * 1fff0006 7f0006Hardware MAC address for eth1, according to source + * code of DD-WRT and zRouter, except this MAC address + * is set to ff:ff:ff:ff:ff:ff in my router. + * 1ff1 7f1000PCI EEPROM - "calibration data" + * 1ff1010c 7f110cPCI EEPROM - WLAN mac address reported in DD-WRT + * In my board this is set to 00:00:22:22:22:22 + * Which happens to be the same as the NVRAM value + * ath_hwaddr + */ + +/* Network architecture: + * + * eth0 --> 8309 switch - LAN + * eth1 --> S26 switch - WAN + * wlan0 --> PCI ath9k driver + */ + +#define ADDR_UBOOT 0x1f04 +#define ADDR_AMAC0x1ffb +#define ADDR_NVRAM 0x1ffe +#define ADDR_HMAC0x1fff +#define ADDR_PCIBASE 0x1fff +#define ADDR_EEPROM 0x1fff1000 + +#define EEPROM_WLAN_MAC_OFFSET 0x10c + +#define NVRAM_SIZE 0x1 + +#define DIR632_MAC0_OFFSET 0 +#define DIR632_MAC1_OFFSET 6 + +#define DIR632_AMAC_OFFSET 4 + +/* + + Known LED and GPIO Definitions, derived from + + http://zrouter.org/projects/zrouter/repository/entry/boards/D-Link/DIR-632/GPIO + http://zrouter.org/projects/zrouter/repository/entry/boards/D-Link/DIR-632/board.hints + + and from practical experimentation using the DD-WRT generic_leds and testing + +GPIO LED + 0 LED WPS (blue) + 1 LED STATUS (bicolour: orange) + 6 LED STATUS (bicolour: green) + 7 LED WAN (bicolour: orange) + 8 BUTTON Reset + 9 UART + 10UART + 11LED USB (green) + 12 BUTTON WPS + 13 Test point TP3 + 14 Test point TP4 + 15 Test point TP5 + 17LED WAN (bicolour: green) + +Additionally, the ATH9k has GPIO, specified for the LED in platform data + + 0 LED, WLAN (green) + +*/ + +#define DIR_632_A1_GPIO_LED_WPS0 +#define DIR_632_A1_GPIO_LED_POWER_AMBER1 +#define DIR_632_A1_GPIO_LED_POWER_GREEN6 +#define DIR_632_A1_GPIO_LED_WAN_AMBER 7 +#define DIR_632_A1_GPIO_LED_USB11 +#define DIR_632_A1_GPIO_LED_WAN_GREEN 17 + +#define DIR_632_A1_WLAN_GPIO_LED 0 + +#define DIR_632_A1_GPIO_BTN_RESET 8 +#define DIR_632_A1_GPIO_BTN_WPS12 + +#define DIR_632_A1_KEYS
[OpenWrt-Devel] [PATCH] ar71xx: adds kernel target for the D-Link DIR-632-A1.
This patch adds a kernel target for the D-Link DIR-632-A1. Note that the CONFIG_MTD_CFI_I2 and BANK changes are duplicated from DD-WRT and the D-Link firmware; I think it is because this uses a different flash chip (mx25l6405d) from many of the other similar devices. Signed-off-by: Andrew McDonnell --- target/linux/ar71xx/config-3.8 |4 +-- .../619-MIPS-ath79-add-DIR-632-A1-support.patch| 39 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/config-3.8 b/target/linux/ar71xx/config-3.8 index ea2be6b..7f3d4db 100644 --- a/target/linux/ar71xx/config-3.8 +++ b/target/linux/ar71xx/config-3.8 @@ -38,6 +38,7 @@ CONFIG_ATH79_MACH_CAP4200AG=y CONFIG_ATH79_MACH_DB120=y CONFIG_ATH79_MACH_DIR_600_A1=y CONFIG_ATH79_MACH_DIR_615_C1=y +CONFIG_ATH79_MACH_DIR_632_A1=y CONFIG_ATH79_MACH_DIR_825_B1=y CONFIG_ATH79_MACH_DIR_825_C1=y CONFIG_ATH79_MACH_EAP7660D=y @@ -191,12 +192,9 @@ CONFIG_MIPS_MT_DISABLED=y CONFIG_MODULES_USE_ELF_REL=y CONFIG_MTD_CFI_ADV_OPTIONS=y CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set # CONFIG_MTD_CFI_INTELEXT is not set CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_M25P80=y -# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set CONFIG_MTD_MYLOADER_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-2 diff --git a/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-DIR-632-A1-support.patch b/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-DIR-632-A1-support.patch new file mode 100644 index 000..b4c5bf2 --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/619-MIPS-ath79-add-DIR-632-A1-support.patch @@ -0,0 +1,39 @@ +--- a/arch/mips/ath79/Kconfig b/arch/mips/ath79/Kconfig +@@ -273,6 +273,16 @@ config ATH79_MACH_DIR_615_C1 + select ATH79_DEV_WMAC + select ATH79_NVRAM + ++config ATH79_MACH_DIR_632_A1 ++ bool "D-Link DIR-632 rev. A1 support" ++ select SOC_AR724X ++ select ATH79_DEV_ETH ++ select ATH79_DEV_GPIO_BUTTONS ++ select ATH79_DEV_LEDS_GPIO ++ select ATH79_DEV_M25P80 ++ select ATH79_DEV_USB ++ select ATH79_NVRAM ++ + config ATH79_MACH_DIR_825_B1 + bool "D-Link DIR-825 rev. B1 board support" + select SOC_AR71XX +--- a/arch/mips/ath79/machtypes.h b/arch/mips/ath79/machtypes.h +@@ -38,6 +38,7 @@ enum ath79_mach_type { + ATH79_MACH_DIR_600_A1, /* D-Link DIR-600 rev. A1 */ + ATH79_MACH_DIR_615_C1, /* D-Link DIR-615 rev. C1 */ + ATH79_MACH_DIR_615_E4, /* D-Link DIR-615 rev. E4 */ ++ ATH79_MACH_DIR_632_A1, /* D-Link DIR-632 rev. A1 */ + ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */ + ATH79_MACH_DIR_825_C1, /* D-Link DIR-825 rev. C1 */ + ATH79_MACH_DIR_835_A1, /* D-Link DIR-835 rev. A1 */ +--- a/arch/mips/ath79/Makefile b/arch/mips/ath79/Makefile +@@ -54,6 +54,7 @@ obj-$(CONFIG_ATH79_MACH_CAP4200AG) += ma + obj-$(CONFIG_ATH79_MACH_DB120)+= mach-db120.o + obj-$(CONFIG_ATH79_MACH_DIR_600_A1) += mach-dir-600-a1.o + obj-$(CONFIG_ATH79_MACH_DIR_615_C1) += mach-dir-615-c1.o ++obj-$(CONFIG_ATH79_MACH_DIR_632_A1) += mach-dir-632-a1.o + obj-$(CONFIG_ATH79_MACH_DIR_825_B1) += mach-dir-825-b1.o + obj-$(CONFIG_ATH79_MACH_DIR_825_C1) += mach-dir-825-c1.o + obj-$(CONFIG_ATH79_MACH_EW_DORIN) += mach-ew-dorin.o ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: add image build support for the D-Link DIR-632-A1
This patch adds image build support for the D-Link DIR-632-A1. Note the sizes are set based on the manufacturer upgrade image, but I think there is a lot of wasted space as the lzma compressed kernel is not as big as the space left here, so perhaps this could be improved in the future. Signed-off-by: Andrew McDonnell --- target/linux/ar71xx/image/Makefile | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index c6b4dc4..73e256d 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -174,6 +174,7 @@ cameo933x_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvra cameo934x_mtdlayout=mtdparts=spi0.0:64k(uboot)ro,64k(nvram)ro,1280k(kernel),14656k(rootfs),192k(lang)ro,64k(mac)ro,64k(art)ro,15936k@0x2(firmware) cap4200ag_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),320k(custom)ro,1536k(kernel),12096k(rootfs),2048k(failsafe),64k(art),13632k@0xa(firmware) db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x5(firmware) +dir632a1_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(nvram),1984k(linux),5568k(rootfs),64k(MAC),192k(LP),64k(ART)ro,7488k@0x5(firmware) debug loglevel=8 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x5(firmware),64k@0x7f(caldata_copy) dir825b1_mtdlayout_fat=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),6784k(rootfs),64k(caldata)ro,7808k@0x5(firmware),64k@0x66(caldata_orig),6208k@0x5(firmware_orig) ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1024k(kernel),2688k(rootfs),64k(art),3712k@0x5(firmware) @@ -359,6 +360,15 @@ define Image/Build/Cameo933x/initramfs $(call MkuImageLzma/initramfs,$(2),$(3) $(cameo933x_mtdlayout)) endef +define Image/Build/DIR632A1 + $(call Image/Build/Cameo,$(1),$(2),$(3),$(dir632a1_mtdlayout),2031616,5636096,$(4)) +endef + +define Image/Build/DIR632A1/initramfs + $(call MkuImageLzma/initramfs,$(2),$(3) $(dir632a1_mtdlayout)) +endef + + define Image/Build/Cameo934x $(call Image/Build/Cameo,$(1),$(2),$(3),$(cameo934x_mtdlayout),1310720,15007718,$(4)) endef @@ -864,6 +874,8 @@ $(eval $(call SingleProfile,Cameo934x,$(fs_64k),DIR835A1,dir-835-a1,DIR-835-A1,t $(eval $(call SingleProfile,CyberTAN,$(fs_64k),WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,1.00.01)) +$(eval $(call SingleProfile,DIR632A1,$(fs_squash),DIR632A1,dir-632-a1,DIR-632-A1,ttyS0,115200,"A101-AR7242-RT-100324-02")) + $(eval $(call SingleProfile,DIR825B1,$(fs_64k),DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00)) $(eval $(call SingleProfile,DIR825B1,$(fs_64k),TEW673GRU,tew-673gru,TEW-673GRU,ttyS0,115200,01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01)) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Add board profile for the D-Link DIR-632-A1
This patch adds a board profile for the D-Link DIR-632-A1, specifically, ensures that USB support is built in by default. Signed-off-by: Andrew McDonnell --- target/linux/ar71xx/generic/profiles/d-link.mk | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/generic/profiles/d-link.mk b/target/linux/ar71xx/generic/profiles/d-link.mk index f30e9b1..8c371a3e 100644 --- a/target/linux/ar71xx/generic/profiles/d-link.mk +++ b/target/linux/ar71xx/generic/profiles/d-link.mk @@ -50,6 +50,17 @@ endef $(eval $(call Profile,DIR615E4)) +define Profile/DIR632A1 + NAME:=D-Link DIR-632 rev. A1 + PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev +endef + +define Profile/DIR632A1/Description + Package set optimized for the D-Link DIR-632 rev. A1 +endef + +$(eval $(call Profile,DIR632A1)) + define Profile/DIR825B1 NAME:=D-Link DIR-825 rev. B1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Add user space support for the D-Link DIR-632-A1
This patch adds user space supoprt for the D-Link DIR-632-A1, specifically provides default LED behaviour and default bridge configuration and boot board platform check. Signed-off-by: Andrew McDonnell --- target/linux/ar71xx/base-files/etc/diag.sh |3 +++ .../ar71xx/base-files/etc/uci-defaults/01_leds |6 ++ .../ar71xx/base-files/etc/uci-defaults/02_network |8 .../etc/uci-defaults/03_network-switchX-migration |1 + target/linux/ar71xx/base-files/lib/ar71xx.sh |3 +++ .../ar71xx/base-files/lib/upgrade/platform.sh |1 + 6 files changed, 22 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index ed269b2..cd39f59 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -47,6 +47,9 @@ get_status_led() { dir-615-e4) status_led="d-link:green:power" ;; + dir-632-a1) + status_led="d-link:amber:power" + ;; dir-615-c1) status_led="d-link: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 6e3e370..0bf3a09 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -60,6 +60,12 @@ dir-615-e4) ucidef_set_led_switch "lan4" "LAN4" "d-link:green:lan4" "switch0" "0x10" ;; +dir-632-a1) + ucidef_set_led_usbdev "usb" "USB" "d-link:green:usb" "1-1" + ucidef_set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "d-link:green:wireless" "phy0tpt" + ;; + dir-825-b1 | \ dir-825-c1) ucidef_set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1" 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 a9a3ff2..c19b9e7 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -217,6 +217,14 @@ wpe72) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +dir-632-a1) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5 6 7 8" + ;; + + + ap121 |\ ap121-mini |\ ap96 |\ diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index 718a924..3bf74fe 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration @@ -57,6 +57,7 @@ ap121-mini|\ ap96|\ airrouter|\ dir-600-a1|\ +dir-632-a1|\ dir-615-c1|\ dir-615-e4|\ ja76pf|\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 194a40b..94437ef 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -237,6 +237,9 @@ ar71xx_board_detect() { *"DIR-615 rev. E4") name="dir-615-e4" ;; + *"DIR-632 rev. A1") + name="dir-632-a1" + ;; *"DIR-825 rev. B1") name="dir-825-b1" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 817123b..4410859 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -108,6 +108,7 @@ platform_check_image() { dir-600-a1 | \ dir-615-c1 | \ dir-615-e4 | \ + dir-632-a1 | \ dir-825-c1 | \ dir-835-a1 | \ ew-dorin | \ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Allow platform configurable tx/rx ring size in ag71xx
This patch allows the platform to configure the default ethernet tx/rx ring size (specifcally, for the ar7242 ag7240 device as found in the D-Link DIR-632-A1). This patch only causes the platform data to be used if specifically initialised in the board specific support, otherwise the existing defaults remain in place. This change allows the DIR-632-A1 to set the ring sizes to the same values as is done in the DD-WRT ag7240 driver. Signed-off-by: Andrew McDonnell --- .../mips/include/asm/mach-ath79/ag71xx_platform.h |3 +++ .../net/ethernet/atheros/ag71xx/ag71xx_main.c |6 ++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h index 656a6ef..dcc1170 100644 --- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h +++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h @@ -45,6 +45,9 @@ struct ag71xx_platform_data { u32 fifo_cfg1; u32 fifo_cfg2; u32 fifo_cfg3; + + unsignedtx_ring_size; + unsignedrx_ring_size; }; struct ag71xx_mdio_platform_data { diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index 50029ff..2e1d39e 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -1149,6 +1149,12 @@ static int ag71xx_probe(struct platform_device *pdev) ag->tx_ring.size = AG71XX_TX_RING_SIZE_DEFAULT; ag->rx_ring.size = AG71XX_RX_RING_SIZE_DEFAULT; + if (pdata->tx_ring_size > 0 && pdata->tx_ring_size < AG71XX_TX_RING_SIZE_MAX) { + ag->tx_ring.size = pdata->tx_ring_size; + } + if (pdata->rx_ring_size > 0 && pdata->rx_ring_size < AG71XX_RX_RING_SIZE_MAX) { + ag->rx_ring.size = pdata->rx_ring_size; + } ag->stop_desc = dma_alloc_coherent(NULL, sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL); ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Allow for activation of second mdio bus in ar7242 / ag71xx driver
This patch allows a board to enable the mdio bus on the second ethernet port provided by the AR7242 (as used in the D-Link DIR-632-A1.) The AR7242 (at least on the dir632) has two ethernet, eth0 at 0x1900 and eth1 at 0x1a00, and both have enumerable mdio busses. It further defaults to connecting eth1 to ag71xx-mdio.1 when registering eth1 with ath79 platform data. Please note this superseded prior email with missing subject(!) Signed-off-by: Andrew McDonnell --- .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index 47e1350..cbd782d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -183,6 +183,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) if (ath79_soc == ATH79_SOC_AR9341 || ath79_soc == ATH79_SOC_AR9342 || ath79_soc == ATH79_SOC_AR9344 || + ath79_soc == ATH79_SOC_AR7242 || ath79_soc == ATH79_SOC_QCA9556 || ath79_soc == ATH79_SOC_QCA9558) max_id = 1; @@ -202,6 +203,13 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) mdio_data = &ath79_mdio1_data; break; + case ATH79_SOC_AR7242: + ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, + AR7242_PLL_REG_ETH0_INT_CLOCK, 0x6200, + AR71XX_ETH0_PLL_SHIFT); + /* The driver in DD-WRT always has a 100ms delay after setting the PLL */ + udelay(100*1000); + /* fall through - the AR7242 has two eth ports */ case ATH79_SOC_AR9341: case ATH79_SOC_AR9342: case ATH79_SOC_AR9344: @@ -216,11 +224,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) } break; - case ATH79_SOC_AR7242: - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, - AR7242_PLL_REG_ETH0_INT_CLOCK, 0x6200, - AR71XX_ETH0_PLL_SHIFT); - /* fall through */ default: mdio_dev = &ath79_mdio0_device; mdio_data = &ath79_mdio0_data; @@ -236,7 +239,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) case ATH79_SOC_AR7241: mdio_data->builtin_switch = 1; break; - + case ATH79_SOC_AR7242: + if (id == 1) { + mdio_data->builtin_switch = 1; +} +break; case ATH79_SOC_AR9330: mdio_data->is_ar9330 = 1; /* fall through */ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx:
This patch allows a board to enable the mdio bus on the second ethernet port provided by the AR7242 (as used in the D-Link DIR-632-A1.) The AR7242 (at least on the dir632) has two ethernet, eth0 at 0x1900 and eth1 at 0x1a00, and both have enumerable mdio busses. It further defaults to connecting eth1 to ag71xx-mdio.1 when registering eth1 with ath79 platform data. Signed-off-by: Andrew McDonnell --- .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c | 19 +-- 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index 47e1350..cbd782d 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -183,6 +183,7 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) if (ath79_soc == ATH79_SOC_AR9341 || ath79_soc == ATH79_SOC_AR9342 || ath79_soc == ATH79_SOC_AR9344 || + ath79_soc == ATH79_SOC_AR7242 || ath79_soc == ATH79_SOC_QCA9556 || ath79_soc == ATH79_SOC_QCA9558) max_id = 1; @@ -202,6 +203,13 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) mdio_data = &ath79_mdio1_data; break; + case ATH79_SOC_AR7242: + ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, + AR7242_PLL_REG_ETH0_INT_CLOCK, 0x6200, + AR71XX_ETH0_PLL_SHIFT); + /* The driver in DD-WRT always has a 100ms delay after setting the PLL */ + udelay(100*1000); + /* fall through - the AR7242 has two eth ports */ case ATH79_SOC_AR9341: case ATH79_SOC_AR9342: case ATH79_SOC_AR9344: @@ -216,11 +224,6 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) } break; - case ATH79_SOC_AR7242: - ath79_set_pll(AR71XX_PLL_REG_SEC_CONFIG, - AR7242_PLL_REG_ETH0_INT_CLOCK, 0x6200, - AR71XX_ETH0_PLL_SHIFT); - /* fall through */ default: mdio_dev = &ath79_mdio0_device; mdio_data = &ath79_mdio0_data; @@ -236,7 +239,11 @@ void __init ath79_register_mdio(unsigned int id, u32 phy_mask) case ATH79_SOC_AR7241: mdio_data->builtin_switch = 1; break; - + case ATH79_SOC_AR7242: + if (id == 1) { + mdio_data->builtin_switch = 1; +} +break; case ATH79_SOC_AR9330: mdio_data->is_ar9330 = 1; /* fall through */ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Add missing GPIO function bits for AR7242
This patch adds GPIO function enable/disable bits for the AR7242, as derived from the D-Link GPL firmware sources for the DIR-632-A1. Note that of these, AR724X_GPIO_FUNCTION_CLK_OBS6_ENABLE and AR724X_GPIO_FUNCTION_PCIEPHY_TST_EN are explicitly cleared by the D-Link sources. I suspect these bits are necessary to enable the test pin GPIOs although I havent had a chance to scientifically verify this. Signed-off-by: Andrew McDonnell --- .../902-MIPS-ath79-ar7274-gpio-functions.patch | 26 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/target/linux/ar71xx/patches-3.8/902-MIPS-ath79-ar7274-gpio-functions.patch b/target/linux/ar71xx/patches-3.8/902-MIPS-ath79-ar7274-gpio-functions.patch new file mode 100644 index 000..9ea2276 --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/902-MIPS-ath79-ar7274-gpio-functions.patch @@ -0,0 +1,26 @@ +--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +@@ -672,8 +672,23 @@ + #define AR71XX_GPIO_FUNC_USB_OC_ENBIT(4) + #define AR71XX_GPIO_FUNC_USB_CLK_EN BIT(0) + ++#define AR724X_GPIO_FUNCTION_SPDIF2TCK_EN BIT(31) ++#define AR724X_GPIO_FUNCTION_SPDIF_EN BIT(30) ++#define AR724X_GPIO_FUNCTION_I2S_GPIO_18_22_EN BIT(29) ++#define AR724X_GPIO_FUNCTION_I2S_REFCLKEN BIT(28) ++#define AR724X_GPIO_FUNCTION_I2S_MCKEN BIT(27) ++#define AR724X_GPIO_FUNCTION_I2S0_ENBIT(26) ++#define AR724X_GPIO_FUNCTION_ETH_SWITCH_LED_DUPL_EN BIT(25) ++#define AR724X_GPIO_FUNCTION_ETH_SWITCH_LED_COLLBIT(24) ++#define AR724X_GPIO_FUNCTION_ETH_SWITCH_LED_ACTVBIT(23) ++#define AR724X_GPIO_FUNCTION_PLL_SHIFT_EN BIT(22) ++#define AR724X_GPIO_FUNCTION_EXT_MDIO_SEL BIT(21) ++#define AR724X_GPIO_FUNCTION_CLK_OBS6_ENABLEBIT(20) + #define AR724X_GPIO_FUNC_GE0_MII_CLK_EN BIT(19) + #define AR724X_GPIO_FUNC_SPI_EN BIT(18) ++#define AR724X_GPIO_FUNCTION_DDR_DQOE_ENBIT(17) ++#define AR724X_GPIO_FUNCTION_PCIEPHY_TST_EN BIT(16) ++#define AR724X_GPIO_FUNCTION_S26_UART_DISABLE BIT(15) + #define AR724X_GPIO_FUNC_SPI_CS_EN2 BIT(14) + #define AR724X_GPIO_FUNC_SPI_CS_EN1 BIT(13) + #define AR724X_GPIO_FUNC_CLK_OBS5_EN BIT(12) ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: WARN instead of BUG when an invalid speed indicated via platform data of ag71xx
This patch causes a kernel WARN stacktrace and falls back to a default 100mbit, instead of a BUG and panicing the kernel, when an invalid speed is pased to ath79_mii_ctrl_set_speed() via incorrect platform data settings. This makes debugging slightly easier when working with a board (such as the dir632a1) for which u-boot has broken TFTP and you dont have nearby a suitable browser/operating system combination for restoring the firmware via the factory recovery mechanism. Signed-off-by: Andrew McDonnell --- .../linux/ar71xx/files/arch/mips/ath79/dev-eth.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c index d7f3595..47e1350 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c @@ -134,7 +134,9 @@ static void ath79_mii_ctrl_set_speed(unsigned int reg, unsigned int speed) mii_speed = AR71XX_MII_CTRL_SPEED_1000; break; default: - BUG(); + WARN(1, "ath79_mii_ctrl_set_speed(): invalid speed (%d), fallback to %d\n", speed, SPEED_100); + mii_speed = AR71XX_MII_CTRL_SPEED_100; +break; } base = ioremap(AR71XX_MII_BASE, AR71XX_MII_SIZE); ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: Add AG7240+S26+8309 network driver to enable support of DIR-632-A1 (supersedes previous emails for this patch)
Hi Jonas, I eventually managed to get eth0 to work, without too much effort as it turns out, once I concentrated on the ethernet and understood how the platform data hangs together. Fixing eth1, on the otherhand, has caused me several late nights with no reward (more below) So shortly I will submit a series of patches to add support for the DIR632 - without eth1 (wan) functionality working. Hopefully they conform as required... I have other tasks that need my attention for a while, and fixing eth1 needs input from people who have more experience working with ethernet drivers :-) At least, this will allow the DIR-632 to be added as 'partial support', and usable by anyone who has a use case that doesn't require the wan port (e.g. wireless repeater, basic switch, etc.) If they badly need wan support they can use my unofficial patches for the interim With eth1, after a couple of false starts and fixing obvious things like being able to register platform mdio.1, I ended up instrumenting DD-WRT to trace every register write, switch register and mdio write, and it appears that the ar71xx_ag7240.c has quite a lot of differences - where the DD-WRT driver writes to many registers on the switch and mdio that are not touched by OpenWRT. I started by naively adding the missing calls, but then finally stalled when I realised there is a whole interrupt handler missing from openwrt. If you like I can post my partial work to my github or here, but first I want to get the rest of the board into the trunk if at all possible. hope this helps, Andrew On 30/04/13 21:41, Jonas Gorski wrote: > On Tue, Apr 30, 2013 at 1:58 PM, Andrew McDonnell > wrote: >> >> This patch adds ethernet and switch support - ag7240 ethernet driver >> incorporating RTL8309 switch and S26 switch support - for the D-link DIR 632 >> router (hardware version A1) based on DD-WRT r20421. I added Linux platform >> support for integration with OpenWRT. > > NACK. There already is a ethernet driver for ar7240 (ag71xx) including > switch support, so let's rather fix there what's wrong if it doesn't > work for the DIR-632 A1; everything else is a maintenance nightmare. > > > Jonas > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH] ar71xx: Add AG7240+S26+8309 network driver to enable support of DIR-632-A1 (supersedes previous emails for this patch)
Fair enough ... I tried early on and couldn't make that driver work, attempting network traffic on eth0 would hang the system, and there was no kernel panic stack to help Now that everything else is working I can give it another try. I have learned rather a bit more about this architecture since - but I wanted to get the board support out for others to test out. On 30/04/13 21:41, Jonas Gorski wrote: > On Tue, Apr 30, 2013 at 1:58 PM, Andrew McDonnell > wrote: >> >> This patch adds ethernet and switch support - ag7240 ethernet driver >> incorporating RTL8309 switch and S26 switch support - for the D-link DIR 632 >> router (hardware version A1) based on DD-WRT r20421. I added Linux platform >> support for integration with OpenWRT. > > NACK. There already is a ethernet driver for ar7240 (ag71xx) including > switch support, so let's rather fix there what's wrong if it doesn't > work for the DIR-632 A1; everything else is a maintenance nightmare. > > > Jonas > ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] ar71xx: Add support for DIR-632-A1 router (supersedes previous emails for this patch)
This patch adds board support for the D-link DIR-632-A1. Requires other patch adding AG7240+S26+8309 support for Ethernet; tested net, wlan, USB, buttons and LEDs Signed-off-by: Andrew McDonnell --- target/linux/ar71xx/base-files/etc/diag.sh |3 + .../ar71xx/base-files/etc/uci-defaults/01_leds |6 + .../ar71xx/base-files/etc/uci-defaults/02_network |8 + .../etc/uci-defaults/03_network-switchX-migration |1 + target/linux/ar71xx/base-files/lib/ar71xx.sh |3 + .../ar71xx/base-files/lib/upgrade/platform.sh |1 + target/linux/ar71xx/config-3.8 | 29 ++- .../ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c | 433 .../mips/include/asm/mach-ath79/ag71xx_platform.h |6 + target/linux/ar71xx/generic/profiles/d-link.mk | 11 + target/linux/ar71xx/image/Makefile | 12 + .../619-MIPS-ath79-add-DIR-632-A1-support.patch| 47 +++ .../902-MIPS-ath79-ar7274-gpio-functions.patch | 26 ++ 13 files changed, 583 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 708e2c5..2afd4c6 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -47,6 +47,9 @@ get_status_led() { dir-615-e4) status_led="d-link:green:power" ;; + dir-632-a1) + status_led="d-link:amber:power" + ;; dir-615-c1) status_led="d-link: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 afeae42..e023ba8 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -60,6 +60,12 @@ dir-615-e4) ucidef_set_led_switch "lan4" "LAN4" "d-link:green:lan4" "switch0" "0x10" ;; +dir-632-a1) + ucidef_set_led_usbdev "usb" "USB" "d-link:green:usb" "1-1" + ucidef_set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "d-link:green:wireless" "phy0tpt" + ;; + dir-825-b1 | \ dir-825-c1) ucidef_set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1" 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 ca58a39..13b4a55 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network @@ -216,6 +216,14 @@ wpe72) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +dir-632-a1) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5 6 7 8" + ;; + + + ap121 |\ ap121-mini |\ ap96 |\ diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index 718a924..3bf74fe 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration @@ -57,6 +57,7 @@ ap121-mini|\ ap96|\ airrouter|\ dir-600-a1|\ +dir-632-a1|\ dir-615-c1|\ dir-615-e4|\ ja76pf|\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index b7056f2..2a15923 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -222,6 +222,9 @@ ar71xx_board_detect() { *"DIR-615 rev. E4") name="dir-615-e4" ;; + *"DIR-632 rev. A1") + name="dir-632-a1" + ;; *"DIR-825 rev. B1") name="dir-825-b1" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 85e9d61..1b82d38 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -108,6 +108,7 @@ platform_check_image() { dir-600-a1 | \ dir-615-c1 | \ dir-615-e4 | \ + dir-632-a1 | \ dir-825-c1 | \ dir-835-a1 | \ ew-dorin | \ diff --git a/target/linux/ar71xx/config-3.8 b/target/linux/ar71xx/config-3.8 index 32393fb..2393f7e 100644 --- a/target/linux/ar71xx/config-3.8 +++ b/targ
[OpenWrt-Devel] [PATCH 1/2] [ar71xx] Support for DIR-632-A1 - board support
This patch adds board support for the D-link DIR 632 router (hardware version A1) based on trunk r36419. Signed-off-by: Andrew McDonnell --- This patch alone does not enable ethernet and switch support; patch 2/2 following adds support for the AG7242+RTL8309+S26 necessary to complete support for this router. Together the patches should allow tickets 13079 and 13069 to be closed. USB tested OK using USB storage. LEDs tested OK. SPI flash tested OK. Note: the bi-colour LEDS for status/power and WAN only work in orange and not green (for power/status) and green and not orange (for WAN). target/linux/ar71xx/base-files/etc/diag.sh |3 + .../ar71xx/base-files/etc/uci-defaults/01_leds |6 + .../ar71xx/base-files/etc/uci-defaults/02_network |8 + .../etc/uci-defaults/03_network-switchX-migration |1 + target/linux/ar71xx/base-files/lib/ar71xx.sh |3 + .../ar71xx/base-files/lib/upgrade/platform.sh |1 + target/linux/ar71xx/config-3.8 | 29 ++- .../ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c | 394 .../mips/include/asm/mach-ath79/ag71xx_platform.h |6 + target/linux/ar71xx/generic/profiles/d-link.mk | 11 + target/linux/ar71xx/image/Makefile | 12 + .../617-MIPS-ath79-add-DIR-632-A1-support.patch| 47 +++ diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index c107f41..fa0c476 100755 @@ -47,6 +47,9 @@ get_status_led() { dir-615-e4) status_led="d-link:green:power" ;; + dir-632-a1) + status_led="d-link:amber:power" + ;; dir-615-c1) status_led="d-link: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 afeae42..e023ba8 100755 @@ -60,6 +60,12 @@ dir-615-e4) ucidef_set_led_switch "lan4" "LAN4" "d-link:green:lan4" "switch0" "0x10" ;; +dir-632-a1) + ucidef_set_led_usbdev "usb" "USB" "d-link:green:usb" "1-1" + ucidef_set_led_netdev "wan" "WAN" "d-link:green:wan" "eth1" + ucidef_set_led_wlan "wlan" "WLAN" "d-link:green:wireless" "phy0tpt" + ;; + dir-825-b1 | \ dir-825-c1) ucidef_set_led_usbdev "usb" "USB" "d-link:blue:usb" "1-1" 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 0329ea5..9bd2f07 100755 @@ -214,6 +214,14 @@ wpe72) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; +dir-632-a1) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4 5 6 7 8" + ;; + + + ap121 |\ ap121-mini |\ ap96 |\ diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration b/target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration index 718a924..3bf74fe 100755 @@ -57,6 +57,7 @@ ap121-mini|\ ap96|\ airrouter|\ dir-600-a1|\ +dir-632-a1|\ dir-615-c1|\ dir-615-e4|\ ja76pf|\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index a9e063b..cb8b642 100755 @@ -219,6 +219,9 @@ ar71xx_board_detect() { *"DIR-615 rev. E4") name="dir-615-e4" ;; + *"DIR-632 rev. A1") + name="dir-632-a1" + ;; *"DIR-825 rev. B1") name="dir-825-b1" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 8f2f610..7e7d05d 100755 @@ -108,6 +108,7 @@ platform_check_image() { dir-600-a1 | \ dir-615-c1 | \ dir-615-e4 | \ + dir-632-a1 | \ dir-825-c1 | \ dir-835-a1 | \ ew-dorin | \ diff --git a/target/linux/ar71xx/config-3.8 b/target/linux/ar71xx/config-3.8 index 847b9a5..02147bd 100644 @@ -2,6 +2,27 @@ CONFIG_AG71XX=y CONFIG_AG71XX_AR8216_SUPPORT=y # CONFIG_AG71XX_DEBUG is not set # CONFIG_AG71XX_DEBUG_FS is not set +CONFIG_AG7240=y +# CONFIG_AG7240_GE0_GMII is not set +CONFIG_AG7240_GE0_IS_CONNECTED=y +CONFIG_AG7240_GE0_MII=y +# CONFIG_AG7240_GE0_RGMII is not set +CONFIG_AG7240_GE1_IS_CONNECTED=y +CONFIG_AG7240_GE1_MII=y +CONFIG_AG7240_MAC_LOCATION=0x1fff +CONFIG_AG7240_NUMBER_RX_PKTS=252 +CONFIG_AG7240_NUMBER_TX_PKTS=80 +# CONFIG_AG7240_USE_TRC is not set +CONFIG_AR7240_S26_PHY=y +# CONF
Re: [OpenWrt-Devel] [PATCH] [ar71xx] Add support for D-link DIR, 632 A1 router
In follow up, in further testing it seems the problem with the switch and the LEDS have resolved themselves - I have confirmed in my latest image that USB LED works, WLAN LED works, WAN LED works, and devices on the switch can ping each other. So only the minor issue of changing the colour of the power/status LED remains (and the stacktrace) --Andrew -- https://launchpad.net/~andymc73 http://blog.oldcomputerjunk.net Twitter: @andymc73 GPG: http://www.andrewmcdonnell.net/gpg.html ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] [ar71xx] Add support for D-link DIR 632 A1 router
This patch adds support for the D-link DIR 632 router (hardware version A1) Signed-off-by: Andrew McDonnell --- Notes: This patch is 420kb. Maybe I am doing something wrong :-| Given the entirety is to add support for a single device I am not sure how to logically split it - perhaps separate the ag7240 from the rest? Anyway, iaw. the patch submission guidelines I have uploaded it to github for the time being instead of inline here: https://raw.github.com/andymc73/openwrt-dir632/master/patch-dir632.txt This router has 8mb flash, 32m RAM, 8-port switch, WLAN, USB2 This should be considered 'beta'. I have the following bugs I havent managed to solve yet, now would be a great time for other sets of eyes: 0. To get any network at all I had to port the ag7240 device driver from DD-WRT. This brings over more than a dozen files. I think this is needed because switchs dont seem to connect properly when using the ar71xx_ag7240 driver already present in OpenWRT. I converted it to a platform device so the MAC addresses could be passed through from the init function. 1. The switch isn't "switching" - computers plugged into the switch can talk to the router but not each other. Hopefully just a boot configuration issue. 2. Wifi needs to be turned on as follows before it will work: uci set wireless.radio0.disabled=0 ; wifi up 3. Kernel - the wlan LED doesnt work yet 4. Kernel - the Power/Status LED only works in Orange (should be able to be Green as well) 5. Kernel - the WAN LED only works in Green (should be able to be in Orange as well) 6. Kernel - I was getting a 'warn_slowpath_common' stacktrace once in the kernel when the first packet is processed in the router, but it doesnt seem to affect performance 7. MAC addresses - I am not sure what the policy should be - the factory sets them all to the stickered MAC address, but DD-WRT reads a different MAC address from the ART partition. Currently I set the stickered MAC as the default for the WLAN, and use the ART for default eth0, and the ART 6th octet+1 for default eth1. 8. The LEDS dont seem to be doing the right thing in user space - at one point I had power/status flashing at boot but it doesn't currently Finally, could someone kindly please let me know how to make git diff put the line of = in between each file? :-) target/linux/ar71xx/base-files/etc/diag.sh |3 + .../ar71xx/base-files/etc/uci-defaults/01_leds |6 + .../ar71xx/base-files/etc/uci-defaults/02_network |8 + target/linux/ar71xx/base-files/lib/ar71xx.sh |3 + .../ar71xx/base-files/lib/upgrade/platform.sh |1 + target/linux/ar71xx/config-3.8 | 26 +- .../ar71xx/files/arch/mips/ath79/mach-dir-632-a1.c | 403 +++ .../mips/include/asm/mach-ath79/ag71xx_platform.h |6 + .../drivers/net/ethernet/atheros/ag7240/Kconfig| 124 + .../drivers/net/ethernet/atheros/ag7240/Makefile | 14 + .../drivers/net/ethernet/atheros/ag7240/ag7240.c | 2584 .../drivers/net/ethernet/atheros/ag7240/ag7240.h | 706 ++ .../net/ethernet/atheros/ag7240/ag7240_phy.h | 169 ++ .../net/ethernet/atheros/ag7240/ag7240_trc.h | 99 + .../drivers/net/ethernet/atheros/ag7240/ar7240.h | 984 .../net/ethernet/atheros/ag7240/ar7240_s26_phy.c | 1431 +++ .../ethernet/atheros/ag7240/ar7240_s26_phy.c.new | 1386 +++ .../net/ethernet/atheros/ag7240/ar7240_s26_phy.h | 224 ++ .../drivers/net/ethernet/atheros/ag7240/ar8216.c | 843 +++ .../drivers/net/ethernet/atheros/ag7240/ar8216.h | 187 ++ .../net/ethernet/atheros/ag7240/athrf1_phy.c | 385 +++ .../net/ethernet/atheros/ag7240/athrf1_phy.h | 26 + .../net/ethernet/atheros/ag7240/athrs16_phy.c | 896 +++ .../net/ethernet/atheros/ag7240/athrs16_phy.h | 245 ++ .../net/ethernet/atheros/ag7240/athrs_ioctl.h | 135 + .../net/ethernet/atheros/ag7240/athrs_qos.c| 196 ++ .../net/ethernet/atheros/ag7240/athrs_qos.h| 289 +++ .../drivers/net/ethernet/atheros/ag7240/eth_diag.h | 65 + .../net/ethernet/atheros/ag7240/python_vlan_igmp.c | 686 ++ .../net/ethernet/atheros/ag7240/rtl8309g_phy.c | 245 ++ .../net/ethernet/atheros/ag7240/rtl8309g_phy.h | 35 + .../net/ethernet/atheros/ag7240/tools/Makefile | 47 + .../net/ethernet/atheros/ag7240/tools/Makefile.inc | 84 + .../net/ethernet/atheros/ag7240/tools/ethreg.c | 141 ++ target/linux/ar71xx/generic/profiles/d-link.mk | 11 + target/linux/ar71xx/image/Makefile | 12 + .../617-MIPS-ath79-add-DIR-632-A1-support.patch| 39 + .../620-net-add-ag7240-driver-for-DIR-632-A1.patch | 19 + 38 files changed, 12760 insertions(+), 3 deletions(-) Applies against git clone SHA 5feba677c1d207c9a25ae47ea728bb9c795b2797 "feeds: fix syntax error" https://raw.github.c
[OpenWrt-Devel] Porting of D-link DIR-632-A1 router - patches coming soon
Hello all, After a few late nights I have managed to get this router working under OpenWRT. This is my first contribution to OpenWRT, so far I have posted to the DIR632 forum and added Debricking instructions to the related wiki page, now I am about to work my way through the OpenWrt patch submission guide at https://dev.openwrt.org/wiki/SubmittingPatches. Constructive feedback greatly welcomed :-) (By way of introduction - my blog is at http://oldcomputerjunk.net ) thanks, --Andrew -- https://launchpad.net/~andymc73 http://blog.oldcomputerjunk.net Twitter: @andymc73 GPG: http://www.andrewmcdonnell.net/gpg.html signature.asc Description: OpenPGP digital signature ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel