summaryrefslogtreecommitdiff
path: root/drivers/net/fec_mxc.c
AgeCommit message (Collapse)Author
2026-02-17treewide: Clean up DECLARE_GLOBAL_DATA_PTR usagePeng Fan
Remove DECLARE_GLOBAL_DATA_PTR from files where gd is not used, and drop the unnecessary inclusion of asm/global_data.h. Headers should be included directly by the files that need them, rather than indirectly via global_data.h. Reviewed-by: Patrice Chotard <[email protected]> #STMicroelectronics boards and STM32MP1 ram test driver Tested-by: Anshul Dalal <[email protected]> #TI boards Acked-by: Yao Zi <[email protected]> #TH1520 Signed-off-by: Peng Fan <[email protected]>
2026-02-06net: fec_mxc: Add support for i.MX91Primoz Fiser
The i.MX91 SoC reuses the ENET FEC from i.MX93. Add all required driver checks to make it work also on the i.MX91 based platforms. Signed-off-by: Primoz Fiser <[email protected]>
2025-11-29net: fec_mxc.c: improve readability of dm_fec_bind_mdioMarkus Niebel
The last parameter to device_bind_driver_to_node is optional. Since the returned information is not used and overwritten by uclass_get_device_by_ofnode just provide NULL as parameter. Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: add unique bus and device names for DM_MDIOMarkus Niebel
When using DM_MDIO on SOC with more than one FEC and not sharing the MDIO bus the name of the driver and the bus needs to be unique. Since name used in device_bind_driver_to_node needs to be a static string, add the string to the fec_priv struct and reuse fec_set_dev_name to generate the name with the device sequence number. Fixes: 3b8f99a3e762 ("net: fec: add support for DM_MDIO") Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: fix usage of DM_MDIO and DM_ETH_PHYMarkus Niebel
If DM_ETH_PHY is used and the FEC instance owns the shared MDIO bus, eth_phy_get_mdio_bus returns NULL. If DM_MDIO bus is used, the mdio_register API is called from dm_mdio_post_probe. Therefore the bus should must be queried by name in this case. For DM_MDIO case fec_mii_setspeed has already being called in dm_fec_mdio_probe(), so skip setting this again. Fixes: 3b8f99a3e762 ("net: fec: add support for DM_MDIO") Fixes: e75d08821574 ("net: fec-mxc: prevent crash if no MAC address is set") Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: rewrite fallback MDIO Bus allocationMarkus Niebel
The code should only be executed if MDIO bus is not assigned. Otherwise the already assigned / allocated bus will be overwritten. Add condition check and simplify the code to make it more readable. Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: fix remove with DM_MDIOMarkus Niebel
If DM_MDIO is used and the FEC device is removed the mdio API must not be used to remove the bus structure. Store pointer the the udevice for MDIO bus created by dm_fec_bind_mdio and use DM functions to cleanup the device in fecmxc_remove. Fixes: 3b8f99a3e762 ("net: fec: add support for DM_MDIO") Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: fix probe of MDIO bus for DM_MDIOMarkus Niebel
When initializing the MDIO bus the MDC signal needs to be configured. Otherwise the communication over the bus may fail. Add the call to fec_mii_setspeed to the DM_MDIO probe handler. Fixes: 3b8f99a3e762 ("net: fec: add support for DM_MDIO") Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec-mxc: prevent crash if no MAC address is setMarkus Niebel
If no MAC address can be found (either in ROM, device tree or env), the post_probe of an ethernet device will fail and therefore the device cannot be instantiated. The DM_ETH_PHY (eth-phy-uclass) use case must not be mixed with using CONFIG_FEC_MXC_MDIO_BASE. This prevents following error for MAC not fused, no eth[1]addr env is present and providing a random MAC is disabled: Net: Error: ethernet@5b040000 address not set. Error: ethernet@5b040000 address not set. FEC: can't find phy-handle "Error" handler, esr 0xbf000002 elr: 000000008004e4b8 lr : 000000008004e4b4 (reloc) elr: 00000000bfe984b8 lr : 00000000bfe984b4 x0 : 0000000000000000 x1 : 0000000000000020 x2 : 00000000bbe61e50 x3 : 00000000bbe6e1a0 x4 : 0000000000000020 x5 : 0000000000000020 x6 : 000000000000000a x7 : 0000000000000000 x8 : 0000000000000000 x9 : 0000000000000008 x10: 00000000ffffffd8 x11: 0000000000000006 x12: 000000000001869f x13: 0000000000002c50 x14: 0000000000000000 x15: 00000000ffffffff x16: 0000000000000000 x17: 0000000000000000 x18: 00000000bbe61d98 x19: 00000000bbe4fa68 x20: 00000000bbe78c10 x21: 00000000bbe6e460 x22: 00000000bbe78c10 x23: 00000000bbe91780 x24: 00000000bbe6e510 x25: 00000000000001f8 x26: 00000000ffff8000 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000bbe4fa10 Code: f900003f 9100a3a1 97ffff6e 35000100 (f94017a1) Resetting CPU ... Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-11-29net: fec_mxc: respect return value of phy_configMarkus Niebel
phy_config may fail - for instance in parsing device tree. This should be handled correctly. So return errors from phy_config to caller. Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
2025-08-07net: fec_mxc: Set error code on error exitAndrew Goodbody
In fecmxc_probe if a timeout is detected when resetting the chip no error code is set before taking the error exit. This could lead to a silent failure. Instead set an error code. This issue was found by Smatch. Signed-off-by: Andrew Goodbody <[email protected]>
2024-12-23net: fec_mxc: add DM_FLAG_ACTIVE_DMA flag for FEC network driverMeng Li
When FEC network card works as the prime one in u-boot, and is in active status, kernel might crash during booting up stage, especially working with grub. Because the DMA of FEC is still in active status, and copy data into memory if there is network data received. In this case, if kernel allocated a part of memory that has overlay with the memory used by DMA, kernel memory may be destroyed and cause kernel crashes. Because before kernel boots up really, u-boot dm_remove_devices_flags() can call the remove callback of FEC driver with DM_FLAG_ACTIVE_DMA flag. In fecmxc_remove(), phy power is disabled, so there is no data received. In this way, it makes sure that there is no DMA action, so that avoid kernel crashing occurs. Signed-off-by: Meng Li <[email protected]>
2024-12-15net: fec: phy: Don't advertise Gbit on (R)MIIAlexander Sverdlin
Currently if a gigabit-capable PHY is connected to FEC via RMII or MII, it will advertise 1000FULL and 1000HALF to a link partner. Different problems may arise here: - usually with (R)MII between MAC and PHY the PHY's connection to magnetics would have only 2 pairs routed as well, otherwise a PHY can negotiate 1000 speed and there will be no traffic possible; - but even if there is no way to negotiate 1000 speed in HW (only 2 signal pairs routed), it may take a lot of time for PHY to figure this out; in case of AD1300 it takes 17-20 seconds, which is waay longer than default 4s PHY_ANEG_TIMEOUT. Use phy_set_supported() in such cases to disable gigabit advertised options. Signed-off-by: Alexander Sverdlin <[email protected]>
2024-11-25net: fec_mxc: fix probing for imx8qxpHeiko Schocher
probing on capricorn board (imx8qxp based) brings: Can't find FEC0 clk rate: -19 Cause is that when probing fec_mxc driver, fec_mii_setspeed() is called which calls fec_get_clk_rate(). fec_mii_setspeed() calls fec_get_clk_rate with NULL pointer for udev and so as in IMX8QXP case CLK_CCF is enabled udev gets searched with: uclass_get_device_by_seq(UCLASS_ETH, idx, &dev); but we do not have yet a UCLASS_ETH ! as we just probing it! Prevent this by passing udev to fec_get_clk_rate() Signed-off-by: Heiko Schocher <[email protected]>
2024-09-25Merge tag 'u-boot-imx-next-20240925' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx into next CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/22406 - i.MX93 FEC fixes. - Always name the generated fitImage u-boot.itb to keep compatibility with pr-buildman behavior. -----------------------
2024-09-24net: fec_mxc: Skip recv packet process when fec is haltedYe Li
After FEC is halted by calling fec_halt callback, we should not continue receiving packet. Otherwise it will process previous pending interrupts on EIR register and uses wrong rbd index as this has been reset to 0. The GRA interrupt which is triggered by issuing graceful stop command to FEC transmitter in fec_halt is processed in this case. It causes wrong receive buffer descriptors be used by FEC in next time. Signed-off-by: Ye Li <[email protected]> Reviewed-by: Peng Fan <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2024-09-24net: fec_mxc: Fix clk_ref rate on iMX93Peng Fan
i.MX93 FEC ENET port supports two mode: RGMII and RMII. For RGMII, there is an internal /2 divider, so the freq needs to set with (*2), otherwise the speed will not reach 1G and cause communication error in some network environments. For RMII, the clk path is ccm -> enet tx_clk pin -> pad loop back to enet, no /2 divider. So fix for RGMII mode with freq multiplied by 2. Fixes: 09de565f76b ("net: fec_mxc: support i.MX93") Signed-off-by: Ye Li <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2024-09-24net: fec_mxc_init(): do not ignore return status of fec_open()Jerome Forissier
The fec_mxc_init() function currently always returns 0. This does not allow the callers to detect when for instance the PHY initialization failed due to the port being unconnected. Fix that by returning the status of fec_open(). Signed-off-by: Jerome Forissier <[email protected]> Reviewed-by: Fabio Estevam <[email protected]> Reviewed-by: Peter Robinson <[email protected]> Reviewed-by: Ilias Apalodimas <[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]>
2024-03-30net: fec_mxc: Avoid enable regulator failureYe Li
Change to regulator_set_enable_if_allowed to avoid enable failure, in case same phy supply shared by multiple FEC controllers. Signed-off-by: Ye Li <[email protected]>
2023-03-30net: fec_mxc: Add board_interface_eth_init() for i.MX8M Mini/Nano/PlusMarek Vasut
Implement common board_interface_eth_init() and call it from the FEC driver to configure IOMUXC GPR[1] register according to the PHY mode obtained from DT. This supports all three interface modes supported by the i.MX8M Mini/Nano/Plus FEC and supersedes the current board-side configuration of the same IOMUX GPR[1] duplicated in the board files. Signed-off-by: Marek Vasut <[email protected]>
2023-03-30net: fec_mxc: Add ref clock setup support for i.MX8M Mini/Nano/PlusMarek Vasut
The FEC ref clock frequency on i.MX8M Mini/Nano/Plus was so far configured via ad-hoc board code. Replace that with DM clock clk_set_rate() instead. This way, the driver claims all its required clock and sets the ref clock rate, without any need of architecture specific register fiddling. Signed-off-by: Marek Vasut <[email protected]>
2023-02-10Correct SPL uses of IMX_MODULE_FUSESimon Glass
This converts 6 usages of this option to the non-SPL form, since there is no SPL_IMX_MODULE_FUSE defined in Kconfig Signed-off-by: Simon Glass <[email protected]>
2023-02-02net: fec: add support for DM_MDIOTim Harvey
Add support for DM_MDIO by registering a UCLASS_MDIO driver and attempting to use it. This is necessary if wanting to use a DSA driver for example hanging off of the FEC MAC. Care is taken to fallback to non DM_MDIO mii bus as several boards define DM_MDIO without having the proper device-tree configuration necessary such as an mdio subnode, a phy-mode prop, and either a valid phy-handle prop or fixed-phy subnode which will cause dm_eth_phy_connect() to fail. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Fabio Estevam <[email protected]>
2023-01-20global: Finish CONFIG -> CFG migrationTom Rini
At this point, the remaining places where we have a symbol that is defined as CONFIG_... are in fairly odd locations. While as much dead code has been removed as possible, some of these locations are simply less obvious at first. In other cases, this code is used, but was defined in such a way as to have been missed by earlier checks. Perform a rename of all such remaining symbols to be CFG_... rather than CONFIG_... Signed-off-by: Tom Rini <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2022-12-23global: Migrate CONFIG_FEC_MXC_PHYADDR to CFGTom Rini
Perform a simple rename of CONFIG_FEC_MXC_PHYADDR to CFG_FEC_MXC_PHYADDR Signed-off-by: Tom Rini <[email protected]>
2022-12-22fec_mxc: Remove CONFIG_FEC_FIXED_SPEED supportTom Rini
This option is only used on one platform currently. However, with PHYLIB enabled, which this platform also does, this option is not checked and the functional use case is handled. Remove this code. Signed-off-by: Tom Rini <[email protected]>
2022-12-05arm: Remove unused mx27 codeTom Rini
We no longer have any i.MX27 platforms, remove the remaining support code. Signed-off-by: Tom Rini <[email protected]>
2022-09-29dm: core: Drop ofnode_is_available()Simon Glass
This function is also available as ofnode_is_enabled(), so use that instead. Signed-off-by: Simon Glass <[email protected]>
2022-07-26net: fec_mxc: support i.MX93Peng Fan
Support i.MX93 in fec_mxc driver Reviewed-by: Ramon Fried <[email protected]> Signed-off-by: Peng Fan <[email protected]>
2022-04-10net: fec: prevent undesired de-assertion of phy-reset on requestTim Harvey
When gpio_request_by_name allocates a gpio output it by default will de-assert the gpio which for phy-reset will take the PHY out of reset. As this occurs before fec_gpio_reset is called to assert the reset line it can cause undesired affects if reset timings are not properly met. Configure the gpio with GPIOD_IS_OUT_ACTIVE so that reset is kept active (reset asserted) to avoid this. Cc: Sean Anderson <[email protected]> Signed-off-by: Tim Harvey <[email protected]> Acked-by: Joe Hershberger <[email protected]> Tested-by: Adam Ford <[email protected]> #imx8mm-beacon Reviewed-by: Ramon Fried <[email protected]>
2022-04-10treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NAMarek Behún
Rename constant PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA to make it compatible with Linux' naming. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Stefan Roese <[email protected]> Reviewed-by: Ramon Fried <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]>
2022-04-10net: introduce helpers to get PHY interface mode from a device/ofnodeMarek Behún
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property. Add corresponding UT test. Use them treewide. This allows us to inline the phy_get_interface_by_name() into ofnode_read_phy_mode(), since the former is not used anymore. Signed-off-by: Marek Behún <[email protected]> Reviewed-by: Ramon Fried <[email protected]> Tested-by: Patrice Chotard <[email protected]>
2022-03-18net: fec_mxc: Drop CONFIG_FEC_XCV_TYPETom Rini
With all boards now using DM_ETH we determine the value for CONFIG_FEC_XCV_TYPE at run time, except in the case of the default fall-back. Set the fallback directly now. Cc: Fabio Estevam <[email protected]> Cc: Ramon Fried <[email protected]> Cc: Stefano Babic <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2022-03-18net: fec_mxc: Remove non-DM_ETH codeTom Rini
Now that all boards have been converted, remove the non-DM_ETH code. Cc: Fabio Estevam <[email protected]> Cc: Ramon Fried <[email protected]> Cc: Stefano Babic <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <[email protected]>
2022-01-13drivers/net/fec_mxc.c: Fix spelling of "resetting".Vagrant Cascadian
2021-10-01arm: Remove zmx25 board and ARCH_MX25Tom Rini
This board has not been converted to CONFIG_DM by the deadline. Remove it. As this is the last ARCH_MX25 platform, remove those references as well. Cc: Matthias Weisser <[email protected]> Cc: Stefano Babic <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2021-08-09net: fec_mxc: support i.MX8ULPPeng Fan
Support i.MX8ULP in fec_mxc Signed-off-by: Peng Fan <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-07-10net: fec: add set_promisc functionTim Harvey
Enabling promiscuous mode is necessary if FEC is the master of a DSA switch driver where each port has their own MAC address. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-07-10net: fec: set phy_of_node properly for fixed-link phyTim Harvey
If the FEC is connected to a fixed-link (upstream switch port for example) the phy_of_node should be set to the fixed-link node so that speed and other properties can be found properly. In addition fix a typo in the debug string. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-07-10net: fec: use device sequence vs index when fetching fecTim Harvey
When using uclass_get_device* to get the FEC device we need to use device sequence instead of index into UCLASS_ETH. In systems where for example a I2C based DSA switch exists it will probe before the FEC master and its ports will be registered first and have the first indexes yet the FEC's sequence comes from the device-tree alias. Take for example the imx8mm-venice-gw7901 board which has an i2c based DSA switch: u-boot=> net list eth1 : lan1 00:0d:8d:aa:00:2f eth2 : lan2 00:0d:8d:aa:00:30 eth3 : lan3 00:0d:8d:aa:00:31 eth4 : lan4 00:0d:8d:aa:00:32 eth0 : ethernet@30be0000 00:0d:8d:aa:00:2e active Thus in this case uclass_get_device(UCLASS_ETH, 0, &dev) returns lan1 which is wrong but uclass_get_device_seq(UCLASS_ETH, 0, &dev) returns ethernet@30be000 which is correct. Signed-off-by: Tim Harvey <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-05-02net: fec: Only unregister MII bus if we registered itSean Anderson
If we fail to probe for whatever reason, we cannot unregister/free the MII bus unless we registered it with fec_get_miibus. This fixes FECs sharing an MDIO bus from destroying it, preventing the other FEC from using it. Fixes: 6a895d039b ("net: Update eQos driver and FEC driver to use eth phy interfaces") Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-05-02net: fec: Don't use disabled physSean Anderson
If a phy is disabled, don't use it. This matches Linux's behavior. Signed-off-by: Sean Anderson <[email protected]> Reviewed-by: Ramon Fried <[email protected]>
2021-02-02common: Drop asm/global_data.h from common headerSimon Glass
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2020-12-18dm: Avoid accessing seq directlySimon Glass
At present various drivers etc. access the device's 'seq' member directly. This makes it harder to change the meaning of that member. Change access to go through a function instead. The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass
This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <[email protected]>
2020-12-13dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass
Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <[email protected]>