Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'intel-pinctrl-v5.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel into devel

intel-pinctrl for v5.8-1

* Introduce GPIO driver for Jasper Lake
* Fix long standing bug in Sunrisepoint-H PAD locking code
* Enable pin configuration setting for GPIO chip for Baytrail
* Work around race condition in Cherriview hardware when handle IRQ
* Clean up Cherryview code to be closer to other drivers

The following is an automated git shortlog grouped by driver:

baytrail:
- Use platform_get_irq_optional() explicitly
- Enable pin configuration setting for GPIO chip

cannonlake:
- Use generic flag for special GPIO base treatment

cherryview:
- Add missing spinlock usage in chv_gpio_irq_handler
- Use GENMASK() consistently
- Re-use data structures from pinctrl-intel.h (part 2)

icelake:
- Use generic flag for special GPIO base treatment

intel:
- Move npins closer to pin_base in struct intel_community
- Update description in struct intel_community
- Add Intel Jasper Lake pin controller support
- Introduce new flag to force GPIO base to be 0
- Introduce common flags for GPIO mapping scheme

lynxpoint:
- Use platform_get_irq_optional() explicitly

sunrisepoint:
- Fix PAD lock register offset for SPT-H

tigerlake:
- Use generic flag for special GPIO base treatment

+572 -265
+8
drivers/pinctrl/intel/Kconfig
··· 111 111 This pinctrl driver provides an interface that allows configuring 112 112 of Intel Ice Lake PCH pins and using them as GPIOs. 113 113 114 + config PINCTRL_JASPERLAKE 115 + tristate "Intel Jasper Lake PCH pinctrl and GPIO driver" 116 + depends on ACPI 117 + select PINCTRL_INTEL 118 + help 119 + This pinctrl driver provides an interface that allows configuring 120 + of Intel Jasper Lake PCH pins and using them as GPIOs. 121 + 114 122 config PINCTRL_LEWISBURG 115 123 tristate "Intel Lewisburg pinctrl and GPIO driver" 116 124 depends on ACPI
+1
drivers/pinctrl/intel/Makefile
··· 12 12 obj-$(CONFIG_PINCTRL_DENVERTON) += pinctrl-denverton.o 13 13 obj-$(CONFIG_PINCTRL_GEMINILAKE) += pinctrl-geminilake.o 14 14 obj-$(CONFIG_PINCTRL_ICELAKE) += pinctrl-icelake.o 15 + obj-$(CONFIG_PINCTRL_JASPERLAKE) += pinctrl-jasperlake.o 15 16 obj-$(CONFIG_PINCTRL_LEWISBURG) += pinctrl-lewisburg.o 16 17 obj-$(CONFIG_PINCTRL_SUNRISEPOINT) += pinctrl-sunrisepoint.o 17 18 obj-$(CONFIG_PINCTRL_TIGERLAKE) += pinctrl-tigerlake.o
+5 -5
drivers/pinctrl/intel/pinctrl-baytrail.c
··· 1286 1286 .direction_output = byt_gpio_direction_output, 1287 1287 .get = byt_gpio_get, 1288 1288 .set = byt_gpio_set, 1289 + .set_config = gpiochip_generic_config, 1289 1290 .dbg_show = byt_gpio_dbg_show, 1290 1291 }; 1291 1292 ··· 1506 1505 { 1507 1506 struct platform_device *pdev = to_platform_device(vg->dev); 1508 1507 struct gpio_chip *gc; 1509 - struct resource *irq_rc; 1510 - int ret; 1508 + int irq, ret; 1511 1509 1512 1510 /* Set up gpio chip */ 1513 1511 vg->chip = byt_gpio_chip; ··· 1526 1526 #endif 1527 1527 1528 1528 /* set up interrupts */ 1529 - irq_rc = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1530 - if (irq_rc && irq_rc->start) { 1529 + irq = platform_get_irq_optional(pdev, 0); 1530 + if (irq > 0) { 1531 1531 struct gpio_irq_chip *girq; 1532 1532 1533 1533 vg->irqchip.name = "BYT-GPIO", ··· 1547 1547 sizeof(*girq->parents), GFP_KERNEL); 1548 1548 if (!girq->parents) 1549 1549 return -ENOMEM; 1550 - girq->parents[0] = (unsigned int)irq_rc->start; 1550 + girq->parents[0] = irq; 1551 1551 girq->default_type = IRQ_TYPE_NONE; 1552 1552 girq->handler = handle_bad_irq; 1553 1553 }
+28 -30
drivers/pinctrl/intel/pinctrl-cannonlake.c
··· 30 30 .gpio_base = (g), \ 31 31 } 32 32 33 - #define CNL_NO_GPIO -1 34 - 35 33 #define CNL_COMMUNITY(b, s, e, o, g) \ 36 34 { \ 37 35 .barno = (b), \ ··· 375 377 }; 376 378 377 379 static const struct intel_padgroup cnlh_community1_gpps[] = { 378 - CNL_GPP(0, 51, 74, 64), /* GPP_C */ 379 - CNL_GPP(1, 75, 98, 96), /* GPP_D */ 380 - CNL_GPP(2, 99, 106, 128), /* GPP_G */ 381 - CNL_GPP(3, 107, 114, CNL_NO_GPIO), /* AZA */ 382 - CNL_GPP(4, 115, 146, 160), /* vGPIO_0 */ 383 - CNL_GPP(5, 147, 154, CNL_NO_GPIO), /* vGPIO_1 */ 380 + CNL_GPP(0, 51, 74, 64), /* GPP_C */ 381 + CNL_GPP(1, 75, 98, 96), /* GPP_D */ 382 + CNL_GPP(2, 99, 106, 128), /* GPP_G */ 383 + CNL_GPP(3, 107, 114, INTEL_GPIO_BASE_NOMAP), /* AZA */ 384 + CNL_GPP(4, 115, 146, 160), /* vGPIO_0 */ 385 + CNL_GPP(5, 147, 154, INTEL_GPIO_BASE_NOMAP), /* vGPIO_1 */ 384 386 }; 385 387 386 388 static const struct intel_padgroup cnlh_community3_gpps[] = { 387 - CNL_GPP(0, 155, 178, 192), /* GPP_K */ 388 - CNL_GPP(1, 179, 202, 224), /* GPP_H */ 389 - CNL_GPP(2, 203, 215, 256), /* GPP_E */ 390 - CNL_GPP(3, 216, 239, 288), /* GPP_F */ 391 - CNL_GPP(4, 240, 248, CNL_NO_GPIO), /* SPI */ 389 + CNL_GPP(0, 155, 178, 192), /* GPP_K */ 390 + CNL_GPP(1, 179, 202, 224), /* GPP_H */ 391 + CNL_GPP(2, 203, 215, 256), /* GPP_E */ 392 + CNL_GPP(3, 216, 239, 288), /* GPP_F */ 393 + CNL_GPP(4, 240, 248, INTEL_GPIO_BASE_NOMAP), /* SPI */ 392 394 }; 393 395 394 396 static const struct intel_padgroup cnlh_community4_gpps[] = { 395 - CNL_GPP(0, 249, 259, CNL_NO_GPIO), /* CPU */ 396 - CNL_GPP(1, 260, 268, CNL_NO_GPIO), /* JTAG */ 397 - CNL_GPP(2, 269, 286, 320), /* GPP_I */ 398 - CNL_GPP(3, 287, 298, 352), /* GPP_J */ 397 + CNL_GPP(0, 249, 259, INTEL_GPIO_BASE_NOMAP), /* CPU */ 398 + CNL_GPP(1, 260, 268, INTEL_GPIO_BASE_NOMAP), /* JTAG */ 399 + CNL_GPP(2, 269, 286, 320), /* GPP_I */ 400 + CNL_GPP(3, 287, 298, 352), /* GPP_J */ 399 401 }; 400 402 401 403 static const unsigned int cnlh_spi0_pins[] = { 40, 41, 42, 43 }; ··· 788 790 }; 789 791 790 792 static const struct intel_padgroup cnllp_community0_gpps[] = { 791 - CNL_GPP(0, 0, 24, 0), /* GPP_A */ 792 - CNL_GPP(1, 25, 50, 32), /* GPP_B */ 793 - CNL_GPP(2, 51, 58, 64), /* GPP_G */ 794 - CNL_GPP(3, 59, 67, CNL_NO_GPIO), /* SPI */ 793 + CNL_GPP(0, 0, 24, 0), /* GPP_A */ 794 + CNL_GPP(1, 25, 50, 32), /* GPP_B */ 795 + CNL_GPP(2, 51, 58, 64), /* GPP_G */ 796 + CNL_GPP(3, 59, 67, INTEL_GPIO_BASE_NOMAP), /* SPI */ 795 797 }; 796 798 797 799 static const struct intel_padgroup cnllp_community1_gpps[] = { 798 - CNL_GPP(0, 68, 92, 96), /* GPP_D */ 799 - CNL_GPP(1, 93, 116, 128), /* GPP_F */ 800 - CNL_GPP(2, 117, 140, 160), /* GPP_H */ 801 - CNL_GPP(3, 141, 172, 192), /* vGPIO */ 802 - CNL_GPP(4, 173, 180, 224), /* vGPIO */ 800 + CNL_GPP(0, 68, 92, 96), /* GPP_D */ 801 + CNL_GPP(1, 93, 116, 128), /* GPP_F */ 802 + CNL_GPP(2, 117, 140, 160), /* GPP_H */ 803 + CNL_GPP(3, 141, 172, 192), /* vGPIO */ 804 + CNL_GPP(4, 173, 180, 224), /* vGPIO */ 803 805 }; 804 806 805 807 static const struct intel_padgroup cnllp_community4_gpps[] = { 806 - CNL_GPP(0, 181, 204, 256), /* GPP_C */ 807 - CNL_GPP(1, 205, 228, 288), /* GPP_E */ 808 - CNL_GPP(2, 229, 237, CNL_NO_GPIO), /* JTAG */ 809 - CNL_GPP(3, 238, 243, CNL_NO_GPIO), /* HVCMOS */ 808 + CNL_GPP(0, 181, 204, 256), /* GPP_C */ 809 + CNL_GPP(1, 205, 228, 288), /* GPP_E */ 810 + CNL_GPP(2, 229, 237, INTEL_GPIO_BASE_NOMAP), /* JTAG */ 811 + CNL_GPP(3, 238, 243, INTEL_GPIO_BASE_NOMAP), /* HVCMOS */ 810 812 }; 811 813 812 814 static const struct intel_community cnllp_communities[] = {
+108 -172
drivers/pinctrl/intel/pinctrl-cherryview.c
··· 35 35 36 36 #define CHV_PADCTRL0 0x000 37 37 #define CHV_PADCTRL0_INTSEL_SHIFT 28 38 - #define CHV_PADCTRL0_INTSEL_MASK (0xf << CHV_PADCTRL0_INTSEL_SHIFT) 38 + #define CHV_PADCTRL0_INTSEL_MASK GENMASK(31, 28) 39 39 #define CHV_PADCTRL0_TERM_UP BIT(23) 40 40 #define CHV_PADCTRL0_TERM_SHIFT 20 41 - #define CHV_PADCTRL0_TERM_MASK (7 << CHV_PADCTRL0_TERM_SHIFT) 41 + #define CHV_PADCTRL0_TERM_MASK GENMASK(22, 20) 42 42 #define CHV_PADCTRL0_TERM_20K 1 43 43 #define CHV_PADCTRL0_TERM_5K 2 44 44 #define CHV_PADCTRL0_TERM_1K 4 45 45 #define CHV_PADCTRL0_PMODE_SHIFT 16 46 - #define CHV_PADCTRL0_PMODE_MASK (0xf << CHV_PADCTRL0_PMODE_SHIFT) 46 + #define CHV_PADCTRL0_PMODE_MASK GENMASK(19, 16) 47 47 #define CHV_PADCTRL0_GPIOEN BIT(15) 48 48 #define CHV_PADCTRL0_GPIOCFG_SHIFT 8 49 - #define CHV_PADCTRL0_GPIOCFG_MASK (7 << CHV_PADCTRL0_GPIOCFG_SHIFT) 49 + #define CHV_PADCTRL0_GPIOCFG_MASK GENMASK(10, 8) 50 50 #define CHV_PADCTRL0_GPIOCFG_GPIO 0 51 51 #define CHV_PADCTRL0_GPIOCFG_GPO 1 52 52 #define CHV_PADCTRL0_GPIOCFG_GPI 2 ··· 57 57 #define CHV_PADCTRL1 0x004 58 58 #define CHV_PADCTRL1_CFGLOCK BIT(31) 59 59 #define CHV_PADCTRL1_INVRXTX_SHIFT 4 60 - #define CHV_PADCTRL1_INVRXTX_MASK (0xf << CHV_PADCTRL1_INVRXTX_SHIFT) 61 - #define CHV_PADCTRL1_INVRXTX_TXENABLE (2 << CHV_PADCTRL1_INVRXTX_SHIFT) 60 + #define CHV_PADCTRL1_INVRXTX_MASK GENMASK(7, 4) 61 + #define CHV_PADCTRL1_INVRXTX_RXDATA BIT(6) 62 + #define CHV_PADCTRL1_INVRXTX_TXENABLE BIT(5) 62 63 #define CHV_PADCTRL1_ODEN BIT(3) 63 - #define CHV_PADCTRL1_INVRXTX_RXDATA (4 << CHV_PADCTRL1_INVRXTX_SHIFT) 64 - #define CHV_PADCTRL1_INTWAKECFG_MASK 7 64 + #define CHV_PADCTRL1_INTWAKECFG_MASK GENMASK(2, 0) 65 65 #define CHV_PADCTRL1_INTWAKECFG_FALLING 1 66 66 #define CHV_PADCTRL1_INTWAKECFG_RISING 2 67 67 #define CHV_PADCTRL1_INTWAKECFG_BOTH 3 68 68 #define CHV_PADCTRL1_INTWAKECFG_LEVEL 4 69 - 70 - /** 71 - * struct chv_alternate_function - A per group or per pin alternate function 72 - * @pin: Pin number (only used in per pin configs) 73 - * @mode: Mode the pin should be set in 74 - * @invert_oe: Invert OE for this pin 75 - */ 76 - struct chv_alternate_function { 77 - unsigned int pin; 78 - u8 mode; 79 - bool invert_oe; 80 - }; 81 - 82 - /** 83 - * struct chv_pincgroup - describes a CHV pin group 84 - * @name: Name of the group 85 - * @pins: An array of pins in this group 86 - * @npins: Number of pins in this group 87 - * @altfunc: Alternate function applied to all pins in this group 88 - * @overrides: Alternate function override per pin or %NULL if not used 89 - * @noverrides: Number of per pin alternate function overrides if 90 - * @overrides != NULL. 91 - */ 92 - struct chv_pingroup { 93 - const char *name; 94 - const unsigned int *pins; 95 - size_t npins; 96 - struct chv_alternate_function altfunc; 97 - const struct chv_alternate_function *overrides; 98 - size_t noverrides; 99 - }; 100 - 101 - /** 102 - * struct chv_gpio_pinrange - A range of pins that can be used as GPIOs 103 - * @base: Start pin number 104 - * @npins: Number of pins in this range 105 - */ 106 - struct chv_gpio_pinrange { 107 - unsigned int base; 108 - unsigned int npins; 109 - }; 110 69 111 70 /** 112 71 * struct chv_community - A community specific configuration ··· 76 117 * @ngroups: Number of groups 77 118 * @functions: All functions in this community 78 119 * @nfunctions: Number of functions 79 - * @gpio_ranges: An array of GPIO ranges in this community 80 - * @ngpio_ranges: Number of GPIO ranges 120 + * @gpps: Pad groups 121 + * @ngpps: Number of pad groups in this community 81 122 * @nirqs: Total number of IRQs this community can generate 82 123 * @acpi_space_id: An address space ID for ACPI OpRegion handler 83 124 */ ··· 85 126 const char *uid; 86 127 const struct pinctrl_pin_desc *pins; 87 128 size_t npins; 88 - const struct chv_pingroup *groups; 129 + const struct intel_pingroup *groups; 89 130 size_t ngroups; 90 131 const struct intel_function *functions; 91 132 size_t nfunctions; 92 - const struct chv_gpio_pinrange *gpio_ranges; 93 - size_t ngpio_ranges; 133 + const struct intel_padgroup *gpps; 134 + size_t ngpps; 94 135 size_t nirqs; 95 136 acpi_adr_space_type acpi_space_id; 96 137 }; ··· 132 173 struct chv_pin_context *saved_pin_context; 133 174 }; 134 175 135 - #define ALTERNATE_FUNCTION(p, m, i) \ 136 - { \ 137 - .pin = (p), \ 138 - .mode = (m), \ 139 - .invert_oe = (i), \ 140 - } 176 + #define PINMODE_INVERT_OE BIT(15) 141 177 142 - #define PIN_GROUP_WITH_ALT(n, p, m, i) \ 143 - { \ 144 - .name = (n), \ 145 - .pins = (p), \ 146 - .npins = ARRAY_SIZE((p)), \ 147 - .altfunc.mode = (m), \ 148 - .altfunc.invert_oe = (i), \ 149 - } 178 + #define PINMODE(m, i) ((m) | ((i) * PINMODE_INVERT_OE)) 150 179 151 - #define PIN_GROUP_WITH_OVERRIDE(n, p, m, i, o) \ 152 - { \ 153 - .name = (n), \ 154 - .pins = (p), \ 155 - .npins = ARRAY_SIZE((p)), \ 156 - .altfunc.mode = (m), \ 157 - .altfunc.invert_oe = (i), \ 158 - .overrides = (o), \ 159 - .noverrides = ARRAY_SIZE((o)), \ 160 - } 161 - 162 - #define GPIO_PINRANGE(start, end) \ 180 + #define CHV_GPP(start, end) \ 163 181 { \ 164 182 .base = (start), \ 165 - .npins = (end) - (start) + 1, \ 183 + .size = (end) - (start) + 1, \ 166 184 } 167 185 168 186 static const struct pinctrl_pin_desc southwest_pins[] = { ··· 224 288 static const unsigned southwest_i2c_nfc_pins[] = { 49, 52 }; 225 289 static const unsigned southwest_spi3_pins[] = { 76, 79, 80, 81, 82 }; 226 290 227 - /* LPE I2S TXD pins need to have invert_oe set */ 228 - static const struct chv_alternate_function southwest_lpe_altfuncs[] = { 229 - ALTERNATE_FUNCTION(30, 1, true), 230 - ALTERNATE_FUNCTION(34, 1, true), 231 - ALTERNATE_FUNCTION(97, 1, true), 291 + /* Some of LPE I2S TXD pins need to have OE inversion set */ 292 + static const unsigned int southwest_lpe_altfuncs[] = { 293 + PINMODE(1, 1), PINMODE(1, 0), PINMODE(1, 0), PINMODE(1, 0), /* 30, 31, 32, 33 */ 294 + PINMODE(1, 1), PINMODE(1, 0), PINMODE(1, 0), PINMODE(1, 0), /* 34, 35, 36, 37 */ 295 + PINMODE(1, 0), PINMODE(1, 0), PINMODE(1, 0), PINMODE(1, 1), /* 92, 94, 96, 97 */ 232 296 }; 233 297 234 298 /* 235 299 * Two spi3 chipselects are available in different mode than the main spi3 236 - * functionality, which is using mode 1. 300 + * functionality, which is using mode 2. 237 301 */ 238 - static const struct chv_alternate_function southwest_spi3_altfuncs[] = { 239 - ALTERNATE_FUNCTION(76, 3, false), 240 - ALTERNATE_FUNCTION(80, 3, false), 302 + static const unsigned int southwest_spi3_altfuncs[] = { 303 + PINMODE(3, 0), PINMODE(2, 0), PINMODE(3, 0), PINMODE(2, 0), /* 76, 79, 80, 81 */ 304 + PINMODE(2, 0), /* 82 */ 241 305 }; 242 306 243 - static const struct chv_pingroup southwest_groups[] = { 244 - PIN_GROUP_WITH_ALT("uart0_grp", southwest_uart0_pins, 2, false), 245 - PIN_GROUP_WITH_ALT("uart1_grp", southwest_uart1_pins, 1, false), 246 - PIN_GROUP_WITH_ALT("uart2_grp", southwest_uart2_pins, 1, false), 247 - PIN_GROUP_WITH_ALT("hda_grp", southwest_hda_pins, 2, false), 248 - PIN_GROUP_WITH_ALT("i2c0_grp", southwest_i2c0_pins, 1, true), 249 - PIN_GROUP_WITH_ALT("i2c1_grp", southwest_i2c1_pins, 1, true), 250 - PIN_GROUP_WITH_ALT("i2c2_grp", southwest_i2c2_pins, 1, true), 251 - PIN_GROUP_WITH_ALT("i2c3_grp", southwest_i2c3_pins, 1, true), 252 - PIN_GROUP_WITH_ALT("i2c4_grp", southwest_i2c4_pins, 1, true), 253 - PIN_GROUP_WITH_ALT("i2c5_grp", southwest_i2c5_pins, 1, true), 254 - PIN_GROUP_WITH_ALT("i2c6_grp", southwest_i2c6_pins, 1, true), 255 - PIN_GROUP_WITH_ALT("i2c_nfc_grp", southwest_i2c_nfc_pins, 2, true), 256 - 257 - PIN_GROUP_WITH_OVERRIDE("lpe_grp", southwest_lpe_pins, 1, false, 258 - southwest_lpe_altfuncs), 259 - PIN_GROUP_WITH_OVERRIDE("spi3_grp", southwest_spi3_pins, 2, false, 260 - southwest_spi3_altfuncs), 307 + static const struct intel_pingroup southwest_groups[] = { 308 + PIN_GROUP("uart0_grp", southwest_uart0_pins, PINMODE(2, 0)), 309 + PIN_GROUP("uart1_grp", southwest_uart1_pins, PINMODE(1, 0)), 310 + PIN_GROUP("uart2_grp", southwest_uart2_pins, PINMODE(1, 0)), 311 + PIN_GROUP("hda_grp", southwest_hda_pins, PINMODE(2, 0)), 312 + PIN_GROUP("i2c0_grp", southwest_i2c0_pins, PINMODE(1, 1)), 313 + PIN_GROUP("i2c1_grp", southwest_i2c1_pins, PINMODE(1, 1)), 314 + PIN_GROUP("i2c2_grp", southwest_i2c2_pins, PINMODE(1, 1)), 315 + PIN_GROUP("i2c3_grp", southwest_i2c3_pins, PINMODE(1, 1)), 316 + PIN_GROUP("i2c4_grp", southwest_i2c4_pins, PINMODE(1, 1)), 317 + PIN_GROUP("i2c5_grp", southwest_i2c5_pins, PINMODE(1, 1)), 318 + PIN_GROUP("i2c6_grp", southwest_i2c6_pins, PINMODE(1, 1)), 319 + PIN_GROUP("i2c_nfc_grp", southwest_i2c_nfc_pins, PINMODE(2, 1)), 320 + PIN_GROUP("lpe_grp", southwest_lpe_pins, southwest_lpe_altfuncs), 321 + PIN_GROUP("spi3_grp", southwest_spi3_pins, southwest_spi3_altfuncs), 261 322 }; 262 323 263 324 static const char * const southwest_uart0_groups[] = { "uart0_grp" }; ··· 293 360 FUNCTION("spi3", southwest_spi3_groups), 294 361 }; 295 362 296 - static const struct chv_gpio_pinrange southwest_gpio_ranges[] = { 297 - GPIO_PINRANGE(0, 7), 298 - GPIO_PINRANGE(15, 22), 299 - GPIO_PINRANGE(30, 37), 300 - GPIO_PINRANGE(45, 52), 301 - GPIO_PINRANGE(60, 67), 302 - GPIO_PINRANGE(75, 82), 303 - GPIO_PINRANGE(90, 97), 363 + static const struct intel_padgroup southwest_gpps[] = { 364 + CHV_GPP(0, 7), 365 + CHV_GPP(15, 22), 366 + CHV_GPP(30, 37), 367 + CHV_GPP(45, 52), 368 + CHV_GPP(60, 67), 369 + CHV_GPP(75, 82), 370 + CHV_GPP(90, 97), 304 371 }; 305 372 306 373 static const struct chv_community southwest_community = { ··· 311 378 .ngroups = ARRAY_SIZE(southwest_groups), 312 379 .functions = southwest_functions, 313 380 .nfunctions = ARRAY_SIZE(southwest_functions), 314 - .gpio_ranges = southwest_gpio_ranges, 315 - .ngpio_ranges = ARRAY_SIZE(southwest_gpio_ranges), 381 + .gpps = southwest_gpps, 382 + .ngpps = ARRAY_SIZE(southwest_gpps), 316 383 /* 317 384 * Southwest community can generate GPIO interrupts only for the 318 385 * first 8 interrupts. The upper half (8-15) can only be used to ··· 388 455 PINCTRL_PIN(72, "PANEL0_VDDEN"), 389 456 }; 390 457 391 - static const struct chv_gpio_pinrange north_gpio_ranges[] = { 392 - GPIO_PINRANGE(0, 8), 393 - GPIO_PINRANGE(15, 27), 394 - GPIO_PINRANGE(30, 41), 395 - GPIO_PINRANGE(45, 56), 396 - GPIO_PINRANGE(60, 72), 458 + static const struct intel_padgroup north_gpps[] = { 459 + CHV_GPP(0, 8), 460 + CHV_GPP(15, 27), 461 + CHV_GPP(30, 41), 462 + CHV_GPP(45, 56), 463 + CHV_GPP(60, 72), 397 464 }; 398 465 399 466 static const struct chv_community north_community = { 400 467 .uid = "2", 401 468 .pins = north_pins, 402 469 .npins = ARRAY_SIZE(north_pins), 403 - .gpio_ranges = north_gpio_ranges, 404 - .ngpio_ranges = ARRAY_SIZE(north_gpio_ranges), 470 + .gpps = north_gpps, 471 + .ngpps = ARRAY_SIZE(north_gpps), 405 472 /* 406 473 * North community can generate GPIO interrupts only for the first 407 474 * 8 interrupts. The upper half (8-15) can only be used to trigger ··· 439 506 PINCTRL_PIN(26, "MF_ISH_I2C1_SDA"), 440 507 }; 441 508 442 - static const struct chv_gpio_pinrange east_gpio_ranges[] = { 443 - GPIO_PINRANGE(0, 11), 444 - GPIO_PINRANGE(15, 26), 509 + static const struct intel_padgroup east_gpps[] = { 510 + CHV_GPP(0, 11), 511 + CHV_GPP(15, 26), 445 512 }; 446 513 447 514 static const struct chv_community east_community = { 448 515 .uid = "3", 449 516 .pins = east_pins, 450 517 .npins = ARRAY_SIZE(east_pins), 451 - .gpio_ranges = east_gpio_ranges, 452 - .ngpio_ranges = ARRAY_SIZE(east_gpio_ranges), 518 + .gpps = east_gpps, 519 + .ngpps = ARRAY_SIZE(east_gpps), 453 520 .nirqs = 16, 454 521 .acpi_space_id = 0x93, 455 522 }; ··· 529 596 static const unsigned southeast_spi1_pins[] = { 60, 61, 62, 64, 66 }; 530 597 static const unsigned southeast_spi2_pins[] = { 2, 3, 4, 6, 7 }; 531 598 532 - static const struct chv_pingroup southeast_groups[] = { 533 - PIN_GROUP_WITH_ALT("pwm0_grp", southeast_pwm0_pins, 1, false), 534 - PIN_GROUP_WITH_ALT("pwm1_grp", southeast_pwm1_pins, 1, false), 535 - PIN_GROUP_WITH_ALT("sdmmc1_grp", southeast_sdmmc1_pins, 1, false), 536 - PIN_GROUP_WITH_ALT("sdmmc2_grp", southeast_sdmmc2_pins, 1, false), 537 - PIN_GROUP_WITH_ALT("sdmmc3_grp", southeast_sdmmc3_pins, 1, false), 538 - PIN_GROUP_WITH_ALT("spi1_grp", southeast_spi1_pins, 1, false), 539 - PIN_GROUP_WITH_ALT("spi2_grp", southeast_spi2_pins, 4, false), 599 + static const struct intel_pingroup southeast_groups[] = { 600 + PIN_GROUP("pwm0_grp", southeast_pwm0_pins, PINMODE(1, 0)), 601 + PIN_GROUP("pwm1_grp", southeast_pwm1_pins, PINMODE(1, 0)), 602 + PIN_GROUP("sdmmc1_grp", southeast_sdmmc1_pins, PINMODE(1, 0)), 603 + PIN_GROUP("sdmmc2_grp", southeast_sdmmc2_pins, PINMODE(1, 0)), 604 + PIN_GROUP("sdmmc3_grp", southeast_sdmmc3_pins, PINMODE(1, 0)), 605 + PIN_GROUP("spi1_grp", southeast_spi1_pins, PINMODE(1, 0)), 606 + PIN_GROUP("spi2_grp", southeast_spi2_pins, PINMODE(4, 0)), 540 607 }; 541 608 542 609 static const char * const southeast_pwm0_groups[] = { "pwm0_grp" }; ··· 557 624 FUNCTION("spi2", southeast_spi2_groups), 558 625 }; 559 626 560 - static const struct chv_gpio_pinrange southeast_gpio_ranges[] = { 561 - GPIO_PINRANGE(0, 7), 562 - GPIO_PINRANGE(15, 26), 563 - GPIO_PINRANGE(30, 35), 564 - GPIO_PINRANGE(45, 52), 565 - GPIO_PINRANGE(60, 69), 566 - GPIO_PINRANGE(75, 85), 627 + static const struct intel_padgroup southeast_gpps[] = { 628 + CHV_GPP(0, 7), 629 + CHV_GPP(15, 26), 630 + CHV_GPP(30, 35), 631 + CHV_GPP(45, 52), 632 + CHV_GPP(60, 69), 633 + CHV_GPP(75, 85), 567 634 }; 568 635 569 636 static const struct chv_community southeast_community = { ··· 574 641 .ngroups = ARRAY_SIZE(southeast_groups), 575 642 .functions = southeast_functions, 576 643 .nfunctions = ARRAY_SIZE(southeast_functions), 577 - .gpio_ranges = southeast_gpio_ranges, 578 - .ngpio_ranges = ARRAY_SIZE(southeast_gpio_ranges), 644 + .gpps = southeast_gpps, 645 + .ngpps = ARRAY_SIZE(southeast_gpps), 579 646 .nirqs = 16, 580 647 .acpi_space_id = 0x94, 581 648 }; ··· 722 789 unsigned int function, unsigned int group) 723 790 { 724 791 struct chv_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 725 - const struct chv_pingroup *grp; 792 + const struct intel_pingroup *grp; 726 793 unsigned long flags; 727 794 int i; 728 795 ··· 741 808 } 742 809 743 810 for (i = 0; i < grp->npins; i++) { 744 - const struct chv_alternate_function *altfunc = &grp->altfunc; 745 811 int pin = grp->pins[i]; 746 812 void __iomem *reg; 813 + unsigned int mode; 814 + bool invert_oe; 747 815 u32 value; 748 816 749 817 /* Check if there is pin-specific config */ 750 - if (grp->overrides) { 751 - int j; 818 + if (grp->modes) 819 + mode = grp->modes[i]; 820 + else 821 + mode = grp->mode; 752 822 753 - for (j = 0; j < grp->noverrides; j++) { 754 - if (grp->overrides[j].pin == pin) { 755 - altfunc = &grp->overrides[j]; 756 - break; 757 - } 758 - } 759 - } 823 + /* Extract OE inversion */ 824 + invert_oe = mode & PINMODE_INVERT_OE; 825 + mode &= ~PINMODE_INVERT_OE; 760 826 761 827 reg = chv_padreg(pctrl, pin, CHV_PADCTRL0); 762 828 value = readl(reg); ··· 763 831 value &= ~CHV_PADCTRL0_GPIOEN; 764 832 /* Set to desired mode */ 765 833 value &= ~CHV_PADCTRL0_PMODE_MASK; 766 - value |= altfunc->mode << CHV_PADCTRL0_PMODE_SHIFT; 834 + value |= mode << CHV_PADCTRL0_PMODE_SHIFT; 767 835 chv_writel(value, reg); 768 836 769 837 /* Update for invert_oe */ 770 838 reg = chv_padreg(pctrl, pin, CHV_PADCTRL1); 771 839 value = readl(reg) & ~CHV_PADCTRL1_INVRXTX_MASK; 772 - if (altfunc->invert_oe) 840 + if (invert_oe) 773 841 value |= CHV_PADCTRL1_INVRXTX_TXENABLE; 774 842 chv_writel(value, reg); 775 843 776 844 dev_dbg(pctrl->dev, "configured pin %u mode %u OE %sinverted\n", 777 - pin, altfunc->mode, altfunc->invert_oe ? "" : "not "); 845 + pin, mode, invert_oe ? "" : "not "); 778 846 } 779 847 780 848 raw_spin_unlock_irqrestore(&chv_lock, flags); ··· 1411 1479 struct chv_pinctrl *pctrl = gpiochip_get_data(gc); 1412 1480 struct irq_chip *chip = irq_desc_get_chip(desc); 1413 1481 unsigned long pending; 1482 + unsigned long flags; 1414 1483 u32 intr_line; 1415 1484 1416 1485 chained_irq_enter(chip, desc); 1417 1486 1487 + raw_spin_lock_irqsave(&chv_lock, flags); 1418 1488 pending = readl(pctrl->regs + CHV_INTSTAT); 1489 + raw_spin_unlock_irqrestore(&chv_lock, flags); 1490 + 1419 1491 for_each_set_bit(intr_line, &pending, pctrl->community->nirqs) { 1420 1492 unsigned int irq, offset; 1421 1493 ··· 1526 1590 { 1527 1591 struct chv_pinctrl *pctrl = gpiochip_get_data(chip); 1528 1592 const struct chv_community *community = pctrl->community; 1529 - const struct chv_gpio_pinrange *range; 1593 + const struct intel_padgroup *gpp; 1530 1594 int ret, i; 1531 1595 1532 - for (i = 0; i < community->ngpio_ranges; i++) { 1533 - range = &community->gpio_ranges[i]; 1596 + for (i = 0; i < community->ngpps; i++) { 1597 + gpp = &community->gpps[i]; 1534 1598 ret = gpiochip_add_pin_range(chip, dev_name(pctrl->dev), 1535 - range->base, range->base, 1536 - range->npins); 1599 + gpp->base, gpp->base, 1600 + gpp->size); 1537 1601 if (ret) { 1538 1602 dev_err(pctrl->dev, "failed to add GPIO pin range\n"); 1539 1603 return ret; ··· 1545 1609 1546 1610 static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq) 1547 1611 { 1548 - const struct chv_gpio_pinrange *range; 1612 + const struct intel_padgroup *gpp; 1549 1613 struct gpio_chip *chip = &pctrl->chip; 1550 1614 bool need_valid_mask = !dmi_check_system(chv_no_valid_mask); 1551 1615 const struct chv_community *community = pctrl->community; ··· 1593 1657 } 1594 1658 1595 1659 if (!need_valid_mask) { 1596 - for (i = 0; i < community->ngpio_ranges; i++) { 1597 - range = &community->gpio_ranges[i]; 1660 + for (i = 0; i < community->ngpps; i++) { 1661 + gpp = &community->gpps[i]; 1598 1662 1599 1663 irq_domain_associate_many(chip->irq.domain, irq_base, 1600 - range->base, range->npins); 1601 - irq_base += range->npins; 1664 + gpp->base, gpp->size); 1665 + irq_base += gpp->size; 1602 1666 } 1603 1667 } 1604 1668
+14 -16
drivers/pinctrl/intel/pinctrl-icelake.c
··· 29 29 .gpio_base = (g), \ 30 30 } 31 31 32 - #define ICL_NO_GPIO -1 33 - 34 32 #define ICL_COMMUNITY(b, s, e, g) \ 35 33 { \ 36 34 .barno = (b), \ ··· 303 305 }; 304 306 305 307 static const struct intel_padgroup icllp_community0_gpps[] = { 306 - ICL_GPP(0, 0, 7, 0), /* GPP_G */ 307 - ICL_GPP(1, 8, 33, 32), /* GPP_B */ 308 - ICL_GPP(2, 34, 58, 64), /* GPP_A */ 308 + ICL_GPP(0, 0, 7, 0), /* GPP_G */ 309 + ICL_GPP(1, 8, 33, 32), /* GPP_B */ 310 + ICL_GPP(2, 34, 58, 64), /* GPP_A */ 309 311 }; 310 312 311 313 static const struct intel_padgroup icllp_community1_gpps[] = { 312 - ICL_GPP(0, 59, 82, 96), /* GPP_H */ 313 - ICL_GPP(1, 83, 103, 128), /* GPP_D */ 314 - ICL_GPP(2, 104, 123, 160), /* GPP_F */ 315 - ICL_GPP(3, 124, 152, 192), /* vGPIO */ 314 + ICL_GPP(0, 59, 82, 96), /* GPP_H */ 315 + ICL_GPP(1, 83, 103, 128), /* GPP_D */ 316 + ICL_GPP(2, 104, 123, 160), /* GPP_F */ 317 + ICL_GPP(3, 124, 152, 192), /* vGPIO */ 316 318 }; 317 319 318 320 static const struct intel_padgroup icllp_community4_gpps[] = { 319 - ICL_GPP(0, 153, 176, 224), /* GPP_C */ 320 - ICL_GPP(1, 177, 182, ICL_NO_GPIO), /* HVCMOS */ 321 - ICL_GPP(2, 183, 206, 256), /* GPP_E */ 322 - ICL_GPP(3, 207, 215, ICL_NO_GPIO), /* JTAG */ 321 + ICL_GPP(0, 153, 176, 224), /* GPP_C */ 322 + ICL_GPP(1, 177, 182, INTEL_GPIO_BASE_NOMAP), /* HVCMOS */ 323 + ICL_GPP(2, 183, 206, 256), /* GPP_E */ 324 + ICL_GPP(3, 207, 215, INTEL_GPIO_BASE_NOMAP), /* JTAG */ 323 325 }; 324 326 325 327 static const struct intel_padgroup icllp_community5_gpps[] = { 326 - ICL_GPP(0, 216, 223, 288), /* GPP_R */ 327 - ICL_GPP(1, 224, 231, 320), /* GPP_S */ 328 - ICL_GPP(2, 232, 240, ICL_NO_GPIO), /* SPI */ 328 + ICL_GPP(0, 216, 223, 288), /* GPP_R */ 329 + ICL_GPP(1, 224, 231, 320), /* GPP_S */ 330 + ICL_GPP(2, 232, 240, INTEL_GPIO_BASE_NOMAP), /* SPI */ 329 331 }; 330 332 331 333 static const struct intel_community icllp_communities[] = {
+16 -6
drivers/pinctrl/intel/pinctrl-intel.c
··· 798 798 for (j = 0; j < comm->ngpps; j++) { 799 799 const struct intel_padgroup *pgrp = &comm->gpps[j]; 800 800 801 - if (pgrp->gpio_base < 0) 801 + if (pgrp->gpio_base == INTEL_GPIO_BASE_NOMAP) 802 802 continue; 803 803 804 804 if (offset >= pgrp->gpio_base && ··· 1138 1138 for (i = 0; i < community->ngpps; i++) { 1139 1139 const struct intel_padgroup *gpp = &community->gpps[i]; 1140 1140 1141 - if (gpp->gpio_base < 0) 1141 + if (gpp->gpio_base == INTEL_GPIO_BASE_NOMAP) 1142 1142 continue; 1143 1143 1144 1144 ret = gpiochip_add_pin_range(&pctrl->chip, dev_name(pctrl->dev), ··· 1180 1180 for (j = 0; j < community->ngpps; j++) { 1181 1181 const struct intel_padgroup *gpp = &community->gpps[j]; 1182 1182 1183 - if (gpp->gpio_base < 0) 1183 + if (gpp->gpio_base == INTEL_GPIO_BASE_NOMAP) 1184 1184 continue; 1185 1185 1186 1186 if (gpp->gpio_base + gpp->size > ngpio) ··· 1276 1276 if (gpps[i].size > 32) 1277 1277 return -EINVAL; 1278 1278 1279 - if (!gpps[i].gpio_base) 1280 - gpps[i].gpio_base = gpps[i].base; 1279 + /* Special treatment for GPIO base */ 1280 + switch (gpps[i].gpio_base) { 1281 + case INTEL_GPIO_BASE_MATCH: 1282 + gpps[i].gpio_base = gpps[i].base; 1283 + break; 1284 + case INTEL_GPIO_BASE_ZERO: 1285 + gpps[i].gpio_base = 0; 1286 + break; 1287 + case INTEL_GPIO_BASE_NOMAP: 1288 + default: 1289 + break; 1290 + } 1281 1291 1282 1292 gpps[i].padown_num = padown_num; 1283 1293 ··· 1606 1596 struct device *dev = pctrl->dev; 1607 1597 u32 requested; 1608 1598 1609 - if (padgrp->gpio_base < 0) 1599 + if (padgrp->gpio_base == INTEL_GPIO_BASE_NOMAP) 1610 1600 return; 1611 1601 1612 1602 requested = intel_gpio_is_requested(&pctrl->chip, padgrp->gpio_base, padgrp->size);
+20 -7
drivers/pinctrl/intel/pinctrl-intel.h
··· 53 53 * @reg_num: GPI_IS register number 54 54 * @base: Starting pin of this group 55 55 * @size: Size of this group (maximum is 32). 56 - * @gpio_base: Starting GPIO base of this group (%0 if matches with @base, 57 - * and %-1 if no GPIO mapping should be created) 56 + * @gpio_base: Starting GPIO base of this group 58 57 * @padown_num: PAD_OWN register number (assigned by the core driver) 59 58 * 60 59 * If pad groups of a community are not the same size, use this structure ··· 65 66 unsigned int size; 66 67 int gpio_base; 67 68 unsigned int padown_num; 69 + }; 70 + 71 + /** 72 + * enum - Special treatment for GPIO base in pad group 73 + * 74 + * @INTEL_GPIO_BASE_ZERO: force GPIO base to be 0 75 + * @INTEL_GPIO_BASE_NOMAP: no GPIO mapping should be created 76 + * @INTEL_GPIO_BASE_MATCH: matches with starting pin number 77 + */ 78 + enum { 79 + INTEL_GPIO_BASE_ZERO = -2, 80 + INTEL_GPIO_BASE_NOMAP = -1, 81 + INTEL_GPIO_BASE_MATCH = 0, 68 82 }; 69 83 70 84 /** ··· 94 82 * @ie_offset: Register offset of GPI_IE from @regs. 95 83 * @features: Additional features supported by the hardware 96 84 * @pin_base: Starting pin of pins in this community 85 + * @npins: Number of pins in this community 97 86 * @gpp_size: Maximum number of pads in each group, such as PADCFGLOCK, 98 - * HOSTSW_OWN, GPI_IS, GPI_IE, etc. Used when @gpps is %NULL. 87 + * HOSTSW_OWN, GPI_IS, GPI_IE. Used when @gpps is %NULL. 99 88 * @gpp_num_padown_regs: Number of pad registers each pad group consumes at 100 89 * minimum. Use %0 if the number of registers can be 101 90 * determined by the size of the group. 102 - * @npins: Number of pins in this community 103 91 * @gpps: Pad groups if the controller has variable size pad groups 104 92 * @ngpps: Number of pad groups in this community 105 93 * @pad_map: Optional non-linear mapping of the pads 106 94 * @regs: Community specific common registers (reserved for core driver) 107 95 * @pad_regs: Community specific pad registers (reserved for core driver) 108 96 * 109 - * Most Intel GPIO host controllers this driver supports each pad group is 110 - * of equal size (except the last one). In that case the driver can just 97 + * In some of Intel GPIO host controllers this driver supports each pad group 98 + * is of equal size (except the last one). In that case the driver can just 111 99 * fill in @gpp_size field and let the core driver to handle the rest. If 112 100 * the controller has pad groups of variable size the client driver can 113 101 * pass custom @gpps and @ngpps instead. ··· 121 109 unsigned int ie_offset; 122 110 unsigned int features; 123 111 unsigned int pin_base; 112 + size_t npins; 124 113 unsigned int gpp_size; 125 114 unsigned int gpp_num_padown_regs; 126 - size_t npins; 127 115 const struct intel_padgroup *gpps; 128 116 size_t ngpps; 129 117 const unsigned int *pad_map; 118 + 130 119 /* Reserved for the core driver */ 131 120 void __iomem *regs; 132 121 void __iomem *pad_regs;
+344
drivers/pinctrl/intel/pinctrl-jasperlake.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Intel Jasper Lake PCH pinctrl/GPIO driver 4 + * 5 + * Copyright (C) 2020, Intel Corporation 6 + * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com> 7 + */ 8 + 9 + #include <linux/mod_devicetable.h> 10 + #include <linux/module.h> 11 + #include <linux/platform_device.h> 12 + 13 + #include <linux/pinctrl/pinctrl.h> 14 + 15 + #include "pinctrl-intel.h" 16 + 17 + #define JSL_PAD_OWN 0x020 18 + #define JSL_PADCFGLOCK 0x080 19 + #define JSL_HOSTSW_OWN 0x0b0 20 + #define JSL_GPI_IS 0x100 21 + #define JSL_GPI_IE 0x120 22 + 23 + #define JSL_GPP(r, s, e, g) \ 24 + { \ 25 + .reg_num = (r), \ 26 + .base = (s), \ 27 + .size = ((e) - (s) + 1), \ 28 + .gpio_base = (g), \ 29 + } 30 + 31 + #define JSL_COMMUNITY(b, s, e, g) \ 32 + { \ 33 + .barno = (b), \ 34 + .padown_offset = JSL_PAD_OWN, \ 35 + .padcfglock_offset = JSL_PADCFGLOCK, \ 36 + .hostown_offset = JSL_HOSTSW_OWN, \ 37 + .is_offset = JSL_GPI_IS, \ 38 + .ie_offset = JSL_GPI_IE, \ 39 + .pin_base = (s), \ 40 + .npins = ((e) - (s) + 1), \ 41 + .gpps = (g), \ 42 + .ngpps = ARRAY_SIZE(g), \ 43 + } 44 + 45 + /* Jasper Lake */ 46 + static const struct pinctrl_pin_desc jsl_pins[] = { 47 + /* GPP_F */ 48 + PINCTRL_PIN(0, "CNV_BRI_DT_UART0_RTSB"), 49 + PINCTRL_PIN(1, "CNV_BRI_RSP_UART0_RXD"), 50 + PINCTRL_PIN(2, "EMMC_HIP_MON"), 51 + PINCTRL_PIN(3, "CNV_RGI_RSP_UART0_CTSB"), 52 + PINCTRL_PIN(4, "CNV_RF_RESET_B"), 53 + PINCTRL_PIN(5, "MODEM_CLKREQ"), 54 + PINCTRL_PIN(6, "CNV_PA_BLANKING"), 55 + PINCTRL_PIN(7, "EMMC_CMD"), 56 + PINCTRL_PIN(8, "EMMC_DATA0"), 57 + PINCTRL_PIN(9, "EMMC_DATA1"), 58 + PINCTRL_PIN(10, "EMMC_DATA2"), 59 + PINCTRL_PIN(11, "EMMC_DATA3"), 60 + PINCTRL_PIN(12, "EMMC_DATA4"), 61 + PINCTRL_PIN(13, "EMMC_DATA5"), 62 + PINCTRL_PIN(14, "EMMC_DATA6"), 63 + PINCTRL_PIN(15, "EMMC_DATA7"), 64 + PINCTRL_PIN(16, "EMMC_RCLK"), 65 + PINCTRL_PIN(17, "EMMC_CLK"), 66 + PINCTRL_PIN(18, "EMMC_RESETB"), 67 + PINCTRL_PIN(19, "A4WP_PRESENT"), 68 + /* GPP_B */ 69 + PINCTRL_PIN(20, "CORE_VID_0"), 70 + PINCTRL_PIN(21, "CORE_VID_1"), 71 + PINCTRL_PIN(22, "VRALERTB"), 72 + PINCTRL_PIN(23, "CPU_GP_2"), 73 + PINCTRL_PIN(24, "CPU_GP_3"), 74 + PINCTRL_PIN(25, "SRCCLKREQB_0"), 75 + PINCTRL_PIN(26, "SRCCLKREQB_1"), 76 + PINCTRL_PIN(27, "SRCCLKREQB_2"), 77 + PINCTRL_PIN(28, "SRCCLKREQB_3"), 78 + PINCTRL_PIN(29, "SRCCLKREQB_4"), 79 + PINCTRL_PIN(30, "SRCCLKREQB_5"), 80 + PINCTRL_PIN(31, "PMCALERTB"), 81 + PINCTRL_PIN(32, "SLP_S0B"), 82 + PINCTRL_PIN(33, "PLTRSTB"), 83 + PINCTRL_PIN(34, "SPKR"), 84 + PINCTRL_PIN(35, "GSPI0_CS0B"), 85 + PINCTRL_PIN(36, "GSPI0_CLK"), 86 + PINCTRL_PIN(37, "GSPI0_MISO"), 87 + PINCTRL_PIN(38, "GSPI0_MOSI"), 88 + PINCTRL_PIN(39, "GSPI1_CS0B"), 89 + PINCTRL_PIN(40, "GSPI1_CLK"), 90 + PINCTRL_PIN(41, "GSPI1_MISO"), 91 + PINCTRL_PIN(42, "GSPI1_MOSI"), 92 + PINCTRL_PIN(43, "DDSP_HPD_A"), 93 + PINCTRL_PIN(44, "GSPI0_CLK_LOOPBK"), 94 + PINCTRL_PIN(45, "GSPI1_CLK_LOOPBK"), 95 + /* GPP_A */ 96 + PINCTRL_PIN(46, "ESPI_IO_0"), 97 + PINCTRL_PIN(47, "ESPI_IO_1"), 98 + PINCTRL_PIN(48, "ESPI_IO_2"), 99 + PINCTRL_PIN(49, "ESPI_IO_3"), 100 + PINCTRL_PIN(50, "ESPI_CSB"), 101 + PINCTRL_PIN(51, "ESPI_CLK"), 102 + PINCTRL_PIN(52, "ESPI_RESETB"), 103 + PINCTRL_PIN(53, "SMBCLK"), 104 + PINCTRL_PIN(54, "SMBDATA"), 105 + PINCTRL_PIN(55, "SMBALERTB"), 106 + PINCTRL_PIN(56, "CPU_GP_0"), 107 + PINCTRL_PIN(57, "CPU_GP_1"), 108 + PINCTRL_PIN(58, "USB2_OCB_1"), 109 + PINCTRL_PIN(59, "USB2_OCB_2"), 110 + PINCTRL_PIN(60, "USB2_OCB_3"), 111 + PINCTRL_PIN(61, "DDSP_HPD_A_TIME_SYNC_0"), 112 + PINCTRL_PIN(62, "DDSP_HPD_B"), 113 + PINCTRL_PIN(63, "DDSP_HPD_C"), 114 + PINCTRL_PIN(64, "USB2_OCB_0"), 115 + PINCTRL_PIN(65, "PCHHOTB"), 116 + PINCTRL_PIN(66, "ESPI_CLK_LOOPBK"), 117 + /* GPP_S */ 118 + PINCTRL_PIN(67, "SNDW1_CLK"), 119 + PINCTRL_PIN(68, "SNDW1_DATA"), 120 + PINCTRL_PIN(69, "SNDW2_CLK"), 121 + PINCTRL_PIN(70, "SNDW2_DATA"), 122 + PINCTRL_PIN(71, "SNDW1_CLK"), 123 + PINCTRL_PIN(72, "SNDW1_DATA"), 124 + PINCTRL_PIN(73, "SNDW4_CLK_DMIC_CLK_0"), 125 + PINCTRL_PIN(74, "SNDW4_DATA_DMIC_DATA_0"), 126 + /* GPP_R */ 127 + PINCTRL_PIN(75, "HDA_BCLK"), 128 + PINCTRL_PIN(76, "HDA_SYNC"), 129 + PINCTRL_PIN(77, "HDA_SDO"), 130 + PINCTRL_PIN(78, "HDA_SDI_0"), 131 + PINCTRL_PIN(79, "HDA_RSTB"), 132 + PINCTRL_PIN(80, "HDA_SDI_1"), 133 + PINCTRL_PIN(81, "I2S1_SFRM"), 134 + PINCTRL_PIN(82, "I2S1_TXD"), 135 + /* GPP_H */ 136 + PINCTRL_PIN(83, "GPPC_H_0"), 137 + PINCTRL_PIN(84, "SD_PWR_EN_B"), 138 + PINCTRL_PIN(85, "MODEM_CLKREQ"), 139 + PINCTRL_PIN(86, "SX_EXIT_HOLDOFFB"), 140 + PINCTRL_PIN(87, "I2C2_SDA"), 141 + PINCTRL_PIN(88, "I2C2_SCL"), 142 + PINCTRL_PIN(89, "I2C3_SDA"), 143 + PINCTRL_PIN(90, "I2C3_SCL"), 144 + PINCTRL_PIN(91, "I2C4_SDA"), 145 + PINCTRL_PIN(92, "I2C4_SCL"), 146 + PINCTRL_PIN(93, "CPU_VCCIO_PWR_GATEB"), 147 + PINCTRL_PIN(94, "I2S2_SCLK"), 148 + PINCTRL_PIN(95, "I2S2_SFRM"), 149 + PINCTRL_PIN(96, "I2S2_TXD"), 150 + PINCTRL_PIN(97, "I2S2_RXD"), 151 + PINCTRL_PIN(98, "I2S1_SCLK"), 152 + PINCTRL_PIN(99, "GPPC_H_16"), 153 + PINCTRL_PIN(100, "GPPC_H_17"), 154 + PINCTRL_PIN(101, "GPPC_H_18"), 155 + PINCTRL_PIN(102, "GPPC_H_19"), 156 + PINCTRL_PIN(103, "GPPC_H_20"), 157 + PINCTRL_PIN(104, "GPPC_H_21"), 158 + PINCTRL_PIN(105, "GPPC_H_22"), 159 + PINCTRL_PIN(106, "GPPC_H_23"), 160 + /* GPP_D */ 161 + PINCTRL_PIN(107, "SPI1_CSB"), 162 + PINCTRL_PIN(108, "SPI1_CLK"), 163 + PINCTRL_PIN(109, "SPI1_MISO_IO_1"), 164 + PINCTRL_PIN(110, "SPI1_MOSI_IO_0"), 165 + PINCTRL_PIN(111, "ISH_I2C0_SDA"), 166 + PINCTRL_PIN(112, "ISH_I2C0_SCL"), 167 + PINCTRL_PIN(113, "ISH_I2C1_SDA"), 168 + PINCTRL_PIN(114, "ISH_I2C1_SCL"), 169 + PINCTRL_PIN(115, "ISH_SPI_CSB"), 170 + PINCTRL_PIN(116, "ISH_SPI_CLK"), 171 + PINCTRL_PIN(117, "ISH_SPI_MISO"), 172 + PINCTRL_PIN(118, "ISH_SPI_MOSI"), 173 + PINCTRL_PIN(119, "ISH_UART0_RXD"), 174 + PINCTRL_PIN(120, "ISH_UART0_TXD"), 175 + PINCTRL_PIN(121, "ISH_UART0_RTSB"), 176 + PINCTRL_PIN(122, "ISH_UART0_CTSB"), 177 + PINCTRL_PIN(123, "SPI1_IO_2"), 178 + PINCTRL_PIN(124, "SPI1_IO_3"), 179 + PINCTRL_PIN(125, "I2S_MCLK"), 180 + PINCTRL_PIN(126, "CNV_MFUART2_RXD"), 181 + PINCTRL_PIN(127, "CNV_MFUART2_TXD"), 182 + PINCTRL_PIN(128, "CNV_PA_BLANKING"), 183 + PINCTRL_PIN(129, "I2C5_SDA"), 184 + PINCTRL_PIN(130, "I2C5_SCL"), 185 + PINCTRL_PIN(131, "GSPI2_CLK_LOOPBK"), 186 + PINCTRL_PIN(132, "SPI1_CLK_LOOPBK"), 187 + /* vGPIO */ 188 + PINCTRL_PIN(133, "CNV_BTEN"), 189 + PINCTRL_PIN(134, "CNV_WCEN"), 190 + PINCTRL_PIN(135, "CNV_BT_HOST_WAKEB"), 191 + PINCTRL_PIN(136, "CNV_BT_IF_SELECT"), 192 + PINCTRL_PIN(137, "vCNV_BT_UART_TXD"), 193 + PINCTRL_PIN(138, "vCNV_BT_UART_RXD"), 194 + PINCTRL_PIN(139, "vCNV_BT_UART_CTS_B"), 195 + PINCTRL_PIN(140, "vCNV_BT_UART_RTS_B"), 196 + PINCTRL_PIN(141, "vCNV_MFUART1_TXD"), 197 + PINCTRL_PIN(142, "vCNV_MFUART1_RXD"), 198 + PINCTRL_PIN(143, "vCNV_MFUART1_CTS_B"), 199 + PINCTRL_PIN(144, "vCNV_MFUART1_RTS_B"), 200 + PINCTRL_PIN(145, "vUART0_TXD"), 201 + PINCTRL_PIN(146, "vUART0_RXD"), 202 + PINCTRL_PIN(147, "vUART0_CTS_B"), 203 + PINCTRL_PIN(148, "vUART0_RTS_B"), 204 + PINCTRL_PIN(149, "vISH_UART0_TXD"), 205 + PINCTRL_PIN(150, "vISH_UART0_RXD"), 206 + PINCTRL_PIN(151, "vISH_UART0_CTS_B"), 207 + PINCTRL_PIN(152, "vISH_UART0_RTS_B"), 208 + PINCTRL_PIN(153, "vCNV_BT_I2S_BCLK"), 209 + PINCTRL_PIN(154, "vCNV_BT_I2S_WS_SYNC"), 210 + PINCTRL_PIN(155, "vCNV_BT_I2S_SDO"), 211 + PINCTRL_PIN(156, "vCNV_BT_I2S_SDI"), 212 + PINCTRL_PIN(157, "vI2S2_SCLK"), 213 + PINCTRL_PIN(158, "vI2S2_SFRM"), 214 + PINCTRL_PIN(159, "vI2S2_TXD"), 215 + PINCTRL_PIN(160, "vI2S2_RXD"), 216 + PINCTRL_PIN(161, "vSD3_CD_B"), 217 + /* GPP_C */ 218 + PINCTRL_PIN(162, "GPPC_C_0"), 219 + PINCTRL_PIN(163, "GPPC_C_1"), 220 + PINCTRL_PIN(164, "GPPC_C_2"), 221 + PINCTRL_PIN(165, "GPPC_C_3"), 222 + PINCTRL_PIN(166, "GPPC_C_4"), 223 + PINCTRL_PIN(167, "GPPC_C_5"), 224 + PINCTRL_PIN(168, "SUSWARNB_SUSPWRDNACK"), 225 + PINCTRL_PIN(169, "SUSACKB"), 226 + PINCTRL_PIN(170, "UART0_RXD"), 227 + PINCTRL_PIN(171, "UART0_TXD"), 228 + PINCTRL_PIN(172, "UART0_RTSB"), 229 + PINCTRL_PIN(173, "UART0_CTSB"), 230 + PINCTRL_PIN(174, "UART1_RXD"), 231 + PINCTRL_PIN(175, "UART1_TXD"), 232 + PINCTRL_PIN(176, "UART1_RTSB"), 233 + PINCTRL_PIN(177, "UART1_CTSB"), 234 + PINCTRL_PIN(178, "I2C0_SDA"), 235 + PINCTRL_PIN(179, "I2C0_SCL"), 236 + PINCTRL_PIN(180, "I2C1_SDA"), 237 + PINCTRL_PIN(181, "I2C1_SCL"), 238 + PINCTRL_PIN(182, "UART2_RXD"), 239 + PINCTRL_PIN(183, "UART2_TXD"), 240 + PINCTRL_PIN(184, "UART2_RTSB"), 241 + PINCTRL_PIN(185, "UART2_CTSB"), 242 + /* HVCMOS */ 243 + PINCTRL_PIN(186, "L_BKLTEN"), 244 + PINCTRL_PIN(187, "L_BKLTCTL"), 245 + PINCTRL_PIN(188, "L_VDDEN"), 246 + PINCTRL_PIN(189, "SYS_PWROK"), 247 + PINCTRL_PIN(190, "SYS_RESETB"), 248 + PINCTRL_PIN(191, "MLK_RSTB"), 249 + /* GPP_E */ 250 + PINCTRL_PIN(192, "ISH_GP_0"), 251 + PINCTRL_PIN(193, "ISH_GP_1"), 252 + PINCTRL_PIN(194, "IMGCLKOUT_1"), 253 + PINCTRL_PIN(195, "ISH_GP_2"), 254 + PINCTRL_PIN(196, "IMGCLKOUT_2"), 255 + PINCTRL_PIN(197, "SATA_LEDB"), 256 + PINCTRL_PIN(198, "IMGCLKOUT_3"), 257 + PINCTRL_PIN(199, "ISH_GP_3"), 258 + PINCTRL_PIN(200, "ISH_GP_4"), 259 + PINCTRL_PIN(201, "ISH_GP_5"), 260 + PINCTRL_PIN(202, "ISH_GP_6"), 261 + PINCTRL_PIN(203, "ISH_GP_7"), 262 + PINCTRL_PIN(204, "IMGCLKOUT_4"), 263 + PINCTRL_PIN(205, "DDPA_CTRLCLK"), 264 + PINCTRL_PIN(206, "DDPA_CTRLDATA"), 265 + PINCTRL_PIN(207, "DDPB_CTRLCLK"), 266 + PINCTRL_PIN(208, "DDPB_CTRLDATA"), 267 + PINCTRL_PIN(209, "DDPC_CTRLCLK"), 268 + PINCTRL_PIN(210, "DDPC_CTRLDATA"), 269 + PINCTRL_PIN(211, "IMGCLKOUT_5"), 270 + PINCTRL_PIN(212, "CNV_BRI_DT"), 271 + PINCTRL_PIN(213, "CNV_BRI_RSP"), 272 + PINCTRL_PIN(214, "CNV_RGI_DT"), 273 + PINCTRL_PIN(215, "CNV_RGI_RSP"), 274 + /* GPP_G */ 275 + PINCTRL_PIN(216, "SD3_CMD"), 276 + PINCTRL_PIN(217, "SD3_D0"), 277 + PINCTRL_PIN(218, "SD3_D1"), 278 + PINCTRL_PIN(219, "SD3_D2"), 279 + PINCTRL_PIN(220, "SD3_D3"), 280 + PINCTRL_PIN(221, "SD3_CDB"), 281 + PINCTRL_PIN(222, "SD3_CLK"), 282 + PINCTRL_PIN(223, "SD3_WP"), 283 + }; 284 + 285 + static const struct intel_padgroup jsl_community0_gpps[] = { 286 + JSL_GPP(0, 0, 19, 320), /* GPP_F */ 287 + JSL_GPP(1, 20, 45, 32), /* GPP_B */ 288 + JSL_GPP(2, 46, 66, 64), /* GPP_A */ 289 + JSL_GPP(3, 67, 74, 96), /* GPP_S */ 290 + JSL_GPP(4, 75, 82, 128), /* GPP_R */ 291 + }; 292 + 293 + static const struct intel_padgroup jsl_community1_gpps[] = { 294 + JSL_GPP(0, 83, 106, 160), /* GPP_H */ 295 + JSL_GPP(1, 107, 132, 192), /* GPP_D */ 296 + JSL_GPP(2, 133, 161, 224), /* vGPIO */ 297 + JSL_GPP(3, 162, 185, 256), /* GPP_C */ 298 + }; 299 + 300 + static const struct intel_padgroup jsl_community4_gpps[] = { 301 + JSL_GPP(0, 186, 191, INTEL_GPIO_BASE_NOMAP), /* HVCMOS */ 302 + JSL_GPP(1, 192, 215, 288), /* GPP_E */ 303 + }; 304 + 305 + static const struct intel_padgroup jsl_community5_gpps[] = { 306 + JSL_GPP(0, 216, 223, INTEL_GPIO_BASE_ZERO), /* GPP_G */ 307 + }; 308 + 309 + static const struct intel_community jsl_communities[] = { 310 + JSL_COMMUNITY(0, 0, 82, jsl_community0_gpps), 311 + JSL_COMMUNITY(1, 83, 185, jsl_community1_gpps), 312 + JSL_COMMUNITY(2, 186, 215, jsl_community4_gpps), 313 + JSL_COMMUNITY(3, 216, 223, jsl_community5_gpps), 314 + }; 315 + 316 + static const struct intel_pinctrl_soc_data jsl_soc_data = { 317 + .pins = jsl_pins, 318 + .npins = ARRAY_SIZE(jsl_pins), 319 + .communities = jsl_communities, 320 + .ncommunities = ARRAY_SIZE(jsl_communities), 321 + }; 322 + 323 + static const struct acpi_device_id jsl_pinctrl_acpi_match[] = { 324 + { "INT34C8", (kernel_ulong_t)&jsl_soc_data }, 325 + { } 326 + }; 327 + MODULE_DEVICE_TABLE(acpi, jsl_pinctrl_acpi_match); 328 + 329 + static INTEL_PINCTRL_PM_OPS(jsl_pinctrl_pm_ops); 330 + 331 + static struct platform_driver jsl_pinctrl_driver = { 332 + .probe = intel_pinctrl_probe_by_hid, 333 + .driver = { 334 + .name = "jasperlake-pinctrl", 335 + .acpi_match_table = jsl_pinctrl_acpi_match, 336 + .pm = &jsl_pinctrl_pm_ops, 337 + }, 338 + }; 339 + 340 + module_platform_driver(jsl_pinctrl_driver); 341 + 342 + MODULE_AUTHOR("Andy Shevchenko <andriy.shevchenko@linux.intel.com>"); 343 + MODULE_DESCRIPTION("Intel Jasper Lake PCH pinctrl/GPIO driver"); 344 + MODULE_LICENSE("GPL v2");
+5 -5
drivers/pinctrl/intel/pinctrl-lynxpoint.c
··· 794 794 const struct intel_pinctrl_soc_data *soc; 795 795 struct intel_pinctrl *lg; 796 796 struct gpio_chip *gc; 797 - struct resource *io_rc, *irq_rc; 798 797 struct device *dev = &pdev->dev; 798 + struct resource *io_rc; 799 799 void __iomem *regs; 800 800 unsigned int i; 801 - int ret; 801 + int irq, ret; 802 802 803 803 soc = (const struct intel_pinctrl_soc_data *)device_get_match_data(dev); 804 804 if (!soc) ··· 870 870 gc->parent = dev; 871 871 872 872 /* set up interrupts */ 873 - irq_rc = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 874 - if (irq_rc && irq_rc->start) { 873 + irq = platform_get_irq_optional(pdev, 0); 874 + if (irq > 0) { 875 875 struct gpio_irq_chip *girq; 876 876 877 877 girq = &gc->irq; ··· 884 884 GFP_KERNEL); 885 885 if (!girq->parents) 886 886 return -ENOMEM; 887 - girq->parents[0] = (unsigned int)irq_rc->start; 887 + girq->parents[0] = irq; 888 888 girq->default_type = IRQ_TYPE_NONE; 889 889 girq->handler = handle_bad_irq; 890 890 }
+8 -7
drivers/pinctrl/intel/pinctrl-sunrisepoint.c
··· 15 15 16 16 #include "pinctrl-intel.h" 17 17 18 - #define SPT_PAD_OWN 0x020 19 - #define SPT_PADCFGLOCK 0x0a0 20 - #define SPT_HOSTSW_OWN 0x0d0 21 - #define SPT_GPI_IS 0x100 22 - #define SPT_GPI_IE 0x120 18 + #define SPT_PAD_OWN 0x020 19 + #define SPT_H_PADCFGLOCK 0x090 20 + #define SPT_LP_PADCFGLOCK 0x0a0 21 + #define SPT_HOSTSW_OWN 0x0d0 22 + #define SPT_GPI_IS 0x100 23 + #define SPT_GPI_IE 0x120 23 24 24 25 #define SPT_COMMUNITY(b, s, e) \ 25 26 { \ 26 27 .barno = (b), \ 27 28 .padown_offset = SPT_PAD_OWN, \ 28 - .padcfglock_offset = SPT_PADCFGLOCK, \ 29 + .padcfglock_offset = SPT_LP_PADCFGLOCK, \ 29 30 .hostown_offset = SPT_HOSTSW_OWN, \ 30 31 .is_offset = SPT_GPI_IS, \ 31 32 .ie_offset = SPT_GPI_IE, \ ··· 48 47 { \ 49 48 .barno = (b), \ 50 49 .padown_offset = SPT_PAD_OWN, \ 51 - .padcfglock_offset = SPT_PADCFGLOCK, \ 50 + .padcfglock_offset = SPT_H_PADCFGLOCK, \ 52 51 .hostown_offset = SPT_HOSTSW_OWN, \ 53 52 .is_offset = SPT_GPI_IS, \ 54 53 .ie_offset = SPT_GPI_IE, \
+15 -17
drivers/pinctrl/intel/pinctrl-tigerlake.c
··· 21 21 #define TGL_GPI_IS 0x100 22 22 #define TGL_GPI_IE 0x120 23 23 24 - #define TGL_NO_GPIO -1 25 - 26 24 #define TGL_GPP(r, s, e, g) \ 27 25 { \ 28 26 .reg_num = (r), \ ··· 340 342 }; 341 343 342 344 static const struct intel_padgroup tgllp_community0_gpps[] = { 343 - TGL_GPP(0, 0, 25, 0), /* GPP_B */ 344 - TGL_GPP(1, 26, 41, 32), /* GPP_T */ 345 - TGL_GPP(2, 42, 66, 64), /* GPP_A */ 345 + TGL_GPP(0, 0, 25, 0), /* GPP_B */ 346 + TGL_GPP(1, 26, 41, 32), /* GPP_T */ 347 + TGL_GPP(2, 42, 66, 64), /* GPP_A */ 346 348 }; 347 349 348 350 static const struct intel_padgroup tgllp_community1_gpps[] = { 349 - TGL_GPP(0, 67, 74, 96), /* GPP_S */ 350 - TGL_GPP(1, 75, 98, 128), /* GPP_H */ 351 - TGL_GPP(2, 99, 119, 160), /* GPP_D */ 352 - TGL_GPP(3, 120, 143, 192), /* GPP_U */ 353 - TGL_GPP(4, 144, 170, 224), /* vGPIO */ 351 + TGL_GPP(0, 67, 74, 96), /* GPP_S */ 352 + TGL_GPP(1, 75, 98, 128), /* GPP_H */ 353 + TGL_GPP(2, 99, 119, 160), /* GPP_D */ 354 + TGL_GPP(3, 120, 143, 192), /* GPP_U */ 355 + TGL_GPP(4, 144, 170, 224), /* vGPIO */ 354 356 }; 355 357 356 358 static const struct intel_padgroup tgllp_community4_gpps[] = { 357 - TGL_GPP(0, 171, 194, 256), /* GPP_C */ 358 - TGL_GPP(1, 195, 219, 288), /* GPP_F */ 359 - TGL_GPP(2, 220, 225, TGL_NO_GPIO), /* HVCMOS */ 360 - TGL_GPP(3, 226, 250, 320), /* GPP_E */ 361 - TGL_GPP(4, 251, 259, TGL_NO_GPIO), /* JTAG */ 359 + TGL_GPP(0, 171, 194, 256), /* GPP_C */ 360 + TGL_GPP(1, 195, 219, 288), /* GPP_F */ 361 + TGL_GPP(2, 220, 225, INTEL_GPIO_BASE_NOMAP), /* HVCMOS */ 362 + TGL_GPP(3, 226, 250, 320), /* GPP_E */ 363 + TGL_GPP(4, 251, 259, INTEL_GPIO_BASE_NOMAP), /* JTAG */ 362 364 }; 363 365 364 366 static const struct intel_padgroup tgllp_community5_gpps[] = { 365 - TGL_GPP(0, 260, 267, 352), /* GPP_R */ 366 - TGL_GPP(1, 268, 276, TGL_NO_GPIO), /* SPI */ 367 + TGL_GPP(0, 260, 267, 352), /* GPP_R */ 368 + TGL_GPP(1, 268, 276, INTEL_GPIO_BASE_NOMAP), /* SPI */ 367 369 }; 368 370 369 371 static const struct intel_community tgllp_communities[] = {