[OpenWrt-Devel] [PATCH 1/2] ar71xx: Unify ath10k calibration data loading

2015-06-27 Thread Matti Laakso
Currently one board uses the proper way of providing firmware
with the name ath10k/cal-pci-pci address.bin, whereas other
boards patch board.bin template in preinit and rely on a custom
ath10k patch to use calibration data from the template.

This patch makes all boards use the first method.

Signed-off-by: Matti Laakso malaa...@elisanet.fi
---
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 61 ++
 .../lib/preinit/81_load_ath10k_board_bin   | 75 --
 2 files changed, 49 insertions(+), 87 deletions(-)
 delete mode 100644 
target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin

diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 164d3ab..50f7425 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -8,38 +8,75 @@ ath10kcal_die() {
 ath10kcal_from_file() {
local source=$1
local offset=$2
-   local target=$3
+   local count=$3
 
-   dd if=$source of=$target bs=1 skip=$offset count=2116 2/dev/null || \
+   dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2/dev/null || \
ath10kcal_die failed to extract calibration data from $source
 }
 
+ath10kcal_extract() {
+   local part=$1
+   local offset=$2
+   local count=$3
+   local mtd
+
+   mtd=$(find_mtd_chardev $part)
+   [ -n $mtd ] || \
+   ath10kcal_die no mtd device found for partition $part
+
+   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2/dev/null || \
+   ath10kcal_die failed to extract calibration data from $mtd
+}
+
+ath10kcal_patch_mac() {
+   local mac=$1
+
+   [ -z $mac ]  return
+
+   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=6 count=6
+}
+
 [ -e /lib/firmware/$FIRMWARE ]  exit 0
 
 . /lib/ar71xx.sh
 . /lib/functions.sh
 . /lib/functions/system.sh
 
-ath10kcal_mac=
-ath10kcal_tmp=/tmp/ath10k-caldata.bin
-
 board=$(ar71xx_board_name)
 
 case $FIRMWARE in
+ath10k/cal-pci-:00:00.0.bin)
+   case $board in
+   mc-mac1200r)
+   ath10kcal_extract art 20480 2116
+   ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth1/address) -1)
+   ;;
+   r6100)
+   ath10kcal_extract caldata 20480 2116
+   ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth1/address) +2)
+   ;;
+   qihoo-c301)
+   ath10kcal_extract radiocfg 20480 2116
+   ath10kcal_patch_mac $(mtd_get_mac_ascii devdata wlan5mac)
+   ;;
+   esac
+   ;;
 ath10k/cal-pci-:01:00.0.bin)
case $board in
+   archer-c5 | \
+   archer-c7)
+   ath10kcal_extract art 20480 2116
+   ath10kcal_patch_mac $(macaddr_add $(cat 
/sys/class/net/eth1/address) -2)
+   ;;
+   nbg6716)
+   ath10kcal_extract RFdata 20480 2116
+   ;;
rb-911g-5hpacd)
-   ath10kcal_from_file /sys/firmware/routerboot/ext_wlan_data 
20480 $ath10kcal_tmp
+   ath10kcal_from_file /sys/firmware/routerboot/ext_wlan_data 
20480 2116
;;
esac
;;
-
 *)
exit 1
;;
 esac
-
-[ -f $ath10kcal_tmp ]  {
-   cp $ath10kcal_tmp /lib/firmware/$FIRMWARE
-   rm -f $ath10kcal_tmp
-}
diff --git 
a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin 
b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
deleted file mode 100644
index 9a32dfc..000
--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh
-
-. /lib/functions/system.sh
-. /lib/ar71xx.sh
-
-do_load_ath10k_board_bin() {
-   # load board.bin
-   case $(ar71xx_board_name) in
-   nbg6716)
-   dd if=/dev/mtdblock2 \
-   bs=1 skip=20480 count=2116 \
-   of=/tmp/ath10k-board.bin
-   ;;
-   archer-c5 | \
-   archer-c7)
-   local mac
-   mac=$(macaddr_add $(cat /sys/class/net/eth1/address) -2)
-
-   dd if=/dev/mtdblock4 \
-   bs=1 skip=20480 count=6 \
-   of=/tmp/ath10k-board.bin
-   macaddr_2bin $mac  /tmp/ath10k-board.bin
-   dd if=/dev/mtdblock4 \
-   bs=1 skip=20492 count=2104  
/tmp/ath10k-board.bin
-   ;;
-   mc-mac1200r)
-   local mac
-   mac=$(macaddr_add $(cat /sys/class/net/eth1/address) -1)
-
-   dd if=/dev/mtdblock4 \
-   

[OpenWrt-Devel] [PATCH 2/2] mac80211: Drop ath10k workaround for providing calibration data

2015-06-27 Thread Matti Laakso
Ath10k has now a proper method of providing calibration data via
the kernel firmware API. This patch can be dropped as all boards
now use the proper method.

Signed-off-by: Matti Laakso malaa...@elisanet.fi
---
 ...w_fallback_to_board_bin_on_empty_otp_stream.patch | 20 
 1 file changed, 20 deletions(-)
 delete mode 100644 
package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch

diff --git 
a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
 
b/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
deleted file mode 100644
index 4c04d4f..000
--- 
a/package/kernel/mac80211/patches/920-ath10k_allow_fallback_to_board_bin_on_empty_otp_stream.patch
+++ /dev/null
@@ -1,20 +0,0 @@
 a/drivers/net/wireless/ath/ath10k/core.c
-+++ b/drivers/net/wireless/ath/ath10k/core.c
-@@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s
- 
-   ath10k_dbg(ar, ATH10K_DBG_BOOT, boot otp execute result %d\n, result);
- 
--  if (!skip_otp  result != 0) {
--  ath10k_err(ar, otp calibration failed: %d, result);
--  return -EINVAL;
-+  if (!skip_otp) {
-+  if (result == 2) {
-+  ath10k_warn(ar, otp stream is empty, using board.bin 
contents);
-+  return 0;
-+  } else if (result != 0) {
-+  ath10k_err(ar, otp calibration failed: %d, result);
-+  return -EINVAL;
-+  }
-   }
- 
-   return 0;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 0/2] mac80211: Update QCA9880 firmware (ath10k)

2015-06-27 Thread Matti Laakso
 On Thu, 25 Jun 2015 20:59:19 +0200, Matti Laakso malaakso at elisanet.fi 
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel  
 wrote:

 / 
 // On 22/06/15 20:19, Matti Laakso wrote:
 // / These patches backport the new FW API v5 to ath10k
 // // (upstream commits 8348db2, 53513c3, and dc3632a)
 // // and change mac80211 to use the new firmware.
 // //
 // //
 // /Could you also update
 // target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k?
 // See https://patchwork.ozlabs.org/patch/466945/ and possibly
 // https://patchwork.ozlabs.org/patch/481472/
 //
 // Thanks,
 // Stijn
 //
 // Hi,
 //
 // That seems like a burden to maintain. Do I understand correctly that the
 // device has valid data in the PCIe card EEPROM (so it is not necessary to
 // create a file with the calibration data in 81_load_ath10k_board_bin),
 // but the MAC is incorrect? Is the MAC completely bogus (like same for all
 // devices), or valid but just not what it says on the router cover? If the
 // latter, I'd like to drop the whole script altogether and just live with
 // a different MAC.
 /
 On the dgl5500 the mac in the eeprom is the same on all devices (and iirc  
 it's the default mac the firmware also uses). Patching it to the right one  
 in the firmware file is what happens in 82_patch_ath10k.


 Imre

That's... interesting. I'll make v2 with a patched 82_patch_ath10k then,
unless someone can think of a better way to provide a proper MAC for the
board.

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


[OpenWrt-Devel] [PATCH] ar71xx: update preinit script for new ath10k firmware

2015-06-27 Thread Matti Laakso
Update firmware name and md5sum. MAC-address location remains
unchanged from previous version.

Signed-off-by: Matti Laakso malaa...@elisanet.fi
---
 target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k 
b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
index 4511162..4da611a 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
+++ b/target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k
@@ -5,14 +5,14 @@
 
 
 do_patch_ath10k_firmware() {
-   local firmware_file=/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
+   local firmware_file=/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
 
# bail out if firmware does not exist
[ -f $firmware_file ] || {
return
}
 
-   local firmware_md5_orig=ab36ef267d15cfc02317ceeb38e8f548
+   local firmware_md5_orig=36768dc68572b3f2660211e20e89f558
local firmware_md5_current=$(md5sum $firmware_file)
local firmware_md5_current=${firmware_md5_current%% *}
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/3 v2] mac80211: Backport ath10k firmware API v5 support

2015-06-27 Thread Matti Laakso
These patches add support for the new version 5 firmware API.

Signed-off-by: Matti Laakso malaa...@elisanet.fi
---
 ...31-ath10k_add_ath10k_fw_ie_htt_op_version.patch | 385 +
 .../patches/932-ath10k_bump_up_fw_api_to_5.patch   |  43 +++
 ...tt_op_backwards_compatibility_for_qca6174.patch |  47 +++
 3 files changed, 475 insertions(+)
 create mode 100644 
package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch
 create mode 100644 
package/kernel/mac80211/patches/932-ath10k_bump_up_fw_api_to_5.patch
 create mode 100644 
package/kernel/mac80211/patches/933-ath10k_fix_htt_op_backwards_compatibility_for_qca6174.patch

diff --git 
a/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch
 
b/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch
new file mode 100644
index 000..45384ed
--- /dev/null
+++ 
b/package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch
@@ -0,0 +1,385 @@
+diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
+index 02da72e..f3788e2 100644
+--- a/drivers/net/wireless/ath/ath10k/core.c
 b/drivers/net/wireless/ath/ath10k/core.c
+@@ -675,6 +675,17 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k 
*ar, const char *name)
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, found fw ie wmi op 
version %d\n,
+  ar-wmi.op_version);
+   break;
++  case ATH10K_FW_IE_HTT_OP_VERSION:
++  if (ie_len != sizeof(u32))
++  break;
++
++  version = (__le32 *)data;
++
++  ar-htt.op_version = le32_to_cpup(version);
++
++  ath10k_dbg(ar, ATH10K_DBG_BOOT, found fw ie htt op 
version %d\n,
++ ar-htt.op_version);
++  break;
+   default:
+   ath10k_warn(ar, Unknown FW IE: %u\n,
+   le32_to_cpu(hdr-id));
+diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
+index 4f59ab9..f782d76 100644
+--- a/drivers/net/wireless/ath/ath10k/htt.c
 b/drivers/net/wireless/ath/ath10k/htt.c
+@@ -22,6 +22,86 @@
+ #include core.h
+ #include debug.h
+ 
++static const enum htt_t2h_msg_type htt_main_t2h_msg_types[] = {
++  [HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH,
++  [HTT_MAIN_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP,
++  [HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA,
++  [HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG,
++  [HTT_MAIN_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND] =
++  HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND] =
++  HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
++  [HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND] =
++  HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND] = HTT_T2H_MSG_TYPE_RX_PN_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND] =
++  HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
++  [HTT_MAIN_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,
++};
++
++static const enum htt_t2h_msg_type htt_10x_t2h_msg_types[] = {
++  [HTT_10X_T2H_MSG_TYPE_VERSION_CONF] = HTT_T2H_MSG_TYPE_VERSION_CONF,
++  [HTT_10X_T2H_MSG_TYPE_RX_IND] = HTT_T2H_MSG_TYPE_RX_IND,
++  [HTT_10X_T2H_MSG_TYPE_RX_FLUSH] = HTT_T2H_MSG_TYPE_RX_FLUSH,
++  [HTT_10X_T2H_MSG_TYPE_PEER_MAP] = HTT_T2H_MSG_TYPE_PEER_MAP,
++  [HTT_10X_T2H_MSG_TYPE_PEER_UNMAP] = HTT_T2H_MSG_TYPE_PEER_UNMAP,
++  [HTT_10X_T2H_MSG_TYPE_RX_ADDBA] = HTT_T2H_MSG_TYPE_RX_ADDBA,
++  [HTT_10X_T2H_MSG_TYPE_RX_DELBA] = HTT_T2H_MSG_TYPE_RX_DELBA,
++  [HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND] = HTT_T2H_MSG_TYPE_TX_COMPL_IND,
++  [HTT_10X_T2H_MSG_TYPE_PKTLOG] = HTT_T2H_MSG_TYPE_PKTLOG,
++  [HTT_10X_T2H_MSG_TYPE_STATS_CONF] = HTT_T2H_MSG_TYPE_STATS_CONF,
++  [HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND] = HTT_T2H_MSG_TYPE_RX_FRAG_IND,
++  [HTT_10X_T2H_MSG_TYPE_SEC_IND] = HTT_T2H_MSG_TYPE_SEC_IND,
++  [HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND] = HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
++  [HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND] = HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
++  [HTT_10X_T2H_MSG_TYPE_TEST] = HTT_T2H_MSG_TYPE_TEST,

[OpenWrt-Devel] [PATCH 2/3 v2] mac80211: Update QCA9880 firmware to 10.2.4.70-2

2015-06-27 Thread Matti Laakso
This firmware adds support for management frames over normal
packet transport interface instead of over the WMI management
interface.

Signed-off-by: Matti Laakso malaa...@elisanet.fi
---
 package/kernel/mac80211/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 2af5d39..0872a9c 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -128,7 +128,7 @@ endef
 $(eval $(call Download,linux-firmware))
 
 PKG_ATH10K_LINUX_FIRMWARE_NAME:=ath10k-firmware
-PKG_ATH10K_LINUX_FIRMWARE_VERSION:=da0f85d924226ee30c46e037120621c9e192b39e
+PKG_ATH10K_LINUX_FIRMWARE_VERSION:=b46f3e01a6c1f9150fb4612ef53611d714565842
 
PKG_ATH10K_LINUX_FIRMWARE_SOURCE:=$(PKG_ATH10K_LINUX_FIRMWARE_NAME)-$(PKG_ATH10K_LINUX_FIRMWARE_VERSION).tar.bz2
 PKG_ATH10K_LINUX_FIRMWARE_PROTO:=git
 
PKG_ATH10K_LINUX_FIRMWARE_SOURCE_URL:=https://github.com/kvalo/ath10k-firmware.git
@@ -1864,8 +1864,8 @@ ifeq ($(CONFIG_ATH10K_STA_FW),y)
$(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-2.bin
 else
$(INSTALL_DATA) \
-   
$(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/firmware-4.bin_10.2.4.45
 \
-   $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-4.bin
+   
$(PKG_BUILD_DIR)/$(PKG_ATH10K_LINUX_FIRMWARE_SUBDIR)/10.2.4/untested/firmware-5.bin_10.2.4.70-2
 \
+   $(1)/lib/firmware/ath10k/QCA988X/hw2.0/firmware-5.bin
 endif
 endef
 
-- 
2.1.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/3 v2] mac80211: Update QCA9880 firmware (ath10k)

2015-06-27 Thread Matti Laakso
Current firmware version for QCA9880 is known to stall for some time
when a station in power saving mode (e.g. mobile phone) leaves the AP
range. This stall causes ath10k timeouts during station removal and
subsequently firmware thinks station is still connected, causing
Spurios quick kickout for STA -messages in kernel log.

A fix is to use a newer firmware where this problem has been worked
around by sending management frames via normal packet transport
channel instead of the problematic management interface.

These patches backport the new FW API v5 to ath10k
(upstream commits 8348db2, 53513c3, and dc3632a)
and change mac80211 to use the new firmware.

Fixes https://dev.openwrt.org/ticket/18794 (even though it is
already marked as fixed).

v2: fix the preinit script for patching ath10k firmware for dgl5500

Matti Laakso (3):
  mac80211: Backport ath10k firmware API v5 support
  mac80211: Update QCA9880 firmware to 10.2.4.70-2
  ar71xx: update preinit script for new ath10k firmware

 package/kernel/mac80211/Makefile   |   6 +-
 ...31-ath10k_add_ath10k_fw_ie_htt_op_version.patch | 385 +
 .../patches/932-ath10k_bump_up_fw_api_to_5.patch   |  43 +++
 ...tt_op_backwards_compatibility_for_qca6174.patch |  47 +++
 target/linux/ar71xx/base-files/lib/preinit/82_patch_ath10k | 4 ++--

 5 files changed, 480 insertions(+), 5 deletions(-)
 create mode 100644 
package/kernel/mac80211/patches/931-ath10k_add_ath10k_fw_ie_htt_op_version.patch
 create mode 100644 
package/kernel/mac80211/patches/932-ath10k_bump_up_fw_api_to_5.patch
 create mode 100644 
package/kernel/mac80211/patches/933-ath10k_fix_htt_op_backwards_compatibility_for_qca6174.patch

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


[OpenWrt-Devel] An interesting feature request

2015-06-27 Thread Jonathan Bennett
A couple lines of thought collided today during a conversation with a
friend who is also an fwknop user. Sending a knock over http is a clever
feature, and the hidden service idea is really cool. For example, I have a
web server that also has a cacti service in order to monitor that service.
However, I don't really want to log into cacti over http, as it would send
my username and password in the clear.

An https request sends an encrypted url request. Pcap cannot sniff this
encrypted url. While doing some work on the http support in the android
client, I observed that an http request (or an https request) will write
the requested url to the apache access_log file.

So, what if instead of using pcap to sniff incoming connections, we added
an option to watch an Apache access_log for an http or https request that
contained a valid SPA string.

The use case would be a hidden service that is accessed entirely over the
encrypted ssl channel. To anyone watching, all the traffic would look like
https access to the public web site, but we could send an spa packet and
access a hidden service all using ssl over port 443.

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


Re: [OpenWrt-Devel] An interesting feature request

2015-06-27 Thread Jonathan Bennett
Oh dear. Sent to the wrong mailing list. Please disregard.

On Sat, Jun 27, 2015 at 1:52 PM Jonathan Bennett jbscienc...@gmail.com
wrote:

 A couple lines of thought collided today during a conversation with a
 friend who is also an fwknop user. Sending a knock over http is a clever
 feature, and the hidden service idea is really cool. For example, I have a
 web server that also has a cacti service in order to monitor that service.
 However, I don't really want to log into cacti over http, as it would send
 my username and password in the clear.

 An https request sends an encrypted url request. Pcap cannot sniff this
 encrypted url. While doing some work on the http support in the android
 client, I observed that an http request (or an https request) will write
 the requested url to the apache access_log file.

 So, what if instead of using pcap to sniff incoming connections, we added
 an option to watch an Apache access_log for an http or https request that
 contained a valid SPA string.

 The use case would be a hidden service that is accessed entirely over the
 encrypted ssl channel. To anyone watching, all the traffic would look like
 https access to the public web site, but we could send an spa packet and
 access a hidden service all using ssl over port 443.

 --Jonathan

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


[OpenWrt-Devel] HT modes apparently not working in adhoc under Barrier Breaker

2015-06-27 Thread Ben West
This is the /etc/config/wireless I'm using on a UBNT M5 radio running
Barrier Breaker r45620:

config wifi-device  radio0
option type mac80211
option channel  36
option hwmode   11a
option path 'pci:00/:00:00.0'
option htmode   HT20
option country 'US'
option beacon_int '500'
list basic_rate '12000 18000 24000 36000 48000 54000'
option diversity '1'
option doth '0'
option disabled 0

config wifi-iface wlan0
option device   radio0
option network  'mesh'
option mode 'adhoc'
option mcast_rate '12000'
option ssid MyMesh
option bssid '02:CA:FF:EE:BA:BE'
option encryption 'psk2+aes'
option key '...'

... and this is the /var/run/wpa_supplicant-wlan0.conf generated when using
packages hostapd, hostapd-common, and wpa-supplicant:

ap_scan=2
network={
scan_ssid=0
ssid=MyMesh
key_mgmt=WPA-PSK
mode=1
fixed_freq=1
frequency=5180
mode=1
psk=...
proto=RSN
bssid=02:CA:FF:EE:BA:BE
beacon_int=500
mcast_rate=12
}

Running iw wlan0 station dump confirms no HT modes appear on links to
other stations.  By comparison, the same radio and same wireless config
under Chaos Calmer r46069 sees this /var/run/wpa_supplicant-wlan0.conf
generated:

ap_scan=2
network={
scan_ssid=0
ssid=MyMesh
key_mgmt=WPA-PSK
mode=1
fixed_freq=1
frequency=5180
mode=1
psk=...
proto=RSN
bssid=02:CA:FF:EE:BA:BE
mcast_rate=12
htmode=HT20
}

The station dump on the radio running Chaos Calmer does show HT modes in
use.

-- 
Ben West
http://gowasabi.net
b...@gowasabi.net
314-246-9434
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] lantiq: Add support for the BT Home Hub 5A

2015-06-27 Thread Martin Blumenstingl
u-boot support depends on the next upstream version ([0]) from
Daniel Schwierzeck.
Since the installation process is quite complicated a how to was
added to the wiki: [1]

[0] 
https://github.com/danielschwierzeck/u-boot-lantiq/tree/openwrt/v2014.01-next
[1] http://wiki.openwrt.org/toh/bt/homehub_v5a

Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 .../etc/hotplug.d/firmware/11-ath10k-caldata   |  51 
 .../lantiq/base-files/etc/uci-defaults/01_leds |   2 +-
 .../lantiq/base-files/etc/uci-defaults/02_network  |   8 +
 .../lantiq/base-files/lib/upgrade/platform.sh  |   2 +-
 target/linux/lantiq/dts/BTHOMEHUBV5A.dts   | 287 +
 target/linux/lantiq/image/Makefile |   3 +
 target/linux/lantiq/xrx200/profiles/bt.mk  |   9 +
 7 files changed, 360 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
 create mode 100644 target/linux/lantiq/dts/BTHOMEHUBV5A.dts
 create mode 100644 target/linux/lantiq/xrx200/profiles/bt.mk

diff --git 
a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
new file mode 100644
index 000..0d8084f
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -0,0 +1,51 @@
+#!/bin/sh
+# Based on ar71xx 11-ath10k-caldata and 10-rt2x00-eeprom
+
+ath10k_caldata_die() {
+   echo ath10k caldata:  $*
+   exit 1
+}
+
+ath10k_caldata_extract() {
+   local part=$1
+   local offset=$2
+   local mtd
+
+   . /lib/functions.sh
+
+   mtd=$(find_mtd_part $part)
+   [ -n $mtd ] || \
+   ath10k_caldata_die no mtd device found for partition $part
+
+   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=2116 || \
+   ath10k_caldata_die failed to extract from $mtd
+}
+
+ath10k_caldata_set_macaddr() {
+   local macaddr=$1
+
+   macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \
+   conv=notrunc bs=1 seek=6 count=6
+}
+
+[ -e /lib/firmware/$FIRMWARE ]  exit 0
+. /lib/functions.sh
+. /lib/functions/system.sh
+. /lib/functions/lantiq.sh
+
+case $FIRMWARE in
+ath10k/cal-pci-:02:00.0.bin)
+   local board=$(lantiq_board_name)
+   case $board in
+   BTHOMEHUBV5A)
+   local lan_mac=$(mtd_get_mac_binary caldata 4364)
+   local wifi_mac=$(macaddr_add $lan_mac 3)
+   ath10k_caldata_extract caldata 20480
+   ath10k_caldata_set_macaddr $wifi_mac
+   ;;
+   *)
+   ath10k_caldata_die board $board is not supported yet
+   ;;
+   esac
+   ;;
+esac
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/01_leds 
b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds
index 8041ac9..3e05eba 100644
--- a/target/linux/lantiq/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/01_leds
@@ -25,7 +25,7 @@ BTHOMEHUBV2B)
ucidef_set_led_netdev internet internet soc:blue:broadband 
pppoa-wan
ucidef_set_led_usbdev usb usb soc:blue:phone 1-1
;;
-BTHOMEHUBV3A)
+BTHOMEHUBV3A|BTHOMEHUBV5A)
ucidef_set_led_default power power soc:blue:power 1
ucidef_set_led_wlan wifi wifi soc:blue:wireless phy0tpt
ucidef_set_led_netdev internet internet soc:blue:broadband 
pppoa-wan
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/02_network 
b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
index afb8714..6f9d9c0 100644
--- a/target/linux/lantiq/base-files/etc/uci-defaults/02_network
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/02_network
@@ -169,6 +169,14 @@ BTHOMEHUBV2B|BTHOMEHUBV3A)
wan_mac=$(macaddr_add $lan_mac 1)
;;
 
+BTHOMEHUBV5A)
+   lan_mac=$(mtd_get_mac_binary caldata 4364)
+   wan_mac=$(macaddr_add $lan_mac 1)
+   ucidef_set_interface_lan 'eth0.1'
+   ucidef_add_switch switch0 1 1
+   ucidef_add_switch_vlan switch0 1 0 1 2 4 6t
+   ;;
+
 VGV7519)
lan_mac=$(mtd_get_mac_binary board_config 22)
wan_mac=$(macaddr_add $lan_mac 1)
diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh 
b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
index 1688d3a..f255e81 100755
--- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
+++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
@@ -7,7 +7,7 @@ platform_check_image() {
local board=$(lantiq_board_name)
 
case $board in
-   BTHOMEHUBV2B|BTHOMEHUBV3A|P2812HNUF* )
+   BTHOMEHUBV2B|BTHOMEHUBV3A|BTHOMEHUBV5A|P2812HNUF* )
nand_do_platform_check $board $1
return $?;
;;
diff --git 

[OpenWrt-Devel] [PATCH] lantiq: Make the MEI address available for kernel drivers

2015-06-27 Thread Martin Blumenstingl
Newer DSL driver versions depend on the address information.

Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 target/linux/lantiq/dts/vr9.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/linux/lantiq/dts/vr9.dtsi b/target/linux/lantiq/dts/vr9.dtsi
index bdb1270..136483a 100644
--- a/target/linux/lantiq/dts/vr9.dtsi
+++ b/target/linux/lantiq/dts/vr9.dtsi
@@ -155,6 +155,7 @@
 
mei@E116000 {
compatible = lantiq,mei-xrx200;
+   reg = 0xE116000 0x9c;
interrupt-parent = icu0;
interrupts = 63;
};
-- 
2.4.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] lantiq DSL drivers / firmware info

2015-06-27 Thread Martin Blumenstingl
On Sat, Jun 6, 2015 at 3:23 PM, Sylwester Petela ssc...@gmail.com wrote:
 After 9 days and bit of performance drop I reverted back to stripped out
 init script and also lowered debug level to default so I can track what is
 causing these issues.
If it is a driver issue then you can test the new version (more info below).

A few days ago I got a new set of DSL drivers - version 4.16.2.4 to be exact.
I am writing this very email while connected with that updated driver.
(this is with firmware
5.7.3.3.0.7-5.7.1.5.0.2 / 186b5406e6511c97d997b48f5e0ec5ad3f62600d on
a VDSL line).

The patch for updating the DSL driver can be found here: [0]
Please note that it depends on [1]

Regards,
Martin


[0] https://gist.github.com/xdarklight/3452b26620b28f3bc577
[1] https://lists.openwrt.org/pipermail/openwrt-devel/2015-June/033911.html
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] alternative for pyserial+python-mini

2015-06-27 Thread Christian Mehlis

Am 26.06.2015 um 14:57 schrieb valent.turko...@gmail.com:

Does micro-python have some alternative or replacement for pyserial?


you can use stty[1] from busybox to configure the tty.
After that every program can use regular read/write calls...

[1] http://unixhelp.ed.ac.uk/CGI/man-cgi?stty

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


[OpenWrt-Devel] [PATCH 1/2] lantiq: Change the data-type of mac address in ETOP driver

2015-06-27 Thread Martin Blumenstingl
Make it consistent with the net_device struct and the xrx200 driver

Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 .../lantiq/patches-3.18/0028-NET-lantiq-various-etop-fixes.patch | 2 +-
 .../0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch | 9 -
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git 
a/target/linux/lantiq/patches-3.18/0028-NET-lantiq-various-etop-fixes.patch 
b/target/linux/lantiq/patches-3.18/0028-NET-lantiq-various-etop-fixes.patch
index 187e301..6a752f9 100644
--- a/target/linux/lantiq/patches-3.18/0028-NET-lantiq-various-etop-fixes.patch
+++ b/target/linux/lantiq/patches-3.18/0028-NET-lantiq-various-etop-fixes.patch
@@ -170,7 +170,7 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +  int tx_irq;
 +  int rx_irq;
 +
-+  const void *mac;
++  unsigned char mac[6];
 +  int mii_mode;
  
spinlock_t lock;
diff --git 
a/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
 
b/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
index 04c2071..094d16c 100644
--- 
a/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ 
b/target/linux/lantiq/patches-3.18/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -590,15 +590,6 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +device_initcall(of_ralink_eeprom_init);
 --- a/drivers/net/ethernet/lantiq_etop.c
 +++ b/drivers/net/ethernet/lantiq_etop.c
-@@ -161,7 +161,7 @@ struct ltq_etop_priv {
-   int tx_irq;
-   int rx_irq;
- 
--  const void *mac;
-+  void *mac;
-   int mii_mode;
- 
-   spinlock_t lock;
 @@ -840,7 +840,11 @@ ltq_etop_init(struct net_device *dev)
if (err)
goto err_hw;
-- 
2.4.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 3/3] lantiq: Make ATM and PTM drivers compatible with kernel 4.1

2015-06-27 Thread Martin Blumenstingl
Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 package/kernel/lantiq/ltq-atm/src/ltq_atm.c  | 4 
 package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c | 4 
 package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c | 4 
 3 files changed, 12 insertions(+)

diff --git a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c 
b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
index 15435f6..84ce7fa 100644
--- a/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
+++ b/package/kernel/lantiq/ltq-atm/src/ltq_atm.c
@@ -1818,7 +1818,11 @@ static int ltq_atm_probe(struct platform_device *pdev)
}
 
/*  register interrupt handler  */
+#if LINUX_VERSION_CODE = KERNEL_VERSION(4,1,0)
+   ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, 
atm_mailbox_isr, g_atm_priv_data);
+#else
ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 
IRQF_DISABLED, atm_mailbox_isr, g_atm_priv_data);
+#endif
if ( ret ) {
if ( ret == -EBUSY ) {
pr_err(IRQ may be occupied by other driver, please 
reconfig to disable it.\n);
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c 
b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
index 82ac2ad..38001c3 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
@@ -1455,7 +1455,11 @@ static int ifx_ptm_init(void)
 }
 
 /*  register interrupt handler  */
+#if LINUX_VERSION_CODE = KERNEL_VERSION(4,1,0)
+ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, 
ptm_mailbox_isr, g_ptm_priv_data);
+#else
 ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 
IRQF_DISABLED, ptm_mailbox_isr, g_ptm_priv_data);
+#endif
 if ( ret ) {
 if ( ret == -EBUSY ) {
 err(IRQ may be occupied by other driver, please reconfig to 
disable it.);
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c 
b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
index b328261..9adeba4 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
@@ -964,7 +964,11 @@ static int ifx_ptm_init(void)
 }
 
 /*  register interrupt handler  */
+#if LINUX_VERSION_CODE = KERNEL_VERSION(4,1,0)
+ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 0, 
ptm_mailbox_isr, g_ptm_priv_data);
+#else
 ret = request_irq(PPE_MAILBOX_IGU1_INT, mailbox_irq_handler, 
IRQF_DISABLED, ptm_mailbox_isr, g_ptm_priv_data);
+#endif
 if ( ret ) {
 if ( ret == -EBUSY ) {
 err(IRQ may be occupied by other driver, please reconfig to 
disable it.);
-- 
2.4.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] generic: Allow configuring an increment with mtd-mac-address

2015-06-27 Thread Martin Blumenstingl
This is useful if the device also has an ethernet WAN interface with a
separate mac address (that is derived from the LAN mac address).

Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 .../patches-3.18/681-NET-add-of_get_mac_address_mtd.patch| 12 
 .../patches-4.0/681-NET-add-of_get_mac_address_mtd.patch | 12 
 .../patches-4.1/681-NET-add-of_get_mac_address_mtd.patch | 12 
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git 
a/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch 
b/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
index bb3bf98..8ce17fe 100644
--- a/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
@@ -23,12 +23,12 @@ Signed-off-by: John Crispin blo...@openwrt.org
  
  /**
   * of_get_phy_mode - Get phy mode for given device_node
-@@ -75,3 +76,39 @@ const void *of_get_mac_address(struct de
+@@ -75,3 +76,43 @@ const void *of_get_mac_address(struct de
return NULL;
  }
  EXPORT_SYMBOL(of_get_mac_address);
 +
-+int of_get_mac_address_mtd(struct device_node *np, void *mac)
++int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
 +{
 +  struct device_node *mtd_np = NULL;
 +  size_t retlen;
@@ -37,6 +37,7 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +  const char *part;
 +  const __be32 *list;
 +  phandle phandle;
++  u32 mac_inc = 0;
 +
 +  list = of_get_property(np, mtd-mac-address, size);
 +  if (!list || (size != (2 * sizeof(*list
@@ -57,9 +58,12 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +  if (IS_ERR(mtd))
 +  return PTR_ERR(mtd);
 +
-+  ret = mtd_read(mtd, be32_to_cpup(list), 6, retlen, (u_char *) mac);
++  ret = mtd_read(mtd, be32_to_cpup(list), 6, retlen, mac);
 +  put_mtd_device(mtd);
 +
++  if (!of_property_read_u32(np, mtd-mac-address-increment, mac_inc))
++  mac[5] += mac_inc;
++
 +  return ret;
 +}
 +EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
@@ -69,7 +73,7 @@ Signed-off-by: John Crispin blo...@openwrt.org
  #include linux/of.h
  extern int of_get_phy_mode(struct device_node *np);
  extern const void *of_get_mac_address(struct device_node *np);
-+extern int of_get_mac_address_mtd(struct device_node *np, void *mac);
++extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac);
  #else
  static inline int of_get_phy_mode(struct device_node *np)
  {
diff --git 
a/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch 
b/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
index bb3bf98..8ce17fe 100644
--- a/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
@@ -23,12 +23,12 @@ Signed-off-by: John Crispin blo...@openwrt.org
  
  /**
   * of_get_phy_mode - Get phy mode for given device_node
-@@ -75,3 +76,39 @@ const void *of_get_mac_address(struct de
+@@ -75,3 +76,43 @@ const void *of_get_mac_address(struct de
return NULL;
  }
  EXPORT_SYMBOL(of_get_mac_address);
 +
-+int of_get_mac_address_mtd(struct device_node *np, void *mac)
++int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
 +{
 +  struct device_node *mtd_np = NULL;
 +  size_t retlen;
@@ -37,6 +37,7 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +  const char *part;
 +  const __be32 *list;
 +  phandle phandle;
++  u32 mac_inc = 0;
 +
 +  list = of_get_property(np, mtd-mac-address, size);
 +  if (!list || (size != (2 * sizeof(*list
@@ -57,9 +58,12 @@ Signed-off-by: John Crispin blo...@openwrt.org
 +  if (IS_ERR(mtd))
 +  return PTR_ERR(mtd);
 +
-+  ret = mtd_read(mtd, be32_to_cpup(list), 6, retlen, (u_char *) mac);
++  ret = mtd_read(mtd, be32_to_cpup(list), 6, retlen, mac);
 +  put_mtd_device(mtd);
 +
++  if (!of_property_read_u32(np, mtd-mac-address-increment, mac_inc))
++  mac[5] += mac_inc;
++
 +  return ret;
 +}
 +EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
@@ -69,7 +73,7 @@ Signed-off-by: John Crispin blo...@openwrt.org
  #include linux/of.h
  extern int of_get_phy_mode(struct device_node *np);
  extern const void *of_get_mac_address(struct device_node *np);
-+extern int of_get_mac_address_mtd(struct device_node *np, void *mac);
++extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac);
  #else
  static inline int of_get_phy_mode(struct device_node *np)
  {
diff --git 
a/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch 
b/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch
index fe3f04e..6542898 100644
--- a/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch
+++ 

[OpenWrt-Devel] [PATCH 2/3] lantiq: Make ltq-ifxos compile with kernel 4.1

2015-06-27 Thread Martin Blumenstingl
Signed-off-by: Martin Blumenstingl martin.blumensti...@googlemail.com
---
 .../lantiq/ltq-ifxos/patches/100-compat.patch  | 119 +
 1 file changed, 97 insertions(+), 22 deletions(-)

diff --git a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch 
b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch
index 2fd7cd3..a91dafe 100644
--- a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch
+++ b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch
@@ -1,8 +1,6 @@
-Index: lib_ifxos-1.5.14/configure.in
-===
 lib_ifxos-1.5.14.orig/configure.in 2010-07-22 18:34:07.0 +0200
-+++ lib_ifxos-1.5.14/configure.in  2013-03-14 08:23:57.481810836 +0100
-@@ -64,7 +64,7 @@
+--- a/configure.in
 b/configure.in
+@@ -64,7 +64,7 @@ dnl Set kernel build path
  AC_ARG_ENABLE(kernelbuild,
AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path 
(only for kernel 2.6.x)),
[
@@ -11,10 +9,8 @@ Index: lib_ifxos-1.5.14/configure.in
AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
else
AC_MSG_ERROR([The kernel build directory is not valid 
or not configured!])
-Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c
-===
 lib_ifxos-1.5.14.orig/src/linux/ifxos_linux_thread_drv.c   2010-01-08 
18:10:47.0 +0100
-+++ lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c2013-03-14 
08:23:57.481810836 +0100
+--- a/src/linux/ifxos_linux_thread_drv.c
 b/src/linux/ifxos_linux_thread_drv.c
 @@ -34,8 +34,8 @@
  #include linux/sched.h
  #include linux/version.h
@@ -36,7 +32,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c
  /* 

 IFX Linux adaptation - Kernel Thread handling
 = 
*/
-@@ -96,9 +92,9 @@
+@@ -96,9 +92,9 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
 - IFX_SUCCESS on success
 - IFX_ERROR on error
  */
@@ -48,7 +44,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c
 IFX_int32_t retVal  = IFX_ERROR;
  #if (LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0))
 struct task_struct *kthread = current;
-@@ -139,7 +135,7 @@
+@@ -139,7 +135,7 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr
 /* let others run */
 unlock_kernel();
  #else
@@ -57,7 +53,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c
  
 /* Enable signals in Kernel = 2.6 */
 allow_signal(SIGKILL);
-@@ -218,9 +214,7 @@
+@@ -218,9 +214,7 @@ IFX_int32_t IFXOS_ThreadInit(
   init_completion(pThrCntrl-thrCompletion);
  
   /* start kernel thread via the wrapper function */
@@ -68,11 +64,9 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c
  
   pThrCntrl-bValid = IFX_TRUE;
  
-Index: lib_ifxos-1.5.14/src/include/ifxos_thread.h
-===
 lib_ifxos-1.5.14.orig/src/include/ifxos_thread.h   2010-01-14 
10:59:13.0 +0100
-+++ lib_ifxos-1.5.14/src/include/ifxos_thread.h2013-03-14 
08:24:43.577812806 +0100
-@@ -111,7 +111,7 @@
+--- a/src/include/ifxos_thread.h
 b/src/include/ifxos_thread.h
+@@ -111,7 +111,7 @@ typedef struct IFXOS_ThreadParams_s
  /**
 Function type of the user thread/task function.
  */
@@ -81,11 +75,9 @@ Index: lib_ifxos-1.5.14/src/include/ifxos_thread.h
  
  /** @} */
  
-Index: lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h
-===
 lib_ifxos-1.5.14.orig/src/include/linux/ifxos_linux_thread.h   
2010-01-08 18:10:27.0 +0100
-+++ lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h2013-03-14 
08:25:13.193814073 +0100
-@@ -152,7 +152,7 @@
+--- a/src/include/linux/ifxos_linux_thread.h
 b/src/include/linux/ifxos_linux_thread.h
+@@ -152,7 +152,7 @@ typedef struct
 IFXOS_ThreadFunction_t  pThrFct;
  
 /** Kernel thread process ID */
@@ -94,3 +86,86 @@ Index: 
lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h
  
 /** requested kernel thread priority */
 IFX_int32_t nPriority;
+--- a/src/linux/ifxos_linux_socket_drv.c
 b/src/linux/ifxos_linux_socket_drv.c
+@@ -19,6 +19,7 @@
+ /* 

+IFX Linux adaptation - Global Includes - Kernel
+= 
*/
++#include linux/version.h
+ #include linux/kernel.h
+ #ifdef MODULE
+#include linux/module.h
+@@ -166,23 +167,33 @@ IFX_int_t IFXOS_SocketSendTo(
+IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR);
+IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR);
+ 
++   iov.iov_base = pBuffer;
++   iov.iov_len = (unsigned int) 

[OpenWrt-Devel] [PATCH 0/3] lantiq: Initial support for linux 4.1

2015-06-27 Thread Martin Blumenstingl
This adds basic linux 4.1 support to the lantiq target.
It is booting without any oops'es and ethernet is working fine.

The PTM/ATM driver and the lantiq ifxos driver had to be patched
to be compatible with linux 4.1.
Those patches were compile-tested only (on 3.18 and 4.1).

A bootlog can be found here: https://paste.kde.org/pffvzpzdv


Martin Blumenstingl (3):
  Add support for linux 4.1
  lantiq: Make ltq-ifxos compile with kernel 4.1
  lantiq: Make ATM and PTM drivers compatible with kernel 4.1

 package/kernel/lantiq/ltq-atm/src/ltq_atm.c|4 +
 .../lantiq/ltq-ifxos/patches/100-compat.patch  |  119 +-
 .../kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c   |4 +
 .../kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c   |4 +
 target/linux/lantiq/config-4.1 |  163 +
 .../0001-MIPS-lantiq-add-pcie-driver.patch | 5540 
 .../0002-MIPS-lantiq-dtb-image-hack.patch  |   31 +
 .../0004-MIPS-lantiq-add-atm-hack.patch|  500 ++
 .../0007-MIPS-lantiq-add-basic-tffs-driver.patch   |  111 +
 .../0008-MIPS-lantiq-backport-old-timer-code.patch | 1028 
 .../0012-pinctrl-lantiq-fix-up-pinmux.patch|   79 +
 ...0013-MTD-lantiq-xway-fix-invalid-operator.patch |   24 +
 ...xway-the-latched-command-should-be-persis.patch |   44 +
 .../0015-MTD-lantiq-xway-remove-endless-loop.patch |   41 +
 ...xway-add-missing-write_buf-and-read_buf-t.patch |   55 +
 .../0017-MTD-xway-fix-nand-locking.patch   |   89 +
 .../0018-MTD-nand-lots-of-xrx200-fixes.patch   |  125 +
 ...MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch |   25 +
 ...MTD-m25p80-allow-loading-mtd-name-from-OF.patch |   44 +
 ...023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch |  271 +
 ...024-NET-lantiq-adds-PHY11G-firmware-blobs.patch |  364 ++
 .../0025-NET-MIPS-lantiq-adds-xrx200-net.patch | 3339 
 .../patches-4.1/0026-NET-multi-phy-support.patch   |   53 +
 .../0028-NET-lantiq-various-etop-fixes.patch   |  907 
 .../0030-GPIO-add-named-gpio-exports.patch |  166 +
 ...2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch | 1034 
 .../0032-USB-fix-roothub-for-IFXHCD.patch  |   31 +
 .../0033-SPI-MIPS-lantiq-adds-spi-xway.patch   | 1020 
 ...ompile-when-reset-RESET_CONTROLLER-is-not.patch |   45 +
 ...-lantiq-wifi-and-ethernet-eeprom-handling.patch |  614 +++
 .../0036-owrt-generic-dtb-image-hack.patch |   32 +
 .../patches-4.1/0038-MIPS-lantiq-fpi-on-ar9.patch  |   21 +
 .../0039-MIPS-lantiq-initialize-usb-on-boot.patch  |   96 +
 .../0040-USB-DWC2-enable-usb-power-gpio.patch  |   35 +
 .../patches-4.1/0041-USB-DWC2-add-ltq-params.patch |   45 +
 .../0042-USB-DWC2-big-endian-support.patch | 3156 +++
 .../0043-gpio-stp-xway-fix-phy-mask.patch  |   23 +
 .../0100-lantiq-xrx200-enable-remove-crc.patch |   25 +
 .../linux/lantiq/patches-4.1/0101-mtd-split.patch  |  192 +
 .../patches-4.1/0150-lantiq-pinctrl-xway.patch |   15 +
 .../0151-lantiq-ifxmips_pcie-use-of.patch  |   51 +
 .../0160-owrt-lantiq-multiple-flash.patch  |  217 +
 ...D-cfi-cmdset-0001-disable-buffered-writes.patch |   11 +
 43 files changed, 19771 insertions(+), 22 deletions(-)
 create mode 100644 target/linux/lantiq/config-4.1
 create mode 100644 
target/linux/lantiq/patches-4.1/0001-MIPS-lantiq-add-pcie-driver.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0002-MIPS-lantiq-dtb-image-hack.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0004-MIPS-lantiq-add-atm-hack.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0007-MIPS-lantiq-add-basic-tffs-driver.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0008-MIPS-lantiq-backport-old-timer-code.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0012-pinctrl-lantiq-fix-up-pinmux.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0013-MTD-lantiq-xway-fix-invalid-operator.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0014-MTD-lantiq-xway-the-latched-command-should-be-persis.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0015-MTD-lantiq-xway-remove-endless-loop.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0016-MTD-lantiq-xway-add-missing-write_buf-and-read_buf-t.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0017-MTD-xway-fix-nand-locking.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0018-MTD-nand-lots-of-xrx200-fixes.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0020-MTD-lantiq-handle-NO_XIP-on-cfi0001-flash.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0022-MTD-m25p80-allow-loading-mtd-name-from-OF.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0024-NET-lantiq-adds-PHY11G-firmware-blobs.patch
 create mode 100644 
target/linux/lantiq/patches-4.1/0025-NET-MIPS-lantiq-adds-xrx200-net.patch
 create 

Re: [OpenWrt-Devel] [PATCH 6/6] bcm53xx: R8000 handle PEX8603 switch

2015-06-27 Thread Ian Kent
On Tue, 2015-06-23 at 07:58 +0800, Ian Kent wrote:
 On Mon, 2015-06-22 at 18:42 +0200, Hauke Mehrtens wrote:
  
  On 03/10/2015 04:30 AM, Ian Kent wrote:
   The Netgear R8000 has a PEX8603 connected to the BCM53012 and if
   it isn't configured during the bus scan the PCI layer goes crazy
   trying to configure phantom devices.
  
  Could you provide some diagram how this is connected?
 
 I could try, when I get a chance, ascii art isn't my strong suit.
 
  
  My current assumption is that on one of the 3 PCIe ports is this switch,
  so the scan will find this switch as a PCIe device, bu how does it go
  from there?
 
 I can only infer from looking at sysfs, which is what I have done.
 
 Perhaps I'm not correct but it looks to me that there are is a BCM53012
 connected with two legs, one has one wireless device, and the other has
 a PEX8603 bridge which has two legs, each with a wireless device.

I still think this is the correct topology and IIRC that was also
inferred by looking at sysfs with vendor firmware installed. But maybe
my recollection fails me, I'll need to check.

 
  From the vendor driver I would assume that that the two devices behind
  the switch are device function 0x08 and 0x10 on the switch device.
 
 I'll have to reacquaint myself with the code before I respond to the
 comments below, its been a while.

Yes, looking at the code again they are upstream port bus number + 1,
devfn 0x08 (aka. slot 1) and upstream port bus number + 2, devfn 0x10
(aka. slot 2) so the slot number can't be used alone.

  
  
  Can you also post the output of lspci on your device?
 
 Don't think I have lspci in the build I was using, I'll need to add it
 and rebuild. That probably won't be until the weekend.

I'll get this when the ncurses build breakage is fixed or perhaps by
deselecting ncurses dependencies if it takes too long for it to be
fixed.

 
  
   
   Signed-off-by: Ian Kent ra...@themaw.net
   ---
.../172-bcm5301x-R8000-handle-PEX8603-switch.patch |  225 
   
.../172-bcm5301x-R8000-handle-PEX8603-switch.patch |  225 
   
2 files changed, 450 insertions(+)
create mode 100644 
   target/linux/bcm53xx/patches-3.14/172-bcm5301x-R8000-handle-PEX8603-switch.patch
create mode 100644 
   target/linux/bcm53xx/patches-3.18/172-bcm5301x-R8000-handle-PEX8603-switch.patch
   
  
  
  ..
  
  
   diff --git 
   a/target/linux/bcm53xx/patches-3.18/172-bcm5301x-R8000-handle-PEX8603-switch.patch

   b/target/linux/bcm53xx/patches-3.18/172-bcm5301x-R8000-handle-PEX8603-switch.patch
   new file mode 100644
   index 000..fc606b4
   --- /dev/null
   +++ 
   b/target/linux/bcm53xx/patches-3.18/172-bcm5301x-R8000-handle-PEX8603-switch.patch
   @@ -0,0 +1,225 @@
   +bcm53xx: R8000 handle PEX8603 switch
   +
   +The Netgear R8000 has a PEX8603 which, if not configured at
   +bus probe results in quite a few phantom devices as it doesn't
   +respond properly to configuration requests. The device needs
   +to be configured when seen.
   +
   +Signed-off-by: Ian Kent ra...@themaw.net
   +
   +--- a/drivers/pci/host/pci-host-bcm5301x.c
    b/drivers/pci/host/pci-host-bcm5301x.c
   +@@ -29,6 +29,21 @@
   + #define PCI_TARGET_LINK_SPEED_GEN20x2
   + #define PCI_TARGET_LINK_SPEED_GEN10x1
   + 
   ++#define PCI_MAX_BUS 4
   ++#define PLX_PRIM_SEC_BUS_NUM(0x0201 | (PCI_MAX_BUS  
   16))
   ++
   ++#ifndef SZ_48M
   ++#define SZ_48M  (SZ_32M + SZ_16M)
   ++#endif
  
  Please remove the ifndef, it should fail if this gets added.

OK, I put the conditional in thinking this might be added to
linux/sizes.h at some point but looking at sizes.h again we probably
won't see the 48 variant being added.

  
  
   ++
   ++struct pex86xx_info {
   ++u8 busno;   /* Upstream bus PEX is on */
   ++u8 slot;/* Upstream slot PEX is at */
   ++u16 active; /* Active port count */
   ++u16 ports;  /* Active port bit map */
   ++};
   ++struct pex86xx_info pex8603;
   ++
   + static int bcma_pcie2_map_irq(const struct pci_dev *pdev, u8 slot, u8 
   pin)
   + {
   + struct pci_sys_data *sys = pdev-sysdata;
   +@@ -115,6 +130,39 @@ static int bcma_pcie2_read_config_pci(st
   + struct pci_sys_data *sys = bus-sysdata;
   + struct bcma_device *bdev = sys-private_data;
   + 
   ++/* The PEX8603 won't return sensible values to the PCI layer so
   ++ * we have to do that ourselves.
   ++ */
   ++if (pex8603.busno) {
   ++u16 slot = PCI_SLOT(devfn);
   ++
   ++/* Not the PEX upstream slot */
   ++if (pex8603.busno == bus-number  pex8603.slot != 
   slot)
   ++goto done;
   ++
   ++/* Not the PEX downstream bus? */
   ++if (bus-number  pex8603.busno ||
   ++bus-number  pex8603.busno + 1)
   ++

[OpenWrt-Devel] Patch to enable RFKill and USB Power GPIO for tl-wdr4900v1

2015-06-27 Thread Alpha Sparc
Add dts patch to enable RFKill and USB Power GPIO Control

--- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
+++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/tl-wdr4900-v1.dts
@@ -198,6 +198,11 @@
 gpios = gpio0 4 1; /* active low */
 label = tp-link:green:usb2;
 };
+
+usbpower {
+gpios = gpio0 10 1; /* active low */
+label = tp-link:usb:power;
+};
 };

 buttons {
@@ -208,6 +213,12 @@
 gpios = gpio0 5 1; /* active low */
 linux,code = 0x198; /* KEY_RESTART */
 };
+
+rfkill {
+label = RFKILL switch;
+gpios = gpio0 11 1; /* active low */
+linux,code = 0xf7; /* RFKill */
+};
 };
 };
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel