aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc3.c4
-rw-r--r--arch/arm/plat-samsung/gpio.c8
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h18
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h15
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c4
5 files changed, 45 insertions, 4 deletions
diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c b/arch/arm/plat-samsung/dev-hsmmc3.c
index 85aaf0f2842f..335bc35044d3 100644
--- a/arch/arm/plat-samsung/dev-hsmmc3.c
+++ b/arch/arm/plat-samsung/dev-hsmmc3.c
@@ -33,8 +33,8 @@ static struct resource s3c_hsmmc3_resource[] = {
33 .flags = IORESOURCE_MEM, 33 .flags = IORESOURCE_MEM,
34 }, 34 },
35 [1] = { 35 [1] = {
36 .start = IRQ_MMC3, 36 .start = IRQ_HSMMC3,
37 .end = IRQ_MMC3, 37 .end = IRQ_HSMMC3,
38 .flags = IORESOURCE_IRQ, 38 .flags = IORESOURCE_IRQ,
39 } 39 }
40}; 40};
diff --git a/arch/arm/plat-samsung/gpio.c b/arch/arm/plat-samsung/gpio.c
index b83a83351cea..7743c4b8b2fb 100644
--- a/arch/arm/plat-samsung/gpio.c
+++ b/arch/arm/plat-samsung/gpio.c
@@ -157,3 +157,11 @@ __init void s3c_gpiolib_add(struct s3c_gpio_chip *chip)
157 if (ret >= 0) 157 if (ret >= 0)
158 s3c_gpiolib_track(chip); 158 s3c_gpiolib_track(chip);
159} 159}
160
161int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
162{
163 struct s3c_gpio_chip *s3c_chip = container_of(chip,
164 struct s3c_gpio_chip, chip);
165
166 return s3c_chip->irq_base + offset;
167}
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index f684901b4b76..e4b5cf126fa9 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -207,4 +207,22 @@ extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin);
207*/ 207*/
208extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr); 208extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr);
209 209
210/**
211 * s5p_register_gpio_interrupt() - register interrupt support for a gpio group
212 * @pin: The pin number from the group to be registered
213 *
214 * This function registers gpio interrupt support for the group that the
215 * specified pin belongs to.
216 *
217 * The total number of gpio pins is quite large ob s5p series. Registering
218 * irq support for all of them would be a resource waste. Because of that the
219 * interrupt support for standard gpio pins is registered dynamically.
220 *
221 * It will return the irq number of the interrupt that has been registered
222 * or -ENOMEM if no more gpio interrupts can be registered. It is allowed
223 * to call this function more than once for the same gpio group (the group
224 * will be registered only once).
225 */
226extern int s5p_register_gpio_interrupt(int pin);
227
210#endif /* __PLAT_GPIO_CFG_H */ 228#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index e358c7da8480..13a22b8861ef 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -43,6 +43,8 @@ struct s3c_gpio_cfg;
43 * struct s3c_gpio_chip - wrapper for specific implementation of gpio 43 * struct s3c_gpio_chip - wrapper for specific implementation of gpio
44 * @chip: The chip structure to be exported via gpiolib. 44 * @chip: The chip structure to be exported via gpiolib.
45 * @base: The base pointer to the gpio configuration registers. 45 * @base: The base pointer to the gpio configuration registers.
46 * @group: The group register number for gpio interrupt support.
47 * @irq_base: The base irq number.
46 * @config: special function and pull-resistor control information. 48 * @config: special function and pull-resistor control information.
47 * @lock: Lock for exclusive access to this gpio bank. 49 * @lock: Lock for exclusive access to this gpio bank.
48 * @pm_save: Save information for suspend/resume support. 50 * @pm_save: Save information for suspend/resume support.
@@ -63,6 +65,8 @@ struct s3c_gpio_chip {
63 struct s3c_gpio_cfg *config; 65 struct s3c_gpio_cfg *config;
64 struct s3c_gpio_pm *pm; 66 struct s3c_gpio_pm *pm;
65 void __iomem *base; 67 void __iomem *base;
68 int irq_base;
69 int group;
66 spinlock_t lock; 70 spinlock_t lock;
67#ifdef CONFIG_PM 71#ifdef CONFIG_PM
68 u32 pm_save[4]; 72 u32 pm_save[4];
@@ -118,6 +122,17 @@ extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
118extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); 122extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
119extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); 123extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
120 124
125
126/**
127 * samsung_gpiolib_to_irq - convert gpio pin to irq number
128 * @chip: The gpio chip that the pin belongs to.
129 * @offset: The offset of the pin in the chip.
130 *
131 * This helper returns the irq number calculated from the chip->irq_base and
132 * the provided offset.
133 */
134extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
135
121/* exported for core SoC support to change */ 136/* exported for core SoC support to change */
122extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default; 137extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default;
123 138
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index 7df03f87fbfa..96528200eb79 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -192,7 +192,7 @@ struct s3c_gpio_pm s3c_gpio_pm_2bit = {
192 .resume = s3c_gpio_pm_2bit_resume, 192 .resume = s3c_gpio_pm_2bit_resume,
193}; 193};
194 194
195#ifdef CONFIG_ARCH_S3C64XX 195#if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P)
196static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip) 196static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip)
197{ 197{
198 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); 198 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
@@ -302,7 +302,7 @@ struct s3c_gpio_pm s3c_gpio_pm_4bit = {
302 .save = s3c_gpio_pm_4bit_save, 302 .save = s3c_gpio_pm_4bit_save,
303 .resume = s3c_gpio_pm_4bit_resume, 303 .resume = s3c_gpio_pm_4bit_resume,
304}; 304};
305#endif /* CONFIG_ARCH_S3C64XX */ 305#endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */
306 306
307/** 307/**
308 * s3c_pm_save_gpio() - save gpio chip data for suspend 308 * s3c_pm_save_gpio() - save gpio chip data for suspend