From patchwork Fri Feb 3 13:01:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 13127495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6360C61DA4 for ; Fri, 3 Feb 2023 13:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232327AbjBCNCJ (ORCPT ); Fri, 3 Feb 2023 08:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232237AbjBCNCH (ORCPT ); Fri, 3 Feb 2023 08:02:07 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2059.outbound.protection.outlook.com [40.107.94.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18F49D077; Fri, 3 Feb 2023 05:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pv9DoqrEaBcgVw6saLF7vHnvMjpAjJnd7ll/2mUR7ewbdEK+KKB9yQ99Y0CnXWAV8g9NTD1qw5bGXkM5fZd8+odk7qB+Rvv4aHFG03Q5KMLomn1xZFQBhEG3FcqyqDvGdy6Awz0d/K5iimn2+GaYMYJ42TXEU0/BiGiaBq1zoI8wTXSGqJy5Mb6lxfg5fv8MeCLC5lY22uujtIEerZOl2gwJPFpw5SLqdnMXTX/QZomjSavmUPebArBET7RBgmA8mD1Q7vbAN1yfnvs6XYXjoBnmci0xH6sE7Zt+jGT4zQf31g4LDtfjBJwp+gKXLG7tXx19EIvEi+ayRw2HkY3JaQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XYqNtURX6sgj1Il06Rub7pp9lcxmqO67nIgl0nPpEaM=; b=aPmnDuyVe2IhMsIgNxSryM0Y7CYHNktEp5DK+9M7d5dJYS1K2rEUgRcZolvSRr9RaJZ4AVdI5wHAzYvNEGU/m+p2Dg4Bi+HsOQevHSAxNOmh6LocH5yjB8/nwEMyDUapv6jV9CTV9TZzbuoegHQexd07tzNsz7K79ZohgvejTM5hrWAlzFtN3Q2Rw2vgtUEecAWFznuAd5xIectdvZ6tMQLhubxoMmy6X+FbHYCG86bjk025HJqtFMect/S6H1mFXdYjxnXhgHbJZIesXXSQ84WrLqHwU9BOJmTk4R3WoyRg/ii5q24Fg+9wcrfrY5FaR3JLEv474DNuGYnU7GIgwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XYqNtURX6sgj1Il06Rub7pp9lcxmqO67nIgl0nPpEaM=; b=HrmIE+7Az4hZHDE2SgTM2HzERNDIYmzJVjrEazjGQYGZBWYcqw5Bm5nSJUTeKde0PjRiJkrNexHHyWZxmwGaVOBPoS8+MbOabtBwhyqY4YP+2youDaNI3m6c57mdang0bAB2UB7RcGWD87FWfaJILooW1alvG+nZTG4F7CMka0VYExdsGRHYyAFRpGrcI2KvQDpbPKfGNMM5CxodRARzxpGHVmbHbwr1iYxEpeVkVPXaMt2rVXXW9NFgFjERJWH4NiQqt/n0xIS+L53LOcU7Usaj4rzKXrnJouwrfU4+kUxIqs9o5m6doFUIidbNyrw9UoElBcZJDbHmlHHwmtLSMA== Received: from MW4PR03CA0239.namprd03.prod.outlook.com (2603:10b6:303:b9::34) by CH0PR12MB5187.namprd12.prod.outlook.com (2603:10b6:610:ba::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.25; Fri, 3 Feb 2023 13:02:03 +0000 Received: from CO1NAM11FT085.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::e3) by MW4PR03CA0239.outlook.office365.com (2603:10b6:303:b9::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Fri, 3 Feb 2023 13:02:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT085.mail.protection.outlook.com (10.13.174.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Fri, 3 Feb 2023 13:02:03 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:01:51 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:01:50 -0800 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Fri, 3 Feb 2023 05:01:46 -0800 From: Krishna Yarlagadda To: , , , , , , , , , CC: , , , , Krishna Yarlagadda Subject: [Patch V2 1/4] dt-bindings: tpm: Add compatible for Tegra TPM Date: Fri, 3 Feb 2023 18:31:30 +0530 Message-ID: <20230203130133.32901-2-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230203130133.32901-1-kyarlagadda@nvidia.com> References: <20230203130133.32901-1-kyarlagadda@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT085:EE_|CH0PR12MB5187:EE_ X-MS-Office365-Filtering-Correlation-Id: 73317ae1-0ecc-45b9-046f-08db05e6d898 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +4f6Dql+1bRN1kVfI9HgKXy1et4Zc+xm6S7MJHA/XbVVJaB/3R3uHW4AN2nByBX4EB44JfdNwDZuR2VqcsZ58U/wKLbTYUqAtxqPgE6RtxOcF80e5Sl4rhl5HDfU1L9cVTfTws2USMYtBwSUIVqTEaw0aPIt8W8EBg+dQkm2LtqyLVCg5aCGNsqoF/0qUL1X8M4zBHgEY88eAD5Pty9m+2YzSzmNG1oxRBoXUK13/NgXLhnb4YF8J4wo/xYhLEuT2IAcOH0fG6OZoA55+1t2O7iBzgY+Tnrk+NntHEDy2S2/bK9oWW6Nkts9obD3oFR78nCK8zia455Ui9YJSNAbcHUlVOMBqNqyb/2/7lZZNiczl3KkOHuz1MqmA6utHJFwvuqcScB0NN9BAtNYzPj3wYKCF7I/HoLAwR16VAP2Pw2uCNbofnCDVsZK1V4JgePzXb7QWaqO8yYX+fWsctwMbJoIp9gxyG9uLEKkLiEx6eJsS4StvOxCJneKDndzTXndrSO8EbZ+dXOiJgcDdWUcQul2tsCAeW8GObrkiIwNpC9msWqeRJbC+TbUXHWIRPIa7iz7LqXnw59MdB0udS/99qtC1s+y25Lvz1jcGqIAI/dHxTas+13fkzhId1tbbBlECRahJTYPCiwWYmXrBhXZQ+KVcwDjA+UIrWV19gwL2jmfms2aAX/PfcTS5EEH1ASDZbVm8x0dVwBVXkSkBm4wa3LzPslSoLUOb8GB6AKwSJLtWfsUETdj3lR6RPxkTYWsYZ3e3kFcsWYYtuSQ6RtbDDZpWblkd31dNabXoZGx9QrFRX8/VH8T9ylPcrNy8MfYAIrHgsX4NkADr/7vOaVxjng7evTQkH/HmuH4qLCLKH0qSKmYxnV8NfRDJ+BAqx7MiR0QvROCUxhnl6vxgC79ig== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(136003)(376002)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(47076005)(966005)(82310400005)(86362001)(6666004)(107886003)(7696005)(478600001)(26005)(2616005)(186003)(336012)(40460700003)(1076003)(36860700001)(70206006)(70586007)(41300700001)(4326008)(7416002)(82740400003)(426003)(8936002)(83380400001)(40480700001)(36756003)(316002)(7636003)(8676002)(2906002)(110136005)(356005)(921005)(5660300002)(54906003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 13:02:03.5952 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73317ae1-0ecc-45b9-046f-08db05e6d898 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT085.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5187 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Tegra234 and Tegra241 devices have QSPI controller that supports TPM devices. Since the controller only supports half duplex, sw wait polling method implemented in tpm_tis_spi does not suffice. Wait polling as per protocol is a hardware feature. Add compatible for Tegra TPM driver with hardware flow control. Signed-off-by: Krishna Yarlagadda --- .../security/tpm/nvidia,tegra-tpm-spi.yaml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Documentation/devicetree/bindings/security/tpm/nvidia,tegra-tpm-spi.yaml diff --git a/Documentation/devicetree/bindings/security/tpm/nvidia,tegra-tpm-spi.yaml b/Documentation/devicetree/bindings/security/tpm/nvidia,tegra-tpm-spi.yaml new file mode 100644 index 000000000000..dcb78db7355c --- /dev/null +++ b/Documentation/devicetree/bindings/security/tpm/nvidia,tegra-tpm-spi.yaml @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/security/tpm/nvidia,tegra-tpm-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Tegra QSPI TPM driver + +maintainers: + - Thierry Reding + - Jonathan Hunter + +properties: + compatible: + enum: + - nvidia,tegra-tpm-spi + + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + qspi1@3250000 { + tpm@0 { + compatible = "nvidia,tegra-tpm-spi"; + reg = <0>; + }; + }; From patchwork Fri Feb 3 13:01:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 13127496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 943EDC636D4 for ; Fri, 3 Feb 2023 13:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232338AbjBCNCS (ORCPT ); Fri, 3 Feb 2023 08:02:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbjBCNCQ (ORCPT ); Fri, 3 Feb 2023 08:02:16 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2082.outbound.protection.outlook.com [40.107.244.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF039D595; Fri, 3 Feb 2023 05:02:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZCq1yVB5O8MQYLvmpVsf4okocyDw/sjsXZd3+33hRA17mCGmX7xg5iZags7I3oRsaJ9ZSi39+M9TH414prepKIlaYJx86ncOvL4ykO82DCZFmcssgPNw++aF9huW32c2QFgzWJw3iTWlZBNVWJ33SQDO8cqIHCWZG7DflAnX3Pwu5cofuwEKPZgw0huC1Lpt0yjLoXJ7okKbX8dX1RrcNJ1J7TKTcNmctO+XTknZtd4VsXr1SYHal+oFCTVSXbSFG7KlajXhgoxD/J0STnE1N4ExGJynwcVYGbX8h09825Vnmq0tvnm1KvcX5dtzpYc1V3JsDu1jelgSJvQpiYClgA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/HCwdw+VY8n1JR+QE1oTKBbBxFSCXXoMSgE1nTrnikc=; b=mOeJpnj7eY98SjKDEy6eEkNM6FOzahqqu4hfq5C4CmfGzBJk6uRFja0msGmLNzYZnEO5JS/1eqD0Nx6aZdvgsADgzJKJe8cn5eo0sMTcW0lr8ZbSe3xdMXDD0Uz4jBUqd4990pX8uqttxrM/ri7fxd2JCEkIvtr2LaahmLdSRvSDffryDLU23iTAIzeOUNb2CkEIFo/EQ25/GchsSGwsIvf5C4DcF9PxXKZqJDuhVR43YSG0kl0zZkdxcAp67W5ilivwnJDa38faBvVd0RG2ZEWFq62dAjPxhMRcdakxe28WG/J/WT8g6u/HbIWilBZCJPvfQeLfxOyRV/Mdl65klw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/HCwdw+VY8n1JR+QE1oTKBbBxFSCXXoMSgE1nTrnikc=; b=KrrSsfzPgK2Y46eXxREDER+pEbUyjGj4sKVRM18zrRBAK0y6aAXsZbgcoLVbgJNkSGiyERwlsJ+RiY3Oj3/rVqxecpNk1U8c2fYlCKP3GAyIBR6QRwq7QhZSLpDjzSx1MS0CyBAyJmQhepAyPdYNQZAnvEjuirUV2IGWilEqr6rvKS2MwCB/oxtlzLLN509mFeUyyPu6Bx7VaJEDiVxSJQH1zcmwzK0rSft8uM18mMI7byuh2FNIu5+ut6jhT19gUW+iMweiTdEvE/iJzFUl8ChKg18S00Fx7xOrwxMZo1YWykbsZb09QM2fr49ykvHy8dq7b+OdEpU0SW4bJMuOkQ== Received: from MW4PR04CA0199.namprd04.prod.outlook.com (2603:10b6:303:86::24) by CH2PR12MB4874.namprd12.prod.outlook.com (2603:10b6:610:64::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Fri, 3 Feb 2023 13:02:12 +0000 Received: from CO1NAM11FT097.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::7c) by MW4PR04CA0199.outlook.office365.com (2603:10b6:303:86::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.29 via Frontend Transport; Fri, 3 Feb 2023 13:02:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT097.mail.protection.outlook.com (10.13.175.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Fri, 3 Feb 2023 13:02:11 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:01:56 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:01:56 -0800 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Fri, 3 Feb 2023 05:01:51 -0800 From: Krishna Yarlagadda To: , , , , , , , , , CC: , , , , Krishna Yarlagadda Subject: [Patch V2 2/4] tpm: tegra: Support SPI tpm wait state detect Date: Fri, 3 Feb 2023 18:31:31 +0530 Message-ID: <20230203130133.32901-3-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230203130133.32901-1-kyarlagadda@nvidia.com> References: <20230203130133.32901-1-kyarlagadda@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT097:EE_|CH2PR12MB4874:EE_ X-MS-Office365-Filtering-Correlation-Id: 32c57e6e-8e33-47aa-edf6-08db05e6dd7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ywU40jzMwri6G8rZYNvqGFNe6wjNYdLKlRz57y+nfoVieUiEO5AV2DVDzOE/s3cj3NRfzSyXjDsYbufvr9yd7KHX/oq88U63N8rSa91IcRgabQdfugD+B71i0qaq630Vp5WO9FTltdF8ZrgEBRXJdluSkULZ7me5EEvIYGEU9Ch5iQtt5eG+fH+2Fu+HxJFgHVtMTPQcdyajJnbMAVyWmWYlf6c/B3eP3Kzzoa0hXNQC1Pf4skyvMrLhtdWMC34L5hMLspCxrct6qYR+RWD+kXuA9NbJmE5Iyu1gxeMIGB64JDdHpbRYX5xrpmjVjNE/lVA4Cuq077DGGZ9CpYSfJUuL/NpBnHiVOyVc7rpASZ7qef0f3IFeosZq5xxFwhQ0VdlfmjS2BfsXR24UVhj9Xw7YWu0SO7jSilRlCkOD9X5ufEB3L9AZnjypoHpwkjM095PhWpY1ehffNHhxzLLIrlhXOJH3BmbgtK1fL2x5QVQJFJoi5Hm5SvNWlv35NvUmaZLXghp2Zc2smSX8qbAxa5Gsjr/rTWvTHg8VfN1vogLRperk3emQC1fLUhhRuXqv9IjOGy6i8ru5/T2vB9EPUt0I1wIUVxU1Xxa3tY+7KatLdikfYzrHNVq9/1RjrjCGCYDvH0YvivHxE1GSQ6wcUVVtddPAJAOW44po9I6sQKsYoIM4pnE+QfvQ1kGdaiIwljCrV/MSV/mhghQxXy+xeFNedJhdC0WlDWzAG2kcM7fCRRJ1qD23rqr5epNu4ArMX2JnQNZpzGYv2qmOhavvwg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(396003)(346002)(39860400002)(136003)(376002)(451199018)(36840700001)(40470700004)(46966006)(36756003)(47076005)(70586007)(70206006)(316002)(82310400005)(36860700001)(8676002)(4326008)(83380400001)(54906003)(7636003)(110136005)(82740400003)(1076003)(5660300002)(186003)(107886003)(478600001)(26005)(336012)(40460700003)(6666004)(7416002)(921005)(86362001)(41300700001)(426003)(356005)(40480700001)(2616005)(7696005)(8936002)(2906002)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 13:02:11.8129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32c57e6e-8e33-47aa-edf6-08db05e6dd7d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT097.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4874 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Tegra234 and Tegra241 chips have QSPI controller that supports TCG TIS hardware flow control. Since the controller only supports half duplex, sw wait polling method implemented in tpm_tis_spi does not suffice. Added extending driver to disable sw flow control and send all transfers in single message. Signed-off-by: Krishna Yarlagadda --- drivers/char/tpm/Makefile | 1 + drivers/char/tpm/tpm_tis_spi.h | 1 + drivers/char/tpm/tpm_tis_spi_main.c | 4 +- drivers/char/tpm/tpm_tis_spi_tegra.c | 123 +++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 drivers/char/tpm/tpm_tis_spi_tegra.c diff --git a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile index 0222b1ddb310..445b15493cb3 100644 --- a/drivers/char/tpm/Makefile +++ b/drivers/char/tpm/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_TCG_TIS_SYNQUACER) += tpm_tis_synquacer.o obj-$(CONFIG_TCG_TIS_SPI) += tpm_tis_spi.o tpm_tis_spi-y := tpm_tis_spi_main.o +tpm_tis_spi-y += tpm_tis_spi_tegra.o tpm_tis_spi-$(CONFIG_TCG_TIS_SPI_CR50) += tpm_tis_spi_cr50.o obj-$(CONFIG_TCG_TIS_I2C_CR50) += tpm_tis_i2c_cr50.o diff --git a/drivers/char/tpm/tpm_tis_spi.h b/drivers/char/tpm/tpm_tis_spi.h index d0f66f6f1931..feaea14b428b 100644 --- a/drivers/char/tpm/tpm_tis_spi.h +++ b/drivers/char/tpm/tpm_tis_spi.h @@ -31,6 +31,7 @@ extern int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy, extern int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len, u8 *in, const u8 *out); +extern int tegra_tpm_spi_probe(struct spi_device *spi); #ifdef CONFIG_TCG_TIS_SPI_CR50 extern int cr50_spi_probe(struct spi_device *spi); #else diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c index a0963a3e92bd..5d4502a4461a 100644 --- a/drivers/char/tpm/tpm_tis_spi_main.c +++ b/drivers/char/tpm/tpm_tis_spi_main.c @@ -198,7 +198,7 @@ static int tpm_tis_spi_driver_probe(struct spi_device *spi) const struct spi_device_id *spi_dev_id = spi_get_device_id(spi); tpm_tis_spi_probe_func probe_func; - probe_func = of_device_get_match_data(&spi->dev); + probe_func = device_get_match_data(&spi->dev); if (!probe_func) { if (spi_dev_id) { probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data; @@ -227,6 +227,7 @@ static const struct spi_device_id tpm_tis_spi_id[] = { { "tpm_tis_spi", (unsigned long)tpm_tis_spi_probe }, { "tpm_tis-spi", (unsigned long)tpm_tis_spi_probe }, { "cr50", (unsigned long)cr50_spi_probe }, + { "tegra-tpm-spi", (unsigned long)tegra_tpm_spi_probe }, {} }; MODULE_DEVICE_TABLE(spi, tpm_tis_spi_id); @@ -236,6 +237,7 @@ static const struct of_device_id of_tis_spi_match[] = { { .compatible = "infineon,slb9670", .data = tpm_tis_spi_probe }, { .compatible = "tcg,tpm_tis-spi", .data = tpm_tis_spi_probe }, { .compatible = "google,cr50", .data = cr50_spi_probe }, + { .compatible = "nvidia,tegra-tpm-spi", .data = tegra_tpm_spi_probe }, {} }; MODULE_DEVICE_TABLE(of, of_tis_spi_match); diff --git a/drivers/char/tpm/tpm_tis_spi_tegra.c b/drivers/char/tpm/tpm_tis_spi_tegra.c new file mode 100644 index 000000000000..23f20684513d --- /dev/null +++ b/drivers/char/tpm/tpm_tis_spi_tegra.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2023 NVIDIA CORPORATION. + * + * This device driver implements TEGRA QSPI hw wait detection for chips + * + * It is based on tpm_tis_spi driver by Peter Huewe and Christophe Ricard. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "tpm_tis_core.h" +#include "tpm_tis_spi.h" + +#define MAX_SPI_FRAMESIZE 64 + +int tpm_tis_spi_tegra_transfer(struct tpm_tis_data *data, u32 addr, u16 len, + u8 *in, const u8 *out) +{ + struct tpm_tis_spi_phy *phy = to_tpm_tis_spi_phy(data); + int ret = 0; + struct spi_message m; + struct spi_transfer spi_xfer[3]; + u8 transfer_len; + + spi_bus_lock(phy->spi_device->master); + + while (len) { + transfer_len = min_t(u16, len, MAX_SPI_FRAMESIZE); + + spi_message_init(&m); + phy->iobuf[0] = (in ? 0x80 : 0) | (transfer_len - 1); + phy->iobuf[1] = 0xd4; + phy->iobuf[2] = addr >> 8; + phy->iobuf[3] = addr; + + memset(&spi_xfer, 0, sizeof(spi_xfer)); + + spi_xfer[0].tx_buf = phy->iobuf; + spi_xfer[0].len = 1; + spi_message_add_tail(&spi_xfer[0], &m); + + spi_xfer[1].tx_buf = phy->iobuf + 1; + spi_xfer[1].len = 3; + spi_message_add_tail(&spi_xfer[1], &m); + + if (out) { + spi_xfer[2].tx_buf = &phy->iobuf[4]; + spi_xfer[2].rx_buf = NULL; + memcpy(&phy->iobuf[4], out, transfer_len); + out += transfer_len; + } + if (in) { + spi_xfer[2].tx_buf = NULL; + spi_xfer[2].rx_buf = &phy->iobuf[4]; + } + spi_xfer[2].len = transfer_len; + spi_message_add_tail(&spi_xfer[2], &m); + + reinit_completion(&phy->ready); + ret = spi_sync_locked(phy->spi_device, &m); + if (ret < 0) + goto exit; + + if (in) { + memcpy(in, &phy->iobuf[4], transfer_len); + in += transfer_len; + } + + len -= transfer_len; + } + +exit: + spi_bus_unlock(phy->spi_device->master); + return ret; +} + +static int tpm_tis_spi_tegra_read_bytes(struct tpm_tis_data *data, u32 addr, + u16 len, u8 *result, + enum tpm_tis_io_mode io_mode) +{ + return tpm_tis_spi_tegra_transfer(data, addr, len, result, NULL); +} + +static int tpm_tis_spi_tegra_write_bytes(struct tpm_tis_data *data, u32 addr, + u16 len, const u8 *value, + enum tpm_tis_io_mode io_mode) +{ + return tpm_tis_spi_tegra_transfer(data, addr, len, NULL, value); +} + +static const struct tpm_tis_phy_ops tegra_tpm_spi_phy_ops = { + .read_bytes = tpm_tis_spi_tegra_read_bytes, + .write_bytes = tpm_tis_spi_tegra_write_bytes, +}; + +int tegra_tpm_spi_probe(struct spi_device *dev) +{ + struct tpm_tis_spi_phy *phy; + int irq; + + phy = devm_kzalloc(&dev->dev, sizeof(struct tpm_tis_spi_phy), + GFP_KERNEL); + if (!phy) + return -ENOMEM; + + phy->flow_control = NULL; + + /* If the SPI device has an IRQ then use that */ + if (dev->irq > 0) + irq = dev->irq; + else + irq = -1; + + init_completion(&phy->ready); + return tpm_tis_spi_init(dev, phy, irq, &tegra_tpm_spi_phy_ops); +} From patchwork Fri Feb 3 13:01:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 13127497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE6DCC636D4 for ; Fri, 3 Feb 2023 13:02:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbjBCNC1 (ORCPT ); Fri, 3 Feb 2023 08:02:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232529AbjBCNCZ (ORCPT ); Fri, 3 Feb 2023 08:02:25 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2044.outbound.protection.outlook.com [40.107.101.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C56F79D593; Fri, 3 Feb 2023 05:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gk6aCK0UyQb2BOQtp7AZDO8MuG3dk3zv5YMEhF9WfvKiR9xZb0TKMX0U79xjQkQ5CIyh4q6gjAFJlfkdghq3dwMr04a3n6qgQMF9IBm3A3nx0lpwzPwwo35QNJXG1wME1GVrgD8BAp3HU9YJvaHIywrEYvczfChLhPH3te8NbNjZGyIsThwi4Ecd72OKHdEYRzVS5HwQCj0SrZTiyxkvLvGLNBSg7/u7AOyWa6V32gIg3JpUgu4iS1cIgKulEWsqdT5694uOu+EHndwNarc2ULVRcBLYlHNdQOWh1So2efyDcGTRAUFTfnzydecC68Bd4oCdmIwdMMGfWPUcltnbUg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aExJLvyqOQDaSH2CBQmqboHZSVYzBuC+9cM/kjEBTHs=; b=Z8sbGIiNe/FWzWD0lWCLde1wrtZPaGCXmuAPRtPrCasSvoc45pLZY3I8SAS91o+1q61EgTe4mUc65MLslpMXNwFMwWZ/EYiukOcWfuId+MZQTIVX9kFA9MWNMjxNcCOkjhTiTP1gtTDUDeGCiC/mYohpax+C4CiB3NmI52Xy0B4OoEhbWV1SWUiskdXpqf3Lnz7PhYDr6sq8Q91c32c3Hk4aBIYNhNJwKqcPE7YX9PDjIKwmQi+ch/i2dAslJrEmaUr7lHAb1tWNbY8l1QptEuT6O/H4S6YnXVSdOtSMe1NdMd+ZVDxKzYopMb3V34EFDNYdiCA/BImWuKb+GEPdhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aExJLvyqOQDaSH2CBQmqboHZSVYzBuC+9cM/kjEBTHs=; b=Qp36Qk6crLD/jKgrl8YKCVrAKYN53rFJO3dF9F/yQEOVJRVJxor2Yh57OzLRpbhQozciJYOgsaWlRTUHzJK4ETe4xsZTtwWGAqQ9A7kFcIqrbT8fVspekkMQeMrT/xpIU16s/sCOJHk+jyPROg2BiUzM1hq8/6iAKx+N9uKfRSAs5a2kBrgObO0TmySdUStCLwIV6trkfllQgKhyGDGZF8qjlwEeIcLTgn0jG6UUcpkdAkYC218ENP5okjqqEJB7GAiDAPjE+5tytwuq26H83oZzdtOt/Mk+XreKVvomE8L+TiDgNReaw6y+ZjY8HU0mD0klTriELAuWVXpf8DCBVA== Received: from MW2PR2101CA0031.namprd21.prod.outlook.com (2603:10b6:302:1::44) by DM4PR12MB5842.namprd12.prod.outlook.com (2603:10b6:8:65::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31; Fri, 3 Feb 2023 13:02:16 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::8c) by MW2PR2101CA0031.outlook.office365.com (2603:10b6:302:1::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.5 via Frontend Transport; Fri, 3 Feb 2023 13:02:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.28 via Frontend Transport; Fri, 3 Feb 2023 13:02:15 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:02:02 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:02:01 -0800 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Fri, 3 Feb 2023 05:01:56 -0800 From: Krishna Yarlagadda To: , , , , , , , , , CC: , , , , Krishna Yarlagadda Subject: [Patch V2 3/4] spi: dt-bindings: Add Tegra TPM wait polling flag Date: Fri, 3 Feb 2023 18:31:32 +0530 Message-ID: <20230203130133.32901-4-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230203130133.32901-1-kyarlagadda@nvidia.com> References: <20230203130133.32901-1-kyarlagadda@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT112:EE_|DM4PR12MB5842:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e81568b-a193-42e1-4b0d-08db05e6dffc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qOulHvGLqMzsSjlx1CJJXZaF2px49lnZKLY+Y1Wgn5qrU41/DYuF5cKqBMOnnYfRRx9asmucAHO6oO7m5nQg0BOKBlU5wo9qXy24UaeOBlMHd6Bs1qC6c3XrhEkga9FBlF13iobvFgy3nt02eevGaArDpb8yQg1zMLeon169+5ELyhNcVKRggXSl8RYVXrQU6rgC5FZUY//I/p1sWFbbPhmGrDgIubLkSWiNNBiONNbBGRC/vQKYPTWYH4TPSKdmiEOAsSuxNK6rLXD09h0QBYOnzD3XPrDmuvgbG3gYmHM1KizOv4UMscfjLzCPwRXahBiVmmPkx0sea2XkCEIxxKFxgz62ZKlQOCyZ3M5fmaodt6Rhp6+CFZ/nXx9492ExzpIM5c/V9VQZ75GMJXySQLnTDOePArRVL+75iSDUmy/Nz+v/117LSl72uwZ8WbajWnSiOl6qqjMzxDJL0xR6QTgNO16yqRieuIjOcPiEBZgbdfGqlfmc/nhvm/RDR3KMSTLF+sbE4BJ9+LQOqivQuta5ht1U/92X5TqY2VEj7xpWAa2Px6yh3M+TMDlIMnTg4ZuL/K13YdIjXmlzzGMiCMva+lDNK0jdaErpsls57vhgt+ZKN3FCKSOvqFS4EcgHAk6K1TqwmxGIEoBSHzcgGxRcbWHbX9WUrT2tmynEv9kECLtFVp9sG26OlKIccWm5ODUi4fVNkOceFmznmkdLmFyktbF9j8+RNIC3NAA+2mjL9NlkW630Ak002GvSjJU6EGDh9nDeZ+56i7+TgVU9vA== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(136003)(39860400002)(376002)(396003)(346002)(451199018)(46966006)(40470700004)(36840700001)(356005)(921005)(86362001)(36756003)(7636003)(36860700001)(82740400003)(316002)(41300700001)(8936002)(5660300002)(110136005)(4326008)(70586007)(70206006)(54906003)(8676002)(82310400005)(40480700001)(40460700003)(2906002)(7416002)(426003)(336012)(4744005)(47076005)(478600001)(2616005)(186003)(7696005)(26005)(6666004)(107886003)(1076003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 13:02:15.9965 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e81568b-a193-42e1-4b0d-08db05e6dffc X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5842 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Add "nvidia,wait-polling" flag to enable TCG TIS hardware flow control. Signed-off-by: Krishna Yarlagadda --- .../bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml index 2c3cada75339..19d2b30cadbf 100644 --- a/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml +++ b/Documentation/devicetree/bindings/spi/nvidia,tegra210-quad-peripheral-props.yaml @@ -29,4 +29,10 @@ properties: minimum: 0 maximum: 255 + nvidia,wait-polling: + description: + Enable TPM wait polling feature for QSPI as specified in TCG PC Client + Specific TPM Interface Specification (TIS). + $ref: /schemas/types.yaml#/definitions/flag + additionalProperties: true From patchwork Fri Feb 3 13:01:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 13127498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 788EDC61DA4 for ; Fri, 3 Feb 2023 13:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbjBCNCf (ORCPT ); Fri, 3 Feb 2023 08:02:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbjBCNCd (ORCPT ); Fri, 3 Feb 2023 08:02:33 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2068.outbound.protection.outlook.com [40.107.212.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4A2C9D582; Fri, 3 Feb 2023 05:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxwyaIbx1vDm1+db9XJTtssNsD6l1jQYoU4JwmQgXSgUI9uZCHFoXTy9NkVBjp1kJfN/nRYisA09PXfDJ2vOUzp1kEFE4pQNzpEnXcM4RaAQd/fQVF5FfbuIuAlzXia/UqMLgSxSyyrKl4j9Bx97ASmG0gY0MXq2Gds7EdVWj5fGts7k5jmLi5e0ZPtr7XzYOQaAsIrSbxBCwVJabtBTmONGRZcAS4hGdH/Gf+WzX+1Th7NS4/EhhBmiiWI0M94EqXLWEQ9gPycnVupF8UzFw7hXavLYRva1ZxN3dc5BP2rmowBAuwHv7QB45c5NPCEUsfQh3K8h/KcSYG5hvc/Qgw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nqWFNUwPKtgLMprxqTkaVOXPw+aYN4kOMzuRnY3qTUs=; b=jY7JunFJrPGi0OeI0ooyX4kCJhsmswf9HY9dMerJWKK4FD+UR51peUGqcZVMRrqAYyOVH336W+IKQhql2yRczEBTno5JP1P06xtLGajUivoR5CQ5pLoKQGJiSB+58TZciZjmkRoJcyiBxRFFUCrA/LY4YJ6kGqQPnC6NUmoQlbgGDhfHc4+OOpttJZ39ax3rpa6QLeLCwuWHNGkHn+19BLeZ9WI/Dba+xeA2sNLtR0kdRs2tQ4WuNlyaJulPZWVuv03DMSrWke3/0dOMkv91uyDstWn7GS0XZWvjCYpfWQlBnMYiD+/LdwixLCG5ZjsOziVqFeAJgEf6kVLfVQ/xNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nqWFNUwPKtgLMprxqTkaVOXPw+aYN4kOMzuRnY3qTUs=; b=BIctkJi7p+x60j1k4l5YjQBkoHbT/WM33bqE+K8lOe+85A3WBpFZzdflRksU3IS76PbEjKA15j6gle3LlMmawNyP5kRmZRZE2QBDwF82RuqUyBKmffyMfjerbI9tSk+kbxwuctIpmaVsIzti4DPW/t3ygSN9zNPx620dlVMXU2OmVY9UxGvb2XpRwvYrLLg5gRJbQI2YZSygLvd1RS1O6AzyD32kI1BChM1TaVd1JBSpuZ2V61dFnSwX+EGJX42CfAM2oycRjrs8dhM2nNCctq3V5PuZJujQFqtL+S7FtbF+EtZiWDTKIPZfOVnVuTOhRzV3NrfeXQ5rNHXnPHcGNw== Received: from MW4PR03CA0207.namprd03.prod.outlook.com (2603:10b6:303:b8::32) by BN9PR12MB5145.namprd12.prod.outlook.com (2603:10b6:408:136::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.28; Fri, 3 Feb 2023 13:02:22 +0000 Received: from CO1NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b8:cafe::6a) by MW4PR03CA0207.outlook.office365.com (2603:10b6:303:b8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.29 via Frontend Transport; Fri, 3 Feb 2023 13:02:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1NAM11FT065.mail.protection.outlook.com (10.13.174.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31 via Frontend Transport; Fri, 3 Feb 2023 13:02:22 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:02:07 -0800 Received: from rnnvmail204.nvidia.com (10.129.68.6) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Fri, 3 Feb 2023 05:02:07 -0800 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.6) with Microsoft SMTP Server id 15.2.986.36 via Frontend Transport; Fri, 3 Feb 2023 05:02:02 -0800 From: Krishna Yarlagadda To: , , , , , , , , , CC: , , , , Krishna Yarlagadda Subject: [Patch V2 4/4] spi: tegra210-quad: Enable TPM wait polling Date: Fri, 3 Feb 2023 18:31:33 +0530 Message-ID: <20230203130133.32901-5-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230203130133.32901-1-kyarlagadda@nvidia.com> References: <20230203130133.32901-1-kyarlagadda@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT065:EE_|BN9PR12MB5145:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a6423fb-b792-44d7-7b8d-08db05e6e3b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kpmU7srE9+EB1kNjCn9MeMB0eKsQoM5GRJ+mGWr0gBGMTDSGdcvVYqboUVtUib12Slv8VYwJVymX7VWCmJ0+3AUL2+DxzBK5YvSe2+TPlsFJIsojzaQShcdLTJfnJf9rmxb8dR65DxiwzRQdffmHCmJqh8DjcawS5Ph8UNyNI3nl/8SnoBKJlZWx6EB+gfiSDD1EORf+dnqxF0mEd0D26WN8BAxuXVk8e0go1Xw0t422Y+zhRB3V319SHwWJ3sg3vjk/kWWgyP2RpWKCAIZWnd5z1yLlnLLg+/E3LEidiJL2lpwegIsPCAOaYU3n3mdJQl7C1CUEcm+qHvyq4DnI7YnRk697GLt1AwLIEN5C7gMBINxFgSA8AB1UwY2f9Pu3SAijLB/ka6+wBnGqf30QHaijM055L8grQ/f3JSD/L3eeNtLCdnR0ubdjbFqgFWC/doxjwcnBWJhZ6LVHhr7nElg6tMf3H6N6MAESdZ4rlR0sd43orMjtmw33iJ/hNgdeoySyypTW4JVn5y705PGB7XCl72MO1c7bucCqy3K6CEs3iYj0C07IrUF6mlHBJar3ZfZAFH8jq0dDHgXxSgWsTXMmM+hYt7qNnQfR723dlheg8zDbWVq3YNISwP9eENvdGDw3eWLoGfccsU3bTCIPVlGaM3gEaeA+/C6jHyAcrJhljV3b+2bcLuws6ayrTn80+Ee+S9AbweAa+KDUYY5A9fdLaqD1eM6/TL3hKp3dVEV1FaE3cSXFC/I57jLUX/MWq1AN7GgbacW6TOo0mXy07Q== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(39860400002)(136003)(346002)(396003)(376002)(451199018)(36840700001)(46966006)(40470700004)(7696005)(47076005)(36756003)(40460700003)(40480700001)(86362001)(7636003)(36860700001)(82310400005)(356005)(2616005)(26005)(186003)(336012)(426003)(83380400001)(921005)(478600001)(7416002)(1076003)(110136005)(6666004)(8676002)(54906003)(316002)(107886003)(41300700001)(4326008)(70586007)(8936002)(70206006)(5660300002)(82740400003)(2906002)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 13:02:22.2458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a6423fb-b792-44d7-7b8d-08db05e6e3b3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5145 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Trusted Platform Module defines flow control where slave will drive data line at specified clock cycles. Tegra241 has TPM wait state detections support when using combined sequence transfers. Enabling the feature based on device tree flag. Signed-off-by: Krishna Yarlagadda --- drivers/spi/spi-tegra210-quad.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index 9f356612ba7e..ea8a08a3d838 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -142,6 +142,7 @@ #define QSPI_GLOBAL_CONFIG 0X1a4 #define QSPI_CMB_SEQ_EN BIT(0) +#define QSPI_TPM_WAIT_POLL_EN BIT(1) #define QSPI_CMB_SEQ_ADDR 0x1a8 #define QSPI_ADDRESS_VALUE_SET(X) (((x) & 0xFFFF) << 0) @@ -170,6 +171,7 @@ struct tegra_qspi_soc_data { struct tegra_qspi_client_data { int tx_clk_tap_delay; int rx_clk_tap_delay; + bool wait_polling; }; struct tegra_qspi { @@ -934,6 +936,8 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic &cdata->tx_clk_tap_delay); device_property_read_u32(&spi->dev, "nvidia,rx-clk-tap-delay", &cdata->rx_clk_tap_delay); + cdata->wait_polling = + device_property_read_bool(&spi->dev, "nvidia,wait-polling"); return cdata; } @@ -991,6 +995,14 @@ static void tegra_qspi_dump_regs(struct tegra_qspi *tqspi) dev_dbg(tqspi->dev, "TRANS_STAT: 0x%08x | FIFO_STATUS: 0x%08x\n", tegra_qspi_readl(tqspi, QSPI_TRANS_STATUS), tegra_qspi_readl(tqspi, QSPI_FIFO_STATUS)); + dev_dbg(tqspi->dev, "GLOBAL_CFG: 0x%08x\n", + tegra_qspi_readl(tqspi, QSPI_GLOBAL_CONFIG)); + dev_dbg(tqspi->dev, "CMB_CMD: 0x%08x | CMB_CMD_CFG: 0x%08x\n", + tegra_qspi_readl(tqspi, QSPI_CMB_SEQ_CMD), + tegra_qspi_readl(tqspi, QSPI_CMB_SEQ_CMD_CFG)); + dev_dbg(tqspi->dev, "CMB_ADDR: 0x%08x | CMB_ADDR_CFG: 0x%08x\n", + tegra_qspi_readl(tqspi, QSPI_CMB_SEQ_ADDR), + tegra_qspi_readl(tqspi, QSPI_CMB_SEQ_ADDR_CFG)); } static void tegra_qspi_handle_error(struct tegra_qspi *tqspi) @@ -1056,6 +1068,7 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, bool is_first_msg = true; struct spi_transfer *xfer; struct spi_device *spi = msg->spi; + struct tegra_qspi_client_data *cdata = spi->controller_data; u8 transfer_phase = 0; u32 cmd1 = 0, dma_ctl = 0; int ret = 0; @@ -1065,6 +1078,8 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi, /* Enable Combined sequence mode */ val = tegra_qspi_readl(tqspi, QSPI_GLOBAL_CONFIG); + if (cdata->wait_polling) + val |= QSPI_TPM_WAIT_POLL_EN; val |= QSPI_CMB_SEQ_EN; tegra_qspi_writel(tqspi, val, QSPI_GLOBAL_CONFIG); /* Process individual transfer list */ @@ -1192,6 +1207,7 @@ static int tegra_qspi_non_combined_seq_xfer(struct tegra_qspi *tqspi, /* Disable Combined sequence mode */ val = tegra_qspi_readl(tqspi, QSPI_GLOBAL_CONFIG); val &= ~QSPI_CMB_SEQ_EN; + val &= ~QSPI_TPM_WAIT_POLL_EN; tegra_qspi_writel(tqspi, val, QSPI_GLOBAL_CONFIG); list_for_each_entry(transfer, &msg->transfers, transfer_list) { struct spi_transfer *xfer = transfer;