Skip to content

Commit 474932a

Browse files
author
Linus Walleij
committed
Merge tag 'intel-pinctrl-v5.17-4' of gitolite.kernel.org:pub/scm/linux/kernel/git/pinctrl/intel into fixes
intel-pinctrl for v5.17-4 * Couple of fixes on how Intel driver handles an interrupt * Revert pin renaming change in ZynqMQ as it appears to be part of the Device Tree bindings * Fix ordering of the files in the Makefile The following is an automated git shortlog grouped by driver: intel: - Fix a glitch when updating IRQ flags on a preconfigured line - fix unexpected interrupt Place correctly CONFIG_PINCTRL_ST in the Makefile: - Place correctly CONFIG_PINCTRL_ST in the Makefile zynqmp: - Revert "Unify pin naming"
2 parents 1fd6bb5 + 500c77e commit 474932a

3 files changed

Lines changed: 41 additions & 35 deletions

File tree

drivers/pinctrl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ obj-$(CONFIG_PINCTRL_PISTACHIO) += pinctrl-pistachio.o
4242
obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o
4343
obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o
4444
obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
45+
obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
4546
obj-$(CONFIG_PINCTRL_STARFIVE) += pinctrl-starfive.o
4647
obj-$(CONFIG_PINCTRL_STMFX) += pinctrl-stmfx.o
47-
obj-$(CONFIG_PINCTRL_ST) += pinctrl-st.o
4848
obj-$(CONFIG_PINCTRL_SX150X) += pinctrl-sx150x.o
4949
obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o
5050
obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
451451
value &= ~PADCFG0_PMODE_MASK;
452452
value |= PADCFG0_PMODE_GPIO;
453453

454-
/* Disable input and output buffers */
455-
value |= PADCFG0_GPIORXDIS;
454+
/* Disable TX buffer and enable RX (this will be input) */
455+
value &= ~PADCFG0_GPIORXDIS;
456456
value |= PADCFG0_GPIOTXDIS;
457457

458458
/* Disable SCI/SMI/NMI generation */
@@ -497,9 +497,6 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev,
497497

498498
intel_gpio_set_gpio_mode(padcfg0);
499499

500-
/* Disable TX buffer and enable RX (this will be input) */
501-
__intel_gpio_set_direction(padcfg0, true);
502-
503500
raw_spin_unlock_irqrestore(&pctrl->lock, flags);
504501

505502
return 0;
@@ -1115,9 +1112,6 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type)
11151112

11161113
intel_gpio_set_gpio_mode(reg);
11171114

1118-
/* Disable TX buffer and enable RX (this will be input) */
1119-
__intel_gpio_set_direction(reg, true);
1120-
11211115
value = readl(reg);
11221116

11231117
value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV);
@@ -1216,6 +1210,39 @@ static irqreturn_t intel_gpio_irq(int irq, void *data)
12161210
return IRQ_RETVAL(ret);
12171211
}
12181212

1213+
static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1214+
{
1215+
int i;
1216+
1217+
for (i = 0; i < pctrl->ncommunities; i++) {
1218+
const struct intel_community *community;
1219+
void __iomem *base;
1220+
unsigned int gpp;
1221+
1222+
community = &pctrl->communities[i];
1223+
base = community->regs;
1224+
1225+
for (gpp = 0; gpp < community->ngpps; gpp++) {
1226+
/* Mask and clear all interrupts */
1227+
writel(0, base + community->ie_offset + gpp * 4);
1228+
writel(0xffff, base + community->is_offset + gpp * 4);
1229+
}
1230+
}
1231+
}
1232+
1233+
static int intel_gpio_irq_init_hw(struct gpio_chip *gc)
1234+
{
1235+
struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1236+
1237+
/*
1238+
* Make sure the interrupt lines are in a proper state before
1239+
* further configuration.
1240+
*/
1241+
intel_gpio_irq_init(pctrl);
1242+
1243+
return 0;
1244+
}
1245+
12191246
static int intel_gpio_add_community_ranges(struct intel_pinctrl *pctrl,
12201247
const struct intel_community *community)
12211248
{
@@ -1320,6 +1347,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
13201347
girq->num_parents = 0;
13211348
girq->default_type = IRQ_TYPE_NONE;
13221349
girq->handler = handle_bad_irq;
1350+
girq->init_hw = intel_gpio_irq_init_hw;
13231351

13241352
ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
13251353
if (ret) {
@@ -1695,26 +1723,6 @@ int intel_pinctrl_suspend_noirq(struct device *dev)
16951723
}
16961724
EXPORT_SYMBOL_GPL(intel_pinctrl_suspend_noirq);
16971725

1698-
static void intel_gpio_irq_init(struct intel_pinctrl *pctrl)
1699-
{
1700-
size_t i;
1701-
1702-
for (i = 0; i < pctrl->ncommunities; i++) {
1703-
const struct intel_community *community;
1704-
void __iomem *base;
1705-
unsigned int gpp;
1706-
1707-
community = &pctrl->communities[i];
1708-
base = community->regs;
1709-
1710-
for (gpp = 0; gpp < community->ngpps; gpp++) {
1711-
/* Mask and clear all interrupts */
1712-
writel(0, base + community->ie_offset + gpp * 4);
1713-
writel(0xffff, base + community->is_offset + gpp * 4);
1714-
}
1715-
}
1716-
}
1717-
17181726
static bool intel_gpio_update_reg(void __iomem *reg, u32 mask, u32 value)
17191727
{
17201728
u32 curr, updated;

drivers/pinctrl/pinctrl-zynqmp.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,6 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev,
809809
unsigned int *npins)
810810
{
811811
struct pinctrl_pin_desc *pins, *pin;
812-
char **pin_names;
813812
int ret;
814813
int i;
815814

@@ -821,14 +820,13 @@ static int zynqmp_pinctrl_prepare_pin_desc(struct device *dev,
821820
if (!pins)
822821
return -ENOMEM;
823822

824-
pin_names = devm_kasprintf_strarray(dev, ZYNQMP_PIN_PREFIX, *npins);
825-
if (IS_ERR(pin_names))
826-
return PTR_ERR(pin_names);
827-
828823
for (i = 0; i < *npins; i++) {
829824
pin = &pins[i];
830825
pin->number = i;
831-
pin->name = pin_names[i];
826+
pin->name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
827+
ZYNQMP_PIN_PREFIX, i);
828+
if (!pin->name)
829+
return -ENOMEM;
832830
}
833831

834832
*zynqmp_pins = pins;

0 commit comments

Comments
 (0)