From patchwork Mon Oct 16 05:34:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422498 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 BD847CDB465 for ; Mon, 16 Oct 2023 05:34:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 588138D0040; Mon, 16 Oct 2023 01:34:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 538278D0001; Mon, 16 Oct 2023 01:34:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D9698D0040; Mon, 16 Oct 2023 01:34:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 2AEFD8D0001 for ; Mon, 16 Oct 2023 01:34:35 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 030B9C0A99 for ; Mon, 16 Oct 2023 05:34:34 +0000 (UTC) X-FDA: 81350209710.20.2AF4D8B Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2065.outbound.protection.outlook.com [40.107.237.65]) by imf08.hostedemail.com (Postfix) with ESMTP id F0B7216000B for ; Mon, 16 Oct 2023 05:34:31 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=bzs6M8Zm; spf=pass (imf08.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.237.65 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=1697434472; 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=cj1FL9bY1+E5VkSXdHtmUFBFoFzAO04Ti2E6Y68ZqkHkisjGKL3L+iNRElV4X8wj197utK IIJ4SqRxddviBmlQtM5czChCAEO3+6VzLycMoC7r3vnJdyOg1GZYgDnuZxrGoFC9yPi7bE gWgLt/nEr+Um/B6Tgvywvxrw/xuGN5E= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=bzs6M8Zm; spf=pass (imf08.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.237.65 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=1697434472; a=rsa-sha256; cv=pass; b=cmab8lU3kw6aLpNYnKo9CHURfAuhRArA68yImZUmyUgQET8DGDjZjROwjs8+H3Eyin9AcZ 9PHiDOj0LYa5ZrPiDA3VoEms3H+QX6RQt6COwz5BwU9rJI1ewfbFLz13P0b2muF3V+18d4 2VzfhahMS+nSQbka3lXpdeDWuNHuxNM= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U1Q7QKa3ruGA4rmvraQ3lEADNcz4L4ojGZBMA+o+rPKjDiP9Iu0WzfePYKvtJiwiscxIFu5ifauKh0H/wBURCpFfs0upOHQaijoZiqavPRGDRYrRc2CyFlnTGyYAzutzGLrcxqAGM+yzlYyLM0XrLpu2WMKCtyA4O5oWBLdK6v58qKp/P+xEluugswuaSP5U0JhsKrZVgKXKevkFVpq8+LmgZYeFYrHA3PfEIJX5WaQbKEjUujXSCIBoASymquAlWoVL4MRLe30nqMefYa30wGvkqCercKFFf0s+jPDdcz0dhMgNkqbi2pyOPBhdeqjzLRzKL9JJRobQjIC8PClNbQ== 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=jOAv6Sa/y6ZcR6GtwSFoK7BDPpveDL4sMoTLRa2nt9Oipm+MgNG5uXn1785zE3PBjo/ud2oLkUGlEnAalvJe590jw3flt61qnFvl7aGVLpeWzFUZMZP4HQJ9UyvlCjzRl/f1A5GIlhc3FQwO+eaaqCtwGhWukpMbgckrr6Gyto82Yb5lwVlNJd89DKOQPEHRmY02GSNRIyHBjtCU1J/US+WJXCW+kpof3DufvNi0Y1gW8TMfg2HFDUv0uclXLd5iRPrSLPkfyM7xasX2KkdSNduxiMvKNd/PKk0g2uHwgZ+bqwQAuIIG3/lqK1i7xYBHjm5z/C0y1S0TNJli8JnzTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=bzs6M8ZmSTXtpaf2Dbn2lIBvo4bUQnkhXy5C1y/l8bnyhhenWd/VSA957oQSDpK9Yl+Q5m482dhTwEPcFu3UeBu8fet20vgwo8DwnJuaUssBzRsR91DLaz0rrFWJLmVmMfGqYbpu1LfCp5h7fi7cv2peur5p40cEeybTXBtq5yJtjICkV3sV9bg6KWM/a0HjPbbfZvW+iNkiDPKgYtIR6RPXd3wfbSgdGIP0PwLYPuBjfZxjmhAOQNMgAEh+sFJunfBnRaJss2LO69jrdUx2ibHtyPBTXgdFfLb5MJwFbthEholgvxH5TEzOafHBJUpyxn+gxdqMij+W6AsNKEPDfw== Received: from SA0PR11CA0079.namprd11.prod.outlook.com (2603:10b6:806:d2::24) by DM3PR12MB9436.namprd12.prod.outlook.com (2603:10b6:8:1af::20) 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 05:34:27 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::79) by SA0PR11CA0079.outlook.office365.com (2603:10b6:806:d2::24) 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 05:34:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) 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 05:34:27 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:26 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:25 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:21 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 1/8] mm/util: Introduce kmemdup_array() Date: Mon, 16 Oct 2023 11:04:04 +0530 Message-ID: <20231016053411.3380-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: SA2PEPF00001507:EE_|DM3PR12MB9436:EE_ X-MS-Office365-Filtering-Correlation-Id: 532511ea-9c7d-4680-11ab-08dbce099082 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JIqjJSYk9cle5q0KrE6X1zbwBG4mHKYoAsBFKjjGY9LvyjaNaHf7jYGmx2rPwenjZilMZYZwqy3hPmJYZ+E1psL6VD0h6l9gc3NZ2nrkktG8Ma9ZDAGeZDamkcPfDPMr/Ggpf6+hSARsTWARpXoVbeUS4ZYnFndqKC+dDYVU1iy8T3WZmIJIe/KGHaeq+xWybOTCwuduHUBDbU7Hwd4wAQXQNMAi1Jh3ZN6ESlb5z/l+BAOF1a8v8xFLURYSLaEEqhYP4iYJd2L23QqxJCyyia8n//0NCulUU1jdARDHlSP8PHecWcEekasLdDCIAc5OCxwQX3X4oKX2liLnxrqkJJGjGO1vkFdlLbSk8PbAJ8U2xXj63KL0ZAhMc0qlkIZnBPQ6ScSxbzie8asew6eSgxXS2wIIKCP0jtQnG7ypfVzlRRkWkR4rpw/yeNpMIjsPW9uMavtu+3xyDZJTTIoM/SYfAFbzds6gIJphH+3ilTxJiuHZe9weKnv9nr1dmC/AwhP/1HWsEPJ9H9RWX9PNyrgN8qfwxffmWUm/Yvh0PpJ3iQzT9PL5l7J2wV2P6rkZwyrYgV6zjexNNsZRmsEy/muknAWG0SFRRecNhT+9M3CWF0eJ6uLzIAUEITlXNMpzCGl3AE8LMuM7UKTgE6N8hFRx3YoKtIJCltFS/XnJ6/yWM3v0xBuQSILXqSseYzcRvrSg0GJp1VzubKvX0vmrByfn6e/VzuYebmzM/IQGISwo5A3w/lHGAeNwzykHl5Kw0Jw1suRn0AB3Hl867d2YTA== X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39850400004)(346002)(376002)(136003)(230922051799003)(1800799009)(64100799003)(186009)(82310400011)(451199024)(36840700001)(46966006)(478600001)(426003)(70206006)(70586007)(316002)(110136005)(1076003)(2616005)(336012)(26005)(6666004)(8676002)(8936002)(5660300002)(41300700001)(7416002)(2906002)(86362001)(36756003)(7636003)(921005)(356005)(82740400003)(36860700001)(47076005)(40480700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:27.6121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 532511ea-9c7d-4680-11ab-08dbce099082 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9436 X-Rspamd-Queue-Id: F0B7216000B X-Rspam-User: X-Stat-Signature: 9gdecebi3bb6ute8h6n4xhynxahrkmce X-Rspamd-Server: rspam01 X-HE-Tag: 1697434471-39012 X-HE-Meta: U2FsdGVkX1/veMN2YXwYEGX/xgze1JCIIlbTTFWmSrY20d1lOsFUZa+8wmlNTe7dv8nAeH92aEUmulTDDoyHHdn41MRavNKSgUd48aA9nENENTuWiCPCBDzb+JtsF/W9XN3HHGZ4ggc+xUog8XHQVPlJBSsh4YoLCMRIWRRiWLSoXnZYR0VjXTjUzjYgtNBIiCpEYi0BMCyajF2ylk4ODDqVTnqM3x9de3rCQD71nsFYxjooZB9T6V4gqAcrF0VnGROfzMwLnJqV12QAXDWlnDess7JqNOswhe2oRLkwXu/u8iyJX/JxuIzLNc8Pz7NNkjokkMqb8B+xiQ63tJnLU+fDQ/s+trBCE6x7M/a9KpUyYbFceFW/nTldH5DmhBXs3075WkNuBzKUdrzvQebHSNlj1wnTeOoG1yYKwzkoO9VnjTPe6T/66hqIMzRPAJt/mxNzGqTOxMSKGK0pgyLNNmuUshC+26BkiRMMtFcRCul9P4h+yL04nlCxgd4s3K0rrbTt2VtiPzuAcq3434NgQIrTResbhC6kaVRKl+Q0H7RssaO8puVLod4z5TR2VmXYRUWA2a17xUObxz8ioPhyuWuiw7tVfbfImn08i8onBIZsmqU+Mrq7YVgqKl7/xAIDTgJdnFoXWiSDx7+/g6SDwb9BxeQVpqIebGQCkibmbxCz94/JYsvbavO4pd9qzpTjK/zqON8Ih6umZjOxty8YlhNAiLIGrH1RQTRhfh70+7ZINpmgeOsY6FdZRmdS1gIDWpjm+YVltalWZOfXNDtccIQbEi1JpiHqQLMkZ71mqlTuXpCNA392jDeZfl3nw5niVTHAsbtp/wwCVOhMfedMc9/m+jSr28dGL1S8bttn5Mj0eeVd5+kdlN8Yz6tVNw3lpu+iTc3O4LFB6dqicTSgkihmGJTJOkqM3Va5CL/8+5LLSymyeBKzQ1Y0b2zE8BpRNrLzG7Yz0B9YXSpu06B pbqBjQs3 eCnDLXVtSTrg2hTdTmkU5PY/y3skpa0AwyCs5yZHg4daZdYn/Ggd9WE1YjeKES5+lA+qCHwz04gQhJzdeaZE0PxbJfbNdXnUhgIqw/8k1BCAroJCFUoPl6JJYLUVasVOrewxpoD8OuGNzEIPZkEP2eLtQhxY2s1qUTYIHSH8w/2MIEzDxXCfl7kpWDtT9NjZo5DbtW7y5a7EkIngU/kpzC4071TQH/JLNJlOW4YZXwXpRF9+xyOJj+2L+nCKZB9A/yHcvu+y7l8nhf6We7cS6c5+YUC6S+XG61URFNIjUxioLO+grMaRD6chwyDCblgqYLjdloLK8/PSYQY49UDWw+51RgNnTfiTRkaLsCussPD1gRVe1olfbmUODHbzUA6R2j/X8 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: 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 Acked-by: Kees Cook --- 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 05:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422499 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 A6436CDB465 for ; Mon, 16 Oct 2023 05:34:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 475E08D0041; Mon, 16 Oct 2023 01:34:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44CD78D0001; Mon, 16 Oct 2023 01:34:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 314F78D0041; Mon, 16 Oct 2023 01:34:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 20D988D0001 for ; Mon, 16 Oct 2023 01:34:45 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F29AAB5A1E for ; Mon, 16 Oct 2023 05:34:44 +0000 (UTC) X-FDA: 81350210088.28.4C1DF82 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by imf24.hostedemail.com (Postfix) with ESMTP id 001B2180010 for ; Mon, 16 Oct 2023 05:34:41 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=e3pEKWdX; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf24.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=1697434482; 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=UjJJwuo9EIzEIDhWTVSod58DAr4i6C37uqgLDLc8pGDwojylMxNs4ZmHdKRdmMk54dbWdX ypmzFwoDfmYYdUCwPIwrp+c3D0iN5WjPCMKVdSCgEu8DmKCjelsBHqTGpa/wCg884KkXnF iOe1yUa+JDYKoPfvhiOX9cA0S8E0aSc= ARC-Authentication-Results: i=2; imf24.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=e3pEKWdX; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf24.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=1697434482; a=rsa-sha256; cv=pass; b=aRVOl5SfNqb5DCqIaEKUN2XxqSRdzy9Iz9m67ULIHoglOvbaAdaFJCoF7T7cMrXITwh4J2 apUoDeqGA11/vAUFL67N59jrHnoWnxz28HjFZpgto/0hYE1CxD8Zu4nA6By3tJKgSZaG51 /kPzzgZ4hWppdhjrMKliRx77V+qoY1Y= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QDo9/AomUqjuBwCcgb7TGRfhKQVklWGtvWosxgBMrqrTDr//7yrUcxRDIyFKhZeEao4Sw1pTq6O/YYg5avjXM+nJrieBJkzsMLQQndSdtKaOstpAcR9esaB+jSPSyLLViGyV8ejrNSvxzuN74402kY2w5HEHIFDyz/cZQN6uCIfD/zemkctQixoKVt6OYfNMftL8e/pTNtZEJK/K7tV5krQ758il4Cve38oyiVZ/PZjU/uilWyoN2sIKhOY2+uRtF1H08rPcmcoXpW4Zh1rkSGUICtZuL5dew5RzzA5NjrCe1KLp5QukjEFomXtRkUQdOnZxzaBcnmiCuLBYyKu8Pw== 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=ApGyS4WakQlUTpPJXVHshZLenAWa22s4GGKtI0L6VrvWShA2Zp1SQUToxW8gK2MzDfWXPU9bO+0lmaUEpKxJgfkW4puTI+bdgdL3whZESuyUhc6cLHGTN7k3fNW4Dt7U0jE6AojyzhMSif4kdbkXUACQBGD5Naz6visB16r3zr+W6UbGzBXlkPWyAiS/8ckOSFLlEjQlvuImhzu6TuvDB0us7ZUqKHBSzPniKEevy/pftlHc/TmxBYeq7hbhNVZI50ldulumQBibYAt71asuhD3pZ/vFE0HntWD42LkbEbi/LX5NXTCCBBQxEEmLiHtKGMWrYdrc+jwRJx0TBqSvLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=e3pEKWdX4tU+8OqD1qBIerNVUWoEMMg+QfpTUtxvJl49A94xfxs7YY+AzwRv7jQNVKrHg7cPionjWpy07NR/gok6ZMXT0gGoz2SJJKaFh6fu1Qudpl50hHVuHrJoFkPK8sBkDpsPdMpwzSdqEa0929DOAUhJv5HE42L+kvBazInsBnHIedAIaMYn+XCAY9nCscGxa5CaRj62+sSmrwiCeAfkdMzwfb9KksOrSnLCvdcUqdyQcRrxicRBlCrNOvnmuyF3EhgKYPXEG1iJvAohBuMg4rRsfMyURfItsgyjhurtsO4+rchlgUUmSKaYO1SCTPDNIOyKt2mjsPMSDKMbHg== Received: from DM6PR06CA0021.namprd06.prod.outlook.com (2603:10b6:5:120::34) by SN7PR12MB6814.namprd12.prod.outlook.com (2603:10b6:806:266::6) 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 05:34:39 +0000 Received: from DS1PEPF0001709C.namprd05.prod.outlook.com (2603:10b6:5:120:cafe::8f) by DM6PR06CA0021.outlook.office365.com (2603:10b6:5:120::34) 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 05:34:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF0001709C.mail.protection.outlook.com (10.167.18.106) 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 05:34:39 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:32 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:31 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:26 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Date: Mon, 16 Oct 2023 11:04:05 +0530 Message-ID: <20231016053411.3380-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: DS1PEPF0001709C:EE_|SN7PR12MB6814:EE_ X-MS-Office365-Filtering-Correlation-Id: 9739b100-a834-49b3-0c20-08dbce099784 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IBRKZELZzpFH10UvxHe0vEgypkH6Y911Kk0BctBFcXGaBZI5cogSodzvd4yCqrGBpk88KK4qWgmGDi7JeUBhWLHM00DZjVOX5IA+w0wc/T5wfmZB1VDfWaTvUqouGUuZk/GwNArAiSaVWU01hX0Nxd/B37bpyO/ZvKSC6VIpIRkns2K1C4rOcBdt5MwANFnf83oYhSJXoMq8OlO3c85HPestrOBNfKNi4dCetlUALD//aO3frin/l4KHshYgnB2g+s+2lBii6avVhM7iHOgb0JSBTG0WBGEtQ3cL+YzoT8To3Y6YSm2vHmDMnnAxf68u9CLhTWlkiSRjgbBYcaIUQnstiMBe1fFVAZhOPNfBd+iE8+gdLF6OgXiz1Zwr6vk82rzluqjjx8qbn/fihRvwqTaWdr38+sCXw40fhJW08b9ddCoIK3kLZPsH5BeWcWJ5kbBUMUqGmdkpCNyxsGXe8KuTy/Z28zA1+W3Zj29ZfG58zUGGomvco9hxhUbGLAiLSkAh7/BOI4BifO0VF1y5+6E8ntx9eEoLxKQZm8jg88jlwWYHddUpth8shT5KmgpswNBKJ+gtetXcvDmaabyI0sKvfToORdhGJ3ThlRXA48dhsP7heVRlE9CaXFnbpnYXOUImzMexKt12zr/VXY7nAJqrkgd0HVKU2SsbY7LhqFGYSI+q4b6LKQEQJqDLBEKqXh44Z2NT27/CyAp2WCndjWuxCOyg2RAfrT6mgCIna6A8R0Nibjf6wl19k4NeV8j8dnXx8EAorL0zNsjzbqLI2w+iAlhOjrev5VIDiK9cPtM= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(136003)(396003)(230922051799003)(64100799003)(82310400011)(1800799009)(186009)(451199024)(40470700004)(46966006)(36840700001)(478600001)(6666004)(70206006)(70586007)(110136005)(26005)(1076003)(336012)(426003)(2616005)(8676002)(8936002)(7416002)(2906002)(5660300002)(316002)(41300700001)(36756003)(86362001)(7636003)(921005)(47076005)(36860700001)(83380400001)(82740400003)(356005)(40480700001)(40460700003)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:39.3691 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9739b100-a834-49b3-0c20-08dbce099784 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0001709C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6814 X-Rspamd-Queue-Id: 001B2180010 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 41aq18hweykw1ge8g94six196i98w3xr X-HE-Tag: 1697434481-60739 X-HE-Meta: U2FsdGVkX1+mLKbGlsC4Mwr93u8APV2+Sir3LTjWC/TsYb0zc0+Cg2FEbzD97XMBjuIE2CcbJwhDHiJebxCVBfMXbXz+4fX9eknI9QGRSJ1m2YhLVlriijx3MWcUeySWDUYDo2MiWzFHkPCqx/rcHCtNElaskmveI5fpJNPEu7jdBoi3havf62IJkZHpDIG+3RJirweb7h83bncyc2mvEHXhe01qDIX6I8gI9BNPku0WX2HQ1BYSxUUD7EB+aQ31L1oh50AaS4Dmf0m+zQcuhOiYaGgFt0E/v4o+VssNPg0IHnv02Lmr2EtSsAZxGFQ3+PkY9Cnqap0Dl0MU0qFNsT5Gwy1bnZ0NFBiHVolds6JjIxAEKt1WhJqSJln5fPGJM/06+njdKeY6hcXQRE5zyUt9siV8BvNn8dbiTM/QiutqV4Vc5JDV6ilsAs5H2ReZuOjV4mStTfBs6wnMzy401Uz5/Wqh0Peb48WzO0egoS4r2mvSCdX133FsS2qxlnBTIV7C0UcKiqp8XD72f2paG5V+DtIvokCoLHjiMb4icYnQQuybtOYdk61uQiTUxYw4GjSoLdO/gSWE+n/PRw9VP8nn3r7iLoXLRKsml7y+9IJwztgWi5N8+7i4ybP68SpvzEHDUAf3rGvCC6hxq9qPbi6pRDV2NIWtx4XzxkCgWwxNgbXenyXvkuvXVq+Pg5hIrFCFuQxrNp+VQUWl6dj9IeoGocH5pHPSoqfKPosPuIyad2d/qgrsyt2JSt5CW+IEK/NTbMSzAle2qGU8cwe22kraQ5D/VGhd2hLK5XDkktkIuAev+eZhZXE4S5HAYLNIeLTVWJuq6uDbr+2DrvH7memqz3Xw9A4Uzc5wvBPlJs9M9fhrvR+i6bS1WFvhGyB7joEX+UHxTMvvqrjMajhB0ALAbx+zKdPhn2ncPNqz1AtGDjkMIcCmNrqrqGWHjOS/ehuDFIonXuZH6+sj/OS JbANgPCY yEZ+ZH/TyYdPXvwpMFFHp5mygSOKpcWZxVMj9tGznndBUJn1SUtjF1ZIuRS6FXw7Fe2tMCRrfedNijV53ZO4Xu1HldaAwN9xhaFxTiUVB3wXRsioi8gq9UjyO8SnB8DS5F3Q+W/G9+4NMZRDWL8L+Zc8F9ZJUbTa+NgeEhWKbDRK6hjspz0SZMQRvxqXthwr+1oZIczLmTWIQNampWcDXRafeI3JKEwE+gSszzWG7Tdl3Nqffftk9atucv2ixEOuWBxSLQW3/xVZlh1l6eMsVZbBqRtC8kRbxYCp6Q0tr2c/LtXU7e8VywdNhKH8nHjloPxS95zjrBxjIvVEihNQCS+AvEBvSAlTuoSm51zwvg6IxZ6TRI8Y+mZGDSV1h6tTSU0yi 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 05:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422500 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 2846BCDB483 for ; Mon, 16 Oct 2023 05:34:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B545E8D0047; Mon, 16 Oct 2023 01:34:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B04748D0001; Mon, 16 Oct 2023 01:34:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97DD78D0047; Mon, 16 Oct 2023 01:34:47 -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 844E68D0001 for ; Mon, 16 Oct 2023 01:34:47 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 55357120A72 for ; Mon, 16 Oct 2023 05:34:47 +0000 (UTC) X-FDA: 81350210214.13.57EFAB6 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.61]) by imf10.hostedemail.com (Postfix) with ESMTP id 52DCDC000E for ; Mon, 16 Oct 2023 05:34:44 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=K+GhkQxb; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf10.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.244.61 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=1697434484; 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=htVXazHxCZWwyNvc1AUmo0ch/SyvXyqQqmMCM4y02Ie9vcrBK9dj3aeOFjaYOa9Dh/Pb2v nlqryehfl5L0TuDuJKXyXlPAmc1HLhVHdewv1WCN1Bcrbw92F2bGARLxx7oZ/L8WJOF0uN oSEF5/XqZsM9+etqzFxWjFMDjwitgUE= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=K+GhkQxb; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf10.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.244.61 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697434484; a=rsa-sha256; cv=pass; b=35yRP6khYkgtLiARMMON6HbTPK6YkX7I6ykqgzFCSRKEM3dzoeNtZCDosKXkdB3CXB4uBr LCuBcAO6U0jMNwWItZqc4pxxwxGCH7Spqh0sKfzRIzbYvQvUFSh9+G5prFpXOsBJ/ydciW nt8Rul07NpKvtJDq+UfmdnCAabfn2Rc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O8CvTD65LUD8MyWcR2q3gonBCbXfAcNOrS9VYwv2HMzyDaWUyCjm7VqrDJCSobk+f9cQPH/vEUbjPa8z4RYzb5IXuFrOCi7bvpSROz9iZA89ODK86T1SV+8+154F7EOPUMbiN5LC9gq0VU0n2PStXPcPLG7j/+FGh3y/8iqoer0Dm8IptuSiItSY4UP14jrCxs7kFl+Z9yrXfRXmrtNbC8E1Tlz/RG9Pgp2mKQozKKev8hi/SrJjti5HGR5+gu3wZhNCSp6oNHLMaqarsE3z8r+S6LxG/yZ0nZbExqwKRKgQO1SFXAL2WHpsMSYBtigB91PZIEWxm1L/7BpgmeLXUg== 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=mamLsGc4sQXGfXU3fvBtlclFn+hMi9J9fVSOGZ51vInwG0Qo/VdL8x3iOOA41ZdKI/p2qGWe5VzYx8Suq26DXVfFfalG5dfpGR6zAUs96tZ51H9gllxLO/4omu619XoFTN4jpvAac8SlwDr6csFCeR8hebiY6En8sLEvNFSs+3A5hTAngHFm8LiZZUfEXb3luTOD4T01j9aKdvICvLbGo9RPbG7WSsa2fNyRI6dlEKrDOyBqctJ7cFU0gM3YJu1DcN3Eyv1JA5PeWhm0nP4rV+c4ApVc7b4pxbtgCHE+DkSuqLsaJzl7XEJIsvhC8CXhKr1bfqYwIBKRmuDVbeFOGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=K+GhkQxbcfKSNRGLK2HBCC+W3h6ffp88FVuxE3dcImy+FaOURQ/MPE5RLcllQr4XPLTSXzXuBicfaOorMZdXcWB4zH9fQCI3zrrwbeQ97RPF/TJ1BseAH/GQVxfXSXF8HTnT5WSOk+5FEXbTpeh81R+e13TNKUDgfsPzIJET6bU6j+tYKny+0GzRnh00muoBKMWKjRnku3t/cIaeX8CeoBON1WTWVix1MJLvXBvUWVt9KD+hrGbESwJfzifGSTvl1XTxv+10sH/gk/YsD0KQKbgTTqjfLpmd05ZldRSasb4HJaVsFBPEnM6Dx/A601JOMycVCfSnVR8+tvkCzxTv6Q== Received: from SA0PR11CA0086.namprd11.prod.outlook.com (2603:10b6:806:d2::31) by CYXPR12MB9337.namprd12.prod.outlook.com (2603:10b6:930:d8::20) 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 05:34:41 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::b7) by SA0PR11CA0086.outlook.office365.com (2603:10b6:806:d2::31) 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 05:34:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) 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 05:34:41 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:38 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:37 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:32 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 3/8] soc/tegra: fuse: Refactor resource mapping Date: Mon, 16 Oct 2023 11:04:06 +0530 Message-ID: <20231016053411.3380-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: SA2PEPF00001507:EE_|CYXPR12MB9337:EE_ X-MS-Office365-Filtering-Correlation-Id: c31fbd33-0181-405b-5e6f-08dbce0998ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AG8YG7fENyNvGKJaTkKKwFAnu66pRMOcQVhSaXZypKL9hT3KqYrl3tyHBgt+kG7XGuF5cRR6pLXP+zlOs7eqZ5cT4vIHNVUJDY5veHSW50pW6qWFw2C81Tox4TcwZYZ7HD2KI9WK1JzeUpuJeJYuFVFNmRreoPmpGRzrh7l0BYfrtnEYsrz2RKD7k/kJM6jE2LLJRkaGxkvLjC7ZHeD3fosobslClm3MsU1J+ykgCG3+4phCSt8xepRuImV3oLibt2zLIQsjslmhBmbIJaNoCKO4GttAIyh2yeB1CyavfFzimWaeIWNEuClVKrXOWr6pnW3hAO04q9Z95bpq29nBwuz9CtbI2P0TMla22RlkR+Y/s/GuM5MXE4YN/LQRKsxrksJ5qAJkh4vdWYpEZ+qM72F+zskbmqvDRII3R6d+OS2PoBrPigW8Iu1F1ZhmmK0dHIBFU3B3+SvJyphtt8XRKP+KMP/16Y6n9OHtHuvNtgjLmMzYDRkCr0ZI6Cx+UgOqcBQLpmX+Ql9M+6AL1v2DASH8SQyLq/hnzPcH/TWr/d5DFx95LKCOBPMrgwF0SsCUa65q5NuK99+QEfneDfEIWRA7MtPQh77K3dmLHXPF7iuri0kKOHGUOZZAKByNLqy52M9G3JmrXUZbloe3ZX9hV/KOGCDGIu3xprGdmmex8G6T9sUeVQY0KSLXB4RGr2eR+6PSvasFcMTmHNQjUMpenr0O1CzN9IWtS4pmNnYdMVD5b0hRi1p0Ez6E4ry2bdHJEWCC7gxrUAHKACfT21CNh/v1R/QESRqR+cHuLKISoCYkFTHnPMRzqik7tROIm7TI X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(478600001)(70586007)(70206006)(110136005)(316002)(6666004)(47076005)(356005)(921005)(83380400001)(36860700001)(86362001)(82740400003)(26005)(1076003)(2616005)(336012)(426003)(36756003)(41300700001)(5660300002)(7636003)(8936002)(8676002)(7416002)(2906002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:41.5339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c31fbd33-0181-405b-5e6f-08dbce0998ce X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9337 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 52DCDC000E X-Stat-Signature: s5n9y9qkwi44i4hi1q7xu9scgrc9r7zq X-HE-Tag: 1697434484-945241 X-HE-Meta: U2FsdGVkX18riK1ZwO9JtMi6VDXwZxIyQV0Qznz3YmcQIyh80blgGuXt0p4793J+FG3017FGjNI08GXgtR9puYYLCh7NG8ym1oXNUX2mErb/VBsHjC0m1cH0jpBhwWN2W+q7v08pdx/b+Al7hlAfnLXxwuLiq/U0BKR3YFmlMCOtAHDy9N2LGdO2BO1bsK8es9oOuHi149/09iiFtX2CQDYN2ii6dtTuUWkCqsA/SbDl9ATHtudqP4bNDcvETigCquE1+aLaSZlmBeIo7/Rg28Gqt/P2ZCnewpTtRb50VXLGyx8XRXhQi9USDKNjhV/FHUI19C7ZiR44ZYQxkDo2/KZi2zVYXe8POfiQfe+nWD53ixUR+JyfpCc8rwI8YrBDs5j/G2mYi4UPvMrMvl+um/b5FQl3r4W7cuyLHoQ7bqDpp1fIdeLbAuZ870UhXNK814gaFEJsx4tZEAdpQq4JlHv8PvpzkHKWq2UGiC03k3SallzOz40OAyEqbwP5D+a/8PX11gtNiGLYby1TO2SnVA36MAspOtKUDbO/b4RWsA4ZwX3bcPR6EpXCca7mC9SJGyo6scPB2o4gRii++S4sK91W6gvH8C713itT3bEhkWjaPqS6r6vPUKsv7CTb5TvLVGsGdsxE6e6WdEamqJD9vhctk9q4WpVLJwADhX5r0y4CuluyFFRCXj2cdqd2aGhZEZnHXAeucbG6e7tLPQ537zK7vARjdjWIk9FTGaVIFT8s+ftdn2DuNvBsQTwavEpUXJMcsBrDFV1KOn2uQv2HTiUnmqztf9ogi5gDaRkG9If8Alsu1dTrqf6QPCTyVtN3pXH+p4vXI2qw3AHh4jwcUpwoxYrcUw1UuBS+JPyiICGWmJw+1/yAR6ZG+4wQ4oo5LpPgfm+wW2P0DB+gvQXn+MHh7BDK2bt6JePTvYIalNvhpO4HOUBOnZ/Mg8cF3rfGyhmHhsfUPHmxpyTnYoz On5XEH4s ThvtoweijvRybfn68LHUANZAMZZGjedHK5Kj32BDrXXe8QYfbb7+gjvBvJULyptX4FO8nhCH2q3c6pfhx1CFVisqFppPzyThNFPJNtRe4KcH22ijqpW9TQTb5q6mFukxuCqxPUa0vLTztoSsDq6v7k4Fb+D0W5QwYxk7WO8gB33j93ZO7jDWylXDGhHc3pxFaYiwEExXcHZX8d2pPe/FxUVt5JxdvVA8oYCSR4xgpHoRJhSULlFpbwjl2PQGkH4oN/QIUV4krBVLDj8HWV/4mMGwy6pirFygXk0mxxC5QU5CH41mULLx6YwawQYog+kr9vtolP4ItzmbNa//QOcFSoheLew== 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 05:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422501 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 76625CDB465 for ; Mon, 16 Oct 2023 05:34:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11B018D0048; Mon, 16 Oct 2023 01:34:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CB3C8D0001; Mon, 16 Oct 2023 01:34:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E870C8D0048; Mon, 16 Oct 2023 01:34:56 -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 D52808D0001 for ; Mon, 16 Oct 2023 01:34:56 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AD434B5C48 for ; Mon, 16 Oct 2023 05:34:56 +0000 (UTC) X-FDA: 81350210592.29.A355B39 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2076.outbound.protection.outlook.com [40.107.94.76]) by imf06.hostedemail.com (Postfix) with ESMTP id 999A4180008 for ; Mon, 16 Oct 2023 05:34:53 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="EJhiHXw/"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf06.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.76 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=1697434493; 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=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=ECs8ajraLitztdzeDHJUKeHdQsMFrETMoVaZcFtnIr2WLvyDtpgpnaEwsJ5worfgyxNF/2 EjXWyxFOMHyn0fGKOqE6LApMg+VX/aBLcp437AaY2nIiFlBZp9yuljM9DgrXclVMIHvdBw 0enTDK9dFRKutDHqeFUlG7lepC2X9Sw= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="EJhiHXw/"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf06.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.76 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=1697434493; a=rsa-sha256; cv=pass; b=Zdl3m7nCK6vByiudbnfQ56zw1sdcmGnvMZ6gGpQhMVH173mK2QuG9wP1kxAFs4mae0CI4E F8RRB5ob+TLKRZfy3c6i3KWKx8kwLLrg7G6aYvOAw9Gddw5t9F6spIKn8BxrROUNDCK/Tv IYOmjoOxaTxjsltLe7msmpBM7tHOESI= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JEnHW0+I0hcVKdERWb4BJ3ZUJMEG9bMSEwftNQMlKAAcfxgJdQtbcSKr1NGjPldXnMmRP4KBGk43zAS/eByZTP/LygPjMRSqFwtVpKZzNDuoLz2zgFysSzZnGyD0UCjalCeKmeWKccnaoTQYhQr2A/JoO0O29XdFFxRwsJWMcE2e7vMljdonG9PvI9q0xy0izSxJuaG4cPWn5VxvWlmvofEFH4etjuOsNHpYyA1MYhxcYYv1dKujoudim6//Jc/er6TlSV8wjA6RirFAwTkw6GstrDIICn8RLzQg+pHFOff5VpAs+VSfwUD2v+Z+fXq/CqmeOM6Y7mczCdfiuklcBQ== 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=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=mdYeQifIyCnTv/msJCmWj7O5FRd+MLXEI/hFFV/d7x0AZ3eF4g5K1jPPSkzolAR/dikaT7B1tuVsItHckZ2hztoFW8YoRE+ECIRJG1/UWCp4rEVsJIsuBiGt+OrIYOcLhKoFRrW9jf2yqXjXGYzrCqeD4EZJt9QNDNR0CaOz8EkgRJR5qABKPTvkGJWvGqhY1M8Aa4cMrR6uJpJ45ES6m+XKoiEcxeWz7CU4Qs9GNuMeqjd4XQ8VJsQKJTWc+MgxT4+CFv4PplFcATJeUGV3R8pRqjCqzX/nSj5YBA1DUbqfHwe8tSn/91/kOJMMNa+cVrHDkdBc6Nj6N5GSZwTc3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=H+Fro14rgalH/06qabhLwOLhxQnp+Tg6JsjLLk27Cig=; b=EJhiHXw/eQ0qSI0b50LirdGXbhE1hJAvKIrw96d8T/yvx+MvvN1ed0eENKkcO/KzodEaTzBng2DMeCkKnh7OLL3Z5BWA0GF2tOlcwne5n+kDVLg96twZ/Rcyyb2qPp4ZXmQ4QcH2glrzOH5MbzsQwzy41j9mhgZ1PeueKm1KTjuSTXStPE/NtlGzXaeqI4D7/EPSeWDv8iXUccGvWBx26/lr2Ix9H0DIGCBD06zN2iCEQ9gEq9Bj9YaQL3bfg+WP6WqF3+Vy/I/t/rPgy7P8hBTIas/30T6pG/70j7aufnDOAiotBFAWky1ADupdJNdaDhUf7rph0hIU9zh0FBKxxQ== Received: from SA0PR11CA0085.namprd11.prod.outlook.com (2603:10b6:806:d2::30) by DM6PR12MB4340.namprd12.prod.outlook.com (2603:10b6:5:2a8::7) 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 05:34:50 +0000 Received: from SA2PEPF00001507.namprd04.prod.outlook.com (2603:10b6:806:d2:cafe::a9) by SA0PR11CA0085.outlook.office365.com (2603:10b6:806:d2::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34 via Frontend Transport; Mon, 16 Oct 2023 05:34:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF00001507.mail.protection.outlook.com (10.167.242.39) 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 05:34:50 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:44 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:43 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:38 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Date: Mon, 16 Oct 2023 11:04:07 +0530 Message-ID: <20231016053411.3380-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: SA2PEPF00001507:EE_|DM6PR12MB4340:EE_ X-MS-Office365-Filtering-Correlation-Id: 02f06d93-628f-468d-7eec-08dbce099e43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qP2r2GZDdysf7gyp370SU2VOGuNHyE5GxwcGlvPGzVC95X9NYVHnMS8VQbquYFgZuS2R/CqzDFkq1WCYxS6Al90XipBg+6zC3hjSWyrhFZpjtQt0AFf+OH2N4MeCvO6VEl+GMuMa+uPHPdw2oCj3M8mVqBDtRS8E2QN0YI8Fb8fUC0RIyA3LA8PhUpQpsLghhvOktMbgVzY6agGaP5rHlNbjivOp2ll7EQ1VL8sNf8ADpeFztE9xvqBiAqhtbxNR7yGkkM1LxqJB4dLe6hL1nARo51wfdVuFn2ct/cmHlT57v7Tsui5qFW/jZYQ2wOPkyc+IW0PLtsZrD6qnkT5XZejRrpRRccWlqWQJMpeYpcaVTTstP2BIKAiGcKjy8juECINaWVIXj9Ja5cV5wx+yStJO93fPgqJHGm8amQnSCDKbrwmq2Xr4/SCO8oBfr+CGwMFVKC9SaRAKK0V873+WQFrBF1dfk71WyiH48u+21GzIacerjZo7ZsxoRERchMoxK/R5B11JKNwm2yCs6jpm1xMEzXbuR+2XKJld42tDBDgOUWfCgO8Tld9uaKEWUfD8nVjcfQS7lLtcnu6x/SRuK7toethCXvjm0xUBuQ5qlv6pJwAuck4hyyziRpH+vQGTebLQ5fJfNB13CZi8HJ3fjgz4qTqQbjHLlp38N7FNsuT4s8EnhXSgidIbrsQcl4SS5jIgSWvsNUM6Rk/lmmxTBLLohjBOJnuHlBZVGvJnskrMzWiIwUES8EH0C51xQDy8aAXjMG34zEORfRP4dUYF4zhiZR0YJzoqDW4D0XrNUArIrBuEXT22JI9c1khz6Jtv X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(396003)(346002)(376002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(82310400011)(36840700001)(40470700004)(46966006)(478600001)(7416002)(36860700001)(26005)(2616005)(6666004)(5660300002)(8936002)(8676002)(83380400001)(41300700001)(47076005)(1076003)(316002)(2906002)(70586007)(70206006)(82740400003)(110136005)(336012)(426003)(7636003)(356005)(921005)(86362001)(36756003)(40460700003)(40480700001)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:50.7058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02f06d93-628f-468d-7eec-08dbce099e43 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001507.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4340 X-Rspamd-Queue-Id: 999A4180008 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: a7w3rkqx3ubfrnmrbpomx98rj1heq6bf X-HE-Tag: 1697434493-380562 X-HE-Meta: U2FsdGVkX1/p3WcLlrheAWs/gXGt6+atdmzlis6vXw46qNb1ItpZ3Yg6QS+6m5OvbB3paFIZLHG+QZU1mOxfW9s/PXPvrlRwM6l2e9w3PdVGBoGKpoftCPk1DF/DBgVNJdwBT7WYFDWg41QDhm5Yg9tG4xAgXvBI1oAg8U/ebE+9izdIg2+yOzGyhEUIP9Rm2Haf7IgxNWYl2z/VcfKisJqJ7mEvV5bND+pSprcIhffyjMhCg9mSlWUv1KLZO/TpL/eHGrzGUtmLxRFXQfK5BodSA5n1iRN1aV++vp6lsaPXpThJtYRmr2LkZPbn/q8/lAX/U+94WtWn6YEemcv6V16MlZ5S/AbW6MOY8xMomhi0CJlQ+Oww+nuKftQ4h0Rlbz2JwYaac145pnXhRU5LTNDYC7BQ5HC4v+eBadxLRqbRdS0t283j9jwLpMWa4SxtQqsIksR3G1J8Or3jnpIF/XVx1qPIZTfP/KmpX9A3kOLATnCeOmpi2CIjoeHaevbHd11FfqLiC5sDLT77XSX2vWqAEzuIgiWMEUNkdo/uo/Tq/3R4s4TsXG+b9+ZetI2Ft5FFw8fdNBZUsuX6rhVBi+zMlOVeNJIfFLdTLpzrqtvfIp2zWT1w2oCSRkIuiNWWz4HAW6Xo+ijqXDZgDN/mFwd72WFD56+M8OG8Ytdjed0jOhDdHgLOu8PN+FH/ain74Vo4AQRMqBY3gTLFvxHLdg00dJ7KOkuTO/tUGmEXEAJT4QAEoR1SgXRLz+r8LrAhiyXGMlf/FXWUFCwYVCgSVQXVuNDMutIfZeaOZlVjat9NVk79ir/7nCAGNf/gwe0g+pEWqKx7/Rv0hLn4oO3US2WHd6wHr5gHwv31IvzWhlyz2306VG6S+SuyeSeyGgXUi0MPySB2PV56ed2tRY6h9lcwqVKz65hOwCr8ffXcIJNyvqhI2ezW/NcbR2WMnRaHUW5iSOPtKbwmmPYdCB+ RJdLjD3I mWn+YCIOd1/p3egLSgRpcpkQ1rDgCIPuo0QiXCsLmcGrhZPnAhSH4q80/dxGTc4MuSuwZN0PB1+DaWutgSbn6vOm5WEqWZEH/Mkdxzt9GN3m8RYdfvmY82EpI2ZiJaF0BkyEAXj3p7hA/rIAfyoCzDqPcuw2U3zIuJCuAIXNZy4erBFZOoEjClPA4D2Qb97HVq5Jhsi0YYFi4go25iKT+TrSGzgkSFrtiAj5ZEDmq9JrAZb4EO4CM1dsXZ4FunYj3z4zVkyMqd4taJHNeJ6tNzu8rvyqk7IdTbimpQdvAYFfpWkXcuvNIQNAaaMmC0e5oek30tQ6cE70huBLGqs39F11A7cjlfZ0Omtzu0wjCLqWN/bfueYT5rJflXzMfkd5+mJAHNvgMqVYFt/dEpGRj7Ya/QQHhQ+58bl9G 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 --- 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..e2ca93de6c1f 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, *tmp; + 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_safe(rentry, tmp, &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 05:34:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422502 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 1B168CDB465 for ; Mon, 16 Oct 2023 05:35:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB71E8D0049; Mon, 16 Oct 2023 01:35:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A674C8D0001; Mon, 16 Oct 2023 01:35:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92F7D8D0049; Mon, 16 Oct 2023 01:35:04 -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 845F28D0001 for ; Mon, 16 Oct 2023 01:35:04 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 544F080A72 for ; Mon, 16 Oct 2023 05:35:04 +0000 (UTC) X-FDA: 81350210928.12.408BA80 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2087.outbound.protection.outlook.com [40.107.220.87]) by imf28.hostedemail.com (Postfix) with ESMTP id 4B83EC0012 for ; Mon, 16 Oct 2023 05:35:01 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=M35ECHo5; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.220.87 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=1697434501; 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=UsfBJldkiMPpKKWg3UTuMtU4ygnaQjwm8g1iBXNqTyI=; b=5aab6v8Y4xFyNOkPaU2GPVO0QcUG/S2G7gbNHmmgqKV2R32In2tN5GeNzPGzx5/OfPqC4Z b+yks00JbniXgSa8FngyTaqtBlvsRomVw/3/PXv2W+2V/3qfb+bDQ7z+33chPaFkNT71Rk UnGSZgwvpbCS5vhjwS1DCF//EqX1R+U= ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=M35ECHo5; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf28.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.220.87 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=1697434501; a=rsa-sha256; cv=pass; b=7+1KhhMfUnQJ/GyoftdykU5Fv0moc67yAGul7LGsDo0F2qL8inZP1jHU7QBMWNdpt2V/ek 4u6iG8eSP8UEfhXeWLZpCEeZBl+4TWLBiec2SeME30G/BhpkLsVADTfQKZmj2+9osHehxd xKCYjiknhgNguiaxwktwh8GWjxjz51I= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RWsxpi+L6fM1FbZu8BuPfEAdaJT7lalkZesQrm5Ve0AlHeDK/rBHTulTTkWtfVKxX5x7kFB2dk7JwF2bqXIRGOTYN2zo+jdgGBznk1ka4bl4wAoAaAgJCUA0ZxLBLlzR/a/8wLq9MNR0nvigOcKEMahRAVpAeppTZLg/Yaa4/FP/etTI5vR87PKAg7GqovhWDGuUEps49nc1j/oK4hvMg4a1sULx5xHXJdDqyMNIzChQQzDa86J8jUf+dp29hdoMN+AhWR9der37B4W606lkb7kPX+7CWqR364WT/yz6Y2Mp1iBjtt1lv7pzdC3qBcHpASIMTMhTqKT9OHzWV8anew== 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=UsfBJldkiMPpKKWg3UTuMtU4ygnaQjwm8g1iBXNqTyI=; b=lPcHjyrvaPj4EAm+bAfwTYNpa1SHkKIbZ7ye1trdZrsoS07x7l+ubeETm9VPEMyZ0BYOt57ItiDQ17Cw83kmno6dby7GuBkoix/Oe88lavZ2+rHdm9oC0xBky55+8lELAR1/52hyJS+KcK1tUTHb8CBiYFPc6TyZY6uAOiB5vDRYmRkgqC9u3pqF0d+U5t++x5NXfk5tErDehbjnAduoGl7P4KMixKxfxnEffMVlyt0U4FEOV7a3TofsZ6Yl04Agu8Eb2bl7pD9C2taX88y16y/vtT/90cvG+GI3LOEePx5PqovpnI5fzhuL2b7kNHtQZa8lwAg0JdZNdJkTov9/Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=UsfBJldkiMPpKKWg3UTuMtU4ygnaQjwm8g1iBXNqTyI=; b=M35ECHo5BsLaPKiLYXEhPVhd3DykHxx/XlsIWgWDRhRo32jTvCZfE5B+ZVok3DrhvNE1WtVTmQ/fFbJtajT2sZHg2qdwzzMRa6gwutmaI0KckERN5RDdf1qdSC6FN5hay1ufSlZHcAHPOBWh8z4OxMRGOl/chPuxDpTt/3mfDJTJQ/7OI0IgQIUDSbPIRDmg+nPYFqSUy1m6n0GvpuMGN2ljxlCbhNWhqgqeBwN52APsUvuNrjKQnUzzEYF3IDXVGIdK7poyVy1ORtOc3LiqDZxm+z75MHXLTXPt5g9UaQ+KB7drcW32qpV2zXIcIjX2UcLtqGBKXdnSOU699NYz5g== Received: from DM6PR04CA0007.namprd04.prod.outlook.com (2603:10b6:5:334::12) by BY5PR12MB4180.namprd12.prod.outlook.com (2603:10b6:a03:213::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Mon, 16 Oct 2023 05:34:58 +0000 Received: from DS1PEPF00017098.namprd05.prod.outlook.com (2603:10b6:5:334:cafe::2e) by DM6PR04CA0007.outlook.office365.com (2603:10b6:5:334::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.30 via Frontend Transport; Mon, 16 Oct 2023 05:34:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF00017098.mail.protection.outlook.com (10.167.18.102) 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 05:34:57 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:51 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:48 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:44 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 5/8] soc/tegra: fuse: Add function to add lookups Date: Mon, 16 Oct 2023 11:04:08 +0530 Message-ID: <20231016053411.3380-6-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: DS1PEPF00017098:EE_|BY5PR12MB4180:EE_ X-MS-Office365-Filtering-Correlation-Id: 9333ef9a-438c-4f6f-391e-08dbce09a291 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RS2xRLxxam8cUnx23c4byl61r3KgNJzpK7ipFt0obcH8YopY6l0EMfyfrsN/K/OZZrdwOxm/bXCD+Qyz0g981dXRVr9pa6iF6c8ojhVR4J9t1vdZqAAhH5H5BMsBaL8jHkukenbbiptHPkymeYYyspiikjZz5NezIJhjzFCP3oH+eY+k/FxSMD1/vrMt7FgrVcH2FJitWSNNYXy65sKvvXk27no2v6K9vzO4rdHnttWA5VLdGU4StuIB1poT1h+66adyp/HbNP1jPbAXyu2vL9e9t1DEFF4cqWYa03WHKJK/Gr7zV9cOvVKnQHc+685p93u1+ohnfGjVe0NotG3EsZ76iK/XD5uRcGkRKjAhLmH4v9sTX2J5DVA6NK1cSRwiO7pV1i8cqBSEVsh0aU1+RMNSKuLDvwjaWSIUFUFKU5QxgZGCsmoSeWHvHbg0ymjW3P8EAIf1TDpr7edGVNH4SmVPSuVkvNwx/SgS6fs/yF0pcpcZ1FHg9Dah69wr86AKhmXIaERiJ6liqfFJ+LNJi6XcdbMqZHkBMphLsNBmVNsMbaaDYBvX0trSiOm/2eWDaKpAsQX9P8Qa3lgd9UC9fCck8CdEArj7yHH8ttWaHOzV3mPHVKf50UATsxXPQUrcipEpMF26AOiVh1NDPXL5ukIwtemlOQvQaeGzVY3sPLqjQoP8nxc2k9EnzfRmDBq0rcUokS9tZ0folMcoNJm1uPIkKfbSrH9GGY54LD4KIaNejV/lKdA4g1ELBR8Eq3PA1okRFdLGtIJ6gVWpCdnBW3+4tPU5CMpNsnGyEh3zTfQ= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(376002)(346002)(136003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(46966006)(36840700001)(478600001)(1076003)(7636003)(2616005)(83380400001)(82740400003)(86362001)(356005)(36756003)(6666004)(921005)(36860700001)(7416002)(2906002)(41300700001)(426003)(316002)(40480700001)(336012)(8676002)(5660300002)(26005)(47076005)(70586007)(8936002)(70206006)(110136005)(334744004)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:34:57.9260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9333ef9a-438c-4f6f-391e-08dbce09a291 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017098.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4180 X-Rspamd-Queue-Id: 4B83EC0012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: rtgzskhubo5toyp33eerkynm51hg9oiz X-HE-Tag: 1697434501-527478 X-HE-Meta: U2FsdGVkX19or6wH9zrGtS83xYpJlx/M/BUYNBIstTtLHhBIGg/CgP9TuPJO6b2XiZ77dKa/bOjyU/RfvjKoraJND0ALKw0rhfkHp1tqSn3kK8O+SoLksNyAejFJrqUh5kUxTeIGSkP4PhA5sbGl+AfHeXp0N9/49g0C0tXFfu2RhZyauz7EjgtT8q/+g8PELv1IrUH/h0+6Fe5iIF/ZdpDU9DTbZmMSjLp+OCK0iz+cruvR04CCRGJqhRtzFlJIMXwLi60HAT42479DlUgOx78rqRmz1YCyEZe3oPC40AjSMm8p17pxacCBaI+H8/HvgaemSsZbCvehns2i/RtduFAY5AjzhFNI/DvbCdajuMvwj23WTRJPbQdOh3j64c29j/i2qE5A5eq2KbVH9GXf27erglXKwXQJi1s1aJURcYB6cnm0DrpPPoolZJ77VDTtWxRpk8MxEw9+DqxCFZ1u7jdvMJFcLhQAdntECW6Y7xgGpvtRPLs9FDlGjq9VPuEvFyMw/PJ+1RGq+ubShkhKTaMk2hJpgExy7CfPIAxy6z50IlMqukd80r/FRvLIdgeXICKTEFpgpVrnK/pTT71JosXRJipWGeX+WPo72L+Pk51NM8zc7aw7+GCz7/SxCNXFowAdPqv+fTrq4wuHhEXHaOD0W31Ug29DZbUsVmCgACRCCxr7Wlsipvippt+4GORi7dxvclK+PSDpRplFbdM+fB/dbY8l8NNGf7/pMYUxr7tAqR9BBp/FOgVxkSTAMa4KA2JX2JdHgB3WeAshD5UN5rUKQTfcEq78ZPHlgr+5TkNrJUOFu0KP5pjXZfR0oMLJbDCTNEzNFnn3eAhLJvlUkvLSX77YV2TqjHwME7jBu361xQDPFXCIjeCjfWUcFa4lWpS0BtZO7vj+WZVGb+SHjJp+6FGNHwuAOYOXzLbO6qrYqb1/+kodrIsC53OZzpu97f8ECbpgtelHKLYZVYy MuxbDo5d h365DTCznJwPmmE8gXcRlH8O+dxxO7/QjhTojMcJ7h5h5CnL0V3saNt5smfqNmU9ip7ElH89tXSS1NhVXJvbBcRtYpqJyAS8vVIJWMqrZYidUsWZx6VQhdqH/FTDC0/5XNdanydyYe3gSMH9CEeG7Z64X/nJe2nn5At+zAqHrurlS+0546WVCu96J0Sws27SREm1BdYIrFPNVs8HdaTGwCniG65mQys3F1WZZHq3Y+5/m3k9/zpZnWsaUx1gNU5AgRSU+rKlhUmchUNHYmt2V5+6s8CTRg0bCja0n1nsK+Hc/aCLABUV/sbTjRQnOI871nw9uiSrRs+fdY448c2ObNehxrA== 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..c91194612a9a 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 05:34:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422504 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 7416FCDB474 for ; Mon, 16 Oct 2023 05:35:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 081238D004B; Mon, 16 Oct 2023 01:35:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 02FA08D0001; Mon, 16 Oct 2023 01:35:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D76698D004B; Mon, 16 Oct 2023 01:35:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C355A8D0001 for ; Mon, 16 Oct 2023 01:35:12 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A53ED1A0A8A for ; Mon, 16 Oct 2023 05:35:12 +0000 (UTC) X-FDA: 81350211264.24.7D5F0FF Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2081.outbound.protection.outlook.com [40.107.94.81]) by imf10.hostedemail.com (Postfix) with ESMTP id AD270C0008 for ; Mon, 16 Oct 2023 05:35:09 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BGsDk4dM; spf=pass (imf10.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.81 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=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=1697434509; 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=ELKSSmXMLGbNFUFnL8TV/EvgiM4XWsEshppFSZUpBQE=; b=3Uz3F67nbZBnbAxAjRRLOcwuCf7qha1A7cXO0ntJFMxtXtGJwlcZxTEuvVAQiUh50EKzjv vXjs1sYNIwR+F9KSTtlHM/dIYHGOAlpa3lsWECAcLcGU2O2WgBBRWDwIudsaLsBoUPOyWi tryPLPlPSunadcV8ruWhM85R9/LepJk= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697434509; a=rsa-sha256; cv=pass; b=2W2C72TpLuKDXo2AS6nRjRT1VdwQqUDGm7Fd62blRmlmrYtyUP3+UiDkkN/7hLwiTWS55p p/f77ipBqp1mPbK28QYzPs79C9Ky6dparrnuJxXl1X0VhpqI1EoqH2oNE5ADsqvjXWPVoq ZeKgZ0wvpiRLaFVayKxGZKfDrEE5bKs= ARC-Authentication-Results: i=2; imf10.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=BGsDk4dM; spf=pass (imf10.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.81 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OYm+dGOAYcvPlvd6vegUM/CgjYb130iNqQw74i1931GNSXbdhQn5YJG79ZaCx+in8jeFrzHvQ9IUveB/RBWSPzoMJrQsw4vPRqrVx77AgmP1djuly/OZ//JhzkPjoOvPCCwsHhfqgQJYg4b0VwkB50ff98omh/w2r1lty5i3ureQAvtxSKvdmDm87auM5GUxWWean+GZs9YB79Tz9/MOSrvtMyXpjy5QZREnuL73k77Qk2vpTVrOHXVCCvH2cFaNvrh3+v2yu8QFoh8cuNcknOUAAnPxqLC+JW4oYYnEUQz0WD2cvMSOPEjvviHKKJ+Hnrh8K+vSetnnsvifoXT7rA== 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=ELKSSmXMLGbNFUFnL8TV/EvgiM4XWsEshppFSZUpBQE=; b=EaY4hoJdHbtVxNsIdV09KMafEmZQp/LAmqJSEle2hr2ftF8dbbwJP4rloQkqTD2PYEuSCsx/RR6ZjqJE0LOaAcuJiJC+OoRTn3pglzVbG+uB9MvmohAr4RJdimgivNuX1o6LVLE7fAEXmxXsdne4842G7oZMTG/kSph3+1mRWCiXOYhU/5Jr/qzhN59Vd4Ba2aZfMCYDV7Mf0J19xXxKVLvor5SCvhUvYLjsbfigdHG4Eg4mswPo/bV86hMZI4Qdu4ExWu2UbV8EfuGy03LEiMMepH+VwTJwTSCpEKifEJZT33lqK2CeF8+fT5AnpzevpUkbzU0kvQC/Ap9G9ydSEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=ELKSSmXMLGbNFUFnL8TV/EvgiM4XWsEshppFSZUpBQE=; b=BGsDk4dMKAbSoSpv1aAWheaTnKqKMYP6AXzUCKFOiYy9PEMf797H9r2qjjJ8XC9nRPlN8kSw8WHzgRZ2QOmrPJfsVIQC6oQG0xuB/r61CqJrDdoxUyr7R/E6bQ0pp6pSwaEEsoClcmUGn7YTsuymtVc0QFhsh6PqVH4BpKryXBsoGI975Ram6UtdMYVPI90pTl6wZ1hy1uH2F/xcoqUUQAE1UMQOrXvJxQ6jYMKyXCehnrVlhsWRc+McczYRvYkhgxVDn1bilJpypS0/RGZKTbSr7giXzUBSj/X3YToIa00+EBGFIHA2WgbLCCaMnOHPSCTDHk5A47fm8EJc8g6+eA== Received: from DM6PR17CA0034.namprd17.prod.outlook.com (2603:10b6:5:1b3::47) by SA1PR12MB6847.namprd12.prod.outlook.com (2603:10b6:806:25e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Mon, 16 Oct 2023 05:35:06 +0000 Received: from DS1PEPF0001709A.namprd05.prod.outlook.com (2603:10b6:5:1b3:cafe::11) by DM6PR17CA0034.outlook.office365.com (2603:10b6:5:1b3::47) 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 05:35:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF0001709A.mail.protection.outlook.com (10.167.18.104) 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 05:35:06 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:55 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:34:54 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:49 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 6/8] soc/tegra: fuse: Add function to print SKU info Date: Mon, 16 Oct 2023 11:04:09 +0530 Message-ID: <20231016053411.3380-7-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: DS1PEPF0001709A:EE_|SA1PR12MB6847:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b6025d3-7c4b-4a1f-b61e-08dbce09a7b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +m2Ph9orPCiC93IPmA8nMcpflSWuAYGLzxcJOuvI3VEmVsoCGIUKYheYORx0hWzIB6jyHhJ2sfQji+N0hasGzPCnhmSn1K5jxCHU0km6ma2OEHfVVCBZjM1T32Th0HELvg1ZVFDsM0H7UoXvEdD762q3ra0gYKM0MYDp5kAcAHbsnW3iMPBzJeY8tyldFnnDGwlklI42Xrx0cJAr9Q8nNmLber4oEDRRRe4Zov12Udp0DrKseQmDJfLg3QCZYkim7Vp9b4WsWBRJ1BScjaCeBw3bV1A1o8KFXv87GN0CJ1JJZke49lYDWtnNCV1IWupE6/38IKa3NdAptJ8qmX0aZ88TUI62ft4fjO6ZBWz2L0EG0DcFojkZ/WRjh9dDGfPlAsR5d1PJdSZ3PfMLiJBlBArNEhPd/rioatB8Gz0taic4EWZ+5H3sVuFRaj4cLx5XucTGurwVQvU1OxQubBtL/B+wkq/0aMuzyuKcFS7zHywipA4B4HmbdguTY7rumjbcgrrNPeDW6aRurLj2DNSxy3wamKN62bTrJGi/HdheYbMDy9QGWdNjUMQqHaZ7aRF1NBZLhia1OrFlLNGGLOMhelZ0M93/ICcsmvUP06CLkdMMeJG83Uqthb7EsdUVHMG/aBdLuHw5nmVjBOrLJMzv086x4Q2MfV2aueDXBd2t+HIsp8oogEG7eu7cSIg0lsV53CxBYjUkMQGNPan/qZ0UTEYHOIfyixX1AiGJmj0k+jKk91oU6VKa7xFWpGVra3TsSxr7d8vg+zY8JefB9BKMJ6ldr1RLAJHRNlHSuj23GUA= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(376002)(39860400002)(136003)(230922051799003)(1800799009)(451199024)(64100799003)(82310400011)(186009)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(478600001)(6666004)(110136005)(36860700001)(47076005)(82740400003)(36756003)(86362001)(921005)(7636003)(356005)(7416002)(2906002)(2616005)(426003)(336012)(26005)(1076003)(41300700001)(83380400001)(316002)(5660300002)(70206006)(8676002)(70586007)(8936002)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:06.5316 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b6025d3-7c4b-4a1f-b61e-08dbce09a7b4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0001709A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6847 X-Rspamd-Queue-Id: AD270C0008 X-Rspam-User: X-Stat-Signature: w77k6gn99f3c1g3idb911ertqqk5ruzg X-Rspamd-Server: rspam03 X-HE-Tag: 1697434509-476147 X-HE-Meta: U2FsdGVkX1+Ye5uTenJhFyTCTDr7wiGQK3Njuzc4Bpehfec8WZc+t6kbHmBEoX58daxcFcv41a3jxYZajHYL2FDcIjVBBMspLEB7WmO/FR1Efc06bXyckrK6JUEuNRD1GyfOOYZJFQjlODQlSi31upa5cdxU+3n+rak3onfu4UjfqMVdUTjjzoY07W9U+iswooVyV4e3B62i1L9gjc+f1Ul0HrA134pnPmTgMWa1qLJ/LSI6p0hubr1bjn4XjGdWN8g+Jk2S8H43lzEAtEhaVrvXlvplUhsMX2Un6DjRAP6eWO97UBPNYVu50HewBK2yay/s1HjE08rEdvFcNAt03Viw5WjOmNhK5IPwimKqTVQswY5UJ/5OMMOkrkIq5BSqKaci4tlzdVdjPlmCoeBkqITUXzE6M1kr4Xm3mLjXbzG755iCrVkLvtD0HF+g3VkWDuIoYx6/VhgfJmzr2aVnBq+dJBUAZ0r02QywlpSQJFaI+c40fNQPwKnjG+ptpG5KoxQcqYwjR8qvT0NPwv37SyQhvCiMGcsB+01gypjS9IV4zVSmuDlp1NhNFDF+0mQyGH4KG8LxY+joIx26W/4qtc3IDs5kcJs3CJGEvY8L0hxw+LNLpiPuyXN3ycwkRkadyKUzqdz7wHR+p/U2Wz+ACDblmTo1+0GinYr6AQxXFlwBX57mQgapd2vr2DUXmi680SbAqCjevaGANhUrTg+DGn+y/kjhs5uQ+J4ufWGh9lYJA0syCDM/HtsULKK5dS97raO3/03CKjI4U8/k/L9ZWSbqh4E7L9Hs0Cdq6Sx2/5z9yxMpK3zE3XzdAJDmBcTgl8/gR8uB6JM0eu8MxPtcKDCQxEk1nERsMJ+AdULQLJhxh9GTXI8DFJGp+wcv2VAIk2VQDSY+q5JE0ip5igNKoGlRRNWGiZT661Eq19i8203FBM1PmTpoA0KFWThE3TY47wa291h6MQ1T15T4KdF SCPX8yLk IC8REWjx1oxtYB8LM3bTaCCkfpGfIC4syTAJZ2F1tgkRt01C6wnkLNAvT2HsBeUXl5RpI75i47UoDwduEoVEnSG6X3D7CaYXKduX1hLTFKilTNCBhb9U5KORamtuFqp+raSsKq48LmbcJWzCzUVl5lyh9UUp64fjLAFNmqR3eV5+7EZwKLZNNd1SQ2+Hmbapa7lKo9jdX27hTBqePIvrwR41EHK/EwovCHI2RdUS/+/gpXPy35D4JjvzmUYYvSP/JeBm9Qml8Wzbp89xW19PkyPZGJYK7Cyk+wrjLMYQL9IKYF1Eb8rEpAagF9qSgGuIcoRik8UEkLgPv+I7wOfdJhZ0dwg== 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 c91194612a9a..9bab758a60f2 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 05:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422503 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 14DA0CDB465 for ; Mon, 16 Oct 2023 05:35:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A42F98D004A; Mon, 16 Oct 2023 01:35:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F48D8D0001; Mon, 16 Oct 2023 01:35:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 895978D004A; Mon, 16 Oct 2023 01:35:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7651C8D0001 for ; Mon, 16 Oct 2023 01:35:11 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 53BCB40A79 for ; Mon, 16 Oct 2023 05:35:11 +0000 (UTC) X-FDA: 81350211222.05.F694089 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) by imf15.hostedemail.com (Postfix) with ESMTP id 6941DA0005 for ; Mon, 16 Oct 2023 05:35:08 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RrkYXmov; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf15.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.70 as permitted sender) smtp.mailfrom=kkartik@nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697434508; a=rsa-sha256; cv=pass; b=Aagdg2619B2LmzZddVbYpqQoY6X91rflRb9F0LnlDSm5wKqyXVJ0tvk5ngBKXjGNrRWci1 6SYDgBjnw/vWlwNbymr7ZGDJZnCxNXAMOyV1o6qvHN0niYx3RzywjwJYZ5EPPUzgP3deUX arfdvUuLe/jPYPM6q5YvrnUfLHjvPyo= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=RrkYXmov; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf15.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.243.70 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=1697434508; 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=RXqsHU6ogXlp1x2pbNwnf9ALqPnJ0NoVRvhf8LgRRWM=; b=cZZMKdJ594wbUhnWpkqk3paefBWfeIhTNloQC6YTkQlVOASWIJ7ldpJDAO+yko57eHfCgJ 8FLbyDtwZ4yA4a2Bp22OB9fBrcFe/qO/5AANrmS3kLxbAM6O9VwYxKrdlTBimRzIvhzqen aaiOKHsOonokxz3vDdQUN8DUmLVJS5M= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHKpMQ+wEqxL95cdClz8Nr+Tm+WbGuHVCs+PrOqshtIOfrDTk/fU5UTFdbS8yKyHB4s4V4BmxXArSWS+iZAHPohyga8MHWtDOsKmX65g+kIaQmmEZiy0QkvHEZmS7cEbZXERrEy6h2VsSarkJlOdUXW5oXUuExAOVgtza+NmH+AAUN2z0dUYyLaFXK7zuQ6oeeey2DAcLxwFLJ0KS+kB/ln+8n2c7Ot2dO5apY1EWC0E7i45D8XQi6qPGgvGmvygFaLaVCE7L1efNhpo0jg5aP0Jr9f3dSLapRXKmDIqJ0ENkANBTzT6rCFw+bsaqgOxtINRcNUBzZMk6ONqEIhSiQ== 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=RXqsHU6ogXlp1x2pbNwnf9ALqPnJ0NoVRvhf8LgRRWM=; b=acX7rU5dDZADS+KlxpqTwbdcdLQcfGxcYaZS/wpppkI2NliRFaD4lli+4PJZPGh4wLS0WYxwPnUl73q3VtC3xxPoVSqv7RFomB7if1YUh1jB5iSPl6kHH1a3sMHPLin3qaca5yZMRswSsSQOGPTc11B4dbOZ2cvnuM5C+bnUwdeO9AEIEkRLIrLS/Q9JFrt17TTotc31NAC9ky8DaUOzKileE/pttkWUD1p/vgr7SIoYlJhUr9v+POlNN0haRjP4Tups4M6KBjkWVi9hc8TIAFo3CN02UbXcadHTXVIrh25YaCSUGhrvbCG6strbQFytwzelPYnPsHMXMlIix0ACPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) 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=RXqsHU6ogXlp1x2pbNwnf9ALqPnJ0NoVRvhf8LgRRWM=; b=RrkYXmov4OdL9r0k79dWXpEokdT2Tit2T9vvQMWV+D5qqTHB0GN1SZSvGAUuCVc9ogb+tKzDlttxSVZxoCX3QyqLwCO5GbL9nHhfJo/2YfjkEZUwZ5Wp9/5OfhUzOW8UCrYg6ngUhxLYUwd7Dq+lgmhpH2trbvn7txfPMF6dnQ3ki0OhLapzyhHV0HKAwoZIKCUI/tgSLGeEJl0vJMK+v50Wt5c1COuHxJdwSKReLeVlsx1Bfain5gOEyHkY54QHcfQMbtj0o4VcnUyFYemchLzJsJszi+gBIkBl8kENKHbbA5Xq89zR8wUVAg8dCJqGdyFx51OdnVmCpIm8S0+0zw== Received: from SA9PR10CA0009.namprd10.prod.outlook.com (2603:10b6:806:a7::14) by IA1PR12MB6532.namprd12.prod.outlook.com (2603:10b6:208:3a3::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.46; Mon, 16 Oct 2023 05:35:06 +0000 Received: from SA2PEPF0000150A.namprd04.prod.outlook.com (2603:10b6:806:a7:cafe::f) by SA9PR10CA0009.outlook.office365.com (2603:10b6:806:a7::14) 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 05:35:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SA2PEPF0000150A.mail.protection.outlook.com (10.167.242.42) 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 05:35:05 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:00 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:00 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:34:55 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Date: Mon, 16 Oct 2023 11:04:10 +0530 Message-ID: <20231016053411.3380-8-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: SA2PEPF0000150A:EE_|IA1PR12MB6532:EE_ X-MS-Office365-Filtering-Correlation-Id: a019253a-ccd6-4e34-fe3c-08dbce09a72b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mz/FNMb5wwnMmYSedSFgsJbsEN54AQrXsSv2TSoDrcFRYMJs26KUwKE/uZTVmUF1+Y/bGpiQUyyCQEIsVAdZCToPKr5pPATVBd4NOPpJuouyUKcjboDcK3JYSB/6vLxeKYLQ8iHm/m1zK4WkudmXFU5VaBi9JIqO6p9JLqOnrF+ouEfReOP/nn2zCk5tfkgIlhKnG1uHAae4mgJnLncXUEmUS7gRHa3y5d3kZDtiCg8uex653QOStXWAZuyikdNxZCESXpXAE+lvtruU6WHT5Ksa/54ebFNwevvtFCQ8PJZVympL+yLuC9Sf2xuov1qUsv4U59zBQ6b/MG9ib/MmrksWW83xb955bVb5CinyuGzT9I0xfpX+l/Wh94NfA0pjWB/0vkeWU2VwzzHm4S2FCjHQwm9KAEvupyybtXH7V99lgQBPEwvRJV3AE/P3rw1Z3bDF8w58a0iLpIU/ZhoSzIT4esHy9rZyFK+7pIcmNazWSvxyl/O6yGKukPBU2vXJ/qK/+vzCqVN3sox8tluXUVSwQeWe96+jUZb7boHhQFm3hUnqpRbPSSzH/8zJcOjKobaPZy3VyKRnF5x9WCbYi/4K+0B9oZASHALtWfd+JKtAAM4ZkGPDC79c0fU5BzlFkaH57SMYP2vSKKe6gbotmmq5H2m9YO8a0qyr+jvGhgZ5GsPbZNIy2pQVnSyIveA+zVRSFoAdts4F/7MGXBNA0vf8GNYSzS0L7q+O9s8QpVl7VXoQrMhZLQY1Ha2flwBsiFfyF7XYUUXcH1ohHbJXjGbp/avASFforH1IcVZT4K66/cKWqRWeXbQ1mYs1K1tL X-Forefront-Antispam-Report: CIP:216.228.118.232;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(346002)(376002)(136003)(39860400002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(40470700004)(46966006)(36840700001)(6666004)(426003)(336012)(83380400001)(2616005)(40480700001)(82740400003)(26005)(40460700003)(921005)(1076003)(7636003)(356005)(316002)(70586007)(70206006)(110136005)(36860700001)(7416002)(41300700001)(2906002)(36756003)(8936002)(86362001)(8676002)(5660300002)(47076005)(478600001)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:05.6512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a019253a-ccd6-4e34-fe3c-08dbce09a72b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6532 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6941DA0005 X-Stat-Signature: 1k1yxcsj5femama33fdhy9eygr7x3mbf X-HE-Tag: 1697434508-271634 X-HE-Meta: U2FsdGVkX1/BwlfjpWyDvXvFNJ7V0SxCtuT5v1DYrqtjJBBt5nowaTjMyia8egEselN4dUY7NajEmo9G6HUkhJwcXHl5O+baqHbqhSgyG5HsJr8XubDfwFwUiJ8Ywofi5uLmgOKW8wFhPr9Uc7GaWF1ENRVB+12ElLCkYIO5ErQ968QvEhc3F9/vlmUQzbUDnmMiNVh1huKZ4GiZZOPWXAPKfLmyDEyooN4bH8mI32ov807USLNXkGbSo8lsg21CCUkp6Lu+nv+jDFxo26Abv294CYiwQEhWISlTYw50UWJMG5zLlMk4TxOtSz0tQ3pz1b8LYea8al5bXRhTAS/dv0rwHHk3ZZNWt6ci4/h9uBlzmyyXx001XZc1C31t774E/Pmsg/xwWIJFM/XUWkZ+DQAl3tsOFR7skrlcS2dthg+bQ1OUCOvfSccYZQJ07fGWFIru3LYuIvNuI4tgpOr9ovDxXNWmugfl7jLRet2aUYGUOSbmsFLG1dvJ0o9WtkxzKcvB9uUAeI+1d+IwpWhGvx5J4Ghnmg8nIrte4dbtSF/4RMfE2DYDpJ4wvvWW7zJfHR5zfTZQCIHho3e9Q0KSbU+f/HP54A69LE8eswhdfb0ox5Cp8po6peF6fo4r818Jvp+t9Ny5ljBEv+suBTU9S5c+gf/p/yF8bPipciH7gDHkkf9pOQbnj3dLVBs0uJtoM5pJu+ZH96og4k3ifmi0LWxSqEeDboLiapoXNObecOsGbOddqNBN3OpO3uf1cCIARkFrLwFLGRYK3lJ+t9D7cONcqAZhyVc04zKekgkfUtIiIcdozS4d5qLr1vIRDnexy7P99n3g/eiRMT+1GguO7/ScQKMlXmHHeHQjKY1/nudwyyIxST0l2fqqWbT/Z0E8Ioli+lAh0kEmMGp1Jz9nz+6qmrKApkwuj/yKIb5qBn0g9hDuPnEZ6/+gRIf9XltQ5ZiPBM6ELZkfPoonFUG HejGAY34 lQ56KxS5MFinpoROeMedQgPHiuwhXh9NOH3KYm0+jS9M9DKfFxgI8ztzueboafNkLDndiHzZFkUAdTIRtLb+W1ZwCBGq97CDobQZoZS25qnN31HNQb05bomY+3A+4X14dRVKcDpFLhWf8b1DaGB1TidWyruuvhPxTlgRD9238fmn1ZVkCvNyWaXs7gWRmUkVBnSLg7MuDtmwUp5hMFAbHY/1u9lLwfx9+Tswi/QVtM+HDtzvrUP5yQQk204wyroYWZo2ySInRk9fqBAXJhQ/jUDM27LLgWSv3Y3sWs9b09pbs3Qd0UiBhuGUzfuJu+kCBFUXV8miL+Xj8L9yOqvz/tR6bcPqCGCzIng5TuPzC58xHWHUCq0aM7sFkxg== 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 | 50 +++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index 9bab758a60f2..daf39f0e6d93 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,6 +154,37 @@ static int tegra_fuse_probe(struct platform_device *pdev) return PTR_ERR(fuse->base); fuse->phys = res->start; + /* 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(&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 05:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422505 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 97FE8CDB465 for ; Mon, 16 Oct 2023 05:35:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B4498D004C; Mon, 16 Oct 2023 01:35:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 363C88D0001; Mon, 16 Oct 2023 01:35:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DDE68D004C; Mon, 16 Oct 2023 01:35:21 -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 0A2498D0001 for ; Mon, 16 Oct 2023 01:35:21 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D41E3160A98 for ; Mon, 16 Oct 2023 05:35:20 +0000 (UTC) X-FDA: 81350211600.13.11D671C Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) by imf14.hostedemail.com (Postfix) with ESMTP id D3B9710000F for ; Mon, 16 Oct 2023 05:35:17 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=n0LMXQSn; spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.220.65 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=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=1697434518; 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=Mc7Y8uE9T1ZTCbSjAzTP5hNlgaBupFVz56cm0VutrO4=; b=6PORcST7+d/79hkPDE3P9YvipoMR4LoYEIc2gkElX0jMAgS7InkXMa1dc+P9FxQFclWiAk mz7rZYn80sSD1yYo0eRTCWhHJF6ZPXNmWr6FxWzBN8f138g7KZzCXf69O5hPGFxVXm4TJd W1yiSwcZNC8WZXP1z1ecEXyH+/fK+lQ= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697434518; a=rsa-sha256; cv=pass; b=mP2CFgt1geb+EBCcd19iWqBdyxVLP56OkjUnQlU9ctRWDMgzEDIyyl1fBUsnBXsUplq04E HQVSPDwF/TTdom5SGScDnHsV6t8a7CaaRKKwrWNb5yl8HpGCrKaKhvOPqJjX1Lr5KlmcQ7 J/uE4GVqckBno7QqPqyoLNdu//bqNeg= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=n0LMXQSn; spf=pass (imf14.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.220.65 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mJh4oq8AKjYQsYnUFemE9DwtQp6Dz6fftaki45Z/AAyo4O0YiUVquVs5mUHvaFsl9JlNwDmBuRNF57EPM7zW/o7zvQ+4NJTTUqJ/Y7lstztAHaVeYoARuDbGjAHQKE6DiDMWLg/zyfi4yHD3QB7/vGEsBQb+IxYaCIkWuOuifoeXOqCsGsbA7Tpx32kvTxMke7R604Zl1dm7N5S0VdAm8N9hCca10JZTBzTI7/P+YCHCZLYbQAWImjNQKuDPNiOJsA1/1KWsIw8Sv/1FpPXWf/2f5IROera0wvWje2/AM+vAcuUiad/X9plhPrIAgyFa3cEtFifABj4RE4+z5UKWuQ== 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=Mc7Y8uE9T1ZTCbSjAzTP5hNlgaBupFVz56cm0VutrO4=; b=i4aAuhCFxGl8Bsk8CtIxgP2b/K0puJa2Q9G4qYo+Eib3IPX+nbQeSu3Nk426Fyf6wzLi+toogfpf08cWkbWnk78YVHiN8HMs8uENBKEj7n5u6rE0dyl5vYF+te7ldqxC9GT2DBnWyxy4zc/eMTdlJzFGcLjD1fgg4+sVgLl6mrYWqlX/w/NP9fVuE2gstvKPByz0VatSws8erkKlVueeeofgI55ISBHYzV4MUMbDDC3BPF/v87fD/WY5XZwLmcWNabtDG6aLA5VJRD1rTpRwRIQrErDE9P4IPTP2lyM0ERtaS36mdBvJmogfrjKbUD6mobvfA4+quD5YXh9TP7j43A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=Mc7Y8uE9T1ZTCbSjAzTP5hNlgaBupFVz56cm0VutrO4=; b=n0LMXQSnSVl+CWpQvI03RXfX5pGV+gZiusybbOkd3yG213vrcv4TSXLFmSawh9lQCVxhROyDfQxtZLAqhDJRClErc6Js8p9DQkTqEi322sxe8ntDReNBdeRsL9jWt+CmeMIj/PKz+J7XzOHhLayAPGPs9bwpDPIctSDJi0yvpB0lcJjGafWIEu5dENNKkqT2OZS4o80T8DgjzKhxWMY8b5/Z44SCO7WWk54DjSl3pGCjxEhrmPXmBm5aQyMdAco0REiQMauYTVcqkLU+SSRxLewepPvt80wNrpso82e3aBZ27zjX2a/dQGNbFoGJ4lVeNUYcaRTV4sWMAgJeDBLfZA== Received: from DM6PR01CA0020.prod.exchangelabs.com (2603:10b6:5:296::25) by MN6PR12MB8491.namprd12.prod.outlook.com (2603:10b6:208:46f::22) 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 05:35:14 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:296:cafe::9d) by DM6PR01CA0020.outlook.office365.com (2603:10b6:5:296::25) 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 05:35:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) 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 05:35:14 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:06 -0700 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Sun, 15 Oct 2023 22:35:05 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Sun, 15 Oct 2023 22:35:00 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v5 8/8] soc/tegra: fuse: Add support for Tegra241 Date: Mon, 16 Oct 2023 11:04:11 +0530 Message-ID: <20231016053411.3380-9-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016053411.3380-1-kkartik@nvidia.com> References: <20231016053411.3380-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: DS1PEPF00017096:EE_|MN6PR12MB8491:EE_ X-MS-Office365-Filtering-Correlation-Id: e2a9cc61-c5cb-4cca-572f-08dbce09ac88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GPblzzhVtLPfcaentQ5isVSfwcpASwPLZ+iqWnKpKQ+3nhQmoLGJQzJYKR3xE5VFBVLC1MUvANPEgzPaDuuVUYqFmit1BdhpHtkJHibMfePWA2Hy/9NXae6STqwrMtSiX3eGHyjr3AyLIv5R5V328ucn2+6+almlLKNqThf85eiaSQejP+mBOqaG75Ni4zF8gX2I6p9QdSvrv58QVEFxI+f7r0ETfOwp4AvotqVzRZF9h81wai63bsBftccUdQByDUCO/UMJBr+Q+YgXd4iBVVhkoqSZ5PjAEClPqxjDg/pzmNw7z9uOqm+7WnhSc5XVAK3U2XwuKplBPuhEtapRi99duLmyrT1khTZEGIVqjFKvawOXRmnLqahSZ2Oga9sXjyNA8/fTt4hAAY2aUtAbBODxnvnuN9ZP4x2rxSz0Rl6+Y1JLOvMt6w3YXyAs7bE8k6IEua+g/5iNaO+Zl39H/ZBtEEeUr5aKVae4mZkbch+o97jG6eMIYbXTajnVIXBCgqTIsXh5l821lndd1OgCKDLlq1W1+h3rkby3sRcKrbLESyQXM0Aw8Eg/Y7kI4U+kdTmV1bD+HTIIwBm50krlIzMTFyXBOiVtn0XzaZVcz2GtEqWv7lD/5XyoeiW6YDbj6zMu8TRknoC36W3LTv1yZqXOL76+S3FtPQ3hcUVoP1mclpKbkWyyom+CAqBdwQIwfBDybbDaH8ZF8m9fzk9fmAYSJp7exKn/pjZjqNDELJ3BBYKOm7Jg7PTuUuoWqZxUQC5YA9HfCoEMrg8OcfgxWL+rTqXvOCqZcVacLjioxuqJFoEv6aWHSze2jtocpLgB X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(376002)(346002)(39860400002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799009)(46966006)(36840700001)(40470700004)(40460700003)(40480700001)(478600001)(110136005)(70586007)(70206006)(6666004)(921005)(7636003)(47076005)(83380400001)(36860700001)(86362001)(356005)(82740400003)(316002)(2616005)(26005)(1076003)(426003)(336012)(41300700001)(5660300002)(36756003)(8936002)(8676002)(7416002)(2906002)(83996005)(2101003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 05:35:14.6294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2a9cc61-c5cb-4cca-572f-08dbce09ac88 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8491 X-Rspamd-Queue-Id: D3B9710000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: hyuqgimzz7aec3xayiakmudd8eof8ppd X-HE-Tag: 1697434517-273371 X-HE-Meta: U2FsdGVkX198h4ksgZ9uQIo/Q9+pIOwz2KzvtNmCL9Zem/JHwSjxweKlXoZUfVb0CHeiloa9gYcA163ZCgbTduB8y6E76QyXABDJ0vV4LbTqDI/UgtnELW6wxRfHaS9j5izTEzmrOIW5JkfxrxShWnZPvAkdVVQwG9PB8KVI62qZndt8ppggOqrip4HOank00Gp0G+8MOx5WcwS+lX1h9w19F2aB3NdTFmF5PWO5gLn4AELLFqt5OQplVvUOC6/daKhT3/zD7+IY9ZHfVHICB5N7WBSuAybrfs70QlwowgaBmspse8YuaRSK5wfCXIsZjVFUvayqNVkbpPk2QrB/K+9GSYoDQqTGRBmmxYymwwnaJql81txihgHUb3VfjzIbOgxWEWnR7shVRhNcHHoH3B/9N2S/WdfeufsoStkQKnw/d/3Q5IlIG+sJoEeS1hUEu9msJ9fgHIoXD2mqksWrWva8QjlFHFOfcwy3tyqlaXdYh9rfR9XkljIpy4E9lFTcXGrBdkpfn1mkWUY5N+psvVDctfaW1xx8EtoKhbYMTlM4pUQm/7+UMhhBWD8ELQvizU45dfw/XozsR1LX2GbwYGsU+CgBErT4Puy5zCqLWoMw4oYEUSGCIC3ZiKKYjw9soV0Cq+EYQvZTtuJDmmlbIu+JR5xGwnNmfH3LKBbp8XkvYcMony7jL4XTHlbAUcVzZhv3ZeMYeCuc9d9g5U81+TmtSeHpaRtoksbBBvvyNtJ4z1Y4Kp2NmQ43f962z++1HiqIQ7GhgYX67hjvuFk1Iwk+ZlIgwLxiG7ISGXMbiryApAI1zGoLcWZBcOXE4xz0gFPgkzDtIs7hLN16/tDbPDByrshvGdCdWG62yBFEO8KsdVqBLH9Z1J64BglUqB7R7g8yVwKe8yKzPytOIa9RAjT30Wz2TowiVeFT5NdYq3+E0Bw93cSvc/YUQZgXKT67DXH4RvANHqOSUWYO5+6 vALJ6Lnp gFrBZI1tjjXckjlbbgi+Zu9Ww/AzcBhgz+6Rha2Z8bG4mJKISVSgWcRqFS0y5knzpThqt5WP4Vs8Q5BLnd1NuZbi1l9XMqyeL7AVZxH/Y1re+s7f4T+YnHcm53MVrZGMzVkiT8xxhkj0e/znL2Qmq6XFcNmgoYMnznEcJxGltOViMEwihD9twrWoVnoM2gWu3cs7RSk2Np43Ny8n8WVrAjr6y4GAdpQjzPHdT88RCSxrFOtjpN3pCYfWE3qSvKJFy2f8xfZaVim+HmL20Mq6xv0/b4fAcnrZa/9yFH+rq0DYZ0uKTS3pSgyJhEV0kqhRMio2r0/6LUxGRVPWwr69RtSG8jg== 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 daf39f0e6d93..eac95946c425 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 e2ca93de6c1f..c72bdb3e4e2c 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