Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1682308 > unrolled thread

[PATCH 0/3] Add at24 functionality to read MAC form different EEPROM offsets

Started byClaudiu Beznea <claudiu.beznea@microchip.com>
First post2017-07-06 12:20 +0200
Last post2017-07-10 05:50 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/3] Add at24 functionality to read MAC form different EEPROM offsets Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-07-06 12:20 +0200
    [PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-07-06 12:20 +0200
      Re: [PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings Rob Herring <robh@kernel.org> - 2017-07-10 05:50 +0200
    [PATCH 2/3] drivers: misc: eeprom: at24: support reading mac eeprom from different addresses Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-07-06 12:20 +0200
    [PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset" binding Claudiu Beznea <claudiu.beznea@microchip.com> - 2017-07-06 12:20 +0200
      Re: [PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset"  binding Rob Herring <robh@kernel.org> - 2017-07-10 05:50 +0200

#1682308 — [PATCH 0/3] Add at24 functionality to read MAC form different EEPROM offsets

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-07-06 12:20 +0200
Subject[PATCH 0/3] Add at24 functionality to read MAC form different EEPROM offsets
Message-ID<u0c37-2WU-3@gated-at.bofh.it>
Hi all,

Please give feedback on the following approach to extends at24 EEPROM
driver to support reading MAC from different addresses in EEPROM.  This
will allow the at24 driver to be used as a generic driver by different
hardwares.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  dt-bindings: i2c: eeprom: document all at24 bindings
  drivers: misc: eeprom: at24: support reading mac eeprom from
    different addresses
  dt-bindings: i2c: eeprom: document "start-offset" binding

 Documentation/devicetree/bindings/eeprom/eeprom.txt | 20 +++++++++++++-------
 drivers/misc/eeprom/at24.c                          |  5 ++++-
 include/linux/platform_data/at24.h                  |  1 +
 3 files changed, 18 insertions(+), 8 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1682309 — [PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-07-06 12:20 +0200
Subject[PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings
Message-ID<u0c37-2WU-7@gated-at.bofh.it>
In reply to#1682308
Document all at24 memories specific bindings.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 Documentation/devicetree/bindings/eeprom/eeprom.txt | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt b/Documentation/devicetree/bindings/eeprom/eeprom.txt
index 5696eb5..a50dc01 100644
--- a/Documentation/devicetree/bindings/eeprom/eeprom.txt
+++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
@@ -4,9 +4,11 @@ Required properties:
 
   - compatible : should be "<manufacturer>,<type>", like these:
 
-	"atmel,24c00", "atmel,24c01", "atmel,24c02", "atmel,24c04",
-	"atmel,24c08", "atmel,24c16", "atmel,24c32", "atmel,24c64",
-	"atmel,24c128", "atmel,24c256", "atmel,24c512", "atmel,24c1024"
+	"atmel,24c00", "atmel,24c01", "atmel,24cs01", "atmel,24c02", "atmel,24cs02",
+	"atmel,24mac402", "atmel,24mac602", "atmel,spd", "atmel,24c04",
+	"atmel,24cs04", "atmel,24c08", "atmel,24cs08", "atmel,24c16", "atmel,24cs16",
+	"atmel,24c32", "atmel,24cs32", "atmel,24c64", "atmel,24cs64", "atmel,24c128",
+	"atmel,24c256", "atmel,24c512", "atmel,24c1024"
 
 	"catalyst,24c32"
 
@@ -16,10 +18,11 @@ Required properties:
 
 	"renesas,r1ex24002"
 
-	 If there is no specific driver for <manufacturer>, a generic
-	 driver based on <type> is selected. Possible types are:
-	 "24c00", "24c01", "24c02", "24c04", "24c08", "24c16", "24c32", "24c64",
-	 "24c128", "24c256", "24c512", "24c1024", "spd"
+	If there is no specific driver for <manufacturer>, a generic
+	driver based on <type> is selected. Possible types are:
+	"24c00", "24c01", "24cs01", "24c02", "24cs02", "24mac402", "24mac602", "spd",
+	"24c04", "24cs04", "24c08", "24cs08", "24c16", "24cs16", "24c32", "24cs32",
+	"24c64", "24cs64", "24c128", "24c256", "24c512", "24c1024"
 
   - reg : the I2C address of the EEPROM
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1683938 — Re: [PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings

FromRob Herring <robh@kernel.org>
Date2017-07-10 05:50 +0200
SubjectRe: [PATCH 1/3] dt-bindings: i2c: eeprom: document all at24 bindings
Message-ID<u1xRT-8am-3@gated-at.bofh.it>
In reply to#1682309
On Thu, Jul 06, 2017 at 01:16:55PM +0300, Claudiu Beznea wrote:
> Document all at24 memories specific bindings.

This will probably conflict with Javier's series "eeprom: at24: Add OF 
device ID table".

Rob

[toc] | [prev] | [next] | [standalone]


#1682310 — [PATCH 2/3] drivers: misc: eeprom: at24: support reading mac eeprom from different addresses

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-07-06 12:20 +0200
Subject[PATCH 2/3] drivers: misc: eeprom: at24: support reading mac eeprom from different addresses
Message-ID<u0c37-2WU-9@gated-at.bofh.it>
In reply to#1682308
Add support for reading MAC address from different offsets of EEPROM. The
offset is initialized via device tree. If nothing is given as input the
old value, 0x90, is used. In this way the driver could be used as generic
driver for different vendor memories by only changing the reading offset
via device tree.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/misc/eeprom/at24.c         | 5 ++++-
 include/linux/platform_data/at24.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 764ff5df..53c2b03 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -365,7 +365,7 @@ static ssize_t at24_eeprom_read_mac(struct at24_data *at24, char *buf,
 	memset(msg, 0, sizeof(msg));
 	msg[0].addr = client->addr;
 	msg[0].buf = addrbuf;
-	addrbuf[0] = 0x90 + offset;
+	addrbuf[0] = at24->chip.mac_offset + offset;
 	msg[0].len = 1;
 	msg[1].addr = client->addr;
 	msg[1].flags = I2C_M_RD;
@@ -581,6 +581,9 @@ static void at24_get_pdata(struct device *dev, struct at24_platform_data *chip)
 		 */
 		chip->page_size = 1;
 	}
+	err = device_property_read_u32(dev, "mac-offset", &chip->mac_offset);
+	if (err)
+		chip->mac_offset = 0x90;
 }
 
 static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h
index 271a4e2..4e9523e 100644
--- a/include/linux/platform_data/at24.h
+++ b/include/linux/platform_data/at24.h
@@ -42,6 +42,7 @@
 
 struct at24_platform_data {
 	u32		byte_len;		/* size (sum of all addr) */
+	u32		mac_offset;
 	u16		page_size;		/* for writes */
 	u8		flags;
 #define AT24_FLAG_ADDR16	BIT(7)	/* address pointer is 16 bit */
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1682311 — [PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset" binding

FromClaudiu Beznea <claudiu.beznea@microchip.com>
Date2017-07-06 12:20 +0200
Subject[PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset" binding
Message-ID<u0c38-2WU-19@gated-at.bofh.it>
In reply to#1682308
Document "mac-offset" binding that will be used by at24 EEPROM driver.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 Documentation/devicetree/bindings/eeprom/eeprom.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt b/Documentation/devicetree/bindings/eeprom/eeprom.txt
index a50dc01..3dd267c 100644
--- a/Documentation/devicetree/bindings/eeprom/eeprom.txt
+++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
@@ -35,10 +35,13 @@ Optional properties:
 
   - read-only: this parameterless property disables writes to the eeprom
 
+  - mac-offset: offset in EEPROM where MAC address starts
+
 Example:
 
 eeprom@52 {
 	compatible = "atmel,24c32";
 	reg = <0x52>;
 	pagesize = <32>;
+	mac-offset = <0xf8>;
 };
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1683937 — Re: [PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset" binding

FromRob Herring <robh@kernel.org>
Date2017-07-10 05:50 +0200
SubjectRe: [PATCH 3/3] dt-bindings: i2c: eeprom: document "mac-offset" binding
Message-ID<u1xRT-8am-1@gated-at.bofh.it>
In reply to#1682311
On Thu, Jul 06, 2017 at 01:16:57PM +0300, Claudiu Beznea wrote:
> Document "mac-offset" binding that will be used by at24 EEPROM driver.
> 
> Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
>  Documentation/devicetree/bindings/eeprom/eeprom.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt b/Documentation/devicetree/bindings/eeprom/eeprom.txt
> index a50dc01..3dd267c 100644
> --- a/Documentation/devicetree/bindings/eeprom/eeprom.txt
> +++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
> @@ -35,10 +35,13 @@ Optional properties:
>  
>    - read-only: this parameterless property disables writes to the eeprom
>  
> +  - mac-offset: offset in EEPROM where MAC address starts
> +

This doesn't scale if you have multiple things you need the offset to, 
and we already have a binding for this. Use the nvmem binding.

Rob

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web