Skip to contentSkip to conversation

Add a property in at24.c

PATCH RESEND Superseded [email protected] 5 participants 11 messages Jul 2, 2018 – Jul 24, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Add a property in at24.c

From: Alan Chiang <[email protected]>

This RESEND PATCH only adds the Acked-by and Reviewed-by, no other patch for the codes.

In at24.c, it uses 8-bit addressing by default. In this patch, add a property address-width that provides a flexible method to pass the information to the driver.

Alan Chiang (2):
dt-bindings: at24: Add address-width property
eeprom: at24: Add support for address-width property

 Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
 drivers/misc/eeprom/at24.c                        | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
Signature · 1 line
2.7.4
#1 lore raw

PATCH RESEND v4 1/2 dt-bindings: at24: Add address-width property

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/eeprom/at24.txt +2 -0
index 61d833a..aededdb 100644
@@ -72,6 +72,8 @@ Optional properties:
 
   - wp-gpios: GPIO to which the write-protect pin of the chip is connected.
 
+  - address-width: number of address bits (one of 8, 16).
+
 Example:
 
 eeprom@52 {
Signature · 1 line
2.7.4
maintainer Reviewed-by on v4 1/2
#2 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 21 lines · On Mon, Jul 02, 2018 at 05:12:19PM +0800, [email protected] wrote:

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

Quoted 3 lines
---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)
#3 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 22 lines · Rob Herring
Quoted 21 lines · On Mon, Jul 02, 2018 at 05:12:19PM +0800, [email protected] wrote:

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

Quoted 5 lines
Quoted 3 lines
---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)

"... should be added the compatible field ..."??

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#4 lore raw

RE: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Hi Robert,

Quoted 43 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
Sent: Friday, July 6, 2018 4:24 AM
To: Rob Herring <[email protected]>
Cc: Chiang, AlanX <[email protected]>; [email protected]; Yeh, Andy <[email protected]>; [email protected]; [email protected]; Shevchenko, Andriy <[email protected]>; Mani, Rajmohan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 26 lines · Rob Herring
Quoted 24 lines · On Mon, Jul 02, 2018 at 05:12:19PM +0800, [email protected] wrote:

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines
Quoted 1 line

"... should be added the compatible field ..."??

rday

Maybe I should modify the sentence as below that makes it clear. "The compatible field should be added in the at24.c for specific chips.".

I quote Andy's words in patch v2:
"The current at24 driver has no address width support, thus, reusing same (allocated) IDs (non-DT case) is hard."

This is the reason that I submitted the patch.

Thanks

Quoted 12 lines

--

==========================================================
==============
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

==========================================================
==============

#5 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

2018-07-09 5:12 GMT+02:00 Chiang, AlanX <[email protected]>:

Quoted 54 lines

Hi Robert,

Quoted 43 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
Sent: Friday, July 6, 2018 4:24 AM
To: Rob Herring <[email protected]>
Cc: Chiang, AlanX <[email protected]>; [email protected]; Yeh, Andy <[email protected]>; [email protected]; [email protected]; Shevchenko, Andriy <[email protected]>; Mani, Rajmohan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 26 lines · Rob Herring
Quoted 24 lines · On Mon, Jul 02, 2018 at 05:12:19PM +0800, [email protected] wrote:

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines
Quoted 1 line

"... should be added the compatible field ..."??

rday

Maybe I should modify the sentence as below that makes it clear. "The compatible field should be added in the at24.c for specific chips.".

Quoted 8 lines

I quote Andy's words in patch v2:
"The current at24 driver has no address width support, thus, reusing same (allocated) IDs (non-DT case) is hard."

This is the reason that I submitted the patch.

Thanks

Make it something like:

Currently the only way to use a variant of a supported model with a different address width is to define a new compatible string and the corresponding chip data structure.

Provide a flexible way to specify the size of the address pointer by defining a new property: address-width.

Best regards,
Bartosz Golaszewski

Quoted 12 lines
Quoted 12 lines

--

==========================================================
==============
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

==========================================================
==============

#6 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

2018-07-09 10:52 GMT+02:00 Bartosz Golaszewski <[email protected]>:

Quoted 70 lines

2018-07-09 5:12 GMT+02:00 Chiang, AlanX <[email protected]>:

Quoted 54 lines

Hi Robert,

Quoted 43 lines

-----Original Message-----
From: Robert P. J. Day [mailto:[email protected]]
Sent: Friday, July 6, 2018 4:24 AM
To: Rob Herring <[email protected]>
Cc: Chiang, AlanX <[email protected]>; [email protected]; Yeh, Andy <[email protected]>; [email protected]; [email protected]; Shevchenko, Andriy <[email protected]>; Mani, Rajmohan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 26 lines · Rob Herring
Quoted 24 lines · On Mon, Jul 02, 2018 at 05:12:19PM +0800, [email protected] wrote:

From: Alan Chiang <[email protected]>

The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips.

Provide a flexible way to determine the addressing bits through address-width in this patch.

---
since v1:
-- Remove the address-width field in the example.
since v2:
-- Remove redundant space.
since v3:
-- Add Acked-by.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)
Quoted 5 lines
Quoted 1 line

"... should be added the compatible field ..."??

rday

Maybe I should modify the sentence as below that makes it clear. "The compatible field should be added in the at24.c for specific chips.".

Quoted 8 lines

I quote Andy's words in patch v2:
"The current at24 driver has no address width support, thus, reusing same (allocated) IDs (non-DT case) is hard."

This is the reason that I submitted the patch.

Thanks

Make it something like:

Currently the only way to use a variant of a supported model with a different address width is to define a new compatible string and the corresponding chip data structure.

Quoted 18 lines

Provide a flexible way to specify the size of the address pointer by defining a new property: address-width.

Best regards,
Bartosz Golaszewski

Quoted 12 lines
Quoted 12 lines

--

==========================================================
==============
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday

==========================================================
==============

Hi,

I will soon be sending my pull request to Wolfram, so if you still want that applied for 4.19 - please resend with the commit message fixed.

Thanks,
Bart

#7 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

Quoted 3 lines · Bartosz Golaszewski

I will soon be sending my pull request to Wolfram, so if you still want that applied for 4.19 - please resend with the commit message fixed.

Alan?

Not sure whether it's too late for 4.19 now though.

Signature · 2 lines
Sakari Ailus
[email protected]
#8 lore raw

Re: [RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property

2018-07-24 13:07 GMT+02:00 [email protected] <[email protected]>:

Quoted 5 lines · Bartosz Golaszewski
Quoted 3 lines

I will soon be sending my pull request to Wolfram, so if you still want that applied for 4.19 - please resend with the commit message fixed.

Quoted 7 lines

Alan?

Not sure whether it's too late for 4.19 now though.

--
Sakari Ailus
[email protected]

I may still be ok until tomorrow if Alan resend it.

Bart

#9 lore raw

PATCH RESEND v4 2/2 eeprom: at24: Add support for address-width property

In reply to [email protected]

From: Alan Chiang <[email protected]>

Provide a flexible way to determine the addressing bits of eeprom. Pass the addressing bits to driver through address-width property.

---
since v1
-- Add a warn message for 8-bit addressing.
since v2
-- Modify the warning message for clear.
-- Move the clearing bit operation outside of a statement. since v3
-- Merge the warning message into one line.

---
 drivers/misc/eeprom/at24.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/misc/eeprom/at24.c +17 -0
index 0c125f2..7ea640b 100644
@@ -478,6 +478,23 @@ static void at24_properties_to_pdata(struct device *dev,
 	if (device_property_present(dev, "no-read-rollover"))
 		chip->flags |= AT24_FLAG_NO_RDROL;
 
+	err = device_property_read_u32(dev, "address-width", &val);
+	if (!err) {
+		switch (val) {
+		case 8:
+			if (chip->flags & AT24_FLAG_ADDR16)
+				dev_warn(dev, "Override address width to be 8, while default is 16\n");
+			chip->flags &= ~AT24_FLAG_ADDR16;
+			break;
+		case 16:
+			chip->flags |= AT24_FLAG_ADDR16;
+			break;
+		default:
+			dev_warn(dev, "Bad \"address-width\" property: %u\n",
+				 val);
+		}
+	}
+
 	err = device_property_read_u32(dev, "size", &val);
 	if (!err)
 		chip->byte_len = val;
Signature · 1 line
2.7.4
#10 lore raw
In reply to [email protected]

2018-07-02 11:12 GMT+02:00 <[email protected]>:

Quoted 5 lines

From: Alan Chiang <[email protected]>

This RESEND PATCH only adds the Acked-by and Reviewed-by, no other patch for the codes.

Please don't do this. We're waiting for Rob's Acked-by and I will collect all the tags anyway. Don't resend unless there are changes to patches.

Best regards,
Bartosz Golaszewski

Quoted 15 lines

In at24.c, it uses 8-bit addressing by default. In this patch, add a property address-width that provides a flexible method to pass the information to the driver.

Alan Chiang (2):
dt-bindings: at24: Add address-width property
eeprom: at24: Add support for address-width property

 Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
 drivers/misc/eeprom/at24.c                        | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

--
2.7.4