aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Altherr <raltherr@google.com>2017-02-15 01:09:14 -0500
committerLinus Walleij <linus.walleij@linaro.org>2017-03-14 09:42:22 -0400
commitc825676b0823fd43a4d08bf865f81bb188b51db1 (patch)
treeb4f2efe40ccaa2ba6c41374d8e463d437cce596a
parent3818e4a7678ea70508b6b6e72a4cbf445e1e7dfa (diff)
pinctrl: aspeed: Allow disabling Port D and Port E loopback mode
Port D and port E GPIO loopback modes are commonly enabled via hardware straps for use with front-panel buttons. When the BMC is powered off or fails to boot, the front-panel buttons are directly connected to the host chipset via the loopback to allow direct power-on and reset control. Once the BMC has booted, the loopback mode must be disabled for the BMC to take over control of host power-on and reset. Disabling these loopback modes requires writing to the hardware strap register which violates the current design of assuming the system designer chose the strap settings for a specific reason and they should be treated as read-only. Only the two bits of the strap register related to these loopback modes are allowed to be written and comments have been added to explain why. Signed-off-by: Rick Altherr <raltherr@google.com> Acked-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/aspeed/pinctrl-aspeed.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index 76f62bd45f02..5b49952e5fad 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -198,9 +198,19 @@ static int aspeed_sig_expr_set(const struct aspeed_sig_expr *expr,
198 * them. This may mean that certain functions cannot be 198 * them. This may mean that certain functions cannot be
199 * deconfigured and is the reason we re-evaluate after writing 199 * deconfigured and is the reason we re-evaluate after writing
200 * all descriptor bits. 200 * all descriptor bits.
201 *
202 * Port D and port E GPIO loopback modes are the only exception
203 * as those are commonly used with front-panel buttons to allow
204 * normal operation of the host when the BMC is powered off or
205 * fails to boot. Once the BMC has booted, the loopback mode
206 * must be disabled for the BMC to control host power-on and
207 * reset.
201 */ 208 */
202 if ((desc->reg == HW_STRAP1 || desc->reg == HW_STRAP2) && 209 if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1 &&
203 desc->ip == ASPEED_IP_SCU) 210 !(desc->mask & (BIT(21) | BIT(22))))
211 continue;
212
213 if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2)
204 continue; 214 continue;
205 215
206 ret = regmap_update_bits(maps[desc->ip], desc->reg, 216 ret = regmap_update_bits(maps[desc->ip], desc->reg,