From patchwork Sat Jan 6 07:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petlozu Pravareshwar X-Patchwork-Id: 760480 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2070.outbound.protection.outlook.com [40.107.96.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6ED55232; Sat, 6 Jan 2024 07:52:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="NILdqwF9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlU6CapIOAhspY/npnNo0cDX0wWYmvsH3d9x+pDFd3GVqLqMb69YO0RJNfuWSYPfkheOcIbwgeh0LtETF1dk7TEUKaBrZ82UBbS3kCbUJ2bSu4zMxmhfLmTsY97IGgE4Xsd7wBJNW/YxeESroWaxonXbenRwiCF4VZ6CDIS0FrhIk62R+TT9+co59tV5iTd6pzRIpyX9x51eBAsMGQVP0KNmg7Cy56N4DN7uVypwDRyCdfmHGYFe9XN4Razd3dfgJRXuvIZhrGfKZizaPtTHHV997EYXkaO2+BuBfVr0xT1UsSFtjzv1Wf3290JxEgIb4q7OgbpY3XEdZ6Gv0QnjoQ== 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=jvjztS7so92mNXj5AyvvI7xMsN+GCzW9UZvZG1fEHz4=; b=E2arftG/ZAtR3dBxqB3fPwQksqJ4OdtLjAs32De7f/4fHuRERX7gbTAzP5E4Zjt+gh/Mfu1yLsV1A8jpurUojAr2i8P/DuKz0O0HD2LGSG+8VG8rAiCb+gEgiPTdLeCbeZ88wmmIIpJ+3YY3BZkLo82g4Cj5Qyvav4pMK9Nbo0h/yhvTXLAmJY1BUUcKbTjwXKxy/FciM821zM1s/fYgfAjQdplEBLnHDGMHoJJV6Z/WTGmFDR3cfJDhLyVJxwK/Ktch5NdX7qHhlK105Qozi0EXrv+UfZLOJ9u59U9mY8pf3WRDOMB77FtMts2XdAaeJHiG78MAB0/MUoayBIifqA== 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 (0) 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=jvjztS7so92mNXj5AyvvI7xMsN+GCzW9UZvZG1fEHz4=; b=NILdqwF9iPg+qsOAO+x4I8KbuJDTG7ltEKWMJnZDlmju2FuS8TzicJuIUJfhWEhnwsBjQAPbASxW/50Rj+1at6IjYDElPq5dasV7jYqVPQ8l8QX1vJMs+xuv3XzkfSclXNMK9QNgIRuCoB+0Qc2gzYqMbR+fbTJQSF4u8+KYZJhQixMvnVhvvDBtUMf4Hp3n6pI+CWFLuCnAO0ADupLIsYGXmnfV/zvP6wTHt9OOUKV3hDv7bKf5caDqA8R+jqCDVlcXFJEEMwJFhqTslrXEj9fRizHdCuTU5FspPOSMQTuT67ME5G2wTFTT/TdQLo8pV+h0YGmzC7huBxkuEDa/TA== Received: from BYAPR01CA0019.prod.exchangelabs.com (2603:10b6:a02:80::32) by MW6PR12MB8916.namprd12.prod.outlook.com (2603:10b6:303:24b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.18; Sat, 6 Jan 2024 07:52:26 +0000 Received: from SJ5PEPF000001D6.namprd05.prod.outlook.com (2603:10b6:a02:80:cafe::f8) by BYAPR01CA0019.outlook.office365.com (2603:10b6:a02:80::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.18 via Frontend Transport; Sat, 6 Jan 2024 07:52:26 +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 SJ5PEPF000001D6.mail.protection.outlook.com (10.167.242.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.12 via Frontend Transport; Sat, 6 Jan 2024 07:52:26 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 5 Jan 2024 23:52:14 -0800 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 5 Jan 2024 23:52:13 -0800 Received: from build-petlozup-20231217T213756539.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Fri, 5 Jan 2024 23:52:13 -0800 From: Petlozu Pravareshwar To: , , , , , , , , , , , , , CC: Subject: [PATCH 1/3] soc/tegra: pmc: Update address mapping sequence for PMC apertures Date: Sat, 6 Jan 2024 07:51:32 +0000 Message-ID: <20240106075134.3933491-1-petlozup@nvidia.com> X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D6:EE_|MW6PR12MB8916:EE_ X-MS-Office365-Filtering-Correlation-Id: 220909dc-9a10-4555-5a73-08dc0e8c6cda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zqDsNiXtBXQqASj6h+ddfeoEjiCF0kNKZI1hoRyKrsvzWgXiFXVt2RB1KYf+CCL363BBer9o5Kl/g4McoBI9bOb6Vvv4u4th4rMe/9JECMkpjGnLZjptIyKIG6xVdwgwIigxbYiYSP30ZoepY6bI/+N7auNXmxFlXVmnctMmuKjbrUTFnEGYIwfvudawnGVPxsyh4M5EopLXqof+S6nAfmqNAL61uhmMm6Uv5ri/vlwAkC2gtiHALzzfBOjqO40H5GNSQYaFq90COXnhGwtkE3k4eBjknauoo2HPu6JDLFgEWf7IpY/IHupfnFD01U/Olnf5i9HIflc3UIdE4iOQvp3AJC6mXNroCyS1M7dFMEYAPTqrtteBgjILr1tPsGy7zRNFw0Q+W1nlxRfUQ0h92Wh0dhYgKALpO56DpzdK7R4XC4WUIsaeIyWqZKZT/41n51JZpbgRr/s/jIV3Lz+nGCscIy0PVdnXZCkksdeD54PJUaFCeBqIdYBWhBLY8CL8hoDN37oIuyDEy71Ye00sE9LBAhoXoVZiv0ecDlr9SXPh5E9uWbysNLEt4QgrS3UGXoRlQgZNrj7NvAAPYNyVYrpMksjVOoieYnWzLupN2B6pqluTcPrDGOlXc8OT0uNQdY2fFU46thZceKNn8nTUxv6whUuMfBcGPhNUyUVbrx7KfpIUkuF9hKT8Ndfypo1V5NQ97xX6DURUngDG8hfQKoUvXq1yi8D1pZhDfrDNC3Z3lVNRABiYBEnxfAnHTJNB 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)(136003)(376002)(346002)(39860400002)(396003)(230922051799003)(1800799012)(451199024)(82310400011)(64100799003)(186009)(36840700001)(46966006)(40470700004)(1076003)(26005)(426003)(336012)(2616005)(478600001)(6666004)(7696005)(47076005)(36860700001)(83380400001)(107886003)(2906002)(5660300002)(7416002)(41300700001)(316002)(70206006)(110136005)(4326008)(8936002)(8676002)(70586007)(921011)(82740400003)(86362001)(356005)(7636003)(36756003)(40460700003)(40480700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2024 07:52:26.2977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 220909dc-9a10-4555-5a73-08dc0e8c6cda 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: SJ5PEPF000001D6.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8916 On Tegra SoCs prior to Tegra186, PMC has single address range only. Starting from and after Tegra186, PMC has additional address ranges apart from base address range. Currently in PMC driver, we try to map these additional address ranges on all SoCs and if we fail then we assume that the range is not valid for an SoC. This change makes it more explicit on which address ranges are expected to be present on which SoCs and maps the additional address ranges only on SoCs from and after Tegra186. Signed-off-by: Petlozu Pravareshwar --- drivers/soc/tegra/pmc.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 6dfcc7f50ece..0bc983f6b088 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -384,6 +384,7 @@ struct tegra_pmc_soc { bool has_blink_output; bool has_usb_sleepwalk; bool supports_core_domain; + bool has_single_mmio_aperture; }; /** @@ -2885,31 +2886,28 @@ static int tegra_pmc_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wake"); - if (res) { + if (pmc->soc->has_single_mmio_aperture) { + pmc->wake = base; + pmc->aotag = base; + pmc->scratch = base; + } else { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "wake"); pmc->wake = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(pmc->wake)) return PTR_ERR(pmc->wake); - } else { - pmc->wake = base; - } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "aotag"); - if (res) { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "aotag"); pmc->aotag = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(pmc->aotag)) return PTR_ERR(pmc->aotag); - } else { - pmc->aotag = base; - } - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "scratch"); - if (res) { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "scratch"); pmc->scratch = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(pmc->scratch)) return PTR_ERR(pmc->scratch); - } else { - pmc->scratch = base; } pmc->clk = devm_clk_get_optional(&pdev->dev, "pclk"); @@ -3300,6 +3298,7 @@ static const struct tegra_pmc_soc tegra20_pmc_soc = { .num_pmc_clks = 0, .has_blink_output = true, .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, }; static const char * const tegra30_powergates[] = { @@ -3361,6 +3360,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = { .num_pmc_clks = ARRAY_SIZE(tegra_pmc_clks_data), .has_blink_output = true, .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, }; static const char * const tegra114_powergates[] = { @@ -3418,6 +3418,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = { .num_pmc_clks = ARRAY_SIZE(tegra_pmc_clks_data), .has_blink_output = true, .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, }; static const char * const tegra124_powergates[] = { @@ -3562,6 +3563,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = { .num_pmc_clks = ARRAY_SIZE(tegra_pmc_clks_data), .has_blink_output = true, .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, }; static const char * const tegra210_powergates[] = { @@ -3725,6 +3727,7 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = { .num_pmc_clks = ARRAY_SIZE(tegra_pmc_clks_data), .has_blink_output = true, .has_usb_sleepwalk = true, + .has_single_mmio_aperture = true, }; static const struct tegra_io_pad_soc tegra186_io_pads[] = { @@ -3922,6 +3925,7 @@ static const struct tegra_pmc_soc tegra186_pmc_soc = { .num_pmc_clks = 0, .has_blink_output = false, .has_usb_sleepwalk = false, + .has_single_mmio_aperture = false, }; static const struct tegra_io_pad_soc tegra194_io_pads[] = { @@ -4107,6 +4111,7 @@ static const struct tegra_pmc_soc tegra194_pmc_soc = { .num_pmc_clks = 0, .has_blink_output = false, .has_usb_sleepwalk = false, + .has_single_mmio_aperture = false, }; static const struct tegra_io_pad_soc tegra234_io_pads[] = { @@ -4235,6 +4240,7 @@ static const struct tegra_pmc_soc tegra234_pmc_soc = { .pmc_clks_data = NULL, .num_pmc_clks = 0, .has_blink_output = false, + .has_single_mmio_aperture = false, }; static const struct of_device_id tegra_pmc_match[] = { From patchwork Sat Jan 6 07:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petlozu Pravareshwar X-Patchwork-Id: 760937 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2046.outbound.protection.outlook.com [40.107.237.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62C414411; Sat, 6 Jan 2024 07:52:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="GqHAQLV5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EuNsMAgoVadGN1kdPQsWB+rf7d6WDWcE6bAWcVYYX8ebJJks0PLB0qIcP38eyce5m+Wck0pf8fxRISZoBHGT72u3tYXw8k2d+9kUPTfQKEG2VVmScsJltCjP05N+DMbA9Ucl9UBp85a8x/LCPVAfkuxvVWCPj0803PO7STn5lY2gUu3/1IrbeDMhnClVCYARLIGeAtLyxjV3M5aOJ6AqturCHq4Rq065CQ5SyFf/6fPbkSqlqm4UwRWpOA4LlCOgOgwNDww6VEc4v6MVR6d+1GY4WYBUz7GXfERB6EFH/R9toY/iRnM2seYlb1X3BmiGOmyeZATdG11EzTx/aVNNvQ== 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=YMNY+ZA7KOFaZfxh6sFnvNa1Cmx9tTN1l8kSFCsgq4I=; b=RsaUxQ3Uwc7rmClcqsNh4O64jpFgJtA2YCvgr9iMiB5IeJcZhuTuS5s7GYh0Ww7PEF02DnX+IA649c87HvDE6SPNPCp0Gy7llvYVtMJDhstVf/yFlRgQjfYmvVC02+5VmjcjHKaJ49Ai1WQKz4rki5AQAVz7ytjM7HpaQA57lrqCeb/FhSESxrUvLGQitXGqt78JE4jjBNc2PVjqo4LlSgzpMgoGaM7+lwwIgg7FQZFLaZk3XFpgahM/o7KnegPc7al+KRXsXbZmXU4TLeed+VpQpu3xFcELLYo1ililTGMQS8fuPTjx6OKoyYv+9btKaUHrRuYCE3eBXhw6NV0yAw== 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 (0) 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=YMNY+ZA7KOFaZfxh6sFnvNa1Cmx9tTN1l8kSFCsgq4I=; b=GqHAQLV5pM0AjSbGleWvVeO+VcHoTjyaOxx7mguzzXue3bsL9+zS3rkEMeocZeDW/9RchfkN5wRi4XNjpoqP/YR+zmBdGNTkYsKUVacCQ+0Nk5KFRKX1MQepov2gOzIIejXBMMexMQbldu7xX9qLQLxmCk+GkOH9fbHMs4AFeUuatE7FsupoQfFkR0nlJ8JT+9XpOfTngibZpPA5Bzu5QeEAmWUZrAH5s/IHBsBdinpr3joyo+wbguzTrMCHdJboGQMrNdLR06VTM6v/JyC8ZQjNU4S6ujS9XLG52KVMu8HYmU+KCc5+LJUk0Sbr6zrxAcJOnOz/2k9vyAAbTmXIHQ== Received: from BYAPR21CA0011.namprd21.prod.outlook.com (2603:10b6:a03:114::21) by CH0PR12MB5330.namprd12.prod.outlook.com (2603:10b6:610:d5::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13; Sat, 6 Jan 2024 07:52:45 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a03:114:cafe::79) by BYAPR21CA0011.outlook.office365.com (2603:10b6:a03:114::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.7 via Frontend Transport; Sat, 6 Jan 2024 07:52:44 +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 SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.12 via Frontend Transport; Sat, 6 Jan 2024 07:52:44 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 5 Jan 2024 23:52:34 -0800 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 5 Jan 2024 23:52:33 -0800 Received: from build-petlozup-20231217T213756539.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Fri, 5 Jan 2024 23:52:33 -0800 From: Petlozu Pravareshwar To: , , , , , , , , , , , , , CC: Subject: [PATCH 2/3] dt-bindings: tegra: pmc: Update scratch as an optional aperture Date: Sat, 6 Jan 2024 07:51:33 +0000 Message-ID: <20240106075134.3933491-2-petlozup@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240106075134.3933491-1-petlozup@nvidia.com> References: <20240106075134.3933491-1-petlozup@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|CH0PR12MB5330:EE_ X-MS-Office365-Filtering-Correlation-Id: b309bfbf-4cec-47f5-7f00-08dc0e8c77bc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r6ZYajYaPbPwSiNev6C8ddponl6gpa8KhveMNqdQA0yCy7Uix4SZqm8ehPtUbUFGbqRDtX8BIetEnbxEK+/LLtFQp1MbawdpAb4qCqExMlr6p1E3W89KyEWrv9Y9Y+E2eYhl9w/EMLnK+TGXv5jiafuoybRl/5bWKXHDOGTUoox7Umk2TUdMlzQ9cwiIIwdCw9USifjV0dvRGtz25M64oOdCw7NrrtrFN3rt1/UVcGDSO4rghVfN27GFFjLmcBxoiLdpTiwGyVWNmNEBFPD7qPNFUaRoKLXgHu1QB2UmOodN3SWC30ZUw9WxkVO9DmeiE3m9iAcRBsdFVmUn3u7trNXhtc+lxB4EXAacS2XrYTPvSwfN7+hAg+p+chs+RYuNyklVab0/FBc9oFswXgbHc6gSyvaKDgVJvD4HOZdIQKttREnv1PmqFq9ejVR/vnrhHpUtJBrYUciG8k2G85jA8Y84tsc4m5SKREwbvGL0XmFbKVvzXptQ1Pg8jVKJ2bdD75ffX3052RgFJoJvxo+88OsODsIpA+8Lckgg/lysL1rtmQJKGtdmwh59wDYCaFC072nsHmc63U/dLQSzDn/ATgviyibcCzx6L4vmSpg5740hOzVrwS3+aQUgZf4XNwcmoCRZGD5HzO4usKLysyVxqLhbanhT6SKDIMtw7UxUlSPKNjDGC1UndVmj8hzGWfOLJ271ea/qWQl+G4w7Z+a4f+a9NUbxHPrKxrChJsVtI40XwN7DLccQ9ncqZyDOPGkbcPAidMIL+XDEMlF+AJXuPw== 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)(136003)(39860400002)(346002)(396003)(376002)(230922051799003)(451199024)(82310400011)(64100799003)(186009)(1800799012)(40470700004)(46966006)(36840700001)(83380400001)(1076003)(26005)(426003)(336012)(107886003)(2616005)(82740400003)(47076005)(36860700001)(8936002)(8676002)(4326008)(5660300002)(7416002)(2906002)(110136005)(7696005)(316002)(41300700001)(478600001)(70206006)(70586007)(921011)(7636003)(356005)(86362001)(36756003)(40480700001)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2024 07:52:44.5570 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b309bfbf-4cec-47f5-7f00-08dc0e8c77bc 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: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5330 Scratch address space register is used to store reboot reason. For some Tegra234 systems, the scratch space is not available to store the reboot reason. This is because scratch region on these systems is not accessible by the kernel as restricted by the Hypervisor. Such systems would delist scratch aperture from PMC DT node. Accordingly, this change makes "scratch" as an optional aperture for Tegra234 in PMC dt-binding document. Signed-off-by: Petlozu Pravareshwar --- .../arm/tegra/nvidia,tegra186-pmc.yaml | 83 +++++++++++++------ 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml index 0faa403f68c8..2716610a1a02 100644 --- a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml @@ -23,12 +23,7 @@ properties: reg-names: minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - const: scratch - - const: misc + maxItems: 5 interrupt-controller: true @@ -41,25 +36,63 @@ properties: description: If present, inverts the PMU interrupt signal. $ref: /schemas/types.yaml#/definitions/flag -if: - properties: - compatible: - contains: - const: nvidia,tegra186-pmc -then: - properties: - reg: - maxItems: 4 - - reg-names: - maxItems: 4 -else: - properties: - reg: - minItems: 5 - - reg-names: - minItems: 5 +allOf: + - if: + properties: + compatible: + contains: + const: nvidia,tegra186-pmc + then: + properties: + reg: + maxItems: 4 + reg-names: + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + + - if: + properties: + compatible: + contains: + const: nvidia,tegra194-pmc + then: + properties: + reg: + minItems: 5 + reg-names: + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + - const: misc + + - if: + properties: + compatible: + contains: + const: nvidia,tegra234-pmc + then: + properties: + reg: + minItems: 4 + maxItems: 5 + reg-names: + anyOf: + - items: + - const: pmc + - const: wake + - const: aotag + - const: misc + - items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + - const: misc patternProperties: "^[a-z0-9]+-[a-z0-9]+$": From patchwork Sat Jan 6 07:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petlozu Pravareshwar X-Patchwork-Id: 760479 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F57263AD; Sat, 6 Jan 2024 07:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="WjUapb+W" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bSIW+RCe8zIINW1R09pfVE06zzYv5wxkdaJyyVbIukB51o6SAbfWUjIYYP0ELXOXDm4aEFzs9xffgprbaDDIfSuMPqJ4jaNL9hikC+3s1X0ICm7hxOON0UEm/sm/GSFpmtwDfYHoyEek1eVZUaRW5n74LUX0d2TFuFRrAptanL2AZ6o4jOua1WSGxhm4jl0nGpZOobwmaPv0/4HFm0txOIYlkiDoY3eddeUobY8DbzAFic0gTTmDH1S0GKhNlnpQTpKl38QuSnZcbju73Tkp5wdynjuGckvAMh5QwFQ7y3y2iuApedHuMDIu0FVMgPuDtzfm0k43a8kNKFetzkKB2w== 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=x+zSkDCkegGMZxyQOmJbK7cVsTWX8LzEg2S9aez9dMM=; b=Ab+5VTKlsRNcLtSDWWMQ0s4WKRAh9tKjo3avzqPFhuZhFLIpFO8IYQGsT7+ELKkHDd0Lt63P0zB/ZsSqxxTXYC73f5obOtUhGPOFApXe8GNMo05YO/Hhh2IP4yo49ajbIHiziqv3sFC1XaBeWE5K/JUwOjbYnKnrAcKUYWinnV0XIX7+PUfqDl9WL0ur5wG0z2pxjWbHqkHswZDvm0vWs+TXPkYDbCrQkWbpAKFAFe/Z0S2cxMapvgdFroJ6OIXN82y+bFoxcEk5x4elokLE2h1uLjKO024DDtm4J0+KAtqfO6V7gzkJrgd5K531gG3/QDwQxecrexUXFXvXs34Z2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=x+zSkDCkegGMZxyQOmJbK7cVsTWX8LzEg2S9aez9dMM=; b=WjUapb+Wz2wRv6Ch34xgB+DesNRv+ExkCrRV24+eE/ufdR0a3WVcyCPl/dGVTDXA1P4y15C0fIVy+YfXQ16ag5L+NXPOzgPfIZn2tiiBA16HF41i1/HPoxxJOO4d/hcOToC2tGY/gmGq7hocLUIBNQvCJPXcW2eW3pTp3BWEnL5EYJAqpIbIlomOi1hvlHpd1vvU7fBAYW30awYxehs067awPemIXB2af5loUCoWxM6v0hGRc6j1gJT28ikqyf+icQoouNuhT2DKE7nDkwx4mCuUY06CuIK6VGem79aGPVxy0o5LgP9SohnxRRkWoB0qFXIAY+X5AGg1Az8WfcPSQw== Received: from BL1PR13CA0389.namprd13.prod.outlook.com (2603:10b6:208:2c0::34) by SJ1PR12MB6122.namprd12.prod.outlook.com (2603:10b6:a03:45b::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.18; Sat, 6 Jan 2024 07:53:02 +0000 Received: from BL02EPF0001A108.namprd05.prod.outlook.com (2603:10b6:208:2c0:cafe::e1) by BL1PR13CA0389.outlook.office365.com (2603:10b6:208:2c0::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15 via Frontend Transport; Sat, 6 Jan 2024 07:53:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0001A108.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.12 via Frontend Transport; Sat, 6 Jan 2024 07:53:01 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Fri, 5 Jan 2024 23:52:45 -0800 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; Fri, 5 Jan 2024 23:52:44 -0800 Received: from build-petlozup-20231217T213756539.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Fri, 5 Jan 2024 23:52:44 -0800 From: Petlozu Pravareshwar To: , , , , , , , , , , , , , CC: Subject: [PATCH 3/3] soc/tegra: pmc: Update scratch as an optional aperture Date: Sat, 6 Jan 2024 07:51:34 +0000 Message-ID: <20240106075134.3933491-3-petlozup@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240106075134.3933491-1-petlozup@nvidia.com> References: <20240106075134.3933491-1-petlozup@nvidia.com> X-NVConfidentiality: public Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A108:EE_|SJ1PR12MB6122:EE_ X-MS-Office365-Filtering-Correlation-Id: bf76b01f-1af1-444b-160c-08dc0e8c81e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qRbB3J1c57UEm4+efbUTEFi/oXSPg7fzOHO3Uxe1maYAGdlUV5ffPaTg2WC/o1i82c4C0nQMUFCME94yoNyHMVcPk7EfP1is/xYqv2P0o4COwCqRdM7TMe50N0TlnwVP05/C2XR042atGEv1Yj3ZXDUGOrVxSdjSlxWeu0V1i8rUQKrM3uZM17CPYbQMogRVy4msS6ViXYaWYJK5Jld1zFr7hwhjFyWPrri1mZZLMdHQGkDrBL4pdkbRN8zCisGs7vDfXW6Bii/NKN9ijlrKCvyRTTZJ+T6HssUvuL1fXUa1R8lha85xeWVeUQfDssaA5kez7JdHhqND6CE5/PIQqeM1yYky50nzxOXq1tDruUTCQWHtlqvHL4yJs8YjC4q7H64hWkBQ1bjHxzeKSCW6ocdeWzSCJVuF7XCeMP/f4nM1sUIYL0W2WV8rNr70WynAy5daNG7wGIUs0iF9kU2pVwOKPQcGI0lmJXjor7NQSrkfVlmC8jQIKJz9LtMAhfNxihbvin+tB9XtRnc5uzeQLwKmJIN09fQ7LUjli30LE4bNP1gHYT1+5onp0bHfJbkTXxL5skWE1VYdnyFfoAky5eMLxB72bnkJbYGadEzEfrnuMJz8J6QUV6YvoBFLu/0P23DcJN0BrYBAk+FJRCxRLHCuitCz03bVOrGhavSG1OxG6Y/OPMLl/tCy/M4afh8O4ZMOAdB2RhKL8UEM9BUq7ol94vScDETJg5rTCTGg+m3wrTcKnpx8sO5M8w0EfqZk X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(346002)(396003)(39860400002)(376002)(136003)(230922051799003)(186009)(82310400011)(1800799012)(64100799003)(451199024)(36840700001)(46966006)(40470700004)(107886003)(2616005)(7696005)(83380400001)(26005)(336012)(426003)(1076003)(921011)(41300700001)(86362001)(4326008)(7416002)(8676002)(8936002)(110136005)(316002)(5660300002)(2906002)(36756003)(70206006)(70586007)(6666004)(478600001)(36860700001)(356005)(7636003)(47076005)(40480700001)(82740400003)(40460700003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2024 07:53:01.5024 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf76b01f-1af1-444b-160c-08dc0e8c81e2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A108.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6122 Scratch address space register is used to store reboot reason. For some Tegra234 systems, the scratch space is not available to store the reboot reason. This is because scratch region on these systems is not accessible by the kernel as restricted by the Hypervisor. Such systems would delist scratch aperture from PMC DT node. Hence this change makes scratch as optional aperture and also avoids registering reboot notifier if scratch address space isn't mapped. Signed-off-by: Petlozu Pravareshwar --- drivers/soc/tegra/pmc.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 0bc983f6b088..6948f78c7a4a 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -2903,11 +2903,16 @@ static int tegra_pmc_probe(struct platform_device *pdev) if (IS_ERR(pmc->aotag)) return PTR_ERR(pmc->aotag); + /* "scratch" is an optional aperture */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "scratch"); - pmc->scratch = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(pmc->scratch)) - return PTR_ERR(pmc->scratch); + if (res) { + pmc->scratch = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(pmc->scratch)) + return PTR_ERR(pmc->scratch); + } else { + pmc->scratch = NULL; + } } pmc->clk = devm_clk_get_optional(&pdev->dev, "pclk"); @@ -2919,12 +2924,15 @@ static int tegra_pmc_probe(struct platform_device *pdev) * PMC should be last resort for restarting since it soft-resets * CPU without resetting everything else. */ - err = devm_register_reboot_notifier(&pdev->dev, - &tegra_pmc_reboot_notifier); - if (err) { - dev_err(&pdev->dev, "unable to register reboot notifier, %d\n", - err); - return err; + if (pmc->scratch) { + err = devm_register_reboot_notifier(&pdev->dev, + &tegra_pmc_reboot_notifier); + if (err) { + dev_err(&pdev->dev, + "unable to register reboot notifier, %d\n", + err); + return err; + } } err = devm_register_sys_off_handler(&pdev->dev,