Skip to contentSkip to conversation

lib/fdtdec: Fix fdt_addr_t and fdt_size_t typedef

PATCH New York Sun 2 participants 4 messages Aug 3, 2015 – Aug 9, 2015

Subsystems (4)
lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH v3 1/2 lib/fdtdec: Fix fdt_addr_t and fdt_size_t typedef

fdt_addr_t is a physical address. It can be either 64-bit or 32-bit, depending on the architecture. It should be phys_addr_t instead of u64 or u32. Similarly, fdt_size_t is changed to phys_size_t.

---
Change log
v3: Rebase code to latest master, split into two patches.
v2: Rebase code to latest master, add change to fsl_dspi.c.

 include/fdtdec.h |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
include/fdtdec.h +2 -4
index 4b3f8d1..4dee0d8 100644
@@ -21,15 +21,13 @@
  * A typedef for a physical address. Note that fdt data is always big
  * endian even on a litle endian machine.
  */
+typedef phys_addr_t fdt_addr_t;
+typedef phys_size_t fdt_size_t;
 #ifdef CONFIG_PHYS_64BIT
-typedef u64 fdt_addr_t;
-typedef u64 fdt_size_t;
 #define FDT_ADDR_T_NONE (-1ULL)
 #define fdt_addr_to_cpu(reg) be64_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be64_to_cpu(reg)
 #else
-typedef u32 fdt_addr_t;
-typedef u32 fdt_size_t;
 #define FDT_ADDR_T_NONE (-1U)
 #define fdt_addr_to_cpu(reg) be32_to_cpu(reg)
 #define fdt_size_to_cpu(reg) be32_to_cpu(reg)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 2/2 lib/fdtdec: Fix compiling warning caused by changing fdt_addr_t type

fdt_addr_t is changed to phys_addr_t. The format in debug should be updated to %pa to match the type.

---
Change log:
v3: split into a separated patch

 drivers/pci/pci_tegra.c |   10 +++++-----
 drivers/spi/fsl_dspi.c  |    4 ++--
 drivers/video/tegra.c   |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/pci/pci_tegra.c +5 -5
index 67b5fdf..ebb959f 100644
@@ -445,11 +445,11 @@ static int tegra_pcie_parse_dt_ranges(const void *fdt, int node,
 	}
 
 	debug("PCI regions:\n");
-	debug("  I/O: %#x-%#x\n", pcie->io.start, pcie->io.end);
-	debug("  non-prefetchable memory: %#x-%#x\n", pcie->mem.start,
-	      pcie->mem.end);
-	debug("  prefetchable memory: %#x-%#x\n", pcie->prefetch.start,
-	      pcie->prefetch.end);
+	debug("  I/O: %pa-%pa\n", &pcie->io.start, &pcie->io.end);
+	debug("  non-prefetchable memory: %pa-%pa\n", &pcie->mem.start,
+	      &pcie->mem.end);
+	debug("  prefetchable memory: %pa-%pa\n", &pcie->prefetch.start,
+	      &pcie->prefetch.end);
 
 	return 0;
 }
drivers/spi/fsl_dspi.c +2 -2
index 7928531..3881b2e 100644
@@ -664,8 +664,8 @@ static int fsl_dspi_ofdata_to_platdata(struct udevice *bus)
 	plat->speed_hz = fdtdec_get_int(blob,
 			node, "spi-max-frequency", FSL_DSPI_DEFAULT_SCK_FREQ);
 
-	debug("DSPI: regs=0x%llx, max-frequency=%d, endianess=%s, num-cs=%d\n",
-	      (u64)plat->regs_addr, plat->speed_hz,
+	debug("DSPI: regs=%pa, max-frequency=%d, endianess=%s, num-cs=%d\n",
+	      &plat->regs_addr, plat->speed_hz,
 	      plat->flags & DSPI_FLAG_REGMAP_ENDIAN_BIG ? "be" : "le",
 	      plat->num_chipselect);
 
drivers/video/tegra.c +1 -1
index b8f3431..33c6103 100644
@@ -92,7 +92,7 @@ void lcd_ctrl_init(void *lcdbase)
 	/* Enable flushing after LCD writes if requested */
 	lcd_set_flush_dcache(config.cache_type & FDT_LCD_CACHE_FLUSH);
 
-	debug("LCD frame buffer at %08X\n", disp_config->frame_buffer);
+	debug("LCD frame buffer at %pa\n", &disp_config->frame_buffer);
 }
 
 ulong calc_fbsize(void)
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v3 2/2 lib/fdtdec: Fix compiling warning caused by changing fdt_addr_t type

Quoted 5 lines · York Sun

fdt_addr_t is changed to phys_addr_t. The format in debug should be updated to %pa to match the type.

Quoted 8 lines

---
Change log:
v3: split into a separated patch

 drivers/pci/pci_tegra.c |   10 +++++-----
 drivers/spi/fsl_dspi.c  |    4 ++--
 drivers/video/tegra.c   |    2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

Applied to u-boot-dm, thanks!

#3 lore raw

PATCH v3 1/2 lib/fdtdec: Fix fdt_addr_t and fdt_size_t typedef

In reply to York Sun
Quoted 6 lines · York Sun

fdt_addr_t is a physical address. It can be either 64-bit or 32-bit, depending on the architecture. It should be phys_addr_t instead of u64 or u32. Similarly, fdt_size_t is changed to phys_size_t.

Quoted 7 lines

---
Change log
v3: Rebase code to latest master, split into two patches.
v2: Rebase code to latest master, add change to fsl_dspi.c.

 include/fdtdec.h |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!