Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2430137rdb; Wed, 4 Oct 2023 00:16:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAr49lpaTNpP9rk3faJRq6c784HUCUlzB5T6kdZVUrF1CVtyDYd74lTVLmX/cb7gLh949Q X-Received: by 2002:a05:6830:1e28:b0:6bb:1c30:6f3c with SMTP id t8-20020a0568301e2800b006bb1c306f3cmr1287935otr.0.1696403818198; Wed, 04 Oct 2023 00:16:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696403818; cv=none; d=google.com; s=arc-20160816; b=jgXAK3Felgc95imDRn9tgG4eVDjWpRTdN9LGFxyMq2XsUzT7DplfziGppCO1V1r5rk dwEdUebdD1xbO8uc37OlEhfMW3nlMy2s570WwWM99zU1azEnFg+IGfBFqYhBwfnnrdcN f6pXpjZf396vOvYoao7B8mTy52Xrf2na0v2d1NLCBGlh6e4G7MIznRrc0NrdL1AGScxY s0iCTfygz/KZRMBjD7rdXHYZsLsMb+1e9yJnupN2Y0vJ3yhbq99u1/JrmvnFUpIi1mbC bcwkHdJxdYCo40x+Ft7IF2ADzYCXosUfmb2+3sdFybuQz/V9p3w9+IDy9ho9y7U5AK0L a7tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yFCKItcXGPE1Q+oFb43qALwVs7ooi/Pj1fioqFcF6gw=; fh=2BpOAYf4XnRp8Wl8Alt/I5wXL3B5nuFxTlSSQoH0Igw=; b=vNBJ65GV9p+83AsM8LgGJO/bfHHctcTLX27k480iFv8D/2gfRVeSfl7aOwq8D/YNgj PFQoIFvSp2Qj3M0X/rb9AHHkZ3/KpVuM66smP4rN6GiIq7h28ZOUpUB6tdzUe9azMSnH 57/YX5oBGQEZJ0SG+Ao2YsJabnmUWjoWh49aAaKG75lvBMkpux1D5HyOCqgDUcMuMs5t eT+6ue3HkEEyJ6FWpdA6RoBCqIwDmhSmWjtsil9CSqg5c+rw8cIvVywDFLRfPOPMwY0f eFTtBQl6zAV3gzyAGLOQE3vKE6MQpDIlMBMNZ0rEFawCgpKacYaJu15Juycz0M5abg48 dRng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=hadfSUMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 19-20020a630c53000000b005779c97fae5si3022368pgm.480.2023.10.04.00.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 00:16:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=hadfSUMf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8522E80BF1E1; Wed, 4 Oct 2023 00:16:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbjJDHQr (ORCPT + 99 others); Wed, 4 Oct 2023 03:16:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229577AbjJDHQr (ORCPT ); Wed, 4 Oct 2023 03:16:47 -0400 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [71.19.156.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C8E5AB for ; Wed, 4 Oct 2023 00:16:43 -0700 (PDT) Received: from hatter.bewilderbeest.net (unknown [IPv6:2602:61:7e5d:5300::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id DAF71DD9; Wed, 4 Oct 2023 00:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1696403803; bh=yFCKItcXGPE1Q+oFb43qALwVs7ooi/Pj1fioqFcF6gw=; h=From:To:Cc:Subject:Date:From; b=hadfSUMfsGJ2vkIP/x8ARWUdzgF/1O22W2p3kl7aFETYKCgQYjqWYD8dd+u5IMAAb QwIJfiO2YOrAUYq9LkkngRKjaINpWN+x9ECkRf7URPtuomY/zTeiNAxm2O2wvooZcE b7E7qQkbbCzfQW+29dD3HVZmiKypiBPXXo7HwIbY= From: Zev Weiss To: Andrew Jeffery , Linus Walleij , Joel Stanley , linux-aspeed@lists.ozlabs.org Cc: Zev Weiss , openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] pinctrl: aspeed: Allow changing hardware strap defaults Date: Wed, 4 Oct 2023 00:16:06 -0700 Message-ID: <20231004071605.21323-2-zev@bewilderbeest.net> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 04 Oct 2023 00:16:55 -0700 (PDT) Previously we've generally assumed that the defaults in the hardware strapping register are in fact appropriate for the system and thus have avoided making any changes to its contents (with the exception of the bits controlling the GPIO passthrough feature). Unfortunately, on some platforms corrections from software are required as the hardware strapping is simply incorrect for the system (such as the SPI1 interface being configured for passthrough mode when master mode is in fact the only useful configuration for it). We thus remove the checks preventing changes to the strap register so that the pinctrl subsystem can be used for such corrections. Signed-off-by: Zev Weiss --- drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 21 --------------------- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 21 --------------------- drivers/pinctrl/aspeed/pinmux-aspeed.h | 3 --- 3 files changed, 45 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c index bfed0e274643..7ecfe3e4280e 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c @@ -2556,27 +2556,6 @@ static int aspeed_g4_sig_expr_set(struct aspeed_pinmux_data *ctx, if (!ctx->maps[desc->ip]) return -ENODEV; - /* - * Strap registers are configured in hardware or by early-boot - * firmware. Treat them as read-only despite that we can write - * them. This may mean that certain functions cannot be - * deconfigured and is the reason we re-evaluate after writing - * all descriptor bits. - * - * Port D and port E GPIO loopback modes are the only exception - * as those are commonly used with front-panel buttons to allow - * normal operation of the host when the BMC is powered off or - * fails to boot. Once the BMC has booted, the loopback mode - * must be disabled for the BMC to control host power-on and - * reset. - */ - if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1 && - !(desc->mask & (BIT(21) | BIT(22)))) - continue; - - if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2) - continue; - ret = regmap_update_bits(ctx->maps[desc->ip], desc->reg, desc->mask, val); diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c index 4c0d26606b6c..3e57e76c2eb7 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c @@ -2735,27 +2735,6 @@ static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx, return PTR_ERR(map); } - /* - * Strap registers are configured in hardware or by early-boot - * firmware. Treat them as read-only despite that we can write - * them. This may mean that certain functions cannot be - * deconfigured and is the reason we re-evaluate after writing - * all descriptor bits. - * - * Port D and port E GPIO loopback modes are the only exception - * as those are commonly used with front-panel buttons to allow - * normal operation of the host when the BMC is powered off or - * fails to boot. Once the BMC has booted, the loopback mode - * must be disabled for the BMC to control host power-on and - * reset. - */ - if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1 && - !(desc->mask & (BIT(21) | BIT(22)))) - continue; - - if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP2) - continue; - /* On AST2500, Set bits in SCU70 are cleared from SCU7C */ if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1) { u32 value = ~val & desc->mask; diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h index aaa78a613196..e9068acd5879 100644 --- a/drivers/pinctrl/aspeed/pinmux-aspeed.h +++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h @@ -16,9 +16,6 @@ * bits. Some difficulty arises as the pin's function bit masks for each * priority level are frequently not the same (i.e. cannot just flip a bit to * change from a high to low priority signal), or even in the same register. - * Further, not all signals can be unmuxed, as some expressions depend on - * values in the hardware strapping register (which may be treated as - * read-only). * * SoC Multi-function Pin Expression Examples * ------------------------------------------ -- 2.42.0