[source] brcm63xx: drop support for caldata in brcm63xxpart

LEDE Commits lede-commits at lists.infradead.org
Sun Jun 4 02:35:43 PDT 2017


jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/092ac42e1e625defa637b0bd1181e351d430e15b

commit 092ac42e1e625defa637b0bd1181e351d430e15b
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Tue Feb 7 14:26:15 2017 +0100

    brcm63xx: drop support for caldata in brcm63xxpart
    
    Now that we always provide these partitions through DT, we don't need to
    pass their data through parser data from board files anymore.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
---
 .../412-MTD-physmap-allow-passing-pp_data.patch    |  41 -------
 .../414-MTD-m25p80-allow-passing-pp_data.patch     |  40 -------
 ...416-BCM63XX-add-a-fixup-for-ath9k-devices.patch |   4 +-
 ...cm63xxpart-allow-passing-a-caldata-offset.patch | 119 ---------------------
 ...8-MIPS-BCM63XX-pass-caldata-info-to-flash.patch |  84 ---------------
 .../420-BCM63XX-add-endian-check-for-ath9k.patch   |   2 +-
 .../421-BCM63XX-add-led-pin-for-ath9k.patch        |   2 +-
 ...22-BCM63XX-add-a-fixup-for-rt2x00-devices.patch |  22 ----
 .../425-bcm63xxpart_parse_paritions_from_dt.patch  |  75 +++----------
 .../brcm63xx/patches-4.4/511-board_V2500V.patch    |   2 +-
 10 files changed, 22 insertions(+), 369 deletions(-)

diff --git a/target/linux/brcm63xx/patches-4.4/412-MTD-physmap-allow-passing-pp_data.patch b/target/linux/brcm63xx/patches-4.4/412-MTD-physmap-allow-passing-pp_data.patch
deleted file mode 100644
index 1b472d7..0000000
--- a/target/linux/brcm63xx/patches-4.4/412-MTD-physmap-allow-passing-pp_data.patch
+++ /dev/null
@@ -1,41 +0,0 @@
-From 266c506f4b262bd6aba0776a03d82c98e65d9906 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Tue, 1 May 2012 17:32:36 +0200
-Subject: [PATCH 63/79] MTD: physmap: allow passing pp_data
-
----
- drivers/mtd/maps/physmap.c  |    4 +++-
- include/linux/mtd/physmap.h |    1 +
- 2 files changed, 4 insertions(+), 1 deletion(-)
-
---- a/drivers/mtd/maps/physmap.c
-+++ b/drivers/mtd/maps/physmap.c
-@@ -96,6 +96,7 @@ static int physmap_flash_probe(struct pl
- {
- 	struct physmap_flash_data *physmap_data;
- 	struct physmap_flash_info *info;
-+	struct mtd_part_parser_data *pp_data;
- 	const char * const *probe_type;
- 	const char * const *part_types;
- 	int err = 0;
-@@ -186,8 +187,9 @@ static int physmap_flash_probe(struct pl
- 	spin_lock_init(&info->vpp_lock);
- 
- 	part_types = physmap_data->part_probe_types ? : part_probe_types;
-+	pp_data = physmap_data->pp_data ? physmap_data->pp_data : NULL;
- 
--	mtd_device_parse_register(info->cmtd, part_types, NULL,
-+	mtd_device_parse_register(info->cmtd, part_types, pp_data,
- 				  physmap_data->parts, physmap_data->nr_parts);
- 	return 0;
- 
---- a/include/linux/mtd/physmap.h
-+++ b/include/linux/mtd/physmap.h
-@@ -31,6 +31,7 @@ struct physmap_flash_data {
- 	char                    *probe_type;
- 	struct mtd_partition	*parts;
- 	const char * const	*part_probe_types;
-+	struct mtd_part_parser_data *pp_data;
- };
- 
- #endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/target/linux/brcm63xx/patches-4.4/414-MTD-m25p80-allow-passing-pp_data.patch b/target/linux/brcm63xx/patches-4.4/414-MTD-m25p80-allow-passing-pp_data.patch
deleted file mode 100644
index c565ac0..0000000
--- a/target/linux/brcm63xx/patches-4.4/414-MTD-m25p80-allow-passing-pp_data.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 7f17dfe9009beb07a3de0e380932a725293829df Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Tue, 1 May 2012 17:33:03 +0200
-Subject: [PATCH 64/79] MTD: m25p80: allow passing pp_data
-
----
- drivers/mtd/devices/m25p80.c |    5 +++--
- include/linux/spi/flash.h    |    2 ++
- 2 files changed, 5 insertions(+)
-
---- a/drivers/mtd/devices/m25p80.c
-+++ b/drivers/mtd/devices/m25p80.c
-@@ -261,7 +261,8 @@ static int m25p_probe(struct spi_device
- 		return ret;
- 
- 	return mtd_device_parse_register(&nor->mtd,
--			data ? data->part_probe_types : NULL, NULL,
-+			data ? data->part_probe_types : NULL,
-+			data ? data->pp_data : NULL,
- 			data ? data->parts : NULL,
- 			data ? data->nr_parts : 0);
- }
---- a/include/linux/spi/flash.h
-+++ b/include/linux/spi/flash.h
-@@ -12,6 +12,7 @@ struct mtd_part_parser_data;
-  *	with chips that can't be queried for JEDEC or other IDs
-  * @part_probe_types: optional list of MTD parser names to use for
-  *	partitioning
-+ * @pp_data: optional partition parser data.
-  *
-  * Board init code (in arch/.../mach-xxx/board-yyy.c files) can
-  * provide information about SPI flash parts (such as DataFlash) to
-@@ -28,6 +29,7 @@ struct flash_platform_data {
- 	char		*type;
- 
- 	const char	**part_probe_types;
-+	struct mtd_part_parser_data *pp_data;
- 	/* we'll likely add more ... use JEDEC IDs, etc */
- };
- 
diff --git a/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch b/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch
index 7a7c825..7d01216 100644
--- a/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch
+++ b/target/linux/brcm63xx/patches-4.4/416-BCM63XX-add-a-fixup-for-ath9k-devices.patch
@@ -24,7 +24,7 @@ Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices
  obj-y		+= boards/
 --- /dev/null
 +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c
-@@ -0,0 +1,199 @@
+@@ -0,0 +1,201 @@
 +/*
 + *  Broadcom BCM63XX Ath9k EEPROM fixup helper.
 + *
@@ -41,11 +41,13 @@ Subject: [PATCH 61/72] BCM63XX: add a fixup for ath9k devices
 + *  by the Free Software Foundation.
 + */
 +
++#include <linux/if_ether.h>
 +#include <linux/pci.h>
 +#include <linux/delay.h>
 +#include <linux/ath9k_platform.h>
 +
 +#include <bcm63xx_cpu.h>
++#include <bcm63xx_regs.h>
 +#include <bcm63xx_io.h>
 +#include <bcm63xx_nvram.h>
 +#include <bcm63xx_dev_pci.h>
diff --git a/target/linux/brcm63xx/patches-4.4/417-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch b/target/linux/brcm63xx/patches-4.4/417-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch
deleted file mode 100644
index c055308..0000000
--- a/target/linux/brcm63xx/patches-4.4/417-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-Allow bcm63xxpart to receive a caldata offset if calibration data is
-contained in flash.
----
- drivers/mtd/bcm63xxpart.c      |   51 ++++++++++++++++++++++++++++++++++++---
- include/linux/mtd/partitions.h |    2 +
- 2 files changed, 49 insertions(+), 4 deletions(-)
-
---- a/drivers/mtd/bcm63xxpart.c
-+++ b/drivers/mtd/bcm63xxpart.c
-@@ -53,10 +53,12 @@ static int bcm63xx_parse_cfe_partitions(
- 	struct mtd_partition *parts;
- 	int ret;
- 	size_t retlen;
--	unsigned int rootfsaddr, kerneladdr, spareaddr;
-+	unsigned int rootfsaddr, kerneladdr, spareaddr, nvramaddr;
- 	unsigned int rootfslen, kernellen, sparelen, totallen;
- 	unsigned int cfelen, nvramlen;
- 	unsigned int cfe_erasesize;
-+	unsigned int caldatalen1 = 0, caldataaddr1 = 0;
-+	unsigned int caldatalen2 = 0, caldataaddr2 = 0;
- 	int i;
- 	u32 computed_crc;
- 	bool rootfs_first = false;
-@@ -70,6 +72,24 @@ static int bcm63xx_parse_cfe_partitions(
- 	cfelen = cfe_erasesize;
- 	nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;
- 	nvramlen = roundup(nvramlen, cfe_erasesize);
-+	nvramaddr = master->size - nvramlen;
-+
-+	if (data) {
-+		if (data->caldata[0]) {
-+			caldatalen1 = cfe_erasesize;
-+			caldataaddr1 = rounddown(data->caldata[0],
-+						 cfe_erasesize);
-+		}
-+		if (data->caldata[1]) {
-+			caldatalen2 = cfe_erasesize;
-+			caldataaddr2 = rounddown(data->caldata[1],
-+						 cfe_erasesize);
-+		}
-+		if (caldataaddr1 == caldataaddr2) {
-+			caldataaddr2 = 0;
-+			caldatalen2 = 0;
-+		}
-+	}
- 
- 	/* Allocate memory for buffer */
- 	buf = vmalloc(sizeof(struct bcm_tag));
-@@ -121,7 +141,7 @@ static int bcm63xx_parse_cfe_partitions(
- 		rootfsaddr = 0;
- 		spareaddr = cfelen;
- 	}
--	sparelen = master->size - spareaddr - nvramlen;
-+	sparelen = min_not_zero(nvramaddr, caldataaddr1) - spareaddr;
- 
- 	/* Determine number of partitions */
- 	if (rootfslen > 0)
-@@ -130,6 +150,12 @@ static int bcm63xx_parse_cfe_partitions(
- 	if (kernellen > 0)
- 		nrparts++;
- 
-+	if (caldatalen1 > 0)
-+		nrparts++;
-+
-+	if (caldatalen2 > 0)
-+		nrparts++;
-+
- 	/* Ask kernel for more memory */
- 	parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL);
- 	if (!parts) {
-@@ -167,15 +193,32 @@ static int bcm63xx_parse_cfe_partitions(
- 		curpart++;
- 	}
- 
-+	if (caldatalen1 > 0) {
-+		if (caldatalen2 > 0)
-+			parts[curpart].name = "cal_data1";
-+		else
-+			parts[curpart].name = "cal_data";
-+		parts[curpart].offset = caldataaddr1;
-+		parts[curpart].size = caldatalen1;
-+		curpart++;
-+	}
-+
-+	if (caldatalen2 > 0) {
-+		parts[curpart].name = "cal_data2";
-+		parts[curpart].offset = caldataaddr2;
-+		parts[curpart].size = caldatalen2;
-+		curpart++;
-+	}
-+
- 	parts[curpart].name = "nvram";
--	parts[curpart].offset = master->size - nvramlen;
-+	parts[curpart].offset = nvramaddr;
- 	parts[curpart].size = nvramlen;
- 	curpart++;
- 
- 	/* Global partition "linux" to make easy firmware upgrade */
- 	parts[curpart].name = "linux";
- 	parts[curpart].offset = cfelen;
--	parts[curpart].size = master->size - cfelen - nvramlen;
-+	parts[curpart].size = min_not_zero(nvramaddr, caldataaddr1) - cfelen;
- 
- 	for (i = 0; i < nrparts; i++)
- 		pr_info("Partition %d is %s offset %llx and length %llx\n", i,
---- a/include/linux/mtd/partitions.h
-+++ b/include/linux/mtd/partitions.h
-@@ -56,9 +56,11 @@ struct device_node;
- /**
-  * struct mtd_part_parser_data - used to pass data to MTD partition parsers.
-  * @origin: for RedBoot, start address of MTD device
-+ * @caldata: for CFE, start address of wifi calibration data
-  */
- struct mtd_part_parser_data {
- 	unsigned long origin;
-+	unsigned long caldata[2];
- };
- 
- 
diff --git a/target/linux/brcm63xx/patches-4.4/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch b/target/linux/brcm63xx/patches-4.4/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
deleted file mode 100644
index 5f51dac..0000000
--- a/target/linux/brcm63xx/patches-4.4/418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 977f8a30103b9c4992cab8f49357fe0d4274004f Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski at gmail.com>
-Date: Thu, 3 May 2012 14:55:26 +0200
-Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
-
----
- arch/mips/bcm63xx/boards/board_common.c              |    2 +-
- arch/mips/bcm63xx/dev-flash.c                          |    9 ++++++++-
- arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h |    4 +++-
- 3 files changed, 12 insertions(+), 3 deletions(-)
-
---- a/arch/mips/bcm63xx/boards/board_common.c
-+++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -255,7 +255,7 @@ int __init board_register_devices(void)
- 	if (board.num_spis)
- 		spi_register_board_info(board.spis, board.num_spis);
- 
--	bcm63xx_flash_register();
-+	bcm63xx_flash_register(board.has_caldata, board.caldata);
- 
- 	bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
- 	bcm63xx_led_data.leds = board.leds;
---- a/arch/mips/bcm63xx/dev-flash.c
-+++ b/arch/mips/bcm63xx/dev-flash.c
-@@ -39,12 +39,15 @@ static struct mtd_partition mtd_partitio
- 	}
- };
- 
-+static struct mtd_part_parser_data bcm63xx_parser_data;
-+
- static const char *bcm63xx_part_types[] = { "bcm63xxpart", "RedBoot", NULL };
- 
- static struct physmap_flash_data flash_data = {
- 	.width			= 2,
- 	.parts			= mtd_partitions,
- 	.part_probe_types	= bcm63xx_part_types,
-+	.pp_data		= &bcm63xx_parser_data,
- };
- 
- static struct resource mtd_resources[] = {
-@@ -72,6 +75,7 @@ void __init bcm63xx_flash_force_phys_bas
- 
- static struct flash_platform_data bcm63xx_flash_data = {
- 	.part_probe_types	= bcm63xx_part_types,
-+	.pp_data		= &bcm63xx_parser_data,
- };
- 
- static struct spi_board_info bcm63xx_spi_flash_info[] = {
-@@ -237,10 +241,14 @@ void __init bcm63xx_flash_detect(void)
- 	}
- }
- 
--int __init bcm63xx_flash_register(void)
-+int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata)
- {
- 	struct device_node *np;
- 	u32 val;
-+	unsigned int i;
-+
-+	for (i = 0; i < num_caldata; i++)
-+		bcm63xx_parser_data.caldata[i] = caldata[i].caldata_offset;
- 
- 	switch (flash_type) {
- 	case BCM63XX_FLASH_TYPE_PARALLEL:
---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
-+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
-@@ -1,6 +1,8 @@
- #ifndef __BCM63XX_FLASH_H
- #define __BCM63XX_FLASH_H
- 
-+#include <board_bcm963xx.h>
-+
- enum {
- 	BCM63XX_FLASH_TYPE_PARALLEL,
- 	BCM63XX_FLASH_TYPE_SERIAL,
-@@ -11,7 +13,7 @@ void bcm63xx_flash_detect(void);
- 
- void bcm63xx_flash_force_phys_base_address(u32 start, u32 end);
- 
--int __init bcm63xx_flash_register(void);
-+int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata);
- 
- int bcm63xx_flash_get_type(void);
- 
diff --git a/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch b/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch
index fd5cbfb..6599bf2 100644
--- a/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch
+++ b/target/linux/brcm63xx/patches-4.4/420-BCM63XX-add-endian-check-for-ath9k.patch
@@ -21,7 +21,7 @@
  /*
 --- a/arch/mips/bcm63xx/pci-ath9k-fixup.c
 +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c
-@@ -181,12 +181,14 @@ static void ath9k_pci_fixup(struct pci_d
+@@ -183,12 +183,14 @@ static void ath9k_pci_fixup(struct pci_d
  }
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup);
  
diff --git a/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch b/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch
index c18d8db..83ea2ad 100644
--- a/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch
+++ b/target/linux/brcm63xx/patches-4.4/421-BCM63XX-add-led-pin-for-ath9k.patch
@@ -11,7 +11,7 @@
  }
 --- a/arch/mips/bcm63xx/pci-ath9k-fixup.c
 +++ b/arch/mips/bcm63xx/pci-ath9k-fixup.c
-@@ -182,13 +182,15 @@ static void ath9k_pci_fixup(struct pci_d
+@@ -184,13 +184,15 @@ static void ath9k_pci_fixup(struct pci_d
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATHEROS, PCI_ANY_ID, ath9k_pci_fixup);
  
  void __init pci_enable_ath9k_fixup(unsigned slot, u32 offset,
diff --git a/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch b/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
index 2eb7a2c..ddc6f39 100644
--- a/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
+++ b/target/linux/brcm63xx/patches-4.4/422-BCM63XX-add-a-fixup-for-rt2x00-devices.patch
@@ -59,17 +59,6 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
  
  	return 0;
  }
---- a/arch/mips/bcm63xx/dev-flash.c
-+++ b/arch/mips/bcm63xx/dev-flash.c
-@@ -241,7 +241,7 @@ void __init bcm63xx_flash_detect(void)
- 	}
- }
- 
--int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata)
-+int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata)
- {
- 	struct device_node *np;
- 	u32 val;
 --- /dev/null
 +++ b/arch/mips/bcm63xx/pci-rt2x00-fixup.c
 @@ -0,0 +1,72 @@
@@ -145,17 +134,6 @@ Subject: [PATCH 72/72] 446-BCM63XX-add-a-fixup-for-rt2x00-devices
 +	rt2x00_num_fixups++;
 +}
 +
---- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
-+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
-@@ -13,7 +13,7 @@ void bcm63xx_flash_detect(void);
- 
- void bcm63xx_flash_force_phys_base_address(u32 start, u32 end);
- 
--int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata);
-+int __init bcm63xx_flash_register(int num_caldata, struct bcm63xx_caldata *caldata);
- 
- int bcm63xx_flash_get_type(void);
- 
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 @@ -10,6 +10,7 @@
diff --git a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch b/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
index d208a07..d64d42c 100644
--- a/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
+++ b/target/linux/brcm63xx/patches-4.4/425-bcm63xxpart_parse_paritions_from_dt.patch
@@ -8,7 +8,7 @@
  
  #include <asm/mach-bcm63xx/bcm63xx_nvram.h>
  #include <asm/mach-bcm63xx/bcm963xx_tag.h>
-@@ -43,66 +44,35 @@
+@@ -43,46 +44,35 @@
  
  #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
  
@@ -30,12 +30,10 @@
 +	u32 computed_crc;
  	int ret;
  	size_t retlen;
--	unsigned int rootfsaddr, kerneladdr, spareaddr, nvramaddr;
+-	unsigned int rootfsaddr, kerneladdr, spareaddr;
 -	unsigned int rootfslen, kernellen, sparelen, totallen;
 -	unsigned int cfelen, nvramlen;
 -	unsigned int cfe_erasesize;
--	unsigned int caldatalen1 = 0, caldataaddr1 = 0;
--	unsigned int caldatalen2 = 0, caldataaddr2 = 0;
 -	int i;
 -	u32 computed_crc;
 +	unsigned int rootfsaddr, kerneladdr;
@@ -51,24 +49,6 @@
 -	cfelen = cfe_erasesize;
 -	nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;
 -	nvramlen = roundup(nvramlen, cfe_erasesize);
--	nvramaddr = master->size - nvramlen;
--
--	if (data) {
--		if (data->caldata[0]) {
--			caldatalen1 = cfe_erasesize;
--			caldataaddr1 = rounddown(data->caldata[0],
--						 cfe_erasesize);
--		}
--		if (data->caldata[1]) {
--			caldatalen2 = cfe_erasesize;
--			caldataaddr2 = rounddown(data->caldata[1],
--						 cfe_erasesize);
--		}
--		if (caldataaddr1 == caldataaddr2) {
--			caldataaddr2 = 0;
--			caldatalen2 = 0;
--		}
--	}
 +	int curr_part = next_part;
  
  	/* Allocate memory for buffer */
@@ -90,7 +70,7 @@
  	}
  
  	computed_crc = crc32_le(IMAGETAG_CRC_START, (u8 *)buf,
-@@ -121,7 +91,6 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -101,7 +91,6 @@ static int bcm63xx_parse_cfe_partitions(
  
  		kerneladdr = kerneladdr - BCM63XX_EXTENDED_SIZE;
  		rootfsaddr = rootfsaddr - BCM63XX_EXTENDED_SIZE;
@@ -98,7 +78,7 @@
  
  		if (rootfsaddr < kerneladdr) {
  			/* default Broadcom layout */
-@@ -130,8 +99,8 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -110,8 +99,8 @@ static int bcm63xx_parse_cfe_partitions(
  		} else {
  			/* OpenWrt layout */
  			rootfsaddr = kerneladdr + kernellen;
@@ -109,22 +89,20 @@
  		}
  	} else {
  		pr_warn("CFE boot tag CRC invalid (expected %08x, actual %08x)\n",
-@@ -139,16 +108,153 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -119,23 +108,139 @@ static int bcm63xx_parse_cfe_partitions(
  		kernellen = 0;
  		rootfslen = 0;
  		rootfsaddr = 0;
 -		spareaddr = cfelen;
  	}
--	sparelen = min_not_zero(nvramaddr, caldataaddr1) - spareaddr;
+-	sparelen = master->size - spareaddr - nvramlen;
  
 -	/* Determine number of partitions */
 -	if (rootfslen > 0)
 -		nrparts++;
 +	if (kernellen > 0) {
 +		int kernelpart = curr_part;
- 
--	if (kernellen > 0)
--		nrparts++;
++
 +		if (rootfslen > 0 && rootfs_first)
 +			kernelpart++;
 +		pparts[kernelpart].name = "kernel";
@@ -232,8 +210,6 @@
 +	unsigned int nvramaddr;
 +	unsigned int cfelen, nvramlen;
 +	unsigned int cfe_erasesize;
-+	unsigned int caldatalen1 = 0, caldataaddr1 = 0;
-+	unsigned int caldatalen2 = 0, caldataaddr2 = 0;
 +	unsigned int imageaddr, imagelen;
 +	int i;
 +
@@ -247,30 +223,11 @@
 +	nvramlen = bcm63xx_nvram_get_psi_size() * SZ_1K;
 +	nvramlen = roundup(nvramlen, cfe_erasesize);
 +	nvramaddr = master->size - nvramlen;
-+
-+	if (data) {
-+		if (data->caldata[0]) {
-+			caldatalen1 = cfe_erasesize;
-+			caldataaddr1 = rounddown(data->caldata[0],
-+						 cfe_erasesize);
-+		}
-+		if (data->caldata[1]) {
-+			caldatalen2 = cfe_erasesize;
-+			caldataaddr2 = rounddown(data->caldata[1],
-+						 cfe_erasesize);
-+		}
-+		if (caldataaddr1 == caldataaddr2) {
-+			caldataaddr2 = 0;
-+			caldatalen2 = 0;
-+		}
-+	}
-+
-+	imageaddr = cfelen;
-+	imagelen = min_not_zero(nvramaddr, caldataaddr1) - imageaddr;
  
- 	if (caldatalen1 > 0)
- 		nrparts++;
-@@ -158,10 +264,8 @@ static int bcm63xx_parse_cfe_partitions(
+-	if (kernellen > 0)
+-		nrparts++;
++	imageaddr = cfelen;
++	imagelen = nvramaddr - imageaddr;
  
  	/* Ask kernel for more memory */
  	parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL);
@@ -282,7 +239,7 @@
  
  	/* Start building partition list */
  	parts[curpart].name = "CFE";
-@@ -169,29 +273,7 @@ static int bcm63xx_parse_cfe_partitions(
+@@ -143,29 +248,7 @@ static int bcm63xx_parse_cfe_partitions(
  	parts[curpart].size = cfelen;
  	curpart++;
  
@@ -311,14 +268,14 @@
 -	}
 +	curpart += parse_bcmtag(master, parts, curpart, imageaddr, imagelen);
  
- 	if (caldatalen1 > 0) {
- 		if (caldatalen2 > 0)
-@@ -217,25 +299,33 @@ static int bcm63xx_parse_cfe_partitions(
+ 	parts[curpart].name = "nvram";
+ 	parts[curpart].offset = master->size - nvramlen;
+@@ -174,25 +257,33 @@ static int bcm63xx_parse_cfe_partitions(
  
  	/* Global partition "linux" to make easy firmware upgrade */
  	parts[curpart].name = "linux";
 -	parts[curpart].offset = cfelen;
--	parts[curpart].size = min_not_zero(nvramaddr, caldataaddr1) - cfelen;
+-	parts[curpart].size = master->size - cfelen - nvramlen;
 +	parts[curpart].offset = imageaddr;
 +	parts[curpart].size = imagelen;
 +	curpart++;
diff --git a/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch b/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch
index 175e8fc..5eca1b6 100644
--- a/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch
+++ b/target/linux/brcm63xx/patches-4.4/511-board_V2500V.patch
@@ -77,7 +77,7 @@
  #include <bcm63xx_cpu.h>
  #include <bcm63xx_dev_flash.h>
  #include <bcm63xx_dev_hsspi.h>
-@@ -261,6 +262,13 @@ int __init bcm63xx_flash_register(int nu
+@@ -253,6 +254,13 @@ int __init bcm63xx_flash_register(void)
  			val = bcm_mpi_readl(MPI_CSBASE_REG(0));
  			val &= MPI_CSBASE_BASE_MASK;
  



More information about the lede-commits mailing list