mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-01-30 05:44:07 -05:00
Merge tag 'pinctrl-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull Pin control fixes from Linus Walleij:
"Pin control fixes for the v4.5 series, all are individual driver
fixes:
- Fix the PXA2xx driver to export its init function so we do not
break modular compiles.
- Hide unused functions in the Nomadik driver.
- Fix up direction control in the Mediatek driver.
- Toggle the sunxi GPIO lines to input when you read them on the H3
GPIO controller, lest you only get garbage.
- Fix up the number of settings in the MVEBU driver.
- Fix a serious SMP race condition in the Samsung driver"
* tag 'pinctrl-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
pinctrl: samsung: fix SMP race condition
pinctrl: mvebu: fix num_settings in mpp group assignment
pinctrl: sunxi: H3 requires irq_read_needs_mux
pinctrl: mediatek: fix direction control issue
pinctrl: nomadik: hide unused functions
pinctrl: pxa: export pxa2xx_pinctrl_init()
This commit is contained in:
@@ -347,6 +347,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev *pctldev,
|
||||
ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
|
||||
break;
|
||||
case PIN_CONFIG_INPUT_ENABLE:
|
||||
mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
|
||||
ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
|
||||
break;
|
||||
case PIN_CONFIG_OUTPUT:
|
||||
@@ -354,6 +355,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev *pctldev,
|
||||
ret = mtk_pmx_gpio_set_direction(pctldev, NULL, pin, false);
|
||||
break;
|
||||
case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
|
||||
mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
|
||||
ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
|
||||
break;
|
||||
case PIN_CONFIG_DRIVE_STRENGTH:
|
||||
|
||||
@@ -666,16 +666,19 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
|
||||
struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
|
||||
struct mvebu_pinctrl_group *grp;
|
||||
unsigned num_settings;
|
||||
unsigned supp_settings;
|
||||
|
||||
for (num_settings = 0; ; set++) {
|
||||
for (num_settings = 0, supp_settings = 0; ; set++) {
|
||||
if (!set->name)
|
||||
break;
|
||||
|
||||
num_settings++;
|
||||
|
||||
/* skip unsupported settings for this variant */
|
||||
if (pctl->variant && !(pctl->variant & set->variant))
|
||||
continue;
|
||||
|
||||
num_settings++;
|
||||
supp_settings++;
|
||||
|
||||
/* find gpio/gpo/gpi settings */
|
||||
if (strcmp(set->name, "gpio") == 0)
|
||||
@@ -688,7 +691,7 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
/* skip modes with no settings for this variant */
|
||||
if (!num_settings)
|
||||
if (!supp_settings)
|
||||
continue;
|
||||
|
||||
grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
|
||||
|
||||
@@ -191,6 +191,7 @@ static void abx500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
|
||||
dev_err(pct->dev, "%s write failed (%d)\n", __func__, ret);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset,
|
||||
enum abx500_gpio_pull_updown *pull_updown)
|
||||
{
|
||||
@@ -226,6 +227,7 @@ static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset,
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int abx500_set_pull_updown(struct abx500_pinctrl *pct,
|
||||
int offset, enum abx500_gpio_pull_updown val)
|
||||
@@ -468,6 +470,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
|
||||
unsigned gpio)
|
||||
{
|
||||
@@ -553,8 +556,6 @@ static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
|
||||
#include <linux/seq_file.h>
|
||||
|
||||
static void abx500_gpio_dbg_show_one(struct seq_file *s,
|
||||
|
||||
@@ -426,6 +426,7 @@ int pxa2xx_pinctrl_init(struct platform_device *pdev,
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(pxa2xx_pinctrl_init);
|
||||
|
||||
int pxa2xx_pinctrl_exit(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
@@ -514,25 +514,35 @@ static const struct pinconf_ops samsung_pinconf_ops = {
|
||||
.pin_config_group_set = samsung_pinconf_group_set,
|
||||
};
|
||||
|
||||
/* gpiolib gpio_set callback function */
|
||||
static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
|
||||
/*
|
||||
* The samsung_gpio_set_vlaue() should be called with "bank->slock" held
|
||||
* to avoid race condition.
|
||||
*/
|
||||
static void samsung_gpio_set_value(struct gpio_chip *gc,
|
||||
unsigned offset, int value)
|
||||
{
|
||||
struct samsung_pin_bank *bank = gpiochip_get_data(gc);
|
||||
const struct samsung_pin_bank_type *type = bank->type;
|
||||
unsigned long flags;
|
||||
void __iomem *reg;
|
||||
u32 data;
|
||||
|
||||
reg = bank->drvdata->virt_base + bank->pctl_offset;
|
||||
|
||||
spin_lock_irqsave(&bank->slock, flags);
|
||||
|
||||
data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]);
|
||||
data &= ~(1 << offset);
|
||||
if (value)
|
||||
data |= 1 << offset;
|
||||
writel(data, reg + type->reg_offset[PINCFG_TYPE_DAT]);
|
||||
}
|
||||
|
||||
/* gpiolib gpio_set callback function */
|
||||
static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
|
||||
{
|
||||
struct samsung_pin_bank *bank = gpiochip_get_data(gc);
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&bank->slock, flags);
|
||||
samsung_gpio_set_value(gc, offset, value);
|
||||
spin_unlock_irqrestore(&bank->slock, flags);
|
||||
}
|
||||
|
||||
@@ -553,6 +563,8 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset)
|
||||
}
|
||||
|
||||
/*
|
||||
* The samsung_gpio_set_direction() should be called with "bank->slock" held
|
||||
* to avoid race condition.
|
||||
* The calls to gpio_direction_output() and gpio_direction_input()
|
||||
* leads to this function call.
|
||||
*/
|
||||
@@ -564,7 +576,6 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc,
|
||||
struct samsung_pinctrl_drv_data *drvdata;
|
||||
void __iomem *reg;
|
||||
u32 data, mask, shift;
|
||||
unsigned long flags;
|
||||
|
||||
bank = gpiochip_get_data(gc);
|
||||
type = bank->type;
|
||||
@@ -581,31 +592,42 @@ static int samsung_gpio_set_direction(struct gpio_chip *gc,
|
||||
reg += 4;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&bank->slock, flags);
|
||||
|
||||
data = readl(reg);
|
||||
data &= ~(mask << shift);
|
||||
if (!input)
|
||||
data |= FUNC_OUTPUT << shift;
|
||||
writel(data, reg);
|
||||
|
||||
spin_unlock_irqrestore(&bank->slock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* gpiolib gpio_direction_input callback function. */
|
||||
static int samsung_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
|
||||
{
|
||||
return samsung_gpio_set_direction(gc, offset, true);
|
||||
struct samsung_pin_bank *bank = gpiochip_get_data(gc);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&bank->slock, flags);
|
||||
ret = samsung_gpio_set_direction(gc, offset, true);
|
||||
spin_unlock_irqrestore(&bank->slock, flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* gpiolib gpio_direction_output callback function. */
|
||||
static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset,
|
||||
int value)
|
||||
{
|
||||
samsung_gpio_set(gc, offset, value);
|
||||
return samsung_gpio_set_direction(gc, offset, false);
|
||||
struct samsung_pin_bank *bank = gpiochip_get_data(gc);
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
|
||||
spin_lock_irqsave(&bank->slock, flags);
|
||||
samsung_gpio_set_value(gc, offset, value);
|
||||
ret = samsung_gpio_set_direction(gc, offset, false);
|
||||
spin_unlock_irqrestore(&bank->slock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -492,6 +492,7 @@ static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
|
||||
.pins = sun8i_h3_pins,
|
||||
.npins = ARRAY_SIZE(sun8i_h3_pins),
|
||||
.irq_banks = 2,
|
||||
.irq_read_needs_mux = true
|
||||
};
|
||||
|
||||
static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
|
||||
|
||||
Reference in New Issue
Block a user