Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144259
b: refs/heads/master
c: 644e28f
h: refs/heads/master
i:
  144257: 171fe6b
  144255: 8bf7802
v: v3
  • Loading branch information
Valentine Barshak authored and Josh Boyer committed Apr 24, 2009
1 parent 05bbc0a commit 64b3e38
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9ae2ccf26416ed52874718e2b0c8e6813253263a
refs/heads/master: 644e28f3426810710b176080cc906995ebc24b63
56 changes: 43 additions & 13 deletions trunk/arch/powerpc/boot/4xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,33 @@ void ibm440spe_fixup_memsize(void)

#define DDR_GET_VAL(val, mask, shift) (((val) >> (shift)) & (mask))

void ibm4xx_denali_fixup_memsize(void)
/*
* Some U-Boot versions set the number of chipselects to two
* for Sequoia/Rainier boards while they only have one chipselect
* hardwired. Hardcode the number of chipselects to one
* for sequioa/rainer board models or read the actual value
* from the memory controller register DDR0_10 otherwise.
*/
static inline u32 ibm4xx_denali_get_cs(void)
{
u32 val, max_cs, max_col, max_row;
u32 cs, col, row, bank, dpath;
unsigned long memsize;
void *devp;
char model[64];
u32 val, cs;

val = SDRAM0_READ(DDR0_02);
if (!DDR_GET_VAL(val, DDR_START, DDR_START_SHIFT))
fatal("DDR controller is not initialized\n");
devp = finddevice("/");
if (!devp)
goto read_cs;

/* get maximum cs col and row values */
max_cs = DDR_GET_VAL(val, DDR_MAX_CS_REG, DDR_MAX_CS_REG_SHIFT);
max_col = DDR_GET_VAL(val, DDR_MAX_COL_REG, DDR_MAX_COL_REG_SHIFT);
max_row = DDR_GET_VAL(val, DDR_MAX_ROW_REG, DDR_MAX_ROW_REG_SHIFT);
if (getprop(devp, "model", model, sizeof(model)) <= 0)
goto read_cs;

model[sizeof(model)-1] = 0;

if (!strcmp(model, "amcc,sequoia") ||
!strcmp(model, "amcc,rainier"))
return 1;

read_cs:
/* get CS value */
val = SDRAM0_READ(DDR0_10);

Expand All @@ -183,7 +195,25 @@ void ibm4xx_denali_fixup_memsize(void)
cs++;
val = val >> 1;
}
return cs;
}

void ibm4xx_denali_fixup_memsize(void)
{
u32 val, max_cs, max_col, max_row;
u32 cs, col, row, bank, dpath;
unsigned long memsize;

val = SDRAM0_READ(DDR0_02);
if (!DDR_GET_VAL(val, DDR_START, DDR_START_SHIFT))
fatal("DDR controller is not initialized\n");

/* get maximum cs col and row values */
max_cs = DDR_GET_VAL(val, DDR_MAX_CS_REG, DDR_MAX_CS_REG_SHIFT);
max_col = DDR_GET_VAL(val, DDR_MAX_COL_REG, DDR_MAX_COL_REG_SHIFT);
max_row = DDR_GET_VAL(val, DDR_MAX_ROW_REG, DDR_MAX_ROW_REG_SHIFT);

cs = ibm4xx_denali_get_cs();
if (!cs)
fatal("No memory installed\n");
if (cs > max_cs)
Expand All @@ -193,9 +223,9 @@ void ibm4xx_denali_fixup_memsize(void)
val = SDRAM0_READ(DDR0_14);

if (DDR_GET_VAL(val, DDR_REDUC, DDR_REDUC_SHIFT))
dpath = 8; /* 64 bits */
else
dpath = 4; /* 32 bits */
else
dpath = 8; /* 64 bits */

/* get address pins (rows) */
val = SDRAM0_READ(DDR0_42);
Expand Down

0 comments on commit 64b3e38

Please sign in to comment.