Re: [OpenWrt-Devel] [PATCH] ZRAM: enhacements including /tmp on ZRAM for Barrier Breaker
we wont backport this to AA and probably not to BB until it is properly tested in CC On 03/12/2014 04:55, Fernando Frediani wrote: Hi all, It would be great if someone could port ZRAM to AA so it can be used on 16MB devices too. Despite the kernel version doesn't have it, it had several ports that work on that version. By the way. As BB has it natively (I suppose), has anyone used BB with ZRAM stably on 16MB devices (e.g: WRT54GL) ? Thanks Regards, Fernando On 02/12/2014 11:16, John Crispin wrote: i just pushed a an alternate patch that fixes the problem. please test it and let me know the results John On 22/10/2014 09:20, Tomasz Wasiak wrote: Devices with less memory are still common so why limit ZRAM usage just to swap when it could be very useful as for /tmp storage. This patch changes 3 things: - sets default number of ZRAM devices to 2 (1st for /tmp, 2nd for swap) - adds ZRAM (default) support to procd's init (TMPFS is used when ZRAM is not available - changes zram-swap so it will use /dev/zram1 for 1st CPU, /dev/zram2 for 2nd and so on as /dev/zram0 is in use for /tmp. Signed-off-by: Tomasz Wasiak tjwas...@gmail.com --- package/system/procd/patches/procd-support_for_tmp_on_zram.patch | 185 ++ package/system/zram-swap/files/zram.init | 15 target/linux/generic/patches-3.10/998_zram_make_2_devices_by_default.patch | 11 3 files changed, 203 insertions(+), 8 deletions(-) --- a/package/system/procd/patches/procd-support_for_tmo_on_zram.patch +++ b/package/system/procd/patches/procd-support_for_tmp_on_zram.patch @@ -0,0 +1,185 @@ +--- a/initd/early.c b/initd/early.c +@@ -12,34 +12,130 @@ + * GNU General Public License for more details. + */ + +-#include sys/mount.h +-#include sys/types.h +-#include sys/stat.h +- +-#include stdio.h ++#include errno.h + #include fcntl.h +-#include unistd.h ++#include stdio.h + #include stdlib.h ++#include string.h ++#include strings.h ++#include unistd.h ++#include sys/mount.h ++#include sys/stat.h ++#include sys/types.h ++#include sys/wait.h + + #include ../log.h + #include init.h + ++static long ++check_ramsize(void) ++{ ++FILE *fp; ++char line[256]; ++char *key; ++long val = 0; ++ ++fp = fopen(/proc/meminfo, r); ++if(fp == NULL) ++{ ++ERROR(Can't open /proc/meminfo: %s\n, strerror(errno)); ++return errno; ++} ++ ++while(fgets(line, sizeof(line), fp)) ++{ ++key = strtok(line, :); ++val = atol(strtok(NULL, kB\n)); ++ ++if (!key || !val) ++continue; ++ ++if (!strcasecmp(key, MemTotal)) ++break; ++} ++ ++fclose(fp); ++ ++return val; ++} ++ ++static int ++mount_zram_on_tmp(void) ++{ ++FILE *fp; ++long zramsize = (check_ramsize() / 2); ++pid_t pid; ++ ++if(!zramsize) ++{ ++ERROR(Can't read size of RAM. Assuming 16 MB.\n); ++zramsize = 8192; ++} ++ ++fp = fopen(/sys/block/zram0/disksize, r+); ++if(fp == NULL) ++{ ++ERROR(Can't open /sys/block/zram0/disksize: %s\n, strerror(errno)); ++return errno; ++} ++ ++fprintf(fp, %ld, (zramsize * 1024)); ++ ++fclose(fp); ++ ++pid = fork(); ++ ++if (!pid) ++{ ++char *mkfs[] = { /sbin/mke2fs, -b, 4096, -F, -L, TEMP, -m, 0, /dev/zram0, NULL }; ++int fd = open(/dev/null, O_RDWR); ++ ++if (fd -1) { ++dup2(fd, STDIN_FILENO); ++dup2(fd, STDOUT_FILENO); ++dup2(fd, STDERR_FILENO); ++if (fd STDERR_FILENO) ++close(fd); ++} ++ ++execvp(mkfs[0], mkfs); ++ERROR(Can't exec /sbin/mke2fs\n); ++exit(-1); ++} ++ ++if (pid = 0) ++{ ++ERROR(Can't exec /sbin/mke2fs\n); ++return -1; ++} else { ++waitpid(pid, NULL, 0); ++} ++ ++if(mount(/dev/zram0, /tmp, ext2, MS_NOSUID | MS_NODEV | MS_NOATIME, check=none,errors=continue,noquota) 0) ++{ ++ERROR(Can't mount /dev/zram0 on /tmp: %s\n, strerror(errno)); ++return errno; ++} ++ ++LOG(Using up to %ld kB of RAM as ZRAM storage on /mnt\n, zramsize); ++return 0; ++} ++ + static void +-early_mounts(void) ++mount_tmpfs_on_tmp(void) + { +-mount(proc, /proc, proc, MS_NOATIME, 0); +-mount(sysfs, /sys, sysfs, MS_NOATIME, 0); ++char line[256]; ++long tmpfssize = (check_ramsize() / 2); + +-mount(tmpfs, /tmp, tmpfs, MS_NOSUID | MS_NODEV | MS_NOATIME, NULL); +-mkdir(/tmp/run, 0777); +-mkdir(/tmp/lock, 0777); +-mkdir(/tmp/state, 0777); +-symlink(/tmp, /var); ++if(!tmpfssize) ++{ ++ERROR(Can't read size of RAM. Assuming 16 MB.\n); ++tmpfssize = 8192; ++} + +-
Re: [OpenWrt-Devel] [PATCH RFC] broadcom-wl: use CCMP by default for WPA (version 1)
On 03/12/2014 07:10, Rafał Miłecki wrote: Honestly, I don't know what is this file for. I don't understand netifd wireless well at all. I asked for help in the Request for any netifd wireless documentation e-mail thread, but ppl who know /things/ ignored me. can you narrow down your questions to specific things you don't understand ? a global i don't understand it is hard to resolve. in general there are 2 files * /lib/wifi/*.sh - the legacy layer used for probing the hw during wifi detect * /lib/netfid/wireless/*.sh the new netifd wifi layer which of the 2 is causing /problems/ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/4] netifd: Fix restore of original device settings
Don't restore original device settings based on the device settings flags in system_if_down as device flags are already reset when the device config is deleted. Therefore move the masking of the relevant original device settings to system_if_up. Signed-off-by: Hans Dedecker dedec...@gmail.com --- system-linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system-linux.c b/system-linux.c index ed69bef..4662bf8 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1033,6 +1033,8 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned int system_if_up(struct device *dev) { system_if_get_settings(dev, dev-orig_settings); + /* Only keep orig settings based on what needs to be set */ + dev-orig_settings.flags = dev-settings.flags; system_if_apply_settings(dev, dev-settings, dev-settings.flags); return system_if_flags(dev-ifname, IFF_UP, 0); } @@ -1040,7 +1042,6 @@ int system_if_up(struct device *dev) int system_if_down(struct device *dev) { int ret = system_if_flags(dev-ifname, 0, IFF_UP); - dev-orig_settings.flags = dev-settings.flags; system_if_apply_settings(dev, dev-orig_settings, dev-orig_settings.flags); return ret; } -- 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 2/4] netifd: Fix proto shell setup/teardwon race condition
Fix setup race condition when proto shell is in teardown or setup_abort state when setup cmd is received. Don't change the proto shell state and launch no setup in these conditions so the proto shell teardown timeout handler does not kill the wrong processes and proto_shell_task_finish takes action on the correct teardown state. Don't launch a new setup action when already in setup state. Signed-off-by: Hans Dedecker dedec...@gmail.com --- proto-shell.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/proto-shell.c b/proto-shell.c index 0131e19..86933b0 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -156,10 +156,22 @@ proto_shell_handler(struct interface_proto_state *proto, proc = state-script_task; if (cmd == PROTO_CMD_SETUP) { - action = setup; - state-last_error = -1; - proto_shell_clear_host_dep(state); - state-sm = S_SETUP; + switch (state-sm) { + case S_IDLE: + action = setup; + state-last_error = -1; + proto_shell_clear_host_dep(state); + state-sm = S_SETUP; + break; + + case S_SETUP_ABORT: + case S_TEARDOWN: + case S_SETUP: + return 0; + + default: + return -1; + } } else if (cmd == PROTO_CMD_RENEW) { if (!(handler-proto.flags PROTO_FLAG_RENEW_AVAILABLE)) return 0; -- 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 3/4] netifd: Make possible state transitions more clear when handling teardown event
Improves code readibility regarding state transitions when handling teardown event Signed-off-by: Hans Dedecker dedec...@gmail.com --- proto-shell.c | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/proto-shell.c b/proto-shell.c index 86933b0..977cdbc 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -184,28 +184,35 @@ proto_shell_handler(struct interface_proto_state *proto, state-renew_pending = false; action = renew; } else { - if (state-sm == S_TEARDOWN) - return 0; - - state-renew_pending = false; - if (state-script_task.uloop.pending) { - if (state-sm != S_SETUP_ABORT) { + switch (state-sm) { + case S_SETUP: + if (state-script_task.uloop.pending) { uloop_timeout_set(state-teardown_timeout, 1000); kill(state-script_task.uloop.pid, SIGTERM); if (state-proto_task.uloop.pending) kill(state-proto_task.uloop.pid, SIGTERM); + state-renew_pending = false; state-sm = S_SETUP_ABORT; + return 0; + } + /* fall through if no script task is running */ + case S_IDLE: + action = teardown; + state-renew_pending = false; + state-sm = S_TEARDOWN; + if (state-last_error = 0) { + snprintf(error_buf, sizeof(error_buf), ERROR=%d, state-last_error); + envp[j++] = error_buf; } + uloop_timeout_set(state-teardown_timeout, 5000); + break; + + case S_TEARDOWN: return 0; - } - action = teardown; - state-sm = S_TEARDOWN; - if (state-last_error = 0) { - snprintf(error_buf, sizeof(error_buf), ERROR=%d, state-last_error); - envp[j++] = error_buf; + default: + return -1; } - uloop_timeout_set(state-teardown_timeout, 5000); } D(INTERFACE, run %s for interface '%s'\n, action, proto-iface-name); -- 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 4/4] netifd: Add igmpversion config support
Config support to force the IGMP host version on device level; possible values are: 1|igmpv1: IGMP version 1 2|igmpv2: IGMP version 2 3|igmpv3: IGMP version 3 Signed-off-by: Hans Dedecker dedec...@gmail.com --- device.c | 11 +++ device.h | 3 +++ system-dummy.c | 6 ++ system-linux.c | 46 ++ system.h | 1 + 5 files changed, 67 insertions(+) diff --git a/device.c b/device.c index aa5818f..6d33f69 100644 --- a/device.c +++ b/device.c @@ -41,6 +41,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_PROMISC] = { .name = promisc, .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_RPFILTER] = { .name = rpfilter, .type = BLOBMSG_TYPE_STRING }, [DEV_ATTR_ACCEPTLOCAL] = { .name = acceptlocal, .type = BLOBMSG_TYPE_BOOL }, + [DEV_ATTR_IGMPVERSION] = { .name = igmpversion, .type = BLOBMSG_TYPE_STRING }, }; const struct uci_blob_param_list device_attr_list = { @@ -158,6 +159,7 @@ device_merge_settings(struct device *dev, struct device_settings *n) n-promisc = s-flags DEV_OPT_PROMISC ? s-promisc : os-promisc; n-rpfilter = s-flags DEV_OPT_RPFILTER ? s-rpfilter : os-rpfilter; n-acceptlocal = s-flags DEV_OPT_ACCEPTLOCAL ? s-acceptlocal : os-acceptlocal; + n-igmpversion = s-flags DEV_OPT_IGMPVERSION ? s-igmpversion : os-igmpversion; n-flags = s-flags | os-flags; } @@ -213,6 +215,13 @@ device_init_settings(struct device *dev, struct blob_attr **tb) s-flags |= DEV_OPT_ACCEPTLOCAL; } + if ((cur = tb[DEV_ATTR_IGMPVERSION])) { + if (system_resolve_igmpversion(blobmsg_data(cur), s-igmpversion)) + s-flags |= DEV_OPT_IGMPVERSION; + else + DPRINTF(Failed to resolve igmpversion: %s\n, (char *) blobmsg_data(cur)); + } + device_set_disabled(dev, disabled); } @@ -754,6 +763,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) blobmsg_add_u32(b, rpfilter, st.rpfilter); if (st.flags DEV_OPT_ACCEPTLOCAL) blobmsg_add_u8(b, acceptlocal, st.acceptlocal); + if (st.flags DEV_OPT_IGMPVERSION) + blobmsg_add_u32(b, igmpversion, st.igmpversion); } s = blobmsg_open_table(b, statistics); diff --git a/device.h b/device.h index 8569be7..a83cac8 100644 --- a/device.h +++ b/device.h @@ -35,6 +35,7 @@ enum { DEV_ATTR_PROMISC, DEV_ATTR_RPFILTER, DEV_ATTR_ACCEPTLOCAL, + DEV_ATTR_IGMPVERSION, __DEV_ATTR_MAX, }; @@ -70,6 +71,7 @@ enum { DEV_OPT_PROMISC = (1 4), DEV_OPT_RPFILTER= (1 5), DEV_OPT_ACCEPTLOCAL = (1 6), + DEV_OPT_IGMPVERSION = (1 7), }; /* events broadcasted to all users of a device */ @@ -119,6 +121,7 @@ struct device_settings { bool promisc; unsigned int rpfilter; bool acceptlocal; + unsigned int igmpversion; }; /* diff --git a/system-dummy.c b/system-dummy.c index 76c6ffa..247b083 100644 --- a/system-dummy.c +++ b/system-dummy.c @@ -215,6 +215,12 @@ bool system_resolve_rpfilter(const char *filter, unsigned int *id) return true; } +bool system_resolve_igmpversion(const char *version, unsigned int *id) +{ + *id = 0; + return true; +} + int system_add_iprule(struct iprule *rule) { return 0; diff --git a/system-linux.c b/system-linux.c index 4662bf8..776676a 100644 --- a/system-linux.c +++ b/system-linux.c @@ -275,6 +275,11 @@ static void system_set_acceptlocal(struct device *dev, const char *val) system_set_dev_sysctl(/proc/sys/net/ipv4/conf/%s/accept_local, dev-ifname, val); } +static void system_set_igmpversion(struct device *dev, const char *val) +{ + system_set_dev_sysctl(/proc/sys/net/ipv4/conf/%s/force_igmp_version, dev-ifname, val); +} + static int system_get_sysctl(const char *path, char *buf, const size_t buf_sz) { int fd = -1, ret = -1; @@ -321,6 +326,12 @@ static int system_get_acceptlocal(struct device *dev, char *buf, const size_t bu dev-ifname, buf, buf_sz); } +static int system_get_igmpversion(struct device *dev, char *buf, const size_t buf_sz) +{ + return system_get_dev_sysctl(/proc/sys/net/ipv4/conf/%s/force_igmp_version, + dev-ifname, buf, buf_sz); +} + // Evaluate netlink messages static int cb_rtnl_event(struct nl_msg *msg, void *arg) { @@ -985,6 +996,11 @@ system_if_get_settings(struct device *dev, struct device_settings *s) s-acceptlocal = strtoul(buf, NULL, 0); s-flags |= DEV_OPT_ACCEPTLOCAL; } + + if (!system_get_igmpversion(dev, buf, sizeof(buf))) { + s-igmpversion = strtoul(buf, NULL, 0); + s-flags |= DEV_OPT_IGMPVERSION; + } } void @@
Re: [OpenWrt-Devel] [PATCH 4/4] netifd: Add igmpversion config support
On 2014-12-03 11:15, Hans Dedecker wrote: Config support to force the IGMP host version on device level; possible values are: 1|igmpv1: IGMP version 1 2|igmpv2: IGMP version 2 3|igmpv3: IGMP version 3 Signed-off-by: Hans Dedecker dedec...@gmail.com I'd prefer to leave out support for the igmpvX strings to simplify the configuration format. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 4/4] netifd: Add igmpversion config support
On 03.12.2014 11:15, Hans Dedecker wrote: Config support to force the IGMP host version on device level; possible values are: 1|igmpv1: IGMP version 1 2|igmpv2: IGMP version 2 3|igmpv3: IGMP version 3 Thanks Hans. However, I don't really see the point of the string logic, it seems a bit bloated and the simple integer 1 2 or 3 should suffice imo. Also I'm wondering if this should set MLD version too (i.e. 1 if IGMP is 2 and 2 if IGMP is 3). Cheers, Steven ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH] scripts: use extended-remote for greater compatibility
From: Karl Palsson ka...@remake.is Plain remote results in failure to connect using the gdb built with the toolchain. (On atheros target at least) extended-remote also allows run to restart the target process. Signed-off-by: Karl Palsson ka...@remake.is --- scripts/remote-gdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/remote-gdb b/scripts/remote-gdb index 380a225..2c08f14 100755 --- a/scripts/remote-gdb +++ b/scripts/remote-gdb @@ -61,7 +61,7 @@ if( opendir SD, $Bin/../staging_dir ) my ($sysroot) = glob($Bin/../staging_dir/target-${arch}_${libc}/root-*/); print $fh set sysroot $sysroot\n if $sysroot; - my $cmd = target remote; + my $cmd = target extended-remote; -f $ARGV[0] and $cmd = core-file; print $fh $cmd $ARGV[0]\n; -- 1.8.3.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH][Kernel] unset NF_REJECT_IPV6 and PHY_SAMSUNG_USB2
oldconfig kept asking for that config symbol... PHY_SAMSUNG_USB2 depends on DWC2 diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index e0e2a0b..d014334 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -2560,6 +2560,7 @@ CONFIG_NF_NAT_IPV4=m # CONFIG_NF_NAT_SNMP_BASIC is not set # CONFIG_NF_NAT_TFTP is not set CONFIG_NF_REJECT_IPV4=m +# CONFIG_NF_REJECT_IPV6 is not set # CONFIG_NF_TABLES is not set # CONFIG_NI52 is not set # CONFIG_NI65 is not set @@ -2802,6 +2803,7 @@ CONFIG_PCI_SYSCALL=y # CONFIG_PHYS_ADDR_T_64BIT is not set # CONFIG_PHY_EXYNOS_DP_VIDEO is not set # CONFIG_PHY_EXYNOS_MIPI_VIDEO is not set +# CONFIG_PHY_SAMSUNG_USB2 is not set # CONFIG_PID_IN_CONTEXTIDR is not set # CONFIG_PID_NS is not set CONFIG_PINCONF=y ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 4/4] netifd: Add igmpversion config support
On Wed, Dec 3, 2014 at 11:23 AM, Steven Barth cy...@openwrt.org wrote: On 03.12.2014 11:15, Hans Dedecker wrote: Config support to force the IGMP host version on device level; possible values are: 1|igmpv1: IGMP version 1 2|igmpv2: IGMP version 2 3|igmpv3: IGMP version 3 Thanks Hans. However, I don't really see the point of the string logic, it seems a bit bloated and the simple integer 1 2 or 3 should suffice imo. Also I'm wondering if this should set MLD version too (i.e. 1 if IGMP is 2 and 2 if IGMP is 3). Cheers, Steven I will simplify the configuration format and restrict it to the numerical format as requested by you and Felix. Regarding the MLD version wouldn't it be preferable to have this as a different UCI parameter as I could imagine different versions in use for MLD and IGMP. Quite a lot of ISP's are still stuck to IGMPv2 in their network while they're using MLDv2 for IPV6. Hans ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 4/4] netifd: Add igmpversion config support
On 03.12.2014 11:39, Hans Dedecker wrote: Regarding the MLD version wouldn't it be preferable to have this as a different UCI parameter as I could imagine different versions in use for MLD and IGMP. Quite a lot of ISP's are still stuck to IGMPv2 in their network while they're using MLDv2 for IPV6. Okay, makes sense, thanks again. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/3] uboot-oxnas: re-add IC+ phy driver
KD20 got an IC+ phy, without the driver the phy is not properly initialized resulting in ethernet not working unless being already initialized by the vendor loader. upstream commit 368b4d2b49bbbf379d9334747fbbd2fe4356 drivers: net: remove dead drivers removed icplus.c due to the lack of in-tree users. Partially revert that commit adding back the IC+ driver. Signed-off-by: Daniel Golle dan...@makrotopia.org --- .../boot/uboot-oxnas/files/include/configs/ox820.h | 1 + .../boot/uboot-oxnas/patches/200-icplus-phy.patch | 129 + 2 files changed, 130 insertions(+) create mode 100644 package/boot/uboot-oxnas/patches/200-icplus-phy.patch diff --git a/package/boot/uboot-oxnas/files/include/configs/ox820.h b/package/boot/uboot-oxnas/files/include/configs/ox820.h index e3c71e6..85ee3b4 100644 --- a/package/boot/uboot-oxnas/files/include/configs/ox820.h +++ b/package/boot/uboot-oxnas/files/include/configs/ox820.h @@ -76,6 +76,7 @@ #define CONFIG_CMD_MII #define CONFIG_PHYLIB #define CONFIG_PHY_REALTEK +#define CONFIG_PHY_ICPLUS /* spl */ #ifdef CONFIG_SPL_BUILD diff --git a/package/boot/uboot-oxnas/patches/200-icplus-phy.patch b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch new file mode 100644 index 000..3db7816 --- /dev/null +++ b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch @@ -0,0 +1,129 @@ +From e719404ee1241af679a51879eaad291bc27e4817 Mon Sep 17 00:00:00 2001 +From: Daniel Golle dan...@makrotopia.org +Date: Tue, 2 Dec 2014 14:46:05 +0100 +Subject: [PATCH] net/phy: add back icplus driver + +IC+ phy driver was removed due to the lack of users some time ago. +Add it back, so we can use it. +--- + drivers/net/phy/Makefile | 1 + + drivers/net/phy/icplus.c | 80 + drivers/net/phy/phy.c| 3 ++ + 3 files changed, 84 insertions(+) + create mode 100644 drivers/net/phy/icplus.c + +--- a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile +@@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_ATHEROS) += atheros.o + obj-$(CONFIG_PHY_BROADCOM) += broadcom.o + obj-$(CONFIG_PHY_DAVICOM) += davicom.o + obj-$(CONFIG_PHY_ET1011C) += et1011c.o ++obj-$(CONFIG_PHY_ICPLUS) += icplus.o + obj-$(CONFIG_PHY_LXT) += lxt.o + obj-$(CONFIG_PHY_MARVELL) += marvell.o + obj-$(CONFIG_PHY_MICREL) += micrel.o +--- /dev/null b/drivers/net/phy/icplus.c +@@ -0,0 +1,80 @@ ++/* ++ * ICPlus PHY drivers ++ * ++ * SPDX-License-Identifier: GPL-2.0+ ++ * ++ * Copyright (c) 2007 Freescale Semiconductor, Inc. ++ */ ++#include phy.h ++ ++/* IP101A/G - IP1001 */ ++#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ ++#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ ++#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ ++#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ ++#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ ++#define IP101A_G_IRQ_CONF_STATUS0x11/* Conf Info IRQ Status Reg */ ++#define IP101A_G_IRQ_PIN_USED (115) /* INTR pin used */ ++#define IP101A_G_IRQ_DEFAULTIP101A_G_IRQ_PIN_USED ++ ++static int ip1001_config(struct phy_device *phydev) ++{ ++ int c; ++ ++ /* Enable Auto Power Saving mode */ ++ c = phy_read(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2); ++ if (c 0) ++ return c; ++ c |= IP1001_APS_ON; ++ c = phy_write(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2, c); ++ if (c 0) ++ return c; ++ ++ /* INTR pin used: speed/link/duplex will cause an interrupt */ ++ c = phy_write(phydev, MDIO_DEVAD_NONE, IP101A_G_IRQ_CONF_STATUS, ++IP101A_G_IRQ_DEFAULT); ++ if (c 0) ++ return c; ++ ++ if (phydev-interface == PHY_INTERFACE_MODE_RGMII) { ++ /* ++ * Additional delay (2ns) used to adjust RX clock phase ++ * at RGMII interface ++ */ ++ c = phy_read(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS); ++ if (c 0) ++ return c; ++ ++ c |= IP1001_PHASE_SEL_MASK; ++ c = phy_write(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS, ++c); ++ if (c 0) ++ return c; ++ } ++ ++ return 0; ++} ++ ++static int ip1001_startup(struct phy_device *phydev) ++{ ++ genphy_update_link(phydev); ++ genphy_parse_link(phydev); ++ ++ return 0; ++} ++static struct phy_driver IP1001_driver = { ++ .name = ICPlus IP1001, ++ .uid = 0x02430d90, ++ .mask = 0x0ff0, ++ .features = PHY_GBIT_FEATURES, ++ .config = ip1001_config, ++ .startup = ip1001_startup, ++ .shutdown = genphy_shutdown, ++}; ++ ++int phy_icplus_init(void) ++{ ++ phy_register(IP1001_driver); ++ ++ return 0; ++} +--- a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
[OpenWrt-Devel] [PATCH 2/3] uboot-oxnas: adjust digtial drive strength of IC+ phy
This is what the vendor bootloader does on KD20. Signed-off-by: Daniel Golle dan...@makrotopia.org --- package/boot/uboot-oxnas/patches/200-icplus-phy.patch | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-oxnas/patches/200-icplus-phy.patch b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch index 3db7816..b378331 100644 --- a/package/boot/uboot-oxnas/patches/200-icplus-phy.patch +++ b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch @@ -24,7 +24,7 @@ Add it back, so we can use it. obj-$(CONFIG_PHY_MICREL) += micrel.o --- /dev/null +++ b/drivers/net/phy/icplus.c -@@ -0,0 +1,80 @@ +@@ -0,0 +1,93 @@ +/* + * ICPlus PHY drivers + * @@ -43,6 +43,15 @@ Add it back, so we can use it. +#define IP101A_G_IRQ_CONF_STATUS0x11/* Conf Info IRQ Status Reg */ +#define IP101A_G_IRQ_PIN_USED (115) /* INTR pin used */ +#define IP101A_G_IRQ_DEFAULTIP101A_G_IRQ_PIN_USED ++#define IP1001LF_DRIVE_MASK (15 5) ++#define IP1001LF_RXCLKDRIVE_HI (2 5) ++#define IP1001LF_RXDDRIVE_HI(2 7) ++#define IP1001LF_RXCLKDRIVE_M (1 5) ++#define IP1001LF_RXDDRIVE_M (1 7) ++#define IP1001LF_RXCLKDRIVE_L (0 5) ++#define IP1001LF_RXDDRIVE_L (0 7) ++#define IP1001LF_RXCLKDRIVE_VL (3 5) ++#define IP1001LF_RXDDRIVE_VL(3 7) + +static int ip1001_config(struct phy_device *phydev) +{ @@ -73,6 +82,10 @@ Add it back, so we can use it. + return c; + + c |= IP1001_PHASE_SEL_MASK; ++ /* adjust digtial drive strength */ ++ c = ~IP1001LF_DRIVE_MASK; ++ c |= IP1001LF_RXCLKDRIVE_M; ++ c |= IP1001LF_RXDDRIVE_M; + c = phy_write(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS, +c); + if (c 0) -- 2.1.3 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] Buildbot: buildslave4 has destroyed 3/4 of builds for a week
buildslave4 has destroyed 3/4 of snapshot builds by rapidly failing them and preventing other buildslaves to try those target plaforms. The slave has been broken for almost a week. For several platforms the last succesful build has been 28-Nov, 5 days ago. (Only those builds succeed that get assigned to the other slaves when the initial daily buildbot run starts. Buildslave4 manages to start and fail all other platforms during the time when the other slaves are building their first and only target platform.) Should somebody check the buildbot status every now and then? Somehow it seems to be left alone to a large extent. http://buildbot.openwrt.org:8010/buildslaves/buildslave4 http://buildbot.openwrt.org:8010/one_line_per_build ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 1/3] uboot-oxnas: re-add IC+ phy driver
i recently removed the driver from the ralink kernel as it made the link unstable. how does the phy behave for you without the drive strength quirk ? does the linux phy driver work for you on this HW ? i looked for the datasheet but failed to find it. do you have it ? On 03/12/2014 16:03, Daniel Golle wrote: KD20 got an IC+ phy, without the driver the phy is not properly initialized resulting in ethernet not working unless being already initialized by the vendor loader. upstream commit 368b4d2b49bbbf379d9334747fbbd2fe4356 drivers: net: remove dead drivers removed icplus.c due to the lack of in-tree users. Partially revert that commit adding back the IC+ driver. Signed-off-by: Daniel Golle dan...@makrotopia.org --- .../boot/uboot-oxnas/files/include/configs/ox820.h | 1 + .../boot/uboot-oxnas/patches/200-icplus-phy.patch | 129 + 2 files changed, 130 insertions(+) create mode 100644 package/boot/uboot-oxnas/patches/200-icplus-phy.patch diff --git a/package/boot/uboot-oxnas/files/include/configs/ox820.h b/package/boot/uboot-oxnas/files/include/configs/ox820.h index e3c71e6..85ee3b4 100644 --- a/package/boot/uboot-oxnas/files/include/configs/ox820.h +++ b/package/boot/uboot-oxnas/files/include/configs/ox820.h @@ -76,6 +76,7 @@ #define CONFIG_CMD_MII #define CONFIG_PHYLIB #define CONFIG_PHY_REALTEK +#define CONFIG_PHY_ICPLUS /* spl */ #ifdef CONFIG_SPL_BUILD diff --git a/package/boot/uboot-oxnas/patches/200-icplus-phy.patch b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch new file mode 100644 index 000..3db7816 --- /dev/null +++ b/package/boot/uboot-oxnas/patches/200-icplus-phy.patch @@ -0,0 +1,129 @@ +From e719404ee1241af679a51879eaad291bc27e4817 Mon Sep 17 00:00:00 2001 +From: Daniel Golle dan...@makrotopia.org +Date: Tue, 2 Dec 2014 14:46:05 +0100 +Subject: [PATCH] net/phy: add back icplus driver + +IC+ phy driver was removed due to the lack of users some time ago. +Add it back, so we can use it. +--- + drivers/net/phy/Makefile | 1 + + drivers/net/phy/icplus.c | 80 + drivers/net/phy/phy.c| 3 ++ + 3 files changed, 84 insertions(+) + create mode 100644 drivers/net/phy/icplus.c + +--- a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile +@@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_ATHEROS) += atheros.o + obj-$(CONFIG_PHY_BROADCOM) += broadcom.o + obj-$(CONFIG_PHY_DAVICOM) += davicom.o + obj-$(CONFIG_PHY_ET1011C) += et1011c.o ++obj-$(CONFIG_PHY_ICPLUS) += icplus.o + obj-$(CONFIG_PHY_LXT) += lxt.o + obj-$(CONFIG_PHY_MARVELL) += marvell.o + obj-$(CONFIG_PHY_MICREL) += micrel.o +--- /dev/null b/drivers/net/phy/icplus.c +@@ -0,0 +1,80 @@ ++/* ++ * ICPlus PHY drivers ++ * ++ * SPDX-License-Identifier:GPL-2.0+ ++ * ++ * Copyright (c) 2007 Freescale Semiconductor, Inc. ++ */ ++#include phy.h ++ ++/* IP101A/G - IP1001 */ ++#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ ++#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ ++#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ ++#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ ++#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ ++#define IP101A_G_IRQ_CONF_STATUS0x11/* Conf Info IRQ Status Reg */ ++#define IP101A_G_IRQ_PIN_USED (115) /* INTR pin used */ ++#define IP101A_G_IRQ_DEFAULT IP101A_G_IRQ_PIN_USED ++ ++static int ip1001_config(struct phy_device *phydev) ++{ ++int c; ++ ++/* Enable Auto Power Saving mode */ ++c = phy_read(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2); ++if (c 0) ++ return c; ++ c |= IP1001_APS_ON; ++ c = phy_write(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2, c); ++ if (c 0) ++ return c; ++ ++ /* INTR pin used: speed/link/duplex will cause an interrupt */ ++c = phy_write(phydev, MDIO_DEVAD_NONE, IP101A_G_IRQ_CONF_STATUS, ++ IP101A_G_IRQ_DEFAULT); ++ if (c 0) ++ return c; ++ ++ if (phydev-interface == PHY_INTERFACE_MODE_RGMII) { ++ /* ++ * Additional delay (2ns) used to adjust RX clock phase ++* at RGMII interface ++ */ ++ c = phy_read(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS); ++ if (c 0) ++ return c; ++ ++ c |= IP1001_PHASE_SEL_MASK; ++ c = phy_write(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS, ++ c); ++if (c 0) ++ return c; ++ } ++ ++ return 0; ++} ++ ++static int ip1001_startup(struct phy_device *phydev) ++{ ++genphy_update_link(phydev); ++ genphy_parse_link(phydev); ++ ++ return 0; ++} ++static struct phy_driver IP1001_driver = { ++ .name = ICPlus IP1001, ++ .uid = 0x02430d90, ++.mask = 0x0ff0, ++ .features = PHY_GBIT_FEATURES, ++ .config =
[OpenWrt-Devel] [PATCH][ar71xx] Add support for BHU Networks BXO2000n-2S/BXO5000n-2S/BXI2000n-2/BXO2000n-2S-U
BXO2000n-2S/BXO5000n-2S/BXI2000n-2/BXO2000n-2S-U are 4 BHU Networks WLAN boards, use ar9341 and ar9344 chip. I also merge BXU2000n-2 board to same file for all BHU devices. Signed-off-by: Terry Yang yan...@bhunetworks.com Index: target/linux/ar71xx/base-files/etc/diag.sh === --- target/linux/ar71xx/base-files/etc/diag.sh (revision 43488) +++ target/linux/ar71xx/base-files/etc/diag.sh (working copy) @@ -37,7 +37,7 @@ bullet-m | rocket-m | nano-m | nanostation-m | nanostation-m-xw | loco-m-xw) status_led=ubnt:green:link4 ;; - bxu2000n-2-a1) + bxu2000n-2-a1 | bxo2000n-2s-u | bxo2000n-2s | bxi2000n-2 | bxo5000n-2s) status_led=bhu:green:status ;; cap4200ag) Index: target/linux/ar71xx/base-files/etc/uci-defaults/01_leds === --- target/linux/ar71xx/base-files/etc/uci-defaults/01_leds (revision 43488) +++ target/linux/ar71xx/base-files/etc/uci-defaults/01_leds (working copy) @@ -46,10 +46,21 @@ ucidef_set_led_rssi rssihigh RSSIHIGH ubnt:green:link4 wlan0 76 100 -75 13 ;; -bxu2000n-2-a1) +bxu2000n-2-a1|\ +bxi2000n-2) ucidef_set_led_wlan wlan WLAN bhu:green:wlan phy0tpt ;; +bxo2000n-2s-u|\ +bxo2000n-2s|\ +bxo5000n-2s) + ucidef_set_led_wlan wlan WLAN bhu:green:wlan phy0tpt + ucidef_set_rssimon wlan0 4 1 + ucidef_set_led_rssi rssilow RSSILOW bhu:green:rssilow wlan0 1 40 0 6 + ucidef_set_led_rssi rssimedium RSSIMEDIUM bhu:green:rssimedium wlan0 30 80 -29 5 + ucidef_set_led_rssi rssihigh RSSIHIGH bhu:green:rssihigh wlan0 70 100 -69 8 + ;; + cap4200ag) ucidef_set_led_default lan_green LAN_GREEN senao:green:lan 1 ucidef_set_led_wlan wlan_amber WLAN_AMBER senao:amber:wlan phy0tpt Index: target/linux/ar71xx/base-files/etc/uci-defaults/02_network === --- target/linux/ar71xx/base-files/etc/uci-defaults/02_network (revision 43488) +++ target/linux/ar71xx/base-files/etc/uci-defaults/02_network (working copy) @@ -332,7 +332,8 @@ ucidef_set_interface_lan eth0 ;; -dir-505-a1) +dir-505-a1 |\ +bxi2000n-2) ucidef_set_interface_lan eth1 ;; Index: target/linux/ar71xx/base-files/lib/ar71xx.sh === --- target/linux/ar71xx/base-files/lib/ar71xx.sh(revision 43488) +++ target/linux/ar71xx/base-files/lib/ar71xx.sh(working copy) @@ -810,6 +810,18 @@ *BHU BXU2000n-2 rev. A1) name=bxu2000n-2-a1 ;; + *BHU BXO2000n-2S) + name=bxo2000n-2s + ;; + *BHU BXO2000n-2S-U) + name=bxo2000n-2s-u + ;; + *BHU BXI2000n-2) + name=bxi2000n-2 + ;; + *BHU BXO5000n-2S) + name=bxo5000n-2s + ;; *HiWiFi HC6361) name=hiwifi-hc6361 ;; Index: target/linux/ar71xx/base-files/lib/upgrade/platform.sh === --- target/linux/ar71xx/base-files/lib/upgrade/platform.sh (revision 43488) +++ target/linux/ar71xx/base-files/lib/upgrade/platform.sh (working copy) @@ -183,6 +183,10 @@ db120 | \ hornet-ub | \ bxu2000n-2-a1 | \ + bxo2000n-2s | \ + bxo2000n-2s-u | \ + bxi2000n-2 | \ + bxo5000n-2s | \ zcn-1523h-2 | \ zcn-1523h-5) [ $magic_long != 68737173 -a $magic_long != 19852003 ] { Index: target/linux/ar71xx/config-3.14 === --- target/linux/ar71xx/config-3.14 (revision 43488) +++ target/linux/ar71xx/config-3.14 (working copy) @@ -37,7 +37,7 @@ CONFIG_ATH79_MACH_AP96=y CONFIG_ATH79_MACH_ARCHER_C7=y CONFIG_ATH79_MACH_AW_NR580=y -CONFIG_ATH79_MACH_BHU_BXU2000N2_A=y +CONFIG_ATH79_MACH_BHU_ATH=y CONFIG_ATH79_MACH_CAP4200AG=y CONFIG_ATH79_MACH_CARAMBOLA2=y CONFIG_ATH79_MACH_CPE510=y Index: target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c === --- target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c(revision 0) +++ target/linux/ar71xx/files/arch/mips/ath79/mach-bhu-ath.c(working copy) @@ -0,0 +1,370 @@ +/* + * BHU board support + * + * Copyright (C) 2013-2014 Terry Yang yan...@bhunetworks.com + * + * 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 linux/gpio.h +#include linux/platform_device.h + +#include asm/mach-ath79/ath79.h +#include asm/mach-ath79/ar71xx_regs.h + +#include common.h +#include dev-eth.h
Re: [OpenWrt-Devel] [PATCH][ar71xx] Add support for BHU Networks BXO2000n-2S/BXO5000n-2S/BXI2000n-2/BXO2000n-2S-U
Hi, patches for new boards are always welcome, a few comments below On 04/12/2014 08:23, yangbo wrote: +/* + * BHU BXO2000n-2S-U board + */ + +static void __init bhu_bxo2000n2s_u_setup(void) +{ + bhu_ap123_setup((u8 *) KSEG1ADDR(0x1fff), (u8 *) KSEG1ADDR(0x1fff1000)); + +ath79_register_leds_gpio(-1, ARRAY_SIZE(bhu_bxo2000n2s_leds_gpio), + bhu_bxo2000n2s_leds_gpio); ^ the patch is full of leading space vs tab errors like this. please fix them and resend the patch. i am not sure how the other mach files handle it but i would prefer to have all the #defines at the start of the file rather than have it intermingled with the code. John + +ath79_register_gpio_keys_polled(1, BHU_BXO2000N2S_KEYS_POLL_INTERVAL, +ARRAY_SIZE(bhu_bxo2000n2s_gpio_keys), +bhu_bxo2000n2s_gpio_keys); +} + +MIPS_MACHINE(ATH79_MACH_BHU_BXO2000N2SU, BXO2000n-2S-U, + BHU BXO2000n-2S-U, + bhu_bxo2000n2s_u_setup); + +/* + * BHU BXI2000n-2 board + */ + ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel