pinctrl: meson: get rid of pin_base

pin_base was used with the manually set pin offset in meson pinctrl. This
is no longer the case, pin_base is 0 on every meson pinctrl controllers
and should go away.

Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Jerome Brunet 2017-09-20 15:39:25 +02:00 коммит произвёл Linus Walleij
Родитель 634e40b0c2
Коммит 70e5ecb1b9
5 изменённых файлов: 13 добавлений и 25 удалений

Просмотреть файл

@ -820,7 +820,6 @@ static struct meson_bank meson_gxbb_aobus_banks[] = {
struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = { struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = {
.name = "periphs-banks", .name = "periphs-banks",
.pin_base = 0,
.pins = meson_gxbb_periphs_pins, .pins = meson_gxbb_periphs_pins,
.groups = meson_gxbb_periphs_groups, .groups = meson_gxbb_periphs_groups,
.funcs = meson_gxbb_periphs_functions, .funcs = meson_gxbb_periphs_functions,
@ -833,7 +832,6 @@ struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = {
struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = { struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = {
.name = "aobus-banks", .name = "aobus-banks",
.pin_base = 0,
.pins = meson_gxbb_aobus_pins, .pins = meson_gxbb_aobus_pins,
.groups = meson_gxbb_aobus_groups, .groups = meson_gxbb_aobus_groups,
.funcs = meson_gxbb_aobus_functions, .funcs = meson_gxbb_aobus_functions,

Просмотреть файл

@ -807,7 +807,6 @@ static struct meson_bank meson_gxl_aobus_banks[] = {
struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = { struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
.name = "periphs-banks", .name = "periphs-banks",
.pin_base = 0,
.pins = meson_gxl_periphs_pins, .pins = meson_gxl_periphs_pins,
.groups = meson_gxl_periphs_groups, .groups = meson_gxl_periphs_groups,
.funcs = meson_gxl_periphs_functions, .funcs = meson_gxl_periphs_functions,
@ -820,7 +819,6 @@ struct meson_pinctrl_data meson_gxl_periphs_pinctrl_data = {
struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = { struct meson_pinctrl_data meson_gxl_aobus_pinctrl_data = {
.name = "aobus-banks", .name = "aobus-banks",
.pin_base = 0,
.pins = meson_gxl_aobus_pins, .pins = meson_gxl_aobus_pins,
.groups = meson_gxl_aobus_groups, .groups = meson_gxl_aobus_groups,
.funcs = meson_gxl_aobus_functions, .funcs = meson_gxl_aobus_functions,

Просмотреть файл

@ -413,16 +413,15 @@ static const struct pinconf_ops meson_pinconf_ops = {
static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
{ {
struct meson_pinctrl *pc = gpiochip_get_data(chip); struct meson_pinctrl *pc = gpiochip_get_data(chip);
unsigned int reg, bit, pin; unsigned int reg, bit;
struct meson_bank *bank; struct meson_bank *bank;
int ret; int ret;
pin = pc->data->pin_base + gpio; ret = meson_get_bank(pc, gpio, &bank);
ret = meson_get_bank(pc, pin, &bank);
if (ret) if (ret)
return ret; return ret;
meson_calc_reg_and_bit(bank, pin, REG_DIR, &reg, &bit); meson_calc_reg_and_bit(bank, gpio, REG_DIR, &reg, &bit);
return regmap_update_bits(pc->reg_gpio, reg, BIT(bit), BIT(bit)); return regmap_update_bits(pc->reg_gpio, reg, BIT(bit), BIT(bit));
} }
@ -431,21 +430,20 @@ static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
int value) int value)
{ {
struct meson_pinctrl *pc = gpiochip_get_data(chip); struct meson_pinctrl *pc = gpiochip_get_data(chip);
unsigned int reg, bit, pin; unsigned int reg, bit;
struct meson_bank *bank; struct meson_bank *bank;
int ret; int ret;
pin = pc->data->pin_base + gpio; ret = meson_get_bank(pc, gpio, &bank);
ret = meson_get_bank(pc, pin, &bank);
if (ret) if (ret)
return ret; return ret;
meson_calc_reg_and_bit(bank, pin, REG_DIR, &reg, &bit); meson_calc_reg_and_bit(bank, gpio, REG_DIR, &reg, &bit);
ret = regmap_update_bits(pc->reg_gpio, reg, BIT(bit), 0); ret = regmap_update_bits(pc->reg_gpio, reg, BIT(bit), 0);
if (ret) if (ret)
return ret; return ret;
meson_calc_reg_and_bit(bank, pin, REG_OUT, &reg, &bit); meson_calc_reg_and_bit(bank, gpio, REG_OUT, &reg, &bit);
return regmap_update_bits(pc->reg_gpio, reg, BIT(bit), return regmap_update_bits(pc->reg_gpio, reg, BIT(bit),
value ? BIT(bit) : 0); value ? BIT(bit) : 0);
} }
@ -453,16 +451,15 @@ static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
{ {
struct meson_pinctrl *pc = gpiochip_get_data(chip); struct meson_pinctrl *pc = gpiochip_get_data(chip);
unsigned int reg, bit, pin; unsigned int reg, bit;
struct meson_bank *bank; struct meson_bank *bank;
int ret; int ret;
pin = pc->data->pin_base + gpio; ret = meson_get_bank(pc, gpio, &bank);
ret = meson_get_bank(pc, pin, &bank);
if (ret) if (ret)
return; return;
meson_calc_reg_and_bit(bank, pin, REG_OUT, &reg, &bit); meson_calc_reg_and_bit(bank, gpio, REG_OUT, &reg, &bit);
regmap_update_bits(pc->reg_gpio, reg, BIT(bit), regmap_update_bits(pc->reg_gpio, reg, BIT(bit),
value ? BIT(bit) : 0); value ? BIT(bit) : 0);
} }
@ -470,16 +467,15 @@ static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value)
static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio) static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio)
{ {
struct meson_pinctrl *pc = gpiochip_get_data(chip); struct meson_pinctrl *pc = gpiochip_get_data(chip);
unsigned int reg, bit, val, pin; unsigned int reg, bit, val;
struct meson_bank *bank; struct meson_bank *bank;
int ret; int ret;
pin = pc->data->pin_base + gpio; ret = meson_get_bank(pc, gpio, &bank);
ret = meson_get_bank(pc, pin, &bank);
if (ret) if (ret)
return ret; return ret;
meson_calc_reg_and_bit(bank, pin, REG_IN, &reg, &bit); meson_calc_reg_and_bit(bank, gpio, REG_IN, &reg, &bit);
regmap_read(pc->reg_gpio, reg, &val); regmap_read(pc->reg_gpio, reg, &val);
return !!(val & BIT(bit)); return !!(val & BIT(bit));

Просмотреть файл

@ -1046,7 +1046,6 @@ static struct meson_bank meson8_aobus_banks[] = {
struct meson_pinctrl_data meson8_cbus_pinctrl_data = { struct meson_pinctrl_data meson8_cbus_pinctrl_data = {
.name = "cbus-banks", .name = "cbus-banks",
.pin_base = 0,
.pins = meson8_cbus_pins, .pins = meson8_cbus_pins,
.groups = meson8_cbus_groups, .groups = meson8_cbus_groups,
.funcs = meson8_cbus_functions, .funcs = meson8_cbus_functions,
@ -1059,7 +1058,6 @@ struct meson_pinctrl_data meson8_cbus_pinctrl_data = {
struct meson_pinctrl_data meson8_aobus_pinctrl_data = { struct meson_pinctrl_data meson8_aobus_pinctrl_data = {
.name = "ao-bank", .name = "ao-bank",
.pin_base = 0,
.pins = meson8_aobus_pins, .pins = meson8_aobus_pins,
.groups = meson8_aobus_groups, .groups = meson8_aobus_groups,
.funcs = meson8_aobus_functions, .funcs = meson8_aobus_functions,

Просмотреть файл

@ -906,7 +906,6 @@ static struct meson_bank meson8b_aobus_banks[] = {
struct meson_pinctrl_data meson8b_cbus_pinctrl_data = { struct meson_pinctrl_data meson8b_cbus_pinctrl_data = {
.name = "cbus-banks", .name = "cbus-banks",
.pin_base = 0,
.pins = meson8b_cbus_pins, .pins = meson8b_cbus_pins,
.groups = meson8b_cbus_groups, .groups = meson8b_cbus_groups,
.funcs = meson8b_cbus_functions, .funcs = meson8b_cbus_functions,
@ -919,7 +918,6 @@ struct meson_pinctrl_data meson8b_cbus_pinctrl_data = {
struct meson_pinctrl_data meson8b_aobus_pinctrl_data = { struct meson_pinctrl_data meson8b_aobus_pinctrl_data = {
.name = "aobus-banks", .name = "aobus-banks",
.pin_base = 0,
.pins = meson8b_aobus_pins, .pins = meson8b_aobus_pins,
.groups = meson8b_aobus_groups, .groups = meson8b_aobus_groups,
.funcs = meson8b_aobus_functions, .funcs = meson8b_aobus_functions,