All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-03-30 13:48 ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

This patchset adds a socinfo driver which provides information about
Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
serial_number.

Please note the serial number is currently available only for the S500
SoC variant.

This has been tested on the S500 SoC based RoseapplePi SBC.

Thanks,
Cristi

Changes in v2:
 - Exposed the memory range for reading the SoC serial number under
   /reserved-memory DT node, according to Rob's review; as a consequence
   added a new binding document (actions,owl-soc-serial.yaml) and updated
   owl-socinfo.yaml

 - Replaced the unportable usage of system_serial_{low,high} globals
   with a public API to provide external access to SoC serial number
   parts (e.g. Owl Ethernet MAC driver will use this to generate a
   stable MAC address)

 - Rebased patch series on v5.12-rc5

Cristian Ciocaltea (6):
  dt-bindings: reserved-memory: Add Owl SoC serial number binding
  dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  soc: actions: Add Actions Semi Owl socinfo driver
  arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial
    number
  arm: dts: owl-s500: Add socinfo support
  MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings

 .../actions,owl-soc-serial.yaml               |  53 ++++++
 .../bindings/soc/actions/owl-socinfo.yaml     |  57 +++++++
 MAINTAINERS                                   |   2 +
 arch/arm/boot/dts/owl-s500.dtsi               |  13 +-
 drivers/soc/actions/Kconfig                   |   8 +
 drivers/soc/actions/Makefile                  |   1 +
 drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
 include/linux/soc/actions/owl-serial-number.h |  20 +++
 8 files changed, 305 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
 create mode 100644 drivers/soc/actions/owl-socinfo.c
 create mode 100644 include/linux/soc/actions/owl-serial-number.h

-- 
2.31.1


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

* [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-03-30 13:48 ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

This patchset adds a socinfo driver which provides information about
Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
serial_number.

Please note the serial number is currently available only for the S500
SoC variant.

This has been tested on the S500 SoC based RoseapplePi SBC.

Thanks,
Cristi

Changes in v2:
 - Exposed the memory range for reading the SoC serial number under
   /reserved-memory DT node, according to Rob's review; as a consequence
   added a new binding document (actions,owl-soc-serial.yaml) and updated
   owl-socinfo.yaml

 - Replaced the unportable usage of system_serial_{low,high} globals
   with a public API to provide external access to SoC serial number
   parts (e.g. Owl Ethernet MAC driver will use this to generate a
   stable MAC address)

 - Rebased patch series on v5.12-rc5

Cristian Ciocaltea (6):
  dt-bindings: reserved-memory: Add Owl SoC serial number binding
  dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  soc: actions: Add Actions Semi Owl socinfo driver
  arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial
    number
  arm: dts: owl-s500: Add socinfo support
  MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings

 .../actions,owl-soc-serial.yaml               |  53 ++++++
 .../bindings/soc/actions/owl-socinfo.yaml     |  57 +++++++
 MAINTAINERS                                   |   2 +
 arch/arm/boot/dts/owl-s500.dtsi               |  13 +-
 drivers/soc/actions/Kconfig                   |   8 +
 drivers/soc/actions/Makefile                  |   1 +
 drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
 include/linux/soc/actions/owl-serial-number.h |  20 +++
 8 files changed, 305 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
 create mode 100644 drivers/soc/actions/owl-socinfo.c
 create mode 100644 include/linux/soc/actions/owl-serial-number.h

-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add devicetree binding for the Actions Semi Owl SoC serial number
reserved-memory range.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml

diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
new file mode 100644
index 000000000000..41b71f47ee6c
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Actions Semi Owl reserved-memory for SoC serial number
+
+maintainers:
+  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+
+description: |
+  Provide access to the memory region where the two parts of the Actions
+  Semi Owl SoC serial number (low & high) can be read from. This information
+  is provided by the bootloader, hence expose it under /reserved-memory node.
+
+  Please refer to reserved-memory.txt in this directory for common binding
+  part and usage.
+
+  This is currently supported only on the S500 SoC variant.
+
+properties:
+  compatible:
+    oneOf:
+      - const: actions,owl-soc-serial
+      - items:
+          - enum:
+              - actions,s500-soc-serial
+          - const: actions,owl-soc-serial
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    reserved-memory {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        soc_serial: soc-serial@800 {
+            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
+            reg = <0x800 0x8>;
+        };
+    };
+
+...
-- 
2.31.1


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

* [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add devicetree binding for the Actions Semi Owl SoC serial number
reserved-memory range.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml

diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
new file mode 100644
index 000000000000..41b71f47ee6c
--- /dev/null
+++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
@@ -0,0 +1,53 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Actions Semi Owl reserved-memory for SoC serial number
+
+maintainers:
+  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+
+description: |
+  Provide access to the memory region where the two parts of the Actions
+  Semi Owl SoC serial number (low & high) can be read from. This information
+  is provided by the bootloader, hence expose it under /reserved-memory node.
+
+  Please refer to reserved-memory.txt in this directory for common binding
+  part and usage.
+
+  This is currently supported only on the S500 SoC variant.
+
+properties:
+  compatible:
+    oneOf:
+      - const: actions,owl-soc-serial
+      - items:
+          - enum:
+              - actions,s500-soc-serial
+          - const: actions,owl-soc-serial
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: true
+
+examples:
+  - |
+    reserved-memory {
+        #address-cells = <1>;
+        #size-cells = <1>;
+        ranges;
+
+        soc_serial: soc-serial@800 {
+            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
+            reg = <0x800 0x8>;
+        };
+    };
+
+...
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add devicetree binding for the Actions Semi Owl socinfo driver.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml

diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
new file mode 100644
index 000000000000..01e4a8b4f5ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Actions Semi Owl SoC info module
+
+maintainers:
+  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+
+description: |
+  Actions Semi Owl SoC info module provides access to various information
+  about the S500, S700 and S900 SoC variants, such as serial number or id.
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - actions,s500-soc
+          - actions,s700-soc
+          - actions,s900-soc
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - actions,s500-soc
+          - actions,s700-soc
+          - actions,s900-soc
+      - const: simple-bus
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+    / {
+        compatible = "roseapplepi,roseapplepi", "actions,s500";
+        model = "Roseapple Pi";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        soc {
+            compatible = "actions,s500-soc", "simple-bus";
+            #address-cells = <1>;
+            #size-cells = <1>;
+            ranges;
+        };
+    };
+
+...
-- 
2.31.1


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

* [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add devicetree binding for the Actions Semi Owl socinfo driver.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml

diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
new file mode 100644
index 000000000000..01e4a8b4f5ac
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Actions Semi Owl SoC info module
+
+maintainers:
+  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+
+description: |
+  Actions Semi Owl SoC info module provides access to various information
+  about the S500, S700 and S900 SoC variants, such as serial number or id.
+
+select:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - actions,s500-soc
+          - actions,s700-soc
+          - actions,s900-soc
+  required:
+    - compatible
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - actions,s500-soc
+          - actions,s700-soc
+          - actions,s900-soc
+      - const: simple-bus
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+    / {
+        compatible = "roseapplepi,roseapplepi", "actions,s500";
+        model = "Roseapple Pi";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        soc {
+            compatible = "actions,s500-soc", "simple-bus";
+            #address-cells = <1>;
+            #size-cells = <1>;
+            ranges;
+        };
+    };
+
+...
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

The driver provides information about the Action Semi Owl family of
SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
soc_id, serial_number.

Note the serial number is currently provided only for the S500 SoC
variant.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 drivers/soc/actions/Kconfig                   |   8 +
 drivers/soc/actions/Makefile                  |   1 +
 drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
 include/linux/soc/actions/owl-serial-number.h |  20 +++
 4 files changed, 181 insertions(+)
 create mode 100644 drivers/soc/actions/owl-socinfo.c
 create mode 100644 include/linux/soc/actions/owl-serial-number.h

diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
index 1aca2058a40c..15faade9282d 100644
--- a/drivers/soc/actions/Kconfig
+++ b/drivers/soc/actions/Kconfig
@@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
 	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
 	  If unsure, say 'n'.
 
+config OWL_SOCINFO
+	bool "Actions Semi Owl SoC info driver"
+	default ARCH_ACTIONS
+	select SOC_BUS
+	help
+	  Say 'y' here to support the Action Semiconductor Owl socinfo
+	  driver, providing information about the SoC to user space.
+
 endif
diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
index 4db9e7b050e5..4b2591d3089f 100644
--- a/drivers/soc/actions/Makefile
+++ b/drivers/soc/actions/Makefile
@@ -2,3 +2,4 @@
 
 obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
 obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
+obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
new file mode 100644
index 000000000000..f28eafac3792
--- /dev/null
+++ b/drivers/soc/actions/owl-socinfo.c
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Actions Semi Owl SoC information driver
+ *
+ * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+ */
+
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/random.h>
+#include <linux/soc/actions/owl-serial-number.h>
+#include <linux/sys_soc.h>
+
+struct owl_soc_serial_rmem {
+	u32 low;
+	u32 high;
+};
+
+static struct owl_soc_serial_rmem *owl_socinfo_serial;
+
+u32 owl_get_soc_serial_low(void)
+{
+	return owl_socinfo_serial ? owl_socinfo_serial->low : 0;
+}
+EXPORT_SYMBOL_GPL(owl_get_soc_serial_low);
+
+u32 owl_get_soc_serial_high(void)
+{
+	return owl_socinfo_serial ? owl_socinfo_serial->high : 0;
+}
+EXPORT_SYMBOL_GPL(owl_get_soc_serial_high);
+
+struct owl_soc_info {
+	char *name;
+	int (*read_soc_serial)(struct device *dev);
+};
+
+/*
+ * Access SoC's serial number stored by the bootloader in DDR memory.
+ */
+static int owl_socinfo_read_serial_rmem(struct device *dev)
+{
+	struct reserved_mem *rmem;
+	struct device_node *np;
+	int ret = 0;
+
+	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
+	if (!np)
+		return -ENXIO;
+
+	rmem = of_reserved_mem_lookup(np);
+	if (!rmem) {
+		dev_err(dev, "failed to acquire reserved memory region\n");
+		ret = -EINVAL;
+		goto out_put;
+	}
+
+	owl_socinfo_serial = memremap(rmem->base, rmem->size, MEMREMAP_WB);
+	if (!owl_socinfo_serial)
+		ret = -ENOMEM;
+
+out_put:
+	of_node_put(np);
+	return ret;
+}
+
+static int owl_socinfo_probe(struct platform_device *pdev)
+{
+	const struct owl_soc_info *soc_info;
+	struct soc_device_attribute *soc_dev_attr;
+	struct soc_device *soc_dev;
+	const char *sn;
+	int ret;
+
+	soc_info = of_device_get_match_data(&pdev->dev);
+	if (!soc_info)
+		return -ENODEV;
+
+	soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr),
+				    GFP_KERNEL);
+	if (!soc_dev_attr)
+		return -ENOMEM;
+
+	ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
+	if (ret)
+		return ret;
+
+	soc_dev_attr->family = "Actions Semi Owl";
+	soc_dev_attr->soc_id = soc_info->name;
+
+	if (soc_info->read_soc_serial) {
+		ret = soc_info->read_soc_serial(&pdev->dev);
+
+		if (!ret) {
+			sn = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%08x%08x",
+					    owl_get_soc_serial_high(),
+					    owl_get_soc_serial_low());
+			soc_dev_attr->serial_number = sn;
+			/* Feed the SoC unique data into entropy pool. */
+			add_device_randomness(sn, 16);
+		}
+	}
+
+	soc_dev = soc_device_register(soc_dev_attr);
+	if (IS_ERR(soc_dev))
+		return dev_err_probe(&pdev->dev, PTR_ERR(soc_dev),
+				     "failed to register soc device");
+
+	dev_info(soc_device_to_device(soc_dev),
+		 "SoC: %s %s\n",
+		 soc_dev_attr->family, soc_dev_attr->soc_id);
+
+	return 0;
+}
+
+static const struct owl_soc_info s500_soc_info = {
+	.name = "S500",
+	.read_soc_serial = owl_socinfo_read_serial_rmem,
+};
+
+static const struct owl_soc_info s700_soc_info = {
+	.name = "S700",
+	/* FIXME: provide read_soc_serial */
+};
+
+static const struct owl_soc_info s900_soc_info = {
+	.name = "S900",
+	/* FIXME: provide read_soc_serial */
+};
+
+static const struct of_device_id owl_socinfo_of_match[] = {
+	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
+	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
+	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },
+	{ }
+};
+
+static struct platform_driver owl_socinfo_platform_driver = {
+	.probe = owl_socinfo_probe,
+	.driver = {
+		.name = "owl-socinfo",
+		.of_match_table = owl_socinfo_of_match,
+	},
+};
+
+static int __init owl_socinfo_init(void)
+{
+	return platform_driver_register(&owl_socinfo_platform_driver);
+}
+subsys_initcall(owl_socinfo_init);
diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
new file mode 100644
index 000000000000..f8595417668f
--- /dev/null
+++ b/include/linux/soc/actions/owl-serial-number.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+ */
+
+#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
+#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
+
+#if IS_ENABLED(CONFIG_OWL_SOCINFO)
+u32 owl_get_soc_serial_low(void);
+u32 owl_get_soc_serial_high(void);
+#else
+static inline u32 owl_get_soc_serial_low(void)
+{ return 0; }
+
+static inline u32 owl_get_soc_serial_high(void)
+{ return 0; }
+#endif /* CONFIG_OWL_SOCINFO */
+
+#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
-- 
2.31.1


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

* [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

The driver provides information about the Action Semi Owl family of
SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
soc_id, serial_number.

Note the serial number is currently provided only for the S500 SoC
variant.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 drivers/soc/actions/Kconfig                   |   8 +
 drivers/soc/actions/Makefile                  |   1 +
 drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
 include/linux/soc/actions/owl-serial-number.h |  20 +++
 4 files changed, 181 insertions(+)
 create mode 100644 drivers/soc/actions/owl-socinfo.c
 create mode 100644 include/linux/soc/actions/owl-serial-number.h

diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
index 1aca2058a40c..15faade9282d 100644
--- a/drivers/soc/actions/Kconfig
+++ b/drivers/soc/actions/Kconfig
@@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
 	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
 	  If unsure, say 'n'.
 
+config OWL_SOCINFO
+	bool "Actions Semi Owl SoC info driver"
+	default ARCH_ACTIONS
+	select SOC_BUS
+	help
+	  Say 'y' here to support the Action Semiconductor Owl socinfo
+	  driver, providing information about the SoC to user space.
+
 endif
diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
index 4db9e7b050e5..4b2591d3089f 100644
--- a/drivers/soc/actions/Makefile
+++ b/drivers/soc/actions/Makefile
@@ -2,3 +2,4 @@
 
 obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
 obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
+obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
new file mode 100644
index 000000000000..f28eafac3792
--- /dev/null
+++ b/drivers/soc/actions/owl-socinfo.c
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Actions Semi Owl SoC information driver
+ *
+ * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+ */
+
+#include <linux/of_address.h>
+#include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
+#include <linux/platform_device.h>
+#include <linux/random.h>
+#include <linux/soc/actions/owl-serial-number.h>
+#include <linux/sys_soc.h>
+
+struct owl_soc_serial_rmem {
+	u32 low;
+	u32 high;
+};
+
+static struct owl_soc_serial_rmem *owl_socinfo_serial;
+
+u32 owl_get_soc_serial_low(void)
+{
+	return owl_socinfo_serial ? owl_socinfo_serial->low : 0;
+}
+EXPORT_SYMBOL_GPL(owl_get_soc_serial_low);
+
+u32 owl_get_soc_serial_high(void)
+{
+	return owl_socinfo_serial ? owl_socinfo_serial->high : 0;
+}
+EXPORT_SYMBOL_GPL(owl_get_soc_serial_high);
+
+struct owl_soc_info {
+	char *name;
+	int (*read_soc_serial)(struct device *dev);
+};
+
+/*
+ * Access SoC's serial number stored by the bootloader in DDR memory.
+ */
+static int owl_socinfo_read_serial_rmem(struct device *dev)
+{
+	struct reserved_mem *rmem;
+	struct device_node *np;
+	int ret = 0;
+
+	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
+	if (!np)
+		return -ENXIO;
+
+	rmem = of_reserved_mem_lookup(np);
+	if (!rmem) {
+		dev_err(dev, "failed to acquire reserved memory region\n");
+		ret = -EINVAL;
+		goto out_put;
+	}
+
+	owl_socinfo_serial = memremap(rmem->base, rmem->size, MEMREMAP_WB);
+	if (!owl_socinfo_serial)
+		ret = -ENOMEM;
+
+out_put:
+	of_node_put(np);
+	return ret;
+}
+
+static int owl_socinfo_probe(struct platform_device *pdev)
+{
+	const struct owl_soc_info *soc_info;
+	struct soc_device_attribute *soc_dev_attr;
+	struct soc_device *soc_dev;
+	const char *sn;
+	int ret;
+
+	soc_info = of_device_get_match_data(&pdev->dev);
+	if (!soc_info)
+		return -ENODEV;
+
+	soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr),
+				    GFP_KERNEL);
+	if (!soc_dev_attr)
+		return -ENOMEM;
+
+	ret = of_property_read_string(of_root, "model", &soc_dev_attr->machine);
+	if (ret)
+		return ret;
+
+	soc_dev_attr->family = "Actions Semi Owl";
+	soc_dev_attr->soc_id = soc_info->name;
+
+	if (soc_info->read_soc_serial) {
+		ret = soc_info->read_soc_serial(&pdev->dev);
+
+		if (!ret) {
+			sn = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%08x%08x",
+					    owl_get_soc_serial_high(),
+					    owl_get_soc_serial_low());
+			soc_dev_attr->serial_number = sn;
+			/* Feed the SoC unique data into entropy pool. */
+			add_device_randomness(sn, 16);
+		}
+	}
+
+	soc_dev = soc_device_register(soc_dev_attr);
+	if (IS_ERR(soc_dev))
+		return dev_err_probe(&pdev->dev, PTR_ERR(soc_dev),
+				     "failed to register soc device");
+
+	dev_info(soc_device_to_device(soc_dev),
+		 "SoC: %s %s\n",
+		 soc_dev_attr->family, soc_dev_attr->soc_id);
+
+	return 0;
+}
+
+static const struct owl_soc_info s500_soc_info = {
+	.name = "S500",
+	.read_soc_serial = owl_socinfo_read_serial_rmem,
+};
+
+static const struct owl_soc_info s700_soc_info = {
+	.name = "S700",
+	/* FIXME: provide read_soc_serial */
+};
+
+static const struct owl_soc_info s900_soc_info = {
+	.name = "S900",
+	/* FIXME: provide read_soc_serial */
+};
+
+static const struct of_device_id owl_socinfo_of_match[] = {
+	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
+	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
+	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },
+	{ }
+};
+
+static struct platform_driver owl_socinfo_platform_driver = {
+	.probe = owl_socinfo_probe,
+	.driver = {
+		.name = "owl-socinfo",
+		.of_match_table = owl_socinfo_of_match,
+	},
+};
+
+static int __init owl_socinfo_init(void)
+{
+	return platform_driver_register(&owl_socinfo_platform_driver);
+}
+subsys_initcall(owl_socinfo_init);
diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
new file mode 100644
index 000000000000..f8595417668f
--- /dev/null
+++ b/include/linux/soc/actions/owl-serial-number.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
+ */
+
+#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
+#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
+
+#if IS_ENABLED(CONFIG_OWL_SOCINFO)
+u32 owl_get_soc_serial_low(void);
+u32 owl_get_soc_serial_high(void);
+#else
+static inline u32 owl_get_soc_serial_low(void)
+{ return 0; }
+
+static inline u32 owl_get_soc_serial_high(void)
+{ return 0; }
+#endif /* CONFIG_OWL_SOCINFO */
+
+#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 4/6] arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial number
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Provide access to the reserved memory region where the Actions Semi Owl
S500 SoC serial number can be read from.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 arch/arm/boot/dts/owl-s500.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/owl-s500.dtsi b/arch/arm/boot/dts/owl-s500.dtsi
index 739b4b9cec8c..e4c61a9c6e39 100644
--- a/arch/arm/boot/dts/owl-s500.dtsi
+++ b/arch/arm/boot/dts/owl-s500.dtsi
@@ -23,6 +23,17 @@ aliases {
 	chosen {
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		soc_serial: soc-serial@800 {
+			compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
+			reg = <0x800 0x8>;
+		};
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-- 
2.31.1


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

* [PATCH v2 4/6] arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial number
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Provide access to the reserved memory region where the Actions Semi Owl
S500 SoC serial number can be read from.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 arch/arm/boot/dts/owl-s500.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/owl-s500.dtsi b/arch/arm/boot/dts/owl-s500.dtsi
index 739b4b9cec8c..e4c61a9c6e39 100644
--- a/arch/arm/boot/dts/owl-s500.dtsi
+++ b/arch/arm/boot/dts/owl-s500.dtsi
@@ -23,6 +23,17 @@ aliases {
 	chosen {
 	};
 
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		soc_serial: soc-serial@800 {
+			compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
+			reg = <0x800 0x8>;
+		};
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 5/6] arm: dts: owl-s500: Add socinfo support
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Update soc node compatible property to enable support for the Actions
Semi Owl soc info driver.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 arch/arm/boot/dts/owl-s500.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/owl-s500.dtsi b/arch/arm/boot/dts/owl-s500.dtsi
index e4c61a9c6e39..a8eb276e5ac1 100644
--- a/arch/arm/boot/dts/owl-s500.dtsi
+++ b/arch/arm/boot/dts/owl-s500.dtsi
@@ -91,7 +91,7 @@ losc: losc {
 	};
 
 	soc {
-		compatible = "simple-bus";
+		compatible = "actions,s500-soc", "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
-- 
2.31.1


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

* [PATCH v2 5/6] arm: dts: owl-s500: Add socinfo support
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Update soc node compatible property to enable support for the Actions
Semi Owl soc info driver.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 arch/arm/boot/dts/owl-s500.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/owl-s500.dtsi b/arch/arm/boot/dts/owl-s500.dtsi
index e4c61a9c6e39..a8eb276e5ac1 100644
--- a/arch/arm/boot/dts/owl-s500.dtsi
+++ b/arch/arm/boot/dts/owl-s500.dtsi
@@ -91,7 +91,7 @@ losc: losc {
 	};
 
 	soc {
-		compatible = "simple-bus";
+		compatible = "actions,s500-soc", "simple-bus";
 		#address-cells = <1>;
 		#size-cells = <1>;
 		ranges;
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 6/6] MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add entries for the Actions Semi Owl reserved-memory and socinfo
bindings.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index bea5ac8a5e47..48b7f7d097ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1533,6 +1533,8 @@ F:	Documentation/devicetree/bindings/mmc/owl-mmc.yaml
 F:	Documentation/devicetree/bindings/net/actions,owl-emac.yaml
 F:	Documentation/devicetree/bindings/pinctrl/actions,*
 F:	Documentation/devicetree/bindings/power/actions,owl-sps.txt
+F:	Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
+F:	Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
 F:	Documentation/devicetree/bindings/timer/actions,owl-timer.txt
 F:	arch/arm/boot/dts/owl-*
 F:	arch/arm/mach-actions/
-- 
2.31.1


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

* [PATCH v2 6/6] MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings
@ 2021-03-30 13:48   ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-03-30 13:48 UTC (permalink / raw)
  To: Rob Herring, Andreas Färber, Manivannan Sadhasivam
  Cc: devicetree, linux-arm-kernel, linux-actions, linux-kernel

Add entries for the Actions Semi Owl reserved-memory and socinfo
bindings.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index bea5ac8a5e47..48b7f7d097ae 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1533,6 +1533,8 @@ F:	Documentation/devicetree/bindings/mmc/owl-mmc.yaml
 F:	Documentation/devicetree/bindings/net/actions,owl-emac.yaml
 F:	Documentation/devicetree/bindings/pinctrl/actions,*
 F:	Documentation/devicetree/bindings/power/actions,owl-sps.txt
+F:	Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
+F:	Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
 F:	Documentation/devicetree/bindings/timer/actions,owl-timer.txt
 F:	arch/arm/boot/dts/owl-*
 F:	arch/arm/mach-actions/
-- 
2.31.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-03-30 13:48 ` Cristian Ciocaltea
@ 2021-04-01  5:24   ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01  5:24 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> This patchset adds a socinfo driver which provides information about
> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> serial_number.
> 
> Please note the serial number is currently available only for the S500
> SoC variant.
> 
> This has been tested on the S500 SoC based RoseapplePi SBC.
> 

Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
what basis it provides? I don't think the SoC has the provision for
soc_id based on HW parameters.

Thanks,
Mani

> Thanks,
> Cristi
> 
> Changes in v2:
>  - Exposed the memory range for reading the SoC serial number under
>    /reserved-memory DT node, according to Rob's review; as a consequence
>    added a new binding document (actions,owl-soc-serial.yaml) and updated
>    owl-socinfo.yaml
> 
>  - Replaced the unportable usage of system_serial_{low,high} globals
>    with a public API to provide external access to SoC serial number
>    parts (e.g. Owl Ethernet MAC driver will use this to generate a
>    stable MAC address)
> 
>  - Rebased patch series on v5.12-rc5
> 
> Cristian Ciocaltea (6):
>   dt-bindings: reserved-memory: Add Owl SoC serial number binding
>   dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
>   soc: actions: Add Actions Semi Owl socinfo driver
>   arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial
>     number
>   arm: dts: owl-s500: Add socinfo support
>   MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings
> 
>  .../actions,owl-soc-serial.yaml               |  53 ++++++
>  .../bindings/soc/actions/owl-socinfo.yaml     |  57 +++++++
>  MAINTAINERS                                   |   2 +
>  arch/arm/boot/dts/owl-s500.dtsi               |  13 +-
>  drivers/soc/actions/Kconfig                   |   8 +
>  drivers/soc/actions/Makefile                  |   1 +
>  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
>  include/linux/soc/actions/owl-serial-number.h |  20 +++
>  8 files changed, 305 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
>  create mode 100644 drivers/soc/actions/owl-socinfo.c
>  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> 
> -- 
> 2.31.1
> 

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01  5:24   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01  5:24 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> This patchset adds a socinfo driver which provides information about
> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> serial_number.
> 
> Please note the serial number is currently available only for the S500
> SoC variant.
> 
> This has been tested on the S500 SoC based RoseapplePi SBC.
> 

Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
what basis it provides? I don't think the SoC has the provision for
soc_id based on HW parameters.

Thanks,
Mani

> Thanks,
> Cristi
> 
> Changes in v2:
>  - Exposed the memory range for reading the SoC serial number under
>    /reserved-memory DT node, according to Rob's review; as a consequence
>    added a new binding document (actions,owl-soc-serial.yaml) and updated
>    owl-socinfo.yaml
> 
>  - Replaced the unportable usage of system_serial_{low,high} globals
>    with a public API to provide external access to SoC serial number
>    parts (e.g. Owl Ethernet MAC driver will use this to generate a
>    stable MAC address)
> 
>  - Rebased patch series on v5.12-rc5
> 
> Cristian Ciocaltea (6):
>   dt-bindings: reserved-memory: Add Owl SoC serial number binding
>   dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
>   soc: actions: Add Actions Semi Owl socinfo driver
>   arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial
>     number
>   arm: dts: owl-s500: Add socinfo support
>   MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings
> 
>  .../actions,owl-soc-serial.yaml               |  53 ++++++
>  .../bindings/soc/actions/owl-socinfo.yaml     |  57 +++++++
>  MAINTAINERS                                   |   2 +
>  arch/arm/boot/dts/owl-s500.dtsi               |  13 +-
>  drivers/soc/actions/Kconfig                   |   8 +
>  drivers/soc/actions/Makefile                  |   1 +
>  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
>  include/linux/soc/actions/owl-serial-number.h |  20 +++
>  8 files changed, 305 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
>  create mode 100644 drivers/soc/actions/owl-socinfo.c
>  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> 
> -- 
> 2.31.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01  5:24   ` Manivannan Sadhasivam
@ 2021-04-01  9:40     ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01  9:40 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

Hi Mani,

On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > This patchset adds a socinfo driver which provides information about
> > Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > serial_number.
> > 
> > Please note the serial number is currently available only for the S500
> > SoC variant.
> > 
> > This has been tested on the S500 SoC based RoseapplePi SBC.
> > 
> 
> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> what basis it provides? I don't think the SoC has the provision for
> soc_id based on HW parameters.

No, the soc_id is not provided by the bootloader, or at least I couldn't
identify any related implementation. Instead, I provided this via the
driver itself, since I've encountered this approach in some other soc
drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 

Thanks,
Cristi

> Thanks,
> Mani
 
[...]

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01  9:40     ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01  9:40 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

Hi Mani,

On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > This patchset adds a socinfo driver which provides information about
> > Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > serial_number.
> > 
> > Please note the serial number is currently available only for the S500
> > SoC variant.
> > 
> > This has been tested on the S500 SoC based RoseapplePi SBC.
> > 
> 
> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> what basis it provides? I don't think the SoC has the provision for
> soc_id based on HW parameters.

No, the soc_id is not provided by the bootloader, or at least I couldn't
identify any related implementation. Instead, I provided this via the
driver itself, since I've encountered this approach in some other soc
drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 

Thanks,
Cristi

> Thanks,
> Mani
 
[...]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01  9:40     ` Cristian Ciocaltea
@ 2021-04-01 10:27       ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01 10:27 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> Hi Mani,
> 
> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > > This patchset adds a socinfo driver which provides information about
> > > Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > > serial_number.
> > > 
> > > Please note the serial number is currently available only for the S500
> > > SoC variant.
> > > 
> > > This has been tested on the S500 SoC based RoseapplePi SBC.
> > > 
> > 
> > Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > what basis it provides? I don't think the SoC has the provision for
> > soc_id based on HW parameters.
> 
> No, the soc_id is not provided by the bootloader, or at least I couldn't
> identify any related implementation. Instead, I provided this via the
> driver itself, since I've encountered this approach in some other soc
> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> 

Sorry, I was referring to serial_number. Since your comment says so, can
you point to the corresponding code?

Thanks,
Mani

> Thanks,
> Cristi
> 
> > Thanks,
> > Mani
>  
> [...]

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01 10:27       ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01 10:27 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> Hi Mani,
> 
> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > > This patchset adds a socinfo driver which provides information about
> > > Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > > serial_number.
> > > 
> > > Please note the serial number is currently available only for the S500
> > > SoC variant.
> > > 
> > > This has been tested on the S500 SoC based RoseapplePi SBC.
> > > 
> > 
> > Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > what basis it provides? I don't think the SoC has the provision for
> > soc_id based on HW parameters.
> 
> No, the soc_id is not provided by the bootloader, or at least I couldn't
> identify any related implementation. Instead, I provided this via the
> driver itself, since I've encountered this approach in some other soc
> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> 

Sorry, I was referring to serial_number. Since your comment says so, can
you point to the corresponding code?

Thanks,
Mani

> Thanks,
> Cristi
> 
> > Thanks,
> > Mani
>  
> [...]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01 10:27       ` Manivannan Sadhasivam
@ 2021-04-01 10:49         ` Andreas Färber
  -1 siblings, 0 replies; 48+ messages in thread
From: Andreas Färber @ 2021-04-01 10:49 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Cristian Ciocaltea
  Cc: Rob Herring, devicetree, linux-arm-kernel, linux-actions, linux-kernel

Hi,

On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
>> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
>>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
>>>> This patchset adds a socinfo driver which provides information about
>>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
>>>> serial_number.
>>>>
>>>> Please note the serial number is currently available only for the S500
>>>> SoC variant.
>>>>
>>>> This has been tested on the S500 SoC based RoseapplePi SBC.
>>>>
>>>
>>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
>>> what basis it provides? I don't think the SoC has the provision for
>>> soc_id based on HW parameters.
>>
>> No, the soc_id is not provided by the bootloader, or at least I couldn't
>> identify any related implementation. Instead, I provided this via the
>> driver itself, since I've encountered this approach in some other soc
>> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
>>
> 
> Sorry, I was referring to serial_number. Since your comment says so, can
> you point to the corresponding code?

Seconded that this needs to be better understood. If this is just a
convention of some downstream U-Boot that's not implemented in mainline
(and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
it might not be worth its own reserved-memory based kernel driver?

Implementing a standard interface such as DMI tables or a DT property in
mainline U-Boot may be more useful then. Is it still Mani's S900 only?

Regards,
Andreas

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01 10:49         ` Andreas Färber
  0 siblings, 0 replies; 48+ messages in thread
From: Andreas Färber @ 2021-04-01 10:49 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Cristian Ciocaltea
  Cc: Rob Herring, devicetree, linux-arm-kernel, linux-actions, linux-kernel

Hi,

On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
>> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
>>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
>>>> This patchset adds a socinfo driver which provides information about
>>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
>>>> serial_number.
>>>>
>>>> Please note the serial number is currently available only for the S500
>>>> SoC variant.
>>>>
>>>> This has been tested on the S500 SoC based RoseapplePi SBC.
>>>>
>>>
>>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
>>> what basis it provides? I don't think the SoC has the provision for
>>> soc_id based on HW parameters.
>>
>> No, the soc_id is not provided by the bootloader, or at least I couldn't
>> identify any related implementation. Instead, I provided this via the
>> driver itself, since I've encountered this approach in some other soc
>> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
>>
> 
> Sorry, I was referring to serial_number. Since your comment says so, can
> you point to the corresponding code?

Seconded that this needs to be better understood. If this is just a
convention of some downstream U-Boot that's not implemented in mainline
(and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
it might not be worth its own reserved-memory based kernel driver?

Implementing a standard interface such as DMI tables or a DT property in
mainline U-Boot may be more useful then. Is it still Mani's S900 only?

Regards,
Andreas

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01 10:49         ` Andreas Färber
@ 2021-04-01 10:58           ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 10:58 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam
  Cc: Rob Herring, devicetree, linux-arm-kernel, linux-actions, linux-kernel

Hi Mani, Andreas,

On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> Hi,
> 
> On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> >>>> This patchset adds a socinfo driver which provides information about
> >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> >>>> serial_number.
> >>>>
> >>>> Please note the serial number is currently available only for the S500
> >>>> SoC variant.
> >>>>
> >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> >>>>
> >>>
> >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> >>> what basis it provides? I don't think the SoC has the provision for
> >>> soc_id based on HW parameters.
> >>
> >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> >> identify any related implementation. Instead, I provided this via the
> >> driver itself, since I've encountered this approach in some other soc
> >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> >>
> > 
> > Sorry, I was referring to serial_number. Since your comment says so, can
> > you point to the corresponding code?
> 
> Seconded that this needs to be better understood. If this is just a
> convention of some downstream U-Boot that's not implemented in mainline
> (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> it might not be worth its own reserved-memory based kernel driver?

The serial number is actually provided by the s500-bootloader for which
Actions did not provide the source code, at least it is not available
in the xapp github repo. I did not find anything related to this in
downstream U-Boot.

Kind regards,
Cristi

> Implementing a standard interface such as DMI tables or a DT property in
> mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> 
> Regards,
> Andreas
> 
> -- 
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer
> HRB 36809 (AG Nürnberg)

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01 10:58           ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 10:58 UTC (permalink / raw)
  To: Andreas Färber, Manivannan Sadhasivam
  Cc: Rob Herring, devicetree, linux-arm-kernel, linux-actions, linux-kernel

Hi Mani, Andreas,

On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> Hi,
> 
> On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> >>>> This patchset adds a socinfo driver which provides information about
> >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> >>>> serial_number.
> >>>>
> >>>> Please note the serial number is currently available only for the S500
> >>>> SoC variant.
> >>>>
> >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> >>>>
> >>>
> >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> >>> what basis it provides? I don't think the SoC has the provision for
> >>> soc_id based on HW parameters.
> >>
> >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> >> identify any related implementation. Instead, I provided this via the
> >> driver itself, since I've encountered this approach in some other soc
> >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> >>
> > 
> > Sorry, I was referring to serial_number. Since your comment says so, can
> > you point to the corresponding code?
> 
> Seconded that this needs to be better understood. If this is just a
> convention of some downstream U-Boot that's not implemented in mainline
> (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> it might not be worth its own reserved-memory based kernel driver?

The serial number is actually provided by the s500-bootloader for which
Actions did not provide the source code, at least it is not available
in the xapp github repo. I did not find anything related to this in
downstream U-Boot.

Kind regards,
Cristi

> Implementing a standard interface such as DMI tables or a DT property in
> mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> 
> Regards,
> Andreas
> 
> -- 
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer
> HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01 10:58           ` Cristian Ciocaltea
@ 2021-04-01 11:07             ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01 11:07 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Rob Herring, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel, matheus

+ Matheus

On Thu, Apr 01, 2021 at 01:58:05PM +0300, Cristian Ciocaltea wrote:
> Hi Mani, Andreas,
> 
> On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> > Hi,
> > 
> > On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> > >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > >>>> This patchset adds a socinfo driver which provides information about
> > >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > >>>> serial_number.
> > >>>>
> > >>>> Please note the serial number is currently available only for the S500
> > >>>> SoC variant.
> > >>>>
> > >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> > >>>>
> > >>>
> > >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > >>> what basis it provides? I don't think the SoC has the provision for
> > >>> soc_id based on HW parameters.
> > >>
> > >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> > >> identify any related implementation. Instead, I provided this via the
> > >> driver itself, since I've encountered this approach in some other soc
> > >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> > >>
> > > 
> > > Sorry, I was referring to serial_number. Since your comment says so, can
> > > you point to the corresponding code?
> > 
> > Seconded that this needs to be better understood. If this is just a
> > convention of some downstream U-Boot that's not implemented in mainline
> > (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> > it might not be worth its own reserved-memory based kernel driver?
> 
> The serial number is actually provided by the s500-bootloader for which
> Actions did not provide the source code, at least it is not available
> in the xapp github repo. I did not find anything related to this in
> downstream U-Boot.
> 

Hmm, then we can consider this as the firmware dependent property. But
can we get consensus that this is common for all S500 SoCs? Maybe,
Matheus can verify it on Labrador?

I don't think adding a SOCINFO driver for a single board is a good idea.

Thanks,
Mani

> Kind regards,
> Cristi
> 
> > Implementing a standard interface such as DMI tables or a DT property in
> > mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> > 
> > Regards,
> > Andreas
> > 
> > -- 
> > SUSE Software Solutions Germany GmbH
> > Maxfeldstr. 5, 90409 Nürnberg, Germany
> > GF: Felix Imendörffer
> > HRB 36809 (AG Nürnberg)

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01 11:07             ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-01 11:07 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Rob Herring, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel, matheus

+ Matheus

On Thu, Apr 01, 2021 at 01:58:05PM +0300, Cristian Ciocaltea wrote:
> Hi Mani, Andreas,
> 
> On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> > Hi,
> > 
> > On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> > >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > >>>> This patchset adds a socinfo driver which provides information about
> > >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > >>>> serial_number.
> > >>>>
> > >>>> Please note the serial number is currently available only for the S500
> > >>>> SoC variant.
> > >>>>
> > >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> > >>>>
> > >>>
> > >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > >>> what basis it provides? I don't think the SoC has the provision for
> > >>> soc_id based on HW parameters.
> > >>
> > >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> > >> identify any related implementation. Instead, I provided this via the
> > >> driver itself, since I've encountered this approach in some other soc
> > >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> > >>
> > > 
> > > Sorry, I was referring to serial_number. Since your comment says so, can
> > > you point to the corresponding code?
> > 
> > Seconded that this needs to be better understood. If this is just a
> > convention of some downstream U-Boot that's not implemented in mainline
> > (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> > it might not be worth its own reserved-memory based kernel driver?
> 
> The serial number is actually provided by the s500-bootloader for which
> Actions did not provide the source code, at least it is not available
> in the xapp github repo. I did not find anything related to this in
> downstream U-Boot.
> 

Hmm, then we can consider this as the firmware dependent property. But
can we get consensus that this is common for all S500 SoCs? Maybe,
Matheus can verify it on Labrador?

I don't think adding a SOCINFO driver for a single board is a good idea.

Thanks,
Mani

> Kind regards,
> Cristi
> 
> > Implementing a standard interface such as DMI tables or a DT property in
> > mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> > 
> > Regards,
> > Andreas
> > 
> > -- 
> > SUSE Software Solutions Germany GmbH
> > Maxfeldstr. 5, 90409 Nürnberg, Germany
> > GF: Felix Imendörffer
> > HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
  2021-04-01 11:07             ` Manivannan Sadhasivam
@ 2021-04-01 13:19               ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 13:19 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Andreas Färber, Rob Herring, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel, matheus

On Thu, Apr 01, 2021 at 04:37:52PM +0530, Manivannan Sadhasivam wrote:
> + Matheus
> 
> On Thu, Apr 01, 2021 at 01:58:05PM +0300, Cristian Ciocaltea wrote:
> > Hi Mani, Andreas,
> > 
> > On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> > > Hi,
> > > 
> > > On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > > > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> > > >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > > >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > > >>>> This patchset adds a socinfo driver which provides information about
> > > >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > > >>>> serial_number.
> > > >>>>
> > > >>>> Please note the serial number is currently available only for the S500
> > > >>>> SoC variant.
> > > >>>>
> > > >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> > > >>>>
> > > >>>
> > > >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > > >>> what basis it provides? I don't think the SoC has the provision for
> > > >>> soc_id based on HW parameters.
> > > >>
> > > >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> > > >> identify any related implementation. Instead, I provided this via the
> > > >> driver itself, since I've encountered this approach in some other soc
> > > >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> > > >>
> > > > 
> > > > Sorry, I was referring to serial_number. Since your comment says so, can
> > > > you point to the corresponding code?
> > > 
> > > Seconded that this needs to be better understood. If this is just a
> > > convention of some downstream U-Boot that's not implemented in mainline
> > > (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> > > it might not be worth its own reserved-memory based kernel driver?
> > 
> > The serial number is actually provided by the s500-bootloader for which
> > Actions did not provide the source code, at least it is not available
> > in the xapp github repo. I did not find anything related to this in
> > downstream U-Boot.
> > 
> 
> Hmm, then we can consider this as the firmware dependent property. But
> can we get consensus that this is common for all S500 SoCs?

This should work on all S500 SoCs, as the downstream Linux kernel doesn't
use any conditional logic around reading those memory locations.
Please see "owl_check_revision()" in arch/arm/mach-owl/board-owl.c, from
any of the following repos:

* https://github.com/xapp-le/kernel
* https://github.com/LeMaker/linux-actions

> Maybe,
> Matheus can verify it on Labrador?

The verification is pretty straightforward: the serial number is dumped
on the serial console by the s500 bootloader right before starting
U-boot:

  load uboot: load address is 0x8000000, entry point is 0x8000040
  in fourth
  chip serial no = 9d,4b,f,6d,31,46,e,8,
  [...]
  U-Boot 2015.04 (Apr 23 2020 - 23:01:25)Actions-Semi

The socinfo driver should provide the equivalent information, but in
reversed order (due to integer representation on LE arch):

  $ cat /sys/devices/soc0/serial_number
  080e46316d0f4b9d

> I don't think adding a SOCINFO driver for a single board is a good idea.

The driver could be used for all Owl SoC variants, including S700 and
S900, even though accessing the serial number is currently supported
only on S500.

Unfortunately I do only have this S500 SoC based SBC to experiment with,
therefore I cannot enable new features for the hardware I'm not able to
validate.

Btw, do you know where I could get an S700 or S900 board from? I
couldn't find any so far..

Thanks,
Cristi

> Thanks,
> Mani
> 
> > Kind regards,
> > Cristi
> > 
> > > Implementing a standard interface such as DMI tables or a DT property in
> > > mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> > > 
> > > Regards,
> > > Andreas
> > > 
> > > -- 
> > > SUSE Software Solutions Germany GmbH
> > > Maxfeldstr. 5, 90409 Nürnberg, Germany
> > > GF: Felix Imendörffer
> > > HRB 36809 (AG Nürnberg)

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

* Re: [PATCH v2 0/6] Add support for Actions Semi Owl socinfo
@ 2021-04-01 13:19               ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 13:19 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Andreas Färber, Rob Herring, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel, matheus

On Thu, Apr 01, 2021 at 04:37:52PM +0530, Manivannan Sadhasivam wrote:
> + Matheus
> 
> On Thu, Apr 01, 2021 at 01:58:05PM +0300, Cristian Ciocaltea wrote:
> > Hi Mani, Andreas,
> > 
> > On Thu, Apr 01, 2021 at 12:49:37PM +0200, Andreas Färber wrote:
> > > Hi,
> > > 
> > > On 01.04.21 12:27, Manivannan Sadhasivam wrote:
> > > > On Thu, Apr 01, 2021 at 12:40:41PM +0300, Cristian Ciocaltea wrote:
> > > >> On Thu, Apr 01, 2021 at 10:54:38AM +0530, Manivannan Sadhasivam wrote:
> > > >>> On Tue, Mar 30, 2021 at 04:48:15PM +0300, Cristian Ciocaltea wrote:
> > > >>>> This patchset adds a socinfo driver which provides information about
> > > >>>> Actions Semi Owl SoCs to user space via sysfs: machine, family, soc_id,
> > > >>>> serial_number.
> > > >>>>
> > > >>>> Please note the serial number is currently available only for the S500
> > > >>>> SoC variant.
> > > >>>>
> > > >>>> This has been tested on the S500 SoC based RoseapplePi SBC.
> > > >>>>
> > > >>>
> > > >>> Is this the soc_id provided by the vendor bootloader (uboot)? If so, under
> > > >>> what basis it provides? I don't think the SoC has the provision for
> > > >>> soc_id based on HW parameters.
> > > >>
> > > >> No, the soc_id is not provided by the bootloader, or at least I couldn't
> > > >> identify any related implementation. Instead, I provided this via the
> > > >> driver itself, since I've encountered this approach in some other soc
> > > >> drivers as well (e.g. imx/soc-imx.c, versatile/soc-integrator.c). 
> > > >>
> > > > 
> > > > Sorry, I was referring to serial_number. Since your comment says so, can
> > > > you point to the corresponding code?
> > > 
> > > Seconded that this needs to be better understood. If this is just a
> > > convention of some downstream U-Boot that's not implemented in mainline
> > > (and maybe not even for Guitar or Labrador? tested on RoseapplePi only),
> > > it might not be worth its own reserved-memory based kernel driver?
> > 
> > The serial number is actually provided by the s500-bootloader for which
> > Actions did not provide the source code, at least it is not available
> > in the xapp github repo. I did not find anything related to this in
> > downstream U-Boot.
> > 
> 
> Hmm, then we can consider this as the firmware dependent property. But
> can we get consensus that this is common for all S500 SoCs?

This should work on all S500 SoCs, as the downstream Linux kernel doesn't
use any conditional logic around reading those memory locations.
Please see "owl_check_revision()" in arch/arm/mach-owl/board-owl.c, from
any of the following repos:

* https://github.com/xapp-le/kernel
* https://github.com/LeMaker/linux-actions

> Maybe,
> Matheus can verify it on Labrador?

The verification is pretty straightforward: the serial number is dumped
on the serial console by the s500 bootloader right before starting
U-boot:

  load uboot: load address is 0x8000000, entry point is 0x8000040
  in fourth
  chip serial no = 9d,4b,f,6d,31,46,e,8,
  [...]
  U-Boot 2015.04 (Apr 23 2020 - 23:01:25)Actions-Semi

The socinfo driver should provide the equivalent information, but in
reversed order (due to integer representation on LE arch):

  $ cat /sys/devices/soc0/serial_number
  080e46316d0f4b9d

> I don't think adding a SOCINFO driver for a single board is a good idea.

The driver could be used for all Owl SoC variants, including S700 and
S900, even though accessing the serial number is currently supported
only on S500.

Unfortunately I do only have this S500 SoC based SBC to experiment with,
therefore I cannot enable new features for the hardware I'm not able to
validate.

Btw, do you know where I could get an S700 or S900 board from? I
couldn't find any so far..

Thanks,
Cristi

> Thanks,
> Mani
> 
> > Kind regards,
> > Cristi
> > 
> > > Implementing a standard interface such as DMI tables or a DT property in
> > > mainline U-Boot may be more useful then. Is it still Mani's S900 only?
> > > 
> > > Regards,
> > > Andreas
> > > 
> > > -- 
> > > SUSE Software Solutions Germany GmbH
> > > Maxfeldstr. 5, 90409 Nürnberg, Germany
> > > GF: Felix Imendörffer
> > > HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
  2021-03-30 13:48   ` Cristian Ciocaltea
@ 2021-04-01 17:07     ` Rob Herring
  -1 siblings, 0 replies; 48+ messages in thread
From: Rob Herring @ 2021-04-01 17:07 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl SoC serial number
> reserved-memory range.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> 
> diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> new file mode 100644
> index 000000000000..41b71f47ee6c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> @@ -0,0 +1,53 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl reserved-memory for SoC serial number
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Provide access to the memory region where the two parts of the Actions
> +  Semi Owl SoC serial number (low & high) can be read from. This information
> +  is provided by the bootloader, hence expose it under /reserved-memory node.
> +
> +  Please refer to reserved-memory.txt in this directory for common binding
> +  part and usage.
> +
> +  This is currently supported only on the S500 SoC variant.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: actions,owl-soc-serial
> +      - items:
> +          - enum:
> +              - actions,s500-soc-serial
> +          - const: actions,owl-soc-serial
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    reserved-memory {
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;
> +
> +        soc_serial: soc-serial@800 {
> +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> +            reg = <0x800 0x8>;

You end up wasting a whole page of memory for 8 bytes. It may be better 
to copy this to a DT property ('serial-number' is already a defined root 
property).

Rob

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
@ 2021-04-01 17:07     ` Rob Herring
  0 siblings, 0 replies; 48+ messages in thread
From: Rob Herring @ 2021-04-01 17:07 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl SoC serial number
> reserved-memory range.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
>  1 file changed, 53 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> 
> diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> new file mode 100644
> index 000000000000..41b71f47ee6c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> @@ -0,0 +1,53 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl reserved-memory for SoC serial number
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Provide access to the memory region where the two parts of the Actions
> +  Semi Owl SoC serial number (low & high) can be read from. This information
> +  is provided by the bootloader, hence expose it under /reserved-memory node.
> +
> +  Please refer to reserved-memory.txt in this directory for common binding
> +  part and usage.
> +
> +  This is currently supported only on the S500 SoC variant.
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: actions,owl-soc-serial
> +      - items:
> +          - enum:
> +              - actions,s500-soc-serial
> +          - const: actions,owl-soc-serial
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    reserved-memory {
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        ranges;
> +
> +        soc_serial: soc-serial@800 {
> +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> +            reg = <0x800 0x8>;

You end up wasting a whole page of memory for 8 bytes. It may be better 
to copy this to a DT property ('serial-number' is already a defined root 
property).

Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  2021-03-30 13:48   ` Cristian Ciocaltea
@ 2021-04-01 17:08     ` Rob Herring
  -1 siblings, 0 replies; 48+ messages in thread
From: Rob Herring @ 2021-04-01 17:08 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl socinfo driver.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> new file mode 100644
> index 000000000000..01e4a8b4f5ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl SoC info module
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Actions Semi Owl SoC info module provides access to various information
> +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +      - const: simple-bus
> +
> +required:
> +  - compatible
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    / {
> +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> +        model = "Roseapple Pi";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        soc {
> +            compatible = "actions,s500-soc", "simple-bus";

What's the actual h/w for this bus? Still looks like abuse of DT to 
create your virtual soc_info driver.

> +            #address-cells = <1>;
> +            #size-cells = <1>;
> +            ranges;
> +        };
> +    };
> +
> +...
> -- 
> 2.31.1
> 

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
@ 2021-04-01 17:08     ` Rob Herring
  0 siblings, 0 replies; 48+ messages in thread
From: Rob Herring @ 2021-04-01 17:08 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl socinfo driver.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> new file mode 100644
> index 000000000000..01e4a8b4f5ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl SoC info module
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Actions Semi Owl SoC info module provides access to various information
> +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> +
> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +      - const: simple-bus
> +
> +required:
> +  - compatible
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    / {
> +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> +        model = "Roseapple Pi";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        soc {
> +            compatible = "actions,s500-soc", "simple-bus";

What's the actual h/w for this bus? Still looks like abuse of DT to 
create your virtual soc_info driver.

> +            #address-cells = <1>;
> +            #size-cells = <1>;
> +            ranges;
> +        };
> +    };
> +
> +...
> -- 
> 2.31.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
  2021-04-01 17:07     ` Rob Herring
@ 2021-04-01 17:40       ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 17:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl SoC serial number
> > reserved-memory range.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> >  1 file changed, 53 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > new file mode 100644
> > index 000000000000..41b71f47ee6c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > @@ -0,0 +1,53 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl reserved-memory for SoC serial number
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Provide access to the memory region where the two parts of the Actions
> > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > +
> > +  Please refer to reserved-memory.txt in this directory for common binding
> > +  part and usage.
> > +
> > +  This is currently supported only on the S500 SoC variant.
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - const: actions,owl-soc-serial
> > +      - items:
> > +          - enum:
> > +              - actions,s500-soc-serial
> > +          - const: actions,owl-soc-serial
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    reserved-memory {
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +        ranges;
> > +
> > +        soc_serial: soc-serial@800 {
> > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > +            reg = <0x800 0x8>;
> 
> You end up wasting a whole page of memory for 8 bytes. It may be better 
> to copy this to a DT property ('serial-number' is already a defined root 
> property).

Actually there is more information provided by the vendor bootloader
in this memory page, so we might use it once we are able to decode it.
For the moment I could only identify the serial number.

Thanks,
Cristi

> Rob

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
@ 2021-04-01 17:40       ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 17:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl SoC serial number
> > reserved-memory range.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> >  1 file changed, 53 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > new file mode 100644
> > index 000000000000..41b71f47ee6c
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > @@ -0,0 +1,53 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl reserved-memory for SoC serial number
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Provide access to the memory region where the two parts of the Actions
> > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > +
> > +  Please refer to reserved-memory.txt in this directory for common binding
> > +  part and usage.
> > +
> > +  This is currently supported only on the S500 SoC variant.
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - const: actions,owl-soc-serial
> > +      - items:
> > +          - enum:
> > +              - actions,s500-soc-serial
> > +          - const: actions,owl-soc-serial
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    reserved-memory {
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +        ranges;
> > +
> > +        soc_serial: soc-serial@800 {
> > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > +            reg = <0x800 0x8>;
> 
> You end up wasting a whole page of memory for 8 bytes. It may be better 
> to copy this to a DT property ('serial-number' is already a defined root 
> property).

Actually there is more information provided by the vendor bootloader
in this memory page, so we might use it once we are able to decode it.
For the moment I could only identify the serial number.

Thanks,
Cristi

> Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  2021-04-01 17:08     ` Rob Herring
@ 2021-04-01 17:57       ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 17:57 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:08:18PM -0500, Rob Herring wrote:
> On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl socinfo driver.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > new file mode 100644
> > index 000000000000..01e4a8b4f5ac
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > @@ -0,0 +1,57 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl SoC info module
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Actions Semi Owl SoC info module provides access to various information
> > +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +      - const: simple-bus
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    / {
> > +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> > +        model = "Roseapple Pi";
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +
> > +        soc {
> > +            compatible = "actions,s500-soc", "simple-bus";
> 
> What's the actual h/w for this bus? Still looks like abuse of DT to 
> create your virtual soc_info driver.

Right, there is no bus involved in accessing soc info, but I assumed
the already existing soc node in common DTS is a good candidate for
binding the driver. (e.g. arch/arm/boot/dts/owl-s500.dtsi)

Should I, instead, create a dedicated sub-node?

Thanks,
Cristi

> 
> > +            #address-cells = <1>;
> > +            #size-cells = <1>;
> > +            ranges;
> > +        };
> > +    };
> > +
> > +...
> > -- 
> > 2.31.1
> > 

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
@ 2021-04-01 17:57       ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-01 17:57 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andreas Färber, Manivannan Sadhasivam, devicetree,
	linux-arm-kernel, linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 12:08:18PM -0500, Rob Herring wrote:
> On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl socinfo driver.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > new file mode 100644
> > index 000000000000..01e4a8b4f5ac
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > @@ -0,0 +1,57 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl SoC info module
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Actions Semi Owl SoC info module provides access to various information
> > +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +      - const: simple-bus
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    / {
> > +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> > +        model = "Roseapple Pi";
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +
> > +        soc {
> > +            compatible = "actions,s500-soc", "simple-bus";
> 
> What's the actual h/w for this bus? Still looks like abuse of DT to 
> create your virtual soc_info driver.

Right, there is no bus involved in accessing soc info, but I assumed
the already existing soc node in common DTS is a good candidate for
binding the driver. (e.g. arch/arm/boot/dts/owl-s500.dtsi)

Should I, instead, create a dedicated sub-node?

Thanks,
Cristi

> 
> > +            #address-cells = <1>;
> > +            #size-cells = <1>;
> > +            ranges;
> > +        };
> > +    };
> > +
> > +...
> > -- 
> > 2.31.1
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  2021-03-30 13:48   ` Cristian Ciocaltea
@ 2021-04-02 18:04     ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:04 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl socinfo driver.
> 

Devicetree binding shouldn't be added for a driver instead for an IP or hw.

> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> new file mode 100644
> index 000000000000..01e4a8b4f5ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl SoC info module
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Actions Semi Owl SoC info module provides access to various information
> +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> +

S700/S900 are not yet confirmed, so please avoid them.

> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +      - const: simple-bus
> +
> +required:
> +  - compatible
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    / {
> +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> +        model = "Roseapple Pi";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        soc {
> +            compatible = "actions,s500-soc", "simple-bus";

No. This shouldn't fall under /soc. I think you should added a separate
compatible for the reserved memory itself and add a corresponding socinfo
driver under drivers/soc.

This way it is obvious that the information is contained in a memory region and
a driver is used for parsing that.

Thanks,
Mani

> +            #address-cells = <1>;
> +            #size-cells = <1>;
> +            ranges;
> +        };
> +    };
> +
> +...
> -- 
> 2.31.1
> 

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
@ 2021-04-02 18:04     ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:04 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> Add devicetree binding for the Actions Semi Owl socinfo driver.
> 

Devicetree binding shouldn't be added for a driver instead for an IP or hw.

> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
>  1 file changed, 57 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> 
> diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> new file mode 100644
> index 000000000000..01e4a8b4f5ac
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Actions Semi Owl SoC info module
> +
> +maintainers:
> +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> +
> +description: |
> +  Actions Semi Owl SoC info module provides access to various information
> +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> +

S700/S900 are not yet confirmed, so please avoid them.

> +select:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    items:
> +      - enum:
> +          - actions,s500-soc
> +          - actions,s700-soc
> +          - actions,s900-soc
> +      - const: simple-bus
> +
> +required:
> +  - compatible
> +
> +additionalProperties: true
> +
> +examples:
> +  - |
> +    / {
> +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> +        model = "Roseapple Pi";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        soc {
> +            compatible = "actions,s500-soc", "simple-bus";

No. This shouldn't fall under /soc. I think you should added a separate
compatible for the reserved memory itself and add a corresponding socinfo
driver under drivers/soc.

This way it is obvious that the information is contained in a memory region and
a driver is used for parsing that.

Thanks,
Mani

> +            #address-cells = <1>;
> +            #size-cells = <1>;
> +            ranges;
> +        };
> +    };
> +
> +...
> -- 
> 2.31.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
  2021-04-01 17:40       ` Cristian Ciocaltea
@ 2021-04-02 18:06         ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:06 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 08:40:01PM +0300, Cristian Ciocaltea wrote:
> On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> > On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > > Add devicetree binding for the Actions Semi Owl SoC serial number
> > > reserved-memory range.
> > > 
> > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > ---
> > >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> > >  1 file changed, 53 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > new file mode 100644
> > > index 000000000000..41b71f47ee6c
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > @@ -0,0 +1,53 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Actions Semi Owl reserved-memory for SoC serial number
> > > +
> > > +maintainers:
> > > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > +
> > > +description: |
> > > +  Provide access to the memory region where the two parts of the Actions
> > > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > > +
> > > +  Please refer to reserved-memory.txt in this directory for common binding
> > > +  part and usage.
> > > +
> > > +  This is currently supported only on the S500 SoC variant.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - const: actions,owl-soc-serial
> > > +      - items:
> > > +          - enum:
> > > +              - actions,s500-soc-serial
> > > +          - const: actions,owl-soc-serial
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +
> > > +additionalProperties: true
> > > +
> > > +examples:
> > > +  - |
> > > +    reserved-memory {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +        ranges;
> > > +
> > > +        soc_serial: soc-serial@800 {
> > > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > > +            reg = <0x800 0x8>;
> > 
> > You end up wasting a whole page of memory for 8 bytes. It may be better 
> > to copy this to a DT property ('serial-number' is already a defined root 
> > property).
> 
> Actually there is more information provided by the vendor bootloader

Then you should call it as socinfo or something not soc_serial.

Thanks,
Mani

> in this memory page, so we might use it once we are able to decode it.
> For the moment I could only identify the serial number.
> 
> Thanks,
> Cristi
> 
> > Rob

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
@ 2021-04-02 18:06         ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:06 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Thu, Apr 01, 2021 at 08:40:01PM +0300, Cristian Ciocaltea wrote:
> On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> > On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > > Add devicetree binding for the Actions Semi Owl SoC serial number
> > > reserved-memory range.
> > > 
> > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > ---
> > >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> > >  1 file changed, 53 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > new file mode 100644
> > > index 000000000000..41b71f47ee6c
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > @@ -0,0 +1,53 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Actions Semi Owl reserved-memory for SoC serial number
> > > +
> > > +maintainers:
> > > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > +
> > > +description: |
> > > +  Provide access to the memory region where the two parts of the Actions
> > > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > > +
> > > +  Please refer to reserved-memory.txt in this directory for common binding
> > > +  part and usage.
> > > +
> > > +  This is currently supported only on the S500 SoC variant.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - const: actions,owl-soc-serial
> > > +      - items:
> > > +          - enum:
> > > +              - actions,s500-soc-serial
> > > +          - const: actions,owl-soc-serial
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +
> > > +additionalProperties: true
> > > +
> > > +examples:
> > > +  - |
> > > +    reserved-memory {
> > > +        #address-cells = <1>;
> > > +        #size-cells = <1>;
> > > +        ranges;
> > > +
> > > +        soc_serial: soc-serial@800 {
> > > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > > +            reg = <0x800 0x8>;
> > 
> > You end up wasting a whole page of memory for 8 bytes. It may be better 
> > to copy this to a DT property ('serial-number' is already a defined root 
> > property).
> 
> Actually there is more information provided by the vendor bootloader

Then you should call it as socinfo or something not soc_serial.

Thanks,
Mani

> in this memory page, so we might use it once we are able to decode it.
> For the moment I could only identify the serial number.
> 
> Thanks,
> Cristi
> 
> > Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
  2021-03-30 13:48   ` Cristian Ciocaltea
@ 2021-04-02 18:16     ` Manivannan Sadhasivam
  -1 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:16 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote:
> The driver provides information about the Action Semi Owl family of
> SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
> soc_id, serial_number.
> 
> Note the serial number is currently provided only for the S500 SoC
> variant.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  drivers/soc/actions/Kconfig                   |   8 +
>  drivers/soc/actions/Makefile                  |   1 +
>  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
>  include/linux/soc/actions/owl-serial-number.h |  20 +++
>  4 files changed, 181 insertions(+)
>  create mode 100644 drivers/soc/actions/owl-socinfo.c
>  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> 
> diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
> index 1aca2058a40c..15faade9282d 100644
> --- a/drivers/soc/actions/Kconfig
> +++ b/drivers/soc/actions/Kconfig
> @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
>  	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
>  	  If unsure, say 'n'.
>  
> +config OWL_SOCINFO
> +	bool "Actions Semi Owl SoC info driver"
> +	default ARCH_ACTIONS
> +	select SOC_BUS
> +	help
> +	  Say 'y' here to support the Action Semiconductor Owl socinfo

Actions Semi

> +	  driver, providing information about the SoC to user space.
> +
>  endif
> diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
> index 4db9e7b050e5..4b2591d3089f 100644
> --- a/drivers/soc/actions/Makefile
> +++ b/drivers/soc/actions/Makefile
> @@ -2,3 +2,4 @@
>  
>  obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
>  obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
> +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
> diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
> new file mode 100644
> index 000000000000..f28eafac3792
> --- /dev/null
> +++ b/drivers/soc/actions/owl-socinfo.c
> @@ -0,0 +1,152 @@

[...]

> + * Access SoC's serial number stored by the bootloader in DDR memory.
> + */
> +static int owl_socinfo_read_serial_rmem(struct device *dev)
> +{
> +	struct reserved_mem *rmem;
> +	struct device_node *np;
> +	int ret = 0;
> +
> +	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
> +	if (!np)
> +		return -ENXIO;
> +
> +	rmem = of_reserved_mem_lookup(np);

If you do this correctly, you could use "pdev->dev.of_node" here instead of
using "of_find_compatible_node()" for getting np.

> +	if (!rmem) {
> +		dev_err(dev, "failed to acquire reserved memory region\n");
> +		ret = -EINVAL;
> +		goto out_put;
> +	}
> +

[...]

> +static const struct of_device_id owl_socinfo_of_match[] = {
> +	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
> +	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
> +	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },

Please don't add S700/S900 for now.

> +	{ }
> +};
> +
> +static struct platform_driver owl_socinfo_platform_driver = {
> +	.probe = owl_socinfo_probe,
> +	.driver = {
> +		.name = "owl-socinfo",
> +		.of_match_table = owl_socinfo_of_match,
> +	},
> +};
> +
> +static int __init owl_socinfo_init(void)
> +{
> +	return platform_driver_register(&owl_socinfo_platform_driver);
> +}
> +subsys_initcall(owl_socinfo_init);
> diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
> new file mode 100644
> index 000000000000..f8595417668f
> --- /dev/null
> +++ b/include/linux/soc/actions/owl-serial-number.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> + */
> +
> +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> +
> +#if IS_ENABLED(CONFIG_OWL_SOCINFO)
> +u32 owl_get_soc_serial_low(void);
> +u32 owl_get_soc_serial_high(void);

Where are these APIs used?

Thanks,
Mani

> +#else
> +static inline u32 owl_get_soc_serial_low(void)
> +{ return 0; }
> +
> +static inline u32 owl_get_soc_serial_high(void)
> +{ return 0; }
> +#endif /* CONFIG_OWL_SOCINFO */
> +
> +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
> -- 
> 2.31.1
> 

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

* Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
@ 2021-04-02 18:16     ` Manivannan Sadhasivam
  0 siblings, 0 replies; 48+ messages in thread
From: Manivannan Sadhasivam @ 2021-04-02 18:16 UTC (permalink / raw)
  To: Cristian Ciocaltea
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote:
> The driver provides information about the Action Semi Owl family of
> SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
> soc_id, serial_number.
> 
> Note the serial number is currently provided only for the S500 SoC
> variant.
> 
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> ---
>  drivers/soc/actions/Kconfig                   |   8 +
>  drivers/soc/actions/Makefile                  |   1 +
>  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
>  include/linux/soc/actions/owl-serial-number.h |  20 +++
>  4 files changed, 181 insertions(+)
>  create mode 100644 drivers/soc/actions/owl-socinfo.c
>  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> 
> diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
> index 1aca2058a40c..15faade9282d 100644
> --- a/drivers/soc/actions/Kconfig
> +++ b/drivers/soc/actions/Kconfig
> @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
>  	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
>  	  If unsure, say 'n'.
>  
> +config OWL_SOCINFO
> +	bool "Actions Semi Owl SoC info driver"
> +	default ARCH_ACTIONS
> +	select SOC_BUS
> +	help
> +	  Say 'y' here to support the Action Semiconductor Owl socinfo

Actions Semi

> +	  driver, providing information about the SoC to user space.
> +
>  endif
> diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
> index 4db9e7b050e5..4b2591d3089f 100644
> --- a/drivers/soc/actions/Makefile
> +++ b/drivers/soc/actions/Makefile
> @@ -2,3 +2,4 @@
>  
>  obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
>  obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
> +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
> diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
> new file mode 100644
> index 000000000000..f28eafac3792
> --- /dev/null
> +++ b/drivers/soc/actions/owl-socinfo.c
> @@ -0,0 +1,152 @@

[...]

> + * Access SoC's serial number stored by the bootloader in DDR memory.
> + */
> +static int owl_socinfo_read_serial_rmem(struct device *dev)
> +{
> +	struct reserved_mem *rmem;
> +	struct device_node *np;
> +	int ret = 0;
> +
> +	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
> +	if (!np)
> +		return -ENXIO;
> +
> +	rmem = of_reserved_mem_lookup(np);

If you do this correctly, you could use "pdev->dev.of_node" here instead of
using "of_find_compatible_node()" for getting np.

> +	if (!rmem) {
> +		dev_err(dev, "failed to acquire reserved memory region\n");
> +		ret = -EINVAL;
> +		goto out_put;
> +	}
> +

[...]

> +static const struct of_device_id owl_socinfo_of_match[] = {
> +	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
> +	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
> +	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },

Please don't add S700/S900 for now.

> +	{ }
> +};
> +
> +static struct platform_driver owl_socinfo_platform_driver = {
> +	.probe = owl_socinfo_probe,
> +	.driver = {
> +		.name = "owl-socinfo",
> +		.of_match_table = owl_socinfo_of_match,
> +	},
> +};
> +
> +static int __init owl_socinfo_init(void)
> +{
> +	return platform_driver_register(&owl_socinfo_platform_driver);
> +}
> +subsys_initcall(owl_socinfo_init);
> diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
> new file mode 100644
> index 000000000000..f8595417668f
> --- /dev/null
> +++ b/include/linux/soc/actions/owl-serial-number.h
> @@ -0,0 +1,20 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> + */
> +
> +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> +
> +#if IS_ENABLED(CONFIG_OWL_SOCINFO)
> +u32 owl_get_soc_serial_low(void);
> +u32 owl_get_soc_serial_high(void);

Where are these APIs used?

Thanks,
Mani

> +#else
> +static inline u32 owl_get_soc_serial_low(void)
> +{ return 0; }
> +
> +static inline u32 owl_get_soc_serial_high(void)
> +{ return 0; }
> +#endif /* CONFIG_OWL_SOCINFO */
> +
> +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
> -- 
> 2.31.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
  2021-04-02 18:04     ` Manivannan Sadhasivam
@ 2021-04-02 19:25       ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:25 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:34:07PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl socinfo driver.
> > 
> 
> Devicetree binding shouldn't be added for a driver instead for an IP or hw.
> 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > new file mode 100644
> > index 000000000000..01e4a8b4f5ac
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > @@ -0,0 +1,57 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl SoC info module
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Actions Semi Owl SoC info module provides access to various information
> > +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> > +
> 
> S700/S900 are not yet confirmed, so please avoid them.
> 
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +      - const: simple-bus
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    / {
> > +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> > +        model = "Roseapple Pi";
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +
> > +        soc {
> > +            compatible = "actions,s500-soc", "simple-bus";
> 
> No. This shouldn't fall under /soc. I think you should added a separate
> compatible for the reserved memory itself and add a corresponding socinfo
> driver under drivers/soc.
> 
> This way it is obvious that the information is contained in a memory region and
> a driver is used for parsing that.

I avoided on purpose to bind the driver on the reserved memory node
in order to be able to handle also the S700 and S900 SoCs, for which
we currently provide (only) the following information: machine, family,
soc_id.

I assumed the serial_number is not mandatory and we can use the driver
as it is for all SoC variants. I don't know how the serial number for
S700 and S900 could be read, but I think it is very likely they require
a different access method.

Hence my intention was to keep the driver generic, not coupled strictly
with the serial number information.

Regards,
Cristi

> Thanks,
> Mani
> 
> > +            #address-cells = <1>;
> > +            #size-cells = <1>;
> > +            ranges;
> > +        };
> > +    };
> > +
> > +...
> > -- 
> > 2.31.1
> > 

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

* Re: [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding
@ 2021-04-02 19:25       ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:25 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:34:07PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:17PM +0300, Cristian Ciocaltea wrote:
> > Add devicetree binding for the Actions Semi Owl socinfo driver.
> > 
> 
> Devicetree binding shouldn't be added for a driver instead for an IP or hw.
> 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  .../bindings/soc/actions/owl-socinfo.yaml     | 57 +++++++++++++++++++
> >  1 file changed, 57 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > new file mode 100644
> > index 000000000000..01e4a8b4f5ac
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/soc/actions/owl-socinfo.yaml
> > @@ -0,0 +1,57 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/soc/actions/owl-socinfo.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Actions Semi Owl SoC info module
> > +
> > +maintainers:
> > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > +
> > +description: |
> > +  Actions Semi Owl SoC info module provides access to various information
> > +  about the S500, S700 and S900 SoC variants, such as serial number or id.
> > +
> 
> S700/S900 are not yet confirmed, so please avoid them.
> 
> > +select:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    items:
> > +      - enum:
> > +          - actions,s500-soc
> > +          - actions,s700-soc
> > +          - actions,s900-soc
> > +      - const: simple-bus
> > +
> > +required:
> > +  - compatible
> > +
> > +additionalProperties: true
> > +
> > +examples:
> > +  - |
> > +    / {
> > +        compatible = "roseapplepi,roseapplepi", "actions,s500";
> > +        model = "Roseapple Pi";
> > +        #address-cells = <1>;
> > +        #size-cells = <1>;
> > +
> > +        soc {
> > +            compatible = "actions,s500-soc", "simple-bus";
> 
> No. This shouldn't fall under /soc. I think you should added a separate
> compatible for the reserved memory itself and add a corresponding socinfo
> driver under drivers/soc.
> 
> This way it is obvious that the information is contained in a memory region and
> a driver is used for parsing that.

I avoided on purpose to bind the driver on the reserved memory node
in order to be able to handle also the S700 and S900 SoCs, for which
we currently provide (only) the following information: machine, family,
soc_id.

I assumed the serial_number is not mandatory and we can use the driver
as it is for all SoC variants. I don't know how the serial number for
S700 and S900 could be read, but I think it is very likely they require
a different access method.

Hence my intention was to keep the driver generic, not coupled strictly
with the serial number information.

Regards,
Cristi

> Thanks,
> Mani
> 
> > +            #address-cells = <1>;
> > +            #size-cells = <1>;
> > +            ranges;
> > +        };
> > +    };
> > +
> > +...
> > -- 
> > 2.31.1
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
  2021-04-02 18:16     ` Manivannan Sadhasivam
@ 2021-04-02 19:36       ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:36 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:46:24PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote:
> > The driver provides information about the Action Semi Owl family of
> > SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
> > soc_id, serial_number.
> > 
> > Note the serial number is currently provided only for the S500 SoC
> > variant.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  drivers/soc/actions/Kconfig                   |   8 +
> >  drivers/soc/actions/Makefile                  |   1 +
> >  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
> >  include/linux/soc/actions/owl-serial-number.h |  20 +++
> >  4 files changed, 181 insertions(+)
> >  create mode 100644 drivers/soc/actions/owl-socinfo.c
> >  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> > 
> > diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
> > index 1aca2058a40c..15faade9282d 100644
> > --- a/drivers/soc/actions/Kconfig
> > +++ b/drivers/soc/actions/Kconfig
> > @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
> >  	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
> >  	  If unsure, say 'n'.
> >  
> > +config OWL_SOCINFO
> > +	bool "Actions Semi Owl SoC info driver"
> > +	default ARCH_ACTIONS
> > +	select SOC_BUS
> > +	help
> > +	  Say 'y' here to support the Action Semiconductor Owl socinfo
> 
> Actions Semi
> 
> > +	  driver, providing information about the SoC to user space.
> > +
> >  endif
> > diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
> > index 4db9e7b050e5..4b2591d3089f 100644
> > --- a/drivers/soc/actions/Makefile
> > +++ b/drivers/soc/actions/Makefile
> > @@ -2,3 +2,4 @@
> >  
> >  obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
> >  obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
> > +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
> > diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
> > new file mode 100644
> > index 000000000000..f28eafac3792
> > --- /dev/null
> > +++ b/drivers/soc/actions/owl-socinfo.c
> > @@ -0,0 +1,152 @@
> 
> [...]
> 
> > + * Access SoC's serial number stored by the bootloader in DDR memory.
> > + */
> > +static int owl_socinfo_read_serial_rmem(struct device *dev)
> > +{
> > +	struct reserved_mem *rmem;
> > +	struct device_node *np;
> > +	int ret = 0;
> > +
> > +	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
> > +	if (!np)
> > +		return -ENXIO;
> > +
> > +	rmem = of_reserved_mem_lookup(np);
> 
> If you do this correctly, you could use "pdev->dev.of_node" here instead of
> using "of_find_compatible_node()" for getting np.

Right, as previously explained, my intention was to avoid binding the
driver on the serial number node in order to keep it generic enough.

> > +	if (!rmem) {
> > +		dev_err(dev, "failed to acquire reserved memory region\n");
> > +		ret = -EINVAL;
> > +		goto out_put;
> > +	}
> > +
> 
> [...]
> 
> > +static const struct of_device_id owl_socinfo_of_match[] = {
> > +	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
> > +	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
> > +	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },
> 
> Please don't add S700/S900 for now.

I assumed we can use the driver for S700/S900, even though the serial
number is not provided for them.

> > +	{ }
> > +};
> > +
> > +static struct platform_driver owl_socinfo_platform_driver = {
> > +	.probe = owl_socinfo_probe,
> > +	.driver = {
> > +		.name = "owl-socinfo",
> > +		.of_match_table = owl_socinfo_of_match,
> > +	},
> > +};
> > +
> > +static int __init owl_socinfo_init(void)
> > +{
> > +	return platform_driver_register(&owl_socinfo_platform_driver);
> > +}
> > +subsys_initcall(owl_socinfo_init);
> > diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
> > new file mode 100644
> > index 000000000000..f8595417668f
> > --- /dev/null
> > +++ b/include/linux/soc/actions/owl-serial-number.h
> > @@ -0,0 +1,20 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
> > +/*
> > + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > + */
> > +
> > +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> > +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> > +
> > +#if IS_ENABLED(CONFIG_OWL_SOCINFO)
> > +u32 owl_get_soc_serial_low(void);
> > +u32 owl_get_soc_serial_high(void);
> 
> Where are these APIs used?

This will be used by the Ethernet MAC driver to generate a stable
address. Initially I used the global 'system_serial_{low,high}'
variables to pass this information outside the driver, but that is
not portable, i.e. only supported on ARM32, not ARM64.

Thanks for the review,
Cristi

> Thanks,
> Mani
> 
> > +#else
> > +static inline u32 owl_get_soc_serial_low(void)
> > +{ return 0; }
> > +
> > +static inline u32 owl_get_soc_serial_high(void)
> > +{ return 0; }
> > +#endif /* CONFIG_OWL_SOCINFO */
> > +
> > +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
> > -- 
> > 2.31.1
> > 

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

* Re: [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver
@ 2021-04-02 19:36       ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:36 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:46:24PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Mar 30, 2021 at 04:48:18PM +0300, Cristian Ciocaltea wrote:
> > The driver provides information about the Action Semi Owl family of
> > SoCs (S500, S700 and S900) to user space via sysfs: machine, family,
> > soc_id, serial_number.
> > 
> > Note the serial number is currently provided only for the S500 SoC
> > variant.
> > 
> > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > ---
> >  drivers/soc/actions/Kconfig                   |   8 +
> >  drivers/soc/actions/Makefile                  |   1 +
> >  drivers/soc/actions/owl-socinfo.c             | 152 ++++++++++++++++++
> >  include/linux/soc/actions/owl-serial-number.h |  20 +++
> >  4 files changed, 181 insertions(+)
> >  create mode 100644 drivers/soc/actions/owl-socinfo.c
> >  create mode 100644 include/linux/soc/actions/owl-serial-number.h
> > 
> > diff --git a/drivers/soc/actions/Kconfig b/drivers/soc/actions/Kconfig
> > index 1aca2058a40c..15faade9282d 100644
> > --- a/drivers/soc/actions/Kconfig
> > +++ b/drivers/soc/actions/Kconfig
> > @@ -14,4 +14,12 @@ config OWL_PM_DOMAINS
> >  	  power-gating on Actions Semiconductor S500, S700 and S900 SoCs.
> >  	  If unsure, say 'n'.
> >  
> > +config OWL_SOCINFO
> > +	bool "Actions Semi Owl SoC info driver"
> > +	default ARCH_ACTIONS
> > +	select SOC_BUS
> > +	help
> > +	  Say 'y' here to support the Action Semiconductor Owl socinfo
> 
> Actions Semi
> 
> > +	  driver, providing information about the SoC to user space.
> > +
> >  endif
> > diff --git a/drivers/soc/actions/Makefile b/drivers/soc/actions/Makefile
> > index 4db9e7b050e5..4b2591d3089f 100644
> > --- a/drivers/soc/actions/Makefile
> > +++ b/drivers/soc/actions/Makefile
> > @@ -2,3 +2,4 @@
> >  
> >  obj-$(CONFIG_OWL_PM_DOMAINS_HELPER) += owl-sps-helper.o
> >  obj-$(CONFIG_OWL_PM_DOMAINS) += owl-sps.o
> > +obj-$(CONFIG_OWL_SOCINFO) += owl-socinfo.o
> > diff --git a/drivers/soc/actions/owl-socinfo.c b/drivers/soc/actions/owl-socinfo.c
> > new file mode 100644
> > index 000000000000..f28eafac3792
> > --- /dev/null
> > +++ b/drivers/soc/actions/owl-socinfo.c
> > @@ -0,0 +1,152 @@
> 
> [...]
> 
> > + * Access SoC's serial number stored by the bootloader in DDR memory.
> > + */
> > +static int owl_socinfo_read_serial_rmem(struct device *dev)
> > +{
> > +	struct reserved_mem *rmem;
> > +	struct device_node *np;
> > +	int ret = 0;
> > +
> > +	np = of_find_compatible_node(NULL, NULL, "actions,owl-soc-serial");
> > +	if (!np)
> > +		return -ENXIO;
> > +
> > +	rmem = of_reserved_mem_lookup(np);
> 
> If you do this correctly, you could use "pdev->dev.of_node" here instead of
> using "of_find_compatible_node()" for getting np.

Right, as previously explained, my intention was to avoid binding the
driver on the serial number node in order to keep it generic enough.

> > +	if (!rmem) {
> > +		dev_err(dev, "failed to acquire reserved memory region\n");
> > +		ret = -EINVAL;
> > +		goto out_put;
> > +	}
> > +
> 
> [...]
> 
> > +static const struct of_device_id owl_socinfo_of_match[] = {
> > +	{ .compatible = "actions,s500-soc", .data = &s500_soc_info, },
> > +	{ .compatible = "actions,s700-soc", .data = &s700_soc_info, },
> > +	{ .compatible = "actions,s900-soc", .data = &s900_soc_info, },
> 
> Please don't add S700/S900 for now.

I assumed we can use the driver for S700/S900, even though the serial
number is not provided for them.

> > +	{ }
> > +};
> > +
> > +static struct platform_driver owl_socinfo_platform_driver = {
> > +	.probe = owl_socinfo_probe,
> > +	.driver = {
> > +		.name = "owl-socinfo",
> > +		.of_match_table = owl_socinfo_of_match,
> > +	},
> > +};
> > +
> > +static int __init owl_socinfo_init(void)
> > +{
> > +	return platform_driver_register(&owl_socinfo_platform_driver);
> > +}
> > +subsys_initcall(owl_socinfo_init);
> > diff --git a/include/linux/soc/actions/owl-serial-number.h b/include/linux/soc/actions/owl-serial-number.h
> > new file mode 100644
> > index 000000000000..f8595417668f
> > --- /dev/null
> > +++ b/include/linux/soc/actions/owl-serial-number.h
> > @@ -0,0 +1,20 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
> > +/*
> > + * Copyright (c) 2021 Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > + */
> > +
> > +#ifndef __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> > +#define __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__
> > +
> > +#if IS_ENABLED(CONFIG_OWL_SOCINFO)
> > +u32 owl_get_soc_serial_low(void);
> > +u32 owl_get_soc_serial_high(void);
> 
> Where are these APIs used?

This will be used by the Ethernet MAC driver to generate a stable
address. Initially I used the global 'system_serial_{low,high}'
variables to pass this information outside the driver, but that is
not portable, i.e. only supported on ARM32, not ARM64.

Thanks for the review,
Cristi

> Thanks,
> Mani
> 
> > +#else
> > +static inline u32 owl_get_soc_serial_low(void)
> > +{ return 0; }
> > +
> > +static inline u32 owl_get_soc_serial_high(void)
> > +{ return 0; }
> > +#endif /* CONFIG_OWL_SOCINFO */
> > +
> > +#endif /* __SOC_ACTIONS_OWL_SERIAL_NUMBER_H__ */
> > -- 
> > 2.31.1
> > 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
  2021-04-02 18:06         ` Manivannan Sadhasivam
@ 2021-04-02 19:44           ` Cristian Ciocaltea
  -1 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:44 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:36:07PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Apr 01, 2021 at 08:40:01PM +0300, Cristian Ciocaltea wrote:
> > On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> > > On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > > > Add devicetree binding for the Actions Semi Owl SoC serial number
> > > > reserved-memory range.
> > > > 
> > > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > > ---
> > > >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> > > >  1 file changed, 53 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > new file mode 100644
> > > > index 000000000000..41b71f47ee6c
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > @@ -0,0 +1,53 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Actions Semi Owl reserved-memory for SoC serial number
> > > > +
> > > > +maintainers:
> > > > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > > +
> > > > +description: |
> > > > +  Provide access to the memory region where the two parts of the Actions
> > > > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > > > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > > > +
> > > > +  Please refer to reserved-memory.txt in this directory for common binding
> > > > +  part and usage.
> > > > +
> > > > +  This is currently supported only on the S500 SoC variant.
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    oneOf:
> > > > +      - const: actions,owl-soc-serial
> > > > +      - items:
> > > > +          - enum:
> > > > +              - actions,s500-soc-serial
> > > > +          - const: actions,owl-soc-serial
> > > > +
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +required:
> > > > +  - compatible
> > > > +  - reg
> > > > +
> > > > +additionalProperties: true
> > > > +
> > > > +examples:
> > > > +  - |
> > > > +    reserved-memory {
> > > > +        #address-cells = <1>;
> > > > +        #size-cells = <1>;
> > > > +        ranges;
> > > > +
> > > > +        soc_serial: soc-serial@800 {
> > > > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > > > +            reg = <0x800 0x8>;
> > > 
> > > You end up wasting a whole page of memory for 8 bytes. It may be better 
> > > to copy this to a DT property ('serial-number' is already a defined root 
> > > property).
> > 
> > Actually there is more information provided by the vendor bootloader
> 
> Then you should call it as socinfo or something not soc_serial.

Agree, maybe 'bootinfo' or 'fwinfo', to suggest it is coming from
firmware / bootloader.

Thanks for reviewing,
Cristi

> Thanks,
> Mani
> 
> > in this memory page, so we might use it once we are able to decode it.
> > For the moment I could only identify the serial number.
> > 
> > Thanks,
> > Cristi
> > 
> > > Rob

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

* Re: [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding
@ 2021-04-02 19:44           ` Cristian Ciocaltea
  0 siblings, 0 replies; 48+ messages in thread
From: Cristian Ciocaltea @ 2021-04-02 19:44 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Rob Herring, Andreas Färber, devicetree, linux-arm-kernel,
	linux-actions, linux-kernel

On Fri, Apr 02, 2021 at 11:36:07PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Apr 01, 2021 at 08:40:01PM +0300, Cristian Ciocaltea wrote:
> > On Thu, Apr 01, 2021 at 12:07:04PM -0500, Rob Herring wrote:
> > > On Tue, Mar 30, 2021 at 04:48:16PM +0300, Cristian Ciocaltea wrote:
> > > > Add devicetree binding for the Actions Semi Owl SoC serial number
> > > > reserved-memory range.
> > > > 
> > > > Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > > ---
> > > >  .../actions,owl-soc-serial.yaml               | 53 +++++++++++++++++++
> > > >  1 file changed, 53 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > 
> > > > diff --git a/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > new file mode 100644
> > > > index 000000000000..41b71f47ee6c
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/reserved-memory/actions,owl-soc-serial.yaml
> > > > @@ -0,0 +1,53 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/reserved-memory/actions,owl-soc-serial.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Actions Semi Owl reserved-memory for SoC serial number
> > > > +
> > > > +maintainers:
> > > > +  - Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
> > > > +
> > > > +description: |
> > > > +  Provide access to the memory region where the two parts of the Actions
> > > > +  Semi Owl SoC serial number (low & high) can be read from. This information
> > > > +  is provided by the bootloader, hence expose it under /reserved-memory node.
> > > > +
> > > > +  Please refer to reserved-memory.txt in this directory for common binding
> > > > +  part and usage.
> > > > +
> > > > +  This is currently supported only on the S500 SoC variant.
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    oneOf:
> > > > +      - const: actions,owl-soc-serial
> > > > +      - items:
> > > > +          - enum:
> > > > +              - actions,s500-soc-serial
> > > > +          - const: actions,owl-soc-serial
> > > > +
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +required:
> > > > +  - compatible
> > > > +  - reg
> > > > +
> > > > +additionalProperties: true
> > > > +
> > > > +examples:
> > > > +  - |
> > > > +    reserved-memory {
> > > > +        #address-cells = <1>;
> > > > +        #size-cells = <1>;
> > > > +        ranges;
> > > > +
> > > > +        soc_serial: soc-serial@800 {
> > > > +            compatible = "actions,s500-soc-serial", "actions,owl-soc-serial";
> > > > +            reg = <0x800 0x8>;
> > > 
> > > You end up wasting a whole page of memory for 8 bytes. It may be better 
> > > to copy this to a DT property ('serial-number' is already a defined root 
> > > property).
> > 
> > Actually there is more information provided by the vendor bootloader
> 
> Then you should call it as socinfo or something not soc_serial.

Agree, maybe 'bootinfo' or 'fwinfo', to suggest it is coming from
firmware / bootloader.

Thanks for reviewing,
Cristi

> Thanks,
> Mani
> 
> > in this memory page, so we might use it once we are able to decode it.
> > For the moment I could only identify the serial number.
> > 
> > Thanks,
> > Cristi
> > 
> > > Rob

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-04-02 19:45 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 13:48 [PATCH v2 0/6] Add support for Actions Semi Owl socinfo Cristian Ciocaltea
2021-03-30 13:48 ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 1/6] dt-bindings: reserved-memory: Add Owl SoC serial number binding Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-04-01 17:07   ` Rob Herring
2021-04-01 17:07     ` Rob Herring
2021-04-01 17:40     ` Cristian Ciocaltea
2021-04-01 17:40       ` Cristian Ciocaltea
2021-04-02 18:06       ` Manivannan Sadhasivam
2021-04-02 18:06         ` Manivannan Sadhasivam
2021-04-02 19:44         ` Cristian Ciocaltea
2021-04-02 19:44           ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 2/6] dt-bindings: soc: actions: Add Actions Semi Owl socinfo binding Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-04-01 17:08   ` Rob Herring
2021-04-01 17:08     ` Rob Herring
2021-04-01 17:57     ` Cristian Ciocaltea
2021-04-01 17:57       ` Cristian Ciocaltea
2021-04-02 18:04   ` Manivannan Sadhasivam
2021-04-02 18:04     ` Manivannan Sadhasivam
2021-04-02 19:25     ` Cristian Ciocaltea
2021-04-02 19:25       ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 3/6] soc: actions: Add Actions Semi Owl socinfo driver Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-04-02 18:16   ` Manivannan Sadhasivam
2021-04-02 18:16     ` Manivannan Sadhasivam
2021-04-02 19:36     ` Cristian Ciocaltea
2021-04-02 19:36       ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 4/6] arm: dts: owl-s500: Add reserved-memory range for Owl SoC serial number Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 5/6] arm: dts: owl-s500: Add socinfo support Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-03-30 13:48 ` [PATCH v2 6/6] MAINTAINERS: Add entries for Owl reserved-memory and socinfo bindings Cristian Ciocaltea
2021-03-30 13:48   ` Cristian Ciocaltea
2021-04-01  5:24 ` [PATCH v2 0/6] Add support for Actions Semi Owl socinfo Manivannan Sadhasivam
2021-04-01  5:24   ` Manivannan Sadhasivam
2021-04-01  9:40   ` Cristian Ciocaltea
2021-04-01  9:40     ` Cristian Ciocaltea
2021-04-01 10:27     ` Manivannan Sadhasivam
2021-04-01 10:27       ` Manivannan Sadhasivam
2021-04-01 10:49       ` Andreas Färber
2021-04-01 10:49         ` Andreas Färber
2021-04-01 10:58         ` Cristian Ciocaltea
2021-04-01 10:58           ` Cristian Ciocaltea
2021-04-01 11:07           ` Manivannan Sadhasivam
2021-04-01 11:07             ` Manivannan Sadhasivam
2021-04-01 13:19             ` Cristian Ciocaltea
2021-04-01 13:19               ` Cristian Ciocaltea

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.