bcm63xx: update patches with upstream submissions
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-3.8 / 032-MTD-bcm63xxpart-use-nvram-for-PSI-size.patch
1 From f6eefaa4a08ec27c69485c2fc4db23247b84f8c9 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Tue, 1 May 2012 14:10:39 +0200
4 Subject: [PATCH v2 3/3] MTD: bcm63xxpart: use nvram for PSI size
5
6 Read out the SPI size from nvram instead of defaulting to 64K - some
7 vendors actually use values larger than the "max" value of 64.
8
9 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 ---
11 drivers/mtd/bcm63xxpart.c | 6 ++++--
12 1 file changed, 4 insertions(+), 2 deletions(-)
13
14 --- a/drivers/mtd/bcm63xxpart.c
15 +++ b/drivers/mtd/bcm63xxpart.c
16 @@ -4,7 +4,7 @@
17 * Copyright © 2006-2008 Florian Fainelli <florian@openwrt.org>
18 * Mike Albon <malbon@openwrt.org>
19 * Copyright © 2009-2010 Daniel Dickinson <openwrt@cshore.neomailbox.net>
20 - * Copyright © 2011-2012 Jonas Gorski <jonas.gorski@gmail.com>
21 + * Copyright © 2011-2013 Jonas Gorski <jonas.gorski@gmail.com>
22 *
23 * This program is free software; you can redistribute it and/or modify
24 * it under the terms of the GNU General Public License as published by
25 @@ -34,6 +34,7 @@
26 #include <linux/mtd/partitions.h>
27
28 #include <linux/bcm963xx_tag.h>
29 +#include <asm/mach-bcm63xx/bcm63xx_nvram.h>
30 #include <asm/mach-bcm63xx/board_bcm963xx.h>
31
32 #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
33 @@ -91,7 +92,8 @@ static int bcm63xx_parse_cfe_partitions(
34 BCM63XX_CFE_BLOCK_SIZE);
35
36 cfelen = cfe_erasesize;
37 - nvramlen = cfe_erasesize;
38 + nvramlen = bcm63xx_nvram_get_psi_size();
39 + nvramlen = roundup(nvramlen, cfe_erasesize);
40
41 /* Allocate memory for buffer */
42 buf = vmalloc(sizeof(struct bcm_tag));