From patchwork Wed Sep 22 12:37:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Kashinath Jakhade X-Patchwork-Id: 12510419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1A91C433F5 for ; Wed, 22 Sep 2021 12:38:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6BDC460555 for ; Wed, 22 Sep 2021 12:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6BDC460555 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=4fpDjj2yJOuDU1xXi4tsxfiAyWfY3KcI6cD/XbpjJE8=; b=J+6DJPvaawuY+O b+oyDsdrmnSukp8izqo1CalidpgIA5KB1N+JSCjAAbpWesGhwLQTiwP/qKrqonSxoeOuSwbNcz6ky cz+UN6lPc5HMfPldRt33cNckg7CT9XY46IaM4yo1xDWRRmCHl19prtv8jnzVOcrKy/LKkhFqL76BX MKisYU4444kOqOT57J3IK+BegMaW/XnoeLnfDzFcchy/kDJWy4IO4OFo63LeyPkhYB8Q33NVtlDf1 1PTMZZM9b/yFE12JGY9LZsSxPU+eV9h09u7UnJ2NDA16bdwpKBgtO3lkr0I6PqaeC+7TjFkRwzafu +YDjLsgdKB8OUlF/qKGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vi-008O49-Mu; Wed, 22 Sep 2021 12:38:02 +0000 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vf-008O2g-7z for linux-phy@lists.infradead.org; Wed, 22 Sep 2021 12:38:00 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18MBWLIK010092; Wed, 22 Sep 2021 05:37:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=MKg7JQwxA4RPNqr6icqL8NswvNa+SZUHYBXn85QczIs=; b=GNEl/k7KCT1jRnZS1TQZNJxQOfivUBbkK8c8S5aBnnDgFmTxBmA4vwVEYA9//x+vwhcO rvu5isj4Y3Y050ApvfJDDcfairQRi3X5nWvt8XDYh+LKSNlYi8hqdtkHGvqrR29Mlixf 8zD5NnGKtWgc8E5wQnl6zr6sOgIl1rc0S0EJqp40ezyazwmG277uPDFdBl2gYebtiYJ2 GFerpAxoisNRZqZgo8jGVUTme2SRxL5NvLwztqTGWnVzf5YbsH+v0wx6q2YYS198n8T2 va78fJxuTjnWMDUHTmrvUoZ63EE9aPLCKO2NeZktcFkEbg3b20NXUHWC5bn5uX8IIy3S tQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2103.outbound.protection.outlook.com [104.47.70.103]) by mx0a-0014ca01.pphosted.com with ESMTP id 3b7q41a4y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Sep 2021 05:37:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W2B5Wj/vuCAgb99T0krMg2+gHXa1NNs3Ibh5mVkVu9H3wLIdRJ7lu3Shpq4pKMJHCPyy4PldsVFgVC6nlJ1P0EXnCStWYDQL3rcH05RPkYGIMM79awe8rozs2sRbcpKCalwXtEwMJhpMDx6OUkclyCAQCLYPaJX3I8uPmXrcUNJVrrEfaispNsBFNEEOY4tRP8DoY1ENYuA4APsp4s4fc4HvRALz79ZNsZ+OH3mR+EZHojoLxpU2J4Ai1bFmYAAIhONMVYyXuyWQDOpR71H4gEpMIwzD2v66kby9+vOmG+ozK9JDTwbZ0U1dKmy5e0AJ6O87UBD+Krgj9/H/esigtw== 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; bh=MKg7JQwxA4RPNqr6icqL8NswvNa+SZUHYBXn85QczIs=; b=DXxZ643P+SoYc2RmK4rpI8nTn5wBUJGRh7dAzo8hMk4OGdPCn5+Sc5BYTlbBCEk6SQYr1Cyq0zhptZaKKpbrg9NNhaHmLKUMhUHUatGWWD/BtVc3BTA3WNOwZEmkL7l6FViFmGprxWq475+rDi6f+7FqV02SvUeP2q8D1lcvAF0VbPyoZcjV5uHkdq3f8GgM0YrJ0/djM8znLLgMb4KEcAqFCKlzZpqA22ZkeP7MmHw33BvTH3bD/GaUXdoa+kRHh0aPAPRAr2I8sFNjyeUkggVQfSockEEhxMLftB72U1uaDVvjSncc4V1IuKnbxe/zQjGiGzLT/9F+MsCkra9uAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 64.207.220.244) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MKg7JQwxA4RPNqr6icqL8NswvNa+SZUHYBXn85QczIs=; b=pEhnRKRVcO/8GunJrSXNpsm5kS23RwuOrF5mp6ylogCaWQ8jBbpqMe61uFIeNqWAQ6Uy4tb3iFYWkYhWalS7Jzsk9p9kbNkZZp62DvOwFOyPigxEaWu8wsX/TsUCAzSsCsoctZ0TYQjKHdOLQWb8Pxk2pE1uxV8xTT7vfoBEsf4= Received: from CO2PR05CA0070.namprd05.prod.outlook.com (2603:10b6:102:2::38) by DM6PR07MB4267.namprd07.prod.outlook.com (2603:10b6:5:ca::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.17; Wed, 22 Sep 2021 12:37:50 +0000 Received: from MW2NAM12FT031.eop-nam12.prod.protection.outlook.com (2603:10b6:102:2:cafe::7a) by CO2PR05CA0070.outlook.office365.com (2603:10b6:102:2::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.7 via Frontend Transport; Wed, 22 Sep 2021 12:37:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 64.207.220.244) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 64.207.220.244 as permitted sender) receiver=protection.outlook.com; client-ip=64.207.220.244; helo=wcmailrelayl01.cadence.com; Received: from wcmailrelayl01.cadence.com (64.207.220.244) by MW2NAM12FT031.mail.protection.outlook.com (10.13.181.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 12:37:49 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by wcmailrelayl01.cadence.com (8.14.7/8.14.4) with ESMTP id 18MCbj49070810 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=OK); Wed, 22 Sep 2021 05:37:48 -0700 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu4.global.cadence.com (10.160.110.201) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Sep 2021 14:37:44 +0200 Received: from maileu3.global.cadence.com (10.160.88.99) by maileu4.global.cadence.com (10.160.110.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 22 Sep 2021 14:37:44 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 22 Sep 2021 14:37:37 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 18MCbcw1021973; Wed, 22 Sep 2021 14:37:38 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 18MCbbj3021972; Wed, 22 Sep 2021 14:37:38 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH v2 1/4] phy: cadence-torrent: Migrate to clk_hw based registration and OF APIs Date: Wed, 22 Sep 2021 14:37:32 +0200 Message-ID: <20210922123735.21927-2-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210922123735.21927-1-sjakhade@cadence.com> References: <20210922123735.21927-1-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68f6160a-aa17-423a-a2e0-08d97dc5c999 X-MS-TrafficTypeDiagnostic: DM6PR07MB4267: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:519; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GgBBXcXUefj5ukVjD3GHQ8OQyaXbFdF2dg2mJOgy2b0ktJSvG1NT9JffFVy0nBZERgmT4D0hZ39SKy4q4fCDVJ1eVt6oIyu63rTXg2Upq8CYq9GBYywo8i4yo91exPLA2NQBKpSJHKp8nhCZA0MX+ciXKBcvhCypthsdPomax1QnRC7iMsxaDS77qHmtk4RwK12VpwPxeRILi659BgZsaHQWi3D21R8h8skQJsZoFRUjNcXzy9h+3ZipvVizmdWcyNxZt/OQKEe5/uMEdhwrhFBmTUH9i0eEUdlS256TVvu9z1YMyLc9uUnIHuDZMQbJvz89Dhq4jcgube/8tHLwLMxAaPj+tExS+gcxuEsPewDnmpEjfP72YbhpL3rt/4w5m/+00qNrzmhJL653b201TUUXnvScALsQY9RFN0ofBcsYOj/A88+WmK24toj31ZqJsGm69fiTB5RoaD+S6ZYQBLpunCzsZ4GU1Xx9gghUdApJmP1eClozEUxFo49w/pMgJLtbuwHqa9bIg4q4jbCyuVtIGq6q+k+SOq3jia/TPs1M/L/IA7HH8Vky5HImvxlEnzrzmHMxbktCVCoWIK3/r6spowsOi8IXXR4TIzu1uW2Mo4QeJYDc7gVJUjGCxy20vQvJtseFu3r5Pv1Gi7ycsBzZlRvYh2WXrwGzBC1g3T8dtTUpQObAZGtTX7d9bdHXNQQnqG6wr8UoEQQGbcbGo0pYbMUcDNJhLM+mzZdsKHZhh49UjNxLMf0KZ5q0tBLdOlwaKVaJzauwUGLqrti9Sav6zrT5H8gD9bmR5+CiylE= X-Forefront-Antispam-Report: CIP:64.207.220.244; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:wcmailrelayl01.cadence.com; PTR:ErrorRetry; CAT:NONE; SFS:(4636009)(36092001)(36840700001)(46966006)(47076005)(6666004)(70586007)(5660300002)(316002)(70206006)(82310400003)(26005)(336012)(426003)(1076003)(36756003)(36860700001)(8936002)(2616005)(8676002)(356005)(81166007)(42186006)(86362001)(54906003)(2906002)(508600001)(186003)(110136005)(4326008)(83380400001)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 12:37:49.3354 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68f6160a-aa17-423a-a2e0-08d97dc5c999 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[64.207.220.244]; Helo=[wcmailrelayl01.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT031.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR07MB4267 X-Proofpoint-ORIG-GUID: SYI7RXkGX5rbq0FWtwKHlSLpD-XVicZ7 X-Proofpoint-GUID: SYI7RXkGX5rbq0FWtwKHlSLpD-XVicZ7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-22_04,2021-09-22_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=1011 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109200000 definitions=main-2109220089 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_053759_437423_F87691C3 X-CRM114-Status: GOOD ( 19.97 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Use clk_hw based provider APIs to register clks to remove the usage of deprecated APIs. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 30 ++++++++++++++--------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 415ace64adc5..ecb1aa883c05 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -235,6 +235,8 @@ #define PHY_PMA_CMN_CTRL2 0x0001U #define PHY_PMA_PLL_RAW_CTRL 0x0003U +#define CDNS_TORRENT_OUTPUT_CLOCKS 1 + static const char * const clk_names[] = { [CDNS_TORRENT_REFCLK_DRIVER] = "refclk-driver", }; @@ -333,8 +335,7 @@ struct cdns_torrent_phy { struct regmap_field *phy_pma_pll_raw_ctrl; struct regmap_field *phy_reset_ctrl; struct regmap_field *phy_pcs_iso_link_ctrl_1[MAX_NUM_LANES]; - struct clk *clks[CDNS_TORRENT_REFCLK_DRIVER + 1]; - struct clk_onecell_data clk_data; + struct clk_hw_onecell_data *clk_hw_data; }; enum phy_powerstate { @@ -1659,8 +1660,9 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph const char *parent_name; struct regmap *regmap; char clk_name[100]; + struct clk_hw *hw; struct clk *clk; - int i; + int i, ret; derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); if (!derived_refclk) @@ -1706,11 +1708,12 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph derived_refclk->hw.init = init; - clk = devm_clk_register(dev, &derived_refclk->hw); - if (IS_ERR(clk)) - return PTR_ERR(clk); + hw = &derived_refclk->hw; + ret = devm_clk_hw_register(dev, hw); + if (ret) + return ret; - cdns_phy->clks[CDNS_TORRENT_REFCLK_DRIVER] = clk; + cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER] = hw; return 0; } @@ -2188,18 +2191,23 @@ static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) { struct device *dev = cdns_phy->dev; struct device_node *node = dev->of_node; + struct clk_hw_onecell_data *data; int ret; + data = devm_kzalloc(dev, struct_size(data, hws, CDNS_TORRENT_OUTPUT_CLOCKS), GFP_KERNEL); + if (!data) + return -ENOMEM; + + data->num = CDNS_TORRENT_OUTPUT_CLOCKS; + cdns_phy->clk_hw_data = data; + ret = cdns_torrent_derived_refclk_register(cdns_phy); if (ret) { dev_err(dev, "failed to register derived refclk\n"); return ret; } - cdns_phy->clk_data.clks = cdns_phy->clks; - cdns_phy->clk_data.clk_num = CDNS_TORRENT_REFCLK_DRIVER + 1; - - ret = of_clk_add_provider(node, of_clk_src_onecell_get, &cdns_phy->clk_data); + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data); if (ret) { dev_err(dev, "Failed to add clock provider: %s\n", node->name); return ret; From patchwork Wed Sep 22 12:37:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Kashinath Jakhade X-Patchwork-Id: 12510427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BFE9C43217 for ; Wed, 22 Sep 2021 12:38:08 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1B9B361181 for ; Wed, 22 Sep 2021 12:38:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1B9B361181 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=A+qrDvsmUmfoi9+28zggk0KSquTKUdrxoYh4R+HX16U=; b=P3YdPzzBw6NB8t XSm/tZj+UQLPrzijPJc/YSbEMRV35cwCfqZ3mvYMwUPoeRnk4S92I0uBn9ZF6NhXznD8itorQl6RI 6rI4Vb/SFi6P3B2bdjuVISJ9LGSklriMK/GnA6eClP0YqrXBBuJqUshaZmMmeA1QAaBBHhU5NuKGT ziVZWpcCrkTPdaWKLinSFu3P+uVkd8o4oK5Sk4QliUpnhtIibq6lcr0pPpNgYjGe+ZnvevyXCSZ+/ oXtwmpSETInRPVa+ML7vdwXaR63DdspBfOQKxtWlzjPMVoO/341grUjxVJZ2PuOJfphZFwJ42Y1Iq 37QJG185FaFeKQyChypg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vn-008O62-Jy; Wed, 22 Sep 2021 12:38:07 +0000 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vl-008O5J-FR for linux-phy@lists.infradead.org; Wed, 22 Sep 2021 12:38:06 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18MBEDBI011057; Wed, 22 Sep 2021 05:38:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=KBXBDrvPArq1kogd2+VhgbmyqIZl15RH1yoDmXxWoNE=; b=Oz1x3yFwHX9ofqFl1ixBX3Abf1K0jOzhFFT8eX542iUNBUH8EVcs9xFA/N880I60Jc0W El8EhBfdXMDuDhV61CwiWVLTfxN2d+51hS/S8l844YFvKwwfvVNFATHms/OjL7962mCw /SjlQ+T9dowHN7P+Hu/W1OUd1CRZM1cn2VqcCeZyvMRgccGomj65O+NFAiOjSh/e3q4V 48ianLGmvsCArE9SpqhTAC5C/oBlhY2F3lTHs7uteqxHD0rSmp5/3F8iVf79UUryXeg3 Tk+jiRWjsdvgyiGoWKRxGn8CIlCawcrS+pHmVF0BChCqwXsNQ97Yx2A/7mUsXsQMvXbA nw== Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by mx0a-0014ca01.pphosted.com with ESMTP id 3b7q41a4ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Sep 2021 05:38:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XcjhIsvTF9VZkq1VlOnVv41hK2NEz+ovGnqffeMqE1rMmBYzLazVWQuq8d+OK4X5adUy3+PHxUDbqX6GyT7HmHVAj+QfKeM+czLV08nB/u8meNZhKy0eGIPnG+16WdDGMGPiB8Kiro8gjLQQl6TrwiOlFdk5+OjTGCS3PHyiuKFEUIfu0fs6Z9k0QplzJWJn5ffU4WcU9pi4lOgaSq0XlyXWFZ7br7xe0170JWdiobNqzPCrBgUs8G8sZ0dDeZl5YNWIXCvlgxTdgyAkKYycO8I9FKGe2MDAEC79m/4+WvI7kin0NRA4h+CPODqoRrlyPhBwhrc2x0VJ/iIVbKaF/g== 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; bh=KBXBDrvPArq1kogd2+VhgbmyqIZl15RH1yoDmXxWoNE=; b=GhaTbDh5Q2WxZ4zQIVy3Hdus6f+mLMfmlODyf67mqBL8enIKE53bwbXmaRQBHWWYYrOiVJOmGFcg33DaxaQdu4ZWXZfp4rzKWtJnAD6MpR5/jkjl/0SI+v6djeXzZfJ03ijk+tAke5gp2Ryu90pJJaIzrULIrJ5iR8SS2yBnpg96mCarZcBJBPb+8tyg09B1YmLdGj7RAO1nI9tgBQNVP3KnUyTvJnuDfpXVgM8XPFC83IHvnjl4O0BOufEaTN3K3cEUs1J/l8Z6KKLdaV0ewA8I1SgLxixZGFgb/S2iAB63K8WiSVwfXcvEewmbTMzrhIrZKFMZYZ9jrF/YJw5v+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 199.43.4.23) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KBXBDrvPArq1kogd2+VhgbmyqIZl15RH1yoDmXxWoNE=; b=22H+yOHMgsudD6jI/V7isIh3AVUqYWJyz4fBZe8+X36N1QIehYoLPJL9sW/J6fhmhmlBExYBw0hqAYKjBmVziaLPXTglZcf0zVeWpRG6z5l56VovdBhrtVQ0yY4OY+ZibgPbZ5EygEcaxqoiLOrve7z8GAC8xdgKece2SPlzZC4= Received: from MW4PR03CA0118.namprd03.prod.outlook.com (2603:10b6:303:b7::33) by BN3PR07MB2705.namprd07.prod.outlook.com (2a01:111:e400:7bb2::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 22 Sep 2021 12:38:01 +0000 Received: from MW2NAM12FT053.eop-nam12.prod.protection.outlook.com (2603:10b6:303:b7:cafe::c) by MW4PR03CA0118.outlook.office365.com (2603:10b6:303:b7::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.14 via Frontend Transport; Wed, 22 Sep 2021 12:38:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 199.43.4.23) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 199.43.4.23 as permitted sender) receiver=protection.outlook.com; client-ip=199.43.4.23; helo=rmmaillnx1.cadence.com; Received: from rmmaillnx1.cadence.com (199.43.4.23) by MW2NAM12FT053.mail.protection.outlook.com (10.13.181.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 12:38:01 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by rmmaillnx1.cadence.com (8.14.4/8.14.4) with ESMTP id 18MCbvKm003390 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Sep 2021 08:38:00 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu4.global.cadence.com (10.160.110.201) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Sep 2021 14:37:50 +0200 Received: from maileu3.global.cadence.com (10.160.88.99) by maileu4.global.cadence.com (10.160.110.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 18MCbcf3021977; Wed, 22 Sep 2021 14:37:38 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 18MCbcDF021976; Wed, 22 Sep 2021 14:37:38 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH v2 2/4] dt-bindings: phy: cadence-torrent: Add clock IDs for derived and received refclk Date: Wed, 22 Sep 2021 14:37:33 +0200 Message-ID: <20210922123735.21927-3-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210922123735.21927-1-sjakhade@cadence.com> References: <20210922123735.21927-1-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f5b5838f-937f-4356-c286-08d97dc5d0c1 X-MS-TrafficTypeDiagnostic: BN3PR07MB2705: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: soaBvoW/Mq7L4I84qwMQL63AsBw0BtTvi0HFAldAA3OXBInLMEKmmYDBASQCs6jezoRf4i8Sn+qyol0XZVBbiy49QdBHxG+F2pF4LKuxpmvUJuXaoDOpQd+Uvl8tm8wyN82fniKZeScjRVWvU2Z7pJSXFgO6/DIvebxzbPEtqk9+Uw+jzw2rogPgIHSfLR6Z0i8288x/D4GUanSmiLSmjx7owNtiiyyCXMSacpe1w0zmi8hFfHARBm0+tVyxpYFm00g6BpySJ5yCEspgOUUHEWna4KRg0ndRKc+HgpGkx5DkANwCQGCs/3rYp96Er1pQKBwSMy/X4N+asuKlEVpwQeWFY3b9gn5KJIbEbtH1HCPQKdtdVAx8hBxw2WJufHvuXwaFoMFbEbRw3oiOnzXRRBrCEKR1mdjZB9V8c69P0K4zmLiulMFzbjNgyIMK8cJrbq5pdxAXLEr9hlVNJPGYlc/ja5ygEOE3RGPmnuh4Fnh5EkXnEaTcD/aa/Vk/m08WFVx6OBAn9R3Eiu0CA9Ru3hbpfB+5ToCR6s9DQVYKKoP1dEmyvHm4cU/ReTrmzL8Es6NxIzBMMiWH+s40wjAJ5lR0fXjQ2NytK3VKFCCRQnKhV8nbx/mA8s4kk7RFJLU4lGPhyVwAQ0prCV0BfttmYlHGSpr8T7xjRLo1YourwtmgYamprXq+SYSOtHf6DOaj4Xdrg6Ity9C/8MwT9Q9HR/W1MtU9rtg/VF7DxDJBvrCApMjafRuqhcVnWshAmubzUuYVHXwmDh1o1Wwb+F47ODuPNk//msiVOjegW8Qfaf8= X-Forefront-Antispam-Report: CIP:199.43.4.23; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:rmmaillnx1.cadence.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36092001)(46966006)(36840700001)(6666004)(83380400001)(1076003)(81166007)(86362001)(8936002)(316002)(508600001)(54906003)(4326008)(42186006)(36906005)(356005)(110136005)(36756003)(36860700001)(2616005)(4744005)(5660300002)(82310400003)(26005)(426003)(47076005)(186003)(336012)(8676002)(2906002)(70206006)(70586007)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 12:38:01.2435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f5b5838f-937f-4356-c286-08d97dc5d0c1 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[199.43.4.23]; Helo=[rmmaillnx1.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT053.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2705 X-Proofpoint-ORIG-GUID: aKtFxpGq6TyK52uFDJ4B-16papSSo_Uh X-Proofpoint-GUID: aKtFxpGq6TyK52uFDJ4B-16papSSo_Uh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-22_04,2021-09-22_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 lowpriorityscore=0 adultscore=0 mlxlogscore=961 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109200000 definitions=main-2109220089 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_053805_547058_A37995F5 X-CRM114-Status: GOOD ( 13.95 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Add clock IDs for derived and received reference clock output. Signed-off-by: Swapnil Jakhade Acked-by: Rob Herring --- include/dt-bindings/phy/phy-cadence.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/dt-bindings/phy/phy-cadence.h b/include/dt-bindings/phy/phy-cadence.h index 4652bcb86265..24fdc9e11bd6 100644 --- a/include/dt-bindings/phy/phy-cadence.h +++ b/include/dt-bindings/phy/phy-cadence.h @@ -12,6 +12,8 @@ #define TORRENT_SERDES_INTERNAL_SSC 2 #define CDNS_TORRENT_REFCLK_DRIVER 0 +#define CDNS_TORRENT_DERIVED_REFCLK 1 +#define CDNS_TORRENT_RECEIVED_REFCLK 2 /* Sierra */ #define CDNS_SIERRA_PLL_CMNLC 0 From patchwork Wed Sep 22 12:37:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Kashinath Jakhade X-Patchwork-Id: 12510421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 292E8C4332F for ; Wed, 22 Sep 2021 12:38:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id AF90C6115A for ; Wed, 22 Sep 2021 12:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF90C6115A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=2vItWXZ/pO4uq5GG8sXRC6FpQpZ6Ww04sfGyOdEpvYI=; b=f3FIm9cVeF5QA8 0G1M8pWzKmKA8a8EWsDTjikYpFd1o7oPzysPr1obLaJJWDCbVVOztS0SAvJALyTIVVOAxiKrwFJC0 k0up97y8ouYTGSTuhzivaeByG3q1lSZjoEtHUnIbk/1R+GEc2KKCG5etirFl+3xWa1bZnVj74pKtY NZFpe9Qc+RyoPLD2jLKFTcIajH5ocQ/wy0MWrOyPJ4+ofCwtF1Y1+aIlme7RS/HRwWzI4OL+x3jSQ gZe5hWmIicFcodZ3Bf4uUWexwdQTyQmHKnJjx699Zm2Zc1cqny3Yu/bWoKPsbuQsO8DEddKVEKjiD efm6dgcxHStpTrpa4WNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vj-008O4G-74; Wed, 22 Sep 2021 12:38:03 +0000 Received: from mx0a-0014ca01.pphosted.com ([208.84.65.235]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vf-008O2h-2B for linux-phy@lists.infradead.org; Wed, 22 Sep 2021 12:38:01 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18MBnBM0010091; Wed, 22 Sep 2021 05:37:54 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=E6gCNz0tD6ZgOgaMvvDvIxHx1QIeTiVcf8ZDEZOe+Fk=; b=IaKXqjrlpXU7dMUZdAmI+t98oB+AzfwlcRw4nIrxiVLhj8c36y3kgWLFParuK9YEeg1n Ra6ZzoKJgdlPRVXXexMVRzkbxB8Koe7ehT1t2Inr0SKnZXWYLKZhtUA1+rVbM6z3/HrC ga3gyhhYoI5VXVDxlKKDDqHN2oQkrrV+e0K5IYTXGsRBwpKp7ZsanMW8w4FO6LFeyUQ7 E697XJy+ngqBZF7v1cu2ouhbHAhJyz+xmI8AWocOuYsUGreuGfXATxafyXgwNREn6JsT UrQs7Ed2Dz2sAaG7II96j7TN4umNBiAkFjzU/RBXzaIppKNnNQNQSdXyZpoIvFrZxsIr kQ== Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2044.outbound.protection.outlook.com [104.47.73.44]) by mx0a-0014ca01.pphosted.com with ESMTP id 3b7q41a4xy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Sep 2021 05:37:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MuLfv8AgG0uzRyGeENUOy6SUNpnBeAQy2bFFGiUUxfHAH0YQl53vVYZ7yXqNqwyU2rL69oNDchziSJ8RQnn7kjzhgSIfCQu5JHarfij2LqEmo3zhjXglubgS3Mo6dCf952/Xn3Cqq07d479R4igDwur+gAGI5xUGqFnvfnQNhIZtm+d0ydWpQX2BOnjNoO2DX5k7SxVZ+FBM2bnnyUkOaXddlG4aG4aW3q44hggkLAeSUm9q3tczwYv/2qJP+t0cwXufn1ZKbzHwpI3Tsl/EDOHLEJb8dpJpdm5KCaeAnqr0QskA7Jub8nJovoaNSLFg0eM1G8IaQ5BF3ikAhwB4wA== 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; bh=E6gCNz0tD6ZgOgaMvvDvIxHx1QIeTiVcf8ZDEZOe+Fk=; b=Ql+kUr6rY6HzDnaVEG9HsofacdAySRtcpiYEKze8EG3emvdiQ6V15Czy0O/Zdu/F/CoZz+RQhjKQPJPPMDGp7vw7Ibcm5sZYJp+LSTP+XXhXeHJRZ9lTcIIm3VewQX9W8Vz9sUS8hYluzeDc9z0TSMD5aYSwQq7SCUUlIOuWlVND72vqGqI73WU3jvC2tY/HkkNUVl3A8unXns++pETK1vmTYbEkBzaAwZZq/h9LGLXbkqZYtYCqTx7KRB+vfzg3UAOP2xYa5/RwpkI+UmSBaRaL2gS64s4TB9kKjyCp2bgKyIUGEHzywUSK9pv0QonSCPYRs8EWnP/SJFdEU52u8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 64.207.220.244) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=E6gCNz0tD6ZgOgaMvvDvIxHx1QIeTiVcf8ZDEZOe+Fk=; b=cmcm/F9hOBNTVC7T2DFrPa/PNOlRiAhUItYGq7DpQStKowmGjMucznCWffbSb0CRAqZXeH2tWpF04+7JTSsPTKwlXSuKjPULJkqmb9gZyRVw8e47WxFYy+nA8th42sYSqIQootuPKSipzrynSeF1iww3GN7b3n8p8NuTsHw4Jbw= Received: from CO1PR15CA0069.namprd15.prod.outlook.com (2603:10b6:101:20::13) by SJ0PR07MB8406.namprd07.prod.outlook.com (2603:10b6:a03:335::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14; Wed, 22 Sep 2021 12:37:50 +0000 Received: from MW2NAM12FT056.eop-nam12.prod.protection.outlook.com (2603:10b6:101:20:cafe::5f) by CO1PR15CA0069.outlook.office365.com (2603:10b6:101:20::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 12:37:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 64.207.220.244) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 64.207.220.244 as permitted sender) receiver=protection.outlook.com; client-ip=64.207.220.244; helo=wcmailrelayl01.cadence.com; Received: from wcmailrelayl01.cadence.com (64.207.220.244) by MW2NAM12FT056.mail.protection.outlook.com (10.13.181.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 12:37:48 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by wcmailrelayl01.cadence.com (8.14.7/8.14.4) with ESMTP id 18MCbj47070810 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=OK); Wed, 22 Sep 2021 05:37:46 -0700 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 18MCbckb021981; Wed, 22 Sep 2021 14:37:38 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 18MCbcBk021980; Wed, 22 Sep 2021 14:37:38 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH v2 3/4] phy: cadence-torrent: Model reference clock driver as a clock to enable derived refclk Date: Wed, 22 Sep 2021 14:37:34 +0200 Message-ID: <20210922123735.21927-4-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210922123735.21927-1-sjakhade@cadence.com> References: <20210922123735.21927-1-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd10da15-6544-4e5b-b456-08d97dc5c911 X-MS-TrafficTypeDiagnostic: SJ0PR07MB8406: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:398; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: skMomNna64khi4KCmJs6ADmiGlByTv6Ur0370slJ3h8mrXLjvRDNSd+jFUnbF6weT0FQCI+KMtL8BuaTdKCFwX/LT3uT6bFRyA0Zpu9ra+O09LJQ9vgQ8mdAdS815f3WtfTUmNLjVp76W5HUur1WT6hMC40BCv6cQBlL/eTmIPJpOwmndXNI0okTUqv6uO4z4JC+XifD3zuDGVGWRGqwuKO27/z/yw0X/ChuGdA6SpX2XUvujKbVw9bCw/IgTAOTqCKre7l60MSByR7h/3HdiLnQd7WFs1+U02s9nfT2wXkOsL/hMRpXTUx5Q86bDI5lfTNWF3AN3lbYJZIjfEs21RvrSIPACzVQK3803hl5AnQNkjLVwnje5H2KUXQTMGL71OruJa3dlWIVlqivymyb1hZZ3XjQbHnFOx3Mh6HlRS3IIrvHx8T2R/jLgb3m9klfAPPIDvPh3MbeLTGcfw84NLV+S8JXRdfDdgEx5hBSussqa+d+Xf6BSwbdZp0Pt6LO9KNTTv/mVWMymn32/dCrO6x5uK+T1U2yb4HTctohyjDwQfbHaFScrsIV8G5V+SwFXY4BIZB/ti9W1Bfc3CI5uPzGvc/AQIZ3dgCIm3t8aiCB1Fl7nvbrONqL+zuTRDe9CkNKStP720WNlwAMIFlJBgEhDiycWPTUsemQlT6ezgCU2amcI1PlUBMD7ICz3b8RvWfQ3YRaF5u1RLO54wvxOnNM2Fvt3hmC75XREuKhPMaZUK+uK1wISv7NMpgxDidKGeu/SRcIruHivB2nNtrS/Kl0xPMKwdCOsuHeM8TueAZ6HaNBnXf/fnGecZnp+ko0 X-Forefront-Antispam-Report: CIP:64.207.220.244; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:wcmailrelayl01.cadence.com; PTR:ErrorRetry; CAT:NONE; SFS:(4636009)(36092001)(36840700001)(46966006)(70586007)(356005)(6666004)(81166007)(2616005)(2906002)(5660300002)(4326008)(82310400003)(316002)(336012)(86362001)(110136005)(83380400001)(36756003)(8936002)(186003)(54906003)(1076003)(36860700001)(42186006)(47076005)(26005)(70206006)(8676002)(426003)(508600001)(2101003)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 12:37:48.3626 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd10da15-6544-4e5b-b456-08d97dc5c911 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[64.207.220.244]; Helo=[wcmailrelayl01.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT056.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR07MB8406 X-Proofpoint-ORIG-GUID: DQrUczRehuhw4XS-VqdhhVcbLwLU80G- X-Proofpoint-GUID: DQrUczRehuhw4XS-VqdhhVcbLwLU80G- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-22_04,2021-09-22_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 spamscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 impostorscore=0 suspectscore=0 bulkscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109200000 definitions=main-2109220089 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_053759_438708_D13FAD09 X-CRM114-Status: GOOD ( 22.00 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org When reference clock driver is enabled, either derived or received refclk is output on cmn_refclk_p/m. Update the reference clock driver implementation by modelling reference clock driver as a "clock" with derived reference clock set as its default parent. The support for received reference clock will be added in a separate patch. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 157 ++++++++++++++++++---- 1 file changed, 132 insertions(+), 25 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index ecb1aa883c05..615aca6bd52b 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -235,10 +235,11 @@ #define PHY_PMA_CMN_CTRL2 0x0001U #define PHY_PMA_PLL_RAW_CTRL 0x0003U -#define CDNS_TORRENT_OUTPUT_CLOCKS 1 +#define CDNS_TORRENT_OUTPUT_CLOCKS 2 static const char * const clk_names[] = { [CDNS_TORRENT_REFCLK_DRIVER] = "refclk-driver", + [CDNS_TORRENT_DERIVED_REFCLK] = "refclk-der", }; static const struct reg_field phy_pll_cfg = @@ -261,10 +262,12 @@ static const struct reg_field phy_pcs_iso_link_ctrl_1 = static const struct reg_field phy_pipe_cmn_ctrl1_0 = REG_FIELD(PHY_PIPE_CMN_CTRL1, 0, 0); -#define REFCLK_OUT_NUM_CMN_CONFIG 5 +static const struct reg_field cmn_cdiag_refclk_ovrd_4 = + REG_FIELD(CMN_CDIAG_REFCLK_OVRD, 4, 4); + +#define REFCLK_OUT_NUM_CMN_CONFIG 4 enum cdns_torrent_refclk_out_cmn { - CMN_CDIAG_REFCLK_OVRD_4, CMN_CDIAG_REFCLK_DRV0_CTRL_1, CMN_CDIAG_REFCLK_DRV0_CTRL_4, CMN_CDIAG_REFCLK_DRV0_CTRL_5, @@ -272,7 +275,6 @@ enum cdns_torrent_refclk_out_cmn { }; static const struct reg_field refclk_out_cmn_cfg[] = { - [CMN_CDIAG_REFCLK_OVRD_4] = REG_FIELD(CMN_CDIAG_REFCLK_OVRD, 4, 4), [CMN_CDIAG_REFCLK_DRV0_CTRL_1] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 1, 1), [CMN_CDIAG_REFCLK_DRV0_CTRL_4] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 4, 4), [CMN_CDIAG_REFCLK_DRV0_CTRL_5] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 5, 5), @@ -330,6 +332,8 @@ struct cdns_torrent_phy { struct regmap *regmap_phy_pcs_lane_cdb[MAX_NUM_LANES]; struct regmap *regmap_dptx_phy_reg; struct regmap_field *phy_pll_cfg; + struct regmap_field *phy_pipe_cmn_ctrl1_0; + struct regmap_field *cmn_cdiag_refclk_ovrd_4; struct regmap_field *phy_pma_cmn_ctrl_1; struct regmap_field *phy_pma_cmn_ctrl_2; struct regmap_field *phy_pma_pll_raw_ctrl; @@ -345,10 +349,19 @@ enum phy_powerstate { POWERSTATE_A3 = 3, }; +struct cdns_torrent_refclk_driver { + struct clk_hw hw; + struct regmap_field *cmn_fields[REFCLK_OUT_NUM_CMN_CONFIG]; + struct clk_init_data clk_data; +}; + +#define to_cdns_torrent_refclk_driver(_hw) \ + container_of(_hw, struct cdns_torrent_refclk_driver, hw) + struct cdns_torrent_derived_refclk { struct clk_hw hw; struct regmap_field *phy_pipe_cmn_ctrl1_0; - struct regmap_field *cmn_fields[REFCLK_OUT_NUM_CMN_CONFIG]; + struct regmap_field *cmn_cdiag_refclk_ovrd_4; struct clk_init_data clk_data; }; @@ -1618,11 +1631,7 @@ static int cdns_torrent_derived_refclk_enable(struct clk_hw *hw) { struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); - regmap_field_write(derived_refclk->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_6], 0); - regmap_field_write(derived_refclk->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1); - regmap_field_write(derived_refclk->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_5], 1); - regmap_field_write(derived_refclk->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 0); - regmap_field_write(derived_refclk->cmn_fields[CMN_CDIAG_REFCLK_OVRD_4], 1); + regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 1); regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 1); return 0; @@ -1633,6 +1642,7 @@ static void cdns_torrent_derived_refclk_disable(struct clk_hw *hw) struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); regmap_field_write(derived_refclk->phy_pipe_cmn_ctrl1_0, 0); + regmap_field_write(derived_refclk->cmn_cdiag_refclk_ovrd_4, 0); } static int cdns_torrent_derived_refclk_is_enabled(struct clk_hw *hw) @@ -1640,7 +1650,7 @@ static int cdns_torrent_derived_refclk_is_enabled(struct clk_hw *hw) struct cdns_torrent_derived_refclk *derived_refclk = to_cdns_torrent_derived_refclk(hw); int val; - regmap_field_read(derived_refclk->phy_pipe_cmn_ctrl1_0, &val); + regmap_field_read(derived_refclk->cmn_cdiag_refclk_ovrd_4, &val); return !!val; } @@ -1655,21 +1665,19 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph { struct cdns_torrent_derived_refclk *derived_refclk; struct device *dev = cdns_phy->dev; - struct regmap_field *field; struct clk_init_data *init; const char *parent_name; - struct regmap *regmap; char clk_name[100]; struct clk_hw *hw; struct clk *clk; - int i, ret; + int ret; derived_refclk = devm_kzalloc(dev, sizeof(*derived_refclk), GFP_KERNEL); if (!derived_refclk) return -ENOMEM; snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), - clk_names[CDNS_TORRENT_REFCLK_DRIVER]); + clk_names[CDNS_TORRENT_DERIVED_REFCLK]); clk = devm_clk_get_optional(dev, "phy_en_refclk"); if (IS_ERR(clk)) { @@ -1688,27 +1696,104 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph init->flags = 0; init->name = clk_name; - regmap = cdns_phy->regmap_phy_pcs_common_cdb; - field = devm_regmap_field_alloc(dev, regmap, phy_pipe_cmn_ctrl1_0); - if (IS_ERR(field)) { - dev_err(dev, "phy_pipe_cmn_ctrl1_0 reg field init failed\n"); - return PTR_ERR(field); + derived_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0; + derived_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4; + + derived_refclk->hw.init = init; + + hw = &derived_refclk->hw; + ret = devm_clk_hw_register(dev, hw); + if (ret) + return ret; + + cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK] = hw; + + return 0; +} + +static int cdns_torrent_refclk_driver_enable(struct clk_hw *hw) +{ + struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); + + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_6], 0); + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1); + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_5], 1); + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 0); + + return 0; +} + +static void cdns_torrent_refclk_driver_disable(struct clk_hw *hw) +{ + struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); + + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 1); +} + +static int cdns_torrent_refclk_driver_is_enabled(struct clk_hw *hw) +{ + struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); + int val; + + regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], &val); + + return !val; +} + +static const struct clk_ops cdns_torrent_refclk_driver_ops = { + .enable = cdns_torrent_refclk_driver_enable, + .disable = cdns_torrent_refclk_driver_disable, + .is_enabled = cdns_torrent_refclk_driver_is_enabled, +}; + +static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy) +{ + struct cdns_torrent_refclk_driver *refclk_driver; + struct device *dev = cdns_phy->dev; + struct regmap_field *field; + struct clk_init_data *init; + const char *parent_name; + struct regmap *regmap; + char clk_name[100]; + struct clk_hw *hw; + int i, ret; + + refclk_driver = devm_kzalloc(dev, sizeof(*refclk_driver), GFP_KERNEL); + if (!refclk_driver) + return -ENOMEM; + + hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK]; + if (IS_ERR_OR_NULL(hw)) { + dev_err(dev, "No parent clock for refclk driver clock\n"); + return IS_ERR(hw) ? PTR_ERR(hw) : -ENOENT; } - derived_refclk->phy_pipe_cmn_ctrl1_0 = field; + parent_name = clk_hw_get_name(hw); + + snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), + clk_names[CDNS_TORRENT_REFCLK_DRIVER]); + + init = &refclk_driver->clk_data; + + init->ops = &cdns_torrent_refclk_driver_ops; + init->flags = 0; + init->parent_names = &parent_name; + init->num_parents = 1; + init->name = clk_name; regmap = cdns_phy->regmap_common_cdb; + for (i = 0; i < REFCLK_OUT_NUM_CMN_CONFIG; i++) { field = devm_regmap_field_alloc(dev, regmap, refclk_out_cmn_cfg[i]); if (IS_ERR(field)) { - dev_err(dev, "CMN reg field init failed\n"); + dev_err(dev, "Refclk driver CMN reg field init failed\n"); return PTR_ERR(field); } - derived_refclk->cmn_fields[i] = field; + refclk_driver->cmn_fields[i] = field; } - derived_refclk->hw.init = init; + refclk_driver->hw.init = init; - hw = &derived_refclk->hw; + hw = &refclk_driver->hw; ret = devm_clk_hw_register(dev, hw); if (ret) return ret; @@ -1768,6 +1853,22 @@ static int cdns_torrent_regfield_init(struct cdns_torrent_phy *cdns_phy) } cdns_phy->phy_pll_cfg = field; + regmap = cdns_phy->regmap_phy_pcs_common_cdb; + field = devm_regmap_field_alloc(dev, regmap, phy_pipe_cmn_ctrl1_0); + if (IS_ERR(field)) { + dev_err(dev, "phy_pipe_cmn_ctrl1_0 reg field init failed\n"); + return PTR_ERR(field); + } + cdns_phy->phy_pipe_cmn_ctrl1_0 = field; + + regmap = cdns_phy->regmap_common_cdb; + field = devm_regmap_field_alloc(dev, regmap, cmn_cdiag_refclk_ovrd_4); + if (IS_ERR(field)) { + dev_err(dev, "cmn_cdiag_refclk_ovrd_4 reg field init failed\n"); + return PTR_ERR(field); + } + cdns_phy->cmn_cdiag_refclk_ovrd_4 = field; + regmap = cdns_phy->regmap_phy_pma_common_cdb; field = devm_regmap_field_alloc(dev, regmap, phy_pma_cmn_ctrl_1); if (IS_ERR(field)) { @@ -2207,6 +2308,12 @@ static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) return ret; } + ret = cdns_torrent_refclk_driver_register(cdns_phy); + if (ret) { + dev_err(dev, "failed to register refclk driver\n"); + return ret; + } + ret = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, data); if (ret) { dev_err(dev, "Failed to add clock provider: %s\n", node->name); From patchwork Wed Sep 22 12:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Kashinath Jakhade X-Patchwork-Id: 12510423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 122CEC43217 for ; Wed, 22 Sep 2021 12:38:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id C35CD60F9D for ; Wed, 22 Sep 2021 12:38:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C35CD60F9D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cadence.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=aNjqDed/SUIpRY5aYHlD5EK4K7It5r7kOHvyk+HG8hg=; b=niEo2CRnhN18rW CHnvkNEHgD3qS9p8u4NpRNw/huDPT7FWlqeWhk07YahBvi+L6JwjbwW1lgf9O1NWyQbNnuPxVjG4w zfPj5LvmSGOesYAq6U27wdVHGOMzzg4UN6g+80AdUY6LsQWcYfg0GZPalwnrump4GGD9hJYYmb7xE 64ry75l5vXFTEzjXV39ihgNxmSx75miroZpNug6E3qxWLcWSbYh5z4ndH09pxuc7zWLoGuKR7IcJK Ryx6tB1+M6TXhRzJas7RUXEHfLjRYPf7RO3qVjaNl5CMTgSbwmG1n/dusJ7fBSTfTBxuDgS+RRnHi EcYLFOtL8fVQ6nQW7BBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vk-008O4f-BB; Wed, 22 Sep 2021 12:38:04 +0000 Received: from mx0b-0014ca01.pphosted.com ([208.86.201.193] helo=mx0a-0014ca01.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mT1Vg-008O2u-Pe for linux-phy@lists.infradead.org; Wed, 22 Sep 2021 12:38:02 +0000 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18MC2WD5007309; Wed, 22 Sep 2021 05:37:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=proofpoint; bh=VUAy+4bxbgtWEnSipFmQjVDcD+nwg0+iuqj/uBZlFaA=; b=gl3lNeUUSFzV5FIHv3Vs6PYg43VsvLl6N4fgWhTpNXYJ7xkvGPbjX99r0k8VDRcpJyv5 I9tLCYQ+ktpvWfAcgp5dBlvRmtHdlwOwsRDcdKmjC1vZwy8Aa+voOIzCiwwriA/DMThj tjow+hvGSXiNlu1OxreKD2tEbYp7AY2STNfJuCdos5VAHifobNgPJQwyZZ0obcDlGyk4 HGVDYN99IUm2BTyBVxbAanphlzMBC4IheScdIzhw68JbXzlkn3MlFjTPDJiM9E9GWj0+ OY3Yg7z0YPA+Ol08kjTI6ujbiHPuNa66ZGnMiDc4rLiiJvLVyUJxMfLhm8i/KcXf5arT 9w== Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2041.outbound.protection.outlook.com [104.47.51.41]) by mx0b-0014ca01.pphosted.com with ESMTP id 3b7q4va5r9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Sep 2021 05:37:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJOaGtA4sJuU3v+mQXF4RgLhUtx64Hhp9klDyzbGk44OyoTYxLjBbWxXpUCS9JVm12+j/ySAnYaOVoZgW5yI9Kt05Id71lABp7Yx6BoG9OaDg3UIpOcYc2Eb6alHSZVI2dafz1EKpI/CeSwQGwJ49qTeea508VQFUlEZDxlRMHhGZ7HiivRC5fEIivNxsw8fJuC58wH2etNdOwdA5fLxqIY1ct3z6GvfbX61gmVtVzqBXHykyFZ/x4yTZx73dtSXaavtaRzk6JBVTPy9Gj7hZpfGeHTV1m8/qHiiNXCI+oH8Ii5y5wnR8xwwWKO+KHVU1ePBMFZOvXpFgJ0g8nGyhA== 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; bh=VUAy+4bxbgtWEnSipFmQjVDcD+nwg0+iuqj/uBZlFaA=; b=geiR3kEUe3RT0OTXwhhgAo7rjkFvmNyjRwCcEKcrNzXJu9Qp+dVCm3u9ijeZqleRnftczal6x3xsMKp8jzhKQuomcit8RJVKkYyqh1JjMUjvY6yi91q9oBvQbxsEkPUZD6i7YvcakiXXTpMdm+PSbDH/eLmJ3geD8RhlRVPip1XtyGvuUkSGAEYnLS3bxtxwpsbqzw1Y+diYNQlaWy/FVM3c79vpk8AidgZrgZK1N4/WXr4dIlF7AoKnW0IQO8TdHar1ldcZ3vuGnecHzp7U9YdVPtZJXDtFDZscZQW6LjLlBQfmoGd4kxccPro+NZPl8HQwj6RUyTlewhT9htrGaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 64.207.220.244) smtp.rcpttodomain=kernel.org smtp.mailfrom=cadence.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=cadence.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cadence.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VUAy+4bxbgtWEnSipFmQjVDcD+nwg0+iuqj/uBZlFaA=; b=uIpeB4ji3Kg2+HveBpgIgkPSauIVW65gSpTZgZeU+alPxRkawuYczIp4JWOYPdt7kW7J0avmhaSf3G1o/sosRcL0dWof1ivWFh0AcaDzJ56vWGT41k8LRyEkCH4QO20vpF7Bd3I5NhJQjk2oZfTIug+wM6rohDdR2rYkhFfQcKQ= Received: from CO2PR05CA0064.namprd05.prod.outlook.com (2603:10b6:102:2::32) by DM8PR07MB8807.namprd07.prod.outlook.com (2603:10b6:8:10::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13; Wed, 22 Sep 2021 12:37:50 +0000 Received: from MW2NAM12FT031.eop-nam12.prod.protection.outlook.com (2603:10b6:102:2:cafe::70) by CO2PR05CA0064.outlook.office365.com (2603:10b6:102:2::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 12:37:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 64.207.220.244) smtp.mailfrom=cadence.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=cadence.com; Received-SPF: Pass (protection.outlook.com: domain of cadence.com designates 64.207.220.244 as permitted sender) receiver=protection.outlook.com; client-ip=64.207.220.244; helo=wcmailrelayl01.cadence.com; Received: from wcmailrelayl01.cadence.com (64.207.220.244) by MW2NAM12FT031.mail.protection.outlook.com (10.13.181.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 12:37:48 +0000 Received: from maileu3.global.cadence.com (maileu3.cadence.com [10.160.88.99]) by wcmailrelayl01.cadence.com (8.14.7/8.14.4) with ESMTP id 18MCbj48070810 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=OK); Wed, 22 Sep 2021 05:37:47 -0700 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu3.global.cadence.com (10.160.88.99) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (10.160.88.83) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Wed, 22 Sep 2021 14:37:38 +0200 Received: from vleu-orange.cadence.com (localhost.localdomain [127.0.0.1]) by vleu-orange.cadence.com (8.14.4/8.14.4) with ESMTP id 18MCbcNQ021985; Wed, 22 Sep 2021 14:37:38 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 18MCbcXO021984; Wed, 22 Sep 2021 14:37:38 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH v2 4/4] phy: cadence-torrent: Add support to output received reference clock Date: Wed, 22 Sep 2021 14:37:35 +0200 Message-ID: <20210922123735.21927-5-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210922123735.21927-1-sjakhade@cadence.com> References: <20210922123735.21927-1-sjakhade@cadence.com> MIME-Version: 1.0 X-OrganizationHeadersPreserved: maileu3.global.cadence.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4713f755-4126-4995-8dac-08d97dc5c954 X-MS-TrafficTypeDiagnostic: DM8PR07MB8807: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:381; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3ZL+IWNXyvTXKZOz6dYklz6w3PXCS+olS8NvEclamnDxwhBVq+BRIj8cMXdckIeno5cIA2ipikjf+jTgAC9Wzxc2vNgf3jwK2bVXz5gRcdBojAgeNt22aNTE/NokX+/MmVbkx0tm/K/NsnuSwivQUXl1SC/kBNr37Kzg/Epizq4uusCNQ5hMmZY/F6HWqu+z/+pgG6ivAW8pfY720dpbBELTQ0GKOoUq+gqGgTca5xIE0/Yc0gmHZe1TNeMJFppB9EM2z9av/jGzpqv+oWY50nILeP0t8NQtUEd8EITx6fZ7PpsQ7ScSeYE0CI9yc9B5nZLsQUYU7qSlj3LDU5zqoSj7IOyJuoxyFAWpC1maHAbHVU+FsJe11Xg/4yldh0zqOo/HTLtiJiJgf1vd5jWyxW2ZNpWDP7FiV9EgVZj6b1dc9+6O9hA5foJj+Sw1Mh1+GP6o3JbdQx28VEDAxJqsgZ1SAKzQfJNB1HvYS75FDlYh6FHQe4qfOplZYJdCiFxQ6UfgA0il+3/2kAL0uOnTqlfG0Mtwv9Nz2nJU987a8scCnTwxzBwWZIAu40Xl/I34ZnZEu+Q4eraD/ZiggKRBBYceVZSbcXf2YokJQxdoxAb3ytufYcIj7Z5YW0en48He8rlheiprNKLS9V23QbAMeFnzlVm1I/gyXSeMKmNI0vXNxiNoGgqFb6PzSb7lt/RrX0qrSfrIdqYOIQAmlSOXRhkDJvZjSs5KMnksAiTJR7vlkqyR1HeVrNfZgQVWBtzdtE/UvnjUo1zDwffB7MBbROYpVsOvX+ys8ble5yVRKM= X-Forefront-Antispam-Report: CIP:64.207.220.244; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:wcmailrelayl01.cadence.com; PTR:ErrorRetry; CAT:NONE; SFS:(4636009)(36092001)(36840700001)(46966006)(336012)(70206006)(86362001)(2906002)(42186006)(82310400003)(36860700001)(81166007)(83380400001)(26005)(47076005)(316002)(508600001)(5660300002)(2616005)(426003)(356005)(8936002)(8676002)(6666004)(110136005)(54906003)(36756003)(186003)(70586007)(4326008)(1076003)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 12:37:48.8057 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4713f755-4126-4995-8dac-08d97dc5c954 X-MS-Exchange-CrossTenant-Id: d36035c5-6ce6-4662-a3dc-e762e61ae4c9 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d36035c5-6ce6-4662-a3dc-e762e61ae4c9; Ip=[64.207.220.244]; Helo=[wcmailrelayl01.cadence.com] X-MS-Exchange-CrossTenant-AuthSource: MW2NAM12FT031.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR07MB8807 X-Proofpoint-GUID: QKzScnrrIplW0AbdCvp6Dy4XKJE9SJtw X-Proofpoint-ORIG-GUID: QKzScnrrIplW0AbdCvp6Dy4XKJE9SJtw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-22_04,2021-09-22_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 spamscore=0 clxscore=1015 impostorscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109200000 definitions=main-2109220088 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210922_053801_010941_CD7E22F0 X-CRM114-Status: GOOD ( 22.21 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Add support to output received reference clock. Model the received reference clock as an alternate parent of reference clock driver clock. When received refclk is selected to output on cmn_refclk_p/m, this is the internal reference clock driven on the pma_cmn_refclk_int. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 159 ++++++++++++++++++++-- 1 file changed, 148 insertions(+), 11 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 615aca6bd52b..5786166133d3 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -235,11 +235,12 @@ #define PHY_PMA_CMN_CTRL2 0x0001U #define PHY_PMA_PLL_RAW_CTRL 0x0003U -#define CDNS_TORRENT_OUTPUT_CLOCKS 2 +#define CDNS_TORRENT_OUTPUT_CLOCKS 3 static const char * const clk_names[] = { [CDNS_TORRENT_REFCLK_DRIVER] = "refclk-driver", [CDNS_TORRENT_DERIVED_REFCLK] = "refclk-der", + [CDNS_TORRENT_RECEIVED_REFCLK] = "refclk-rec", }; static const struct reg_field phy_pll_cfg = @@ -281,6 +282,13 @@ static const struct reg_field refclk_out_cmn_cfg[] = { [CMN_CDIAG_REFCLK_DRV0_CTRL_6] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 6, 6), }; +static const int refclk_driver_parent_index[] = { + CDNS_TORRENT_DERIVED_REFCLK, + CDNS_TORRENT_RECEIVED_REFCLK +}; + +static u32 cdns_torrent_refclk_driver_mux_table[] = { 1, 0 }; + enum cdns_torrent_phy_type { TYPE_NONE, TYPE_DP, @@ -368,6 +376,16 @@ struct cdns_torrent_derived_refclk { #define to_cdns_torrent_derived_refclk(_hw) \ container_of(_hw, struct cdns_torrent_derived_refclk, hw) +struct cdns_torrent_received_refclk { + struct clk_hw hw; + struct regmap_field *phy_pipe_cmn_ctrl1_0; + struct regmap_field *cmn_cdiag_refclk_ovrd_4; + struct clk_init_data clk_data; +}; + +#define to_cdns_torrent_received_refclk(_hw) \ + container_of(_hw, struct cdns_torrent_received_refclk, hw) + struct cdns_reg_pairs { u32 val; u32 off; @@ -1711,12 +1729,94 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph return 0; } +static int cdns_torrent_received_refclk_enable(struct clk_hw *hw) +{ + struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); + + regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 1); + + return 0; +} + +static void cdns_torrent_received_refclk_disable(struct clk_hw *hw) +{ + struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); + + regmap_field_write(received_refclk->phy_pipe_cmn_ctrl1_0, 0); +} + +static int cdns_torrent_received_refclk_is_enabled(struct clk_hw *hw) +{ + struct cdns_torrent_received_refclk *received_refclk = to_cdns_torrent_received_refclk(hw); + int val, cmn_val; + + regmap_field_read(received_refclk->phy_pipe_cmn_ctrl1_0, &val); + regmap_field_read(received_refclk->cmn_cdiag_refclk_ovrd_4, &cmn_val); + + return val && !cmn_val; +} + +static const struct clk_ops cdns_torrent_received_refclk_ops = { + .enable = cdns_torrent_received_refclk_enable, + .disable = cdns_torrent_received_refclk_disable, + .is_enabled = cdns_torrent_received_refclk_is_enabled, +}; + +static int cdns_torrent_received_refclk_register(struct cdns_torrent_phy *cdns_phy) +{ + struct cdns_torrent_received_refclk *received_refclk; + struct device *dev = cdns_phy->dev; + struct clk_init_data *init; + const char *parent_name; + char clk_name[100]; + struct clk_hw *hw; + struct clk *clk; + int ret; + + received_refclk = devm_kzalloc(dev, sizeof(*received_refclk), GFP_KERNEL); + if (!received_refclk) + return -ENOMEM; + + snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), + clk_names[CDNS_TORRENT_RECEIVED_REFCLK]); + + clk = devm_clk_get_optional(dev, "phy_en_refclk"); + if (IS_ERR(clk)) { + dev_err(dev, "No parent clock for received_refclk\n"); + return PTR_ERR(clk); + } + + init = &received_refclk->clk_data; + + if (clk) { + parent_name = __clk_get_name(clk); + init->parent_names = &parent_name; + init->num_parents = 1; + } + init->ops = &cdns_torrent_received_refclk_ops; + init->flags = 0; + init->name = clk_name; + + received_refclk->phy_pipe_cmn_ctrl1_0 = cdns_phy->phy_pipe_cmn_ctrl1_0; + received_refclk->cmn_cdiag_refclk_ovrd_4 = cdns_phy->cmn_cdiag_refclk_ovrd_4; + + received_refclk->hw.init = init; + + hw = &received_refclk->hw; + ret = devm_clk_hw_register(dev, hw); + if (ret) + return ret; + + cdns_phy->clk_hw_data->hws[CDNS_TORRENT_RECEIVED_REFCLK] = hw; + + return 0; +} + static int cdns_torrent_refclk_driver_enable(struct clk_hw *hw) { struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_6], 0); - regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1); regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_5], 1); regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_1], 0); @@ -1740,10 +1840,30 @@ static int cdns_torrent_refclk_driver_is_enabled(struct clk_hw *hw) return !val; } +static u8 cdns_torrent_refclk_driver_get_parent(struct clk_hw *hw) +{ + struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); + unsigned int val; + + regmap_field_read(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], &val); + return clk_mux_val_to_index(hw, cdns_torrent_refclk_driver_mux_table, 0, val); +} + +static int cdns_torrent_refclk_driver_set_parent(struct clk_hw *hw, u8 index) +{ + struct cdns_torrent_refclk_driver *refclk_driver = to_cdns_torrent_refclk_driver(hw); + unsigned int val; + + val = cdns_torrent_refclk_driver_mux_table[index]; + return regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], val); +} + static const struct clk_ops cdns_torrent_refclk_driver_ops = { .enable = cdns_torrent_refclk_driver_enable, .disable = cdns_torrent_refclk_driver_disable, .is_enabled = cdns_torrent_refclk_driver_is_enabled, + .set_parent = cdns_torrent_refclk_driver_set_parent, + .get_parent = cdns_torrent_refclk_driver_get_parent, }; static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy) @@ -1752,7 +1872,8 @@ static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy struct device *dev = cdns_phy->dev; struct regmap_field *field; struct clk_init_data *init; - const char *parent_name; + const char **parent_names; + unsigned int num_parents; struct regmap *regmap; char clk_name[100]; struct clk_hw *hw; @@ -1762,12 +1883,19 @@ static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy if (!refclk_driver) return -ENOMEM; - hw = cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK]; - if (IS_ERR_OR_NULL(hw)) { - dev_err(dev, "No parent clock for refclk driver clock\n"); - return IS_ERR(hw) ? PTR_ERR(hw) : -ENOENT; + num_parents = ARRAY_SIZE(refclk_driver_parent_index); + parent_names = devm_kzalloc(dev, (sizeof(char *) * num_parents), GFP_KERNEL); + if (!parent_names) + return -ENOMEM; + + for (i = 0; i < num_parents; i++) { + hw = cdns_phy->clk_hw_data->hws[refclk_driver_parent_index[i]]; + if (IS_ERR_OR_NULL(hw)) { + dev_err(dev, "No parent clock for refclk driver clock\n"); + return IS_ERR(hw) ? PTR_ERR(hw) : -ENOENT; + } + parent_names[i] = clk_hw_get_name(hw); } - parent_name = clk_hw_get_name(hw); snprintf(clk_name, sizeof(clk_name), "%s_%s", dev_name(dev), clk_names[CDNS_TORRENT_REFCLK_DRIVER]); @@ -1775,9 +1903,9 @@ static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy init = &refclk_driver->clk_data; init->ops = &cdns_torrent_refclk_driver_ops; - init->flags = 0; - init->parent_names = &parent_name; - init->num_parents = 1; + init->flags = CLK_SET_RATE_NO_REPARENT; + init->parent_names = parent_names; + init->num_parents = num_parents; init->name = clk_name; regmap = cdns_phy->regmap_common_cdb; @@ -1791,6 +1919,9 @@ static int cdns_torrent_refclk_driver_register(struct cdns_torrent_phy *cdns_phy refclk_driver->cmn_fields[i] = field; } + /* Enable Derived reference clock as default */ + regmap_field_write(refclk_driver->cmn_fields[CMN_CDIAG_REFCLK_DRV0_CTRL_4], 1); + refclk_driver->hw.init = init; hw = &refclk_driver->hw; @@ -2308,6 +2439,12 @@ static int cdns_torrent_clk_register(struct cdns_torrent_phy *cdns_phy) return ret; } + ret = cdns_torrent_received_refclk_register(cdns_phy); + if (ret) { + dev_err(dev, "failed to register received refclk\n"); + return ret; + } + ret = cdns_torrent_refclk_driver_register(cdns_phy); if (ret) { dev_err(dev, "failed to register refclk driver\n");