Skip to content

Commit 94801e5

Browse files
committed
Merge tag 'pinctrl-v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control fixes from Linus Walleij: "Here is a late set of pin control fixes for v5.10, most concern some minor and major issues found in the Intel drivers. Some are so hairy that I have no idea what is going on there, but luckily the maintainer knows what's up. We also have an interesting fix for AMD, which makes AMD-based laptops more stable IIUC. Summary: - Fix up some SPI group and a register offset on Intel Jasperlake - Set default bias on Intel Merrifield - Preserve debouncing on Intel Baytrail - Stop .set_type() irqchip callback in the AMD driver from fiddling with the debounce filter - Fix access to GPIO banks that are pass-thru on the Aspeed - Fix a fix for the Intel pin control driver to disable Rx/Tx when requesting a UART line as GPIO" * tag 'pinctrl-v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: intel: Actually disable Tx and Rx buffers on GPIO request pinctrl: aspeed: Fix GPIO requests on pass-through banks pinctrl: amd: remove debounce filter setting in IRQ type setting pinctrl: baytrail: Avoid clearing debounce value when turning it off pinctrl: merrifield: Set default bias in case no particular value given pinctrl: jasperlake: Fix HOSTSW_OWN offset pinctrl: jasperlake: Unhide SPI group of pins
2 parents 6d47cde + e8873c0 commit 94801e5

7 files changed

Lines changed: 320 additions & 240 deletions

File tree

drivers/pinctrl/aspeed/pinctrl-aspeed.c

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,76 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
286286
static bool aspeed_expr_is_gpio(const struct aspeed_sig_expr *expr)
287287
{
288288
/*
289-
* The signal type is GPIO if the signal name has "GPI" as a prefix.
290-
* strncmp (rather than strcmp) is used to implement the prefix
291-
* requirement.
289+
* We need to differentiate between GPIO and non-GPIO signals to
290+
* implement the gpio_request_enable() interface. For better or worse
291+
* the ASPEED pinctrl driver uses the expression names to determine
292+
* whether an expression will mux a pin for GPIO.
292293
*
293-
* expr->signal might look like "GPIOB1" in the GPIO case.
294-
* expr->signal might look like "GPIT0" in the GPI case.
294+
* Generally we have the following - A GPIO such as B1 has:
295+
*
296+
* - expr->signal set to "GPIOB1"
297+
* - expr->function set to "GPIOB1"
298+
*
299+
* Using this fact we can determine whether the provided expression is
300+
* a GPIO expression by testing the signal name for the string prefix
301+
* "GPIO".
302+
*
303+
* However, some GPIOs are input-only, and the ASPEED datasheets name
304+
* them differently. An input-only GPIO such as T0 has:
305+
*
306+
* - expr->signal set to "GPIT0"
307+
* - expr->function set to "GPIT0"
308+
*
309+
* It's tempting to generalise the prefix test from "GPIO" to "GPI" to
310+
* account for both GPIOs and GPIs, but in doing so we run aground on
311+
* another feature:
312+
*
313+
* Some pins in the ASPEED BMC SoCs have a "pass-through" GPIO
314+
* function where the input state of one pin is replicated as the
315+
* output state of another (as if they were shorted together - a mux
316+
* configuration that is typically enabled by hardware strapping).
317+
* This feature allows the BMC to pass e.g. power button state through
318+
* to the host while the BMC is yet to boot, but take control of the
319+
* button state once the BMC has booted by muxing each pin as a
320+
* separate, pin-specific GPIO.
321+
*
322+
* Conceptually this pass-through mode is a form of GPIO and is named
323+
* as such in the datasheets, e.g. "GPID0". This naming similarity
324+
* trips us up with the simple GPI-prefixed-signal-name scheme
325+
* discussed above, as the pass-through configuration is not what we
326+
* want when muxing a pin as GPIO for the GPIO subsystem.
327+
*
328+
* On e.g. the AST2400, a pass-through function "GPID0" is grouped on
329+
* balls A18 and D16, where we have:
330+
*
331+
* For ball A18:
332+
* - expr->signal set to "GPID0IN"
333+
* - expr->function set to "GPID0"
334+
*
335+
* For ball D16:
336+
* - expr->signal set to "GPID0OUT"
337+
* - expr->function set to "GPID0"
338+
*
339+
* By contrast, the pin-specific GPIO expressions for the same pins are
340+
* as follows:
341+
*
342+
* For ball A18:
343+
* - expr->signal looks like "GPIOD0"
344+
* - expr->function looks like "GPIOD0"
345+
*
346+
* For ball D16:
347+
* - expr->signal looks like "GPIOD1"
348+
* - expr->function looks like "GPIOD1"
349+
*
350+
* Testing both the signal _and_ function names gives us the means
351+
* differentiate the pass-through GPIO pinmux configuration from the
352+
* pin-specific configuration that the GPIO subsystem is after: An
353+
* expression is a pin-specific (non-pass-through) GPIO configuration
354+
* if the signal prefix is "GPI" and the signal name matches the
355+
* function name.
295356
*/
296-
return strncmp(expr->signal, "GPI", 3) == 0;
357+
return !strncmp(expr->signal, "GPI", 3) &&
358+
!strcmp(expr->signal, expr->function);
297359
}
298360

299361
static bool aspeed_gpio_in_exprs(const struct aspeed_sig_expr **exprs)

drivers/pinctrl/aspeed/pinmux-aspeed.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,10 +452,11 @@ struct aspeed_sig_desc {
452452
* evaluation of the descriptors.
453453
*
454454
* @signal: The signal name for the priority level on the pin. If the signal
455-
* type is GPIO, then the signal name must begin with the string
456-
* "GPIO", e.g. GPIOA0, GPIOT4 etc.
455+
* type is GPIO, then the signal name must begin with the
456+
* prefix "GPI", e.g. GPIOA0, GPIT0 etc.
457457
* @function: The name of the function the signal participates in for the
458-
* associated expression
458+
* associated expression. For pin-specific GPIO, the function
459+
* name must match the signal name.
459460
* @ndescs: The number of signal descriptors in the expression
460461
* @descs: Pointer to an array of signal descriptors that comprise the
461462
* function expression

drivers/pinctrl/intel/pinctrl-baytrail.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,6 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
10491049
break;
10501050
case PIN_CONFIG_INPUT_DEBOUNCE:
10511051
debounce = readl(db_reg);
1052-
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10531052

10541053
if (arg)
10551054
conf |= BYT_DEBOUNCE_EN;
@@ -1058,24 +1057,31 @@ static int byt_pin_config_set(struct pinctrl_dev *pctl_dev,
10581057

10591058
switch (arg) {
10601059
case 375:
1060+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10611061
debounce |= BYT_DEBOUNCE_PULSE_375US;
10621062
break;
10631063
case 750:
1064+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10641065
debounce |= BYT_DEBOUNCE_PULSE_750US;
10651066
break;
10661067
case 1500:
1068+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10671069
debounce |= BYT_DEBOUNCE_PULSE_1500US;
10681070
break;
10691071
case 3000:
1072+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10701073
debounce |= BYT_DEBOUNCE_PULSE_3MS;
10711074
break;
10721075
case 6000:
1076+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10731077
debounce |= BYT_DEBOUNCE_PULSE_6MS;
10741078
break;
10751079
case 12000:
1080+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10761081
debounce |= BYT_DEBOUNCE_PULSE_12MS;
10771082
break;
10781083
case 24000:
1084+
debounce &= ~BYT_DEBOUNCE_PULSE_MASK;
10791085
debounce |= BYT_DEBOUNCE_PULSE_24MS;
10801086
break;
10811087
default:

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,8 @@ static void intel_gpio_set_gpio_mode(void __iomem *padcfg0)
442442
value |= PADCFG0_PMODE_GPIO;
443443

444444
/* Disable input and output buffers */
445-
value &= ~PADCFG0_GPIORXDIS;
446-
value &= ~PADCFG0_GPIOTXDIS;
445+
value |= PADCFG0_GPIORXDIS;
446+
value |= PADCFG0_GPIOTXDIS;
447447

448448
/* Disable SCI/SMI/NMI generation */
449449
value &= ~(PADCFG0_GPIROUTIOXAPIC | PADCFG0_GPIROUTSCI);

0 commit comments

Comments
 (0)