Skip to contentSkip to conversation

Implement SoC bus support for Vybrid

PATCH Superseded Sanchayan Maity 3 participants 8 messages Jun 5, 2015 – Jun 10, 2015

Subsystems (2)

v5 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v5 cover Implement SoC bus support for Vybrid

Hello,

This patchset implements SoC bus support for Freescale Vybrid platform, implementing the following
https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-soc
and is the fifth revision. Tested on a Colibri VF61 module after rebasing on shawn's for-next branch.

Arnd and Shawn I did like to have your comments to get this in a mergeable state and make any changes as necessary and required.

Thanks for the comments and feedback till now. Feedback is most welcome.

Version 4 of the patchset can be found here
https://lkml.org/lkml/2015/5/26/199

Version 3 of the patchset can be found here
http://www.spinics.net/lists/arm-kernel/msg420847.html

Version 2 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80654.html

Version 1 of the patchset can be found here
http://www.spinics.net/lists/devicetree/msg80257.html

The RFC version can be found here
https://lkml.org/lkml/2015/5/11/13

Changes since v4:
- Use devm_* family of functions and use a struct to get rid of global variables (suggested by Joachim Eastwood)
- Make Kconfig govern the compilation with tristate, instead of earlier bool. Paul Bolle raised a valid point that perhaps this should have been built in with the bool, however I had not taken into consideration generic distro kernels and it makes sense to have this tristated. (comments from Paul Bolle and Andreas Farber)

Changes since v3:
- Instead of using the syscon_regmap_lookup_by_compatible function use a phandle in the device tree along with offsets specified in this phandle node and then read the offset along with the device node in the driver for reading from the required region.

Changes since v2:
- Implement the SoC bus code as a driver in drivers/soc by registering with fsl,mscm-cpucfg as per Arnd's feedback

Changes since v1:
- Sort the headers in alphabetical order

Changes since RFC:
- Use a DT entry for the ROM area while specifying it as syscon.

Notes same since v1:
Currently the required information is more or less read across the whole SoC, but I guess we cannot change that since these are the locations with the required information.

There seem to be three options for the revision field:
- ROM revision (see https://community.freescale.com/docs/DOC-94802)
- ANADIG revision (ANADIG_DIGIPROC, as used for the i.MX SoC's)
- OCOTP revision

Some numbers:

Colibri VF61 1.1A (2N02G)
- 0x00000013
- 0x00610000
- 0x01000000
- 0x410000c8

Colibri VF61 V1.0B (1N02G)
- 0x00000011
- 0x00610000
- 0x01000000
- 0x410000c8

Colibri VF61 V1.0A (which is actually a VF600 SoC, no L2 cache, since that was the only one we could buy back then, 1N02G printed on it)
- 0x00000011
- 0x00610000
- 0x01000000
- none...

Colibri VF50 V1.0A (1N02G)
- 0x00000011
- 0x00610000
- 0x01000000
- none...

Vybrid Tower Rev J (1N02G)
- 0x00000011
- 0x00610000
- 0x01000000
- 0x410000c8

The ROM revision differs the most, so we would like to go with the revision information from the ROM register 0x80.

Sanchayan Maity (2):
ARM: dts: vfxxx: Add OCOTP and OCROM nodes
soc: Add driver for Freescale Vybrid Platform

 arch/arm/boot/dts/vfxxx.dtsi |  12 ++++
 drivers/soc/Kconfig          |   1 +
 drivers/soc/Makefile         |   1 +
 drivers/soc/fsl/Kconfig      |  10 +++
 drivers/soc/fsl/Makefile     |   1 +
 drivers/soc/fsl/soc-vf610.c  | 166 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 191 insertions(+)
 create mode 100644 drivers/soc/fsl/Kconfig
 create mode 100644 drivers/soc/fsl/Makefile
 create mode 100644 drivers/soc/fsl/soc-vf610.c
Signature · 1 line
2.4.2
#1 lore raw

PATCH v5 1/2 ARM: dts: vfxxx: Add OCOTP and OCROM nodes

Add a device tree node for the On-Chip One Time Programmable Controller (OCOTP) and the On-Chip ROM.

---
 arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +12 -0
index 2f4b04d..ed9b6b8 100644
@@ -56,6 +56,13 @@
 		compatible = "simple-bus";
 		interrupt-parent = <&mscm_ir>;
 		ranges;
+		ocotp-cfg = <&ocotp 0x410 0x420>;
+		rom-revision = <&ocrom 0x80>;
+
+		ocrom: ocrom {
+			compatible = "fsl,vf610-ocrom", "syscon";
+			reg = <0x00000000 0x18000>;
+		};
 
 		aips0: aips-bus at 40000000 {
 			compatible = "fsl,aips-bus", "simple-bus";
@@ -403,6 +410,11 @@
 				status = "disabled";
 			};
 
+			ocotp: ocotp at 400a5000 {
+				compatible = "fsl,vf610-ocotp", "syscon";
+				reg = <0x400a5000 0x1000>;
+			};
+
 			snvs0: snvs at 400a7000 {
 			    compatible = "fsl,sec-v4.0-mon", "simple-bus";
 				#address-cells = <1>;
Signature · 1 line
2.4.2
#5 lore raw

PATCH v5 2/2 soc: Add driver for Freescale Vybrid Platform

In reply to Sanchayan Maity

This adds a SoC driver to be used by the Freescale Vybrid SoC's. We create the "fsl" directory for holding the different Freescale designs. Driver utilises syscon to get the various register values needed. After this sysfs exposes some SoC specific properties as below:

Quoted 2 lines

cd /sys/devices/soc0
ls

family machine power revision soc_id subsystem uevent

Quoted 1 line

cat family

Freescale Vybrid VF610

Quoted 1 line

cat machine

Freescale Vybrid

Quoted 1 line

cat revision

00000013

Quoted 1 line

cat soc_id

df6472a60c1c39d4

---
 drivers/soc/Kconfig         |   1 +
 drivers/soc/Makefile        |   1 +
 drivers/soc/fsl/Kconfig     |  10 +++
 drivers/soc/fsl/Makefile    |   1 +
 drivers/soc/fsl/soc-vf610.c | 166 ++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 179 insertions(+)
 create mode 100644 drivers/soc/fsl/Kconfig
 create mode 100644 drivers/soc/fsl/Makefile
 create mode 100644 drivers/soc/fsl/soc-vf610.c
drivers/soc/Kconfig +1 -0
index d8bde82..8b4dd2b 100644
@@ -1,5 +1,6 @@
 menu "SOC (System On Chip) specific Drivers"
 
+source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/ti/Kconfig"
drivers/soc/Makefile +1 -0
index 70042b2..142676e 100644
@@ -2,6 +2,7 @@
 # Makefile for the Linux Kernel SOC specific device drivers.
 #
 
+obj-$(CONFIG_SOC_VF610)        += fsl/
 obj-$(CONFIG_ARCH_MEDIATEK)	+= mediatek/
 obj-$(CONFIG_ARCH_QCOM)		+= qcom/
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
drivers/soc/fsl/Kconfig new file +10 -0
new file mode 100644
index 0000000..5752f77
@@ -0,0 +1,10 @@
+#
+# Freescale SoC drivers
+
+config SOC_BUS_VF610
+	   tristate "SoC bus device for the Freescale Vybrid platform"
+	   depends on SOC_VF610
+	   select SOC_BUS
+	   help
+	     Include support for the SoC bus on the Freescale Vybrid platform
+		 providing some sysfs information about the module variant.
drivers/soc/fsl/Makefile new file +1 -0
new file mode 100644
index 0000000..3d6b331
@@ -0,0 +1 @@
+obj-$(CONFIG_SOC_BUS_VF610)		+= soc-vf610.o
drivers/soc/fsl/soc-vf610.c new file +166 -0

166 lines not on this page · raw message

Signature · 1 line
2.4.2
#6 lore raw

Re: [PATCH v5 2/2] soc: Add driver for Freescale Vybrid Platform

Quoted 175 lines · Sanchayan Maity
drivers/soc/fsl/Kconfig new file +7 -0
 
+config SOC_BUS_VF610
+	   tristate "SoC bus device for the Freescale Vybrid platform"
+	   depends on SOC_VF610
+	   select SOC_BUS
+	   help
+	     Include support for the SoC bus on the Freescale Vybrid platform
+		 providing some sysfs information about the module variant.
drivers/soc/fsl/Makefile new file +1 -0
 
+obj-$(CONFIG_SOC_BUS_VF610)		+= soc-vf610.o
drivers/soc/fsl/soc-vf610.c new file +156 -0
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2015 Toradex AG
+ *
+ * Author: Sanchayan Maity <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/random.h>
+#include <linux/slab.h>
+#include <linux/sys_soc.h>
+
+#define DRIVER_NAME "vf610-soc-bus"
+
+#define MSCM_CPxCOUNT_OFFSET   0x0000002C
+#define MSCM_CPxCFG1_OFFSET    0x00000014
+
+struct vf610_soc {
+	struct device *dev;
+	struct soc_device_attribute *soc_dev_attr;
+	struct soc_device *soc_dev;
+};
+
+static int vf610_soc_probe(struct platform_device *pdev)
+{
+	struct vf610_soc *info;
+	struct regmap *ocotp_regmap, *mscm_regmap, *rom_regmap;
+	struct device *dev = &pdev->dev;
+	struct device_node *node = pdev->dev.of_node;
+	struct device_node *soc_node;
+	struct of_phandle_args pargs;
+	char soc_type[] = "xx0";
+	u32 cfg0_offset, cfg1_offset, rom_rev_offset;
+	u32 soc_id1, soc_id2, rom_rev;
+	u32 cpxcount, cpxcfg1;
+	u64 soc_id;
+	int ret;
+
+	info = devm_kzalloc(&pdev->dev, sizeof(struct vf610_soc), GFP_KERNEL);
+	if (!info)
+		return -ENOMEM;
+
+	info->dev = &pdev->dev;
+	platform_set_drvdata(pdev, info);
+
+	mscm_regmap = syscon_node_to_regmap(node);
+	if (IS_ERR(mscm_regmap)) {
+		dev_err(dev, "regmap lookup for mscm failed\n");
+		return PTR_ERR(mscm_regmap);
+	}
+
+	soc_node = of_find_node_by_path("/soc");
+
+	ret = of_parse_phandle_with_fixed_args(soc_node,
+					"ocotp-cfg", 2, 0, &pargs);
+	if (ret) {
+		dev_err(dev, "lookup failed for ocotp-cfg node %d\n", ret);
+		return ret;
+	}
+
+	ocotp_regmap = syscon_node_to_regmap(pargs.np);
+	if (IS_ERR(ocotp_regmap)) {
+		of_node_put(pargs.np);
+		dev_err(dev, "regmap lookup for ocotp failed\n");
+		return PTR_ERR(ocotp_regmap);
+	}
+
+	cfg0_offset = pargs.args[0];
+	cfg1_offset = pargs.args[1];
+	of_node_put(pargs.np);
+
+	ret = of_parse_phandle_with_fixed_args(soc_node,
+					"rom-revision", 1, 0, &pargs);
+	if (ret) {
+		dev_err(dev, "lookup failed for rom-revision node %d\n", ret);
+		return ret;
+	}
+
+	rom_regmap = syscon_node_to_regmap(pargs.np);
+	if (IS_ERR(rom_regmap)) {
+		of_node_put(pargs.np);
+		dev_err(dev, "regmap lookup for ocrom failed\n");
+		return PTR_ERR(rom_regmap);
+	}
+
+	rom_rev_offset = pargs.args[0];
+	of_node_put(pargs.np);
+
+	ret = regmap_read(ocotp_regmap, cfg0_offset, &soc_id1);
+	if (ret)
+		return -ENODEV;
+
+	ret = regmap_read(ocotp_regmap, cfg1_offset, &soc_id2);
+	if (ret)
+		return -ENODEV;
+
+	soc_id = (u64) soc_id1 << 32 | soc_id2;
+	add_device_randomness(&soc_id, sizeof(soc_id));
+
+	ret = regmap_read(mscm_regmap, MSCM_CPxCOUNT_OFFSET, &cpxcount);
+	if (ret)
+		return -ENODEV;
+
+	ret = regmap_read(mscm_regmap, MSCM_CPxCFG1_OFFSET, &cpxcfg1);
+	if (ret)
+		return -ENODEV;
+
+	soc_type[0] = cpxcount ? '6' : '5'; /* Dual Core => VF6x0 */
+	soc_type[1] = cpxcfg1 ? '1' : '0'; /* L2 Cache => VFx10 */
+
+	ret = regmap_read(rom_regmap, rom_rev_offset, &rom_rev);
+	if (ret)
+		return -ENODEV;
+
+	info->soc_dev_attr = devm_kzalloc(&pdev->dev,
+				sizeof(info->soc_dev_attr), GFP_KERNEL);
+	if (!info->soc_dev_attr)
+		return -ENOMEM;
+
+	info->soc_dev_attr->machine = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "Freescale Vybrid");
+	info->soc_dev_attr->soc_id = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "%016llx", soc_id);
+	info->soc_dev_attr->family = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "Freescale Vybrid VF%s",
+				soc_type);
+	info->soc_dev_attr->revision = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "%08x", rom_rev);
+
+	info->soc_dev = soc_device_register(info->soc_dev_attr);
+	if (IS_ERR(info->soc_dev))
+		return -ENODEV;
+
+	return 0;
+}
+
+static int vf610_soc_remove(struct platform_device *pdev)
+{
+	struct vf610_soc *info = platform_get_drvdata(pdev);
+
+	if (info->soc_dev)
+		soc_device_unregister(info->soc_dev);
+
+	return 0;
+}
+
+static const struct of_device_id vf610_soc_bus_match[] = {
+	{ .compatible = "fsl,vf610-mscm-cpucfg", },
+	{ /* sentinel */ }
+};

drivers/soc/fsl/soc-vf610.c line 166

Quoted 10 lines
drivers/soc/fsl/soc-vf610.c new file +10 -0
+
+static struct platform_driver vf610_soc_driver = {
+	.probe          = vf610_soc_probe,
+	.remove         = vf610_soc_remove,
+	.driver         = {
+		.name   = DRIVER_NAME,
+		.of_match_table = vf610_soc_bus_match,
+	},
+};
+module_platform_driver(vf610_soc_driver);

The Kconfig symbol is tristate now, but all module specific code is gone from this file (ie, MODULE_DEVICE_TABLE, MODULE_DESCRIPTION and MODULE_LICENSE). Why's that?

Thanks,

Paul Bolle

#2 lore raw

Re: [PATCH v5 1/2] ARM: dts: vfxxx: Add OCOTP and OCROM nodes

In reply to Sanchayan Maity

Hi,

Quoted 13 lines · Sanchayan Maity

Add a device tree node for the On-Chip One Time Programmable Controller (OCOTP) and the On-Chip ROM.

---
 arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +0 -0
index 2f4b04d..ed9b6b8 100644

arch/arm/boot/dts/vfxxx.dtsi line 65

Quoted 10 lines
arch/arm/boot/dts/vfxxx.dtsi +7 -0
@@ -56,6 +56,13 @@
 		compatible = "simple-bus";
 		interrupt-parent = <&mscm_ir>;
 		ranges;
+		ocotp-cfg = <&ocotp 0x410 0x420>;
+		rom-revision = <&ocrom 0x80>;
+
+		ocrom: ocrom {
+			compatible = "fsl,vf610-ocrom", "syscon";
+			reg = <0x00000000 0x18000>;
+		};

Shouldn't that use the new nvmem framework currently being discussed, instead of defining custom bindings?

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150606/502566bf/attachment.sig>
#3 lore raw

Re: [PATCH v5 1/2] ARM: dts: vfxxx: Add OCOTP and OCROM nodes

Hello Maxime,

Quoted 21 lines · Maxime Ripard

Hi,

Quoted 18 lines · Sanchayan Maity

Add a device tree node for the On-Chip One Time Programmable Controller (OCOTP) and the On-Chip ROM.

---
 arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +2 -0
index 2f4b04d..ed9b6b8 100644
@@ -56,6 +56,13 @@
 		compatible = "simple-bus";
 		interrupt-parent = <&mscm_ir>;
 		ranges;
+		ocotp-cfg = <&ocotp 0x410 0x420>;
+		rom-revision = <&ocrom 0x80>;
Quoted 8 lines

arch/arm/boot/dts/vfxxx.dtsi line 65

Quoted 5 lines
arch/arm/boot/dts/vfxxx.dtsi +5 -0
+
+		ocrom: ocrom {
+			compatible = "fsl,vf610-ocrom", "syscon";
+			reg = <0x00000000 0x18000>;
+		};

Shouldn't that use the new nvmem framework currently being discussed, instead of defining custom bindings?

I am aware of those nvmem framework patches by Srinivas, however from what I can see that framework has not been merged yet atleast from the mail chain that I see for v5 of the patchset so I have not properly looked into that. Mark Brown did apply the regmap patches to his tree, but has the rest of the framework been merged or is it expected to be merged?

If it is expected to be merged and if that framework is a fit for what we are trying to do here and it seems so on a quick glance, then I can go with that. However I still did like to hear from Arnd or have some more comments before I go for that approach with the next respin.

- Sanchayan

#7 lore raw

Re: [PATCH v5 2/2] soc: Add driver for Freescale Vybrid Platform

In reply to Paul Bolle

Hello Paul,

Quoted 182 lines · Paul Bolle
Quoted 181 lines · Sanchayan Maity
drivers/soc/fsl/Kconfig new file +7 -0
 
+config SOC_BUS_VF610
+	   tristate "SoC bus device for the Freescale Vybrid platform"
+	   depends on SOC_VF610
+	   select SOC_BUS
+	   help
+	     Include support for the SoC bus on the Freescale Vybrid platform
+		 providing some sysfs information about the module variant.
drivers/soc/fsl/Makefile new file +1 -0
 
+obj-$(CONFIG_SOC_BUS_VF610)		+= soc-vf610.o
drivers/soc/fsl/soc-vf610.c new file +162 -0
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2015 Toradex AG
+ *
+ * Author: Sanchayan Maity <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/mfd/syscon.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/random.h>
+#include <linux/slab.h>
+#include <linux/sys_soc.h>
+
+#define DRIVER_NAME "vf610-soc-bus"
+
+#define MSCM_CPxCOUNT_OFFSET   0x0000002C
+#define MSCM_CPxCFG1_OFFSET    0x00000014
+
+struct vf610_soc {
+	struct device *dev;
+	struct soc_device_attribute *soc_dev_attr;
+	struct soc_device *soc_dev;
+};
+
+static int vf610_soc_probe(struct platform_device *pdev)
+{
+	struct vf610_soc *info;
+	struct regmap *ocotp_regmap, *mscm_regmap, *rom_regmap;
+	struct device *dev = &pdev->dev;
+	struct device_node *node = pdev->dev.of_node;
+	struct device_node *soc_node;
+	struct of_phandle_args pargs;
+	char soc_type[] = "xx0";
+	u32 cfg0_offset, cfg1_offset, rom_rev_offset;
+	u32 soc_id1, soc_id2, rom_rev;
+	u32 cpxcount, cpxcfg1;
+	u64 soc_id;
+	int ret;
+
+	info = devm_kzalloc(&pdev->dev, sizeof(struct vf610_soc), GFP_KERNEL);
+	if (!info)
+		return -ENOMEM;
+
+	info->dev = &pdev->dev;
+	platform_set_drvdata(pdev, info);
+
+	mscm_regmap = syscon_node_to_regmap(node);
+	if (IS_ERR(mscm_regmap)) {
+		dev_err(dev, "regmap lookup for mscm failed\n");
+		return PTR_ERR(mscm_regmap);
+	}
+
+	soc_node = of_find_node_by_path("/soc");
+
+	ret = of_parse_phandle_with_fixed_args(soc_node,
+					"ocotp-cfg", 2, 0, &pargs);
+	if (ret) {
+		dev_err(dev, "lookup failed for ocotp-cfg node %d\n", ret);
+		return ret;
+	}
+
+	ocotp_regmap = syscon_node_to_regmap(pargs.np);
+	if (IS_ERR(ocotp_regmap)) {
+		of_node_put(pargs.np);
+		dev_err(dev, "regmap lookup for ocotp failed\n");
+		return PTR_ERR(ocotp_regmap);
+	}
+
+	cfg0_offset = pargs.args[0];
+	cfg1_offset = pargs.args[1];
+	of_node_put(pargs.np);
+
+	ret = of_parse_phandle_with_fixed_args(soc_node,
+					"rom-revision", 1, 0, &pargs);
+	if (ret) {
+		dev_err(dev, "lookup failed for rom-revision node %d\n", ret);
+		return ret;
+	}
+
+	rom_regmap = syscon_node_to_regmap(pargs.np);
+	if (IS_ERR(rom_regmap)) {
+		of_node_put(pargs.np);
+		dev_err(dev, "regmap lookup for ocrom failed\n");
+		return PTR_ERR(rom_regmap);
+	}
+
+	rom_rev_offset = pargs.args[0];
+	of_node_put(pargs.np);
+
+	ret = regmap_read(ocotp_regmap, cfg0_offset, &soc_id1);
+	if (ret)
+		return -ENODEV;
+
+	ret = regmap_read(ocotp_regmap, cfg1_offset, &soc_id2);
+	if (ret)
+		return -ENODEV;
+
+	soc_id = (u64) soc_id1 << 32 | soc_id2;
+	add_device_randomness(&soc_id, sizeof(soc_id));
+
+	ret = regmap_read(mscm_regmap, MSCM_CPxCOUNT_OFFSET, &cpxcount);
+	if (ret)
+		return -ENODEV;
+
+	ret = regmap_read(mscm_regmap, MSCM_CPxCFG1_OFFSET, &cpxcfg1);
+	if (ret)
+		return -ENODEV;
+
+	soc_type[0] = cpxcount ? '6' : '5'; /* Dual Core => VF6x0 */
+	soc_type[1] = cpxcfg1 ? '1' : '0'; /* L2 Cache => VFx10 */
+
+	ret = regmap_read(rom_regmap, rom_rev_offset, &rom_rev);
+	if (ret)
+		return -ENODEV;
+
+	info->soc_dev_attr = devm_kzalloc(&pdev->dev,
+				sizeof(info->soc_dev_attr), GFP_KERNEL);
+	if (!info->soc_dev_attr)
+		return -ENOMEM;
+
+	info->soc_dev_attr->machine = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "Freescale Vybrid");
+	info->soc_dev_attr->soc_id = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "%016llx", soc_id);
+	info->soc_dev_attr->family = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "Freescale Vybrid VF%s",
+				soc_type);
+	info->soc_dev_attr->revision = devm_kasprintf(&pdev->dev,
+				GFP_KERNEL, "%08x", rom_rev);
+
+	info->soc_dev = soc_device_register(info->soc_dev_attr);
+	if (IS_ERR(info->soc_dev))
+		return -ENODEV;
+
+	return 0;
+}
+
+static int vf610_soc_remove(struct platform_device *pdev)
+{
+	struct vf610_soc *info = platform_get_drvdata(pdev);
+
+	if (info->soc_dev)
+		soc_device_unregister(info->soc_dev);
+
+	return 0;
+}
+
+static const struct of_device_id vf610_soc_bus_match[] = {
+	{ .compatible = "fsl,vf610-mscm-cpucfg", },
+	{ /* sentinel */ }
+};
+
+static struct platform_driver vf610_soc_driver = {
+	.probe          = vf610_soc_probe,
+	.remove         = vf610_soc_remove,
+	.driver         = {
+		.name   = DRIVER_NAME,
Quoted 8 lines

drivers/soc/fsl/soc-vf610.c line 166

Quoted 4 lines
drivers/soc/fsl/soc-vf610.c new file +4 -0
+		.of_match_table = vf610_soc_bus_match,
+	},
+};
+module_platform_driver(vf610_soc_driver);

The Kconfig symbol is tristate now, but all module specific code is gone from this file (ie, MODULE_DEVICE_TABLE, MODULE_DESCRIPTION and MODULE_LICENSE). Why's that?

Sorry that this crept in. It is a mistake on my part. Will fix.

Thank you for the feedback.

- Sanchayan.

#4 lore raw

Re: [PATCH v5 1/2] ARM: dts: vfxxx: Add OCOTP and OCROM nodes

In reply to [email protected]

Hi,

Quoted 27 lines · maitysanchayan at gmail.com
Quoted 18 lines
Quoted 18 lines

Add a device tree node for the On-Chip One Time Programmable Controller (OCOTP) and the On-Chip ROM.

---
 arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/vfxxx.dtsi +2 -0
index 2f4b04d..ed9b6b8 100644
@@ -56,6 +56,13 @@
 		compatible = "simple-bus";
 		interrupt-parent = <&mscm_ir>;
 		ranges;
+		ocotp-cfg = <&ocotp 0x410 0x420>;
+		rom-revision = <&ocrom 0x80>;
Quoted 8 lines

arch/arm/boot/dts/vfxxx.dtsi line 65

Quoted 5 lines
arch/arm/boot/dts/vfxxx.dtsi +5 -0
+
+		ocrom: ocrom {
+			compatible = "fsl,vf610-ocrom", "syscon";
+			reg = <0x00000000 0x18000>;
+		};

Shouldn't that use the new nvmem framework currently being discussed, instead of defining custom bindings?

Quoted 5 lines

I am aware of those nvmem framework patches by Srinivas, however from what I can see that framework has not been merged yet atleast from the mail chain that I see for v5 of the patchset so I have not properly looked into that. Mark Brown did apply the regmap patches to his tree, but has the rest of the framework been merged or is it expected to be merged?

Yeah, obviously the plan is to get it merged, and there's some effort toward that, with the amount of review that seem to slow down, so I guess it's closer to its merge than to its first submission.

Quoted 4 lines

If it is expected to be merged and if that framework is a fit for what we are trying to do here and it seems so on a quick glance, then I can go with that. However I still did like to hear from Arnd or have some more comments before I go for that approach with the next respin.

If it doesn't fit, don't hesitate to mention your concern on the thread. What you're trying to do should definitely be covered by that framework.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150610/f327df94/attachment-0001.sig>