From 812b787e7b06cc4dd0091d773404a4d01ddb1b15 Mon Sep 17 00:00:00 2001 From: jogo Date: Fri, 4 Jan 2013 14:47:50 +0000 Subject: bcm63xx: Fix caldata partition mtd patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow bcm63xxpart to receive a caldata offset if calibration data is contained in flash. Tested-by: Álvaro Fernández Rojas Signed-off-by: Jonas Gorski git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35010 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...cm63xxpart-allow-passing-a-caldata-offset.patch | 44 +++++++++++----------- 1 file changed, 23 insertions(+), 21 deletions(-) (limited to 'target/linux/brcm63xx') diff --git a/target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch b/target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch index 681bab248..3b34eec6b 100644 --- a/target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch +++ b/target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch @@ -1,18 +1,18 @@ -From 8ab86c5dc38ad4de1442e50e0adbc354d9184d71 Mon Sep 17 00:00:00 2001 -From: Jonas Gorski -Date: Tue, 1 May 2012 14:38:41 +0200 -Subject: [PATCH 68/79] MTD: bcm63xxpart: allow passing a caldata offset - Allow bcm63xxpart to receive a caldata offset if calibration data is contained in flash. --- - drivers/mtd/bcm63xxpart.c | 47 ++++++++++++++++++++++++++++++++++++++-- - include/linux/mtd/partitions.h | 2 ++ - 2 files changed, 47 insertions(+), 2 deletions(-) + 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 -@@ -80,6 +80,8 @@ static int bcm63xx_parse_cfe_partitions( +@@ -76,10 +76,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; @@ -21,10 +21,12 @@ contained in flash. int i; u32 computed_crc; bool rootfs_first = false; -@@ -94,6 +96,23 @@ static int bcm63xx_parse_cfe_partitions( +@@ -93,6 +95,24 @@ static int bcm63xx_parse_cfe_partitions( + cfelen = cfe_erasesize; nvramlen = bcm63xx_nvram_get_psi_size() * 1024; nvramlen = roundup(nvramlen, cfe_erasesize); - ++ nvramaddr = master->size - nvramlen; ++ + if (data) { + if (data->caldata[0]) { + caldatalen1 = cfe_erasesize; @@ -41,20 +43,19 @@ contained in flash. + caldatalen2 = 0; + } + } -+ + /* Allocate memory for buffer */ buf = vmalloc(sizeof(struct bcm_tag)); - if (!buf) -@@ -144,7 +163,7 @@ static int bcm63xx_parse_cfe_partitions( +@@ -144,7 +164,7 @@ static int bcm63xx_parse_cfe_partitions( rootfsaddr = 0; spareaddr = cfelen; } - sparelen = master->size - spareaddr - nvramlen; -+ sparelen = master->size - spareaddr - nvramlen - caldatalen1 - caldatalen2; ++ sparelen = min_not_zero(nvramaddr, caldataaddr1) - spareaddr; /* Determine number of partitions */ if (rootfslen > 0) -@@ -153,6 +172,12 @@ static int bcm63xx_parse_cfe_partitions( +@@ -153,6 +173,12 @@ static int bcm63xx_parse_cfe_partitions( if (kernellen > 0) nrparts++; @@ -67,7 +68,7 @@ contained in flash. /* Ask kernel for more memory */ parts = kzalloc(sizeof(*parts) * nrparts + 10 * nrparts, GFP_KERNEL); if (!parts) { -@@ -190,6 +215,23 @@ static int bcm63xx_parse_cfe_partitions( +@@ -190,15 +216,32 @@ static int bcm63xx_parse_cfe_partitions( curpart++; } @@ -89,15 +90,16 @@ contained in flash. + } + parts[curpart].name = "nvram"; - parts[curpart].offset = master->size - nvramlen; +- parts[curpart].offset = master->size - nvramlen; ++ parts[curpart].offset = nvramaddr; parts[curpart].size = nvramlen; -@@ -198,7 +240,8 @@ static int bcm63xx_parse_cfe_partitions( + 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 = master->size - cfelen - nvramlen -+ - caldatalen1 - caldatalen2; ++ 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, -- cgit v1.2.3