blk: rq_data_dir() should not return a boolean
[cris-mirror.git] / arch / sh / boards / mach-sdk7786 / gpio.c
blobf71ce09d4e15d0260b402e453987f18e38bd29c7
1 /*
2 * SDK7786 FPGA USRGPIR Support.
4 * Copyright (C) 2010 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10 #include <linux/init.h>
11 #include <linux/interrupt.h>
12 #include <linux/gpio.h>
13 #include <linux/irq.h>
14 #include <linux/kernel.h>
15 #include <linux/spinlock.h>
16 #include <linux/io.h>
17 #include <mach/fpga.h>
19 #define NR_FPGA_GPIOS 8
21 static const char *usrgpir_gpio_names[NR_FPGA_GPIOS] = {
22 "in0", "in1", "in2", "in3", "in4", "in5", "in6", "in7",
25 static int usrgpir_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
27 /* always in */
28 return 0;
31 static int usrgpir_gpio_get(struct gpio_chip *chip, unsigned gpio)
33 return !!(fpga_read_reg(USRGPIR) & (1 << gpio));
36 static struct gpio_chip usrgpir_gpio_chip = {
37 .label = "sdk7786-fpga",
38 .names = usrgpir_gpio_names,
39 .direction_input = usrgpir_gpio_direction_input,
40 .get = usrgpir_gpio_get,
41 .base = -1, /* don't care */
42 .ngpio = NR_FPGA_GPIOS,
45 static int __init usrgpir_gpio_setup(void)
47 return gpiochip_add(&usrgpir_gpio_chip);
49 device_initcall(usrgpir_gpio_setup);