Skip to content

Commit d875d6c

Browse files
zevweissLinus Walleij
authored andcommitted
pinctrl: aspeed: Allow changing SPI mode from hardware strap defaults
Some platforms unfortunately have their SPI mode selection bits strapped incorrectly (such as being configured for passthrough mode when master mode is in fact the only useful configuration for it) and thus require correction in software. Add the SPI mode bits to the GPIO passthrough bits as the exceptions to the read-only rule for the hardware strap register so that the pinctrl subsystem can be used for such corrections. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au> Link: https://lore.kernel.org/r/20231005030849.11352-2-zev@bewilderbeest.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 54a3342 commit d875d6c

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,15 +2563,20 @@ static int aspeed_g4_sig_expr_set(struct aspeed_pinmux_data *ctx,
25632563
* deconfigured and is the reason we re-evaluate after writing
25642564
* all descriptor bits.
25652565
*
2566-
* Port D and port E GPIO loopback modes are the only exception
2567-
* as those are commonly used with front-panel buttons to allow
2568-
* normal operation of the host when the BMC is powered off or
2569-
* fails to boot. Once the BMC has booted, the loopback mode
2570-
* must be disabled for the BMC to control host power-on and
2571-
* reset.
2566+
* We make two exceptions to the read-only rule:
2567+
*
2568+
* - The passthrough mode of GPIO ports D and E are commonly
2569+
* used with front-panel buttons to allow normal operation
2570+
* of the host if the BMC is powered off or fails to boot.
2571+
* Once the BMC has booted, the loopback mode must be
2572+
* disabled for the BMC to control host power-on and reset.
2573+
*
2574+
* - The operating mode of the SPI1 interface is simply
2575+
* strapped incorrectly on some systems and requires a
2576+
* software fixup, which we allow to be done via pinctrl.
25722577
*/
25732578
if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1 &&
2574-
!(desc->mask & (BIT(21) | BIT(22))))
2579+
!(desc->mask & (BIT(22) | BIT(21) | BIT(13) | BIT(12))))
25752580
continue;
25762581

25772582
if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2)

drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,15 +2742,20 @@ static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx,
27422742
* deconfigured and is the reason we re-evaluate after writing
27432743
* all descriptor bits.
27442744
*
2745-
* Port D and port E GPIO loopback modes are the only exception
2746-
* as those are commonly used with front-panel buttons to allow
2747-
* normal operation of the host when the BMC is powered off or
2748-
* fails to boot. Once the BMC has booted, the loopback mode
2749-
* must be disabled for the BMC to control host power-on and
2750-
* reset.
2745+
* We make two exceptions to the read-only rule:
2746+
*
2747+
* - The passthrough mode of GPIO ports D and E are commonly
2748+
* used with front-panel buttons to allow normal operation
2749+
* of the host if the BMC is powered off or fails to boot.
2750+
* Once the BMC has booted, the loopback mode must be
2751+
* disabled for the BMC to control host power-on and reset.
2752+
*
2753+
* - The operating mode of the SPI1 interface is simply
2754+
* strapped incorrectly on some systems and requires a
2755+
* software fixup, which we allow to be done via pinctrl.
27512756
*/
27522757
if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1 &&
2753-
!(desc->mask & (BIT(21) | BIT(22))))
2758+
!(desc->mask & (BIT(22) | BIT(21) | BIT(13) | BIT(12))))
27542759
continue;
27552760

27562761
if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2)

0 commit comments

Comments
 (0)