From patchwork Mon Sep 9 12:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 826584 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp1963291wrb; Mon, 9 Sep 2024 05:06:54 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVf7/+6q1BZnNG7O5v5+KUg4zI6Mq6KhOB7N16lcW1RrfxfSX5VhtgzWQQTPRd6GJegmXyjeA==@linaro.org X-Google-Smtp-Source: AGHT+IHdVzkbTVk0Ypte91FqlpI1QVU3C/omGZl+MmUQ+bgMedNiXS64hEP3x9FgS0whGGicvQHf X-Received: by 2002:a5d:510d:0:b0:375:570e:7ee with SMTP id ffacd0b85a97d-378895cb813mr7122766f8f.15.1725883613979; Mon, 09 Sep 2024 05:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725883613; cv=none; d=google.com; s=arc-20240605; b=iqKv16JxBfaOkErNBZ62qoTCEdKCp+BpB87/bi5aAQdCF1JRV0g3c6gKPvkDVM9YTF PRAxMwqJkUcXIkQ7NKpEnikUpnwOdi/5QtFNR1vYu7EM/WowOHXdZgH1URJRIjFbkrx7 XTxvc098bIiVMDAtZB3O8wmt260yiAz+2y35dZ1Gq4VVXjzlDA4xRxeuHFNdEr/G58uP nyzvwZISZqmFrhrrRu0Octp3j/tWHrAGsH2twKxdFH93RBZ+PrViNfQLm6JDI5hc3x6O PVM1k7tY+zZ8P+qHQ8jDcbNfvreDP9bN+DflAE2r/SUrdpfTy9ifzCx5dopRnMpbWRDi zQog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=pp4hr0Pl6dMJ7egx7sUE8uwG6pH4A9PkCe8vVMgvv6o=; fh=gu7QzZR4j+8o6XTONyGkiSqGyvQgm2r5iDOF7zxx+DI=; b=X+ggXwTIOQ7ih8+nDyD1ud+I1B8UGt3WxiCBw8ucRsp5K1aywyQc4s+w0zXIS/pDZy TiOv0VLhTghR8sdehqC4s9F8ftHG4bYBjPgxQJhxYPI4Y5hZp1Ty37yFrhgmdt/eE6OU Fxm9ZYZjemQTqrUk8mMHSMZR/XhkggU5SzTCZq3LgEidYYmB4rf3rFEzLYbb3Wzst97I YRNKpjAm2sczoPu51XRnwylqDl8IlPJ2aABWKjCbN6adCzv6KOBqE7sAy/31h8JU1q2a DgR/qNeYh+J9de8Jth8z/nm2D5Xe54cMIq0fy4oWqXJpQg3hMPl8CG+YALdsg+lY53Ad F+rA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EZBXz5Yt; 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; dara=neutral header.i=@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 ffacd0b85a97d-3789569a6f3si2122108f8f.442.2024.09.09.05.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 05:06:53 -0700 (PDT) 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=EZBXz5Yt; 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; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B069C88C70; Mon, 9 Sep 2024 14:06:52 +0200 (CEST) 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="EZBXz5Yt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4838F88D90; Mon, 9 Sep 2024 14:06:51 +0200 (CEST) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 48E1588C70 for ; Mon, 9 Sep 2024 14:06:49 +0200 (CEST) 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-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c3ed267a7bso1811919a12.3 for ; Mon, 09 Sep 2024 05:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725883609; x=1726488409; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pp4hr0Pl6dMJ7egx7sUE8uwG6pH4A9PkCe8vVMgvv6o=; b=EZBXz5YtMqHaM0Ds4zbl0KuELyZN0BhY55RX3QymB0y2XXtVAXdCax90u9onqrCzDF esUE17I0Sho0xPbaA8hAy0HFbUcOu45Xisae6pL7ohVXKLXOEN9R8cYquLKDjq87eicU d1exLT793lkE45DDneXO+asoLDLuVfJaCZT35ZvtGGZP1c3p5ZBNfohOLSpO9uOdPksL hByA4024/Tl7bTceWdHYiQoRJkT4WLUKbEct6p0hLnRvpUhylqfKjJ/d3MJ1Lo25DnIk xcvlS4Kj81FLJMFmckQJG8U3iDqUJAAY+4rMa1G8OheBH8w1GeORQ29/n7NYLUyAB1nn HI+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725883609; x=1726488409; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pp4hr0Pl6dMJ7egx7sUE8uwG6pH4A9PkCe8vVMgvv6o=; b=PbXvklqhuZKcywZU7EnJcuskvj0Nx0sRG5WnLnnAvMW/BTW4Q9uMRWhYJMdAZdfrMM P2avWuHyo6jF9xIdR0vvySrDcwM19GRmpo18CJZcNEzOIUFAGwaN913Vf45JGHrGD8z8 8s/XpQpYnlYajTYqhwt1bAy7996kisH+58Jup5DLeufu+cwYB/0ttTumhYTm7UiR1X3e RKf74L4oC/IH5D5X6A6Kl4dsL7K25OagV1NPDPFjADJXQqozOLZ2gJJN5009NFKJ2ziu qI80Id+877kcOiT+IbGHs+L8djJh7shfOGrC6Xnq3ZsBHvyINmBfM6RJu4RNAZTiKOSK AZzA== X-Gm-Message-State: AOJu0YyhAnm6YA69cKdk60EWVAQMyIT25fuJHbGid3u8tzlJRl9QUkDt AL9jGDmHRegYkodJojR9LxiivlgTzq3qe1dYA1QnyHgF30KVHrvIMHaTVm8VE+o= X-Received: by 2002:a17:907:e90:b0:a7a:9447:3e8c with SMTP id a640c23a62f3a-a8a885bddf2mr664900466b.3.1725883608431; Mon, 09 Sep 2024 05:06:48 -0700 (PDT) Received: from lion.caleb.rex.connolly.tech ([2a02:8109:aa0d:be00::8db]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d2583f73asm332871966b.7.2024.09.09.05.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 05:06:47 -0700 (PDT) From: Caleb Connolly To: Caleb Connolly , Heiko Schocher , Neil Armstrong , Simon Glass , Sumit Garg , Tom Rini Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io Subject: [PATCH] Revert "gpio: qcom_pmic: add a quirk to skip GPIO configuration" Date: Mon, 9 Sep 2024 14:06:10 +0200 Message-ID: <20240909120641.1396544-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 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 This reverts commit 19f000b72b2fa7e4540f7cdb91287aff594239bd. The bug in writing was caused by a long-standing error in the SPMI driver which has since been fixed - c2de620d64d4 ("spmi: msm: fix version 5 support"). We can safely enable writing GPIO configuration now. Signed-off-by: Caleb Connolly Reviewed-by: Neil Armstrong --- Tested on SDM845/pm8998 (OnePlus 6) --- drivers/gpio/qcom_pmic_gpio.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/gpio/qcom_pmic_gpio.c b/drivers/gpio/qcom_pmic_gpio.c index 80fee841ee3f..f2ef4e5ce144 100644 --- a/drivers/gpio/qcom_pmic_gpio.c +++ b/drivers/gpio/qcom_pmic_gpio.c @@ -68,19 +68,8 @@ #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. - * This is a workaround for an unknown bug on some platforms where trying to write the - * GPIO configuration registers causes the board to hang. - */ -enum pmic_gpio_quirks { - QCOM_PMIC_QUIRK_READONLY = (1 << 0), -}; - struct qcom_pmic_gpio_data { uint32_t pid; /* Peripheral ID on SPMI bus */ bool lv_mv_type; /* If subtype is GPIO_LV(0x10) or GPIO_MV(0x11) */ u32 pin_count; @@ -127,15 +116,10 @@ static int qcom_gpio_set_direction(struct udevice *dev, unsigned int offset, bool input, int value) { struct qcom_pmic_gpio_data *plat = dev_get_plat(dev); uint32_t gpio_base = plat->pid + REG_OFFSET(offset); - 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, REG_EN_CTL_ENABLE, 0); if (ret < 0) @@ -277,9 +261,8 @@ static const struct dm_gpio_ops qcom_gpio_ops = { static int qcom_gpio_bind(struct udevice *dev) { struct qcom_pmic_gpio_data *plat = dev_get_plat(dev); - ulong quirks = dev_get_driver_data(dev); struct udevice *child; struct driver *drv; int ret; @@ -291,9 +274,9 @@ static int qcom_gpio_bind(struct udevice *dev) /* Bind the GPIO driver as a child of the PMIC. */ ret = device_bind_with_driver_data(dev, drv, dev->name, - quirks, dev_ofnode(dev), &child); + 0, dev_ofnode(dev), &child); if (ret) return log_msg_ret("bind", ret); dev_set_plat(child, plat); @@ -360,13 +343,13 @@ static int qcom_gpio_probe(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", .data = QCOM_PMIC_QUIRK_READONLY }, + { .compatible = "qcom,pm8998-gpio" }, { .compatible = "qcom,pms405-gpio" }, - { .compatible = "qcom,pm6125-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, - { .compatible = "qcom,pm8150-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, - { .compatible = "qcom,pm8550-gpio", .data = QCOM_PMIC_QUIRK_READONLY }, + { .compatible = "qcom,pm6125-gpio" }, + { .compatible = "qcom,pm8150-gpio" }, + { .compatible = "qcom,pm8550-gpio" }, { } }; U_BOOT_DRIVER(qcom_pmic_gpio) = {