NatSemi SCx200 patches for Linux-2.5
Subsystems (6)
Hi,
This patch adds support for the National Semiconductor SCx200 processor to Linux 2.5 (as of the BK tree yesterday). If it looks good, please apply to the 2.5 kernel.
The patch consists of the following drivers:
arch/i386/kernel/scx200.c -- give kernel access to the GPIO pins
drivers/chars/scx200_gpio.c -- give userspace access to the GPIO pins drivers/chars/scx200_wdt.c -- watchdog timer driver
drivers/i2c/scx200_i2c.c -- use any two GPIO pins as an I2C bus drivers/i2c/scx200_acb.c -- driver for the Access.BUS hardware
drivers/mtd/maps/scx200_docflash.c -- driver for a CFI flash connected
to the DOCCS pin
How can I guarantee that the driver scx200.c is initialized before any other drivers that use the scx200_gpio functions (e.g. scx200_i2c.c)? I have put scx200.c in in arch/i386/kernel in the hope that this directory will always be initialized before anything else, but is this really true?
/Christer
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.634 -> 1.636
# drivers/mtd/maps/Makefile 1.3 -> 1.4
# drivers/i2c/Makefile 1.4 -> 1.5
# arch/i386/Config.help 1.15 -> 1.16
# arch/i386/kernel/Makefile 1.22 -> 1.23
# drivers/i2c/Config.help 1.1 -> 1.2
# drivers/char/Config.in 1.37 -> 1.38
# drivers/mtd/maps/Config.help 1.1 -> 1.2
# arch/i386/config.in 1.49 -> 1.50
# include/linux/pci_ids.h 1.59 -> 1.60
# drivers/char/Config.help 1.11 -> 1.12
# drivers/mtd/maps/Config.in 1.6 -> 1.7
# MAINTAINERS 1.101 -> 1.102
# drivers/char/Makefile 1.37 -> 1.38
# drivers/i2c/Config.in 1.5 -> 1.6
# (new) -> 1.2 drivers/char/scx200_wdt.c # (new) -> 1.1 drivers/i2c/scx200_acb.c # (new) -> 1.1 include/linux/scx200.h # (new) -> 1.1 drivers/mtd/maps/scx200_docflash.c # (new) -> 1.1 drivers/char/scx200_gpio.c # (new) -> 1.1 include/linux/scx200_gpio.h # (new) -> 1.1 drivers/i2c/scx200_i2c.c # (new) -> 1.1 arch/i386/kernel/scx200.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/30 [email protected] 1.635
# scx200-2.5.diff # -------------------------------------------- # 02/09/30 [email protected] 1.636 # Removed unneccesary ifdefs. # Cleaned up fault handling. # -------------------------------------------- # diff -Nru a/MAINTAINERS b/MAINTAINERS --- a/MAINTAINERS Mon Sep 30 13:07:40 2002 +++ b/MAINTAINERS Mon Sep 30 13:07:40 2002 @@ -1430,6 +1430,12 @@ L: [email protected] S: Maintained
+SCx200 CPU SUPPORT
+P: Christer Weinigel
+M: [email protected]
+W: http://www.weinigel.se
+S: Supported
+
SGI VISUAL WORKSTATION 320 AND 540
P: Bent Hagemark
M: [email protected]
arch/i386/Config.help +9 -0
@@ -981,3 +981,12 @@ absence of features. For more information take a look at Documentation/swsusp.txt. + +CONFIG_SCx200 + This provides basic support for the National Semiconductor SCx200 + processor, such as the GPIO pins. + + If you don't know what to do here, say N. + + This support is also available as a module. If compiled as a + will be called scx200_nano.o.
arch/i386/config.in +2 -0
@@ -276,6 +276,8 @@ fi fi +tristate 'NatSemi SCx200 support' CONFIG_SCx200 + source drivers/pci/Config.in bool 'EISA support' CONFIG_EISA
arch/i386/kernel/Makefile +3 -0
@@ -29,4 +29,7 @@ EXTRA_AFLAGS := -traditional +export-objs += scx200.o +obj-$(CONFIG_SCx200) += scx200.o + include $(TOPDIR)/Rules.make
arch/i386/kernel/scx200.c new file +128 -0
128 lines not on this page · raw message
drivers/char/Config.help +12 -0
@@ -803,6 +803,12 @@ module, say M here and read <file:Documentation/modules.txt>. Most people will say N. +CONFIG_SCx200_WDT + Enable the built-in watchdog timer support on the National + Semiconductor SCx200 processors. + + If compiled as a module, it will be called scx200_watchdog.o. + CONFIG_MACHZ_WDT If you are using a ZF Micro MachZ processor, say Y here, otherwise N. This is the driver for the watchdog timer builtin on that
@@ -1005,4 +1011,10 @@ The raw driver permits block devices to be bound to /dev/raw/rawN. Once bound, I/O against /dev/raw/rawN uses efficient zero-copy I/O. See the raw(8) manpage for more details. + +CONFIG_SCx200_GPIO + Give userspace access to the GPIO pins on the National + Semiconductor SCx200 processors. + + If compiled as a module, it will be called scx200_gpio.o.
drivers/char/Config.in +3 -0
@@ -131,6 +131,7 @@ tristate ' IB700 SBC Watchdog Timer' CONFIG_IB700_WDT tristate ' Intel i810 TCO timer / Watchdog' CONFIG_I810_TCO tristate ' Mixcom Watchdog' CONFIG_MIXCOMWD + tristate ' NatSemi SCx200 Watchdog' CONFIG_SCx200_WDT tristate ' SBC-60XX Watchdog Timer' CONFIG_60XX_WDT tristate ' W83877F (EMACS) Watchdog Timer' CONFIG_W83877F_WDT tristate ' ZF MachZ Watchdog' CONFIG_MACHZ_WDT
@@ -189,6 +190,8 @@ if [ "$CONFIG_X86" = "y" ]; then tristate 'ACP Modem (Mwave) support' CONFIG_MWAVE fi + +tristate 'NatSemi SCx200 GPIO Support' CONFIG_SCx200_GPIO tristate ' RAW driver (/dev/raw/rawN)' CONFIG_RAW_DRIVER
drivers/char/Makefile +2 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_DZ) += dz.o obj-$(CONFIG_NWBUTTON) += nwbutton.o obj-$(CONFIG_NWFLASH) += nwflash.o +obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o # Only one watchdog can succeed. We probe the hardware watchdog # drivers first, then the softdog driver. This means if your hardware
@@ -85,6 +86,7 @@ obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o obj-$(CONFIG_IB700_WDT) += ib700wdt.o obj-$(CONFIG_MIXCOMWD) += mixcomwd.o +obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o obj-$(CONFIG_WDT) += wdt.o obj-$(CONFIG_WDTPCI) += wdt_pci.o
drivers/char/scx200_gpio.c new file +154 -0
154 lines not on this page · raw message
drivers/char/scx200_wdt.c new file +277 -0
277 lines not on this page · raw message
drivers/i2c/Config.help +22 -0
@@ -91,6 +91,28 @@ <file:Documentation/modules.txt>. The module will be called i2c-dev.o. +CONFIG_SCx200_I2C + Enable the use of two GPIO pins of a SCx200 processor as an I2C bus. + + If you don't know what to do here, say N. + + If compiled as a module, it will be called scx200_i2c.o. + +CONFIG_SCx200_I2C_SCL + Enter the GPIO pin number used for the SCL signal. This value can + also be specified with a module parameter. + +CONFIG_SCx200_I2C_SDA + Enter the GPIO pin number used for the SSA signal. This value can + also be specified with a module parameter. + +CONFIG_SCx200_ACB + Enable the use of the ACCESS.bus controllers of a SCx200 processor. + + If you don't know what to do here, say N. + + If compiled as a module, it will be called scx200_acb.o. + CONFIG_I2C_PROC This provides support for i2c device entries in the /proc filesystem. The entries will be found in /proc/sys/dev/sensors.
drivers/i2c/Config.in +6 -0
@@ -13,6 +13,12 @@ dep_tristate ' Philips style parallel port adapter' CONFIG_I2C_PHILIPSPAR $CONFIG_I2C_ALGOBIT $CONFIG_PARPORT dep_tristate ' ELV adapter' CONFIG_I2C_ELV $CONFIG_I2C_ALGOBIT dep_tristate ' Velleman K9000 adapter' CONFIG_I2C_VELLEMAN $CONFIG_I2C_ALGOBIT + dep_tristate ' NatSemi SCx200 I2C using GPIO pins' CONFIG_SCx200_I2C $CONFIG_SCx200_GPIO $CONFIG_I2C_ALGOBIT + if [ "$CONFIG_SCx200_I2C" != "n" ]; then + int ' GPIO pin used for SCL' CONFIG_SCx200_I2C_SCL 12 + int ' GPIO pin used for SDA' CONFIG_SCx200_I2C_SDA 13 + fi + dep_tristate ' NatSemi SCx200 ACCESS.bus' CONFIG_SCx200_ACB $CONFIG_I2C fi dep_tristate 'I2C PCF 8584 interfaces' CONFIG_I2C_ALGOPCF $CONFIG_I2C
drivers/i2c/Makefile +2 -0
@@ -15,6 +15,8 @@ obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o obj-$(CONFIG_ITE_I2C_ALGO) += i2c-algo-ite.o obj-$(CONFIG_ITE_I2C_ADAP) += i2c-adap-ite.o +obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o +obj-$(CONFIG_SCx200_ACB) += scx200_acb.o obj-$(CONFIG_I2C_PROC) += i2c-proc.o # This is needed for automatic patch generation: sensors code starts here
drivers/i2c/scx200_acb.c new file +578 -0
578 lines not on this page · raw message
drivers/i2c/scx200_i2c.c new file +156 -0
156 lines not on this page · raw message
drivers/mtd/maps/Config.help +8 -0
@@ -127,6 +127,14 @@ you probably want to enable this mapping driver. More info is at <http://www.itc.hu/>. +CONFIG_MTD_SCx200_DOCFLASH + Enable support for a flash chip mapped using the DOCCS signal on a + National Semiconductor SCx200 processor. + + If you don't know what to do here, say N. + + If compiled as a module, it will be called scx200_docflash.o. + CONFIG_MTD_OCTAGON This provides a 'mapping' driver which supports the way in which the flash chips are connected in the Octagon-5066 Single Board
drivers/mtd/maps/Config.in +1 -0
@@ -26,6 +26,7 @@ dep_tristate ' JEDEC Flash device mapped on Mixcom piggyback card' CONFIG_MTD_MIXMEM $CONFIG_MTD_JEDEC dep_tristate ' JEDEC Flash device mapped on Octagon 5066 SBC' CONFIG_MTD_OCTAGON $CONFIG_MTD_JEDEC dep_tristate ' JEDEC Flash device mapped on Tempustech VMAX SBC301' CONFIG_MTD_VMAX $CONFIG_MTD_JEDEC + dep_tristate ' Flash device mapped with DOCCS on NatSemi SCx200' CONFIG_MTD_SCx200_DOCFLASH $CONFIG_MTD_CFI dep_tristate ' BIOS flash chip on Intel L440GX boards' CONFIG_MTD_L440GX $CONFIG_MTD_JEDEC fi
drivers/mtd/maps/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_MTD_NETSC520) += netsc520.o obj-$(CONFIG_MTD_SUN_UFLASH) += sun_uflash.o obj-$(CONFIG_MTD_VMAX) += vmax301.o +obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o obj-$(CONFIG_MTD_OCELOT) += ocelot.o obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
drivers/mtd/maps/scx200_docflash.c new file +268 -0
268 lines not on this page · raw message
include/linux/pci_ids.h +6 -0
@@ -288,6 +288,12 @@#define PCI_DEVICE_ID_NS_87560_USB 0x0012#define PCI_DEVICE_ID_NS_83815 0x0020#define PCI_DEVICE_ID_NS_83820 0x0022 +#define PCI_DEVICE_ID_NS_SCx200_BRIDGE 0x0500 +#define PCI_DEVICE_ID_NS_SCx200_SMI 0x0501 +#define PCI_DEVICE_ID_NS_SCx200_IDE 0x0502 +#define PCI_DEVICE_ID_NS_SCx200_AUDIO 0x0503 +#define PCI_DEVICE_ID_NS_SCx200_VIDEO 0x0504 +#define PCI_DEVICE_ID_NS_SCx200_XBUS 0x0505#define PCI_DEVICE_ID_NS_87410 0xd001#define PCI_VENDOR_ID_TSENG 0x100c
include/linux/scx200.h new file +56 -0
56 lines not on this page · raw message
include/linux/scx200_gpio.h new file +98 -0
98 lines not on this page · raw message
Signature · 5 lines
-- "Just how much can I get away with and still go to heaven?" Freelance consultant specializing in device driver programming for Linux Christer Weinigel <[email protected]> http://www.weinigel.se
Quoted 5 lines · Christer Weinigel
How can I guarantee that the driver
scx200.cis initialized before any other drivers that use thescx200_gpiofunctions (e.g.scx200_i2c.c)? I have putscx200.cin inarch/i386/kernelin the hope that this directory will always be initialized before anything else, but is this really true?
There are two ways. For built in code you can use the link order to force ordering. In 2.4 thats your only real choice. For modules you need to ensure there is a dependancy so modprobe loads the supporting module first
Alan
Quoted 11 lines · Alan Cox
Quoted 5 lines · Christer Weinigel
How can I guarantee that the driver
scx200.cis initialized before any other drivers that use thescx200_gpiofunctions (e.g.scx200_i2c.c)? I have putscx200.cin inarch/i386/kernelin the hope that this directory will always be initialized before anything else, but is this really true?There are two ways. For built in code you can use the link order to force ordering. In 2.4 thats your only real choice. For modules you need to ensure there is a dependancy so modprobe loads the supporting module first
I'll just assume that it works then. With the current link order in 2.5 it works when compiled into the kernel and for the module case there is an explicit dependency.
Now I just have to merge back a few things to the 2.4 code; I found a few uglies and want to see if the link order trick works with 2.4.
/Christer
Signature · 4 lines
"Just how much can I get away with and still go to heaven?" Freelance consultant specializing in device driver programming for Linux Christer Weinigel <[email protected]> http://www.weinigel.se
Quoted 2 lines
Now I just have to merge back a few things to the 2.4 code; I found a few uglies and want to see if the link order trick works with 2.4.
2.4 relies on it. Even IDE requires the trick works