soc: nuvoton: Add SoC info driver for WPCM450
Jonathan Neuschäfer
maintainerPATCH v4 1/1 soc: nuvoton: Add SoC info driver for WPCM450
Add a SoC information driver for Nuvoton WPCM450 SoCs. It provides information such as the SoC revision.
Usage example:
# grep . /sys/devices/soc0/* /sys/devices/soc0/family:Nuvoton NPCM /sys/devices/soc0/revision:A3 /sys/devices/soc0/soc_id:WPCM450
---
v4:
- rebase on 5.19-rc1
v3:
- Declare revisions array as static
- Change get_revision parameter to unsigned int
- Add Paul's R-b tag
- Add usage example
- Sort includes
v2:
- https://lore.kernel.org/lkml/[email protected]/
- Add R-b tag
- rebase on 5.18-rc1
v1:
- https://lore.kernel.org/lkml/[email protected]/
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/nuvoton/Kconfig | 11 ++++ drivers/soc/nuvoton/Makefile | 2 + drivers/soc/nuvoton/wpcm450-soc.c | 90 +++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 drivers/soc/nuvoton/Kconfig create mode 100644 drivers/soc/nuvoton/Makefile create mode 100644 drivers/soc/nuvoton/wpcm450-soc.c
drivers/soc/Kconfig +1 -0
@@ -14,6 +14,7 @@ source "drivers/soc/ixp4xx/Kconfig" source "drivers/soc/litex/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/microchip/Kconfig" +source "drivers/soc/nuvoton/Kconfig" source "drivers/soc/pxa/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/renesas/Kconfig"
drivers/soc/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_SOC_XWAY) += lantiq/ obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/ obj-y += mediatek/ obj-y += microchip/ +obj-y += nuvoton/ obj-y += pxa/ obj-y += amlogic/ obj-y += qcom/
drivers/soc/nuvoton/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +menuconfig WPCM450_SOC + bool "Nuvoton WPCM450 SoC driver" + default y if ARCH_WPCM450 + select SOC_BUS + help + Say Y here to compile the SoC information driver for Nuvoton + WPCM450 SoCs. + + This driver provides information such as the SoC model and + revision.
drivers/soc/nuvoton/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_WPCM450_SOC) += wpcm450-soc.o
drivers/soc/nuvoton/wpcm450-soc.c new file +90 -0
90 lines not on this page · raw message
--
2.35.1
Quoted 6 lines · Jonathan Neuschäfer
Add a SoC information driver for Nuvoton WPCM450 SoCs. It provides information such as the SoC revision.
Usage example:
Quoted 8 lines
# grep . /sys/devices/soc0/* /sys/devices/soc0/family:Nuvoton NPCM /sys/devices/soc0/revision:A3 /sys/devices/soc0/soc_id:WPCM450Signed-off-by Jonathan Neuschäfer <[email protected]>Reviewed-by Joel Stanley <[email protected]>Reviewed-by Paul Menzel <[email protected]>
Looks good overall.
drivers/soc/nuvoton/Kconfig line 4
Quoted 3 lines
drivers/soc/nuvoton/Kconfig new file +3
-0+menuconfig WPCM450_SOC + bool "Nuvoton WPCM450 SoC driver" + default y if ARCH_WPCM450
It would be nice to make this a tristate option, as we generally like to keep optional drivers out of the allmodconfig vmlinux file, even if this is a tiny one.
Just add the trivial cleanup function and MODULE_LICENSE() etc tags.
Arnd
Jonathan Neuschäfer
maintainerQuoted 19 lines · Arnd Bergmann
Quoted 6 lines · Jonathan Neuschäfer
Add a SoC information driver for Nuvoton WPCM450 SoCs. It provides information such as the SoC revision.
Usage example:
Quoted 8 lines
# grep . /sys/devices/soc0/* /sys/devices/soc0/family:Nuvoton NPCM /sys/devices/soc0/revision:A3 /sys/devices/soc0/soc_id:WPCM450Signed-off-by Jonathan Neuschäfer <[email protected]>Reviewed-by Joel Stanley <[email protected]>Reviewed-by Paul Menzel <[email protected]>Looks good overall.
Quoted 7 lines
drivers/soc/nuvoton/Kconfig line 4
Quoted 3 lines
drivers/soc/nuvoton/Kconfig new file +3
-0+menuconfig WPCM450_SOC + bool "Nuvoton WPCM450 SoC driver" + default y if ARCH_WPCM450It would be nice to make this a tristate option, as we generally like to keep optional drivers out of the allmodconfig vmlinux file, even if this is a tiny one.
Ok.
Quoted 1 line
Just add the trivial cleanup function and
MODULE_LICENSE()etc tags.
The right thing to do seems to be to unregister the SoC device in the cleanup function. Is that what you mean?
Jonathan
Quoted 4 lines · Jonathan Neuschäfer
Quoted 1 line
Just add the trivial cleanup function and
MODULE_LICENSE()etc tags.The right thing to do seems to be to unregister the SoC device in the cleanup function. Is that what you mean?
Yes, plus kfree() the soc_device_attribute, or make it statically allocated.
Arnd