summaryrefslogtreecommitdiff
path: root/drivers/net/ksz9477.c
AgeCommit message (Collapse)Author
2024-10-27net: ksz9477: add support for KSZ GbE switches using SPI busRomain Naour
The Microchip KSZ Gigabit Ethernet Switches support SGMII/RGMII/MII/RMII with register access via SPI, I2C, or MDIO. Since this driver is now able to check the underlying bus type, handle the case when the SPI bus is used. The SPI bus is only used for 8/16/32 wide access of registers. Reword Kconfig option to include SPI bus support. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: prepare ksz9477 without I2C supportRomain Naour
With the upcoming ksz9477 SPI support added, the I2C support will be optional. Either the I2C or the SPI bus will be used. For now, DM_I2C is still mandatory. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: rename ksz_i2c_probe() to ksz_probe()Romain Naour
In order to support management bus other than the I2C, rename ksz_i2c_probe() to ksz_probe() since this function is no longer specific to the I2C bus. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: store ksz bus operations functionsRomain Naour
The ksz9477 Linux kernel driver is based on regmap API to seamlessly communicate to switch devices connected via different buses like SPI or I2C. The current regmap implementation in U-Boot only supports memory-mapped registers access [1]. Until regmap API with bus support is available in U-boot, introduce struct ksz_phy_ops to store low-level ksz bus operations (I2C for now). [1] https://lists.denx.de/pipermail/u-boot/2018-May/329392.html Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: set i2c bus offset length only when neededRomain Naour
In order to add ksz9477 SPI bus support, check parent bus is an I2C bus before calling i2c_set_offset_len(). Doing so, ksz_i2c_probe() will now return an error (-EINVAL) if the parent bus is not the one expected by the ksz-switch u-boot driver. Indeed, the DSA KSZ devicetree binding doesn't specify anything about the underlying bus between the SoC and the DSA switch, so the same "compatible" string can be used wathever the management interface used (SPI or I2C). The ksz-switch u-boot driver currently only support I2C interface but will match a compatible "microchip,ksz9xxx" located under under an SPI bus node. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: rename udevice_id tab to ksz_idsRomain Naour
The DSA KSZ devicetree binding doesn't specify anything about the underlying bus between the SoC and the DSA switch, so the same "compatible" string can be used wathever the management interface used. The driver must be able to access the underlying bus without any help from the compatible string (like for TPM2 TIS devices). So, rename udevice_id tab to ksz_ids since it's not specific to i2c bus. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: add KSZ9896 switch supportRomain Naour
Add support for the KSZ9896 6-port Gigabit Ethernet Switch to the ksz9477 driver. The KSZ9896 is similar to KSZ9897 but has only one configurable MII/RMII/RGMII/GMII cpu port. Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: remove dev_set_parent_priv() callRomain Naour
The ksz9477 is currently the only driver using dev_set_parent_priv() outside of the driver model. Also, there was no explanation in the commit adding ksz9477 driver and why dev_set_parent_priv() is required. Actually there is a typo in ksz_mdio_probe() while retrieving the parent (switch@0) private data: - priv->ksz = dev_get_parent_priv(dev->parent); + priv->ksz = dev_get_priv(dev->parent); Printing the address of struct ksz_dsa_priv *priv allows to notice the slight difference: ksz_i2c_probe: ksz_dsa_priv *priv 0xfdf45768 // address of the saved priv ksz_mdio_bind: ksz_dsa_priv *priv 0xfdf45798 // address returned by dev_get_parent_priv(dev->parent) ksz_mdio_bind: ksz_dsa_priv *priv 0xfdf45768 // address returned by dev_get_priv(dev->parent) The ksz_mdio driver get the wrong data and without dev_set_parent_priv() the mdio driver fail to access the underlying bus. While it doesn't cause any issue with I2C bus, it override the per-child data used by the SPI bus (struct spi_slave) and prevent further bus access (even with sspi command). Signed-off-by: Romain Naour <[email protected]>
2024-10-27net: ksz9477: move struct ksz_dsa_priv *priv declarationRomain Naour
struct ksz_dsa_priv *priv should be declared before dev_dbg() Signed-off-by: Romain Naour <[email protected]>
2023-07-27net: ksz9477: add support for KSZ9893 GbE switchKarsten Wiese
Copy and tweak the required code from the linux kernel. Only the KSZ9893 has been tested. Signed-off-by: Karsten Wiese <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2023-05-05net: ksz9477: add port_probe function to config phyTim Harvey
Add a port_probe function to configure the phy. This leads to earlier link negotiation so the port is more likely to be ready when used. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2023-05-05net: ksz9477: remove unnecessary variableTim Harvey
We don't do anything useful with the master dev, so remove the variable. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2023-05-05net: ksz9477: remove unnecessary dsa_set_tagging callTim Harvey
packet tagging is not used for this driver so we do not need to call dsa_set_tagging. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2023-02-02net: ksz9477: remove unnecessary xmit and recv functionsTim Harvey
Remove the unnecessary xmit and recv functions. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Reviewed-by: Fabio Estevam <[email protected]>
2021-07-10net: add support for KSZ9477/KSZ9897/KSZ9567 GbE switchTim Harvey
The Microchip KSZ9477/KSZ9897/KSZ9567 7-Port Gigabit Ethernet Switches support SGMII/RGMII/MII/RMII with register access via SPI, I2C, or MDIO. This driver currently supports I2C register access but SPI or MDIO register access can be easily added at a later time. Tagging is not implemented and instead the active port is tracked to avoid needing a tag to store port information. This was tested with the imx8mm-venice-gw7901 board which has a KSZ9897S switch with an IMX8MM FEC MAC master connected via RGMII_ID. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>