From patchwork Tue Sep 27 11:13:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Shete X-Patchwork-Id: 610446 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 1E84AC54EE9 for ; Tue, 27 Sep 2022 11:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbiI0LNf (ORCPT ); Tue, 27 Sep 2022 07:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbiI0LNa (ORCPT ); Tue, 27 Sep 2022 07:13:30 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2064.outbound.protection.outlook.com [40.107.243.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A73F24951; Tue, 27 Sep 2022 04:13:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HmUP4sIGMFjZac8kJFGXRfTd6v1Vqa7qK/OL6aYoiAyGtO4QmbYWSJ6sYVlhVhBl8FqRDpZVCQ0DBAnbl8NLSO3BWxRlqn89znGtiboK/69DaI1PkijsCfPnRn2BfYe43n62LRVYQjXDu5IfZjiYLO1vvyaqNwC/Xdw96Tw1ZfyI+ty0mfp5z9O2XSUeEV39KputdddCie3ZEsQQwd1DDqWIzvvE/Wj4lhqD1/DOuP7LtIMSo4QNwXWdzMHoy8YNbLdNJ3S1XLqvNg3VNKQGqWo3JW1HXts8vlK77cvMJSURtRWTDi3XA1e85Ei67KcooQ4WCCsOlFf2hi7M57moJQ== 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=Yt2SFqLcav+hZ/lBpn/7PhfyM9sb1S7Ki7Fjfdb/ozI=; b=F8u6VKT1k8x4+UUH2lIb81qTpkXljRTZ1nB4H8jTJU44il1+DdQaZDqInzG5bYJit7vfCE3r6/dwrbUL3p63HwDY6DaMotCx0pI+XWg6YIZjF5CAdhIGshJxElCFA2Yi/WYY19VtCsNPdxlgbyN0hJ1ztab3xN0aNAguy+ISwjjenWY64pAN7u2SACiMEoF7OMTXyBlggta7hVnkQBTMyhWCG+GBaVuhp6+gDn4VzPiguyKOxI6T++rhDeRQ4dK6IQ3sEgnS+TUJhS1QtArttgZXnap2eENlnPUc1jq3CELfplGLEUNTJE2Os67OFRIpnc82ufpWI23qfnrd5Rj0MQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=Yt2SFqLcav+hZ/lBpn/7PhfyM9sb1S7Ki7Fjfdb/ozI=; b=PWyLpHEsQHJ061/PR/HXkciAJeOCVYNF3mypDgNdZ2RllzroEwh/0r8GJw37FWRbRqHpKJ+/X9sRyWFE62FBky2nrUErCE+4m7L8GM76RsJrUX2fryk6x3cV1OL+D6UaAFK70kB3MUDJjrAEzFSNTIL/a6vm8SXNKAFdNVw0R6Iy3Yh0i00JfGMUT0XKadh/rnPWRiaS+jlMWArT1xKnvTGTgLSZfbmDbppQeUIbk0aYGm0U6tojH63U/fNzbgrFBUxEXMJg+ocpbDBAkRu33nrZraaKcTqpTqtr9kt1Kf2s4fsGB+XX9JEyA6NNm5jvG1f+HgzgrV0XENcq8BYBEQ== Received: from MW4PR04CA0179.namprd04.prod.outlook.com (2603:10b6:303:85::34) by DM4PR12MB5391.namprd12.prod.outlook.com (2603:10b6:5:39a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Tue, 27 Sep 2022 11:13:27 +0000 Received: from CO1NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:303:85:cafe::de) by MW4PR04CA0179.outlook.office365.com (2603:10b6:303:85::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26 via Frontend Transport; Tue, 27 Sep 2022 11:13:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT006.mail.protection.outlook.com (10.13.174.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Tue, 27 Sep 2022 11:13:27 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 27 Sep 2022 04:13:19 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.29; Tue, 27 Sep 2022 04:13:19 -0700 Received: from pshete-ubuntu.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 27 Sep 2022 04:13:16 -0700 From: Prathamesh Shete To: , , , , , , , CC: , , , Subject: [PATCH v5 1/3] mmc: sdhci-tegra: Separate Tegra194 and Tegra234 SoC data Date: Tue, 27 Sep 2022 16:43:11 +0530 Message-ID: <20220927111314.32229-1-pshete@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT006:EE_|DM4PR12MB5391:EE_ X-MS-Office365-Filtering-Correlation-Id: 9bdbfdec-a796-4349-40c9-08daa0794d46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rHawTeGMLXtwCp1aEE3DafoiERzzjErpckGQXAVGEJqFRi42Qev/CUyPNTewEXJrS+T6aU2dMHpWQEF+MeKyQx97RjxOVyXa2xBhD0iyZExHRqDDsdJwify+BC1ShwS9pzTiPFiL3bk0impjF/+kEpwQuCQpaB/Pl367hEzZoG5Gj6rZ02ec0VR0iYI+sclEcR1udztpxGzjycudT2ygx2XNt22VrfPUFH0trkquS2BSxkjp2p73HZxsDFYwxi5PO8Z1VKPCQ6lG+RN0NzCeWNPA9IddoLCFFLxWyiT670ew5poOB20W/Rl08W/JUBrMqVJxdtE2zw9yv3BLm11kiXjOtheALhra7poJoJLn1AQsVVXQUFEkTiWB05Clj8kXrRQmZSP9LZvGW4/AKt4HiCeRNl9hWhWaW/zssI4wqU78BUx9CNgHHWzOtZtWEY6X0Y+ywxySwGXAYnvxDbryXfKLbuyN12681jQKjc+axSx2BJa0s6g1rf2JEACmubKuZbKbnl7k4Qm4qIX/xAymowpLNkKxN1AOOlUL94G/rAZdU+5vZ8TlRJoRvoYTM01dHoy+e1T6wpCxabHEF4cFo94fHTyyGiq0yO+qA6t9FAx3lcjjZKXu7eMcQ6532kW3OruelEa1nDq5wFx25HwiotnbAZwd1i37IKKDGONeXZe5ACkpTMiJUfDhR+99onlcvazmMSplgxSSk0FrgXZCjelRTkd1BRgn/g+fWpdHST9nrJZ85nuFmntbFOd78MAqzixWgSd+VeeFiTOSv4J9xA== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(346002)(136003)(396003)(376002)(451199015)(46966006)(36840700001)(40470700004)(36756003)(7696005)(316002)(336012)(82740400003)(54906003)(110136005)(1076003)(186003)(26005)(8936002)(2616005)(36860700001)(86362001)(2906002)(40480700001)(41300700001)(83380400001)(426003)(47076005)(8676002)(4326008)(70206006)(70586007)(82310400005)(478600001)(40460700003)(7636003)(5660300002)(356005)(107886003)(6666004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2022 11:13:27.3345 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9bdbfdec-a796-4349-40c9-08daa0794d46 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5391 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Create new SoC data structure for Tegra234 platforms. Additional features, tap value configurations are added/ updated for Tegra234 platform hence separate Tegra194 and Tegra234 SoC data. Signed-off-by: Aniruddha Tvs Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-tegra.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 2d2d8260c681..a6c5bbae77b4 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1556,7 +1556,21 @@ static const struct sdhci_tegra_soc_data soc_data_tegra194 = { .max_tap_delay = 139, }; +static const struct sdhci_tegra_soc_data soc_data_tegra234 = { + .pdata = &sdhci_tegra186_pdata, + .dma_mask = DMA_BIT_MASK(39), + .nvquirks = NVQUIRK_NEEDS_PAD_CONTROL | + NVQUIRK_HAS_PADCALIB | + NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | + NVQUIRK_ENABLE_SDR50 | + NVQUIRK_ENABLE_SDR104 | + NVQUIRK_HAS_TMCLK, + .min_tap_delay = 95, + .max_tap_delay = 111, +}; + static const struct of_device_id sdhci_tegra_dt_match[] = { + { .compatible = "nvidia,tegra234-sdhci", .data = &soc_data_tegra234 }, { .compatible = "nvidia,tegra194-sdhci", .data = &soc_data_tegra194 }, { .compatible = "nvidia,tegra186-sdhci", .data = &soc_data_tegra186 }, { .compatible = "nvidia,tegra210-sdhci", .data = &soc_data_tegra210 }, From patchwork Tue Sep 27 11:13:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Shete X-Patchwork-Id: 610445 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 E72BAC54EE9 for ; Tue, 27 Sep 2022 11:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbiI0LNw (ORCPT ); Tue, 27 Sep 2022 07:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231708AbiI0LNl (ORCPT ); Tue, 27 Sep 2022 07:13:41 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2053.outbound.protection.outlook.com [40.107.243.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC932A41E; Tue, 27 Sep 2022 04:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxDf3AMwp2tOK3vFW29NgBuS35uTp7hWznwmb9qBJHMEXsgUlJImp6esA/qzT8RV/UaUvJj2C6OaVTdaGkujSSsvtxTKoVH7AQAfiZUi3/4RQdu+3Fo90dIuTWa2ZoikPdDFONLYQ5fQdyTsMRngT3r5AZd/OGrvW3MB0A8ZoJiW1aEFt4dAm0Qc8ZHLpKd+LIVJAePUBOZKfhNbYgZV3GpC/b0UzBMNaRxP62vzuTS1oVwqNRlJbI7nGDid4YChBVyteBP1i1YO3VTIvTPmGKsEd74Oas5w+1xAlCA4NMlOuvN2p+HdFVJXSb+qyXvcJVd2fIt3fyivQNZH/nVnAw== 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=Ipct4Y5NPT73PyqKyxCHVgVKzJR75k/mMXi2vpHdDCU=; b=BYLXZhMdzUY/wYmdWNeALXNX7DXHbt2F0BYAH6OvGQjm2C2iuhS5+oU3AY4pPfSHWODSbm9kH/ViG3wJJ315rx2VHvFUD6v6pK20nc9aEjrbadM6qNhptK6BfsxLdL9gcoy0hbtohVZNm5MIlIQC9eS2qzzTqs4Rz9Dkarrwi36pw1+dXOuSc3iWXt6JlBHTIE4/7aJUhos1ohjE7t6W13xL3E2LqduITOvwYXBrq6AwXSK+q6q4Vg8PLzkB1/H4A6JWuejh3WMNZxgG5cT1lfMHnPVB9DAVaphLTUFWL2dSPvtvcHoiRnCxHQQm9lIgwTJOqgMINZPb8a4/herAug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=Ipct4Y5NPT73PyqKyxCHVgVKzJR75k/mMXi2vpHdDCU=; b=EgUvNN3M1WPLICTkPxqUOOGnZH8qoHEPTcb2/dV9ekQlOWzK0VUHH7lLoMMDFknXrMLRKiEQ7tgSrh9WORr996wgghJNC0ViLchBNP8YCpVXl9P/P6+txR8WRDNanwmxQZn9cGxlhmynUlSbQwQ26y0wDbX82zxVTSp4dmXunWajstIaiMhZN6AmBmIRpKOukbADEPSCX2mgGMvNCvOtb7k14CrB0IIcpjl6v5fsP+IdPv+hOYO2LKUX7KZhTMlWjzL3+DKTP6lLJOj0j00gvfv84MqtXgKgsZgyz+tO8kOhQPoBelMn/Yo/bKcNWnEHEQl23anEv3jK4hkYcUfk+w== Received: from MW4PR04CA0139.namprd04.prod.outlook.com (2603:10b6:303:84::24) by DM6PR12MB4516.namprd12.prod.outlook.com (2603:10b6:5:2ac::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Tue, 27 Sep 2022 11:13:37 +0000 Received: from CO1NAM11FT092.eop-nam11.prod.protection.outlook.com (2603:10b6:303:84:cafe::a1) by MW4PR04CA0139.outlook.office365.com (2603:10b6:303:84::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26 via Frontend Transport; Tue, 27 Sep 2022 11:13:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT092.mail.protection.outlook.com (10.13.175.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Tue, 27 Sep 2022 11:13:37 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 27 Sep 2022 04:13:24 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.29; Tue, 27 Sep 2022 04:13:23 -0700 Received: from pshete-ubuntu.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 27 Sep 2022 04:13:20 -0700 From: Prathamesh Shete To: , , , , , , , CC: , , , Subject: [PATCH v5 2/3] mmc: sdhci-tegra: Add support to program MC stream ID Date: Tue, 27 Sep 2022 16:43:12 +0530 Message-ID: <20220927111314.32229-2-pshete@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927111314.32229-1-pshete@nvidia.com> References: <20220927111314.32229-1-pshete@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT092:EE_|DM6PR12MB4516:EE_ X-MS-Office365-Filtering-Correlation-Id: 27a22bd9-2204-4f45-2f70-08daa0795355 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iKbrfOTt+hIup28B7jnPbNu27uYTTJDiabbI5ibHYMIzjn6H3fq0I0nwsBTmH4c3QvoRytksgjfohZDTvPVYkyL8ERIKMLQi8dHl+E5Q+jvlVU1rv2LeZZqOTrRVYBOKQL2+pTtt3owmbLt54OxTGHDKd+yADWdri5ERqt+I9JBQhn74x4wQTXflq1eeoB/UGcQ7mb0Ldnzg43yoWD0YWJkK7jFIXnB0bQCG7sRPuiIsnl0Y6wVQJlzRq0yO3JDCUhPgkVU5Xb5BER8ta3bBcey7o5Pm8WryNaeoanSE5qU0dFk9GLLE+TusFgu6GXL5LbumSErir+UgksqYAAn8MzFOrGYNwojiCu5p7qwVtfxoATNIJJFnh7kJaC/4wxNc7AGRqu6MYHVbJdgERmiRBTSAsI7YtsUn+1B6FL28J6rtCfORUriNJKFg3Ab6TPkCxa/R/n7Hyiv9gIJ3Yuy+gm5OADRzXspYggYyZEaugmOjyfIkpwztX7fNHaFDr4cfo6wMGQ8o0PpZYhqpLWEEYndfjF8x/rGcIc19zTVTasElHNExQVOZ9lKS+Hx8JRJ4N9Mk7GvlcTZhdxpIF6Y7/lx8gkxcE/qzgQvSdPlcE/6ahbn2AnAN5/+gOoviwGr8dObqzzpWiXshUwaLV7nF/i2jK7Y2+cwUMyXNyTiHwSR5/hFe8TdfTJHkBHAzlQq0ncMew8teA4mCbaHSIxy7TdSo2yyzj2DpyZezwU939MxwJ+IZImxfReomXZWzJ6Mf2lkrPvNKWdgqW/5gF+1YOg== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(396003)(39860400002)(376002)(346002)(136003)(451199015)(46966006)(36840700001)(40470700004)(26005)(5660300002)(36756003)(41300700001)(36860700001)(6666004)(2616005)(8936002)(2906002)(70586007)(4326008)(7696005)(70206006)(8676002)(107886003)(40480700001)(86362001)(82740400003)(47076005)(186003)(1076003)(336012)(7636003)(82310400005)(356005)(40460700003)(54906003)(110136005)(316002)(426003)(83380400001)(478600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2022 11:13:37.4831 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 27a22bd9-2204-4f45-2f70-08daa0795355 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT092.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4516 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SMMU clients are supposed to program stream ID from their respective address spaces instead of MC override. Define NVQUIRK_PROGRAM_STREAMID and use it to program SMMU stream ID from the SDMMC client address space. Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete --- drivers/mmc/host/sdhci-tegra.c | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index a6c5bbae77b4..46f37cc26dbb 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -25,6 +25,9 @@ #include #include #include +#ifdef CONFIG_IOMMU_API +#include +#endif #include @@ -94,6 +97,8 @@ #define SDHCI_TEGRA_AUTO_CAL_STATUS 0x1ec #define SDHCI_TEGRA_AUTO_CAL_ACTIVE BIT(31) +#define SDHCI_TEGRA_CIF2AXI_CTRL_0 0x1fc + #define NVQUIRK_FORCE_SDHCI_SPEC_200 BIT(0) #define NVQUIRK_ENABLE_BLOCK_GAP_DET BIT(1) #define NVQUIRK_ENABLE_SDHCI_SPEC_300 BIT(2) @@ -121,6 +126,7 @@ #define NVQUIRK_HAS_TMCLK BIT(10) #define NVQUIRK_HAS_ANDROID_GPT_SECTOR BIT(11) +#define NVQUIRK_PROGRAM_STREAMID BIT(12) /* SDMMC CQE Base Address for Tegra Host Ver 4.1 and Higher */ #define SDHCI_TEGRA_CQE_BASE_ADDR 0xF000 @@ -128,6 +134,8 @@ #define SDHCI_TEGRA_CQE_TRNS_MODE (SDHCI_TRNS_MULTI | \ SDHCI_TRNS_BLK_CNT_EN | \ SDHCI_TRNS_DMA) +#define SDHCI_TEGRA_STREAMID_MASK 0xff +#define SDHCI_TEGRA_WRITE_STREAMID_SHIFT 0x8 struct sdhci_tegra_soc_data { const struct sdhci_pltfm_data *pdata; @@ -177,6 +185,9 @@ struct sdhci_tegra { bool enable_hwcq; unsigned long curr_clk_rate; u8 tuned_tap_delay; +#ifdef CONFIG_IOMMU_API + u32 streamid; +#endif }; static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) @@ -1564,6 +1575,7 @@ static const struct sdhci_tegra_soc_data soc_data_tegra234 = { NVQUIRK_DIS_CARD_CLK_CONFIG_TAP | NVQUIRK_ENABLE_SDR50 | NVQUIRK_ENABLE_SDR104 | + NVQUIRK_PROGRAM_STREAMID | NVQUIRK_HAS_TMCLK, .min_tap_delay = 95, .max_tap_delay = 111, @@ -1636,6 +1648,9 @@ static int sdhci_tegra_probe(struct platform_device *pdev) struct sdhci_host *host; struct sdhci_pltfm_host *pltfm_host; struct sdhci_tegra *tegra_host; +#ifdef CONFIG_IOMMU_API + struct iommu_fwspec *fwspec; +#endif struct clk *clk; int rc; @@ -1775,6 +1790,25 @@ static int sdhci_tegra_probe(struct platform_device *pdev) if (rc) goto err_add_host; + /* Program MC streamID for DMA transfers */ +#ifdef CONFIG_IOMMU_API + if (soc_data->nvquirks & NVQUIRK_PROGRAM_STREAMID) { + fwspec = dev_iommu_fwspec_get(&pdev->dev); + if (fwspec == NULL) { + dev_warn(mmc_dev(host->mmc), + "iommu fwspec is NULL, continue without stream ID\n"); + } else { + tegra_host->streamid = fwspec->ids[0] & 0xffff; + tegra_sdhci_writel(host, (tegra_host->streamid & + SDHCI_TEGRA_STREAMID_MASK) | + ((tegra_host->streamid << + SDHCI_TEGRA_WRITE_STREAMID_SHIFT) + & SDHCI_TEGRA_STREAMID_MASK), + SDHCI_TEGRA_CIF2AXI_CTRL_0); + } + } +#endif + return 0; err_add_host: @@ -1861,6 +1895,10 @@ static int sdhci_tegra_suspend(struct device *dev) static int sdhci_tegra_resume(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); +#ifdef CONFIG_IOMMU_API + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host); +#endif int ret; ret = mmc_gpio_set_cd_wake(host->mmc, false); @@ -1871,6 +1909,15 @@ static int sdhci_tegra_resume(struct device *dev) if (ret) return ret; + /* Re-program MC streamID for DMA transfers */ +#ifdef CONFIG_IOMMU_API + if (tegra_host->soc_data->nvquirks & NVQUIRK_PROGRAM_STREAMID) { + tegra_sdhci_writel(host, tegra_host->streamid | + (tegra_host->streamid << 8), + SDHCI_TEGRA_CIF2AXI_CTRL_0); + } +#endif + ret = sdhci_resume_host(host); if (ret) goto disable_clk; From patchwork Tue Sep 27 11:13:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Shete X-Patchwork-Id: 609926 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 404B4C6FA83 for ; Tue, 27 Sep 2022 11:13:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbiI0LNw (ORCPT ); Tue, 27 Sep 2022 07:13:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231751AbiI0LNn (ORCPT ); Tue, 27 Sep 2022 07:13:43 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2052.outbound.protection.outlook.com [40.107.100.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B2328E07; Tue, 27 Sep 2022 04:13:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dr5MgHxUuBLZ3MPgMZ7knYdNPl/jd3zLzJV7vL+iGK/dyZ2VC63vAjcvhKh8OKLyCN+M36vCXf3eftRzy7DOzkEdecnLEC0f8sbUIDvd8M00zpjA1vJfvXg3BiV2fiomPdaSXf/LUfb0dZ5esripne5f5WzBhTWMhvkDJdEHV6WL7sIf+ADjvYgOko35tcfqc8oy+tNNapFIvQJKpS3qu7ZC54fVC/ZUJMPyqjSF30fRVIrRTUNY9YAQBW2YdsgY6DAEq52AF20muvj5RW4chyjdz5YH/Lf2hqbX1yNHZLulmiAKm6uaxCp1JXYkoRC4kMou7DjbQAGtsZs/ScxBvw== 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=6RkAacYyGEm6912nGI+71qd87CiKcmh+M1C1UXg0j4M=; b=Ofp9N9hUpSbIlklbjdZXTTJ2ob4L8mmiWvR5HHTmGGIO+nDrDZ872f6O2/uJioEOyKLlp9/Dta1SPR/IYhjmARhF7mJcIwzZn8lZSeeW0dF/kAORJHOhDHiRGZ2V/4pHGosfhkzhDE/sNzUsuKMUwtwLPWkKBoKZH7EliDM1siCBCy8p14wbedp2HH98ocCe5n4G4G4CAqJGuhmCdKZdKj6loTxS3qo7Bf+b1KLdRRQ34I7/Gmk1ksvdWFpyFmsANeSVkjnvudS2NbsPT6zdfsI8obB8OzhO7lPlP53j7av7xWuZcLU3quRiyw4znvVaRiefo2nUGB9TTCxET/Dscg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.com 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=6RkAacYyGEm6912nGI+71qd87CiKcmh+M1C1UXg0j4M=; b=rY6ivEYzvv2h4G8cQxzWbqKncIVY0CY9JTbreLHynv381Pa3Ay1BNFuFXDwNyrIvMLnOzZbKkezpOnguHiG+xLnQoXVVGzeJBC17nNLSLJbNhnqoSHomvtt5vN9gErdwY3ZmcXu4UPtTickQxy2WQbsbk5zSh8MfmJdzDSE+gokRguvtmmo2mI6MdX5M1cVsD/T3k8f83Ef+bpBmxHkvrP5g7ERsoazE8tF1s+V3O4daARvIvcahxe7gXLf093iVMHeHxemt6uMkLJqHcJLT3FdKb4Ru4SeUXDeyzMqtqDCewYN/9BYltWerJ6D3C3/LAqJ4TXYy4as8y1ciuZWUig== Received: from DS7PR03CA0121.namprd03.prod.outlook.com (2603:10b6:5:3b4::6) by SN7PR12MB7226.namprd12.prod.outlook.com (2603:10b6:806:2a9::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Tue, 27 Sep 2022 11:13:40 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::47) by DS7PR03CA0121.outlook.office365.com (2603:10b6:5:3b4::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26 via Frontend Transport; Tue, 27 Sep 2022 11:13:40 +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 DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Tue, 27 Sep 2022 11:13:40 +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.26; Tue, 27 Sep 2022 04:13:28 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.29; Tue, 27 Sep 2022 04:13:28 -0700 Received: from pshete-ubuntu.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 27 Sep 2022 04:13:25 -0700 From: Prathamesh Shete To: , , , , , , , CC: , , , Subject: [PATCH v5 3/3] mmc: sdhci-tegra: Issue CMD and DAT resets together Date: Tue, 27 Sep 2022 16:43:13 +0530 Message-ID: <20220927111314.32229-3-pshete@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927111314.32229-1-pshete@nvidia.com> References: <20220927111314.32229-1-pshete@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT025:EE_|SN7PR12MB7226:EE_ X-MS-Office365-Filtering-Correlation-Id: edb406ad-445e-4c52-a986-08daa07954f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ffNabXWH3U617+DdVrdqlSN4gYmukNPyw299+9WDV8omjjF7vH7QQNFjsPLlKz27D1wOyC2NIz5cM+5glfVOzzd+7DrN3DR2pcrYYuldSxESWf8W/wRkRShMvIhv5eJ7fiT/0H/UFKzaVSH9WjdtkMhpJ1eOXZRofWay7Nfj+OmP7V34ynS5BDd0pnL1tCB9gkabOq9uRQc0Rqn2qoX2kUIK1sNXKQcCjQ7+q+NT/jdXbaaf03qj5o33Uv1Zu8nLp2Wo/u3BOqOcR8TkcXM3hSF1ZeJGKievbuTHcelrVRBv2mEX8lSv8gX3IZvXQOWXF1RLVEtUMN8BGsJ/7u05Y27x1m9azZjoN0yy0tjQjfxRFUGtmtHwwBEnpSwqG4pAWE1IsNn65+G7BR6HztCWISu3QD9FfsZro7W5Bl2pUHjSsbt426rs9SMz5Wi+aHtZECDeNMRlE1M5fNUMczR8afubaAsX95Aaz4B9qdiekNolTmCPvSfYGqLMX2a9T/uR0VvjuGRveHynnlg+5GGsjUor/IJuG9It3hyGwhTLip1CfyC433HDHNHGpdR308f5RYffak+RlyjGvlbn5akBmSx81WBVE0zWywSPhS7m7vt3Z3BAiqrQR0cmBcVSOsPutHEm/m7Kv3SPGNpyZ7PTrK4MrgR6UMv8A4gJMYmF4rvYzSdjYHhrsoWQyxxoerjKjFUNzGIUGXUS5YHp+wnjBKN9/mPdcgHnItV9ODQXmOrlfrh/uEvToMZ+ztz2tohXVjB67NDuzgM0m5TgwpAPcA== 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:(13230022)(4636009)(39860400002)(346002)(396003)(376002)(136003)(451199015)(36840700001)(40470700004)(46966006)(316002)(110136005)(36860700001)(1076003)(186003)(26005)(8936002)(336012)(54906003)(8676002)(2616005)(4326008)(70206006)(86362001)(2906002)(70586007)(6666004)(5660300002)(83380400001)(41300700001)(7696005)(426003)(36756003)(47076005)(40460700003)(107886003)(40480700001)(7636003)(82310400005)(82740400003)(478600001)(356005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2022 11:13:40.1747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: edb406ad-445e-4c52-a986-08daa07954f4 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: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7226 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org In case of error condition to avoid system crash Tegra SDMMC controller requires CMD and DAT resets issued together. SDHCI controller FSM goes into bad state due to rapid SD card hot-plug event. Issuing reset on the CMD FSM before DATA FSM results in kernel panic, hence add support to issue CMD and DAT resets together. This is applicable to Tegra186 and later chips. Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete --- drivers/mmc/host/sdhci-tegra.c | 3 ++- drivers/mmc/host/sdhci.c | 5 +++++ drivers/mmc/host/sdhci.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 46f37cc26dbb..61dc5ee0726d 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1536,7 +1536,8 @@ static const struct sdhci_pltfm_data sdhci_tegra186_pdata = { SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER, .ops = &tegra186_sdhci_ops, }; diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 2b5dda521b0e..8512a69f1aae 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -270,6 +270,11 @@ enum sdhci_reset_reason { static void sdhci_reset_for_reason(struct sdhci_host *host, enum sdhci_reset_reason reason) { + if (host->quirks2 & + SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER) { + sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); + return; + } switch (reason) { case SDHCI_RESET_FOR_INIT: sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index d750c464bd1e..6a5766774b05 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -478,6 +478,8 @@ struct sdhci_host { * block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* Issue CMD and DATA reset together */ +#define SDHCI_QUIRK2_ISSUE_CMD_DAT_RESET_TOGETHER (1<<19) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */ From patchwork Tue Sep 27 11:13:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prathamesh Shete X-Patchwork-Id: 609925 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 CE394C6FA93 for ; Tue, 27 Sep 2022 11:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbiI0LNx (ORCPT ); Tue, 27 Sep 2022 07:13:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231906AbiI0LNt (ORCPT ); Tue, 27 Sep 2022 07:13:49 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2087.outbound.protection.outlook.com [40.107.212.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB3F1A81E; Tue, 27 Sep 2022 04:13:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jt5gvz2u2gM5/vfzDOhIqcaYeiN1u9e3mTI9dZl9MKvuQjb88cmQQOL5KjDNX2eWVQeeLu+yevFvJsN53sUVuRvpUHM6tg1iC6s/wQ+eHp2pjHNpFi6VfJki3QbR2ozR4dYMxHl+V2mOLtVOK5drITxjVOibiNFpOxWGiFruQItVuK31LNPTeSB5ZJe04lqdJSKSLlVTWjQvA8kH+VYF7SbmNG+hxqDl0z++mweQ/VSd/6XTqKt8kchjhNdv/I445zfFxDHenO/QIhgrkf7MQ5Caqul0z/x4D6r532ddi3JWqEqHNsVHPIJYrvBrLKQHIm/KyOWwADAZkBcwAUOweQ== 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=WrH7mXv8Qhft7UcA4wqYTG7iWuUTiv6yT0sZS4USblM=; b=RJlpLBgxsyLr4/ze0TX3pCcRHSOJEabsw05S6e/6J4kRcxhZTNZbkhXPMNnahfoyX3b40Q8m1u0B+LHt6f30ib6fe8VXefsL55QuL8lgTSUoaPYHB5r+dfQRPOQdXY9Nlo4pwerZ0Uet3DZNDPCTMqfcqilMrQlELmcT9IogFgqKRh5QVfiHJcNVzJOZ9psvWM/JCfiFK2M5kQyFTMfxPxHxbGh4Ep5NtsDlmbWlkTpunTB6vb0VLB8ckr6IIF2DwrhFm15eu4cTYszjAIzDGERMpxW0GFrk6VfDH2Oj9b6P8zqGKLxp0XUPxNVTmh66dN+lqCQDBT0JPokhFIJInw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=intel.com 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=WrH7mXv8Qhft7UcA4wqYTG7iWuUTiv6yT0sZS4USblM=; b=of66Vn75nQqbr9c5G184Og6Mo5gzH6sK8q/U7+ufz3JTLaewIYNvd0fhxRS2XRLKq2IJm8XEUVli/mjRBUzSn2Dn4LB4ju/hDvbCZmur0TsvEaL7qfMAT4/MA0wu6JxJcmEms+NK1Ufg1KF8Cv6y3mQS5hojj14uKcZN0w5k5FgoXGnR8IV23USAqsKPXs6cm6o7en44afdAP8N42wTGinBXHlWQ0omno2yBckocsXvseyi6kNYrPTA3u9TmaNeHpf5X4rYzIoG/2FD29LMZ6j2b4RSCAYOGkwX56btYGRsNpJE7t/4ZggPVhyivq/V2YIUMGJwLU/iBJ5sISWuehA== Received: from MW4PR03CA0117.namprd03.prod.outlook.com (2603:10b6:303:b7::32) by BY5PR12MB4934.namprd12.prod.outlook.com (2603:10b6:a03:1db::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Tue, 27 Sep 2022 11:13:47 +0000 Received: from CO1NAM11FT078.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b7:cafe::a0) by MW4PR03CA0117.outlook.office365.com (2603:10b6:303:b7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25 via Frontend Transport; Tue, 27 Sep 2022 11:13:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT078.mail.protection.outlook.com (10.13.175.177) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14 via Frontend Transport; Tue, 27 Sep 2022 11:13:46 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 27 Sep 2022 04:13:32 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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.29; Tue, 27 Sep 2022 04:13:32 -0700 Received: from pshete-ubuntu.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Tue, 27 Sep 2022 04:13:29 -0700 From: Prathamesh Shete To: , , , , , , , CC: , , , Subject: [PATCH v5 4/4] mmc: sdhci-tegra: Use actual clock rate for SW tuning correction Date: Tue, 27 Sep 2022 16:43:14 +0530 Message-ID: <20220927111314.32229-4-pshete@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220927111314.32229-1-pshete@nvidia.com> References: <20220927111314.32229-1-pshete@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT078:EE_|BY5PR12MB4934:EE_ X-MS-Office365-Filtering-Correlation-Id: 501c43ff-3f26-4f1b-3e5b-08daa07958e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r5bLpRWPyqq9dDj/l0fHpXSZAtVtLrMD4QGBz36c0jWYmHZ7pHVrzeP4KJ7nbGXQthKXIQUihEf8DBS9I+HjD7aBJ7r3iKUGySC0mEy39yMyobjDrfbjT/lie3wCldsAlBhdnK7Fb3wNQz5aWfEgrRtxLCSj8FmUsSdJRHpF5hG+gW6cNgt5NW17nMh7ccDLtohvGBZW1WKrsqynMCGIbZR3zmd9YxbjHbHPqeFxKZYjMoDqEGDfmcNaz8CBIzjSa+d5Ke4zKIe8qHpiAnKzDanQfOREMqghfoV7gYceFWXx22+8kI4tx1i4I96FZKcJiSDEpV0tVMntl2UEZ+bul9kPdhbnc/Ukhd1oTuMiIiOGJj5uXEk1EcEZCrnv+cqz1SW+1QZhvOi36QLgGKDDLaRB2MzVVITOfKL1/8l8S12eOwtxyYkAdDwtmc7lEomfZK/a2vK2+dd/aBO2st4m5GIJVLkglKxG2K0zaBIKey+EnXmT+bSbb2gfsFFMeMK544B39wUYM7BSKdn3N8i5K8PRP6QJHAOz05r3vfHT/fox+fNR9C+uOctz7xBUEASlW5qeTR7Io00X5IB1Uhdl9/VDAz53PV6FOGFOxvr+Q03984i9NmPnCOvM40PtJRg6MAmzYe4EHHyrFNL9rUbbMKNHGvg4Z0b334CIEbslx1pRD0eUHoLCyAFtPlpnU3a686nU8quNinaf5Vhh/fgfcO3nSMcoihQ5GhZdTGByNMmevxpRJP9nqruNmdI4CLXPmHtoUQOyaXByeHEnw8wD6A== X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230022)(4636009)(136003)(39860400002)(346002)(396003)(376002)(451199015)(40470700004)(46966006)(36840700001)(36860700001)(86362001)(7636003)(40460700003)(70586007)(356005)(82740400003)(70206006)(4326008)(8676002)(41300700001)(54906003)(110136005)(316002)(82310400005)(2906002)(5660300002)(40480700001)(8936002)(336012)(47076005)(186003)(2616005)(1076003)(426003)(83380400001)(478600001)(107886003)(26005)(7696005)(6666004)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2022 11:13:46.8027 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 501c43ff-3f26-4f1b-3e5b-08daa07958e3 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.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT078.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4934 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Ensure tegra_host member "curr_clk_rate" holds the actual clock rate instead of requested clock rate for proper use during tuning correction algorithm. Actual clk rate may not be the same as the requested clk frequency depending on the parent clock source set. Tuning correction algorithm depends on certain parameters which are sensitive to current clk rate. If the host clk is selected instead of the actual clock rate, tuning correction algorithm may end up applying invalid correction, which could result in errors Fixes: ea8fc5953e8b ("mmc: tegra: update hw tuning process") Signed-off-by: Aniruddha TVS Rao Signed-off-by: Prathamesh Shete Acked-by: Adrian Hunter --- drivers/mmc/host/sdhci-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 61dc5ee0726d..8285b979391d 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -784,7 +784,7 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) dev_err(dev, "failed to set clk rate to %luHz: %d\n", host_clk, err); - tegra_host->curr_clk_rate = host_clk; + tegra_host->curr_clk_rate = clk_get_rate(pltfm_host->clk); if (tegra_host->ddr_signaling) host->max_clk = host_clk; else