aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/mach-bf548/gpio.c17
-rw-r--r--include/asm-blackfin/gpio.h4
-rw-r--r--include/asm-blackfin/mach-bf548/gpio.h4
3 files changed, 22 insertions, 3 deletions
diff --git a/arch/blackfin/mach-bf548/gpio.c b/arch/blackfin/mach-bf548/gpio.c
index fac7cf3d6791..9b1a00aabf28 100644
--- a/arch/blackfin/mach-bf548/gpio.c
+++ b/arch/blackfin/mach-bf548/gpio.c
@@ -52,6 +52,7 @@ inline int check_gpio(unsigned short gpio)
52{ 52{
53 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15 \ 53 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15 \
54 || gpio == GPIO_PH14 || gpio == GPIO_PH15 \ 54 || gpio == GPIO_PH14 || gpio == GPIO_PH15 \
55 || gpio == GPIO_PJ14 || gpio == GPIO_PJ15 \
55 || gpio > MAX_BLACKFIN_GPIOS) 56 || gpio > MAX_BLACKFIN_GPIOS)
56 return -EINVAL; 57 return -EINVAL;
57 return 0; 58 return 0;
@@ -173,3 +174,19 @@ void gpio_direction_output(unsigned short gpio)
173 local_irq_restore(flags); 174 local_irq_restore(flags);
174} 175}
175EXPORT_SYMBOL(gpio_direction_output); 176EXPORT_SYMBOL(gpio_direction_output);
177
178void gpio_set_value(unsigned short gpio, unsigned short arg)
179{
180 if (arg)
181 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio);
182 else
183 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio);
184
185}
186EXPORT_SYMBOL(gpio_set_value);
187
188unsigned short gpio_get_value(unsigned short gpio)
189{
190 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
191}
192EXPORT_SYMBOL(gpio_get_value);
diff --git a/include/asm-blackfin/gpio.h b/include/asm-blackfin/gpio.h
index bc0cca02850b..e679703f7ae5 100644
--- a/include/asm-blackfin/gpio.h
+++ b/include/asm-blackfin/gpio.h
@@ -234,6 +234,7 @@
234* MODIFICATION HISTORY : 234* MODIFICATION HISTORY :
235**************************************************************/ 235**************************************************************/
236 236
237#ifndef BF548_FAMILY
237void set_gpio_dir(unsigned short, unsigned short); 238void set_gpio_dir(unsigned short, unsigned short);
238void set_gpio_inen(unsigned short, unsigned short); 239void set_gpio_inen(unsigned short, unsigned short);
239void set_gpio_polar(unsigned short, unsigned short); 240void set_gpio_polar(unsigned short, unsigned short);
@@ -268,7 +269,6 @@ unsigned short get_gpiop_maska(unsigned short);
268unsigned short get_gpiop_maskb(unsigned short); 269unsigned short get_gpiop_maskb(unsigned short);
269unsigned short get_gpiop_data(unsigned short); 270unsigned short get_gpiop_data(unsigned short);
270 271
271#ifndef BF548_FAMILY
272struct gpio_port_t { 272struct gpio_port_t {
273 unsigned short data; 273 unsigned short data;
274 unsigned short dummy1; 274 unsigned short dummy1;
@@ -363,8 +363,10 @@ void gpio_free(unsigned short);
363void gpio_set_value(unsigned short gpio, unsigned short arg); 363void gpio_set_value(unsigned short gpio, unsigned short arg);
364unsigned short gpio_get_value(unsigned short gpio); 364unsigned short gpio_get_value(unsigned short gpio);
365 365
366#ifndef BF548_FAMILY
366#define gpio_get_value(gpio) get_gpio_data(gpio) 367#define gpio_get_value(gpio) get_gpio_data(gpio)
367#define gpio_set_value(gpio, value) set_gpio_data(gpio, value) 368#define gpio_set_value(gpio, value) set_gpio_data(gpio, value)
369#endif
368 370
369void gpio_direction_input(unsigned short gpio); 371void gpio_direction_input(unsigned short gpio);
370void gpio_direction_output(unsigned short gpio); 372void gpio_direction_output(unsigned short gpio);
diff --git a/include/asm-blackfin/mach-bf548/gpio.h b/include/asm-blackfin/mach-bf548/gpio.h
index 45289425ce59..8c5847a6680b 100644
--- a/include/asm-blackfin/mach-bf548/gpio.h
+++ b/include/asm-blackfin/mach-bf548/gpio.h
@@ -187,8 +187,8 @@
187#define GPIO_PJ11 155 187#define GPIO_PJ11 155
188#define GPIO_PJ12 156 188#define GPIO_PJ12 156
189#define GPIO_PJ13 157 189#define GPIO_PJ13 157
190#define GPIO_PJ14 158 190#define GPIO_PJ14 158 /* N/A */
191#define GPIO_PJ15 159 191#define GPIO_PJ15 159 /* N/A */
192 192
193#define MAX_BLACKFIN_GPIOS 160 193#define MAX_BLACKFIN_GPIOS 160
194 194