diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-09-15 12:51:57 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-09-19 14:27:26 +0200 |
commit | 0b3a64f862b367e634d1d4f8b4b94a10e0128dd4 (patch) | |
tree | 399a1dd4cf164876013a77edd93692fafb16a34c /target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c | |
parent | 58fbe07560fdb07a20a07f01f6cf97635a3ccab3 (diff) | |
download | upstream-0b3a64f862b367e634d1d4f8b4b94a10e0128dd4.tar.gz upstream-0b3a64f862b367e634d1d4f8b4b94a10e0128dd4.tar.bz2 upstream-0b3a64f862b367e634d1d4f8b4b94a10e0128dd4.zip |
cns3xxx: eliminate hardcoded kernel/rootfs partition split
This changes the sysupgrade format. To support upgrades from the old
firmware to the new one, legacy images are provided. Because of the old
partition split, these have to be specific to the NOR or SPI device.
The new sysupgrade images are suitable for begin put on flash directly,
and they are independent of NOR vs SPI flash variant.
Flashing back to old firmware is supported via using the old full-flash
images instead of the old sysupgrade images.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c')
-rw-r--r-- | target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c | 62 |
1 files changed, 11 insertions, 51 deletions
diff --git a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c index 664492a7e1..5df69f3c4a 100644 --- a/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c +++ b/target/linux/cns3xxx/files/arch/arm/mach-cns3xxx/laguna.c @@ -122,13 +122,8 @@ static struct mtd_partition laguna_nor_partitions[] = { .size = SZ_128K, .offset = SZ_256K, }, { - .name = "kernel", - .size = SZ_2M, + .name = "firmware", .offset = SZ_256K + SZ_128K, - }, { - .name = "rootfs", - .size = SZ_16M - SZ_256K - SZ_128K - SZ_2M, - .offset = SZ_256K + SZ_128K + SZ_2M, }, }; @@ -168,13 +163,8 @@ static struct mtd_partition laguna_spi_partitions[] = { .size = SZ_256K, .offset = SZ_256K, }, { - .name = "kernel", - .size = SZ_1M + SZ_512K, + .name = "firmware", .offset = SZ_512K, - }, { - .name = "rootfs", - .size = SZ_16M - SZ_2M, - .offset = SZ_2M, }, }; @@ -1017,49 +1007,19 @@ static int __init laguna_model_setup(void) platform_device_register(&laguna_uart); if (laguna_info.config2_bitmap & (NOR_FLASH_LOAD)) { - switch (laguna_info.nor_flash_size) { - case 1: - laguna_nor_partitions[3].size = SZ_8M - SZ_256K - SZ_128K - SZ_2M; - laguna_nor_res.end = CNS3XXX_FLASH_BASE + SZ_8M - 1; - break; - case 2: - laguna_nor_partitions[3].size = SZ_16M - SZ_256K - SZ_128K - SZ_2M; - laguna_nor_res.end = CNS3XXX_FLASH_BASE + SZ_16M - 1; - break; - case 3: - laguna_nor_partitions[3].size = SZ_32M - SZ_256K - SZ_128K - SZ_2M; - laguna_nor_res.end = CNS3XXX_FLASH_BASE + SZ_32M - 1; - break; - case 4: - laguna_nor_partitions[3].size = SZ_64M - SZ_256K - SZ_128K - SZ_2M; - laguna_nor_res.end = CNS3XXX_FLASH_BASE + SZ_64M - 1; - break; - case 5: - laguna_nor_partitions[3].size = SZ_128M - SZ_256K - SZ_128K - SZ_2M; - laguna_nor_res.end = CNS3XXX_FLASH_BASE + SZ_128M - 1; - break; - } + laguna_nor_partitions[2].size = + (SZ_4M << laguna_info.nor_flash_size) - + laguna_nor_partitions[2].offset; + laguna_nor_res.end = CNS3XXX_FLASH_BASE + + laguna_nor_partitions[2].offset + + laguna_nor_partitions[2].size - 1; platform_device_register(&laguna_nor_pdev); } if (laguna_info.config2_bitmap & (SPI_FLASH_LOAD)) { - switch (laguna_info.spi_flash_size) { - case 1: - laguna_spi_partitions[3].size = SZ_4M - SZ_2M; - break; - case 2: - laguna_spi_partitions[3].size = SZ_8M - SZ_2M; - break; - case 3: - laguna_spi_partitions[3].size = SZ_16M - SZ_2M; - break; - case 4: - laguna_spi_partitions[3].size = SZ_32M - SZ_2M; - break; - case 5: - laguna_spi_partitions[3].size = SZ_64M - SZ_2M; - break; - } + laguna_spi_partitions[2].size = + (SZ_2M << laguna_info.spi_flash_size) - + laguna_spi_partitions[2].offset; spi_register_board_info(ARRAY_AND_SIZE(laguna_spi_devices)); } |