From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DAEEC4708F for ; Tue, 1 Jun 2021 10:20:44 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6726D60FD8 for ; Tue, 1 Jun 2021 10:20:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6726D60FD8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 80DCB81E53; Tue, 1 Jun 2021 12:20:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="UaeVXsfB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C01F581F9B; Tue, 1 Jun 2021 12:20:38 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20627.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::627]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D304C81D48 for ; Tue, 1 Jun 2021 12:20:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michals@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kx2xbftAjIBI5Ock2MH2Ll0DX0tQyRExTMrgpAy4DGam5hCL0ApLezuZ1EcqNzz5pjuvCTdImkO6UddB+gDr8tGJQrSXeJU7v6u5VeUzHGnfKUDa9EpP7h/4ypKD4f3OyKgqUC+pwkZCljSlCe3idUqzserDz5sTVEA9Kwko/J8h273TpkTyKtmYYKDavxPm8R1R2G14j0Tqwpb0nLhyL0S76nYWs6PES+bi2i7EDA49Mxqcq4kdqnt9XfTi5cAjd2DDR693R2FKwvczrac3lqtlHO/af1sARUKCU7SbN+fCvD9n5n/j6N90Tn3wQsMasf/8E0zk57vTSSfd9gckqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WLFUp7Bnfe/CxkKWWWNaVKBpH2BCHLIPxBWnZ0zJupI=; b=Ch9bNmBCq66+i4BTEnUn9GsqMMt86BQOVTfoW1Wv00w0WO012uNC6lVLtzh+i2XDLLYle0udSn4rnN2gX3jDTfqXV/Yz4zzYzLljTnXjcYdxpJ/qPHgERcO9Hn0BbE/2mFCOH9UHeFvJVWWyC4z7TEQ+Wzqy7sDh2xGazjHQQAJhl4tJHYJyBumg9fEc8vXlZhBLWH2b2ZekEszVOe8gFN5r9dBpb11BIQmlPRW0aEsI8u6QbExlW+xsf7EsznmlLd6rXhTydJE+waIyPqyAfH2iUM/qfYedyjS7suJmYNKctyJDhFlt5K7Gmb9UQvQLH4WsBz4RFvg42DRIRwcgfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WLFUp7Bnfe/CxkKWWWNaVKBpH2BCHLIPxBWnZ0zJupI=; b=UaeVXsfBEt9wdCjTtwGfvm5WTESa0pqVAp+DkmpgXG9DUzztdpYb//WCrd/nrvzVDnriH12KTbKy2MsnJG3JUIGEPZSY1iOtSCoxI6zfavrVKzzdFf+VQiUcqZBh/EJA7qxS27ec8Y3cdNeEYN9uuu2d1nd+IxFyEUXw6knJazk= Received: from SN4PR0501CA0032.namprd05.prod.outlook.com (2603:10b6:803:40::45) by BYAPR02MB4309.namprd02.prod.outlook.com (2603:10b6:a03:5c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.24; Tue, 1 Jun 2021 10:20:20 +0000 Received: from SN1NAM02FT0041.eop-nam02.prod.protection.outlook.com (2603:10b6:803:40:cafe::24) by SN4PR0501CA0032.outlook.office365.com (2603:10b6:803:40::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.10 via Frontend Transport; Tue, 1 Jun 2021 10:20:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0041.mail.protection.outlook.com (10.97.5.44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4150.30 via Frontend Transport; Tue, 1 Jun 2021 10:20:17 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 03:20:07 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.2 via Frontend Transport; Tue, 1 Jun 2021 03:20:07 -0700 Envelope-to: u-boot@lists.denx.de, bruno.thomsen@gmail.com, sjg@chromium.org, jorge@foundries.io Received: from [172.30.17.109] (port=55814) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lo1VH-0000li-Ll; Tue, 01 Jun 2021 03:20:07 -0700 Subject: Re: [PATCHv2] drivers: tpm2: update reset gpio semantics To: "Jorge Ramirez-Ortiz, Foundries" , Michal Simek CC: , , References: <20210601060927.30894-1-jorge@foundries.io> <20210601073517.GA2523@trex> From: Michal Simek Message-ID: <121d591d-6136-c66e-967f-8c3ad77b0dc6@xilinx.com> Date: Tue, 1 Jun 2021 12:20:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <20210601073517.GA2523@trex> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16f06290-4ee2-4cb5-7269-08d924e6da7e X-MS-TrafficTypeDiagnostic: BYAPR02MB4309: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:112; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NT2sXoaysDgdlZDTKISouiqew1lPCBUsB0rXkRo8HiXXkHD3JZNFdJ7+LGO0AwoTZVDdxaWcsQg9zSiGBg9Q88eOfRl53OngWtzMvAnI26ORLchrxwkoRktke7LVLTsJDQXmlP5e6JXP1wfMbcsXBPVC1fiJuStWtgB5JK+Qfd6Ie7zjKLkH65NhhCZE8gCOQDXgGPgWxKsfhd9AKyvJ/l5ZO0SvkHO+4Rk8/rlGXbHJpyUxlrKUs0V0w27pOK2Su5/e7ahhl/v7EvHoAJpS6oxoHnQvscv5yLeJDEAu+1buV2dvd8W7lCVyqGgJlUF1vgi4M2L15Z9JCxtzn2e6dOYAP5HMtfiRZTCZEzpf73xkZ1nDvFTOlm6mPnfU+Md6H4BAmkudNq9w4YVlpYskN5O2GpSL8/X8z5oFz48T0rit/g/4WlmqjRCIyAntg7tYuhj7Hj8Hog9APSxkQ/iZJ3DsS1QjXeXXoaT++8cAW03x41tiogYqTxwEFyhpn4S3nfo9le5nJ6Lo5TPRu7gvmtx1ELdQQuFSHI/ATLRj+oV0G5FkQvxiJGeCiM136XejC7ZdpoQfdc7j+cHkrkaIn901gRvunkwLvQFwF2DDIZHUlY9IcEBdrsjiL59Wn3heZmMAT23siGX9wO7hdcD81FEEXDGnN4q8eeFTDrh0QlW5CiNR6H7cllvlrDjL4Xpw9TpJST9e/ffXcD5wrYm4nQ== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39850400004)(136003)(346002)(376002)(396003)(36840700001)(46966006)(7636003)(82740400003)(9786002)(36756003)(356005)(83380400001)(47076005)(53546011)(15650500001)(316002)(8936002)(5660300002)(4326008)(26005)(110136005)(8676002)(54906003)(336012)(478600001)(426003)(82310400003)(31686004)(70206006)(36860700001)(70586007)(186003)(44832011)(31696002)(2906002)(2616005)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2021 10:20:17.5634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16f06290-4ee2-4cb5-7269-08d924e6da7e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0041.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4309 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 On 6/1/21 9:35 AM, Jorge Ramirez-Ortiz, Foundries wrote: > On 01/06/21, Michal Simek wrote: >> >> >> On 6/1/21 8:09 AM, Jorge Ramirez-Ortiz wrote: >>> Use the more generic reset-gpios propery name. >>> >>> Signed-off-by: Jorge Ramirez-Ortiz >>> --- >>> v2: kept gpio-reset as legacy >>> >>> .../tpm2/tis-tpm2-spi.txt | 2 +- >>> drivers/tpm/tpm2_tis_spi.c | 21 ++++++++++++------- >>> 2 files changed, 14 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..bbcd12950f 100644 >>> --- a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt >>> +++ b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt >>> @@ -6,7 +6,7 @@ Required properties: >>> - reg : SPI Chip select >>> >>> Optional properties: >>> -- gpio-reset : Reset GPIO (if not connected to the SoC reset line) >> >> As I said you shouldn't remove this. Just extend description that it is >> deprecated and reset-gpios should be used instead. > > I dont really agree with that. IMO we should remove the documentation > since it is obsolete after this commit and anyone reading it should > not care about the gpio-reset property. Run this on linux kernel and you will see that normal style is to keep it there. git grep deprecated Documentation/devicetree/bindings > >> >>> +- reset-gpios : Reset GPIO (if not connected to the SoC reset line) >>> - 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..1f9f89f68f 100644 >>> --- a/drivers/tpm/tpm2_tis_spi.c >>> +++ b/drivers/tpm/tpm2_tis_spi.c >>> @@ -589,18 +589,23 @@ 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; >>> + } >> >> And here it is clear that gpio-reset is used which should deprecated >> that's why you should print message about it here. > > yes, I can do that. makes sense > >> >> >>> } >>> + dm_gpio_set_value(&reset_gpio, 1); >>> + mdelay(1); >>> + dm_gpio_set_value(&reset_gpio, 0); >>> } >> >> What about this to remove that goto? > > um, what is the problem with the goto (IMO tidier than yet another > conditional); it is not as if this goto is making the code obscure. > > with the change below you just removed previous functionality > (ie indicating that there is no GPIO reset provided, hence why at > first sight might look cleaner than a goto) I tend to use goto unless there is no way around. But up2you. M