diff mbox

[U-Boot,RFC] fdt: Remove fdt_fixup_memory function

Message ID 1397047800-26221-1-git-send-email-trini@ti.com
State RFC
Delegated to: Wolfgang Denk
Headers show

Commit Message

Tom Rini April 9, 2014, 12:50 p.m. UTC
The fdt_fixup_memory function is only used on PowerPC where we only
claim one memory bank in U-Boot (and then in the device tree) so we can
call a function that just calls fdt_fixup_memory_banks(..., 1).  Call
this directly for consistency with other architectures.

Cc: Jerry Van Baren <vanbaren@cideas.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/powerpc/cpu/74xx_7xx/cpu.c             |    2 +-
 arch/powerpc/cpu/mpc512x/cpu.c              |    2 +-
 arch/powerpc/cpu/mpc5xxx/cpu.c              |    2 +-
 arch/powerpc/cpu/mpc8260/cpu.c              |    2 +-
 arch/powerpc/cpu/mpc83xx/fdt.c              |    2 +-
 arch/powerpc/cpu/mpc85xx/fdt.c              |    2 +-
 arch/powerpc/cpu/mpc86xx/fdt.c              |    2 +-
 arch/powerpc/cpu/mpc8xx/fdt.c               |    2 +-
 arch/powerpc/cpu/ppc4xx/fdt.c               |    2 +-
 arch/powerpc/lib/bootm.c                    |    2 +-
 board/exmeritus/hww1u1a/hww1u1a.c           |    2 +-
 board/freescale/b4860qds/b4860qds.c         |    2 +-
 board/freescale/bsc9131rdb/bsc9131rdb.c     |    2 +-
 board/freescale/bsc9132qds/bsc9132qds.c     |    2 +-
 board/freescale/c29xpcie/c29xpcie.c         |    2 +-
 board/freescale/corenet_ds/corenet_ds.c     |    2 +-
 board/freescale/mpc7448hpc2/mpc7448hpc2.c   |    2 +-
 board/freescale/mpc8572ds/mpc8572ds.c       |    2 +-
 board/freescale/p1010rdb/p1010rdb.c         |    2 +-
 board/freescale/p1022ds/p1022ds.c           |    2 +-
 board/freescale/p1023rdb/p1023rdb.c         |    2 +-
 board/freescale/p1023rds/p1023rds.c         |    2 +-
 board/freescale/p1_p2_rdb/p1_p2_rdb.c       |    2 +-
 board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c |    2 +-
 board/freescale/p1_twr/p1_twr.c             |    2 +-
 board/freescale/p2020come/p2020come.c       |    2 +-
 board/freescale/p2020ds/p2020ds.c           |    2 +-
 board/freescale/p2041rdb/p2041rdb.c         |    2 +-
 board/freescale/t1040qds/t1040qds.c         |    2 +-
 board/freescale/t104xrdb/t104xrdb.c         |    2 +-
 board/freescale/t208xqds/t208xqds.c         |    2 +-
 board/freescale/t208xrdb/t208xrdb.c         |    2 +-
 board/freescale/t4qds/t4240emu.c            |    2 +-
 board/freescale/t4qds/t4240qds.c            |    2 +-
 board/gdsys/p1022/controlcenterd.c          |    2 +-
 board/keymile/kmp204x/kmp204x.c             |    2 +-
 common/cmd_fdt.c                            |    2 +-
 common/fdt_support.c                        |    5 -----
 include/fdt_support.h                       |    1 -
 39 files changed, 37 insertions(+), 43 deletions(-)

Comments

Wolfgang Denk April 9, 2014, 2:26 p.m. UTC | #1
Dear Tom Rini,

In message <1397047800-26221-1-git-send-email-trini@ti.com> you wrote:
> The fdt_fixup_memory function is only used on PowerPC where we only
> claim one memory bank in U-Boot (and then in the device tree) so we can
> call a function that just calls fdt_fixup_memory_banks(..., 1).  Call
> this directly for consistency with other architectures.

I understand what you mean and what you want, but I'm not really
happy about it.

First, the description is not correct.  In my understanding a "bank"
of memory is some memory device which, on the hardware level, is
addressed using one specific chip select signal.  On PPC, we usually
have flexible memory controllers, so e can always map all existing
memory banks such that they for a single, contiguous region.

It is causing me some creepes to introduce code that claims it is
fixing memory for only one bank - I feel this is wrong.

And is dropping the (u64) not a problem?  bd->bi_memstart is just an
"unsigned long", but fdt_fixup_memory_banks() expects a u64 ?

Best regards,

Wolfgang Denk
Tom Rini April 9, 2014, 6:24 p.m. UTC | #2
On Wed, Apr 09, 2014 at 04:26:40PM +0200, Wolfgang Denk wrote:
> Dear Tom Rini,
> 
> In message <1397047800-26221-1-git-send-email-trini@ti.com> you wrote:
> > The fdt_fixup_memory function is only used on PowerPC where we only
> > claim one memory bank in U-Boot (and then in the device tree) so we can
> > call a function that just calls fdt_fixup_memory_banks(..., 1).  Call
> > this directly for consistency with other architectures.
> 
> I understand what you mean and what you want, but I'm not really
> happy about it.

Code or comment wise?

> First, the description is not correct.  In my understanding a "bank"
> of memory is some memory device which, on the hardware level, is
> addressed using one specific chip select signal.  On PPC, we usually
> have flexible memory controllers, so e can always map all existing
> memory banks such that they for a single, contiguous region.

Right, so we have a mismatch between function name
(fdt_fixup_memory_bank) and function of the node
(Documentation/devicetree/booting-without-of.txt in the kernel is,
sadly, the best description I can find of the memory node bindings).  We
itterate over the number of "banks" passed in (1 on PowerPC,
CONFIG_NR_DRAM_BANKS on ARM, which is between 1 and 4) and do, as the
binding expects, set the reg property correctly (base, size) for each
"bank".  It would be more correct to call this "ranges" rather than
"banks", or perhaps "nr_ranges".

> It is causing me some creepes to introduce code that claims it is
> fixing memory for only one bank - I feel this is wrong.
> 
> And is dropping the (u64) not a problem?  bd->bi_memstart is just an
> "unsigned long", but fdt_fixup_memory_banks() expects a u64 ?

Oops, I don't know how I missed that.  Or rather, what the hell is up
with calling fdt_fixup_memory() in two places on PowerPC?  I just
changed the call in board/freescale/t1040qds/t1040qds.c::ft_board_setup,
which uses phy_addr_t/phy_size_t on getenv_lowmem_... and this is fine, but
arch/powerpc/cpu/mpc85xx/fdt.c::ft_cpu_setup calls bd->bi_mem* and needs
a cast.
Wolfgang Denk April 9, 2014, 9:39 p.m. UTC | #3
Dear Tom,

In message <20140409182426.GV23803@bill-the-cat> you wrote:
> 
> > I understand what you mean and what you want, but I'm not really
> > happy about it.
> 
> Code or comment wise?

Both...

> Right, so we have a mismatch between function name
> (fdt_fixup_memory_bank) and function of the node
> (Documentation/devicetree/booting-without-of.txt in the kernel is,
> sadly, the best description I can find of the memory node bindings).  We
> itterate over the number of "banks" passed in (1 on PowerPC,
> CONFIG_NR_DRAM_BANKS on ARM, which is between 1 and 4) and do, as the

If I u nderstand correctly, CONFIG_NR_DRAM_BANKS gives only the
maximum possible number of banks.  On the actual system less banks may
be present.

> binding expects, set the reg property correctly (base, size) for each
> "bank".  It would be more correct to call this "ranges" rather than
> "banks", or perhaps "nr_ranges".

Yes, ture.  But then, AFAICT ARM has never made such clear definition
of terms, and for the tyical ARM memory controllers "range" and "bank"
are actually synonyms, so this never bothered anybody.

> > And is dropping the (u64) not a problem?  bd->bi_memstart is just an
> > "unsigned long", but fdt_fixup_memory_banks() expects a u64 ?
> 
> Oops, I don't know how I missed that.  Or rather, what the hell is up
> with calling fdt_fixup_memory() in two places on PowerPC?  I just
> changed the call in board/freescale/t1040qds/t1040qds.c::ft_board_setup,
> which uses phy_addr_t/phy_size_t on getenv_lowmem_... and this is fine, but
> arch/powerpc/cpu/mpc85xx/fdt.c::ft_cpu_setup calls bd->bi_mem* and needs
> a cast.

This should probably best be answered by the MPC85xx experts...

Best regards,

Wolfgang Denk
Tom Rini April 9, 2014, 11:12 p.m. UTC | #4
On Wed, Apr 09, 2014 at 11:39:10PM +0200, Wolfgang Denk wrote:
> Dear Tom,
> 
> In message <20140409182426.GV23803@bill-the-cat> you wrote:
> > 
> > > I understand what you mean and what you want, but I'm not really
> > > happy about it.
> > 
> > Code or comment wise?
> 
> Both...

OK, concept wise?

> > Right, so we have a mismatch between function name
> > (fdt_fixup_memory_bank) and function of the node
> > (Documentation/devicetree/booting-without-of.txt in the kernel is,
> > sadly, the best description I can find of the memory node bindings).  We
> > itterate over the number of "banks" passed in (1 on PowerPC,
> > CONFIG_NR_DRAM_BANKS on ARM, which is between 1 and 4) and do, as the
> 
> If I u nderstand correctly, CONFIG_NR_DRAM_BANKS gives only the
> maximum possible number of banks.  On the actual system less banks may
> be present.

If I recall correctly, when we have less populated banks than
CONFIG_NR_DRAM_BANKS we set size to 0, but I'll have to double check the
omap3 sdrc and emif code.

> > binding expects, set the reg property correctly (base, size) for each
> > "bank".  It would be more correct to call this "ranges" rather than
> > "banks", or perhaps "nr_ranges".
> 
> Yes, ture.  But then, AFAICT ARM has never made such clear definition
> of terms, and for the tyical ARM memory controllers "range" and "bank"
> are actually synonyms, so this never bothered anybody.

Well, the binding means "range" not "bank".  The usage of
CONFIG_NR_DRAM_BANKS within U-Boot is used to check for actual banks.
I'm not aware off-hand, but it's not impossible that we have
discontiguous DRAM chunks.  I know on omap3 we make sure to map them
contiguously.

The high level point here is to get things to the point of having a
single call we use for setting the /memory node for the kernel so that
we can then easily enough change things so that this depends on
CONFIG_something_or_another so that cases where we know we don't want to
modify the /memory node (it contains more memory than we can probe or
discontiguous ranges that again, we can't probe), we don't.
diff mbox

Patch

diff --git a/arch/powerpc/cpu/74xx_7xx/cpu.c b/arch/powerpc/cpu/74xx_7xx/cpu.c
index 6cd54bf..50608cf 100644
--- a/arch/powerpc/cpu/74xx_7xx/cpu.c
+++ b/arch/powerpc/cpu/74xx_7xx/cpu.c
@@ -292,7 +292,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
 			     "clock-frequency", bd->bi_intfreq, 1);
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 
 	fdt_fixup_ethernet(blob);
 }
diff --git a/arch/powerpc/cpu/mpc512x/cpu.c b/arch/powerpc/cpu/mpc512x/cpu.c
index 8508e8d..5041db7 100644
--- a/arch/powerpc/cpu/mpc512x/cpu.c
+++ b/arch/powerpc/cpu/mpc512x/cpu.c
@@ -183,7 +183,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_HAS_ETH0
 	fdt_fixup_ethernet(blob);
 #endif
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 }
 #endif
 
diff --git a/arch/powerpc/cpu/mpc5xxx/cpu.c b/arch/powerpc/cpu/mpc5xxx/cpu.c
index 7a463b5..7be7fd8 100644
--- a/arch/powerpc/cpu/mpc5xxx/cpu.c
+++ b/arch/powerpc/cpu/mpc5xxx/cpu.c
@@ -133,7 +133,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 	}
 
 #endif
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 }
 #endif
 
diff --git a/arch/powerpc/cpu/mpc8260/cpu.c b/arch/powerpc/cpu/mpc8260/cpu.c
index 6eed6f5..588699d 100644
--- a/arch/powerpc/cpu/mpc8260/cpu.c
+++ b/arch/powerpc/cpu/mpc8260/cpu.c
@@ -301,7 +301,7 @@  void ft_cpu_setup (void *blob, bd_t *bd)
 		"timebase-frequency", OF_TBCLK, 1);
 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
 		"clock-frequency", bd->bi_intfreq, 1);
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 }
 #endif /* CONFIG_OF_LIBFDT */
 
diff --git a/arch/powerpc/cpu/mpc83xx/fdt.c b/arch/powerpc/cpu/mpc83xx/fdt.c
index cce7d6b..346a1b3 100644
--- a/arch/powerpc/cpu/mpc83xx/fdt.c
+++ b/arch/powerpc/cpu/mpc83xx/fdt.c
@@ -122,7 +122,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 		"clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
 #endif
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 
 #if defined(CONFIG_BOOTCOUNT_LIMIT)
 	fdt_fixup_muram (blob);
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 33bc900..33e18d8 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -661,7 +661,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 		"clock-frequency", get_bus_freq(0), 1);
 #endif
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 
 #ifdef CONFIG_MP
 	ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);
diff --git a/arch/powerpc/cpu/mpc86xx/fdt.c b/arch/powerpc/cpu/mpc86xx/fdt.c
index 26a65c5..0523456 100644
--- a/arch/powerpc/cpu/mpc86xx/fdt.c
+++ b/arch/powerpc/cpu/mpc86xx/fdt.c
@@ -39,7 +39,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 	do_fixup_by_compat_u32(blob, "fsl,elbc",
 			       "bus-frequency", gd->arch.lbc_clk, 1);
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 
 #if defined(CONFIG_HAS_ETH0) || defined(CONFIG_HAS_ETH1) \
     || defined(CONFIG_HAS_ETH2) || defined(CONFIG_HAS_ETH3)
diff --git a/arch/powerpc/cpu/mpc8xx/fdt.c b/arch/powerpc/cpu/mpc8xx/fdt.c
index 97830e3..f9ad0c3 100644
--- a/arch/powerpc/cpu/mpc8xx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xx/fdt.c
@@ -26,5 +26,5 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 	/* Fixup ethernet MAC addresses */
 	fdt_fixup_ethernet(blob);
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 }
diff --git a/arch/powerpc/cpu/ppc4xx/fdt.c b/arch/powerpc/cpu/ppc4xx/fdt.c
index bd905d1..bbff2c1 100644
--- a/arch/powerpc/cpu/ppc4xx/fdt.c
+++ b/arch/powerpc/cpu/ppc4xx/fdt.c
@@ -120,7 +120,7 @@  void ft_cpu_setup(void *blob, bd_t *bd)
 		do_fixup_by_path_u32(blob, "/plb/ebc", "clock-frequency",
 			sys_info.freqEBC, 1);
 
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 
 	/*
 	 * Fixup all UART clocks for CPU internal UARTs
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 33099a4..62c3b47 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -300,7 +300,7 @@  void boot_prep_vxworks(bootm_headers_t *images)
 
 	off = fdt_path_offset(images->ft_addr, "/memory");
 	if (off < 0)
-		fdt_fixup_memory(images->ft_addr, base, size);
+		fdt_fixup_memory_banks(images->ft_addr, &base, &size, 1);
 
 #if defined(CONFIG_MP)
 #if defined(CONFIG_MPC85xx)
diff --git a/board/exmeritus/hww1u1a/hww1u1a.c b/board/exmeritus/hww1u1a/hww1u1a.c
index 97b84b3..43d7519 100644
--- a/board/exmeritus/hww1u1a/hww1u1a.c
+++ b/board/exmeritus/hww1u1a/hww1u1a.c
@@ -256,7 +256,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	FT_FSL_PCI_SETUP;
 }
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index d9c88a0..25f48e2 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -868,7 +868,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index 7fe4ae7..52e3fe1 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -60,7 +60,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	fdt_fixup_dr_usb(blob, bd);
 }
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index 9377280..a6ebdce 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -362,7 +362,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	FT_FSL_PCI_SETUP;
 	#endif
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
 	u32 porbmsr = in_be32(&gur->porbmsr);
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index f964d61..9e37c86 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -139,7 +139,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	FT_FSL_PCI_SETUP;
 #endif
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 	if (cpu->soc_ver == SVR_C291)
 		fdt_del_sec(blob, 1);
 	else if (cpu->soc_ver == SVR_C292)
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index 9212372..c33d23b 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -194,7 +194,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/mpc7448hpc2/mpc7448hpc2.c b/board/freescale/mpc7448hpc2/mpc7448hpc2.c
index 71b760c..3ae58f1 100644
--- a/board/freescale/mpc7448hpc2/mpc7448hpc2.c
+++ b/board/freescale/mpc7448hpc2/mpc7448hpc2.c
@@ -74,7 +74,7 @@  void
 ft_board_setup(void *blob, bd_t *bd)
 {
 	ft_cpu_setup(blob, bd);
-	fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize);
+	fdt_fixup_memory_banks(blob, &bd->bi_memstart, &bd->bi_memsize, 1);
 }
 #endif
 
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c
index 5686322..8f00c83 100644
--- a/board/freescale/mpc8572ds/mpc8572ds.c
+++ b/board/freescale/mpc8572ds/mpc8572ds.c
@@ -236,7 +236,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	FT_FSL_PCI_SETUP;
 
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index 62caf67..a99b5cc 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -455,7 +455,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	FT_FSL_PCI_SETUP;
 #endif
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #if defined(CONFIG_HAS_FSL_DR_USB)
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
index ba789a4..b5ad431 100644
--- a/board/freescale/p1022ds/p1022ds.c
+++ b/board/freescale/p1022ds/p1022ds.c
@@ -336,7 +336,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_HAS_FSL_DR_USB
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c
index d2d4f83..cd1c91d 100644
--- a/board/freescale/p1023rdb/p1023rdb.c
+++ b/board/freescale/p1023rdb/p1023rdb.c
@@ -134,7 +134,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_HAS_FSL_DR_USB
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p1023rds/p1023rds.c b/board/freescale/p1023rds/p1023rds.c
index d8c8745..699597f 100644
--- a/board/freescale/p1023rds/p1023rds.c
+++ b/board/freescale/p1023rds/p1023rds.c
@@ -180,7 +180,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	/* By default NOR is on, and NAND is disabled */
 #ifdef CONFIG_NAND_U_BOOT
diff --git a/board/freescale/p1_p2_rdb/p1_p2_rdb.c b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
index 3df557d..bb92285 100644
--- a/board/freescale/p1_p2_rdb/p1_p2_rdb.c
+++ b/board/freescale/p1_p2_rdb/p1_p2_rdb.c
@@ -244,7 +244,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	ft_pci_board_setup(blob);
 #endif /* #if defined(CONFIG_PCI) */
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #if defined(CONFIG_HAS_FSL_DR_USB)
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 5f3d6fd..0526e9b 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -430,7 +430,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	FT_FSL_PCI_SETUP;
 
diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c
index 0e0d058..dbfd2a0 100644
--- a/board/freescale/p1_twr/p1_twr.c
+++ b/board/freescale/p1_twr/p1_twr.c
@@ -265,7 +265,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	FT_FSL_PCI_SETUP;
 
diff --git a/board/freescale/p2020come/p2020come.c b/board/freescale/p2020come/p2020come.c
index f777bb9..ecf227d 100644
--- a/board/freescale/p2020come/p2020come.c
+++ b/board/freescale/p2020come/p2020come.c
@@ -264,7 +264,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	ft_pci_board_setup(blob);
 #endif
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_HAS_FSL_DR_USB
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p2020ds/p2020ds.c b/board/freescale/p2020ds/p2020ds.c
index a0cf927..6942f2c 100644
--- a/board/freescale/p2020ds/p2020ds.c
+++ b/board/freescale/p2020ds/p2020ds.c
@@ -240,7 +240,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_HAS_FSL_DR_USB
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index 8554512..c61c052 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -219,7 +219,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c
index 3dec447..ef0c0d6 100644
--- a/board/freescale/t1040qds/t1040qds.c
+++ b/board/freescale/t1040qds/t1040qds.c
@@ -209,7 +209,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c
index 6e29d64..b25cc9c 100644
--- a/board/freescale/t104xrdb/t104xrdb.c
+++ b/board/freescale/t104xrdb/t104xrdb.c
@@ -75,7 +75,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index 9cfc0bd..f4c1b09 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -443,7 +443,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index f3fec2a..b0b0584 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -108,7 +108,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c
index 7a61036..66ff3f1 100644
--- a/board/freescale/t4qds/t4240emu.c
+++ b/board/freescale/t4qds/t4240emu.c
@@ -73,7 +73,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 	fdt_fixup_liodn(blob);
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index 79b770b..8db4ed9 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -658,7 +658,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_PCI
 	pci_of_setup(blob, bd);
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 8ccd9ce..149d309 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -340,7 +340,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #ifdef CONFIG_HAS_FSL_DR_USB
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 95a19cd..3378ff5 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -216,7 +216,7 @@  void ft_board_setup(void *blob, bd_t *bd)
 	base = getenv_bootm_low();
 	size = getenv_bootm_size();
 
-	fdt_fixup_memory(blob, (u64)base, (u64)size);
+	fdt_fixup_memory_banks(blob, &base, &size, 1);
 
 #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB)
 	fdt_fixup_dr_usb(blob, bd);
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 3a9edd6..7bb2f2d 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -510,7 +510,7 @@  static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		int err;
 		addr = simple_strtoull(argv[2], NULL, 16);
 		size = simple_strtoull(argv[3], NULL, 16);
-		err = fdt_fixup_memory(working_fdt, addr, size);
+		err = fdt_fixup_memory_banks(working_fdt, &addr, &size, 1);
 		if (err < 0)
 			return err;
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index f9f358e..190244a 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -436,11 +436,6 @@  int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
 	return 0;
 }
 
-int fdt_fixup_memory(void *blob, u64 start, u64 size)
-{
-	return fdt_fixup_memory_banks(blob, &start, &size, 1);
-}
-
 void fdt_fixup_ethernet(void *fdt)
 {
 	int node, i, j;
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 9871e2f..d2d4c4e 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -38,7 +38,6 @@  void do_fixup_by_compat(void *fdt, const char *compat,
 			const char *prop, const void *val, int len, int create);
 void do_fixup_by_compat_u32(void *fdt, const char *compat,
 			    const char *prop, u32 val, int create);
-int fdt_fixup_memory(void *blob, u64 start, u64 size);
 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks);
 void fdt_fixup_ethernet(void *fdt);
 int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,