Convert National Semiconductor GPIO drivers to gpiolib
Subsystems (8)
Linus Walleij
maintainercover Convert National Semiconductor GPIO drivers to gpiolib
This is an obvious attack patch to see if anyone is really using the custom API from these deviant drivers/char/* GPIO drivers from the early 2000s.
Probe PC8736x through the ISA bus API and create the SCx200 GPIO device from its PCI bridge. Register both controllers with gpiolib using port I/O. Describe the net48xx and WRAP LED GPIOs with software nodes and switch both LED drivers to descriptors.
Remove the private GPIO API and per-pin character devices. We assume there are no remaining users of the old NSC GPIO userspace ABI.
An LLM assisted in the implementation and x86-32 build checks.
---
Linus Walleij (3):
gpio: convert PC8736x to gpiolib
gpio: convert SCx200 to gpiolib and use descriptors for board LEDs
gpio: remove the legacy NSC GPIO API
MAINTAINERS | 6 +- arch/x86/platform/scx200/scx200_32.c | 90 ++++----- drivers/char/Kconfig | 33 ---- drivers/char/Makefile | 3 - drivers/char/nsc_gpio.c | 126 ------------- drivers/char/pc8736x_gpio.c | 352 ----------------------------------- drivers/char/scx200_gpio.c | 138 -------------- drivers/gpio/Kconfig | 22 +++ drivers/gpio/Makefile | 2 + drivers/gpio/gpio-pc8736x.c | 264 ++++++++++++++++++++++++++ drivers/gpio/gpio-scx200.c | 245 ++++++++++++++++++++++++ drivers/leds/leds-net48xx.c | 85 +++++---- drivers/leds/leds-wrap.c | 143 +++++++------- include/linux/nsc_gpio.h | 41 ---- include/linux/scx200.h | 1 + include/linux/scx200_gpio.h | 89 --------- 16 files changed, 697 insertions(+), 943 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261123-b4-nsc-gpio-87547fbbf7b4
Best regards,
Signature · 1 line
Linus Walleij <[email protected]>
Linus Walleij
maintainerPATCH 1/3 gpio: convert PC8736x to gpiolib
Move the PC8736x over to gpiolib.
Keep the legacy character device during the conversion. Both interfaces use the same register access and locking.
--- MAINTAINERS | 2 +- drivers/char/Kconfig | 13 -- drivers/char/Makefile | 1 - drivers/char/pc8736x_gpio.c | 352 ----------------------------------------- drivers/gpio/Kconfig | 13 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-pc8736x.c | 376 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 391 insertions(+), 367 deletions(-)
MAINTAINERS +1 -1
@@ -21262,7 +21262,7 @@ F: drivers/hwmon/pc87360.c PC8736x GPIO DRIVER M: Jim Cromie <[email protected]> S: Maintained -F: drivers/char/pc8736x_gpio.c +F: drivers/gpio/gpio-pc8736x.c PC87427 HARDWARE MONITORING DRIVER M: Jean Delvare <[email protected]>
drivers/char/Kconfig +0 -13
@@ -233,19 +233,6 @@ config SCx200_GPIO If compiled as a module, it will be called scx200_gpio. -config PC8736x_GPIO - tristate "NatSemi PC8736x GPIO Support" - depends on X86_32 && !UML - default SCx200_GPIO # mostly N - select NSC_GPIO # needed for support routines - help - Give userspace access to the GPIO pins on the National - Semiconductor PC-8736x (x=[03456]) SuperIO chip. The chip - has multiple functional units, inc several managed by - hwmon/pc87360 driver. Tested with PC-87366 - - If compiled as a module, it will be called pc8736x_gpio. - config NSC_GPIO tristate "NatSemi Base GPIO Support" depends on X86_32
drivers/char/Makefile +0 -1
@@ -27,7 +27,6 @@ obj-$(CONFIG_PPDEV) += ppdev.o obj-$(CONFIG_NWBUTTON) += nwbutton.o obj-$(CONFIG_NWFLASH) += nwflash.o obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o -obj-$(CONFIG_PC8736x_GPIO) += pc8736x_gpio.o obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_TELCLOCK) += tlclk.o
drivers/char/pc8736x_gpio.c deleted +0 -352
352 lines not on this page · raw message
drivers/gpio/Kconfig +13 -0
@@ -1093,6 +1093,19 @@ config GPIO_IT87 To compile this driver as a module, choose M here: the module will be called gpio_it87. +config PC8736x_GPIO + tristate "NatSemi PC87365/PC87366 GPIO support" + depends on X86_32 + default SCx200_GPIO + select ISA_BUS_API + select NSC_GPIO + help + Support the GPIO controller in the National Semiconductor + PC87365 and PC87366 Super I/O chips. The GPIO logical device + must already be enabled by the firmware. + + This driver can also be built as a module called gpio-pc8736x. + config GPIO_SCH tristate "Intel SCH/TunnelCreek/Centerton/Quark X1000 GPIO" depends on (X86 || COMPILE_TEST) && ACPI
drivers/gpio/Makefile +1 -0
@@ -142,6 +142,7 @@ obj-$(CONFIG_GPIO_NPCM_SGPIO) += gpio-npcm-sgpio.o obj-$(CONFIG_GPIO_OCTEON) += gpio-octeon.o obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o obj-$(CONFIG_GPIO_PALMAS) += gpio-palmas.o +obj-$(CONFIG_PC8736x_GPIO) += gpio-pc8736x.o obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o obj-$(CONFIG_GPIO_PCA9570) += gpio-pca9570.o obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
drivers/gpio/gpio-pc8736x.c new file +376 -0
376 lines not on this page · raw message
Signature · 1 line
2.56.1
Arnd Bergmann
maintainerRe: [PATCH 1/3] gpio: convert PC8736x to gpiolib
Quoted 8 lines · Linus Walleij
Move the PC8736x over to gpiolib.
Keep the legacy character device during the conversion. Both interfaces use the same register access and locking.
The driver looks fine and I'm glad to have the old one out of drivers/char.
In the changelog text, please mention that you don't actually use the hardware and link to the last time we discussed this one at
https://lore.kernel.org/all/CAJfuBxztAe3vzzviGH3QJnhU7F68ecrafTLUoaR4BMskMp__3Q@mail.gmail.com/
so that the next time we consider removing it, your patch does not give the impression that you actually need the driver.
Arnd
Linus Walleij
maintainerPATCH 2/3 gpio: convert SCx200 to gpiolib and use descriptors for board LEDs
In reply to Linus WalleijCreate a platform device for the GPIO I/O ports of the SCx200 PCI bridge. Keep the configuration block in the PCI driver for the timer, watchdog and flash drivers.
Expose the first GPIO bank. Exclude the package-reserved pins on the SC1100 and SCx200 variants. Serialize updates to the output latch and indexed configuration registers.
Keep the legacy character device
working through the same register operations for now.
Attach a software node to the GPIO provider. Reference that node from the net48xx and WRAP LED devices and switch both LED drivers to GPIO descriptors.
--- MAINTAINERS | 4 +- arch/x86/platform/scx200/scx200_32.c | 90 +++----- drivers/char/Kconfig | 10 - drivers/char/Makefile | 1 - drivers/char/scx200_gpio.c | 138 ------------ drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-scx200.c | 400 +++++++++++++++++++++++++++++++++++ drivers/leds/leds-net48xx.c | 85 +++++--- drivers/leds/leds-wrap.c | 143 +++++++------ include/linux/scx200.h | 1 + include/linux/scx200_gpio.h | 89 -------- 12 files changed, 575 insertions(+), 398 deletions(-)
MAINTAINERS +2 -2
@@ -25256,8 +25256,8 @@ F: include/linux/scx200.h SCx200 GPIO DRIVER M: Jim Cromie <[email protected]> S: Maintained -F: drivers/char/scx200_gpio.c -F: include/linux/scx200_gpio.h +F: drivers/gpio/gpio-scx200.c +F: include/linux/scx200.h SCx200 HRT CLOCKSOURCE DRIVER M: Jim Cromie <[email protected]>
arch/x86/platform/scx200/scx200_32.c +34 -56
137 lines not on this page · raw message
drivers/char/Kconfig +0 -10
@@ -223,16 +223,6 @@ config SONYPI To compile this driver as a module, choose M here: the module will be called sonypi. -config SCx200_GPIO - tristate "NatSemi SCx200 GPIO Support" - depends on SCx200 - select NSC_GPIO - help - Give userspace access to the GPIO pins on the National - Semiconductor SCx200 processors. - - If compiled as a module, it will be called scx200_gpio. - config NSC_GPIO tristate "NatSemi Base GPIO Support" depends on X86_32
drivers/char/Makefile +0 -1
@@ -26,7 +26,6 @@ obj-$(CONFIG_HW_RANDOM) += hw_random/ obj-$(CONFIG_PPDEV) += ppdev.o obj-$(CONFIG_NWBUTTON) += nwbutton.o obj-$(CONFIG_NWFLASH) += nwflash.o -obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_TELCLOCK) += tlclk.o
drivers/char/scx200_gpio.c deleted +0 -138
138 lines not on this page · raw message
drivers/gpio/Kconfig +11 -0
@@ -1106,6 +1106,17 @@ config PC8736x_GPIO This driver can also be built as a module called gpio-pc8736x. +config SCx200_GPIO + tristate "NatSemi SCx200 GPIO support" + depends on SCx200 && HAS_IOPORT + select NSC_GPIO + help + Support the GPIO controller on National Semiconductor SCx200 and + SC1100 processors. The first bank is exposed to GPIO consumers + such as the Soekris and PC Engines board LED drivers. + + This driver can also be built as a module called gpio-scx200. + config GPIO_SCH tristate "Intel SCH/TunnelCreek/Centerton/Quark X1000 GPIO" depends on (X86 || COMPILE_TEST) && ACPI
drivers/gpio/Makefile +1 -0
@@ -171,6 +171,7 @@ obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o obj-$(CONFIG_GPIO_SCH) += gpio-sch.o obj-$(CONFIG_GPIO_SHARED_PROXY) += gpio-shared-proxy.o +obj-$(CONFIG_SCx200_GPIO) += gpio-scx200.o obj-$(CONFIG_GPIO_SIFIVE) += gpio-sifive.o obj-$(CONFIG_GPIO_SIM) += gpio-sim.o obj-$(CONFIG_GPIO_SIOX) += gpio-siox.o
drivers/gpio/gpio-scx200.c new file +400 -0
400 lines not on this page · raw message
drivers/leds/leds-net48xx.c +53 -32
125 lines not on this page · raw message
drivers/leds/leds-wrap.c +73 -70
189 lines not on this page · raw message
include/linux/scx200.h +1 -0
@@ -9,6 +9,7 @@/* Interesting stuff for the National Semiconductor SCx200 CPU */ extern unsigned scx200_cb_base; +extern const struct software_node scx200_gpio_swnode;#define scx200_cb_present () (scx200_cb_base!=0)
include/linux/scx200_gpio.h deleted +0 -89
89 lines not on this page · raw message
Signature · 1 line
2.56.1
Linus Walleij
maintainerPATCH 3/3 gpio: remove the legacy NSC GPIO API
In reply to Linus WalleijBoth controllers now expose the standard GPIO character-device ABI, and the net48xx and WRAP LED drivers use GPIO descriptors. Remove the per-pin character devices and their shared file operations.
We assume there are no remaining users of the old NSC GPIO userspace ABI.
--- drivers/char/Kconfig | 10 --- drivers/char/Makefile | 1 - drivers/char/nsc_gpio.c | 126 ----------------------------------- drivers/gpio/Kconfig | 2 - drivers/gpio/gpio-pc8736x.c | 114 +------------------------------ drivers/gpio/gpio-scx200.c | 159 +------------------------------------------- include/linux/nsc_gpio.h | 41 ------------ 7 files changed, 3 insertions(+), 450 deletions(-)
drivers/char/Kconfig +0 -10
@@ -223,16 +223,6 @@ config SONYPI To compile this driver as a module, choose M here: the module will be called sonypi. -config NSC_GPIO - tristate "NatSemi Base GPIO Support" - depends on X86_32 - # selected by SCx200_GPIO and PC8736x_GPIO - # what about 2 selectors differing: m != y - help - Common support used (and needed) by scx200_gpio and - pc8736x_gpio drivers. If those drivers are built as - modules, this one will be too, named nsc_gpio - config DEVMEM bool "/dev/mem virtual device support" default y
drivers/char/Makefile +0 -1
@@ -26,7 +26,6 @@ obj-$(CONFIG_HW_RANDOM) += hw_random/ obj-$(CONFIG_PPDEV) += ppdev.o obj-$(CONFIG_NWBUTTON) += nwbutton.o obj-$(CONFIG_NWFLASH) += nwflash.o -obj-$(CONFIG_NSC_GPIO) += nsc_gpio.o obj-$(CONFIG_TELCLOCK) += tlclk.o obj-y += agp/
drivers/char/nsc_gpio.c deleted +0 -126
126 lines not on this page · raw message
drivers/gpio/Kconfig +0 -2
@@ -1098,7 +1098,6 @@ config PC8736x_GPIO depends on X86_32 default SCx200_GPIO select ISA_BUS_API - select NSC_GPIO help Support the GPIO controller in the National Semiconductor PC87365 and PC87366 Super I/O chips. The GPIO logical device
@@ -1109,7 +1108,6 @@ config PC8736x_GPIO config SCx200_GPIO tristate "NatSemi SCx200 GPIO support" depends on SCx200 && HAS_IOPORT - select NSC_GPIO help Support the GPIO controller on National Semiconductor SCx200 and SC1100 processors. The first bank is exposed to GPIO consumers
drivers/gpio/gpio-pc8736x.c +1 -113
163 lines not on this page · raw message
drivers/gpio/gpio-scx200.c +2 -157
196 lines not on this page · raw message
include/linux/nsc_gpio.h deleted +0 -41
41 lines not on this page · raw message
Signature · 1 line
2.56.1
[email protected]
AI reviewSashiko has reviewed this 3-patch series and found no issues.
Sashiko has reviewed this 3-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]
Quoted 12 lines · Linus Walleij
This is an obvious attack patch to see if anyone is really using the custom API from these deviant
drivers/char/*GPIO drivers from the early 2000s.Probe PC8736x through the ISA bus API and create the SCx200 GPIO device from its PCI bridge. Register both controllers with gpiolib using port I/O. Describe the net48xx and WRAP LED GPIOs with software nodes and switch both LED drivers to descriptors.
Remove the private GPIO API and per-pin character devices. We assume there are no remaining users of the old NSC GPIO userspace ABI.
Quoted 7 lines
An LLM assisted in the implementation and x86-32 build checks.
---
Linus Walleij (3):
gpio: convert PC8736x to gpiolib
gpio: convert SCx200 to gpiolib and use descriptors for board LEDs
gpio: remove the legacy NSC GPIO API