linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs
@ 2020-09-16  9:49 Jon Hunter
  2020-09-16  9:49 ` [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field Jon Hunter
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

For platforms that have multiple boards and hence have multiple EEPROMs
for identifying the different boards, it is useful to label the EEPROMs
in device-tree so that they can be easily identified. For example, MAC
address information is stored in the EEPROM on the processor module for
some Jetson platforms which is not only required by the kernel but the
bootloader as well. So having a simple way to identify the EEPROM is
needed.

Changes since V1:
- By default initialise the nvmem_config.id as NVMEM_DEVID_AUTO and not
  NVMEM_DEVID_NONE
- Dropped the 'maxItems' from the dt-binding doc.

Jon Hunter (5):
  misc: eeprom: at24: Initialise AT24 NVMEM ID field
  dt-bindings: eeprom: at24: Add label property for AT24
  misc: eeprom: at24: Support custom device names for AT24 EEPROMs
  arm64: tegra: Add label properties for EEPROMs
  arm64: tegra: Populate EEPROMs for Jetson Xavier NX

 .../devicetree/bindings/eeprom/at24.yaml      |  3 +++
 .../boot/dts/nvidia/tegra186-p2771-0000.dts   |  1 +
 .../arm64/boot/dts/nvidia/tegra186-p3310.dtsi |  1 +
 .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |  1 +
 .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  1 +
 .../nvidia/tegra194-p3509-0000+p3668-0000.dts | 14 ++++++++++++
 .../boot/dts/nvidia/tegra194-p3668-0000.dtsi  | 16 ++++++++++++++
 .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi |  1 +
 .../boot/dts/nvidia/tegra210-p2371-2180.dts   |  1 +
 .../boot/dts/nvidia/tegra210-p3450-0000.dts   |  2 ++
 drivers/misc/eeprom/at24.c                    | 22 ++++++++++++++++++-
 11 files changed, 62 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
@ 2020-09-16  9:49 ` Jon Hunter
  2020-09-24 13:14   ` Bartosz Golaszewski
  2020-09-16  9:49 ` [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24 Jon Hunter
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

The AT24 EEPROM driver does not initialise the 'id' field of the
nvmem_config structure and because the entire structure is not
initialised, it ends up with a random value. This causes the NVMEM
driver to append the device 'devid' value to name of the NVMEM
device. Ideally for I2C devices such as the AT24 that already have a
unique name, we would not bother to append the 'devid'. However, given
that this has always been done for AT24 devices, we cannot remove the
'devid' as this will change the name of the userspace sysfs node for
the NVMEM device. Nonetheless we should ensure that the 'id' field of
the nvmem_config structure is initialised so that there is no chance of
a random value causes problems in the future. Therefore, set the NVMEM
config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is
always appended.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/misc/eeprom/at24.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index e9df1ca251df..f76624b5c033 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -715,6 +715,7 @@ static int at24_probe(struct i2c_client *client)
 
 	nvmem_config.name = dev_name(dev);
 	nvmem_config.dev = dev;
+	nvmem_config.id = NVMEM_DEVID_AUTO;
 	nvmem_config.read_only = !writable;
 	nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
 	nvmem_config.owner = THIS_MODULE;
-- 
2.25.1


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

* [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
  2020-09-16  9:49 ` [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field Jon Hunter
@ 2020-09-16  9:49 ` Jon Hunter
  2020-09-23 15:32   ` Rob Herring
  2020-09-24 13:25   ` Bartosz Golaszewski
  2020-09-16  9:49 ` [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs Jon Hunter
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

Add a label property for the AT24 EEPROM to allow a custom name to be
used for identifying the EEPROM on a board. This is useful when there
is more than one EEPROM present.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 Documentation/devicetree/bindings/eeprom/at24.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml
index 4cee72d53318..6edfa705b486 100644
--- a/Documentation/devicetree/bindings/eeprom/at24.yaml
+++ b/Documentation/devicetree/bindings/eeprom/at24.yaml
@@ -114,6 +114,9 @@ properties:
           - const: renesas,r1ex24128
           - const: atmel,24c128
 
+  label:
+    description: Descriptive name of the EEPROM.
+
   reg:
     maxItems: 1
 
-- 
2.25.1


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

* [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
  2020-09-16  9:49 ` [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field Jon Hunter
  2020-09-16  9:49 ` [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24 Jon Hunter
@ 2020-09-16  9:49 ` Jon Hunter
  2020-09-24 13:25   ` Bartosz Golaszewski
  2020-09-16  9:49 ` [PATCH V2 4/5] arm64: tegra: Add label properties for EEPROMs Jon Hunter
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

By using the label property, a more descriptive name can be populated
for AT24 EEPROMs NVMEM device. Update the AT24 driver to check to see
if the label property is present and if so, use this as the name for
NVMEM device. Please note that when the 'label' property is present for
the AT24 EEPROM, we do not want the NVMEM driver to append the 'devid'
to the name and so the nvmem_config.id is initialised to
NVMEM_DEVID_NONE.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/misc/eeprom/at24.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index f76624b5c033..305f2e13107b 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -713,9 +713,28 @@ static int at24_probe(struct i2c_client *client)
 			return err;
 	}
 
-	nvmem_config.name = dev_name(dev);
+	/*
+	 * If the 'label' property is not present for the AT24 EEPROM,
+	 * then nvmem_config.id is initialised to NVMEM_DEVID_AUTO,
+	 * and this will append the 'devid' to the name of the NVMEM
+	 * device. This is purely legacy and the AT24 driver has always
+	 * defaulted to this. However, if the 'label' property is
+	 * present then this means that the name is specified by the
+	 * firmware and this name should be used verbatim and so it is
+	 * not necessary to append the 'devid'.
+	 */
+	if (device_property_present(dev, "label")) {
+		nvmem_config.id = NVMEM_DEVID_NONE;
+		err = device_property_read_string(dev, "label",
+						  &nvmem_config.name);
+		if (err)
+			return err;
+	} else {
+		nvmem_config.id = NVMEM_DEVID_AUTO;
+		nvmem_config.name = dev_name(dev);
+	}
+
 	nvmem_config.dev = dev;
-	nvmem_config.id = NVMEM_DEVID_AUTO;
 	nvmem_config.read_only = !writable;
 	nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
 	nvmem_config.owner = THIS_MODULE;
-- 
2.25.1


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

* [PATCH V2 4/5] arm64: tegra: Add label properties for EEPROMs
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
                   ` (2 preceding siblings ...)
  2020-09-16  9:49 ` [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs Jon Hunter
@ 2020-09-16  9:49 ` Jon Hunter
  2020-09-16  9:49 ` [PATCH V2 5/5] arm64: tegra: Populate EEPROMs for Jetson Xavier NX Jon Hunter
  2020-09-23  9:15 ` [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Bartosz Golaszewski
  5 siblings, 0 replies; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

Populate the label property for the AT24 EEPROMs on the various Jetson
platforms. Note that the name 'module' is used to identify the EEPROM
on the processor module board and the name 'system' is used to identify
the EEPROM on the main base board (which is sometimes referred to as
the carrier board).

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 1 +
 arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi     | 1 +
 arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi     | 1 +
 arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 1 +
 arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi     | 1 +
 arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 1 +
 arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 2 ++
 7 files changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
index 802b8c52489a..381a84912ba8 100644
--- a/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts
@@ -222,6 +222,7 @@ eeprom@57 {
 			compatible = "atmel,24c02";
 			reg = <0x57>;
 
+			label = "system";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi b/arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi
index 53d92fdd7f06..fd9177447711 100644
--- a/arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra186-p3310.dtsi
@@ -173,6 +173,7 @@ eeprom@50 {
 			compatible = "atmel,24c02";
 			reg = <0x50>;
 
+			label = "module";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi
index 0ea0bd83cb8e..d71b7a1140fe 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi
@@ -64,6 +64,7 @@ eeprom@50 {
 				compatible = "atmel,24c02";
 				reg = <0x50>;
 
+				label = "module";
 				vcc-supply = <&vdd_1v8ls>;
 				address-width = <8>;
 				pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts b/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
index 4d8a0e10250f..54d057beec59 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts
@@ -28,6 +28,7 @@ eeprom@56 {
 				compatible = "atmel,24c02";
 				reg = <0x56>;
 
+				label = "system";
 				vcc-supply = <&vdd_1v8ls>;
 				address-width = <8>;
 				pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
index 85ee7e6b71ac..6077d572d828 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210-p2180.dtsi
@@ -273,6 +273,7 @@ eeprom@50 {
 			compatible = "atmel,24c02";
 			reg = <0x50>;
 
+			label = "module";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts b/arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
index 56adf287a82c..4c9c2a054642 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts
@@ -86,6 +86,7 @@ eeprom@57 {
 			compatible = "atmel,24c02";
 			reg = <0x57>;
 
+			label = "system";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts b/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts
index ba892cd4b5a9..859241db4b4d 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts
@@ -144,6 +144,7 @@ eeprom@50 {
 			compatible = "atmel,24c02";
 			reg = <0x50>;
 
+			label = "module";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
@@ -155,6 +156,7 @@ eeprom@57 {
 			compatible = "atmel,24c02";
 			reg = <0x57>;
 
+			label = "system";
 			vcc-supply = <&vdd_1v8>;
 			address-width = <8>;
 			pagesize = <8>;
-- 
2.25.1


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

* [PATCH V2 5/5] arm64: tegra: Populate EEPROMs for Jetson Xavier NX
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
                   ` (3 preceding siblings ...)
  2020-09-16  9:49 ` [PATCH V2 4/5] arm64: tegra: Add label properties for EEPROMs Jon Hunter
@ 2020-09-16  9:49 ` Jon Hunter
  2020-09-23  9:15 ` [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Bartosz Golaszewski
  5 siblings, 0 replies; 15+ messages in thread
From: Jon Hunter @ 2020-09-16  9:49 UTC (permalink / raw)
  To: Bartosz Golaszewski, Rob Herring, Thierry Reding
  Cc: linux-i2c, devicetree, linux-kernel, linux-tegra, Jon Hunter

Populate the EEPROMs that are present on the Jetson Xavier NX developer
platform.

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
 .../nvidia/tegra194-p3509-0000+p3668-0000.dts    | 14 ++++++++++++++
 .../boot/dts/nvidia/tegra194-p3668-0000.dtsi     | 16 ++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0000.dts b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0000.dts
index c1c589805d6b..7f97b34216a0 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0000.dts
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p3509-0000+p3668-0000.dts
@@ -27,6 +27,20 @@ ddc: i2c@3190000 {
 			status = "okay";
 		};
 
+		i2c@3160000 {
+			eeprom@57 {
+				compatible = "atmel,24c02";
+				reg = <0x57>;
+
+				label = "system";
+				vcc-supply = <&vdd_1v8>;
+				address-width = <8>;
+				pagesize = <8>;
+				size = <256>;
+				read-only;
+			};
+		};
+
 		hda@3510000 {
 			nvidia,model = "jetson-xavier-nx-hda";
 			status = "okay";
diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p3668-0000.dtsi b/arch/arm64/boot/dts/nvidia/tegra194-p3668-0000.dtsi
index 10cb836aea7e..a2893be80507 100644
--- a/arch/arm64/boot/dts/nvidia/tegra194-p3668-0000.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra194-p3668-0000.dtsi
@@ -58,6 +58,22 @@ serial@c280000 {
 			status = "okay";
 		};
 
+		i2c@3160000 {
+			status = "okay";
+
+			eeprom@50 {
+				compatible = "atmel,24c02";
+				reg = <0x50>;
+
+				label = "module";
+				vcc-supply = <&vdd_1v8ls>;
+				address-width = <8>;
+				pagesize = <8>;
+				size = <256>;
+				read-only;
+			};
+		};
+
 		/* SDMMC1 (SD/MMC) */
 		mmc@3400000 {
 			status = "okay";
-- 
2.25.1


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

* Re: [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs
  2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
                   ` (4 preceding siblings ...)
  2020-09-16  9:49 ` [PATCH V2 5/5] arm64: tegra: Populate EEPROMs for Jetson Xavier NX Jon Hunter
@ 2020-09-23  9:15 ` Bartosz Golaszewski
  2020-09-23  9:23   ` Jon Hunter
  2020-09-23 11:38   ` Thierry Reding
  5 siblings, 2 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-23  9:15 UTC (permalink / raw)
  To: Jon Hunter, Thierry Reding
  Cc: Rob Herring, linux-i2c, linux-devicetree, LKML, linux-tegra

On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> For platforms that have multiple boards and hence have multiple EEPROMs
> for identifying the different boards, it is useful to label the EEPROMs
> in device-tree so that they can be easily identified. For example, MAC
> address information is stored in the EEPROM on the processor module for
> some Jetson platforms which is not only required by the kernel but the
> bootloader as well. So having a simple way to identify the EEPROM is
> needed.
>
> Changes since V1:
> - By default initialise the nvmem_config.id as NVMEM_DEVID_AUTO and not
>   NVMEM_DEVID_NONE
> - Dropped the 'maxItems' from the dt-binding doc.
>
> Jon Hunter (5):
>   misc: eeprom: at24: Initialise AT24 NVMEM ID field
>   dt-bindings: eeprom: at24: Add label property for AT24
>   misc: eeprom: at24: Support custom device names for AT24 EEPROMs
>   arm64: tegra: Add label properties for EEPROMs
>   arm64: tegra: Populate EEPROMs for Jetson Xavier NX
>
>  .../devicetree/bindings/eeprom/at24.yaml      |  3 +++
>  .../boot/dts/nvidia/tegra186-p2771-0000.dts   |  1 +
>  .../arm64/boot/dts/nvidia/tegra186-p3310.dtsi |  1 +
>  .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |  1 +
>  .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  1 +
>  .../nvidia/tegra194-p3509-0000+p3668-0000.dts | 14 ++++++++++++
>  .../boot/dts/nvidia/tegra194-p3668-0000.dtsi  | 16 ++++++++++++++
>  .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi |  1 +
>  .../boot/dts/nvidia/tegra210-p2371-2180.dts   |  1 +
>  .../boot/dts/nvidia/tegra210-p3450-0000.dts   |  2 ++
>  drivers/misc/eeprom/at24.c                    | 22 ++++++++++++++++++-
>  11 files changed, 62 insertions(+), 1 deletion(-)
>
> --
> 2.25.1
>

Just FYI: I'm fine with the at24 part. I can take them through my tree
for v5.10. Who is taking the DTS patches for tegra? Thierry? I can
provide you with an immutable branch if that's fine. I can't just ack
the at24 patches because they conflict with what I already have in my
tree for v5.10.

Bartosz

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

* Re: [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs
  2020-09-23  9:15 ` [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Bartosz Golaszewski
@ 2020-09-23  9:23   ` Jon Hunter
  2020-09-23 11:38   ` Thierry Reding
  1 sibling, 0 replies; 15+ messages in thread
From: Jon Hunter @ 2020-09-23  9:23 UTC (permalink / raw)
  To: Bartosz Golaszewski, Thierry Reding
  Cc: Rob Herring, linux-i2c, linux-devicetree, LKML, linux-tegra


On 23/09/2020 10:15, Bartosz Golaszewski wrote:
> On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>>
>> For platforms that have multiple boards and hence have multiple EEPROMs
>> for identifying the different boards, it is useful to label the EEPROMs
>> in device-tree so that they can be easily identified. For example, MAC
>> address information is stored in the EEPROM on the processor module for
>> some Jetson platforms which is not only required by the kernel but the
>> bootloader as well. So having a simple way to identify the EEPROM is
>> needed.
>>
>> Changes since V1:
>> - By default initialise the nvmem_config.id as NVMEM_DEVID_AUTO and not
>>   NVMEM_DEVID_NONE
>> - Dropped the 'maxItems' from the dt-binding doc.
>>
>> Jon Hunter (5):
>>   misc: eeprom: at24: Initialise AT24 NVMEM ID field
>>   dt-bindings: eeprom: at24: Add label property for AT24
>>   misc: eeprom: at24: Support custom device names for AT24 EEPROMs
>>   arm64: tegra: Add label properties for EEPROMs
>>   arm64: tegra: Populate EEPROMs for Jetson Xavier NX
>>
>>  .../devicetree/bindings/eeprom/at24.yaml      |  3 +++
>>  .../boot/dts/nvidia/tegra186-p2771-0000.dts   |  1 +
>>  .../arm64/boot/dts/nvidia/tegra186-p3310.dtsi |  1 +
>>  .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |  1 +
>>  .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  1 +
>>  .../nvidia/tegra194-p3509-0000+p3668-0000.dts | 14 ++++++++++++
>>  .../boot/dts/nvidia/tegra194-p3668-0000.dtsi  | 16 ++++++++++++++
>>  .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi |  1 +
>>  .../boot/dts/nvidia/tegra210-p2371-2180.dts   |  1 +
>>  .../boot/dts/nvidia/tegra210-p3450-0000.dts   |  2 ++
>>  drivers/misc/eeprom/at24.c                    | 22 ++++++++++++++++++-
>>  11 files changed, 62 insertions(+), 1 deletion(-)
>>
>> --
>> 2.25.1
>>
> 
> Just FYI: I'm fine with the at24 part. I can take them through my tree
> for v5.10. Who is taking the DTS patches for tegra? Thierry? I can
> provide you with an immutable branch if that's fine. I can't just ack
> the at24 patches because they conflict with what I already have in my
> tree for v5.10.

Thanks. Yes Thierry is picking up the DTS patches.

Cheers
Jon

-- 
nvpublic

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

* Re: [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs
  2020-09-23  9:15 ` [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Bartosz Golaszewski
  2020-09-23  9:23   ` Jon Hunter
@ 2020-09-23 11:38   ` Thierry Reding
  2020-09-23 11:43     ` Bartosz Golaszewski
  1 sibling, 1 reply; 15+ messages in thread
From: Thierry Reding @ 2020-09-23 11:38 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Jon Hunter, Rob Herring, linux-i2c, linux-devicetree, LKML, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 2416 bytes --]

On Wed, Sep 23, 2020 at 11:15:03AM +0200, Bartosz Golaszewski wrote:
> On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
> >
> > For platforms that have multiple boards and hence have multiple EEPROMs
> > for identifying the different boards, it is useful to label the EEPROMs
> > in device-tree so that they can be easily identified. For example, MAC
> > address information is stored in the EEPROM on the processor module for
> > some Jetson platforms which is not only required by the kernel but the
> > bootloader as well. So having a simple way to identify the EEPROM is
> > needed.
> >
> > Changes since V1:
> > - By default initialise the nvmem_config.id as NVMEM_DEVID_AUTO and not
> >   NVMEM_DEVID_NONE
> > - Dropped the 'maxItems' from the dt-binding doc.
> >
> > Jon Hunter (5):
> >   misc: eeprom: at24: Initialise AT24 NVMEM ID field
> >   dt-bindings: eeprom: at24: Add label property for AT24
> >   misc: eeprom: at24: Support custom device names for AT24 EEPROMs
> >   arm64: tegra: Add label properties for EEPROMs
> >   arm64: tegra: Populate EEPROMs for Jetson Xavier NX
> >
> >  .../devicetree/bindings/eeprom/at24.yaml      |  3 +++
> >  .../boot/dts/nvidia/tegra186-p2771-0000.dts   |  1 +
> >  .../arm64/boot/dts/nvidia/tegra186-p3310.dtsi |  1 +
> >  .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |  1 +
> >  .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  1 +
> >  .../nvidia/tegra194-p3509-0000+p3668-0000.dts | 14 ++++++++++++
> >  .../boot/dts/nvidia/tegra194-p3668-0000.dtsi  | 16 ++++++++++++++
> >  .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi |  1 +
> >  .../boot/dts/nvidia/tegra210-p2371-2180.dts   |  1 +
> >  .../boot/dts/nvidia/tegra210-p3450-0000.dts   |  2 ++
> >  drivers/misc/eeprom/at24.c                    | 22 ++++++++++++++++++-
> >  11 files changed, 62 insertions(+), 1 deletion(-)
> >
> > --
> > 2.25.1
> >
> 
> Just FYI: I'm fine with the at24 part. I can take them through my tree
> for v5.10. Who is taking the DTS patches for tegra? Thierry? I can
> provide you with an immutable branch if that's fine. I can't just ack
> the at24 patches because they conflict with what I already have in my
> tree for v5.10.

I don't think I'll need an immutable branch since the device tree
changes are not dependent on anything in the bindings, except maybe for
validation, or the driver.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs
  2020-09-23 11:38   ` Thierry Reding
@ 2020-09-23 11:43     ` Bartosz Golaszewski
  0 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-23 11:43 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jon Hunter, Rob Herring, linux-i2c, linux-devicetree, LKML, linux-tegra

On Wed, Sep 23, 2020 at 1:38 PM Thierry Reding <thierry.reding@gmail.com> wrote:
>
> On Wed, Sep 23, 2020 at 11:15:03AM +0200, Bartosz Golaszewski wrote:
> > On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
> > >
> > > For platforms that have multiple boards and hence have multiple EEPROMs
> > > for identifying the different boards, it is useful to label the EEPROMs
> > > in device-tree so that they can be easily identified. For example, MAC
> > > address information is stored in the EEPROM on the processor module for
> > > some Jetson platforms which is not only required by the kernel but the
> > > bootloader as well. So having a simple way to identify the EEPROM is
> > > needed.
> > >
> > > Changes since V1:
> > > - By default initialise the nvmem_config.id as NVMEM_DEVID_AUTO and not
> > >   NVMEM_DEVID_NONE
> > > - Dropped the 'maxItems' from the dt-binding doc.
> > >
> > > Jon Hunter (5):
> > >   misc: eeprom: at24: Initialise AT24 NVMEM ID field
> > >   dt-bindings: eeprom: at24: Add label property for AT24
> > >   misc: eeprom: at24: Support custom device names for AT24 EEPROMs
> > >   arm64: tegra: Add label properties for EEPROMs
> > >   arm64: tegra: Populate EEPROMs for Jetson Xavier NX
> > >
> > >  .../devicetree/bindings/eeprom/at24.yaml      |  3 +++
> > >  .../boot/dts/nvidia/tegra186-p2771-0000.dts   |  1 +
> > >  .../arm64/boot/dts/nvidia/tegra186-p3310.dtsi |  1 +
> > >  .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |  1 +
> > >  .../boot/dts/nvidia/tegra194-p2972-0000.dts   |  1 +
> > >  .../nvidia/tegra194-p3509-0000+p3668-0000.dts | 14 ++++++++++++
> > >  .../boot/dts/nvidia/tegra194-p3668-0000.dtsi  | 16 ++++++++++++++
> > >  .../arm64/boot/dts/nvidia/tegra210-p2180.dtsi |  1 +
> > >  .../boot/dts/nvidia/tegra210-p2371-2180.dts   |  1 +
> > >  .../boot/dts/nvidia/tegra210-p3450-0000.dts   |  2 ++
> > >  drivers/misc/eeprom/at24.c                    | 22 ++++++++++++++++++-
> > >  11 files changed, 62 insertions(+), 1 deletion(-)
> > >
> > > --
> > > 2.25.1
> > >
> >
> > Just FYI: I'm fine with the at24 part. I can take them through my tree
> > for v5.10. Who is taking the DTS patches for tegra? Thierry? I can
> > provide you with an immutable branch if that's fine. I can't just ack
> > the at24 patches because they conflict with what I already have in my
> > tree for v5.10.
>
> I don't think I'll need an immutable branch since the device tree
> changes are not dependent on anything in the bindings, except maybe for
> validation, or the driver.
>
> Thierry

Ok sounds good then.

Bartosz

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

* Re: [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24
  2020-09-16  9:49 ` [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24 Jon Hunter
@ 2020-09-23 15:32   ` Rob Herring
  2020-09-24 13:25   ` Bartosz Golaszewski
  1 sibling, 0 replies; 15+ messages in thread
From: Rob Herring @ 2020-09-23 15:32 UTC (permalink / raw)
  To: Jon Hunter
  Cc: devicetree, Bartosz Golaszewski, linux-i2c, Thierry Reding,
	linux-kernel, Rob Herring, linux-tegra

On Wed, 16 Sep 2020 10:49:49 +0100, Jon Hunter wrote:
> Add a label property for the AT24 EEPROM to allow a custom name to be
> used for identifying the EEPROM on a board. This is useful when there
> is more than one EEPROM present.
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  Documentation/devicetree/bindings/eeprom/at24.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field
  2020-09-16  9:49 ` [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field Jon Hunter
@ 2020-09-24 13:14   ` Bartosz Golaszewski
  2020-09-24 13:17     ` Bartosz Golaszewski
  0 siblings, 1 reply; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-24 13:14 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Rob Herring, Thierry Reding, linux-i2c, linux-devicetree, LKML,
	linux-tegra

On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> The AT24 EEPROM driver does not initialise the 'id' field of the
> nvmem_config structure and because the entire structure is not
> initialised, it ends up with a random value. This causes the NVMEM
> driver to append the device 'devid' value to name of the NVMEM
> device. Ideally for I2C devices such as the AT24 that already have a
> unique name, we would not bother to append the 'devid'. However, given
> that this has always been done for AT24 devices, we cannot remove the
> 'devid' as this will change the name of the userspace sysfs node for
> the NVMEM device. Nonetheless we should ensure that the 'id' field of
> the nvmem_config structure is initialised so that there is no chance of
> a random value causes problems in the future. Therefore, set the NVMEM
> config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is
> always appended.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  drivers/misc/eeprom/at24.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index e9df1ca251df..f76624b5c033 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -715,6 +715,7 @@ static int at24_probe(struct i2c_client *client)
>
>         nvmem_config.name = dev_name(dev);
>         nvmem_config.dev = dev;
> +       nvmem_config.id = NVMEM_DEVID_AUTO;
>         nvmem_config.read_only = !writable;
>         nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
>         nvmem_config.owner = THIS_MODULE;
> --
> 2.25.1
>

Ha! I only now noticed I already have a patch for this in my tree from
Vadym Kochan for this cycle. I'll drop this one.

Bartosz

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

* Re: [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field
  2020-09-24 13:14   ` Bartosz Golaszewski
@ 2020-09-24 13:17     ` Bartosz Golaszewski
  0 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-24 13:17 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Rob Herring, Thierry Reding, linux-i2c, linux-devicetree, LKML,
	linux-tegra

On Thu, Sep 24, 2020 at 3:14 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
> >
> > The AT24 EEPROM driver does not initialise the 'id' field of the
> > nvmem_config structure and because the entire structure is not
> > initialised, it ends up with a random value. This causes the NVMEM
> > driver to append the device 'devid' value to name of the NVMEM
> > device. Ideally for I2C devices such as the AT24 that already have a
> > unique name, we would not bother to append the 'devid'. However, given
> > that this has always been done for AT24 devices, we cannot remove the
> > 'devid' as this will change the name of the userspace sysfs node for
> > the NVMEM device. Nonetheless we should ensure that the 'id' field of
> > the nvmem_config structure is initialised so that there is no chance of
> > a random value causes problems in the future. Therefore, set the NVMEM
> > config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is
> > always appended.
> >
> > Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> > ---
> >  drivers/misc/eeprom/at24.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> > index e9df1ca251df..f76624b5c033 100644
> > --- a/drivers/misc/eeprom/at24.c
> > +++ b/drivers/misc/eeprom/at24.c
> > @@ -715,6 +715,7 @@ static int at24_probe(struct i2c_client *client)
> >
> >         nvmem_config.name = dev_name(dev);
> >         nvmem_config.dev = dev;
> > +       nvmem_config.id = NVMEM_DEVID_AUTO;
> >         nvmem_config.read_only = !writable;
> >         nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
> >         nvmem_config.owner = THIS_MODULE;
> > --
> > 2.25.1
> >
>
> Ha! I only now noticed I already have a patch for this in my tree from
> Vadym Kochan for this cycle. I'll drop this one.
>
> Bartosz

-ETOOEARLY, nevermind my comment, it's for a different issue. I queued
this for v5.10.

Thanks!
Bartosz

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

* Re: [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24
  2020-09-16  9:49 ` [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24 Jon Hunter
  2020-09-23 15:32   ` Rob Herring
@ 2020-09-24 13:25   ` Bartosz Golaszewski
  1 sibling, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-24 13:25 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Rob Herring, Thierry Reding, linux-i2c, linux-devicetree, LKML,
	linux-tegra

On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> Add a label property for the AT24 EEPROM to allow a custom name to be
> used for identifying the EEPROM on a board. This is useful when there
> is more than one EEPROM present.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  Documentation/devicetree/bindings/eeprom/at24.yaml | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/eeprom/at24.yaml b/Documentation/devicetree/bindings/eeprom/at24.yaml
> index 4cee72d53318..6edfa705b486 100644
> --- a/Documentation/devicetree/bindings/eeprom/at24.yaml
> +++ b/Documentation/devicetree/bindings/eeprom/at24.yaml
> @@ -114,6 +114,9 @@ properties:
>            - const: renesas,r1ex24128
>            - const: atmel,24c128
>
> +  label:
> +    description: Descriptive name of the EEPROM.
> +
>    reg:
>      maxItems: 1
>
> --
> 2.25.1
>

Queued for v5.10, thanks!

Bartosz

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

* Re: [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs
  2020-09-16  9:49 ` [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs Jon Hunter
@ 2020-09-24 13:25   ` Bartosz Golaszewski
  0 siblings, 0 replies; 15+ messages in thread
From: Bartosz Golaszewski @ 2020-09-24 13:25 UTC (permalink / raw)
  To: Jon Hunter
  Cc: Rob Herring, Thierry Reding, linux-i2c, linux-devicetree, LKML,
	linux-tegra

On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@nvidia.com> wrote:
>
> By using the label property, a more descriptive name can be populated
> for AT24 EEPROMs NVMEM device. Update the AT24 driver to check to see
> if the label property is present and if so, use this as the name for
> NVMEM device. Please note that when the 'label' property is present for
> the AT24 EEPROM, we do not want the NVMEM driver to append the 'devid'
> to the name and so the nvmem_config.id is initialised to
> NVMEM_DEVID_NONE.
>
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---

Queued for v5.10, thanks!

Bartosz

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

end of thread, other threads:[~2020-09-24 13:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  9:49 [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Jon Hunter
2020-09-16  9:49 ` [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field Jon Hunter
2020-09-24 13:14   ` Bartosz Golaszewski
2020-09-24 13:17     ` Bartosz Golaszewski
2020-09-16  9:49 ` [PATCH V2 2/5] dt-bindings: eeprom: at24: Add label property for AT24 Jon Hunter
2020-09-23 15:32   ` Rob Herring
2020-09-24 13:25   ` Bartosz Golaszewski
2020-09-16  9:49 ` [PATCH V2 3/5] misc: eeprom: at24: Support custom device names for AT24 EEPROMs Jon Hunter
2020-09-24 13:25   ` Bartosz Golaszewski
2020-09-16  9:49 ` [PATCH V2 4/5] arm64: tegra: Add label properties for EEPROMs Jon Hunter
2020-09-16  9:49 ` [PATCH V2 5/5] arm64: tegra: Populate EEPROMs for Jetson Xavier NX Jon Hunter
2020-09-23  9:15 ` [PATCH V2 0/5] Add support for custom names for AT24 EEPROMs Bartosz Golaszewski
2020-09-23  9:23   ` Jon Hunter
2020-09-23 11:38   ` Thierry Reding
2020-09-23 11:43     ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).