* [PATCH 0/3] ARM: vt8500: Add runtime SoC version identification
@ 2025-04-23 19:18 Alexey Charkov
2025-04-23 19:18 ` [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification Alexey Charkov
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Alexey Charkov @ 2025-04-23 19:18 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Krzysztof Kozlowski
Cc: devicetree, linux-kernel, linux-arm-kernel, Alexey Charkov
VIA/WonderMedia SoCs have a chip ID register, which is helpful for
selecting support for correct sets of hardware quirks at runtime, add
code for it.
This will enable the use of SOC bus match tables in individual drivers,
allowing for finer grained feature selection where device trees might
not provide full information about what the hardware expects (such as
with non-user-visible SoC revisions having different behavior within
the same user-visible SoC version).
This series intentionally omits the updates to MAINTAINERS, as there
are multiple VT8500 related submissions this cycle which may go via
different trees (and cause pain in sequencing the merges). It will be
updated separately in a single pass to cover everything VT8500 related.
Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
Alexey Charkov (3):
dt-bindings: soc: Add VIA/WonderMedia SoC identification
soc: Add VIA/WonderMedia SoC identification driver
ARM: dts: vt8500: add DT nodes for the system config ID register
.../devicetree/bindings/soc/vt8500/via,scc-id.yaml | 37 +++++++
arch/arm/boot/dts/vt8500/vt8500.dtsi | 5 +
arch/arm/boot/dts/vt8500/wm8505.dtsi | 5 +
arch/arm/boot/dts/vt8500/wm8650.dtsi | 5 +
arch/arm/boot/dts/vt8500/wm8750.dtsi | 5 +
arch/arm/boot/dts/vt8500/wm8850.dtsi | 5 +
drivers/soc/Kconfig | 1 +
drivers/soc/Makefile | 1 +
drivers/soc/vt8500/Kconfig | 20 ++++
drivers/soc/vt8500/Makefile | 2 +
drivers/soc/vt8500/wmt-socinfo.c | 121 +++++++++++++++++++++
11 files changed, 207 insertions(+)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250423-wmt-soc-driver-de26d67bd4ef
Best regards,
--
Alexey Charkov <alchark@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification 2025-04-23 19:18 [PATCH 0/3] ARM: vt8500: Add runtime SoC version identification Alexey Charkov @ 2025-04-23 19:18 ` Alexey Charkov 2025-04-25 10:20 ` Krzysztof Kozlowski 2025-04-23 19:18 ` [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver Alexey Charkov 2025-04-23 19:18 ` [PATCH 3/3] ARM: dts: vt8500: add DT nodes for the system config ID register Alexey Charkov 2 siblings, 1 reply; 7+ messages in thread From: Alexey Charkov @ 2025-04-23 19:18 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Krzysztof Kozlowski Cc: devicetree, linux-kernel, linux-arm-kernel, Alexey Charkov VIA/WonderMedia SoC's have a chip ID register inside their system configuration controller space, which can be used to identify appropriate hardware quirks at runtime. Add binding for it. Signed-off-by: Alexey Charkov <alchark@gmail.com> --- .../devicetree/bindings/soc/vt8500/via,scc-id.yaml | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml b/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eac72bd66fd6331c8d9316288bc1acc3e337efaa --- /dev/null +++ b/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/vt8500/via,scc-id.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: VIA/WonderMedia SoC system configuration information + +maintainers: + - Alexey Charkov <alchark@gmail.com> + +description: + The system configuration controller on VIA/WonderMedia SoC's contains a chip + identifier and revision used to differentiate between different hardware + versions of on-chip IP blocks having their own peculiarities which may or + may not be captured by their respective DT compatible strings + +properties: + compatible: + items: + - const: via,scc-id + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; -- 2.49.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification 2025-04-23 19:18 ` [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification Alexey Charkov @ 2025-04-25 10:20 ` Krzysztof Kozlowski 0 siblings, 0 replies; 7+ messages in thread From: Krzysztof Kozlowski @ 2025-04-25 10:20 UTC (permalink / raw) To: Alexey Charkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: devicetree, linux-kernel, linux-arm-kernel On 23/04/2025 21:18, Alexey Charkov wrote: > VIA/WonderMedia SoC's have a chip ID register inside their system > configuration controller space, which can be used to identify > appropriate hardware quirks at runtime. Add binding for it. > > Signed-off-by: Alexey Charkov <alchark@gmail.com> > --- > .../devicetree/bindings/soc/vt8500/via,scc-id.yaml | 37 ++++++++++++++++++++++ chipid should probably go to hwinfo directory in bindings. > 1 file changed, 37 insertions(+) > > diff --git a/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml b/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml > new file mode 100644 > index 0000000000000000000000000000000000000000..eac72bd66fd6331c8d9316288bc1acc3e337efaa > --- /dev/null > +++ b/Documentation/devicetree/bindings/soc/vt8500/via,scc-id.yaml > @@ -0,0 +1,37 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/soc/vt8500/via,scc-id.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: VIA/WonderMedia SoC system configuration information > + > +maintainers: > + - Alexey Charkov <alchark@gmail.com> > + > +description: > + The system configuration controller on VIA/WonderMedia SoC's contains a chip > + identifier and revision used to differentiate between different hardware > + versions of on-chip IP blocks having their own peculiarities which may or > + may not be captured by their respective DT compatible strings > + > +properties: > + compatible: > + items: > + - const: via,scc-id Compatible based on SoC (and then also keep filename matching it). > + > + reg: > + maxItems: 1 > + Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver 2025-04-23 19:18 [PATCH 0/3] ARM: vt8500: Add runtime SoC version identification Alexey Charkov 2025-04-23 19:18 ` [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification Alexey Charkov @ 2025-04-23 19:18 ` Alexey Charkov 2025-04-25 10:24 ` Krzysztof Kozlowski 2025-04-23 19:18 ` [PATCH 3/3] ARM: dts: vt8500: add DT nodes for the system config ID register Alexey Charkov 2 siblings, 1 reply; 7+ messages in thread From: Alexey Charkov @ 2025-04-23 19:18 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Krzysztof Kozlowski Cc: devicetree, linux-kernel, linux-arm-kernel, Alexey Charkov Add a small SOC bus driver to parse the chip ID and revision made available on VIA/WonderMedia SoCs via their system configuration controller's SCC_ID register. This is intended to select appropriate sets of on-chip device quirks at runtime, as it has been found that even within the same SoC version there can be register-incompatible differences, such as with the SDMMC controller on WM8505 rev. A0-A1 vs. rev. A2. The list of SoC versions is compiled from various vendor source dumps and not all of them have corresponding mainline driver support. Some of them also have been seen with varying on-chip markings while sharing the same hardware chip ID's (as is the case with e.g. WM8850 vs. WM8950). In such cases the selection of names to use here among those seen in various source dumps and chip markings was arbitrary. Suggested by Krzysztof at [1] - thanks a lot! [1] https://lore.kernel.org/all/14de236b-e2a7-4bde-986d-1e5ffddd01b4@kernel.org/ Signed-off-by: Alexey Charkov <alchark@gmail.com> --- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/vt8500/Kconfig | 20 +++++++ drivers/soc/vt8500/Makefile | 2 + drivers/soc/vt8500/wmt-socinfo.c | 121 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 145 insertions(+) diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 6a8daeb8c4b96cd29d56343b338a423140b89896..37ca3f094f8994c7e9c7c99c3ba47d168d41ce30 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -28,6 +28,7 @@ source "drivers/soc/tegra/Kconfig" source "drivers/soc/ti/Kconfig" source "drivers/soc/ux500/Kconfig" source "drivers/soc/versatile/Kconfig" +source "drivers/soc/vt8500/Kconfig" source "drivers/soc/xilinx/Kconfig" endmenu diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index 2037a8695cb2898659a434803dcdfa2d95b1dbd6..777255401252eab554f56bded7ff8ea5611704bf 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -34,4 +34,5 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-y += ti/ obj-$(CONFIG_ARCH_U8500) += ux500/ obj-y += versatile/ +obj-y += vt8500/ obj-y += xilinx/ diff --git a/drivers/soc/vt8500/Kconfig b/drivers/soc/vt8500/Kconfig new file mode 100644 index 0000000000000000000000000000000000000000..2b2350678c3f70297c51f94eb77674c01be773d8 --- /dev/null +++ b/drivers/soc/vt8500/Kconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only + +if ARCH_VT8500 || COMPILE_TEST + +menu "VIA/WonderMedia SoC drivers" + +config WMT_SOCINFO + bool "VIA/WonderMedia SoC Information driver" + default ARCH_VT8500 + select SOC_BUS + default ARCH_VT8500 + help + Say yes to support decoding of VIA/WonderMedia system configuration + register information. This currently includes just the chip ID register + which helps identify the exact hardware revision of the SoC the kernel + is running on (to know if any revision-specific quirks are required) + +endmenu + +endif diff --git a/drivers/soc/vt8500/Makefile b/drivers/soc/vt8500/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..05964c5f2890989c1d794af4f5af10f849a497bc --- /dev/null +++ b/drivers/soc/vt8500/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_WMT_SOCINFO) += wmt-socinfo.o diff --git a/drivers/soc/vt8500/wmt-socinfo.c b/drivers/soc/vt8500/wmt-socinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..81dd6f722ede35150289a0d87cf09b95d9446948 --- /dev/null +++ b/drivers/soc/vt8500/wmt-socinfo.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2025 Alexey Charkov <alchark@gmail.com> + * Based on aspeed-socinfo.c + */ + +#include <linux/io.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/sys_soc.h> + +static struct { + const char *name; + const unsigned long id; +} const chip_id_table[] = { + /* VIA */ + { "VT8420", 0x3300 }, + { "VT8430", 0x3357 }, + { "VT8500", 0x3400 }, + + /* WonderMedia */ + { "WM8425", 0x3429 }, + { "WM8435", 0x3437 }, + { "WM8440", 0x3451 }, + { "WM8505", 0x3426 }, + { "WM8650", 0x3465 }, + { "WM8750", 0x3445 }, + { "WM8850", 0x3481 }, + { "WM8880", 0x3498 }, +}; + +static const char *sccid_to_name(unsigned long sccid) +{ + unsigned long id = sccid >> 16; + unsigned int i; + + for (i = 0 ; i < ARRAY_SIZE(chip_id_table) ; ++i) { + if (chip_id_table[i].id == id) + return chip_id_table[i].name; + } + + return "Unknown"; +} + +static const char *sccid_to_rev(unsigned long sccid) +{ + char letter, digit; + + letter = (sccid >> 8) & 0xf; + letter = (letter - 1) + 'A'; + + digit = sccid & 0xff; + digit = (digit - 1) + '0'; + + return kasprintf(GFP_KERNEL, "%c%c", letter, digit); +} + +static int __init wmt_socinfo_init(void) +{ + struct soc_device_attribute *attrs; + struct soc_device *soc_dev; + struct device_node *np; + void __iomem *reg; + unsigned long sccid; + const char *machine = NULL; + + np = of_find_compatible_node(NULL, NULL, "via,scc-id"); + if (!of_device_is_available(np)) { + of_node_put(np); + return -ENODEV; + } + + reg = of_iomap(np, 0); + if (!reg) { + of_node_put(np); + return -ENODEV; + } + sccid = readl(reg); + iounmap(reg); + + attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); + if (!attrs) + return -ENODEV; + + /* + * Machine: VIA APC Rock + * Family: WM8850 + * Revision: A2 + * SoC ID: raw silicon revision id (0x34810103) + */ + + np = of_find_node_by_path("/"); + of_property_read_string(np, "model", &machine); + if (machine) + attrs->machine = kstrdup(machine, GFP_KERNEL); + of_node_put(np); + + attrs->family = sccid_to_name(sccid); + attrs->revision = sccid_to_rev(sccid); + attrs->soc_id = kasprintf(GFP_KERNEL, "%08lx", sccid); + + soc_dev = soc_device_register(attrs); + if (IS_ERR(soc_dev)) { + kfree(attrs->machine); + kfree(attrs->soc_id); + kfree(attrs->revision); + kfree(attrs); + return PTR_ERR(soc_dev); + } + + pr_info("VIA/WonderMedia %s rev %s (%s)\n", + attrs->family, + attrs->revision, + attrs->soc_id); + + return 0; +} +early_initcall(wmt_socinfo_init); -- 2.49.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver 2025-04-23 19:18 ` [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver Alexey Charkov @ 2025-04-25 10:24 ` Krzysztof Kozlowski 2025-04-25 12:15 ` Alexey Charkov 0 siblings, 1 reply; 7+ messages in thread From: Krzysztof Kozlowski @ 2025-04-25 10:24 UTC (permalink / raw) To: Alexey Charkov, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: devicetree, linux-kernel, linux-arm-kernel On 23/04/2025 21:18, Alexey Charkov wrote: > Add a small SOC bus driver to parse the chip ID and revision made > available on VIA/WonderMedia SoCs via their system configuration > controller's SCC_ID register. ... > +#include <linux/io.h> > +#include <linux/of.h> > +#include <linux/of_address.h> > +#include <linux/of_platform.h> > +#include <linux/platform_device.h> > +#include <linux/slab.h> > +#include <linux/sys_soc.h> > + > +static struct { I think const by convention is placed here - right after static. It should be equivalent, just convention. > + const char *name; > + const unsigned long id; > +} const chip_id_table[] = { > + /* VIA */ > + { "VT8420", 0x3300 }, > + { "VT8430", 0x3357 }, > + { "VT8500", 0x3400 }, > + > + /* WonderMedia */ > + { "WM8425", 0x3429 }, > + { "WM8435", 0x3437 }, > + { "WM8440", 0x3451 }, > + { "WM8505", 0x3426 }, > + { "WM8650", 0x3465 }, > + { "WM8750", 0x3445 }, > + { "WM8850", 0x3481 }, > + { "WM8880", 0x3498 }, > +}; > + > +static const char *sccid_to_name(unsigned long sccid) > +{ > + unsigned long id = sccid >> 16; > + unsigned int i; > + > + for (i = 0 ; i < ARRAY_SIZE(chip_id_table) ; ++i) { > + if (chip_id_table[i].id == id) > + return chip_id_table[i].name; > + } > + > + return "Unknown"; > +} > + > +static const char *sccid_to_rev(unsigned long sccid) > +{ > + char letter, digit; > + > + letter = (sccid >> 8) & 0xf; > + letter = (letter - 1) + 'A'; > + > + digit = sccid & 0xff; > + digit = (digit - 1) + '0'; > + > + return kasprintf(GFP_KERNEL, "%c%c", letter, digit); > +} > + > +static int __init wmt_socinfo_init(void) > +{ > + struct soc_device_attribute *attrs; > + struct soc_device *soc_dev; > + struct device_node *np; > + void __iomem *reg; > + unsigned long sccid; > + const char *machine = NULL; > + > + np = of_find_compatible_node(NULL, NULL, "via,scc-id"); > + if (!of_device_is_available(np)) { > + of_node_put(np); > + return -ENODEV; > + } > + > + reg = of_iomap(np, 0); of_node_put(np) here... although this will be dropped (see below) > + if (!reg) { > + of_node_put(np); > + return -ENODEV; > + } > + sccid = readl(reg); > + iounmap(reg); > + > + attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); > + if (!attrs) > + return -ENODEV; > + > + /* > + * Machine: VIA APC Rock > + * Family: WM8850 > + * Revision: A2 > + * SoC ID: raw silicon revision id (0x34810103) > + */ > + > + np = of_find_node_by_path("/"); > + of_property_read_string(np, "model", &machine); > + if (machine) > + attrs->machine = kstrdup(machine, GFP_KERNEL); > + of_node_put(np); > + > + attrs->family = sccid_to_name(sccid); > + attrs->revision = sccid_to_rev(sccid); > + attrs->soc_id = kasprintf(GFP_KERNEL, "%08lx", sccid); > + > + soc_dev = soc_device_register(attrs); > + if (IS_ERR(soc_dev)) { > + kfree(attrs->machine); > + kfree(attrs->soc_id); > + kfree(attrs->revision); > + kfree(attrs); > + return PTR_ERR(soc_dev); > + } > + > + pr_info("VIA/WonderMedia %s rev %s (%s)\n", > + attrs->family, > + attrs->revision, > + attrs->soc_id); > + > + return 0; > +} > +early_initcall(wmt_socinfo_init); No, this does not scale. This is supposed to be module_platform_driver instead of manually re-ordering code. Then all your memory allocations become devm, printks become dev_xxx and you can simplify it. > Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver 2025-04-25 10:24 ` Krzysztof Kozlowski @ 2025-04-25 12:15 ` Alexey Charkov 0 siblings, 0 replies; 7+ messages in thread From: Alexey Charkov @ 2025-04-25 12:15 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel, linux-arm-kernel On Fri, Apr 25, 2025 at 2:24 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 23/04/2025 21:18, Alexey Charkov wrote: > > Add a small SOC bus driver to parse the chip ID and revision made > > available on VIA/WonderMedia SoCs via their system configuration > > controller's SCC_ID register. > > > ... > > > +#include <linux/io.h> > > +#include <linux/of.h> > > +#include <linux/of_address.h> > > +#include <linux/of_platform.h> > > +#include <linux/platform_device.h> > > +#include <linux/slab.h> > > +#include <linux/sys_soc.h> > > + > > +static struct { > > I think const by convention is placed here - right after static. It > should be equivalent, just convention. Makes sense, thank you. Will adjust in v2. > > + const char *name; > > + const unsigned long id; > > +} const chip_id_table[] = { > > + /* VIA */ > > + { "VT8420", 0x3300 }, > > + { "VT8430", 0x3357 }, > > + { "VT8500", 0x3400 }, > > + > > + /* WonderMedia */ > > + { "WM8425", 0x3429 }, > > + { "WM8435", 0x3437 }, > > + { "WM8440", 0x3451 }, > > + { "WM8505", 0x3426 }, > > + { "WM8650", 0x3465 }, > > + { "WM8750", 0x3445 }, > > + { "WM8850", 0x3481 }, > > + { "WM8880", 0x3498 }, > > +}; > > + > > +static const char *sccid_to_name(unsigned long sccid) > > +{ > > + unsigned long id = sccid >> 16; > > + unsigned int i; > > + > > + for (i = 0 ; i < ARRAY_SIZE(chip_id_table) ; ++i) { > > + if (chip_id_table[i].id == id) > > + return chip_id_table[i].name; > > + } > > + > > + return "Unknown"; > > +} > > + > > +static const char *sccid_to_rev(unsigned long sccid) > > +{ > > + char letter, digit; > > + > > + letter = (sccid >> 8) & 0xf; > > + letter = (letter - 1) + 'A'; > > + > > + digit = sccid & 0xff; > > + digit = (digit - 1) + '0'; > > + > > + return kasprintf(GFP_KERNEL, "%c%c", letter, digit); > > +} > > + > > +static int __init wmt_socinfo_init(void) > > +{ > > + struct soc_device_attribute *attrs; > > + struct soc_device *soc_dev; > > + struct device_node *np; > > + void __iomem *reg; > > + unsigned long sccid; > > + const char *machine = NULL; > > + > > + np = of_find_compatible_node(NULL, NULL, "via,scc-id"); > > + if (!of_device_is_available(np)) { > > + of_node_put(np); > > + return -ENODEV; > > + } > > + > > + reg = of_iomap(np, 0); > > of_node_put(np) here... although this will be dropped (see below) > > > > + if (!reg) { > > + of_node_put(np); > > + return -ENODEV; > > + } > > + sccid = readl(reg); > > + iounmap(reg); > > + > > + attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); > > + if (!attrs) > > + return -ENODEV; > > + > > + /* > > + * Machine: VIA APC Rock > > + * Family: WM8850 > > + * Revision: A2 > > + * SoC ID: raw silicon revision id (0x34810103) > > + */ > > + > > + np = of_find_node_by_path("/"); > > + of_property_read_string(np, "model", &machine); > > + if (machine) > > + attrs->machine = kstrdup(machine, GFP_KERNEL); > > + of_node_put(np); > > + > > + attrs->family = sccid_to_name(sccid); > > + attrs->revision = sccid_to_rev(sccid); > > + attrs->soc_id = kasprintf(GFP_KERNEL, "%08lx", sccid); > > + > > + soc_dev = soc_device_register(attrs); > > + if (IS_ERR(soc_dev)) { > > + kfree(attrs->machine); > > + kfree(attrs->soc_id); > > + kfree(attrs->revision); > > + kfree(attrs); > > + return PTR_ERR(soc_dev); > > + } > > + > > + pr_info("VIA/WonderMedia %s rev %s (%s)\n", > > + attrs->family, > > + attrs->revision, > > + attrs->soc_id); > > + > > + return 0; > > +} > > +early_initcall(wmt_socinfo_init); > > No, this does not scale. This is supposed to be module_platform_driver > instead of manually re-ordering code. Then all your memory allocations > become devm, printks become dev_xxx and you can simplify it. Fair enough. Will convert into a platform driver and use managed functions. Thanks for pointing this out! Best regards, Alexey ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] ARM: dts: vt8500: add DT nodes for the system config ID register 2025-04-23 19:18 [PATCH 0/3] ARM: vt8500: Add runtime SoC version identification Alexey Charkov 2025-04-23 19:18 ` [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification Alexey Charkov 2025-04-23 19:18 ` [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver Alexey Charkov @ 2025-04-23 19:18 ` Alexey Charkov 2 siblings, 0 replies; 7+ messages in thread From: Alexey Charkov @ 2025-04-23 19:18 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Krzysztof Kozlowski Cc: devicetree, linux-kernel, linux-arm-kernel, Alexey Charkov Every VIA/WonderMedia SoC has a 32-bit chip ID register at the MMIO address 0xd8120000. Add respective device tree nodes to let the system code access it at runtime for the selection of appropriate hardware quirks where needed. Signed-off-by: Alexey Charkov <alchark@gmail.com> --- arch/arm/boot/dts/vt8500/vt8500.dtsi | 5 +++++ arch/arm/boot/dts/vt8500/wm8505.dtsi | 5 +++++ arch/arm/boot/dts/vt8500/wm8650.dtsi | 5 +++++ arch/arm/boot/dts/vt8500/wm8750.dtsi | 5 +++++ arch/arm/boot/dts/vt8500/wm8850.dtsi | 5 +++++ 5 files changed, 25 insertions(+) diff --git a/arch/arm/boot/dts/vt8500/vt8500.dtsi b/arch/arm/boot/dts/vt8500/vt8500.dtsi index f23cb5ee11ae63222276c8ac178c52a6a3872c0c..1f81f0cbdb7e2c2378b62e40afd3675303bf8cc1 100644 --- a/arch/arm/boot/dts/vt8500/vt8500.dtsi +++ b/arch/arm/boot/dts/vt8500/vt8500.dtsi @@ -55,6 +55,11 @@ pinctrl: pinctrl@d8110000 { #gpio-cells = <2>; }; + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; + pmc@d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>; diff --git a/arch/arm/boot/dts/vt8500/wm8505.dtsi b/arch/arm/boot/dts/vt8500/wm8505.dtsi index d9e1280372c55c5080d242014c2392eaf4335d11..adc239a9999995c077dda0e2ef3a76066264bb8c 100644 --- a/arch/arm/boot/dts/vt8500/wm8505.dtsi +++ b/arch/arm/boot/dts/vt8500/wm8505.dtsi @@ -66,6 +66,11 @@ pinctrl: pinctrl@d8110000 { #gpio-cells = <2>; }; + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; + pmc@d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>; diff --git a/arch/arm/boot/dts/vt8500/wm8650.dtsi b/arch/arm/boot/dts/vt8500/wm8650.dtsi index 35d12d77efc0f91e3735b98b8ec1f25a62c9c22e..2139d183a92b18583884f9329ad286e9da98c066 100644 --- a/arch/arm/boot/dts/vt8500/wm8650.dtsi +++ b/arch/arm/boot/dts/vt8500/wm8650.dtsi @@ -62,6 +62,11 @@ pinctrl: pinctrl@d8110000 { #gpio-cells = <2>; }; + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; + pmc@d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>; diff --git a/arch/arm/boot/dts/vt8500/wm8750.dtsi b/arch/arm/boot/dts/vt8500/wm8750.dtsi index b292f85d4e69b43d6eeb4525113265722a7b90af..5b2d3697418dbe668fa3b8586b0c98f2efa6bfb7 100644 --- a/arch/arm/boot/dts/vt8500/wm8750.dtsi +++ b/arch/arm/boot/dts/vt8500/wm8750.dtsi @@ -68,6 +68,11 @@ pinctrl: pinctrl@d8110000 { #gpio-cells = <2>; }; + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; + pmc@d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>; diff --git a/arch/arm/boot/dts/vt8500/wm8850.dtsi b/arch/arm/boot/dts/vt8500/wm8850.dtsi index c61717ebb4f1f3523733241c4df11f741ad4ae14..2c4922933875c9c31ea7c979aa8cbcc3d9a934a5 100644 --- a/arch/arm/boot/dts/vt8500/wm8850.dtsi +++ b/arch/arm/boot/dts/vt8500/wm8850.dtsi @@ -65,6 +65,11 @@ pinctrl: pinctrl@d8110000 { #gpio-cells = <2>; }; + system-configuration@d8120000 { + compatible = "via,scc-id"; + reg = <0xd8120000 0x4>; + }; + pmc@d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>; -- 2.49.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-04-25 12:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-04-23 19:18 [PATCH 0/3] ARM: vt8500: Add runtime SoC version identification Alexey Charkov 2025-04-23 19:18 ` [PATCH 1/3] dt-bindings: soc: Add VIA/WonderMedia SoC identification Alexey Charkov 2025-04-25 10:20 ` Krzysztof Kozlowski 2025-04-23 19:18 ` [PATCH 2/3] soc: Add VIA/WonderMedia SoC identification driver Alexey Charkov 2025-04-25 10:24 ` Krzysztof Kozlowski 2025-04-25 12:15 ` Alexey Charkov 2025-04-23 19:18 ` [PATCH 3/3] ARM: dts: vt8500: add DT nodes for the system config ID register Alexey Charkov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®