diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:13:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 12:13:34 -0400 |
commit | ed402af3c23a4804b3f8899263e8d0f97c62ab49 (patch) | |
tree | 3aa971aea57f900a3060cc0545b199ef611f4dcf /arch/sh/include/asm/gpio.h | |
parent | 096e6f673dc02a6394dc9a7d8f8735c6978f5b91 (diff) | |
parent | 40e24c403f325715f9c43b9fed2068641201ee0b (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (112 commits)
sh: Move SH-4 CPU headers down one more level.
sh: Only build in gpio.o when CONFIG_GENERIC_GPIO is selected.
sh: Migrate common board headers to mach-common/.
sh: Move the CPU definition headers from asm/ to cpu/.
serial: sh-sci: Add support SCIF of SH7723
video: add sh_mobile_lcdc platform flags
video: remove unused sh_mobile_lcdc platform data
sh: remove consistent alloc cruft
sh: add dynamic crash base address support
sh: reduce Migo-R smc91x overruns
sh: Fix up some merge damage.
Fix debugfs_create_file's error checking method for arch/sh/mm/
Fix debugfs_create_dir's error checking method for arch/sh/kernel/
sh: ap325rxa: Add support RTC RX-8564LC in AP325RXA board
sh: Use sh7720 GPIO on magicpanelr2 board
sh: Add sh7720 pinmux code
sh: Use sh7203 GPIO on rsk7203 board
sh: Add sh7203 pinmux code
sh: Use sh7723 GPIO on AP325RXA board
sh: Add sh7723 pinmux code
...
Diffstat (limited to 'arch/sh/include/asm/gpio.h')
-rw-r--r-- | arch/sh/include/asm/gpio.h | 92 |
1 files changed, 90 insertions, 2 deletions
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h index cf32bd2df881..9650e7c9c39e 100644 --- a/arch/sh/include/asm/gpio.h +++ b/arch/sh/include/asm/gpio.h | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * include/asm-sh/gpio.h | 2 | * include/asm-sh/gpio.h |
3 | * | 3 | * |
4 | * Copyright (C) 2007 Markus Brunner, Mark Jonas | 4 | * Generic GPIO API and pinmux table support for SuperH. |
5 | * | 5 | * |
6 | * Addresses for the Pin Function Controller | 6 | * Copyright (c) 2008 Magnus Damm |
7 | * | 7 | * |
8 | * This file is subject to the terms and conditions of the GNU General Public | 8 | * This file is subject to the terms and conditions of the GNU General Public |
9 | * License. See the file "COPYING" in the main directory of this archive | 9 | * License. See the file "COPYING" in the main directory of this archive |
@@ -16,4 +16,92 @@ | |||
16 | #include <cpu/gpio.h> | 16 | #include <cpu/gpio.h> |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | typedef unsigned short pinmux_enum_t; | ||
20 | typedef unsigned char pinmux_flag_t; | ||
21 | |||
22 | #define PINMUX_TYPE_NONE 0 | ||
23 | #define PINMUX_TYPE_FUNCTION 1 | ||
24 | #define PINMUX_TYPE_GPIO 2 | ||
25 | #define PINMUX_TYPE_OUTPUT 3 | ||
26 | #define PINMUX_TYPE_INPUT 4 | ||
27 | #define PINMUX_TYPE_INPUT_PULLUP 5 | ||
28 | #define PINMUX_TYPE_INPUT_PULLDOWN 6 | ||
29 | |||
30 | #define PINMUX_FLAG_TYPE (0x7) | ||
31 | #define PINMUX_FLAG_WANT_PULLUP (1 << 3) | ||
32 | #define PINMUX_FLAG_WANT_PULLDOWN (1 << 4) | ||
33 | |||
34 | struct pinmux_gpio { | ||
35 | pinmux_enum_t enum_id; | ||
36 | pinmux_flag_t flags; | ||
37 | }; | ||
38 | |||
39 | #define PINMUX_GPIO(gpio, data_or_mark) [gpio] = { data_or_mark } | ||
40 | #define PINMUX_DATA(data_or_mark, ids...) data_or_mark, ids, 0 | ||
41 | |||
42 | struct pinmux_cfg_reg { | ||
43 | unsigned long reg, reg_width, field_width; | ||
44 | unsigned long *cnt; | ||
45 | pinmux_enum_t *enum_ids; | ||
46 | }; | ||
47 | |||
48 | #define PINMUX_CFG_REG(name, r, r_width, f_width) \ | ||
49 | .reg = r, .reg_width = r_width, .field_width = f_width, \ | ||
50 | .cnt = (unsigned long [r_width / f_width]) {}, \ | ||
51 | .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ | ||
52 | |||
53 | struct pinmux_data_reg { | ||
54 | unsigned long reg, reg_width; | ||
55 | pinmux_enum_t *enum_ids; | ||
56 | }; | ||
57 | |||
58 | #define PINMUX_DATA_REG(name, r, r_width) \ | ||
59 | .reg = r, .reg_width = r_width, \ | ||
60 | .enum_ids = (pinmux_enum_t [r_width]) \ | ||
61 | |||
62 | struct pinmux_range { | ||
63 | pinmux_enum_t begin; | ||
64 | pinmux_enum_t end; | ||
65 | }; | ||
66 | |||
67 | struct pinmux_info { | ||
68 | char *name; | ||
69 | pinmux_enum_t reserved_id; | ||
70 | struct pinmux_range data; | ||
71 | struct pinmux_range input; | ||
72 | struct pinmux_range input_pd; | ||
73 | struct pinmux_range input_pu; | ||
74 | struct pinmux_range output; | ||
75 | struct pinmux_range mark; | ||
76 | struct pinmux_range function; | ||
77 | |||
78 | unsigned first_gpio, last_gpio; | ||
79 | |||
80 | struct pinmux_gpio *gpios; | ||
81 | struct pinmux_cfg_reg *cfg_regs; | ||
82 | struct pinmux_data_reg *data_regs; | ||
83 | |||
84 | pinmux_enum_t *gpio_data; | ||
85 | unsigned int gpio_data_size; | ||
86 | |||
87 | unsigned long *gpio_in_use; | ||
88 | }; | ||
89 | |||
90 | int register_pinmux(struct pinmux_info *pip); | ||
91 | |||
92 | int __gpio_request(unsigned gpio); | ||
93 | static inline int gpio_request(unsigned gpio, const char *label) | ||
94 | { | ||
95 | return __gpio_request(gpio); | ||
96 | } | ||
97 | void gpio_free(unsigned gpio); | ||
98 | int gpio_direction_input(unsigned gpio); | ||
99 | int gpio_direction_output(unsigned gpio, int value); | ||
100 | int gpio_get_value(unsigned gpio); | ||
101 | void gpio_set_value(unsigned gpio, int value); | ||
102 | static inline int gpio_export(unsigned gpio, bool direction_may_change) | ||
103 | { | ||
104 | return 0; | ||
105 | } | ||
106 | |||
19 | #endif /* __ASM_SH_GPIO_H */ | 107 | #endif /* __ASM_SH_GPIO_H */ |