diff options
author | Jonas Gorski <jogo@openwrt.org> | 2013-01-04 14:47:50 +0000 |
---|---|---|
committer | Jonas Gorski <jogo@openwrt.org> | 2013-01-04 14:47:50 +0000 |
commit | 0e58173fa51a079bf5f3f6ac9d3e7a956b991ba7 (patch) | |
tree | 8e6ddc60094cb8de52c66fea164bb73efadfd550 /target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch | |
parent | 10fc07daacfee223f869397d356d1481e4094e12 (diff) | |
download | master-31e0f0ae-0e58173fa51a079bf5f3f6ac9d3e7a956b991ba7.tar.gz master-31e0f0ae-0e58173fa51a079bf5f3f6ac9d3e7a956b991ba7.tar.bz2 master-31e0f0ae-0e58173fa51a079bf5f3f6ac9d3e7a956b991ba7.zip |
bcm63xx: Fix caldata partition mtd patch
Allow bcm63xxpart to receive a caldata offset if calibration data is contained in flash.
Tested-by: Álvaro Fernández Rojas <noltari@gmail.com>
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
SVN-Revision: 35010
Diffstat (limited to 'target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch')
-rw-r--r-- | target/linux/brcm63xx/patches-3.6/436-MTD-bcm63xxpart-allow-passing-a-caldata-offset.patch | 44 |
1 files changed, 23 insertions, 21 deletions
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 681bab2488..3b34eec6ba 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 <jonas.gorski@gmail.com> -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, |