~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to arch/arm/plat-samsung/include/plat/gpio-core.h

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 * specific code.
26
26
*/
27
27
 
28
 
struct s3c_gpio_chip;
 
28
struct samsung_gpio_chip;
29
29
 
30
30
/**
31
 
 * struct s3c_gpio_pm - power management (suspend/resume) information
 
31
 * struct samsung_gpio_pm - power management (suspend/resume) information
32
32
 * @save: Routine to save the state of the GPIO block
33
33
 * @resume: Routine to resume the GPIO block.
34
34
 */
35
 
struct s3c_gpio_pm {
36
 
        void (*save)(struct s3c_gpio_chip *chip);
37
 
        void (*resume)(struct s3c_gpio_chip *chip);
 
35
struct samsung_gpio_pm {
 
36
        void (*save)(struct samsung_gpio_chip *chip);
 
37
        void (*resume)(struct samsung_gpio_chip *chip);
38
38
};
39
39
 
40
 
struct s3c_gpio_cfg;
 
40
struct samsung_gpio_cfg;
41
41
 
42
42
/**
43
 
 * struct s3c_gpio_chip - wrapper for specific implementation of gpio
 
43
 * struct samsung_gpio_chip - wrapper for specific implementation of gpio
44
44
 * @chip: The chip structure to be exported via gpiolib.
45
45
 * @base: The base pointer to the gpio configuration registers.
46
46
 * @group: The group register number for gpio interrupt support.
60
60
 * CPU cores trying to get one lock for different GPIO banks, where each
61
61
 * bank of GPIO has its own register space and configuration registers.
62
62
 */
63
 
struct s3c_gpio_chip {
 
63
struct samsung_gpio_chip {
64
64
        struct gpio_chip        chip;
65
 
        struct s3c_gpio_cfg     *config;
66
 
        struct s3c_gpio_pm      *pm;
 
65
        struct samsung_gpio_cfg *config;
 
66
        struct samsung_gpio_pm  *pm;
67
67
        void __iomem            *base;
68
68
        int                     irq_base;
69
69
        int                     group;
73
73
#endif
74
74
};
75
75
 
76
 
static inline struct s3c_gpio_chip *to_s3c_gpio(struct gpio_chip *gpc)
 
76
static inline struct samsung_gpio_chip *to_samsung_gpio(struct gpio_chip *gpc)
77
77
{
78
 
        return container_of(gpc, struct s3c_gpio_chip, chip);
 
78
        return container_of(gpc, struct samsung_gpio_chip, chip);
79
79
}
80
80
 
81
 
/** s3c_gpiolib_add() - add the s3c specific version of a gpio_chip.
82
 
 * @chip: The chip to register
83
 
 *
84
 
 * This is a wrapper to gpiochip_add() that takes our specific gpio chip
85
 
 * information and makes the necessary alterations for the platform and
86
 
 * notes the information for use with the configuration systems and any
87
 
 * other parts of the system.
88
 
 */
89
 
extern void s3c_gpiolib_add(struct s3c_gpio_chip *chip);
90
 
 
91
 
/* CONFIG_S3C_GPIO_TRACK enables the tracking of the s3c specific gpios
92
 
 * for use with the configuration calls, and other parts of the s3c gpiolib
93
 
 * support code.
94
 
 *
95
 
 * Not all s3c support code will need this, as some configurations of cpu
96
 
 * may only support one or two different configuration options and have an
97
 
 * easy gpio to s3c_gpio_chip mapping function. If this is the case, then
98
 
 * the machine support file should provide its own s3c_gpiolib_getchip()
99
 
 * and any other necessary functions.
100
 
 */
101
 
 
102
 
/**
103
 
 * samsung_gpiolib_add_4bit_chips - 4bit single register GPIO config.
104
 
 * @chip: The gpio chip that is being configured.
105
 
 * @nr_chips: The no of chips (gpio ports) for the GPIO being configured.
106
 
 *
107
 
 * This helper deal with the GPIO cases where the control register has 4 bits
108
 
 * of control per GPIO, generally in the form of:
109
 
 * 0000 = Input
110
 
 * 0001 = Output
111
 
 * others = Special functions (dependent on bank)
112
 
 *
113
 
 * Note, since the code to deal with the case where there are two control
114
 
 * registers instead of one, we do not have a separate set of function
115
 
 * (samsung_gpiolib_add_4bit2_chips)for each case.
116
 
 */
117
 
extern void samsung_gpiolib_add_4bit_chips(struct s3c_gpio_chip *chip,
118
 
                                           int nr_chips);
119
 
extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
120
 
                                            int nr_chips);
121
 
extern void samsung_gpiolib_add_2bit_chips(struct s3c_gpio_chip *chip,
122
 
                                           int nr_chips);
123
 
 
124
 
extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
125
 
extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
126
 
 
127
 
 
128
81
/**
129
82
 * samsung_gpiolib_to_irq - convert gpio pin to irq number
130
83
 * @chip: The gpio chip that the pin belongs to.
136
89
extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
137
90
 
138
91
/* exported for core SoC support to change */
139
 
extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default;
 
92
extern struct samsung_gpio_cfg s3c24xx_gpiocfg_default;
140
93
 
141
94
#ifdef CONFIG_S3C_GPIO_TRACK
142
 
extern struct s3c_gpio_chip *s3c_gpios[S3C_GPIO_END];
 
95
extern struct samsung_gpio_chip *s3c_gpios[S3C_GPIO_END];
143
96
 
144
 
static inline struct s3c_gpio_chip *s3c_gpiolib_getchip(unsigned int chip)
 
97
static inline struct samsung_gpio_chip *samsung_gpiolib_getchip(unsigned int chip)
145
98
{
146
99
        return (chip < S3C_GPIO_END) ? s3c_gpios[chip] : NULL;
147
100
}
148
101
#else
149
 
/* machine specific code should provide s3c_gpiolib_getchip */
 
102
/* machine specific code should provide samsung_gpiolib_getchip */
150
103
 
151
104
#include <mach/gpio-track.h>
152
105
 
153
 
static inline void s3c_gpiolib_track(struct s3c_gpio_chip *chip) { }
 
106
static inline void s3c_gpiolib_track(struct samsung_gpio_chip *chip) { }
154
107
#endif
155
108
 
156
109
#ifdef CONFIG_PM
157
 
extern struct s3c_gpio_pm s3c_gpio_pm_1bit;
158
 
extern struct s3c_gpio_pm s3c_gpio_pm_2bit;
159
 
extern struct s3c_gpio_pm s3c_gpio_pm_4bit;
 
110
extern struct samsung_gpio_pm samsung_gpio_pm_1bit;
 
111
extern struct samsung_gpio_pm samsung_gpio_pm_2bit;
 
112
extern struct samsung_gpio_pm samsung_gpio_pm_4bit;
160
113
#define __gpio_pm(x) x
161
114
#else
162
 
#define s3c_gpio_pm_1bit NULL
163
 
#define s3c_gpio_pm_2bit NULL
164
 
#define s3c_gpio_pm_4bit NULL
 
115
#define samsung_gpio_pm_1bit NULL
 
116
#define samsung_gpio_pm_2bit NULL
 
117
#define samsung_gpio_pm_4bit NULL
165
118
#define __gpio_pm(x) NULL
166
119
 
167
120
#endif /* CONFIG_PM */
168
121
 
169
122
/* locking wrappers to deal with multiple access to the same gpio bank */
170
 
#define s3c_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
171
 
#define s3c_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)
 
123
#define samsung_gpio_lock(_oc, _fl) spin_lock_irqsave(&(_oc)->lock, _fl)
 
124
#define samsung_gpio_unlock(_oc, _fl) spin_unlock_irqrestore(&(_oc)->lock, _fl)