summaryrefslogtreecommitdiff
path: root/drivers/net/rswitch.c
AgeCommit message (Collapse)Author
12 daysnet: rswitch: Remap CPU to bus addresses using dev_phys_to_bus()Marek Vasut
Use dev_phys_to_bus() to convert CPU addresses of DMA descriptors into bus addresses of DMA descriptors. This is necessary on hardware which does not have 1:1 mapping between CPU and memory addressed by the DMA. This has no impact on other hardware which does not need this conversion. Signed-off-by: Marek Vasut <[email protected]>
12 daysnet: rswitch: Avoid NULL pointer dereference during PHY accessMarek Vasut
At the very early stage when PHY ID is being auto-detected, the PHY device is not yet instantiated and rswitch_etha .phydev is still NULL. Add missing check for this condition and perform C22 fallback access in this PHY ID auto-detection case. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Add Renesas R-Car X5H Ethernet Switch3 supportMarek Vasut
Add support for the Renesas Ethernet Switch3 (RSW3) controller, present in R-Car Gen5 SoCs such as R-Car X5H (R8A78000). The hardware offset differences are handled via driver match data. The driver newly detects whether the switch prot is connected to xPCS or not, and if so, turns on MIOC bit 3. This is new on R-Car X5H. GWCKSC register is also programmed only on X5H. The rest of the operation is identical to RSwitch2. Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Tam Nguyen <[email protected]> Signed-off-by: Phong Hoang <[email protected]> Signed-off-by: Thanh Quan <[email protected]> Signed-off-by: Hai Pham <[email protected]>
2025-11-06net: rswitch: Parametrize MPIC_MDC_CLK_SET clock settingMarek Vasut
The MPIC_MDC_CLK clock setting value differs between R-Car S4 and R-Car X5H. Parametrize the value in preparation for R-Car X5H addition into this driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Parametrize GWDCBAC, FWPBFCSDC, CABPIRM register offsetsMarek Vasut
The GWDCBAC0, GWDCBAC1, FWPBFCSDC, CABPIRM register offsets changed between R-Car S4 and R-Car X5H. Parametrize their offsets in preparation for R-Car X5H addition into this driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Inline FWRO, CARO, GWRO, TARO, RMRO macrosMarek Vasut
Inline FWRO, CARO, GWRO, TARO, RMRO macros directly into the follow up register macros. FWRO, CARO, GWRO, TARO are already zero, drop them. RMRO is 0x1000, increment all registers which add RMRO by 0x1000 directly. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Parametrize forwarding engine CSD register offsetMarek Vasut
The forwarding engine CSD register offset changed between the R-Car S4 and R-Car X5H. Parametrize this offset in preparation for R-Car X5H addition into this driver. Clean up the macro parameter names and make them more obvious. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Parametrize port countMarek Vasut
The total port counts differ across variants of this IP in R-Car S4 and R-Car X5H. Parametrize port count in preparation for R-Car X5H addition into this driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Parametize COMA, ETHA, GWCA offsetsMarek Vasut
The COMA, ETHA, GWCA offsets differ across variants of this IP in R-Car S4 and R-Car X5H. Parametrize these offsets in preparation for R-Car X5H addition into this driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Add support for split MII and SerDesMarek Vasut
This IP does support operating MII and SerDes via different ports. Currently, the driver assumes that MII and SerDes are always bound together on the same port, but this may not be the case. Implement support for controlling MII and SerDes separately. While the change is extensive, the gist of the change is to pass pointer to the selected port registers to MII or SerDes functions, depending on which port and operations should be done on that port. Each combined ETHA instance contains both MII and SerDes register pointers, which may not point to the same port, and passes those registers to MII and SerDes functions respectively to control the MII or SerDes of each port. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Use bulk clock operationsMarek Vasut
The new version of RSwitch3 in Renesas R-Car Gen5 uses multiple clock to supply the IP. Convert the driver to bulk clock API to cater for both single clock of R-Car S4 and multiple clock of R-Car Gen5. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Initialize RX DMA descriptor .die_dt field to DT_FEMPTYMarek Vasut
Empty RX DMA descriptor must contain .die_dt field set to DT_FEMPTY, because hardware DMA overwrites this field to non-DT_FEMPTY when data are received, and the .recv callback tests the content of RX descriptor .die_dt field to determine whether hardware did receive any data and updated the .die_dt field, and based on that information, receives a packet or not. Fix the incorrect RX DMA descriptor initialization to assure the .recv callback always works correctly. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Drop unused macrosMarek Vasut
Remove macros which are not used in the driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-11-06net: rswitch: Switch indent from spaces to tabsMarek Vasut
Fix indent from multiple spaces to tabs, to be consistent with coding style and the rest of the driver. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2025-08-06net: rswitch: Fix error detectionAndrew Goodbody
In rswitch_probe the error detection after the call to devm_clk_get is very wrong. It checks the value of ret which is uninitialised at that point. Instead it should be using the macros for including errors into pointers. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]> Reviewed-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Implement C22 to C45 accessMarek Vasut
Add support for mapping C22 register access to C45-only PHYs. This is mainly useful for 'mii info' command, which performs C22 only access to determine PHY ID and link state and does not work well with this driver so far. Signed-off-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Add PHY C22 access supportMarek Vasut
Implement C22 PHY access support in addition to C45 PHY access support which is already present. This is used for PHYs which do not support C45 access or which are C22 only. The C22 access can be recognized when devad is set to -1 or 0xffffffff hex, which also matches MDIO_DEVAD_NONE macro. Test for this special devad value and if it is set this way, perform C22 access, otherwise perform C45 access. Based on work by LUU HOAI <[email protected]> Signed-off-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Fold MPSM C45 setting into rswitch_mii_access_c45()Marek Vasut
The Set Station Management Mode : Clause 45 setting of MFF bit in MPSM register can be done in rswitch_mii_access_c45() once, instead of this being done before each rswitch_mii_access_c45() call. Deduplicate the bit setting into rswitch_mii_access_c45(). No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Simplify code using clrsetbits_le32()Marek Vasut
Use clrsetbits_le32() to make this complicated construct simpler. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Fix up macro indentMarek Vasut
Update the macro indent, replace multiple spaces with tabs proper. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-12-29net: rswitch: Replace enum rswitch_reg with plain macrosMarek Vasut
Replace enum rswitch_reg with plain #define REGISTER OFFSET macros. The enum rswitch_reg was not referenced anywhere, so there was no benefit of keeping it around. Include register block labels. Turn all register offsets into lowercase hex values. No functional change. Rename EATDQDC to EATDQDCR, GWTRC to GWTRCR, GWDCC to GWDCCR, FWPC0 to FWPC, FWPBFC to FWPBFCR, FWPBFCSDC to FWPBFCSDCR because there are both register names which used to be part of this enum and also macros with the same name, each used for slightly different purpose. Make sure there is no collission. Signed-off-by: Marek Vasut <[email protected]>
2024-12-22net: rswitch: Do not register disabled ports as ethernet devicesMarek Vasut
In case an rswitch port is described as disabled in DT, do not register it as ethernet device in U-Boot. This way, such ports cannot be accessed from U-Boot command line. Signed-off-by: Marek Vasut <[email protected]>
2024-12-20net: rswitch: Add missing cache invalidate of TX descriptorMarek Vasut
TFTP transfers of large files, for example 128 MiB, can sporadically get stuck and the transfer slows down considerably. This happens because the TX DMA descriptor in DRAM becomes out of sync with the view of the TX DMA descriptor content from the CPU side, which is viewed through the CPU caches. In order to guarantee these two views are consistent, the cache over TX DMA descriptor that has possibly been written by the rswitch hardware must first be invalidated, only then can the descriptor be cleared and updated by the CPU, and finally the cache over that area must be flushed back into DRAM to make sure the rswitch hardware has consistent view of the updated descriptor content. The very first invalidation operation was missing, which led to sporadic corruption of the TX DMA descriptor. Fix it, add the missing invalidation operation. Reported-by: Enric Balletbo i Serra <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Tested-by: Enric Balletbo i Serra <[email protected]>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-05-07net: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini <[email protected]>
2023-04-16net: rswitch: Add Renesas Ethernet SwitchPhong Hoang
This patch adds Ethernet Switch support that found on R-Car S4 (r8a779f0) SoC. This is extracted from multiple patches from downstream BSP, with additional rework of the network device registration. Signed-off-by: Hai Pham <[email protected]> Signed-off-by: Marek Vasut <[email protected]> Signed-off-by: Phong Hoang <[email protected]> Signed-off-by: Takeshi Kihara <[email protected]> [Marek: Rework the driver to support all ports via subdrivers. Split the driver up, add generic PHY framework support. Generic code clean ups.] Reviewed-by: Ramon Fried <[email protected]>