SCx200 patches part 3/3 -- I2C drivers
This is the thirdSCx200 patch. It adds support for an I2C bus on the SCx200 processors. Actually the patch is threee parts:
1. A driver for the ACCESS.bus of the SCx200 CPU, this is basically an I2C bus with some hardware state machines.
2. A driver for using two GPIO pins of the processor as an I2C bus.
3. A driver for the GPIO pins so that the I2C bus driver has something to talk to. I have added the I2C driver to the arch/i386/kernel directory since it is very processor specific, and I've also added some static initializers to init/main.c so that the GPIO initialization is run before any drivers. Does this look ok?
I also have some more patches for my specific SCx200 board, and also some IDE patches that probably should end up in the main kernel, but I will sit on those for a while since they are not as well tested yet. If anyone is inerested, please mail me.
/Christer
linux/arch/i386/config.in renamed from linux/arch/i386/config.in.orig +5 -0
@@ -238,6 +238,11 @@ fi fi +tristate 'NatSemi SCx200 GPIO support' CONFIG_SCx200_GPIO +if [ "$CONFIG_SCx200_GPIO" = "y" ]; then + define_bool CONFIG_SCx200 y +fi + source drivers/pci/Config.in bool 'EISA support' CONFIG_EISA
linux/arch/i386/kernel/Makefile renamed from linux/arch/i386/kernel/Makefile.orig +4 -0
@@ -41,4 +41,8 @@ obj-$(CONFIG_X86_IO_APIC) += io_apic.o acpitable.o obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o +obj-$(CONFIG_SCx200) += scx200.o +export-objs += scx200_gpio.o +obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o + include $(TOPDIR)/Rules.make
linux/arch/i386/kernel/scx200.c renamed from linux/arch/i386/kernel/scx200.c.orig +31 -0
@@ -0,0 +1,31 @@ +/* linux/arch/i386/kernel/scx200.c + +Copyright (c) 2001,2002 Christer Weinigel <[email protected]> + +Make sure that the SCx200 specific initializations are run before +any drivers are initialized. This is also a good place to add any +board specific initializers. */ + +#include <linux/config.h> +#include <linux/module.h> +#include <linux/errno.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/pci.h> + +extern int scx200_gpio_init (void ); +extern int scx200_nano_init (void ); + +int __init scx200_init (void ) +{ +#ifdef CONFIG_SCx200_GPIO +scx200_gpio_init (); +#endif +} + +/* +Local variables: +compile-command: "make -k -C ../../.. SUBDIRS=arch/i386/kernel bzImage" +c-basic-offset: 8 +End: +*/
linux/arch/i386/kernel/scx200_gpio.c renamed from linux/arch/i386/kernel/scx200_gpio.c.orig +130 -0
130 lines not on this page · raw message
linux/drivers/i2c/Config.in renamed from linux/drivers/i2c/Config.in.orig +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
linux/drivers/i2c/Makefile renamed from linux/drivers/i2c/Makefile.orig +2 -0
@@ -18,6 +18,8 @@ obj-$(CONFIG_ITE_I2C_ALGO) += i2c-algo-ite.o obj-$(CONFIG_ITE_I2C_ADAP) += i2c-adap-ite.o obj-$(CONFIG_I2C_PROC) += i2c-proc.o +obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o +obj-$(CONFIG_SCx200_ACB) += scx200_acb.o obj-$(CONFIG_I2C_KEYWEST) += i2c-keywest.o # This is needed for automatic patch generation: sensors code starts here
linux/drivers/i2c/scx200_acb.c renamed from linux/drivers/i2c/scx200_acb.c.orig +581 -0
581 lines not on this page · raw message
linux/drivers/i2c/scx200_i2c.c renamed from linux/drivers/i2c/scx200_i2c.c.orig +156 -0
156 lines not on this page · raw message
linux/include/linux/scx200_gpio.h renamed from linux/include/linux/scx200_gpio.h.orig +99 -0
99 lines not on this page · raw message
linux/init/main.c renamed from linux/init/main.c.orig +4 -0
@@ -94,6 +94,7 @@extern void sysctl_init (void );extern void signals_init (void );extern int init_pcmcia_ds (void ); +extern int scx200_init (void );extern void free_initmem (void );
@@ -521,6 +522,9 @@#endif #ifdef CONFIG_TC tc_init (); +#endif +#ifdef CONFIG_SCx200 +scx200_init ();#endif /* Networking initialization needs a process context */
Signature · 1 line
"Just how much can I get away with and still go to heaven?"