aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-26 12:08:49 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-26 12:08:49 -0500
commit928d336a93534df66c0448db61cc4d22705e5b9e (patch)
tree8f5ad96886d0a2e2a1d9c085c709aa46176c8ed2
parentbed7b016091d2f9bdc3f3c28899b33adab7c4786 (diff)
parentdf1539c25cce98e2ac69881958850c6535240707 (diff)
Merge tag 'pinctrl-v4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "A bunch of pin control fixes for v4.10 that didn't get sent off until now, sorry for the delay. It's only driver fixes: - A bunch of fixes to the Intel drivers: broxton, baytrail. Bugs related to register offsets, IRQ, debounce functionality. - Fix a conflict amongst UART settings on the meson. - Fix the ethernet setting on the Uniphier. - A compilation warning squelched" * tag 'pinctrl-v4.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: uniphier: fix Ethernet (RMII) pin-mux setting for LD20 pinctrl: meson: fix uart_ao_b for GXBB and GXL/GXM pinctrl: amd: avoid maybe-uninitalized warning pinctrl: baytrail: Do not add all GPIOs to IRQ domain pinctrl: baytrail: Rectify debounce support pinctrl: intel: Set pin direction properly pinctrl: broxton: Use correct PADCFGLOCK offset
-rw-r--r--drivers/pinctrl/intel/pinctrl-baytrail.c39
-rw-r--r--drivers/pinctrl/intel/pinctrl-broxton.c2
-rw-r--r--drivers/pinctrl/intel/pinctrl-intel.c30
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson-gxbb.c7
-rw-r--r--drivers/pinctrl/meson/pinctrl-meson-gxl.c7
-rw-r--r--drivers/pinctrl/pinctrl-amd.c2
-rw-r--r--drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c2
7 files changed, 54 insertions, 35 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c
index 37300634b7d2..c123488266ce 100644
--- a/drivers/pinctrl/intel/pinctrl-baytrail.c
+++ b/drivers/pinctrl/intel/pinctrl-baytrail.c
@@ -1092,6 +1092,7 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset,
1092 enum pin_config_param param = pinconf_to_config_param(*config); 1092 enum pin_config_param param = pinconf_to_config_param(*config);
1093 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 1093 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
1094 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1094 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
1095 void __iomem *db_reg = byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG);
1095 unsigned long flags; 1096 unsigned long flags;
1096 u32 conf, pull, val, debounce; 1097 u32 conf, pull, val, debounce;
1097 u16 arg = 0; 1098 u16 arg = 0;
@@ -1128,7 +1129,7 @@ static int byt_pin_config_get(struct pinctrl_dev *pctl_dev, unsigned int offset,
1128 return -EINVAL; 1129 return -EINVAL;
1129 1130
1130 raw_spin_lock_irqsave(&vg->lock, flags); 1131 raw_spin_lock_irqsave(&vg->lock, flags);
1131 debounce = readl(byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG)); 1132 debounce = readl(db_reg);
1132 raw_spin_unlock_irqrestore(&vg->lock, flags); 1133 raw_spin_unlock_irqrestore(&vg->lock, flags);
1133 1134
1134 switch (debounce & BYT_DEBOUNCE_PULSE_MASK) { 1135 switch (debounce & BYT_DEBOUNCE_PULSE_MASK) {
@@ -1176,6 +1177,7 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
1176 unsigned int param, arg; 1177 unsigned int param, arg;
1177 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG); 1178 void __iomem *conf_reg = byt_gpio_reg(vg, offset, BYT_CONF0_REG);
1178 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG); 1179 void __iomem *val_reg = byt_gpio_reg(vg, offset, BYT_VAL_REG);
1180 void __iomem *db_reg = byt_gpio_reg(vg, offset, BYT_DEBOUNCE_REG);
1179 unsigned long flags; 1181 unsigned long flags;
1180 u32 conf, val, debounce; 1182 u32 conf, val, debounce;
1181 int i, ret = 0; 1183 int i, ret = 0;
@@ -1238,36 +1240,40 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
1238 1240
1239 break; 1241 break;
1240 case PIN_CONFIG_INPUT_DEBOUNCE: 1242 case PIN_CONFIG_INPUT_DEBOUNCE:
1241 debounce = readl(byt_gpio_reg(vg, offset, 1243 debounce = readl(db_reg);
1242 BYT_DEBOUNCE_REG)); 1244 debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
1243 conf &= ~BYT_DEBOUNCE_PULSE_MASK;
1244 1245
1245 switch (arg) { 1246 switch (arg) {
1247 case 0:
1248 conf &= BYT_DEBOUNCE_EN;
1249 break;
1246 case 375: 1250 case 375:
1247 conf |= BYT_DEBOUNCE_PULSE_375US; 1251 debounce |= BYT_DEBOUNCE_PULSE_375US;
1248 break; 1252 break;
1249 case 750: 1253 case 750:
1250 conf |= BYT_DEBOUNCE_PULSE_750US; 1254 debounce |= BYT_DEBOUNCE_PULSE_750US;
1251 break; 1255 break;
1252 case 1500: 1256 case 1500:
1253 conf |= BYT_DEBOUNCE_PULSE_1500US; 1257 debounce |= BYT_DEBOUNCE_PULSE_1500US;
1254 break; 1258 break;
1255 case 3000: 1259 case 3000:
1256 conf |= BYT_DEBOUNCE_PULSE_3MS; 1260 debounce |= BYT_DEBOUNCE_PULSE_3MS;
1257 break; 1261 break;
1258 case 6000: 1262 case 6000:
1259 conf |= BYT_DEBOUNCE_PULSE_6MS; 1263 debounce |= BYT_DEBOUNCE_PULSE_6MS;
1260 break; 1264 break;
1261 case 12000: 1265 case 12000:
1262 conf |= BYT_DEBOUNCE_PULSE_12MS; 1266 debounce |= BYT_DEBOUNCE_PULSE_12MS;
1263 break; 1267 break;
1264 case 24000: 1268 case 24000:
1265 conf |= BYT_DEBOUNCE_PULSE_24MS; 1269 debounce |= BYT_DEBOUNCE_PULSE_24MS;
1266 break; 1270 break;
1267 default: 1271 default:
1268 ret = -EINVAL; 1272 ret = -EINVAL;
1269 } 1273 }
1270 1274
1275 if (!ret)
1276 writel(debounce, db_reg);
1271 break; 1277 break;
1272 default: 1278 default:
1273 ret = -ENOTSUPP; 1279 ret = -ENOTSUPP;
@@ -1617,6 +1623,8 @@ static void byt_gpio_irq_handler(struct irq_desc *desc)
1617 1623
1618static void byt_gpio_irq_init_hw(struct byt_gpio *vg) 1624static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
1619{ 1625{
1626 struct gpio_chip *gc = &vg->chip;
1627 struct device *dev = &vg->pdev->dev;
1620 void __iomem *reg; 1628 void __iomem *reg;
1621 u32 base, value; 1629 u32 base, value;
1622 int i; 1630 int i;
@@ -1638,10 +1646,12 @@ static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
1638 } 1646 }
1639 1647
1640 value = readl(reg); 1648 value = readl(reg);
1641 if ((value & BYT_PIN_MUX) == byt_get_gpio_mux(vg, i) && 1649 if (value & BYT_DIRECT_IRQ_EN) {
1642 !(value & BYT_DIRECT_IRQ_EN)) { 1650 clear_bit(i, gc->irq_valid_mask);
1651 dev_dbg(dev, "excluding GPIO %d from IRQ domain\n", i);
1652 } else if ((value & BYT_PIN_MUX) == byt_get_gpio_mux(vg, i)) {
1643 byt_gpio_clear_triggering(vg, i); 1653 byt_gpio_clear_triggering(vg, i);
1644 dev_dbg(&vg->pdev->dev, "disabling GPIO %d\n", i); 1654 dev_dbg(dev, "disabling GPIO %d\n", i);
1645 } 1655 }
1646 } 1656 }
1647 1657
@@ -1680,6 +1690,7 @@ static int byt_gpio_probe(struct byt_gpio *vg)
1680 gc->can_sleep = false; 1690 gc->can_sleep = false;
1681 gc->parent = &vg->pdev->dev; 1691 gc->parent = &vg->pdev->dev;
1682 gc->ngpio = vg->soc_data->npins; 1692 gc->ngpio = vg->soc_data->npins;
1693 gc->irq_need_valid_mask = true;
1683 1694
1684#ifdef CONFIG_PM_SLEEP 1695#ifdef CONFIG_PM_SLEEP
1685 vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio, 1696 vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio,
diff --git a/drivers/pinctrl/intel/pinctrl-broxton.c b/drivers/pinctrl/intel/pinctrl-broxton.c
index 59cb7a6fc5be..901b356b09d7 100644
--- a/drivers/pinctrl/intel/pinctrl-broxton.c
+++ b/drivers/pinctrl/intel/pinctrl-broxton.c
@@ -19,7 +19,7 @@
19 19
20#define BXT_PAD_OWN 0x020 20#define BXT_PAD_OWN 0x020
21#define BXT_HOSTSW_OWN 0x080 21#define BXT_HOSTSW_OWN 0x080
22#define BXT_PADCFGLOCK 0x090 22#define BXT_PADCFGLOCK 0x060
23#define BXT_GPI_IE 0x110 23#define BXT_GPI_IE 0x110
24 24
25#define BXT_COMMUNITY(s, e) \ 25#define BXT_COMMUNITY(s, e) \
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 1e139672f1af..6df35dcb29ae 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -353,6 +353,21 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned function,
353 return 0; 353 return 0;
354} 354}
355 355
356static void __intel_gpio_set_direction(void __iomem *padcfg0, bool input)
357{
358 u32 value;
359
360 value = readl(padcfg0);
361 if (input) {
362 value &= ~PADCFG0_GPIORXDIS;
363 value |= PADCFG0_GPIOTXDIS;
364 } else {
365 value &= ~PADCFG0_GPIOTXDIS;
366 value |= PADCFG0_GPIORXDIS;
367 }
368 writel(value, padcfg0);
369}
370
356static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, 371static int intel_gpio_request_enable(struct pinctrl_dev *pctldev,
357 struct pinctrl_gpio_range *range, 372 struct pinctrl_gpio_range *range,
358 unsigned pin) 373 unsigned pin)
@@ -375,11 +390,11 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev,
375 /* Disable SCI/SMI/NMI generation */ 390 /* Disable SCI/SMI/NMI generation */
376 value &= ~(PADCFG0_GPIROUTIOXAPIC | PADCFG0_GPIROUTSCI); 391 value &= ~(PADCFG0_GPIROUTIOXAPIC | PADCFG0_GPIROUTSCI);
377 value &= ~(PADCFG0_GPIROUTSMI | PADCFG0_GPIROUTNMI); 392 value &= ~(PADCFG0_GPIROUTSMI | PADCFG0_GPIROUTNMI);
378 /* Disable TX buffer and enable RX (this will be input) */
379 value &= ~PADCFG0_GPIORXDIS;
380 value |= PADCFG0_GPIOTXDIS;
381 writel(value, padcfg0); 393 writel(value, padcfg0);
382 394
395 /* Disable TX buffer and enable RX (this will be input) */
396 __intel_gpio_set_direction(padcfg0, true);
397
383 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 398 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
384 399
385 return 0; 400 return 0;
@@ -392,18 +407,11 @@ static int intel_gpio_set_direction(struct pinctrl_dev *pctldev,
392 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 407 struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
393 void __iomem *padcfg0; 408 void __iomem *padcfg0;
394 unsigned long flags; 409 unsigned long flags;
395 u32 value;
396 410
397 raw_spin_lock_irqsave(&pctrl->lock, flags); 411 raw_spin_lock_irqsave(&pctrl->lock, flags);
398 412
399 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); 413 padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0);
400 414 __intel_gpio_set_direction(padcfg0, input);
401 value = readl(padcfg0);
402 if (input)
403 value |= PADCFG0_GPIOTXDIS;
404 else
405 value &= ~PADCFG0_GPIOTXDIS;
406 writel(value, padcfg0);
407 415
408 raw_spin_unlock_irqrestore(&pctrl->lock, flags); 416 raw_spin_unlock_irqrestore(&pctrl->lock, flags);
409 417
diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
index c3928aa3fefa..e0bca4df2a2f 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxbb.c
@@ -253,9 +253,8 @@ static const unsigned int uart_tx_ao_a_pins[] = { PIN(GPIOAO_0, 0) };
253static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, 0) }; 253static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, 0) };
254static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, 0) }; 254static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, 0) };
255static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, 0) }; 255static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, 0) };
256static const unsigned int uart_tx_ao_b_pins[] = { PIN(GPIOAO_0, 0) }; 256static const unsigned int uart_tx_ao_b_pins[] = { PIN(GPIOAO_4, 0) };
257static const unsigned int uart_rx_ao_b_pins[] = { PIN(GPIOAO_1, 0), 257static const unsigned int uart_rx_ao_b_pins[] = { PIN(GPIOAO_5, 0) };
258 PIN(GPIOAO_5, 0) };
259static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, 0) }; 258static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, 0) };
260static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) }; 259static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) };
261 260
@@ -498,7 +497,7 @@ static struct meson_pmx_group meson_gxbb_aobus_groups[] = {
498 GPIO_GROUP(GPIOAO_13, 0), 497 GPIO_GROUP(GPIOAO_13, 0),
499 498
500 /* bank AO */ 499 /* bank AO */
501 GROUP(uart_tx_ao_b, 0, 26), 500 GROUP(uart_tx_ao_b, 0, 24),
502 GROUP(uart_rx_ao_b, 0, 25), 501 GROUP(uart_rx_ao_b, 0, 25),
503 GROUP(uart_tx_ao_a, 0, 12), 502 GROUP(uart_tx_ao_a, 0, 12),
504 GROUP(uart_rx_ao_a, 0, 11), 503 GROUP(uart_rx_ao_a, 0, 11),
diff --git a/drivers/pinctrl/meson/pinctrl-meson-gxl.c b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
index 25694f7094c7..b69743b07a1d 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gxl.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gxl.c
@@ -214,9 +214,8 @@ static const unsigned int uart_tx_ao_a_pins[] = { PIN(GPIOAO_0, 0) };
214static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, 0) }; 214static const unsigned int uart_rx_ao_a_pins[] = { PIN(GPIOAO_1, 0) };
215static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, 0) }; 215static const unsigned int uart_cts_ao_a_pins[] = { PIN(GPIOAO_2, 0) };
216static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, 0) }; 216static const unsigned int uart_rts_ao_a_pins[] = { PIN(GPIOAO_3, 0) };
217static const unsigned int uart_tx_ao_b_pins[] = { PIN(GPIOAO_0, 0) }; 217static const unsigned int uart_tx_ao_b_pins[] = { PIN(GPIOAO_4, 0) };
218static const unsigned int uart_rx_ao_b_pins[] = { PIN(GPIOAO_1, 0), 218static const unsigned int uart_rx_ao_b_pins[] = { PIN(GPIOAO_5, 0) };
219 PIN(GPIOAO_5, 0) };
220static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, 0) }; 219static const unsigned int uart_cts_ao_b_pins[] = { PIN(GPIOAO_2, 0) };
221static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) }; 220static const unsigned int uart_rts_ao_b_pins[] = { PIN(GPIOAO_3, 0) };
222 221
@@ -409,7 +408,7 @@ static struct meson_pmx_group meson_gxl_aobus_groups[] = {
409 GPIO_GROUP(GPIOAO_9, 0), 408 GPIO_GROUP(GPIOAO_9, 0),
410 409
411 /* bank AO */ 410 /* bank AO */
412 GROUP(uart_tx_ao_b, 0, 26), 411 GROUP(uart_tx_ao_b, 0, 24),
413 GROUP(uart_rx_ao_b, 0, 25), 412 GROUP(uart_rx_ao_b, 0, 25),
414 GROUP(uart_tx_ao_a, 0, 12), 413 GROUP(uart_tx_ao_a, 0, 12),
415 GROUP(uart_rx_ao_a, 0, 11), 414 GROUP(uart_rx_ao_a, 0, 11),
diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c
index c9a146948192..537b52055756 100644
--- a/drivers/pinctrl/pinctrl-amd.c
+++ b/drivers/pinctrl/pinctrl-amd.c
@@ -202,6 +202,8 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
202 i = 128; 202 i = 128;
203 pin_num = AMD_GPIO_PINS_BANK2 + i; 203 pin_num = AMD_GPIO_PINS_BANK2 + i;
204 break; 204 break;
205 default:
206 return;
205 } 207 }
206 208
207 for (; i < pin_num; i++) { 209 for (; i < pin_num; i++) {
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c
index aa8bd9794683..96686336e3a3 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c
@@ -561,7 +561,7 @@ static const int ether_rgmii_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
561 0, 0, 0, 0}; 561 0, 0, 0, 0};
562static const unsigned ether_rmii_pins[] = {30, 31, 32, 33, 34, 35, 36, 37, 39, 562static const unsigned ether_rmii_pins[] = {30, 31, 32, 33, 34, 35, 36, 37, 39,
563 41, 42, 45}; 563 41, 42, 45};
564static const int ether_rmii_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; 564static const int ether_rmii_muxvals[] = {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
565static const unsigned i2c0_pins[] = {63, 64}; 565static const unsigned i2c0_pins[] = {63, 64};
566static const int i2c0_muxvals[] = {0, 0}; 566static const int i2c0_muxvals[] = {0, 0};
567static const unsigned i2c1_pins[] = {65, 66}; 567static const unsigned i2c1_pins[] = {65, 66};