diff options
author | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-04-07 16:34:16 -0400 |
---|---|---|
committer | Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> | 2009-04-07 16:34:16 -0400 |
commit | 38f4b8c0da01ae7cd9b93386842ce272d6fde9ab (patch) | |
tree | 3c8c52201aac038094bfea7efdd0984a8f62045e /arch/xtensa/variants/s6000/gpio.c | |
parent | a811454027352c762e0d5bba1b1d8f7d26bf96ae (diff) | |
parent | 8e2c4f2844c0e8dcdfe312e5f2204854ca8532c6 (diff) |
Merge commit 'origin/master' into for-linus/xen/master
* commit 'origin/master': (4825 commits)
Fix build errors due to CONFIG_BRANCH_TRACER=y
parport: Use the PCI IRQ if offered
tty: jsm cleanups
Adjust path to gpio headers
KGDB_SERIAL_CONSOLE check for module
Change KCONFIG name
tty: Blackin CTS/RTS
Change hardware flow control from poll to interrupt driven
Add support for the MAX3100 SPI UART.
lanana: assign a device name and numbering for MAX3100
serqt: initial clean up pass for tty side
tty: Use the generic RS485 ioctl on CRIS
tty: Correct inline types for tty_driver_kref_get()
splice: fix deadlock in splicing to file
nilfs2: support nanosecond timestamp
nilfs2: introduce secondary super block
nilfs2: simplify handling of active state of segments
nilfs2: mark minor flag for checkpoint created by internal operation
nilfs2: clean up sketch file
nilfs2: super block operations fix endian bug
...
Conflicts:
arch/x86/include/asm/thread_info.h
arch/x86/lguest/boot.c
drivers/xen/manage.c
Diffstat (limited to 'arch/xtensa/variants/s6000/gpio.c')
-rw-r--r-- | arch/xtensa/variants/s6000/gpio.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/xtensa/variants/s6000/gpio.c b/arch/xtensa/variants/s6000/gpio.c new file mode 100644 index 000000000000..33a8d952934c --- /dev/null +++ b/arch/xtensa/variants/s6000/gpio.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | * s6000 gpio driver | ||
3 | * | ||
4 | * Copyright (c) 2009 emlix GmbH | ||
5 | * Authors: Oskar Schirmer <os@emlix.com> | ||
6 | * Johannes Weiner <jw@emlix.com> | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/init.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/gpio.h> | ||
13 | |||
14 | #include <variant/hardware.h> | ||
15 | |||
16 | #define S6_GPIO_DATA 0x000 | ||
17 | #define S6_GPIO_IS 0x404 | ||
18 | #define S6_GPIO_IBE 0x408 | ||
19 | #define S6_GPIO_IEV 0x40C | ||
20 | #define S6_GPIO_IE 0x410 | ||
21 | #define S6_GPIO_RIS 0x414 | ||
22 | #define S6_GPIO_MIS 0x418 | ||
23 | #define S6_GPIO_IC 0x41C | ||
24 | #define S6_GPIO_AFSEL 0x420 | ||
25 | #define S6_GPIO_DIR 0x800 | ||
26 | #define S6_GPIO_BANK(nr) ((nr) * 0x1000) | ||
27 | #define S6_GPIO_MASK(nr) (4 << (nr)) | ||
28 | #define S6_GPIO_OFFSET(nr) \ | ||
29 | (S6_GPIO_BANK((nr) >> 3) + S6_GPIO_MASK((nr) & 7)) | ||
30 | |||
31 | static int direction_input(struct gpio_chip *chip, unsigned int off) | ||
32 | { | ||
33 | writeb(0, S6_REG_GPIO + S6_GPIO_DIR + S6_GPIO_OFFSET(off)); | ||
34 | return 0; | ||
35 | } | ||
36 | |||
37 | static int get(struct gpio_chip *chip, unsigned int off) | ||
38 | { | ||
39 | return readb(S6_REG_GPIO + S6_GPIO_DATA + S6_GPIO_OFFSET(off)); | ||
40 | } | ||
41 | |||
42 | static int direction_output(struct gpio_chip *chip, unsigned int off, int val) | ||
43 | { | ||
44 | unsigned rel = S6_GPIO_OFFSET(off); | ||
45 | writeb(~0, S6_REG_GPIO + S6_GPIO_DIR + rel); | ||
46 | writeb(val ? ~0 : 0, S6_REG_GPIO + S6_GPIO_DATA + rel); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static void set(struct gpio_chip *chip, unsigned int off, int val) | ||
51 | { | ||
52 | writeb(val ? ~0 : 0, S6_REG_GPIO + S6_GPIO_DATA + S6_GPIO_OFFSET(off)); | ||
53 | } | ||
54 | |||
55 | static struct gpio_chip gpiochip = { | ||
56 | .owner = THIS_MODULE, | ||
57 | .direction_input = direction_input, | ||
58 | .get = get, | ||
59 | .direction_output = direction_output, | ||
60 | .set = set, | ||
61 | .base = 0, | ||
62 | .ngpio = 24, | ||
63 | .can_sleep = 0, /* no blocking io needed */ | ||
64 | .exported = 0, /* no exporting to userspace */ | ||
65 | }; | ||
66 | |||
67 | static int gpio_init(void) | ||
68 | { | ||
69 | return gpiochip_add(&gpiochip); | ||
70 | } | ||
71 | device_initcall(gpio_init); | ||