From patchwork Thu Jun 3 10:40:26 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: 1487178 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=MycalS86; 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 4Fwj930LG1z9sWF for ; Thu, 3 Jun 2021 20:40:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C20D182FBB; Thu, 3 Jun 2021 12:40:35 +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="MycalS86"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1388682FBD; Thu, 3 Jun 2021 12:40:34 +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-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 DB4A082F9E for ; Thu, 3 Jun 2021 12:40:29 +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-x432.google.com with SMTP id m18so5347342wrv.2 for ; Thu, 03 Jun 2021 03:40:29 -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=G6j1UUYbOK85H0ZIlb7xTfjVhO1LHS5Zv6cj1UFXJRU=; b=MycalS86Dx521aPodLz4/8Wne/+E/6rS8WcooMI3qhI4tp3NuFQ+7hPp8KFpg/Wp3S NvvFBqZb9+l0NggKNOXYi1+qALILXZAgVE+Cye2sdEl86x/ckGplRwFpmA3YQEVL4K4q YrEoyd/XxXpAcfyZM92O9y7hyWQmcvflDJWNULDzdgCp6JLw/ybGisV+gZvs92TbQuiD 1Vab/o/FTWvv2ygGXRD1ZLieW53C68224cymDssj79CWCKqsvXsc2rG7mBNlqhyYY5wH SqLi06VahjsQ8mMz6iwRYQjyLrYKXpv9U1FJrQysY/At/of3Gno7v9bS1sJFNUkpPfcN TFPA== 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=G6j1UUYbOK85H0ZIlb7xTfjVhO1LHS5Zv6cj1UFXJRU=; b=WPDsLkTmyCUHs0HcWvBYGh0co+Fgx0qbm02CChB3UVwNK8+W+0ShBDXvXTeVbHR6zx VT37JDzkN31/AQoUqPnMn9TYO1+ksig5y2/382vCLyioPAkHgawn/xotzHqvXE1CMBmi H9eYX89JlcY5wnOhu/CyfRwhgbmAI4BMsgZTZhjnXMuachDW+MCvMQ7rXXYtk4bIoepJ vweiiMhNsAyeBUugAM+/Nx7c/oNqGGaqidKtCrR1OkXUPs61jkW0RphlmMwXyXmfXzdr ahIc064LI+wfG8QecjgT5n9klLt1j64lcg/UlunImPALkv1sNXlAGK7bYUW2bbIv6x+G 0tOg== X-Gm-Message-State: AOAM533Iet2g/SWqAy5ouNwAp21dGSX74l0RtauqznHpVV5l1/JnKIrN GEu/M2zjyO51PVwC3qMpWtKetJzqXrE++g== X-Google-Smtp-Source: ABdhPJwGTM8fcITBbc7935j3/GADB4hkS3KZn+wOD8s14lsmE6QyAfKmi2Ki4fykXRqefRDWNBwsFg== X-Received: by 2002:a5d:5271:: with SMTP id l17mr31072632wrc.142.1622716829490; Thu, 03 Jun 2021 03:40:29 -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 n13sm3262127wrg.75.2021.06.03.03.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 03:40:28 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, michal.simek@xilinx.com, sjg@chromium.org Cc: u-boot@lists.denx.de Subject: [PATCHv5] drivers: tpm2: update reset gpio semantics Date: Thu, 3 Jun 2021 12:40:26 +0200 Message-Id: <20210603104026.24346-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 Acked-by: Ilias Apalodimas --- v5: added Acked-by: Michal Simek .../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..16f870225f 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 (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..1d24d32d86 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 is 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);