[OpenWrt-Devel] [PATCH] ath79: Add GL.iNet AR-300M-Lite

2019-03-06 Thread Jeff Kletsky
From: Jeff Kletsky 

AR300M-Lite is single-Ethernet variant of the AR300M series
Its eth0 would otherwise be assigned to the WAN interface
making it unreachable firstboot or failsafe.

Installation instructions from OEM (OpenWrt variant):
* Install sysupgrade.bin using OEM's "Advanced" GUI (LuCI),
   * Do not preserve settings
   * Access rebooted device via Ethernet at OpenWrt default address

Add previously missing LED defaults for all three variants;
-nand, -nor, -lite to the definitions in 01_leds

Non-lite variants thanks to Andreas Ziegler
https://patchwork.ozlabs.org/patch/1049396/

Runtime-tested:  GL.iNet AR300M-Lite

Signed-off-by: Jeff Kletsky 
---
 target/linux/ath79/base-files/etc/board.d/01_leds  |  7 +++
 .../linux/ath79/base-files/etc/board.d/02_network  |  1 +
 .../ath79/dts/qca9531_glinet_gl-ar300m-lite.dts| 22 +
 .../ath79/dts/qca9531_glinet_gl-ar300m-nand.dts| 34 -
 .../ath79/dts/qca9531_glinet_gl-ar300m-nor.dts | 39 ---
 .../linux/ath79/dts/qca9531_glinet_gl-ar300m.dtsi  | 57 +++---
 target/linux/ath79/image/generic.mk| 14 +-
 7 files changed, 91 insertions(+), 83 deletions(-)
 create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts

diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds 
b/target/linux/ath79/base-files/etc/board.d/01_leds
index 0fa4bc73bb..e9a85c3eb1 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -63,6 +63,13 @@ glinet,gl-ar150)
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
ucidef_set_led_switch "lan" "LAN" "$boardname:green:lan" "switch0" 
"0x02"
;;
+glinet,gl-ar300m-nand|\
+glinet,gl-ar300m-nor)
+   ucidef_set_led_netdev "lan" "LAN" "gl-ar300m:green:lan" "eth0"
+   ;;
+glinet,gl-ar300m-lite)
+   ucidef_set_led_netdev "lan" "LAN" "gl-ar300m-lite:green:lan" "eth0"
+   ;;
 glinet,gl-x750)
ucidef_set_led_netdev "wan" "WAN" "$boardname:green:wan" "eth0"
;;
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
b/target/linux/ath79/base-files/etc/board.d/02_network
index 9a7f2d6472..6bc3abf331 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -13,6 +13,7 @@ ath79_setup_interfaces()
devolo,dvl1200i|\
devolo,dvl1750c|\
devolo,dvl1750i|\
+   glinet,ar300m-lite|\
ocedo,koala|\
ocedo,raccoon|\
pcs,cap324|\
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts 
b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
new file mode 100644
index 00..fba08e4295
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-lite.dts
@@ -0,0 +1,22 @@
+/dts-v1/;
+
+#include "qca9531_glinet_gl-ar300m-nor.dts"
+
+/ {
+   compatible = "glinet,gl-ar300m-lite", "qca,qca9531";
+   model = "GL.iNet GL-AR300M-Lite";
+};
+
+// GL-AR300M-Lite has different LED colors than the non-Lite version
+
+_status {
+   label = "gl-ar300m-lite:red:status";
+};
+
+_lan {
+   label = "gl-ar300m-lite:green:lan";
+};
+
+_wlan {
+   label = "gl-ar300m-lite:green:wlan";
+};
\ No newline at end of file
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts 
b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts
index 9e78f83a76..26c30f2b72 100644
--- a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nand.dts
@@ -8,42 +8,8 @@
 };
 
  {
-   status = "okay";
num-cs = <1>;
 
-   flash@0 {
-   compatible = "winbond,w25q128", "jedec,spi-nor";
-   reg = <0>;
-   spi-max-frequency = <2500>;
-
-   partitions {
-   compatible = "fixed-partitions";
-   #address-cells = <1>;
-   #size-cells = <1>;
-
-   partition@0 {
-   label = "u-boot";
-   reg = <0x00 0x04>;
-   read-only;
-   };
-
-   partition@1 {
-   label = "u-boot-env";
-   reg = <0x04 0x01>;
-   };
-
-   partition@2 {
-   label = "reserved";
-   reg = <0x05 0xfa>;
-   };
-
-   art: partition@3 {
-   label = "art";
-   reg = <0xff 0x01>;
-   };
-   };
-   };
-
flash@1 {
compatible = "spinand,mt29f";
reg = <1>;
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-ar300m-nor.dts 

Re: [OpenWrt-Devel] ath79: Add GL.iNet AR-300M-Lite

2019-03-06 Thread Jeff Kletsky
Patch updated to include default LED triggers 
on suggestion of Andreas Ziegler

Confirmed to apply cleanly, build, and run 
on `master` of today.

Jeff



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


[OpenWrt-Devel] [PATCH] build: have scripts/feeds honor feed.mk of the individual feed

2019-03-06 Thread Sven Roederer
The luci and freifunk feed having a common Makefile included by the
individual packages. Currently a change to this file will be ignored
when running "scripts/feeds update".
Add a check for a Makefile "feed.mk" in the root of a feed and include
this to the dependencies.

Signed-off-by: Sven Roederer 
---
 include/scan.mk | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/scan.mk b/include/scan.mk
index d9cd4f7e8c..134c5f6407 100644
--- a/include/scan.mk
+++ b/include/scan.mk
@@ -12,10 +12,18 @@ 
OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
 
 export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
 
+define feedname
+$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1
+endef
+
 ifeq ($(SCAN_NAME),target)
   SCAN_DEPS=image/Makefile profiles/*.mk $(TOPDIR)/include/kernel*.mk 
$(TOPDIR)/include/target.mk image/*.mk
 else
   SCAN_DEPS=$(TOPDIR)/include/package*.mk
+  FEED_COMMON_MK=$(TOPDIR)/feeds/$(call feedname,$(SCAN_DIR))/feed.mk
+ifneq ($(wildcard $(FEED_COMMON_MK)),)
+  SCAN_DEPS += $(FEED_COMMON_MK)
+endif
 endif
 
 ifeq ($(IS_TTY),1)
@@ -34,10 +42,6 @@ else
   endef
 endif
 
-define feedname
-$(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1
-endef
-
 define PackageDir
   $(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1)
   $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(foreach 
DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter 
/%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP
-- 
2.11.0


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


Re: [OpenWrt-Devel] [PATCH] ath79: add suport for EnGenius EPG5000

2019-03-06 Thread Petr Štetiar
Tomasz Maciej Nowak  [2019-03-06 21:03:53]:

> > Tomasz Maciej Nowak  [2019-03-04 15:18:53]:
> > 
> >> When doing upgrade from OpenWrt ar71xx image, it is recomended to not keep 
> >> the
> >> old configuration.
> > 
> > why is that?
> 
> The sysfs path to 2.4 wifi has changed, so after the upgrade it won't be
> enabled. Better tell the users that they need to create new configuration,
> than explaining that the upgrade didn't break wifi.

There are already more advanced migration scripts for your inspiration:

 target/linux/brcm47xx/base-files/etc/uci-defaults/03_network_migration
 target/linux/lantiq/base-files/etc/uci-defaults/02_migrate_xdsl_iface
 target/linux/ar71xx/base-files/etc/uci-defaults/03_network-switchX-migration  
 target/linux/ar71xx/base-files/etc/uci-defaults/03_network-vlan-migration
 target/linux/mvebu/base-files/etc/uci-defaults/03_wireless

-- ynezz

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


Re: [OpenWrt-Devel] [PATCH] ath79: add support for jjPlus JA76PF2

2019-03-06 Thread Tomasz Maciej Nowak
W dniu 06.03.2019 o 20:44, Tomasz Maciej Nowak pisze:
> W dniu 04.03.2019 o 20:52, Petr Štetiar pisze:
>> Tomasz Maciej Nowak  [2019-03-04 19:25:12]:
>>
>   [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j 
> $CONF_TAR"
>   dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \
> - mtd -r $append -Fkernel:$kern_length:0x8006,rootfs 
> write - kernel:rootfs
> + mtd -r $append 
> -F$CI_KERNPART:$kern_length:0x8006,rootfs write - $KERNPART:rootfs

 instead of passing CI_KERNPART as global variable, wouldn't it be better to
 pass CI_KERNPART as 2nd argument to this function? Something like this:
>>>
>>> I just followed an example like in:
>>> https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
>>> this is how all other targets pass additional options. Changing this is
>>> possible, but I would like to keep it consistent with other implementations.
>>
>> I think, that's this isn't exactly good example to follow, but I can see why
>> it's done this way, just take a look at 
>> package/base-files/files/lib/upgrade/nand.sh
>>
>> You don't need to try shoot yourself into the foot :-)
>>
> 
> Thanks for pointing that out, I overlooked what was included in the script i 
> pointed to. Version 2 sent.
> 
> + /* Didn't find it */
> ++if (offset + master->erasesize < master->size) {
> ++/* not at the end of the flash yet, maybe next 
> block :) */
> ++directory++;
> ++goto restart;
> ++}

 I'm wondering if this patch could be upstreamed first, so we don't need to 
 drag it around forever.
>>>
>>> Yes, that would be preferred, but given my lack of skills and understanding
>>> in that regard (no programming skills), I don't see that accepted.
>>
>> I would say, that patch is either good enough for upstream, or it has to have
>> very good reason to be included and maintained in OpenWrt. So, why does this
>> patch belong to OpenWrt if it might not be good enough for upstream?
>>
> 
> Would like also to know this, I can assume, since there is option on which 
> block to look for FIS table, available in kernel config, there shouldn't be 
> necessity for this patch. The problem is when one wants to support more 
> boards with same kernel, but those have partition in different place. Anyway, 
> maybe someone from core OpenWrt devs could shed som light on this?
> 
> Regarding the part: "I don't see that accepted", I meant if there would be 
> request to change the patch it would be something like this: "Ekh... hmm... 
> how would I do that, don't know any programming.". So I would that patch 
> would stuck in limbo.

My typing is failing, last sentence should be:

So that patch would stuck in limbo.

> 
>> BTW, if you're able to submit patches in this very good quality to OpenWrt,
>> I'm pretty sure, that you can do this for kernel as well :-)
> 
> Sending patches to OpenWrt is easy :)
> 
>>
>> -- ynezz
>>
> 
> Regards
> 

--
TMN

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


Re: [OpenWrt-Devel] [PATCH] ath79: add suport for EnGenius EPG5000

2019-03-06 Thread Tomasz Maciej Nowak
Hi,

W dniu 04.03.2019 o 21:54, Petr Štetiar pisze:
> Tomasz Maciej Nowak  [2019-03-04 15:18:53]:
> 
> Hi,
> 
>> When doing upgrade from OpenWrt ar71xx image, it is recomended to not keep 
>> the
>> old configuration.
> 
> why is that?

The sysfs path to 2.4 wifi has changed, so after the upgrade it won't be 
enabled. Better tell the users that they need to create new configuration, than 
explaining that the upgrade didn't break wifi.

> 
>> +wan {
>> +label = "epg5000:blue:wan";
>> +gpios = < 22 GPIO_ACTIVE_LOW>;
>> +};
> 
> this LED is marked in ar71xx as `epg5000:amber:wps` any reason for this 
> change?

There is no second WPS LED on the device, check the manual 
https://www.engeniustech.com/resources/EPG5000-user_manual.pdf on page 9. Also 
the color of it is blue instead of amber. The whole mach file in ar71xx seems 
to be copy pasta from similar ESR1750 with only name of the device changed 
throughout the file, and errors replicated. The ESR1750 also doesn't have two 
WPS LEDs, but I don't know which color it is since I don't own such device.

> 
>> +wlan2g {
>> +label = "epg5000:blue:wlan2g";
>> +gpios = < 13 GPIO_ACTIVE_LOW>;
>> +linux,default-trigger = "phy1tpt";
>> +};
> 
> In ar71xx it's named as `epg5000:blue:wlan-2g`, so to keep the upgrade process
> to ath79 seamless it would be good idea to use the same name.
> 

Wanted to change it to the same name as most devices in this targe, but don't 
have strong feeling about it so if any of Committers would request the change, 
I will adapt.

>> +
>> +wlan5g {
>> +label = "epg5000:blue:wlan5g";
>> +gpios = < 23 GPIO_ACTIVE_LOW>;
>> +linux,default-trigger = "phy0tpt";
>> +};
> 
> In ar71xx it's named as `epg5000:blue:wlan-5g`.
> 
> -- ynezz
> 

Regards

-- 
TMN

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


Re: [OpenWrt-Devel] [PATCH] ath79: add support for jjPlus JA76PF2

2019-03-06 Thread Tomasz Maciej Nowak
W dniu 04.03.2019 o 20:52, Petr Štetiar pisze:
> Tomasz Maciej Nowak  [2019-03-04 19:25:12]:
> 
[ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j 
 $CONF_TAR"
dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \
 -  mtd -r $append -Fkernel:$kern_length:0x8006,rootfs 
 write - kernel:rootfs
 +  mtd -r $append 
 -F$CI_KERNPART:$kern_length:0x8006,rootfs write - $KERNPART:rootfs
>>>
>>> instead of passing CI_KERNPART as global variable, wouldn't it be better to
>>> pass CI_KERNPART as 2nd argument to this function? Something like this:
>>
>> I just followed an example like in:
>> https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
>> this is how all other targets pass additional options. Changing this is
>> possible, but I would like to keep it consistent with other implementations.
> 
> I think, that's this isn't exactly good example to follow, but I can see why
> it's done this way, just take a look at 
> package/base-files/files/lib/upgrade/nand.sh
> 
> You don't need to try shoot yourself into the foot :-)
> 

Thanks for pointing that out, I overlooked what was included in the script i 
pointed to. Version 2 sent.

 +  /* Didn't find it */
 ++ if (offset + master->erasesize < master->size) {
 ++ /* not at the end of the flash yet, maybe next block :) 
 */
 ++ directory++;
 ++ goto restart;
 ++ }
>>>
>>> I'm wondering if this patch could be upstreamed first, so we don't need to 
>>> drag it around forever.
>>
>> Yes, that would be preferred, but given my lack of skills and understanding
>> in that regard (no programming skills), I don't see that accepted.
> 
> I would say, that patch is either good enough for upstream, or it has to have
> very good reason to be included and maintained in OpenWrt. So, why does this
> patch belong to OpenWrt if it might not be good enough for upstream?
> 

Would like also to know this, I can assume, since there is option on which 
block to look for FIS table, available in kernel config, there shouldn't be 
necessity for this patch. The problem is when one wants to support more boards 
with same kernel, but those have partition in different place. Anyway, maybe 
someone from core OpenWrt devs could shed som light on this?

Regarding the part: "I don't see that accepted", I meant if there would be 
request to change the patch it would be something like this: "Ekh... hmm... how 
would I do that, don't know any programming.". So I would that patch would 
stuck in limbo.

> BTW, if you're able to submit patches in this very good quality to OpenWrt,
> I'm pretty sure, that you can do this for kernel as well :-)

Sending patches to OpenWrt is easy :)

> 
> -- ynezz
> 

Regards

--
TMN

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


Re: [OpenWrt-Devel] [PATCH 1/7] tegra: add new target

2019-03-06 Thread Tomasz Maciej Nowak
Hi,

W dniu 05.03.2019 o 11:36, Felix Fietkau pisze:
> On 2019-03-04 19:53, Tomasz Maciej Nowak wrote:
>> New target introduces initial support for NVIDIA Tegra SoC based devices.
>> It focuses on Tegra 2 CPUs, for successors supporting NEON instruction
>> set the target should be split in two subtargets.
>> This initial commit doesn't create any device image, it's groundwork
>> for further additions.
>>
>> Signed-off-by: Tomasz Maciej Nowak 
> You add a lot of Tegra specific kmod packages. I assume that on the
> Tegra platform kernel size is not a big concern, so I would strongly
> prefer enabling those drivers in the kernel config instead.

Yes, I don't know of any board which has space constrains, so the series is now 
changed as requested.

> 
> Thanks,
> 
> - Felix
> 

Regards

-- 
TMN

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


[OpenWrt-Devel] [PATCH v2] ath79: add support for jjPlus JA76PF2

2019-03-06 Thread Tomasz Maciej Nowak
jjPlus JA76PF2 (marketed as IntellusPro2) is a network embedded board.

Specification
SoC:Atheros AR7161
RAM:64 MB DDR
Flash:  16 MB SPI NOR
Ethernet:   2x 10/100/1000 Mbps AR8316
LAN (CN11), WAN/PoE (CN6 - close to power barrel
connector, 48 V)
MiniPCI:2x
LEDS:   4x, which 3 are GPIO controlled
Buttons:2x GPIO controlled
Reset (SW1, closer to ethernet ports), WPS (SW2)
Serial: 1x (only RX and TX are wired)
baud: 115200, parity: none, flow control: none

Currently there is one caveat compared to ar71xx target images as the
MAC addresses are random on every reboot. To remedy this one needs to
store the WAN MAC address in RedBoot configuration. OpenWrt on first
boot, after flashing, will read out the address and assign proper ones
to both WAN and LAN ports. It is iportant to NOT keep the old
configuration when doing sysupgrade from ar71xx.

Upgrading from OpenWrt ar71xx image
1. Connect to serial port,
2. Download OpenWrt sysupgrade image to /tmp directory and flash it
   with:
sysupgrade -n 
3. After writing new image OpenWrt will reboot, now interrupt boot
   process and enter RedBoot (bootloader) command line by pressing
   Ctrl+C,
4. Enter following commands (replace variable accordingly),
set_mac (to view MAC addresses)
alias ethaddr 
(confirm storing the value by inputting y and pressing Enter)
reset
5. Now board should restart and boot OpenWrt with proper MAC addresses.

Installation
1. Prepare TFTP server with OpenWrt initramfs image,
2. Connect to WAN ethernet port,
3. Connect to serial port,
4. Power on the board and enter RedBoot (bootloader) command line by
   pressing Ctrl+C,
5. Enter following commands (replace variables accordingly):
set_mac (to view MAC addresses)
alias ethaddr 
(confirm storing the value by inputting y and pressing Enter)
ip_adress -l /24 -h 
load -r -b 0x8006 
exec -c ""
6. Now board should boot OpenWrt initramfs image,
7. Download OpenWrt sysupgrade image to /tmp directory and flash it
   with:
sysupgrade 
8. Wait few minutes, after the D2 LED will stop blinking, the board
   is ready for configuration.

Signed-off-by: Tomasz Maciej Nowak 
---

Changes in v2
- in sysupgrade function pass kernel partition name as second argument
  instead of setting global variable, sugested by Petr ??tetiar.

---

 .../ath79/base-files/etc/board.d/02_network   |   4 +
 .../ath79/base-files/lib/upgrade/platform.sh  |  12 +-
 .../linux/ath79/dts/ar7161_jjplus_ja76pf2.dts | 126 ++
 target/linux/ath79/generic/config-default |   1 +
 target/linux/ath79/image/generic.mk   |  12 ++
 .../408-mtd-redboot_partition_scan.patch  |  44 ++
 6 files changed, 195 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ath79/dts/ar7161_jjplus_ja76pf2.dts
 create mode 100644 
target/linux/ath79/patches-4.14/408-mtd-redboot_partition_scan.patch

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network 
b/target/linux/ath79/base-files/etc/board.d/02_network
index 9a7f2d6472..014042abdf 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -279,6 +279,10 @@ ath79_setup_macs()
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
;;
+   jjplus,ja76pf2)
+   wan_mac=$(fconfig -s -r -d $(find_mtd_part "RedBoot config") -n 
alias/ethaddr)
+   lan_mac=$(macaddr_add "$wan_mac" 1)
+   ;;
nec,wg800hp)
lan_mac=$(mtd_get_mac_text board_data 640)
wan_mac=$(mtd_get_mac_text board_data 1152)
diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh 
b/target/linux/ath79/base-files/lib/upgrade/platform.sh
index bc19149d5c..c2fe08154d 100644
--- a/target/linux/ath79/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh
@@ -5,9 +5,10 @@
 PART_NAME=firmware
 REQUIRE_IMAGE_METADATA=1
 
-routerstation_do_upgrade() {
+redboot_fis_do_upgrade() {
local append
local sysup_file="$1"
+   local kern_part="$2"
local magic=$(get_magic_word "$sysup_file")
 
if [ "$magic" = "4349" ]; then
@@ -15,7 +16,7 @@ routerstation_do_upgrade() {
 
[ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j 
$CONF_TAR"
dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \
-   mtd -r $append -Fkernel:$kern_length:0x8006,rootfs 
write - kernel:rootfs
+   mtd -r $append 
-F$kern_part:$kern_length:0x8006,rootfs write - $kern_part:rootfs
 
elif [ "$magic" = "7379" ]; then
local board_dir=$(tar tf $sysup_file | grep -m 1 
'^sysupgrade-.*/$')
@@ -23,7 +24,7 @@ routerstation_do_upgrade() {
 
[ 

[OpenWrt-Devel] [PATCH v2 3/7] tools: add cbootimage-configs for tegra

2019-03-06 Thread Tomasz Maciej Nowak
This provides board configuraion tables for various Tegra boards needed
by cbootimage tool to create flashable bootloader images.

Signed-off-by: Tomasz Maciej Nowak 
---
 tools/Makefile|  2 +-
 tools/cbootimage-configs/Makefile | 32 +++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 tools/cbootimage-configs/Makefile

diff --git a/tools/Makefile b/tools/Makefile
index 182821e66d..cee9c0bf8a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -38,7 +38,7 @@ tools-$(BUILD_B43_TOOLS) += b43-tools
 tools-$(BUILD_ISL) += isl
 tools-$(CONFIG_USE_SPARSE) += sparse
 tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
-tools-$(CONFIG_TARGET_tegra) += cbootimage
+tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
 
 # builddir dependencies
 $(curdir)/bison/compile := $(curdir)/flex/compile
diff --git a/tools/cbootimage-configs/Makefile 
b/tools/cbootimage-configs/Makefile
new file mode 100644
index 00..5a1fc568cb
--- /dev/null
+++ b/tools/cbootimage-configs/Makefile
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2017-2019 Tomasz Maciej Nowak 
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME := cbootimage-configs
+
+PKG_SOURCE_DATE := 2017-04-13
+PKG_SOURCE_PROTO := git
+PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage-configs.git
+PKG_SOURCE_VERSION := 7c3b458b93ed6947cd083623f543e93f9103cc0f
+PKG_MIRROR_HASH := 
1d24421af8cf74ec2d625e237aa8121b1273774c4380ad333e2954e052a5a4fe
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+endef
+
+define Host/Install
+   $(INSTALL_DIR) $(STAGING_DIR_HOST)/share/$(PKG_NAME)
+   $(CP) $(HOST_BUILD_DIR)/* \
+   $(STAGING_DIR_HOST)/share/$(PKG_NAME)
+endef
+
+define Host/Clean
+   rm -fR $(STAGING_DIR_HOST)/share/$(PKG_NAME)
+endef
+
+$(eval $(call HostBuild))
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH v2 4/7] uboot-tegra: add U-Boot for tegra boards

2019-03-06 Thread Tomasz Maciej Nowak
Add U-Boot for NVIDIA Tegra based boards, with the first being CompuLab
TrimSlice. This is part of initial support for this board.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/boot/uboot-tegra/Makefile | 59 +++
 .../tegra/base-files/lib/upgrade/platform.sh  |  2 +
 target/linux/tegra/image/Makefile |  4 +-
 3 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 package/boot/uboot-tegra/Makefile

diff --git a/package/boot/uboot-tegra/Makefile 
b/package/boot/uboot-tegra/Makefile
new file mode 100644
index 00..60d1b02a60
--- /dev/null
+++ b/package/boot/uboot-tegra/Makefile
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2017-2019 Tomasz Maciej Nowak 
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_VERSION := 2019.01
+PKG_RELEASE := 1
+
+PKG_HASH := 50bd7e5a466ab828914d080d5f6a432345b500e8fba1ad3b7b61e95e60d51c22
+
+PKG_MAINTAINER := Tomasz Maciej Nowak 
+
+include $(INCLUDE_DIR)/u-boot.mk
+include $(INCLUDE_DIR)/package.mk
+
+define U-Boot/Default
+  BUILD_TARGET := tegra
+  HIDDEN := y
+endef
+
+define U-Boot/trimslice
+  NAME := CompuLab TrimSlice
+  BUILD_DEVICES := trimslice
+  UBOOT_IMAGE := trimslice-mmc.img trimslice-spi.img
+  SOC := tegra20
+  VENDOR := compulab
+endef
+
+UBOOT_TARGETS := trimslice
+
+define Build/bct-image
+   $(CP) $(PKG_BUILD_DIR)/u-boot-dtb-tegra.bin $(PKG_BUILD_DIR)/u-boot.bin
+   $(foreach bct,$(basename $(UBOOT_IMAGE)), \
+   cd $(PKG_BUILD_DIR); \
+   cbootimage -s $(SOC) -gbct \
+   
$(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).bct.cfg
 \
+   $(bct).bct; \
+   cbootimage -s $(SOC) \
+   
$(STAGING_DIR_HOST)/share/cbootimage-configs/$(SOC)/$(VENDOR)/$(VARIANT)/$(bct).img.cfg
 \
+   $(PKG_BUILD_DIR)/$(bct).img; \
+   rm -f $(bct).bct; \
+   )
+endef
+
+define Build/Compile
+   $(call Build/Compile/U-Boot)
+   $(call Build/bct-image)
+endef
+
+define Build/InstallDev
+   $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
+   $(foreach img,$(UBOOT_IMAGE), \
+   $(CP) $(PKG_BUILD_DIR)/$(img) $(STAGING_DIR_IMAGE)/;)
+endef
+
+$(eval $(call BuildPackage/U-Boot))
diff --git a/target/linux/tegra/base-files/lib/upgrade/platform.sh 
b/target/linux/tegra/base-files/lib/upgrade/platform.sh
index be453bdf9f..97dd381041 100644
--- a/target/linux/tegra/base-files/lib/upgrade/platform.sh
+++ b/target/linux/tegra/base-files/lib/upgrade/platform.sh
@@ -87,6 +87,8 @@ platform_do_upgrade() {
return 0
fi
 
+   #write uboot image
+   get_image "$@" | dd of="$diskdev" bs=512 skip=1 seek=1 count=4097 
conv=fsync,notrunc
#iterate over each partition from the image and write it to the boot 
disk
while read part start size; do
if export_partdevice partdev $part; then
diff --git a/target/linux/tegra/image/Makefile 
b/target/linux/tegra/image/Makefile
index 757e5b823f..5e3427ad27 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -32,9 +32,11 @@ define Build/tegra-sdcard
$(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
$(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
2048
+
+   $(if $(UBOOT),dd if=$(STAGING_DIR_IMAGE)/$(UBOOT).img of=$@ bs=512 
skip=1 seek=1 conv=notrunc)
 endef
 
-DEVICE_VARS += BOOT_SCRIPT
+DEVICE_VARS += BOOT_SCRIPT UBOOT
 define Device/Default
   BOOT_SCRIPT := generic-bootscript
   IMAGES := sdcard.img.gz
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH v2 1/7] tegra: add new target

2019-03-06 Thread Tomasz Maciej Nowak
New target introduces initial support for NVIDIA Tegra SoC based devices.
It focuses on Tegra 2 CPUs, for successors supporting NEON instruction
set the target should be split in two subtargets.
This initial commit doesn't create any device image, it's groundwork
for further additions.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/kernel/linux/modules/netdevices.mk|   4 +-
 target/linux/generic/config-4.14  |   2 +
 target/linux/tegra/Makefile   |  29 +
 target/linux/tegra/base-files/etc/inittab |   4 +
 .../base-files/lib/preinit/79_move_config |  22 +
 .../tegra/base-files/lib/upgrade/platform.sh  | 103 
 target/linux/tegra/config-4.14| 562 ++
 target/linux/tegra/image/Makefile |  47 ++
 target/linux/tegra/image/generic-bootscript   |   6 +
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 10 files changed, 854 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/tegra/Makefile
 create mode 100644 target/linux/tegra/base-files/etc/inittab
 create mode 100644 target/linux/tegra/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/tegra/base-files/lib/upgrade/platform.sh
 create mode 100644 target/linux/tegra/config-4.14
 create mode 100644 target/linux/tegra/image/Makefile
 create mode 100644 target/linux/tegra/image/generic-bootscript
 create mode 100644 
target/linux/tegra/patches-4.14/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch

diff --git a/package/kernel/linux/modules/netdevices.mk 
b/package/kernel/linux/modules/netdevices.mk
index fbc24b8405..2e29a5441f 100644
--- a/package/kernel/linux/modules/netdevices.mk
+++ b/package/kernel/linux/modules/netdevices.mk
@@ -113,7 +113,7 @@ $(eval $(call KernelPackage,mii))
 define KernelPackage/mdio-gpio
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:= Supports GPIO lib-based MDIO busses
-  DEPENDS:=+kmod-libphy @GPIO_SUPPORT 
+(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung):kmod-of-mdio
+  DEPENDS:=+kmod-libphy @GPIO_SUPPORT 
+(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio
   KCONFIG:= \
CONFIG_MDIO_BITBANG \
CONFIG_MDIO_GPIO
@@ -261,7 +261,7 @@ $(eval $(call KernelPackage,switch-rtl8306))
 define KernelPackage/switch-rtl8366-smi
   SUBMENU:=$(NETWORK_DEVICES_MENU)
   TITLE:=Realtek RTL8366 SMI switch interface support
-  DEPENDS:=@GPIO_SUPPORT +kmod-swconfig 
+(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung):kmod-of-mdio
+  DEPENDS:=@GPIO_SUPPORT +kmod-swconfig 
+(TARGET_armvirt||TARGET_brcm2708_bcm2708||TARGET_samsung||TARGET_tegra):kmod-of-mdio
   KCONFIG:=CONFIG_RTL8366_SMI
   FILES:=$(LINUX_DIR)/drivers/net/phy/rtl8366_smi.ko
   AUTOLOAD:=$(call AutoLoad,42,rtl8366_smi)
diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14
index cabdd9d01d..b8f46c0e8c 100644
--- a/target/linux/generic/config-4.14
+++ b/target/linux/generic/config-4.14
@@ -2280,6 +2280,7 @@ CONFIG_KERNFS=y
 # CONFIG_KEYBOARD_SUNKBD is not set
 # CONFIG_KEYBOARD_TCA6416 is not set
 # CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_TEGRA is not set
 # CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
 # CONFIG_KEYBOARD_TWL4030 is not set
 # CONFIG_KEYBOARD_XTKBD is not set
@@ -5498,6 +5499,7 @@ CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y
 # CONFIG_USB_WUSB is not set
 # CONFIG_USB_WUSB_CBAF is not set
 # CONFIG_USB_XHCI_HCD is not set
+# CONFIG_USB_XHCI_TEGRA is not set
 # CONFIG_USB_XUSBATM is not set
 # CONFIG_USB_YUREX is not set
 # CONFIG_USB_ZD1201 is not set
diff --git a/target/linux/tegra/Makefile b/target/linux/tegra/Makefile
new file mode 100644
index 00..57cb902cfd
--- /dev/null
+++ b/target/linux/tegra/Makefile
@@ -0,0 +1,29 @@
+#
+# Copyright (C) 2017-2019 Tomasz Maciej Nowak 
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH := arm
+BOARD := tegra
+BOARDNAME := NVIDIA Tegra
+FEATURES := audio boot-part display ext4 fpu gpio pci pcie rootfs-part rtc 
squashfs usb
+CPU_TYPE := cortex-a9
+CPU_SUBTYPE := vfpv3
+MAINTAINER := Tomasz Maciej Nowak 
+
+KERNEL_PATCHVER := 4.14
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME := zImage dtbs
+
+DEFAULT_PACKAGES += e2fsprogs mkf2fs partx-utils
+
+define Target/Description
+   Build firmware image for NVIDIA Tegra SoC devices.
+endef
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/tegra/base-files/etc/inittab 
b/target/linux/tegra/base-files/etc/inittab
new file mode 100644
index 00..b944a93ada
--- /dev/null
+++ b/target/linux/tegra/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K shutdown
+::askconsole:/usr/libexec/login.sh
+tty1::askfirst:/usr/libexec/login.sh
diff --git a/target/linux/tegra/base-files/lib/preinit/79_move_config 
b/target/linux/tegra/base-files/lib/preinit/79_move_config
new 

[OpenWrt-Devel] [PATCH v2 7/7] tegra: add kernel 4.19 support

2019-03-06 Thread Tomasz Maciej Nowak
Signed-off-by: Tomasz Maciej Nowak 
---
 target/linux/generic/config-4.19  |   1 +
 target/linux/tegra/config-4.19| 565 ++
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 ...enable-front-panel-leds-in-TrimSlice.patch |  46 ++
 4 files changed, 689 insertions(+)
 create mode 100644 target/linux/tegra/config-4.19
 create mode 100644 
target/linux/tegra/patches-4.19/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
 create mode 100644 
target/linux/tegra/patches-4.19/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch

diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19
index 288c2c5836..e187241567 100644
--- a/target/linux/generic/config-4.19
+++ b/target/linux/generic/config-4.19
@@ -2397,6 +2397,7 @@ CONFIG_KERNFS=y
 # CONFIG_KEYBOARD_SUNKBD is not set
 # CONFIG_KEYBOARD_TCA6416 is not set
 # CONFIG_KEYBOARD_TCA8418 is not set
+# CONFIG_KEYBOARD_TEGRA is not set
 # CONFIG_KEYBOARD_TM2_TOUCHKEY is not set
 # CONFIG_KEYBOARD_TWL4030 is not set
 # CONFIG_KEYBOARD_XTKBD is not set
diff --git a/target/linux/tegra/config-4.19 b/target/linux/tegra/config-4.19
new file mode 100644
index 00..ad8c1842fc
--- /dev/null
+++ b/target/linux/tegra/config-4.19
@@ -0,0 +1,565 @@
+CONFIG_AC97_BUS=y
+# CONFIG_AHCI_TEGRA is not set
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_CLOCKSOURCE_DATA=y
+CONFIG_ARCH_HAS_DEBUG_VIRTUAL=y
+CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
+CONFIG_ARCH_HAS_FORTIFY_SOURCE=y
+CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
+CONFIG_ARCH_HAS_KCOV=y
+CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE=y
+CONFIG_ARCH_HAS_PHYS_TO_DMA=y
+CONFIG_ARCH_HAS_RESET_CONTROLLER=y
+CONFIG_ARCH_HAS_SET_MEMORY=y
+CONFIG_ARCH_HAS_SG_CHAIN=y
+CONFIG_ARCH_HAS_STRICT_KERNEL_RWX=y
+CONFIG_ARCH_HAS_STRICT_MODULE_RWX=y
+CONFIG_ARCH_HAS_TICK_BROADCAST=y
+CONFIG_ARCH_HAVE_CUSTOM_GPIO_H=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MULTIPLATFORM=y
+CONFIG_ARCH_MULTI_V6_V7=y
+CONFIG_ARCH_MULTI_V7=y
+CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED=y
+CONFIG_ARCH_NR_GPIO=1024
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX=y
+CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT=y
+CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y
+CONFIG_ARCH_SUPPORTS_FIRMWARE=y
+CONFIG_ARCH_SUPPORTS_TRUSTED_FOUNDATIONS=y
+CONFIG_ARCH_SUPPORTS_UPROBES=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+CONFIG_ARCH_TEGRA=y
+# CONFIG_ARCH_TEGRA_114_SOC is not set
+# CONFIG_ARCH_TEGRA_124_SOC is not set
+CONFIG_ARCH_TEGRA_2x_SOC=y
+# CONFIG_ARCH_TEGRA_3x_SOC is not set
+CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_CMPXCHG_LOCKREF=y
+CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
+CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
+CONFIG_ARM=y
+CONFIG_ARM_AMBA=y
+CONFIG_ARM_ARCH_TIMER=y
+CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y
+CONFIG_ARM_CPU_SUSPEND=y
+CONFIG_ARM_CRYPTO=y
+CONFIG_ARM_ERRATA_720789=y
+CONFIG_ARM_ERRATA_754327=y
+CONFIG_ARM_ERRATA_764369=y
+CONFIG_ARM_GIC=y
+CONFIG_ARM_HAS_SG_CHAIN=y
+CONFIG_ARM_HEAVY_MB=y
+CONFIG_ARM_L1_CACHE_SHIFT=6
+CONFIG_ARM_L1_CACHE_SHIFT_6=y
+# CONFIG_ARM_LPAE is not set
+CONFIG_ARM_PATCH_IDIV=y
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+# CONFIG_ARM_PL172_MPMC is not set
+# CONFIG_ARM_SMMU is not set
+# CONFIG_ARM_SP805_WATCHDOG is not set
+CONFIG_ARM_TEGRA20_CPUFREQ=y
+CONFIG_ARM_THUMB=y
+CONFIG_ARM_THUMBEE=y
+CONFIG_ARM_VIRT_EXT=y
+CONFIG_ASN1=y
+CONFIG_ATA=y
+CONFIG_ATAGS=y
+CONFIG_AUTO_ZRELADDR=y
+CONFIG_BLK_DEV_BSG=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_BOUNCE=y
+CONFIG_CACHE_L2X0=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLKSRC_MMIO=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CLZ_TAB=y
+CONFIG_CMA=y
+CONFIG_CMA_ALIGNMENT=8
+CONFIG_CMA_AREAS=7
+# CONFIG_CMA_DEBUG is not set
+# CONFIG_CMA_DEBUGFS is not set
+CONFIG_CMA_SIZE_MBYTES=16
+# CONFIG_CMA_SIZE_SEL_MAX is not set
+CONFIG_CMA_SIZE_SEL_MBYTES=y
+# CONFIG_CMA_SIZE_SEL_MIN is not set
+# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
+CONFIG_COMMON_CLK=y
+# CONFIG_CPUFREQ_DT is not set
+CONFIG_CPU_32v6K=y
+CONFIG_CPU_32v7=y
+CONFIG_CPU_ABRT_EV7=y
+# CONFIG_CPU_BPREDICT_DISABLE is not set
+CONFIG_CPU_CACHE_V7=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
+CONFIG_CPU_FREQ_GOV_ATTR_SET=y
+CONFIG_CPU_FREQ_GOV_COMMON=y
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=y
+CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
+CONFIG_CPU_FREQ_GOV_USERSPACE=y
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_HAS_ASID=y
+# CONFIG_CPU_HOTPLUG_STATE_CONTROL is not set
+# CONFIG_CPU_ICACHE_DISABLE is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_PABRT_V7=y
+CONFIG_CPU_PM=y
+CONFIG_CPU_RMAP=y
+CONFIG_CPU_SPECTRE=y
+CONFIG_CPU_THUMB_CAPABLE=y
+CONFIG_CPU_TLB_V7=y
+CONFIG_CPU_V7=y
+CONFIG_CRC16=y
+# CONFIG_CRC32_SARWATE is not set
+CONFIG_CRC32_SLICEBY8=y

[OpenWrt-Devel] [PATCH v2 6/7] tegra: add support for CompuLab TrimSlice

2019-03-06 Thread Tomasz Maciej Nowak
It is a small form factor computer with rich amount of expansion ports.
Some hardware specs and supported features in this commit:

CPU: NVIDIA Tegra 2 @ 1GHz
RAM: 1GB DDR2-667
Storage: SDHC card slot
 µSDHC card slot
 USB to SATA bridge (depends on model)
 1MB SPI NOR flash for bootloader (single partition)
LAN: RTL8111DL GbE
WIFI: RT3070 b/g/n with external antenna (depends on model)
RTC: EM3027 (mapped as rtc0; with battery backup)
 Tegra 2 built-in (mapped as rtc1)
Sound: Analog/Digital (TLV320AIC23b; S/PDIF not tested)
Connectors: 4x USB 2.0
RS232 (mini serial)
HDMI
DVI-D (depends on model, not supported atm)
Extension connector (24 pin ZIF, 0.5mm pitch):
2X UART
SPI
JTAG (1.8V)
Other: power button with green led (not functional for early revisions
   without programmed PMIC)
   2x GPIO configurable green led

TrimSlice uses U-Boot placed in NOR flash. Boots Linux from any media
connected to USB, SATA or SD card inserted in slot. Can also boot from
TFTP. To run OpenWrt one needs to update U-Boot to fairly recent version
(the versions, pre-dts/dts provided by CompuLab won't suffice):

 1. Boot TrimSlice into Your current linux distro,
 2. Download trimslice-spi.img from u-boot-trimslice subdir,
 3. Install mtd-utils,
 4. Run following commands:
 flash_erase /dev/mtd0 0 256
 nandwrite /dev/mtd0 trimslice-spi.img
 5. Poweroff, insert SD card with OpenWrt, boot and enjoy.

If by some obstacle You can't follow those instructions, it is possible
to flash U-Boot using serial console.

 1. Insert FAT or EXT2/EXT3 formatted SD card with trimslice-spi.img,
 2. Interrupt boot process to enter U-Boot command line,
 3. Run following commands:
 ${fs}load mmc 0 0x0408 trimslice-spi.img
 sf probe 0
 sf erase 0 0x10
 sf write 0x0408 0x0 ${filesize}
 reset
 4. Poweroff, insert SD card with OpenWrt, boot and enjoy.

If something went wrong with one of above steps, there is simple
recovery option:

 1. Open the µSD slot security door to access the recovery-boot button,
 2. Insert SD card with OpenWrt to the front slot while unpowered,
 3. Power on the TrimSlice while pressing the recovery-boot button,
 4. With this it should boot straigth to OpenWrt, from there download
trimslice-spi.img and execute following commands:
 mtd erase /dev/mtd0
 mtd write trimslice-spi.img /dev/mtd0
 5. Reboot, now it should boot straigth to OpenWrt, without pressing the
recovery-boot button, with proper U-Boot flashed.

Signed-off-by: Tomasz Maciej Nowak 
---
 target/linux/tegra/config-4.14|  4 +-
 target/linux/tegra/image/Makefile | 10 
 ...enable-front-panel-leds-in-TrimSlice.patch | 46 +++
 3 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch

diff --git a/target/linux/tegra/config-4.14 b/target/linux/tegra/config-4.14
index d0d89c1fe2..8d117e62ec 100644
--- a/target/linux/tegra/config-4.14
+++ b/target/linux/tegra/config-4.14
@@ -488,10 +488,12 @@ CONFIG_SND_SOC_TEGRA20_SPDIF=y
 # CONFIG_SND_SOC_TEGRA_RT5640 is not set
 # CONFIG_SND_SOC_TEGRA_RT5677 is not set
 # CONFIG_SND_SOC_TEGRA_SGTL5000 is not set
-# CONFIG_SND_SOC_TEGRA_TRIMSLICE is not set
+CONFIG_SND_SOC_TEGRA_TRIMSLICE=y
 # CONFIG_SND_SOC_TEGRA_WM8753 is not set
 # CONFIG_SND_SOC_TEGRA_WM8903 is not set
 # CONFIG_SND_SOC_TEGRA_WM9712 is not set
+CONFIG_SND_SOC_TLV320AIC23=y
+CONFIG_SND_SOC_TLV320AIC23_I2C=y
 # CONFIG_SND_USB is not set
 CONFIG_SOC_BUS=y
 CONFIG_SOC_TEGRA_FLOWCTRL=y
diff --git a/target/linux/tegra/image/Makefile 
b/target/linux/tegra/image/Makefile
index 5e3427ad27..706cc65d92 100644
--- a/target/linux/tegra/image/Makefile
+++ b/target/linux/tegra/image/Makefile
@@ -46,4 +46,14 @@ define Device/Default
   PROFILES := Default
 endef
 
+define Device/trimslice
+  DEVICE_TITLE := CompuLab TrimSlice
+  DEVICE_DTS := tegra20-trimslice
+  DEVICE_PACKAGES := kmod-r8169 kmod-rt2800-usb kmod-rtc-em3027 \
+   kmod-usb-storage wpad-mini
+  SUPPORTED_DEVICES := compulab,trimslice
+  UBOOT := trimslice-mmc
+endef
+TARGET_DEVICES += trimslice
+
 $(eval $(call BuildImage))
diff --git 
a/target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
 
b/target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
new file mode 100644
index 00..ae48e8d862
--- /dev/null
+++ 
b/target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
@@ -0,0 +1,46 @@
+--- a/arch/arm/boot/dts/tegra20-trimslice.dts
 b/arch/arm/boot/dts/tegra20-trimslice.dts
+@@ -200,16 +200,17 @@
+   conf_ata {
+   nvidia,pins = "ata", "atc", "atd", "ate",
+   "crtp", "dap2", "dap3", "dap4", 

[OpenWrt-Devel] [PATCH v2 5/7] kernel: package rtc-em3027 module

2019-03-06 Thread Tomasz Maciej Nowak
Support for Microelectronic EM3027 real time clock chip.

Signed-off-by: Tomasz Maciej Nowak 
---
 package/kernel/linux/modules/other.mk | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index 220452df9b..e279616f20 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -528,6 +528,24 @@ endef
 $(eval $(call KernelPackage,rtc-ds1672))
 
 
+define KernelPackage/rtc-em3027
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=Microelectronic EM3027 RTC support
+  DEFAULT:=m if ALL_KMODS && RTC_SUPPORT
+  DEPENDS:=+kmod-i2c-core
+  KCONFIG:=CONFIG_RTC_DRV_EM3027 \
+   CONFIG_RTC_CLASS=y
+  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-em3027.ko
+  AUTOLOAD:=$(call AutoProbe,rtc-em3027)
+endef
+
+define KernelPackage/rtc-em3027/description
+ Kernel module for Microelectronic EM3027 RTC.
+endef
+
+$(eval $(call KernelPackage,rtc-em3027))
+
+
 define KernelPackage/rtc-isl1208
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Intersil ISL1208 RTC support
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH v2 2/7] tools: add cbootimage for tegra

2019-03-06 Thread Tomasz Maciej Nowak
Tegra BCT and bootable flash image generator/compiler

>From documentation:
This project provides a tool which compiles BCT (Boot Configuration
Table) images to place into the boot flash of a Tegra-based device.

The tool will either:

a) Compile a textual representation of a BCT into a binary image.

b) Generate an entire boot image from a previously compiled BCT and a
   bootloader binary.

Signed-off-by: Tomasz Maciej Nowak 
---
 tools/Makefile|  2 ++
 tools/cbootimage/Makefile | 31 +++
 2 files changed, 33 insertions(+)
 create mode 100644 tools/cbootimage/Makefile

diff --git a/tools/Makefile b/tools/Makefile
index f7ff2db361..182821e66d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -38,6 +38,7 @@ tools-$(BUILD_B43_TOOLS) += b43-tools
 tools-$(BUILD_ISL) += isl
 tools-$(CONFIG_USE_SPARSE) += sparse
 tools-$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini) += genext2fs
+tools-$(CONFIG_TARGET_tegra) += cbootimage
 
 # builddir dependencies
 $(curdir)/bison/compile := $(curdir)/flex/compile
@@ -76,6 +77,7 @@ $(curdir)/zlib/compile := $(curdir)/cmake/compile
 $(curdir)/wrt350nv2-builder/compile := $(curdir)/zlib/compile
 $(curdir)/lzma-old/compile := $(curdir)/zlib/compile
 $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
+$(curdir)/cbootimage/compile += $(curdir)/autoconf/compile
 
 ifneq ($(HOST_OS),Linux)
   $(curdir)/squashfskit4/compile += $(curdir)/coreutils/compile
diff --git a/tools/cbootimage/Makefile b/tools/cbootimage/Makefile
new file mode 100644
index 00..42640eab36
--- /dev/null
+++ b/tools/cbootimage/Makefile
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2017-2019 Tomasz Maciej Nowak 
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME := cbootimage
+PKG_VERSION := 1.8
+
+PKG_SOURCE_PROTO := git
+PKG_SOURCE_URL := https://github.com/NVIDIA/cbootimage.git
+PKG_SOURCE_VERSION := 7c9db585d06cce9efffa2a82245f233233680060
+PKG_MIRROR_HASH := 
84d9abaaa3eddde05f506dc16effe1c9e18eb94727ed59c5e0a879baeb04e0b2
+
+HOST_BUILD_PARALLEL := 1
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Configure
+   (cd $(HOST_BUILD_DIR); autoreconf --install --symlink)
+   $(call Host/Configure/Default)
+endef
+
+define Host/Clean
+   rm -f $(STAGING_DIR_HOST)/bin/$(PKG_NAME) \
+   $(STAGING_DIR_HOST)/share/man/man1/$(PKG_NAME).1
+endef
+
+$(eval $(call HostBuild))
-- 
2.21.0


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


[OpenWrt-Devel] [PATCH v2 0/7] tegra: add new target with support for CompuLab TrimSlice

2019-03-06 Thread Tomasz Maciej Nowak
This is continuation of effort in [1] PR to old LEDE source tree. It
received few improvement and some commits got split.

Main changes worth mentioning:
- update tools and U-Boot to recent versions,
- added support for 4.19 kernel
- now SD card image is also an rescue image with embedded of U-Boot
- the SD card creation process is more generic which makes adding basic
  support for other boards/devices trivial

1. https://github.com/lede-project/source/pull/1252

Changes in v2
- there are no drastic storage space constraints for this target, so
  instead of creating packages for target speciffic modules, build them
  in the kernel, requested by Felix Fietkau
- since video drivers are now built-in I enabled also USB keyboard
  related drivers, because most users with connected monitors would
  expect to interact with the device OOTB

Tomasz Maciej Nowak (7):
  tegra: add new target
  tools: add cbootimage for tegra
  tools: add cbootimage-configs for tegra
  uboot-tegra: add U-Boot for tegra boards
  kernel: package rtc-em3027 module
  tegra: add support for CompuLab TrimSlice
  tegra: add kernel 4.19 support

 package/boot/uboot-tegra/Makefile |  59 ++
 package/kernel/linux/modules/netdevices.mk|   4 +-
 package/kernel/linux/modules/other.mk |  18 +
 target/linux/generic/config-4.14  |   2 +
 target/linux/generic/config-4.19  |   1 +
 target/linux/tegra/Makefile   |  29 +
 target/linux/tegra/base-files/etc/inittab |   4 +
 .../base-files/lib/preinit/79_move_config |  22 +
 .../tegra/base-files/lib/upgrade/platform.sh  | 105 
 target/linux/tegra/config-4.14| 564 +
 target/linux/tegra/config-4.19| 565 ++
 target/linux/tegra/image/Makefile |  59 ++
 target/linux/tegra/image/generic-bootscript   |   6 +
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 ...enable-front-panel-leds-in-TrimSlice.patch |  46 ++
 ...interrupts-due-to-tegra2-silicon-bug.patch |  77 +++
 ...enable-front-panel-leds-in-TrimSlice.patch |  46 ++
 tools/Makefile|   2 +
 tools/cbootimage-configs/Makefile |  32 +
 tools/cbootimage/Makefile |  31 +
 20 files changed, 1747 insertions(+), 2 deletions(-)
 create mode 100644 package/boot/uboot-tegra/Makefile
 create mode 100644 target/linux/tegra/Makefile
 create mode 100644 target/linux/tegra/base-files/etc/inittab
 create mode 100644 target/linux/tegra/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/tegra/base-files/lib/upgrade/platform.sh
 create mode 100644 target/linux/tegra/config-4.14
 create mode 100644 target/linux/tegra/config-4.19
 create mode 100644 target/linux/tegra/image/Makefile
 create mode 100644 target/linux/tegra/image/generic-bootscript
 create mode 100644 
target/linux/tegra/patches-4.14/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
 create mode 100644 
target/linux/tegra/patches-4.14/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
 create mode 100644 
target/linux/tegra/patches-4.19/100-serial8250-on-tegra-hsuart-recover-from-spurious-interrupts-due-to-tegra2-silicon-bug.patch
 create mode 100644 
target/linux/tegra/patches-4.19/101-ARM-dtc-tegra-enable-front-panel-leds-in-TrimSlice.patch
 create mode 100644 tools/cbootimage-configs/Makefile
 create mode 100644 tools/cbootimage/Makefile

-- 
2.21.0


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


Re: [OpenWrt-Devel] Random PARTUUID on every rebuild

2019-03-06 Thread Mike Jones
On Wed, Mar 6, 2019 at 5:32 AM Jo-Philipp Wich  wrote:

> Hi,
>
> the random PARTUUID has been chosen to ensure that a given boot grub
> partition (containing grub config, kernel, sysupgrade restore tarball)
> boots the correct corresponding rootfs in case multiple openwrt
> partitions are present on the device (e.g. different versions on
> different block devices).
>
> Chosing a random uuid at build time was the simplest way to achieve that.
>
> The random identifier can be replaced by a stable identifier derived
> from the version or something like SOURCE_DATE_EPOCH combined with a
> checksum over the kernel config or similar.
>
> Maybe the kernel version magic value would be a suitable pseudorandom
> seed candidate to produce a reproducible partuuid which still
> distinguishes different kernel/rootfs pairs sufficiently.
>
> ~ Jo
>

Could this be a CLI parameter to make, or something that's written to the
.config?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] mac80211: Select better ch/VHT for sub-band radios

2019-03-06 Thread Jeff Kletsky

On 3/3/19 2:44 PM, Jeff Kletsky wrote:


From: Jeff Kletsky 

Certain wireless devices have limitations on the channels
on which they can operate. For some of these devices,
the present default of ch. 36 (VHT80) is outside of the
capabilities of the device.

For 5 GHz, provide a default of the first non-disabled channel
returned by `iw phy $phy info`. For VHT-capable devices,
Select VHT20 if that channel may  not be "clear" for either
VHT40 or VHT80 due to either band edges or DFS restrictions.

Based on hostap src/common/hw_features_common.c

VHT80: 36, 52, 100, 116, 132, 149
VHT40: 44, 60, 108, 124, 140, 157, 165, 184, 192

Adding in band edges, DFS, and limited-use bands reduces this to:

VHT80: 36, 149
VHT40: 44, 157

Runtime-tested: TP-Link Archer C7v2, GL.iNet AR750S
Runtime-tested: Linksys EA8300 (QCA9888; ch. 100 and above only)

Signed-off-by: Jeff Kletsky 


[...]

If and when https://patchwork.ozlabs.org/patch/1051204/ is accepted,
this may need a change to detect the presence of 5 GHz capabilities.

The existing check in `master` for '5180 MHz' may fail, depending on
the channels permitted by the DT restriction and how `iw` renders them
in its output.


One approach (untested against patch/1051204 at this time) would be to 
change


fgrep -q '5180 MHz'

to

egrep -q '5[0-9][0-9][0-9] MHz'

Jeff



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


[OpenWrt-Devel] Recursive dependency - openconnect

2019-03-06 Thread Koen Vandeputte

Hi All,

Could someone with more knowledge regarding dependencies take a look at 
this?



koen@bob:~/firmware/builds/generic_cns3xxx$ make menuconfig

feeds/packages/net/openconnect/Config.in:6:error: recursive dependency 
detected!

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
feeds/packages/net/openconnect/Config.in:6:    choice  contains 
symbol PACKAGE_openconnect

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
tmp/.config-package.in:107895:    symbol PACKAGE_openconnect is selected 
by PACKAGE_luci-proto-openconnect

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
tmp/.config-package.in:66907:    symbol PACKAGE_luci-proto-openconnect 
depends on OPENCONNECT_OPENSSL

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
feeds/packages/net/openconnect/Config.in:13:    symbol 
OPENCONNECT_OPENSSL is part of choice 

package/libs/openssl/Config.in:247:error: recursive dependency detected!
For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
package/libs/openssl/Config.in:247:    symbol OPENSSL_ENGINE is selected 
by OPENSSL_ENGINE_CRYPTO

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
package/libs/openssl/Config.in:256:    symbol OPENSSL_ENGINE_CRYPTO 
depends on PACKAGE_libopenssl

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
tmp/.config-package.in:55922:    symbol PACKAGE_libopenssl is selected 
by PACKAGE_libp11

For a resolution refer to Documentation/kbuild/kconfig-language.txt
subsection "Kconfig recursive dependency limitations"
tmp/.config-package.in:63088:    symbol PACKAGE_libp11 is selected by 
OPENSSL_ENGINE



*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

koen@bob:~/firmware/builds/generic_cns3xxx$ make -j32
WARNING: your configuration is out of sync. Please run make menuconfig, 
oldconfig or defconfig!

 make[1] world
 make[2] tools/compile
 make[2] package/cleanup
^C/mnt/ramdisk/koen/firmware/builds/generic_cns3xxx/include/toplevel.mk:216: 
recipe for target 'world' failed

make: *** [world] Interrupt

koen@bob:~/firmware/builds/generic_cns3xxx$


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


Re: [OpenWrt-Devel] coverity results are now public

2019-03-06 Thread Petr Štetiar
Alexander Couzens  [2019-03-05 04:40:02]:

Hi,

> I changed the project to allow everybody to view the defects.

can you please try harder? :-) I can view some stats, but no details about
actual defects. Am I doing it wrong?

-- ynezz

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


Re: [OpenWrt-Devel] Random PARTUUID on every rebuild

2019-03-06 Thread Jo-Philipp Wich
Hi,

the random PARTUUID has been chosen to ensure that a given boot grub
partition (containing grub config, kernel, sysupgrade restore tarball)
boots the correct corresponding rootfs in case multiple openwrt
partitions are present on the device (e.g. different versions on
different block devices).

Chosing a random uuid at build time was the simplest way to achieve that.

The random identifier can be replaced by a stable identifier derived
from the version or something like SOURCE_DATE_EPOCH combined with a
checksum over the kernel config or similar.

Maybe the kernel version magic value would be a suitable pseudorandom
seed candidate to produce a reproducible partuuid which still
distinguishes different kernel/rootfs pairs sufficiently.

~ Jo



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] ramips: ethernet: fix to interrupt handling

2019-03-06 Thread Mingyu Li
the original code use status register to keep there still have some
pkts in buffer.
need next napi call to receive it.

if 128 packets in buffer. you clear status first. because napi max
handle 64 packets in buffer.
so 64 packets need to handle in next napi poll. if no new packet
comming. the status register will not set.
so fe_poll function will not call fe_poll_tx or fe_poll_rx. that would
be a problem.

the status register also use to control napi interrupt enable. must
make sure no packets need to
handle then enable interrupt.

Rosen Penev  於 2019年3月6日 週三 下午12:08寫道:
>
> From: NeilBrown 
>
> The current code acknowledged interrupts *after* polling.
> This is the wrong way around, and could cause an interrupt to
> be missed.
> This is not likely to be fatal as another packet, and so another
> interrupt, should come along soon.  But maybe it is causing
> problems, so let's fix it anyway.
>
> Signed-off-by: NeilBrown 
> Signed-off-by: Rosen Penev 
> ---
>  .../drivers/net/ethernet/mediatek/mtk_eth_soc.c   | 11 +--
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git 
> a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c 
> b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index e0bc0ab818..2e0c8f94ca 100644
> --- 
> a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ 
> b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -876,6 +876,8 @@ static int fe_poll_rx(struct napi_struct *napi, int 
> budget,
> struct fe_rx_dma *rxd, trxd;
> int done = 0, pad;
>
> +   fe_reg_w32(rx_intr, FE_REG_FE_INT_STATUS);
> +
> if (netdev->features & NETIF_F_RXCSUM)
> checksum_bit = soc->checksum_bit;
> else
> @@ -963,9 +965,6 @@ release_desc:
> done++;
> }
>
> -   if (done < budget)
> -   fe_reg_w32(rx_intr, FE_REG_FE_INT_STATUS);
> -
> return done;
>  }
>
> @@ -981,6 +980,8 @@ static int fe_poll_tx(struct fe_priv *priv, int budget, 
> u32 tx_intr,
> u32 idx, hwidx;
> struct fe_tx_ring *ring = >tx_ring;
>
> +   fe_reg_w32(tx_intr, FE_REG_FE_INT_STATUS);
> +
> idx = ring->tx_free_idx;
> hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0);
>
> @@ -1004,9 +1005,7 @@ static int fe_poll_tx(struct fe_priv *priv, int budget, 
> u32 tx_intr,
> if (idx == hwidx) {
> /* read hw index again make sure no new tx packet */
> hwidx = fe_reg_r32(FE_REG_TX_DTX_IDX0);
> -   if (idx == hwidx)
> -   fe_reg_w32(tx_intr, FE_REG_FE_INT_STATUS);
> -   else
> +   if (idx != hwidx)
> *tx_again = 1;
> } else {
> *tx_again = 1;
> --
> 2.17.1
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

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