Lines Matching +full:chip +full:- +full:relative
5 * Copyright 2006 Phil Sutter <n0-1@freewrt.org>
37 #include <asm/mach-rc32434/rb.h>
38 #include <asm/mach-rc32434/gpio.h>
41 /* Offsets relative to GPIOBASE */
51 struct gpio_chip chip; member
59 .end = REGBASE + GPIOBASE + sizeof(struct rb532_gpio_reg) - 1,
64 /* rb532_set_bit - sanely set a bit
86 /* rb532_get_bit - read a bit
97 static int rb532_gpio_get(struct gpio_chip *chip, unsigned offset) in rb532_gpio_get() argument
101 gpch = gpiochip_get_data(chip); in rb532_gpio_get()
102 return !!rb532_get_bit(offset, gpch->regbase + GPIOD); in rb532_gpio_get()
108 static void rb532_gpio_set(struct gpio_chip *chip, in rb532_gpio_set() argument
113 gpch = gpiochip_get_data(chip); in rb532_gpio_set()
114 rb532_set_bit(value, offset, gpch->regbase + GPIOD); in rb532_gpio_set()
120 static int rb532_gpio_direction_input(struct gpio_chip *chip, unsigned offset) in rb532_gpio_direction_input() argument
124 gpch = gpiochip_get_data(chip); in rb532_gpio_direction_input()
127 rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); in rb532_gpio_direction_input()
129 rb532_set_bit(0, offset, gpch->regbase + GPIOCFG); in rb532_gpio_direction_input()
136 static int rb532_gpio_direction_output(struct gpio_chip *chip, in rb532_gpio_direction_output() argument
141 gpch = gpiochip_get_data(chip); in rb532_gpio_direction_output()
144 rb532_set_bit(0, offset, gpch->regbase + GPIOFUNC); in rb532_gpio_direction_output()
147 rb532_set_bit(value, offset, gpch->regbase + GPIOD); in rb532_gpio_direction_output()
149 rb532_set_bit(1, offset, gpch->regbase + GPIOCFG); in rb532_gpio_direction_output()
153 static int rb532_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) in rb532_gpio_to_irq() argument
160 .chip = {
178 rb532_set_bit(bit, gpio, rb532_gpio_chip->regbase + GPIOILEVEL); in rb532_gpio_set_ilevel()
187 rb532_set_bit(bit, gpio, rb532_gpio_chip->regbase + GPIOISTAT); in rb532_gpio_set_istat()
196 rb532_set_bit(1, gpio, rb532_gpio_chip->regbase + GPIOFUNC); in rb532_gpio_set_func()
205 rb532_gpio_chip->regbase = ioremap(r->start, resource_size(r)); in rb532_gpio_init()
207 if (!rb532_gpio_chip->regbase) { in rb532_gpio_init()
209 return -ENXIO; in rb532_gpio_init()
212 /* Register our GPIO chip */ in rb532_gpio_init()
213 gpiochip_add_data(&rb532_gpio_chip->chip, rb532_gpio_chip); in rb532_gpio_init()