On 02.08.21 11:09, Jan Kiszka via Xenomai wrote: > On 28.07.21 09:27, Jean-Baptiste Trédez via Xenomai wrote: >> Signed-off-by: Jean-Baptiste Trédez <jean-baptiste.tre...@ba-healthcare.com> >> >> ---------------------------------------- >> Content : >> >> net: fec: add phy_reset_after_clk_enable() support >> >> Some PHYs (for example the SMSC LAN8710/LAN8720) doesn't allow turning >> the refclk on and off again during operation (according to their >> datasheet). Nonetheless exactly this behaviour was introduced for power >> saving reasons by commit e8fcfcd5684a ("net: fec: optimize the clock >> management to save power"). >> Therefore add support for the phy_reset_after_clk_enable function from >> phylib to mitigate this issue. >> >> Generally speaking this issue is only relevant if the ref clk for the >> PHY is generated by the SoC and therefore the PHY is configured to >> "REF_CLK In Mode". In our specific case (PCB) this problem does occur at >> about every 10th to 50th POR of an LAN8710 connected to an i.MX6SOLO >> SoC. The typical symptom of this problem is a "swinging" ethernet link. >> Similar issues were reported by users of the NXP forum: >> https://community.nxp.com/thread/389902 >> https://community.nxp.com/message/309354 >> With this patch applied the issue didn't occur for at least a few >> hundret PORs of our board. >> >> Fixes: e8fcfcd5684a ("net: fec: optimize the clock management to save power") >> Signed-off-by: Richard Leitner <richard.leit...@skidata.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: add necessary defines to work on ARM64 >> >> The i.MX8 is a ARMv8 based SoC, that uses the same FEC IP as the >> earlier, ARMv7 based, i.MX SoCs. Allow the driver to work on ARM64. >> >> Signed-off-by: Lucas Stach <l.st...@pengutronix.de> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> drivers: net: Remove device_node checks with of_mdiobus_register() >> >> A number of drivers have the following pattern: >> >> if (np) >> of_mdiobus_register() >> else >> mdiobus_register() >> >> which the implementation of of_mdiobus_register() now takes care of. >> Remove that pattern in drivers that strictly adhere to it. >> >> Signed-off-by: Florian Fainelli <f.faine...@gmail.com> >> Reviewed-by: Grygorii Strashko <grygorii.stras...@ti.com> >> Reviewed-by: Fugang Duan <fugang.d...@nxp.com> >> Reviewed-by: Antoine Tenart <antoine.ten...@bootlin.com> >> Reviewed-by: Jose Abreu <joab...@synopsys.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: freescale: Allow FEC with COMPILE_TEST >> >> The Freescale FEC driver builds fine with COMPILE_TEST, so make that >> possible. >> >> Signed-off-by: Florian Fainelli <f.faine...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: Add a SPDX identifier >> >> Currently there is no license information in the header of >> this file. >> >> The MODULE_LICENSE field contains ("GPL"), which means >> GNU Public License v2 or later, so add a corresponding >> SPDX license identifier. >> >> Signed-off-by: Fabio Estevam <fabio.este...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: freescale: Use generic CRC32 implementation >> >> Use generic kernel CRC32 implementation because it: >> 1. Should be faster (uses lookup tables), >> 2. Removes duplicated CRC generation code, >> 3. Uses well-proven algorithm instead of coding it one more time. >> >> Suggested-by: Eric Biggers <ebigge...@gmail.com> >> Signed-off-by: Krzysztof Kozlowski <k...@kernel.org> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: check DMA addressing limitations >> >> Check DMA addressing limitations as suggested by the DMA API >> how-to. This does not fix a particular issue seen but is >> considered good style. >> >> Signed-off-by: Stefan Agner <ste...@agner.ch> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Reviewed-by: Robin Murphy <robin.mur...@arm.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: Use phy_set_max_speed() to limit advertised speed >> >> Many Ethernet MAC drivers want to limit the PHY to only advertise a >> maximum speed of 100Mbs or 1Gbps. Rather than using a mask, make use >> of the helper function phy_set_max_speed(). >> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: Add helper to remove a supported link mode >> >> Some MAC hardware cannot support a subset of link modes. e.g. often >> 1Gbps Full duplex is supported, but Half duplex is not. Add a helper >> to remove such a link mode. >> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: Add helper for MACs which support pause >> >> Rather than have the MAC drivers manipulate phydev members, add a >> helper function for MACs supporting Pause, but not Asym Pause. >> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: Add helper for set_pauseparam for Pause >> >> ethtool can be used to enable/disable pause. Add a helper to configure >> the PHY when Pause is supported. >> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> Reviewed-by: Florian Fainelli <f.faine...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: remove redundant null pointer check before of_node_put >> >> of_node_put has taken the null pointer check into account. So it is >> safe to remove the duplicated check before of_node_put. >> >> Signed-off-by: zhong jiang <zhongji...@huawei.com> >> Reviewed-by: Vladimir Zapolskiy <v...@mleia.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: don't dump RX FIFO register when not available >> >> Commit db65f35f50e0 ("net: fec: add support of ethtool get_regs") introduce >> ethool "--register-dump" interface to dump all FEC registers. >> >> But not all silicon implementations of the Freescale FEC hardware module >> have the FRBR (FIFO Receive Bound Register) and FRSR (FIFO Receive Start >> Register) register, so we should not be trying to dump them on those that >> don't. >> >> To fix it we create a quirk flag, FEC_QUIRK_HAS_RFREG, and check it before >> dump those RX FIFO registers. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: get regulator optional >> >> According to the device tree binding the phy-supply property is >> optional. Use the regulator_get_optional API accordingly. The >> code already handles NULL just fine. >> >> This gets rid of the following warning: >> fec 2188000.ethernet: 2188000.ethernet supply phy not found, using dummy >> regulator >> >> Signed-off-by: Stefan Agner <ste...@agner.ch> >> Reviewed-by: Marcel Ziswiler <marcel.ziswi...@toradex.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: freescale: set FEC ethtool regs version >> >> Currently the ethtool_regs version is set to 0 for FEC devices. >> >> Use this field to store the register dump version exposed by the >> kernel. The choosen version 2 corresponds to the kernel compile test: >> >> #if defined(CONFIG_M523x) || defined(CONFIG_M527x) >> || defined(CONFIG_M528x) || defined(CONFIG_M520x) >> || defined(CONFIG_M532x) || defined(CONFIG_ARM) >> || defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST) >> >> and version 1 corresponds to the opposite. Binaries of ethtool unaware >> of this version will dump the whole set as usual. >> >> Signed-off-by: Vivien Didelot <vivien.dide...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: manage ahb clock in runtime pm >> >> Some SOC like i.MX6SX clock have some limits: >> - ahb clock should be disabled before ipg. >> - ahb and ipg clocks are required for MAC MII bus. >> So, move the ahb clock to runtime management together with >> ipg clock. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: support of_get_mac_address new ERR_PTR error >> >> There was NVMEM support added to of_get_mac_address, so it could now >> return ERR_PTR encoded error values, so we need to adjust all current >> users of of_get_mac_address to this new fact. >> >> While at it, remove superfluous is_valid_ether_addr as the MAC address >> returned from of_get_mac_address is always valid and checked by >> is_valid_ether_addr anyway. >> >> Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") >> Signed-off-by: Petr Štetiar <yn...@true.cz> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: remove redundant ipg clock disable >> >> Don't disable the ipg clock in the regulator error path. The clock is >> disable unconditionally two lines below the failed_regulator label. >> >> Signed-off-by: Baruch Siach <bar...@tkos.co.il> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: fix the clk mismatch in failed_reset path >> >> Fix the clk mismatch in the error path "failed_reset" because >> below error path will disable clk_ahb and clk_ipg directly, it >> should use pm_runtime_put_noidle() instead of pm_runtime_put() >> to avoid to call runtime resume callback. >> >> Reported-by: Baruch Siach <bar...@tkos.co.il> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> Tested-by: Baruch Siach <bar...@tkos.co.il> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: Do not use netdev messages too early >> >> When a valid MAC address is not found the current messages >> are shown: >> >> fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC >> address: 00:00:00:00:00:00 >> fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC >> address: aa:9f:25:eb:7e:aa >> >> Since the network device has not been registered at this point, it is better >> to use dev_err()/dev_info() instead, which will provide cleaner log >> messages like these: >> >> fec 2188000.ethernet: Invalid MAC address: 00:00:00:00:00:00 >> fec 2188000.ethernet: Using random MAC address: aa:9f:25:eb:7e:aa >> >> Tested on a imx6dl-pico-pi board. >> >> Signed-off-by: Fabio Estevam <feste...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec_main: Use dev_err() instead of pr_err() >> >> dev_err() is more appropriate for printing error messages inside >> drivers, so switch to dev_err(). >> >> Signed-off-by: Fabio Estevam <feste...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> ethernet: remove redundant memset >> >> kvzalloc already zeroes the memory during the allocation. >> pci_alloc_consistent calls dma_alloc_coherent directly. >> In commit 518a2f1925c3 >> ("dma-mapping: zero memory returned from dma_alloc_*"), >> dma_alloc_coherent has already zeroed the memory. >> So the memset after these function is not needed. >> >> Signed-off-by: Fuqian Huang <huangfq.dax...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: Use skb accessors in network drivers >> >> In preparation for unifying the skb_frag and bio_vec, use the fine >> accessors which already exist and use skb_frag_t instead of >> struct skb_frag_struct. >> >> Signed-off-by: Matthew Wilcox (Oracle) <wi...@infradead.org> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: use devm_platform_ioremap_resource() to simplify code >> >> Use devm_platform_ioremap_resource() to simplify the code a bit. >> This is detected by coccinelle. >> >> Reported-by: Hulk Robot <hul...@huawei.com> >> Signed-off-by: YueHaibing <yuehaib...@huawei.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: add C45 MDIO read/write support >> >> IEEE 802.3ae clause 45 defines a modified MDIO protocol that uses a two >> staged access model in order to increase the address space. >> >> This patch adds support for C45 MDIO read and write accesses, which are >> used whenever the MII_ADDR_C45 flag in the regnum argument is set. >> In case it is not set, C22 accesses are used as before. >> >> Signed-off-by: Marco Hartmann <marco.hartm...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: remove redundant assignment to pointer bdp >> >> The pointer bdp is being assigned with a value that is never >> read, so the assignment is redundant and hence can be removed. >> >> Addresses-Coverity: ("Unused value") >> Signed-off-by: Colin Ian King <colin.k...@canonical.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: Let fec_ptp have its own interrupt routine >> >> This is better for code locality and should slightly >> speed up normal interrupts. >> >> This also allows PPS clock output to start working for >> i.mx7. This is because i.mx7 was already using the limit >> of 3 interrupts, and needed another. >> >> Signed-off-by: Troy Kisky <troy.ki...@boundarydevices.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: remove stale comment >> >> This comment is outdated as fec_ptp_ioctl has been replaced by >> fec_ptp_set/fec_ptp_get >> since commit 1d5244d0e43b ("fec: Implement the SIOCGHWTSTAMP ioctl") >> >> Signed-off-by: YueHaibing <yuehaib...@huawei.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: ptp: Switch to SPDX identifier >> >> Adopt the SPDX license identifier headers to ease license compliance >> management. >> >> Signed-off-by: Fabio Estevam <fabio.este...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: remove redundant variable 'inc' >> >> Variable 'inc' is being assigned but is never used hence it is >> redundant and can be removed. >> >> Cleans up clang warning: >> warning: variable 'inc' set but not used [-Wunused-but-set-variable] >> >> Signed-off-by: Colin Ian King <colin.k...@canonical.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec_ptp: Use dev_err() instead of pr_err() >> >> dev_err() is more appropriate for printing error messages inside >> drivers, so switch to dev_err(). >> >> Signed-off-by: Fabio Estevam <feste...@gmail.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec_ptp: Use platform_get_irq_xxx_optional() to avoid error message >> >> Use platform_get_irq_byname_optional() and platform_get_irq_optional() >> instead of platform_get_irq_byname() and platform_get_irq() for optional >> IRQs to avoid below error message during probe: >> >> [ 0.795803] fec 30be0000.ethernet: IRQ pps not found >> [ 0.800787] fec 30be0000.ethernet: IRQ index 3 not found >> >> Signed-off-by: Anson Huang <anson.hu...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Reviewed-by: Stephen Boyd <swb...@chromium.org> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: ethernet: freescale: fix false-positive string overflow warning >> >> While compile-testing on arm64 with gcc-8.1, I ran into a build diagnostic: >> >> kernel/drivers/net/drivers/freescale/fec_main.c: In function 'fec_probe': >> kernel/drivers/net/drivers/freescale/fec_main.c:3517:25: error: '%d' >> directive writing between 1 and 10 bytes into a region of size 5 >> [-Werror=format-overflow=] >> sprintf(irq_name, "int%d", i); >> ^~ >> kernel/drivers/net/drivers/freescale/fec_main.c:3517:21: note: directive >> argument in the range [0, 2147483646] >> sprintf(irq_name, "int%d", i); >> ^~~~~~~ >> kernel/drivers/net/drivers/freescale/fec_main.c:3517:3: note: 'sprintf' >> output between 5 and 14 bytes into a destination of size 8 >> sprintf(irq_name, "int%d", i); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> It appears this has never shown on ppc32 or arm32 for an unknown reason, but >> now gcc fails to identify that the 'irq_cnt' loop index has an upper bound >> of 3, and instead uses a bogus range. >> >> To work around the warning, this changes the sprintf to snprintf with the >> correct buffer length. >> >> Fixes: 78cc6e7ef957 ("net: ethernet: freescale: Allow FEC with COMPILE_TEST") >> Signed-off-by: Arnd Bergmann <a...@arndb.de> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec_main: Use platform_get_irq_byname_optional() to avoid error message >> >> Failed to get irq using name is NOT fatal as driver will use index >> to get irq instead, use platform_get_irq_byname_optional() instead >> of platform_get_irq_byname() to avoid below error message during >> probe: >> >> [ 0.819312] fec 30be0000.ethernet: IRQ int0 not found >> [ 0.824433] fec 30be0000.ethernet: IRQ int1 not found >> [ 0.829539] fec 30be0000.ethernet: IRQ int2 not found >> >> Signed-off-by: Anson Huang <anson.hu...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Reviewed-by: Stephen Boyd <swb...@chromium.org> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: add missed clk_disable_unprepare in remove >> >> This driver forgets to disable and unprepare clks when remove. >> Add calls to clk_disable_unprepare to fix it. >> >> Signed-off-by: Chuhong Yuan <hsleste...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: fix clock count mis-match >> >> pm_runtime_put_autosuspend in probe will call runtime suspend to >> disable clks automatically if CONFIG_PM is defined. (If CONFIG_PM >> is not defined, its implementation will be empty, then runtime >> suspend will not be called.) >> >> Therefore, we can call pm_runtime_get_sync to runtime resume it >> first to enable clks, which matches the runtime suspend. (Only when >> CONFIG_PM is defined, otherwise pm_runtime_get_sync will also be >> empty, then runtime resume will not be called.) >> >> Then it is fine to disable clks without causing clock count mis-match. >> >> Fixes: c43eab3eddb4 ("net: fec: add missed clk_disable_unprepare in remove") >> Signed-off-by: Chuhong Yuan <hsleste...@gmail.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: freescale: fec: Fix ethtool -d runtime PM >> >> In order to dump the FECs registers the clocks have to be ticking, >> otherwise a data abort occurs. Add calls to runtime PM so they are >> enabled and later disabled. >> >> Fixes: e8fcfcd5684a ("net: fec: optimize the clock management to save power") >> Reported-by: Chris Healy <chris.he...@zii.aero> >> Signed-off-by: Andrew Lunn <and...@lunn.ch> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: validate the new settings in fec_enet_set_coalesce() >> >> [ Upstream commit ab14961d10d02d20767612c78ce148f6eb85bd58 ] >> >> fec_enet_set_coalesce() validates the previously set params >> and if they are within range proceeds to apply the new ones. >> The new ones, however, are not validated. This seems backwards, >> probably a copy-paste error? >> >> Compile tested only. >> >> Fixes: d851b47b22fc ("net: fec: add interrupt coalescence feature support") >> Signed-off-by: Jakub Kicinski <k...@kernel.org> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org> >> >> ---------- >> >> net: fec: add imx8mq and imx8qm new versions support >> >> The ENET of imx8mq and imx8qm are basically the same as imx6sx, >> but they have new features support based on imx6sx, like: >> - imx8mq: supports IEEE 802.3az EEE standard. >> - imx8qm: supports RGMII mode delayed clock. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> net: fec: add stop mode support for imx8 platform >> >> The current driver support stop mode by calling machine api. >> The patch add dts support to set gpr register for stop request. >> >> imx8mq enter stop/exit stop mode by setting GPR bit, which can >> be accessed by A core. >> imx8qm enter stop/exit stop mode by calling IMX_SC ipc APIs that >> communicate with M core ipc service, and the M core set the related >> GPR bit at last. >> >> After magic pattern coming during system suspend status, system will >> be waked up, and irq handler will be called, then registers access >> cause system hang due to clocks are off. So disable wake up irq in >> .suspend(), and enable it in .resume(). >> >> Signed-off-by: Fugang Duan <b38...@freescale.com> >> >> ---------- >> >> MLK-16782 net: fec: double check the mii interrupt status >> >> Double check the mii interrupt status during mdio bus accessing >> to avoid interrupt lost in timeout case. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> net: fec: update scu ctrl name >> >> The scu ctrl name is updated, so update driver accordingly >> >> Signed-off-by: Dong Aisheng <aisheng.d...@nxp.com> >> >> ---------- >> >> net: fec: avoid imx_sc_misc_set_control() is called at atomic context >> >> Avoid SCU interface like imx_sc_misc_set_control() is called at >> atomic context. >> >> Signed-off-by: Fugang Duan <b38...@freescale.com> >> >> ---------- >> >> net: fec: fix the typo for the property string "fsl,wakeup_irq" >> >> Fix the typo for the property string "fsl,wakeup_irq". >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> MLK-23687-01 net: fec: add stop mode support for imx8dxl >> >> Enable stop mode for imx8dxl. >> >> Reviewed-by: Joakim Zhang <qiangqing.zh...@nxp.com> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> MLK-24341 net: fec: fix the uninitialized variable in fec_resume() >> >> Coverity reprot: CID = 6473151 >> The variable will contain an arbitrary value left from earlier computations. >> In fec_resume, it uses of an uninitialized variable. >> >> Reviewed-by: Richard Zhu <hongxing....@nxp.com> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> net: fec: correct the error path for regulator disable in probe >> >> [ Upstream commit c6165cf0dbb82ded90163dce3ac183fc7a913dc4 ] >> >> Correct the error path for regulator disable. >> >> Fixes: 9269e5560b26 ("net: fec: add phy-reset-gpios PROBE_DEFER check") >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> Signed-off-by: Sasha Levin <sas...@kernel.org> >> >> ---------- >> >> MLK-20190-01 ptp: fec: add clock rate zero check >> >> Add clock rate zero check to fixes coverity issue of "divide by 0". >> >> Reviewed-by: Haibo Chen <haibo.c...@nxp.com> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadi...@mentor.com> >> >> ---------- >> >> net: fec: change the default rx copybreak value to maximum >> >> Set the default rx copybreak value to maximum that can improve >> the performance when SMMU is enabled. User can change the copybreak >> vaule in dynamically by ethtool. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> net: fec: add defer probe for of_get_mac_address >> >> If MAC address read from nvmem efuse by calling .of_get_mac_address(), >> but nvmem efuse is registerred later than the driver, then it >> return -EPROBE_DEFER value. So modify the driver to support >> defer probe when read MAC address from nvmem efuse. >> >> Updates for v2: >> avoid memory leak that the queues allocated by fec_enet_alloc_queue(). >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> >> ---------- >> >> MLK-9786 net: fec: Add busfreq support to the driver >> >> Add request_bus_freq() and release_bus_freq() calls to the >> various drivers to ensure that the DDR and AHB are the requested >> frequency before the driver starts its task. >> >> Signed-off-by: Fugang Duan <b38...@freescale.com> >> Signed-off-by: Vipul Kumar <vipul_ku...@mentor.com> >> Signed-off-by: Leonard Crestez <leonard.cres...@nxp.com> >> >> ---------- >> >> net: fec: Fix keeping busfreq high on probe defer >> >> Add release_bus_freq on probe exit path. >> >> This was exposed by commit 95ea0158b3fe ("net: fec: add defer probe for >> of_get_mac_address") >> >> Signed-off-by: Leonard Crestez <leonard.cres...@nxp.com> >> Acked-by: Fugang Duan <fugang.d...@nxp.com> >> Fixes: fed31bc87f36 ("MLK-9786 net: fec: Add busfreq support to the driver") >> >> ---------- >> >> net: fec: remove workaround to restart phylib state machine on MDIO timeout >> >> There's a workaround to restart the phylib state machine in case of a >> MDIO access timeout. Seems it was introduced to deal with the >> consequences of a too small MDIO timeout. See also commit message of >> c3b084c24c8a ("net: fec: Adjust ENET MDIO timeouts") which increased >> the timeout value later. Due to the later timeout value fix it seems >> to be safe to remove the workaround. >> >> Signed-off-by: Heiner Kallweit <hkallwe...@gmail.com> >> Signed-off-by: David S. Miller <da...@davemloft.net> >> >> ---------- >> >> net: fec: fix the potential memory leak in fec_enet_init() >> >> If the memory allocated for cbd_base is failed, it should >> free the memory allocated for the queues, otherwise it causes >> memory leak. >> >> And if the memory allocated for the queues is failed, it can >> return error directly. >> >> Signed-off-by: Fugang Duan <fugang.d...@nxp.com> >> --- >> kernel/drivers/net/drivers/freescale/fec.h | 42 +- >> .../drivers/net/drivers/freescale/fec_main.c | 534 +++++++++++++----- >> .../drivers/net/drivers/freescale/fec_ptp.c | 110 ++-- >> 3 files changed, 499 insertions(+), 187 deletions(-) >> >> diff --git a/kernel/drivers/net/drivers/freescale/fec.h >> b/kernel/drivers/net/drivers/freescale/fec.h >> index 185aa6463..5ab51701d 100644 >> --- a/kernel/drivers/net/drivers/freescale/fec.h >> +++ b/kernel/drivers/net/drivers/freescale/fec.h >> @@ -20,8 +20,14 @@ >> #include <linux/timecounter.h> >> #include <rtnet_port.h> >> >> +#ifdef CONFIG_IMX_SCU_SOC >> +#include <dt-bindings/firmware/imx/rsrc.h> >> +#include <linux/firmware/imx/sci.h> >> +#endif >> + >> #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) >> || \ >> - defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) >> + defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) >> || \ >> + defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST) >> /* >> * Just figures, Motorola would have to change the offsets for >> * registers in the same peripheral device on different models >> @@ -196,7 +202,7 @@ >> * Evidently, ARM SoCs have the FEC block generated in a >> * little endian mode so adjust endianness accordingly. >> */ >> -#if defined(CONFIG_ARM) >> +#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) >> #define fec32_to_cpu le32_to_cpu >> #define fec16_to_cpu le16_to_cpu >> #define cpu_to_fec32 cpu_to_le32 >> @@ -452,6 +458,27 @@ struct bufdesc_ex { >> * initialisation. >> */ >> #define FEC_QUIRK_MIB_CLEAR (1 << 15) >> +/* Only i.MX25/i.MX27/i.MX28 controller supports FRBR,FRSR registers, >> + * those FIFO receive registers are resolved in other platforms. >> + */ >> +#define FEC_QUIRK_HAS_FRREG (1 << 16) >> +/* i.MX8MQ ENET IP version add new feature to support IEEE 802.3az EEE >> + * standard. For the transmission, MAC supply two user registers to set >> + * Sleep (TS) and Wake (TW) time. >> + */ >> +#define FEC_QUIRK_HAS_EEE (1 << 17) >> +/* i.MX8QM ENET IP version add new feture to generate delayed TXC/RXC >> + * as an alternative option to make sure it works well with various PHYs. >> + * For the implementation of delayed clock, ENET takes synchronized 250MHz >> + * clocks to generate 2ns delay. >> + */ >> +#define FEC_QUIRK_DELAYED_CLKS_SUPPORT (1 << 18) >> + >> +struct fec_enet_stop_mode { >> + struct regmap *gpr; >> + u8 req_gpr; >> + u8 req_bit; >> +}; >> >> struct bufdesc_prop { >> int qid; >> @@ -541,7 +568,6 @@ struct fec_enet_private { >> >> /* Phylib and MDIO interface */ >> struct mii_bus *mii_bus; >> - int mii_timeout; >> uint phy_speed; >> phy_interface_t phy_interface; >> struct device_node *phy_node; >> @@ -554,6 +580,7 @@ struct fec_enet_private { >> bool bufdesc_ex; >> int pause_flag; >> int wol_flag; >> + int wake_irq; >> u32 quirks; >> >> struct napi_struct napi; >> @@ -596,15 +623,20 @@ struct fec_enet_private { >> int pps_enable; >> unsigned int next_counter; >> >> + /* stop mode */ >> + struct fec_enet_stop_mode lpm; >> +#ifdef CONFIG_IMX_SCU_SOC >> + struct imx_sc_ipc *ipc_handle; >> +#endif >> + >> u64 ethtool_stats[0]; >> }; >> >> -void fec_ptp_init(struct platform_device *pdev); >> +void fec_ptp_init(struct platform_device *pdev, int irq_idx); >> void fec_ptp_stop(struct platform_device *pdev); >> void fec_ptp_start_cyclecounter(struct net_device *ndev); >> int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr); >> int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr); >> -uint fec_ptp_check_pps_event(struct fec_enet_private *fep); >> >> >> /****************************************************************************/ >> #endif /* FEC_H */ >> diff --git a/kernel/drivers/net/drivers/freescale/fec_main.c >> b/kernel/drivers/net/drivers/freescale/fec_main.c >> index 08956dfab..0fc754e63 100644 >> --- a/kernel/drivers/net/drivers/freescale/fec_main.c >> +++ b/kernel/drivers/net/drivers/freescale/fec_main.c >> @@ -1,3 +1,4 @@ >> +// SPDX-License-Identifier: GPL-2.0+ >> /* >> * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. >> * Copyright (c) 1997 Dan Malek (dma...@jlc.net) >> @@ -47,6 +48,7 @@ >> #include <linux/io.h> >> #include <linux/irq.h> >> #include <linux/clk.h> >> +#include <linux/crc32.h> >> #include <linux/platform_device.h> >> #include <linux/mdio.h> >> #include <linux/phy.h> >> @@ -59,8 +61,12 @@ >> #include <linux/regulator/consumer.h> >> #include <linux/if_vlan.h> >> #include <linux/pinctrl/consumer.h> >> +#include <linux/pm_runtime.h> >> +#include <linux/busfreq-imx.h> > > This is downstream stuff from linux-imx, breaking the build. I'm > dropping this patch. > > Please base on upstream or account for the still (sigh...) missing bits > there so that we can use things against normal kernels. >
Unfortunately, just pulling this patch does not help. I will have to remove more. Patch 1 and 2 should be safe, though. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux