All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spi: cadence_qspi: Change to use devfdt_get_addr_index()
@ 2018-05-07  9:42 Ley Foon Tan
  2018-05-07  9:42 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning Ley Foon Tan
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Ley Foon Tan @ 2018-05-07  9:42 UTC (permalink / raw)
  To: u-boot

Change to use devfdt_get_addr_index() function to get fdt address.

Original code has compilation warning below:

drivers/spi/cadence_qspi.c: In function ‘cadence_spi_ofdata_to_platdata’:
drivers/spi/cadence_qspi.c:297:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  plat->regbase = (void *)data[0];
                  ^
drivers/spi/cadence_qspi.c:298:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  plat->ahbbase = (void *)data[2];
                  ^
Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/spi/cadence_qspi.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 7b312f8..f80d073 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -284,18 +284,9 @@ static int cadence_spi_ofdata_to_platdata(struct udevice *bus)
 	const void *blob = gd->fdt_blob;
 	int node = dev_of_offset(bus);
 	int subnode;
-	u32 data[4];
-	int ret;
 
-	/* 2 base addresses are needed, lets get them from the DT */
-	ret = fdtdec_get_int_array(blob, node, "reg", data, ARRAY_SIZE(data));
-	if (ret) {
-		printf("Error: Can't get base addresses (ret=%d)!\n", ret);
-		return -ENODEV;
-	}
-
-	plat->regbase = (void *)data[0];
-	plat->ahbbase = (void *)data[2];
+	plat->regbase = (void *)devfdt_get_addr_index(bus, 0);
+	plat->ahbbase = (void *)devfdt_get_addr_index(bus, 1);
 	plat->is_decoded_cs = fdtdec_get_bool(blob, node, "cdns,is-decoded-cs");
 	plat->fifo_depth = fdtdec_get_uint(blob, node, "cdns,fifo-depth", 128);
 	plat->fifo_width = fdtdec_get_uint(blob, node, "cdns,fifo-width", 4);
-- 
1.7.1

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

end of thread, other threads:[~2018-06-01 17:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-07  9:42 [U-Boot] [PATCH] spi: cadence_qspi: Change to use devfdt_get_addr_index() Ley Foon Tan
2018-05-07  9:42 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix compilation warning Ley Foon Tan
2018-06-01  8:07   ` Marek Vasut
2018-06-01  8:23     ` Ley Foon Tan
2018-05-07  9:42 ` [U-Boot] [PATCH] spi: cadence_qspi: Fix warning cast from pointer to integer of different size Ley Foon Tan
2018-06-01  8:07   ` Marek Vasut
2018-06-01  8:24     ` Ley Foon Tan
2018-05-16 13:33 ` [U-Boot] [PATCH] spi: cadence_qspi: Change to use devfdt_get_addr_index() Jagan Teki
2018-05-17  2:23   ` Ley Foon Tan
2018-06-01  8:07 ` Marek Vasut
2018-06-01 17:02 ` Jagan Teki

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.