[LEDE-DEV] [PATCH] ramips: add support for GL-inet GL-MT300N-V2

2017-05-05 Thread kysonlok
This patch adds supports for the GL-inet GL-MT300N-V2.

Specification:
- SoC: MediaTek MT7628AN
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR
- Ethernet: 1 x WAN (100 Mbps) and 1 x LAN (100 Mbps)
- USB: 1 x USB 2.0 port
- Button: 1 x switch button, 1 x reset button
- LED: 3 x LEDS
- UART: 1 x UART on PCB (JP1: 3.3V, RX, TX, GND)

Installation through Luci:
- The original firmware is LEDE, so both LuCI or sysupgrade can be used.
- Do not keep settings, for sysupgrade please use the -n option.

Installation through bootloader webserver:
- Plug power and hold reset button until red LED blink to bright.
- Install sysupgrade image using web interface on 192.168.1.1.

Signed-off-by: kyson Lok 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   1 +
 .../linux/ramips/base-files/etc/board.d/02_network |   4 +
 target/linux/ramips/base-files/etc/diag.sh |   3 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/GL-MT300N-V2.dts   | 127 +
 target/linux/ramips/image/mt7628.mk|   8 ++
 7 files changed, 147 insertions(+)
 create mode 100644 target/linux/ramips/dts/GL-MT300N-V2.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 52542ec..101c1c2 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -186,6 +186,7 @@ fonera20n)
;;
 gl-mt300a|\
 gl-mt300n|\
+gl-mt300n-v2|\
 gl-mt750)
set_wifi_led "$board:wlan"
;;
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 80a3bc2..741e702 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -175,6 +175,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
+   gl-mt300n-v2)
+   ucidef_add_switch "switch0" \
+   "1:lan" "0:wan" "6@eth0"
+   ;;
awapn2403)
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 461f46c..e051dfd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -164,6 +164,9 @@ get_status_led() {
miwifi-nano)
status_led="$board:blue:status"
;;
+   gl-mt300n-v2)
+   status_led="$board:red:wlan"
+   ;;
m4-4M|\
m4-8M)
status_led="m4:blue:status"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 87cb7ff..1e031cd 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -214,6 +214,9 @@ ramips_board_detect() {
*"GL-MT300N")
name="gl-mt300n"
;;
+   *"GL-MT300N-V2")
+   name="gl-mt300n-v2"
+   ;;
*"GL-MT750")
name="gl-mt750"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index adad8da..2c50c3c 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -64,6 +64,7 @@ platform_check_image() {
freestation5|\
gl-mt300a|\
gl-mt300n|\
+   gl-mt300n-v2|\
gl-mt750|\
hc5*61|\
hc5661a|\
diff --git a/target/linux/ramips/dts/GL-MT300N-V2.dts 
b/target/linux/ramips/dts/GL-MT300N-V2.dts
new file mode 100644
index 000..5fd40d9
--- /dev/null
+++ b/target/linux/ramips/dts/GL-MT300N-V2.dts
@@ -0,0 +1,127 @@
+dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include 
+#include 
+
+/{
+   compatible = "GL-MT300N-V2", "ralink,mt7620an-soc";
+   model = "GL-MT300N-V2";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x800>;
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   usbpow {
+   label = "gl-mt300n-v2:blue:usbpow";
+   gpios = < 11 1>;
+   };
+
+   wan {
+   label = "gl-mt300n-v2:blue:wan";
+   gpios = < 11 1>;
+   };
+
+   wlan {
+   label = "gl-mt300n-v2:red:wlan";
+   gpios = < 12 1>;
+   };
+   };
+
+   gpio-keys {
+   compatible = 

[LEDE-DEV] Stalled PR #977 -- patch-kernel.sh: handle broken tarballs w/ 444 mode files

2017-05-05 Thread Philip Prindeville
Can I please get closure on this trivial PR?

https://github.com/lede-project/source/pull/977 


Thanks.

-Philip


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] imx6: add gw560x support

2017-05-05 Thread Tim Harvey
Signed-off-by: Tim Harvey 
---
 .../linux/imx6/base-files/etc/board.d/02_network   |   1 +
 target/linux/imx6/base-files/lib/imx6.sh   |   5 +
 .../files-4.9/arch/arm/boot/dts/imx6dl-gw560x.dts  |  55 ++
 .../files-4.9/arch/arm/boot/dts/imx6q-gw560x.dts   |  59 ++
 .../arch/arm/boot/dts/imx6qdl-gw560x.dtsi  | 750 +
 target/linux/imx6/image/Makefile   |   4 +-
 ...-imx-add-gateworks-ventana-gw560x-support.patch |  18 +
 7 files changed, 891 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6dl-gw560x.dts
 create mode 100644 
target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6q-gw560x.dts
 create mode 100644 
target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6qdl-gw560x.dtsi
 create mode 100644 
target/linux/imx6/patches-4.9/0002-arm-dts-imx-add-gateworks-ventana-gw560x-support.patch

diff --git a/target/linux/imx6/base-files/etc/board.d/02_network 
b/target/linux/imx6/base-files/etc/board.d/02_network
index fbe3eea..e315a48 100755
--- a/target/linux/imx6/base-files/etc/board.d/02_network
+++ b/target/linux/imx6/base-files/etc/board.d/02_network
@@ -13,6 +13,7 @@ board_config_update
 case "$board" in
 *gw51xx |\
 *gw52xx |\
+*gw560x |\
 *gw5904)
ucidef_set_interface_lan 'eth0'
;;
diff --git a/target/linux/imx6/base-files/lib/imx6.sh 
b/target/linux/imx6/base-files/lib/imx6.sh
index 8254cac..0e8c343 100755
--- a/target/linux/imx6/base-files/lib/imx6.sh
+++ b/target/linux/imx6/base-files/lib/imx6.sh
@@ -49,6 +49,11 @@ imx6_board_detect() {
name="gw553x"
;;
 
+   "Gateworks Ventana i.MX6 DualLite/Solo GW560X" |\
+   "Gateworks Ventana i.MX6 Dual/Quad GW560X")
+   name="gw560x"
+   ;;
+
"Gateworks Ventana i.MX6 DualLite/Solo GW5904" |\
"Gateworks Ventana i.MX6 Dual/Quad GW5904")
name="gw5904"
diff --git a/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6dl-gw560x.dts 
b/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6dl-gw560x.dts
new file mode 100644
index 000..21bdfaf
--- /dev/null
+++ b/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6dl-gw560x.dts
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Gateworks Corporation
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "imx6dl.dtsi"
+#include "imx6qdl-gw560x.dtsi"
+
+/ {
+   model = "Gateworks Ventana i.MX6 DualLite/Solo GW560X";
+   compatible = "gw,imx6dl-gw560x", "gw,ventana", "fsl,imx6dl";
+};
diff --git a/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6q-gw560x.dts 
b/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6q-gw560x.dts
new file mode 100644
index 000..735f2bb
--- /dev/null
+++ b/target/linux/imx6/files-4.9/arch/arm/boot/dts/imx6q-gw560x.dts
@@ -0,0 +1,59 @@
+/*
+ * 

Re: [LEDE-DEV] [PATCH] ipq806x: Add nand boot support for ipq40xx AP-DK04.1-C1

2017-05-05 Thread John Crispin



On 05/05/17 17:49, Ram Chandra Jangir wrote:

This change add nand boot support for IPQ40xx based
AP-DK04.1-C1 board using ubi image, also add sysupgrage
support for AP-DK04.1-C1 and generates a sysupgrade.tar
image.

Testing:
*Tested on IPQ40xx AP-DK04.1-C1 and IPQ806x AP148 Board:
   a. NAND boot
   b. ubi sysupgrade

Signed-off-by: Ram Chandra Jangir 

Hi Ram,

have you posted this driver upstream already ?

John


---
  .../ipq806x/base-files/lib/upgrade/platform.sh |1 +
  target/linux/ipq806x/image/Makefile|1 +
  ...nd-Add-bam_dma-support-in-qcom_nand-drive.patch |  382 ++
  ...nd-Added-bam-transaction-and-support-addi.patch | 1273 
  ...gine-qcom-bam_dma-Add-custom-data-mapping.patch |  217 
  ...ts-ipq4019-add-nand-and-qpic-bam-dma-node.patch |   83 ++
  6 files changed, 1957 insertions(+)
  create mode 100644 
target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
  create mode 100644 
target/linux/ipq806x/patches-4.9/860-qcom-mtd-nand-Added-bam-transaction-and-support-addi.patch
  create mode 100644 
target/linux/ipq806x/patches-4.9/861-dmaengine-qcom-bam_dma-Add-custom-data-mapping.patch
  create mode 100644 
target/linux/ipq806x/patches-4.9/862-dts-ipq4019-add-nand-and-qpic-bam-dma-node.patch

diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 8970285..fd08db3 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -12,6 +12,7 @@ platform_pre_upgrade() {
  
  	case "$board" in

ap148 |\
+   ap-dk04.1-c1 |\
d7800 |\
nbg6817 |\
r7500 |\
diff --git a/target/linux/ipq806x/image/Makefile 
b/target/linux/ipq806x/image/Makefile
index 6ebcde5..c49a73e 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -264,6 +264,7 @@ endef
  
  define Device/AP-DK04.1-C1

$(call Device/FitImage)
+   $(call Device/UbiFit)
DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
KERNEL_LOADADDR := 0x80208000
KERNEL_INSTALL := 1
diff --git 
a/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
 
b/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
new file mode 100644
index 000..ad9d1bb
--- /dev/null
+++ 
b/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
@@ -0,0 +1,382 @@
+From 074036f9de6b8c5fc642e8e2540950f6a35aa804 Mon Sep 17 00:00:00 2001
+From: Ram Chandra Jangir 
+Date: Thu, 20 Apr 2017 10:31:10 +0530
+Subject: [PATCH] qcom: mtd: nand: Add bam_dma support in qcom_nand driver
+
+The current driver only support ADM DMA so this patch adds the
+BAM DMA support in current NAND driver with compatible string
+qcom,ebi2-nandc-bam.
+Added bam channels and data buffers, NAND BAM uses 3 channels:
+command, data tx and data rx, while ADM uses only single channel.
+So this patch adds the BAM channel in device tree and using the
+same in NAND driver allocation function.
+
+Signed-off-by: Ram Chandra Jangir 
+---
+ .../devicetree/bindings/mtd/qcom_nandc.txt |  69 +++--
+ drivers/mtd/nand/qcom_nandc.c  | 160 +
+ 2 files changed, 190 insertions(+), 39 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt 
b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
+index 70dd511..9e5c9be 100644
+--- a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
 b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
+@@ -1,21 +1,26 @@
+ * Qualcomm NAND controller
+
+ Required properties:
+-- compatible: should be "qcom,ipq806x-nand"
++- compatible: "qcom,ipq806x-nand" for IPQ8064 which uses
++  ADM DMA.
++  "qcom,ebi2-nand-bam" - nand drivers using BAM DMA
++  like IPQ4019.
+ - reg:MMIO address range
+ - clocks: must contain core clock and always on clock
+ - clock-names:must contain "core" for the core clock and 
"aon" for the
+   always on clock
+ - dmas:   DMA specifier, consisting of a phandle to the 
ADM DMA
+-  controller node and the channel number to be used for
+-  NAND. Refer to dma.txt and qcom_adm.txt for more details
+-- dma-names:  must be "rxtx"
+-- qcom,cmd-crci:  must contain the ADM command type CRCI block instance
+-  number specified for the NAND controller on the given
+-  platform
+-- qcom,data-crci: must contain the ADM data type CRCI block instance
+-  number specified for the NAND controller on 

[LEDE-DEV] [PATCH] ipq806x: Add nand boot support for ipq40xx AP-DK04.1-C1

2017-05-05 Thread Ram Chandra Jangir
This change add nand boot support for IPQ40xx based
AP-DK04.1-C1 board using ubi image, also add sysupgrage
support for AP-DK04.1-C1 and generates a sysupgrade.tar
image.

Testing:
*Tested on IPQ40xx AP-DK04.1-C1 and IPQ806x AP148 Board:
  a. NAND boot
  b. ubi sysupgrade

Signed-off-by: Ram Chandra Jangir 
---
 .../ipq806x/base-files/lib/upgrade/platform.sh |1 +
 target/linux/ipq806x/image/Makefile|1 +
 ...nd-Add-bam_dma-support-in-qcom_nand-drive.patch |  382 ++
 ...nd-Added-bam-transaction-and-support-addi.patch | 1273 
 ...gine-qcom-bam_dma-Add-custom-data-mapping.patch |  217 
 ...ts-ipq4019-add-nand-and-qpic-bam-dma-node.patch |   83 ++
 6 files changed, 1957 insertions(+)
 create mode 100644 
target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
 create mode 100644 
target/linux/ipq806x/patches-4.9/860-qcom-mtd-nand-Added-bam-transaction-and-support-addi.patch
 create mode 100644 
target/linux/ipq806x/patches-4.9/861-dmaengine-qcom-bam_dma-Add-custom-data-mapping.patch
 create mode 100644 
target/linux/ipq806x/patches-4.9/862-dts-ipq4019-add-nand-and-qpic-bam-dma-node.patch

diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh 
b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
index 8970285..fd08db3 100644
--- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
@@ -12,6 +12,7 @@ platform_pre_upgrade() {
 
case "$board" in
ap148 |\
+   ap-dk04.1-c1 |\
d7800 |\
nbg6817 |\
r7500 |\
diff --git a/target/linux/ipq806x/image/Makefile 
b/target/linux/ipq806x/image/Makefile
index 6ebcde5..c49a73e 100644
--- a/target/linux/ipq806x/image/Makefile
+++ b/target/linux/ipq806x/image/Makefile
@@ -264,6 +264,7 @@ endef
 
 define Device/AP-DK04.1-C1
$(call Device/FitImage)
+   $(call Device/UbiFit)
DEVICE_DTS := qcom-ipq4019-ap.dk04.1-c1
KERNEL_LOADADDR := 0x80208000
KERNEL_INSTALL := 1
diff --git 
a/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
 
b/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
new file mode 100644
index 000..ad9d1bb
--- /dev/null
+++ 
b/target/linux/ipq806x/patches-4.9/859-qcom-mtd-nand-Add-bam_dma-support-in-qcom_nand-drive.patch
@@ -0,0 +1,382 @@
+From 074036f9de6b8c5fc642e8e2540950f6a35aa804 Mon Sep 17 00:00:00 2001
+From: Ram Chandra Jangir 
+Date: Thu, 20 Apr 2017 10:31:10 +0530
+Subject: [PATCH] qcom: mtd: nand: Add bam_dma support in qcom_nand driver
+
+The current driver only support ADM DMA so this patch adds the
+BAM DMA support in current NAND driver with compatible string
+qcom,ebi2-nandc-bam.
+Added bam channels and data buffers, NAND BAM uses 3 channels:
+command, data tx and data rx, while ADM uses only single channel.
+So this patch adds the BAM channel in device tree and using the
+same in NAND driver allocation function.
+
+Signed-off-by: Ram Chandra Jangir 
+---
+ .../devicetree/bindings/mtd/qcom_nandc.txt |  69 +++--
+ drivers/mtd/nand/qcom_nandc.c  | 160 +
+ 2 files changed, 190 insertions(+), 39 deletions(-)
+
+diff --git a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt 
b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
+index 70dd511..9e5c9be 100644
+--- a/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
 b/Documentation/devicetree/bindings/mtd/qcom_nandc.txt
+@@ -1,21 +1,26 @@
+ * Qualcomm NAND controller
+
+ Required properties:
+-- compatible: should be "qcom,ipq806x-nand"
++- compatible: "qcom,ipq806x-nand" for IPQ8064 which uses
++  ADM DMA.
++  "qcom,ebi2-nand-bam" - nand drivers using BAM DMA
++  like IPQ4019.
+ - reg:MMIO address range
+ - clocks: must contain core clock and always on clock
+ - clock-names:must contain "core" for the core clock and 
"aon" for the
+   always on clock
+ - dmas:   DMA specifier, consisting of a phandle to the 
ADM DMA
+-  controller node and the channel number to be used for
+-  NAND. Refer to dma.txt and qcom_adm.txt for more details
+-- dma-names:  must be "rxtx"
+-- qcom,cmd-crci:  must contain the ADM command type CRCI block instance
+-  number specified for the NAND controller on the given
+-  platform
+-- qcom,data-crci: must contain the ADM data type CRCI block instance
+-  number specified for the NAND controller on the given
+-  platform
++  or BAM DMA controller node and the channel number to
++ 

Re: [LEDE-DEV] [PATCH 3/3] ramips-mt7621: add dts for UBNT-ERX-SFP

2017-05-05 Thread Mathias Kresin
2017-05-04 1:41 GMT+02:00 Sven Roederer :
> * use a copy and modify version of the  UBNT-ERX for the UBNT-ERX-SFP
> * define i2c-gpio via DTS 
> (Linux/Documentation/devicetree/bindings/i2c/i2c-gpio.txt)
> * also define PCA9555 for PoE-switching in DTS

Please, make sure to add a proper SoB line as described in "Submitting
patches": [1].

Also, would you please include in your commit message a short
description about the hardware and how to install LEDE on it? Have a
look at the recent ramips board additions for some examples[2].

Please merge all ubnt-erx-sfp related commits into one. They do not
really work on its own and it does not make any sense to split the
changes. Patch 1/3 for example adds the ubnt-erx-sfp image by using
the ubnt-erx dts. It is fixed later with an extra commit which is hard
to review.

I haven't checked how similar the ubnt-erx and ubnt-erx-sfp device
tree source files are. But it might be more elegant to move stuff
which is the same between both boards to a dtsi, include the dtsi for
the ubnt-erx* and add all missing stuff in the ubnt-erx-sfp dts.

Depending on what is really required, there might be the following
commits in the end:

- split ubnt-erx into dtsi
- add ubnt-erx poe passthrough gpios
- add ubnt-erx-stp support

Find more comments inline.

> ---
>  target/linux/ramips/dts/UBNT-ERX-SFP.dts | 121 
> +++
>  target/linux/ramips/image/mt7621.mk  |   2 +-
>  2 files changed, 122 insertions(+), 1 deletion(-)
>  create mode 100644 target/linux/ramips/dts/UBNT-ERX-SFP.dts
>
> diff --git a/target/linux/ramips/dts/UBNT-ERX-SFP.dts 
> b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
> new file mode 100644
> index 000..808086a
> --- /dev/null
> +++ b/target/linux/ramips/dts/UBNT-ERX-SFP.dts
> @@ -0,0 +1,121 @@
> +#include 

Move this line below the include "mt7621.dtsi". Please include
dt-bindings/gpio/gpio.h here as well and keep alphabetical order.

Use the GPIO_ACTIVE_LOW and GPIO_ACTIVE_HIGH macros afterwards in
stead of 1 and 0 in the gpio parameters.

Check the recent ramips board additions for examples.

> +
> +/dts-v1/;
> +
> +#include "mt7621.dtsi"
> +
> +/ {
> +   model = "UBNT-ERX-SFP";
> +
> +   memory@0 {
> +   device_type = "memory";
> +   reg = <0x0 0x1000>;
> +   };
> +
> +   chosen {
> +   bootargs = "console=ttyS0,57600";
> +   };
> +
> +   gpio-keys-polled {
> +   compatible = "gpio-keys-polled";
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +   poll-interval = <20>;
> +
> +   reset {
> +   label = "reset";
> +   gpios = < 12 1>;
> +   linux,code = ;
> +   };
> +   };
> +
> +   i2c-gpio {
> +   compatible = "i2c-gpio";
> +   gpios = < 3 0 /* sda */
> + 4 0 /* scl */
> +   >;
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   pca9555@25 {
> +   compatible = "pca9555";
> +   reg = <0x25>;
> +   };
> +   };
> +};
> +
> + {
> +   mtd-mac-address = < 0x22>;
> +};
> +
> + {
> +   status = "okay";
> +
> +   partition@0 {
> +   label = "u-boot";
> +   reg = <0x0 0x8>;
> +   read-only;
> +   };
> +
> +   partition@8 {
> +   label = "u-boot-env";
> +   reg = <0x8 0x6>;
> +   read-only;
> +   };
> +
> +   factory: partition@e {
> +   label = "factory";
> +   reg = <0xe 0x6>;
> +   };
> +
> +   partition@14 {
> +   label = "kernel1";
> +   reg = <0x14 0x30>;
> +   };
> +
> +   partition@44 {
> +   label = "kernel2";
> +   reg = <0x44 0x30>;
> +   };
> +
> +   partition@74 {
> +   label = "ubi";
> +   reg = <0x74 0xf7c>;
> +   };
> +};
> +
> + {
> +   state_default: pinctrl0 {
> +   gpio {
> +   ralink,group = "uart2", "uart3", "i2c", "pcie", 
> "rgmii2", "jtag";
> +   ralink,function = "gpio";
> +   };
> +   };
> +};
> +
> + {
> +   /* This board has 2Mb spi flash soldered in and visible
> +  from manufacturer's firmware.
> +  But this SoC shares spi and nand pins,
> +  and current driver does't handle this sharing well */
> +   status = "disabled";
> +
> +   m25p80@0 {
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   compatible = "jedec,spi-nor";
> +   reg = <1>;
> +   spi-max-frequency = <1000>;
> +   m25p,chunked-io = <32>;
> +
> +   partition@0 {
> +

Re: [LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)

2017-05-05 Thread Mathias Kresin
2017-05-04 1:41 GMT+02:00 Sven Roederer :
> define GPIOs for ubnt-erx and ubnt-erx-sfp
> ---
>  .../ramips/base-files/etc/board.d/03_gpio_switches | 28 
> ++
>  1 file changed, 28 insertions(+)
>  create mode 100755 
> target/linux/ramips/base-files/etc/board.d/03_gpio_switches
>
> diff --git a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches 
> b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
> new file mode 100755
> index 000..21d1aa2
> --- /dev/null
> +++ b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
> @@ -0,0 +1,28 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2017 LEDE-project.org
> +#
> +
> +. /lib/functions/uci-defaults.sh
> +. /lib/ramips.sh
> +
> +board_config_update
> +
> +board=$(ramips_board_name)
> +
> +case "$board" in
> +ubnt-erx)
> +   ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "4"
> +   ;;
> +ubnt-erx-sfp)
> +   ucidef_add_gpio_switch "poe_power_port0" "PoE Power Port0" "496"
> +   ucidef_add_gpio_switch "poe_power_port1" "PoE Power Port1" "497"
> +   ucidef_add_gpio_switch "poe_power_port2" "PoE Power Port2" "498"
> +   ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "499"
> +   ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "500"
> +   ;;
> +esac
> +
> +board_config_flush

Is it necessary to control the GPIOs from userspace/via config files?
If not, add a gpio_export node to the dts and set the output value
this way [0].

Mathias

[0] 
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/ramips/dts/A5-V11.dts;hb=ddbb036bbb8a1030dd8f6fae0004d390b5f2b8a5#l38

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH netifd] interface: add new "ifup-failed" hotplug event

2017-05-05 Thread Martin Schiller

Are there any comments about this patch?
I still want to get this feature into netifd.

On 2017-03-31 08:31, Martin Schiller wrote:

This hook makes it possible to do some helper work in hotplug scripts
when a connection is not established successfully.

example: try several username/passwords from a pool to establish a
pppoe or wwan connection by replacing the configured values of the
connection in a hotplug script.

Signed-off-by: Martin Schiller 
---
 interface-event.c | 2 ++
 interface.c   | 4 
 interface.h   | 1 +
 3 files changed, 7 insertions(+)

diff --git a/interface-event.c b/interface-event.c
index 4976c2c..86e8f54 100644
--- a/interface-event.c
+++ b/interface-event.c
@@ -33,6 +33,7 @@ static struct uloop_process task = {
 static const char * const eventnames[] = {
[IFEV_DOWN] = "ifdown",
[IFEV_UP] = "ifup",
+   [IFEV_UP_FAILED] = "ifup-failed",
[IFEV_UPDATE] = "ifupdate",
[IFEV_FREE] = "free",
[IFEV_RELOAD] = "reload",
@@ -191,6 +192,7 @@ static void interface_event_cb(struct
interface_user *dep, struct interface *ifa
switch (ev) {
case IFEV_LINK_UP:
case IFEV_UP:
+   case IFEV_UP_FAILED:
case IFEV_UPDATE:
case IFEV_DOWN:
interface_queue_event(iface, ev);
diff --git a/interface.c b/interface.c
index f150f7d..e04d477 100644
--- a/interface.c
+++ b/interface.c
@@ -241,6 +241,7 @@ interface_event(struct interface *iface, enum
interface_event ev)
adev = iface->l3_dev.dev;
/* fall through */
case IFEV_DOWN:
+   case IFEV_UP_FAILED:
alias_notify_device(iface->name, adev);
break;
default:
@@ -268,6 +269,8 @@ mark_interface_down(struct interface *iface)
iface->state = IFS_DOWN;
if (state == IFS_UP)
interface_event(iface, IFEV_DOWN);
+   else
+   interface_event(iface, IFEV_UP_FAILED);
interface_ip_set_enabled(>config_ip, false);
interface_ip_set_enabled(>proto_ip, false);
interface_ip_flush(>proto_ip);
@@ -557,6 +560,7 @@ interface_alias_cb(struct interface_user *dep,
struct interface *iface, enum int
interface_set_available(alias, true);
break;
case IFEV_DOWN:
+   case IFEV_UP_FAILED:
interface_set_available(alias, false);
interface_set_main_dev(alias, NULL);
break;
diff --git a/interface.h b/interface.h
index 1472324..c51705c 100644
--- a/interface.h
+++ b/interface.h
@@ -23,6 +23,7 @@ struct interface_proto_state;
 enum interface_event {
IFEV_DOWN,
IFEV_UP,
+   IFEV_UP_FAILED,
IFEV_UPDATE,
IFEV_FREE,
IFEV_RELOAD,



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] ramips: add support for GL-inet GL-MT300N-V2

2017-05-05 Thread Mathias Kresin
2017-05-05 11:28 GMT+02:00 kysonlok :
> This patch adds supports for the GL-inet GL-MT300N-V2.
>
> Specification:
> - SoC: MediaTek MT7628AN
> - Flash: 16 MiB (W25Q128FVSG)
> - RAM: 128 MiB DDR
> - Ethernet: 1 x WAN (100 Mbps) and 1 x LAN (100 Mbps)
> - USB: 1 x USB 2.0 port
> - Button: 1 x switch button, 1 x reset button
> - LED: 3 x LEDS
> - UART: 1 x UART on PCB (JP1: 3.3V, RX, TX, GND)
>
> Installation through Luci:
> - The original firmware is LEDE, so both LuCI or sysupgrade can be used.
> - Do not keep settings, for sysupgrade please use the -n option.
>
> Installation through bootloader webserver:
> - Plug power and hold reset button until red LED blink to bright.
> - Install sysupgrade image using web interface on 192.168.1.1.
>
> Signed-off-by: kysonlok 

It seams to me you have missed my review of your patch. Would you
please fix the issues I've outlined in
http://lists.infradead.org/pipermail/lede-dev/2017-May/007293.html.

Mathias

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] ramips: add support for GL-inet GL-MT300N-V2

2017-05-05 Thread kysonlok
This patch adds supports for the GL-inet GL-MT300N-V2.

Specification:
- SoC: MediaTek MT7628AN
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR
- Ethernet: 1 x WAN (100 Mbps) and 1 x LAN (100 Mbps)
- USB: 1 x USB 2.0 port
- Button: 1 x switch button, 1 x reset button
- LED: 3 x LEDS
- UART: 1 x UART on PCB (JP1: 3.3V, RX, TX, GND)

Installation through Luci:
- The original firmware is LEDE, so both LuCI or sysupgrade can be used.
- Do not keep settings, for sysupgrade please use the -n option.

Installation through bootloader webserver:
- Plug power and hold reset button until red LED blink to bright.
- Install sysupgrade image using web interface on 192.168.1.1.

Signed-off-by: kysonlok 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   1 +
 .../linux/ramips/base-files/etc/board.d/02_network |   4 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/GL-MT300N-V2.dts   | 127 +
 target/linux/ramips/image/mt7628.mk|   8 ++
 6 files changed, 144 insertions(+)
 create mode 100644 target/linux/ramips/dts/GL-MT300N-V2.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 52542ec..101c1c2 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -186,6 +186,7 @@ fonera20n)
;;
 gl-mt300a|\
 gl-mt300n|\
+gl-mt300n-v2|\
 gl-mt750)
set_wifi_led "$board:wlan"
;;
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 80a3bc2..741e702 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -175,6 +175,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6@eth0"
;;
+   gl-mt300n-v2)
+   ucidef_add_switch "switch0" \
+   "1:lan" "0:wan" "6@eth0"
+   ;;
awapn2403)
ucidef_add_switch "switch0" \
"0:lan" "1:wan" "6@eth0"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index 87cb7ff..1e031cd 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -214,6 +214,9 @@ ramips_board_detect() {
*"GL-MT300N")
name="gl-mt300n"
;;
+   *"GL-MT300N-V2")
+   name="gl-mt300n-v2"
+   ;;
*"GL-MT750")
name="gl-mt750"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index adad8da..2c50c3c 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -64,6 +64,7 @@ platform_check_image() {
freestation5|\
gl-mt300a|\
gl-mt300n|\
+   gl-mt300n-v2|\
gl-mt750|\
hc5*61|\
hc5661a|\
diff --git a/target/linux/ramips/dts/GL-MT300N-V2.dts 
b/target/linux/ramips/dts/GL-MT300N-V2.dts
new file mode 100644
index 000..d29e222
--- /dev/null
+++ b/target/linux/ramips/dts/GL-MT300N-V2.dts
@@ -0,0 +1,127 @@
+dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include 
+#include 
+
+/{
+   compatible = "GL-MT300N-V2", "ralink,mt7620an-soc";
+   model = "GL-MT300N-V2";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x800>;
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   usbpow {
+   label = "gl-mt300n-v2:usbpow";
+   gpios = < 11 1>;
+   };
+
+   wan {
+   label = "gl-mt300n-v2:wan";
+   gpios = < 11 1>;
+   };
+
+   wlan {
+   label = "gl-mt300n-v2:wlan";
+   gpios = < 12 1>;
+   };
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys-polled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   poll-interval = <20>;
+
+   reset {
+   label = "reset";
+   gpios = < 6 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   BIT_0 {
+   label = "BIT_0";
+   gpios = < 0 1>;
+   linux,code = <0x100>;
+   };
+
+   BIT_1 {
+   label = "BIT_1";
+   gpios = < 3 1>;
+