Commit Graph

126 Commits

Author SHA1 Message Date
Álvaro Fernández Rojas
7122609082 bmips: switch to generic bcma/ssb fallback SPROM
Stop using bmips b43-sprom fixups and switch to generic bcma/ssb fallback
SPROMs. This way we don't need to include the b43-sprom fixups on devices
without Broadcom wireless.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-23 12:18:35 +02:00
Álvaro Fernández Rojas
5ec781c444 bmips: pci-bcm6348: load IO resource from DT ranges
Correctly load IO resource from DT ranges and remove the specific IO resource.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 20:11:28 +02:00
Álvaro Fernández Rojas
16b0cbbde0 bmips: drop unneeded ath9k fixup
We no longer need the custom ath9k fixup now that we're using the standard
kmod-owl-loader.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 19:45:04 +02:00
Álvaro Fernández Rojas
db4f158c03 bmips: hg556a: switch to kmod-owl-loader
Stop using custom ath9k fixup and switch to standard kmod-owl-loader

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-18 19:45:04 +02:00
Álvaro Fernández Rojas
457549665f bmips: dts: add missing phy modes
PHY modes should be defined in the device tree for the bcm63xx internal switch.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:06:22 +02:00
Álvaro Fernández Rojas
2c824b4615 bmips: remove source-only flag
bmips target is now more stable and it's time to start generating buildbot
images in order to receive a wider testing, which will be essential to replace
bcm63xx target in the future.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
6fd8e0f943 bmips: add subtargets for each SoC
BMIPS is a generic arch that can be used for multiple Broadcom SoCs, each one
with its own specific drivers, so instead of having a huge kernel supporting
all of them, let's switch to a subtarget per SoC like other OpenWrt targets.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
e76556d967 bmips: b43-sprom: fix build when SSB/BCMA disabled
Fix build of B43 SPROM fallback when SSB or BCMA are disabled.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
95b846fbc0 bmips: allow disabling mdio-mux-bcm6368
This controller is only present on SoCs with B53 MMAP switch.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-10 10:04:08 +02:00
Álvaro Fernández Rojas
8bee6a9f1d bmips: switch to LED kernel modules
Disable LED controllers from kernel config and switch to per device kernel
modules.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:52:32 +02:00
Álvaro Fernández Rojas
6e081e1778 bmips: add LED kernel modules
Add BCM6328 and BCM6358 LED kernel modules.
This allows selecting the LED controllers only for those devices using them.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:34:05 +02:00
Álvaro Fernández Rojas
aefeb34223 bmips: add support for Sercomm SHG2500
Sercomm SHG2500 is a BCM63168 with 128M of RAM, 256M of NAND, an external
BCM53124S switch for the LAN ports and internal/external Broadcom wifi.
LEDs are connected to an external MSP430G2513 MCU controlled via SPI.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:33:13 +02:00
Álvaro Fernández Rojas
d11a7c4d95 bmips: use sercomm-pid script
Make use of sercomm-pid script for generating the Sercomm PID, which avoids
having to add an array of hex bytes for every new Sercomm device.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:21:58 +02:00
Álvaro Fernández Rojas
d309160d30 bmips: image: rename SERCOMM_VERSION to SERCOMM_FSVER
SERCOMM_VERSION is ambiguous and it should be more clear that it refers to the
version used for the filesystem.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-04-09 10:06:26 +02:00
Álvaro Fernández Rojas
967520800a bmips: bcm6362/bcm63268: enable HW RNG
This enables the HW Random Number Generator on the BCM6362 and BCM63268 SoCs,
which is the same one used on BCM6368 SoC.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-31 17:52:03 +02:00
Álvaro Fernández Rojas
a0f100c569 bmips: bcm6348-enet: register emac driver from iudma
Register the ethernet driver from iudma, which avoids the attempt to probe the
emac driver before iudma and its consequent deferral.
The ethernet driver can't work without iudma anyway.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-29 18:33:34 +02:00
Álvaro Fernández Rojas
cd64353bd6 bmips: bcm6348-enet: add PHY support
We should ensure that the PHY is properly configured.
This is specially needed in devices using the internal PHY for ethernet0.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-29 16:26:42 +02:00
Álvaro Fernández Rojas
1c552eb44d bmips: add basic BCM6358 ethernet support
The MDIO bus is supported but there are errors when trying to probe and
configure the external BCM5325E switch through B53 DSA.
Therefore, let's add basic ethernet (but working) support for now.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 20:01:22 +02:00
Álvaro Fernández Rojas
414ca70684 bmips: bcm6368-enetsw: refactor probe
- Switch to devm functions where possible.
- Fix probing when no resets provided.
- Properly check pointers (IS_ERR_OR_NULL/PTR_ERR).
- Add probe info.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 19:36:59 +02:00
Álvaro Fernández Rojas
4d99f0ce4d bmips: bcm6368-enetsw: remove unneeded variables
Change the code to use defines instead of variables.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:47:17 +02:00
Álvaro Fernández Rojas
33f59ebd1f bmips: bcm6368-enetsw: harmonize dev variables
The current implementation of bcm6368-enetsw is a mess of dev, ndev and kdev
variables, which have refer to different things depending on the function.
This commit harmonizes it and resolves the issue.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:34:46 +02:00
Álvaro Fernández Rojas
741780bd93 bmips: sercomm,h500-s: add Quantenna gpio switch
Sercomm H500-s has a Quantenna SoC for external wifi which can be activated or
deactivated through GPIO #20.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-28 18:20:34 +02:00
Álvaro Fernández Rojas
67c28dde09 bmips: sercomm,h500-s: fix upgrade
Sercomm H500-s devices don't need the JFFS2 cleanmarkers as opposed to the
other bmips NAND devices.

Fixes: 6df12200d9 ("bmips: add support for Sercomm H-500s")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-25 10:25:31 +01:00
Álvaro Fernández Rojas
4dedcbdc80 bmips: sercomm,h500-s: add Quantenna network config
Sercomm H500-s has an external Quantenna QT3740BC SoC connected by RGMII.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-24 11:23:42 +01:00
Álvaro Fernández Rojas
b88ae628cb kernel: add more dsa b53 pending patches
These patches have now received a positive review upstream, so let's add them
to pending patches.

776-net-dsa-b53-mmap-add-phy-ops.patch:
  This is mostly bmips/bcm63xx-specific to get external switches working
  without hanging the device when accessing certain registers.

777-net-dsa-b53-mdio-add-support-for-BCM53134:
  This adds support for BCM53134 switch on DSA B53, so any target using DSA B53
  can benefit from it.

Also fix sercomm-h500-s external switch IMP port phy-mode.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-24 11:23:42 +01:00
Álvaro Fernández Rojas
6df12200d9 bmips: add support for Sercomm H-500s
Sercomm H-500s is a BCM63268 with 128M, internal and external (Quantenna) wifi
and external BCM53134S switch.
This device is already supported in bcm63xx target, so more information can be
found in https://openwrt.org/toh/sercomm/h500-s.

It's a perfect example of a device with internal and external switch
coexistance since most devices only have ports on one of the switches but not
both of them.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-22 20:57:07 +01:00
Álvaro Fernández Rojas
cc07d1d2fd bmips: drop unneded cpu labels from external switches
These labels aren't needed and were accidentally added when adding external
switches support for bmips.

Fixes: 80a3ecc894 ("bmips: add Huawei HG253s v2 support")
Fixes: 61f3c3b1ee ("bmips: dgnd3700v2: enable external BCM53125 switch")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-22 18:31:31 +01:00
Álvaro Fernández Rojas
a97965b7b1 kernel: add pending patches for bcm63268-timer-clocks
bcm63268-timer-clocks have been sent upstream with a positive review, so let's
add them to pending v5.15.
Also add devm_clk_hw_register_gate() patch from v5.17 to backports since it's
needed for upstream bcm63268-timer-clocks patches.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-22 18:31:31 +01:00
Álvaro Fernández Rojas
68883278ab bmips: dts: nand: add missing address/size cells
Fixes the following warnings for Netgear DGND3700v2 and Comtrend VR-3032u:
[    1.059540] 7 fixed-partitions partitions found on MTD device brcmnand.0
[    1.066570] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions
[    1.073766] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions
[    1.081927] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions
[    1.089128] OF: Bad cell count for /ubus/nand@10000200/nandcs@0/partitions

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-21 20:49:21 +01:00
Álvaro Fernández Rojas
80a3ecc894 bmips: add Huawei HG253s v2 support
Huawei HG253s v2 is a BCM6362 with 128M RAM, internal wifi and external
BCM53124S switch.
This device is already supported in bcm63xx target, so more information can be
found in https://openwrt.org/toh/huawei/hg253s_v2.

It's a perfect example of a device with internal and external switch
coexistance since most devices only have ports on one of the switches but not
both of them.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-21 20:49:18 +01:00
Álvaro Fernández Rojas
61f3c3b1ee bmips: dgnd3700v2: enable external BCM53125 switch
The Netgear DGND3700v2 has an external BCM53125 switch which can now be enabled
as a DSA disjoint switch tree setup.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-21 19:45:20 +01:00
Álvaro Fernández Rojas
82dc16fde0 bmips: disable B53 MMAP phy read/write ops
Without this change, internal and external B53 switches couldn't coexist as
reported in https://github.com/openwrt/openwrt/issues/10313.
In order to fix this we need to force the B53 MMAP DSA switch driver to use
bcm6368-mdio-mux for accessing the PHY registers instead of its own phy_read()
and phy_write() functions.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-21 19:36:16 +01:00
Álvaro Fernández Rojas
82ce340384 bmips: dts: fix switch compatible strings
Use the proper string for each SoC.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-20 19:55:24 +01:00
Álvaro Fernández Rojas
fff07085fb kernel: add pending bmips patches
Add patches sent upstream for bmips and b53 and remove downstream ones.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-20 19:51:53 +01:00
Álvaro Fernández Rojas
c2836c4d27 bmips: tweak Kconfig options
Add patch to reduce and improve selected bmips kernel config options.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-16 20:49:47 +01:00
Álvaro Fernández Rojas
9fc98b1956 bmips: irq-bcm6345-l1: register memory region
Add new patch sent upstream for requesting the memory region in the bcm6345-l1
interrupt controller.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-16 20:49:47 +01:00
Álvaro Fernández Rojas
8d0c254651 bmips: update patches sent upstream
Update bmips patches with the latest version sent upstream

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-16 20:49:47 +01:00
Álvaro Fernández Rojas
89390a9e50 bmips: dts: fix warnings
- Add missing interrupt-parent to ext_intc.
- Add missing #address-cells and #size-cells to gpio_cntl.
- Use proper gpio handle for gpios (ar-5315u).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-09 19:05:30 +01:00
Álvaro Fernández Rojas
2f8e90739a Revert "bmips: add missing switch cpu label"
This reverts commit dc0de05e10.
As pointed out by @BKPepe and @arinc9 this was removed by 9df035b since it
isn't needed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-05 11:53:52 +01:00
Álvaro Fernández Rojas
dc0de05e10 bmips: add missing switch cpu label
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-04 21:27:30 +01:00
Sieng-Piaw Liew
65ebe31130 bmips: check for DMA error when refilling Rx
dma_mapping_error() should be called as dma_map_single() could fail and
return error.

Signed-off-by: Sieng-Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng-Piaw Liew
a6a54135ef bmips: fix Tx cleanup when NAPI poll budget is zero
NAPI poll() function may be passed a budget value of zero, i.e. during
netpoll, which isn't NAPI context.
Therefore, napi_consume_skb() must be given budget value instead of
!force to truly discern netpoll-like scenarios.

https://lore.kernel.org/netdev/20220707141056.2644-1-liew.s.piaw@gmail.com/t/#m470f5c20225e76fb08c44d6cfa2f1b739ffaaea4
Signed-off-by: Sieng-Piaw Liew <liew.s.piaw@gmail.com>
[improve code format]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
cbc1fcf0e4 bmips: add BQL support
Add Byte Queue Limits support to reduce/remove bufferbloat.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
85d403a579 bmips: batch process eth_type_trans() in rx path
Improve cache efficiency by running eth_type_trans() in its own loop.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
686050b2b2 bmips: batch process rx path
Use netif_receive_skb_list() to batch process rx skb. This improves
cache efficiency.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
6276dad6ca bmips: improve rx loop
Use existing rx processed count to track against budget, thereby making
budget decrement operation redundant.
rx_desc_count can be calculated outside the rx loop, making the loop a
bit smaller.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
330cbcc09c bmips: switch to napi_build_skb() to reuse skbuff_heads
napi_build_skb() reuses NAPI skbuff_head cache in order to save some
cycles on freeing/allocating skbuff_heads on every new rx or completed
tx.
Use napi_consume_skb() to feed the cache with skbuff_heads of completed
tx so it's never empty.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
a332b8cc9c bmips: check NAPI context when refilling rx SKB
Check if we're in NAPI context when refilling rx. Normally we're almost
always running in NAPI context. Dispatch to napi_alloc_frag() directly
instead of relying on netdev_alloc_frag() which does the same but with
the overhead of local_bh_disable/enable.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
[improve code format]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
71ef4ec47c bmips: convert to build_skb()
We can increase the efficiency of rx path by using buffers to receive
packets then build SKBs around them just before passing into the network
stack. In contrast, preallocating SKBs too early reduces CPU cache
efficiency.
Performance is slightly increased but the changes allow more
potential optimizations.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
[improve code format]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-03-04 19:28:16 +01:00
Sieng Piaw Liew
7178adadcc bmips: use netdev_alloc_skb() for copybreak
bmips is using Broadcom B53 DSA driver which means the ethernet driver
must compensate for 6 bytes tags from the internal switch.
This means using NET_IP_ALIGN actually misaligns the skb, lowering
performance significantly. Therefore napi_alloc_skb() which uses
NET_IP_ALIGN is changed to netdev_alloc_skb().
Performance in iperf3 is increased from ~47Mbps to 52Mbps.

Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
2023-03-04 19:28:16 +01:00