aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/files
Commit message (Collapse)AuthorAgeFilesLines
...
* kernel: mtdsplit: bcm_wfi: refactor codeÁlvaro Fernández Rojas2020-06-021-82/+69
| | | | | | Create new parse_bcm_wfi function with common code from current parsers. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: mtdsplit: bcm_wfi: remove brcm,wfi-sercomm compatibilityÁlvaro Fernández Rojas2020-06-021-2/+1
| | | | | | | The only Sercomm WFI user has been migrated to a dedicated firmware parser. Keep support for no cferam partition based on a boolean DT property. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: mtdsplit: bcm_wfi: support Sercomm bootflagsÁlvaro Fernández Rojas2020-06-021-0/+148
| | | | | | | | Sercomm uses 2 bootflag partitions and boots the firmware with the highest bootflag. Support splitting the firmware partition while keeping support for unsplitted layout. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: mtdsplit: bcm_wfi: code refactoringÁlvaro Fernández Rojas2020-06-021-15/+18
| | | | | | | | - Rename master to mtd. - Pass mtd size as an argument. - Rename of_match_table. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* generic: routerboot sysfs: soft_config support for ath79 cpufreqThibaut VARÈNE2020-05-281-2/+64
| | | | | | | | | | | | This commit introduces support for R/W access to the CPU frequency setting of routerboot on ath79 hardware. On unsupported hardware, the sysfs attribute will expose the raw tag value (read-only) to help with reverse engineering its meaning. Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerboot sysfs: move tag_show_u32()Thibaut VARÈNE2020-05-283-22/+23
| | | | | | | | This routine will be shared between hard and soft config drivers. Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerboot sysfs: add support for soft_configThibaut VARÈNE2020-05-286-2/+711
| | | | | | | | | | | | | | | | | | | This driver exposes the data encoded in the "soft_config" flash segment of MikroTik RouterBOARDs devices. It presents the data in a sysfs folder named "soft_config" through a set of human-and-machine-parseable attributes. Changes can be discarded by writing 0 to the 'commit' attribute, or they can be committed to flash storage by writing 1. This driver does not reuse any of the existing code previously found in the "rbcfg" utility and makes this utility obsolete by providing a clean sysfs interface. Like "rbcfg", this driver requires 4K_SECTORS support since the flash partition in which these parameters are stored is typically 4KB in size. Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerboot sysfs: move tag_show_string()Thibaut VARÈNE2020-05-283-11/+15
| | | | | | | | | This routine will be shared between hard and soft config drivers. Also use scnprintf() instead of snprintf(). Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: platform/mikrotik: rb_hardconfig.c minor fixesThibaut VARÈNE2020-05-281-7/+14
| | | | | | | | | | | | | For the sake of strictly typed code, add a missing const qualifier. Add a missing return value in error path. Check the return value of mtd_read(), for good measure. Also demote the error printks of failed sysfs file creation to warn level since they are not fatal in the init() sequence. Finally, add a note regarding PAGE_SIZE and clarify a comment. Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: platform/mikrotik: reorder KconfigThibaut VARÈNE2020-05-281-2/+2
| | | | | | | | | The depends and select should apply to the sysfs driver, not the meta config. Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: platform/mikrotik: disambiguate SPDX-License-IdentifierThibaut VARÈNE2020-05-203-3/+3
| | | | | | I meant it to be GPL-2.0-only, as evidenced by the boilerplate. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerbootpart.c: disambiguate SPDX-License-IdentifierThibaut VARÈNE2020-05-201-1/+1
| | | | | | I meant it to be GPL-2.0-only, as evidenced by the boilerplate. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* kernel: mtdsplit: bcm_wfi: add sercomm supportÁlvaro Fernández Rojas2020-05-191-23/+47
| | | | | | SERCOMM creates separates partitions for cferam. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* kernel: mtdsplit: add BCM WFI supportÁlvaro Fernández Rojas2020-05-183-0/+209
| | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* generic: drop outdated kernel version switches in local driversAdrian Schmutzler2020-05-175-51/+3
| | | | | | | This drops the obsolete version switches for non-supported kernels from local drivers in generic target. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* generic: platform/mikrotik: fix LZOR supportThibaut VARÈNE2020-05-161-21/+36
| | | | | | | | | | | | 31e99fe3da which introduced this code was unfortunately untested. This commit fixes a number of issues and works around the fact that in this particular scheme, the LZO payload may be padded at the end which will trigger a harmless lzo decompression error. This commit also disambiguates the debug printks. Tested-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org> Fixes: 31e99fe3da ("generic: platform/mikrotik: support LZOR encoding")
* generic: add MikroTik hw bit descriptionKoen Vandeputte2020-05-111-0/+1
| | | | | | | | | An e-mail response from MikroTik contained a minimal overview on hardware option bits which mentioned a currently unknown bit. While not being too detailed what it does, add it for documentation purposes. Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
* generic: platform/mikrotik: support LZOR encodingThibaut VARÈNE2020-05-081-1/+261
| | | | | | | | Some newer MikroTik RouterBOARD devices use a new encoding scheme for their WLAN calibration data. This patch provides support for decoding this new scheme. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerboot sysfs platform driverThibaut VARÈNE2020-05-085-0/+717
| | | | | | | | | | | | | | | | | | | | | | | | | This driver exposes the data encoded in the "hard_config" flash segment of MikroTik RouterBOARDs devices. It presents the data in a sysfs folder named "hard_config". The WLAN calibration data is available on demand via the 'wlan_data' sysfs file in that folder. This driver permanently allocates a chunk of RAM as large as the "hard_config" MTD partition (typically 4KB), although it is technically possible to operate entirely from the MTD device without using a local buffer (except when requesting WLAN calibration data), at the cost of a performance penalty. This driver does not reuse any of the existing code previously found in routerboot.c. This driver has been successfully tested on BE (ath79) and LE (ipq40xx and ramips) hardware. Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Tested-by: Baptiste Jonglez <git@bitsofnetworks.org> Tested-by: Tobias Schramm <t.schramm@manjaro.org> Tested-by: Christopher Hill <ch6574@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: routerbootpart MTD parser for RouterBootThibaut VARÈNE2020-05-081-0/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver provides an OF MTD parser to properly assign the RouterBoot partitions on the flash. This parser builds from the "fixed-partitions" one (see ofpart.c), but it can handle dynamic partitions as found on routerboot devices. The parent node must contain the following: compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; Children routerbootpart DTS nodes are defined as follows: For fixed partitions node-name@unit-address { reg = <prop-encoded-array>; label = <string>; read-only; lock; }; All properties but reg are optional. For dynamic partitions: node-name { size = <prop-encoded-array>; label = <string>; read-only; lock; }; size property is mandatory unless the next partition is a fixed one or a "well-known" one (matched from the strings defined below) in which case it can be omitted or set to 0; other properties are optional. By default dynamic partitions are appended after the preceding one, except for "well-known" ones which are automatically located on flash. Well-known partitions (matched via label or node-name): - "hard_config" - "soft_config" - "dtb_config" This parser requires the DTS to list partitions in ascending order as expected on the MTD device. This parser has been successfully tested on BE (ath79) and LE (ipq40xx and ramips) hardware. Tested-by: Baptiste Jonglez <git@bitsofnetworks.org> Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> Tested-by: Tobias Schramm <t.schramm@manjaro.org> Tested-by: Christopher Hill <ch6574@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* generic: ar8216: fix unknown packet flooding for ar8229/ar8236Chuanhong Guo2020-05-062-7/+16
| | | | | | | | | | | | ar8229 and ar8236 don't allow unknown unicast/multicast frames and broadcast frames to be flooded to cpu port. This isn't desired behavior for swconfig as we treat it as a standalone switch. Current code doesn't enable unicast frame flooding for ar8229 and uses wrong setup for ar8236. This commit fixes both of them by enabling port 0 flooding for all unknown frames. Fixes: FS#2848 Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* kernel: fix include of myloader.o since kernel 5.4Adrian Schmutzler2020-04-241-182/+0
| | | | | | | | | | | | | | | | | | | | | | Between 4.19 and 5.4, mtd parsers have been moved to "parsers" subdirectory. Based on this, the selection of myloader.o in OpenWrt was also moved to that subdirectory, while the Kconfig and our local myloader.c file remained in /drivers/mtd. This resulted in linking errors like the following (on ath25@5.4): make[8]: *** No rule to make target 'drivers/mtd/parsers/myloader.o', ... needed by 'drivers/mtd/parsers/built-in.a'. Stop. make[7]: *** [scripts/Makefile.build:500: drivers/mtd/parsers] Error 2 make[6]: *** [scripts/Makefile.build:500: drivers/mtd] Error 2 Since myloader.c is not too big, this patch moves it to the kernel patches, allowing to adjust the path for kernel 5.4 and keeping Makefiles and file paths better in sync. Other patches have been refreshed accordingly. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* kernel: rtl8367b: use id as a bit offset for BYPASS_LINE_RATEINAGAKI Hiroshi2020-04-041-4/+2
| | | | | | | | | | | | | | | | | In RTL8367B (RTL8367RB/RTL8367R-VB), the driver in GPL tars of the devices with this switch directly uses the ID of external interface as a bit offset. We should use the same way. ref (RTL8367B): - ASUS RT-N56U - TP-Link Archer C2 v1 ref (RTL8367): - TP-Link TL-WR2543ND v1 Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
* kernel: rtl8367b: fix DEBUG register address for extif2INAGAKI Hiroshi2020-04-041-1/+1
| | | | | | | | RTL8367B_CHIP_DEBUG1_REG (0x1304) is for external interface 1. For external interface 2, use RTL8367B_CHIP_DEBUG2_REG (0x13e2) instead. Fixes: 9801d61c4a ("kernel: rtl8367b: add configuration for extif2") Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
* kernel: rtl8367b: add configuration for extif2Serge Vasilugin2020-03-211-5/+42
| | | | | | | | | | | | | | | | | | | | | | Both rtl8367b and rtl8367s have two extended interface rtl8367rb: 5 port + 2*RGMII/MII rtl8367s: 5 port + SGMII/HSGMI + RGMII/MII (?)rtl8367sb: 5 port + 2*RGMII/MII These interfaces correspond to EXT1 and EXT2 (ports 6 and 7 respectivly). This patch allow to configure EXT2 in dts-file: rtl8367rb { compatible = "realtek,rtl8367b"; cpu_port = <7>; realtek,extif2 = <1 0 1 1 1 1 1 1 2>; mii-bus = <&mdio0>; phy_id = <29>; }; Signed-off-by: Serge Vasilugin <vasilugin@yandex.ru> [fix indent, replace magic value, alter commit message] Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: rtl8367b: add definition of debug regChuanhong Guo2020-03-211-5/+30
| | | | | | | This commit adds definition of DEBUG0 and DEBUG1 registers and replace magic values with proper register modifying. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: make all phy drivers kernel 5.0 compatibleMathias Kresin2020-03-163-0/+21
| | | | | | | | It adjusts the code to upstream changes from the commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode") Signed-off-by: Mathias Kresin <dev@kresin.me>
* kernel: add support for kernel 5.4Koen Vandeputte2020-02-281-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following patches were removed because they are integrated in the upstream kernel 5.4: * backport-5.4/047-v4.21-mtd-keep-original-flags-for-every-struct-mtd_info.patch * backport-5.4/048-v4.21-mtd-improve-calculating-partition-boundaries-when-ch.patch * backport-5.4/080-v5.1-0001-bcma-keep-a-direct-pointer-to-the-struct-device.patch * backport-5.4/080-v5.1-0002-bcma-use-dev_-printing-functions.patch * backport-5.4/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch * backport-5.4/101-arm-cns3xxx-use-actual-size-reads-for-PCIe.patch * backport-5.4/200-v5.2-usb-dwc2-Set-lpm-mode-parameters-depend-on-HW-configuration.patch * backport-5.4/210-arm64-sve-Disentangle-uapi-asm-ptrace.h-from-uapi-as.patch * backport-5.4/380-v5.3-net-sched-Introduce-act_ctinfo-action.patch * backport-5.4/450-v5.0-mtd-spinand-winbond-Add-support-for-W25N01GV.patch * backport-5.4/451-v5.0-mtd-spinand-Add-initial-support-for-Toshiba-TC58CVG2.patch * backport-5.4/452-v5.0-mtd-spinand-add-support-for-GigaDevice-GD5FxGQ4xA.patch * backport-5.4/455-v5.1-mtd-spinand-Add-support-for-all-Toshiba-Memory-produ.patch * backport-5.4/456-v5.1-mtd-spinand-Add-support-for-GigaDevice-GD5F1GQ4UExxG.patch * backport-5.4/460-v5.0-mtd-spi-nor-Add-support-for-mx25u12835f.patch * backport-5.4/460-v5.3-mtd-spinand-Define-macros-for-page-read-ops-with-thr.patch * backport-5.4/461-v5.3-mtd-spinand-Add-support-for-two-byte-device-IDs.patch * backport-5.4/462-v5.3-mtd-spinand-Add-support-for-GigaDevice-GD5F1GQ4UFxxG.patch * backport-5.4/463-v5.3-mtd-spinand-Add-initial-support-for-Paragon-PN26G0xA.patch * backport-5.4/700-v5.1-net-phylink-only-call-mac_config-during-resolve-when.patch * backport-5.4/701-v5.2-net-phylink-ensure-inband-AN-works-correctly.patch * backport-5.4/702-v4.20-net-ethernet-Add-helper-for-MACs-which-support-asym-.patch * backport-5.4/703-v4.20-net-ethernet-Add-helper-for-set_pauseparam-for-Asym-.patch * backport-5.4/704-v4.20-net-phy-Stop-with-excessive-soft-reset.patch * backport-5.4/705-v5.1-net-phy-provide-full-set-of-accessor-functions-to-MM.patch * backport-5.4/706-v5.1-net-phy-add-register-modifying-helpers-returning-1-o.patch * backport-5.4/707-v5.1-net-phy-add-genphy_c45_check_and_restart_aneg.patch * backport-5.4/708-v5.3-net-phylink-remove-netdev-from-phylink-mii-ioctl-emu.patch * backport-5.4/709-v5.3-net-phylink-support-for-link-gpio-interrupt.patch * backport-5.4/710-v5.3-net-phy-allow-Clause-45-access-via-mii-ioctl.patch * backport-5.4/711-v5.3-net-sfp-add-mandatory-attach-detach-methods-for-sfp-.patch * backport-5.4/712-v5.3-net-sfp-remove-sfp-bus-use-of-netdevs.patch * backport-5.4/713-v5.2-net-phylink-avoid-reducing-support-mask.patch * backport-5.4/714-v5.3-net-sfp-Stop-SFP-polling-and-interrupt-handling-duri.patch * backport-5.4/715-v5.3-net-phylink-don-t-start-and-stop-SGMII-PHYs-in-SFP-m.patch * backport-5.4/740-v5.5-net-phy-avoid-matching-all-ones-clause-45-PHY-IDs.patch * backport-5.4/741-v5.5-net-phylink-fix-link-mode-modification-in-PHY-mode.patch * pending-5.4/103-MIPS-perf-ath79-Fix-perfcount-IRQ-assignment.patch * pending-5.4/131-spi-use-gpio_set_value_cansleep-for-setting-chipsele.patch * pending-5.4/132-spi-spi-gpio-fix-crash-when-num-chipselects-is-0.patch * pending-5.4/220-optimize_inlining.patch * pending-5.4/341-MIPS-mm-remove-no-op-dma_map_ops-where-possible.patch * pending-5.4/475-mtd-spi-nor-Add-Winbond-w25q128jv-support.patch * pending-5.4/477-mtd-add-spi-nor-add-mx25u3235f.patch * pending-5.4/479-mtd-spi-nor-add-eon-en25qh64.patch Some bigger changes were done to this feature and we did not port this patch yet: * hack-5.4/207-disable-modorder.patch This depends on BOOTMEM which was removed from the kernel, this needs some bigger changes: * hack-5.4/930-crashlog.patch A different version of the FPU disable patch was merged upstream, OpenWrt needs some adaptations. * pending-5.4/304-mips_disable_fpu.patch - no crashlog support yet as a required file got deleted upstream - Removed patch below, which is now seen as a recursive dependency [1] - Removed patch below due to build error [2] - fix still required to avoid identical function def [3] - Fixes included from Blocktrron - Fixes included from Chunkeey - Fix included from nbd regarding "dst leak in Flow Offload" [1] target/linux/generic/hack-5.4/260-crypto_test_dependencies.patch [2] target/linux/generic/hack-5.4/207-disable-modorder.patch [3] target/linux/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com> Signed-off-by: David Bauer <mail@david-bauer.net> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* kernel: swconfig: make compatible with kernel 5.2Mathias Kresin2020-02-121-6/+41
| | | | | | | | | | | | | | | | | | | | | Since kernel 5.2 within netlink messages the NLA_F_NESTED nested flag is validated. But swconfig/swlib doesn't set the flag for SWITCH_ATTR_OP_VALUE_PORTS related netlink messages and assigning ports to vlans via swconfig dev switch0 vlan 1 set ports '0 1 2 3 4 6t' Errors put with "Failed to set attribute: Invalid input data or parameter". Relax the validation rules and use the deprecated functions, to use the same level of validation as it was till kernel 5.1. Depending on who has swconfig related netlink messages implemented, there might be more broken tools out there and we should keep backward compatibility if possible. Signed-off-by: Mathias Kresin <dev@kresin.me> Tested-by: Rafał Miłecki <rafal@milecki.pl>
* swconfig: fix Broadcom b53 supportTobias Schramm2020-01-122-0/+33
| | | | | | | | | This commit fixes a bug in the main swconfig patch where a function needed by the b53 driver is not exported. Additionally it adds OF support to the b53_mdio driver for devicetree- based probing Signed-off-by: Tobias Schramm <tobleminer@gmail.com>
* generic ar8xxx: increase VLAN table for AR83x7David Bauer2019-11-303-9/+13
| | | | | | | | | | | | The Atheros AR8327 and AR8337 have (according to their datasheet) a VLAN table with a maximum of 4096 entries. Currently, there's a hard limit of 128 VLANs, which is the same as for most other Atheros switches. Increase this limit only for the AR83x7 series and modify some shared functions to allow them to work with a variable max VLAN count. Signed-off-by: David Bauer <mail@david-bauer.net>
* mac80211: switch to upstream owl-loader driverChristian Lamparter2019-11-301-246/+0
| | | | | | | | | | | | | | | | | | The Owl Loader (named after the codename that Atheros gave these devices back in the day) has been accepted upstream. This patch removes the "misc" driver OpenWrt had and adds the remaining differences against the version that ships with 5.4-rc1 into a separate "120-owl-loader-compat.patch" file that can be cut down once AR71XX is being dealt with. Note: I decided to keep the existing (kmod-)owl-loader package name around for now. The kernel module file in the kmod package will be called ath9k_pci_owl_loader.ko though. Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* kernel: fix swconfig compilation with kernels 5.2+Rafał Miłecki2019-10-281-0/+23
| | | | | | | This is related to the upstream kernel change 3b0f31f2b8c9 ("genetlink: make policy common to family"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* kernel: Fix off-by-one error in FIT mtd partition search.Oldřich Jedlička2019-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This fixes off-by-one error introduced in commit dc76900021b8 ("kernel: Correctly search for the FIT image in mtd partition.") Function `mtd_read` starts reading at `offset` and needs `hdr_len` number of bytes to be available. Suppose the easiest case when `offset` is `0` and `hdr_len` equals to `mtd->size` - the `for` loop will not be entered even when enough bytes are available to be read. Same happens for any non-zero `offset`, when `hdr_len` is just enough bytes to be read until `mtd->size` is reached. Imagine that for example `mtd->size=5`, `offset=4` and `hdr_len=1`. Then `offset+hdr_len=5` and the check has to be `offset+hdr_len <= mtd->size`, i.e. `5 <= 5`. The check for `offset + hdr_len` value needs to be inclusive, therefore use `<=`. Fixes: dc76900021b8 ("kernel: Correctly search for the FIT image in mtd partition.") Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com> [adjusted commit ref, fixes tag] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* kernel: Correctly search for the FIT image in mtd partition.Fredrik Olofsson2019-09-191-2/+2
| | | | | | Previously all iterations of the loop checked offset=0 in the partition. Signed-off-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
* kernel: mtdsplit_uimage: add support for okli imageChuanhong Guo2019-08-081-0/+58
| | | | | | | | | | This adds support for uImage used by OpenWrt kernel loader. The parser searches for uImage header at flash eraseblock boundary and it might attempt to split any firmware with loader, therefore this entry doesn't have MTD_PARSER_TYPE_FIRMWARE so that this parser is only used when explicitly defined in dts. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* kernel: drop Fon(Foxconn) parser matching for the "firmware" partitionRafał Miłecki2019-08-061-1/+0
| | | | | | | | | | | | | | | | This parser's matching function appears to be too generic as it matches e.g. Buffalo WZR-HP-G300NH. That results in incorrect parts parsing. Luckily this parser is needed by Fon FON2601 only which uses DT-based ramips target. It means we can depend on mtd subsystem matching of "fonfxc,uimage" string. That said triggering this parser based on the "firmware" (or whatever MTD_SPLIT_FIRMWARE_NAME is) partiiton name is not needed. It can be dropped which will automatically fix the Buffalo WZR-HP-G300NH case. Fixes: a1c6a316d299 ("ramips: add support for Fon FON2601") Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* Revert "kernel: generic: fix fonfxc uimage parser"Rafał Miłecki2019-08-061-14/+7
| | | | | | | | | | | | | | | | | This reverts commit e92a14709d37f64dcba8c81fa51e61e5f10f439a. mtdsplit_uimage_parse_fonfxc() gets called in two situations: 1) It was /requested/ from DT using "fonfxc,uimage" compatible string 2) It was called by parsing code after finding "firmware" (MTD_SPLIT_FIRMWARE_NAME) due to the parser's type Code added in the /fix/ commit basically just disabled the second case. If that's the real goal it could be achieved by simply dropping type MTD_PARSER_TYPE_FIRMWARE. It may however require another solution as it's possible that some non-DT target actually needs fonfxc uImage parsing. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* kernel: generic: fix fonfxc uimage parserNOGUCHI Hiroshi2019-08-041-7/+14
| | | | | | | | | | | | | | | | We cannot distinguish between fonfxc uImage and generic uImage because fonfxc uImage header is almost same as generic uImage, except padding length after image name. The fonfxc uImage parser is available when specifying directly with DT compatible property. So this patch adds check if the partition DT node is compatible with the parser. Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2413 Fixes: a1c6a316d299 ("ramips: add support for Fon FON2601") Signed-off-by: NOGUCHI Hiroshi <drvlabo@gmail.com> [commit light touches and removed C code comment] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* ramips: add support for Fon FON2601NOGUCHI Hiroshi2019-07-261-12/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FON2601 is a wireless router. Specification: - SoC: Mediatek MT7620A (580MHz) - RAM: 128 MiB - ROM: 16 MiB SPI Flash - Wireless: for 11b/g/n (upto 300 Mbps): MT7620A built-in WMAC for 11a/n/ac (upto 867 Mbps): MT7662E - Ethernet LAN: 1 port, upto 100 Mbps - Ethernet WAN: 1 port, upto 1000 Mbps - USB: 1 port (USB 2.0 host) - LEDs: 4 (all can be controlled by SoC's GPIO) - buttons: 1 (Displayed as "WPS" on enclosure) - serial port: 57600n8 pins: Vcc(3.3V), Rx, Tx, GND (left to right, viewed from outside of board) Installation (only available via UART): 1. download sysupgrade binary image by wget command 2. write sysupgrade binary image to Flash command is: mtd write sysupgrade.bin firmware 3. reboot Important Notice: Only one button is displayed as "WPS" on enclosure. However, it is configured as "reset" (factory resetting feature). Signed-off-by: NOGUCHI Hiroshi <drvlabo@gmail.com> [removed unrelated openwrt-keyring revert, missing -Wall for uimage_padhdr] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* kernel: Add missing includes mtdsplit_*.cHauke Mehrtens2019-07-079-0/+9
| | | | | | | | | | | This fixes the following compile problem with kernel 4.9 on lantiq: drivers/mtd/mtdsplit/mtdsplit_uimage.c:244:34: error: array type has incomplete element type 'struct of_device_id' static const struct of_device_id mtdsplit_uimage_of_match_table[] = { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/mtd/mtdsplit/mtdsplit_uimage.c:245:4: error: field name not in record or union initializer { .compatible = "denx,uimage" }, Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* generic: ar8216: group MIB counters and use two basic ones only by defaultChuanhong Guo2019-05-203-81/+150
| | | | | | | | | | | | | | | | | There are too many MIB counters that almost nobody needs since commit d6366ce3665f ("generic: ar8216: mib_work_func: read all port mibs everytime"). In the worker function to poll MIB data, it deals with all ports instead of only one port every time, which introduces too many mdio operations that it becomes a heavy CPU load even on not-emulated MDIO bus. This commit groups MIB counters and enable only TxBytes and RxGoodBytes by default (both of which are necessary to get swconfig led working.) and adds an swconfig attribute to allow enabling all counters if users need them. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add mib_poll_interval switch attributeChuanhong Guo2019-05-203-8/+63
| | | | | | | | | | | | | | This allows specifying interval of polling MIB counters from userspace and allow completely turning off MIB counter support by setting mib_poll_interval to 0. Since MIB counter polling is a heavy CPU load for GPIO emulated MDIO bus, disable this behavior by default. Those who wants to use swconfig LEDs can enable them with qca,mib-poll-interval dts property or with swconfig command. Fixes: FS#2230 ("kworker spikes 100% cpu every 2 second.") Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* kernel: b53: add support for kernels 5.0+Rafał Miłecki2019-04-041-0/+10
| | | | | | | | It adjusts b53 code to upstream changes from the commit 3c1bcc8614db ("net: ethernet: Convert phydev advertize and supported from u32 to link mode"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* generic: ar8216: introduce qca,mib-poll-interval propertyChuanhong Guo2019-03-242-2/+13
| | | | | | | | This allows users to specify a shorter mib poll interval so that the swconfig leds could behave normal with current get_port_stats() implementation. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: do a software reset for switch during hw_initChuanhong Guo2019-03-241-0/+3
| | | | | | | | | | | | | | This applies to ar8216 and ar8236. QCA's newer U-boot will enable the switch mdio master for FE switches which makes phy inaccessible from CPU mdio. (e.g. on TP-Link TL-WR941N v7 Chinese version which uses QCA9558+AR8236.) For these devices PHY probing is broken and mdio device probing is a must. We also need to disable switch mdio master in driver for later PHY initialization. Do a soft reset during hw_init so that mdio master can be disabled and expose PHYs to CPU mdio for later PHY accessing. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: mib_work_func: read all port mibs everytimeChuanhong Guo2019-03-242-9/+5
| | | | | | | | ar8xxx_mib_capture will update mib counters for all ports. Current code only update one port at a time and the data for other ports are lost. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for get_port_stats()Chuanhong Guo2019-03-243-25/+59
| | | | | | | | | | | | | | | | | | | | | | | Partially reverts commit eff3549c5883a9abc5dbff00c084cabbcfdf4437. AR7240 and AR9341 have buggy hardware switch LED trigger. The AR7240 one doesn't blink and the blinking of port0/port5 is reversed on AR9341 if we swap PHY0 and PHY4. (Only blinking is reversed, which means LED for PHY0 will lit when PHY0 is link up and will blink when PHY4 has active link and vice versa.) On these two chips a software swconfig LED trigger is required. This commit adds swconfig port stats back but: 1. move checking of mib_t/rxb_id into ar8xxx_chip since we can't distinguish ar7240sw and ar8216 using only chip id. 2. don't update mib counter in get_port_stat. This function is called every 0.01s and this capturing procedure will take up a lot of CPU. We already have a mib_work_func updating mib counters every 2s so return the saved counter instead of fetching new data. The blinking rate will be weird but it should solve the previously mentioned CPU time problem. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: add support for ar724x/ar933x builtin switchChuanhong Guo2019-03-242-6/+112
| | | | | | | | | | | | | | This builtin switch is a bugless ar8216 with different mib counters and gigabit cpu port. Atheros uses the same device ID and it's impossible to distinguish the standalone one and the builtin one. So we add support to mdio device probe only. This switch doesn't have buggy vlan tag so it's not needed to enable atheros header. This commit changed ar8216_setup_port so that it can be reused for this switch. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* generic: ar8216: mdiodev: add qca,phy4-mii-enable optionChuanhong Guo2019-03-241-0/+6
| | | | | | This option allows setting phy4 as a phy connected directly to CPU. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>