ramips: setup GPIO chip functions on the fly

SVN-Revision: 26324
lede-17.01
Gabor Juhos 2011-03-27 19:19:51 +00:00
parent b03f2dfcee
commit 251a367fb4
1 changed files with 5 additions and 12 deletions

View File

@ -147,10 +147,6 @@ static int ramips_gpio_get(struct gpio_chip *chip, unsigned offset)
static struct ramips_gpio_chip ramips_gpio_chip0 = { static struct ramips_gpio_chip ramips_gpio_chip0 = {
.chip = { .chip = {
.label = "ramips-gpio0", .label = "ramips-gpio0",
.direction_input = ramips_gpio_direction_input,
.direction_output = ramips_gpio_direction_output,
.get = ramips_gpio_get,
.set = ramips_gpio_set,
.base = 0, .base = 0,
.ngpio = RALINK_SOC_GPIO0_COUNT, .ngpio = RALINK_SOC_GPIO0_COUNT,
}, },
@ -173,10 +169,6 @@ static struct ramips_gpio_chip ramips_gpio_chip0 = {
static struct ramips_gpio_chip ramips_gpio_chip1 = { static struct ramips_gpio_chip ramips_gpio_chip1 = {
.chip = { .chip = {
.label = "ramips-gpio1", .label = "ramips-gpio1",
.direction_input = ramips_gpio_direction_input,
.direction_output = ramips_gpio_direction_output,
.get = ramips_gpio_get,
.set = ramips_gpio_set,
.base = 32, .base = 32,
.ngpio = RALINK_SOC_GPIO1_COUNT, .ngpio = RALINK_SOC_GPIO1_COUNT,
}, },
@ -199,10 +191,6 @@ static struct ramips_gpio_chip ramips_gpio_chip1 = {
static struct ramips_gpio_chip ramips_gpio_chip2 = { static struct ramips_gpio_chip ramips_gpio_chip2 = {
.chip = { .chip = {
.label = "ramips-gpio2", .label = "ramips-gpio2",
.direction_input = ramips_gpio_direction_input,
.direction_output = ramips_gpio_direction_output,
.get = ramips_gpio_get,
.set = ramips_gpio_set,
.base = 64, .base = 64,
.ngpio = RALINK_SOC_GPIO2_COUNT, .ngpio = RALINK_SOC_GPIO2_COUNT,
}, },
@ -228,6 +216,11 @@ static __init void ramips_gpio_chip_add(struct ramips_gpio_chip *rg)
rg->regs_base = ioremap(rg->map_base, rg->map_size); rg->regs_base = ioremap(rg->map_base, rg->map_size);
rg->chip.direction_input = ramips_gpio_direction_input;
rg->chip.direction_output = ramips_gpio_direction_output;
rg->chip.get = ramips_gpio_get;
rg->chip.set = ramips_gpio_set;
/* set polarity to low for all lines */ /* set polarity to low for all lines */
ramips_gpio_wr(rg, RAMIPS_GPIO_REG_POL, 0); ramips_gpio_wr(rg, RAMIPS_GPIO_REG_POL, 0);