From patchwork Wed Sep 8 18:26:24 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: 12481679 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=-17.1 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 60E9DC433F5 for ; Wed, 8 Sep 2021 18:26:43 +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 0FF0960EE6 for ; Wed, 8 Sep 2021 18:26:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0FF0960EE6 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=cmjVI9xbli4cK3CPmRr4x6WxZyq8h6jAF+2LbXy0Y1M=; b=uWk+KeUKf7G4Vv +K0ggjaWFEDCZjBtAa+w9pbKiA4zZyVVxdWnAf01TMEOdIaHKbc1TVskmmgMw1YDTv7Dh2GARE+yF JBgUfwSKMM2JatnL/k9oi2odWgYtjuDEg3cJtxGrXoYpXfXkC2duDW9F52fLoq7SXlKF/vFmexRk/ 9IQjNY+6McbvErXeWVN3xnn2x2JitoAJ3t2FGntR9zfDyDgXy9RR34CLumDxjFJ9W3gmFRV0kXvxn IOqi79UqIHdjt7wmXnPwYdC4bj0Z3c800CscwtFCZFDCKhKLSsmYhpQCfCqUnNJFrZ8F2KF0Qbtdd hP9R0Oaq5+MPeJ5iqBhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO2HS-007P3a-If; Wed, 08 Sep 2021 18:26:42 +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 1mO2HO-007P1S-LT for linux-phy@lists.infradead.org; Wed, 08 Sep 2021 18:26:41 +0000 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 188D3ZCA016869; Wed, 8 Sep 2021 11:26:36 -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=3CN0SdAMnHg/qTITFD2Vf7qCMq9VUhJg0yPtDcOFM1M=; b=MY4TcNw99ZdrnvYa4Si0LCFk8Gn+kuGcn3d9/XMjhky9owhMpKuCNaGvrw/J0MzTTEvQ y00Y5u8pAe3xf0QlpsMCe0V6apQ5Owk+6CtzNx1TVlAP/iLy4COH8VHyy/CRPSLyfmPF Ucu/5zKgV/cJnfbYmTUKNToKIwVJEfYteMQQt98fSuhUMoQIJHmel+yn+HeJcSDa+QCj WDDXPQe7teNB2yauwlO39kTYrQJOTA9kKjUKHCMfrz5/fQfXzgomebvl0JxvJA4ru/jV zWUVB+sAFgQcB7bBgxM5W2ZJS1sjuTmQBPEHBXjTSHbjMuF0acZBph7RQMizVc+LYV3P iQ== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by mx0b-0014ca01.pphosted.com with ESMTP id 3axcp9m759-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Sep 2021 11:26:35 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIQb3xH0TbDxWLRN6vsPOXTMI9bTvzK4WcAsI1DbezZAc9xAN1L5QrCmgxaj6FHsFZvnYlCfZD63yat0Lvz7X+eKzToqs4nv1TrAlnEjdQjK5P2vlZ5u/mI7yWtEzXbVWQpXXZUPwH6T9fR56e9Ij3Gbr2mrkxuGLXMFxTlThdK5Bep43GNQEo5N3CIYc3Hosr6nIxT9VPt0zMiZxbdLBhBlcH4TFl1mwMIhyMqSEFft+jKAdOlKkessuhpZaq486qkj4iATnq2Bb3nLPGVb8Bs+EvUq4ekL8T4VfzCXcVNyp7v6rpu8IIAeEIneuCXYLmjyNlEMYSOqH854fdJksA== 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=3CN0SdAMnHg/qTITFD2Vf7qCMq9VUhJg0yPtDcOFM1M=; b=H5XMpsnt40MyYt/vwodYNxhVJJJSvn1Lhyklnx6csbF2eODwZ35KTEBSrNmQAtX/hbKuwfpi+OFcvHPOvT/oFYaYwQIcw+Y27qEc0tMll96Xwm+1yrXnpQFg7oNI+Rh5HQehuzQy4Ev/Mfwmij/pFhhqpZNItlKbMuW64WxR/Pc5D43FTvid+o5tmwjaBEUslT9Gmnk+eJxdOfjQ6Y7diRn66nbhSSyF3E6jwUXkPgKgc73v4hN4dOfcYdGnoFECnWwA+m8JtHUaC54u0rd8TGXK3yzaPbefguSgvsTEOuiUvCk30YTAODAeNZJQPTPXWHRVWp4jGuocmXur2ZGKRQ== 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=3CN0SdAMnHg/qTITFD2Vf7qCMq9VUhJg0yPtDcOFM1M=; b=r0mnYkycxXFH+OBVM/sAj2mj6E+EK74xM14f9YW7mEOKub2ETIqfxX29nRY1TVz89Qce3JHemNDNnFkW3wdNN4qM7zq6z+bggBJ37kuTEl7c46W9AGf3qADDPJgdvPMoVQwPumehipNpbs1JJkRuLXT2QDtYtxu6+snE8oyGE4g= Received: from MW4PR04CA0167.namprd04.prod.outlook.com (2603:10b6:303:85::22) by BYAPR07MB4391.namprd07.prod.outlook.com (2603:10b6:a02:cd::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Wed, 8 Sep 2021 18:26:33 +0000 Received: from MW2NAM12FT022.eop-nam12.prod.protection.outlook.com (2603:10b6:303:85:cafe::f) by MW4PR04CA0167.outlook.office365.com (2603:10b6:303:85::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 MW2NAM12FT022.mail.protection.outlook.com (10.13.180.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 188IQUwI017985 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 14:26:31 -0400 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, 8 Sep 2021 20:26:29 +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, 8 Sep 2021 20:26:29 +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 188IQTkh028409; Wed, 8 Sep 2021 20:26:29 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 188IQTrs028408; Wed, 8 Sep 2021 20:26:29 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH 1/5] phy: cadence-torrent: Migrate to clk_hw based registration and OF APIs Date: Wed, 8 Sep 2021 20:26:24 +0200 Message-ID: <20210908182628.28364-2-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210908182628.28364-1-sjakhade@cadence.com> References: <20210908182628.28364-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: c4992063-4395-4e86-5b52-08d972f62f89 X-MS-TrafficTypeDiagnostic: BYAPR07MB4391: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:249; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dOjyoofIDEIuFWZ5qxWonnhECm90FaqWKEH8k/8duPWt24xhulwjqgwR4TwDbokksmpkG5DYnXdyDpso9IhdIp0L4rzn0CVZvgmsgYTn4Fj+bGEGJORIWvAKJktXvx2fpLuntE5JUrlYCNmbcCc4Lmu31YZkkqvEc7293klm27foXAteiZ6ArUBEprpJxdoOgA8/RWxfSjl1uBAfC24YEgpiF3cPzj9/Rtx3lhlh51/60DF+YfechNuLVzyJ1m2s19qRmF50CEF5/cunNcWts3HsXXUYWZh2dw3XUgufy1u86b8woOy77PrVHEtJYXhyvq5x0dxbdJONtQ03Rt9uv8tnNV/KssTJdEcYE79x8u88VdpJJOV49SGSMS0PSbB1aJQFTAB7p0+WZrTJ68tl5/QtpxhOD2nVF6AHFy0TPHF87rWQB37gMR2NZEfzlNfVp/8W5FBem4n6fW5KPGNFQ26PcKY2e+zcPYdJW+U2zCIXR2WVjQlaU7pJ71K/Z0+4PVWyJA25io0KAm/GMKvIO0H3x5fYHnx+H4LQrayjor1h/HdkDLrNc+UMIlW09NUuWI5RLchj5Mi7DGLJbV9S4VfmSsPVVj1xcuNJjh9sWWp+LIwWqnj7eHXX/JXNhjmHfewcSbLBHmMZqRXodX3hoyj8w8ABxuDUs/651G4vi6i7BGfIWdH2hdFNwIJN/VXI9DI+5wrtx6IWJLUm1EmRM+hZq7TKhrF0eBf7aVy+82wYN65PJUPTZ2HxQtUYZ3NHbJaWMEEABRwYZLoM8daL9piFRu//Ei5y1B++0k4ciq0= 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)(36840700001)(46966006)(26005)(47076005)(70206006)(81166007)(36860700001)(356005)(336012)(70586007)(110136005)(54906003)(508600001)(2616005)(8936002)(82310400003)(42186006)(316002)(2906002)(36756003)(426003)(5660300002)(83380400001)(36906005)(86362001)(8676002)(4326008)(186003)(1076003)(6666004)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:26:33.3039 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4992063-4395-4e86-5b52-08d972f62f89 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: MW2NAM12FT022.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4391 X-Proofpoint-GUID: YKJQ3WAO587flapfbTa2a0k5mzZQcV-b X-Proofpoint-ORIG-GUID: YKJQ3WAO587flapfbTa2a0k5mzZQcV-b 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-08_06,2021-09-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=1 bulkscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_112639_749053_CB71F837 X-CRM114-Status: GOOD ( 18.76 ) 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. 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 8 18:26:25 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: 12481677 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=-14.3 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 24FF5C433EF for ; Wed, 8 Sep 2021 18:26:42 +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 D2FF961078 for ; Wed, 8 Sep 2021 18:26:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D2FF961078 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=nIB5llKOORMCk1E9p2CtH4pTOkVnqN6qooDKF/cb4Hs=; b=U6EGEi25h7GbOh 6AUQdQzTefRYII83HWnFJp9NwFF8aY8vxdVkHwVwcactrps7qlKipb8Dn4LxhN8h3BPxivGs32FcQ t30QrBXdGcwCav5/NlqjhQp0lw762b0+LxAgeXHkm+KQ/HDVI+0bgb1lH/qagIOGjIcAie2ycqjj5 H/vfpBkLzkikbo3uJ3vNIu9mLyrXfEmjVIkZFC63tDPjLylQPSfK/R/YvVluNBbL7sG+14fhVydXj TdKCpFOR1H2mbf7NfKe8E/fIemliJuP/Ff5liWAHDm/3XFdmZ0tY2n56hZ0lmFMl+3UZZ/H7/wjkF 7dnW2ZXcd74hg6O954Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO2HR-007P35-B7; Wed, 08 Sep 2021 18:26:41 +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 1mO2HP-007P1c-Cn for linux-phy@lists.infradead.org; Wed, 08 Sep 2021 18:26:40 +0000 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 188IOeax016935; Wed, 8 Sep 2021 11:26:37 -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=6K+6h2LQn2ewuASmn89bSHxezoXmvzINqbB0MYAkCfI=; b=YbuUK82afba6bhQbt9GZT04+G3aM777J+J1pWDdpBssFn/Jb82uN8Cq2TR52mk1Q8UGr e3dPXFC3kewsnluX+IsL01wiRckaUjrmmgHHtoibBHgTY1xiDkbEvkhqqbW0gwjW3XDW kpmbH54zs2y+m5TG2hrMuG0nR6gfuf2XaryDLZHndU1UEzlmpE1WqymI3oPwesjHoDKy et36yBvEHHMWu76Vey0TasJt8dyj0DfdqxlWkHkd3boyvII+WxUP9d7+u70Tg8TRsHL5 BpwTlSN1Z0Qfcxm9dci/7lr3iNoHB7F27hJcrQh1/IiiJw/HuU/o8w5O2lPBntJvBNkQ jg== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by mx0b-0014ca01.pphosted.com with ESMTP id 3axcp9m75e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Sep 2021 11:26:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YXO45/L5pbSJp2zQFinijUbP/mIaSOOj9sCn6i+fk+6EPTERLvf/zf14fKiHumzCtY8Ch1qTNf+SgXM0r/jkUdDVHPTaIC9DjdU75VLtTzZQzB/rcKLIcGTiddHGyV7BO0e57zATjsnxlECHCHrWNS+6/Di5w/LyErO+IeNJDvFuQsmq+qFsWuQZ8Ok4XB9dzzfBsY8bXEV6iI2ZvRwcaoiBJaG/MTzLbS7CfQedxHbf4rQLTUioSEfmHs64K8LnCkodWbUkh2ccfysZoOWnok6aC+brbFyOBCt9nQtnpHU99NoW+qVTj0+UAvc0z+jZZpKI0cHikf/OsFuZNqgbLQ== 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=6K+6h2LQn2ewuASmn89bSHxezoXmvzINqbB0MYAkCfI=; b=LlhA9d2Iw4S5UYIZvYOSxoaX8q1r1SlK8+MxvCQvrihnBV6tNgqUzDBSkIhGiUUGqgcKzrl8KmcDEWBFfh25mJ172DQD5Uw5L9be0Unm/lIY1MmoJeJ69uJy7dxciUncLVn7Ec2wQ5HrobyLfYjZDUOtpnfzYFTk4IOfzAwRdKqWYZOgTN8JG9W6+hWEQs8pFYKV8vZz/G2jWVaTzYPTann9y+eojkFXxDJMaZCVTex1yoS3RHd6jznwL7xo/zpPGwy7l6WoI8BjCqiFBrPLV0ut7eV2TRV/dc9oXuQayfSmn6FMDn1swqnHB+No+v3cOEZwcw+9xH1KdFV0PUlfBw== 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=6K+6h2LQn2ewuASmn89bSHxezoXmvzINqbB0MYAkCfI=; b=P2rJK5dztomeUnFPAUjIabIa6rSnycdxvCABCRSaUnPQMQDMX1KNt7Qb5J/dTxyiFVSn9srw0UAvK3utuGHC94naq3RHgqk8AcH5ZBMps6S/mcNTXWW2sV4WClpCRfSNMZlo07JyRcoRjTyReyBJ0sU+ihm/kxfancwAsVGqRwg= Received: from BN9PR03CA0500.namprd03.prod.outlook.com (2603:10b6:408:130::25) by BYAPR07MB4183.namprd07.prod.outlook.com (2603:10b6:a02:ca::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.24; Wed, 8 Sep 2021 18:26:34 +0000 Received: from BN8NAM12FT068.eop-nam12.prod.protection.outlook.com (2603:10b6:408:130:cafe::fe) by BN9PR03CA0500.outlook.office365.com (2603:10b6:408:130::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 BN8NAM12FT068.mail.protection.outlook.com (10.13.182.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 188IQUwM017985 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 14:26:33 -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, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:29 +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 188IQTXb028413; Wed, 8 Sep 2021 20:26:29 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 188IQT28028412; Wed, 8 Sep 2021 20:26:29 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH 2/5] dt-bindings: phy: cadence-torrent: Add clock IDs for derived and received refclk Date: Wed, 8 Sep 2021 20:26:25 +0200 Message-ID: <20210908182628.28364-3-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210908182628.28364-1-sjakhade@cadence.com> References: <20210908182628.28364-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: 9ad8c531-07e4-4e5c-5138-08d972f62fa0 X-MS-TrafficTypeDiagnostic: BYAPR07MB4183: 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: eZUwjDfJSGmTWYy7SAZzRJSryq+vEVJaD35laReZptg0V7pUxLvlfZXykuHqmvsBS4Qnj0l2z5e17kLcdYZpd/Y2w1NmE9SsdkVCvFED82P7i8CoWBx+U6+w8xed2B2Laio66xPeMNs2v9Z1ynHARbYapH2zIZsBw01LmUjkm0nIZCd7OvJEgs0AdwjQcFL3Hn9JBTXHiI01pILstHjsAHI/tPOdD4CkJ3oUptj47gvHponxT7xfabjD2Q5dWcjHtJ5CMmhKuf3x9YvYF6Ws+96yJImKFoHc2D3c/+UZ8ygAVysB5LZ2OMSgv+i7FiMKMAiLjb1ScGt75ucMBtTLGTI6UgJlfuvaJDDhnbj7ObJ5tWMKKTYDp4cV8hXbVsChJ35KK3oWSNlHxuiHeER8Dy5j5kZs/Ic1YoLNTXEt49tWRTVYWfDDeFcplu85jI6PZ7dt8YXNeGMvuuPOp5qkTAmvyPedtwXqRlvRrmyc0KfuEeoLKq+4bnoR3oJ+To2ZP7nkrRr44SSAeFjIUqxE9tAcg0600pq41vwilcyV6QlfRqo5qkEdcGqzQM4dMOz7uP1TXGzZ+7v3qtXj4Vwq6ztI/OSd78OrYLmQF0kuO7VaM5oH26Deu5I1N83YXwUW+fZpNQ/8+R91WLg4xyTi+PEwun569dQloHFrTqaSoxazfsu8dFKuqRKkEm6QftmwEVODz3Hdk+lMWWG+RCBlrlyBr+AkOyV3BL/eisPUlRfjkvkn8eOf+/Fbv41BLWYzVt0poqkCUs2MNK26s5lvqNealqDGwoMQJxqrVeDZmgU= 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)(36840700001)(46966006)(26005)(83380400001)(336012)(356005)(8676002)(426003)(81166007)(316002)(8936002)(508600001)(36756003)(2616005)(186003)(70206006)(70586007)(86362001)(54906003)(1076003)(47076005)(6666004)(110136005)(4744005)(2906002)(4326008)(42186006)(36906005)(36860700001)(5660300002)(82310400003)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:26:33.5902 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ad8c531-07e4-4e5c-5138-08d972f62fa0 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: BN8NAM12FT068.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4183 X-Proofpoint-GUID: 6JkMD01yUggI9E5LnFLCKMCEbHDc8Gk7 X-Proofpoint-ORIG-GUID: 6JkMD01yUggI9E5LnFLCKMCEbHDc8Gk7 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-08_06,2021-09-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=899 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_112639_749062_839A1092 X-CRM114-Status: GOOD ( 13.44 ) 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 8 18:26:26 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: 12481685 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=-17.1 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 E2A3DC433FE for ; Wed, 8 Sep 2021 18:26:44 +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 A10F6610E8 for ; Wed, 8 Sep 2021 18:26:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A10F6610E8 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=0DvWoi2Q9Jn85oX9HqNnY/nYI2UPHsS/bnjJDW+73ec=; b=r68QIWnOLEfPsf HEN2lvdrKO3QE6jYAp+xOOm4jkVtt0Ru/TNGxvtlEsR7zPdiSIMLhB+FMCaI1Pq7/DcfaTALxHE6R dN65GBoCuOq0YK92HHh/P1NwxkYoTDdbeJ+xrTMH+YX+npp605cIopvaCJ/vc4BcIDiy+Of9v6567 eJYU893/c7dTsMzMKP4+bXbaPIag9kmYZdK8rMVtEjtMi/0WAEIwEIbqQTThOS9EANsX6lH9LuXcm d50MHPMMc3IrAcXBbBojjITNu3U2JW1flDLYQobyMoCYxKtI81lpPjDclXKSQMIbp6TGdbZ+JxpBD g/OpkSjEY3U/F5+ru3DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO2HU-007P4K-49; Wed, 08 Sep 2021 18:26:44 +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 1mO2HP-007P1d-R3 for linux-phy@lists.infradead.org; Wed, 08 Sep 2021 18:26:42 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 188I6GgR030393; Wed, 8 Sep 2021 11:26:38 -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=9RIhqQ/mpOHj6dY0vt9ZTVzyuBi3D89GD/iJZ4UXDSU=; b=OK8TMmDBMUMWN4B8NBLgzs60/v6PSeXLl9Y2Ywn2pJpWHH00YttZVBrhhhc0ThuNs9jn B1M4Au2cQn2qmPToH6PfGNKk2lREl403DF17787t/GkdQoJsjpEcx+mwE8y88qJ2BY/L rlsJL9N/6mercA/FV7g9iY6z1AGUxvPYk+EUk29+L/e5iHfXAXOMwcCIuDYktwvn4wNb ZMHgzI3HSXPPwEWEh+mlHGEhuN3BNbSEmaHnWWZFkL9AjMH/3fnEmOyHmVpAiQMGHHyH MxVXWCQuoK9MOSjE5L0k01E5crXV8cTmyl82KbV8EWXvLQvicmkyYT33pHjZnX5DFEVi 3Q== Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2172.outbound.protection.outlook.com [104.47.56.172]) by mx0a-0014ca01.pphosted.com with ESMTP id 3axcn5c477-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Sep 2021 11:26:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F6PMS52RVEVTBaMxXCXdeZFKdLj/tGeyGhQV5F6auuNKgZ/bijjKXgNoY+LK8wyznKJeHhDC//l2hapd/A/N/mg6kC+5n9aD6PbH8iIugJHV+7WITrA/TfIaCJJs3bdj4tNDkURRW9VC/5HSFguP3ycQs1J0JwTFWmgAFxDDeXqFMHJmv4qwOEi3KF26R+bzCBmag9wuTIDCFdnwUem/8pRZkH+eSe0EdvgGHOdtIrdOoEBuo769Vq8kY18NDJULJbYwlMstKdNKByylCGUhFhi95KdnWNUTLNCVS40KFlF556pVHngWvIQas0KTiGpz/TyF57FbHVNKAR/bPsWdnw== 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=9RIhqQ/mpOHj6dY0vt9ZTVzyuBi3D89GD/iJZ4UXDSU=; b=Rd9Wfi6bnQhx7Zn+4LDQ55L1PfWd8aEvt4C+PXJ9Y6phGPzIDsnMLhFppqB4Sckvoi+Q546OFtq4Ed14dEC+MCJ4U7DAL9/DDhPsZtLzqFce0WyKWmSBwiBHAzhy1sNjwdHrdLZpHxJsxNUvnEyabxz7RUIFwys927+zBgTWCsKtUNucEBY5DR3m69zZrXgsqaBMPi7a+QASI3Hrbf7rkKae39KpQauef10Lz1wSbMHSmNb4O97FoZH+JIF6FyM7jDAxdW7a3TAu89QRxnJ3/65nmQ+KELPvPPm/vP+pEln4Y1WdM4kk/H7HF6oRv88nsm4cs0kH1CiDIRbJ6QnfqA== 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=9RIhqQ/mpOHj6dY0vt9ZTVzyuBi3D89GD/iJZ4UXDSU=; b=uqiKMifwbtkKS7QeF9vwBQZyRj3obFEgB0capYNtiFEdbm9BPwAN8Y8FyPPWppIOiZgmtVhbIEXbJ2OOjTIlr8WlkQetfnUSdhuVXo92rka0JQtZXhAffnYxuMpZq7aAtahcoIx8mT9DbFAPBKroEbLGOYI4ilRgo0IRl8xpAdo= Received: from BN6PR1701CA0024.namprd17.prod.outlook.com (2603:10b6:405:15::34) by BL0PR07MB5636.namprd07.prod.outlook.com (2603:10b6:208:8c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14; Wed, 8 Sep 2021 18:26:33 +0000 Received: from BN8NAM12FT026.eop-nam12.prod.protection.outlook.com (2603:10b6:405:15:cafe::44) by BN6PR1701CA0024.outlook.office365.com (2603:10b6:405:15::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 BN8NAM12FT026.mail.protection.outlook.com (10.13.182.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Wed, 8 Sep 2021 18:26:32 +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 188IQUwK017985 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 14:26:32 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu5.global.cadence.com (10.160.110.202) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Sep 2021 20:26:30 +0200 Received: from maileu3.global.cadence.com (10.160.88.99) by maileu5.global.cadence.com (10.160.110.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:30 +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 188IQUQ1028417; Wed, 8 Sep 2021 20:26:30 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 188IQUnf028416; Wed, 8 Sep 2021 20:26:30 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH 3/5] phy: cadence-torrent: Add support for derived reference clock output Date: Wed, 8 Sep 2021 20:26:26 +0200 Message-ID: <20210908182628.28364-4-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210908182628.28364-1-sjakhade@cadence.com> References: <20210908182628.28364-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: 613d6761-b2a4-4dd3-3245-08d972f62f18 X-MS-TrafficTypeDiagnostic: BL0PR07MB5636: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:370; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PCWvxaU6Bc/3S+ie0Pd3KC8MUQKGcqSR0rvWMib48LorncFhGTwH/xJEN5D35omJV2NMTbMbi12dL05FsOZUUYgoxe7P+41TcWqBOzAraPZrOnHXoy/lMOE174PjornYmxG3WtxAZq4Gti2rVdto9DkXw0ru/szjEAFNbRiY2gUGnv0yoP0JPXDPH4MSnjShOOHrUtoxNnhdEbdF/8TgHttKZZcJZ6Rua1EY9Citj8o9J+Xe3Ko9J+8fHrDAW3hcEc7Lqv9UpEa3XaBsndOyHlR1WsOfe/NYphV4BHW69JP57TXGGXfXkFdn3W73sIQN9gH3/2Yg1v9DGfayvxSZfeajHFmGpfTomyvuoa4oiqYCjc0Y6QusIzLpxnMN8A3+7UDM8uB6wjwBiOD+mUcmrJVqkpdvR+6Ul6vH3svzDM3pEg6E5WvHHVcYhi9j9XkhMlF4q7/84Ee/nwyuUo6o9qpVYp5R2yTcrOLBbhoTzCpwwdltX1628qLfUonRJSiCgsXuRTPkXZiF1b2rF099D7MjuoA3V0X9UzSCgh+EQXj3Y2vr7gV9TC5klX2fi3EPkQVJcy+yZh2Pk+QdxB4DHox6+rdyOeIwtL64iSPlUGq5Z43nyaHdckfqmvDaUBKOV2Tt5rZZ4Ia2pAFzpavpJk4THFID3hpf/7GWs46EUk8SkWgZza4ZtN2fT83owHZobN8zIJeG5JS9h2tkwqVPAx0cLM9G1j1+CCicru4mWsm26jG+IZ9V4od73YpV4qqSb9MoovbuZPxImG4Roc6sxZ02MKeEhDEtajJv7sGt3piDOlI2XOmXmTLoANi8YqsN 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)(136003)(396003)(346002)(376002)(39860400002)(36092001)(36840700001)(46966006)(70206006)(336012)(70586007)(356005)(1076003)(478600001)(6666004)(5660300002)(82740400003)(2906002)(8676002)(186003)(26005)(81166007)(83380400001)(36756003)(54906003)(316002)(36906005)(2616005)(82310400003)(8936002)(36860700001)(47076005)(426003)(86362001)(4326008)(110136005)(42186006)(2101003)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:26:32.6942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 613d6761-b2a4-4dd3-3245-08d972f62f18 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: BN8NAM12FT026.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR07MB5636 X-Proofpoint-ORIG-GUID: V3n1VEtUxeYlNWA_PBj4np_eE0-W1y4q X-Proofpoint-GUID: V3n1VEtUxeYlNWA_PBj4np_eE0-W1y4q 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-08_06,2021-09-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_112639_939195_7FE19260 X-CRM114-Status: GOOD ( 22.16 ) 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 Update the reference clock driver implementation where cmn_refclk_

is configured to output the reference clock. cmn_refclk_p/m will output either derived or received reference clock based on the selection. So, all these clocks should be modelled separately. Model the derived reference clock here as a first step to support reference clock driver. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 78 +++++++++-------------- 1 file changed, 31 insertions(+), 47 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index ecb1aa883c05..6dceb12e88c4 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,23 +262,8 @@ 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 - -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, - CMN_CDIAG_REFCLK_DRV0_CTRL_6, -}; - -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), - [CMN_CDIAG_REFCLK_DRV0_CTRL_6] = REG_FIELD(CMN_CDIAG_REFCLK_DRV0_CTRL, 6, 6), -}; +static const struct reg_field cmn_cdiag_refclk_ovrd_4 = + REG_FIELD(CMN_CDIAG_REFCLK_OVRD, 4, 4); enum cdns_torrent_phy_type { TYPE_NONE, @@ -330,6 +316,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; @@ -348,7 +336,7 @@ enum phy_powerstate { 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 +1606,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 +1617,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 +1625,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 +1640,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,23 +1671,8 @@ 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 = field; - - 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"); - return PTR_ERR(field); - } - derived_refclk->cmn_fields[i] = 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; @@ -1713,7 +1681,7 @@ static int cdns_torrent_derived_refclk_register(struct cdns_torrent_phy *cdns_ph if (ret) return ret; - cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER] = hw; + cdns_phy->clk_hw_data->hws[CDNS_TORRENT_DERIVED_REFCLK] = hw; return 0; } @@ -1768,6 +1736,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)) { From patchwork Wed Sep 8 18:26:27 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: 12481683 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=-17.1 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 9ACABC4332F for ; Wed, 8 Sep 2021 18:26:44 +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 5DB6661153 for ; Wed, 8 Sep 2021 18:26:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5DB6661153 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=QiOo5X4Gb/SJoLzDw6ara6SjjcnnHWMQ/e/kGSuYQTo=; b=DqvTjnJbY+OLRg DAehevqEuIb0SUiPtmXN8NSqMOXN53R4zCOVLVwh9L5F4s8Orv+te+VX2l1Ajen7gSYowj/Ugr7Ny sYfbCz8g/fFySG69MJHcn7vr2IqBF09VinZ8rvbGuu0LomzeUW9nv7c5mThGSns+kbPJWyxKjGC0U rKxZiZBxpOEj8vifGMCU9D/ReiIyKidivGWLf+T1RUHEOoZpZO6E/pwSKheX3iUWe4MtTdqZJzCO+ 9djP2KScPFMU8ofAiItCuTRRqlJx08KSVdYPyIKX6bDC2Na3OYUNU1uIt29KuP3F/xwZwzLDp8G3r JNbpgL9Sm0/piNYq4Q8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO2HT-007P47-RA; Wed, 08 Sep 2021 18:26:43 +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 1mO2HO-007P1T-LU for linux-phy@lists.infradead.org; Wed, 08 Sep 2021 18:26:42 +0000 Received: from pps.filterd (m0042333.ppops.net [127.0.0.1]) by mx0b-0014ca01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 188IFI7b016872; Wed, 8 Sep 2021 11:26:36 -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=pgYX0wpmWp7GH5f/5jQmVn8NQbB34wR4K6Sqbw7xq5c=; b=sjST+bPm0RVWeOe/70HGCBEjJPjvl9gz93rl+7xJMpf9xkCi9esvi6qLgQTwX/Uasj2M E5ZgkAZEqluzMJv204cMHeRdWaRJ0oh3I35TgZXxMP0e+x/QxL+C7W6Xfm5DCupgEgsx WPIYkYQp5q0idqV3FWiwrOs6NfPaQxdJZ5qZ9gxRGiK68/S/VEx8LzwLTeeqXTohNzGW KTcIumjspvJ0MgytkII+j3dQREnXZeM9ZQZz3XbL+WmuJQkJa0aP2hXGaepKjItsR+b1 JdYe9SjAjdSWEvpBrC9RlfS8g/Dkdxog0N9g5RrdLDNdo+Dg4IVR8Tp0k1mji/3mDpXT 6w== Received: from nam02-dm3-obe.outbound.protection.outlook.com (mail-dm3nam07lp2048.outbound.protection.outlook.com [104.47.56.48]) by mx0b-0014ca01.pphosted.com with ESMTP id 3axcp9m75a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Sep 2021 11:26:36 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibNoRSRMGTV8Csswm4HjDZKvF3c2Go7i2BjjYyCtgl34PDRM6m5DYV4HeCAFnhjrxbyAUF1VyHlPodVRmAbNVmqng2WVkM7ZVSbWmWeglMdDBZ+c+3VgkJVATvQoejmoFTFPRDT5jPmaENVAcNrs8bWa0HQrPfNJ9O1ZKcbqBj9MCclafdfmujWuvAP7+xydKnEongw16ggmVfLEjIW0A5zi9Us/aPVEjGgri0Ox951nwZqAmtOvGMQCP4NXqFp5MlRi+0Aa7ojT/BHSdGrgCAthxbWflNUTfs7ogy2TGCVC+/7dVjrgH/p7uJgjjY8UE9TgmQoItXCSh3oRailBrQ== 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=pgYX0wpmWp7GH5f/5jQmVn8NQbB34wR4K6Sqbw7xq5c=; b=Hg3utsoX5ws8LdBau/3ShJl9fUHlKD7bmzewGYa8KCdySTVtVnQ29dbNcKLuCGwIwExbl+/+x0mt4CiI2QuaNJRp3hEfxPh2RzrMkH297zOwaWahOFSeqmDHHBybrDgfSmcRE0SJBI2Ls/BVvT5GnwhG/26hCtWqd9UtFzjKqVzLtYYRl5K1Zi/pqBWXnSHVhoufG7189r9tFMB2rPku7/OzwJdUgnFMAEPanNmxN05wXB932ibdktLeex0aD2sNQk74yzjbhGLNeGbymS9K5zG7kbXZfdzkgOqKy6wjLjDFqOUasDdNQapIawvFj1EFNSw+tbjmn1oW2edYyX+4ig== 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=pgYX0wpmWp7GH5f/5jQmVn8NQbB34wR4K6Sqbw7xq5c=; b=zsoMQ1hPmaBhV+QfROKd2oKPFCyTO7jFSiDhLiRdHPSC1vAHhnTzyv7To4bOBQQGNuqUlB1ldus4BkfiYwkjwRYlLqZJP2BosIzZ/2g5eWL1c8cS5ADPNmrAHKo4qg7DdEQwmX6Z86hKTi3vOkbXwcCDOQwrcgV4NiLq0kIj1Nw= Received: from BN6PR13CA0006.namprd13.prod.outlook.com (2603:10b6:404:10a::16) by MN2PR07MB6894.namprd07.prod.outlook.com (2603:10b6:208:1b2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Wed, 8 Sep 2021 18:26:34 +0000 Received: from BN8NAM12FT065.eop-nam12.prod.protection.outlook.com (2603:10b6:404:10a:cafe::22) by BN6PR13CA0006.outlook.office365.com (2603:10b6:404:10a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.4 via Frontend Transport; Wed, 8 Sep 2021 18:26:34 +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 BN8NAM12FT065.mail.protection.outlook.com (10.13.182.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.8 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 188IQUwN017985 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 14:26:33 -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, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:30 +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 188IQUB3028421; Wed, 8 Sep 2021 20:26:30 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 188IQUK8028420; Wed, 8 Sep 2021 20:26:30 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH 4/5] phy: cadence-torrent: Add support for received reference clock output Date: Wed, 8 Sep 2021 20:26:27 +0200 Message-ID: <20210908182628.28364-5-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210908182628.28364-1-sjakhade@cadence.com> References: <20210908182628.28364-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: 39c745c5-9595-4735-c6bc-08d972f62fd9 X-MS-TrafficTypeDiagnostic: MN2PR07MB6894: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:404; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uHF+Zr6tBw4UhTm5wval/SYssiBVIR7O9vgbeFC+90N2ptHrmAOD7U3I/A4pHwqnlQSnQ4LSKJeqCF/VLI4me2k7HpvdP/YKmYCONk+TTG9R1orw49ZbMMlVPXiQQucgYmGhN996m6dTgXTXn0dQBQ8TUrN4cX/xdbeA4BrW3uMU2WDXWbohuLqeIc2FLIXtZkKlUQH0Qp/AOIAaZBz+ztmYUmqGutegFRUUV5Qy1P+sCtaUOky0WpV+gbZVPB1AeZLZAF/aEdG+nkSiv1yiqpMkYitZVu1IpMk0z3GvIV7RIpS5EBRyFkCGNIuzTCvAtX0t7Irx9d74Y+BowGktCT1wmIvHItw6Cfc7IUZ12407xXZXVvV5+ZrmeDcxO5sfZ7YlexLmgtdZ0KGQqyzZKL823QlrxK3OjIDIOe/HCwpnY/6LucfnftP+5eV4Hoa/B9SPVMIJuERJCs9AIeSHUzAjICDjb/dByVYVDfgXW/NhN4EIKs/fXy2gpm57Q8MQNs6DitmeX8EQNd+kUvp7UefUhYrO1/VhrgrOwKbOVKpAO9l/2Q46dStqxy0UEaKN7VQ9hukyJSqaA02ttx6PB/K4oHdu+OVJmj9kvMKOdXOPEH1DxcREYZnUUsxeBxK1DoH7QHSiVvvYfwGbJcNak586uN+dInhIyjGlIOWTEcYI0pWlhATqyI7P0aKvX/G1C14eK1XUVks1pJ4axO7PJ8elpMG/7rLVny8efZ3SUKEDYXxBT6RqLKjkleXGMfAYEXlnRufyVkqt4KIGYT27BNGGDIl7/WWrlDM5tFlSi7A= 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)(39860400002)(346002)(376002)(136003)(396003)(36092001)(36840700001)(46966006)(70586007)(70206006)(86362001)(5660300002)(8676002)(110136005)(82310400003)(186003)(356005)(82740400003)(36756003)(2616005)(54906003)(47076005)(6666004)(81166007)(4326008)(478600001)(36906005)(2906002)(336012)(426003)(42186006)(36860700001)(83380400001)(316002)(1076003)(26005)(8936002)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:26:33.9668 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39c745c5-9595-4735-c6bc-08d972f62fd9 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: BN8NAM12FT065.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR07MB6894 X-Proofpoint-GUID: zDdtSAeGEJ5cKrG0zkHzIFo8BYbUSO6W X-Proofpoint-ORIG-GUID: zDdtSAeGEJ5cKrG0zkHzIFo8BYbUSO6W 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-08_06,2021-09-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_112639_748253_C5905B05 X-CRM114-Status: GOOD ( 21.51 ) 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 Model the received reference clock as a next step to support reference clock driver. 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 | 102 +++++++++++++++++++++- 1 file changed, 101 insertions(+), 1 deletion(-) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 6dceb12e88c4..2c42a6690632 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 = @@ -343,6 +344,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; @@ -1686,6 +1697,89 @@ 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 struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, u32 block_offset, u8 reg_offset_shift, @@ -2191,6 +2285,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 = 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 8 18:26:28 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: 12481687 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=-17.1 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 2C1E7C433F5 for ; Wed, 8 Sep 2021 18:26:47 +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 CF16E61078 for ; Wed, 8 Sep 2021 18:26:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CF16E61078 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=NKNb68wafkvocYFUkY+jBqPZUKYK6A0aajEqlnWRtwU=; b=N2o0oluDAk9SvY jU9k/WJEha/wUmjaQnGiSFUpM3OxUrCXTJAARiM3eIImX/WCLfCNzsIFgvRa8KTOr7Qir2YgNA4lf cF0hzz3nmGOKMy/JBpKwf3UsPTQd4zqKew/NpPYuw5oFCN0ZdanDeQpXUka79csL2rnyvImgmY7l9 FNzxYzs8JBjuQrAWIfY0vKrN/+Nc3stnz/FvKs5EWcidvkX1NU//7YQ37sFUHmjO+oejz3lDERrCp db+AAR/fiSZWSF0KA/WHz+YtRvWXt3c7BSnfXUOglkfFsGamNg7Os8iQ6dqbni4jQRhdEv2eZ2AON fbUKNWsNmOWLSt9MsJ9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO2HW-007P53-B0; Wed, 08 Sep 2021 18:26:46 +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 1mO2HS-007P3H-4N for linux-phy@lists.infradead.org; Wed, 08 Sep 2021 18:26:43 +0000 Received: from pps.filterd (m0042385.ppops.net [127.0.0.1]) by mx0a-0014ca01.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 188I6GgT030393; Wed, 8 Sep 2021 11:26:41 -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=r4LGrKYVFPXf28WdbIK1scsv/PzmLaaE4zedmIKKVwE=; b=KeGNFHF88g3pMWJiHY/1U7h1WK2NrP0l4NfvBz3FNtlR3HruNn9LXGDoYSKgj9f5qt/H gvK6hLy1Yy6KzYxaK19HCtg9j/Z+34qts0GVdsj9iOkN0uN08N/stYXQTHyqXP382jy6 tq0s7HhU4FrEijaqYWe6mrE7V1ObXL1mFBEGrRbZUZmH7q2yJtvmNxPpoYV9gypNglXF FH/3jz+Tljv4OqTWdWPzD/7SQnMSQuH9RrSBwuhF4OOH7FS4/gqzXNAjm6aEh+ZXuiBv 1tS7glRqVhJY3rV8KoRISC8lqPgJ51yOdEG6t8zZrJk1oal1V3YQ1BJMqtxD+iTLi8i1 eg== Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam07lp2042.outbound.protection.outlook.com [104.47.51.42]) by mx0a-0014ca01.pphosted.com with ESMTP id 3axcn5c479-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Sep 2021 11:26:40 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jahLDl83K1tY7KjlH7sxi1Bn1vrChEb1OZk1hbtcniTZU1DmKJu7Qx7wUdPvil7rNWOHI3FKMs3+2WFtOP3CbnTZtDAzyh8gXSqe0NAFI8znyPzY4inhKDPmu1n9sAJQOsK7Zdzr84cejej9qtUNb9GlXchPf+AZqjmzC0kERoicpxui+bTn3uF6e+0oiw+8JKDFM3khRgexTpWCKXaMJeLpvlo+7M7xEPYJxC+GmLmJwwNF4BN9lcVJTt9OptiM9d4WRKQ0wOYZX8UleBqvbm4h5NdSTETFaDTLB7aZKot1Mnjx/QaTZXvfJ1LRV8rgrgnGl0fKx2mOvL6if1nbQA== 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=r4LGrKYVFPXf28WdbIK1scsv/PzmLaaE4zedmIKKVwE=; b=WJauSt05mjF9se6YfQu3bKbaHfgYiImQCuefV9hgvQyjrDtUO/iUkqNEt20TrjK+mfDVfiFP9K+5mQdGQTifxaeulunuSNuyhreg9Tl931u8ewMdEnXSRMWhymQFPsBVQHWKLaS7mKUtEmaSSlfaBMnnNhgzAlQet2dwkGukIqBHNhE+66JQwU/ulZvbnIpVDw8IHrWiVSDoWURpEj/kNnvGoodRU67wNfS0yg+JIpzTgirSK/5ChtTN5i13W6NAdnOzcs2JfQWFqtWMJ1EEaJgifX1KRNA2+fUKTUIzvCa5rC1pvBqp+BfD3EGDwZnb02IycXMxBPonZJ6cE+hw5w== 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=r4LGrKYVFPXf28WdbIK1scsv/PzmLaaE4zedmIKKVwE=; b=gD7SpYYLN58GrYO/WRIXsGCPYdSVcHzJkgIfVEGnKklZLWB31E6GGJHLWFH+H06Ftz2XATkLx4s2sJ9TQZmGaeXvTcrPtw4tC3oE7zLFeKKAzTjadJxMpI0u9E/563UvutjSS8+dhuc9dM1InIQmDVm/4w4Ky5MvoIqvsCUv4yk= Received: from MWHPR01CA0026.prod.exchangelabs.com (2603:10b6:300:101::12) by BN8PR07MB5828.namprd07.prod.outlook.com (2603:10b6:408:6e::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.24; Wed, 8 Sep 2021 18:26:36 +0000 Received: from MW2NAM12FT021.eop-nam12.prod.protection.outlook.com (2603:10b6:300:101:cafe::da) by MWHPR01CA0026.outlook.office365.com (2603:10b6:300:101::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Wed, 8 Sep 2021 18:26:34 +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 MW2NAM12FT021.mail.protection.outlook.com (10.13.180.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.6 via Frontend Transport; Wed, 8 Sep 2021 18:26:33 +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 188IQUwL017985 (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Sep 2021 14:26:32 -0400 X-CrossPremisesHeadersFilteredBySendConnector: maileu3.global.cadence.com Received: from maileu5.global.cadence.com (10.160.110.202) by maileu3.global.cadence.com (10.160.88.99) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 8 Sep 2021 20:26:30 +0200 Received: from maileu3.global.cadence.com (10.160.88.99) by maileu5.global.cadence.com (10.160.110.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Wed, 8 Sep 2021 20:26:30 +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, 8 Sep 2021 20:26:30 +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 188IQUsU028429; Wed, 8 Sep 2021 20:26:30 +0200 Received: (from sjakhade@localhost) by vleu-orange.cadence.com (8.14.4/8.14.4/Submit) id 188IQUSj028428; Wed, 8 Sep 2021 20:26:30 +0200 From: Swapnil Jakhade To: , , , , , CC: , , , Subject: [PATCH 5/5] phy: cadence-torrent: Model reference clock driver as a gate and mux clock Date: Wed, 8 Sep 2021 20:26:28 +0200 Message-ID: <20210908182628.28364-6-sjakhade@cadence.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20210908182628.28364-1-sjakhade@cadence.com> References: <20210908182628.28364-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: 4af95582-e825-4cd3-4feb-08d972f62fe1 X-MS-TrafficTypeDiagnostic: BN8PR07MB5828: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:139; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8uTb/vC2c/YEv5ppweKVunO7DIzo3e/2PGDRbibaViMZ9D++siyMxQHhlnbqGmCIS7o9blGwjNQ5hl7Ct0QQPSV68tUbDHLVntgjuA91SJZTqgUTeEpoOSo46fucrA+o/GeuB4yjGwVTK8mGJMiEjNm6Q7OLytx7Ujr8L+i5oX1my2/LnTCBKWxkwwbTmUkaKa7NfEin1VMnbNps7HvInLlsKTGeO6taJvprogv5TV5fG3qRRm/OrbFTWKsI5FSuOHHFByBmzmEKVpi7TP6CMh4Kq/l3jpna0aVG8BJ5MxEZ27/G7pnQC41u3J/kWBDHNp3UP4iB78cQ1HISJSpabV//+kzHIbXFfFxYLFn3AyaYcL9M744Kn3QJruI3NB1b/a38tUayNG2V9w3/bOWDzEpHui4c8GmAqMyFeAY/YJSpXNrcU9ZjmnOE2DuG1SGcHy6ICX+Gp6QzypztJa3Oiz3bFNMScvNx2DCyFtM8NjiU862sScdJeJmZg9iGsOCEz8oqHsXbLa0luNjcKlYLMENzYu2WNHoqKPqGMiswa3qVjQNrgmxpg2TkNpH4st4NZEq6evcTC8xANyPoP4FlCAc6a7RI2ZB3UyAA6RO29HnlbeaLuy76MLUTm4geslFC9sv4mfBP0YrSo4IP18G2Vv9hzoJphONTHh0peONPyZOGTazkWoqdqTJr51Tb9dxDiQbEUdgwCj5ME8+3lxgH8fUiFZfOP+Arfr/9a9NssBpe3xvo4LpJJpI9PRc5NagPCJNXQCXb083BRsnJa9ckOE5NrPET6TvAVvR2PGJrG8o= 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)(396003)(376002)(346002)(39860400002)(136003)(36092001)(46966006)(36840700001)(36860700001)(70206006)(81166007)(316002)(36906005)(1076003)(8936002)(110136005)(336012)(70586007)(42186006)(47076005)(82310400003)(478600001)(356005)(82740400003)(26005)(186003)(2906002)(426003)(5660300002)(4326008)(54906003)(83380400001)(2616005)(86362001)(36756003)(8676002)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: cadence.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2021 18:26:33.8913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4af95582-e825-4cd3-4feb-08d972f62fe1 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: MW2NAM12FT021.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR07MB5828 X-Proofpoint-ORIG-GUID: bgcQCMbrjumSRLNAjSCgCg8Xp415ip_Y X-Proofpoint-GUID: bgcQCMbrjumSRLNAjSCgCg8Xp415ip_Y 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-08_06,2021-09-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_check_notspam policy=outbound_check score=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 spamscore=0 impostorscore=0 priorityscore=1501 lowpriorityscore=0 mlxscore=0 clxscore=1015 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109030001 definitions=main-2109080115 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_112642_230197_90A00C9D X-CRM114-Status: GOOD ( 22.60 ) 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. Model reference clock driver as a "clock" with gate and mux clock operations. Signed-off-by: Swapnil Jakhade --- drivers/phy/cadence/phy-cadence-torrent.c | 160 ++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 2c42a6690632..5786166133d3 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -266,6 +266,29 @@ static const struct reg_field phy_pipe_cmn_ctrl1_0 = REG_FIELD(PHY_PIPE_CMN_CTRL 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_DRV0_CTRL_1, + CMN_CDIAG_REFCLK_DRV0_CTRL_4, + CMN_CDIAG_REFCLK_DRV0_CTRL_5, + CMN_CDIAG_REFCLK_DRV0_CTRL_6, +}; + +static const struct reg_field refclk_out_cmn_cfg[] = { + [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), + [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, @@ -334,6 +357,15 @@ 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; @@ -1780,6 +1812,128 @@ static int cdns_torrent_received_refclk_register(struct cdns_torrent_phy *cdns_p 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_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 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) +{ + 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_names; + unsigned int num_parents; + 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; + + 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); + } + + 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 = 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; + + 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, "Refclk driver CMN reg field init failed\n"); + return PTR_ERR(field); + } + 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; + ret = devm_clk_hw_register(dev, hw); + if (ret) + return ret; + + cdns_phy->clk_hw_data->hws[CDNS_TORRENT_REFCLK_DRIVER] = hw; + + return 0; +} + static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, u32 block_offset, u8 reg_offset_shift, @@ -2291,6 +2445,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);