Skip to contentSkip to conversation

eeprom: at24: Add support for address-width property

PATCH Superseded [email protected] 3 participants 4 messages Jun 22, 2018

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

From: "alanx.chiang" <[email protected]>

Provide a flexible way to determine the addressing bits of eeprom. It doesn't need to add acpi or i2c ids for specific modules.

---
 drivers/misc/eeprom/at24.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/misc/eeprom/at24.c +16 -0
index 0c125f2..a6fbdae 100644
@@ -478,6 +478,22 @@ 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:
+			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
#1 lore raw

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

From: "alanx.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.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/eeprom/at24.txt +3 -0
index 61d833a..5879259 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 {
@@ -79,4 +81,5 @@ eeprom@52 {
 	reg = <0x52>;
 	pagesize = <32>;
 	wp-gpios = <&gpio1 3 0>;
+	address-width = <16>;
 };
Signature · 1 line
2.7.4
#2 lore raw

RE: [v1, 2/2] dt-bindings: at24: Add address-width property

Hi Alan,

Thanks for the patch set.
You should change the subject as below.
[PATCH v1, 1/2]
[PATCH v1, 2/2]

And I think you may missed to create a cover page. Please follow my BKM. Thanks. git format-patch --cover --subject-prefix <version> -o <output folder> HEAD~n

Regards, Andy

Quoted 49 lines

-----Original Message-----
From: Chiang, AlanX
Sent: Friday, June 22, 2018 5:47 PM
To: [email protected]
Cc: Yeh, Andy <[email protected]>; [email protected]; Shevchenko, Andriy <[email protected]>; Mani, Rajmohan <[email protected]>; Chiang, AlanX <[email protected]>
Subject: [v1, 2/2] dt-bindings: at24: Add address-width property

From: "alanx.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.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/eeprom/at24.txt +3 -1
index 61d833a..5879259 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 {
@@ -79,4 +81,5 @@ eeprom@52 {
 	reg = <0x52>;
 	pagesize = <32>;
 	wp-gpios = <&gpio1 3 0>;
+	address-width = <16>;
 };
--

2.7.4

#3 lore raw

RE: [v1, 2/2] dt-bindings: at24: Add address-width property

Quoted 2 lines

And I think you may missed to create a cover page. Please follow my BKM. Thanks. git format-patch --cover --subject-prefix <version> -o <output folder> HEAD~n

-v<N> will do the job in a less error prone way.