Commit Graph

747 Commits

Author SHA1 Message Date
Chukun Pan
eee41e33ec ipq806x: Askey RT4230W REV6: enable onboard spi flash
There is a mr25h256 spi flash on this machine. From the mtd backup
of the stock firmware, this spi flash is empty.

[    3.652745] spi_qup 1a280000.spi: IN:block:16, fifo:64, OUT:block:16,
fifo:64
[    3.653925] spi-nor spi0.0: mr25h256 (32 Kbytes)

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-04-16 16:59:31 +02:00
Rui Salvaterra
de7535a6ac kernel: bump 5.15 to 5.15.34
Deleted (upstreamed):
generic/pending-5.15/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.34&id=60eabd66d17fa2cbc31f670b2f201f0bc54090a2

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-04-16 14:02:13 +02:00
John Audia
0085dd6cb5 kernel: bump 5.10 to 5.10.111
Removed upstreamed:
  pending-5.10/850-0003-PCI-aardvark-Fix-support-for-MSI-interrupts.patch
  apm821xx/patches-5.10/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch

All other patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2022-04-16 14:02:11 +02:00
Ansuel Smith
3f0d87fd69 ipq806x: fix wrong CPU OPP for ipq8062
Fix wrong CPU OPP for ipq8062. Revision of the SoC added an
extra 25mV for every pvs. Also fix the voltage min/max value
that were wrong.

Reviewed-by: Robert Marko robimarko@gmail.com
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-04-16 11:22:54 +02:00
Rodrigo Balerdi
284f2c2ae0 ipq806x: fix USB bug in 5.10 dtsi additions
The existing device tree has incorrect definitions for usb3_0 and usb3_1
and the blocks they depend upon: their addresses and interrupts are
swapped. However, their clocks and resets are not. The result is that
the USB blocks are non-functional if only one of them is enabled.

This fix backports the definitions from mainline Linux 5.15 to
OpenWrt's 5.10 dtsi additions. See the relevant mainline code here:
https://github.com/torvalds/linux/blob/v5.17/arch/arm/boot/dts/qcom-ipq8064.dtsi#L1062-L1148

This fix does not break existing ports. But some ports may have enabled
both USB blocks even thought their board only implements one, because
enabling a single USB block would not have worked before this fix.
This means that revisiting all ports of ipq806x devices that implement
a single USB port is advised. This work must be done by maintainers that
can determine which USB block corresponds to the implemented port on
their hardware.

Note that this fix swaps the names of the hardware ports. This is
unfortunate, but will happen anyway when switching to kernel 5.15. Thus,
it is best to do this ASAP, before users get to depend on port names.

It is strongly recommended that this fix is backported to 22.03 before
its release. This will minimize the number of users affected by the port
name swap.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
2022-04-16 11:22:54 +02:00
Rodrigo Balerdi
3a4d972d43 ipq806x: remove non-working fixes for USB bug in 5.10 dtsi additions
These workarrounds are incomplete and non-functional, and thus not needed.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
2022-04-16 11:22:54 +02:00
John Audia
b92ec82235 kernel: bump 5.10 to 5.10.110
Removed upstreamed:
  generic/backport-5.10/350-v5.18-MIPS-pgalloc-fix-memory-leak-caused-by-pgd_free.patch
  generic/pending-5.10/850-0014-PCI-aardvark-Fix-reading-PCI_EXP_RTSTA_PME-bit-on-em.patch
  ipq40xx/patches-5.10/105-ipq40xx-fix-sleep-clock.patch

All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200
Compile-/run-tested: ath79/generic (Archer C7 v2).

Signed-off-by: John Audia <graysky@archlinux.us>
2022-04-09 19:31:46 +02:00
Rui Salvaterra
be381a7ac7 kernel: bump 5.15 to 5.15.33
Deleted (upstreamed):
generic/backport-5.15/350-v5.18-MIPS-pgalloc-fix-memory-leak-caused-by-pgd_free.patch [1]
generic/backport-5.15/730-v5.16-hv-utils-add-PTP_1588_CLOCK-to-Kconfig-to-fix-build.patch [2]
generic/pending-5.15/850-0014-PCI-aardvark-Fix-reading-PCI_EXP_RTSTA_PME-bit-on-em.patch [3]
generic/pending-5.15/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch [4]

Manually rebased:
generic/pending-5.15/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch
ramips/patches-5.15/710-at803x.patch

[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.33&id=d29cda15cab086d82d692de016f7249545d4b6b4
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.33&id=d5aad7d63b1b5c1f3c4b69e12c05e7c7d196fae8
[3] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.33&id=ed750e22e44366e264bcdf7b1cf0713f08f7980a
[4] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.33&id=0fe94b84c43cfea867e1721606185e8686d7d32f

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
[Refresh patches again]
[Remove generic/pending-5.15/850-0002-PCI-aardvark-Fix-reading-MSI-interrupt-number.patch]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-04-09 19:31:46 +02:00
Rui Salvaterra
5a09eb17c2 kernel: bump 5.15 to 5.15.32
Patches automatically rebased.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-04-09 19:31:46 +02:00
Aleksander Jan Bajkowski
a98ded6c5c kernel: move some symbols to generic config
This commit add some enabled symbols to generic config.
LTO is only supported by clang compiler and therefore should
be disabled in the generic config instead of duplicating this
symbol in each target. CONFIG_LTO_NONE do this job.

The second group of symbols is enabled by the options available
in the generic config and is therefore added here:
* CONFIG_AF_UNIX_OOB is selected by CONFIG_NET && CONFIG_UNIX,
* CONFIG_BINARY_PRINTF is selected by CONFIG_BPF_SYSCALL,
* CONFIG_NET_SOCK_MSG is selected by CONFIG_BPF_SYSCALL && CONFIG_NET.

The other symbols are disabled and should be in the generic config.

This commit also removes these symbols from subtargets.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
2022-04-09 19:31:46 +02:00
Ansuel Smith
876a49ca62 ipq806x: 5:15: fix dedicated krait cpufreq
Fix dedicated cpufreq for kernel 5.15 as they changed module
order and now it can happen that cpufreq probe after cache driver.
Also add lock between cache scaling in set_target as it's now required
by opp functions.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
af70a27b38 ipq806x: backport nand raname to kernel 5.10
Rename nand_controller to nand in kernel 5.10 to use the same dts across kernel version.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
e86dfd0a44 ipq806x: rework rootfs conflicts patch for smem
Now that smem actually free the leaked parts, when
a rootfs partition is detected, the kernel panics as
it try to free the static space allocated for the "ubi"
name. Change the logic and fix the name at the allocate_partition
function to correctly free the space allocated by smem.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
8cc2caed58 ipq806x: 5:15: add testing kernel version
Refresh patch for 5.15
Rework tweak patch to sync with upstream ipq8064 dtsi and fix
regression introduced.
Rename nand_controller to nand in every dts.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
327677a71d ipq806x: 5:15: drop upstream patch
- Drop stmmac upstream patches
- Drop tsens patches
- Drop ADM driver
- Drop SMEM parser

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
4c5d5c66ca ipq806x: 5:15: refresh config
Refreshed using make kernel_menuconfig CONFIG_TARGET=generic

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Ansuel Smith
3064e76c94 ipq806x: 5:15: copy config and patch from 5.10
Copy config and patch from kernel 5.10 to kernel 5.15

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2022-03-27 16:16:07 +01:00
Christian Lamparter
621b0589fb ipq806x: fix TP-Link Archer VR2600v bootlooping
Timo Schroeder reported:
"The TP-Link Archer VR2600v is stuck in a boot loop on written
snapshot image. It's able to boot using the snapshot uimage
though, but there ath10k firmware can't be found.
21.02.2 release version doesn't have either problem."

The VR2600v has a 512 byte header at the beginning of the
firmware that needs to be accounted for.

Fixes: f6a01d7f5c ("ipq806x: convert TP-Link Archer VR2600v to denx,uimage")
Reported-by: Timo Schroeder <der.timosch@gmail.com>
References: <https://github.com/openwrt/openwrt/issues/9467>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-03-16 20:48:01 +01:00
Hannu Nyman
549f8694c3 ipq806x: provide ramoops for R7800/XR500 by default
Add kmod-ramoops to the default set of device packages in
R7800 and XR500, so that the ramoops kernel crash logs
are provided by default for these routers.

The capability was earlier defined by 97158fe1 and cf346dfa,
but the feature was not yet turned on by default.

The possible kernel crashes are stored into /sys/fs/pstore/*

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2022-03-08 18:33:42 +01:00
Rui Salvaterra
72d2c54ccb kernel: 5.10: allocate last level PTEs in high memory
Enable support for allocating user space page table entries in high memory [1],
for the targets which support this feature. This saves precious low memory
(permanently mapped, the only type of memory directly accessible by the kernel).

[1] https://www.kernel.org/doc/html/latest/vm/highmem.html

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-03-01 22:57:34 +00:00
John Audia
0989b7ad3a kernel: bump 5.10 to 5.10.102
Removed upstreamed:
	bcm4908/patches-5.10/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.102&id=f333c1916fd6b55900029bf8f918cc00009e2111

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2022-03-01 21:38:36 +01:00
John Audia
a2d4b5711a kernel: bump 5.10 to 5.10.101
Removed upstreamed:
  pending-5.10/841-USB-serial-option-add-ZTE-MF286D-modem.patch[1]
  bcm27xx/950-0592-drm-vc4-Allow-DBLCLK-modes-even-if-horz-timing-is-od.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.101&id=7113440a36c741efd7c76e3d70b3634100120cdb
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.101&id=21c890ca8eaecea06cabb92be2a53a6f26f56383

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <graysky@archlinux.us>
2022-03-01 21:38:36 +01:00
Petr Štetiar
fc317a190c ipq806x: base-files: asrock: fix bootcount include
Fixes following warning message during image building process:

 Finalizing root filesystem...
 root-ipq806x/lib/upgrade/asrock.sh: line 1: /lib/functions.sh: No such file or directory
 Enabling boot
 root-ipq806x/lib/upgrade/asrock.sh: line 1: /lib/functions.sh: No such file or directory
 Enabling bootcount

Fixes #9350

Fixes: 98b86296e6 ("ipq806x: add support for ASRock G10")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2022-02-28 15:17:11 +01:00
Hannu Nyman
ec32c4ef01 ipq806x: Increase kernel size to 4 MB for EA8500/EA7500v1
Increase the kernel size from 3 MB to 4 MB for EA8500 and EA7500v1.
* modify the common .dtsi
* modify the kernel size in the image recipes

Define compat-version 2.0 to force factory image usage for sysupgrade.
Add explanation message. Reenable both devices.

As for 4MiB (and not more): Hannu Nyman noted that:
"We have lots of ipq806x devices with 4 MB kernel, so will
need action at that point in future in any case.
(Assuming that the bootloader did not have a 4 MB limit that
has been tested...)"

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
(squashed, added 4MiB notice of support in ipq806x)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-26 19:52:06 +01:00
Hannu Nyman
cf346dfadf ipq806x: kernel crash log ramoops storage for R7800 and XR500
Define the kernel crash log storage ramoops/pstore feature
for R7800 and its sister XR500.

Reference to the ramoops admin guide in upstream Linux:
https://www.kernel.org/doc/html/v5.10/admin-guide/ramoops.html

Tested with R7800.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2022-02-24 20:45:12 +01:00
Christian Lamparter
5696244ae2 ipq806x: disable Linksys EA7500v1 and EA8500
The kernel of both images will no longer fit into
the 3072KiB / 3MiB kernel partition:
|Image Name:   ARM OpenWrt Linux-5.10.100
|Created:      Sat Feb 19 00:11:55 2022
|Image Type:   ARM Linux Kernel Image (uncompressed)
|Data Size:    3147140 Bytes = 3073.38 KiB = 3.00 MiB

Disable both targets for now, until a solution is available.
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-20 14:04:38 +01:00
John Audia
c5dca80526 ipq806x: update defconfig
Enabled `CONFIG_ALL_KMODS` and ran `make kernel_menuconfig` against
ipq806x to update defconfig.

The removed symbols are in fact present in
target/linux/generic/config-5.10. CONFIG_MDIO_DEVRES
was likely added due to this:
<https://elixir.bootlin.com/linux/v5.10.100/source/drivers/net/phy/Kconfig#L16>

Signed-off-by: John Audia <graysky@archlinux.us>
2022-02-19 18:29:42 +01:00
Christian Lamparter
c420947bb3 ipq806x: TP-Link VR2600v convert legacy partitioning
This device still had the legacy flash partitioning.
This is a problem, because neither the nvmem-cells
for mac-address and calibration. Nor the denx,uimage
mtd-splitter compatible would be picked up.

The patch also changes the node-names of the flash
and partition nodes to hopefully meet all the
current FDT trends.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-19 18:29:42 +01:00
Mike Lothian
a0ad07ea03 ipq806x: Enlarge D7800 flash - use netgear partition
Increase the available flash memory size in Netgear R7800
by repurposing the unused "netgear" partition that is
located after the firmware partition.

Available flash space for kernel+rootfs+overlay increases
by 68 MB from 32 MB to 100 MB.

In a typical build, overlay space increases from 15 to 85,
increasing the package installation possibilities greatly.

Reverting to the OEM firmware is still possible, as the OEM
firmware contains logic to initialise the "netgear" partition
if its contents do not match expectations. In OEM firmware,
"netgear" contains 6 UBI sub-partitions that are defined in
/etc/netgear.cfg and initialisation is done by /etc/preinit

This is based on fb8a578aa7

Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
2022-02-08 12:52:14 +01:00
Rosen Penev
8cfce165a7 target/linux: replace egrep with grep -E
egrep is deprecated and replaced by grep -E. The latter is used
throughout the tree.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-02-07 00:03:27 +01:00
Christian Lamparter
f6a01d7f5c ipq806x: convert TP-Link Archer VR2600v to denx,uimage
The recent device-tree modification that added pre-cal
nvmem-cells pushed the device's kernel+dtb over the
allotted 3072k KERNEL_SIZE.

> WARNING: Image file tplink_vr2600v-uImage is too big: 3147214 > 3145728

There was a previous kernel partition size upgrade:
commit 0c967d92b3 ("ipq806x: increase kernel partition size for the TP-Link Archer VR2600v")
It has been seemingly upgraded from a 2048k KERNEL_SIZE in the past.
The commit talks about using the MTD_SPLIT_TPLINK_FW. But looking at
the image make recipe, there is no code that adds a TPLINK header.
So instead the board will use "denx,umimage". This requires
MTD_SPLIT_UIMAGE_FW, but this is present thanks to some NEC devices.

(Maybe the MTD_CONFIG_ARGS can be removed as well? But it could be
there because of the padding at the beginning. This needs testing.)

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-06 17:11:20 +01:00
Christian Lamparter
965e878333 ipq806x: G10: use ASROCK's wifi calibration data
brings back the ath10k QCA9980 wifi nodes to which
it adds ASROCK's wifi calibration data. These are
now provided by the ath10k_firmware.git's board-2.bin.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-05 00:44:35 +01:00
Christian Lamparter
20470580cd ipq806x: utilize nvmem-cells for pre-calibration data
converts extraction entries from 11-ath10k-caldata into
nvmem-cells in the individual board's device-tree file.

The patch also moves previously existing referenced
nvmem-cells data nodes which were placed at the end
back into the partitions node. As well as removing
some duplicated properties from qcom-ipq8065-xr500.dts's
art (the included nighthawk.dtsi defines those already).

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2022-02-05 00:41:36 +01:00
Rui Salvaterra
ff97fb98e3 kernel: bump 5.10 to 5.10.96
Patches automatically rebased.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2022-02-01 23:34:07 +00:00
Sungbo Eo
f16f419022 ipq806x: convert remaining mtd-mac-address-increment
Commit d284e6ef0f ("treewide: convert mtd-mac-address-increment* to
generic implementation") renamed "mtd-mac-address-increment" property
to "mac-address-increment". Convert remaining usages that have been
added after that.

Fixes: f44e933458 ("ipq806x: provide WiFI mac-addresses from dts")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2022-02-01 14:55:40 +09:00
Sungbo Eo
81a561b4a6 kernel: move bootargs-append patch to generic
This moves bootargs-append support patch from ipq40xx and ipq806x to
generic. This way we can append additional boot arguments from DTS instead
of only being able to overwrite them.

This is a preparation for kirkwood support of ipTIME NAS1.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2022-01-29 23:50:28 +09:00
David Woodhouse
408b6558e4 ipq806x: Netgear D7800: Fix RAM and enable PCIe #2
This board has 512MiB of RAM like the R7800, and the VDSL modem is
attached to the second PCIe port.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2022-01-21 17:18:35 +00:00
Alex Lewontin
62a2bfaff8 ipq806x: janitorial work, respect line lengths
This commit breaks up some lines so that they are shorter than
74 charcters.

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
2022-01-08 23:25:05 +01:00
Alex Lewontin
479acf03cc ipq806x: modularize generic subtarget
This commit moves the device profiles within the ipq806x/generic
subtarget into their own includable .mk file, to support eventually
having subtargets other than generic.

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
2022-01-08 23:25:05 +01:00
Stefan Lippers-Hollmann
d9c2b0cfdd ipq806x: ASRock g10: fix bogus read errors
Properly declare that the g10 is booting from NAND and define its
correct (larger than on other devices-) boot_pages_size, to prevent
the kernel from constantly falling over missing OOB error correction
for the bootloader.

This patch prevents a constant slew of (bogus) read errors reported
by the kernel and keeping the CPU busy and fixes:

blk_update_request: I/O error, dev mtdblock0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 8 op 0x0:(READ) flags 0x80700 phys_seg 3 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 16 op 0x0:(READ) flags 0x80700 phys_seg 2 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 24 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Buffer I/O error on dev mtdblock0, logical block 0, async page read
blk_update_request: I/O error, dev mtdblock0, sector 32 op 0x0:(READ) flags 0x80700 phys_seg 8 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 40 op 0x0:(READ) flags 0x80700 phys_seg 7 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 48 op 0x0:(READ) flags 0x80700 phys_seg 6 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 56 op 0x0:(READ) flags 0x80700 phys_seg 5 prio class 0
blk_update_request: I/O error, dev mtdblock0, sector 64 op 0x0:(READ) flags 0x80700 phys_seg 4 prio class 0
Buffer I/O error on dev mtdblock0, logical block 1, async page read
Buffer I/O error on dev mtdblock1, logical block 0, async page read
Buffer I/O error on dev mtdblock1, logical block 1, async page read
Buffer I/O error on dev mtdblock2, logical block 0, async page read
Buffer I/O error on dev mtdblock2, logical block 1, async page read
Buffer I/O error on dev mtdblock3, logical block 0, async page read
Buffer I/O error on dev mtdblock3, logical block 0, async page read
Buffer I/O error on dev mtdblock4, logical block 0, async page read
Buffer I/O error on dev mtdblock4, logical block 1, async page read

Suggested-by: Ansuel Smith <ansuelsmth@gmail.com>
Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
2022-01-02 20:41:50 +01:00
Sergey Ryazanov
fa3690f8f1 kernel: 5.10: consolidate mac80211 crypto options
Each of
- CRYPTO_AEAD2
- CRYPTO_AEAD
- CRYPTO_GF128MUL
- CRYPTO_GHASH
- CRYPTO_HASH2
- CRYPTO_HASH
- CRYPTO_MANAGER2
- CRYPTO_MANAGER
- CRYPTO_NULL2

either directly required for mac80211 crypto support, or directly
selected by such options. Support for the mac80211 crypto was enabled in
the generic config since c7182123b9 ("kernel: make cryptoapi support
needed by mac80211 built-in"). So move the above options from the target
configs to the generic config to make it clear why do we need them.

CC: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
2021-12-17 16:16:34 +01:00
Sergey Ryazanov
b61ab8f57e kernel: filter out both Clang and LLD versions
Both CLANG_VERSION and LLD_VERISON are autogenerated runtime
configuration options, so add them to the kernel configuration filter
and remove from generic and per-target configs to keep configs clean.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
2021-12-17 16:16:34 +01:00
John Audia
6c945fa379 kernel: bump 5.10 to 5.10.83
Removed upstreamed:
    bcm53xx/patches-5.10/033-v5.16-0024-ARM-dts-BCM5301X-Fix-I2C-controller-interrupt.patch[1]
    bcm53xx/patches-5.10/033-v5.16-0025-ARM-dts-BCM5301X-Add-interrupt-properties-to-GPIO-no.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.83&id=b2cd6fdcbe0a5cb44e4610a08cc58261d494a885
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.10.83&id=9db1d4a3c2700e1cc84c3d61199411d75c2a3ec6

Build system: x86_64*
Build-tested: bcm2711/RPi4B, ipq806x/R7800†
Run-tested: bcm2711/RPi4B, ipq806x/R7800†

* Had to revert 7c99085bd6 in order to build
  (latest bump of ca-certificates)

† Had to revert 7f1edbd412 in order to build
  (binutils 2.37, https://bugs.openwrt.org/index.php?do=details&task_id=4149)

Signed-off-by: John Audia <graysky@archlinux.us>
2021-12-12 21:11:30 +01:00
Shane Synan
9f0575a130 ipq806x: revert SDC clock changes for NBG6817 MMC
Revert the SDC "CLK_SET_RATE_GATE" changes to the SDC clock regulator
structures.

See https://elinux.org/images/b/b8/Elc2013_Clement.pdf
> if ((clk->flags & CLK_SET_RATE_GATE) && clk->prepare_count) {
>
> For this particular clock, setting its rate is possible only if the
> clock is ungated (not yet prepared)

This fixes the MMC failing to initialize on newer ZyXEL NBG6817
hardware revisions with Kingston MMC.  Older revisions should
hopefully be unaffected.

Check MMC hardware details with:
cd /sys/block/mmcblk0/device/ && \
  tail -v cid date name manfid fwrev hwrev oemid rev

Known problematic MMC names (broken before this commit):
* M62704 (dated 12/2018) via myself
* M62704 (dated 11/2018) via Drake Stefani

Known unaffected MMC names (already working without this commit):
* S10004 (dated 12/2015) via slh

Without enabling dynamic debugging, this error manifests in the kernel
hardware serial console as the following:

[    2.746605] mmc0: error -110 whilst initialising MMC card
[…trimmed other messages…]
[    2.877832] Waiting for root device /dev/mmcblk0p5...

Enabling Linux dynamic kernel debugging provides additional messages.
For guidance, see the Linux kernel documentation:
https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html

First, enable dynamic debugging in OpenWRT's configuration:

1.  Run "make menuconfig"

2.  Select "Global build settings --->"

3.  Select "Kernel build options --->"

4.  Enable "Compile the kernel with dynamic printk" via spacebar

5.  Save and exit (arrow key to "Exit" until prompted to save, save)

Alternatively, set "CONFIG_KERNEL_DYNAMIC_DEBUG=y" in your .config.

Then, turn on dynamic debugging at boot:

Modify bootargs in
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-nbg6817.dts
to add…

bootargs = "[…existing bootargs…] dyndbg=\"file drivers/mmc/* +p\" dynamic_debug.verbose=1 loglevel=8";

For example:
 	chosen {
-		bootargs = "rootfstype=squashfs,ext4 rootwait noinitrd fstools_ignore_partname=1";
+		bootargs = "rootfstype=squashfs,ext4 rootwait noinitrd fstools_ignore_partname=1 dyndbg=\"file drivers/mmc/* +p\" dynamic_debug.verbose=1 loglevel=8";
 		append-rootblock = "root=/dev/mmcblk0p";

Then, compile and flash the resulting build.  If you are testing
before this commit on newer MMC hardware, be prepared to recover!

NOTE: If you have hardware serial console access, you don't need to
use TFTP recovery to change the active boot partition.

Reboot to working alternative partition via serial console:

1.  Connect to hardware serial console
    * See https://openwrt.org/toh/zyxel/nbg6817#serial

2.  Interrupt boot at "Hit any key to stop autoboot:"

3.  Run "ATSE NBG6817"

4.  Copy the result (e.g. "001976FE4B04")
    * Changes with **every boot** - can't reuse this

5.  On your local system, run
    "./zyxel-uboot-password-tool.sh <copied value here>"
    * Example: "./zyxel-uboot-password-tool.sh 001976FE4B04"

6.  Run the command provided by the password tool
    * Example: "ATEN 1,910F129B"
    * Changes with **every boot** - can't reuse this

7.  Run "ATGU"
    * You now have full u-boot shell until next boot - unlocking is
       not remembered

8.  Run either "run boot_mmc" (for booting partition set "FF") or
    "run boot_mmc_1" (for booting partition set "01")
    * These commands are not affected by dual-boot partition flags

NOTE: This will NOT set the dual-boot partition flag.  You'll need to
fix that manually.  The "nbg6817-dualboot" script may help:
https://github.com/pkgadd/nbg6817/blob/master/nbg6817-dualboot

zyxel-uboot-password-tool.sh - sourced from
commit 459c8c9ef816156107e297964d088ddee2b4eef5:

ror32() {
  echo $(( ($1 >> $2) | (($1 << (32 - $2) & (2**32-1)) ) ))
}

v="0x$1"
a="0x${v:2:6}"
b=$(( a + 0x10F0A563))
c=$(( 0x${v:12:14} & 7 ))
p=$(( $(ror32 $b $c) ^ a ))
printf "ATEN 1,%X\n" $p

Kernel serial console log BEFORE commit with dynamic debug enabled:
[…trimmed…]
[    3.171343] mmci-pl18x 12400000.sdcc: designer ID = 0x51
[    3.171397] mmci-pl18x 12400000.sdcc: revision = 0x0
[    3.175811] mmci-pl18x 12400000.sdcc: clocking block at 96000000 Hz
[    3.181134] mmci-pl18x 12400000.sdcc: No vqmmc regulator found
[    3.186788] mmci-pl18x 12400000.sdcc: mmc0: PL180 manf 51 rev0 at 0x12400000 irq 41,0 (pio)
[    3.192902] mmci-pl18x 12400000.sdcc: DMA channels RX dma1chan1, TX dma1chan2
[    3.215609] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[    3.227532] mmci-pl18x 12400000.sdcc: Initial signal voltage of 3.3v
[    3.247518] mmc0: clock 52000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[…trimmed…]
[    3.997725] mmc0: req done (CMD2): -110: 00000000 00000000 00000000 00000000
[    4.003631] mmci-pl18x 12400000.sdcc: irq0 (data+cmd) 00000000
[    4.003659] mmc0: error -110 whilst initialising MMC card
[    4.016481] mmc0: clock 0Hz busmode 2 powermode 0 cs 0 Vdd 0 width 1 timing 0

Notice how the initial clock is 52 MHz, which is incorrect - MMC
requires negotiation to enable higher speeds.

Kernel serial console log AFTER commit with dynamic debug enabled:
[…trimmed…]
[    3.168996] mmci-pl18x 12400000.sdcc: designer ID = 0x51
[    3.169051] mmci-pl18x 12400000.sdcc: revision = 0x0
[    3.173492] mmci-pl18x 12400000.sdcc: clocking block at 96000000 Hz
[    3.178808] mmci-pl18x 12400000.sdcc: No vqmmc regulator found
[    3.184702] mmci-pl18x 12400000.sdcc: mmc0: PL180 manf 51 rev0 at 0x12400000 irq 41,0 (pio)
[    3.190573] mmci-pl18x 12400000.sdcc: DMA channels RX dma1chan1, TX dma1chan2
[    3.217873] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 1 timing 0
[    3.229250] mmci-pl18x 12400000.sdcc: Initial signal voltage of 3.3v
[    3.249111] mmc0: clock 400000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 0
[…trimmed…]
[    4.392652] mmci-pl18x 12400000.sdcc: irq0 (data+cmd) 00000000
[    4.392785] mmc0: clock 52000000Hz busmode 2 powermode 2 cs 0 Vdd 21 width 1 timing 1
[    4.406554] mmc0: starting CMD6 arg 03b70201 flags 0000049d
[…trimmed…]

Now, the MMC properly initializes and later switches to high speed.

Thanks to:
* Ansuel for maintaining/help with the IPQ806x platform, kernel code
* slh for additional debugging and suggestions
* dwfreed for confirming newer MMC details, clock frequency
* robimarko for device driver debug printing help, clock debugging
* Drake for testing and confirmation with their own newer NBG6817
...and anyone else I missed!

Signed-off-by: Shane Synan <digitalcircuit36939@gmail.com>
Tested-by: Shane Synan <digitalcircuit36939@gmail.com>
2021-12-05 18:49:14 +01:00
Bjørn Mork
5fb51d4516 ipq806x: sysupgrade: drop unnecessary UBI to UBI logic
The purpose of this code seems to be to avoid issues caused
by partially overwriting an existing UBI partition, where some
of the erase counters would be reset but not the unmodified
ones.  This problem has been solved in a more generic way by
the UBI EOF marker. This ensures that any old PEBs after the
marker are properly initialized.  It is therefore unnecessary
to erase the whole partition before flashing a new OpenWrt
factory image.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-12-03 12:23:02 +01:00
Matthew Hagan
67f5201276 ipq806x: add support for Cisco Meraki MR42/MR52
The MR42 and MR52 are two similar IPQ806x based devices from the Cisco
Meraki "Cryptid" series.

  MR42 main features:
  -  IPQ8068 1.4GHz
  -  512MB RAM
  -  128MB NAND
  -  2x QCA9992 (2.4 & 5GHz)
  -  1x QCA9889 (2.4 & 5GHz)
  -  1x AR8033 PHY
  -  PoE/AC power

  MR52 main features:
  -  IPQ8068 1.4GHz
  -  512MB RAM
  -  128MB NAND
  -  2x QCA9994 (2.4 & 5GHz)
  -  1x QCA9889 (2.4 & 5GHz)
  -  2x AR8033 PHYs
  -  PoE/AC power

(MR42 Only) Installation via diagnostic mode:

If you can successfully complete step 1 then you can continue to install
via this method without having to open the device. Otherwise please use
the standard UART method. Please note that when booting via TFTP, some
Ethernet devices, in particular those on laptops, will not connect in
time, resulting in TFTP boot not succeeding. In this instance it is
advised to connect via a switch.

  1. Hold down reset at power on and keep holding, after around 10 seconds
     if the orange LED changes behaviour to begin flashing, proceed to
     release reset, then press reset two times. Ensure that the LED has
     turned blue. Note that flashing will occur on some devices, but it
     will not be possible to change the LED colour using the reset button.
     In this case it will still be possible to continue with this install
     method.

  2. Set your IP to 192.168.1.250. Set up a TFTP server serving
     mr42_u-boot.mbn and
     openwrt-ipq806x-generic-meraki_mr42-initramfs-fit-uImage.itb, obtained
     from [1].

  3. Use telnet and connect to 192.168.1.1. Run the following commands to
     install u-boot. Note that all these commands are critical, an error
     will likely render the device unusable.

     Option 3.1:
       If you are sure you have set up the TFTP server correctly you can
       run this script on the device. This will download and flash the
       u-boot image immediately:

       `/etc/update_uboot.sh 192.168.1.250 mr42_u-boot.mbn`

       Once completed successfully, power off the device.

     Option 3.2:
       If you are unsure the TFTP server is correctly set up you can
       obtain the image and flash manually:

       3.2.1. `cd /tmp`
       3.2.2. `tftp-hpa 192.168.1.250 -m binary -c get mr42_u-boot.mbn`
       3.2.3. Confirm file has downloaded correctly by comparing the
              md5sum:

            `md5sum mr42_u-boot.mbn`

       3.2.4. The following are the required commands to write the image.

            `echo 1 > /sys/devices/platform/msm_nand/boot_layout
             mtd erase /dev/mtd1
             nandwrite -pam /dev/mtd1 mr42_u-boot.mbn
             echo 0 > /sys/devices/platform/msm_nand/boot_layout`

          Important: You must observe the output of the `nandwrite`
          command. Look for the following to verify writing is occurring:

            `Writing data to block 0 at offset 0x0
             Writing data to block 1 at offset 0x20000
             Writing data to block 2 at offset 0x40000`

          If you do not see this then do not power off the device. Check
          your previous commands and that mr42_u-boot.mbn was downloaded
          correctly. Once you are sure the image has been written you
          can proceed to power off the device.

  4. Hold the reset button and power on the device. This will immediately
     begin downloading the appropriate initramfs image and boot into it.

     Note: If the device does not download the initramfs, this is likely
     due to the interface not being brought up in time. Changing Ethernet
     source to a router or switch will likely resolve this. You can also
     try manually setting the link speed to 10Mb/s Half-Duplex.

  5. Once a solid white LED is displayed on the device, continue to the
     UART installation method, step 6.

Standard installation via UART - MR42 & MR52

  1. Disassemble the device and connect a UART header. The header pinout
     is as follows:

       1 - 3.3v
       2 - TXD
       3 - RXD
       4 - GND

     Important: You should only connect TXD, RXD and GND. Connecting
     3.3v may damage the device.

  2. Set your IP to 192.168.1.250. Set up a TFTP server serving
     openwrt-ipq806x-generic-meraki_(mr42|mr52)-initramfs-fit-uImage.itb.
     Separately obtain the respective sysupgrade image.

  3. Run the following commands, preferably from a Linux host. The
     mentioned files, including ubootwrite.py and u-boot images, can be
     obtained from [1].

       `python ubootwrite.py --write=(mr42|mr52)_u-boot.bin`

     The default for "--serial" option is /dev/ttyUSB0.

  4. Power on the device. The ubootwrite script will upload the image to
     the device and launch it. The second stage u-boot will in turn load
     the initramfs image by TFTP, provided the TFTP server is running
     correctly. This process will take about 13 minutes. Once a solid
     white LED is displayed, the image has successfully finished
     loading. Note: If the image does not load via TFTP, try again with
     the Ethernet link to 10Mb/s Half-Duplex.

  5. (MR42 only) Do not connect over the network. Instead connect over
     the UART using minicom or similar tool. To replace u-boot with
     the network enabled version, please run the following commands.
     Note that in the provided initramfs images, the u-boot.mbn file
     is located in /root:

     If you have not used the provided initramfs, you must ensure you
     are using an image with "boot_layout" ECC configuration enabled in
     the Kernel. This will be version 5.10 or higher. If you do not do
     this correctly the device will be bricked.

       `insmod mtd-rw i_want_a_brick=1
        mtd erase /dev/mtd8
        nandwrite -pam /dev/mtd8 /root/mr42_u-boot.mbn`

     After running nandwrite, ensure you observe the following output:

       `Writing data to block 0 at offset 0x0
        Writing data to block 1 at offset 0x20000
        Writing data to block 2 at offset 0x40000`

  6. (Optional) If you have no further use for the Meraki OS, you can
     remove all other UBI volumes on ubi0 (mtd11), including diagnostic1,
     part.old, storage and part.safe. You must not remove the ubi1 ART
     partition (mtd12).

       `for i in diagnostic1 part.old storage part.safe ; do
        ubirmvol /dev/ubi0 -N $i
        done`

  7. Proceed to flash the sysupgrade image via luci, or else download or
     scp the image to /tmp and use the sysupgrade command.

[1] The mentioned images and ubootwrite.py script can be found in this repo:
    https://github.com/clayface/openwrt-cryptid

[2] The modified u-boot sources for the MR42 and MR52 are available:
    https://github.com/clayface/U-boot-MR52-20200629

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2021-11-28 17:51:52 +01:00
Matthew Hagan
6e5b8c6300 ipq806x: add gsbi2_i2c label
gsbi2_i2c is used by the Meraki MR42 so we need to expose a label here.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2021-11-28 17:51:52 +01:00
Matthew Hagan
771691ec83 ipq806x: backport GMAC_AHB_RESET deassert patches
Add backports of the following patches:
"net: stmmac: explicitly deassert GMAC_AHB_RESET" and
"ARM: dts: qcom: add ahb reset to ipq806x-gmac"
Required for Meraki MR42/MR52.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2021-11-28 17:51:52 +01:00
Matthew Hagan
cef420e8f7 ipq806x: add GSBI nodes to ipq8064-dtsi-addidions
Rather than having separate patches for each GSBI node added, this patch
consolidates the existing GSBI1 patch into
083-ipq8064-dtsi-additions.patch. In addition, GSBI6 and GSBI7 I2C nodes,
required for the MR42 and MR52 respectively, are added.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
2021-11-28 17:41:18 +01:00
John Audia
894f483d20 kernel: bump 5.10 to 5.10.82
Removed upstreamed:
    bcm53xx/patches-5.10/033-v5.16-0014-ARM-dts-NSP-Fix-mpcore-mmc-node-names.patch

Manually rebased:
    ipq806x/patches-5.10/086-ipq8064-fix-duplicate-node.patch

All other patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, ipq806x/R7800
Run-tested: bcm2711/RPi4B, ipq806x/R7800

Signed-off-by: John Audia <graysky@archlinux.us>
2021-11-27 19:19:30 +01:00