mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] eeprom: at25: Allow page sizes greater than 16 bit
@ 2020-01-27  7:41 Christian Eggers
  2020-01-27 13:01 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Eggers @ 2020-01-27  7:41 UTC (permalink / raw)
  To: barebox; +Cc: Christian Eggers, ceggers

For FRAM devices the page size is usually equal to the device size. Some
available devices are greater than 64kB, so a 32 bit variable must be
used.

The same change has to be done for the Linux driver. I'll try to
upstream this as soon as possible.

Signed-off-by: Christian Eggers <ceggers@arri.de>
---
 drivers/eeprom/at25.c | 2 +-
 include/spi/eeprom.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index 1c9ef1232..56168c216 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -259,7 +259,7 @@ static int at25_np_to_chip(struct device_d *dev,
 
 	if (of_property_read_u32(np, "pagesize", &val) == 0 ||
 	    of_property_read_u32(np, "at25,page-size", &val) == 0) {
-		chip->page_size = (u16)val;
+		chip->page_size = val;
 	} else {
 		dev_err(dev, "Error: missing \"pagesize\" property\n");
 		return -ENODEV;
diff --git a/include/spi/eeprom.h b/include/spi/eeprom.h
index 15495e59f..137718f02 100644
--- a/include/spi/eeprom.h
+++ b/include/spi/eeprom.h
@@ -10,7 +10,7 @@
  */
 struct spi_eeprom {
 	char		name[10];
-	u16		page_size;		/* for writes */
+	u32		page_size;		/* for writes */
 	u16		flags;
 #define	EE_ADDR1	0x0001			/*  8 bit addrs */
 #define	EE_ADDR2	0x0002			/* 16 bit addrs */
-- 
Christian Eggers
Embedded software developer

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRA 57918
Persoenlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: Muenchen - Registergericht: Amtsgericht Muenchen - Handelsregisternummer: HRB 54477
Geschaeftsfuehrer: Dr. Michael Neuhaeuser; Stephan Schenk; Walter Trauninger; Markus Zeiler


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] eeprom: at25: Allow page sizes greater than 16 bit
  2020-01-27  7:41 [PATCH] eeprom: at25: Allow page sizes greater than 16 bit Christian Eggers
@ 2020-01-27 13:01 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2020-01-27 13:01 UTC (permalink / raw)
  To: Christian Eggers; +Cc: barebox, ceggers

On Mon, Jan 27, 2020 at 08:41:15AM +0100, Christian Eggers wrote:
> For FRAM devices the page size is usually equal to the device size. Some
> available devices are greater than 64kB, so a 32 bit variable must be
> used.
> 
> The same change has to be done for the Linux driver. I'll try to
> upstream this as soon as possible.
> 
> Signed-off-by: Christian Eggers <ceggers@arri.de>
> ---
>  drivers/eeprom/at25.c | 2 +-
>  include/spi/eeprom.h  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-27 13:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27  7:41 [PATCH] eeprom: at25: Allow page sizes greater than 16 bit Christian Eggers
2020-01-27 13:01 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox