diff mbox

[OpenWrt-Devel,4/6] bcm53xx: increase nvram allocation size to 64k

Message ID 20150310033028.9542.7205.stgit@perseus.themaw.net
State Superseded
Delegated to: Rafał Miłecki
Headers show

Commit Message

Ian Kent March 10, 2015, 3:30 a.m. UTC
The R8000 nvram is larger than 32k, increase nvram allocation to
64k to accomadate.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 ...3xx-increase-nvram-allocation-size-to-64k.patch |   19 +++++++++++++++++++
 ...3xx-increase-nvram-allocation-size-to-64k.patch |   20 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 target/linux/bcm53xx/patches-3.14/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch
 create mode 100644 target/linux/bcm53xx/patches-3.18/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch

Comments

Rafał Miłecki April 2, 2015, 7:45 a.m. UTC | #1
On 10 March 2015 at 04:30, Ian Kent <raven@themaw.net> wrote:
> The R8000 nvram is larger than 32k, increase nvram allocation to
> 64k to accomadate.

I handled this by sending nvram.c patch for mainline:
http://patchwork.linux-mips.org/patch/9651/
And backporting all changes to bcm53xx:
https://dev.openwrt.org/changeset/45204/
Ian Kent April 2, 2015, 9:47 a.m. UTC | #2
On Thu, 2015-04-02 at 09:45 +0200, Rafał Miłecki wrote:
> On 10 March 2015 at 04:30, Ian Kent <raven@themaw.net> wrote:
> > The R8000 nvram is larger than 32k, increase nvram allocation to
> > 64k to accomadate.
> 
> I handled this by sending nvram.c patch for mainline:
> http://patchwork.linux-mips.org/patch/9651/
> And backporting all changes to bcm53xx:
> https://dev.openwrt.org/changeset/45204/

OK, help me out with this patch.

I thought it was necessary to calculate a from starting offset based on
mtd size and nvram size since the code assumes the nvram partition might
not start at 0 whereas in the patch it looks like a 0 starting offset is
assumed?

When I was working on this area of code, IIRC, the from offset was
actually not 0.

Ian
Ian Kent April 2, 2015, 9:57 a.m. UTC | #3
On Thu, 2015-04-02 at 17:47 +0800, Ian Kent wrote:
> On Thu, 2015-04-02 at 09:45 +0200, Rafał Miłecki wrote:
> > On 10 March 2015 at 04:30, Ian Kent <raven@themaw.net> wrote:
> > > The R8000 nvram is larger than 32k, increase nvram allocation to
> > > 64k to accomadate.
> > 
> > I handled this by sending nvram.c patch for mainline:
> > http://patchwork.linux-mips.org/patch/9651/
> > And backporting all changes to bcm53xx:
> > https://dev.openwrt.org/changeset/45204/
> 
> OK, help me out with this patch.
> 
> I thought it was necessary to calculate a from starting offset based on
> mtd size and nvram size since the code assumes the nvram partition might
> not start at 0 whereas in the patch it looks like a 0 starting offset is
> assumed?
> 
> When I was working on this area of code, IIRC, the from offset was
> actually not 0.

Mmm .. so that's probably wrong since ...

 mtd = get_mtd_device_nm("nvram");

Should get us the start of the nvram partition at offset 0.

> 
> Ian
Rafał Miłecki April 2, 2015, 10:23 a.m. UTC | #4
On 2 April 2015 at 11:57, Ian Kent <raven@themaw.net> wrote:
> On Thu, 2015-04-02 at 17:47 +0800, Ian Kent wrote:
>> On Thu, 2015-04-02 at 09:45 +0200, Rafał Miłecki wrote:
>> > On 10 March 2015 at 04:30, Ian Kent <raven@themaw.net> wrote:
>> > > The R8000 nvram is larger than 32k, increase nvram allocation to
>> > > 64k to accomadate.
>> >
>> > I handled this by sending nvram.c patch for mainline:
>> > http://patchwork.linux-mips.org/patch/9651/
>> > And backporting all changes to bcm53xx:
>> > https://dev.openwrt.org/changeset/45204/
>>
>> OK, help me out with this patch.
>>
>> I thought it was necessary to calculate a from starting offset based on
>> mtd size and nvram size since the code assumes the nvram partition might
>> not start at 0 whereas in the patch it looks like a 0 starting offset is
>> assumed?
>>
>> When I was working on this area of code, IIRC, the from offset was
>> actually not 0.
>
> Mmm .. so that's probably wrong since ...
>
>  mtd = get_mtd_device_nm("nvram");
>
> Should get us the start of the nvram partition at offset 0.

That's right, if something doesn't work for you, let me know.
diff mbox

Patch

diff --git a/target/linux/bcm53xx/patches-3.14/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch b/target/linux/bcm53xx/patches-3.14/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch
new file mode 100644
index 0000000..89763eb
--- /dev/null
+++ b/target/linux/bcm53xx/patches-3.14/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch
@@ -0,0 +1,19 @@ 
+bcm53xx: increase nvram allocation size to 64k
+
+The R8000 nvram is too large for the 32k allocation size in
+bcm47xx_nvram.c.
+
+Increase the allocation size to 64k.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
+@@ -20,7 +20,7 @@
+ #include <linux/bcm47xx_nvram.h>
+
+ #define NVRAM_MAGIC			0x48534C46	/* 'FLSH' */
+-#define NVRAM_SPACE			0x8000
++#define NVRAM_SPACE			0x10000
+ #define NVRAM_MAX_GPIO_ENTRIES		32
+ #define NVRAM_MAX_GPIO_VALUE_LEN	30
+
diff --git a/target/linux/bcm53xx/patches-3.18/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch b/target/linux/bcm53xx/patches-3.18/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch
new file mode 100644
index 0000000..3382549
--- /dev/null
+++ b/target/linux/bcm53xx/patches-3.18/113-bcm53xx-increase-nvram-allocation-size-to-64k.patch
@@ -0,0 +1,20 @@ 
+bcm53xx: increase nvram allocation size to 64k
+
+The R8000 nvram is too large for the 32k allocation size in
+bcm47xx_nvram.c.
+
+Increase the allocation size to 64k.
+
+Signed-off-by: Ian Kent <raven@themaw.net>
+
+--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
+@@ -20,7 +20,7 @@
+ #include <linux/bcm47xx_nvram.h>
+
+ #define NVRAM_MAGIC			0x48534C46	/* 'FLSH' */
+-#define NVRAM_SPACE			0x8000
++#define NVRAM_SPACE			0x10000
+ #define NVRAM_MAX_GPIO_ENTRIES		32
+ #define NVRAM_MAX_GPIO_VALUE_LEN	30
+