All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning
@ 2021-09-12  3:15 Bin Meng
  2021-09-12  3:15 ` [PATCH 2/9] clk: " Bin Meng
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

The following warning is seen in cache-sifive-ccache.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Fix by casting it with uintptr_t.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/cache/cache-sifive-ccache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cache/cache-sifive-ccache.c b/drivers/cache/cache-sifive-ccache.c
index 76c0ab26ae..c8766f6242 100644
--- a/drivers/cache/cache-sifive-ccache.c
+++ b/drivers/cache/cache-sifive-ccache.c
@@ -38,7 +38,7 @@ static int sifive_ccache_get_info(struct udevice *dev, struct cache_info *info)
 {
 	struct sifive_ccache *priv = dev_get_priv(dev);
 
-	info->base = (phys_addr_t)priv->base;
+	info->base = (uintptr_t)priv->base;
 
 	return 0;
 }
-- 
2.25.1


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

* [PATCH 2/9] clk: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  3:46   ` Leo Liang
  2021-09-12  3:15 ` [PATCH 3/9] gpio: " Bin Meng
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

dev_read_addr() returns a value of type fdt_addr_t which is a 64-bit
address and pd->va is a pointer. In a 32-bit build, this causes the
following warning seen when building sifive-prci.c:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_ptr().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/clk/sifive/sifive-prci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
index cd1acb9442..52ae268e0c 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -653,9 +653,9 @@ static int sifive_prci_probe(struct udevice *dev)
 	struct prci_clk_desc *data =
 		(struct prci_clk_desc *)dev_get_driver_data(dev);
 
-	pd->va = (void *)dev_read_addr(dev);
-	if (IS_ERR(pd->va))
-		return PTR_ERR(pd->va);
+	pd->va = dev_read_addr_ptr(dev);
+	if (!pd->va)
+		return -EINVAL;
 
 	err = clk_get_by_index(dev, 0, &pd->parent_hfclk);
 	if (err)
-- 
2.25.1


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

* [PATCH 3/9] gpio: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
  2021-09-12  3:15 ` [PATCH 2/9] clk: " Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  3:57   ` Leo Liang
  2021-09-12  3:15 ` [PATCH 4/9] i2c: ocores: " Bin Meng
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

dev_read_addr() returns a value of type fdt_addr_t which is a 64-bit
address and plat->base is a pointer. In a 32-bit build, this causes the
following warning seen when building sifive-gpio.c:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_ptr().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/gpio/sifive-gpio.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/sifive-gpio.c b/drivers/gpio/sifive-gpio.c
index abd1f629b9..151f484e8f 100644
--- a/drivers/gpio/sifive-gpio.c
+++ b/drivers/gpio/sifive-gpio.c
@@ -157,13 +157,11 @@ static const struct dm_gpio_ops sifive_gpio_ops = {
 static int sifive_gpio_of_to_plat(struct udevice *dev)
 {
 	struct sifive_gpio_plat *plat = dev_get_plat(dev);
-	fdt_addr_t addr;
 
-	addr = dev_read_addr(dev);
-	if (addr == FDT_ADDR_T_NONE)
+	plat->base = dev_read_addr_ptr(dev);
+	if (!plat->base)
 		return -EINVAL;
 
-	plat->base = (void *)addr;
 	return 0;
 }
 
-- 
2.25.1


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

* [PATCH 4/9] i2c: ocores: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
  2021-09-12  3:15 ` [PATCH 2/9] clk: " Bin Meng
  2021-09-12  3:15 ` [PATCH 3/9] gpio: " Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  4:39   ` Leo Liang
  2021-09-12  3:15 ` [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr() Bin Meng
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

The following warning is seen in ocores_i2c.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_ptr().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/i2c/ocores_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/ocores_i2c.c b/drivers/i2c/ocores_i2c.c
index f129ec3818..3b19ba78fa 100644
--- a/drivers/i2c/ocores_i2c.c
+++ b/drivers/i2c/ocores_i2c.c
@@ -516,7 +516,7 @@ static int ocores_i2c_probe(struct udevice *dev)
 	u32 clock_frequency_khz;
 	int ret;
 
-	bus->base = (void __iomem *)devfdt_get_addr(dev);
+	bus->base = dev_read_addr_ptr(dev);
 
 	if (dev_read_u32(dev, "reg-shift", &bus->reg_shift)) {
 		/* no 'reg-shift', check for deprecated 'regstep' */
-- 
2.25.1


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

* [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr()
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (2 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 4/9] i2c: ocores: " Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  7:21   ` Leo Liang
  2021-09-30  4:09   ` Simon Glass
  2021-09-12  3:15 ` [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Bin Meng
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

At present there is only devfdt_get_addr_ptr() which only returns
the first <addr, size> pair in the 'reg' property. Add a new API
devfdt_get_addr_index_ptr() to return the indexed pointer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/core/fdtaddr.c | 11 ++++++++---
 include/dm/fdtaddr.h   | 12 ++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 4ffbd6b2eb..8dbb06ab03 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -93,6 +93,13 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
 #endif
 }
 
+void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
+{
+	fdt_addr_t addr = devfdt_get_addr_index(dev, index);
+
+	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+}
+
 fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
 				      fdt_size_t *size)
 {
@@ -155,9 +162,7 @@ fdt_addr_t devfdt_get_addr(const struct udevice *dev)
 
 void *devfdt_get_addr_ptr(const struct udevice *dev)
 {
-	fdt_addr_t addr = devfdt_get_addr_index(dev, 0);
-
-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	return devfdt_get_addr_index_ptr(dev, 0);
 }
 
 void *devfdt_remap_addr_index(const struct udevice *dev, int index)
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index a4fda581a7..d2c1994291 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -92,6 +92,18 @@ void *devfdt_map_physmem(const struct udevice *dev, unsigned long size);
  */
 fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index);
 
+/**
+ * devfdt_get_addr_index_ptr() - Return indexed pointer to the address of the
+ *                               reg property of a device
+ *
+ * @dev: Pointer to a device
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ *	   and @index is used to select which one is required
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
+
 /**
  * devfdt_get_addr_size_index() - Get the indexed reg property of a device
  *
-- 
2.25.1


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

* [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (3 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr() Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  7:23   ` Leo Liang
  2021-09-30  4:09   ` Simon Glass
  2021-09-12  3:15 ` [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings Bin Meng
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

Like dev_read_addr_ptr(), provide a wrapper for the indexed version.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 include/dm/read.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/include/dm/read.h b/include/dm/read.h
index 5bf3405614..890bf3d847 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -180,6 +180,18 @@ int dev_read_size(const struct udevice *dev, const char *propname);
  */
 fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index);
 
+/**
+ * dev_read_addr_index_ptr() - Get the indexed reg property of a device
+ *                             as a pointer
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ *	   and @index is used to select which one is required
+ *
+ * @return pointer or NULL if not found
+ */
+void *dev_read_addr_index_ptr(const struct udevice *dev, int index);
+
 /**
  * dev_read_addr_size_index() - Get the indexed reg property of a device
  *
@@ -805,6 +817,12 @@ static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev,
 	return devfdt_get_addr_index(dev, index);
 }
 
+static inline void *dev_read_addr_index_ptr(const struct udevice *dev,
+					    int index)
+{
+	return devfdt_get_addr_index_ptr(dev, index);
+}
+
 static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev,
 						  int index,
 						  fdt_size_t *size)
-- 
2.25.1


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

* [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (4 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-13 18:40   ` Ramon Fried
  2021-09-12  3:15 ` [PATCH 8/9] ram: sifive: " Bin Meng
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

The following warning is seen in macb.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_index_ptr(), or cast with uintptr_t.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/net/macb.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 57ea45e2dc..fe14027b31 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -574,14 +574,9 @@ static int macb_phy_find(struct macb_device *macb, const char *name)
 #ifdef CONFIG_DM_ETH
 static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
 {
-	fdt_addr_t addr;
 	void *gemgxl_regs;
 
-	addr = dev_read_addr_index(dev, 1);
-	if (addr == FDT_ADDR_T_NONE)
-		return -ENODEV;
-
-	gemgxl_regs = (void __iomem *)addr;
+	gemgxl_regs = dev_read_addr_index_ptr(dev, 1);
 	if (!gemgxl_regs)
 		return -ENODEV;
 
@@ -1383,7 +1378,7 @@ static int macb_eth_probe(struct udevice *dev)
 		macb->phy_addr = ofnode_read_u32_default(phandle_args.node,
 							 "reg", -1);
 
-	macb->regs = (void *)pdata->iobase;
+	macb->regs = (void *)(uintptr_t)pdata->iobase;
 
 	macb->is_big_endian = (cpu_to_be32(0x12345678) == 0x12345678);
 
@@ -1444,7 +1439,7 @@ static int macb_eth_of_to_plat(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_plat(dev);
 
-	pdata->iobase = (phys_addr_t)dev_remap_addr(dev);
+	pdata->iobase = (uintptr_t)dev_remap_addr(dev);
 	if (!pdata->iobase)
 		return -EINVAL;
 
-- 
2.25.1


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

* [PATCH 8/9] ram: sifive: Fix -Wint-to-pointer-cast warnings
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (5 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  7:25   ` Leo Liang
  2021-09-12  3:15 ` [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
  2021-09-15  3:40 ` [PATCH 1/9] cache: " Leo Liang
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

The following warning is seen in sifive_ddr.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Change to use dev_read_addr_index_ptr().

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/ram/sifive/sifive_ddr.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/ram/sifive/sifive_ddr.c b/drivers/ram/sifive/sifive_ddr.c
index ba18466033..4bd69a62be 100644
--- a/drivers/ram/sifive/sifive_ddr.c
+++ b/drivers/ram/sifive/sifive_ddr.c
@@ -313,7 +313,7 @@ static int sifive_ddr_setup(struct udevice *dev)
 	sifive_ddr_phy_fixup(denali_phy);
 
 	/* check size */
-	priv->info.size = get_ram_size((long *)priv->info.base,
+	priv->info.size = get_ram_size((long *)(uintptr_t)priv->info.base,
 				       ddr_size);
 
 	debug("%s : %lx\n", __func__, (uintptr_t)priv->info.size);
@@ -369,9 +369,9 @@ static int sifive_ddr_probe(struct udevice *dev)
 		return ret;
 	}
 
-	priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index(dev, 0);
-	priv->phy = (struct sifive_ddrphy *)dev_read_addr_index(dev, 1);
-	priv->physical_filter_ctrl = (u32 *)dev_read_addr_index(dev, 2);
+	priv->ctl = (struct sifive_ddrctl *)dev_read_addr_index_ptr(dev, 0);
+	priv->phy = (struct sifive_ddrphy *)dev_read_addr_index_ptr(dev, 1);
+	priv->physical_filter_ctrl = (u32 *)dev_read_addr_index_ptr(dev, 2);
 
 	return sifive_ddr_setup(dev);
 #endif
-- 
2.25.1


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

* [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (6 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 8/9] ram: sifive: " Bin Meng
@ 2021-09-12  3:15 ` Bin Meng
  2021-09-15  7:26   ` Leo Liang
  2021-09-15  3:40 ` [PATCH 1/9] cache: " Leo Liang
  8 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-09-12  3:15 UTC (permalink / raw)
  To: Simon Glass, Rick Chen, Leo Yu-Chi Liang, u-boot

The following warning is seen in unleashed.c in a 32-bit build:

  warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

Cast with uintptr_t.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 board/sifive/unleashed/unleashed.c | 2 +-
 board/sifive/unmatched/unmatched.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index 33baeda986..e7d2332d8c 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -118,7 +118,7 @@ void *board_fdt_blob_setup(void)
 {
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
-			return (ulong *)gd->arch.firmware_fdt_addr;
+			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
 
 	return (ulong *)&_end;
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index 8773b660fa..93c452c57f 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -15,7 +15,7 @@ void *board_fdt_blob_setup(void)
 {
 	if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
 		if (gd->arch.firmware_fdt_addr)
-			return (ulong *)gd->arch.firmware_fdt_addr;
+			return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
 	}
 
 	return (ulong *)&_end;
-- 
2.25.1


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

* Re: [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings
  2021-09-12  3:15 ` [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings Bin Meng
@ 2021-09-13 18:40   ` Ramon Fried
  0 siblings, 0 replies; 22+ messages in thread
From: Ramon Fried @ 2021-09-13 18:40 UTC (permalink / raw)
  To: Bin Meng; +Cc: Simon Glass, Rick Chen, Leo Yu-Chi Liang, U-Boot Mailing List

On Sun, Sep 12, 2021 at 6:16 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> The following warning is seen in macb.c in a 32-bit build:
>
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>
> Change to use dev_read_addr_index_ptr(), or cast with uintptr_t.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/net/macb.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 57ea45e2dc..fe14027b31 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -574,14 +574,9 @@ static int macb_phy_find(struct macb_device *macb, const char *name)
>  #ifdef CONFIG_DM_ETH
>  static int macb_sifive_clk_init(struct udevice *dev, ulong rate)
>  {
> -       fdt_addr_t addr;
>         void *gemgxl_regs;
>
> -       addr = dev_read_addr_index(dev, 1);
> -       if (addr == FDT_ADDR_T_NONE)
> -               return -ENODEV;
> -
> -       gemgxl_regs = (void __iomem *)addr;
> +       gemgxl_regs = dev_read_addr_index_ptr(dev, 1);
>         if (!gemgxl_regs)
>                 return -ENODEV;
>
> @@ -1383,7 +1378,7 @@ static int macb_eth_probe(struct udevice *dev)
>                 macb->phy_addr = ofnode_read_u32_default(phandle_args.node,
>                                                          "reg", -1);
>
> -       macb->regs = (void *)pdata->iobase;
> +       macb->regs = (void *)(uintptr_t)pdata->iobase;
>
>         macb->is_big_endian = (cpu_to_be32(0x12345678) == 0x12345678);
>
> @@ -1444,7 +1439,7 @@ static int macb_eth_of_to_plat(struct udevice *dev)
>  {
>         struct eth_pdata *pdata = dev_get_plat(dev);
>
> -       pdata->iobase = (phys_addr_t)dev_remap_addr(dev);
> +       pdata->iobase = (uintptr_t)dev_remap_addr(dev);
>         if (!pdata->iobase)
>                 return -EINVAL;
>
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

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

* Re: [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
                   ` (7 preceding siblings ...)
  2021-09-12  3:15 ` [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
@ 2021-09-15  3:40 ` Leo Liang
  2021-10-11  3:14   ` Bin Meng
  8 siblings, 1 reply; 22+ messages in thread
From: Leo Liang @ 2021-09-15  3:40 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:08AM +0800, Bin Meng wrote:
> The following warning is seen in cache-sifive-ccache.c in a 32-bit build:
>
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>
> Fix by casting it with uintptr_t.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/cache/cache-sifive-ccache.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
CONFIDENTIALITY NOTICE:

This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein is strictly prohibited. In this case, please immediately notify the sender by return e-mail, delete the message (and any accompanying documents) and destroy all printed hard copies. Thank you for your cooperation.

Copyright ANDES TECHNOLOGY CORPORATION - All Rights Reserved.

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

* Re: [PATCH 2/9] clk: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 ` [PATCH 2/9] clk: " Bin Meng
@ 2021-09-15  3:46   ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  3:46 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:09AM +0800, Bin Meng wrote:
> dev_read_addr() returns a value of type fdt_addr_t which is a 64-bit
> address and pd->va is a pointer. In a 32-bit build, this causes the
> following warning seen when building sifive-prci.c:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Change to use dev_read_addr_ptr().
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/clk/sifive/sifive-prci.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 3/9] gpio: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 ` [PATCH 3/9] gpio: " Bin Meng
@ 2021-09-15  3:57   ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  3:57 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:10AM +0800, Bin Meng wrote:
> dev_read_addr() returns a value of type fdt_addr_t which is a 64-bit
> address and plat->base is a pointer. In a 32-bit build, this causes the
> following warning seen when building sifive-gpio.c:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Change to use dev_read_addr_ptr().
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/gpio/sifive-gpio.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 4/9] i2c: ocores: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 ` [PATCH 4/9] i2c: ocores: " Bin Meng
@ 2021-09-15  4:39   ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  4:39 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:11AM +0800, Bin Meng wrote:
> The following warning is seen in ocores_i2c.c in a 32-bit build:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Change to use dev_read_addr_ptr().
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/i2c/ocores_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr()
  2021-09-12  3:15 ` [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr() Bin Meng
@ 2021-09-15  7:21   ` Leo Liang
  2021-09-30  4:09   ` Simon Glass
  1 sibling, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  7:21 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:12AM +0800, Bin Meng wrote:
> At present there is only devfdt_get_addr_ptr() which only returns
> the first <addr, size> pair in the 'reg' property. Add a new API
> devfdt_get_addr_index_ptr() to return the indexed pointer.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/core/fdtaddr.c | 11 ++++++++---
>  include/dm/fdtaddr.h   | 12 ++++++++++++
>  2 files changed, 20 insertions(+), 3 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> 

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

* Re: [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper
  2021-09-12  3:15 ` [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Bin Meng
@ 2021-09-15  7:23   ` Leo Liang
  2021-09-30  4:09   ` Simon Glass
  1 sibling, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  7:23 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:13AM +0800, Bin Meng wrote:
> Like dev_read_addr_ptr(), provide a wrapper for the indexed version.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  include/dm/read.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 8/9] ram: sifive: Fix -Wint-to-pointer-cast warnings
  2021-09-12  3:15 ` [PATCH 8/9] ram: sifive: " Bin Meng
@ 2021-09-15  7:25   ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  7:25 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:15AM +0800, Bin Meng wrote:
> The following warning is seen in sifive_ddr.c in a 32-bit build:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Change to use dev_read_addr_index_ptr().
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  drivers/ram/sifive/sifive_ddr.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-12  3:15 ` [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
@ 2021-09-15  7:26   ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-09-15  7:26 UTC (permalink / raw)
  To: Bin Meng; +Cc: u-boot

On Sun, Sep 12, 2021 at 11:15:16AM +0800, Bin Meng wrote:
> The following warning is seen in unleashed.c in a 32-bit build:
> 
>   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> Cast with uintptr_t.
> 
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> 
>  board/sifive/unleashed/unleashed.c | 2 +-
>  board/sifive/unmatched/unmatched.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

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

* Re: [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr()
  2021-09-12  3:15 ` [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr() Bin Meng
  2021-09-15  7:21   ` Leo Liang
@ 2021-09-30  4:09   ` Simon Glass
  1 sibling, 0 replies; 22+ messages in thread
From: Simon Glass @ 2021-09-30  4:09 UTC (permalink / raw)
  To: Bin Meng; +Cc: Rick Chen, Leo Yu-Chi Liang, U-Boot Mailing List

Hi Bin,

On Sat, 11 Sept 2021 at 21:15, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> At present there is only devfdt_get_addr_ptr() which only returns
> the first <addr, size> pair in the 'reg' property. Add a new API
> devfdt_get_addr_index_ptr() to return the indexed pointer.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/core/fdtaddr.c | 11 ++++++++---
>  include/dm/fdtaddr.h   | 12 ++++++++++++
>  2 files changed, 20 insertions(+), 3 deletions(-)

Please do update the tests for this new function.

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

* Re: [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper
  2021-09-12  3:15 ` [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Bin Meng
  2021-09-15  7:23   ` Leo Liang
@ 2021-09-30  4:09   ` Simon Glass
  1 sibling, 0 replies; 22+ messages in thread
From: Simon Glass @ 2021-09-30  4:09 UTC (permalink / raw)
  To: Bin Meng; +Cc: Rick Chen, Leo Yu-Chi Liang, U-Boot Mailing List

On Sat, 11 Sept 2021 at 21:15, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Like dev_read_addr_ptr(), provide a wrapper for the indexed version.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  include/dm/read.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* Re: [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning
  2021-09-15  3:40 ` [PATCH 1/9] cache: " Leo Liang
@ 2021-10-11  3:14   ` Bin Meng
  2021-10-12  7:43     ` Leo Liang
  0 siblings, 1 reply; 22+ messages in thread
From: Bin Meng @ 2021-10-11  3:14 UTC (permalink / raw)
  To: Leo Liang; +Cc: U-Boot Mailing List

On Wed, Sep 15, 2021 at 11:40 AM Leo Liang <ycliang@andestech.com> wrote:
>
> On Sun, Sep 12, 2021 at 11:15:08AM +0800, Bin Meng wrote:
> > The following warning is seen in cache-sifive-ccache.c in a 32-bit build:
> >
> >   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> >
> > Fix by casting it with uintptr_t.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > ---
> >
> >  drivers/cache/cache-sifive-ccache.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

Ping for apply?

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

* Re: [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning
  2021-10-11  3:14   ` Bin Meng
@ 2021-10-12  7:43     ` Leo Liang
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Liang @ 2021-10-12  7:43 UTC (permalink / raw)
  To: Bin Meng, sjg; +Cc: U-Boot Mailing List

On Mon, Oct 11, 2021 at 11:14:21AM +0800, Bin Meng wrote:
> On Wed, Sep 15, 2021 at 11:40 AM Leo Liang <ycliang@andestech.com> wrote:
> >
> > On Sun, Sep 12, 2021 at 11:15:08AM +0800, Bin Meng wrote:
> > > The following warning is seen in cache-sifive-ccache.c in a 32-bit build:
> > >
> > >   warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> > >
> > > Fix by casting it with uintptr_t.
> > >
> > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > > ---
> > >
> > >  drivers/cache/cache-sifive-ccache.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
> 
> Ping for apply?

Hi Bin,

Sorry for the late reply.

For this patch set, I thought you were going to update the tests for the
new API `devfdt_get_addr_index_ptr()` as Simon suggested.

Just wanted to make sure that you don't have any updates for this
patchset, then I will apply this patch right away.

Hi Simon,

After checking the test/dm/test-fdt.c,
there seems to be no need for any updates, right? 
Or is there anything I miss?

Best regards,
Leo

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

end of thread, other threads:[~2021-10-12  7:46 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12  3:15 [PATCH 1/9] cache: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
2021-09-12  3:15 ` [PATCH 2/9] clk: " Bin Meng
2021-09-15  3:46   ` Leo Liang
2021-09-12  3:15 ` [PATCH 3/9] gpio: " Bin Meng
2021-09-15  3:57   ` Leo Liang
2021-09-12  3:15 ` [PATCH 4/9] i2c: ocores: " Bin Meng
2021-09-15  4:39   ` Leo Liang
2021-09-12  3:15 ` [PATCH 5/9] dm: core: Add a new API devfdt_get_addr_index_ptr() Bin Meng
2021-09-15  7:21   ` Leo Liang
2021-09-30  4:09   ` Simon Glass
2021-09-12  3:15 ` [PATCH 6/9] dm: Provide dev_read_addr_index_ptr() wrapper Bin Meng
2021-09-15  7:23   ` Leo Liang
2021-09-30  4:09   ` Simon Glass
2021-09-12  3:15 ` [PATCH 7/9] net: macb: Fix -Wint-to-pointer-cast warnings Bin Meng
2021-09-13 18:40   ` Ramon Fried
2021-09-12  3:15 ` [PATCH 8/9] ram: sifive: " Bin Meng
2021-09-15  7:25   ` Leo Liang
2021-09-12  3:15 ` [PATCH 9/9] board: sifive: Fix -Wint-to-pointer-cast warning Bin Meng
2021-09-15  7:26   ` Leo Liang
2021-09-15  3:40 ` [PATCH 1/9] cache: " Leo Liang
2021-10-11  3:14   ` Bin Meng
2021-10-12  7:43     ` Leo Liang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.