1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-10-19 22:18:16 +02:00
Commit Graph

24733 Commits

Author SHA1 Message Date
Bjørn Mork
2449a63208 ramips: mt7621: Add support for ZyXEL NR7101
The ZyXEL NR7101 is an 802.3at PoE powered 5G outdoor (IP68) CPE
with integrated directional 5G/LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7603E
 - Switch: 1 LAN port (Gigabiti)
 - 5G/LTE: Quectel RG502Q-EA connected by USB3 to SoC
 - SIM: 2 micro-SIM slots under transparent cover
 - Buttons: Reset, WLAN under same cover
 - LEDs: Multicolour green/red/yellow under same cover (visible)
 - Power: 802.3at PoE via LAN port

The device is built as an outdoor ethernet to 5G/LTE bridge or
router. The Wifi interface is intended for installation and/or
temporary management purposes only.

UART Serial:

57600N1
Located on populated 5 pin header J5:

 [o] GND
 [ ] key - no pin
 [o] RX
 [o] TX
 [o] 3.3V Vcc

Remove the SIM/button/LED cover, the WLAN button and 12 screws
holding the back plate and antenna cover together. The GPS antenna
is fixed to the cover, so be careful with the cable.  Remove 4
screws fixing the antenna board to the main board, again being
careful with the cables.

A bluetooth TTL adapter is recommended for permanent console
access, to keep the router water and dustproof. The 3.3V pin is
able to power such an adapter.

MAC addresses:

OpenWrt OEM   Address          Found as
lan     eth2  08:26:97:*:*:BC  Factory 0xe000 (hex), label
wlan0   ra0   08:26:97:*:*:BD  Factory 0x4 (hex)
wwan0   usb0  random

WARNING!!

ISP managed firmware might at any time update itself to a version
where all known workarounds have been disabled.  Never boot an ISP
managed firmware with a SIM in any of the slots if you intend to use
the router with OpenWrt. The bootloader lock can only be disabled with
root access to running firmware. The flash chip is physically
inaccessible without soldering.

Installation from OEM web GUI:

- Log in as "supervisor" on https://172.17.1.1/
- Upload OpenWrt initramfs-recovery.bin image on the
  Maintenance -> Firmware page
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Installation from OEM ssh:

- Log in as "root" on 172.17.1.1 port 22022
- scp OpenWrt initramfs-recovery.bin image to 172.17.1.1:/tmp
- Prepare bootloader config by running:
    nvram setro uboot DebugFlag 0x1
    nvram setro uboot CheckBypass 0
    nvram commit
- Run "mtd_write -w write initramfs-recovery.bin Kernel" and reboot
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- (optional) Copy OpenWrt to the recovery partition. See below
- Sysupgrade to the OpenWrt sysupgrade image and reboot

Copying OpenWrt to the recovery partition:

- Verify that you are running a working OpenWrt recovery image
  from flash
- ssh to root@192.168.1.1 and run:
    fw_setenv CheckBypass 0
    mtd -r erase Kernel2
- Wait while the bootloader mirrors Image1 to Image2

NOTE: This should only be done after successfully booting the OpenWrt
  recovery image from the primary partition during installation.  Do
  not do this after having sysupgraded OpenWrt!  Reinstalling the
  recovery image on normal upgrades is not required or recommended.

Installation from Z-Loader:

- Halt boot by pressing Escape on console
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Type "ATNR 1,initramfs-recovery.bin" at the "ZLB>" prompt
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- Sysupgrade to the OpenWrt sysupgrade image

NOTE: ATNR will write the recovery image to both primary and recovery
  partitions in one go.

Booting from RAM:

- Halt boot by pressing Escape on console
- Type "ATGU" at the "ZLB>" prompt to enter the U-Boot menu
- Press "4" to select "4: Entr boot command line interface."
- Set up a tftp server to serve the OpenWrt initramfs-recovery.bin
  image at 10.10.10.3
- Load it using "tftpboot 0x88000000 initramfs-recovery.bin"
- Boot with "bootm  0x8800017C" to skip the 380 (0x17C) bytes ZyXEL
  header

This method can also be used to RAM boot OEM firmware. The warning
regarding OEM applies!  Never boot an unknown OEM firmware, or any OEM
firmware with a SIM in any slot.

NOTE: U-Boot configuration is incomplete (on some devices?). You may
  have to configure a working mac address before running tftp using
   "setenv eth0addr <mac>"

Unlocking the bootloader:

If you are unebale to halt boot, then the bootloader is locked.

The OEM firmware locks the bootloader on every boot by setting
DebugFlag to 0.  Setting it to 1 is therefore only temporary
when OEM firmware is installed.

- Run "nvram setro uboot DebugFlag 0x1; nvram commit" in OEM firmware
- Run "fw_setenv DebugFlag 0x1" in OpenWrt

  NOTE:
    OpenWrt does this automatically on first boot if necessary

  NOTE2:
    Setting the flag to 0x1 avoids the reset to 0 in known OEM
    versions, but this might change.

  WARNING:
    Writing anything to flash while the bootloader is locked is
    considered extremely risky. Errors might cause a permanent
    brick!

Enabling management access from LAN:

Temporary workaround to allow installing OpenWrt if OEM firmware
has disabled LAN management:

- Connect to console
- Log in as "root"
- Run "iptables -I INPUT -i br0 -j ACCEPT"

Notes on the OEM/bootloader dual partition scheme

The dual partition scheme on this device uses Image2 as a recovery
image only. The device will always boot from Image1, but the
bootloader might copy Image2 to Image1 under specific conditions. This
scheme prevents repurposing of the space occupied by Image2 in any
useful way.

Validation of primary and recovery images is controlled by the
variables CheckBypass, Image1Stable, and Image1Try.

The bootloader sets CheckBypass to 0 and reboots if Image1 fails
validation.

If CheckBypass is 0 and Image1 is invalid then Image2 is copied to
Image1.

If CheckBypass is 0 and Image2 is invalid, then Image1 is copied to
Image2.

If CheckBypass is 1 then all tests are skipped and Image1 is booted
unconditionally.  CheckBypass is set to 1 after each successful
validation of Image1.

Image1Try is incremented if Image1Stable is 0, and Image2 is copied to
Image1 if Image1Try is 3 or larger.  But the bootloader only tests
Image1Try if CheckBypass is 0, which is impossible unless the booted
image sets it to 0 before failing.

The system is therefore not resilient against runtime errors like
failure to mount the rootfs, unless the kernel image sets CheckBypass
to 0 before failing. This is not yet implemented in OpenWrt.

Setting Image1Stable to 1 prevents the bootloader from updating
Image1Try on every boot, saving unnecessary writes to the environment
partition.

Keeping an OpenWrt initramfs recovery as Image2 is recommended
primarily to avoid unwanted OEM firmware boots on failure. Ref the
warning above. It enables console-less recovery in case of some
failures to boot from Image1.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-05-09 09:15:44 +02:00
Ilya Lipnitskiy
89b99e9c1a treewide: consolidate named GPIO patch into hack-5.10
ath79, lantiq, ipq40xx, ramips all use the OpenWrt-specific gpio-export
functionality. Consolidate the patch that adds it under hack-5.10 since
this logic is obviously not target-specific. For those who want to
disable it, unsetting CONFIG_GPIO_SYSFS symbol will disable this code.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-05-09 09:15:44 +02:00
Mark Mentovai
62850e7a77 ipq806x: Bring missing patches from 5.4 to 5.10
Kernel 5.10 support for ipq806x was added at the same time that these
patches were developed for kernel 5.4. This carries the patches forward
to kernel 5.10.

fa731838c524 ipq806x: dwmac: clear forced speed during probe
75ca641f1b84 ipq806x: Add "snps,dwmac" to all gmac compatible=
d62825dd77b3 ipq806x: dwmac: set forced speed when using fixed-link

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Run-tested: ipq806x/ubnt,unifi-ac-hd
Cc: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-09 09:15:44 +02:00
Mark Mentovai
a1afeb9270 ipq806x: Add mising devices to kernel 5.10
d53be2a2e981 migrated 0069-arm-boot-add-dts-files.patch from patches-5.4
to patches-5.10, but a subsequent patch in that set, 1e25423be8ac,
erroneously removed several devices:

ipq8062/nec,wg2600hp3 from 3bb16185737c
ipq8064/asrock,g10 from 98b86296e67d
ipq8064/ubnt,unifi-ac-hd from 4e46beb31342

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Run-tested: ipq806x/ubnt,unifi-ac-hd
Cc: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-09 09:15:44 +02:00
John Audia
da16b801a3 kernel: bump 5.4 to 5.4.117
All patches automatically rebased.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2021-05-09 09:15:44 +02:00
Daniel Golle
e1adb1fa39
mediatek: reserve memory for ramoops and enable PSTORE
Reserve 64KiB of memory for crashlogs and enable PSTORE feature in
kernel config for MT7622.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-05-08 23:36:18 +01:00
Stefan Lippers-Hollmann
435dc2e77e ipq806x: ecw5410: case-insensitive qcom-smem partitions
The out-of-tree qcom-smem patches traditionally displayed mtd partition names
in upper case, starting with the new mainline qcom-smem support in kernel v5.10,
it switches to normalizing the partition names to lower case.

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
2021-05-08 18:45:42 +02:00
Stefan Lippers-Hollmann
f70e11cd97 ipq806x: g10: case-insensitive qcom-smem partitions
The out-of-tree qcom-smem patches traditionally displayed mtd partition names
in upper case, starting with the new mainline qcom-smem support in kernel v5.10,
it switches to normalizing the partition names to lower case.

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
2021-05-08 18:45:42 +02:00
Stefan Lippers-Hollmann
2db9dded0a ipq806x: nbg6817: case-insensitive qcom-smem partitions
The out-of-tree qcom-smem patches traditionally displayed mtd partition names
in upper case, starting with the new mainline qcom-smem support in kernel v5.10,
it switches to normalizing the partition names to lower case.

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
2021-05-08 18:45:42 +02:00
Mark Mentovai
d62825dd77 ipq806x: dwmac: fix GMACs connected via SGMII fixed-link
fa731838c524 cleared the forced speed in the QSGMII PCS_ALL_CH_CTL
register during probe, but this is only correct for GMACs that are not
configured with fixed-link. This prevented GMACs configured with both
phy-mode = "sgmii" and fixed-link from working properly, as discussed at
https://github.com/openwrt/openwrt/pull/3954#issuecomment-834625090 and
the comments that follow. Notably, this prevented all communication
between gmac2 and the switch on the Netgear R7800.

The correct behavior is to set the QSGMII PCS_ALL_CH_CTL register by
considering the gmac's fixed-link child, setting the speed as directed by
fixed-link if present, and otherwise clearing it as was done previously.

Fixes: fa731838c524 ("ipq806x: dwmac: clear forced speed during probe")
Signed-off-by: Mark Mentovai <mark@moxienet.com>
Tested-by: Hannu Nyman <hannu.nyman@iki.fi>
Run-tested: ipq806x/ubnt,unifi-ac-hd, ipq806x/netgear,r7800
Cc: Petr Štetiar <ynezz@true.cz>
Cc: Ansuel Smith <ansuelsmth@gmail.com>
Tested-by:  Ansuel Smith <ansuelsmth@gmail.com>
2021-05-08 18:45:42 +02:00
Baptiste Jonglez
979f406366 ipq40xx: fix hard_config partition size on MikroTik hAP-ac2
The routerbootparts driver dynamically discovers the location of MikroTik
partitions, but it cannot determine their size (except by extending them
up to the start of the next discovered partition).

The hard_config partition has a default size of 0x1000 in the driver,
while it actually takes 0x2000 on the hAP-ac2.  Set the correct size in
the hAP-ac2 DTS.

On most devices, this isn't a problem as the actual data fits in 0x1000
bytes.  However, some devices have larger data that doesn't fit in 0x1000
bytes.  In any case, all devices seen so far have enough space for a
0x2000 hard_config partition before the start of the dtb_config partition.
With the current 0x1000 size:

0x00000000e000-0x00000000f000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

With this patch extending the size to 0x2000:

0x00000000e000-0x000000010000 : "hard_config"
0x000000010000-0x000000017bbc : "dtb_config"

Other ipq40xx boards may need the same fix but it needs testing.

References: https://forum.openwrt.org/t/support-for-mikrotik-hap-ac2/23333/324
Acked-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
2021-05-08 12:18:43 +02:00
Sven Roederer
1e4b191ac8 sdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives
Using these config-options to customize the folders used at build-time makes these
folder settings appear in generated archive. This causes the SDK to be not
portable, as it's going to use the build-time folders on the new systems.
The errors vary from passing the build, disk out-of-space to permission denied.

The build-time settings of these folders are passed into the archive via Config.build.
The expected behavior is that the SDK acts after unpacking like these settings have
their defaults, using intree folders. So just filter these folders out when running
convert-config.pl to create Config.build.

This addresses the same issue that's fixed in the previous commit for the imagebuilder.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-05-08 12:14:04 +02:00
Sven Roederer
6967903b01 imagebuilder: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archive
Using these config-options to customize the folders used at build-time
makes these folder settings appear in generated archive. This causes the
imagebuilder to be not portable, as it's going to use the build-time folders
on the new systems. Errors look like:

  mkdir: cannot create directory '/mnt/build': Permission denied
  Makefile:116: recipe for target '_call_image' failed
  make[2]: *** [_call_image] Error 1
  Makefile:241: recipe for target 'image' failed
  make[1]: *** [image] Error 2

The build-time settings of these folders are passed into the archives via
.config file.
The expected behavior is that after unpacking the imagebuilder acts like
these settings have their defaults, using intree folders. So unset the
build-time settings.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-05-08 12:14:00 +02:00
Birger Koblitz
cde31976e3 realtek: Add support for Layer 2 Multicast
Adds support for Layer 2 multicast by implementing the DSA port_mdb_*
callbacks. The Kernel bridge listens to IGMP/MLD messages trapped to
the CPU-port, and calls the Multicast Forwarding Database updates.
The updates manage the L2 forwarding entries and the multicast
port-maps.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
4342d27ec9 realtek: Setup all VLANs with default configurations
This sets up all VLANs with a default configuration on reset:
 - forward based on VLAN-ID and not the FID/MSTI
 - forward based on the inner VLAN-ID (not outer)

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
d4649942ad realtek: Add SoC-specific VLAN setup routine
This adds SoC specific VLAN configuration routines, which
alsoe sets up the portmask table entries that are referred to
in the vlan profiles registers for unknown multicast flooding.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
408990464c realtek: Add support for clause45 PHYs
This adds support for the MMD access registers the RTL-SoCs use to access clause 45
PHYs via mdio.
This new interface is used to add EEE-support for the RTL8226

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
515d9c85f2 realtek: improve EEE support for RTL8380/8390/9300
Clean up and fix bugs in the EEE support for RTL8380/90
Adds EEE support for RTL9300

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
637deabb4a realtek: Add L2 hash bucket size
Adds a hash-bucket size attribute for the different SoCs, in order to
accomodate the buckets with 8 entries of the L2-forwarding tables
on RTL93XX in contrast to only 4 on RTL83XX.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
d497262748 realtek: remove unused FDB print routing
remove fdb_dump debugging function

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
cf4edabefd realtek: add IGMP/MLD snooping support
This adds snooping support for IGMP and MLD on RTL8380/90/9300
by trapping IGMP and MLD packets to the CPU.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Birger Koblitz
9e8d62e421 realtek: enable CRC offloading
Enables CRC calculation offloading on RTL8380/8390/9300.

Tested on Zyxel XGS1210-10 (RTL9302)/GS1900-48 (RTL8390)/GS1900-10HP (RTL8382)
On the Zyxel GS1900-10HP, an increase of 5% in iperf3 send throughput
and 11% in receive throughput is seen.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
2021-05-07 07:05:16 +02:00
Ansuel Smith
3bae740311 ipq806x: add missing wakeup-source for gpio keys
wakeup-source is required for gpio keys to fix error
genirq: irq_chip msmgpio did not update eff. affinity mask

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
1603d09964 ipq806x: apply correct voltage tolerance
Voltage tolerance was 5%, not 5000. Update min and max voltage of the target opp.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
4cd43af0de ipq806x: fix missing tx/rx fifo depth gmac configuration
tx/rx-fifo-depth is required to set mtu to the gmac. Backport upstream patch.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
db2c147cf4 ipq806x: refresh 5.10 patches
make target/linux/kernel refresh

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
d079c8fa48 ipq806x: simplify ecw5410 dts
Simplify ecw5410 dts instead of redefine nodes.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
e3daef34a0 ipq806x: set boot layout for nandc compatible
Set boot layout size to fix io error on block scan.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
85adcec3ba ipq806x: add kernel 5.10 as testing kernel
Add kernel 5.10 as testing kernel

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
9e843a9b8a ipq806x: refresh config 5.10
Refresh config for kernel 5.10.
- Added new symbol.
- Refreshed with make kernel_oldconfig

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
1e25423be8 ipq806x: refresh dtsi patches
- Add new tsens node
- Add new cpufreq required nodes
- Drop arm cpuidle compatible
- Fix duplicate node set upstream
- Add voltage tolerance value for cpu opp

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
62cc66fa67 ipq806x: introduce nandc boot layout mode
ipq806x have different ecc configuration for boot partition and rootfs partition. Add support for this to fix IO error on mtd block scan.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
fdb739bef6 ipq806x: fix broken pci2 and pci3
pci2 and pci3 has a too big io address space. Enlarge the IO_SPACE_LIMIT define for the arm arch.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
6e411b8416 ipq806x: backport cpufreq changes to 5.4
The new cpufreq driver requires different dts bindings.
Backport the new driver to kernel 5.4

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
5dbbefcbcc ipq806x: introduce dedicated krait cpufreq
- Drop cpufreq patchs that tweak the cpufreq-dt driver
- Add dedicated krait cpufreq driver

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
e17fb62293 ipq806x: drop upstream patch
Drop upstream patch already included in the kernel 5.10

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
e2b0ad1114 ipq806x: drop cpuidle generic support from QCOM
The spm driver now has dedicated support for krait cpu idle state. We don't need to add generic arm cpuidle support for qcom.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
c864f587a2 ipq806x: backport mtd adm and smem driver
- Backport mtd adm driver from kernel 5.12
- Backport mtd parser smem from kernel 5.11
- Fix mtd rootfs patch
- Update qcom,smem compatible to qcom,smem-parts

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
cde218d14b ipq806x: fix missing clk and reset
Patch 0030 wrongly disables gsbi1 instead of gsbi4.
Fix the wrong patch and also include other fix from the original qsdk source.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
96f10c9d7a ipq806x: use newer tsens patch
Use improved tsens patch proposed upstream.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
d53be2a2e9 ipq806x: copy kernel 5.4 patches to 5.10
Copy kernel 5.4 patches and config to 5.10

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
Ansuel Smith
861b82d36a ipq806x: improve system latency
Various report and data show that the freq 384000 is too low and cause some
extra latency to the entire system. OEM qsdk code also set the min frequency
for this target to 800 mhz.
Also some user notice some instability with this idle frequency, solved by
setting the min frequency to 600mhz. Fix all these kind of problem by
introducing a boot init.d script that set the min frequency to 600mhz and set
the ondemand governor to be more aggressive. The script set these value only if
the ondemand governor is detected. 384 mhz freq is still available and user can
decide to restore the old behavior by disabling this script.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2021-05-07 07:05:16 +02:00
INAGAKI Hiroshi
4c0c860846 realtek: add support for INABA Abaniact AML2-17GP
INABA Abaniact AML2-17GP is a 17 port gigabit switch, based on RTL8382.

Specification:

- SoC		: Realtek RTL8382
- RAM		: DDR3 128 MiB (SK hynix H5TQ1G63EFR)
- Flash		: SPI-NOR 32 MiB (Macronix MX25L25635FZ2I-10G)
- Ethernet	: 10/100/1000 Mbps x17
  - port 1-8	: RTL8218B (SoC)
  - port 8-16	: RTL8218D
  - port wan	: RTL8214FC
- LEDs/Keys	: 1x, 1x
- UART		: pin header on PCB (Molex 530470410 compatible)
  - J14: 3.3V, GND, RX, TX from rear side
  - 115200n8
- Power		: 100-240 VAC, 50/60 Hz, 0.21 A
  - Plug	: IEC 60320-C13

Flash instruction using initramfs image:

1.  Boot AML2-17GP normally
2.  Set the IP address of computer to the range of 192.168.1.0/24, other
    than 192.168.1.248 and connect computer to "WAN/CONSOLE" port of
    AML2-17GP
3.  Access to "http://192.168.1.248" and open firmware setting page

    -- UI Language: 日本語 --
    "メンテナンス" -> "デュアルイメージ"

    -- UI Language: ENGLISH --
    "Maintenance" -> "Dual Image"

4.  Check "イメージ情報 (en: "Images Information")" and set the first
    image to active by choosing "アクティブイメージ" (en: "Active
    Image") in the partition "0"
5.  open firmware upgrade page

    -- UI Language: 日本語 --
    "メンテナンス" -> "アップグレードマネージャー"

    -- UI Language: ENGLISH --
    "Maintenance" -> "Upgrade Manager"

6.  Set the properties as follows

    -- UI Language: 日本語 --
    "アップグレード方式"	: "HTTP"
    "アップグレードタイプ"	: "イメージ"
    "イメージ"			: "アクティブ"
    "ブラウズファイル"		: (select the OpenWrt initramfs image)

    -- UI Language: ENGLISH --
    "Upgrade Method"		: "HTTP"
    "Upgrade Type"		: "Image"
    "Image"			: "(Active)"
    "Browse file"		: (select the OpenWrt initramfs image)

7.  Press "アップグレード" (en: "Upgrade") button and perform upgrade
8.  Wait ~150 seconds to complete flashing
9.  After the flashing, the following message is showed and press "OK"
    button to reboot

    -- UI Language: 日本語 --
    "成功!! 今すぐリブートしますか?"

    -- UI Language: ENGLISH --
    "Success!! Do you want to reboot now?"

10. After the rebooting, reconnect the cable to other port (1-16) and
    open the SSH connection, download the sysupgrade image to the device
    and perform sysupgrade with it
11. Wait ~120 seconds to complete sysupgrade

Note:

- The uploaded image via WebUI will only be written with the length
  embedded in the uImage header. If the sysupgrade image is specified,
  only the kernel is flashed and lacks the rootfs, this causes a kernel
  panic while booting and bootloops.
  To avoid this issue, initramfs image is required for flashing on WebUI
  of stock firmware.

- This device has 1x LED named as "POWER", but it's not connected to the
  GPIO of SoC and cannot be controlled.

- port 17 is named as "WAN/CONSOLE". This port is for the upstream
  connection and console access (telnet/WebUI) on stock firmware.

Back to stock firmware:

1. Set "bootpartition" variable in u-boot-env2 partition to "1" by
   fw_setsys

   fw_setsys bootpartition 1

2. Reboot AML2-17GP

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2021-05-07 07:05:16 +02:00
Raylynn Knight
c829bc1f2c realtek: Add support for Netgear S350 series switches GS308T and GS310TP
The Netgear GS308T v1 is an 8 port gigabit switch.  The GS310TP v1 is an 8
port POE+ gigabit switch with 2 SFP Ports (currently untested).

The GS308T v1 and GS310TP v1 are quite similar to the Netgear GS1xx
devices already supported.  Theses two devices use the same Netgear
firmware and are very similar to there corresponding GS1xx devices. For
this reason they share a large portion of the device tree with the GS108T
and GS110TP with exception of the uimage magic and model and compatible
values.

All of the above feature a dual firmware layout, referred to as Image0
and Image1 in the Netgear firmware.

In order to manipulate the PoE+ on the GS310TP v1 , one needs the
rtl83xx-poe package

Specifications (GS308T)
----------------------

 * RTL8380M SoC, 1 MIPS 4KEc core @ 500MHz
 * 128MB DDR3-1600 DRAM (Winbond W631GG8MB-12)
 * 32MB 3v NOR SPI Flash (Winbond W25Q256JVFQ)
 * RTL8231 GPIO extender to control the LEDs and the reset button
 * 8 x 10/100/1000BASE-T ports, internal PHY (RTL8218B)
 * UART (115200 8N1) via unpopulated standard 0.1" pin header marked J1
 * Power is supplied via a 12V 1A barrel connector

Specifications (GS310TP)
----------------------

 * RTL8380M SoC, 1 MIPS 4KEc core @ 500MHz
 * Nuvoton M0516LDN for controlling PoE
 * 128MB DDR3-1600 DRAM (Winbond W631GG8MB-12)
 * 32MB 3v NOR SPI Flash (Winbond W25Q256JVFQ)
 * RTL8231 GPIO extender to control the LEDs and the reset button
 * 8 x 10/100/1000BASE-T PoE+ ports, 2 x Gigabit SFP ports,
 internal PHY (RTL8218B)
 * UART (115200 8N1) via unpopulated standard 0.1" pin header marked J1
 * Power is supplied via a 54V 1.25A barrel connector

Both devices have UART pinout
-----------

J1 | [o]ooo
      ^ ||`------ GND
      | |`------- RX         [TX out of the serial adapter]
      | `-------- TX         [RX into the serial adapter]
      `---------- Vcc (3V3)  [the square pin]

The through holes are filled with PB-free solder which melts at 375C.
They can also be drilled using a 0.9mm bit.

Installation
------------
Instructions are identical to those for the similar Negear devices
and apply both to the GS308T v1 and GS310TP v1 as well.
-------------------
Boot initramfs image from U-Boot
--------------------------------

 1. Press the Escape key at the `Hit Esc key to stop autoboot` prompt
 2. Init network with `rtk network on` command
 3. Load image with `tftpboot 0x8f000000
openwrt-realtek-generic-netgear_gs308t-v1-initramfs-kernel.bin` command
 4. Boot the image with `bootm` command

The switch defaults to IP 192.168.1.1 and tries to fetch the image via
TFTP from 192.168.1.111.

Updating the installed firmware
-------------------------------

The OpenWRT ramdisk image can be flashed directly from the Netgear UI.
The Image0 slot should be used in order to enable sysupgrade.

As with similar switches, changing the active boot partition can be
accomplished in U-Boot as follows:

 1. Press the Escape key at the `Hit Esc key to stop autoboot` prompt
 2. Run `setsys bootpartition {0|1}` to select the boot partition
 3. Run `savesys` followed by `boota` to proceed with the boot process

Signed-off-by: Raylynn Knight <rayknight@me.com>
2021-05-07 07:05:16 +02:00
John Audia
daa5860827 kernel: bump 5.4 to 5.4.116
All patches automatically rebased.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2021-05-07 07:05:16 +02:00
Mark Mentovai
75ca641f1b ipq806x: Add "snps,dwmac" to all gmac compatible=
This was introduced to gmac2 and gmac3 in 57ea767a53c1 without fanfare.
There's no indication of why it was added to those devices, but not to
gmac0 or gmac1. It was probably an unintentional omission. It should be
present on all four gmac devices.

This property is considered by
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
stmmac_probe_config_dt.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Build-tested: ipq806x/ubnt,unifi-ac-hd
Run-tested: ipq806x/ubnt,unifi-ac-hd
2021-05-07 07:05:16 +02:00
Mark Mentovai
565814a5ee ipq806x: ubnt,unifi-ac-hd: reorder eth0 and eth1
The Ubiquiti UniFi AC HD (UAP-AC-HD, UAP301) has two Ethernet ports,
labeled MAIN and SECONDARY, connected to gmac2 and gmac1, respectively.
The standard probe order results in gmac1/SECONDARY being eth0 and
gmac2/MAIN being eth1. This does not match the stock firmware, is
contrary to user expectation, causes the wrong (high) MAC address to be
used in a bridged configuration (the default for this device), and makes
the gmac2/MAIN port unusable in the preinit environment (such as for
failsafe). Until a recent patch, gmac1/SECONDARY (eth0) was not even
usable.

This reorders the ports so that gmac2/MAIN is eth0, and the now-working
gmac1/SECONDARY is eth1. eth0 has the low MAC address and eth1 has the
high; when bridged, the bridge takes on the correct low MAC address.
This matches the stock firmware. The MAIN port is usable for failsafe
during preinit.

This device does not have a switch on board, so there's no possibility
to remap ports via switch configuration. "ip link set $interface name"
is used instead, during preinit before networking is configured.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Build-tested: ipq806x/ubnt,unifi-ac-hd
Run-tested: ipq806x/ubnt,unifi-ac-hd
2021-05-07 07:05:16 +02:00
Mark Mentovai
4f74966852 ipq806x: ubnt,unifi-ac-hd: use on-board PHYs
Unlike many ipq806x devices, Ubiquiti UniFi AC HD (UAP-AC-HD, UAP301)
has no switch on board. Its two Ethernet ports are connected to Atheros
AR8033 PHYs. It is not appropriate to use fixed-link in this
configuration. Instead, configure the correct PHYs in the device tree
configuration to allow the at803x driver to load.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Build-tested: ipq806x/ubnt,unifi-ac-hd
Run-tested: ipq806x/ubnt,unifi-ac-hd
2021-05-07 07:05:16 +02:00
Mark Mentovai
fa731838c5 ipq806x: dwmac: clear forced speed during probe
On a Ubiquiti UniFi AC HD (ubnt,unifi-ac-hd, UAP-AC-HD, UAP301), a
forced speed on gmac1 is set in the QSGMII PCS_ALL_CH_CTL register,
presumably by the bootloader (4.3.28), preventing the interface from
being usable. The QSDK NSS GMAC driver takes care to clear the forced
speed in nss_gmac_qsgmii_dev_init
(https://source.codeaurora.org/quic/qsdk/oss/lklm/nss-gmac/tree/ipq806x/nss_gmac_init.c?h=nss
at d5bb14925861).

gmac1 is connected to the port on the device labeled SECONDARY, and is
currently eth0 but will be switched to eth1 by a subsequent patch. By
clearing the QSGMII PCS forced speed during dwmac initialization when
SGMII is in use, this port becomes usable.

This patch is upstreamable, and will be sent upstream after successful
testing in OpenWrt.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
Build-tested: ipq806x/ubnt,unifi-ac-hd
Run-tested: ipq806x/ubnt,unifi-ac-hd
2021-05-07 07:05:16 +02:00
Rafał Miłecki
ed4641e9f1 kernel: fix parsing fixed subpartitions
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-05-06 14:53:25 +02:00