1 From bda508f975d1372568a4fc9862be501a6176fd46 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 12 May 2012 23:04:17 +0200
4 Subject: [PATCH v2 2/3] MIPS: BCM63XX: export PSI size from nvram
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
8 arch/mips/bcm63xx/nvram.c | 13 +++++++++++++
9 arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h | 7 +++++++
10 2 files changed, 20 insertions(+)
12 --- a/arch/mips/bcm63xx/nvram.c
13 +++ b/arch/mips/bcm63xx/nvram.c
15 #include <linux/export.h>
16 #include <linux/kernel.h>
17 #include <linux/if_ether.h>
18 +#include <linux/sizes.h>
20 #include <bcm63xx_nvram.h>
22 @@ -35,6 +36,8 @@ struct bcm963xx_nvram {
26 +#define BCM63XX_DEFAULT_PSI_SIZE SZ_64K
28 static struct bcm963xx_nvram nvram;
29 static int mac_addr_used;
31 @@ -104,3 +107,13 @@ int bcm63xx_nvram_get_mac_address(u8 *ma
34 EXPORT_SYMBOL(bcm63xx_nvram_get_mac_address);
36 +unsigned int bcm63xx_nvram_get_psi_size(void)
38 + /* max is 64k, but some vendors use higher values */
39 + if (nvram.psi_size > 0 && nvram.psi_size <= 512)
40 + return nvram.psi_size * SZ_1K;
42 + return BCM63XX_DEFAULT_PSI_SIZE;
44 +EXPORT_SYMBOL(bcm63xx_nvram_get_psi_size);
45 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
46 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_nvram.h
47 @@ -30,4 +30,11 @@ u8 *bcm63xx_nvram_get_name(void);
49 int bcm63xx_nvram_get_mac_address(u8 *mac);
52 + * bcm63xx_nvram_get_psi_size() - returns the size of the PSI area
54 + * Returns the size of the Persitent Storage Information area in bytes.
56 +unsigned int bcm63xx_nvram_get_psi_size(void);
58 #endif /* BCM63XX_NVRAM_H */