diff options
Diffstat (limited to 'arch/arm/mach-davinci/include/mach')
-rw-r--r-- | arch/arm/mach-davinci/include/mach/da8xx.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/gpio-davinci.h | 91 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/gpio.h | 88 |
3 files changed, 3 insertions, 179 deletions
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index aae53072c0eb..39e58b48e826 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h | |||
@@ -97,6 +97,7 @@ int da8xx_register_mmcsd0(struct davinci_mmc_config *config); | |||
97 | int da850_register_mmcsd1(struct davinci_mmc_config *config); | 97 | int da850_register_mmcsd1(struct davinci_mmc_config *config); |
98 | void da8xx_register_mcasp(int id, struct snd_platform_data *pdata); | 98 | void da8xx_register_mcasp(int id, struct snd_platform_data *pdata); |
99 | int da8xx_register_rtc(void); | 99 | int da8xx_register_rtc(void); |
100 | int da8xx_register_gpio(void *pdata); | ||
100 | int da850_register_cpufreq(char *async_clk); | 101 | int da850_register_cpufreq(char *async_clk); |
101 | int da8xx_register_cpuidle(void); | 102 | int da8xx_register_cpuidle(void); |
102 | void __iomem *da8xx_get_mem_ctlr(void); | 103 | void __iomem *da8xx_get_mem_ctlr(void); |
@@ -110,6 +111,8 @@ int da850_register_vpif_capture | |||
110 | void da8xx_restart(enum reboot_mode mode, const char *cmd); | 111 | void da8xx_restart(enum reboot_mode mode, const char *cmd); |
111 | void da8xx_rproc_reserve_cma(void); | 112 | void da8xx_rproc_reserve_cma(void); |
112 | int da8xx_register_rproc(void); | 113 | int da8xx_register_rproc(void); |
114 | int da850_register_gpio(void); | ||
115 | int da830_register_gpio(void); | ||
113 | 116 | ||
114 | extern struct platform_device da8xx_serial_device[]; | 117 | extern struct platform_device da8xx_serial_device[]; |
115 | extern struct emac_platform_data da8xx_emac_pdata; | 118 | extern struct emac_platform_data da8xx_emac_pdata; |
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h deleted file mode 100644 index 1fdd1fd35448..000000000000 --- a/arch/arm/mach-davinci/include/mach/gpio-davinci.h +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * TI DaVinci GPIO Support | ||
3 | * | ||
4 | * Copyright (c) 2006 David Brownell | ||
5 | * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __DAVINCI_DAVINCI_GPIO_H | ||
14 | #define __DAVINCI_DAVINCI_GPIO_H | ||
15 | |||
16 | #include <linux/io.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | |||
19 | #include <asm-generic/gpio.h> | ||
20 | |||
21 | #include <mach/irqs.h> | ||
22 | #include <mach/common.h> | ||
23 | |||
24 | #define DAVINCI_GPIO_BASE 0x01C67000 | ||
25 | |||
26 | enum davinci_gpio_type { | ||
27 | GPIO_TYPE_DAVINCI = 0, | ||
28 | GPIO_TYPE_TNETV107X, | ||
29 | }; | ||
30 | |||
31 | /* | ||
32 | * basic gpio routines | ||
33 | * | ||
34 | * board-specific init should be done by arch/.../.../board-XXX.c (maybe | ||
35 | * initializing banks together) rather than boot loaders; kexec() won't | ||
36 | * go through boot loaders. | ||
37 | * | ||
38 | * the gpio clock will be turned on when gpios are used, and you may also | ||
39 | * need to pay attention to PINMUX registers to be sure those pins are | ||
40 | * used as gpios, not with other peripherals. | ||
41 | * | ||
42 | * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation, | ||
43 | * and maybe for later updates, code may write GPIO(N). These may be | ||
44 | * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip | ||
45 | * may not support all the GPIOs in that range. | ||
46 | * | ||
47 | * GPIOs can also be on external chips, numbered after the ones built-in | ||
48 | * to the DaVinci chip. For now, they won't be usable as IRQ sources. | ||
49 | */ | ||
50 | #define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */ | ||
51 | |||
52 | /* Convert GPIO signal to GPIO pin number */ | ||
53 | #define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio)) | ||
54 | |||
55 | struct davinci_gpio_controller { | ||
56 | struct gpio_chip chip; | ||
57 | int irq_base; | ||
58 | spinlock_t lock; | ||
59 | void __iomem *regs; | ||
60 | void __iomem *set_data; | ||
61 | void __iomem *clr_data; | ||
62 | void __iomem *in_data; | ||
63 | }; | ||
64 | |||
65 | /* The __gpio_to_controller() and __gpio_mask() functions inline to constants | ||
66 | * with constant parameters; or in outlined code they execute at runtime. | ||
67 | * | ||
68 | * You'd access the controller directly when reading or writing more than | ||
69 | * one gpio value at a time, and to support wired logic where the value | ||
70 | * being driven by the cpu need not match the value read back. | ||
71 | * | ||
72 | * These are NOT part of the cross-platform GPIO interface | ||
73 | */ | ||
74 | static inline struct davinci_gpio_controller * | ||
75 | __gpio_to_controller(unsigned gpio) | ||
76 | { | ||
77 | struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs; | ||
78 | int index = gpio / 32; | ||
79 | |||
80 | if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num) | ||
81 | return NULL; | ||
82 | |||
83 | return ctlrs + index; | ||
84 | } | ||
85 | |||
86 | static inline u32 __gpio_mask(unsigned gpio) | ||
87 | { | ||
88 | return 1 << (gpio % 32); | ||
89 | } | ||
90 | |||
91 | #endif /* __DAVINCI_DAVINCI_GPIO_H */ | ||
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h deleted file mode 100644 index 960e9de47e1e..000000000000 --- a/arch/arm/mach-davinci/include/mach/gpio.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* | ||
2 | * TI DaVinci GPIO Support | ||
3 | * | ||
4 | * Copyright (c) 2006 David Brownell | ||
5 | * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __DAVINCI_GPIO_H | ||
14 | #define __DAVINCI_GPIO_H | ||
15 | |||
16 | #include <asm-generic/gpio.h> | ||
17 | |||
18 | #define __ARM_GPIOLIB_COMPLEX | ||
19 | |||
20 | /* The inline versions use the static inlines in the driver header */ | ||
21 | #include "gpio-davinci.h" | ||
22 | |||
23 | /* | ||
24 | * The get/set/clear functions will inline when called with constant | ||
25 | * parameters referencing built-in GPIOs, for low-overhead bitbanging. | ||
26 | * | ||
27 | * gpio_set_value() will inline only on traditional Davinci style controllers | ||
28 | * with distinct set/clear registers. | ||
29 | * | ||
30 | * Otherwise, calls with variable parameters or referencing external | ||
31 | * GPIOs (e.g. on GPIO expander chips) use outlined functions. | ||
32 | */ | ||
33 | static inline void gpio_set_value(unsigned gpio, int value) | ||
34 | { | ||
35 | if (__builtin_constant_p(value) && gpio < davinci_soc_info.gpio_num) { | ||
36 | struct davinci_gpio_controller *ctlr; | ||
37 | u32 mask; | ||
38 | |||
39 | ctlr = __gpio_to_controller(gpio); | ||
40 | |||
41 | if (ctlr->set_data != ctlr->clr_data) { | ||
42 | mask = __gpio_mask(gpio); | ||
43 | if (value) | ||
44 | __raw_writel(mask, ctlr->set_data); | ||
45 | else | ||
46 | __raw_writel(mask, ctlr->clr_data); | ||
47 | return; | ||
48 | } | ||
49 | } | ||
50 | |||
51 | __gpio_set_value(gpio, value); | ||
52 | } | ||
53 | |||
54 | /* Returns zero or nonzero; works for gpios configured as inputs OR | ||
55 | * as outputs, at least for built-in GPIOs. | ||
56 | * | ||
57 | * NOTE: for built-in GPIOs, changes in reported values are synchronized | ||
58 | * to the GPIO clock. This is easily seen after calling gpio_set_value() | ||
59 | * and then immediately gpio_get_value(), where the gpio_get_value() will | ||
60 | * return the old value until the GPIO clock ticks and the new value gets | ||
61 | * latched. | ||
62 | */ | ||
63 | static inline int gpio_get_value(unsigned gpio) | ||
64 | { | ||
65 | struct davinci_gpio_controller *ctlr; | ||
66 | |||
67 | if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num) | ||
68 | return __gpio_get_value(gpio); | ||
69 | |||
70 | ctlr = __gpio_to_controller(gpio); | ||
71 | return __gpio_mask(gpio) & __raw_readl(ctlr->in_data); | ||
72 | } | ||
73 | |||
74 | static inline int gpio_cansleep(unsigned gpio) | ||
75 | { | ||
76 | if (__builtin_constant_p(gpio) && gpio < davinci_soc_info.gpio_num) | ||
77 | return 0; | ||
78 | else | ||
79 | return __gpio_cansleep(gpio); | ||
80 | } | ||
81 | |||
82 | static inline int irq_to_gpio(unsigned irq) | ||
83 | { | ||
84 | /* don't support the reverse mapping */ | ||
85 | return -ENOSYS; | ||
86 | } | ||
87 | |||
88 | #endif /* __DAVINCI_GPIO_H */ | ||