Skip to content

Commit 5bba2c4

Browse files
committed
Merge tag 'soc-drivers-6.16' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt into soc/drivers
VT8500 (and FSL) SoC drivers for v6.16 1. VT8500: Add SCC socinfo/hwinfo driver. 2. Cleanup unused function in PowerPC Freescale QE driver to have W=1 builds warnings free. * tag 'soc-drivers-6.16' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux-dt: soc: fsl: qe: remove unused qe_ic_from_irq function ARM: vt8500: MAINTAINERS: Include vt8500 soc driver in maintainers entry soc: Add VIA/WonderMedia SoC identification driver dt-bindings: hwinfo: Add VIA/WonderMedia SoC identification Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 382af52 + d47f123 commit 5bba2c4

File tree

8 files changed

+187
-5
lines changed

8 files changed

+187
-5
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/hwinfo/via,vt8500-scc-id.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: VIA/WonderMedia SoC system configuration information
8+
9+
maintainers:
10+
- Alexey Charkov <[email protected]>
11+
12+
description:
13+
The system configuration controller on VIA/WonderMedia SoC's contains a chip
14+
identifier and revision used to differentiate between different hardware
15+
versions of on-chip IP blocks having their own peculiarities which may or
16+
may not be captured by their respective DT compatible strings
17+
18+
properties:
19+
compatible:
20+
items:
21+
- const: via,vt8500-scc-id
22+
23+
reg:
24+
maxItems: 1
25+
26+
required:
27+
- compatible
28+
- reg
29+
30+
additionalProperties: false
31+
32+
examples:
33+
- |
34+
chipid@d8120000 {
35+
compatible = "via,vt8500-scc-id";
36+
reg = <0xd8120000 0x4>;
37+
};

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,6 +3428,7 @@ M: Alexey Charkov <[email protected]>
34283428
M: Krzysztof Kozlowski <[email protected]>
34293429
L: [email protected] (moderated for non-subscribers)
34303430
S: Odd Fixes
3431+
F: Documentation/devicetree/bindings/hwinfo/via,vt8500-scc-id.yaml
34313432
F: Documentation/devicetree/bindings/i2c/i2c-wmt.txt
34323433
F: arch/arm/boot/dts/vt8500/
34333434
F: arch/arm/mach-vt8500/
@@ -3436,6 +3437,7 @@ F: drivers/i2c/busses/i2c-viai2c-wmt.c
34363437
F: drivers/mmc/host/wmt-sdmmc.c
34373438
F: drivers/pwm/pwm-vt8500.c
34383439
F: drivers/rtc/rtc-vt8500.c
3440+
F: drivers/soc/vt8500/
34393441
F: drivers/tty/serial/vt8500_serial.c
34403442
F: drivers/video/fbdev/vt8500lcdfb.*
34413443
F: drivers/video/fbdev/wm8505fb*

drivers/soc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ source "drivers/soc/tegra/Kconfig"
2828
source "drivers/soc/ti/Kconfig"
2929
source "drivers/soc/ux500/Kconfig"
3030
source "drivers/soc/versatile/Kconfig"
31+
source "drivers/soc/vt8500/Kconfig"
3132
source "drivers/soc/xilinx/Kconfig"
3233

3334
endmenu

drivers/soc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ obj-$(CONFIG_ARCH_TEGRA) += tegra/
3434
obj-y += ti/
3535
obj-$(CONFIG_ARCH_U8500) += ux500/
3636
obj-y += versatile/
37+
obj-y += vt8500/
3738
obj-y += xilinx/

drivers/soc/fsl/qe/qe_ic.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,6 @@ static inline void qe_ic_write(__be32 __iomem *base, unsigned int reg,
232232
iowrite32be(value, base + (reg >> 2));
233233
}
234234

235-
static inline struct qe_ic *qe_ic_from_irq(unsigned int virq)
236-
{
237-
return irq_get_chip_data(virq);
238-
}
239-
240235
static inline struct qe_ic *qe_ic_from_irq_data(struct irq_data *d)
241236
{
242237
return irq_data_get_irq_chip_data(d);

drivers/soc/vt8500/Kconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
3+
if ARCH_VT8500 || COMPILE_TEST
4+
5+
menu "VIA/WonderMedia SoC drivers"
6+
7+
config WMT_SOCINFO
8+
bool "VIA/WonderMedia SoC Information driver"
9+
default ARCH_VT8500
10+
select SOC_BUS
11+
help
12+
Say yes to support decoding of VIA/WonderMedia system configuration
13+
register information. This currently includes just the chip ID register
14+
which helps identify the exact hardware revision of the SoC the kernel
15+
is running on (to know if any revision-specific quirks are required)
16+
17+
endmenu
18+
19+
endif

drivers/soc/vt8500/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
obj-$(CONFIG_WMT_SOCINFO) += wmt-socinfo.o

drivers/soc/vt8500/wmt-socinfo.c

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/*
3+
* Copyright 2025 Alexey Charkov <[email protected]>
4+
* Based on aspeed-socinfo.c
5+
*/
6+
7+
#include <linux/dev_printk.h>
8+
#include <linux/device.h>
9+
#include <linux/io.h>
10+
#include <linux/of.h>
11+
#include <linux/platform_device.h>
12+
#include <linux/sys_soc.h>
13+
14+
static const struct {
15+
const char *name;
16+
const u32 id;
17+
} chip_id_table[] = {
18+
/* VIA */
19+
{ "VT8420", 0x3300 },
20+
{ "VT8430", 0x3357 },
21+
{ "VT8500", 0x3400 },
22+
23+
/* WonderMedia */
24+
{ "WM8425", 0x3429 },
25+
{ "WM8435", 0x3437 },
26+
{ "WM8440", 0x3451 },
27+
{ "WM8505", 0x3426 },
28+
{ "WM8650", 0x3465 },
29+
{ "WM8750", 0x3445 },
30+
{ "WM8850", 0x3481 },
31+
{ "WM8880", 0x3498 },
32+
};
33+
34+
static const char *sccid_to_name(u32 sccid)
35+
{
36+
u32 id = sccid >> 16;
37+
unsigned int i;
38+
39+
for (i = 0 ; i < ARRAY_SIZE(chip_id_table) ; ++i) {
40+
if (chip_id_table[i].id == id)
41+
return chip_id_table[i].name;
42+
}
43+
44+
return "Unknown";
45+
}
46+
47+
static int wmt_socinfo_probe(struct platform_device *pdev)
48+
{
49+
struct device_node *np = pdev->dev.of_node;
50+
struct soc_device_attribute *attrs;
51+
struct soc_device *soc_dev;
52+
char letter, digit;
53+
void __iomem *reg;
54+
u32 sccid;
55+
56+
reg = devm_of_iomap(&pdev->dev, np, 0, NULL);
57+
if (IS_ERR(reg))
58+
return PTR_ERR(reg);
59+
60+
sccid = readl(reg);
61+
62+
attrs = devm_kzalloc(&pdev->dev, sizeof(*attrs), GFP_KERNEL);
63+
if (!attrs)
64+
return -ENOMEM;
65+
66+
/*
67+
* Machine: VIA APC Rock
68+
* Family: WM8850
69+
* Revision: A2
70+
* SoC ID: raw silicon revision id (34810103 in hexadecimal)
71+
*/
72+
73+
attrs->family = sccid_to_name(sccid);
74+
75+
letter = (sccid >> 8) & 0xf;
76+
letter = (letter - 1) + 'A';
77+
digit = sccid & 0xff;
78+
digit = (digit - 1) + '0';
79+
attrs->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL,
80+
"%c%c", letter, digit);
81+
82+
attrs->soc_id = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%08x", sccid);
83+
84+
if (!attrs->revision || !attrs->soc_id)
85+
return -ENOMEM;
86+
87+
soc_dev = soc_device_register(attrs);
88+
if (IS_ERR(soc_dev))
89+
return PTR_ERR(soc_dev);
90+
91+
dev_info(&pdev->dev,
92+
"VIA/WonderMedia %s rev %s (%s)\n",
93+
attrs->family,
94+
attrs->revision,
95+
attrs->soc_id);
96+
97+
platform_set_drvdata(pdev, soc_dev);
98+
return 0;
99+
}
100+
101+
static void wmt_socinfo_remove(struct platform_device *pdev)
102+
{
103+
struct soc_device *soc_dev = platform_get_drvdata(pdev);
104+
105+
soc_device_unregister(soc_dev);
106+
}
107+
108+
static const struct of_device_id wmt_socinfo_ids[] = {
109+
{ .compatible = "via,vt8500-scc-id" },
110+
{ /* Sentinel */ },
111+
};
112+
113+
static struct platform_driver wmt_socinfo = {
114+
.probe = wmt_socinfo_probe,
115+
.remove = wmt_socinfo_remove,
116+
.driver = {
117+
.name = "wmt-socinfo",
118+
.of_match_table = wmt_socinfo_ids,
119+
},
120+
};
121+
module_platform_driver(wmt_socinfo);
122+
123+
MODULE_AUTHOR("Alexey Charkov <[email protected]>");
124+
MODULE_DESCRIPTION("VIA/WonderMedia socinfo driver");
125+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)