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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmgjIYoQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD18JUEACTXFpQjEK3AUpWP4liNGOY/qJnCGpQTgIZ
 4WDw3FXgYzvPLFpvBaD0aJ7MNvA3px598OwU8WPTkGHUOMwHrDbEORJ9PUY+21WX
 CamGmF/GheI3ek87fszM7U6/YQpejPO3evAY9e4Izfzwvb+C+ODj/RtC2dvHtWWe
 fD0mHZXJtNGc79xnpM63TxuemVsOESBioW6axO/d+PV9aJW35IcFtvvIGLDD/WEY
 2X8zyOkXDy0E/c4Ub1TVrVkL1JA0WtuuDPlf2oYC67fCBiXQ4PAUDwV9rAsZCGpV
 k1LVTyN8keXTqCKN2eVOC3NhRkKA6h+nc1Htx3XPlH7MUIXfcd5s+X4Jc0T5LBK4
 nbJQY9WX/v1HBs7vr7gXiCnAviysyq0f8i//PRLQ8z/RjTeR+qQvqbMFpRnrLRjg
 tUkfrDC724STQ28cd1VdvsXVswxjlynzr9aBXyUQ7KnjUNynH9U9PpMFGooSjWig
 XPLF0WMsC+EKwOHiQvQ3RRZoZ0crCsnmeaV+DnPNnT76MUd/Hiyj26YOaNig2WY9
 /+jSHhG+dxAidJA/T3NeKtE/pnVDYrp+oJeTq9AjmScks6iG1KlIl66GTl272l30
 tDrRgxPKtGJ8gvXiN7MlUTRnZ5f3tRE7zgxQFHInNK25E28ib4EiiMrVaqXEray4
 vSwZ9/58WQ==
 =6hU1
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmguC8YACgkQmmx57+YA
 GNlR0BAAsQGpiQO7x7emmI894OvdZjZPiW+MO+j3kJRvr9KphufAwIS9spiHhaV2
 mElqQBFfmzmfsx6PYaQEzRnb0oDrbmDBBcv23fH7gh+WXsBd0ZMHFs98GspPuriV
 U6p2SGK/EL7h7siIE/9fxgQK+DtgPsbTI1ehrHDrGE9J1OwjI1cpzfvT7KVvMiBl
 eLuMp+lFw9GZfPq5q8HnNdEADF5bNREkiSOY4omUOU4RFfVPmwzhD4yh7S4zHEeZ
 uz2D5jRum33rimCk7CpCAHimVmCUcSwS6RZ8Mozr0eDa80f9yWXF0/OCtp2Q59iO
 jINVnLDdgNlqehmioR7SrFT3hh02jeDroNJ7bA8JNKlZlr5JQCtG0Z39siu8ixYM
 Hd4WrBHbhNH29+lhyrztIofakOHdoKs+aRSFXan3C07VMJ9wzmQuM9+NshdncVlY
 LvMDVKri3mB3aemucsMx7Mf1ltBX1nwWejzl4bgy7zA3b40SvxXF/X2Tr6F7rEhK
 WPQDIOuK6g4h/4b2p7jOShageVmMkBiCvRUnEa1yjBBWN0LKXREL/zFRnouk6gm9
 4tMojE43moN2ca23k0eVo4rwKcJkFmQkfypsUtZzz5jkJ5E7VNrLkmLjg91krRv1
 /Wi7qZ4k4xFNhc2oDRIo9M966AMMcVaUMXVTzG1WktVJEbFek4U=
 =XZ7C
 -----END PGP SIGNATURE-----

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/20250513104216.25803-6-krzysztof.kozlowski@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2025-05-21 19:22:13 +02:00
commit 5bba2c4675
8 changed files with 187 additions and 5 deletions

View File

@ -0,0 +1,37 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/hwinfo/via,vt8500-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,vt8500-scc-id
reg:
maxItems: 1
required:
- compatible
- reg
additionalProperties: false
examples:
- |
chipid@d8120000 {
compatible = "via,vt8500-scc-id";
reg = <0xd8120000 0x4>;
};

View File

@ -3428,6 +3428,7 @@ M: Alexey Charkov <alchark@gmail.com>
M: Krzysztof Kozlowski <krzk@kernel.org>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Odd Fixes
F: Documentation/devicetree/bindings/hwinfo/via,vt8500-scc-id.yaml
F: Documentation/devicetree/bindings/i2c/i2c-wmt.txt
F: arch/arm/boot/dts/vt8500/
F: arch/arm/mach-vt8500/
@ -3436,6 +3437,7 @@ F: drivers/i2c/busses/i2c-viai2c-wmt.c
F: drivers/mmc/host/wmt-sdmmc.c
F: drivers/pwm/pwm-vt8500.c
F: drivers/rtc/rtc-vt8500.c
F: drivers/soc/vt8500/
F: drivers/tty/serial/vt8500_serial.c
F: drivers/video/fbdev/vt8500lcdfb.*
F: drivers/video/fbdev/wm8505fb*

View File

@ -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

View File

@ -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/

View File

@ -232,11 +232,6 @@ static inline void qe_ic_write(__be32 __iomem *base, unsigned int reg,
iowrite32be(value, base + (reg >> 2));
}
static inline struct qe_ic *qe_ic_from_irq(unsigned int virq)
{
return irq_get_chip_data(virq);
}
static inline struct qe_ic *qe_ic_from_irq_data(struct irq_data *d)
{
return irq_data_get_irq_chip_data(d);

View File

@ -0,0 +1,19 @@
# 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
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

View File

@ -0,0 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_WMT_SOCINFO) += wmt-socinfo.o

View File

@ -0,0 +1,125 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright 2025 Alexey Charkov <alchark@gmail.com>
* Based on aspeed-socinfo.c
*/
#include <linux/dev_printk.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/sys_soc.h>
static const struct {
const char *name;
const u32 id;
} 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(u32 sccid)
{
u32 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 int wmt_socinfo_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct soc_device_attribute *attrs;
struct soc_device *soc_dev;
char letter, digit;
void __iomem *reg;
u32 sccid;
reg = devm_of_iomap(&pdev->dev, np, 0, NULL);
if (IS_ERR(reg))
return PTR_ERR(reg);
sccid = readl(reg);
attrs = devm_kzalloc(&pdev->dev, sizeof(*attrs), GFP_KERNEL);
if (!attrs)
return -ENOMEM;
/*
* Machine: VIA APC Rock
* Family: WM8850
* Revision: A2
* SoC ID: raw silicon revision id (34810103 in hexadecimal)
*/
attrs->family = sccid_to_name(sccid);
letter = (sccid >> 8) & 0xf;
letter = (letter - 1) + 'A';
digit = sccid & 0xff;
digit = (digit - 1) + '0';
attrs->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL,
"%c%c", letter, digit);
attrs->soc_id = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%08x", sccid);
if (!attrs->revision || !attrs->soc_id)
return -ENOMEM;
soc_dev = soc_device_register(attrs);
if (IS_ERR(soc_dev))
return PTR_ERR(soc_dev);
dev_info(&pdev->dev,
"VIA/WonderMedia %s rev %s (%s)\n",
attrs->family,
attrs->revision,
attrs->soc_id);
platform_set_drvdata(pdev, soc_dev);
return 0;
}
static void wmt_socinfo_remove(struct platform_device *pdev)
{
struct soc_device *soc_dev = platform_get_drvdata(pdev);
soc_device_unregister(soc_dev);
}
static const struct of_device_id wmt_socinfo_ids[] = {
{ .compatible = "via,vt8500-scc-id" },
{ /* Sentinel */ },
};
static struct platform_driver wmt_socinfo = {
.probe = wmt_socinfo_probe,
.remove = wmt_socinfo_remove,
.driver = {
.name = "wmt-socinfo",
.of_match_table = wmt_socinfo_ids,
},
};
module_platform_driver(wmt_socinfo);
MODULE_AUTHOR("Alexey Charkov <alchark@gmail.com>");
MODULE_DESCRIPTION("VIA/WonderMedia socinfo driver");
MODULE_LICENSE("GPL");