mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 6/6] net: fsl_enetc: fix compilation for 32-bit
Date: Wed, 14 Aug 2024 11:24:24 +0200	[thread overview]
Message-ID: <20240814092424.39878-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240814092424.39878-1-a.fatoum@pengutronix.de>

The driver is only used on the 64-bit LS1028, but compile testing on
32-bit fails mostly due to unnecessary pointer casts.

Fixing them cleans up the code a little, so let's do that even if
there's no functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/net/fsl_enetc.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index 1695758fd3fe..7895e229e483 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -8,11 +8,12 @@
 #include <net.h>
 #include <linux/phy.h>
 #include <linux/pci.h>
-#include <io.h>
+#include <linux/io.h>
 #include <linux/mdio.h>
 #include <asm/system.h>
 #include <of_net.h>
 #include <asm/unaligned.h>
+#include <io-64-nonatomic-lo-hi.h>
 
 #include "fsl_enetc.h"
 
@@ -197,7 +198,7 @@ static void enetc_start_pcs(struct eth_device *edev)
  * LS1028A is the only part with IERB at this time and there are plans to
  * change its structure, keep this LS1028A specific for now.
  */
-#define LS1028A_IERB_BASE		0x1f0800000ULL
+#define LS1028A_IERB_BASE		IOMEM(0x1f0800000ULL)
 #define LS1028A_IERB_PSIPMAR0(pf, vf)	(LS1028A_IERB_BASE + 0x8000 \
 					 + (pf) * 0x100 + (vf) * 8)
 #define LS1028A_IERB_PSIPMAR1(pf, vf)	(LS1028A_IERB_PSIPMAR0(pf, vf) + 4)
@@ -283,7 +284,6 @@ static void enetc_setup_tx_bdr(struct eth_device *edev)
 {
 	struct enetc_priv *priv = edev->priv;
 	struct bd_ring *tx_bdr = &priv->tx_bdr;
-	u64 tx_bd_add = (u64)priv->enetc_txbd_phys;
 
 	/* used later to advance to the next Tx BD */
 	tx_bdr->bd_count = ENETC_BD_CNT;
@@ -296,9 +296,9 @@ static void enetc_setup_tx_bdr(struct eth_device *edev)
 
 	/* set Tx BD address */
 	enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBBAR0,
-			lower_32_bits(tx_bd_add));
+			lower_32_bits(priv->enetc_txbd_phys));
 	enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBBAR1,
-			upper_32_bits(tx_bd_add));
+			upper_32_bits(priv->enetc_txbd_phys));
 	/* set Tx 8 BD count */
 	enetc_bdr_write(priv, TX, ENETC_TX_BDR_ID, ENETC_TBLENR,
 			tx_bdr->bd_count);
@@ -323,7 +323,6 @@ static void enetc_setup_rx_bdr(struct eth_device *edev)
 {
 	struct enetc_priv *priv = edev->priv;
 	struct bd_ring *rx_bdr = &priv->rx_bdr;
-	u64 rx_bd_add = (u64)priv->enetc_rxbd_phys;
 	int i;
 
 	/* used later to advance to the next BD produced by ENETC HW */
@@ -337,9 +336,9 @@ static void enetc_setup_rx_bdr(struct eth_device *edev)
 
 	/* set Rx BD address */
 	enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBBAR0,
-			lower_32_bits(rx_bd_add));
+			lower_32_bits(priv->enetc_rxbd_phys));
 	enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBBAR1,
-			upper_32_bits(rx_bd_add));
+			upper_32_bits(priv->enetc_rxbd_phys));
 	/* set Rx BD count (multiple of 8) */
 	enetc_bdr_write(priv, RX, ENETC_RX_BDR_ID, ENETC_RBLENR,
 			rx_bdr->bd_count);
@@ -448,8 +447,8 @@ static int enetc_send(struct eth_device *edev, void *packet, int length)
 		return -ETIMEDOUT;
 	}
 
-	dev_vdbg(&edev->dev, "TxBD[%d]send: pkt_len=%d, buff @0x%x%08x\n", pi, length,
-		  upper_32_bits((u64)packet), lower_32_bits((u64)packet));
+	dev_vdbg(&edev->dev, "TxBD[%d]send: pkt_len=%d, buff @%p\n", pi, length,
+		  packet);
 
 	dma = dma_map_single(priv->dev, packet, length, DMA_TO_DEVICE);
 
-- 
2.39.2




  parent reply	other threads:[~2024-08-14  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-14  9:24 [PATCH 1/6] common: pe: fix use of undefined macro for ARMv7 Ahmad Fatoum
2024-08-14  9:24 ` [PATCH 2/6] efi: fs: fix determination of read-only files Ahmad Fatoum
2024-08-14  9:24 ` [PATCH 3/6] filetype: fix else clause indentation Ahmad Fatoum
2024-08-14  9:24 ` [PATCH 4/6] acpi: fix compilation for 32-bit Ahmad Fatoum
2024-08-14  9:24 ` [PATCH 5/6] i2c: efi: avoid 64-bit division Ahmad Fatoum
2024-08-15  5:53   ` Tomas Marek
2024-08-15  6:57     ` Ahmad Fatoum
2024-08-19  6:16       ` Sascha Hauer
2024-08-14  9:24 ` Ahmad Fatoum [this message]
2024-08-14 11:08 ` [PATCH 1/6] common: pe: fix use of undefined macro for ARMv7 Sascha Hauer

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=20240814092424.39878-6-a.fatoum@pengutronix.de \
    --to=a.fatoum@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