summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Dufour2012-12-19 11:23:44 +0100
committerJérémy Dufour2013-01-08 10:28:09 +0100
commita58b50b21279f6c5c410ef366326c5b965926cef (patch)
treefddf8be82c06850811e0c7c4c48c46b2c96aa1f3
parente71c8e52db6b6d4d5b86fa0d433153015b1fbf1c (diff)
cleo/linux/mach-spc300: generate MTD partition dynamically, refs #3579
With this commit, when Linux boots, it uses the function to generate the MTD partitions table dynamically based on the NVRAM, preventing using the static definitions.
-rw-r--r--cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-devices.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-devices.c b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-devices.c
index 66c5de7be3..0843698b35 100644
--- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-devices.c
+++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300-devices.c
@@ -39,6 +39,11 @@
#include "spc300.h"
/**
+ * Maximum number of partition supported.
+ */
+#define SPC300_MTD_PARTITION_NB_MAX 7
+
+/**
* UART Devices Structures
*/
static struct amba_device uart1_device = {
@@ -561,11 +566,19 @@ static int spc300_gen_mtd_partition_table(uint32_t nvram_offset,
void __init spc300_add_device_spidevs(struct spc300_flash_spi_dev *flash, struct spc300_afe_spi_dev *afe)
{
unsigned int pos = 0;
+ static struct mtd_partition mtd_part[SPC300_MTD_PARTITION_NB_MAX];
+ int nb_part;
if(flash)
{
spc300_spiflash_data.type = NULL;
- spc300_spiflash_data.parts = flash->parts;
- spc300_spiflash_data.nr_parts = flash->nb_parts;
+ nb_part
+ = spc300_gen_mtd_partition_table(nvram_offset,
+ &spidcom_nvram,
+ mtd_part,
+ SPC300_MTD_PARTITION_NB_MAX);
+ BUG_ON (nb_part < 0);
+ spc300_spiflash_data.parts = mtd_part;
+ spc300_spiflash_data.nr_parts = nb_part;
spc300_spi_devices[pos].max_speed_hz = flash->speed;
spc300_spi_devices[pos].mode = flash->spimode;
spc300_spi_devices[pos].chip_select = flash->cs;