diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-09-27 09:36:55 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-09-27 10:27:33 +0200 |
commit | 1c4a5d24a1d61092af11c1a889a67d5f6542b08d (patch) | |
tree | e6e1b98dc8abbc1c47bee3f6d671101c19fc4040 | |
parent | b349565fdcc46e36cc11b54942adc6628848d16a (diff) | |
download | barebox-1c4a5d24a1d61092af11c1a889a67d5f6542b08d.tar.gz barebox-1c4a5d24a1d61092af11c1a889a67d5f6542b08d.tar.xz |
pcm030: fix /dev/self0 and /dev/env0
/dev/self0 and /dev/env0 are in the last MB of nor flash. The
offset depends on the size of the flash, so detect this at
runtime.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/ppc/boards/pcm030/pcm030.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c index d1d84d2fb8..61fb11620f 100644 --- a/arch/ppc/boards/pcm030/pcm030.c +++ b/arch/ppc/boards/pcm030/pcm030.c @@ -36,6 +36,8 @@ #include <partition.h> #include <memory.h> #include <sizes.h> +#include <linux/stat.h> +#include <fs.h> static struct mpc5xxx_fec_platform_data fec_info = { .xcv_type = MII100, @@ -44,12 +46,14 @@ static struct mpc5xxx_fec_platform_data fec_info = { static int devices_init (void) { unsigned long sdramsize; + struct stat s; + int ret; /* * Flash can be 16MB or 32MB, setup for the last 32MB no matter * what we find later. */ - mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0001dd00); + mpc5200_setup_cs(MPC5200_BOOTCS, 0xfe000000, SZ_32M, 0x0008fd00); add_cfi_flash_device(-1, 0xfe000000, 32 * 1024 * 1024, 0); sdramsize = mpc5200_get_sdram_size(0) + mpc5200_get_sdram_size(1); @@ -58,8 +62,12 @@ static int devices_init (void) add_generic_device("fec_mpc5xxx", -1, NULL, MPC5XXX_FEC, 0, IORESOURCE_MEM, &fec_info); - devfs_add_partition("nor0", 0x00f00000, 0x40000, PARTITION_FIXED, "self0"); - devfs_add_partition("nor0", 0x00f60000, 0x20000, PARTITION_FIXED, "env0"); + ret = stat("/dev/nor0", &s); + if (ret) + return 0; + + devfs_add_partition("nor0", s.st_size - SZ_1M, SZ_512K, PARTITION_FIXED, "self0"); + devfs_add_partition("nor0", s.st_size - SZ_512K, SZ_512K, PARTITION_FIXED, "env0"); return 0; } |