From patchwork Thu Jan 2 17:03:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Visavalia, Rohit" X-Patchwork-Id: 13924660 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 739CFE77188 for ; Thu, 2 Jan 2025 17:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lH2b+Yw84xb8+PrnQXwbNTY4bmGa+nOWnxNHSaT1oMg=; b=UPnOJHyk+g3/3Gk66SJuQVHa88 wrFavtXxl1yacxuvxXbH6r+fYXNiy63ZEBf4qQiYkYkrrZP7CYwfT3PsUAOtc95AyMKC5prqwgQs5 ie0eTBtwORbmJpYmYeTlk4A7CK2zDVcAts9uP6+WefM8U1l4PFXwxHA9b24mv0XWnRbhDhuWFjC+O defATI5VATmQJcN/Ws/G1QjKq4GH7my2t0DDrOcQePxEVsFsnSrxH8lofjli6MraeYCuBhx1PYMUP fwYQ6coRY0xULiEpR0pItWM2iftqJ9UsKAZOwwxuHK6uk6IaFF5dUKgOJ64RLe9AqlIvt4a4F2feX Pk7LMovw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tTOhA-0000000AwZo-1gTa; Thu, 02 Jan 2025 17:09:16 +0000 Received: from mail-mw2nam12on2060a.outbound.protection.outlook.com ([2a01:111:f403:200a::60a] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tTOcR-0000000AvUt-3K7n for linux-arm-kernel@lists.infradead.org; Thu, 02 Jan 2025 17:04:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EOnpJvUUpnvMBL1SMia6BJhGEIWMaT/hal/ty0SkJW6mH/oWlWQRMBUQoOfA43V+f+pcJzy7M9m3v/UHow/p8izA8sxq1VlpD/7M/RtLPVsGZIombLJUM9BiXdBgUfkAeppXjubK3O33tnYR5A7c+2wpl07n8g9McCIXjOOtporOuqB7F0+0eotXXEfV5Ltj6Q7QDLyUE4tbNiWei93PaX/DmRSluKcG11+C4/TFDR0/LmU1NwsTeECm1ha4jbUGCykD+Gthy6W+e/nY2ucNDct+xY+WyCaNQhYHhsNO4Hp+Hufy0u590fIVdnV+JFjRQz5p5b8LLrrCS2TLhak6/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=lH2b+Yw84xb8+PrnQXwbNTY4bmGa+nOWnxNHSaT1oMg=; b=RRBJk1R+gFuHuikqhn+wklDkqNHDx1noKTjGqDEHAGnk/L6ePmEH40o+B/gRhTT3JVXmHQT6rY8tCG2Xtxeyc6RzOLKIuX2tALwkJqwxk9qvT57dywCfEoK+FgpofuThCwWk3NfTsen52kNpKH8TE4DPli3HI25Xtl1zB6nPYILq2bMA863RbMHWiYeM8e8x7oSlV8yayi4T+uO64mmcf6LhQbhZUPHxOzx6VSILtQ25gw7PBwhGfAcTOc+4LACSGbwLr2b6Y9PsPONfEWZJA3ZZnclvJ2wxmYpH+hypT0G3DOoomyAesg1FlN5bZFCyvYjgrLrs3LxgeFauIx3amg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=baylibre.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lH2b+Yw84xb8+PrnQXwbNTY4bmGa+nOWnxNHSaT1oMg=; b=Rt1+yES51lQF8qY6Qg4UMlOUmRZWNuf7X3PN2o4jzK6yL1PSTg9oAY4Xs0QBi3tbGiiZOpxHyYBqSRZa6Z5V/dNl99Eu2vC4FFRNKrPZj5wxCsQA0hDd/sDZqipZU8LG3/vNo3ih+JGYUBYWaOH8ZpmYBcIYIqjvivvEs4zGsqk= Received: from BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) by LV2PR12MB5919.namprd12.prod.outlook.com (2603:10b6:408:173::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8314.12; Thu, 2 Jan 2025 17:04:13 +0000 Received: from MWH0EPF000989E8.namprd02.prod.outlook.com (2603:10b6:a03:c0:cafe::a8) by BYAPR05CA0021.outlook.office365.com (2603:10b6:a03:c0::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.6 via Frontend Transport; Thu, 2 Jan 2025 17:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000989E8.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8314.11 via Frontend Transport; Thu, 2 Jan 2025 17:04:12 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 2 Jan 2025 11:04:11 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 2 Jan 2025 11:04:10 -0600 Received: from xsjssw-mmedia4.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 2 Jan 2025 11:04:10 -0600 From: Rohit Visavalia To: , , , CC: , , , , , , Rohit Visavalia Subject: [PATCH v2 3/3] clk: xilinx: vcu: Update vcu init/reset sequence Date: Thu, 2 Jan 2025 09:03:59 -0800 Message-ID: <20250102170359.761670-4-rohit.visavalia@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250102170359.761670-1-rohit.visavalia@amd.com> References: <20250102170359.761670-1-rohit.visavalia@amd.com> MIME-Version: 1.0 Received-SPF: None (SATLEXMB05.amd.com: rohit.visavalia@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E8:EE_|LV2PR12MB5919:EE_ X-MS-Office365-Filtering-Correlation-Id: c483f838-ccc7-4029-d4e0-08dd2b4f7b09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: pHCqKjg0bwdll0R6fnCK1Yu2m6PaBV6wpfo6sDyknnbvYxsp9clYsoXz8KMI3QLFwuPxPP8e+vcMwdCvmyKwMQ3nZQUlglXYOZA4TYL0qWuZ+nodW5n/Od9+Gk/WFSIdcpaIU7Hz20AIGPysXXDN5oXTW6mxq5aDw1AulAFq78/+1Buaxo0szwExs3JxG8wcDrPR9ERvqOeX1N0k4c9gBzTOOtUsFRM5Qh7qfT5sF3Xhxnt7zX4riHMGmwskmD/KIqL1LbeArjOEnE+1b7Uby8qaRMY/nzTEIbkQqC/ZQqRa/Q8ypYKVqx0lPTzOByOU/ibMRN8i/Ufr7iuZQ9xtShwGmRq0FG4tpvpKuH1E6ziKCsGczeZZ3aenkmHYNYj3XPCLSS39CpQJJuNaHIm7NJHR/dOE28YB4NVgwntsVnI1pte65vUbE212s70WLWKxtV1yN0UlNHZ6AC1o+h+kvNG/lOWBndX8JRw7EdlYjyAO3LRYOPWo+qmB686+QGitLtHMVdsedM3k0RwUJFrASSVnWnY1sBPhEPMrFaOFT7ZUsmVe2LGpjtiMr1OXir++Io7kSrCbdK2/GqO15h7mErk+0GnsckQ0VgYqsYmvfpalhlZFUAOqTNnzRTITk+b/bX/GRzD8SR9QrccGFNbIn9/UaO1ZGg9pwaU8ANAuE9Y+O1QQpiRslde1yQvAMoIBJsVaKYUMAibWv/EPr1+6ju1tMd2tzNhrzx17DhGv6L3EAVAPIiPKI7nETbNLaPpjLH5Ac9tkg6+5QPrC6RFqxLhDz2e2Fmmo0dT/8nkFhsQpryRT+qOww6dvBThc2wb72xhM1JQWz2CQc7PLC1IhZ4hDoG5FL0yKwUUK1bks2oU3gsqzS8U/Y3N9c3KYVbU5Ga4rHeaYxtn+TkDb2XtXsVS0n04Obkb6/qM8ZkFITi6XHGmnn2gzsfCx9oaYcZvnl1QhLknqZ5zsbxw4fCU2OJHqqQ4L8DUfp6yIVbe9XOKKZyNCQt3CKWJ3SKGaAubzFp3VCNpIr1TPxliNz3m0712YBikLE3Ho57+oF4PWO3K86jUeiXq2LIlDQJVoRvr8zySF7UN2W7G82St8mgLQfmZQiskMTzD3RzS1KogHw9c7bqWuSWcNr3yVkBfOBmQ2kWcQw074SIUp9kVgxINGZfq0gllCEIzFBTUK5mA17LcwdEx/y29w52cjxdCkR/QdRPikG9NnyGpg2uw1eWgHohXjsV9BCgIP963dacn1dj1qSIYqAc7wAW4HE1N46kBKRQDYk6XzrtCgHu5I61E7fShhHEtLVuYDtRu3PHBJA1kXARCwliY3e3yinHsA35WE1CHeXnqX2exDXhCHDNPT+OCP+Guki0g935uxNP2LHONP4Pu2lZeZZ+WLDmelJH3Pwx84OQsFRiTFw5yDAMLzJq6a3mn5iBTBnCtKl5fwZKeMf4pdqPeEGXxCSOzwKIJKqwiwtviKOxBmsMiwvBdorelUDv4vyAgdFk3gGPIwgJc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2025 17:04:12.1568 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c483f838-ccc7-4029-d4e0-08dd2b4f7b09 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5919 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250102_090423_833145_719A8C36 X-CRM114-Status: GOOD ( 18.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Updated vcu init/reset sequence as per design changes. If VCU reset GPIO is available then do assert and de-assert it before enabling/disabling gasket isolation. This GPIO is added because gasket isolation will be removed during startup that requires access to SLCR register space. Post startup, the ownership of the register interface lies with logiCORE IP. Signed-off-by: Rohit Visavalia --- Changes in v2: - Changed patches sequence to have patches with "Fixes" as preceding in order - Used dev_err_probe() - Moved warning to dev_dbg() and updated print with more detail - Link to v1: https://lore.kernel.org/linux-clk/20241226122023.3439559-2-rohit.visavalia@amd.com/ --- drivers/clk/xilinx/xlnx_vcu.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/clk/xilinx/xlnx_vcu.c b/drivers/clk/xilinx/xlnx_vcu.c index c520ae1ba65e..50f7c3ecb07c 100644 --- a/drivers/clk/xilinx/xlnx_vcu.c +++ b/drivers/clk/xilinx/xlnx_vcu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ * @dev: Platform device * @pll_ref: pll ref clock source * @aclk: axi clock source + * @reset_gpio: vcu reset gpio * @logicore_reg_ba: logicore reg base address * @vcu_slcr_ba: vcu_slcr Register base address * @pll: handle for the VCU PLL @@ -61,6 +63,7 @@ struct xvcu_device { struct device *dev; struct clk *pll_ref; struct clk *aclk; + struct gpio_desc *reset_gpio; struct regmap *logicore_reg_ba; void __iomem *vcu_slcr_ba; struct clk_hw *pll; @@ -676,6 +679,24 @@ static int xvcu_probe(struct platform_device *pdev) * Bit 0 : Gasket isolation * Bit 1 : put VCU out of reset */ + xvcu->reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(xvcu->reset_gpio)) { + ret = PTR_ERR(xvcu->reset_gpio); + dev_err_probe(&pdev->dev, ret, "failed to get reset gpio for vcu.\n"); + goto error_get_gpio; + } + + if (xvcu->reset_gpio) { + gpiod_set_value(xvcu->reset_gpio, 0); + /* min 2 clock cycle of vcu pll_ref, slowest freq is 33.33KHz */ + usleep_range(60, 120); + gpiod_set_value(xvcu->reset_gpio, 1); + usleep_range(60, 120); + } else { + dev_dbg(&pdev->dev, "No reset gpio info found in dts for VCU. This may result in incorrect functionality if VCU isolation is removed after initialization in designs where the VCU reset is driven by gpio.\n"); + } + regmap_write(xvcu->logicore_reg_ba, VCU_GASKET_INIT, VCU_GASKET_VALUE); ret = xvcu_register_clock_provider(xvcu); @@ -690,6 +711,7 @@ static int xvcu_probe(struct platform_device *pdev) error_clk_provider: xvcu_unregister_clock_provider(xvcu); +error_get_gpio: clk_disable_unprepare(xvcu->aclk); return ret; } @@ -711,6 +733,13 @@ static void xvcu_remove(struct platform_device *pdev) xvcu_unregister_clock_provider(xvcu); /* Add the Gasket isolation and put the VCU in reset. */ + if (xvcu->reset_gpio) { + gpiod_set_value(xvcu->reset_gpio, 0); + /* min 2 clock cycle of vcu pll_ref, slowest freq is 33.33KHz */ + usleep_range(60, 120); + gpiod_set_value(xvcu->reset_gpio, 1); + usleep_range(60, 120); + } regmap_write(xvcu->logicore_reg_ba, VCU_GASKET_INIT, 0); clk_disable_unprepare(xvcu->aclk);