From patchwork Tue Dec 19 16:04:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 755919 Delivered-To: patch@linaro.org Received: by 2002:adf:b181:0:b0:336:6142:bf13 with SMTP id q1csp1500825wra; Tue, 19 Dec 2023 08:06:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGUxR0xMQPy9ts+8Ol1qQxwIC7e4ewSYbpK+kuWZbhGRLxzbfjxRxzU5TcrMVg7MpOcOyc X-Received: by 2002:adf:a490:0:b0:336:77bb:108 with SMTP id g16-20020adfa490000000b0033677bb0108mr42448wrb.156.1703001975195; Tue, 19 Dec 2023 08:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703001975; cv=none; d=google.com; s=arc-20160816; b=wPKn6X0cw8g1I1m95GcqP4zkYgD3nwhUCvGFPpnA1P15gtu/nVZK5/elfgVds1XmNg 4tH9mxoGNIwT+rJ6vhrgsZaRL+1lSwSrBWtJKpGvyL3dHSFnOGtV784c0sucEiOUNj8H pxWEcapSIpYk1wzwVxbhz++ROdBjseXmuH9byDTf0koa8B9ucg7SW9byiS0koWrSdiN2 kFb1SsZQNlyoWaeKJaRXPEjgiaFnUEyBmDfx2r5R4MUnaP5+ZSksANP9R/CFAExmE3PD HhhXiEVylP1tApsVxmDoLF9771wpUZPVzzWQZ1yLu0gjIqVdl1l43lgszr/t/WTfTtra 0YHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=/XL39AP2M4vV2tYz5P7n+Qfnm8VTDdl4a+oBun6X6mY=; fh=GB9E9KzRIiNXhkRWIZbZpSMjbCjxnqnvE8nYuQxq8UI=; b=UB4FrAhgTav6lqiD1TAkg+L09PiEy63ohvVBGVYuOawzfDe7IsYoYpyzDE/FSeUuaN QkrztUAnn+zM6N6j76oYOlALxLtbodRCQx3pd3q06E55Q8sSFWcXNARfYv3H6Pn7WDf9 7gqOCNrIK5jaFq8ZG1x8VCv/SFumvKGJVlOp6ro9edQzSE7yAhCKn1+cnbfLE91vCw6L CGP6asE3gngAvyjJfmHcsoE0TD75SYElgX/8eDOZHWdSGjCnS5JegXE+dcLlrIjSlViD eQaeKV77At9SDH8DC+W8Pg/Z5e6Dvb5lAPhcJP2kENbkevbnBNG23d3mHr45qAFGujgk x0Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RVfH4mWm; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l8-20020a5d6d88000000b003366f7c3a33si1299750wrs.863.2023.12.19.08.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RVfH4mWm; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 98DC4877D8; Tue, 19 Dec 2023 17:04:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RVfH4mWm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0096E876DA; Tue, 19 Dec 2023 17:04:40 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 22AAE877A9 for ; Tue, 19 Dec 2023 17:04:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40c6e2a47f6so48908205e9.0 for ; Tue, 19 Dec 2023 08:04:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703001871; x=1703606671; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/XL39AP2M4vV2tYz5P7n+Qfnm8VTDdl4a+oBun6X6mY=; b=RVfH4mWmNTslY6lpq4t/81Fy3+QgiFHY8IDR3R+F3nDlA4taXl7oNuoRGfIwCcoGTb XKi4OqLhX6e48TGXT13Lmj3H1d+xppzV10GnZkMw0HlqDShhsVEpBW9MSsBPTwul2FBT Ybg+MzPPwsOMCAsK0J7RryTISEiUjZVt4HaRsdhfxZqm4zP/Id4IvLWPIvSnUnjULwGC DAd5ygGAj69oeeJOI3YNQy2b3MHAtvsmDDSQ6Gd0tC+2qI5+5prEoMRXLMWMlXG7lIEi bIIpCT1wNWXtdqkrHzGZ+EC5d+vOI0F5vTXyQhRCA2QVsgYQWm7+h23eWH3vJhoPpd58 rxZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703001871; x=1703606671; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/XL39AP2M4vV2tYz5P7n+Qfnm8VTDdl4a+oBun6X6mY=; b=kEPqEXAtVTEYTBgLjrY8tiBE8k+YrpDz2RPOJ1hBL94YH3d9h4m9xrsJGlMIR3zS8+ SSqbAKe4kKsWK4nN25Y0qNDdRqpXS7F7Uc5cUre03C0gKMwx3uG6NncRHq1czO7WkijD 7vYWh7j/mRwQPb3DNj4GCF1DPPm9GAXd7KbbeHLnOUziigFaf5HGpWwv+jZUk9FLarwS s3iHgFuKFJPX/Tck5vIuUSrlrEH5D3I/gd2RM9bbtZz4EEfkxY7h9Wh78+xdGqwMMGFP xUeIUVeGndrG1xZnSabNsp6Im/anoEevZaqXxBeuYnqGALR+8TGj0qhKEAhMrlsMQIVT ++Hg== X-Gm-Message-State: AOJu0YwbofWkgM9SGYTWIOJNrE92M6VL6pOhoiIcn2AJv0tCjX5Ibt3O GXpbE/a/+k2nBgBv+jtcZgHNhQ== X-Received: by 2002:a7b:c388:0:b0:40c:fc0:cff7 with SMTP id s8-20020a7bc388000000b0040c0fc0cff7mr4494201wmj.82.1703001871585; Tue, 19 Dec 2023 08:04:31 -0800 (PST) Received: from lion.localdomain (host-92-17-96-230.as13285.net. [92.17.96.230]) by smtp.gmail.com with ESMTPSA id je17-20020a05600c1f9100b0040d1450ca7esm3429723wmb.7.2023.12.19.08.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:04:31 -0800 (PST) From: Caleb Connolly Date: Tue, 19 Dec 2023 16:04:10 +0000 Subject: [PATCH v2 09/32] gpio: qcom_pmic: add a quirk to skip GPIO configuration MIME-Version: 1.0 Message-Id: <20231219-b4-qcom-common-target-v2-9-b6dd9704219e@linaro.org> References: <20231219-b4-qcom-common-target-v2-0-b6dd9704219e@linaro.org> In-Reply-To: <20231219-b4-qcom-common-target-v2-0-b6dd9704219e@linaro.org> To: Neil Armstrong , Sumit Garg , Ramon Fried , Dzmitry Sankouski , Caleb Connolly , Peng Fan , Jaehoon Chung , Rayagonda Kokatanur , Lukasz Majewski , Sean Anderson , Jorge Ramirez-Ortiz , Stephan Gerhold Cc: Marek Vasut , u-boot@lists.denx.de X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2074; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=v9DH+F39Hgb1gjA0X0f+J6A1VLoDuYhN2VKeuQYCUC4=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtTG/Uwfsr5/KeT9+zxEROLCQ3vpTh+raXf0eHftTN5ds W9fV8q+jlIWBkEOBlkxRRbxE8ssm9ZettfYvuACzBxWJpAhDFycAjCRhCkM/+uc+L9YVjioTLya FhG/tyOE60mJTl38ctYW5rR5aytLlzIydGlNqNlRZWQ2MfaYSMJ5eZbS2aEH3Y6phlyecufJsoT YewA= X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Some platforms hard reset when attempting to configure PMIC GPIOs. Add support for quirks specified in match data with a single quirk to skip this configuration. We rely on the GPIO already be configured correctly, which is always the case for volume up (the only current user of these GPIOs). Signed-off-by: Caleb Connolly --- drivers/gpio/qcom_pmic_gpio.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/qcom_pmic_gpio.c b/drivers/gpio/qcom_pmic_gpio.c index 2a4fef8d28cb..198cd84bc31e 100644 --- a/drivers/gpio/qcom_pmic_gpio.c +++ b/drivers/gpio/qcom_pmic_gpio.c @@ -64,6 +64,15 @@ #define REG_EN_CTL 0x46 #define REG_EN_CTL_ENABLE (1 << 7) +/** + * pmic_gpio_match_data - platform specific configuration + * + * @PMIC_MATCH_READONLY: treat all GPIOs as readonly, don't attempt to configure them + */ +enum pmic_gpio_quirks { + QCOM_PMIC_QUIRK_READONLY = (1 << 0), +}; + struct qcom_gpio_bank { uint32_t pid; /* Peripheral ID on SPMI bus */ bool lv_mv_type; /* If subtype is GPIO_LV(0x10) or GPIO_MV(0x11) */ @@ -75,7 +84,12 @@ static int qcom_gpio_set_direction(struct udevice *dev, unsigned offset, struct qcom_gpio_bank *priv = dev_get_priv(dev); uint32_t gpio_base = priv->pid + REG_OFFSET(offset); uint32_t reg_ctl_val; - int ret; + ulong quirks = dev_get_driver_data(dev); + int ret = 0; + + /* Some PMICs don't like their GPIOs being configured */ + if (quirks & QCOM_PMIC_QUIRK_READONLY) + return 0; /* Disable the GPIO */ ret = pmic_clrsetbits(dev->parent, gpio_base + REG_EN_CTL, @@ -304,7 +318,7 @@ static int qcom_gpio_of_to_plat(struct udevice *dev) static const struct udevice_id qcom_gpio_ids[] = { { .compatible = "qcom,pm8916-gpio" }, { .compatible = "qcom,pm8994-gpio" }, /* 22 GPIO's */ - { .compatible = "qcom,pm8998-gpio" }, + { .compatible = "qcom,pm8998-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, { .compatible = "qcom,pms405-gpio" }, { } };