diff options
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 10 | ||||
-rw-r--r-- | drivers/i2c/busses/Makefile | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-acorn.c | 97 |
3 files changed, 108 insertions, 0 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 4d44a2db29dd..fb19dbb31e42 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -495,6 +495,16 @@ config I2C_VERSATILE | |||
495 | This driver can also be built as a module. If so, the module | 495 | This driver can also be built as a module. If so, the module |
496 | will be called i2c-versatile. | 496 | will be called i2c-versatile. |
497 | 497 | ||
498 | config I2C_ACORN | ||
499 | bool "Acorn IOC/IOMD I2C bus support" | ||
500 | depends on I2C && ARCH_ACORN | ||
501 | default y | ||
502 | select I2C_ALGOBIT | ||
503 | help | ||
504 | Say yes if you want to support the I2C bus on Acorn platforms. | ||
505 | |||
506 | If you don't know, say Y. | ||
507 | |||
498 | config I2C_VIA | 508 | config I2C_VIA |
499 | tristate "VIA 82C586B" | 509 | tristate "VIA 82C586B" |
500 | depends on I2C && PCI && EXPERIMENTAL | 510 | depends on I2C && PCI && EXPERIMENTAL |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 03505aa44bbf..290b54018354 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_I2C_SIS630) += i2c-sis630.o | |||
42 | obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o | 42 | obj-$(CONFIG_I2C_SIS96X) += i2c-sis96x.o |
43 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | 43 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o |
44 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o | 44 | obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o |
45 | obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o | ||
45 | obj-$(CONFIG_I2C_VIA) += i2c-via.o | 46 | obj-$(CONFIG_I2C_VIA) += i2c-via.o |
46 | obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o | 47 | obj-$(CONFIG_I2C_VIAPRO) += i2c-viapro.o |
47 | obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o | 48 | obj-$(CONFIG_I2C_VOODOO3) += i2c-voodoo3.o |
diff --git a/drivers/i2c/busses/i2c-acorn.c b/drivers/i2c/busses/i2c-acorn.c new file mode 100644 index 000000000000..09bd7f40b90c --- /dev/null +++ b/drivers/i2c/busses/i2c-acorn.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * linux/drivers/acorn/char/i2c.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Russell King | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * ARM IOC/IOMD i2c driver. | ||
11 | * | ||
12 | * On Acorn machines, the following i2c devices are on the bus: | ||
13 | * - PCF8583 real time clock & static RAM | ||
14 | */ | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/i2c.h> | ||
17 | #include <linux/i2c-algo-bit.h> | ||
18 | |||
19 | #include <asm/hardware.h> | ||
20 | #include <asm/io.h> | ||
21 | #include <asm/hardware/ioc.h> | ||
22 | #include <asm/system.h> | ||
23 | |||
24 | #define FORCE_ONES 0xdc | ||
25 | #define SCL 0x02 | ||
26 | #define SDA 0x01 | ||
27 | |||
28 | /* | ||
29 | * We must preserve all non-i2c output bits in IOC_CONTROL. | ||
30 | * Note also that we need to preserve the value of SCL and | ||
31 | * SDA outputs as well (which may be different from the | ||
32 | * values read back from IOC_CONTROL). | ||
33 | */ | ||
34 | static u_int force_ones; | ||
35 | |||
36 | static void ioc_setscl(void *data, int state) | ||
37 | { | ||
38 | u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA); | ||
39 | u_int ones = force_ones; | ||
40 | |||
41 | if (state) | ||
42 | ones |= SCL; | ||
43 | else | ||
44 | ones &= ~SCL; | ||
45 | |||
46 | force_ones = ones; | ||
47 | |||
48 | ioc_writeb(ioc_control | ones, IOC_CONTROL); | ||
49 | } | ||
50 | |||
51 | static void ioc_setsda(void *data, int state) | ||
52 | { | ||
53 | u_int ioc_control = ioc_readb(IOC_CONTROL) & ~(SCL | SDA); | ||
54 | u_int ones = force_ones; | ||
55 | |||
56 | if (state) | ||
57 | ones |= SDA; | ||
58 | else | ||
59 | ones &= ~SDA; | ||
60 | |||
61 | force_ones = ones; | ||
62 | |||
63 | ioc_writeb(ioc_control | ones, IOC_CONTROL); | ||
64 | } | ||
65 | |||
66 | static int ioc_getscl(void *data) | ||
67 | { | ||
68 | return (ioc_readb(IOC_CONTROL) & SCL) != 0; | ||
69 | } | ||
70 | |||
71 | static int ioc_getsda(void *data) | ||
72 | { | ||
73 | return (ioc_readb(IOC_CONTROL) & SDA) != 0; | ||
74 | } | ||
75 | |||
76 | static struct i2c_algo_bit_data ioc_data = { | ||
77 | .setsda = ioc_setsda, | ||
78 | .setscl = ioc_setscl, | ||
79 | .getsda = ioc_getsda, | ||
80 | .getscl = ioc_getscl, | ||
81 | .udelay = 80, | ||
82 | .timeout = 100 | ||
83 | }; | ||
84 | |||
85 | static struct i2c_adapter ioc_ops = { | ||
86 | .id = I2C_HW_B_IOC, | ||
87 | .algo_data = &ioc_data, | ||
88 | }; | ||
89 | |||
90 | static int __init i2c_ioc_init(void) | ||
91 | { | ||
92 | force_ones = FORCE_ONES | SCL | SDA; | ||
93 | |||
94 | return i2c_bit_add_bus(&ioc_ops); | ||
95 | } | ||
96 | |||
97 | __initcall(i2c_ioc_init); | ||