From patchwork Wed May 2 08:59:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 907411 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=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40bXdr4T8Rz9ryk for ; Wed, 2 May 2018 19:14:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 380EAC21DD9; Wed, 2 May 2018 09:08:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 18914C21EC8; Wed, 2 May 2018 09:00:05 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 382AAC21D65; Wed, 2 May 2018 08:59:40 +0000 (UTC) Received: from mail.bootlin.com (mail.bootlin.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 2BC0BC21D56 for ; Wed, 2 May 2018 08:59:40 +0000 (UTC) Received: by mail.bootlin.com (Postfix, from userid 110) id 3274720A33; Wed, 2 May 2018 10:59:39 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id EAB7720726; Wed, 2 May 2018 10:59:38 +0200 (CEST) From: Miquel Raynal To: Tom Rini , Simon Glass Date: Wed, 2 May 2018 10:59:27 +0200 Message-Id: <20180502085934.29292-19-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180502085934.29292-1-miquel.raynal@bootlin.com> References: <20180502085934.29292-1-miquel.raynal@bootlin.com> Cc: u-boot@lists.denx.de, Bastian Fraune Subject: [U-Boot] [PATCH v3 18/25] tpm: add the possibility to reset the chip with a gpio X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" On some designs, the reset line could not be connected to the SoC reset line, in this case, request the GPIO and ensure the chip gets reset. Signed-off-by: Miquel Raynal --- drivers/tpm/tpm2_tis_spi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c index cfef5b8c24..824ab70bae 100644 --- a/drivers/tpm/tpm2_tis_spi.c +++ b/drivers/tpm/tpm2_tis_spi.c @@ -24,6 +24,9 @@ #include #include #include +#ifdef CONFIG_DM_GPIO +#include +#endif #include "tpm_tis.h" #include "tpm_internal.h" @@ -598,6 +601,21 @@ static int tpm_tis_spi_probe(struct udevice *dev) { struct tpm_chip *chip = dev_get_priv(dev); int ret; +#ifdef CONFIG_DM_GPIO + struct gpio_desc reset_gpio; + + 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__); + + if (dm_gpio_is_valid(&reset_gpio)) { + dm_gpio_set_value(&reset_gpio, 0); + mdelay(1); + dm_gpio_set_value(&reset_gpio, 1); + } +#endif /* Ensure a minimum amount of time elapsed since reset */ mdelay(30);