From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v2 2/2] net: Add fsl_enetc network driver support
Date: Thu, 4 Jan 2024 13:18:56 +0100 [thread overview]
Message-ID: <20240104121856.GT1318922@pengutronix.de> (raw)
In-Reply-To: <20240104112241.989839-2-s.hauer@pengutronix.de>
On Thu, Jan 04, 2024 at 12:22:41PM +0100, Sascha Hauer wrote:
> This adds support for the fsl_enetc network controller found on several
> Layerscape SoCs. The code is originally from U-Boot-2023.10-rc1.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>
> Notes:
> Changes since v1:
>
> - Use get_unaligned to access unaligned pointers
> - use physical address returned by dma_alloc_coherent()
> - implement struct pci_driver::remove hook
> - do not printf in poller function
> - use write[lwq] to access rx/tx rings to avoid dmb()
Actually this last part is missing, here it is:
---------------------------------8<---------------------------
>From 3b312b7d501be3b0049de27582a26b19fdaf84e1 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Wed, 3 Jan 2024 20:55:39 +0100
Subject: [PATCH] fixup! net: Add fsl_enetc network driver support
---
drivers/net/fsl_enetc.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index eb90c526bb..07e9a6b7c8 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -454,13 +454,10 @@ static int enetc_send(struct eth_device *edev, void *packet, int length)
dma = dma_map_single(priv->dev, packet, length, DMA_TO_DEVICE);
/* prepare Tx BD */
- memset(&priv->enetc_txbd[pi], 0x0, sizeof(struct enetc_tx_bd));
- priv->enetc_txbd[pi].addr = cpu_to_le64(dma);
- priv->enetc_txbd[pi].buf_len = cpu_to_le16(length);
- priv->enetc_txbd[pi].frm_len = cpu_to_le16(length);
- priv->enetc_txbd[pi].flags = cpu_to_le16(ENETC_TXBD_FLAGS_F);
-
- dmb();
+ writeq(cpu_to_le64(dma), &priv->enetc_txbd[pi].addr);
+ writew(cpu_to_le16(length), &priv->enetc_txbd[pi].buf_len);
+ writew(cpu_to_le16(length), &priv->enetc_txbd[pi].frm_len);
+ writew(cpu_to_le16(ENETC_TXBD_FLAGS_F), &priv->enetc_txbd[pi].flags);
/* send frame: increment producer index */
pi = (pi + 1) % txr->bd_count;
@@ -508,9 +505,7 @@ static int enetc_recv(struct eth_device *edev)
if (!ENETC_RXBD_STATUS_R(status))
return 0;
- dmb();
-
- len = le16_to_cpu(priv->enetc_rxbd[pi].r.buf_len);
+ len = le16_to_cpu(readw(&priv->enetc_rxbd[pi].r.buf_len));
dev_dbg(&edev->dev, "RxBD[%d]: len=%d err=%d pkt=0x%p\n", pi, len,
ENETC_RXBD_STATUS_ERRORS(status), pkg);
@@ -520,8 +515,8 @@ static int enetc_recv(struct eth_device *edev)
dma_sync_single_for_device(priv->dev, priv->rx_pkg_phys[pi], PKTSIZE, DMA_FROM_DEVICE);
/* BD clean up and advance to next in ring */
- memset(&priv->enetc_rxbd[pi], 0, sizeof(union enetc_rx_bd));
- priv->enetc_rxbd[pi].w.addr = priv->rx_pkg_phys[pi];
+ memset_io(&priv->enetc_rxbd[pi], 0, sizeof(union enetc_rx_bd));
+ writeq(priv->rx_pkg_phys[pi], &priv->enetc_rxbd[pi].w.addr);
rxr->next_prod_idx = (pi + 1) % rxr->bd_count;
ci = (ci + 1) % rxr->bd_count;
rxr->next_cons_idx = ci;
--
2.39.2
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2024-01-04 12:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 11:22 [PATCH v2 1/2] net/phy: sync phy_interface_t types with Linux Sascha Hauer
2024-01-04 11:22 ` [PATCH v2 2/2] net: Add fsl_enetc network driver support Sascha Hauer
2024-01-04 12:18 ` Sascha Hauer [this message]
2024-01-05 9:21 ` Ahmad Fatoum
2024-01-05 9:21 ` [PATCH v2 1/2] net/phy: sync phy_interface_t types with Linux Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240104121856.GT1318922@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox