[OpenWrt-Devel] MAC swap handling for QCA8337N

2016-04-22 Thread Gareth Parker
First time posting to this list

I am adding support for the Comfast CF-WR650AC and have it working.  However
this router has a QCA8337N switch and MAC exchange needs to be enabled for
it to work properly or the router hangs and reboots when trying to access
anything switch related.

The problem is the QCA8337N in this device is not being enabled with MAC
exchange by default as it should be according to r47956.  There is no way to
manually enable either as was the case previously by using mac06_exchange_en
= true in the devices machine file.

I also have an EPG5000 with exactly the same switch type QCA8337N, this
device requires MAC exchange and previously had mac06_exchange_en = true in
its machine file, was removed in r47956 and I can confirm this device still
works no problem.

I changed the following so I could manually enable it and fix the problem.
It appears that the QCA8337N on at-least the CF-WR650AC is not automatically
enabled with MAC exchange for some reason.  If there is a better way I can
do this, please advise.

Gareth

diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c
b/target/linux/generic/files/drivers/net/phy/ar8327.c
index d879782..3a84e2c 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.c
@@ -505,7 +505,7 @@ ar8327_hw_config_pdata(struct ar8xxx_priv *priv,
data->port6_status = ar8327_get_port_init_status(&pdata->port6_cfg);

t = ar8327_get_pad_cfg(pdata->pad0_cfg);
-   if (chip_is_ar8337(priv) && !pdata->pad0_cfg->mac06_exchange_dis)
+   if ((chip_is_ar8337(priv) || pdata->pad0_cfg->mac06_exchange_en) &&
!pdata->pad0_cfg->mac06_exchange_dis)
t |= AR8337_PAD_MAC06_EXCHANGE_EN;
ar8xxx_write(priv, AR8327_REG_PAD0_MODE, t);

diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h
b/target/linux/generic/files/include/linux/ar8216_platform.h
index 24bc442..a8d37ca 100644
--- a/target/linux/generic/files/include/linux/ar8216_platform.h
+++ b/target/linux/generic/files/include/linux/ar8216_platform.h
@@ -47,6 +47,7 @@ struct ar8327_pad_cfg {
bool sgmii_delay_en;
enum ar8327_clk_delay_sel txclk_delay_sel;
enum ar8327_clk_delay_sel rxclk_delay_sel;
+   bool mac06_exchange_en;
bool mac06_exchange_dis;
 };
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [RFC] ramips: fix bad patch awake rt305x USB controller

2016-04-22 Thread Сергей Василюгин
Sorry, fix bad patch (ticket #22248)

Signed-Off-By: Serge Vasilugin 

diff --git 
a/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch 
b/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch
index 9608f6f..2ba462d 100644
--- a/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch
+++ b/target/linux/ramips/patches-4.4/0069-awake-rt305x-dwc2-controller.patch
@@ -1,15 +1,15 @@
 --- a/drivers/usb/dwc2/platform.c
 +++ b/drivers/usb/dwc2/platform.c
 @@ -375,6 +375,12 @@ static int dwc2_driver_probe(struct plat
- dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n",
- (unsigned long)res->start, hsotg->regs);
+   dev_dbg(&dev->dev, "mapped PA %08lx to VA %p\n",
+   (unsigned long)res->start, hsotg->regs);
  
-+ /* Enable USB port before any regs access */
-+ if(dwc2_readl(hsotg->regs + PCGCTL) & 0x0f) {
-+ dwc2_writel(0x00, hsotg->regs + PCGCTL);
-+ /* TODO: mdelay(25) here? vendor driver don't use it */
-+ }
++  /* Enable USB port before any regs access */
++  if(dwc2_readl(hsotg->regs + PCGCTL) & 0x0f) {
++  dwc2_writel(0x00, hsotg->regs + PCGCTL);
++  /* TODO: mdelay(25) here? vendor driver don't use it */
++  }
 +
- hsotg->dr_mode = usb_get_dr_mode(&dev->dev);
- if (IS_ENABLED(CONFIG_USB_DWC2_HOST) &&
- hsotg->dr_mode != USB_DR_MODE_HOST) {
+   hsotg->dr_mode = usb_get_dr_mode(&dev->dev);
+   if (IS_ENABLED(CONFIG_USB_DWC2_HOST) &&
+   hsotg->dr_mode != USB_DR_MODE_HOST) {

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


[OpenWrt-Devel] [PATCH] ubox: make system log support as a selectable option

2016-04-22 Thread Andrej Vlasic
Currently system log is always included as a part of ubox.
Add a config option to optionally exclude system log from ubox package.

Signed-off-by: Andrej Vlasic 
---
 package/system/ubox/Makefile | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/package/system/ubox/Makefile b/package/system/ubox/Makefile
index b32c794..70a9273 100644
--- a/package/system/ubox/Makefile
+++ b/package/system/ubox/Makefile
@@ -26,13 +26,29 @@ define Package/ubox
   CATEGORY:=Base system
   DEPENDS:=+libubox +ubusd +ubus +libubus +libuci +USE_GLIBC:librt
   TITLE:=OpenWrt system helper toolbox
+  MENU:=1
+endef
+
+define Package/ubox/config
+config UBOX_LOGD
+  bool
+  default y
+  depends on PACKAGE_ubox
+  prompt "Include system log implementation"
+  help
+   Include system log implementation which is implemented as part of ubox 
project.
 endef
 
 define Package/ubox/install
-   $(INSTALL_DIR) $(1)/sbin $(1)/usr/sbin $(1)/lib/ $(1)/etc/init.d/
+   $(INSTALL_DIR) $(1)/sbin $(1)/usr/sbin $(1)/lib/
 
-   $(INSTALL_BIN) 
$(PKG_INSTALL_DIR)/usr/sbin/{kmodloader,logd,logread,validate_data} $(1)/sbin/
+   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{kmodloader,validate_data} 
$(1)/sbin/
+  ifeq ($(CONFIG_UBOX_LOGD),y)
+   $(INSTALL_DIR) $(1)/etc/init.d/
+   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{logd,logread} $(1)/sbin/
$(INSTALL_BIN) ./files/log.init $(1)/etc/init.d/log
+  endif
+
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libvalidate.so $(1)/lib
 
$(LN) ../../sbin/kmodloader $(1)/usr/sbin/rmmod
-- 
2.8.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ar71xx: modernize fast SPI flash read

2016-04-22 Thread Heiner Kallweit
OpenWRT has own support for the memory-mapped fast SPI flash read on ath79.
With mainline kernel 4.6/4.7 more elegant generic support for this feature
was added upstream consisting of these two commits:

556351f14e74 "spi: introduce accelerated read support for spi flash devices"
08922f644878 "mtd: devices: m25p80: add support for mmap read request"

I cherry-picked them for use with ar71xx default kernel version 4.1
(new patches 460 + 461)
Once the ar71xx kernel version reaches 4.6 / 4.7 these patches
can be removed.

New patch 462 includes changes from old patch 463 which are not related
to the fast flash read feature.

New patch 463 includes the new implementation for the fast flash read
feature on ath79.

These four new patches replace old patches 460-464.

So far for testing I made the change for the 4.1 version only.
If it looks good I can do the same for the 4.4 version.

The change was successfully tested on a TP-Link TL-WDR3600.

Signed-off-by: Heiner Kallweit 
---
 .../460-spi-add-generic-flash-read.patch   | 159 ++
 .../460-spi-bitbang-export-spi_bitbang_bufs.patch  |  28 
 .../patches-4.1/461-m25p80-add-flash-read.patch|  33 
 .../461-spi-add-type-field-to-spi_transfer.patch   |  23 ---
 .../462-mtd-m25p80-set-spi-transfer-type.patch |  15 --
 .../patches-4.1/462-spi-extend-ath79_spi.patch |  32 
 .../patches-4.1/463-spi-add-ath79-flash-read.patch |  48 ++
 .../463-spi-ath79-add-fast-flash-read.patch| 185 -
 .../464-spi-ath79-fix-fast-flash-read.patch|  35 
 9 files changed, 272 insertions(+), 286 deletions(-)
 create mode 100644 
target/linux/ar71xx/patches-4.1/460-spi-add-generic-flash-read.patch
 delete mode 100644 
target/linux/ar71xx/patches-4.1/460-spi-bitbang-export-spi_bitbang_bufs.patch
 create mode 100644 
target/linux/ar71xx/patches-4.1/461-m25p80-add-flash-read.patch
 delete mode 100644 
target/linux/ar71xx/patches-4.1/461-spi-add-type-field-to-spi_transfer.patch
 delete mode 100644 
target/linux/ar71xx/patches-4.1/462-mtd-m25p80-set-spi-transfer-type.patch
 create mode 100644 
target/linux/ar71xx/patches-4.1/462-spi-extend-ath79_spi.patch
 create mode 100644 
target/linux/ar71xx/patches-4.1/463-spi-add-ath79-flash-read.patch
 delete mode 100644 
target/linux/ar71xx/patches-4.1/463-spi-ath79-add-fast-flash-read.patch
 delete mode 100644 
target/linux/ar71xx/patches-4.1/464-spi-ath79-fix-fast-flash-read.patch

diff --git 
a/target/linux/ar71xx/patches-4.1/460-spi-add-generic-flash-read.patch 
b/target/linux/ar71xx/patches-4.1/460-spi-add-generic-flash-read.patch
new file mode 100644
index 000..afc977e
--- /dev/null
+++ b/target/linux/ar71xx/patches-4.1/460-spi-add-generic-flash-read.patch
@@ -0,0 +1,159 @@
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
+index 47eff80..dcc6f6e 100644
+--- a/drivers/spi/spi.c
 b/drivers/spi/spi.c
+@@ -1152,6 +1152,7 @@ static void __spi_pump_messages(struct spi_master 
*master, bool in_kthread)
+   }
+   }
+ 
++  mutex_lock(&master->bus_lock_mutex);
+   trace_spi_message_start(master->cur_msg);
+ 
+   if (master->prepare_message) {
+@@ -1161,6 +1162,7 @@ static void __spi_pump_messages(struct spi_master 
*master, bool in_kthread)
+   "failed to prepare message: %d\n", ret);
+   master->cur_msg->status = ret;
+   spi_finalize_current_message(master);
++  mutex_unlock(&master->bus_lock_mutex);
+   return;
+   }
+   master->cur_msg_prepared = true;
+@@ -1170,6 +1172,7 @@ static void __spi_pump_messages(struct spi_master 
*master, bool in_kthread)
+   if (ret) {
+   master->cur_msg->status = ret;
+   spi_finalize_current_message(master);
++  mutex_unlock(&master->bus_lock_mutex);
+   return;
+   }
+ 
+@@ -1177,8 +1180,10 @@ static void __spi_pump_messages(struct spi_master 
*master, bool in_kthread)
+   if (ret) {
+   dev_err(&master->dev,
+   "failed to transfer one message from queue\n");
++  mutex_unlock(&master->bus_lock_mutex);
+   return;
+   }
++  mutex_unlock(&master->bus_lock_mutex);
+ }
+ 
+ /**
+@@ -2351,6 +2356,46 @@ int spi_async_locked(struct spi_device *spi, struct 
spi_message *message)
+ EXPORT_SYMBOL_GPL(spi_async_locked);
+ 
+ 
++int spi_flash_read(struct spi_device *spi,
++ struct spi_flash_read_message *msg)
++
++{
++  struct spi_master *master = spi->master;
++  int ret;
++
++  if ((msg->opcode_nbits == SPI_NBITS_DUAL ||
++   msg->addr_nbits == SPI_NBITS_DUAL) &&
++  !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
++  return -EINVAL;
++  if ((msg->opcode_nbits == SPI_NBITS_QUAD ||
++   msg->addr_nbits == SPI_NBITS_QUAD) &&
++  !(spi->mode & SPI_TX_QUAD))
++  return -EINV

Re: [OpenWrt-Devel] rsync mirror of download.openwrt.org ?

2016-04-22 Thread Laurent GUERBY
Hi,

Having no news we completed our mirror by using wget for 15.05.1:

http://openwrt.tetaneutral.net/

For mail contact openwrt-contact AT tetaneutral DOT net :

http://openwrt.tetaneutral.net/README.txt

10G+ network, dual stack IPv4+IPv6, we can add
a rsync server on request.

Still hoping we get the push setup at some point :)

Sincerely,

Laurent

Using a machine in Paris, France (800km from our DC in Toulouse):
# time wget  -O /dev/null
http://openwrt.tetaneutral.net/chaos_calmer/15.05.1/ar71xx/generic/OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2
 
--2016-04-22 17:29:27--
http://openwrt.tetaneutral.net/chaos_calmer/15.05.1/ar71xx/generic/OpenWrt-ImageBuilder-15.05.1-ar71xx-generic.Linux-x86_64.tar.bz2
Resolving openwrt.tetaneutral.net... 89.234.156.230
Connecting to openwrt.tetaneutral.net|89.234.156.230|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 143921369 (137M) [application/octet-stream]
(...)
143,921,369 87.5M/s   in 1.6s
2016-04-22 17:29:28 (87.5 MB/s) (...)

real0m1.598s
user0m0.116s
sys 0m0.376s


On Mon, 2016-04-11 at 23:54 +0200, Laurent GUERBY wrote:
> On Fri, 2016-03-25 at 19:02 +0100, Laurent GUERBY wrote:
> > On Sat, 2016-03-19 at 15:47 +0100, John Crispin wrote:
> > > 
> > > On 19/03/2016 14:10, Laurent GUERBY wrote:
> > > > Hi, 
> > > > 
> > > > We've setup a mirror of openwrt on a 10G+ connection IPv4+v6, MPTCP
> > > > support using initial rsync from ba.mirror.garr.it :
> > > > 
> > > > http://openwrt.tetaneutral.net
> > > > 
> > > > But garr.it does not have 15.05.1, is there a way to directly rsync from
> > > > downloads.openwrt.org ? Or any other way ? (push would be okay if
> > > > needed).
> > > > 
> > > > Sincerely
> > > > 
> > > > Laurent GUERBY
> > > > AS197422 http://tetaneutral.net
> > > 
> > > i can rsync 15.05.1 to your server if that is ok for you ...
> > 
> > Ok for us :)
> > 
> > Laurent
> > 
> > PS: public key request sent last sunday by mail
> > (may be lost somewhere ?)
> 
> Ping ?
> 
> Laurent
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Checksums of all files

2016-04-22 Thread Michal Hrusecky
Hi,

I run into idea I would like some feedback on before I'll send a real patch.
When people have an old router witch flash that may have some errors or root on
external drive, it can happen, that some files will get damaged. And in that
case it could be really useful to have checksums of all files - normally
package managers have that kind of information. Currently I did this:

--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -187,6 +187,9 @@ $(_endef)
$(CheckDependencies)
 
$(RSTRIP) $$(IDIR_$(1))
+   (cd $$(IDIR_$(1)); \
+   find . -type f \! -path ./CONTROL/* -exec md5sum \{\} + | \
+   sed 's|\([[:blank:]]\)\./|\1/|' > $$(IDIR_$(1))/CONTROL/files-md5sum )
(cd $$(IDIR_$(1))/CONTROL; \
( \
echo "CONTROL"; \

Although hacky, works for me as I can now use

> cat /usr/lib/opkg/info/*.files-md5sum | md5sum -c -

To verify that my installed packages are ok.

If I would send a patch, I would definitely make it optional. Best course of
action would be to include it in current files list and teach opkg to use it,
but that is too far ahead. What do you think about the idea itself for now?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCHv2] ramips: add support for Planex MZK-EX300NP

2016-04-22 Thread YuheiOKAWA
MZK-EX300NP is MT7620A based wifi repeater.
Built-in power supply.
64MiB RAM, 8MiB SPI Flash, non Wired Ethernet.

Signed-off-by: YuheiOKAWA 
---

Changes in v2:
- rebase
- change an line in 02_network

 target/linux/ramips/base-files/etc/board.d/01_leds |   1 +
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/MZK-EX300NP.dts| 132 +
 target/linux/ramips/image/mt7620.mk|   2 +
 target/linux/ramips/mt7620/profiles/planex.mk  |  12 ++
 8 files changed, 153 insertions(+)
 create mode 100644 target/linux/ramips/dts/MZK-EX300NP.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index e3b8500..0cfde02 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -118,6 +118,7 @@ dir-615-h1)
ucidef_set_led_default "status" "Status LED (amber)" 
"$board:amber:status" "0"
set_wifi_led "rt2800pci-phy0::radio"
;;
+mzk-ex300np|\
 dir-620-d1)
set_wifi_led "$board:green:wifi"
;;
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 3c958ae..c89b2a2 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -162,6 +162,7 @@ ramips_setup_interfaces()
;;
d105|\
hpm|\
+   mzk-ex300np|\
na930|\
wli-tx4-ag300n|\
wrh-300cr)
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index bd0ff05..0eda084 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -154,6 +154,7 @@ get_status_led() {
whr-600d)
status_led="$board:orange:wifi"
;;
+   mzk-ex300np|\
rt-n10-plus|\
tew-691gr|\
tew-692gr|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 550ec55..e17aa94 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -292,6 +292,9 @@ ramips_board_detect() {
*"MZK-DP150N")
name="mzk-dp150n"
;;
+   *"MZK-EX300NP")
+   name="mzk-ex300np"
+   ;;
*"MZK-W300NH2"*)
name="mzk-w300nh2"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 73ba6e6..c0ee14e 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -88,6 +88,7 @@ platform_check_image() {
mt7628|\
mzk-750dhp|\
mzk-dp150n|\
+   mzk-ex300np|\
mzk-w300nh2|\
mzk-wdpr|\
nbg-419n|\
diff --git a/target/linux/ramips/dts/MZK-EX300NP.dts 
b/target/linux/ramips/dts/MZK-EX300NP.dts
new file mode 100644
index 000..51e87ad
--- /dev/null
+++ b/target/linux/ramips/dts/MZK-EX300NP.dts
@@ -0,0 +1,132 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Planex MZK-EX300NP";
+
+   palmbus@1000 {
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   gpio3: gpio@688 {
+   status = "okay";
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q64";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+

Re: [OpenWrt-Devel] How to initialize multiple phy radios

2016-04-22 Thread Christian Lamparter
Hello,

On Friday, April 22, 2016 02:03:01 AM David Hutchison wrote:
> I have been working on a board port and have everything working except
> for the 2nd radio. This board has a QCA9531 CPU and 2 WiFi Radios:
> AR9531 and a QCA9887 ( http://routerboard.com/RB952Ui-5ac2nD for more
> details ).
> [snip]
>
> Anyway, the Mikrotik hAP only has one radio and is 100% working.
> However the hAP AC Lite has an additional radio ( QCA988X )... I've
> compiled in ath10k, and added "ath79_register_pci()" but it doesn't
> find the radio. I've looked at ap91_pci_init() as well as
> ap94_pci_init() and haven't had any luck.

Does ath79_register_pci actually register the pci bus (there should
be some noise in the kernel log when it registers the pci bus)? Or
does it return an error -ENODEV?

This is what it looks like on a Archer C7: (Has a QCA9880)
[0.129096] ar724x-pci ar724x-pci.0: PCIe link is down   



[0.133988] registering PCI controller with io_map_base unset



[0.139678] registering PCI controller with io_map_base unset



[0.586626] PCI host bridge to bus :00   



[0.590553] pci_bus :00: root bus resource [mem 0x1000-0x11ff]   



[0.597148] pci_bus :00: root bus resource [io  0x]  



[0.602534] pci_bus :00: root bus resource [??? 0x flags 0x0] 
...

I looked at ath79_register_pci, it is located in /arch/mips/ath79/pci.c.
On the first look, it doesn't look like your SoC is present there.
However soc_is_qca953x is just testing soc_is_qca9533. Can you verify
that this is indeed correct and the function actually calls 
ath79_register_pci_ar724x?

> What is the normal way for initializing a platform with multiple
> radio's? Of course I don't know the exact wiring with this board, but
> I believe the QCA988X 802.11ac radio is on a PCI bus of some sort. I'm
> not entirely sure, but every example I have seen it appears to be.
Hm, I don't know much about your device. If it's a proper QCA988X mini-pcie
radio and has the calibration data on a chip on its minipcie board, then
you don't need to setup anything else. Having select kmod-ath10k 
(which AFAIK includes the firmware as well) is enough.

But if the calibration data for ath10k is part of the routerboard's caldata
partition, you need to extracted by the userspace. This is currently done
by a script:
target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata

So you will need to add your device there with the right extraction
code.

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


[OpenWrt-Devel] [PATCHv2] ramips: add support for Planex CS-QR10

2016-04-22 Thread YuheiOKAWA
CS-QR10 is MT7620A based IP Camera.

the camera and sound does not work with kernel 4.4.
 - camera chip is sn9c291.
 - sound chip is wm8960.

Signed-off-by: YuheiOKAWA 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   3 +-
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/CS-QR10.dts| 163 +
 target/linux/ramips/image/mt7620.mk|   2 +
 target/linux/ramips/mt7620/profiles/planex.mk  |  14 ++
 8 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ramips/dts/CS-QR10.dts

diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds 
b/target/linux/ramips/base-files/etc/board.d/01_leds
index e3b8500..367801d 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -30,7 +30,8 @@ br-6475nd|\
 mzk-w300nh2)
set_wifi_led "$board:amber:wlan"
;;
-a5-v11)
+a5-v11|\
+cs-qr10)
ucidef_set_led_default "power" "POWER" "$board:red:power" "1"
;;
 ai-br100)
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network 
b/target/linux/ramips/base-files/etc/board.d/02_network
index 3c958ae..dc3d1bc 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -160,6 +160,7 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0"
;;
+   cs-qr10|\
d105|\
hpm|\
na930|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index bd0ff05..2d43f54 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -33,6 +33,7 @@ get_status_led() {
status_led="$board:green:power"
;;
a5-v11|\
+   cs-qr10|\
d105|\
dcs-930l-b1|\
ex2700|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 550ec55..73dd599 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -88,6 +88,9 @@ ramips_board_detect() {
*"CF-WR800N")
name="cf-wr800n"
;;
+   *"CS-QR10")
+   name="cs-qr10"
+   ;;
*"CY-SWR1100")
name="cy-swr1100"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 73ba6e6..f153b02 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -34,6 +34,7 @@ platform_check_image() {
broadway|\
carambola|\
cf-wr800n|\
+   cs-qr10|\
d105|\
dap-1350|\
db-wrt01|\
diff --git a/target/linux/ramips/dts/CS-QR10.dts 
b/target/linux/ramips/dts/CS-QR10.dts
new file mode 100644
index 000..08299e3
--- /dev/null
+++ b/target/linux/ramips/dts/CS-QR10.dts
@@ -0,0 +1,163 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "ralink,mt7620a-soc";
+   model = "Planex CS-QR10";
+
+   palmbus@1000 {
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   status = "okay";
+   };
+
+   gpio2: gpio@660 {
+   status = "okay";
+   };
+
+   gpio3: gpio@688 {
+   status = "okay";
+   };
+
+   i2c@900 {
+   status = "okay";
+   };
+
+   i2s: i2s@a00 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <&pcm_i2s_pins>;
+   };
+
+   spi@b00 {
+   status = "okay";
+
+   m25p80@0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "jedec,spi-nor";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "mx25l6405d";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-e

[OpenWrt-Devel] [PATCH] [scripts] avoid hard-coded path in sha-bang

2016-04-22 Thread Iblis Lin
Signed-off-by: Iblis Lin 
---
 scripts/brcmImage.pl  | 2 +-
 scripts/deptest.sh| 2 +-
 scripts/feeds | 2 +-
 scripts/mkits.sh  | 2 +-
 scripts/pad_image | 2 +-
 scripts/redboot-script.pl | 2 +-
 scripts/remote-gdb| 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/brcmImage.pl b/scripts/brcmImage.pl
index 9a3acb4..60a59f2 100755
--- a/scripts/brcmImage.pl
+++ b/scripts/brcmImage.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 #Copyright (C) 2009Henk Vergonet 
 #
diff --git a/scripts/deptest.sh b/scripts/deptest.sh
index 047a0ce..03da9f5 100755
--- a/scripts/deptest.sh
+++ b/scripts/deptest.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Automated OpenWrt package dependency checker
 #
diff --git a/scripts/feeds b/scripts/feeds
index 79b5284..2b88eb8 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 use Getopt::Std;
 use FindBin;
 use Cwd;
diff --git a/scripts/mkits.sh b/scripts/mkits.sh
index 6b5100e..8857996 100755
--- a/scripts/mkits.sh
+++ b/scripts/mkits.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 #
 # Licensed under the terms of the GNU GPL License version 2 or later.
 #
diff --git a/scripts/pad_image b/scripts/pad_image
index 14f1499..b1941a2 100755
--- a/scripts/pad_image
+++ b/scripts/pad_image
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 function usage {
   echo "Usage: prepare_image image_type kernel_image rootfs_image header_size"
diff --git a/scripts/redboot-script.pl b/scripts/redboot-script.pl
index 123ebe3..e2d1264 100755
--- a/scripts/redboot-script.pl
+++ b/scripts/redboot-script.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 #
 # Script for generating redboot configs, based on brcmImage.pl
 #
diff --git a/scripts/remote-gdb b/scripts/remote-gdb
index cd59033..5230663 100755
--- a/scripts/remote-gdb
+++ b/scripts/remote-gdb
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 
 use strict;
 use warnings;
-- 
2.8.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] How to initialize multiple phy radios

2016-04-22 Thread David Hutchison
Hello,

I have been working on a board port and have everything working except
for the 2nd radio. This board has a QCA9531 CPU and 2 WiFi Radios:
AR9531 and a QCA9887 ( http://routerboard.com/RB952Ui-5ac2nD for more
details ).

The 2.4GHz radio works great, and I have acquired the correct calibration data:

[   23.44] ath: EEPROM regdomain: 0x0
[   23.44] ath: EEPROM indicates default country code should be used
[   23.44] ath: doing EEPROM country->regdmn map search
[   23.44] ath: country maps to regdmn code: 0x3a
[   23.44] ath: Country alpha2 being used: US
[   23.44] ath: Regpair used: 0x3a
[   23.45] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   23.45] Registered led device: ath9k-phy0
[   23.46] ieee80211 phy0: Atheros AR9531 Rev:0 mem=0xb810, irq=47
[   23.63] cfg80211: Regulatory domain changed to country: US
[   23.63] cfg80211:  DFS Master region: FCC
[   23.64] cfg80211:   (start_freq - end_freq @ bandwidth),
(max_antenna_gain, max_eirp), (dfs_cac_time)
[   23.65] cfg80211:   (2402000 KHz - 2472000 KHz @ 4 KHz),
(N/A, 3000 mBm), (N/A)
[   23.65] cfg80211:   (517 KHz - 525 KHz @ 8 KHz,
16 KHz AUTO), (N/A, 2300 mBm), (N/A)
[   23.66] cfg80211:   (525 KHz - 533 KHz @ 8 KHz,
16 KHz AUTO), (N/A, 2300 mBm), (0 s)
[   23.67] cfg80211:   (549 KHz - 573 KHz @ 16 KHz),
(N/A, 2300 mBm), (0 s)
[   23.68] cfg80211:   (5735000 KHz - 5835000 KHz @ 8 KHz),
(N/A, 3000 mBm), (N/A)
[   23.69] cfg80211:   (5724 KHz - 6372 KHz @ 216
KHz), (N/A, 4000 mBm), (N/A)

That is being done with the following code snippet:
void __init rbhap_wlan_init(u16 id)
{
char *caldata;
u8 wlan_mac[ETH_ALEN];

caldata = rb_get_ext_wlan_data(id);
if (caldata == NULL) {
pr_err("caldata is NULL\n");
return;
}

ath79_init_mac(wlan_mac, ath79_mac_base, 2);
ath79_register_wmac(caldata + 0x1000, wlan_mac);

kfree(caldata);
}

This particular architecture i'm working on adds kernel support for
the hAP as well as the hAP AC Lite. I'm passing "1" or "0" to
rbhap_wlan_init() based on the board:

flags = rbhap_get_flags(info);

if (flags & RB95X_FLAG_80211AC) {
rbhap_wlan_init(1);
ath79_register_pci();
} else {
rbhap_wlan_init(0);
}

I saw the "get_flags" example from mach-rb91x.c as the "board=" in the
bootloader were the same for both the Mikrotik hAP and Mikrotik hAP AC
Lite.

Anyway, the Mikrotik hAP only has one radio and is 100% working.
However the hAP AC Lite has an additional radio ( QCA988X )... I've
compiled in ath10k, and added "ath79_register_pci()" but it doesn't
find the radio. I've looked at ap91_pci_init() as well as
ap94_pci_init() and haven't had any luck.

What is the normal way for initializing a platform with multiple
radio's? Of course I don't know the exact wiring with this board, but
I believe the QCA988X 802.11ac radio is on a PCI bus of some sort. I'm
not entirely sure, but every example I have seen it appears to be.

Any insight as to what to try, to initialize this 2nd radio would be
much appreciated!
QCA9531 + AR9531 + QCA988x

Thank you!!

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


Re: [OpenWrt-Devel] [PATCH 2/2] lantiq: Fix status LED on TDW89X0 after boot is completed.

2016-04-22 Thread Vittorio G (VittGam)

On 22/04/2016 08:34:41 CEST, Mathias Kresin wrote:

Am 21.04.2016 um 23:43 schrieb Vittorio Gambaletta (VittGam):

After recent patches, the status LED on this router would stay
switched off after boot is completed. A switched off status LED
often indicates a boot failure (eg. kernel panic), so fix this and
get back to the previous behaviour.


NAK

This change was intentional. Personally, I don't like the idea of using the WPS 
led as permanent (running) status led. I've never tried it, but I may be 
possible to use WPS with hostapd and show the status of the WPS action using 
the WPS led. I like to prevent such a double use of leds.


Well, personally I think that the WPS LED on this router should be used as a "permanent" 
system status LED, since the power LED is hardwired to the power supply, and there is no other 
status LED to be used. Since the WPS LED is unused by default on OpenWrt, I think it's better to 
use it as full system status LED, to avoid "dying" visually on first boot when no DSL or 
Wi-Fi is configured. This is the same behaviour we have on the TP-LINK MR3020 for example: the 
System LED in OpenWrt (which stays on after boot) corresponds to the WPS LED as it was used in the 
original firmware.

Also, if things haven't changed, you need to write custom scripts to use the WPS LED to indicate 
WPS status. And if you do customize your OpenWrt install with such scripts, and you want the LED to 
default to off instead of on when WPS is not being used, you can just add a section for the WPS LED 
in /etc/config/system with "option trigger 'none'" and "option default '0'" to 
have it switch off after boot is finished.


The basic idea was to let the WPS led blink as long as the device boots and 
switch it off at the time the boot has finished. Which means an unsuccessful 
boot is indicated by a still blinking WPS led.


Nope. If there is a kernel panic, all the GPIO LEDs will stop blinking and get 
switched off. At least when it happened to me it was like this, but it was some 
years ago so I might not remember well (or maybe things have changed and the 
kernel does not stop hardware-assisted LED blinking on panic anymore, or it was 
just some other coincidence...).


Mathias



Signed-off-by: Vittorio Gambaletta 
---

--- a/target/linux/lantiq/dts/TDW89X0.dtsi
+++ b/target/linux/lantiq/dts/TDW89X0.dtsi
@@ -8,6 +8,7 @@
/* the power led can't be controlled, use the wps led 
instead */
boot = &wps;
failsafe = &wps;
+   running = &wps;

dsl = &dsl;
internet = &internet;
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

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