Skip to contentSkip to conversation

ARM: Add GXP SROM Support

PATCH In review [email protected] 4 participants 24 messages Jan 10, 2023 – Feb 2, 2023

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

cover ARM: Add GXP SROM Support

From: Clay Chang <[email protected]>

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

Clay Chang (5):
soc: hpe: Add GXP SROM Control Register Driver
dt-bindings: soc: hpe: hpe,gxp-srom.yaml
ARM: dts: hpe: Add SROM Driver
ARM: multi_v7_defconfig: Add GXP SROM Driver
MAINTAINERS: Add maintainer of GXP SROM support

 .../bindings/soc/hpe/hpe,gxp-srom.yaml        |  36 +++++
 MAINTAINERS                                   |   8 +
 arch/arm/boot/dts/hpe-gxp.dtsi                |  41 ++---
 arch/arm/configs/multi_v7_defconfig           |   2 +
 drivers/soc/Kconfig                           |   1 +
 drivers/soc/Makefile                          |   1 +
 drivers/soc/hpe/Kconfig                       |  29 ++++
 drivers/soc/hpe/Makefile                      |   2 +
 drivers/soc/hpe/gxp-soclib.c                  |  17 +++
 drivers/soc/hpe/gxp-soclib.h                  |   9 ++
 drivers/soc/hpe/gxp-srom.c                    | 141 ++++++++++++++++++
 11 files changed, 269 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml
 create mode 100644 drivers/soc/hpe/Kconfig
 create mode 100644 drivers/soc/hpe/Makefile
 create mode 100644 drivers/soc/hpe/gxp-soclib.c
 create mode 100644 drivers/soc/hpe/gxp-soclib.h
 create mode 100644 drivers/soc/hpe/gxp-srom.c
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/5 soc: hpe: Add GXP SROM Control Register Driver

From: Clay Chang <[email protected]>

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

The GXP SOCLIB is a common library used for creating the common "soc" class in the kernel.

---
 drivers/soc/Kconfig          |   1 +
 drivers/soc/Makefile         |   1 +
 drivers/soc/hpe/Kconfig      |  29 +++++++
 drivers/soc/hpe/Makefile     |   2 +
 drivers/soc/hpe/gxp-soclib.c |  17 +++++
 drivers/soc/hpe/gxp-soclib.h |   9 +++
 drivers/soc/hpe/gxp-srom.c   | 141 +++++++++++++++++++++++++++++++++++
 7 files changed, 200 insertions(+)
 create mode 100644 drivers/soc/hpe/Kconfig
 create mode 100644 drivers/soc/hpe/Makefile
 create mode 100644 drivers/soc/hpe/gxp-soclib.c
 create mode 100644 drivers/soc/hpe/gxp-soclib.h
 create mode 100644 drivers/soc/hpe/gxp-srom.c
drivers/soc/Kconfig +1 -0
index 5dbb09f843f7..faff0f036b61 100644
@@ -10,6 +10,7 @@ source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/canaan/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/fujitsu/Kconfig"
+source "drivers/soc/hpe/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/litex/Kconfig"
drivers/soc/Makefile +1 -0
index fff513bd522d..d257b9d654b3 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-y				+= fujitsu/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
+obj-$(CONFIG_ARCH_HPE)		+= hpe/
 obj-y				+= imx/
 obj-y				+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
drivers/soc/hpe/Kconfig new file +29 -0
new file mode 100644
index 000000000000..88f5d46b06b6
@@ -0,0 +1,29 @@
+#
+# HPE GXP SoC drivers
+#
+menu "HPE GXP SoC drivers"
+	depends on ARCH_HPE || COMPILE_TEST
+
+config HPE_GXP_SOCLIB
+	bool "GXP Common SoC Library"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
+	help
+	  This is for the common library for all HPE SoC drivers. It
+	  creates the root soc class (/sys/class/soc) for all GXP SoC
+	  drivers. It must be yes if any one of the GXP SoC drivers were
+	  added, so the config of all GXP SoC drivers must select this.
+
+
+config HPE_GXP_SROM
+	bool "GXP SROM Configuration Driver"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
+	select HPE_GXP_SOCLIB
+	help
+	  Say yes here to add support for SROM Configuration. The GXP SROM
+	  control register can be used to configure LPC related legacy I/O
+	  registers. Currently only the SROM RAM Offset Register (vromoff)
+	  is exported.
+
+endmenu
drivers/soc/hpe/Makefile new file +2 -0
new file mode 100644
index 000000000000..78de24ecb606
@@ -0,0 +1,2 @@
+obj-$(CONFIG_HPE_GXP_SOCLIB) += gxp-soclib.o
+obj-$(CONFIG_HPE_GXP_SROM) += gxp-srom.o
drivers/soc/hpe/gxp-soclib.c new file +17 -0
new file mode 100644
index 000000000000..11b0afe09070
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (C) 2023 Hewlett Packard Enteprise Development Company, L.P. */
+
+#include <linux/device.h>
+#include <linux/module.h>
+
+struct class *soc_class;
+
+static int __init gxp_soclib_init(void)
+{
+	soc_class = class_create(THIS_MODULE, "soc");
+	if (IS_ERR(soc_class))
+		return PTR_ERR(soc_class);
+	return 0;
+}
+
+module_init(gxp_soclib_init);
drivers/soc/hpe/gxp-soclib.h new file +9 -0
new file mode 100644
index 000000000000..eb0e72b67aee
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright (C) 2023 Hewlett Packard Enterprise Development Company, L.P. */
+
+#ifndef __GXP_SOCLIB_H__
+#define __GXP_SOCLIB_H__
+
+extern struct class *soc_class;
+
+#endif
drivers/soc/hpe/gxp-srom.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 1/5] soc: hpe: Add GXP SROM Control Register Driver

Quoted 60 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

The GXP SOCLIB is a common library used for creating the common "soc" class in the kernel.

---
 drivers/soc/Kconfig          |   1 +
 drivers/soc/Makefile         |   1 +
 drivers/soc/hpe/Kconfig      |  29 +++++++
 drivers/soc/hpe/Makefile     |   2 +
 drivers/soc/hpe/gxp-soclib.c |  17 +++++
 drivers/soc/hpe/gxp-soclib.h |   9 +++
 drivers/soc/hpe/gxp-srom.c   | 141 +++++++++++++++++++++++++++++++++++
 7 files changed, 200 insertions(+)
 create mode 100644 drivers/soc/hpe/Kconfig
 create mode 100644 drivers/soc/hpe/Makefile
 create mode 100644 drivers/soc/hpe/gxp-soclib.c
 create mode 100644 drivers/soc/hpe/gxp-soclib.h
 create mode 100644 drivers/soc/hpe/gxp-srom.c
drivers/soc/Kconfig +1 -0
index 5dbb09f843f7..faff0f036b61 100644
@@ -10,6 +10,7 @@ source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/canaan/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/fujitsu/Kconfig"
+source "drivers/soc/hpe/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/litex/Kconfig"
drivers/soc/Makefile +1 -0
index fff513bd522d..d257b9d654b3 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-y				+= fujitsu/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
+obj-$(CONFIG_ARCH_HPE)		+= hpe/
 obj-y				+= imx/
 obj-y				+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
drivers/soc/hpe/Kconfig new file +5 -0
new file mode 100644
index 000000000000..88f5d46b06b6
@@ -0,0 +1,29 @@
+#
+# HPE GXP SoC drivers
+#
+menu "HPE GXP SoC drivers"
+	depends on ARCH_HPE || COMPILE_TEST

drivers/soc/hpe/Kconfig line 15

Quoted 10 lines
drivers/soc/hpe/Kconfig new file +10 -0
+
+config HPE_GXP_SOCLIB
+	bool "GXP Common SoC Library"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
+	help
+	  This is for the common library for all HPE SoC drivers. It
+	  creates the root soc class (/sys/class/soc) for all GXP SoC
+	  drivers. It must be yes if any one of the GXP SoC drivers were
+	  added, so the config of all GXP SoC drivers must select this.

Don't open-code Kconfig dependencies in free-form text. IOW, drop last sentence.

Quoted 35 lines
drivers/soc/hpe/Kconfig new file +14 -0
+
+
+config HPE_GXP_SROM
+	bool "GXP SROM Configuration Driver"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
+	select HPE_GXP_SOCLIB
+	help
+	  Say yes here to add support for SROM Configuration. The GXP SROM
+	  control register can be used to configure LPC related legacy I/O
+	  registers. Currently only the SROM RAM Offset Register (vromoff)
+	  is exported.
+
+endmenu
drivers/soc/hpe/Makefile new file +2 -0
new file mode 100644
index 000000000000..78de24ecb606
@@ -0,0 +1,2 @@
+obj-$(CONFIG_HPE_GXP_SOCLIB) += gxp-soclib.o
+obj-$(CONFIG_HPE_GXP_SROM) += gxp-srom.o
drivers/soc/hpe/gxp-soclib.c new file +7 -0
new file mode 100644
index 000000000000..11b0afe09070
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (C) 2023 Hewlett Packard Enteprise Development Company, L.P. */
+
+#include <linux/device.h>
+#include <linux/module.h>
+
+struct class *soc_class;

drivers/soc/hpe/gxp-soclib.c line 17

Quoted 10 lines
drivers/soc/hpe/gxp-soclib.c new file +10 -0
+
+static int __init gxp_soclib_init(void)
+{
+	soc_class = class_create(THIS_MODULE, "soc");
+	if (IS_ERR(soc_class))
+		return PTR_ERR(soc_class);
+	return 0;
+}
+
+module_init(gxp_soclib_init);

I don't see a point of making it a shared object and a "kernel library". Module inits are not libraries. Drop entire file.

Quoted 19 lines
drivers/soc/hpe/gxp-soclib.h new file +11 -0
new file mode 100644
index 000000000000..eb0e72b67aee
@@ -0,0 +1,9 @@
 
 
+
+static int sysfs_register(struct device *parent,
+			  struct gxp_srom_drvdata *drvdata)
+{
+	struct device *dev;
+
+	dev = device_create_with_groups(soc_class, parent, 0,
+					drvdata, srom_groups, "srom");
+	if (IS_ERR(dev))
+		return PTR_ERR(dev);
+	drvdata->dev = dev;

drivers/soc/hpe/gxp-soclib.h

Quoted 10 lines
drivers/soc/hpe/gxp-soclib.h new file +10 -0
+	return 0;
+}
+
+static int gxp_srom_probe(struct platform_device *pdev)
+{
+	struct gxp_srom_drvdata *drvdata;
+	struct resource *res;
+	int ret;
+
+	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gxp_srom_drvdata),

sizeof(*)

Quoted 5 lines
drivers/soc/hpe/gxp-soclib.h new file +5 -0
+				GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
+
+	drvdata->pdev = pdev;

drivers/soc/hpe/gxp-soclib.h

Quoted 10 lines
drivers/soc/hpe/gxp-soclib.h new file +10 -0
+	platform_set_drvdata(pdev, drvdata);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
+		dev_err(&pdev->dev, "no srom resource defined\n");
+		ret = -ENODEV;
+		goto out;
+	}
+
+	drvdata->base = devm_ioremap_resource(&pdev->dev, res);

Combine these two. There is a helper for this.

drivers/soc/hpe/gxp-soclib.h

Quoted 3 lines
drivers/soc/hpe/gxp-soclib.h new file +3 -0
+	if (IS_ERR(drvdata->base)) {
+		dev_err(&pdev->dev, "ioremap_resource error\n");
+		ret = PTR_ERR(drvdata->base);

return dev_err_probe().

drivers/soc/hpe/gxp-soclib.h

Quoted 6 lines
drivers/soc/hpe/gxp-soclib.h new file +6 -0
+		goto ioremap_err;
+	}
+
+	mutex_init(&drvdata->mutex);
+
+	ret = sysfs_register(&pdev->dev, drvdata);

Missing ABI documentation.

drivers/soc/hpe/gxp-soclib.h

Quoted 2 lines
drivers/soc/hpe/gxp-soclib.h new file +2 -0
+	if (ret != 0) {
+		dev_err(&pdev->dev, "sysfs error\n");

return dev_err_probe

drivers/soc/hpe/gxp-soclib.h

Quoted 4 lines
drivers/soc/hpe/gxp-soclib.h new file +4 -0
+		goto sysfs_err;
+	}
+
+	dev_info(&pdev->dev, "initialized\n");

Drop silly probe successes.

drivers/soc/hpe/gxp-soclib.h

Quoted 8 lines
drivers/soc/hpe/gxp-soclib.h new file +8 -0
+	return 0;
+
+sysfs_err:
+ioremap_err:
+	platform_set_drvdata(pdev, NULL);
+out:
+	if (drvdata)
+		devm_kfree(&pdev->dev, (void *)drvdata);

1. Why? if it is here, it must be in remove() callback. If it is invalid (because it is really not correct) for remove(), it cannot be here, right?
2. Why cast?

Quoted 4 lines
drivers/soc/hpe/gxp-soclib.h new file +4 -0
+	return ret;
+}
+
+static const struct of_device_id gxp_srom_of_match[] = {

drivers/soc/hpe/gxp-soclib.h

Quoted 10 lines
drivers/soc/hpe/gxp-soclib.h new file +10 -0
+	{ .compatible = "hpe,gxp-srom" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, gxp_srom_of_match);
+
+static struct platform_driver gxp_srom_driver = {
+	.probe = gxp_srom_probe,
+	.driver = {
+		.name = "gxp-srom",
+		.of_match_table = of_match_ptr(gxp_srom_of_match),

That will cause a warning. Drop of_match_ptr.

drivers/soc/hpe/gxp-soclib.h

Quoted 7 lines
drivers/soc/hpe/gxp-soclib.h new file +7 -0
+	},
+};
+module_platform_driver(gxp_srom_driver);
+
+MODULE_AUTHOR("Clay Chang <[email protected]>");
+MODULE_DESCRIPTION("HPE GXP SROM Configuration Driver");
+MODULE_LICENSE("GPL");

Best regards,
Krzysztof

author
#3 lore raw

Re: [PATCH 1/5] soc: hpe: Add GXP SROM Control Register Driver

Hi Krzysztof,

Thank you for the time to review my code.

Quoted 66 lines · Krzysztof Kozlowski
Quoted 65 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

The GXP SOCLIB is a common library used for creating the common "soc" class in the kernel.

---
 drivers/soc/Kconfig          |   1 +
 drivers/soc/Makefile         |   1 +
 drivers/soc/hpe/Kconfig      |  29 +++++++
 drivers/soc/hpe/Makefile     |   2 +
 drivers/soc/hpe/gxp-soclib.c |  17 +++++
 drivers/soc/hpe/gxp-soclib.h |   9 +++
 drivers/soc/hpe/gxp-srom.c   | 141 +++++++++++++++++++++++++++++++++++
 7 files changed, 200 insertions(+)
 create mode 100644 drivers/soc/hpe/Kconfig
 create mode 100644 drivers/soc/hpe/Makefile
 create mode 100644 drivers/soc/hpe/gxp-soclib.c
 create mode 100644 drivers/soc/hpe/gxp-soclib.h
 create mode 100644 drivers/soc/hpe/gxp-srom.c
drivers/soc/Kconfig +1 -0
index 5dbb09f843f7..faff0f036b61 100644
@@ -10,6 +10,7 @@ source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/canaan/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/fujitsu/Kconfig"
+source "drivers/soc/hpe/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
 source "drivers/soc/litex/Kconfig"
drivers/soc/Makefile +1 -0
index fff513bd522d..d257b9d654b3 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_MACH_DOVE)		+= dove/
 obj-y				+= fsl/
 obj-y				+= fujitsu/
 obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
+obj-$(CONFIG_ARCH_HPE)		+= hpe/
 obj-y				+= imx/
 obj-y				+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
drivers/soc/hpe/Kconfig new file +10 -0
new file mode 100644
index 000000000000..88f5d46b06b6
@@ -0,0 +1,29 @@
+#
+# HPE GXP SoC drivers
+#
+menu "HPE GXP SoC drivers"
+	depends on ARCH_HPE || COMPILE_TEST
+
+config HPE_GXP_SOCLIB
+	bool "GXP Common SoC Library"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
Quoted 8 lines

drivers/soc/hpe/Kconfig line 15

Quoted 5 lines
drivers/soc/hpe/Kconfig new file +5 -0
+	help
+	  This is for the common library for all HPE SoC drivers. It
+	  creates the root soc class (/sys/class/soc) for all GXP SoC
+	  drivers. It must be yes if any one of the GXP SoC drivers were
+	  added, so the config of all GXP SoC drivers must select this.

Don't open-code Kconfig dependencies in free-form text. IOW, drop last sentence.

Understood, I will correct this part in the next revision.

Quoted 41 lines
Quoted 41 lines
drivers/soc/hpe/Kconfig new file +14 -0
+
+
+config HPE_GXP_SROM
+	bool "GXP SROM Configuration Driver"
+	default y
+	depends on ARCH_HPE_GXP || COMPILE_TEST
+	select HPE_GXP_SOCLIB
+	help
+	  Say yes here to add support for SROM Configuration. The GXP SROM
+	  control register can be used to configure LPC related legacy I/O
+	  registers. Currently only the SROM RAM Offset Register (vromoff)
+	  is exported.
+
+endmenu
drivers/soc/hpe/Makefile new file +2 -0
new file mode 100644
index 000000000000..78de24ecb606
@@ -0,0 +1,2 @@
+obj-$(CONFIG_HPE_GXP_SOCLIB) += gxp-soclib.o
+obj-$(CONFIG_HPE_GXP_SROM) += gxp-srom.o
drivers/soc/hpe/gxp-soclib.c new file +12 -0
new file mode 100644
index 000000000000..11b0afe09070
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/* Copyright (C) 2023 Hewlett Packard Enteprise Development Company, L.P. */
+
+#include <linux/device.h>
+#include <linux/module.h>
+
+struct class *soc_class;
+
+static int __init gxp_soclib_init(void)
+{
+	soc_class = class_create(THIS_MODULE, "soc");
+	if (IS_ERR(soc_class))
Quoted 8 lines

drivers/soc/hpe/gxp-soclib.c line 17

Quoted 5 lines
drivers/soc/hpe/gxp-soclib.c new file +5 -0
+		return PTR_ERR(soc_class);
+	return 0;
+}
+
+module_init(gxp_soclib_init);

I don't see a point of making it a shared object and a "kernel library". Module inits are not libraries. Drop entire file.

Sure, I will re-write this part in the next revision.

Quoted 24 lines
Quoted 24 lines
drivers/soc/hpe/gxp-soclib.h new file +15 -0
new file mode 100644
index 000000000000..eb0e72b67aee
@@ -0,0 +1,9 @@
 
 
+
+static int sysfs_register(struct device *parent,
+			  struct gxp_srom_drvdata *drvdata)
+{
+	struct device *dev;
+
+	dev = device_create_with_groups(soc_class, parent, 0,
+					drvdata, srom_groups, "srom");
+	if (IS_ERR(dev))
+		return PTR_ERR(dev);
+	drvdata->dev = dev;
+	return 0;
+}
+
+static int gxp_srom_probe(struct platform_device *pdev)
Quoted 8 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 6 lines
drivers/soc/hpe/gxp-soclib.h new file +6 -0
+{
+	struct gxp_srom_drvdata *drvdata;
+	struct resource *res;
+	int ret;
+
+	drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gxp_srom_drvdata),

sizeof(*)

Ok, I will correct this in the next.

Quoted 10 lines
Quoted 10 lines
drivers/soc/hpe/gxp-soclib.h new file +9 -0
+				GFP_KERNEL);
+	if (!drvdata)
+		return -ENOMEM;
+
+	drvdata->pdev = pdev;
+	platform_set_drvdata(pdev, drvdata);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res) {
Quoted 9 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 6 lines
drivers/soc/hpe/gxp-soclib.h new file +6 -0
+		dev_err(&pdev->dev, "no srom resource defined\n");
+		ret = -ENODEV;
+		goto out;
+	}
+
+	drvdata->base = devm_ioremap_resource(&pdev->dev, res);

Combine these two. There is a helper for this.

Sure, I will combine these two with devm_platform_ioremap_resource.

Quoted 5 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 3 lines
drivers/soc/hpe/gxp-soclib.h new file +3 -0
+	if (IS_ERR(drvdata->base)) {
+		dev_err(&pdev->dev, "ioremap_resource error\n");
+		ret = PTR_ERR(drvdata->base);

return dev_err_probe().

Quoted 8 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 6 lines
drivers/soc/hpe/gxp-soclib.h new file +6 -0
+		goto ioremap_err;
+	}
+
+	mutex_init(&drvdata->mutex);
+
+	ret = sysfs_register(&pdev->dev, drvdata);

Missing ABI documentation.

Ok, I will provide with the proper ABI documentation in the next revision.

Quoted 5 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 3 lines
drivers/soc/hpe/gxp-soclib.h new file +2 -0
+	if (ret != 0) {
+		dev_err(&pdev->dev, "sysfs error\n");

return dev_err_probe

Ok, will correct this in the next.

Quoted 7 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 5 lines
drivers/soc/hpe/gxp-soclib.h new file +4 -0
+		goto sysfs_err;
+	}
+
+	dev_info(&pdev->dev, "initialized\n");

Drop silly probe successes.

Sure, will drop this in the next revision.

Quoted 13 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 9 lines
drivers/soc/hpe/gxp-soclib.h new file +8 -0
+	return 0;
+
+sysfs_err:
+ioremap_err:
+	platform_set_drvdata(pdev, NULL);
+out:
+	if (drvdata)
+		devm_kfree(&pdev->dev, (void *)drvdata);

1. Why? if it is here, it must be in remove() callback. If it is invalid (because it is really not correct) for remove(), it cannot be here, right?
2. Why cast?

Ok, sorry for my mis-understanding about the error handling path in device probing. I will re-write this part in the next revision.

Quoted 17 lines
Quoted 5 lines
drivers/soc/hpe/gxp-soclib.h new file +4 -0
+	return ret;
+}
+
+static const struct of_device_id gxp_srom_of_match[] = {

drivers/soc/hpe/gxp-soclib.h

Quoted 10 lines
drivers/soc/hpe/gxp-soclib.h new file +10 -0
+	{ .compatible = "hpe,gxp-srom" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, gxp_srom_of_match);
+
+static struct platform_driver gxp_srom_driver = {
+	.probe = gxp_srom_probe,
+	.driver = {
+		.name = "gxp-srom",
+		.of_match_table = of_match_ptr(gxp_srom_of_match),

That will cause a warning. Drop of_match_ptr.

Got it!

Quoted 12 lines

drivers/soc/hpe/gxp-soclib.h

Quoted 8 lines
drivers/soc/hpe/gxp-soclib.h new file +7 -0
+	},
+};
+module_platform_driver(gxp_srom_driver);
+
+MODULE_AUTHOR("Clay Chang <[email protected]>");
+MODULE_DESCRIPTION("HPE GXP SROM Configuration Driver");
+MODULE_LICENSE("GPL");

Best regards,
Krzysztof

Thanks,
Clay

#4 lore raw

PATCH 2/5 dt-bindings: soc: hpe: hpe,gxp-srom.yaml

In reply to [email protected]

From: Clay Chang <[email protected]>

Document binding to support SROM driver in GXP.

---
 .../bindings/soc/hpe/hpe,gxp-srom.yaml        | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +36 -0
new file mode 100644
index 000000000000..14ad97d595c8
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/hpe/hpe,gxp-srom.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HPE GXP SoC SROM Control Register
+
+maintainers:
+  - Clay Chang <[email protected]>
+
+description: |+
+  The SROM control register can be used to configure LPC related legacy
+  I/O registers.
+
+properties:
+  compatible:
+    items:
+      - const: hpe,gxp-srom
+
+  reg:
+    items:
+      - description: SROM LPC Configuration Registers
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    srom: srom@80fc0000 {
+      compatible = "hpe,gxp-srom";
+      reg = <0x80fc0000 0x100>;
+    };
Signature · 1 line
2.17.1
#5 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml

Quoted 15 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Document binding to support SROM driver in GXP.

---
 .../bindings/soc/hpe/hpe,gxp-srom.yaml        | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +0 -0
new file mode 100644
index 000000000000..14ad97d595c8

Don't drop stuff to soc. Put it in respective directories. This also applies to your driver.

SROM controllers go to memory-controllers. What is this, I have no clue. "SROM Control Register" is not helping me.

Quoted 5 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/hpe/hpe,gxp-srom.yaml#

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HPE GXP SoC SROM Control Register
+
+maintainers:
+  - Clay Chang <[email protected]>
+
+description: |+
+  The SROM control register can be used to configure LPC related legacy
+  I/O registers.

And why this is a hardware? No, you now add fake devices to be able to write some stuff from user-space... Otherwise this needs proper hardware description.

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 18

Quoted 4 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
+
+properties:
+  compatible:
+    items:

Drop items, you have only one item.

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 23

Quoted 5 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +5 -0
+      - const: hpe,gxp-srom
+
+  reg:
+    items:
+      - description: SROM LPC Configuration Registers

Drop items and description. Just maxItems: 1

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 36

Quoted 13 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +13 -0
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    srom: srom@80fc0000 {
+      compatible = "hpe,gxp-srom";
+      reg = <0x80fc0000 0x100>;
+    };

Best regards,
Krzysztof

author
#6 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Quoted 34 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml

Quoted 15 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Document binding to support SROM driver in GXP.

---
 .../bindings/soc/hpe/hpe,gxp-srom.yaml        | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +0 -0
new file mode 100644
index 000000000000..14ad97d595c8

Don't drop stuff to soc. Put it in respective directories. This also applies to your driver.

SROM controllers go to memory-controllers. What is this, I have no clue. "SROM Control Register" is not helping me.

Quoted 11 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +10 -0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/hpe/hpe,gxp-srom.yaml# 
+$schema: http://devicetree.org/meta-schemas/core.yaml# 
+
+title: HPE GXP SoC SROM Control Register
+
+maintainers:
+  - Clay Chang <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 14

Quoted 4 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
+
+description: |+
+  The SROM control register can be used to configure LPC related legacy
+  I/O registers.

And why this is a hardware? No, you now add fake devices to be able to write some stuff from user-space... Otherwise this needs proper hardware description.

Thank you for commenting on this. You are right, this is not a real hardware device, but simply exposes MMIO regions to the user-space. Maybe we should rewrite this as a syscon driver. Is writing a syscon driver a right direction?

Quoted 16 lines

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 18

Quoted 5 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
+
+properties:
+  compatible:
+    items:

Drop items, you have only one item.

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 23

Quoted 5 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +5 -0
+      - const: hpe,gxp-srom
+
+  reg:
+    items:
+      - description: SROM LPC Configuration Registers

Drop items and description. Just maxItems: 1

Quoted 17 lines

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 36

Quoted 13 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +13 -0
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    srom: srom@80fc0000 {
+      compatible = "hpe,gxp-srom";
+      reg = <0x80fc0000 0x100>;
+    };

Best regards,
Krzysztof

Thanks,
Clay

#7 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Quoted 23 lines · Clay Chang
Quoted 13 lines · Krzysztof Kozlowski
Quoted 11 lines · On 10/01/2023 05:25, [email protected] wrote:
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +10 -0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/hpe/hpe,gxp-srom.yaml# 
+$schema: http://devicetree.org/meta-schemas/core.yaml# 
+
+title: HPE GXP SoC SROM Control Register
+
+maintainers:
+  - Clay Chang <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 14

Quoted 4 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
+
+description: |+
+  The SROM control register can be used to configure LPC related legacy
+  I/O registers.

And why this is a hardware? No, you now add fake devices to be able to write some stuff from user-space... Otherwise this needs proper hardware description.

Quoted 4 lines

Thank you for commenting on this. You are right, this is not a real hardware device, but simply exposes MMIO regions to the user-space. Maybe we should rewrite this as a syscon driver. Is writing a syscon driver a right direction?

There are two completely separate questions about the DT binding and about the user-visible interface.

The binding needs to properly identify what this device is. I don't think anyone without the datasheet can tell you the right answer here, it really depends what the other registers do. If there are lots of unrelated registers in a small area, a syscon might be the right answer, but if they are all related to an external memory bus, then categorizing it as a memory controller may be more appropriate.

For the user interface side, I don't really like the idea of having a hardware register directly exposed as driver in drivers/soc, this generally makes it impossible to have portable userspace that works across implementations of multiple SoC vendors, and it makes it too easy to come up with an ad-hoc interface to make a chip work for a particular use case when a more general solution would be better.

Again, it's hard for me to tell why this even needs to be runtime configurable, please try to describe what type of application would access the sysfs interface here, and why this can't just be set to a fixed value by bootloader or kernel without user interaction.

Arnd

author
#8 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Hi Arnd,

Thank you for taking time to answer my questions.

Quoted 32 lines · Arnd Bergmann
Quoted 23 lines · Clay Chang
Quoted 13 lines · Krzysztof Kozlowski
Quoted 11 lines · On 10/01/2023 05:25, [email protected] wrote:
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +10 -0
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/hpe/hpe,gxp-srom.yaml#  
+$schema: http://devicetree.org/meta-schemas/core.yaml#  
+
+title: HPE GXP SoC SROM Control Register
+
+maintainers:
+  - Clay Chang <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml line 14

Quoted 4 lines
Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml new file +4 -0
+
+description: |+
+  The SROM control register can be used to configure LPC related legacy
+  I/O registers.

And why this is a hardware? No, you now add fake devices to be able to write some stuff from user-space... Otherwise this needs proper hardware description.

Quoted 4 lines

Thank you for commenting on this. You are right, this is not a real hardware device, but simply exposes MMIO regions to the user-space. Maybe we should rewrite this as a syscon driver. Is writing a syscon driver a right direction?

There are two completely separate questions about the DT binding and about the user-visible interface.

Quoted 7 lines

The binding needs to properly identify what this device is. I don't think anyone without the datasheet can tell you the right answer here, it really depends what the other registers do. If there are lots of unrelated registers in a small area, a syscon might be the right answer, but if they are all related to an external memory bus, then categorizing it as a memory controller may be more appropriate.

Our use-cases are more like some register accesses not related to an external memory bus, so syscon might be a better fit.

Quoted 9 lines

For the user interface side, I don't really like the idea of having a hardware register directly exposed as driver in drivers/soc, this generally makes it impossible to have portable userspace that works across implementations of multiple SoC vendors, and it makes it too easy to come up with an ad-hoc interface to make a chip work for a particular use case when a more general solution would be better.

I agree with you. I have one question though: if we create a 'hpe' directory under drivers/soc, and put all HPE BMC specific drivers there, do you think this proper?

Quoted 5 lines

Again, it's hard for me to tell why this even needs to be runtime configurable, please try to describe what type of application would access the sysfs interface here, and why this can't just be set to a fixed value by bootloader or kernel without user interaction.

The register is used for communication and synchronization between the BMC and the host. During runtime, user-space daemons configures the value of the register for interactions.

Quoted 2 lines

Arnd

Thanks,
Clay

#9 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Quoted 11 lines · Clay Chang
Quoted 9 lines · Arnd Bergmann

On Thu, Jan 12, 2023, at 14:16, Clay Chang wrote:
For the user interface side, I don't really like the idea of having a hardware register directly exposed as driver in drivers/soc, this generally makes it impossible to have portable userspace that works across implementations of multiple SoC vendors, and it makes it too easy to come up with an ad-hoc interface to make a chip work for a particular use case when a more general solution would be better.

Quoted 3 lines

I agree with you. I have one question though: if we create a 'hpe' directory under drivers/soc, and put all HPE BMC specific drivers there, do you think this proper?

It certainly wouldn't be right to put "all HPE BMC specific drivers" in there. Most drivers will fit into some existing subsystem, and should be moved there instead. drivers/soc is used primarily for drivers using soc_device_register() to provide information about the soc, and we also use it as a place for drivers that just export soc-specific helper functions that can be used by other drivers.

Quoted 9 lines
Quoted 5 lines

Again, it's hard for me to tell why this even needs to be runtime configurable, please try to describe what type of application would access the sysfs interface here, and why this can't just be set to a fixed value by bootloader or kernel without user interaction.

The register is used for communication and synchronization between the BMC and the host. During runtime, user-space daemons configures the value of the register for interactions.

That does not sound very specific. What is the subsystem on the host that this communicates with? Can you put the driver into the same subsystem?

Arnd

author
#10 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Quoted 16 lines · Arnd Bergmann
Quoted 11 lines · Clay Chang
Quoted 9 lines · Arnd Bergmann

On Thu, Jan 12, 2023, at 14:16, Clay Chang wrote:
For the user interface side, I don't really like the idea of having a hardware register directly exposed as driver in drivers/soc, this generally makes it impossible to have portable userspace that works across implementations of multiple SoC vendors, and it makes it too easy to come up with an ad-hoc interface to make a chip work for a particular use case when a more general solution would be better.

Quoted 3 lines

I agree with you. I have one question though: if we create a 'hpe' directory under drivers/soc, and put all HPE BMC specific drivers there, do you think this proper?

Quoted 7 lines

It certainly wouldn't be right to put "all HPE BMC specific drivers" in there. Most drivers will fit into some existing subsystem, and should be moved there instead. drivers/soc is used primarily for drivers using soc_device_register() to provide information about the soc, and we also use it as a place for drivers that just export soc-specific helper functions that can be used by other drivers.

Sorry for not saying it clearly. I meant to put those HPE BMC related drivers that are "not specific" to a particular subsystem in drivers/soc/hpe. For those fit into some existing subsystems go to their designated places.

Quoted 10 lines
Quoted 9 lines
Quoted 5 lines

Again, it's hard for me to tell why this even needs to be runtime configurable, please try to describe what type of application would access the sysfs interface here, and why this can't just be set to a fixed value by bootloader or kernel without user interaction.

The register is used for communication and synchronization between the BMC and the host. During runtime, user-space daemons configures the value of the register for interactions.

Quoted 5 lines

That does not sound very specific. What is the subsystem on the host that this communicates with? Can you put the driver into the same subsystem?

Arnd

This is a control register in the BMC chip that partially controls host boot behaviors. When writing to the register, privileged mode is required. That's why we rely on a kernel driver for writing to the control register. And, there is no corresponding subsystem in the host OS. For this case, is it acceptable to put this driver under drivers/soc/hpe?

Thanks,
Clay

#11 lore raw

Re: [PATCH 2/5] dt-bindings: soc: hpe: hpe,gxp-srom.yaml

Quoted 6 lines · Clay Chang

On Mon, Jan 16, 2023 at 04:18:59PM +0100, Arnd Bergmann wrote:

Sorry for not saying it clearly. I meant to put those HPE BMC related drivers that are "not specific" to a particular subsystem in drivers/soc/hpe. For those fit into some existing subsystems go to their designated places.

Ok, that makes sense. I'm just trying to reduce the number of drivers that fit into this category.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

Again, it's hard for me to tell why this even needs to be runtime configurable, please try to describe what type of application would access the sysfs interface here, and why this can't just be set to a fixed value by bootloader or kernel without user interaction.

Quoted 7 lines
Quoted 3 lines

The register is used for communication and synchronization between the BMC and the host. During runtime, user-space daemons configures the value of the register for interactions.

That does not sound very specific. What is the subsystem on the host that this communicates with? Can you put the driver into the same subsystem?

Quoted 6 lines

This is a control register in the BMC chip that partially controls host boot behaviors. When writing to the register, privileged mode is required. That's why we rely on a kernel driver for writing to the control register. And, there is no corresponding subsystem in the host OS. For this case, is it acceptable to put this driver under drivers/soc/hpe?

I see. So this sounds like it might be generic BMC feature, which would be nice to handle consistently for all BMC families. We had some discussions about other BMC features in the past, but don't remember what the overall consensus was, so I'm adding the openbmc list and as well as aspeed and npcm maintainers to Cc.

The part I'm still missing is what type of userspace makes this decision on the BMC side, and whether that might already have a generalized interface. If there is, maybe part of that interface can be abstracted in the kernel.

Arnd

#12 lore raw

PATCH 3/5 ARM: dts: hpe: Add SROM Driver

In reply to [email protected]

From: Clay Chang <[email protected]>

Add SROM driver to the device tree. Also re-organize the AHB base address to accommodate the SROM driver register requirements. Add the hpe,gxp-srom compatible.

---
 arch/arm/boot/dts/hpe-gxp.dtsi | 41 +++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 18 deletions(-)
arch/arm/boot/dts/hpe-gxp.dtsi +23 -18
index cf735b3c4f35..3e96941721d5 100644
@@ -52,76 +52,81 @@
 			cache-level = <2>;
 		};
 
-		ahb@c0000000 {
+		ahb@80000000 {
 			compatible = "simple-bus";
 			#address-cells = <1>;
 			#size-cells = <1>;
-			ranges = <0x0 0xc0000000 0x30000000>;
+			ranges = <0x0 0x80000000 0x7FFFFFFF>;
 			dma-ranges;
 
-			vic0: interrupt-controller@eff0000 {
+			vic0: interrupt-controller@4eff0000 {
 				compatible = "arm,pl192-vic";
-				reg = <0xeff0000 0x1000>;
+				reg = <0x4eff0000 0x1000>;
 				interrupt-controller;
 				#interrupt-cells = <1>;
 			};
 
-			vic1: interrupt-controller@80f00000 {
+			vic1: interrupt-controller@f00000 {
 				compatible = "arm,pl192-vic";
-				reg = <0x80f00000 0x1000>;
+				reg = <0xf00000 0x1000>;
 				interrupt-controller;
 				#interrupt-cells = <1>;
 			};
 
-			uarta: serial@e0 {
+			uarta: serial@400000e0 {
 				compatible = "ns16550a";
-				reg = <0xe0 0x8>;
+				reg = <0x400000e0 0x8>;
 				interrupts = <17>;
 				interrupt-parent = <&vic0>;
 				clock-frequency = <1846153>;
 				reg-shift = <0>;
 			};
 
-			uartb: serial@e8 {
+			uartb: serial@400000e8 {
 				compatible = "ns16550a";
-				reg = <0xe8 0x8>;
+				reg = <0x400000e8 0x8>;
 				interrupts = <18>;
 				interrupt-parent = <&vic0>;
 				clock-frequency = <1846153>;
 				reg-shift = <0>;
 			};
 
-			uartc: serial@f0 {
+			uartc: serial@400000f0 {
 				compatible = "ns16550a";
-				reg = <0xf0 0x8>;
+				reg = <0x400000f0 0x8>;
 				interrupts = <19>;
 				interrupt-parent = <&vic0>;
 				clock-frequency = <1846153>;
 				reg-shift = <0>;
 			};
 
-			usb0: usb@efe0000 {
+			usb0: usb@4efe0000 {
 				compatible = "hpe,gxp-ehci", "generic-ehci";
-				reg = <0xefe0000 0x100>;
+				reg = <0x4efe0000 0x100>;
 				interrupts = <7>;
 				interrupt-parent = <&vic0>;
 			};
 
-			st: timer@80 {
+			st: timer@40000080 {
 				compatible = "hpe,gxp-timer";
-				reg = <0x80 0x16>;
+				reg = <0x40000080 0x16>;
 				interrupts = <0>;
 				interrupt-parent = <&vic0>;
 				clocks = <&iopclk>;
 				clock-names = "iop";
 			};
 
-			usb1: usb@efe0100 {
+			usb1: usb@4efe0100 {
 				compatible = "hpe,gxp-ohci", "generic-ohci";
-				reg = <0xefe0100 0x110>;
+				reg = <0x4efe0100 0x110>;
 				interrupts = <6>;
 				interrupt-parent = <&vic0>;
 			};
+
+			srom: srom@fc0000 {
+				compatible = "hpe,gxp-srom";
+				reg = <0xfc0000 0x100>;
+			};
 		};
 	};
 };
Signature · 1 line
2.17.1
#13 lore raw

PATCH 4/5 ARM: multi_v7_defconfig: Add GXP SROM Driver

In reply to [email protected]

From: Clay Chang <[email protected]>

Add the CONFIG_HPE_GXP_SROM and CONFIG_HPE_GXP_SOCLIB.

---
 arch/arm/configs/multi_v7_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/multi_v7_defconfig +2 -0
index ee184eb37adc..f50a3731b84c 100644
@@ -1254,3 +1254,5 @@ CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_PRINTK_TIME=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_FS=y
+CONFIG_HPE_GXP_SOCLIB=m
+CONFIG_HPE_GXP_SROM=m
Signature · 1 line
2.17.1
#14 lore raw

Re: [PATCH 4/5] ARM: multi_v7_defconfig: Add GXP SROM Driver

Quoted 14 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Add the CONFIG_HPE_GXP_SROM and CONFIG_HPE_GXP_SOCLIB.

---
 arch/arm/configs/multi_v7_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/multi_v7_defconfig +0 -0
index ee184eb37adc..f50a3731b84c 100644

arch/arm/configs/multi_v7_defconfig CONFIG_CMA_SIZE_MBYTES=64 · line 1258

Quoted 5 lines
arch/arm/configs/multi_v7_defconfig +2 -0
@@ -1254,3 +1254,5 @@ CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_PRINTK_TIME=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_FS=y
+CONFIG_HPE_GXP_SOCLIB=m
+CONFIG_HPE_GXP_SROM=m

Don't add stuff at random places or at the end. Add in proper place, defined by savedefconfig.

Best regards,
Krzysztof

author
#15 lore raw

Re: [PATCH 4/5] ARM: multi_v7_defconfig: Add GXP SROM Driver

Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Add the CONFIG_HPE_GXP_SROM and CONFIG_HPE_GXP_SOCLIB.

---
 arch/arm/configs/multi_v7_defconfig | 2 ++
 1 file changed, 2 insertions(+)
Quoted 13 lines

arch/arm/configs/multi_v7_defconfig CONFIG_CMA_SIZE_MBYTES=64 · line 1258

Quoted 10 lines
arch/arm/configs/multi_v7_defconfig +2 -0
index ee184eb37adc..f50a3731b84c 100644
@@ -1254,3 +1254,5 @@ CONFIG_CMA_SIZE_MBYTES=64
 CONFIG_PRINTK_TIME=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_FS=y
+CONFIG_HPE_GXP_SOCLIB=m
+CONFIG_HPE_GXP_SROM=m

Don't add stuff at random places or at the end. Add in proper place, defined by savedefconfig.

Thank you. I will address this correctly in the next revision.

Quoted 4 lines

Best regards,
Krzysztof

Thanks,
Clay

#16 lore raw

PATCH 5/5 MAINTAINERS: Add maintainer of GXP SROM support

In reply to [email protected]

From: Clay Chang <[email protected]>

Add Clay Chang as the maintainer of GXP SROM support.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index ea941dc469fa..164571ac1cc5 100644
@@ -2279,14 +2279,22 @@ F:	arch/arm/mach-sa1100/jornada720.c
 ARM/HPE GXP ARCHITECTURE
 M:	Jean-Marie Verdun <[email protected]>
 M:	Nick Hawkins <[email protected]>
+M:	Clay Chang <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/arm/hpe,gxp.yaml
+F:	Documentation/devicetree/bindings/soc/hpe/
+F:	Documentation/devicetree/bindings/soc/hpe/hpe,gxp-srom.yaml
 F:	Documentation/devicetree/bindings/spi/hpe,gxp-spifi.yaml
 F:	Documentation/devicetree/bindings/timer/hpe,gxp-timer.yaml
 F:	arch/arm/boot/dts/hpe-bmc*
 F:	arch/arm/boot/dts/hpe-gxp*
 F:	arch/arm/mach-hpe/
 F:	drivers/clocksource/timer-gxp.c
+F:	drivers/soc/hpe/
+F:	drivers/soc/hpe/Kconfig
+F:	drivers/soc/hpe/Makefile
+F:	drivers/soc/hpe/gxp-soclib.[ch]
+F:	drivers/soc/hpe/gxp-srom.c
 F:	drivers/spi/spi-gxp.c
 F:	drivers/watchdog/gxp-wdt.c
 
Signature · 1 line
2.17.1
#17 lore raw

Re: [PATCH 5/5] MAINTAINERS: Add maintainer of GXP SROM support

Quoted 3 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Add Clay Chang as the maintainer of GXP SROM support.

Your commit is not doing it. Nope. Either make proper entry matching this commit msg or make commit msg reflecting truth.

Quoted 11 lines
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +0 -0
index ea941dc469fa..164571ac1cc5 100644

MAINTAINERS F: arch/arm/mach-sa1100/jornada720.c · line 2282

Quoted 4 lines
MAINTAINERS +1 -0
@@ -2279,14 +2279,22 @@ F:	arch/arm/mach-sa1100/jornada720.c
 ARM/HPE GXP ARCHITECTURE
 M:	Jean-Marie Verdun <[email protected]>
 M:	Nick Hawkins <[email protected]>
+M:	Clay Chang <[email protected]>

Best regards,
Krzysztof

author
#18 lore raw

Re: [PATCH 5/5] MAINTAINERS: Add maintainer of GXP SROM support

Quoted 7 lines · Krzysztof Kozlowski
Quoted 3 lines · On 10/01/2023 05:25, [email protected] wrote:

From: Clay Chang <[email protected]>

Add Clay Chang as the maintainer of GXP SROM support.

Your commit is not doing it. Nope. Either make proper entry matching this commit msg or make commit msg reflecting truth.

Thank you for the comment. I will address this correctly in the next revision.

Quoted 6 lines
Quoted 6 lines
---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
Quoted 14 lines

MAINTAINERS F: arch/arm/mach-sa1100/jornada720.c · line 2282

Quoted 9 lines
MAINTAINERS +1 -0
index ea941dc469fa..164571ac1cc5 100644
@@ -2279,14 +2279,22 @@ F:	arch/arm/mach-sa1100/jornada720.c
 ARM/HPE GXP ARCHITECTURE
 M:	Jean-Marie Verdun <[email protected]>
 M:	Nick Hawkins <[email protected]>
+M:	Clay Chang <[email protected]>

Best regards,
Krzysztof

Thanks,
Clay

#19 lore raw
In reply to [email protected]
Quoted 5 lines · On Tue, 10 Jan 2023, at 14:55, [email protected] wrote:

From: Clay Chang <[email protected]>

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

What exact behaviour does vromoff influence? You mention I/O registers, but RAM offset feels like it may be related to MEM or FWH LPC cycles instead?

I'm trying to understand whether we can find some common ground with controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], but the description is a bit too vague right now for me to be able to do that.

[1] https://lore.kernel.org/all/[email protected]/

Andrew

author
#20 lore raw

Hi Andrew,

Thank you for taking time, and sorry for my late response.

Quoted 5 lines · Andrew Jeffery
Quoted 2 lines · On Tue, 10 Jan 2023, at 14:55, [email protected] wrote:

From: Clay Chang <[email protected]>

Quoted 8 lines
Quoted 3 lines

The GXP SROM control register can be used to configure LPC related legacy I/O registers. Currently only the SROM RAM Offset Register (vromoff) is exported.

What exact behaviour does vromoff influence? You mention I/O registers, but RAM offset feels like it may be related to MEM or FWH LPC cycles instead?

Sorry for my previous inaccurate description about the vromoff register. You are right, it is not related to I/O but memory LPC cycles. This register defines the offset and size to BMC's memory for the system rom. BMC uses it for system rom related operations. One way to access this is through the memory LPC cycles.

Quoted 8 lines

I'm trying to understand whether we can find some common ground with controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], but the description is a bit too vague right now for me to be able to do that.

[1] https://lore.kernel.org/all/[email protected]/

Andrew

Thanks,
Clay

author
#21 lore raw

Hi Andrew,

Quoted 8 lines · Clay Chang
Quoted 8 lines

I'm trying to understand whether we can find some common ground with controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], but the description is a bit too vague right now for me to be able to do that.

[1] https://lore.kernel.org/all/[email protected]/

Andrew

I briefly studied driver/soc/aspeed/aspeed-lpc-ctrl.c, and IMO the similarity between HPE GXP driver and Aspeed's could be that we both expose the LPC memory addresses or registers for configuration purposes. However, the functions to be configured could vary. There are a few sets of registers that HPE wants to expose for configuration in the future.

So, do you think there could be some common grounds for genralization? Please let me know if you need more information.

Thanks,
Clay

#22 lore raw
Quoted 10 lines · Clay Chang

Hi Andrew,

Quoted 7 lines · Clay Chang
Quoted 7 lines

I'm trying to understand whether we can find some common ground with controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], but the description is a bit too vague right now for me to be able to do that.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Andrew

I briefly studied driver/soc/aspeed/aspeed-lpc-ctrl.c, and IMO the similarity between HPE GXP driver and Aspeed's could be that we both expose the LPC memory addresses or registers for configuration purposes. However, the functions to be configured could vary. There are a few sets of registers that HPE wants to expose for configuration in the future.

The talk of "exposing registers" feels concerning - we're trying not to do that directly. Instead we want to lift out an API that constrains the behaviour a bit but works for both of us if there's overlap in functionality.

Can you point to any documentation of the behaviour of your hardware? It's still a little vague to me.

Andrew

author
#23 lore raw
Quoted 21 lines · Andrew Jeffery
Quoted 10 lines · Clay Chang

Hi Andrew,

Quoted 7 lines · Clay Chang
Quoted 7 lines

I'm trying to understand whether we can find some common ground with controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], but the description is a bit too vague right now for me to be able to do that.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Andrew

I briefly studied driver/soc/aspeed/aspeed-lpc-ctrl.c, and IMO the similarity between HPE GXP driver and Aspeed's could be that we both expose the LPC memory addresses or registers for configuration purposes. However, the functions to be configured could vary. There are a few sets of registers that HPE wants to expose for configuration in the future.

Quoted 5 lines

The talk of "exposing registers" feels concerning - we're trying not to do that directly. Instead we want to lift out an API that constrains the behaviour a bit but works for both of us if there's overlap in functionality.

Let me describe it more clearly. We don't expose the registers directly to the user. We describe those registers in the device tree, and then the driver exposes them though sysfs interfaces. Users access the registers through the device attributes defined under the sysfs structure (e.g. /sys/class/soc/srom/vromoff) exposed by the driver. In the show/store function pair, we get or set the regmap or memory, validate input, do sanity check, synchronization, and so on.

I learned that in the drivers/soc/aspeed/aspeed-lpc-ctrl.c, both mmap and ioctl were used, and revelant ioctl commands were defined in include/uapi/linux/aspeed-lpc-ctrl.h. Is this what you mean an API for aspeed? And we are trying to see if there are commonalities among us? If yes, yeah I think it is good to see a common abstraction for BMC chips.

Accroding to [1], I'd comment that, in terms of flash update, what we want to do is similar to what was described in [1]. The SROM driver I am working on partially layouts the registers for flash update for HPE GXP hardware.

BTW, the way for user to access the registers is flexible - ioctl should work as well.

Quoted 4 lines

Can you point to any documentation of the behaviour of your hardware? It's still a little vague to me.

Andrew

I wish I could, but there is not yet a technical document or datasheet available to the public. Sorry.

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=v6.2-rc4&id=6c4e976785011dfbe461821d0bfc58cfd60eac56

Thanks,
Clay