mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit
@ 2023-01-10 18:01 Ahmad Fatoum
  2023-01-10 18:01 ` [PATCH 2/2] ARM: rpi: defconfig: enable Raspberry Pi 4 drivers in 32-bit config Ahmad Fatoum
  2023-01-11  8:00 ` [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-01-10 18:01 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

The driver readily works in 32-bit mode as it takes care there
to write zero to the DMA_DESC_ADDRESS_HI field of descriptors.
In the receive path, a 32-bit integer is shifted by 32 though
leading to a (harmless) warning. Adjust the type to silence it.

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

diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
index 32ec36eff65a..3ae341a658a0 100644
--- a/drivers/net/bcmgenet.c
+++ b/drivers/net/bcmgenet.c
@@ -314,8 +314,8 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
 	struct bcmgenet_eth_priv *priv = edev->priv;
 	void *desc_base = priv->mac_reg + GENET_RX_OFF + priv->rx_index * DMA_DESC_SIZE;
 	u32 prod_index = readl(priv->mac_reg + RDMA_PROD_INDEX);
-	u32 length;
-	unsigned long addr_lo, addr_hi, addr;
+	u32 length, addr_lo, addr_hi;
+	dma_addr_t addr;
 
 	if (prod_index == priv->c_index)
 		return -EAGAIN;
@@ -324,7 +324,7 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
 	length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK;
 	addr_lo = readl(desc_base + DMA_DESC_ADDRESS_LO);
 	addr_hi = readl(desc_base + DMA_DESC_ADDRESS_HI);
-	addr = addr_hi << 32 | addr_lo;
+	addr = (u64)addr_hi << 32 | addr_lo;
 
 	dma_sync_single_for_cpu(addr, length, DMA_FROM_DEVICE);
 
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ARM: rpi: defconfig: enable Raspberry Pi 4 drivers in 32-bit config
  2023-01-10 18:01 [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Ahmad Fatoum
@ 2023-01-10 18:01 ` Ahmad Fatoum
  2023-01-11  8:00 ` [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-01-10 18:01 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Raspberry Pi 4 is also supported in 32-bit mode. Enable its network
driver and the fixed regulator driver as that's used as vMMC supply.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/configs/rpi_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index e7d695f8ae54..500c92a8218e 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -80,6 +80,7 @@ CONFIG_CMD_TIME=y
 CONFIG_NET=y
 CONFIG_SERIAL_AMBA_PL011=y
 CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_NET_BCMGENET=y
 CONFIG_NET_USB=y
 CONFIG_NET_USB_SMSC95XX=y
 CONFIG_I2C=y
@@ -98,6 +99,7 @@ CONFIG_WATCHDOG_BCM2835=y
 CONFIG_GPIO_RASPBERRYPI_EXP=y
 CONFIG_PINCTRL_BCM283X=y
 CONFIG_REGULATOR=y
+CONFIG_REGULATOR_FIXED=y
 CONFIG_GENERIC_PHY=y
 CONFIG_USB_NOP_XCEIV=y
 CONFIG_FS_EXT4=y
@@ -106,3 +108,4 @@ CONFIG_FS_NFS=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
+CONFIG_ZLIB=y
-- 
2.30.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit
  2023-01-10 18:01 [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Ahmad Fatoum
  2023-01-10 18:01 ` [PATCH 2/2] ARM: rpi: defconfig: enable Raspberry Pi 4 drivers in 32-bit config Ahmad Fatoum
@ 2023-01-11  8:00 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-01-11  8:00 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Jan 10, 2023 at 07:01:25PM +0100, Ahmad Fatoum wrote:
> The driver readily works in 32-bit mode as it takes care there
> to write zero to the DMA_DESC_ADDRESS_HI field of descriptors.
> In the receive path, a 32-bit integer is shifted by 32 though
> leading to a (harmless) warning. Adjust the type to silence it.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/net/bcmgenet.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
> index 32ec36eff65a..3ae341a658a0 100644
> --- a/drivers/net/bcmgenet.c
> +++ b/drivers/net/bcmgenet.c
> @@ -314,8 +314,8 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
>  	struct bcmgenet_eth_priv *priv = edev->priv;
>  	void *desc_base = priv->mac_reg + GENET_RX_OFF + priv->rx_index * DMA_DESC_SIZE;
>  	u32 prod_index = readl(priv->mac_reg + RDMA_PROD_INDEX);
> -	u32 length;
> -	unsigned long addr_lo, addr_hi, addr;
> +	u32 length, addr_lo, addr_hi;
> +	dma_addr_t addr;
>  
>  	if (prod_index == priv->c_index)
>  		return -EAGAIN;
> @@ -324,7 +324,7 @@ static int bcmgenet_gmac_eth_recv(struct eth_device *edev)
>  	length = (length >> DMA_BUFLENGTH_SHIFT) & DMA_BUFLENGTH_MASK;
>  	addr_lo = readl(desc_base + DMA_DESC_ADDRESS_LO);
>  	addr_hi = readl(desc_base + DMA_DESC_ADDRESS_HI);
> -	addr = addr_hi << 32 | addr_lo;
> +	addr = (u64)addr_hi << 32 | addr_lo;
>  
>  	dma_sync_single_for_cpu(addr, length, DMA_FROM_DEVICE);
>  
> -- 
> 2.30.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 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-11  8:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10 18:01 [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Ahmad Fatoum
2023-01-10 18:01 ` [PATCH 2/2] ARM: rpi: defconfig: enable Raspberry Pi 4 drivers in 32-bit config Ahmad Fatoum
2023-01-11  8:00 ` [PATCH 1/2] net: bcmgenet: fix warning when building for 32-bit Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox