From patchwork Thu Jun 3 09:21:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Foundries" X-Patchwork-Id: 1487129 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=VrQWGYbh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FwgPS4KFJz9sVb for ; Thu, 3 Jun 2021 19:21:16 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7F1E982B0E; Thu, 3 Jun 2021 11:21:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="VrQWGYbh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B59F082F3D; Thu, 3 Jun 2021 11:21:09 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 DF53082B0E for ; Thu, 3 Jun 2021 11:21:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wr1-x429.google.com with SMTP id a11so3205593wrt.13 for ; Thu, 03 Jun 2021 02:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uReyD/kiusFgtw7y8bukc+eT/oEycbMZCLg22sjqTvw=; b=VrQWGYbh0MEI/g4T/9h9GUzI0LzZmvdkvLk4XkLaf/69BOxn6WcJnPY1ow5j3MYOIi 2NdR1Lbub+F5dZvtz+Wm3JFr0MVQY37+A4CPzgD4LJxj68P6MF8+OImoDXCcFiBy6JHD RreJa9j+qzSgIBR0/rwmTHyOU81XjBw+b3DSRFtMvbjpVKr1aUVUVSn71HWa0rP/RORd Od9veJsEEQ4QIANfP8UzOL6TF/lfDlPOaMyIFeJv3XW5RelaSBRttv+hYwWU1g4BPI01 Gxcuqi11OiFhFLDKzSZvdB+VkPbdNMc7ulBZ9S7q54Er2mqdur4yPtGvIy68c8ZMAala l+ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uReyD/kiusFgtw7y8bukc+eT/oEycbMZCLg22sjqTvw=; b=GGnVKifWqhuAlRuZe+6V8WLRM5gB+cPm5RF5MXWTvDGZ0G1pQdV4knWeGxdENFXvzT igB8Yxjo/sUnJBLZbSUZlbn0PJoLH5DEoiLr4gS/o8cE26iq1bpZUDzPNM3sn/ZOOZ79 xaVHtQ8mPOG5dbF4kE150JglNiW/LXPb/xFeMDHHa2xXqV3Hpyc3IYn+nwwaKb+0dpnA eJahLmsfY3TLfhsgXVQb8B2xu8IuaioI9CkenBT2IANXfnZ1Z3Rn8JGtfjaM9oLQGZac D+zkMH58LuD1pW/pFhAyEMdjwd2lN1Llt8D+4OMLs5LsRwkaKRiN2YmCcq7xPbKYXdU1 qGcA== X-Gm-Message-State: AOAM532pBqiEBgbNhIbspwwHkuT7bfQA5JOGk/gxkXp4ldW0kM85CxQm rs4ebDXHzghFVPrYWvvXwBpwWA== X-Google-Smtp-Source: ABdhPJzRPoaYu1Msoz8oPehuAkG5VilRKWxLcFI+KR6sEaz7VqG7I78OibwqCzl4i6s4Rr0tndBVUA== X-Received: by 2002:a5d:5192:: with SMTP id k18mr35528wrv.163.1622712065455; Thu, 03 Jun 2021 02:21:05 -0700 (PDT) Received: from localhost.localdomain (113.red-79-154-202.dynamicip.rima-tde.net. [79.154.202.113]) by smtp.gmail.com with ESMTPSA id g26sm4890717wmh.24.2021.06.03.02.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:21:04 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, michal.simek@xilinx.com Cc: sjg@chromium.org, bruno.thomsen@gmail.com, u-boot@lists.denx.de Subject: [PATCHv3] drivers: tpm2: update reset gpio semantics Date: Thu, 3 Jun 2021 11:21:01 +0200 Message-Id: <20210603092101.27311-1-jorge@foundries.io> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean Use the more generic reset-gpios property name. Signed-off-by: Jorge Ramirez-Ortiz Acked-by: Michal Simek --- v3: maintained the legacy property in the docs .../tpm2/tis-tpm2-spi.txt | 3 ++- drivers/tpm/tpm2_tis_spi.c | 23 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt index 3a2ee4bd17..521550bf67 100644 --- a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt +++ b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt @@ -6,7 +6,8 @@ Required properties: - reg : SPI Chip select Optional properties: -- gpio-reset : Reset GPIO (if not connected to the SoC reset line) +- reset-gpios : Reset GPIO (if not connected to the SoC reset line) +- gpio-reset : Reset GPIO (will be deprecated, use reset-gpios instead) - spi-max-frequency : See spi-bus.txt Example: diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c index 4b33ac8fd3..73e7c342aa 100644 --- a/drivers/tpm/tpm2_tis_spi.c +++ b/drivers/tpm/tpm2_tis_spi.c @@ -589,18 +589,25 @@ static int tpm_tis_spi_probe(struct udevice *dev) if (CONFIG_IS_ENABLED(DM_GPIO)) { struct gpio_desc reset_gpio; - ret = gpio_request_by_name(dev, "gpio-reset", 0, + ret = gpio_request_by_name(dev, "reset-gpios", 0, &reset_gpio, GPIOD_IS_OUT); if (ret) { - log(LOGC_NONE, LOGL_NOTICE, "%s: missing reset GPIO\n", - __func__); - } else { - dm_gpio_set_value(&reset_gpio, 1); - mdelay(1); - dm_gpio_set_value(&reset_gpio, 0); + /* legacy reset */ + ret = gpio_request_by_name(dev, "gpio-reset", 0, + &reset_gpio, GPIOD_IS_OUT); + if (ret) { + log(LOGC_NONE, LOGL_NOTICE, + "%s: missing reset GPIO\n", __func__); + goto init; + } + log(LOGC_NONE, LOGL_NOTICE, + "%s: gpio-reset will be deprecated\n", __func__); } + dm_gpio_set_value(&reset_gpio, 1); + mdelay(1); + dm_gpio_set_value(&reset_gpio, 0); } - +init: /* Ensure a minimum amount of time elapsed since reset of the TPM */ mdelay(drv_data->time_before_first_cmd_ms);