From patchwork Mon Oct 16 10:14:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kartik X-Patchwork-Id: 13422916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF963CDB482 for ; Mon, 16 Oct 2023 10:15:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5BCE38D0057; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 545E88D0001; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 372BB8D0057; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 236188D0001 for ; Mon, 16 Oct 2023 06:15:26 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E9657A0BA1 for ; Mon, 16 Oct 2023 10:15:25 +0000 (UTC) X-FDA: 81350917410.24.A9C45C4 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2083.outbound.protection.outlook.com [40.107.94.83]) by imf30.hostedemail.com (Postfix) with ESMTP id CC6FB80018 for ; Mon, 16 Oct 2023 10:15:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=FA3H1Ue+; spf=pass (imf30.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.83 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697451322; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=VIdE9w2vSldycVPzzF3xU22i8fsDi4j84x2QMKuL6kNT+Zb1YmvghNM5HxK+dll9WVRc4E oYzLACC6OMPUnEPnZNXhLEePBWd+QxEtTe4zXZPyDaJQDjrVrIJEatRijJyTe559SXEwc+ JXmk+QgXDWQAX6456AKcUzpT81EPSE8= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=FA3H1Ue+; spf=pass (imf30.hostedemail.com: domain of kkartik@nvidia.com designates 40.107.94.83 as permitted sender) smtp.mailfrom=kkartik@nvidia.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697451323; a=rsa-sha256; cv=pass; b=zbbJAVMmjSRZqyZa5vjh7p1+vfZ4m3KO8fUfarOrXCEmBuMKnKx0+OQ8FA5LI5j482Yi+B MaQZIfFyfXBeOMrIwndsrBKWKXPL0dod3fVQ37WgUflbump0kXUBxbuQyS6gwWSZ1BsH5F kGEap5iKu3xVSgtsxyCdIKg00yl8FXc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EIT4WsMFhP3IallIZ2B/15jEq8EMIS4ikeBpg4LU+SCfGUNtEMOsmHJ7MTL2XQkM5m+vhg39szOHEtp/deOjv42ZVLifvJD00aiJzDFACjH6zDNnw45whg4kzfRrKRL+Y/T7gHesV9od+rSdAK75xcXDSu959jrhv05sWTaBspQlkNexyvE8P+QEl/VL7+02LKSxlLj1N9umrDpep+NpBZ1aEdFtDxfr6Ie96+1ZW2o36mOevSn7BEfRjjYtdzSlWgvpNfFcgq1SKAjuRgRinVPd5/b39WlNgzTpGMg8UHBpS6YwvcJv/NMmh17ZCjTPmwmt9Kap+quqvShGQ9t6MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=JBh0c33nL3u6mwZmQobKWSRLXhKs2GFzTB156NNi4riU2kVjBNkBRUhwNjwToNd1N4lA1QOEdZJ+hImlil92/OEq6yqJd7IaAOIAhWK4xLjUnGbvUTI9KWCLn7kOGJ1c1iuDmewtv62YYuNND3GbxxSKtlnYgZrX1lY/nQry1QpVtc3iAjElNvdDexG1WlcWo5zJV35Wm1vGPvvMkdEOL4PBPLwfiXQynQEFtieClnd0rtB2LZLeIRmSh4qWR6Z7IEKt9OtR/eK4njDsDHSsSVGxIsFUTKpQDj0gaclKEja27ke+4+Q5PPtIwfVO4uKrOYBA1MQfA1bd6+4cM8smBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Re29ps3AiOSg4y0WBx8YIBQJTME/7AeggREHZrD4b44=; b=FA3H1Ue+8mb+mW4I5VAme3usDXqRdTAvt0fedEThqnsNDXtEGWDmkAjqGXQUFZviynNE7eKmvr18S5kyrMJlvU9bFavq+afLpuM2z6IKtf7sRiv4mmmvU49EKn1Qz13KxBwNWMd45TWLNAYl87sZGK6Jc0nIdiPKCiXoBuHrNh9BJxr7yElxcccDyHW/JMtHZK9Ls09rbtmz4+2FWhrE2+9a8AasvTXFY/ZWrwRnIA4g1q9ldPv2M4/qFUTefGPAw8M0PKO+63EvKG7YjLIoclIcPoumU8r93lB7EijewVA7doYkkzicDA5PmLcm4oxcd5s3rCGKIUosHbIZOXSt0Q== Received: from CH2PR18CA0017.namprd18.prod.outlook.com (2603:10b6:610:4f::27) by DM4PR12MB8452.namprd12.prod.outlook.com (2603:10b6:8:184::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 10:15:19 +0000 Received: from DS3PEPF000099DA.namprd04.prod.outlook.com (2603:10b6:610:4f:cafe::f7) by CH2PR18CA0017.outlook.office365.com (2603:10b6:610:4f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 10:15:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DS3PEPF000099DA.mail.protection.outlook.com (10.167.17.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 10:15:18 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:06 -0700 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 03:15:05 -0700 Received: from localhost.localdomain (10.127.8.10) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 16 Oct 2023 03:15:00 -0700 From: Kartik To: , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 3/8] soc/tegra: fuse: Refactor resource mapping Date: Mon, 16 Oct 2023 15:44:31 +0530 Message-ID: <20231016101436.7146-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231016101436.7146-1-kkartik@nvidia.com> References: <20231016101436.7146-1-kkartik@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DA:EE_|DM4PR12MB8452:EE_ X-MS-Office365-Filtering-Correlation-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nqegj82AxvbaYC7S1nOfZo4psz5tEeQEZRhN9gFFtxvNBN7LakKD04bsVRk/xv5mzKebg1yHyWFEfJCAvWYPJjTISrS9jZQa//kFGmY37q27U+T9uPQXWXCu914/e2Sk9C2pogi7OKHUz0t4SWA6VFaQeaLcUNGRsIP7kQ8YVa7HqOimPt0b9jW6r8IK0pTaKdyUHwMglGVz1bUWP8++NU6Efdy3RzBOwZmDCYg+asTIH0T2VByEzci0d7iqZsY0GsqPQ7v1PJEqUZupOUZ98Xzi2aPSe7Jmq+oiL0QR4+wNyVnFDO7kGqsMCdfVFFU+lK2XgUnYpWkMON+stIbE+PwQh/OcAzvo639SVo6A9MGrfWxL7ab6bpOb1u3TjvWEhU4AzNiKAsOzIzeptqg8ntOZs9iWMbW2JoqnVcy3P8VbuGfCyYUCSQWZb7aHzAfChndbB5HLvxwNdDPD/869JBxFIknJX7DoFvPBw8XJB+vIqwW3P1+G+koGw+JvfGmd2g7nCefdc7s/+I1JtQz5UQPN2tsx3FQl1lwRi5a27DLtOOrAaQAtWE5R6CgQPjn9qHQGcbIXdbP6wTDC0Yw/ASAHprkCDe9hfOiiIMSjdr1xEOQFbfiH5VEZcyA8s9XoxeB9W+f8e3aZ3y/xsnh6YvBxO32vkBSKwkCzIGHSHh5Gt5AG8sIo3WCdvaTruyIVLIKLsvo1FLOPAFa7neWVu4SLaxK+B+MXXTUpPi4O1eooLO1I3s6X+da3/IPNDFe7Q6o72oS00KpqLbZA44OuEuum3Oi0tBMk4SFp2vJOuqlaViV3deEdz2wHfbWG08/5 X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(7416002)(478600001)(41300700001)(8936002)(110136005)(70206006)(70586007)(316002)(8676002)(5660300002)(40480700001)(36860700001)(47076005)(7636003)(921005)(356005)(82740400003)(86362001)(2616005)(26005)(36756003)(336012)(426003)(83380400001)(6666004)(40460700003)(2906002)(1076003)(2101003)(83996005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 10:15:18.8535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcd79bd0-39f9-4aee-d389-08dbce30cca3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099DA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8452 X-Rspamd-Queue-Id: CC6FB80018 X-Rspam-User: X-Stat-Signature: yi7anosrnptgrrc5hucg47wp558ts4sz X-Rspamd-Server: rspam01 X-HE-Tag: 1697451322-891557 X-HE-Meta: U2FsdGVkX1+nLJ565C6pyGq1GmPkqEHPgXdMJu5evrn2hrgJ+ZxlX4r1D1lwVS2GRQGoNZPPBFX/PjIR4UNOLiNdIu+/K6T3Gjrij7ZYmqjjipomHOQppwZqHzc/SjK8nTjP9diEdQiMSiLuO3N9Ounv4qaubBZ2PHE8BMS+yZ172fHpWrjE6eUfo/hMH/sF4NxjOkWM8uJ/W9RfaigJHxZ26pLprdSqffp6uqW+wxpn4y+Ntvfq1hAXzNBAgcOmR8oo6JNjv40igQwsJmGSuCHOjpMkpv8S9tI5mghoU6tCFJLPGIPEiWGwY9WGpDiCbwJ3zk5vKecPPI/vDmvaQPlBPg1mWCP06ePXX/9MF+md/9RI39b16NGSAl4mNWp7T057tmoXICddIJFxVn3cWSfoRr3V4jW0XcLghGUSykTbLGyU5w/AvpTIsgvdV9reddOGlVFKJ8kMMsoO4aDbzsZRXZbDiniDueymdE2C9kcRBOORAC3vOqoGtUGwBfV/aWz4JCgTQRtkdFFCYs48bmJ1y4lvT5ov1dhG601aL/RjY4YePGY7d1CRVUGuY+wjBw9NrNciQz8imBWmZZ7P7DV50/bUlUd3vFydLhgsYed3KxCN6Dc+91uDEEpImuUTGbdQ4lu5F8fjCSgu4Ya3oneWi1ifIa66b26pctxHfOoxptyI5H9/BGu1SylliKGns6VKJ4kvxr33hoeu0coBsgy6XQ6mFii9J3lCH9nHh8r4+++/T2RwXbJS3IGdpo26xn+IsZu6910wp6W/b4uARfDV4Hxch8liINyYJ9aDpOtCyctgHSObNGga/3ZZ9EGwkuY0iLd+FVpm6I6gwRD+hgWU24qZpv3kSHMwmuDihbEVEbDMBoiZmQFbMK1ijTwEY7XAdwkfGOtGRrz+jVEA/Z3u/+WFI3jTSfskyNI7iskTv/AeyLqHxMe9neSZGUiGuKIRXROqDY3Xp9rcJZ+ AgTRJZoZ rSHRZx7g82VKCsQr3S1wSy76h8xvF5+KWmgep9eOJWfy5392oakhMaNI5gxn8R11MZofNiHfS0vXGRpJG+UgyCxDkGJGw7+wlPFr12hUvSiTJzIir8yPdfuuOsGHGBLXU4qB1/OTBe97fMeqgeF4Qa1vBUZPyXvCqp9Dsf6r1OV/E2uzOUinJeOlNj+y7H8lPUSHBauICwzbOxBwKZ/ggtKedWuhbv+f8ndKOip5jsh1WyUohiXdKtcRArZHhIUJbWIZUy9s89YjmlQWkTWpJFOL12YDf37MhdR0/9hDeR5qjs97Lb0f/v94HvreWgL+BapovGGGtl3dwhmQbhRna63qBFQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: To prepare for adding ACPI support to the tegra-apbmisc driver, relocate the code responsible for mapping memory resources from the function ‘tegra_init_apbmisc’ to the function ‘tegra_init_apbmisc_resources.’ This adjustment will allow the code to be shared between ‘tegra_init_apbmisc’ and the upcoming ‘tegra_acpi_init_apbmisc’ function. Signed-off-by: Kartik --- drivers/soc/tegra/fuse/tegra-apbmisc.c | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/soc/tegra/fuse/tegra-apbmisc.c b/drivers/soc/tegra/fuse/tegra-apbmisc.c index da970f3dbf35..06c1b3a2c7ec 100644 --- a/drivers/soc/tegra/fuse/tegra-apbmisc.c +++ b/drivers/soc/tegra/fuse/tegra-apbmisc.c @@ -160,9 +160,28 @@ void __init tegra_init_revision(void) tegra_sku_info.platform = tegra_get_platform(); } -void __init tegra_init_apbmisc(void) +static void tegra_init_apbmisc_resources(struct resource *apbmisc, + struct resource *straps) { void __iomem *strapping_base; + + apbmisc_base = ioremap(apbmisc->start, resource_size(apbmisc)); + if (apbmisc_base) + chipid = readl_relaxed(apbmisc_base + 4); + else + pr_err("failed to map APBMISC registers\n"); + + strapping_base = ioremap(straps->start, resource_size(straps)); + if (strapping_base) { + strapping = readl_relaxed(strapping_base); + iounmap(strapping_base); + } else { + pr_err("failed to map strapping options registers\n"); + } +} + +void __init tegra_init_apbmisc(void) +{ struct resource apbmisc, straps; struct device_node *np; @@ -219,21 +238,7 @@ void __init tegra_init_apbmisc(void) } } - apbmisc_base = ioremap(apbmisc.start, resource_size(&apbmisc)); - if (!apbmisc_base) { - pr_err("failed to map APBMISC registers\n"); - } else { - chipid = readl_relaxed(apbmisc_base + 4); - } - - strapping_base = ioremap(straps.start, resource_size(&straps)); - if (!strapping_base) { - pr_err("failed to map strapping options registers\n"); - } else { - strapping = readl_relaxed(strapping_base); - iounmap(strapping_base); - } - + tegra_init_apbmisc_resources(&apbmisc, &straps); long_ram_code = of_property_read_bool(np, "nvidia,long-ram-code"); put: