* [U-Boot] [PATCH 2/2] ppc4xx: Add board specific function to return the detected flash size
@ 2010-09-16 12:23 Stefan Roese
2010-09-16 12:44 ` Wolfgang Denk
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Roese @ 2010-09-16 12:23 UTC (permalink / raw)
To: u-boot
This function will be called to fixup size of the "reg" property of the
NOR flash device tree nodes. Ebony can't use the weak default, since
it has a special chip-select to bank-number binding.
Signed-off-by: Stefan Roese <sr@denx.de>
---
board/amcc/ebony/flash.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/board/amcc/ebony/flash.c b/board/amcc/ebony/flash.c
index 8fe3ba1..79d2c4c 100644
--- a/board/amcc/ebony/flash.c
+++ b/board/amcc/ebony/flash.c
@@ -34,6 +34,7 @@
#include <common.h>
#include <ppc4xx.h>
#include <asm/processor.h>
+#include <asm/io.h>
#undef DEBUG
#ifdef DEBUG
@@ -71,6 +72,36 @@ static unsigned long flash_addr_table[8][CONFIG_SYS_MAX_FLASH_BANKS] = {
*/
static ulong flash_get_size(vu_long * addr, flash_info_t * info);
+/*
+ * Override the weak default mapping function with a board specific one
+ */
+u32 flash_get_bank_size(int cs, int idx)
+{
+ u8 reg = in_8((void *)CONFIG_SYS_FPGA_BASE);
+
+ if ((reg & BOOT_SMALL_FLASH) && !(reg & FLASH_ONBD_N)) {
+ /*
+ * cs0: small flash (512KiB)
+ * cs2: 2 * big flash (2 * 2MiB)
+ */
+ if (cs == 0)
+ return flash_info[2].size;
+ if (cs == 2)
+ return flash_info[0].size + flash_info[1].size;
+ } else {
+ /*
+ * cs0: 2 * big flash (2 * 2MiB)
+ * cs2: small flash (512KiB)
+ */
+ if (cs == 0)
+ return flash_info[0].size + flash_info[1].size;
+ if (cs == 2)
+ return flash_info[2].size;
+ }
+
+ return 0;
+}
+
unsigned long flash_init(void)
{
unsigned long total_b = 0;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH 2/2] ppc4xx: Add board specific function to return the detected flash size
2010-09-16 12:23 [U-Boot] [PATCH 2/2] ppc4xx: Add board specific function to return the detected flash size Stefan Roese
@ 2010-09-16 12:44 ` Wolfgang Denk
2010-09-16 12:51 ` Stefan Roese
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2010-09-16 12:44 UTC (permalink / raw)
To: u-boot
Dear Stefan Roese,
In message <1284639795-6702-1-git-send-email-sr@denx.de> you wrote:
> This function will be called to fixup size of the "reg" property of the
> NOR flash device tree nodes. Ebony can't use the weak default, since
> it has a special chip-select to bank-number binding.
>
> Signed-off-by: Stefan Roese <sr@denx.de>
> ---
> board/amcc/ebony/flash.c | 31 +++++++++++++++++++++++++++++++
> 1 files changed, 31 insertions(+), 0 deletions(-)
I think this commit must be merged into the previous one to keep the
code bi-sectable (my understanding is that Ebony will break / not work
correctly with only the first patch applied?).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"The whole problem with the world is that fools and fanatics are
always so certain of themselves, but wiser people so full of doubts."
- Bertrand Russell
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH 2/2] ppc4xx: Add board specific function to return the detected flash size
2010-09-16 12:44 ` Wolfgang Denk
@ 2010-09-16 12:51 ` Stefan Roese
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2010-09-16 12:51 UTC (permalink / raw)
To: u-boot
Hi Wolfgang,
On Thursday 16 September 2010 14:44:07 Wolfgang Denk wrote:
> > This function will be called to fixup size of the "reg" property of the
> > NOR flash device tree nodes. Ebony can't use the weak default, since
> > it has a special chip-select to bank-number binding.
> >
> > Signed-off-by: Stefan Roese <sr@denx.de>
> > ---
> >
> > board/amcc/ebony/flash.c | 31 +++++++++++++++++++++++++++++++
> > 1 files changed, 31 insertions(+), 0 deletions(-)
>
> I think this commit must be merged into the previous one to keep the
> code bi-sectable (my understanding is that Ebony will break / not work
> correctly with only the first patch applied?).
Without this patch, Ebony will continue to not work correctly (status quo).
Only with both patches applied, this problem is fixed.
But, yes. I can squash them together and pull them into the ppc4xx repository
for upstream merge, if nobody objects. Gerald, are you ok with this?
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-16 12:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-16 12:23 [U-Boot] [PATCH 2/2] ppc4xx: Add board specific function to return the detected flash size Stefan Roese
2010-09-16 12:44 ` Wolfgang Denk
2010-09-16 12:51 ` Stefan Roese
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.