diff options
Diffstat (limited to 'arch/arm/plat-samsung/gpio-config.c')
-rw-r--r-- | arch/arm/plat-samsung/gpio-config.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c index 8aca88d6c486..19ab89df24c1 100644 --- a/arch/arm/plat-samsung/gpio-config.c +++ b/arch/arm/plat-samsung/gpio-config.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* linux/arch/arm/plat-s3c/gpio-config.c | 1 | /* linux/arch/arm/plat-s3c/gpio-config.c |
2 | * | 2 | * |
3 | * Copyright 2008 Openmoko, Inc. | 3 | * Copyright 2008 Openmoko, Inc. |
4 | * Copyright 2008 Simtec Electronics | 4 | * Copyright 2008-2010 Simtec Electronics |
5 | * Ben Dooks <ben@simtec.co.uk> | 5 | * Ben Dooks <ben@simtec.co.uk> |
6 | * http://armlinux.simtec.co.uk/ | 6 | * http://armlinux.simtec.co.uk/ |
7 | * | 7 | * |
@@ -87,6 +87,19 @@ int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | unsigned s3c_gpio_getcfg_s3c24xx_a(struct s3c_gpio_chip *chip, | ||
91 | unsigned int off) | ||
92 | { | ||
93 | u32 con; | ||
94 | |||
95 | con = __raw_readl(chip->base); | ||
96 | con >>= off; | ||
97 | con &= 1; | ||
98 | con++; | ||
99 | |||
100 | return S3C_GPIO_SFN(con); | ||
101 | } | ||
102 | |||
90 | int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | 103 | int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, |
91 | unsigned int off, unsigned int cfg) | 104 | unsigned int off, unsigned int cfg) |
92 | { | 105 | { |
@@ -109,6 +122,19 @@ int s3c_gpio_setcfg_s3c24xx(struct s3c_gpio_chip *chip, | |||
109 | 122 | ||
110 | return 0; | 123 | return 0; |
111 | } | 124 | } |
125 | |||
126 | unsigned int s3c_gpio_getcfg_s3c24xx(struct s3c_gpio_chip *chip, | ||
127 | unsigned int off) | ||
128 | { | ||
129 | u32 con; | ||
130 | |||
131 | con = __raw_readl(chip->base); | ||
132 | con >>= off * 2; | ||
133 | con &= 3; | ||
134 | |||
135 | /* this conversion works for IN and OUT as well as special mode */ | ||
136 | return S3C_GPIO_SPECIAL(con); | ||
137 | } | ||
112 | #endif | 138 | #endif |
113 | 139 | ||
114 | #ifdef CONFIG_S3C_GPIO_CFG_S3C64XX | 140 | #ifdef CONFIG_S3C_GPIO_CFG_S3C64XX |
@@ -134,6 +160,25 @@ int s3c_gpio_setcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | |||
134 | 160 | ||
135 | return 0; | 161 | return 0; |
136 | } | 162 | } |
163 | |||
164 | unsigned s3c_gpio_getcfg_s3c64xx_4bit(struct s3c_gpio_chip *chip, | ||
165 | unsigned int off) | ||
166 | { | ||
167 | void __iomem *reg = chip->base; | ||
168 | unsigned int shift = (off & 7) * 4; | ||
169 | u32 con; | ||
170 | |||
171 | if (off < 8 && chip->chip.ngpio > 8) | ||
172 | reg -= 4; | ||
173 | |||
174 | con = __raw_readl(reg); | ||
175 | con >>= shift; | ||
176 | con &= 0xf; | ||
177 | |||
178 | /* this conversion works for IN and OUT as well as special mode */ | ||
179 | return S3C_GPIO_SPECIAL(con); | ||
180 | } | ||
181 | |||
137 | #endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */ | 182 | #endif /* CONFIG_S3C_GPIO_CFG_S3C64XX */ |
138 | 183 | ||
139 | #ifdef CONFIG_S3C_GPIO_PULL_UPDOWN | 184 | #ifdef CONFIG_S3C_GPIO_PULL_UPDOWN |