mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 21:54:06 +08:00
Pin control fixes for the v5.8 series:
- Fix an issue in the AMD driver for the UART0 group. - Fix a glitch issue in the Baytrail pin controller. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl8Ii1sACgkQQRCzN7AZ XXM7qQ/+Lztmz5V4/GpqVwqi65yDJExLyz83vQT5Pb2t4d8/5qn112SKd68QWWU3 RRWezXJkbMenPsVCidf0AdSpUQztS4fmCDJicaJVjj36u21L0GlVgKxW0ht1fsyV 4RunJVwS5jrz/rtsvlRXuopuOBRsu5xFfQH8wn0WVwc4oQutJYblN637B4fx0EUS 4h8IQT+GM2VAI9AxVfwA71wSrTAU5zl8tk5d1KnyO5myjz9W2yBEhgHPFWMg9Gip 8wMcoAeqiWjCoXFLjZrcocM24fSBiexd+Scge9v01cAj31rcl7gAtxP16powurWk /VbO1AwzT2YdCTzBahCptYbEePpX9IliDAfvZCSBj3E7PUrWNlNgz/m+eZbxxWb6 hZpmv7Xy3slpAbLstNiNdnmT3vbyF4mcuSj9AuDC6RcYbdTPnMAbfgzubw2VXBim Mm9/gzpYZsSCkXqi5d1BCuHFZ2Uhfh8sT7IEDLhnnmDDIUGj2YVadI7a1SaLhbrj 88dX/Qr6ioWVvPQYd/JLHBKzRdsCzivIHjbmL79WZj0xJqL2Xgu36GasEkAhz8Nv Rh41MK0wpFiAkmCxJZJmN7TsmiopTb2wtu1+gQnmXm3TiMqBrixfJSSI5UZ35SLm UJsbG/JBcuW465EmaG63u6wGzvC3ln8IrOuGV14YKsELcKV4+hw= =4jZj -----END PGP SIGNATURE----- Merge tag 'pinctrl-v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control fixes from Linus Walleij: - Fix an issue in the AMD driver for the UART0 group - Fix a glitch issue in the Baytrail pin controller * tag 'pinctrl-v5.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH) pinctrl: amd: fix npins for uart0 in kerncz_groups
This commit is contained in:
commit
25aadbd2a8
@ -800,6 +800,21 @@ static void byt_gpio_disable_free(struct pinctrl_dev *pctl_dev,
|
||||
pm_runtime_put(vg->dev);
|
||||
}
|
||||
|
||||
static void byt_gpio_direct_irq_check(struct intel_pinctrl *vg,
|
||||
unsigned int offset)
|
||||
{
|
||||
void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
|
||||
|
||||
/*
|
||||
* Before making any direction modifications, do a check if gpio is set
|
||||
* for direct IRQ. On Bay Trail, setting GPIO to output does not make
|
||||
* sense, so let's at least inform the caller before they shoot
|
||||
* themselves in the foot.
|
||||
*/
|
||||
if (readl(conf_reg) & BYT_DIRECT_IRQ_EN)
|
||||
dev_info_once(vg->dev, "Potential Error: Setting GPIO with direct_irq_en to output");
|
||||
}
|
||||
|
||||
static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
|
||||
struct pinctrl_gpio_range *range,
|
||||
unsigned int offset,
|
||||
@ -807,7 +822,6 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
|
||||
{
|
||||
struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctl_dev);
|
||||
void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
|
||||
void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
|
||||
unsigned long flags;
|
||||
u32 value;
|
||||
|
||||
@ -817,14 +831,8 @@ static int byt_gpio_set_direction(struct pinctrl_dev *pctl_dev,
|
||||
value &= ~BYT_DIR_MASK;
|
||||
if (input)
|
||||
value |= BYT_OUTPUT_EN;
|
||||
else if (readl(conf_reg) & BYT_DIRECT_IRQ_EN)
|
||||
/*
|
||||
* Before making any direction modifications, do a check if gpio
|
||||
* is set for direct IRQ. On baytrail, setting GPIO to output
|
||||
* does not make sense, so let's at least inform the caller before
|
||||
* they shoot themselves in the foot.
|
||||
*/
|
||||
dev_info_once(vg->dev, "Potential Error: Setting GPIO with direct_irq_en to output");
|
||||
else
|
||||
byt_gpio_direct_irq_check(vg, offset);
|
||||
|
||||
writel(value, val_reg);
|
||||
|
||||
@ -1165,19 +1173,50 @@ static int byt_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
|
||||
|
||||
static int byt_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
return pinctrl_gpio_direction_input(chip->base + offset);
|
||||
struct intel_pinctrl *vg = gpiochip_get_data(chip);
|
||||
void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
raw_spin_lock_irqsave(&byt_lock, flags);
|
||||
|
||||
reg = readl(val_reg);
|
||||
reg &= ~BYT_DIR_MASK;
|
||||
reg |= BYT_OUTPUT_EN;
|
||||
writel(reg, val_reg);
|
||||
|
||||
raw_spin_unlock_irqrestore(&byt_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note despite the temptation this MUST NOT be converted into a call to
|
||||
* pinctrl_gpio_direction_output() + byt_gpio_set() that does not work this
|
||||
* MUST be done as a single BYT_VAL_REG register write.
|
||||
* See the commit message of the commit adding this comment for details.
|
||||
*/
|
||||
static int byt_gpio_direction_output(struct gpio_chip *chip,
|
||||
unsigned int offset, int value)
|
||||
{
|
||||
int ret = pinctrl_gpio_direction_output(chip->base + offset);
|
||||
struct intel_pinctrl *vg = gpiochip_get_data(chip);
|
||||
void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
|
||||
unsigned long flags;
|
||||
u32 reg;
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
raw_spin_lock_irqsave(&byt_lock, flags);
|
||||
|
||||
byt_gpio_set(chip, offset, value);
|
||||
byt_gpio_direct_irq_check(vg, offset);
|
||||
|
||||
reg = readl(val_reg);
|
||||
reg &= ~BYT_DIR_MASK;
|
||||
if (value)
|
||||
reg |= BYT_LEVEL;
|
||||
else
|
||||
reg &= ~BYT_LEVEL;
|
||||
|
||||
writel(reg, val_reg);
|
||||
|
||||
raw_spin_unlock_irqrestore(&byt_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ static const struct amd_pingroup kerncz_groups[] = {
|
||||
{
|
||||
.name = "uart0",
|
||||
.pins = uart0_pins,
|
||||
.npins = 9,
|
||||
.npins = 5,
|
||||
},
|
||||
{
|
||||
.name = "uart1",
|
||||
|
Loading…
Reference in New Issue
Block a user