summaryrefslogtreecommitdiffstats
path: root/drivers/net/designware_eqos.h
Commit message (Collapse)AuthorAgeFilesLines
* net: designware: eqos: fix NULL pointer dereference on LLDP packetsOleksij Rempel2023-08-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If promisc mode is enabled (which is enabled for DSA switches by default) a LLDP frame received by barebox will trigger following panic: DABT (current EL) exception (ESR 0x9600014b) at 0x0000000000000000 elr: 00000000bfd967d8 lr : 00000000bfd963e0 x0 : 0000000000000000 x1 : 00000000000000e9 x2 : 0000000000000040 x3 : 000000000000003f x4 : 0000000000000000 x5 : 00000000000001a0 x6 : 0000000000000005 x7 : 0000000030200000 x8 : 000000007feda6a8 x9 : 0000000000000000 x10: 0000000000000000 x11: 00000000fffffffa x12: 00000000fffffffa x13: 0000000000000020 x14: 0000000000000000 x15: 0000000000000001 x16: 00000000bfff74c8 x17: 0000000000000001 x18: 00000000bfff7a60 x19: 000000007fee20c0 x20: 0000000000000000 x21: 000000007fee0dc8 x22: 000000007fee0dc8 x23: 00000000000000ea x24: 0000000000000080 x25: 0000000000000000 x26: 00000000000000ea x27: 000000007fee2040 x28: 0000000000000000 x29: 00000000bfff7a60 Call trace: [<bfd967d8>] (v8_inv_dcache_range+0x1c/0x34) from [<bfd953fc>] (arch_sync_dma_for_cpu+0x14/0x20) [<bfd953fc>] (arch_sync_dma_for_cpu+0x14/0x20) from [<bfd25a64>] (eqos_recv+0x78/0x104) [<bfd25a64>] (eqos_recv+0x78/0x104) from [<bfd80724>] (eth_rx+0xd0/0x160) [<bfd80724>] (eth_rx+0xd0/0x160) from [<bfd80b84>] (net_poll+0x24/0x34) [<bfd80b84>] (net_poll+0x24/0x34) from [<bfd80bbc>] (__net_poll+0x28/0x3c) [<bfd80bbc>] (__net_poll+0x28/0x3c) from [<bfd0ec7c>] (poller_call+0x58/0x68) [<bfd0ec7c>] (poller_call+0x58/0x68) from [<bfd0ea98>] (resched+0x38/0x48) [<bfd0ea98>] (resched+0x38/0x48) from [<bfd77be0>] (readline+0xb4/0x89c) [<bfd77be0>] (readline+0xb4/0x89c) from [<bfd0f17c>] (file_get+0x94/0x1d8) [<bfd0f17c>] (file_get+0x94/0x1d8) from [<bfd0f92c>] (parse_stream.constprop.0+0x40/0x534) [<bfd0f92c>] (parse_stream.constprop.0+0x40/0x534) from [<bfd0ff10>] (parse_stream_outer+0xf0/0x1ec) [<bfd0ff10>] (parse_stream_outer+0xf0/0x1ec) from [<bfd10e0c>] (run_shell+0x60/0x98) [<bfd10e0c>] (run_shell+0x60/0x98) from [<bfd01854>] (run_init+0x170/0x2b0) [<bfd01854>] (run_init+0x170/0x2b0) from [<bfd019e4>] (start_barebox+0x50/0x8c) [<bfd019e4>] (start_barebox+0x50/0x8c) from [<bfd95794>] (barebox_non_pbl_start+0x11c/0x150) [<bfd95794>] (barebox_non_pbl_start+0x11c/0x150) from [<bfd0000c>] (__bare_init_start+0x0/0x4) [<bfd0000c>] (__bare_init_start+0x0/0x4) from [<402041fc>] (0x402041fc) [<402041fc>] (0x402041fc) from [<40203bac>] (0x40203bac) panic: unhandled exception This issue can be reproduced by using following command and link partner: mausezahn enp1s0f1 01:80:c2:00:00:0e:08:60:6e:1f:a3:9c:88:cc The problem caused this issue is wrong or may be different (depending on the HW) interpretation of DMA RX buffers. The DMA descriptors have distinct formats depending on their direction: Read Format for CPU-to-DMA and Write-Back Format for DMA-to-CPU. Previously, the driver did not distinguish between these, leading to misinterpretations of the descriptor fields. For example the driver expected a DMA buffer pointer in the Write-Back desc0 which is actually a VLAN tag descriptor and contains artifacts of DMA buffer pointer only by accident. To fix it we should store DMA buffer pointers in a separate array and use them. To prevent more of misunderstandings, i renamed variables to make it visible what format of DMA buffer we actually using. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20230814053229.2311097-5-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: designware: eqos: fix non-working promisc mode when set before ↵Oleksij Rempel2023-08-141-0/+3
| | | | | | | | | | | | | | | interface start Promisc mode is not working if set before starting interface. This seen more with DSA switch driver when having many interfaces and different MACs. Make promisc mode work by saving configs before soft reset, then use them after reset. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.barebox.org/20230814053229.2311097-3-o.rempel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Rename struct device_d to deviceSascha Hauer2023-01-101-4/+4
| | | | | | | | | | | | | The '_d' suffix was originally introduced in case we want to import Linux struct device as a separate struct into barebox. Over time it became clear that this won't happen, instead barebox struct device_d is basically the same as Linux struct device. Rename the struct name accordingly to make porting Linux code easier. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: designware: eqos: remove undefined eqos_reset prototypeAhmad Fatoum2022-08-091-1/+0
| | | | | | | | This function is undefined, so drop its prototype. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220809062422.1749563-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: designware: eqos: replace double accounting of interface up statusAhmad Fatoum2022-08-091-1/+0
| | | | | | | | | Network core already keeps track of whether ethernet interface is up, so no need to replicate holding this state. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220809062422.1749563-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: migrate "GPL-2.0" license identifiers to SPDX 2.0Roland Hieber2021-11-221-1/+1
| | | | | | | | | | "GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier "GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>. Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier") Signed-off-by: Roland Hieber <rhi@pengutronix.de> Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: designware: eqos: mimic Linux gmac4 mdio_{read, write}Ahmad Fatoum2020-03-021-1/+0
| | | | | | | | | | | | | | | The code was ported over from U-Boot and has some things different than the Kernel driver: - It reads ->mdio_address, but the kernel driver doesn't - It doesn't write ->mdio_data in a read, but the kernel driver does - It has delays in addition to spinning on MII_BUSY, but the kernel driver doesn't Adopt the same flow as used by the kernel. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: designware: eqos: enable clocks before mdio_registerAhmad Fatoum2019-11-151-4/+0
| | | | | | | | | | | | | | | | | We can't be using the MAC including the MDIO controller while the clocks are off, but this is exactly the case when mdio_register is called and the interface is not yet up. To allow reading the PHY id to succeed before the interface is up, turn on the clocks as part of the initialization in the probe. This fixes following error at probe time: ERROR: <NULL>: MDIO not idle at entry The NULL is fixed in a follow-up commit. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: add Designware Ethernet QoS for STM32MPAhmad Fatoum2019-11-061-0/+84
We already have Designware NIC support in barebox, but for the DWMAC1000, the DWMAC4 (also called GMAC4), no support was mainline so far. The DWMAC4 is different enough that sharing code with the DWMAC1000 is not really that helpful, because even basics like MDIO registers have different layout. Instead of coding bit masks and shifts into the driver data, like Linux does, we'll keep both driver kinds separate. Nevertheless, we collect functions that are not SoC-specific into a separate 'library' file. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>