Skip to content

Commit

Permalink
[POWERPC] PIKA Warp: Update platform code to support Rev B boards
Browse files Browse the repository at this point in the history
* Switched from 64M NOR/64M NAND to 4M NOR/256M NAND.
* Full DTM support including critical temperature.
* Added POST information.
* Removed LED function, moved to new LED driver.
* Moved ad7414 to new style I2C initialization.

Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
  • Loading branch information
Sean MacLennan authored and Josh Boyer committed May 29, 2008
1 parent 0393cb6 commit 4ebef31
Show file tree
Hide file tree
Showing 3 changed files with 324 additions and 65 deletions.
47 changes: 44 additions & 3 deletions arch/powerpc/boot/cuboot-warp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,62 @@
#include "ops.h"
#include "4xx.h"
#include "cuboot.h"
#include "stdio.h"

#define TARGET_4xx
#define TARGET_44x
#include "ppcboot.h"

static bd_t bd;

static void warp_fixups(void)
static void warp_fixup_one_nor(u32 from, u32 to)
{
unsigned long sysclk = 66000000;
void *devp;
char name[50];
u32 v[2];

sprintf(name, "/plb/opb/ebc/nor_flash@0,0/partition@%x", from);

devp = finddevice(name);
if (!devp)
return;

if (getprop(devp, "reg", v, sizeof(v)) == sizeof(v)) {
v[0] = to;
setprop(devp, "reg", v, sizeof(v));

printf("NOR 64M fixup %x -> %x\r\n", from, to);
}
}


ibm440ep_fixup_clocks(sysclk, 11059200, 50000000);
static void warp_fixups(void)
{
ibm440ep_fixup_clocks(66000000, 11059200, 50000000);
ibm4xx_sdram_fixup_memsize();
ibm4xx_fixup_ebc_ranges("/plb/opb/ebc");
dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);

/* Fixup for 64M flash on Rev A boards. */
if (bd.bi_flashsize == 0x4000000) {
void *devp;
u32 v[3];

devp = finddevice("/plb/opb/ebc/nor_flash@0,0");
if (!devp)
return;

/* Fixup the size */
if (getprop(devp, "reg", v, sizeof(v)) == sizeof(v)) {
v[2] = bd.bi_flashsize;
setprop(devp, "reg", v, sizeof(v));
}

/* Fixup parition offsets */
warp_fixup_one_nor(0x300000, 0x3f00000);
warp_fixup_one_nor(0x340000, 0x3f40000);
warp_fixup_one_nor(0x380000, 0x3f80000);
}
}


Expand Down
49 changes: 37 additions & 12 deletions arch/powerpc/platforms/44x/warp-nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/ndfc.h>
#include <linux/of.h>
#include <asm/machdep.h>


#ifdef CONFIG_MTD_NAND_NDFC

#define CS_NAND_0 1 /* use chip select 1 for NAND device 0 */
Expand All @@ -35,13 +37,23 @@ static struct mtd_partition nand_parts[] = {
{
.name = "root",
.offset = 0x0200000,
.size = 0x3400000
.size = 0x3E00000
},
{
.name = "persistent",
.offset = 0x4000000,
.size = 0x4000000
},
{
.name = "user",
.offset = 0x3600000,
.size = 0x0A00000
.name = "persistent1",
.offset = 0x8000000,
.size = 0x4000000
},
{
.name = "persistent2",
.offset = 0xC000000,
.size = 0x4000000
}
};

struct ndfc_controller_settings warp_ndfc_settings = {
Expand All @@ -67,19 +79,15 @@ static struct platform_device warp_ndfc_device = {
.resource = &warp_ndfc,
};

static struct nand_ecclayout nand_oob_16 = {
.eccbytes = 3,
.eccpos = { 0, 1, 2, 3, 6, 7 },
.oobfree = { {.offset = 8, .length = 16} }
};

/* Do NOT set the ecclayout: let it default so it is correct for both
* 64M and 256M flash chips.
*/
static struct platform_nand_chip warp_nand_chip0 = {
.nr_chips = 1,
.chip_offset = CS_NAND_0,
.nr_partitions = ARRAY_SIZE(nand_parts),
.partitions = nand_parts,
.chip_delay = 50,
.ecclayout = &nand_oob_16,
.chip_delay = 20,
.priv = &warp_chip0_settings,
};

Expand All @@ -96,6 +104,23 @@ static struct platform_device warp_nand_device = {

static int warp_setup_nand_flash(void)
{
struct device_node *np;

/* Try to detect a rev A based on NOR size. */
np = of_find_compatible_node(NULL, NULL, "cfi-flash");
if (np) {
struct property *pp;

pp = of_find_property(np, "reg", NULL);
if (pp && (pp->length == 12)) {
u32 *v = pp->value;
if (v[2] == 0x4000000)
/* Rev A = 64M NAND */
warp_nand_chip0.nr_partitions = 2;
}
of_node_put(np);
}

platform_device_register(&warp_ndfc_device);
platform_device_register(&warp_nand_device);

Expand Down
Loading

0 comments on commit 4ebef31

Please sign in to comment.