aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
Commit message (Collapse)AuthorAgeFilesLines
* kernel: mtd: bcm-wfi: add cferam name supportÁlvaro Fernández Rojas2023-06-151-2/+14
| | | | | | | | | Some devices rename cferam bootloader using specific patterns and don't follow broadcom standards for renaming cferam files. This requires supporting different cferam file names. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 8813edd8d9695d4e3939fdaa3c530c682f91de11)
* generic: b53: rename exported symbols to avoid upstream conflictRobert Marko2023-06-126-21/+21
| | | | | | | | | | | | Upstream DSA driver is exporting symbols with the same name as our downstream swconfig driver, so lets rename the downstream symbols to make them unique and avoid the conflict on 6.1 kernel. Without this change, building 6.1 with kmod-switch-bcm53xx would conflict with the B53 DSA driver and CI would fail. Signed-off-by: Robert Marko <robimarko@gmail.com> (cherry picked from commit effccdd444a956afc5493ef8f1c79a7e7ffa8490)
* kernel: use struct group to wipe psb6970 volatile priv dataAleksander Jan Bajkowski2023-06-101-7/+9
| | | | | | | | | | | | | | | | | | | Instead of reference vlan and do strange subtraction, use the handy struct_group() to create a virtual struct of the same size of the members. This permits to have a more secure memset and fix compilation warning in 6.1 where additional checks are done. Fix compilation warning: | inlined from 'psb6970_reset_switch' at drivers/net/phy/psb6970.c:275:2: | ./include/linux/fortify-string.h:314:25: error: call to '__write_overflow_field' | declared with attribute warning: detected write beyond size of field | (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] | 314 | __write_overflow_field(p_size_field, size); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |cc1: all warnings being treated as errors Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl> (cherry picked from commit d69becd3071d560cd1c9ea655cbba26adce91f61)
* generic: use only first element in bootconf for uImage.FITDaniel Golle2023-06-091-7/+15
| | | | | | | | | | Now that it is possible to load several device tree overlays by appending their config names to bootconf the uImage.FIT partition parser need to discard everything after the first '#' character in bootconf when looking up the config node to be used. Signed-off-by: Daniel Golle <daniel@makrotopia.org> (cherry picked from commit 07bca1adaa0de71d0aefcf83bff2e1d90616cd3d)
* kernel: remove obsolete kernel version switchesAleksander Jan Bajkowski2023-05-203-26/+0
| | | | | | | This removes unneeded kernel version switches from the targets after kernel 5.10 has been dropped. Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
* kernel: psb6970: drop unused variable in psb6970_config_initAleksander Jan Bajkowski2023-05-121-1/+0
| | | | | | | | | | | | | | | Drop unused variable in psb6970_config_init. This variable should have been dropped in 0806f8fc80e6 ("lantiq: add Linux 5.10 support as testing kernel"). This fix compilation warning: drivers/net/phy/psb6970.c: In function 'psb6970_config_init': drivers/net/phy/psb6970.c:310:28: warning: unused variable 'dev' [-Wunused-variable] 310 | struct net_device *dev = pdev->attached_dev; | cc1: all warnings being treated as errors Fixes: 0806f8fc80e6 ("lantiq: add Linux 5.10 support as testing kernel") Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
* kernel: mtk_bmt: refactor to avoid deep recursionMichał Kępień2023-04-291-31/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Linksys E8450 (mt7622) device running current master has recently started crashing: [ 0.562900] mtk-ecc 1100e000.ecc: probed [ 0.570254] spi-nand spi2.0: Fidelix SPI NAND was found. [ 0.575576] spi-nand spi2.0: 128 MiB, block size: 128 KiB, page size: 2048, OOB size: 64 [ 0.583780] mtk-snand 1100d000.spi: ECC strength: 4 bits per 512 bytes [ 0.682930] Insufficient stack space to handle exception! [ 0.682939] ESR: 0x0000000096000047 -- DABT (current EL) [ 0.682946] FAR: 0xffffffc008c47fe0 [ 0.682948] Task stack: [0xffffffc008c48000..0xffffffc008c4c000] [ 0.682951] IRQ stack: [0xffffffc008008000..0xffffffc00800c000] [ 0.682954] Overflow stack: [0xffffff801feb00a0..0xffffff801feb10a0] [ 0.682959] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G S 5.15.107 #0 [ 0.682966] Hardware name: Linksys E8450 (DT) [ 0.682969] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.682975] pc : dequeue_entity+0x0/0x250 [ 0.682988] lr : dequeue_task_fair+0x98/0x290 [ 0.682992] sp : ffffffc008c48030 [ 0.682994] x29: ffffffc008c48030 x28: 0000000000000001 x27: ffffff801feb6380 [ 0.683004] x26: 0000000000000001 x25: ffffff801feb6300 x24: ffffff8000068000 [ 0.683011] x23: 0000000000000001 x22: 0000000000000009 x21: 0000000000000000 [ 0.683017] x20: ffffff801feb6380 x19: ffffff8000068080 x18: 0000000017a740a6 [ 0.683024] x17: ffffffc008bae748 x16: ffffffc008bae6d8 x15: ffffffffffffffff [ 0.683031] x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000f00000101 [ 0.683038] x11: 0000000000000449 x10: 0000000000000127 x9 : 0000000000000000 [ 0.683044] x8 : 0000000000000125 x7 : 0000000000116da1 x6 : 0000000000116da1 [ 0.683051] x5 : 00000000001165a1 x4 : ffffff801feb6e00 x3 : 0000000000000000 [ 0.683058] x2 : 0000000000000009 x1 : ffffff8000068080 x0 : ffffff801feb6380 [ 0.683066] Kernel panic - not syncing: kernel stack overflow [ 0.683069] SMP: stopping secondary CPUs [ 1.648361] SMP: failed to stop secondary CPUs 0-1 [ 1.648366] Kernel Offset: disabled [ 1.648368] CPU features: 0x00003000,00000802 [ 1.648372] Memory Limit: none Several factors contributed to this issue: 1. The mtk_bmt driver recursively calls its scan_bmt() helper function during device initialization, while looking for a valid block mapping table (BMT). 2. Commit fa4dc86e98 ("kernel: backport MEMREAD ioctl"): - increased the size of some stack-allocated structures (like struct mtd_oob_ops, used in bbt_nand_read(), which is indirectly called from scan_bmt()), - increased the stack size for some functions (for example, spinand_mtd_read(), which is indirectly called from scan_bmt(), now uses an extra stack-allocated struct mtd_ecc_stats). 3. OpenWrt currently compiles the kernel with the -fno-optimize-sibling-calls flag, which prevents tail-call optimization. Collectively, all of these factors caused stack usage in the mtk_bmt driver to grow excessively large, triggering stack overflows. Recursion is not really necessary in scan_bmt() as it simply iterates over flash memory blocks in reverse order, looking for a valid BMT. Refactor the logic contained in the scan_bmt() and read_bmt() functions in target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c so that deep recursion is prevented (and therefore also any potential stack overflows it may cause). Link: https://lists.openwrt.org/pipermail/openwrt-devel/2023-April/040872.html Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
* kernel: ssb: fallback-sprom: check bustypeÁlvaro Fernández Rojas2023-04-241-2/+7
| | | | | | host_pci is only defined when bustype is SSB_BUSTYPE_PCI. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: bcma: fallback-sprom: check hosttypeÁlvaro Fernández Rojas2023-04-241-2/+7
| | | | | | host_pci is only defined when hosttype is BCMA_HOSTTYPE_PCI. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: bcma: fallback-sprom: align extraction with upstreamÁlvaro Fernández Rojas2023-04-241-355/+134
| | | | | | | | The current bcma SPROM extraction from upstream only supports SPROMs with revisions from 8 to 11. Let's align the downstream fallback driver with upstream. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: ssb: fallback-sprom: drop mac leftoversÁlvaro Fernández Rojas2023-04-241-12/+0
| | | | | | This was left behind when removing the MAC extractions from PCI SPROMs. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: ssb: fallback-sprom: optimize struct dataÁlvaro Fernández Rojas2023-04-241-14/+14
| | | | | | | - Remove unneeded mac bytes from struct (it's already present in the SPROM). - Convert devid_override to boolean. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: bcma: fallback-sprom: optimize struct dataÁlvaro Fernández Rojas2023-04-241-14/+14
| | | | | | | - Remove unneeded mac bytes from struct (it's already present in the SPROM). - Convert devid_override to boolean. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: add bcma/ssb fallback SPROM supportÁlvaro Fernández Rojas2023-04-232-0/+1500
| | | | | | | This adds generic kernel support for Broadcom Fallback SPROMs so that it can be used in any target, even non Broadcom ones. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* treewide: strip useless `default n` Kconfig linesTony Butler2023-02-032-2/+0
| | | | | | | | | | Kconfig docs say: > The default value deliberately defaults to 'n' in order to avoid > bloating the build. Apply this rule everywhere, to avoid more cloning of bad examples Signed-off-by: Tony Butler <spudz76@gmail.com>
* kernel: mtk-bmt: fix usage of _oob_readChuanhong Guo2023-01-211-2/+8
| | | | | | | | _oob_read returns number of bitflips on success while bbt_nand_read should return 0. Fixes: 2d49e49b18 ("mediatek: bmt: use generic mtd api") Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* kernel: move ubnt ledbar driver to a separate packageFelix Fietkau2022-09-301-255/+0
| | | | | | | Simplifies the tree by removing a non-upstream kernel patch and related kconfig symbols Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: add support for mtdsplit-fit offsetYoonji Park2022-09-121-4/+7
| | | | | | | | | | Support devices that has vendor custom header before FIT image. Some devices has vendor custom header before FIT image. In this case mtd- split can not find FIT image and it results in rootfs mount failure. Please refer iptime,a6004mx device for further examples. Signed-off-by: Yoonji Park <koreapyj@dcmys.kr>
* generic: move ledbar driver from mediatek targetSven Wegener2022-09-111-0/+255
| | | | | | This moves the ledbar driver to generic, to be also used by the ramips target. Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
* kernel: mtdsplit: add support for H3C VFS filesystemJan Hoffmann2022-07-283-0/+176
| | | | | | | | | | | | | | | | The bootloader on some H3C devices (for example HPE 1920 switches) only supports booting from flash by reading an image from an "VFS" filesystem which spans most of the available flash. The filesystem size is hard- coded in the bootloader. However, as long as no write operations are performed in the bootloader menu, it is sufficient if the start of the partition contains a valid filesystem with the kernel image. This mtdsplit parser reads the size and location of the kernel image and finds the location of the rootfs stored after it. It assumes that the filesystem image matches the layout of one generated by mkh3cvfs, with a filename of "openwrt-kernel.bin" for the kernel image. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
* kernel: update FIT partition parser to new property nameDaniel Golle2022-04-201-1/+1
| | | | | | | | The commit "uboot-mediatek: replace patch with accepted commit" changed the name of the boot configuration property from 'bootconf' to 'u-boot,bootconf'. Reflect this change in the FIT partition parser. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* kernel: mtk_bmt: skip bitflip check if threshold isn't setChuanhong Guo2022-04-091-1/+1
| | | | | | kernel spi-nand driver leaves this field empty and let mtd set it later. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: fix compilation warning for ar8xxx swconfigAnsuel Smith2022-03-272-1/+3
| | | | | | | | | There are 2 warning for ar8xxx swconfig. - Fix not used dev variable when ETHERNET_PACKET_MANGLE is not selected - Convert fallthrough comment to compilation macro Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* generic: 5.15: get uImage.FIT partition parser readyDaniel Golle2022-03-271-2/+8
| | | | | | | Prepare uImage.FIT partition parser for Linux 5.15 Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* generic: 5.15: rework hack patchAnsuel Smith2022-03-272-1/+9
| | | | | | | | Rework hack patch in dir for kernel 5.15. For the specific patch of packet mangeling introduce a new extra_priv_flags as we don't have enough space to add additional flags in priv_flags. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* kernel: mtdsplit: support UBI after FIT imagesFelix Fietkau2022-03-251-2/+7
| | | | | | Change the partition name accordingly. Same behavior as mtdsplit_uimage Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: add debugfs file to attempt repair of remapped sectorsFelix Fietkau2022-03-251-1/+26
| | | | | | This can be used for sectors that are not physically damaged Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: add support for mediatek NMBM flash mapping supportFelix Fietkau2022-03-253-3/+2360
| | | | | | | This NAND flash remapping method is used on newer MediaTek devices with NAND flash. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: on error, do not attempt to remap out-of-range blocksFelix Fietkau2022-03-252-15/+24
| | | | | | Pass errors to caller instead Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: fix block copying on remap with bmt v2Felix Fietkau2022-03-251-6/+6
| | | | | | Copy from the previously mapped block (in case it was remapped already) Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: allow get_mapping_block to return an errorFelix Fietkau2022-03-254-8/+25
| | | | | | | Used by the mapping implementation to indicate that no backing block is available Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: split up mtk_bmt driver codeFelix Fietkau2022-03-254-805/+856
| | | | | | Keep a separate source file per variant Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: generic: fix warning in FIT partition parserDaniel Golle2022-03-241-2/+2
| | | | | | Use 'const char *' where necessary to make gcc get quiet. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* kernel: generic: improve FIT partition parserDaniel Golle2022-03-241-12/+40
| | | | | | | | | * only map filesystems configured in 'loadables' * allow mapping more than one filesystem (e.g. customization/branding or localization in addition to rootfs) * small cleaning here and there Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* kernel: generic: use chosen bootconf in FIT partition parserDaniel Golle2022-03-211-4/+13
| | | | | | | | | If the selected boot configuration is stored by U-Boot in '/chosen' node as 'bootconf' attribute, use that configuration to resolve the block device used as rootfs. Fall back to use the default configuration in case 'bootconf' is not present. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* kernel: mtk_bmt: add support for the bbt format used on mt7621Felix Fietkau2022-01-131-6/+202
| | | | | | | | | This does not have spare blocks for remapping, and it is also not suitable for random write access. It only skips over bad blocks on linear writes of an image to a partition. As such, it is really only suitable for the kernel partition, or other partitions with mostly static data Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: add abstraction for supporting other formatsFelix Fietkau2022-01-131-90/+122
| | | | | | Preparation for supporting remapping on MT7621 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: remap blocks after reaching bitflip thresholdFelix Fietkau2022-01-131-0/+4
| | | | | | This ensures that blocks are remapped before data becomes corrupt Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: pass number of bitflips on read to the callerFelix Fietkau2022-01-131-2/+9
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: add support for limiting range of remappingFelix Fietkau2022-01-131-7/+29
| | | | | | | | This can be used to support ubi on top of mtk_bmt without reflashing the boot loader. The boot loader + factory + kernel area is covered, while the rest is passed through as-is Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: extend debug interfaceFelix Fietkau2022-01-131-0/+96
| | | | | | | Add support for showing remapped blocks and garbage collecting old remapped blocks triggered by using the mark_good/mark_bad files Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: mtk_bmt: fix remapping after read/write failureFelix Fietkau2022-01-131-11/+67
| | | | | | Copy from the previous block in order to preserve existing data Signed-off-by: Felix Fietkau <nbd@nbd.name>
* kernel: move mediatek BMT support patch to generic patchesFelix Fietkau2022-01-132-0/+806
| | | | | | | Preparation for supporting BMT on MT7621. Move source files to the files/ subdirectory in order to simplify maintenance Signed-off-by: Felix Fietkau <nbd@nbd.name>
* generic: platform/mikrotik: use MTD notifierDenis Kalashnikov2022-01-134-28/+61
| | | | | | | | | | | | | | | | | | | | If the SPI probe is sufficiently delayed, the routerboot driver may fail to init as the routerboot partitions are not yet available. Register an MTD user notifier instead of doing straight init so that the init subroutines are only executed when the target MTD partitions are present. Because the init/exit routines can now be called outside of the kernel normal init/exit calls, they cannot be jettisoned and must always be available: the __init and __exit qualifiers are thus removed. Reported-by: Denis Kalashnikov <denis281089@gmail.com> Signed-off-by: Denis Kalashnikov <denis281089@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org> Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> [bump hardconfig/softconfig versions] Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* generic: platform/mikrotik: make soft_config writable without 4K sectorsOskari Lemmela2022-01-131-15/+4
| | | | | | | | | Make soft_config writable in all cases. Performing soft_config commit will fail if mtd partition is not writable. Signed-off-by: Oskari Lemmela <oskari@lemmela.net> [bump rb_softconfig version number] Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* generic: deny write to uImage.FIT sub-image partitionsDaniel Golle2022-01-111-1/+1
| | | | | | | Set policy bit to force read-only mode on uImage.FIT filesystem sub-images mapped as block partitions by the FIT partition parser. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* Move mvswitch 88E6060 driver to the ath25Sergey Ryazanov2021-12-272-591/+0
| | | | | | | | | | | | | | | | | | | | | | ath25 requires a 88E6060 driver to support boards such as Fonera 2.0g (FON2202). The swconfig based mvswitch driver has not yet been ported to the 5.10 kernel as the only user is the ath25 target while all other targets have been switched to the upstream DSA implementation. Switching ath25 to the DSA implementation is a complex task, since we need either per-board platform data or DTS support. ath25 lacks both of them and builds only a single generic image. So we need to keep the swconfig driver implementation to easly and quickly port ath25 to the 5.10 kernel. Since porting the mvswitch driver to 5.10 as a generic driver is not an option, and since the ath25 is its only user, make mvswitch a target specific driver to be able to port it to the 5.10 kernel as part of the kernel version update of the target. This will allow us quickly migrate to the next kernel version and not delay the next firmware release. Suggested-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
* kernel: export switch_generic_set_link() symbolRafał Miłecki2021-10-071-0/+1
| | | | | | | | | | | | This fixes: ERROR: "switch_generic_set_link" [drivers/net/phy/b53/b53_common.ko] undefined! At some point all packages for swconfig drivers were dropped and targets were meant to have them built into kernels. It seems b53 (re-)gained its kmod-switch-bcm53xx however and b53 needs to be built as module. Fixes: b2cfed48f626 ("Revert "swconfig: fix Broadcom b53 support"") Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* Revert "swconfig: fix Broadcom b53 support"Rafał Miłecki2021-10-072-33/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit 8f9cd1af0f9c325a902dbd0e79e12015372e6bb0. That commit was meant to add a single EXPORT_SYMBOL_GPL() but it actually also added few .of_match_table-s. One commit should handle one thing and should not introduce unrelated changes. Regarding actual changes: 1. EXPORT_SYMBOL_GPL is not required as we don't build swconfig drivers as modules. 2. PHY drivers must not have .of_match_table. That is allowed for MDIO drivers. This could work for some time (although is didn't for me on bcm53xx) but does not with kernel 5.10. It causes a soft lockup and upstream developers confirmed it's an unsupported design. Link: https://lore.kernel.org/netdev/2b1dc053-8c9a-e3e4-b450-eecdfca3fe16@gmail.com/t/#mf80e472f35ee23f7a75cbf5b1e101a17ab3a64a3 Cc: Tobias Schramm <tobleminer@gmail.com> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* kernel: properly handle paging errors in fit partition parserDaniel Golle2021-08-271-2/+5
| | | | | | | | The uImage.FIT partition uses page mapping without properly handling paging errors. This can lead to Kernel Oops in case of read errors while trying to parse uImage.FIT partitions. Signed-off-by: Daniel Golle <daniel@makrotopia.org>