From patchwork Mon Oct 16 10:14:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422914 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9244CDB465 for ; Mon, 16 Oct 2023 10:15:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D73D8D0055; Mon, 16 Oct 2023 06:15:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 268F98D0001; Mon, 16 Oct 2023 06:15:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0651D8D0055; Mon, 16 Oct 2023 06:15:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E17D78D0001 for ; Mon, 16 Oct 2023 06:15:17 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A28441CB69A for ; Mon, 16 Oct 2023 10:15:17 +0000 (UTC) X-FDA: 81350917074.02.2944E7B Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2055.outbound.protection.outlook.com [40.107.96.55]) by imf28.hostedemail.com (Postfix) with ESMTP id 899A7C0015 for ; Mon, 16 Oct 2023 10:15:14 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=gJ3gKZ9y; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.96.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451314; a=rsa-sha256; cv=pass; b=JLeLPbA+Jjcih8EF3UhxiGrJ5awUWc05qGCx0OWumgLZef+a2b/DK51FMyg83LUVCuz9r+ chsKsB/ksbffVkKwggRuNEKaHxl4t6/DTYUkWPjsU+0vbO9A8IQsJcWWwUcCgcyAqMH/kN vp0XZqs/W+Gl4i1TlLM/PURQDMRY1xc= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=gJ3gKZ9y; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.96.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451314; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kEdGy8EGffjLOVahWgd5/Q4+67B31sO+LdNTQ+9iJ4E=; b=AYU7H1U8aq50icWa0PTdFQuUYRpJhAHnXqjhtqPrxnTs3SyceGbZ4TUJMsSqj1UOcIF1HL EQ1D77YkhsOjkkk4xgKhVLzA3/pMuu3Q7vJyCDyHBDd7ng8msBwS5IcesrEepqA1J7pQRK RYnkDuSNTzHc16CllRuj0vkdzU0VdRw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=brp1goxherUTvXjigjYHIXVe/3ts2rmHaoX/gUveGopy9xFxv7nobfZLH4DPhdKRhxWNdv6R+gybXdCGQ0AXxCgJ4CAuqxmWGnjaa9dhEmVYAHTrA+VCStl6yshM59uo8CEPfExs4riT3OimhHGamp6fnRvj+7YOgTtzGR8Qmp0dBnTRTRlko1y3jtuR8MbEbD23qwJbrdJNUbXjgeI1K5Mb6ve8SjhurVq2s1NnAzYf3nu/3MNJIDvoY6intWcXZOLLcR8ayFyiX4tnJ+lRIgHQjyxPxS8n0xyQDomJatjnt2NG1ApPmuFSVWgXerYFOA+POQ003XdNHobj4rYEqg== 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=kEdGy8EGffjLOVahWgd5/Q4+67B31sO+LdNTQ+9iJ4E=; b=m/CuS/nWXj5jZxTDQDSW+ZMO/7Ytk8NFIjzhDoBd4mEoWHaQ+IrBaXLBzrYO5v84OdCf9qpiKyx2aYFKITnOm9sJdWcjkhITq1g1JNE4G5gOdrB7CNRgSxuIDjyKAvBTfh3sh4Aw86lG6zanGRDwZQbdIm/gH0lCzuqXO46PCrA7jvpbET5Jy6aLG7tvElnpbH2EvHLxb174o4uXZN6bOTPTCNu5cNnqH5afqG0rZKnmmW3Qv/8Mo+OqFo1UqLU+tURJ8pl8sQad4RTGZjZbUG3ensx1jx+RUg9JSPI2xZ+SkD1fzZ9giEZKZsLMAF2pcY3VpLGj4P5thgEfitJQPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=kEdGy8EGffjLOVahWgd5/Q4+67B31sO+LdNTQ+9iJ4E=; b=gJ3gKZ9yYBTXIcovyvumvZiE+7OZNwlSS8Ooa1LmQ/yiLDNeeH5Fr4JED2/Uvk2u1PFRTALe6KCN4bLyVDz57G6h60dJghad5Hj9yXPKVCa3h5p/nx1KhUnJfwTWGYRP67qdonwW0j+BIO/ix8eTRVZCNvE2JaVgs4RDs1ZHpt3hXsiGYSDDueHftSYvkax8ch1tQvOW/08Jc7HuyfuasgcbSZXc3wtbRrUdfZihzcxq07yAphKxBbZ6EFAe0LN/USD+Uzkdd/oAgvRGEi6zBIhjnbHTXgAKIc9d62gVk/rLtwOR7pVvnsaRRruR/xDbf405lLJKn96ZOvkmTXHCoA== Received: from PH8PR20CA0004.namprd20.prod.outlook.com (2603:10b6:510:23c::12) by MW4PR12MB8610.namprd12.prod.outlook.com (2603:10b6:303:1ef::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 10:15:11 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:510:23c:cafe::26) by PH8PR20CA0004.outlook.office365.com (2603:10b6:510:23c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47 via Frontend Transport; Mon, 16 Oct 2023 10:15: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 SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:10 +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.41; Mon, 16 Oct 2023 03:14:54 -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.41; Mon, 16 Oct 2023 03:14:53 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:14:48 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 1/8] mm/util: Introduce kmemdup_array() Date: Mon, 16 Oct 2023 15:44:29 +0530 Message-ID: <20231016101436.7146-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C9:EE_|MW4PR12MB8610:EE_ X-MS-Office365-Filtering-Correlation-Id: d45218c2-e495-45fb-af4e-08dbce30c7ec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FpagbLjOp2taghtHhDTj0N33hrJXhtUQHXamHhyNq4e82xMSq1rYNx/ABbVpmOdN9iyAhxYNAd0W/8cSP8WTIYpKXG2+o1+NdMoGfIzbQkwjEA5EoxR2d9owOb0btVpLwSkh8Fu/WwrRLIo8KbGFHKOl6EhQtrKC/S81j78EDXhM/anNghP5DT/eUxuOf0r+239KxNEGyulwWn/fNbGZvl9kjA7SDmpaIfJm3FSqBrFH2F35I1Z4spwb7k+MgBiVriCw8g4rg0BNpCbG7Ejyrb/JPQiNeS0M55gq4pHH6zkvazCEzsaibQq96BTBzzJ5vss447BnJq2pC1Q2QGIG199fcDrLOCJVIaTp/xuH2ThLaaTvzzlwpM0xl3iGGV+JH1tB97pyl65iyAWk4+16P8wHK26CHQS/d0jpaKK9LNM+jF9nkYh/tVHugcfblpDnv6LxV/mEOTin8ts3pk59NuwSHRVVSNy+xnuYlDW4768nxK0Ypiljb1ClS/5hPuSiJ1CkqcEBUIdm+ZyfjI3yGiSWzNvd22QmXSVbtVkhthYbBh7l+mAKg+iRLb3MSRfzpSiHW3vi/yoA5h0UnrB8wmbqvWvsyJ/EHnI+Un5FePrRyUd+8AaNt/DXd5au0lqPciI7Zw/AZBKYjkJSZea/Yd5bL8xT78fDqHKgxYfX8EFnABi4Plgp4eqd+FhPzW6IqUXHvzbSiWhQC6dxu0err7ETAsn1eYO882+v1j9J3uwMtZdR/fsqZAOaaja6dtLJedIhyFGi+j9mqoj4dPGuYN3Y8y0Dv+LoEs6wOORhSso4mPoutOUeCZhoBDjRTerG 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:(13230031)(4636009)(396003)(376002)(136003)(346002)(39860400002)(230922051799003)(82310400011)(186009)(1800799009)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(47076005)(36860700001)(26005)(40460700003)(82740400003)(2616005)(426003)(336012)(40480700001)(8936002)(7416002)(86362001)(2906002)(5660300002)(8676002)(6666004)(316002)(70586007)(70206006)(110136005)(36756003)(41300700001)(1076003)(921005)(356005)(7636003)(478600001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:10.9580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d45218c2-e495-45fb-af4e-08dbce30c7ec 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: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB8610 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 899A7C0015 X-Stat-Signature: abkoc4ka8eq6sofg393zbps8au45eh56 X-HE-Tag: 1697451314-751009 X-HE-Meta: U2FsdGVkX19Xj5t5dtj2dsv+WRc0cZEYlJ9/q15bVfA6VclR5AOe1+c4WV9VfFZ5zK4QCsXDQvgdAjVdkMZMuB7AtdKWzOvxxg8wI92OQMyXImFosXlTdpg97zPVvgAHEJU6mLW9pGyTMl9i/QoZtS1QuzXmMVBMNyWamW2rGggVeSz2v5vhxS8ik7ojbSQSZTZQcfpb6KiCrVcAuFUea00itzCv4/xiGJeoLy+X2zXH9eVKXLGxS/5hklxZYZG5Mlw+ykVt5kCVUm43MC7gpf474FtgXEBOMn7ZxQqmon9z/luDwPKn+GrnmSSIB9i/V9IcbpeGBz3lSWsVPKcdkpNkz+KSwJkAoF1V/3/Ezol2BmHQVJlEkLA7mf12g0A/18iX/AYj4/ehd2VW6Ver6JipkZgwxDHX+tEq/39DCd0X//QujqdkEUsRZectNHQJZBwDdP8GHiBbKZcoQteLDHrTh2QEiukkeKe8hVteSSB3STvfaDEWUDjtfcSTtu/1N1xxdzX+GvnknjrnrLJ7tqUugD82tuLc9BoA2SzSv/eL3uvMwOJjLFzYFgZ2aiixiN+2X0K6UkR70NcsArGLRsyb6oyJ08tq2W5m8VjZK415FoBeQf1K30zdI2vA2/eAMU/zHy7jewYHuHBwAOhIZ3Ntm1YLdb7bTKaexhH6ZpM0BqBkbH03pjRlZIBOnW4SkmhNO9JBuDr++XW0fjMP9o55VDZtAS2EJYuXxO20yhLfRAQW3+RIIFZ/eBDFfFfHGSZOXk4BF0stE0fRU9Ma8TXPx11+p78VgIfFMBV2dy1FGufr+1h2QARyA3VgVozXJStuSUVQn66FSf/130gQwk890lq790vMwaDoae4QmyFp5fW7NCBkhxzmWWo2Fbu6CETSIAO9jDxi5Jzo3Amyo43Tk5+Qx+BkdMU/JNbS4brBbv+EpTwfFfKL2vG739mw2mc2oeFHHdp+HyzGcJ+ prUsk3/C HF0OpF/N3Nr0aL/IEYbz7Mu6gHunXLGpgBcUWFa/P1dORT7dCSUvixG6PYp8LIynkHI1OPgVUXKG3sYhUe9DSi20+4fE+Trpi272ScCz9/e2ztMiHKD0aiWTmJal9GEWmsDX8CWHMpy3xLZCseLgZpBrgFqYzjKId4PZ7PlY7vJ7aWaqRPqkxpbqg7ijveFT+8H0pw02XWMwHbQirhGQ6a1JGgcsf6qFFDhBd8zfgCdRxMIIALKzVO1of6S/ErYlE/gmXqh5zjc4ViG9qDxTHAEg60jB+qYkpsvvtxZFsuXDZgf6MXn9eiI6tFkCeWre7sx6xT6ae45NjmPZe0Gk6hh+sASmn+TSG/wZxLF2pynjyGdbjWvx5r4JvLiypnp2qrrlI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Introduce kmemdup_array() API to duplicate `n` number of elements from a given array. This internally uses kmemdup to allocate and duplicate the `src` array. Signed-off-by: Kartik --- v4 -> v5: * Simplify the implementation by just returning kmemdup(size_mul). --- include/linux/string.h | 1 + mm/util.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/linux/string.h b/include/linux/string.h index 3c920b6d609b..fcfa1062c79b 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -180,6 +180,7 @@ extern char *kstrndup(const char *s, size_t len, gfp_t gfp); extern void *kmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern void *kvmemdup(const void *src, size_t len, gfp_t gfp) __realloc_size(2); extern char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +extern void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp); extern char **argv_split(gfp_t gfp, const char *str, int *argcp); extern void argv_free(char **argv); diff --git a/mm/util.c b/mm/util.c index 6eddd891198e..8801446140d6 100644 --- a/mm/util.c +++ b/mm/util.c @@ -135,6 +135,23 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp) } EXPORT_SYMBOL(kmemdup); +/** + * kmemdup_array - duplicate a given array. + * + * @src: array to duplicate. + * @element_size: size of each element of array. + * @count: number of elements to duplicate from array. + * @gfp: GFP mask to use. + * + * Return: duplicated array of @src or %NULL in case of error, + * result is physically contiguous. Use kfree() to free. + */ +void *kmemdup_array(const void *src, size_t element_size, size_t count, gfp_t gfp) +{ + return kmemdup(src, size_mul(element_size, count), gfp); +} +EXPORT_SYMBOL(kmemdup_array); + /** * kvmemdup - duplicate region of memory * From patchwork Mon Oct 16 10:14:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422915 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93B1CCDB465 for ; Mon, 16 Oct 2023 10:15:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B0788D0056; Mon, 16 Oct 2023 06:15:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 237DC8D0001; Mon, 16 Oct 2023 06:15:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 03DDD8D0056; Mon, 16 Oct 2023 06:15:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E05D58D0001 for ; Mon, 16 Oct 2023 06:15:20 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9F27280B9E for ; Mon, 16 Oct 2023 10:15:20 +0000 (UTC) X-FDA: 81350917200.04.00D29BC Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by imf04.hostedemail.com (Postfix) with ESMTP id 8856E40018 for ; Mon, 16 Oct 2023 10:15:17 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MnGrAcP0; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf04.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451317; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=eWd0w68v5tUiCP1I5PEtxB6ULI2xhMJZ1yxqaWts6J5AzJlMtsvxvUxo1RoLTMK6p41i+R a5u+e+CSl9VTlXtP0o/UahIgoxDygD3Re5pHMLPQyt+XWR0ktE/97olfugp9xEivHATu6n pTpufavAXBjwrujWDfuXnhrt/hnUaJk= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=MnGrAcP0; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf04.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.236.40 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451317; a=rsa-sha256; cv=pass; b=59KrqmDaleHmLU26RnsQY+Rp8scXm+ZxN7Qskuh8kYmwVsKHs15zOMDzUVSEI4goZmiK1y gaXhJn1KpaX/Rx9nmKgbe+mpHdQ0YUD+3C+Jc+n1o30ZfR6idA5CTuxN9UpQtOaoScnLHs GlElH/4MZnmGtjtLxTTlz3w9DFiy7mo= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mc9w8eRjHCWtN6Y+ktTpjsGb565hF/vl9SquVvV0bx/XAJN2HAtzji5GtsBakjX6F8FPzOnynZ7glztQYkX+Ss2uakaAHPYzPk8vYh2GXPeRDeJpinTEnf/7cuKPzkO/tiri2JqUQ3QfVc15OkpxMdLUlF50jHqTLHVKnJqWU0+R/lNp28qErEiej51qbL2dMdaU07N6seWE5eN/c9n6PZQLvjUs1DbdzgL+qKg63MX4A9Y5ioIRrqxvjvUFHBhQaw80qV4C18hUSDqvR2QeM4s9jObGLILBHbv66PlL//cR1g7KmDDO7DPDhaLiOSS6x5pdr5uNzbXT7l0aHn5j+A== 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=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=LulEdkk2+C2/B0k9/H8iAHiR+NDDiyjMJdi2KEuOQbOdu2zFjeZWOb+rlKkChFgb4QGHLM3QhB3qsnK9eLd6W7shc6dUkmEpHw2etfubE3MuYTC3q0iUrMJko71VPD0yfhocuomODk0VhpHbOy/aFyh3GQiqH/Lhl9myKhP9X9UInBJx0I6Jp5rI8gkg5F79qjRuYd4Avo6nUglgbx4OuqN4WOkJn5DJbX86BlT01nN678l8s2+sMMUMpEY7OIEUxDuqVt1YlRQRR7TX0GaBE2z9OS1u4PR5do6IO6Dn1OSJJcc9AsihQumU8JMlHP3FIvs8NcKsrfinANoNRS2Cjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=uAxNN1B8Aq1rvOj2d6rD47BDQcgdbvf1bV0VdIQGpLo=; b=MnGrAcP0tcR5pPtLUMTsx+/ysuI1BL0KCmkj9u6ru1D7HZJFje0k0R1eIY2ewQkkObpj72TIY4aNqBnjQaNqqTd4Tfp1BpOQmEHnn9JtYxzJAcFuvCAR1vZfMqjU+BUvEpQP5bYhT2ik2TfrMGddQ/q+dSM5p8rps9m3RHV7xSJvM2Hhp3EiAxyL21lGgoA6jgoBzAsfjr6OWI1z3e6BLlcJkGagClUiNXT3YZUP0sjToX3yCBjLoDQCprmNt+qU6LakxqymeJ4v999KYcbyJ49c0tseBmMue9LrpDjGCGsvsk0xePaz/k1iy4NsoCeFIMaJ6kdMpAL1qcapIR9mww== Received: from SA9PR10CA0020.namprd10.prod.outlook.com (2603:10b6:806:a7::25) by MW4PR12MB7261.namprd12.prod.outlook.com (2603:10b6:303:229::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 10:15:14 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::c7) by SA9PR10CA0020.outlook.office365.com (2603:10b6:806:a7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 10:15:14 +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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:13 +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.41; Mon, 16 Oct 2023 03:15:00 -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.41; Mon, 16 Oct 2023 03:14:59 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:14:54 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Date: Mon, 16 Oct 2023 15:44:30 +0530 Message-ID: <20231016101436.7146-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C8:EE_|MW4PR12MB7261:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f6d036a-5ded-4453-b75b-08dbce30c9a8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w69nCxV52EfcyVpKAt4Iz1Fp3xsxGR0JXfXuUrh+gRR9FF1fflVFzV5EbALnU3Lp5VkuxJxRDRBVxBabkvT7TkqbP33r4C3xSO6/q6cix8zXUgKx8zOvJiyb5FYx2ykRYrqlxeN/WzODPBmXJdhrq48c0vFP+D2bp1VjXQJ0zAnHuXSA1zcfViSBv99gpDsI2+yWn4bqbkVZ5TqC8a7VSgKWMsrOtci4HcXq9zkNtlPgMDx4xqbQJnqCh82kuP+4MmEECnMZUqX8+imCm+w3Kz+bSG2Ipk80ddNMYZ5hi0G2BvBifF4nOWH1na0JLZNZ1ZENCcRT0H01H2SRV6vb7VzaaiEms3mgImGdKJgQlUPljyto8Fg+TqbwelNJY+FjRASUOyIKpdhECDT2Y0SPINcb0AvEzWzzl/aPwojxQGT03kN7tg9BH1H3vB9gUogtuuTCtvtRMQ883vYpD3151JOxMMTvDDQxJvOeXiIexdRShtSuuubZs2532qejR+GEM8LeGFJEv+pfwyln+lsT2ygYfezIkxUXVNIYhCmm7sT1NSjpMsaXdfRQefbN+3n7RXTfr61T65Uo73NCJPYjwKaFM7qNvs/ILYn86otpWjGNz1TLmArI14r1AOUBrMe+Iy7CZcKLNI1KyK+5zugdlONtm0ojddnkUUeiURIetE2H7DJml0lNllUbN/Odq7nmsIBnq2rOE6eRVggOxgLRI3K5dGXwYIBCAX7rDYQRco55lv6Aijw6Fj34nY2ZACGuFAlIFjCW3HFKdf5l9oojFmwVDOPilcZ37knhWt8uqWU= 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:(13230031)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(64100799003)(186009)(82310400011)(1800799009)(451199024)(36840700001)(46966006)(40470700004)(110136005)(478600001)(6666004)(70206006)(70586007)(26005)(2616005)(1076003)(316002)(336012)(426003)(8676002)(8936002)(2906002)(7416002)(5660300002)(41300700001)(36756003)(7636003)(86362001)(47076005)(921005)(36860700001)(83380400001)(82740400003)(356005)(40460700003)(40480700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:13.8680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f6d036a-5ded-4453-b75b-08dbce30c9a8 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7261 X-Rspamd-Queue-Id: 8856E40018 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: c7jk1rzje5uzfsa5epjjmj7un3mdioo5 X-HE-Tag: 1697451317-544032 X-HE-Meta: U2FsdGVkX1/qniD7qfnUtnRSfHvjeYTuMkNXam2hRHsTZ4EbQ4qpQ/MN8o1jBetPk6lVaLVClMhUgLvlAzYc3VUXf+nAucayK36GYWn+phK3KuZ0ou/atBOkR0Dg5+F6xt56HCY+4+Vf/xD1tKWA9Oy38OyNj3VeP4tfrJ8nL5aNwRii4uNdj+iYhWnPUlNp98AIk3nD1dy9/rTC6Nu0/5ESGliZhfEev3uOjGV6MHj03C0dLZlSFZ+JVUjwUMtnpEjLprxxzN/ryaLqUIrdaK1xWqFjrSj2jXU+260KzZgpD5iiy6oDOmKp3RJ8fVwJZSIaeA1pViU1tnD4ok/NKEuGLt9ajbALuC496kp/fUgzP/TN5xsNjvOIN7MHlG+fePz+V/T+WuOUlGC/j28ypkWogmZ4fCRM7Soh2fIoln+av78vOdjmknesZOn7CKQ/BKuyeDqdP+pT2xp0XGj2YXlWNzJjpRk3/JLBWbVvm4k9sDKzoxvCSUDY5fxUtj07CHLqsdjNXvy4TjOrjD3W8M0mCGIHcFi1RMDeRr3nLrdoljXA5Tl34vhD1ckIZ0B9+ImPUIZ83fKYYoKdEVUMIrMC8Zq7GGe0RrbrgEJH5Qzc6efpRvORprjstIC7c6w+TYz250yiOrqqVm9Im+cBd+9Lpr87hcvx7v6PRBIV0WsPth/kxakegW3rASnwqWqsuKzvD0UmZSaSTSw2Ry5hD7pb0mb7aZl6EynQ3BFvhCYoL8RWkvfYmdpCbF77Iv7HZ2rH/sukTM6RmH3LyiuHwwahWXd7cXtEa3WAl05c98TdMds9sWBese6XaGIbwGD+u9229cvmzFSPKt5mwO4A4TV4EdPsdMoGNrvebNkRLQRC0jQ7yR2jqNBquGYDz+N0aBUp/c9pUcR16Q8eJMvWO4G0SGliZs6Z5cWuzBTpUmHiRIHKCYzyLki6JHZPEE328ODajWjGP3JAF4jNfav 2EWOZh1n gT4PDiI62Bv77M/MjQvGy2XN3vyFjEHzQR4z/J+1QbfaU+LoeEKzw+1JL0mfaTBJYebiFYW0wf2VpOkknS06LtBcO+QHEUYHeFbu5XPutBlYKFck9IZPr25/psg0leKUiKmthuK8U9KTEoHKVVJ3lmjpDS3eR29aD7IeZQ3taieVyRhMElmJD0rRG08xsXq9hLdBcIQRYcTLSzmei2Rf4PO9brqZ2BU9FOupZeWL6ylORW7o2kz0cwvHc6eXV8uGakf4jLf5aeV8P4+JgRu+HRbUXWd91E0Rcx7yBrIz1wi1aeYgEEGnfox/gqTDNtJxSnGJdPXtnuvufepAHd7YVy9wZyjKt8yKB4M/iCkceqYs55vVmoRD6idFldN+DwqSGKPUk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Currently, in tegra_fuse_probe() if clock/reset get fails, then the driver prints an error if the error is not caused by -EPROBE_DEFER. This can be improved by using dev_err_probe() instead. So, return dev_err_probe() if clock/reset get fails. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index a2c28f493a75..98805885158e 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -131,13 +131,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) fuse->phys = res->start; fuse->clk = devm_clk_get(&pdev->dev, "fuse"); - if (IS_ERR(fuse->clk)) { - if (PTR_ERR(fuse->clk) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to get FUSE clock: %ld", - PTR_ERR(fuse->clk)); - - return PTR_ERR(fuse->clk); - } + if (IS_ERR(fuse->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); platform_set_drvdata(pdev, fuse); fuse->dev = &pdev->dev; @@ -179,12 +174,8 @@ static int tegra_fuse_probe(struct platform_device *pdev) } fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse"); - if (IS_ERR(fuse->rst)) { - err = PTR_ERR(fuse->rst); - dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n", - fuse->rst); - return err; - } + if (IS_ERR(fuse->rst)) + return dev_err_probe(&pdev->dev, PTR_ERR(fuse->rst), "failed to get FUSE reset\n"); /* * FUSE clock is enabled at a boot time, hence this resume/suspend From patchwork Mon Oct 16 10:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422916 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF963CDB482 for ; Mon, 16 Oct 2023 10:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BCE38D0057; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 545E88D0001; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 372BB8D0057; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 236188D0001 for ; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E9657A0BA1 for ; Mon, 16 Oct 2023 10:15:25 +0000 (UTC) X-FDA: 81350917410.24.A9C45C4 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by imf30.hostedemail.com (Postfix) with ESMTP id CC6FB80018 for ; Mon, 16 Oct 2023 10:15:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=FA3H1Ue+; spf=pass (imf30.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.83 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451322; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=VIdE9w2vSldycVPzzF3xU22i8fsDi4j84x2QMKuL6kNT+Zb1YmvghNM5HxK+dll9WVRc4E oYzLACC6OMPUnEPnZNXhLEePBWd+QxEtTe4zXZPyDaJQDjrVrIJEatRijJyTe559SXEwc+ JXmk+QgXDWQAX6456AKcUzpT81EPSE8= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=FA3H1Ue+; spf=pass (imf30.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.83 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451323; a=rsa-sha256; cv=pass; b=zbbJAVMmjSRZqyZa5vjh7p1+vfZ4m3KO8fUfarOrXCEmBuMKnKx0+OQ8FA5LI5j482Yi+B MaQZIfFyfXBeOMrIwndsrBKWKXPL0dod3fVQ37WgUflbump0kXUBxbuQyS6gwWSZ1BsH5F kGEap5iKu3xVSgtsxyCdIKg00yl8FXc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EIT4WsMFhP3IallIZ2B/15jEq8EMIS4ikeBpg4LU+SCfGUNtEMOsmHJ7MTL2XQkM5m+vhg39szOHEtp/deOjv42ZVLifvJD00aiJzDFACjH6zDNnw45whg4kzfRrKRL+Y/T7gHesV9od+rSdAK75xcXDSu959jrhv05sWTaBspQlkNexyvE8P+QEl/VL7+02LKSxlLj1N9umrDpep+NpBZ1aEdFtDxfr6Ie96+1ZW2o36mOevSn7BEfRjjYtdzSlWgvpNfFcgq1SKAjuRgRinVPd5/b39WlNgzTpGMg8UHBpS6YwvcJv/NMmh17ZCjTPmwmt9Kap+quqvShGQ9t6MA== 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=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=JBh0c33nL3u6mwZmQobKWSRLXhKs2GFzTB156NNi4riU2kVjBNkBRUhwNjwToNd1N4lA1QOEdZJ+hImlil92/OEq6yqJd7IaAOIAhWK4xLjUnGbvUTI9KWCLn7kOGJ1c1iuDmewtv62YYuNND3GbxxSKtlnYgZrX1lY/nQry1QpVtc3iAjElNvdDexG1WlcWo5zJV35Wm1vGPvvMkdEOL4PBPLwfiXQynQEFtieClnd0rtB2LZLeIRmSh4qWR6Z7IEKt9OtR/eK4njDsDHSsSVGxIsFUTKpQDj0gaclKEja27ke+4+Q5PPtIwfVO4uKrOYBA1MQfA1bd6+4cM8smBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.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=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=FA3H1Ue+8mb+mW4I5VAme3usDXqRdTAvt0fedEThqnsNDXtEGWDmkAjqGXQUFZviynNE7eKmvr18S5kyrMJlvU9bFavq+afLpuM2z6IKtf7sRiv4mmmvU49EKn1Qz13KxBwNWMd45TWLNAYl87sZGK6Jc0nIdiPKCiXoBuHrNh9BJxr7yElxcccDyHW/JMtHZK9Ls09rbtmz4+2FWhrE2+9a8AasvTXFY/ZWrwRnIA4g1q9ldPv2M4/qFUTefGPAw8M0PKO+63EvKG7YjLIoclIcPoumU8r93lB7EijewVA7doYkkzicDA5PmLcm4oxcd5s3rCGKIUosHbIZOXSt0Q== Received: from CH2PR18CA0017.namprd18.prod.outlook.com (2603:10b6:610:4f::27) by DM4PR12MB8452.namprd12.prod.outlook.com (2603:10b6:8:184::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 10:15:19 +0000 Received: from DS3PEPF000099DA.namprd04.prod.outlook.com (2603:10b6:610:4f:cafe::f7) by CH2PR18CA0017.outlook.office365.com (2603:10b6:610:4f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 10:15:19 +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 DS3PEPF000099DA.mail.protection.outlook.com (10.167.17.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:18 +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.41; Mon, 16 Oct 2023 03:15:06 -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.41; Mon, 16 Oct 2023 03:15:05 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:00 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 3/8] soc/tegra: fuse: Refactor resource mapping Date: Mon, 16 Oct 2023 15:44:31 +0530 Message-ID: <20231016101436.7146-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DA:EE_|DM4PR12MB8452:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nqegj82AxvbaYC7S1nOfZo4psz5tEeQEZRhN9gFFtxvNBN7LakKD04bsVRk/xv5mzKebg1yHyWFEfJCAvWYPJjTISrS9jZQa//kFGmY37q27U+T9uPQXWXCu914/e2Sk9C2pogi7OKHUz0t4SWA6VFaQeaLcUNGRsIP7kQ8YVa7HqOimPt0b9jW6r8IK0pTaKdyUHwMglGVz1bUWP8++NU6Efdy3RzBOwZmDCYg+asTIH0T2VByEzci0d7iqZsY0GsqPQ7v1PJEqUZupOUZ98Xzi2aPSe7Jmq+oiL0QR4+wNyVnFDO7kGqsMCdfVFFU+lK2XgUnYpWkMON+stIbE+PwQh/OcAzvo639SVo6A9MGrfWxL7ab6bpOb1u3TjvWEhU4AzNiKAsOzIzeptqg8ntOZs9iWMbW2JoqnVcy3P8VbuGfCyYUCSQWZb7aHzAfChndbB5HLvxwNdDPD/869JBxFIknJX7DoFvPBw8XJB+vIqwW3P1+G+koGw+JvfGmd2g7nCefdc7s/+I1JtQz5UQPN2tsx3FQl1lwRi5a27DLtOOrAaQAtWE5R6CgQPjn9qHQGcbIXdbP6wTDC0Yw/ASAHprkCDe9hfOiiIMSjdr1xEOQFbfiH5VEZcyA8s9XoxeB9W+f8e3aZ3y/xsnh6YvBxO32vkBSKwkCzIGHSHh5Gt5AG8sIo3WCdvaTruyIVLIKLsvo1FLOPAFa7neWVu4SLaxK+B+MXXTUpPi4O1eooLO1I3s6X+da3/IPNDFe7Q6o72oS00KpqLbZA44OuEuum3Oi0tBMk4SFp2vJOuqlaViV3deEdz2wHfbWG08/5 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:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(7416002)(478600001)(41300700001)(8936002)(110136005)(70206006)(70586007)(316002)(8676002)(5660300002)(40480700001)(36860700001)(47076005)(7636003)(921005)(356005)(82740400003)(86362001)(2616005)(26005)(36756003)(336012)(426003)(83380400001)(6666004)(40460700003)(2906002)(1076003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:18.8535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 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: DS3PEPF000099DA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8452 X-Rspamd-Queue-Id: CC6FB80018 X-Rspam-User: X-Stat-Signature: yi7anosrnptgrrc5hucg47wp558ts4sz X-Rspamd-Server: rspam01 X-HE-Tag: 1697451322-891557 X-HE-Meta: U2FsdGVkX1+nLJ565C6pyGq1GmPkqEHPgXdMJu5evrn2hrgJ+ZxlX4r1D1lwVS2GRQGoNZPPBFX/PjIR4UNOLiNdIu+/K6T3Gjrij7ZYmqjjipomHOQppwZqHzc/SjK8nTjP9diEdQiMSiLuO3N9Ounv4qaubBZ2PHE8BMS+yZ172fHpWrjE6eUfo/hMH/sF4NxjOkWM8uJ/W9RfaigJHxZ26pLprdSqffp6uqW+wxpn4y+Ntvfq1hAXzNBAgcOmR8oo6JNjv40igQwsJmGSuCHOjpMkpv8S9tI5mghoU6tCFJLPGIPEiWGwY9WGpDiCbwJ3zk5vKecPPI/vDmvaQPlBPg1mWCP06ePXX/9MF+md/9RI39b16NGSAl4mNWp7T057tmoXICddIJFxVn3cWSfoRr3V4jW0XcLghGUSykTbLGyU5w/AvpTIsgvdV9reddOGlVFKJ8kMMsoO4aDbzsZRXZbDiniDueymdE2C9kcRBOORAC3vOqoGtUGwBfV/aWz4JCgTQRtkdFFCYs48bmJ1y4lvT5ov1dhG601aL/RjY4YePGY7d1CRVUGuY+wjBw9NrNciQz8imBWmZZ7P7DV50/bUlUd3vFydLhgsYed3KxCN6Dc+91uDEEpImuUTGbdQ4lu5F8fjCSgu4Ya3oneWi1ifIa66b26pctxHfOoxptyI5H9/BGu1SylliKGns6VKJ4kvxr33hoeu0coBsgy6XQ6mFii9J3lCH9nHh8r4+++/T2RwXbJS3IGdpo26xn+IsZu6910wp6W/b4uARfDV4Hxch8liINyYJ9aDpOtCyctgHSObNGga/3ZZ9EGwkuY0iLd+FVpm6I6gwRD+hgWU24qZpv3kSHMwmuDihbEVEbDMBoiZmQFbMK1ijTwEY7XAdwkfGOtGRrz+jVEA/Z3u/+WFI3jTSfskyNI7iskTv/AeyLqHxMe9neSZGUiGuKIRXROqDY3Xp9rcJZ+ AgTRJZoZ rSHRZx7g82VKCsQr3S1wSy76h8xvF5+KWmgep9eOJWfy5392oakhMaNI5gxn8R11MZofNiHfS0vXGRpJG+UgyCxDkGJGw7+wlPFr12hUvSiTJzIir8yPdfuuOsGHGBLXU4qB1/OTBe97fMeqgeF4Qa1vBUZPyXvCqp9Dsf6r1OV/E2uzOUinJeOlNj+y7H8lPUSHBauICwzbOxBwKZ/ggtKedWuhbv+f8ndKOip5jsh1WyUohiXdKtcRArZHhIUJbWIZUy9s89YjmlQWkTWpJFOL12YDf37MhdR0/9hDeR5qjs97Lb0f/v94HvreWgL+BapovGGGtl3dwhmQbhRna63qBFQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upcoming ‘tegra_acpi_init_apbmisc’ function. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index da970f3dbf35..06c1b3a2c7ec 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -160,9 +160,28 @@ void __init tegra_init_revision(void) tegra_sku_info.platform = tegra_get_platform(); } -void __init tegra_init_apbmisc(void) +static void tegra_init_apbmisc_resources(struct resource *apbmisc, + struct resource *straps) { void __iomem *strapping_base; + + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc)); + if (apbmisc_base) + chipid = readl_relaxed(apbmisc_base + 4); + else + pr_err("failed to map APBMISC registers\n"); + + strapping_base = ioremap(straps->start, resource_size(straps)); + if (strapping_base) { + strapping = readl_relaxed(strapping_base); + iounmap(strapping_base); + } else { + pr_err("failed to map strapping options registers\n"); + } +} + +void __init tegra_init_apbmisc(void) +{ struct resource apbmisc, straps; struct device_node *np; @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void) } } - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc)); - if (!apbmisc_base) { - pr_err("failed to map APBMISC registers\n"); - } else { - chipid = readl_relaxed(apbmisc_base + 4); - } - - strapping_base = ioremap(straps.start, resource_size(&straps)); - if (!strapping_base) { - pr_err("failed to map strapping options registers\n"); - } else { - strapping = readl_relaxed(strapping_base); - iounmap(strapping_base); - } - + tegra_init_apbmisc_resources(&apbmisc, &straps); long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code"); put: From patchwork Mon Oct 16 10:14:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422917 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EB3FCDB483 for ; Mon, 16 Oct 2023 10:15:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E6E318D0058; Mon, 16 Oct 2023 06:15:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF9628D0001; Mon, 16 Oct 2023 06:15:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C72038D0058; Mon, 16 Oct 2023 06:15:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ACE8C8D0001 for ; Mon, 16 Oct 2023 06:15:30 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7C7A2160BA4 for ; Mon, 16 Oct 2023 10:15:30 +0000 (UTC) X-FDA: 81350917620.07.15A9C73 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2069.outbound.protection.outlook.com [40.107.223.69]) by imf11.hostedemail.com (Postfix) with ESMTP id 9DA9940012 for ; Mon, 16 Oct 2023 10:15:27 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SoJ7vhug; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf11.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.223.69 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451327; a=rsa-sha256; cv=pass; b=BKl8gWr7OdiIQKuTxXzztmaDrB/qCHq5t6XWKN9NOj5foRNaN4ikIumCCdJ6pOZHGGcdaV G9+08O/rldJeWh/u1lh0uoUxAthOIOsBG8MbCkuQmwwPYWJ67z+sSFbQu/G6qfV1XrjoHn g4LkmIWEW6AJvTx7G9I1JIumBgcCv1A= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SoJ7vhug; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf11.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.223.69 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451327; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Huwxg3aaNBgwNNxWl7rYicXbXEr+ZCJVJJKyE4DsCNU=; b=EaHVErbBKrRGn6/+j8vcQ46PDqNpEHyiA71hBpsEg+a7dOqFrXJZjLHLni8vo6DQw+lPie +Q6bN2bpBR5a+g4BrK0zFJrCTkQV9bNFWeV3AyvEssBcY3A8dBFsKckrdZs4f5vCaX73gI 7/ek6Ktl84QyJdnCrqcsME5pPAvnCII= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GQYu2kY1U5G5H+F8oY4M+GmA2enH6EUnbNNp64joTtV926fZdvrTLc/bf3GihX3PQmndXNtccqZ+lcGNUxmscZX67gX2ZnvQsuM3hfRNyMYZg5KhrHe804/QHOLxsaa3CdCVRZARMgKo+w8bRQ+1iUORcL/PzIfZ7wwDrixu1n1QVtpo7PnsRV6v6WHRwqiGnMJ1egWZBl6FF1ajuXNyML68brME5x6uHDZ0h47FLRNJGQmm214uk/Z5it/OwU4NsiaKmCf3+5xnnn1mobP6h8bUPKDac9DbG0fIe2S0A4h/gkpcOtlqXuUZveAwrDU8OOdwy4p9BJW7kexsfhl8Xw== 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=Huwxg3aaNBgwNNxWl7rYicXbXEr+ZCJVJJKyE4DsCNU=; b=khI81Aeem5EyyAMCMHBGrMsCpN6TsSN8ZCnDhi7L3Nw7WGSTa4h4uotHV5v++FqP04rkKIK0OYWJP4VGFrLqj96GIAocsEeyKYW5GovR7LC7Hh9wnRYceObpu29gs2dLvOeZdSnFuHYxE8E07ldVS/eP6v2r880ysxq1YruVnEVjHsBdZbZpQc7GvDSrG1VmIkjrjUIXMNjdApLT231/nwLXgsBb2sm6AdZUh+qk54D5UTa1Pz1j26Lvu0a7L3ZoFAzI2pUPCbNYLHN5/lja4ByyH38l1E99KR0Z6sDnyiGQJ/DDYC2CV7Tiv9nmjFk8ApQ91B0z4649H6CSe2U8sQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=Huwxg3aaNBgwNNxWl7rYicXbXEr+ZCJVJJKyE4DsCNU=; b=SoJ7vhugt4aft1ur0hmCyj63dKhf0J1DWWPKT2LT2rjl/Isxa4B7nZZ23FDDA9nul8xTVrjV+KUTRLVAntOvmjX4GekLOOqiZY6mcHw/uR5j1W4rMQfDoVvh6DZHAJ4EEzsyxQ7Sgj9mhC+1ODqrzeWZBZE+wrwUJ4GXgYkktDKcELoOgze9bAMjoK848zn6dVkCWhWrJdIetwjPgavLZxbQknYpuu6pH5JuQigSR1+Tf87fOoMklKUnO0inXlYVdm8e3MLJPWiSdXrbZybz302vC6y88AoAaT0bREAjd+IbSr0BRZ9ZrMhOTcv2FX6L/29fPldFZZY0x6TXfrDIjQ== Received: from PH8PR20CA0002.namprd20.prod.outlook.com (2603:10b6:510:23c::6) by CH2PR12MB4876.namprd12.prod.outlook.com (2603:10b6:610:67::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 10:15:25 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:510:23c:cafe::fc) by PH8PR20CA0002.outlook.office365.com (2603:10b6:510:23c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Mon, 16 Oct 2023 10:15:25 +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 SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:25 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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.41; Mon, 16 Oct 2023 03:15:12 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:11 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:06 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Date: Mon, 16 Oct 2023 15:44:32 +0530 Message-ID: <20231016101436.7146-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C9:EE_|CH2PR12MB4876:EE_ X-MS-Office365-Filtering-Correlation-Id: 7fa599d8-4bcf-4453-fbe5-08dbce30d057 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HnXXmtuxgWYd/mOFSVEgjRhlE9vZwtFDy2fyzT5Z1VSzLs/6QCVp8eXcUQxDFpMF/J+dTS2tc1L63dnR97wTfdvpMPdKWvdq3ryevT+FWz2C+Ah8vpJzjfOZxpOI4oTtzV6yzEsJNNfkqdXy21pjTeyQ0oOvDykWoBgH3UAeGxdOlB1LoQvR/6QurwXsEvec6q1/G8IIM1GwuF+j88ctmWQbFU8K40svdbnF38MxojeGToOc6ojTk1Uk0Dz7doJPIuh6ACPIEZvVWm6T83AwoMKYaWe3ovWi8L2EZrJfC7ktrlDWCXQOfjF62g85D5EY4HwJ0PdwtP/FZFxag/MRM1cfzwESQCMEjZSwSu3rYmqrgKSIDhKNrtMknwwK00STNLqEbE6wt10qRxJg59nYe1qVr73x4HopE6Ax7isCMVToYetaDlsy8H8u7zmXqueqHEThe0/5DD2ccqk0bYRI+PXph7DBZwMaqnxn+zXIwUtDCAs6/e/hwVD6pllPireiG45yhVcePlms4CZ+gsXOoGJJPIL4rKONd44zKD1vepHwcFLqU0OB3mA/JXW9tHvtzeMAlUJYDNdhCkUxTFT+Rd74LQtlADbhWaehosvLZ7RqrFYsX4qhurdKx02AKbkc9aLKN9YXLI68UWR5x4tvnooJXV5bptMVB0CDWw4zzwpBllNa1zPE1Dw0f+PZLwPwRemjZ8u6bqulSDyRE9IBi7IaVJtxrdvfUN1UpeIe3ekW6qkQ1+5KB67Fsq8k51lkAcXDIMzL+D5G1CarG56X2UOSbuelZchOUrfdMyExy1oaLVjIyhB97EmoRMVgVpST 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:(13230031)(4636009)(376002)(39860400002)(346002)(136003)(396003)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(40480700001)(82740400003)(36756003)(7636003)(921005)(356005)(36860700001)(47076005)(83380400001)(6666004)(26005)(70586007)(70206006)(316002)(478600001)(2616005)(1076003)(426003)(336012)(110136005)(41300700001)(2906002)(7416002)(86362001)(5660300002)(8936002)(8676002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:25.0517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7fa599d8-4bcf-4453-fbe5-08dbce30d057 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: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4876 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 9DA9940012 X-Stat-Signature: 4b855gbijyweddoj3jcn3oakfp1biidp X-HE-Tag: 1697451327-928050 X-HE-Meta: U2FsdGVkX1+38+vM6bHM0niT8aT+4MVkVT2+ql2mTXZhVTFsKBUYe3G+XPQSQw/6At3z7VBTBj27G/LvOU90vtP8St01Qqd27zv4P59FjMmp1uDYHq9LZuNO/g8bMGSvZ5NHJM7ADi3QSSttQlLxCzOOK/F2fYKzs++yQVLyWiSUjiJ0g9FYuSvrAybNNKyJ8OzDpV1HalTuc7aX8s2vOa+jZiU7Fb25j4e0KkDIZO3SHlRkayPVMwCvK1MPhI1pduX/qWeViPaZhvi0Uz5lX7rKDBdi3TlcG+BoZkkhvx6RM6oS/XZ7OXz4an9yfA7pch5D91mNZ3sTjMM4wTmMlOjUHktL9WTDmhFtwbqLOvhhw7Lveul5Y6AS5kUXwMz5cJZiXe2WUOUeCcrYY32R05f9i0Gu5b0HQKLHStcJ/hMj1lJ/RlBFTxWu4BiWqdvGhWQqT6vPg9BWiGRiiLfD0wxIMz45M68awBM+xip7aPt57eC4KjQHu2G4fXtg/ZslDdDyorNy3reEAdFowcX52/MYFGphMzgdao/L2WGJ7BcY2cZdxx4BySOSi/B/lkbMcqEC7rt1vlNRKt5Ogy6fWyZkPA8X3/BH0OJEUFUtkJhFmRTyAIDolva6yOyCFA0GAE82RYaXjWR/8Q0chKzPyuqLhA1w2UtKenNyIYmQ0AQEuEl3/1r5/UlBub/gghz7CTSNWrpD2irS85/BZNJUeV+xpiJNT+qKgKVLnPg4hvY9Y6RfYDwgp90sZIvw8le8RoemRCWmwTqqTguEgZym2PZkVRAtT+Knp3x/2s71BOidVdKFMopJArjpuR5Gdlil+sLCb58FeVNSn5qe4nAl+SnkzntDGxtC9l1gLa6IVOeHyQQes8i08tXIaU3YL7TTgvuUr37yfRB/nbNefHl+cdf5Iwx58yGeM062OWEgeq1zx7NNxen54i018UPMwjtet+50QoCgLFWcAuU7xiV WXCWZy+9 uV+gs9xLcJnV2ZFiSKCEQNqQAHogxfy35fe7x8T09nH0/OsA2XOezGST4T8tsUFTRNglodh9BIeeXOimwZPPL6hFBrDmCUuZyM8HDPBwsR0gYEF8HLixqL3wld1RcOc7CIDpUmv5LuTb+yebTLPOtAv26AaRl6MHxlCIylRECfHhE4ijsphWGHLImSWk/MpMq8EIigdTtHnm74lde4P4FT8BQlaApg9uLl/sSYOVA408PE8XAXecFI80Vzp1yjSeSsdQmZ2B5B4/LMPjbuTTWqHRCA8VBY5qCE6NrFDDLG9yLV6bcLWzL+qQFTh2t9qAPh3SVa5HYX1WFLrBxLfV96tru7h4Q2tOoNPCNn6av6zEwiCJMo1pDVQpXDFV2tW0nQ9EaejHTqcVxWEMWhZlP6Ed42wW2heSOA3OT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In preparation to ACPI support in Tegra fuse driver add function tegra_acpi_init_apbmisc() to initialize tegra-apbmisc driver. Also, document the reason of calling tegra_init_apbmisc() at early init. Note that function tegra_acpi_init_apbmisc() is not placed in the __init section, because it will be called during probe. Signed-off-by: Kartik --- v3 -> v6: * Use resource_list_for_each_entry() instead of resource_list_for_each_entry_safe(). v2 -> v3: * Fix build warnings seen when CONFIG_ACPI is disabled by moving tegra_init_apbmisc table inside #ifdef CONFIG_ACPI block. v1 -> v2: * Update ACPI ID table 'tegra_init_apbmisc'. * Add comment to document the reason to call tegra_init_apbmisc at early init. * Fix an issue where acpi_dev_free_resource_list() and * acpi_dev_put() were not called if acpi_dev_get_memory_resources() returned 1. * Update logic to fetch memory resources in tegra_acpi_init_apbmisc(). * Fix build errors seen when CONFIG_ACPI is disabled. --- drivers/soc/tegra/fuse/fuse.h | 1 + drivers/soc/tegra/fuse/tegra-apbmisc.c | 72 ++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index 90f23be73894..a41e9f85281a 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -69,6 +69,7 @@ struct tegra_fuse { void tegra_init_revision(void); void tegra_init_apbmisc(void); +void tegra_acpi_init_apbmisc(void); u32 __init tegra_fuse_read_spare(unsigned int spare); u32 __init tegra_fuse_read_early(unsigned int offset); diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 06c1b3a2c7ec..6457f80821bb 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -3,9 +3,11 @@ * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include +#include #include #include @@ -180,6 +182,12 @@ static void tegra_init_apbmisc_resources(struct resource *apbmisc, } } +/** + * tegra_init_apbmisc - Initializes Tegra APBMISC and Strapping registers. + * + * This is called during early init as some of the old 32-bit ARM code needs + * information from the APBMISC registers very early during boot. + */ void __init tegra_init_apbmisc(void) { struct resource apbmisc, straps; @@ -244,3 +252,67 @@ void __init tegra_init_apbmisc(void) put: of_node_put(np); } + +#ifdef CONFIG_ACPI +static const struct acpi_device_id apbmisc_acpi_match[] = { + { "NVDA2010" }, + { /* sentinel */ } +}; + +void tegra_acpi_init_apbmisc(void) +{ + struct resource *resources[2] = { NULL }; + struct resource_entry *rentry; + struct acpi_device *adev = NULL; + struct list_head resource_list; + int rcount = 0; + int ret; + + adev = acpi_dev_get_first_match_dev(apbmisc_acpi_match[0].id, NULL, -1); + if (!adev) + return; + + INIT_LIST_HEAD(&resource_list); + + ret = acpi_dev_get_memory_resources(adev, &resource_list); + if (ret < 0) { + pr_err("failed to get APBMISC memory resources"); + goto out_put_acpi_dev; + } + + /* + * Get required memory resources. + * + * resources[0]: apbmisc. + * resources[1]: straps. + */ + resource_list_for_each_entry(rentry, &resource_list) { + if (rcount >= ARRAY_SIZE(resources)) + break; + + resources[rcount++] = rentry->res; + } + + if (!resources[0]) { + pr_err("failed to get APBMISC registers\n"); + goto out_free_resource_list; + } + + if (!resources[1]) { + pr_err("failed to get strapping options registers\n"); + goto out_free_resource_list; + } + + tegra_init_apbmisc_resources(resources[0], resources[1]); + +out_free_resource_list: + acpi_dev_free_resource_list(&resource_list); + +out_put_acpi_dev: + acpi_dev_put(adev); +} +#else +void tegra_acpi_init_apbmisc(void) +{ +} +#endif From patchwork Mon Oct 16 10:14:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422918 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78091CDB465 for ; Mon, 16 Oct 2023 10:15:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 102228D0059; Mon, 16 Oct 2023 06:15:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08B2F8D0001; Mon, 16 Oct 2023 06:15:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E46678D0059; Mon, 16 Oct 2023 06:15:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id CDC628D0001 for ; Mon, 16 Oct 2023 06:15:36 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AE903160BC4 for ; Mon, 16 Oct 2023 10:15:36 +0000 (UTC) X-FDA: 81350917872.14.2283730 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2055.outbound.protection.outlook.com [40.107.243.55]) by imf14.hostedemail.com (Postfix) with ESMTP id C3425100026 for ; Mon, 16 Oct 2023 10:15:33 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q0KCnjBj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451333; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=W4cZtQZh4u2QpHjpgHfMxErgsbKI6kUdquPwO9/TEVc2G/ML+l7WTbjMDTg60C9bPFAgVz PbKIkaMcVmCPCTB1o1NsAQ2R14HZSV8zX/VqqNL4r7ffGwmUEqlQEQ265Q2cgvq5p2i5C+ yTWiPLc8heOiBemX5ipvsPoyynBk3EE= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451333; a=rsa-sha256; cv=pass; b=21Qstzu167SzkOAF1GEwe2SDrtAlcbLPym5nI2mTBIoI89Guhe83w3X/bWVipOR5c4HDDS sDJoeWUOvQBVCgTxv5UFX5nTM3hG83eOvqcG7sl69dgRZWDDYX+S66kojI2T8XQxfhIEqY UF9amzwOKHwxxbXL3buLYbFg8tMLzdg= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=Q0KCnjBj; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.55 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=foYmv0pVzymGenQmeCJ2M7Y9BlLVVhsn04awBQoVViJZlUujE5jVzZc4uiFrilSO5l5V1q49TRnqIy5UAVg04XI5Ysh47ZVOvj+u+vPU4xgcE2Py0bQGpS9OgPOZ2jYofuAlr7BVINdz8AX3zU0r5WfOm8K4BONjVcmCt549kh1OmLDEWoqmOPEimrem8WzJ59wMqY9pH0uJmSe0PLV7AuXDWwfRXP2pHPDw6TzlNBLKbAxWr4cYBYJ+xmq+zjMFH1YXB/j9TMbVazcO0G5PCDVnTmVpy8SG4uM1GG/f5xTsS9Eov8EwDTcnSNv2zpBmyEMLfb8WO9DG3d4Jx4HA2Q== 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=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Jo6YVWh24Czukgvo1w7wMHq/vCMzi57nfaDIQQlT3Nx3brZLsbQ0zdv2u1ZymJUoNuOCcWx0vbjkanqJhC6vn8yzkLH1N20sKMJBs2cv/U7GR4KyUye28QnCjQtpQY/+P90/bAOwf8qrL7Fx+OQs+xpIIQhqGeZQqCd2eEsotL3B2Y9TmHSc9FMw95ZRbs8X59p21puUE5ccEK8bBRPTcKz07/REDN31AA6fm3YMQosNFgCXm7nZLAg5jDQqTk4XVQi3udCfz9yA4bfo8nVCJeDpdQ//dUbyLKCPS2QhGdnyWl7yD7t24x2dvW5krixmrxhHbpHmvYnKa1PAYbbSng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.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=wHnqTB/I/hBTi1klkL4hU/OmFUiU9wc9yjCWyXOOe8c=; b=Q0KCnjBjaWIYsP3gV6WZik7Xaw2efOFp5lC9IpdTpe+GO9+G32zLS0wkx2EXBpWwYMmmAgO5R2hWlE8xm+OXo0MoNoUwUlOYe/jPvnX9z5jvpHxrqL0fNJnvLVvZyU30oBkahm7Sx/ijYCoLOY+XLFbOKSOygaB4CKXXVAmOADWvj67stOqmiSHGk84I74JKb1uVi4CJzNSJg0Si9guUIml9WD3aS+6dBhBfdxYJ2AFL04Nm1mm9aS8EccnE68S3NPr0czhDh0wePGsx0KF3aCFvcuEeJuWY5laaxO94bJrD1FRT3MJPnLnInXo7BKH5Ae46WOmUHAyydD/+QveVhQ== Received: from DM6PR10CA0003.namprd10.prod.outlook.com (2603:10b6:5:60::16) by BL1PR12MB5078.namprd12.prod.outlook.com (2603:10b6:208:313::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:31 +0000 Received: from DS3PEPF000099D5.namprd04.prod.outlook.com (2603:10b6:5:60:cafe::38) by DM6PR10CA0003.outlook.office365.com (2603:10b6:5:60::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 10:15:31 +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 DS3PEPF000099D5.mail.protection.outlook.com (10.167.17.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:31 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.41; Mon, 16 Oct 2023 03:15:18 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:17 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:12 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 5/8] soc/tegra: fuse: Add function to add lookups Date: Mon, 16 Oct 2023 15:44:33 +0530 Message-ID: <20231016101436.7146-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D5:EE_|BL1PR12MB5078:EE_ X-MS-Office365-Filtering-Correlation-Id: b62457a4-14b7-4380-8e55-08dbce30d411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Mk0LP8BUIStzTxQ2wtmF3yyB/C5EOqvazvEOHseQ7JBPFt37IU4PoQo4BWxSHtph2TKHnt/MFE/iWT36/KEVKoqt9J5HDeuSLUybBoMCvAOrLoFuQGkbyqI4MnnHlY/omDCx5/CHqEUUh50v6YY71flzvxji457HK++wMBcHH2RFARpGDvU3EX/Y0mDnos8LfYhATF/FXBuXNVvP4eGfQsHmrMYxiweeFY0ews8BzsKxQVHk+WJy+Yx48wPzxtEvK29qD+RVpHX1S9dyLBSqtZkhzNE4mowiUOHqZINSZh8+Wls8kz+R/ruZf9xq2iXw17tS9BGOh5XY/T0b2/dO+t9rwPs9hFmBrTILKeFqKXcHH2JHNLwUapDI+oTyTUjYl5dOTF9vYlyN3IgxJ7BNE9qmsmEhWwwTgMqgh34NSNdbx/favm80gMtwwnbz/W9BucCqOWzU/IpgJ5Bw2wIzR+hJuLDcAQKqBOrh8mX5E2x8PDZBOJKR9TAfuq98lpdk966W50RKVOE0YI5iQCXknRAy70NVYlqrDSLqThaYNcKBVK1vnysKUzg5NFoZlcYOdQSaC1zFmirtXuBBpWlvYhn8/5fIl2iZFKsBeau7YU7hcLP2+Zi+dHKkxWkMXdlwautHCgwwFGqgDdqaqF7qn7xLGH7QxxO7alJyHyGwfvDIG053CmHgAsFt0VmzIl4a3XwVnuKfCiH4zc7mg0dvsazyCGUnipLJqu5mNWfKL2SvuhMnXr69vE/pQqgS9cxKmdDLbjpOwViHDCvzBYQSbB9+9O1W63Mi7DzF9V9k6uzDi9VrHZagHUzJ/2oE7oDZqyt37ty9+Sgld0kpZae7fg== 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:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(1800799009)(186009)(64100799003)(82310400011)(451199024)(36840700001)(46966006)(40470700004)(47076005)(478600001)(6666004)(70206006)(70586007)(316002)(110136005)(1076003)(26005)(2616005)(336012)(426003)(8676002)(8936002)(7416002)(2906002)(5660300002)(41300700001)(36756003)(7636003)(86362001)(921005)(356005)(36860700001)(83380400001)(82740400003)(40460700003)(40480700001)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:31.3167 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b62457a4-14b7-4380-8e55-08dbce30d411 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: DS3PEPF000099D5.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5078 X-Stat-Signature: o9u6jqrbp1uc3aesj7sm6cyp9zprhugm X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C3425100026 X-Rspam-User: X-HE-Tag: 1697451333-754209 X-HE-Meta: U2FsdGVkX19l41XhA6TP7o1FzG5kIctnoZM2U4I4NNtozY+94clX1P+pxPcekq/Ebfp7r2x9Nm0+umUXkbBHTpk9jL/DUEE9zKqWlBdZZr1iavyzAQKoHKiu0YK9Au17rzv05fADlo2enK3es2vCcSY56/jU3PbRRzcY76j+smpi+k68tK+YuewCCpHyMwdkE1MbfS8aUPH5lQF2IHa1rQihuIGc6jW7R1inQPMLgu0NDo10wA/zLlel7uTOYKvgKi6tusKm9tpvttgnMPM07g927TuTsCBMM/PO+89KEyUhnuMshiJTWyVLrthuT+jlXs2+U9MTebnvvOhYXwiKpjGkBLgv4qbOP9B6q8NLOksCkLdDABq9juvMO180zR2ffn3AwBMRfgknpQ61QcrwI1q68yt5D+PE5p0VDaocW1/g+ujkoAtbzHs2O0J/5vRPqK6YDO0uNn5xQCNktC5imBoCTo7MHbT/i4V+zFVdj1k1Lv/N0zwWukWxerOPfaxafBX5Fr8g6d4MuKOFPkx4bG8mEhKG0u014dbCZp3jHg6qNUCLVEPFo5H1r7DsCofREdqEyM7nI5pVQHxqjqKGwC9GU7NJhCvUQrgkhUmlI1GIorptlBwDZuqkJYPdiloDLI4PG0JldNy6DqqHgNH6ysBxSPniIlxQohdlOo8EbrTIU1eXuIFOK54HjU5ZCVZBppSneUF+5VNnRPqNHT5OUGkLWuN/UkWWA9tEok9t5q3EXMObyc7Nmez+wPuAI+ZgPcnTgnugzr6GMJ7EzbhEAsGUOKpOcVBPXS8zK4gjeFTzfGY6Puja++vSagS9+of4T0RaYMPXO8H5IjJfSfQrT3y+R+/g5KtQyKPWGq+y0yNWj4EzICoS8gtMWZA8ooOGTK/Lx0njW1TtW1HhSMnybSwtvKCMrCB2468ho1wkWz+fM2mFly0mAXUVuAVIIkXXpODoF81Z4Mf8tQF0VvD BawCj7Al 9/JER78/uvY1tZDxnDmZ21SQyReokmxjEUE08zd7eIm90bjct9PWetE+vaUIxfhXr4cZ5vH8jJk5dDJGakhedDPj4T4RAHPRKI2ocf4GOFDnMrm3yG6spvNhU3S3O+zNjm5QEN01uj3b1Mgo9AIcXVvVXyN5s+46lPk6YKW+es19ghEu8Ovh3EZaXO/u96PQGW53LMhtiS0liseWrwBKKk4j/10l87gzvj21nHogddICZgZ2woD1NkVaYVTSrkZdILe3dDadYPGFBQcV4xPWcUKk8eF0V99rbf0HVUG03TqM2pka3HW/OPqMzOxpwpIaPLxQSUUf5Zzu2Ckq1W+xaUYBrhg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add helper function tegra_fuse_add_lookups() to register Tegra fuse nvmem lookups. So, this can be shared between tegra_fuse_init() and ACPI probe, which is to be introduced later. Use kmemdup_array to duplicate fuse->soc->lookups. Signed-off-by: Kartik --- v3 -> v4: * Use kmemdup_array to duplicate fuse->soc->lookups. * Return err at the end of tegra_fuse_probe to remove redundant code. v1 -> v2: * Use size_mul to calculate lookups array size. --- drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 98805885158e..4ebb5597a77b 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,18 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) +{ + fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), + fuse->soc->num_lookups, GFP_KERNEL); + if (!fuse->lookups) + return -ENOMEM; + + nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); + + return 0; +} + static int tegra_fuse_probe(struct platform_device *pdev) { void __iomem *base = fuse->base; @@ -398,6 +410,7 @@ static int __init tegra_init_fuse(void) const struct of_device_id *match; struct device_node *np; struct resource regs; + int err; tegra_init_apbmisc(); @@ -495,15 +508,11 @@ static int __init tegra_init_fuse(void) pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); - if (fuse->soc->lookups) { - size_t size = sizeof(*fuse->lookups) * fuse->soc->num_lookups; + err = tegra_fuse_add_lookups(fuse); + if (err) + pr_err("failed to add FUSE lookups\n"); - fuse->lookups = kmemdup(fuse->soc->lookups, size, GFP_KERNEL); - if (fuse->lookups) - nvmem_add_cell_lookups(fuse->lookups, fuse->soc->num_lookups); - } - - return 0; + return err; } early_initcall(tegra_init_fuse); From patchwork Mon Oct 16 10:14:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422919 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88846CDB482 for ; Mon, 16 Oct 2023 10:15:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 261E68D005A; Mon, 16 Oct 2023 06:15:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EADF8D0001; Mon, 16 Oct 2023 06:15:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 063ED8D005A; Mon, 16 Oct 2023 06:15:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id E6BD08D0001 for ; Mon, 16 Oct 2023 06:15:47 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AF610160BAC for ; Mon, 16 Oct 2023 10:15:47 +0000 (UTC) X-FDA: 81350918334.30.B39E37B Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by imf23.hostedemail.com (Postfix) with ESMTP id 8A105140008 for ; Mon, 16 Oct 2023 10:15:44 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=lNRne9lU; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.40 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451344; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Boe9hAUW3Y1DekcyUmXJ4mkqskHoBpTocROHHjVt0YM=; b=zVzBqGBK32q10XlJN2MEQh/Q5YLgdU4CcLHDPAZg/41tnhhdkc4e4DoTXfuUdhO261g1oU DztoYuW0bbYgLCNKQyW7PCAy4w/Jnx+4w8cD9v5xnUiLH+I0Yroi96oQPDH6R9eZW8c6Pe xhH0z5eXKOsPUxnUI0ir1lJDaiPPmEY= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=lNRne9lU; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf23.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.40 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451344; a=rsa-sha256; cv=pass; b=ydCu0U550zu5jvKN2hcTM2ShTbmV4gvvkkqRIQOTi5s19fr1fJIe0MYYDHxTiVVreJf6d5 GTUrPrLUkpM5IkX75gTfqLMiJ2Uy4jQKdicF3i/iX4PmcaeOfNlmaYL4fAn8jTe6aSLbb/ LEW5VvRqfuE2aa4/UL7KhCyYpLHPUJU= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNImDBtYW+aExC4B48HYeJrW2rSAEJod++pVHNFCmbkQsqyHxMVzuFd69GjkZcwU/jL6Tmp5/95LpJLJHLw5hiAtUFjycW5zopvGcN8lxm3NIe95i4+Y9/c+U3Dhs8Tc2vesW/sCpUK0jKMgOtAa041sts9591tRP0e0zh3QKqYd5X2pBlpOjeltvSpOCRO6QOefJKnw/bZguKaQZAf2xVEGrRnGUIUEAeoclQzJLjHj4+MfhsTnYDH6D2CB2cyDNUAxvxhQcDtTyJGXjbRYb222fCjIZ109UcNG/ogqQw4daeTUVAqgjE1vfVuAPn7J+Wsn7Jg6VAMOxJ/Y4lhC4A== 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=Boe9hAUW3Y1DekcyUmXJ4mkqskHoBpTocROHHjVt0YM=; b=etuZbUc6tiIlcq6D7uygKutbsrJkaeHX0AKfTzSjaXpzN6dxa2CtQymow+cY2j+cSiwkdQ6midlTIqcUJAJgszivHWTUDszOCus0NyMBSevoBx6Ed1KOWgzFLsg+iIyhnGd0N7hWKRYhbYXjEmbi5AN2uSRPI69lwaSvR2/3xHt7Pr/bMuuXqswIxKZIpunwHkEVsnVxiswlYweKa4ExSKLgvbOkPxsFYaUwTkfz4iaB9quoM8CTZoIKFZJuU/xpPJacLJTGheObg2iLWYnMaufWNOGIX+2WDuL6vV2+Spx+fWOWNLKAXIiHj0OuyKt2BqqoKcwYrtbcp04YcnILwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=Boe9hAUW3Y1DekcyUmXJ4mkqskHoBpTocROHHjVt0YM=; b=lNRne9lUlD9wSr3q+JRP7qYMxy+tOen3kxVPqB30ko4mvC/UGMoyePJghUtwHzF2lykT7TePFjEntmYFfPl9Hk3cAgKZ8lK9ydQNWW+qkHCDNCP5TZzJ6lwWqcliVIqKIcl8fnjZZO7omWKqukCWEik2AW5Q3ez1gOv4EcJzckG/2uEVzfKSIMp9WdGsDXrMsujZMplcRfvoWeF2G/ut3c3lGuQX42LPayQx5m0sgj5NnaW/VswcEFMbJIU9qRhfVf4dU+Fo0oFIJsjxSUsu2PzS+6TU9g37juig1n7+CG5Ujv3cy0QzaXW2hx6s3iBFw5qtlUIA735S5rNr1pg7GQ== Received: from SA9PR10CA0028.namprd10.prod.outlook.com (2603:10b6:806:a7::33) by LV3PR12MB9331.namprd12.prod.outlook.com (2603:10b6:408:219::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:41 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::d) by SA9PR10CA0028.outlook.office365.com (2603:10b6:806:a7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 10:15: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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:40 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.41; Mon, 16 Oct 2023 03:15:24 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:23 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:18 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 6/8] soc/tegra: fuse: Add function to print SKU info Date: Mon, 16 Oct 2023 15:44:34 +0530 Message-ID: <20231016101436.7146-7-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C8:EE_|LV3PR12MB9331:EE_ X-MS-Office365-Filtering-Correlation-Id: c2730010-b993-46d1-eb60-08dbce30d9af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vyj5hgZUNf/Gu0aqe+M9bZUgr6TeK6JZ8STXp2Jez0/rk+nr2RRQ5+i0WDlLdPgzu11g4UCcBlGgIYL7NXTLih0jhv/LRiki3RcAg1oeEF7NgahH3E+Lii7U/yx9ew1ku+ISSVZRqcq8L/ttka57uJilAFeSVxIGkUYVe4lUrwZxb6/+zoe1AvNbaZkuKbo7FBquvk97rNcGtRoUzUWfVfsupmkM0jLf4TibJubQaPKJ14Tgmhl46McHpvKy9O2ifLS1vuC9yqTM4MiDl1a6+d+B8xOl63Xyv2LKa1LDmYcgQuTIFmhHQ57AHyO9GGD5uWgv1LfRKewglTaJdgpdrCwYyNM4VO3uLiMqqXXdFWVU0ZlSF/suRM7QE3k6tR6DNJ3t7bBysdCvVLHas1qv8n4Q+gjwksEwiwGR3qSrQks/p4glm8vlLjmdRgGI6Sg6BQDz1W/Np0qKzdw/drj2Pn8AtUvOSyR1xBq7861YitFGN1jZ4KikVNND5hY+iDFfHi/DsR6NsB5lTvZf/4150lVdWO7dPlsSjo+32Hwk6nL5i2Bp7mYMpovL3S0L3LUqaHmuW9Qu0MsPW28Rk9WZ1AQoEIt+gwDIhnfaJj9ORgTrjpa8IZ+ep0ylQBe1g5pzQJq02NgBO57r/vJ6h44A8Ux+tkSvtUF1laJ3j8IyzH5GzR0bfXH/h3XAjGv3kGM8upYHaoPeOq+hr6CM5lQO9kug/LUrX+2WuSJGspTKQIoDTNvM9qsm66rfRFchdVVsgcVvMhxNnZn0quNqqAx6QYeU4AdsmUqGMy6PtopbiAg= 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:(13230031)(4636009)(376002)(396003)(39860400002)(136003)(346002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(40470700004)(36840700001)(46966006)(7416002)(41300700001)(478600001)(8676002)(8936002)(110136005)(70206006)(70586007)(316002)(5660300002)(40480700001)(36860700001)(47076005)(921005)(7636003)(356005)(86362001)(82740400003)(2616005)(26005)(36756003)(336012)(426003)(83380400001)(6666004)(40460700003)(2906002)(1076003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:40.7431 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2730010-b993-46d1-eb60-08dbce30d9af 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9331 X-Rspamd-Queue-Id: 8A105140008 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 36eqrphrtx785oj3zj9aqci9xd8es6oa X-HE-Tag: 1697451344-473806 X-HE-Meta: U2FsdGVkX19d0rKOev5u7G93q7aYxjRPWLackfAwDSVPo11UaOFI5IAHawNQg471RPAOVEo84qn7xzUXxwJHDSvoqcPDOB2c3rawbUB4Bysxl/Q4GmZBlEctUwVscGUcEE3S1n0AuU66AaBmjLlXUmJWSvNlYPTiu9vsnpAHlt/Dt2GWNqUetCxgZUctthOIJa1dSe0yueZrS/hBxIo/skK8B88arpbGaZPt50IMe5uWtx55X6wqPJHis+4fBpQAN1OxyPMBW61HbzyXHs12ZRZIcPHM3ahpkACEeL6QeY1PGxDOG+z76jNAKZMArOcZqLMLp7yVPqQ57Uo4eD9tMuGG7qAm6wfPtNy2rvS9d4CRYt8bPKcsFkzU56aqUFYXRYQDQHuJ7BrgbYTYiK5l/Cco1hTON2Br0+8M3DbeNYWa2wukoPDa84cPne5l8iLd4B0Bz8TzroQ2n4KxG4mDkeddzeRRWPj0FukKvCvG6Outj10DXhR9oOn7PuxFSLFl5BjE1uCvM1Kjs3RQzMIkMSv18/dm2QQupEN8G73WbwPZYn/cSGscGUbcAzhQ4e1SKJ5JJN5rIafyRmimwWpNV86dwxhFYeJYj75OEO+7xbOSBefuxD9OI1bfl1NmMKvVpTNUPoLwgbJskfIA+UKG3lwiICnJoBDlroiaP94zBpVghmzQK3k6KLN1naiPH9ognktdym6vvRwv8FlDwTmUjV5NDNhWk4yQb7AiplxaeGZcD/u9cWc25MtZ4KcxY1gOu4RN1mpNufpIZdRhWSfPTQAyNNoniMFLUobktjIJ2GAnohRanaCVYQuxmCV0ujp9k+5YRVCW6Ra3DD/oc6wLnRDHwxVeLOPF5sRB2uGhFhNnzxYJlNNjJ3BNetC53vSpJaYIoEyn8mj4to2M2EQrwhGiMiFyfAwBc/U7d0VQIoQPVeJTivSYxZge/6/xpHm0vk/b36jT9Y9CkbAYw27 n/1PXdTW 9z/8dgefwRnPbmy1B1TxrHSP63b+EofRhktOqH4ouVXXnf/5Am51b++4vtCyAbD0dVgl03AdsB7JskTVMG2C1xlDhUgfvoux0DTiYg/zqbmTbi3wpuphh9JU+3qvRgR9w9gts5KPGQ3xFOmqUiFrsWCY0Dxq+oq7RxTlA2btw9uQNZtMvqWBN8217n+P+Cq+k7FJesoUkvAmLJXvNP8NumJjjZ3EAKS1QGz98WudtL7BtzsrbEA99+D/+O+ZTGPBdKt+VchSog+Z9SQWjmCRr0hgY1OIOHLsdbWp6/DyrRDA3SmgJq9XMBPzSsyZ7PETJBUWF6oyI4V9LtZEWFfh2nbwNYA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add helper function tegra_fuse_print_sku_info() to print Tegra SKU information. So, it can be shared between tegra_fuse_init() and ACPI probe which is to be introduced later. Signed-off-by: Kartik --- v1 -> v2: * Renamed tegra_fuse_pr_sku_info() as tegra_fuse_print_sku_info(). --- drivers/soc/tegra/fuse/fuse-tegra.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 4ebb5597a77b..7a93c6512f7b 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -113,6 +113,16 @@ static void tegra_fuse_restore(void *base) fuse->clk = NULL; } +static void tegra_fuse_print_sku_info(struct tegra_sku_info *tegra_sku_info) +{ + pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", + tegra_revision_name[tegra_sku_info->revision], + tegra_sku_info->sku_id, tegra_sku_info->cpu_process_id, + tegra_sku_info->soc_process_id); + pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", + tegra_sku_info->cpu_speedo_id, tegra_sku_info->soc_speedo_id); +} + static int tegra_fuse_add_lookups(struct tegra_fuse *fuse) { fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups), @@ -501,12 +511,7 @@ static int __init tegra_init_fuse(void) fuse->soc->init(fuse); - pr_info("Tegra Revision: %s SKU: %d CPU Process: %d SoC Process: %d\n", - tegra_revision_name[tegra_sku_info.revision], - tegra_sku_info.sku_id, tegra_sku_info.cpu_process_id, - tegra_sku_info.soc_process_id); - pr_debug("Tegra CPU Speedo ID %d, SoC Speedo ID %d\n", - tegra_sku_info.cpu_speedo_id, tegra_sku_info.soc_speedo_id); + tegra_fuse_print_sku_info(&tegra_sku_info); err = tegra_fuse_add_lookups(fuse); if (err) From patchwork Mon Oct 16 10:14:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422920 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A1D5CDB465 for ; Mon, 16 Oct 2023 10:15:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C256B8D005B; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB2838D005C; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A03658D005B; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 878858D0001 for ; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4DFE2B5E02 for ; Mon, 16 Oct 2023 10:15:54 +0000 (UTC) X-FDA: 81350918628.28.52E9DC0 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by imf01.hostedemail.com (Postfix) with ESMTP id 537A54000F for ; Mon, 16 Oct 2023 10:15:51 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tHd0OC60; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf01.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.50 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451351; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=vnCLkKiG3WoNwvXMTh+9d4u1aDhdbcmtKjbLuTY7D9k=; b=K1e82LUaQHQZtzJeXcqudOZprR5c/GsBIT16ZJ2sNNk185DgOO4+Kqcw/VT4DtocASJkGO G/4wDn7zLZGaKuszo3/M4zEtNPmzidxoGTWU5qxhDp28ZwG2OnLmd1RDbXGn4mdtSa8Qr5 2VdEzlTv397KW3RV7b4QaaZ8lc/cmRk= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=tHd0OC60; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf01.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.50 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451351; a=rsa-sha256; cv=pass; b=mu7EQhiqhcFa71ChOL4wUSgPT4fbksx81+fu0gzTtU5lnRKL0H6sTQo0RDr6GLnRmEdAUU j2iXkNMaVNv2X40NVKpfj133LAhHY4JA+wTn1F9E9bbsfUsWU5P1LpO3vhsuKTgi/Kxjx1 N8aFu2JNZMd+dgUG2cQnTTE1Vlj4Qnw= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I/2MZ6FdFOw7AM5lE2jSam/dD/SDRm3UWLSgK9cSY59Hw6g+SAh5DRSg+IdMPPAPabJkXTLr0hlv6PtyIogH9I5nrHK8MqoVNnk9maN7L/vaRwvzIM1LTsSODsO7YCmHbSprhOobOJOy1Ha984y0iWXRCnAMjAOxkeAbpWJH6L0ngVwNscwLYFbn9NH7COcf92Ho6+6wl7GSSLtPrwRqvCNi9RqkMW4gc33dR/IYyJH1IzlzcZ2u7XbJ96F2peQF3Q1vlqnmkq/JxvihIxb6zVpykDOKw8uqgxH14+X4OUrLwxBKMMe/f/DN/7+ZGBR/5ordIUORXwTtMzS/pNUfaQ== 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=vnCLkKiG3WoNwvXMTh+9d4u1aDhdbcmtKjbLuTY7D9k=; b=OZ5flYqwDa/8sSbjkh5fOnGr4CnUrVFI6jSx2Njt8Vj+q4ytFXcQTzcVfFAK9/wnFDqR9Yey9h4ktSdM9I5Rf91fbqxktd2qQ92QRh0Ac8CkRBt/jhmBoo+SJ6EB5543lclH4kmpCxphUAGD56ENAx+69E0eYArMq6tkfkTrM8bh4pMvLTfedxVO6PQiewOq9jJ9XLG7oXKBLfEVso9d5CghW1JzKmlfHMFnku0O9n+/rMEt82X2C97KCYZ6wiC2LFbcuRp2ozo2w5xoTFKDGps1DG6isDgITmlCjS01745ufVvQniqk3uVOctrLPUFdrXjWCtSZ9Zh48WNkZNyy7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.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=vnCLkKiG3WoNwvXMTh+9d4u1aDhdbcmtKjbLuTY7D9k=; b=tHd0OC60KHVezR1q/NyJVSMSvNuDQpHZ08ykri3DrJ6UOuQz785KPImKGV8OLyZXp8CUSFmC5omrbk16etiEpljljE0xsH+MBfFtsYWZ6h6mK8mbj6MEkuQLDPvHkvOIGVEIyrb/Wo2XDqHPzL5oq/2tex1GEgAzB+Tg1Ikt8v1U9Bl8x4vKLeW7wj4rl8ufky7mamgOfSP8ffyViNm4jlbnTUPBJIjJ+nNwaTFIn54xEjWIN9ulTP18beImHjsRKnMb2MCmkLBLOGy8Sm7djIRwTdrffnCTJ6hkHi3mUR8EK0r+uGIrKXG9luYRx1y9iU/9FATHr806vGTmX2ehDw== Received: from SA9PR10CA0014.namprd10.prod.outlook.com (2603:10b6:806:a7::19) by MW3PR12MB4508.namprd12.prod.outlook.com (2603:10b6:303:5b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 10:15:47 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:806:a7:cafe::18) by SA9PR10CA0014.outlook.office365.com (2603:10b6:806:a7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 10:15:47 +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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:47 +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.41; Mon, 16 Oct 2023 03:15:30 -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.41; Mon, 16 Oct 2023 03:15:29 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:24 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Date: Mon, 16 Oct 2023 15:44:35 +0530 Message-ID: <20231016101436.7146-8-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF000015C8:EE_|MW3PR12MB4508:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c74d648-26f5-4277-33eb-08dbce30dda5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DAJ48sWstUPNxt8Uo7a0vtRBzyzVJY4eYZ7ly+Qnndmu46Rh1A3SLW7Avsut8dE5oBQGKDBmq6wgnSwjDnOVQVLjf0ahkFdAKWws1Bt6zHlGsBnBCdcbKXaUfyQgo50S8w+bm1PILl0dkpzrXJhFw8RD5hiHIq4Qu9UAT1/DA9CGn8aJPHG5htrKtjgXEkICeOcy3VjsbDUcqbLPQfwsOA3qUZQHuH44pk69iXwUt+Ill/mA5pUdY39fz3xGruquG3o5psgVcLUwLj2IeptmX26nZ7D4Jl3H05+pypljLumpbUpW8lazA1FGLtySMMVPkN0RjoVVFaz4utecA0Uiqmp5QSZBhdXWEV/pdsCPSCPgLfsDek8ES9I47jpuZjDuu7OzZXC5D5d+V3IuBGMjIF2PO1EvCoYxxFpZTGbhg40BMdAz2n50IgSub6v2Vls6pVP8z1w2Y1Ar4ZgDsu7hZWHZLVOziu7fT3TIqutc3tt7VBNjD6o4PbjTNUe1z8MMqOAOYkRUKeTsaQvFrQMdLTuRoPhw3XkP09kkD7h7UxxTXQsrZxuIhLV/u1cslu1J8JiBYCGckUOFuGOFKTTben4xQ5yZNTvlOwmNOPiRcug2kkqh5IOCUZ4R9b2Ma5aH44/FeaELktKN3egs0NlGvFCPmu0iA9SDwoCTSAF3HixP38kBM9X9a+EFDqahljmXjaGi7OZUEvfpw98edH5EA5KwUX/0MBByQ69Q4mQtyJwfcEIlUheCDODgTtyZDqd1KDug69GGSOAz9Xh9x9wsks3g6B9rsI/3FrVDjdzVG1Nts2VrO5aOMXkYGova6jbb 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:(13230031)(4636009)(396003)(39860400002)(346002)(376002)(136003)(230922051799003)(64100799003)(1800799009)(82310400011)(451199024)(186009)(36840700001)(40470700004)(46966006)(110136005)(478600001)(6666004)(70206006)(70586007)(26005)(1076003)(2616005)(426003)(316002)(86362001)(336012)(8676002)(8936002)(7416002)(2906002)(5660300002)(41300700001)(36756003)(7636003)(921005)(47076005)(356005)(36860700001)(83380400001)(82740400003)(40460700003)(40480700001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:47.3994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c74d648-26f5-4277-33eb-08dbce30dda5 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4508 X-Rspamd-Queue-Id: 537A54000F X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: efhkmtw931phfds731aedbb74796ya9j X-HE-Tag: 1697451351-361865 X-HE-Meta: U2FsdGVkX18UsT51yrDMH//xkiVD/8HS4pWiYNaESzVfcIB8T65Wg1I1r0nrRY/F912KiB7wP1EjE3JwpqQG14n0wwBhkst9uwdB4y8FPs7QjFdesP8IAYYEZh/MBak4s+TADtmVQ+MILbizwdfpYFP3TmLhOkV625/LjkNBdKU9Kajfm7byx3BfKEbD9UfLKAwI60MfUzOjx0Vo7aPRwLQWrIRaMeII7xs+nJNqcHyOclMDs40+vgUjU1kvQtNNZ6eZW6PLsq9TgoeOPcZrZzm1Z+C4+ZXwQKKlTsaa3Rqu7tOA40ndabbQkRmn0olKfZbzJs/t+IabJ7Zs7m05tekoN/KfIblSDP+LG1SmfKttHOGUqqzx3EPPaQa7N1DUMrbLaAIFIlgvTzFXxaQ2HFbgqbdkvbyNMWpU5yYrAYu9pK99QdrZig4jdM8WNKVI2dddIa8JF8BXqXcnGQZkXOZ/C0umFOgw/HrD+M7knnObG2wim0Wj1EY0mwgr3IW0UAEkkqrNedvyRISfCXAbRHnN5ccsFVk8lIVn4C2aPKM4abjSpzm9wic/RhCnUzPf4lqhqNz5ZV2a+cwDz59bZpO4QQynoWoG7tGZaeniApfbkYqL89MIBgxmLIyxRKKjw+qDVWcDzOq1lTX4zgHUyRl42sJ6rUeGmu+J4/kn787moEPLpTa4G/cPnvY7MRkzxFDYZHxmxsPlO7FYsMeW5ERTOVCJ0/pCOt+Cb4QbSIIiFjrFTnRBbBOFK3J0ECUEFh7T4wW9yiiHLSHTGbD9Gh/aPLkTvQbbAiS0Jmca3RBogGO0CJStYNiIsCEPKU80q5EAvVb2wQ0TNLZcutexz+JWD0LvyurvIVvEPpdWcVRCXm3X4rIlOatIQbYesBLwHsFxAmeQL0A6k0xsS5Thob3wvsx3o0i1plhfhWdcIGxQ9Ear/v584NsZUqqy4GrNh8HGok3c4PMtRK+KZZ4 8MMCX5BN eM8qjSBsdufOWrlXczKjejIEZKK8oVDKC4RpDaJ/cZ0O9JEW+11mX7nlGtYEnKyvIB3K86ZNPpSwb4Y1k1gh/jE6bTV+mXP71KJhmOcEqG/ELoeqWLzIcKKITlbFUsIz4Gwt7WlpwlbwPQrayeMBWzcrDNLXiuzB2ehJrTdOefiex7zqWkkg3tZH0O1V2uBWgltNfxXr0ZjPeLAkhw4lXpn4JLe4C7gacGN1S0sSpDCaEeLtLW0vqFdlsQcfOL41SABcicvznYgWbFQKKq6/HPR9Po5pBbvJtSEHZDBd5TbstDnL+3OepItV502mY2znSZSZt1zhfJFA+ISB+n9zrlA+N4T4xqLr1BZQj5wR0qUbRHVbPux+lFcTrOekk03lm3Cx6U+1bruhglj0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add ACPI support for Tegra194 & Tegra243 SoC's. This requires following modifications to the probe when ACPI boot is used: - Initialize soc data. - Add nvmem lookups. - Register soc device. - use devm_clk_get_optional() instead of devm_clk_get() to get fuse->clk, as fuse clocks are not required when using ACPI boot. Also, drop '__init' keyword for tegra_soc_device_register() as this is also used by tegra_fuse_probe() and use dev_err_probe() wherever applicable. Signed-off-by: Kartik --- v4 -> v5: * Fix build warnings seen with tegra_fuse_acpi_match when CONFIG_ACPI is disabled. v3 -> v4: * Use dev_fwnode() to dereference the fwnode. * Add MODULE_DEVICE_TABLE for tegra_fuse_acpi_match. * Moved tegra_fuse_acpi_match above tegra_fuse_driver i.e., close to the user of tegra_fuse_acpi_match. * Moved the improvements made to fuse clk/rst get error handling to separate patch. * Moved ACPI related initialization after fuse->base is initialized in tegra_fuse_probe(), as this triggers a warning in tegra_fuse_read_early() which is called from fuse->soc->init(). v2 -> v3: * Updated commit message to specify changes related to inclusion of dev_err_probe(). v1 -> v2: * Updated ACPI ID table 'tegra_fuse_acpi_match'. * Removed ',' after "{ /* sentinel */ }" in 'tegra_fuse_acpi_match'. * Using same probe for ACPI and device-tree boot. * Added code for required initialization when ACPI boot is used. * Make clocks optional for ACPI. * Use dev_err_probe() wherever applicable. * Check if clock has been initialized only when device-tree boot is used. --- drivers/soc/tegra/fuse/fuse-tegra.c | 52 +++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 7a93c6512f7b..39a59545c93f 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -3,11 +3,13 @@ * Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved. */ +#include #include #include #include #include #include +#include #include #include #include @@ -152,7 +154,38 @@ static int tegra_fuse_probe(struct platform_device *pdev) return PTR_ERR(fuse->base); fuse->phys = res->start; - fuse->clk = devm_clk_get(&pdev->dev, "fuse"); + /* Initialize the soc data and lookups if using ACPI boot. */ + if (is_acpi_node(dev_fwnode(&pdev->dev)) && !fuse->soc) { + u8 chip; + + tegra_acpi_init_apbmisc(); + + chip = tegra_get_chip_id(); + switch (chip) { +#if defined(CONFIG_ARCH_TEGRA_194_SOC) + case TEGRA194: + fuse->soc = &tegra194_fuse_soc; + break; +#endif +#if defined(CONFIG_ARCH_TEGRA_234_SOC) + case TEGRA234: + fuse->soc = &tegra234_fuse_soc; + break; +#endif + default: + return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); + } + + fuse->soc->init(fuse); + tegra_fuse_print_sku_info(&tegra_sku_info); + tegra_soc_device_register(); + + err = tegra_fuse_add_lookups(fuse); + if (err) + return dev_err_probe(&pdev->dev, err, "failed to add FUSE lookups\n"); + } + + fuse->clk = devm_clk_get_optional(&pdev->dev, "fuse"); if (IS_ERR(fuse->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(fuse->clk), "failed to get FUSE clock\n"); @@ -275,10 +308,17 @@ static const struct dev_pm_ops tegra_fuse_pm = { SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume) }; +static const struct acpi_device_id __maybe_unused tegra_fuse_acpi_match[] = { + { "NVDA200F" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(acpi, tegra_fuse_acpi_match); + static struct platform_driver tegra_fuse_driver = { .driver = { .name = "tegra-fuse", .of_match_table = tegra_fuse_match, + .acpi_match_table = ACPI_PTR(tegra_fuse_acpi_match), .pm = &tegra_fuse_pm, .suppress_bind_attrs = true, }, @@ -300,7 +340,13 @@ u32 __init tegra_fuse_read_early(unsigned int offset) int tegra_fuse_readl(unsigned long offset, u32 *value) { - if (!fuse->read || !fuse->clk) + /* + * Wait for fuse->clk to be initialized if device-tree boot is used. + */ + if (is_of_node(dev_fwnode(fuse->dev)) && !fuse->clk) + return -EPROBE_DEFER; + + if (!fuse->read) return -EPROBE_DEFER; if (IS_ERR(fuse->clk)) @@ -383,7 +429,7 @@ const struct attribute_group tegra194_soc_attr_group = { }; #endif -struct device * __init tegra_soc_device_register(void) +struct device *tegra_soc_device_register(void) { struct soc_device_attribute *attr; struct soc_device *dev; From patchwork Mon Oct 16 10:14:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422921 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BDEFCDB482 for ; Mon, 16 Oct 2023 10:15:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DAC08D005C; Mon, 16 Oct 2023 06:15:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0652C8D0001; Mon, 16 Oct 2023 06:15:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEFE38D005D; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AD3AE8D0001 for ; Mon, 16 Oct 2023 06:15:54 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 8682D1A0BA8 for ; Mon, 16 Oct 2023 10:15:54 +0000 (UTC) X-FDA: 81350918628.23.AE3B8C6 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2075.outbound.protection.outlook.com [40.107.92.75]) by imf01.hostedemail.com (Postfix) with ESMTP id A151740015 for ; Mon, 16 Oct 2023 10:15:51 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RqDIbZdV; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf01.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.92.75 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451351; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3b6A1/4Co5BKI2JVzzuIO8+xdLoWsK1IncyT9iv4Tgc=; b=xvudTVayALk/ix9DtpherkICmRf2Xmun8FbdzMS8/3woZzoDb6pY2TdwCOBcCFrxizOkpj XLolynFEiK6w5HLF2jiwSzT8t4TTi2swEBGbENeRXMTPOjRs9VSjl1w6i+leSLpziPqDef 4mfKrLWzOUOs6XGbY3uKj+sWG7aqmg0= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RqDIbZdV; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf01.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.92.75 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451351; a=rsa-sha256; cv=pass; b=1HV2bUsg+nzSsiOPDrnUcyDtJFdcBFi3XYe+YoDBV349LwN0ciWNJsTv2aObBsNoMjh9Dh XFemZWCUonkaJQNtRnth1nrK3SX2JdKAoj4YdAr4CYQXXaExoecxVhRbVQCakzhYuBnkHW TP+xTRnY7Mk+WVdpQ7wxbEg/WP5wYXA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JEh/PCfLYBex2xQ9P3yg2SrM7VZ4pL6oU41VRbRd91FZ/kTr2nWYJB/Bo0SIck5t2bsmYDbKRTWvrBNwZPEMcRg/CJ4HLpbgO4mTwFxUAybDyz5RrF1JgX2UtGvXpI6Tm+peUIo9zrjFuKM9KGe609GE0Sp6c2F265rD0oiyyRug5CZC0/8IMFCfDMKVwt50EGXxMMhe5BQKhQwSFBmglvwuc3N7Y+QabvVaWOit5coNRmnSK88vBAjSxd++fFfjPXHLNFvkvcTmrfj0dyAh3jeq5clV1TjBDaxVl7Sc18HS4VV3xindaSH9dTrn6wDCashbNKsb1ug11ASsAHoD+Q== 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=3b6A1/4Co5BKI2JVzzuIO8+xdLoWsK1IncyT9iv4Tgc=; b=CySMYKHDMWXTWbiDfGv19E928BhKCrM8rETUm6GQYy2FeHVrowGvuKF25/NCfF0Ii9EJiM7mqZ7PrM2XOU4yhoRmQSWF3L7NGzCtX9jQh+nHdijub3Wb0t9dxR7k8X2M5dIJAJSYK1HtWoYplC3lZtCSwDRAfo9D8ka4fLUWr0olPz5W5wh2pZ1QBIsg7U3TtbNA8rYQwe+4uJ6YRukodKwcgSuAR8Q0vMf0QgoNBUzblwPgXw7zuiQmsRHbi0ARJmHvzj6vJP2gFmogyuYOuLPxho3+4Bi09cdOIzl1U03WF0/gsplnLg9oK2PStvR+aTEFx1kRBlom66HgpNeBMg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.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=3b6A1/4Co5BKI2JVzzuIO8+xdLoWsK1IncyT9iv4Tgc=; b=RqDIbZdV8u6euTRJ2wDzj9pACLWR4UMZdfY4VTm4hrgDBMtpNNjg2lJWGZl7Ky5ELdGIOuKxXoAknptNy+7FkVM+WQgWDtkbegV8mO/meNwbzdj4kbtbwomdle/eFhoaLngJNlMpuolKy2aRz6inMJBw1iphLNUTk4OO6iJcIT/qDXz471v3VcsvJOb2v/hm8fqICLuTi2I5F/FPLZ+khsIZvs8KCRUGSmGHv3YayHCIA1nLLIUyfckBx2SpIT8Kj9x7LtQbSN/jqEk6qrDorM5Aw2BiBp2rT6fV1fNkDlkgHfgeANO4Lup2ayZ/qd+nFgFDzPhOVj9vaovlB1sEvg== Received: from DM6PR21CA0027.namprd21.prod.outlook.com (2603:10b6:5:174::37) by SA1PR12MB6920.namprd12.prod.outlook.com (2603:10b6:806:258::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.44; Mon, 16 Oct 2023 10:15:48 +0000 Received: from DS3PEPF000099D6.namprd04.prod.outlook.com (2603:10b6:5:174:cafe::8c) by DM6PR21CA0027.outlook.office365.com (2603:10b6:5:174::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.2 via Frontend Transport; Mon, 16 Oct 2023 10:15:48 +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 DS3PEPF000099D6.mail.protection.outlook.com (10.167.17.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:48 +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.41; Mon, 16 Oct 2023 03:15:36 -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.41; Mon, 16 Oct 2023 03:15:35 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:30 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 8/8] soc/tegra: fuse: Add support for Tegra241 Date: Mon, 16 Oct 2023 15:44:36 +0530 Message-ID: <20231016101436.7146-9-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D6:EE_|SA1PR12MB6920:EE_ X-MS-Office365-Filtering-Correlation-Id: 35501aed-6597-400d-cabc-08dbce30de1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QDjo7XemUXDn1njIO52G3Bz2qvTFC6LSS4kEaKaRrs000AJSLg1u34Ek7G8rPPcEKg9irVtE1x1XLUoT62BsITkmoBFMQpjbdvZCqN2VKFLfyww0W0vPxJv2gR5ZjtEMH7T6SUHFkY1q4ftQQv2j4kEiSWhiDHgRQPhUl6i+JQ5eSVlwiyn32RsC7EsLPeuzlPj5wP46croWSYZAQq0I+6wJ9L6nOwg/pfolDzJ8FBkYzSpRG4B+5/2UXA2+qH/ILmbm8rn1NDGBzy3txxMmvn4d9epvBY8p/kITjiVozjPURDoFdzQWO0MfUZn6CJ1TuxHrUQZVa7jPfAoVZ0Sc55ZqIsD8JxieRTCvpISAe2dw+ekrlsrcmSZaplPdOI2B9mAM+HEWW42dwl2cpaqTHQosBsvfhZqzxWDI1NyviLJVBFqn6jrsY9OidJBnRPurOwYE9X44wNeinpbBbVc5DW1ZhGkDgagOyyYylcHwlg9HHACrUPh/1XwHos6bICDBbEDd7e00RYslVW3kYbZ8ifnH/+XzeXWX6wA+PmMIOg7fgcLSTVT5rvli5mvhvWqAbt2VDVNB1+HLkZpc/DDn4lZNMq1hEqX3k7eD9Sot6mU2Lf3FN1BVZjH64/6tNEdSUyeKr9GjEQRHUwlXELJxDoZ+uL4RodEdnDaOgkKP37BwSdRhM9I2bxqQ+osfOdso6C/7/sTSC1/p8X2HYRNFvLfru9npEbHfqfJJCRMdvQgIh+3cyYDcNpdA35OvwknrsAMYNDieiIwdShORrV6lqF3aReaQpZER6R9J7LrAjuCqekb7eAVXtwcOkEo5qNaG 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:(13230031)(4636009)(39860400002)(396003)(136003)(376002)(346002)(230922051799003)(64100799003)(451199024)(82310400011)(1800799009)(186009)(40470700004)(36840700001)(46966006)(82740400003)(5660300002)(921005)(8936002)(356005)(7636003)(41300700001)(8676002)(40460700003)(86362001)(40480700001)(7416002)(2906002)(1076003)(36860700001)(336012)(2616005)(478600001)(26005)(36756003)(70206006)(426003)(70586007)(47076005)(110136005)(316002)(83380400001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:48.1806 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35501aed-6597-400d-cabc-08dbce30de1e 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: DS3PEPF000099D6.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6920 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A151740015 X-Stat-Signature: uxewuboc8y835jzrsjt8i3iu8guzpn1y X-Rspam-User: X-HE-Tag: 1697451351-972298 X-HE-Meta: U2FsdGVkX1+NpS2SPmCy0c9a5UKEUVXhbYHuI6P+v7/ljLq3VmoWktWqN4YBEKNvT09aSyw7n9Kg1/8as6i9KQHyKidtshY2caRxeIkjh05aHIv7/PNW1ZSaysf9yc5udU9uiFJ5OOj7f/5TQbBf0hWLbvUMcUz6F2l/rN5aP7f0ofINqKH+HrZD0PJv2+JZdAcYm5XQ9vp7Y/ORqAJab7Rrqog4QFsbZCo/uSOX/YOvmDr2i0EzyFnLde0EjrrLobavun/1IFtyh+TegxVM3ErmqZ/umeTJwQviFrDcODv7Y7gQ8YNRQMJFQAR3ysdSI2EIxJHmNng2AoFaERB+PXiyP/buB7ryvn5F5Z1F7kEgX1OV1P5HGgvYelV3RMvZ5dMVQP1RN2EMBBW162EX4LR1Evdd3GHAtDnY58W93faS0uA8/yJMAAKzETZdtzpBop5N7JolK9IqwoAZDEd1FwSH+AAjn2K+XzjFd25rTKTVO2hnKoKVT+YHXoBjt1bkI+3mUE/JlIhTcp17UKEE0vQaY0Qi4gL8Ui71Sy+uw3n+mYzIg3q70FaTBGR0BDCHMV6ZMh2z8OsXhg72NufSuHWxWFZZ1PMxoph5z2jPDCnO81NuJmP+2NwMVHAlRHWU3koSA7GmUVtivgMfYVo93hv/lkOk4G6m6mBOqm+NxdHKupXZEuBKRwT1oGN7yDnd1wOWqCioxKBd1Ot2/HsHC3OyO38xGGs17bwgDlLbi261B/nIlTI2kspPxCRaDNqtFYcMryrdKTJIsmdNEJyUxajZt+jWEQSN+YoNyaBGKULxHvyezONjNxTjcwyof7ccS5FPfhiAns6NUd5iiQwCNd2k2e0VWqeDq45RYXtgS+J1Nb/PG5YLbtR+u1XuR6H+R7WWTaAiZQmhaVl8igWSnZsYyuZsbAZDUu0SMRhKwdw9Tmf8A2AbK0iSvyeY/XZBXHy3xCTCpzXhUtUKEw+ h/7n5zH4 DOklBxZoaaGkflDCoDP7lSwDloTH20RPwjqYXvipapl/TDY0q4IUnfuz6RVxEKTVAPs0cIuuRt+QkRe/Bgwi73VNNXyWz9Hij1LopOPmtBbegeuwQAmjEeiX5PvEKqrM5VXpQLxDctXfIXuu6CzMjzWHysb/82wXky9VOjBSdrqHu12iJEt/+4WVE/IIEhH2WpXJYX2hiOJbfA27SVfaNVCg8XAjwZlkW86cF+3xviOVKALDBbO63IxQ5ZhlyQhaK5s7UIzPyp7B9lEd9Zd6qKsxf5jh3jiMatQkacT4s8AJdmrv/PtwtGMBOljRUiWTZ/uheZ+2TJ0IiMDTgndEACosCcQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add support for Tegra241 which use ACPI boot. Signed-off-by: Kartik --- v1 -> v2: * Removed few entries from tegra241_fuse_soc which were initilized as NULL or 0. --- drivers/soc/tegra/Kconfig | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra.c | 5 +++++ drivers/soc/tegra/fuse/fuse-tegra30.c | 20 ++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 4 ++++ drivers/soc/tegra/fuse/tegra-apbmisc.c | 1 + include/soc/tegra/fuse.h | 1 + 6 files changed, 36 insertions(+) diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index f16beeabaa92..33512558af9f 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -133,6 +133,11 @@ config ARCH_TEGRA_234_SOC help Enable support for the NVIDIA Tegra234 SoC. +config ARCH_TEGRA_241_SOC + bool "NVIDIA Tegra241 SoC" + help + Enable support for the NVIDIA Tegra241 SoC. + endif endif diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 39a59545c93f..240846dd56b4 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -171,6 +171,11 @@ static int tegra_fuse_probe(struct platform_device *pdev) case TEGRA234: fuse->soc = &tegra234_fuse_soc; break; +#endif +#if defined(CONFIG_ARCH_TEGRA_241_SOC) + case TEGRA241: + fuse->soc = &tegra241_fuse_soc; + break; #endif default: return dev_err_probe(&pdev->dev, -EINVAL, "Unsupported SoC: %02x\n", chip); diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c index e94d46372a63..2070d36c510d 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra30.c +++ b/drivers/soc/tegra/fuse/fuse-tegra30.c @@ -678,3 +678,23 @@ const struct tegra_fuse_soc tegra234_fuse_soc = { .clk_suspend_on = false, }; #endif + +#if defined(CONFIG_ARCH_TEGRA_241_SOC) +static const struct tegra_fuse_info tegra241_fuse_info = { + .read = tegra30_fuse_read, + .size = 0x16008, + .spare = 0xcf0, +}; + +static const struct nvmem_keepout tegra241_fuse_keepouts[] = { + { .start = 0xc, .end = 0x1600c } +}; + +const struct tegra_fuse_soc tegra241_fuse_soc = { + .init = tegra30_fuse_init, + .info = &tegra241_fuse_info, + .keepouts = tegra241_fuse_keepouts, + .num_keepouts = ARRAY_SIZE(tegra241_fuse_keepouts), + .soc_attr_group = &tegra194_soc_attr_group, +}; +#endif diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index a41e9f85281a..f3b705327c20 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -136,4 +136,8 @@ extern const struct tegra_fuse_soc tegra194_fuse_soc; extern const struct tegra_fuse_soc tegra234_fuse_soc; #endif +#ifdef CONFIG_ARCH_TEGRA_241_SOC +extern const struct tegra_fuse_soc tegra241_fuse_soc; +#endif + #endif diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index 6457f80821bb..e2ca5d55fd31 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -64,6 +64,7 @@ bool tegra_is_silicon(void) switch (tegra_get_chip_id()) { case TEGRA194: case TEGRA234: + case TEGRA241: case TEGRA264: if (tegra_get_platform() == 0) return true; diff --git a/include/soc/tegra/fuse.h b/include/soc/tegra/fuse.h index 3a513be50243..8f421b9f7585 100644 --- a/include/soc/tegra/fuse.h +++ b/include/soc/tegra/fuse.h @@ -17,6 +17,7 @@ #define TEGRA186 0x18 #define TEGRA194 0x19 #define TEGRA234 0x23 +#define TEGRA241 0x24 #define TEGRA264 0x26 #define TEGRA_FUSE_SKU_CALIB_0 0xf0