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: