From patchwork Thu Aug 4 22:05:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6E8E2C25B08 for ; Thu, 4 Aug 2022 22:06:49 +0000 (UTC) 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=S9QZxaU1VZMfiwbx/M6CdBQvDO7mR6IfFg7tUSbcq3A=; b=NK/dV/hQ12W0HM UjKuMs014sHD4AtSe3lrbK0YEco39y66FoUzAHb0mFY8J+OgGCSOIsvU7/ToFevVlLqciDc7sI1ze VhYNRjeGRouCcbmgZrRqsj2aV4OfIf++0Le0x3ACE5VoXIZJj05kFqoLdy0RNtgTxF6A1STOd0/oP QDbDbRpb97y+wLu9JATrY2ZsVQJdq8rqoip8gHt1n0yLtwLw8jjf2alqFJwJ2ELZpiEOIh+A6+qoY Wi+m0do5Xr7L43pgaDsLjerLDdC27MKlHzTKQWCaMZg3tKvZL4UPkAVXg3KSsRdN6vxpRc8L8b1wA vcuoreZ0OYENlmq+uJCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizQ-009Qk1-NB; Thu, 04 Aug 2022 22:06:48 +0000 Received: from mail-eopbgr20083.outbound.protection.outlook.com ([40.107.2.83] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJiz5-009QXQ-CN; Thu, 04 Aug 2022 22:06:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g8D4ug3//6wdLGXkena3orURzVAYQuoOpaQJdzuWHsDUfAxC9YVGOmBs3zKKwnLt7MqUOMcQJGBGwN5xrw/MeqLmw3QHRGgshQJtv0lHgHA3mucU6vuPTh1prqEpY293QtjOCisA5jcN+8XGGFEmwq+Zj0lKXuVc/1zCsB4ecnM3voZhtj64OrSKbzo6vtkJ03vcpXfzgUe/lk8jKkCirmE8oaUZM4CDEjWNxYFdL8d/bhCZfx2qHFEEnDxACv1TOeyFFqrNb75KXuUidzFD2/2wuRAp3SzY1caOcNPCH+e1aytmuQ+Hh2vRDVDqIzSrt6G7ljCwj/DDvXLAk9weiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PKxq/0RAymWIcWXFqksFoBLD0v2SENyUZixmAv2PcaU=; b=SADR/NZOEZrZpeonhBz7ewO7rf18iWomxNtf1VWhrHdtgnWLrOhBUkogtg2Q5twDuuQ87A73kXXhp71C/z466jlMElFhSxS+MQ0eeOArQLd+om9JNfsi8lH/2GArjgWfBI2gTUgKIETEoOLLJXKHFbp5ZLanbFRL+/AMj91tMEibSzGmJR1Qta5hU70Kmi6iSlak6Lik7HgafWH6WXV6L915ZPx8QeLHCraVGGRS8heRnVx705UPz/EdlHtyzkSCIdRkvqNnNYQPJCzq22CNo1hQOI7uz74vUvyIp2KMNHXTM1TfGyEYUZwvgfyLRXfNTrpHY7qbuf6gslIFXVhrQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PKxq/0RAymWIcWXFqksFoBLD0v2SENyUZixmAv2PcaU=; b=O1OND2k54FGWljdF93vV3PgAe+Cr0xBZ3jaPyON+aDy+iGxuOmCIEzs50NUg9NcB2h+ovfmFOxlpTtGbDDmvvRd23XX5ub/s5Bk2bVA8fl46PF5FLlFGhA1+imecb1s3ZcnVNxa9A75XxBke/3LiWEOqZ/+O1e3+gj0nzIZoGDiJZtYstJrcyD7qp8vFGIE+XGUj4Hzsrnw81glL42zgV7EkCaYcbCiP3jDuS9i1eqxIFg7Z9661zvL/w75SNeWBA313ij6i3/YtIP4lgvPNeLTRV43aXrD+omkl74mQCzU9EWGFZ8HiwmtpNmfdAKD28aYJ7aEz2iox96lGnyWYpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:14 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:14 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson Subject: [PATCH v4 1/8] dt-bindings: phy: Add 2500BASE-X and 10GBASE-R Date: Thu, 4 Aug 2022 18:05:55 -0400 Message-Id: <20220804220602.477589-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5644edbb-7e7a-4f89-63da-08da76658c47 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3UanhBXE0/PIUvAjTJuYUddYwqf8IV+S17nxXA/6Jt//eygqhEveq362DFjpy5xurlZvCZ7Hcl739DGDZVhYWE7K1A3Z82DJ7nbasi09ymUIIG3W5klBF/GJ5p0NzRCMDpxDSIjEj9n4C1DcYDF70tFNqlGwigNVwxZtwn4wT2j/t/g6QHdg13BkUpsUINPVWvhv34jhfDZzZ8QWasnydOAy0AHPXJ5q/TceTeplqCSLtoCmf1yzwxgdH0LxKhZ1KMXFssuv2tXSb31JkHZgWdbQeau98d4FHO9TBWhmPK3x1KYwHnbwQ7xXB/MFIAPBO1GqnoEImxwerdxa8t8Jqlu3V/rA8OkPKCOO35XVasFYuR3jON2ha9HxPPCUnJ+61gQ1Fc8SFRpuU2TljaMNeJ6q9gKQKCjM/fa2Jh2xZR91NkxXff6wn4g45Pf3rirU0OfKw+/mIkNT8YjQoeVqOEAYPlQK/ezXWs9ael+3SNEBFolvzt9Shh93qgVUFqH+bS0PgEkP1mQZcQs7k3SoIBVBlyaGEbziw9QdBGWCn+NGs/RCJjnwzEd0XrwWDJ6opqHY0UuHyNlFw1xZZLAm4otgCXYK7xJQy+GegxjNu2rmCbxyaNRMvCMJqcFnMyVT3eF6K256lvSDmk4Bf85QRK90xy9DYzyAhIoqC17se4wjfu0zZwktf6UhjtplFw+uxNRnFBkE9yMwuYNp9D9P4omN/GqA/IAJEqmaKQDFMg6pI/F16z19euTvxfgoKoIJUCBeLEoT62IOQuj18K6jc+wazsm4WuBNiLMPs15msDPI0NSliqRb2U9E0qmnNbVy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(4744005)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(38350700002)(1076003)(6512007)(107886003)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7+nICGXEV7USesrBq9v/L5kuJGZC6zN35ug4EM/+0yHhNHKCct8s0suTdNS5IK7UgO4yXfV0vuavYSkdGMcJqjF6dD0p+0FV8es7Hsb+SQB87jTGRvUyE6yyN9tHolbYvG5EnarkTsJUQAmJBKAcUKIKcOfasFvGQvb/tnDt+4F+D0/jqhS0oSdwB1WF8Rna16vU/9bQnHUW9wWpK00Xna1AtejzJxYsNMXPA/QYW3eaTpd8MW/2bw6M71fApsSWyv2o5bSk/XZaARqDfUPABN0qzla6LBfH7xQvb9RcTVDsywW++sujM0UifT+vx1fso272ileBOJLE1z7rn5PCpzKHDfaa7jGMkbKArMB47DcYTsNEncSa3zpIZMcRvSzhOH/d5RUODWDSr3QK8SuS4k2yg+UepkF5Eq5o8NB9EVRxHuIk47HzUXoxX1DUHtSSSPFkY/aji2RPOQODMds6RnWVWCgdNYgJVrqxB8HqnyhPfUz4JmSEUzO/dzjrc/OcexvxqNEyUUhU6M3qAVCm1Jf9eKXmYth/QXu65iY0fntLKT1y+Xlpyx5p3aN43zDYumMRfQZ5NeTzt8i0ChFJ5ax+RymfHuaHhhiMsyz/1anBMqdsfgfr4QqdOwD9Q0VfTejzPP2ma9AOinBSZeXYzEuJFh4Kg0fAhzcLCUy8KlqocpcnlntqemQ9TUEt/UzGtP+CQB3/K+RqnjdNqCetnEVVhHYZQ/oalBNFHiMQB4drkN7tsA0eyv4a1kUHAaeGQLk2DSL4eGmAq/BPId+DK7T8rWNHXBEGktkoiuxyw8C7XroqMJPMOhGQFVBN4RExKCLRSn1VhTTmjag24zjMfbD1ZMb7RNNKus+sqWKQHfSILWLe3DKYi6zE5foVrdAeePKBnmm+95rKLjztc4BdXueahLvkIqUL2cUTdlP0lv2RgnwqLsFMV8PQyijkoLl0RwHiBfSWjyBVSt54pYtU+ZwhT2lvVZDIuQZ8sc8ocriCyHOq/anMTE67taO/OI29nesg88rG2I/o0eYheeJXGt84+NC1s3vmOGVAmr1izQ6NGzPdf5Pwvy4FaM1tiUcdBpeWGSOQHL+xdZfgUUFCqLStSqO61Fz/b62waqzGwJ36HNKb7a2/V2AtapvU9YZoCnsW/EIkxj+zWrYfoCeRjSxkb9EKcR4LM+vOg23VvhZnVyXbh3CY2W6xf492xGVj+oBNv6t5u+FblRa56ES6xratYS881Xboc1GCIKNEt+677kQBBCXJLx7Wb53IRtQZyZHu9+GpjvRBKmADGLKWWKJ6EZu+iEVGxuVt3TEQLUNzObbL0LKRXPgyZU0FnoDTh0/Z7xlaUoOJuJiFG9MFXKeTBMA0Jo+XoZ3fUdmOsgrzkjWUbyu6iHBLo3LIRJkIn0FCuYEYEbeDJO2mnbL1IlMu6RfBnW1VPHAkXlQPfjiCsOYWsMelBypA+3xUOXQeejboLzlPiuyEVscsZy3ELQ1DWyjgY1E25PbUDmLG9sT+JL+wkdkW+6DLP1Vr1pPLWSPYUMUBjH/aKaRC1yWSyTqTbAvrJB+ORthH4wBSLW+9nZ038h90Ga2NjiJ8LS/i0ubIJ9j2AzV21TQU+DNV+A== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5644edbb-7e7a-4f89-63da-08da76658c47 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:14.5484 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ax3wz1DCEyuFaXsOdcx0m5xpia5OLq1fm3xrW0Ce92d0+xgK8gPK5SjyVSQOjeThvaC/vtRK3Ub6/QkzSvtcwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150627_469900_85BF3369 X-CRM114-Status: UNSURE ( 8.72 ) X-CRM114-Notice: Please train this message. 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 This adds some modes necessary for Lynx 10G support. 2500BASE-X, also known as 2.5G SGMII, is 1000BASE-X/SGMII overclocked to 3.125 GHz, with autonegotiation disabled. 10GBASE-R, also known as XFI, is the protocol spoken between the PMA and PMD ethernet layers for 10GBASE-T and 10GBASE-S/L/E. It is typically used to communicate directly with SFP+ modules, or with 10GBASE-T phys. Signed-off-by: Sean Anderson --- Changes in v4: - New include/dt-bindings/phy/phy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h index f48c9acf251e..ca2e3d52523d 100644 --- a/include/dt-bindings/phy/phy.h +++ b/include/dt-bindings/phy/phy.h @@ -22,5 +22,7 @@ #define PHY_TYPE_QSGMII 9 #define PHY_TYPE_DPHY 10 #define PHY_TYPE_CPHY 11 +#define PHY_TYPE_2500BASEX 12 +#define PHY_TYPE_10GBASER 13 #endif /* _DT_BINDINGS_PHY */ From patchwork Thu Aug 4 22:05:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD8A8C25B08 for ; Thu, 4 Aug 2022 22:07:23 +0000 (UTC) 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=eDezYT75anXAOtoorz7/0Hcvw/g8qKXu0EA0oECaVpA=; b=LpdaF4KnMrQbEj 6tgsl67IeQbiktNG/0zJg+yAxrZt6Zq68/Sj9upGj+1K6Qeb6mQ8UVufXP7fG+3YFziX9caACRtRf avD2foy9ch9z6dZ8lcC/Y/K56ADbow52Hjs9qZ4fu0AK5fSRJVjVY1A8HJC9H91FeNAJ46FOn4Xno BuxxQk8/YuHOrod0Bgs+HCfK/bslH/WkqiQ0PAeRA8GUR25Y6gAvCKRkMew07H3GB7myUVn2lx6Qp Rs2ruyE8S458UIBvjFj56yUjq+Rjp2gXEXuXaMntaeRRgsD2nsK/EvdTocO2tCphRSOXoNkUuPhr/ We5V55J3330Bns5Nrb1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizz-009Qzj-49; Thu, 04 Aug 2022 22:07:23 +0000 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJiz5-009QTi-Hu; Thu, 04 Aug 2022 22:06:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SDFpV9RkF/1BBXF/P6QUZU2Nr0fnr3wnbZbSpl5t75buO0s/6JFBtPEcE5ynkTG2F8UnkSB7QRS+hMgmgMTHmP7rfp1vHjpn1Is9g/HtqXcqV6Qgpj7cGTEUgaD+uSEA9cjVXIzf76FIzCgetmTwjfY5AvBbeQafXYyZViNBerC3w1VPNdMDoxu0RnVidVSbzJmKRy0KHCje4kDEHynPF4HaM0c1rJj0z19vL0S4hzCsnnmERVppmXM7pZzACxL85WT7ekIvsXQfwQqQdtpyWBBvX1WSomI2bv8s+WRGnmgF48OoxqWmbtkd/2IWoSPIce+n0VmvaUHeOebpW7H9Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J5V8YwPFUT0Hv/rr/nNMiPSzkLn61sIkHDsoocy1Wvw=; b=XoLTu+ELZ+VB3J6md4bLy5mlr13E2lA6LOa1/UKh+GUwH6AmaMCoydpNI/1+4bnzOUxJEJrFFTOeXRrrF/lyovlGRrja1cUyUyNeiPLsMGZHXBN+jm5ElZ8tUIfgMq9U5s8GYOosBlWlbntRLhET/Wyf5/JkxMWKsfhbUS7z8TpMJ3JPVBh7zZeHF15TnCUTm6a1D374/psFrJbEae5MSrtM30xHQyzVQ7pt21aRUNOmYCxxaBh0ky/PjbilCzLPYB3XKEeVUSd4E+rIu494KQugfsgeemUx6LUXqmA956wG9QzVceLhS3VgpOFczOebKgjX0Y82aLDvhl2o1Y+7vA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J5V8YwPFUT0Hv/rr/nNMiPSzkLn61sIkHDsoocy1Wvw=; b=M7n8/WchlCHlD/rccRKYhw+r9PlWVXRyvD1xPDW4QlE7JKHF6AXgZqavAj6lyOW3+2OUsKyS0Tt58VXf30CnNK87X3XBDfpwBmX0cYiY5Fbx4p9/P+WeiyOOPIY93ZuFMtxMq9lwLCwWZVHLE1yP6sZnnfs5Fyq7WwdJ6F1AlcdEHzX89fJs6d5oMWJNkO0azRd2nQ11lSe3bNghoIy8W71jjhwXAJjH0CeYJAvHaz1oXAf5qT14B8uZwcIpkV0Iw9SWbePXM3uEeiZ6TRvy2UnOhObOGC3a1N6DZzPqF/rseYjvMABx8I+BNLM3ZwMLNmfnWU/Y5UuatfBIZCMUyA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:16 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:16 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v4 2/8] dt-bindings: phy: Add Lynx 10G phy binding Date: Thu, 4 Aug 2022 18:05:56 -0400 Message-Id: <20220804220602.477589-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 510fb894-2f4f-4e8b-7b23-08da76658d46 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CpxenYhtIYoSyyD7phxvBZJsmbajgo8KNW8M/baq6WkW/pg2CGK7ZWbPJcaX/gqA/EJ10VwVUhM1647+KUldrCvVyVpVBU4OMaNJsHe/OwdRDVrqDtQQafBDD/x2ZRakYp6koOmVlqn0q731cKrQMtr54gVCX8LDm4B03M8PTDSrJyo8c3EHH9Aye5sNA3EtERx7fVzxtkyic2gSff+kMY8/llebLjjZus8P4fZAbn8M/At1CLrvCk5Vp86FarkSQwn05mbS+LZenNuIDL9bFIPutiDFvpLdt4T0+yuDdPUdaavCYB+ZUW7WBFOKQdEHk7+40IOcaGGGH+3vnX4vY3a3hFB86QWbf7n2WNydPdY+qJevbb31F6tMKezqqZwHGhph6QuVa2az+ccE0X9h969/94jI/CCisWFOCKiPJgrmwRvzBwzjwFugfTBzdsVWfaxfm8VBl75xkDPhBuUv7cjN0nrEPGVPebjR+zFe74YCXIeY2CxWVAfusW5w5erbo9MQFtvwb/86w5JpRNOnJKoJ4s/8dAI+kIDulKLc1DGF9X4gpfT31P+8NG0nLK63lCK02B6/LMpeZb6Gs/c4AqLZNrPAnV4kAXot2DqAYM+6Az8H4RouYev9i+ca9or+ViN2q92Cd2wne5xPz2mIj4zIReOEHn+eKXzPKEPMmGXbNvmz8IHqRzByjfroiw05JI4q1qq7bctrroOwmJBlgVGKn1YeCpdUlAkyJVdYSVOOpKUXpJsp8BDayufXB/mLDTvJC6wHPD2+2CuRc8k4dbECFHDSEz6+0k14BSa4YYgeGNTIABnoAgQr9TagG6grTj29mx0F4dLAC1/88lMj2A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(966005)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LVdlRHKzmbS6gLjv28iU7YjoCTM8B4KBNoCMSBfz1EBk4bLVw4gMr/nHlGTa7njOa6Bj1QjN5f1I0o+4i6iRZ0165iwwmF+lcP+rqoRitMK2ub1MeXw/Ile+LW37z5mupi5DKDG/JAEMzp7iAzt8pBc+SWbppSGV/3Zr7mw9zH0yNLMRpMeq0bzR2v0y8/M75EtDcVCe8LQeM5ktdI3a2E2vXeD5V9ERnQzYZVi8r+aKgTDuX+ZDB+xbJcXxg7B2tjapqOb8SKuhe0EqDXbkTHeLlvuCeLkbX/XGfA1nwDds2xM9lu6Nqk/B7Zrh5u1STw6ji8FP1nFZ8c+vu7N+7dxGAgmnWkRa1M8JV8dIaeXnLHYwFdsc6g3e2tQedwLoMp+kZ/nV7FJnZ1A9s6jbBqgbaDOpOm5bGCIha6keFbVWLVqdPfVpbcU+FPLv2s9xjaSk9UPKlJxAgv0Zd3qF8+ffoVKp5G2KamkDRCvr7VRvlscYYiEPxDz1u3GLuXU8GawDfnaiP+2zfT2LpIlbvqRndcVVFKBP8J+VJURaTGp4j8+aAldFo29fgQzuHrSLmyo7ixu6A+1fEXkCWfp97xruYrHdOeHnF085ZyaNVVg4lCwJOPAfaasOyyBF0lrE6C/ax4n1mUXKuXQFP0ulXogHmklISrLB5YSOIuD/CNs+CyPcu1ZnPQ8GGSnQs++YrOstfSQkP4k5M1tpJR1bzh/UXsYdf9R1q4tR5xtSezzuxoAuBmsOuJPxGRBQzmP/aBReIz833cbZ0O4iqc+95/y5R4y2YB4UNuavoJF12sG5NNSzccCx89Uy8U32GzVISLiOsYm97xZ8CAn6fKzbudMThnxwQdoTf9RjhyQqSWYpg56ZJDr+wRT1wd6QlJVtyLX1Pf5pDWT5F8+E1Vpx+KzbHE61DNy4jdBIPEE4D41B/Y2eo5760mUbh0YHLAsJZRQ5ziQOAq3dRF7DlgFJRUId6vxA41h63JD26WcPsc2flUAISOeHIHEJw0TQt2/eFDFLiFc/7VG4MUAc3GJpiA6IVxr9YuuKRKgVR2XrpHm3SAVn9TLocpP6zwBqKA7rliHGgYxVx+0x5YT44smKGkGfCFmJRKsyESD8n3sfiJ058roA1uJh5kThDH6OLa0b2zmgYsYtCsrM6ArH8p5MLUnLYJ0uCE8636NgUzfnFuvC0xj5rWJtnqof9Kr17izKlMmTJwmbzwtUApXwLLa3dB63leqHibvUFEBNZ7U8EZ6l9UIMS+wgP4JajS90dHiLOP4qKCQfl6wNFb0h+diLHhU1bRLtAUJeHLDYHSyk4UKH7rj/SbjuZBec7JyCSxFrcxNkMS5aN1U4s0QtcUream0KPvkZxptrypxazAdt/APqR9pMBl1AsRzPTrCYazLIsDO1tPvJq+gTqAypcoQspGE9SOobM+4Jx0ypZS2UtOgWY/mhUfORbzk4DKZXduBcvE2WTl7/no3PTD6ZFerwY0V7ECCP11YPZQUZdslaVvJyqRWiHV9gDGz4G5/cJkyhJmB9G51BQUIIn8smOmgbtHSaMsR/KEDIitnF+RDNZpYdzN7w0B0pswRGSlXGx73TDW0PAjoG4HjESmYdX+QKvw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 510fb894-2f4f-4e8b-7b23-08da76658d46 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:16.1264 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3Lc8pGEMNMNd5twVGyKWhXoLF6v3JBKFVXBrrnqfKrYQf7MTwbQZqO5ag2DRQ2xC90fcvVIKcxz6eHbwVUrW0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150627_842058_F9669F2D X-CRM114-Status: GOOD ( 25.61 ) 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 This adds a binding for the SerDes module found on QorIQ processors. Each phy is a subnode of the top-level device, possibly supporting multiple lanes and protocols. This "thick" #phy-cells is used due to allow for better organization of parameters. Note that the particular parameters necessary to select a protocol-controller/lane combination vary across different SoCs, and even within different SerDes on the same SoC. The driver is designed to be able to completely reconfigure lanes at runtime. Generally, the phy consumer can select the appropriate protocol using set_mode. There are two PLLs, each of which can be used as the master clock for each lane. Each PLL has its own reference. For the moment they are required, because it simplifies the driver implementation. Absent reference clocks can be modeled by a fixed-clock with a rate of 0. Signed-off-by: Sean Anderson --- Changes in v4: - Use subnodes to describe lane configuration, instead of describing PCCRs. This is the same style used by phy-cadence-sierra et al. Changes in v3: - Manually expand yaml references - Add mode configuration to device tree Changes in v2: - Rename to fsl,lynx-10g.yaml - Refer to the device in the documentation, rather than the binding - Move compatible first - Document phy cells in the description - Allow a value of 1 for phy-cells. This allows for compatibility with the similar (but according to Ioana Ciornei different enough) lynx-28g binding. - Remove minItems - Use list for clock-names - Fix example binding having too many cells in regs - Add #clock-cells. This will allow using assigned-clocks* to configure the PLLs. - Document the structure of the compatible strings .../devicetree/bindings/phy/fsl,lynx-10g.yaml | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml new file mode 100644 index 000000000000..59417e6172d7 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml @@ -0,0 +1,236 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,lynx-10g.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Lynx 10G SerDes + +maintainers: + - Sean Anderson + +description: | + These Lynx "SerDes" devices are found in NXP's QorIQ line of processors. The + SerDes provides up to eight lanes. Each lane may be configured individually, + or may be combined with adjacent lanes for a multi-lane protocol. The SerDes + supports a variety of protocols, including up to 10G Ethernet, PCIe, SATA, and + others. The specific protocols supported for each lane depend on the + particular SoC. + +properties: + compatible: + items: + - enum: + - fsl,ls1046a-serdes + - fsl,ls1088a-serdes + - const: fsl,lynx-10g + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + "#clock-cells": + const: 1 + description: | + The cell contains an ID as described in dt-bindings/clock/fsl,lynx-10g.h. + Note that when assigning a rate to a PLL, the PLL's rate is divided by + 1000 to avoid overflow. A rate of 5000000 corresponds to 5GHz. + + clocks: + maxItems: 2 + description: | + Clock for each PLL reference clock input. + + clock-names: + minItems: 2 + maxItems: 2 + items: + enum: + - ref0 + - ref1 + + reg: + maxItems: 1 + +patternProperties: + '^phy@': + type: object + + description: | + A contiguous group of lanes which will be configured together. Each group + corresponds to one phy device. Lanes not described by any group will be + left as-is. + + properties: + "#phy-cells": + const: 0 + + reg: + minItems: 1 + maxItems: 8 + description: + The lanes in the group. These must be listed in order. The first lane + will have the FIRST_LANE bit set in GCR0. The order of lanes also + determines the reset order (TRSTDIR). + + patternProperties: + '^(q?sgmii|xfi)': + type: object + + description: | + A protocol controller which may control the group of lanes. Each + controller is selected through the PCCRs. In addition to protocols + desired for use by the OS, protocols which may have been configured + by the bootloader must also be described. This ensures that only one + protocol controller is attached to a group of lanes at once. + + properties: + fsl,pccr: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the PCCR which configures this protocol controller. + This is the same as the register name suffix. For example, PCCR8 + would use a value of 8 for an offset of 0x220 (0x200 + 4 * 8). + + fsl,index: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the protocol controller. This corresponds to the + suffix in the documentation. For example, PEXa would be 0, PEXb + 1, etc. Generally, higher fields occupy lower bits. + + fsl,cfg: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + description: | + The configuration value to program into the protocol controller + field. + + fsl,type: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: + - 8 # PHY_TYPE_SGMII + - 9 # PHY_TYPE_QSGMII + - 12 # PHY_TYPE_2500BASEX + - 13 # PHY_TYPE_10GBASER + description: | + The category of protocols supported by this controller. See + "dt-bindings/phy/phy.h" for the relevant definitions. Individual + protocols are selected by the phy consumer. The availability of + 1000BASE-KX and 10GBASE-KR depends on the SoC. + + - PHY_TYPE_SGMII: 1000BASE-X, SGMII, and 1000BASE-KX + - PHY_TYPE_2500BASEX: 2500BASE-X, 1000BASE-X, SGMII, and + 1000BASE-KX + - PHY_TYPE_QSGMII: QSGMII + - PHY_TYPE_10GBASER: 10GBASE-R and 10GBASE-KR + + required: + - fsl,pccr + - fsl,index + - fsl,cfg + - fsl,type + + additionalProperties: false + + required: + - "#phy-cells" + - reg + + additionalProperties: false + +required: + - "#address-cells" + - "#clock-cells" + - "#size-cells" + - compatible + - clocks + - clock-names + - reg + +additionalProperties: false + +examples: + - | + #include + + serdes1: serdes@1ea0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x1ea0000 0x2000>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + + serdes1_0: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SGMII.6 */ + sgmii-0 { + fsl,pccr = <0x8>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SGMII.5 */ + sgmii-1 { + fsl,pccr = <0x8>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* SGMII.10 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XFI.10 */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x2>; + fsl,type = ; + }; + }; + + serdes1_3: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* SGMII.9 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XGI.9 */ + xfi-9 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + }; +... From patchwork Thu Aug 4 22:05:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB0C6C25B06 for ; Thu, 4 Aug 2022 22:07:01 +0000 (UTC) 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=IP0SyIuCf3RmcVomgUH8PrR/QyV6LIp6+IzjVCQqjts=; b=twF7mIHyofusuD 0xEus1v7RHNXKcxJrph6ZqavGmTw3x/vQX8fGc4he2Tv3V+Ubgxce6TkW4s3ildKbQsfHX38Pg6L0 tNsydY1Qcf29tVmikGb008P6kY6pS/YRfcr05ttSqSAHfA8UivPrNasiXiouOoiPEk3EfvsDvvO26 /KZ4ChR4RuzAxTHrSBI96ugHxx+62hsjgPXTmjp6veJZqoejEh3YdZEX3G9VW/ehEE2QN6Wo4xj1B 1oytuZ6tI9ArUv1qmhmGgHtnu0TnvJW9kmDu1Iv0DkX4vTe/8ey+PKFBiN5IndYm/4F5YwIoumc+F Ng1wMybUdPUbM4EJOyCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizc-009QpV-TV; Thu, 04 Aug 2022 22:07:00 +0000 Received: from mail-eopbgr20083.outbound.protection.outlook.com ([40.107.2.83] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJiz7-009QXQ-8s; Thu, 04 Aug 2022 22:06:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EnfT/h5JUogKPdd28Cl7qwMy06ZldHN3woXgg31zoglqZqJO1sLcjXAMEo7u/p8tZ1IftToN+2AQyaIsouCFgr7jkdhkNRjY3wsykda00Fvy14nDY+K96d3OrlJkDN0j4zo6CkQTQ9KXhn0AGNJyTQAl+79Ug6KmKZCvC36hL5purtIlylNXMrX4VH93n5FCr0lqhgMjVb4UvETLYjqE6kTUeazTG/0qV3VqtLNecNd3hn/fXvXZYe+Dojr047/MGQvUVCFhOia8iCdtw9Heq+yEN/qQ7SgBaJwXbJKg0nNTlVLKIhWC68ZOi1DLTQr8aFcZDVdoqJlYxidAC6xW+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QVDgzB5raXAgwKW49ZsxS3eR4G0GW2MzQUvq2qu6i4k=; b=WT/d132lOelkdSCRCX8qrIDtIK7hn4G4rg69MstFfF+tSIqWl74uVzCMSGMCJ7+n7IxKkg2xlIwnWJzYSy6jLvX6ar+u2QPhrn0ymLG5IPncqTr5/jAWlV0A2E75pAmFFdbqcs1f4nekh3x2qaOsm0geHJx2zaIcZfz4o1z2gDpilZhmrLZ9VgJwPoywhbQnWiz/5ZeAXYwOyjKjIak0qa505jNavLMQ0WVCQdrnJG9SPD2O0orSeNcwBvtvLif0g2idLJzFs7W9pxO+uDGWxpTBJ1tKZonFZqtkDZv95PhvRvNw5DSQdc80SO2pl5n6PtIN9BvL0TJBbSCAaCUHvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QVDgzB5raXAgwKW49ZsxS3eR4G0GW2MzQUvq2qu6i4k=; b=cehiJk5Z9CrK9wq+Ib/USbTSUo/SGVqboWgCwGNLPKmx/ULxQai/ut0tT+sAekqr0yX0PN2L0kn0ZH+cRNEnwrsg2TTu8+R/85WC0qxXjqtUyzGEqixABz3Kxj3/F3B+A9R5kdFWZAWEANZG39xQostOHOZ4n/WocO0Eqcj0v8ilWpwMd6FF36pOtQ0QXUTJNj2FYFdDJPonJhgo0/gSBqc3r0IeYJlKf0CnLDHrR0uXEEuYC2ry4Cl7YpOHGm7+E15XfmuwYENzAkmLTfqB25NVL7SXYi4YbT3x80YYQmKrseg3LqvDC9/2PDjq2DkbyD0RvjTmG+jbC2ybN7yZaA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:18 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:18 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v4 3/8] dt-bindings: clock: Add ids for Lynx 10g PLLs Date: Thu, 4 Aug 2022 18:05:57 -0400 Message-Id: <20220804220602.477589-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f51a319-f5c6-4de2-a6d7-08da76658e39 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SWDuujmEDubZ5D+aQTgPCPP08KOIEtVL4Y6mW2+QqI+HMSHELdwcKzpuEPWK6zEXT+YKK79AFl0OqvxuE3PbaYE/YnUhpb0NvbJLoz5M6fmPENyrosxhxdUAXDOsdXVKSOa2a6cwKfDvpjqUVPS8BMrs3eRDvvA5Xb/ofz33B5a8hCxuII7eLxpjsSkW6A5LKwE0BVk8hksh+MT/ilKfvHCE92oxkrcYNBY5hlK7DsGNNSCmSSiHG5vFyd7t9PEYRzIfFmIM4nWqEN3E27o8yddWWTIxcC4BNFxebDOrcEQ8hLLu30l6FWqe1P3uTvWEfz5vRDOlEs7aaSeHhy2smW9DMWd2hU1tQILORFpP+gy2m6q/e0baZ5QxIAJyf7BVKBXa8ESIuLGJ2feCOEYaCdg02EAQbGmOuHB0dWklzaz5S1jEYfS7LxghAEIBSi/ssEkS8OlXrFvMwqBD9f6t+zg75Jd1MtnbyDYjDU7K3ZIX1/oDan6a823frp5qdDSVvPHmUUS49KxYDklMOAYPqdGukMgtDNOmjwPzoTtj8u1lhPYh8H2trCsr2Fw3xdAMGRCfHKeLmtrgUufs/MtMGIbeuvd6RmpExkJPFOizXWqAJMzwaN5JjxgUI7fajCyVU+Rr5yLMdGKaYEhYEGEl5JUT/HoBMqjubXEJB2ZT/NkijO36tZbq8QYQVfzAEFUzl+TrNVVgt/hA2D52C0GTaFDWWY601SGu882jSy9aCgEfoaWJi6BTE/otzMEMo8ZFJ3YOh7Q3KFnCQKvlpbGCbKdGJph/6UlgG7aEW1FPOdvwkFrwr0OiCQPEJqyYi/1C X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rcJTG2FPDG8YxyeJDwMi4AsPsdaPvbhg7lidI9JkR76l7D1ND7fcXVV7+BMVfM8wL2FEYRQXtnaZ/fOorAbrkdRSgxW6Vm0zju7nVtcs2z76bIQBopbL2HQyck+Gzhd9w8qBxiiCBIZO4BjpWG1OqlEncnu7GgIOvw3oxYGspbow2RivRGIYXL1IL0LQN3DbBYS+xBq2/+mhW5iEiRPWQpTMIzinZ4hD+rSSZ9Lf6uXDUl6Z4LNwNPwMiQO6QAagpVC+CwMRMkeST8i9tdYaiogvqE0L9yzRNd1u39hLP2HjWWnv7lyXkW3m8P1QUMd0ae1nE+/AEj/7gc8wSIk2STZWYTGNrVDNS8C+IFtY6BK8iiNjGcBd84rnQAaETKji1zLLiI3Bii6fBihre6tCFmSiF1AwvZ8p+tunIwb/VipPccf0aeDbVG52L2EWwCVHx1Dm/FTR/7Hd9+CXuNGFLI26hIhRapW4m3TQ+g6xYe2ePYHiH5gUsUfuR/1zEyO0BSVviannBzyqpkg+PDdud8O+z+BM0XKomtYbygsBz+if0Zfmek+S4w+TgdAcYH+CfV7bgWK4l+LrFSj0XSS9y9+31D1oVIMh4+cKpq2fF3gQ3/v1wQLjsW1vp3jOqNirH4qB9J+wsfcuH26aDh3mREGs7sWasqfkJpxT+aT+w1UoZbspWYGmp72Kz9wSs8edDd/YAPs0+9phqkbt795mKMAJnOOoVTMWwwwW9o2cWOX9irdxhx0n5tWvyen75YUhFJUMJ1qldm4naK9PfXOx1Qy+sbpT11G3wJOu9467psWw+dY4PGA/+jyipTBGmgPX8If2THHgh0Oy/nlC0DIo+hOGnQ/P+czx302yH/f4QnrwKjfSxPelJnX9MYGn37uRnzMTn7zjrK+h8dqSJfXFRlaK8+KxRkdK7H6sSS+zb6SQp0l9Hp67LlQ2wppO9x48DtrBoGmguk00E4CYKpMTXMBwYqP1Jy2By6QhnaF1MTkTTG1kqzjFmasbH7OiCUgizozZIrMX5yG1T9VOEB7MVNucMnm9DlUuzRqnPLpzTOvtDJldd4pL+Ayx+7zstYp83tCQTCAvM9cMz5OTn0KR9hlotRx+KwG0kIg9RT7oTv3AJeAf1UYsxvOT5gorK+MQLZr4+bOnTdSP97QG0WsJ/j84mJ31evn3o2I0LgvLV5KQzeY4jG+D5lmGagUrRPLaDN6SZEbJRAS0c4FgUJyaZaP3pmDPtG8W1IpdcO/BRWO54tYD3n8PYnVf7/X6kKBmB8v31vOZO96ZFjq7IBFB1x5tOxgCR//lxvaW05zAWmC3q+y60TnZm5QcMXz00UBpBElJn84ZMOlYgHXhFcXKn+Pqw6/SS2QC8zWlk1m0zP4BeqlYnEnmAlsGaEI9K0EpMl19PGug0ABmFGhlZz+faLGAqvFjJa3m535i9Ku/jiz8pDYP9cquETIyOKPZXhIxEcmJ55hKhMN5B5MM5Zt+1Ps/gsMZqVk/+/Y1tBvWmOtRbMMCtrXUsaZnJ1yHV5lVeAPovYez+j/UpYlqGlxzABbvb8RGGl9SFlwQd++RGzUKKRnPo4N6AIL/cjpyWaY1lv9mSukUc01ZZ8xJJd2zoA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f51a319-f5c6-4de2-a6d7-08da76658e39 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:18.1263 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YtZi6/A7+SoksShqs3A9pqNBwFs9CSPaOcKClsar7nce7CNsUryP8Qkt1r7A373FD7b2JuZiH8IFuqMdjRooBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150629_425565_4D1CAD2C X-CRM114-Status: GOOD ( 10.81 ) 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 This adds ids for the Lynx 10g SerDes's internal PLLs. These may be used witn assigned-clock* to specify a particular frequency to use. Signed-off-by: Sean Anderson --- Changes in v4: - New include/dt-bindings/clock/fsl,lynx-10g.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 include/dt-bindings/clock/fsl,lynx-10g.h diff --git a/include/dt-bindings/clock/fsl,lynx-10g.h b/include/dt-bindings/clock/fsl,lynx-10g.h new file mode 100644 index 000000000000..f5b955658106 --- /dev/null +++ b/include/dt-bindings/clock/fsl,lynx-10g.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2022 Sean Anderson + */ + +#ifndef __DT_BINDINGS_CLK_LYNX_10G_H +#define __DT_BINDINGS_CLK_LYNX_10G_H + +#define LYNX10G_CLKS_PER_PLL 2 + +#define LYNX10G_PLLa(a) ((a) * LYNX10G_CLKS_PER_PLL) +#define LYNX10G_PLLa_EX_DLY(a) ((a) * LYNX10G_CLKS_PER_PLL + 1) + +#endif /* __DT_BINDINGS_CLK_LYNX_10G_H */ From patchwork Thu Aug 4 22:05:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 383E1C25B06 for ; Thu, 4 Aug 2022 22:10:06 +0000 (UTC) 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=vGcaEnlpW1ya53BAzSiha9EMmmCqPNyYoSmjtPJaULY=; b=VAbU0nju0WBrYp ka7vtMHAhN/rw5NCJYFmWjE6/3Q4Wc1DqM+k+AdEBlD4NgAyErLwtsvypG9Nh7wGI1fAnsidA40/u u6uqTcWjA5Lss8xQHapQsMQMx01QKMTEhPXwBuAdr5r/4kUuZgFwnzeN+qUx3YfRBMy0MMEFlA62n 8NUV6o1YzUVH0UzYvlLl27UiAYxRxOa9UIhAzYh+UvOwXZaUTAxLGqZbe9PS1hjDT/jYnlvztAQsW gnT4O5VEdLicLsoeXNIm35qB11aHxhNE3sKIZSEOZ/EaCWI4z+vM41BPfl1mYE/OPXAq9CIbWvF0s r1npmPOCxVlRE5Y/ubhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJj2b-009SFF-8O; Thu, 04 Aug 2022 22:10:05 +0000 Received: from mail-eopbgr20083.outbound.protection.outlook.com ([40.107.2.83] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJiz9-009QXQ-H3; Thu, 04 Aug 2022 22:06:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZRDJWEN27AIBtcHWPmX4rr1PRtZRvu9M72arCTbHC48ehCsH3O8SSLK7+NE1alFGBl5MfERFOV3d5c5sniaEKIy4zLzvMwwxrdWnZAZuUztpza844eCtfBucCKnaok2vccC030v93cFfAoummvOeRAAKrUj74ShSMmmVcF8gq8IP0Zw4sQhHUQNoi7+p0LrmlGq8+qTaaczHnD8EJLWizXUZ7hnCl5gvqfBX77p7PScT/m0egXrmvLpcLfjsqQs20Ul+gFg+I6FCeHfE01564EdFTY+JqzExlISZJUj69UoxKBclHzgiJ0684t6/41p7SyzKypjnBEKiD/SZnqyOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RYEvR5HT4MJP4YjyWjQTkbjnUXvF2MNjjpxGR4ZvYq4=; b=lJ7/XFibbuFPPdAtnekL9vwo3ZI6xmrAdlwUdZKQWoX90mxZY6Ym6uQ7ZQ/mQxFSXoYhfIYW4ip7B9RgIKmMMNJRML3jTJLivYyZeNsExp0zAfpyu+yqi+ZF6P3/R6VrIqMx7iccqiO5/gdfehhw71M5/smu1X7mvxt8TsdqQr3ZdyhJajrEN2Ko4eHnQqevCjqhELu/OBWNgxWyTaQ159Hr1Z6Ry+t4j/g3TAUFEmIzbdJKEQ7dwv7Lk6KEa/9z6mMIjLt5sNKTG3m8clEH6aIl+/jkChWXr/x+dGciddsKXbM2rjvlngst3ehsg/1oQaOC64tYofiI6zbVfBtobw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RYEvR5HT4MJP4YjyWjQTkbjnUXvF2MNjjpxGR4ZvYq4=; b=szWTxX3E4noeVd85cN6TXXNgYKEczu1o5w/zM71t3CXvBiM/2a6ItPl8h3e8cbMeA4fMsSAwu2K3HmUNH6ooeuIt1OfnVNzzrKzlONKk9OVfmswcN8gjg2sDsUyBeTvbMblgT/1qKnc6vJNjurcED5eHrwrffVc9RTTixp1Uj+FpuSGFzmA7ndMfnsNT14ev+wrjQ6Rke8muEBq6QxHkdgXz8ElHF6ynvtrRkQybNkYOVb+Aj1q/fdph6VUPRZm07qikEiSbKICMwoELszMqfzU/uhd6sVipkFXfCh3C/xZK8AU1CPzymCWtUoxyOs4ANjEBCBZrj+C9aJowtLUkHA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:20 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:20 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Jonathan Corbet , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v4 4/8] phy: fsl: Add Lynx 10G SerDes driver Date: Thu, 4 Aug 2022 18:05:58 -0400 Message-Id: <20220804220602.477589-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5030a09f-2253-407b-e12a-08da76658f7d X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kol51LVxiB3yP7ADOCG35ybvRxJXSLwbvLwg+K/85gDux3HVCPTZw7n4g5I7YkJN4nAA28QqvR4UwYQaJ84/x0/wkaZigCZQwXsFzJkNhJ99QKv3bbJql4DC9NNpByU/HKMjdInJRJgvPcQ84Fm94l7tw6DAoqth4B0aGyxvNgYW3nnNzUAgoyBpQ5uSFrsBL8qamubQqxavlZ2T+eGXXAVq+0ZFDqXx/+NTCdy64QFRme0fyjy395HH+DDXOr5CobQ+qCZiuMWqbmzgBEcNh+qO8ZbHDQtc4P8P/OaXl6XKrc+ZeHIB1NMTMyl+CoKKkOyuuuSn7NecomSyH/LvskwquVFiADfpcqB62Snp9cYMQdrXxwLJXWp4LoZIkosjfcVfFlmt2r5UUwvZl9XA3VKG8kNj8AwW25yO0Gd5llQdI7k3NU15PJ9hFMyY9okv4IIRyQG8dwdbmiLcyY/Il//V12dapS11HFmcpiKgGbR3P8pCT50bOdzcTWT2Fh+gWmKTSIhkzRIWTbT6JJX5AqjqHVhMG0E3ozYjWTHo0tc7pb6Rt5BAIBv8vxaYac8z9DjLf9iztqPH2HDIxvzsUvwMqgvYFmtMmO1uMVAlP9zPFdwMSW/xqm8R45KPnEwBCJqeOC8azjkNbriVfRa4kvcqvVkW2/6TQrdlc+6Ia8DZ1Ppb38AFWuMRrXnnEzlsNCfSQuUPvxbtV/C/Rjb5t+eSltxSxGgX2C1M4vou+TXWqz8yZ1X3S9A4y9gxPfnU3eD8n8McyLdQMBOC/5sJfbFU1rl+t0awXPwPJKuXV9sVCN0mP9BXPKZ456oNXHYkqaow/JYbnMt/pxtGhDUoeSI3D0wJj9kePqap9lKPnKU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(30864003)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(966005)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005)(21314003)(559001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xTEqqAE3qZ8dI0bZ3s/0rp023gdo0rWBRD0ve0LNeMvFfID0E3mUt2tVhr0IML2R/bGkohPrzyzVTsaasyuq4wXcmRiNpPXRmwBo1AIvyXYQBJ2JvPmzswI4MmLj9trQsvSjCJ9KfgdC4ui9/EtcvxjxuWh3LFkqOg5rp60c8QacSyJD1wJvWd80ARmlKKf4IRhJCKAbgKtzyvDoW7uuhge8RzVSwZwomfmINNi8JLvzIVz1LRCVMvDzslSclF9s/Ohsv4zifzvr0Gz1gOVV8jCEIaEQV34TT8xUSPOpCo4g7ThoQ8/1N+dkfMoUb1kuBcq2Q88iSdvauo/vhe4uF3wF7OS+sVFHi+wstz6ArrWLmX6+5v/Te3OixZCts0y28wkFFFNQMtM+j6i7jg34FnYqRXTQjp7UOzLMZqmPGR95eRu1tqMuavksG1+jTGIYSczJxZKwBQy1ssCUv/RM+qiZiKEHHmufUDGIi7b21i1b4+trMzSjiahyzd3Ze+JveATfhAuLmXg2TLA1WfKxIr0vTlBzZEQxmeuZFWXxXC+SaA+vpmvzXFt7WVsY3sRX5/LQQH7phOTEbdlK66F4YqcQ4hnls2YYP9PRmupqkQWZIny+raG0wDYOyUJQShR7sqX9VcL5bwBP/O1kx45tNL8iBFmVLo4XZ9N5Z8STyj9KYYNeS1zSRB+P2uJc2c36QYKzM1aTQrjV++JETCyOGn0jDh/U+TbYrv7h4yB+K4e40kg8g9teK8/AymuLLHGCt8cGRZvQASPQBwkixobh5R9NDzOEaLcUzWuOXvAQmQq0HawTc5P2sx2yyPaDNNeQMAYhAuwZLFaK9lI24Sg5TSSjZw5putFqECq2BcPil/gsZpapYQHrpsdIILjOqauyeZqnoWy/skGWBMUN8nvOkpFyg6LYPnKpvPWv8g1EFk1Zuw7a5LiNdbXhl09ueLD3cOyf/MdCeRCecYoHi+Xk/g47i9l98SRu6ry4L8+Tec7dBvMLduRVDKgdwKu8x+hKfkx9p5QxVjf7wKHM6V6Hlg9vQYGCWFbGken0cWJKUmtybzi4ayU5A/Asc2JHOeWkvg1tUgcurdJCHH1mxh28a4iv6Hd8R92E2HCykbfM9BgUDBaeh8SXvMTiM6gmuzvUWXq4MlHGvY1BONOqjjV/AJ0uisCMNT4V0bw4tA6hNRFzuIeyiPAdRaTZRVVPkqeT0RcAYV1CzxxMHPK7yILljljrWVvr9ZcyA8nvF9V+ZYoS6W5VX7qXr163OJEJlc8nVZWHSJ3EF5C0SLLJ9bc+lSrdAX5l4podlJdZPhjhiqDhdupFfKYUo/uc2RlLx51HIWZZwVpQ+JfN7KU+mx0DwJJQuV7ZRl8WjWrhSPA+y3BEYeu/GKMjWbM/+7d74OiymYir/vJqyutaeOQ6DyqxZq2jHWg+D73r3xsC6mzqjHkNNhjutF27b4Y8H8CzL7drZgZo6tHQpWB1emBMVytLyW6/03UfMxur1oIQbNITnkdBwv9gjc7rB/rWTD0KfnjWNWO4mup/3XAALfHeDa9PTkN5Z1wixQHSnKoDmNbB+6Fdd3tYMuHaAFf3zmgacm8nwOKRWySDEGkrrhqTaUqaXg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5030a09f-2253-407b-e12a-08da76658f7d X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:19.9856 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9eJL3mB38H+mcenYQ0Ge6hmU7/fU7bvaJpmPvGNuxTm6wcs08oQgBYMvWnreuJmyagV/e6lBtPz2gE2CCbyM4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150631_908551_00BF6836 X-CRM114-Status: GOOD ( 34.88 ) 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 This adds support for the Lynx 10G "SerDes" devices found on various NXP QorIQ SoCs. There may be up to four SerDes devices on each SoC, each supporting up to eight lanes. Protocol support for each SerDes is highly heterogeneous, with each SoC typically having a totally different selection of supported protocols for each lane. Additionally, the SerDes devices on each SoC also have differing support. One SerDes will typically support Ethernet on most lanes, while the other will typically support PCIe on most lanes. There is wide hardware support for this SerDes. It is present on QorIQ T-Series and Layerscape processors. Because each SoC typically has specific instructions and exceptions for its SerDes, I have limited the initial scope of this module to just the LS1046A and LS1088A. Additionally, I have only added support for Ethernet protocols. There is not a great need for dynamic reconfiguration for other protocols (except perhaps for M.2 cards), so support for them may never be added. Nevertheless, I have tried to provide an obvious path for adding support for other SoCs as well as other protocols. SATA just needs support for configuring LNmSSCR0. PCIe may need to configure the equalization registers. It also uses multiple lanes. I have tried to write the driver with multi-lane support in mind, so there should not need to be any large changes. Although there are 6 protocols supported, I have only tested SGMII and XFI. The rest have been implemented as described in the datasheet. Most of these protocols should work "as-is", but 10GBASE-KR will need PCS support for link training. The PLLs are modeled as clocks proper. This lets us take advantage of the existing clock infrastructure. I have not given the same treatment to the per-lane clocks because they need to be programmed in-concert with the rest of the lane settings. One tricky thing is that the VCO (PLL) rate exceeds 2^32 (maxing out at around 5GHz). This will be a problem on 32-bit platforms, since clock rates are stored as unsigned longs. To work around this, the pll clock rate is generally treated in units of kHz. The PLLs are configured rather interestingly. Instead of the usual direct programming of the appropriate divisors, the input and output clock rates are selected directly. Generally, the only restriction is that the input and output must be integer multiples of each other. This suggests some kind of internal look-up table. The datasheets generally list out the supported combinations explicitly, and not all input/output combinations are documented. I'm not sure if this is due to lack of support, or due to an oversight. If this becomes an issue, then some combinations can be blacklisted (or whitelisted). This may also be necessary for other SoCs which have more stringent clock requirements. The general API call list for this PHY is documented under the driver-api docs. I think this is rather standard, except that most drivers configure the mode (protocol) at xlate-time. Unlike some other phys where e.g. PCIe x4 will use 4 separate phys all configured for PCIe, this driver uses one phy configured to use 4 lanes. This is because while the individual lanes may be configured individually, the protocol selection acts on all lanes at once. Additionally, the order which lanes should be configured in is specified by the datasheet. To coordinate this, lanes are reserved in phy_init, and released in phy_exit. This driver was written with reference to the LS1046A reference manual. However, it was informed by reference manuals for all processors with mEMACs, especially the T4240 (which appears to have a "maxed-out" configuration). The earlier P-Series processors appear to be similar, but have a different overall register layout (using "banks" instead of separate SerDes). Perhaps this those use a "5G Lynx SerDes." Signed-off-by: Sean Anderson --- Changes in v4: - Rework all debug statements to remove use of __func__. Additional information has been provided as necessary. - Consider alternative parent rates in round_rate and not in set_rate. Trying to modify out parent's rate in set_rate will deadlock. - Explicitly perform a stop/reset sequence in set_rate. This way we always ensure that the PLL is properly stopped. - Set the power-down bit when disabling the PLL. We can do this now that enable/disable aren't abused during the set rate sequence. - Fix typos in QSGMII_OFFSET and XFI_OFFSET - Rename LNmTECR0_TEQ_TYPE_PRE to LNmTECR0_TEQ_TYPE_POST to better reflect its function (adding post-cursor equalization). - Use of_clk_hw_onecell_get instead of a custom function. - Return struct clks from lynx_clks_init instead of embedding lynx_clk in lynx_priv. - Rework PCCR helper functions; T-series SoCs differ from Layerscape SoCs primarily in the layout and offset of the PCCRs. This will help bring a cleaner abstraction layer. The caps have been removed, since this handles the only current usage. - Convert to use new binding format. As a result of this, we no longer need to have protocols for PCIe or SATA. Additionally, modes now live in lynx_group instead of lynx_priv. - Remove teq from lynx_proto_params, since it can be determined from preq_ratio/postq_ratio. - Fix an early return from lynx_set_mode not releasing serdes->lock. - Rename lynx_priv.conf to .cfg, since I kept mistyping it. Changes in v3: - Rename remaining references to QorIQ SerDes to Lynx 10G - Fix PLL enable sequence by waiting for our reset request to be cleared before continuing. Do the same for the lock, even though it isn't as critical. Because we will delay for 1.5ms on average, use prepare instead of enable so we can sleep. - Document the status of each protocol - Fix offset of several bitfields in RECR0 - Take into account PLLRST_B, SDRST_B, and SDEN when considering whether a PLL is "enabled." - Only power off unused lanes. - Split mode lane mask into first/last lane (like group) - Read modes from device tree - Use caps to determine whether KX/KR are supported - Move modes to lynx_priv - Ensure that the protocol controller is not already in-use when we try to configure a new mode. This should only occur if the device tree is misconfigured (e.g. when QSGMII is selected on two lanes but there is only one QSGMII controller). - Split PLL drivers off into their own file - Add clock for "ext_dly" instead of writing the bit directly (and racing with any clock code). - Use kasprintf instead of open-coding the snprintf dance - Support 1000BASE-KX in lynx_lookup_proto. This still requires PCS support, so nothing is truly "enabled" yet. Changes in v2: - Rename driver to Lynx 10G (etc.) - Fix not clearing group->pll after disabling it - Support 1 and 2 phy-cells - Power off lanes during probe - Clear SGMIIaCR1_PCS_EN during probe - Rename LYNX_PROTO_UNKNOWN to LYNX_PROTO_NONE - Handle 1000BASE-KX in lynx_proto_mode_prep Documentation/driver-api/phy/index.rst | 1 + Documentation/driver-api/phy/lynx_10g.rst | 66 + MAINTAINERS | 6 + drivers/phy/freescale/Kconfig | 19 + drivers/phy/freescale/Makefile | 3 + drivers/phy/freescale/lynx-10g.h | 16 + drivers/phy/freescale/phy-fsl-lynx-10g-clk.c | 501 ++++++++ drivers/phy/freescale/phy-fsl-lynx-10g.c | 1163 ++++++++++++++++++ 8 files changed, 1775 insertions(+) create mode 100644 Documentation/driver-api/phy/lynx_10g.rst create mode 100644 drivers/phy/freescale/lynx-10g.h create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g-clk.c create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/Documentation/driver-api/phy/index.rst b/Documentation/driver-api/phy/index.rst index 69ba1216de72..c9b7a4698dab 100644 --- a/Documentation/driver-api/phy/index.rst +++ b/Documentation/driver-api/phy/index.rst @@ -7,6 +7,7 @@ Generic PHY Framework .. toctree:: phy + lynx_10g samsung-usb2 .. only:: subproject and html diff --git a/Documentation/driver-api/phy/lynx_10g.rst b/Documentation/driver-api/phy/lynx_10g.rst new file mode 100644 index 000000000000..6e85dcd8fd71 --- /dev/null +++ b/Documentation/driver-api/phy/lynx_10g.rst @@ -0,0 +1,66 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=========================== +Lynx 10G Phy (QorIQ SerDes) +=========================== + +Using this phy +-------------- + +The general order of calls should be:: + + [devm_][of_]phy_get() + phy_init() + phy_power_on() + phy_set_mode[_ext]() + ... + phy_power_off() + phy_exit() + [[of_]phy_put()] + +:c:func:`phy_get` just gets (or creates) a new :c:type:`phy` with the lanes +described in the phandle. :c:func:`phy_init` is what actually reserves the +lanes for use. Unlike some other drivers, when the phy is created, there is no +default protocol. :c:func:`phy_set_mode ` must be called in +order to set the protocol. + +Supporting SoCs +--------------- + +Each new SoC needs a :c:type:`struct lynx_conf `, containing the +number of lanes in each device, the endianness of the device, and the helper +functions to use when selecting protocol controllers. For example, the +configuration for the LS1046A is:: + + static const struct lynx_cfg ls1046a_cfg = { + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, + .mode_conflict = lynx_ls_mode_conflict, + .mode_apply = lynx_ls_mode_apply, + .mode_init = lynx_ls_mode_init, + }; + +In addition, you will need to add a device node as documented in +``Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml``. This lets the +driver know which lanes are available to configure. + +Supporting Protocols +-------------------- + +Each protocol is a combination of values which must be programmed into the lane +registers. To add a new protocol, first add it to :c:type:`enum lynx_protocol +`. Add a new entry to `lynx_proto_params`, and populate the +appropriate fields. Modify `lynx_lookup_proto` to map the :c:type:`enum +phy_mode ` to :c:type:`enum lynx_protocol `. Update +the ``mode_conflict``, ``mode_apply``, and ``mode_init`` helpers are updated to +support your protocol. + +You may need to modify :c:func:`lynx_set_mode` in order to support your +protocol. This can happen when you have added members to :c:type:`struct +lynx_proto_params `. It can also happen if you have specific +clocking requirements, or protocol-specific registers to program. + +Internal API Reference +---------------------- + +.. kernel-doc:: drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/MAINTAINERS b/MAINTAINERS index 66738c8330db..085e110da079 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11799,6 +11799,12 @@ S: Maintained W: http://linux-test-project.github.io/ T: git git://github.com/linux-test-project/ltp.git +LYNX 10G SERDES DRIVER +M: Sean Anderson +S: Maintained +F: Documentation/driver-api/phy/lynx_10g.rst +F: drivers/phy/freescale/phy-fsl-lynx-10g.c + LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei L: netdev@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index f9c54cd02036..fe2a3efe0ba4 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -38,3 +38,22 @@ config PHY_FSL_LYNX_28G found on NXP's Layerscape platforms such as LX2160A. Used to change the protocol running on SerDes lanes at runtime. Only useful for a restricted set of Ethernet protocols. + +config PHY_FSL_LYNX_10G + tristate "Freescale Layerscale Lynx 10G SerDes support" + select GENERIC_PHY + select REGMAP_MMIO + help + This adds support for the Lynx "SerDes" devices found on various QorIQ + SoCs. There may be up to four SerDes devices on each SoC, and each + device supports up to eight lanes. The SerDes is configured by default + by the RCW, but this module is necessary in order to support dynamic + reconfiguration (such as to support 1G and 10G ethernet on the same + interface). The hardware supports a variety of protocols, including + Ethernet, SATA, PCIe, and more exotic links such as Interlaken and + Aurora. This driver only supports Ethernet, but it will try not to + touch lanes configured for other protocols. + + If you have a QorIQ processor and want to dynamically reconfigure your + SerDes, say Y. If this driver is compiled as a module, it will be + named phy-fsl-lynx-10g-drv. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index 3518d5dbe8a7..bd54ecef8b48 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -2,4 +2,7 @@ obj-$(CONFIG_PHY_FSL_IMX8MQ_USB) += phy-fsl-imx8mq-usb.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g.o +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g-clk.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += phy-fsl-lynx-10g-drv.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o diff --git a/drivers/phy/freescale/lynx-10g.h b/drivers/phy/freescale/lynx-10g.h new file mode 100644 index 000000000000..75d9353a867b --- /dev/null +++ b/drivers/phy/freescale/lynx-10g.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 Sean Anderson + */ + +#ifndef LYNX_10G +#define LYNX_10G + +struct clk; +struct device; +struct regmap; + +int lynx_clks_init(struct device *dev, struct regmap *regmap, + struct clk *plls[2], struct clk *ex_dlys[2]); + +#endif /* LYNX 10G */ diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c new file mode 100644 index 000000000000..adb5f4d0a4d2 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c @@ -0,0 +1,501 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This file contains the implementation for the PLLs found on Lynx 10G phys. + * + * XXX: The VCO rate of the PLLs can exceed ~4GHz, which is the maximum rate + * expressable in an unsigned long. To work around this, rates are specified in + * kHz. This is as if there was a division by 1000 in the PLL. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#define PLL_STRIDE 0x20 +#define PLLa(a, off) ((a) * PLL_STRIDE + (off)) +#define PLLaRSTCTL(a) PLLa(a, 0x00) +#define PLLaCR0(a) PLLa(a, 0x04) + +#define PLLaRSTCTL_RSTREQ BIT(31) +#define PLLaRSTCTL_RST_DONE BIT(30) +#define PLLaRSTCTL_RST_ERR BIT(29) +#define PLLaRSTCTL_PLLRST_B BIT(7) +#define PLLaRSTCTL_SDRST_B BIT(6) +#define PLLaRSTCTL_SDEN BIT(5) + +#define PLLaRSTCTL_ENABLE_SET (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_PLLRST_B | \ + PLLaRSTCTL_SDRST_B | PLLaRSTCTL_SDEN) +#define PLLaRSTCTL_ENABLE_MASK (PLLaRSTCTL_ENABLE_SET | PLLaRSTCTL_RST_ERR) + +#define PLLaCR0_POFF BIT(31) +#define PLLaCR0_RFCLK_SEL GENMASK(30, 28) +#define PLLaCR0_PLL_LCK BIT(23) +#define PLLaCR0_FRATE_SEL GENMASK(19, 16) +#define PLLaCR0_DLYDIV_SEL GENMASK(1, 0) + +#define PLLaCR0_DLYDIV_SEL_16 0b01 + +/** + * struct lynx_clk - Driver data for the PLLs + * @pll: The PLL clock + * @ex_dly: The "PLLa_ex_dly_clk" clock + * @ref: Our reference clock + * @dev: The serdes device + * @regmap: Our registers + * @idx: Which PLL this clock is for + */ +struct lynx_clk { + struct clk_hw pll, ex_dly; + struct clk_hw *ref; + struct device *dev; + struct regmap *regmap; + unsigned int idx; +}; + +static u32 lynx_read(struct lynx_clk *clk, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(clk->regmap, reg, &ret)); + return ret; +} + +static void lynx_write(struct lynx_clk *clk, u32 val, u32 reg) +{ + WARN_ON_ONCE(regmap_write(clk->regmap, reg, val)); +} + +static struct lynx_clk *lynx_pll_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, pll); +} + +static struct lynx_clk *lynx_ex_dly_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, ex_dly); +} + +static void lynx_pll_stop(struct lynx_clk *clk) +{ + u32 rstctl; + + rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + rstctl &= ~PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + + ndelay(50); + + rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + rstctl &= ~(PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B); + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + + ndelay(100); +} + +static void lynx_pll_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0; + + dev_dbg(clk->dev, "disable pll%d\n", clk->idx); + + lynx_pll_stop(clk); + + cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + cr0 |= PLLaCR0_POFF; + lynx_write(clk, cr0, PLLaCR0(clk->idx)); +} + +static int lynx_pll_reset(struct lynx_clk *clk) +{ + int ret; + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + + rstctl |= PLLaRSTCTL_RSTREQ; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + ret = read_poll_timeout(lynx_read, rstctl, + rstctl & (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_RST_ERR), + 100, 5000, true, clk, PLLaRSTCTL(clk->idx)); + if (rstctl & PLLaRSTCTL_RST_ERR) + ret = -EIO; + if (ret) { + dev_err(clk->dev, "pll%d reset failed\n", clk->idx); + return ret; + } + + rstctl |= PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B | PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + return 0; +} + +static int lynx_pll_prepare(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + /* + * "Enabling" the PLL involves resetting it (and all attached lanes). + * Avoid doing this if we are already enabled. + */ + if (!(cr0 & PLLaCR0_POFF) && + (rstctl & PLLaRSTCTL_ENABLE_MASK) == PLLaRSTCTL_ENABLE_SET) { + dev_dbg(clk->dev, "pll%d already prepared\n", clk->idx); + return 0; + } + + dev_dbg(clk->dev, "prepare pll%d\n", clk->idx); + + cr0 &= ~PLLaCR0_POFF; + lynx_write(clk, cr0, PLLaCR0(clk->idx)); + + return lynx_pll_reset(clk); +} + +static int lynx_pll_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + bool enabled = !(cr0 & PLLaCR0_POFF); + + dev_dbg(clk->dev, "pll%d %s enabled\n", clk->idx, + enabled ? "is" : "is not"); + + return enabled; +} + +static const u32 rfclk_sel_map[8] = { + [0b000] = 100000000, + [0b001] = 125000000, + [0b010] = 156250000, + [0b011] = 150000000, +}; + +/** + * lynx_rfclk_to_sel() - Convert a reference clock rate to a selector + * @rate: The reference clock rate + * + * To allow for some variation in the reference clock rate, up to 100ppm of + * error is allowed. + * + * Return: An appropriate selector for @rate, or -%EINVAL. + */ +static int lynx_rfclk_to_sel(u32 rate) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(rfclk_sel_map); ret++) { + u32 rfclk_rate = rfclk_sel_map[ret]; + /* Allow an error of 100ppm */ + u32 error = rfclk_rate / 10000; + + if (rate > rfclk_rate - error && rate < rfclk_rate + error) + return ret; + } + + return -EINVAL; +} + +static const u32 frate_sel_map[16] = { + [0b0000] = 5000000, + [0b0101] = 3750000, + [0b0110] = 5156250, + [0b0111] = 4000000, + [0b1001] = 3125000, + [0b1010] = 3000000, +}; + +/** + * lynx_frate_to_sel() - Convert a VCO clock rate to a selector + * @rate_khz: The VCO frequency, in kHz + * + * Return: An appropriate selector for @rate_khz, or -%EINVAL. + */ +static int lynx_frate_to_sel(u32 rate_khz) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(frate_sel_map); ret++) + if (frate_sel_map[ret] == rate_khz) + return ret; + + return -EINVAL; +} + +static u32 lynx_pll_ratio(u32 frate_sel, u32 rfclk_sel) +{ + u64 frate; + u32 rfclk, error, ratio; + + frate = frate_sel_map[frate_sel] * (u64)HZ_PER_KHZ; + rfclk = rfclk_sel_map[rfclk_sel]; + + if (!frate || !rfclk) + return 0; + + ratio = div_u64_rem(frate, rfclk, &error); + if (!error) + return ratio; + return 0; +} + +static unsigned long lynx_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + u32 frate_sel = FIELD_GET(PLLaCR0_FRATE_SEL, cr0); + u32 rfclk_sel = FIELD_GET(PLLaCR0_RFCLK_SEL, cr0); + u32 ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + unsigned long ret; + + /* Ensure that the parent matches our rfclk selector */ + if (rfclk_sel == lynx_rfclk_to_sel(parent_rate)) + ret = mult_frac(parent_rate, ratio, HZ_PER_KHZ); + else + ret = 0; + + dev_dbg(clk->dev, "recalc pll%d new=%llu parent=%lu\n", clk->idx, + (u64)ret * HZ_PER_KHZ, parent_rate); + return ret; +} + +static long lynx_pll_round_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long *parent_rate) +{ + int frate_sel, rfclk_sel; + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 ratio; + + dev_dbg(clk->dev, "round pll%d new=%llu parent=%lu\n", clk->idx, + (u64)rate_khz * HZ_PER_KHZ, *parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + /* Try the current parent rate */ + rfclk_sel = lynx_rfclk_to_sel(*parent_rate); + if (rfclk_sel >= 0) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) + return mult_frac(*parent_rate, ratio, HZ_PER_KHZ); + } + + /* Try all possible parent rates */ + for (rfclk_sel = 0; + rfclk_sel < ARRAY_SIZE(rfclk_sel_map); + rfclk_sel++) { + unsigned long new_parent_rate; + + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (!ratio) + continue; + + /* Ensure the reference clock can produce this rate */ + new_parent_rate = rfclk_sel_map[rfclk_sel]; + new_parent_rate = clk_hw_round_rate(clk->ref, new_parent_rate); + if (rfclk_sel != lynx_rfclk_to_sel(new_parent_rate)) + continue; + + *parent_rate = new_parent_rate; + return mult_frac(new_parent_rate, ratio, HZ_PER_KHZ); + } + + return -EINVAL; +} + +static int lynx_pll_set_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long parent_rate) +{ + int frate_sel, rfclk_sel; + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 ratio, cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + dev_dbg(clk->dev, "set rate pll%d new=%llu parent=%lu\n", clk->idx, + (u64)rate_khz * HZ_PER_KHZ, parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + rfclk_sel = lynx_rfclk_to_sel(parent_rate); + if (rfclk_sel < 0) + return rfclk_sel; + + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (!ratio) + return -EINVAL; + + lynx_pll_stop(clk); + cr0 &= ~(PLLaCR0_RFCLK_SEL | PLLaCR0_FRATE_SEL); + cr0 |= FIELD_PREP(PLLaCR0_RFCLK_SEL, rfclk_sel); + cr0 |= FIELD_PREP(PLLaCR0_FRATE_SEL, frate_sel); + lynx_write(clk, cr0, PLLaCR0(clk->idx)); + /* Don't bother resetting if it's off */ + if (cr0 & PLLaCR0_POFF) + return 0; + return lynx_pll_reset(clk); +} + +static const struct clk_ops lynx_pll_clk_ops = { + .prepare = lynx_pll_prepare, + .disable = lynx_pll_disable, + .is_enabled = lynx_pll_is_enabled, + .recalc_rate = lynx_pll_recalc_rate, + .round_rate = lynx_pll_round_rate, + .set_rate = lynx_pll_set_rate, +}; + +static void lynx_ex_dly_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + lynx_write(clk, PLLaCR0(clk->idx), cr0); +} + +static int lynx_ex_dly_enable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + cr0 |= FIELD_PREP(PLLaCR0_DLYDIV_SEL, PLLaCR0_DLYDIV_SEL_16); + lynx_write(clk, PLLaCR0(clk->idx), cr0); + return 0; +} + +static int lynx_ex_dly_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + + return lynx_read(clk, PLLaCR0(clk->idx)) & PLLaCR0_DLYDIV_SEL; +} + +static unsigned long lynx_ex_dly_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + return parent_rate / 16; +} + +static const struct clk_ops lynx_ex_dly_clk_ops = { + .enable = lynx_ex_dly_enable, + .disable = lynx_ex_dly_disable, + .is_enabled = lynx_ex_dly_is_enabled, + .recalc_rate = lynx_ex_dly_recalc_rate, +}; + +static int lynx_clk_init(struct clk_hw_onecell_data *hw_data, + struct device *dev, struct regmap *regmap, + unsigned int index) +{ + const struct clk_hw *pll_parents, *ex_dly_parents; + struct clk_init_data pll_init = { + .ops = &lynx_pll_clk_ops, + .parent_hws = &pll_parents, + .num_parents = 1, + .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT | + CLK_OPS_PARENT_ENABLE, + }; + struct clk_init_data ex_dly_init = { + .ops = &lynx_ex_dly_clk_ops, + .parent_hws = &ex_dly_parents, + .num_parents = 1, + }; + struct clk *ref; + struct lynx_clk *clk; + char *ref_name; + int ret; + + clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + if (!clk) + return -ENOMEM; + + clk->dev = dev; + clk->regmap = regmap; + clk->idx = index; + + ref_name = kasprintf(GFP_KERNEL, "ref%d", index); + pll_init.name = kasprintf(GFP_KERNEL, "%s.pll%d_khz", dev_name(dev), + index); + ex_dly_init.name = kasprintf(GFP_KERNEL, "%s.pll%d_ex_dly_khz", + dev_name(dev), index); + if (!ref_name || !pll_init.name || !ex_dly_init.name) { + ret = -ENOMEM; + goto out; + } + + ref = devm_clk_get(dev, ref_name); + if (IS_ERR(clk->ref)) { + ret = PTR_ERR(clk->ref); + dev_err_probe(dev, ret, "could not get %s\n", ref_name); + goto out; + } + + clk->ref = __clk_get_hw(ref); + pll_parents = clk->ref; + clk->pll.init = &pll_init; + ret = devm_clk_hw_register(dev, &clk->pll); + if (ret) { + dev_err_probe(dev, ret, "could not register %s\n", + pll_init.name); + goto out; + } + + ex_dly_parents = &clk->pll; + clk->ex_dly.init = &ex_dly_init; + ret = devm_clk_hw_register(dev, &clk->ex_dly); + if (ret) + dev_err_probe(dev, ret, "could not register %s\n", + ex_dly_init.name); + + hw_data->hws[LYNX10G_PLLa(index)] = &clk->pll; + hw_data->hws[LYNX10G_PLLa_EX_DLY(index)] = &clk->ex_dly; + +out: + kfree(ref_name); + kfree(pll_init.name); + kfree(ex_dly_init.name); + return ret; +} + +#define NUM_PLLS 2 +#define NUM_CLKS (NUM_PLLS * LYNX10G_CLKS_PER_PLL) + +int lynx_clks_init(struct device *dev, struct regmap *regmap, + struct clk *plls[2], struct clk *ex_dlys[2]) +{ + int ret, i; + struct clk_hw_onecell_data *hw_data; + + hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, NUM_CLKS), + GFP_KERNEL); + if (!hw_data) + return -ENOMEM; + hw_data->num = NUM_CLKS; + + for (i = 0; i < NUM_PLLS; i++) { + ret = lynx_clk_init(hw_data, dev, regmap, i); + if (ret) + return ret; + + plls[i] = hw_data->hws[LYNX10G_PLLa(i)]->clk; + ex_dlys[i] = hw_data->hws[LYNX10G_PLLa_EX_DLY(i)]->clk; + } + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, hw_data); + if (ret) + dev_err_probe(dev, ret, "could not register clock provider\n"); + + return ret; +} diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g.c b/drivers/phy/freescale/phy-fsl-lynx-10g.c new file mode 100644 index 000000000000..5efc87f6bb4b --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c @@ -0,0 +1,1163 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This driver is for the Lynx 10G phys found on many QorIQ devices, including + * the Layerscape series. + */ + +#include +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#define TCALCR 0x90 +#define TCALCR1 0x94 +#define RCALCR 0xa0 +#define RCALCR1 0xa4 + +#define CALCR_CALRST_B BIT(27) + +#define LS_PCCR_BASE 0x200 +#define PCCR_STRIDE 0x4 + +#define LS_PCCRa(a) (LS_PCCR_BASE + (a) * PCCR_STRIDE) + +#define PCCR8_SGMIIa_KX BIT(3) +#define PCCR8_SGMIIa_MASK GENMASK(3, 0) +#define PCCR8_SGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCR9_QSGMIIa_MASK GENMASK(2, 0) +#define PCCR9_QSGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCRB_XFIa_MASK GENMASK(2, 0) +#define PCCRB_XFIa_SHIFT(a) (28 - (a) * 4) + +#define LANE_BASE 0x800 +#define LANE_STRIDE 0x40 +#define LNm(m, off) (LANE_BASE + (m) * LANE_STRIDE + (off)) +#define LNmGCR0(m) LNm(m, 0x00) +#define LNmGCR1(m) LNm(m, 0x04) +#define LNmSSCR0(m) LNm(m, 0x0C) +#define LNmRECR0(m) LNm(m, 0x10) +#define LNmRECR1(m) LNm(m, 0x14) +#define LNmTECR0(m) LNm(m, 0x18) +#define LNmSSCR1(m) LNm(m, 0x1C) +#define LNmTTLCR0(m) LNm(m, 0x20) + +#define LNmGCR0_RPLL_LES BIT(31) +#define LNmGCR0_RRAT_SEL GENMASK(29, 28) +#define LNmGCR0_TPLL_LES BIT(27) +#define LNmGCR0_TRAT_SEL GENMASK(25, 24) +#define LNmGCR0_RRST_B BIT(22) +#define LNmGCR0_TRST_B BIT(21) +#define LNmGCR0_RX_PD BIT(20) +#define LNmGCR0_TX_PD BIT(19) +#define LNmGCR0_IF20BIT_EN BIT(18) +#define LNmGCR0_FIRST_LANE BIT(16) +#define LNmGCR0_TTRM_VM_SEL GENMASK(13, 12) +#define LNmGCR0_PROTS GENMASK(11, 7) + +#define LNmGCR0_RAT_SEL_SAME 0b00 +#define LNmGCR0_RAT_SEL_HALF 0b01 +#define LNmGCR0_RAT_SEL_QUARTER 0b10 +#define LNmGCR0_RAT_SEL_DOUBLE 0b11 + +#define LNmGCR0_PROTS_PCIE 0b00000 +#define LNmGCR0_PROTS_SGMII 0b00001 +#define LNmGCR0_PROTS_SATA 0b00010 +#define LNmGCR0_PROTS_XFI 0b01010 + +#define LNmGCR1_RDAT_INV BIT(31) +#define LNmGCR1_TDAT_INV BIT(30) +#define LNmGCR1_OPAD_CTL BIT(26) +#define LNmGCR1_REIDL_TH GENMASK(22, 20) +#define LNmGCR1_REIDL_EX_SEL GENMASK(19, 18) +#define LNmGCR1_REIDL_ET_SEL GENMASK(17, 16) +#define LNmGCR1_REIDL_EX_MSB BIT(15) +#define LNmGCR1_REIDL_ET_MSB BIT(14) +#define LNmGCR1_REQ_CTL_SNP BIT(13) +#define LNmGCR1_REQ_CDR_SNP BIT(12) +#define LNmGCR1_TRSTDIR BIT(7) +#define LNmGCR1_REQ_BIN_SNP BIT(6) +#define LNmGCR1_ISLEW_RCTL GENMASK(5, 4) +#define LNmGCR1_OSLEW_RCTL GENMASK(1, 0) + +#define LNmRECR0_RXEQ_BST BIT(28) +#define LNmRECR0_GK2OVD GENMASK(27, 24) +#define LNmRECR0_GK3OVD GENMASK(19, 16) +#define LNmRECR0_GK2OVD_EN BIT(15) +#define LNmRECR0_GK3OVD_EN BIT(14) +#define LNmRECR0_OSETOVD_EN BIT(13) +#define LNmRECR0_BASE_WAND GENMASK(11, 10) +#define LNmRECR0_OSETOVD GENMASK(6, 0) + +#define LNmRECR0_BASE_WAND_OFF 0b00 +#define LNmRECR0_BASE_WAND_DEFAULT 0b01 +#define LNmRECR0_BASE_WAND_ALTERNATE 0b10 +#define LNmRECR0_BASE_WAND_OSETOVD 0b11 + +#define LNmTECR0_TEQ_TYPE GENMASK(29, 28) +#define LNmTECR0_SGN_PREQ BIT(26) +#define LNmTECR0_RATIO_PREQ GENMASK(25, 22) +#define LNmTECR0_SGN_POST1Q BIT(21) +#define LNmTECR0_RATIO_PST1Q GENMASK(20, 16) +#define LNmTECR0_ADPT_EQ GENMASK(13, 8) +#define LNmTECR0_AMP_RED GENMASK(5, 0) + +#define LNmTECR0_TEQ_TYPE_NONE 0b00 +#define LNmTECR0_TEQ_TYPE_POST 0b01 +#define LNmTECR0_TEQ_TYPE_BOTH 0b10 + +#define LNmTTLCR0_FLT_SEL GENMASK(29, 24) + +#define LS_SGMII_BASE 0x1800 +#define LS_QSGMII_BASE 0x1880 +#define LS_XFI_BASE 0x1980 + +#define PCS_STRIDE 0x10 +#define CR_STRIDE 0x4 +#define PCSa(a, base, cr) (base + (a) * PCS_STRIDE + (cr) * CR_STRIDE) + +/* https://community.nxp.com/t5/Layerscape/LS1043A-SERDES-PLL-reset-causes-PHY-link-fail/m-p/1375359#M9456 */ +#define PCSaCR0_RST_B BIT(30) +#define PCSaCR1_MDEV_PORT GENMASK(31, 27) + +#define LS_SGMIIaCR1(a) PCSa(a, LS_SGMII_BASE, 1) +#define SGMIIaCR1_SGPCS_EN BIT(11) + +enum lynx_protocol { + LYNX_PROTO_NONE = 0, + LYNX_PROTO_SGMII, + LYNX_PROTO_SGMII25, /* Not tested */ + LYNX_PROTO_1000BASEKX, /* Not tested */ + LYNX_PROTO_QSGMII, /* Not tested */ + LYNX_PROTO_XFI, + LYNX_PROTO_10GKR, /* Link training unimplemented */ + LYNX_PROTO_LAST, +}; + +static const char lynx_proto_str[][16] = { + [LYNX_PROTO_NONE] = "unknown", + [LYNX_PROTO_SGMII] = "SGMII", + [LYNX_PROTO_SGMII25] = "2.5G SGMII", + [LYNX_PROTO_1000BASEKX] = "1000BASE-KX", + [LYNX_PROTO_QSGMII] = "QSGMII", + [LYNX_PROTO_XFI] = "XFI", + [LYNX_PROTO_10GKR] = "10GBASE-KR", +}; + +#define PROTO_MASK(proto) BIT(LYNX_PROTO_##proto) + +/** + * struct lynx_proto_params - Parameters for configuring a protocol + * @frate_khz: The PLL rate, in kHz + * @rat_sel: The divider to get the line rate + * @if20bit: Whether the proto is 20 bits or 10 bits + * @prots: Lane protocol select + * @reidl_th: Receiver electrical idle detection threshold + * @reidl_ex: Exit electrical idle filter + * @reidl_et: Enter idle filter + * @slew: Slew control + * @baseline_wander: Enable baseline wander correction + * @gain: Adaptive equalization gain override + * @offset_override: Adaptive equalization offset override + * @preq_ratio: Ratio of full swing transition bit to pre-cursor + * @postq_ratio: Ratio of full swing transition bit to first post-cursor. + * @adpt_eq: Transmitter Adjustments for 8G/10G + * @amp_red: Overall TX Amplitude Reduction + * @flt_sel: TTL configuration selector + */ +struct lynx_proto_params { + u32 frate_khz; + u8 rat_sel; + u8 prots; + u8 reidl_th; + u8 reidl_ex; + u8 reidl_et; + u8 slew; + u8 gain; + u8 baseline_wander; + u8 offset_override; + u8 preq_ratio; + u8 postq_ratio; + u8 adpt_eq; + u8 amp_red; + u8 flt_sel; + bool if20bit; +}; + +static const struct lynx_proto_params lynx_proto_params[] = { + [LYNX_PROTO_SGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .reidl_th = 0b001, + .reidl_ex = 0b011, + .reidl_et = 0b100, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .adpt_eq = 0b110000, + .amp_red = 0b000110, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_1000BASEKX] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .adpt_eq = 0b110000, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_SGMII25] = { + .frate_khz = 3125000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b10, + .offset_override = 0b0011111, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + }, + [LYNX_PROTO_QSGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = true, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .offset_override = 0b0011111, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + .amp_red = 0b000010, + }, + [LYNX_PROTO_XFI] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .if20bit = true, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .postq_ratio = 0b00011, + .adpt_eq = 0b110000, + .amp_red = 0b000111, + }, + [LYNX_PROTO_10GKR] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .if20bit = true, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .preq_ratio = 0b0011, + .postq_ratio = 0b01100, + .adpt_eq = 0b110000, + }, +}; + +/** + * struct lynx_mode - A single configuration of a protocol controller + * @protos: A bitmask of the &enum lynx_protocol this mode supports + * @pccr: The number of the PCCR which contains this mode + * @idx: The index of the protocol controller. For example, SGMIIB would have + * index 1. + * @cfg: The value to program into the controller to select this mode + * + * The serdes has multiple protocol controllers which can be each be selected + * independently. Depending on their configuration, they may use multiple lanes + * at once (e.g. AUI or PCIe x4). Additionally, multiple protocols may be + * supported by a single mode (XFI and 10GKR differ only in their protocol + * parameters). + */ +struct lynx_mode { + u16 protos; + u8 pccr; + u8 idx; + u8 cfg; +}; + +static_assert(LYNX_PROTO_LAST - 1 <= + sizeof_field(struct lynx_mode, protos) * BITS_PER_BYTE); + +struct lynx_priv; + +/** + * struct lynx_cfg - Configuration for a particular serdes + * @lanes: Number of lanes + * @endian: Endianness of the registers + * @mode_conflict: Determine whether a protocol controller is already in use + * (by another group). + * @mode_apply: Apply a given protocol. This includes programming the + * appropriate config into the PCCR, as well as enabling/disabling + * any other registers (such as the enabling MDIO access). + * %LYNX_PROTO_NONE may be used to clear any associated registers. + * @mode_init: Finish initializing a mode. All fields are filled in except for + * protos. Type is one of PHY_TYPE_*. mode->protos should be filled + * in, and the other fields should be sanity-checked. + */ +struct lynx_cfg { + unsigned int lanes; + enum regmap_endian endian; + bool (*mode_conflict)(struct lynx_priv *serdes, + const struct lynx_mode *mode); + void (*mode_apply)(struct lynx_priv *serdes, + const struct lynx_mode *mode, + enum lynx_protocol proto); + int (*mode_init)(struct lynx_priv *serdes, struct lynx_mode *mode, + int type); +}; + +/** + * struct lynx_priv - Driver data for the serdes + * @lock: A lock protecting "common" registers in @regmap, as well as the + * members of this struct. Lane-specific registers are protected by the + * phy's lock. PLL registers are protected by the clock's lock. + * @dev: The serdes device + * @regmap: The backing regmap + * @cfg: SoC-specific configuration + * @plls: The PLLs + * @ex_dlys: The "ex_dly" clocks + * @used_lanes: Bitmap of the lanes currently used by phys + */ +struct lynx_priv { + struct mutex lock; + struct device *dev; + struct regmap *regmap; + const struct lynx_cfg *cfg; + struct clk *plls[2], *ex_dlys[2]; + unsigned int used_lanes; +}; + +/** + * struct lynx_group - Driver data for a group of lanes + * @serdes: The parent serdes + * @pll: The currently-used pll + * @ex_dly: The ex_dly clock, if used + * @modes: Valid protocol controller configurations + * @mode_count: Number of modes in @modes + * @first_lane: The first lane in the group + * @last_lane: The last lane in the group + * @proto: The currently-configured protocol + */ +struct lynx_group { + struct lynx_priv *serdes; + struct clk *pll, *ex_dly; + const struct lynx_mode *modes; + size_t mode_count; + unsigned int first_lane; + unsigned int last_lane; + enum lynx_protocol proto; +}; + +static u32 lynx_read(struct lynx_priv *serdes, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(serdes->regmap, reg, &ret)); + dev_vdbg(serdes->dev, "%.8x <= %.8x\n", ret, reg); + return ret; +} + +static void lynx_write(struct lynx_priv *serdes, u32 val, u32 reg) +{ + dev_vdbg(serdes->dev, "%.8x => %.8x\n", val, reg); + WARN_ON_ONCE(regmap_write(serdes->regmap, reg, val)); +} + +/** + * lynx_lane_bitmap() - Get a bitmap for a group of lanes + * @group: The group of lanes + * + * Return: A mask containing all bits between @group->first and @group->last + */ +static unsigned int lynx_lane_bitmap(struct lynx_group *group) +{ + if (group->first_lane > group->last_lane) + return GENMASK(group->first_lane, group->last_lane); + else + return GENMASK(group->last_lane, group->first_lane); +} + +static int lynx_init(struct phy *phy) +{ + int ret = 0; + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + unsigned int lane_mask = lynx_lane_bitmap(group); + + mutex_lock(&serdes->lock); + if (serdes->used_lanes & lane_mask) + ret = -EBUSY; + else + serdes->used_lanes |= lane_mask; + mutex_unlock(&serdes->lock); + return ret; +} + +static int lynx_exit(struct phy *phy) +{ + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + + clk_disable_unprepare(group->ex_dly); + group->ex_dly = NULL; + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + mutex_lock(&serdes->lock); + serdes->used_lanes &= ~lynx_lane_bitmap(group); + mutex_unlock(&serdes->lock); + return 0; +} + +/* + * This is tricky. If first_lane=1 and last_lane=0, the condition will see 2, + * 1, 0. But the loop body will see 1, 0. We do this to avoid underflow. We + * can't pull the same trick when incrementing, because then we might have to + * start at -1 if (e.g.) first_lane = 0. + */ +#define for_range(val, start, end) \ + for (val = start < end ? start : start + 1; \ + start < end ? val <= end : val-- > end; \ + start < end ? val++ : 0) +#define for_each_lane(lane, group) \ + for_range(lane, group->first_lane, group->last_lane) +#define for_each_lane_reverse(lane, group) \ + for_range(lane, group->last_lane, group->first_lane) + +static int lynx_power_on(struct phy *phy) +{ + int i; + struct lynx_group *group = phy_get_drvdata(phy); + u32 gcr0; + + for_each_lane(i, group) { + gcr0 = lynx_read(group->serdes, LNmGCR0(i)); + gcr0 &= ~(LNmGCR0_RX_PD | LNmGCR0_TX_PD); + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + + usleep_range(15, 30); + gcr0 |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + } + + return 0; +} + +static void lynx_power_off_group(struct lynx_group *group) +{ + int i; + + for_each_lane_reverse(i, group) { + u32 gcr0 = lynx_read(group->serdes, LNmGCR0(i)); + + gcr0 |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0 &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + } +} + +static int lynx_power_off(struct phy *phy) +{ + lynx_power_off_group(phy_get_drvdata(phy)); + return 0; +} + +/** + * lynx_lookup_proto() - Convert a phy-subsystem mode to a protocol + * @mode: The mode to convert + * @submode: The submode of @mode + * + * Return: A corresponding serdes-specific mode + */ +static enum lynx_protocol lynx_lookup_proto(enum phy_mode mode, int submode) +{ + switch (mode) { + case PHY_MODE_ETHERNET: + switch (submode) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + return LYNX_PROTO_SGMII; + case PHY_INTERFACE_MODE_1000BASEKX: + return LYNX_PROTO_1000BASEKX; + case PHY_INTERFACE_MODE_2500BASEX: + return LYNX_PROTO_SGMII25; + case PHY_INTERFACE_MODE_QSGMII: + return LYNX_PROTO_QSGMII; + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_10GBASER: + return LYNX_PROTO_XFI; + case PHY_INTERFACE_MODE_10GKR: + return LYNX_PROTO_10GKR; + default: + return LYNX_PROTO_NONE; + } + default: + return LYNX_PROTO_NONE; + } +} + +/** + * lynx_lookup_mode() - Get the mode for a group/protocol combination + * @group: The group of lanes to use + * @proto: The protocol to use + * + * Return: An appropriate mode to use, or %NULL if none match. + */ +static const struct lynx_mode *lynx_lookup_mode(struct lynx_group *group, + enum lynx_protocol proto) +{ + int i; + + for (i = 0; i < group->mode_count; i++) { + const struct lynx_mode *mode = &group->modes[i]; + + if (BIT(proto) & mode->protos) + return mode; + } + + return NULL; +} + +static int lynx_validate(struct phy *phy, enum phy_mode phy_mode, int submode, + union phy_configure_opts *opts) +{ + enum lynx_protocol proto; + struct lynx_group *group = phy_get_drvdata(phy); + const struct lynx_mode *mode; + + proto = lynx_lookup_proto(phy_mode, submode); + if (proto == LYNX_PROTO_NONE) + return -EINVAL; + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + mode = lynx_lookup_mode(group, proto); + if (!mode) + return -EINVAL; + + return 0; +} + +#define abs_diff(a, b) ({ \ + typeof(a) _a = (a); \ + typeof(b) _b = (b); \ + _a > _b ? _a - _b : _b - _a; \ +}) + +static int lynx_set_mode(struct phy *phy, enum phy_mode phy_mode, int submode) +{ + enum lynx_protocol proto; + const struct lynx_proto_params *params; + const struct lynx_mode *old_mode = NULL, *new_mode; + int i, pll, ret; + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + u32 tmp, teq; + u32 gcr0 = 0, gcr1 = 0, recr0 = 0, tecr0 = 0; + u32 gcr0_mask = 0, gcr1_mask = 0, recr0_mask = 0, tecr0_mask = 0; + + proto = lynx_lookup_proto(phy_mode, submode); + if (proto == LYNX_PROTO_NONE) { + dev_dbg(&phy->dev, "unknown mode/submode %d/%d\n", + phy_mode, submode); + return -EINVAL; + } + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + new_mode = lynx_lookup_mode(group, proto); + if (!new_mode) { + dev_dbg(&phy->dev, "could not find mode for %s on lanes %u to %u\n", + lynx_proto_str[proto], group->first_lane, + group->last_lane); + return -EINVAL; + } + + if (group->proto != LYNX_PROTO_NONE) { + old_mode = lynx_lookup_mode(group, group->proto); + if (!old_mode) { + dev_err(&phy->dev, "could not find mode for %s\n", + lynx_proto_str[group->proto]); + return -EBUSY; + } + } + + mutex_lock(&serdes->lock); + if (serdes->cfg->mode_conflict(serdes, new_mode)) { + dev_dbg(&phy->dev, "%s%c already in use\n", + lynx_proto_str[__ffs(new_mode->protos)], + 'A' + new_mode->idx); + ret = -EBUSY; + goto out; + } + + clk_disable_unprepare(group->ex_dly); + group->ex_dly = NULL; + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + /* First, try to use a PLL which already has the correct rate */ + params = &lynx_proto_params[proto]; + for (pll = 0; pll < ARRAY_SIZE(serdes->plls); pll++) { + struct clk *clk = serdes->plls[pll]; + unsigned long rate = clk_get_rate(clk); + unsigned long error = abs_diff(rate, params->frate_khz); + + dev_dbg(&phy->dev, "pll%d has rate %lu (error=%lu)\n", pll, + rate, error); + /* Accept up to 100ppm deviation */ + if (error && params->frate_khz / error < 10000) + continue; + + if (!clk_set_rate_exclusive(clk, rate)) + goto got_pll; + /* + * Someone else got a different rate first (or there was some + * other error) + */ + } + + /* If neither PLL has the right rate, try setting it */ + for (pll = 0; pll < 2; pll++) { + ret = clk_set_rate_exclusive(serdes->plls[pll], + params->frate_khz); + if (!ret) + goto got_pll; + } + + dev_dbg(&phy->dev, "could not get a pll at %ukHz\n", + params->frate_khz); + goto out; + +got_pll: + group->pll = serdes->plls[pll]; + ret = clk_prepare_enable(group->pll); + if (ret) + goto out; + + gcr0_mask |= LNmGCR0_RRAT_SEL | LNmGCR0_TRAT_SEL; + gcr0_mask |= LNmGCR0_RPLL_LES | LNmGCR0_TPLL_LES; + gcr0_mask |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + gcr0_mask |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0_mask |= LNmGCR0_IF20BIT_EN | LNmGCR0_PROTS; + gcr0 |= FIELD_PREP(LNmGCR0_RPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_TPLL_LES, !pll); + gcr0 |= FIELD_PREP(LNmGCR0_RRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_TRAT_SEL, params->rat_sel); + gcr0 |= FIELD_PREP(LNmGCR0_IF20BIT_EN, params->if20bit); + gcr0 |= FIELD_PREP(LNmGCR0_PROTS, params->prots); + + gcr1_mask |= LNmGCR1_RDAT_INV | LNmGCR1_TDAT_INV; + gcr1_mask |= LNmGCR1_OPAD_CTL | LNmGCR1_REIDL_TH; + gcr1_mask |= LNmGCR1_REIDL_EX_SEL | LNmGCR1_REIDL_ET_SEL; + gcr1_mask |= LNmGCR1_REIDL_EX_MSB | LNmGCR1_REIDL_ET_MSB; + gcr1_mask |= LNmGCR1_REQ_CTL_SNP | LNmGCR1_REQ_CDR_SNP; + gcr1_mask |= LNmGCR1_TRSTDIR | LNmGCR1_REQ_BIN_SNP; + gcr1_mask |= LNmGCR1_ISLEW_RCTL | LNmGCR1_OSLEW_RCTL; + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_TH, params->reidl_th); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_SEL, params->reidl_ex & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_SEL, params->reidl_et & 3); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_EX_MSB, params->reidl_ex >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_REIDL_ET_MSB, params->reidl_et >> 2); + gcr1 |= FIELD_PREP(LNmGCR1_TRSTDIR, + group->first_lane > group->last_lane); + gcr1 |= FIELD_PREP(LNmGCR1_ISLEW_RCTL, params->slew); + gcr1 |= FIELD_PREP(LNmGCR1_OSLEW_RCTL, params->slew); + + recr0_mask |= LNmRECR0_RXEQ_BST | LNmRECR0_BASE_WAND; + recr0_mask |= LNmRECR0_GK2OVD | LNmRECR0_GK3OVD; + recr0_mask |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + recr0_mask |= LNmRECR0_OSETOVD_EN | LNmRECR0_OSETOVD; + if (params->gain) { + recr0 |= FIELD_PREP(LNmRECR0_GK2OVD, params->gain); + recr0 |= FIELD_PREP(LNmRECR0_GK3OVD, params->gain); + recr0 |= LNmRECR0_GK2OVD_EN | LNmRECR0_GK3OVD_EN; + } + recr0 |= FIELD_PREP(LNmRECR0_BASE_WAND, params->baseline_wander); + recr0 |= FIELD_PREP(LNmRECR0_OSETOVD, params->offset_override); + + tecr0_mask |= LNmTECR0_TEQ_TYPE; + tecr0_mask |= LNmTECR0_SGN_PREQ | LNmTECR0_RATIO_PREQ; + tecr0_mask |= LNmTECR0_SGN_POST1Q | LNmTECR0_RATIO_PST1Q; + tecr0_mask |= LNmTECR0_ADPT_EQ | LNmTECR0_AMP_RED; + teq = LNmTECR0_TEQ_TYPE_NONE; + if (params->postq_ratio) { + teq = LNmTECR0_TEQ_TYPE_POST; + tecr0 |= FIELD_PREP(LNmTECR0_SGN_POST1Q, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PST1Q, params->postq_ratio); + } + if (params->preq_ratio) { + teq = LNmTECR0_TEQ_TYPE_BOTH; + tecr0 |= FIELD_PREP(LNmTECR0_SGN_PREQ, 1); + tecr0 |= FIELD_PREP(LNmTECR0_RATIO_PREQ, params->preq_ratio); + } + tecr0 |= FIELD_PREP(LNmTECR0_TEQ_TYPE, teq); + tecr0 |= FIELD_PREP(LNmTECR0_ADPT_EQ, params->adpt_eq); + tecr0 |= FIELD_PREP(LNmTECR0_AMP_RED, params->amp_red); + + for_each_lane(i, group) { + tmp = lynx_read(serdes, LNmGCR0(i)); + tmp &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + lynx_write(serdes, tmp, LNmGCR0(i)); + } + + ndelay(50); + + /* Disable the old controller */ + if (old_mode) + serdes->cfg->mode_apply(serdes, old_mode, LYNX_PROTO_NONE); + + for_each_lane(i, group) { + tmp = lynx_read(serdes, LNmGCR0(i)); + tmp &= ~gcr0_mask; + tmp |= gcr0; + tmp |= FIELD_PREP(LNmGCR0_FIRST_LANE, i == group->first_lane); + lynx_write(serdes, tmp, LNmGCR0(i)); + + tmp = lynx_read(serdes, LNmGCR1(i)); + tmp &= ~gcr1_mask; + tmp |= gcr1; + lynx_write(serdes, tmp, LNmGCR1(i)); + + tmp = lynx_read(serdes, LNmRECR0(i)); + tmp &= ~recr0_mask; + tmp |= recr0; + lynx_write(serdes, tmp, LNmRECR0(i)); + + tmp = lynx_read(serdes, LNmTECR0(i)); + tmp &= ~tecr0_mask; + tmp |= tecr0; + lynx_write(serdes, tmp, LNmTECR0(i)); + + tmp = lynx_read(serdes, LNmTTLCR0(i)); + tmp &= ~LNmTTLCR0_FLT_SEL; + tmp |= FIELD_PREP(LNmTTLCR0_FLT_SEL, params->flt_sel); + lynx_write(serdes, tmp, LNmTTLCR0(i)); + } + + ndelay(120); + + for_each_lane_reverse(i, group) { + tmp = lynx_read(serdes, LNmGCR0(i)); + tmp |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + lynx_write(serdes, tmp, LNmGCR0(i)); + } + + /* Enable the new controller */ + serdes->cfg->mode_apply(serdes, new_mode, proto); + if (proto == LYNX_PROTO_1000BASEKX) { + group->ex_dly = serdes->ex_dlys[pll]; + /* This should never fail since it's from our internal driver */ + WARN_ON_ONCE(clk_prepare_enable(group->ex_dly)); + } + group->proto = proto; + + dev_dbg(&phy->dev, "set mode to %s on lanes %u to %u\n", + lynx_proto_str[proto], group->first_lane, group->last_lane); + +out: + mutex_unlock(&serdes->lock); + return ret; +} + +static const struct phy_ops lynx_phy_ops = { + .init = lynx_init, + .exit = lynx_exit, + .power_on = lynx_power_on, + .power_off = lynx_power_off, + .set_mode = lynx_set_mode, + .validate = lynx_validate, + .owner = THIS_MODULE, +}; + +static int lynx_read_u32(struct device *dev, struct fwnode_handle *fwnode, + const char *prop, u32 *val) +{ + int ret; + + ret = fwnode_property_read_u32(fwnode, prop, val); + if (ret) + dev_err(dev, "could not read %s from %pfwP: %d\n", prop, + fwnode, ret); + return ret; +} + +static int lynx_probe_group(struct lynx_priv *serdes, + struct fwnode_handle *fwnode) +{ + int i, lane_count, ret; + struct device *dev = serdes->dev; + struct fwnode_handle *mode_node; + struct lynx_group *group; + struct lynx_mode *modes; + struct phy *phy; + u32 *lanes = NULL; + + group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL); + if (!group) + return -ENOMEM; + group->serdes = serdes; + + lane_count = fwnode_property_count_u32(fwnode, "reg"); + if (lane_count < 0) { + dev_err(dev, "could not read %s from %pfwP: %d\n", + "reg", fwnode, ret); + return lane_count; + } + + lanes = kcalloc(lane_count, sizeof(*lanes), GFP_KERNEL); + if (!lanes) + return -ENOMEM; + + ret = fwnode_property_read_u32_array(fwnode, "reg", lanes, lane_count); + if (ret) { + dev_err(dev, "could not read %s from %pfwP: %d\n", + "reg", fwnode, ret); + goto out; + } + + group->first_lane = lanes[0]; + group->last_lane = lanes[lane_count - 1]; + for (i = 0; i < lane_count; i++) { + if (lanes[i] > serdes->cfg->lanes) { + ret = -EINVAL; + dev_err(dev, "lane %d not in range 0 to %u\n", + i, serdes->cfg->lanes); + goto out; + } + + if (lanes[i] != group->first_lane + + i * !!(group->last_lane - group->first_lane)) { + ret = -EINVAL; + dev_err(dev, "lane %d is not monotonic\n", i); + goto out; + } + } + + fwnode_for_each_child_node(fwnode, mode_node) + group->mode_count++; + + modes = devm_kcalloc(dev, group->mode_count, sizeof(*group->modes), + GFP_KERNEL); + if (!modes) { + ret = -ENOMEM; + goto out; + } + + i = 0; + fwnode_for_each_child_node(fwnode, mode_node) { + struct lynx_mode *mode = &modes[i++]; + u32 val; + + ret = lynx_read_u32(dev, mode_node, "fsl,pccr", &val); + if (ret) + goto out; + mode->pccr = val; + + ret = lynx_read_u32(dev, mode_node, "fsl,index", &val); + if (ret) + goto out; + mode->idx = val; + + ret = lynx_read_u32(dev, mode_node, "fsl,cfg", &val); + if (ret) + goto out; + mode->cfg = val; + + ret = lynx_read_u32(dev, mode_node, "fsl,type", &val); + if (ret) + goto out; + + ret = serdes->cfg->mode_init(serdes, mode, val); + if (ret) + goto out; + + dev_dbg(dev, "mode PCCR%X.%s%c_CFG=%x on lanes %u to %u\n", + mode->pccr, lynx_proto_str[__ffs(mode->protos)], + 'A' + mode->idx, mode->cfg, group->first_lane, + group->last_lane); + } + + WARN_ON(i != group->mode_count); + group->modes = modes; + + /* Deselect anything configured by the RCW/bootloader */ + for (i = 0; i < group->mode_count; i++) + serdes->cfg->mode_apply(serdes, &group->modes[i], + LYNX_PROTO_NONE); + + /* Disable the lanes for now */ + lynx_power_off_group(group); + + phy = devm_phy_create(dev, to_of_node(fwnode), &lynx_phy_ops); + ret = PTR_ERR_OR_ZERO(phy); + if (ret) + dev_err_probe(dev, ret, "could not create phy\n"); + else + phy_set_drvdata(phy, group); + +out: + kfree(lanes); + return ret; +} + +static int lynx_probe(struct platform_device *pdev) +{ + int ret; + struct device *dev = &pdev->dev; + struct fwnode_handle *group_node; + struct lynx_priv *serdes; + struct phy_provider *provider; + struct regmap_config regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .disable_locking = true, + }; + struct resource *res; + void __iomem *base; + + serdes = devm_kzalloc(dev, sizeof(*serdes), GFP_KERNEL); + if (!serdes) + return -ENOMEM; + + serdes->dev = dev; + platform_set_drvdata(pdev, serdes); + mutex_init(&serdes->lock); + serdes->cfg = device_get_match_data(dev); + + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + dev_err_probe(dev, ret, "could not get/map registers\n"); + return ret; + } + + regmap_config.val_format_endian = serdes->cfg->endian; + regmap_config.max_register = res->end - res->start; + serdes->regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(serdes->regmap)) { + ret = PTR_ERR(serdes->regmap); + dev_err_probe(dev, ret, "could not create regmap\n"); + return ret; + } + + ret = lynx_clks_init(dev, serdes->regmap, serdes->plls, + serdes->ex_dlys); + if (ret) + return ret; + + device_for_each_child_node(dev, group_node) { + ret = lynx_probe_group(serdes, group_node); + if (ret) + return ret; + } + + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + ret = PTR_ERR_OR_ZERO(provider); + if (ret) + dev_err_probe(dev, ret, "could not register phy provider\n"); + else + dev_info(dev, "probed with %d lanes\n", serdes->cfg->lanes); + return ret; +} + +/* + * These are common helpers for the PCCRs found on (most) Layerscape SoCs. + * There is an earlier layout used on most T-series SoCs, as well as the + * LS1020A/21A/22A. + */ + +static int lynx_ls_pccr_params(const struct lynx_mode *mode, u32 *off, + u32 *shift, u32 *mask) +{ + if (mode->protos & PROTO_MASK(SGMII)) { + *off = LS_PCCRa(0x8); + *mask = PCCR8_SGMIIa_MASK; + *shift = PCCR8_SGMIIa_SHIFT(mode->idx); + } else if (mode->protos & PROTO_MASK(QSGMII)) { + *off = LS_PCCRa(0x9); + *mask = PCCR9_QSGMIIa_MASK; + *shift = PCCR9_QSGMIIa_SHIFT(mode->idx); + } else if (mode->protos & PROTO_MASK(XFI)) { + *off = LS_PCCRa(0xB); + *mask = PCCRB_XFIa_MASK; + *shift = PCCRB_XFIa_SHIFT(mode->idx); + } else { + return -EINVAL; + } + + return 0; +} + +static bool lynx_ls_mode_conflict(struct lynx_priv *serdes, + const struct lynx_mode *mode) +{ + u32 off, shift, mask; + + if (WARN_ON_ONCE(lynx_ls_pccr_params(mode, &off, &shift, &mask))) + return true; + + return (lynx_read(serdes, off) >> shift) & mask; +} + +static void lynx_ls_mode_apply(struct lynx_priv *serdes, + const struct lynx_mode *mode, + enum lynx_protocol proto) +{ + u32 base, pccr, off, shift, mask; + + if (WARN_ON_ONCE(proto != LYNX_PROTO_NONE && + !(mode->protos & BIT(proto)))) + return; + if (WARN_ON_ONCE(lynx_ls_pccr_params(mode, &off, &shift, &mask))) + return; + + dev_dbg(serdes->dev, "applying %s to PCCR%X.%s%c_CFG\n", + lynx_proto_str[proto], mode->pccr, + lynx_proto_str[__ffs(mode->protos)], 'A' + mode->idx); + + base = 0; + if (mode->protos & PROTO_MASK(SGMII)) + base = LS_SGMII_BASE; + else if (mode->protos & PROTO_MASK(QSGMII)) + base = LS_QSGMII_BASE; + else if (mode->protos & PROTO_MASK(XFI)) + base = LS_XFI_BASE; + + if (base && proto == LYNX_PROTO_NONE) { + u32 cr0 = lynx_read(serdes, PCSa(mode->idx, base, 0)); + + cr0 |= PCSaCR0_RST_B; + lynx_write(serdes, cr0, PCSa(mode->idx, base, 0)); + } + + pccr = lynx_read(serdes, off); + pccr &= ~(mask << shift); + if (proto != LYNX_PROTO_NONE) + pccr |= mode->cfg << shift; + + if (proto == LYNX_PROTO_1000BASEKX) + pccr |= PCCR8_SGMIIa_KX << shift; + lynx_write(serdes, pccr, off); + + if (base && proto != LYNX_PROTO_NONE) { + u32 cr0 = lynx_read(serdes, PCSa(mode->idx, base, 0)); + + cr0 &= ~PCSaCR0_RST_B; + lynx_write(serdes, cr0, PCSa(mode->idx, base, 0)); + } + + if (mode->protos & PROTO_MASK(SGMII)) { + u32 cr1 = lynx_read(serdes, LS_SGMIIaCR1(mode->idx)); + + cr1 &= ~SGMIIaCR1_SGPCS_EN; + cr1 |= proto == LYNX_PROTO_NONE ? 0 : SGMIIaCR1_SGPCS_EN; + lynx_write(serdes, cr1, LS_SGMIIaCR1(mode->idx)); + } +} + +static int lynx_ls_mode_init(struct lynx_priv *serdes, struct lynx_mode *mode, + int type) +{ + u32 max = 0, off, shift, mask; + + if (mode->pccr >= 0x10) { + dev_err(serdes->dev, "PCCR index %u too large\n", mode->pccr); + return -EINVAL; + } + + switch (type) { + case PHY_TYPE_2500BASEX: + mode->protos = PROTO_MASK(SGMII25); + fallthrough; + case PHY_TYPE_SGMII: + max = 8; + mode->protos |= PROTO_MASK(SGMII) | PROTO_MASK(1000BASEKX); + break; + case PHY_TYPE_QSGMII: + max = 4; + mode->protos = PROTO_MASK(QSGMII); + break; + case PHY_TYPE_10GBASER: + max = 8; + mode->protos = PROTO_MASK(XFI) | PROTO_MASK(10GKR); + break; + default: + dev_err(serdes->dev, "unknown mode type %d\n", type); + return -EINVAL; + } + + if (mode->idx >= max) { + dev_err(serdes->dev, "%s index %u too large\n", + lynx_proto_str[__ffs(mode->protos)], mode->idx); + return -EINVAL; + } + + if (WARN_ON_ONCE(lynx_ls_pccr_params(mode, &off, &shift, &mask))) + return -EINVAL; + + if (!mode->cfg || mode->cfg & ~mask) { + dev_err(serdes->dev, "bad value %x for %s%c_CFG\n", + mode->cfg, lynx_proto_str[__ffs(mode->protos)], + 'A' + mode->idx); + return -EINVAL; + } + + return 0; +} + +static const struct lynx_cfg ls1046a_cfg = { + .lanes = 4, + .endian = REGMAP_ENDIAN_BIG, + .mode_conflict = lynx_ls_mode_conflict, + .mode_apply = lynx_ls_mode_apply, + .mode_init = lynx_ls_mode_init, +}; + +static const struct lynx_cfg ls1088a_cfg = { + .lanes = 4, + .endian = REGMAP_ENDIAN_LITTLE, + .mode_conflict = lynx_ls_mode_conflict, + .mode_apply = lynx_ls_mode_apply, + .mode_init = lynx_ls_mode_init, +}; + +static const struct of_device_id lynx_of_match[] = { + { .compatible = "fsl,ls1046a-serdes", .data = &ls1046a_cfg }, + { .compatible = "fsl,ls1088a-serdes", .data = &ls1088a_cfg }, + { }, +}; +MODULE_DEVICE_TABLE(of, lynx_of_match); + +static struct platform_driver lynx_driver = { + .probe = lynx_probe, + .driver = { + .name = "lynx_10g", + .of_match_table = lynx_of_match, + }, +}; +module_platform_driver(lynx_driver); + +MODULE_AUTHOR("Sean Anderson "); +MODULE_DESCRIPTION("Lynx 10G SerDes driver"); +MODULE_LICENSE("GPL"); From patchwork Thu Aug 4 22:05:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6F66C25B06 for ; Thu, 4 Aug 2022 22:08:09 +0000 (UTC) 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=VgI3QN+irpNSWCzg69xacswPajBzYeco8lMJu3KeGM4=; b=vLBN2UcW0zCEVL UALf+IqzCLgx4dOMgzUgQU+WuASzi8v2270hNpd6pubSwQVICmfyJF0Et16cY5JnCOXdzR8eEtlve 0ZE++VPs/BYQcgZEf3B5YMDhpGb9iuR+I6J/TNru8tqOmejbPHp7SS5TvLEQ2lIT+jr2zHU+/WtKy MjbZ+7pPkEbF4Dlz9GnvqqCIFPFyIc22ZzDxjH/vjWBG5KLkcONV4ofBNdmr8FC/b87OEAaap9ybr XbHaq1MgbwisgWCWfbp8VxoBs1siXFNXunUhU2jZ33OIMzsCovRJ3rxcpIrJjHWZGtWx3RaElmPtA 1gATyo9UWoloMT5n32uA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJj0j-009RL6-7M; Thu, 04 Aug 2022 22:08:09 +0000 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizA-009QTi-7W; Thu, 04 Aug 2022 22:06:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKEN8Rdp9cQGFF4HTgTG3ede0OZX+Qn0FT4juVnr0tjEk4WnHIbQstHQp3JFF/NwhUrsvCStO4JEdRz2kd9JxozuWe7agcQai3A03vaGXJzZda18WvbEXxI3alwwxZFaZ4GpEWhDSsS5htSkW2k3ZRInIy6eQkqAhdNJIRp+fGa227wBcLiYf4izrA6GVylWI7bs87NZBrTEn5X2OvD2AYo6YjGrOZeQ8f8DPBWBpV1WdQe+FWTBz0zT16kGSGI+onJU7fYsU91grHZ97IYfVGPGaQCb8Z1fqpQRC/DOIt89YYPXwX8/TO3zilgaYT/imcqDNttURkaMghhuBFmVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ygdPPJqjVp7YWfMMWCkU3Y9BwS2dFd01o+BP+n2pPAI=; b=UrLi43/sDdei/ugjIfR093bHVpmSX12SlZv0MqsDFFVWpRfhExzOYmMEdyJaGSGiRj+zjPpWaONUVJDJtrUuyT0R0jeIEQlVCV34D8d44zjnjE4TATv04VUhA74CI9BPTSwe3ObGnbpq3juBrcgJrZ9SAvcOaKn3j2dp1Vq64jRYN+sqwrQyaDXovyYEViITfg/Nwr+RCvuVosqOkzbcgOV/5Y3iDursSZIhWR7obdAGCaQESXA1ijjAJ2weqphRqvcxJNSCwkRoSA2IW8SuUAgpWA62pUCBabyuG+DHit1BpzOxHDCU+Xe9IBBLzLbt2AYdoYl+uv8/Tjl+8kKYaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ygdPPJqjVp7YWfMMWCkU3Y9BwS2dFd01o+BP+n2pPAI=; b=YZJTHhs9KgykRcdiDNqhaLrWfT0YA06cgQPilVA19u0W0aFZc5HWCIZII4duXjHWCAUqTtGYsALDwBn2eCn4vrh8V5FUyOgEwo5yTYlpcHQIajGIoiQoDztdzLwaQyP08rFqHu+zv5lxz2kyFX5By/6xd2j33NXWKdJlSvF51yApBFr3XLAB4OEiluO0Wl4K7UppCddiYiKSkglD/16SxJ102b1qPthyBBoOOegnaLnorJCJ6i6jMEEzyEiKpZqSVwLsOa9BI5lU7y58nEL4sJZK+L5PXyIFF4MomOcXT6UTV9hXBgY7HtKYF46qaVJJagG32cmxLaIiU2VCJa9xpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:22 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:22 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v4 5/8] arm64: dts: ls1046a: Add serdes bindings Date: Thu, 4 Aug 2022 18:05:59 -0400 Message-Id: <20220804220602.477589-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d20de826-ffc2-416a-923c-08da766590b8 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s/xiuEPmZPmd8bUiER4i/71DMXWgrnimCS9Vm1n2ujaoHY+VGMSdsffxKUqusptnjt0DX50qbihSlwga/zjIauR/1xSaxPoAUw+Gsme4KviHIRpkR6NaQdHJb5rnkj+IepQj2Fdfy3Y6NZbXj6Dtfmwbr/WFX3JfOxOkuYV1YIZHcm3nNDNutZLamIHeaAffYr6q37nx1ZJ5FgD7m4TM12lYYKlomwWlka+3L/UusGrWZBHSXfLMAATLdZnnMhT9CIjqSZj5DspOoGIZ41TsxT0uahWxJWno3lVUqXYnUaKiaMm1zboEtlpq9fzFVUJlN89Qg5DSjJLwk6h2SgZiJyuKKsXTn2tyRKQXN8IkCDfveI1RpzoCURTpH2qzUOBtXvj1ct1NHpQPMFhFZZVCWaDFDlKfv9mOJBujF9fTBuzxK/tEi2mzxFIjlr7ulRELRyFy0V0bmK1H/NbYN5J4eogqD323FMzVCkmmLGp1HEIHlumrN4/bwcVIyU6GGPe7jKNWWrWLC1B4EgJ7y994gzgLz4cWBmoRCYSqPArYhAbkqbElSuUdjreuS7cpLTHI4P5KuWM9FvH8F9OuiGtsE1+rb1mZlDd9yp8afwGfRd7XDuidmDiOTVpGoXwG3p1/S1uXSL/mxyu1U/wYbck2NH8O7l/eWkEV0+3gK9wCus1SYtmvcwPPeHRV1JHs1wdTOc7TcpnZalZ/igBOkqYIDuxr8/fh8dQILva8syFzyydruJX79rBjcTL8Xzhpzw4nNczI3Xqa3ZVBkim15cTU34ZV+KRptdtC5Ag4CBcIwLI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ui1zZpfD6Up2xGkAix4F1DWFzDjd16TdbEk0TLQH8NYKOnlFRwkKdSAA+Bguznaj84kUzG57vSS9x+4MnyDwLeXqQQHVU2mgA1FL2gkYfuorf7mMi7LK2snrJzMEHg9SsMafRNNhVnQHXgG5/ejrkm3dKjbGVUlY4oHb5eEeSVuYD1J7XWyL2p2kB/gujkgcfTuYHvKRTbopoXHmjwlq2lhhpce2ijr1+Ui+TKBsMynhahsN3PMU3+xeNcqM1ZvcaHKG0M+LpiioLW6Zl2DTZy4+jQdEq5btAmCC6Ik9GST7ukouXfZSE5aWQ9R14z11GGoOmUhVMAovOKcCqYmMyi+vL0tufHAf9/zsWDcUBn++Iqdr7u0cjBigbmBk7K/yfD8MKHVxmehFcQ5dGx4Rjct2vwkAiUhyRap2XS00OaImEufQw67zfm6vDjxkipG1dcnW5Z4VaQ6Vsv8J5Nist3yBo2H5eLTWxO3jFSTFlWEpiVNkVkDcJ0/UuKlm9QBnD/quHXktKWApe/8GPq53k44wLDkKugeKcVLuVsPYCtwtdTQtLq23PR1eNos/9VV34/nu4U8YMUWwfqv/uyQ+1qOOqQ+OQOoVrPtcz7GmI3qswCaMGslNZqTbUkkSN4iX2idltKqN+lS8yQqU1M59CKAOkvSoSqDwmemxI7YOwVWvHvbO/DT2Z66CBGW8A0Uku6wxu9XQvj7YDe2y8uzD44PI9fzbimkH82bDsz9QlOcvjcJxn42bsAdWD/Qxy6jO6cHgPkcky9NELYzoY5qxf/C0odmnj72wcV9dSwB4A959C6E9mm692ocP/QoDfUZnD9vRG52+n++p9QRg6x8irwpPYRQxK1P6iTF/OORPA1c0h5vcuH6QnRI0TSUuIo16y/7sghlYHVcoDE5l/5zScbqoMUQCco4D+HFGBnQvkL5HAByCkx1b0HWYQopQ2f+1xV/9rQdsSN/BqUcrk88JbT7TuizAl3Hz+SUlAjYe8M1P5OaEHLwDwwEdspouy57RCVF8lOLyqOWvzkT13a7xH/xutyABpIvqNS1C6smmrpnV8d0VAwEHgIaLBX8F9n3SbB7Jv0WoZ+MFYEZRE1ulkmoyuwR8q6L/DthDT55ucY6IXX812MnVNxYULKDmETNz6pyX95scb1UxttVvbFfMB3nq0vtB3zvMQy0rQVZW9Vg/SJDng5MctRX7wvqdzulCH60L1ouwykln0wLVQZUiXPUjJZMhGleNNK/vc2jbs3ooe2uSfc8fVEJ3uT10CsK8V0tX6pXwhjmtxT5MfUYTzoAYM9g37YDKjIr2TH2W6lCG2rqUIxHVgd1+6LQ5EsiFyVFlRcvoYuhdaiaorPj4sB5J6CLoPGPq6TBhKDxpWedqyaw8bSB4gZymr3snRmEsnLNueI1Qu0ztczSq02x4LV6pb2ru5vtdWJ4yR1HoXkLEtJ8q+Fj9+KdvRg8FhjqLXPHWsaaHEGEeVQmUQVLXEdZcmQ/f0Tz3fHDTwj7zXRPEvgyHyXSYEZyj2U4ikZ2D7pFJjqm7q/CaxqcZdDnlCXcgY50L+fmvDtjSH1h29iAuqaBol8XFeqEXra0v3RYqGDStcIC1V4U17Vinpsqmig== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d20de826-ffc2-416a-923c-08da766590b8 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:22.0792 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RC0SNify/YH+BhmECVicKaAQf7u/BNX/C2qJihgFU0raWhS3+F7Lzup+c+9n12TVtcp6HnSnw5lsGw6rteb5WQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150632_354071_F68752B1 X-CRM114-Status: UNSURE ( 8.51 ) X-CRM114-Notice: Please train this message. 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 This adds bindings for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- Changes in v4: - Convert to new bindings Changes in v3: - Describe modes in device tree Changes in v2: - Use one phy cell for SerDes1, since no lanes can be grouped - Disable SerDes by default to prevent breaking boards inadvertently. arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 0085e83adf65..d6e7b378e128 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -413,6 +413,24 @@ bportals: bman-portals@508000000 { ranges = <0x0 0x5 0x08000000 0x8000000>; }; + serdes1: serdes@1ea0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + }; + + serdes2: serdes@1eb0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Thu Aug 4 22:06:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A83FC25B06 for ; Thu, 4 Aug 2022 22:08:49 +0000 (UTC) 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=WW3Doif5dDrJwpPfJ/eBK8FFZkRnGIsXUs53jiMSMwU=; b=QGImvqIuWzcBzN 4Bve6QrlaU+LWeFYCh45kuMDE9+qQL9vEw9L080qBiBtqgrL3pve3FR0SyWHcVGaiAXF33fOK39U1 2x6ivmpz95KifepQe5IrnPfMEjLrgFSIYdkZ1jjoifQAWyAh0Ykm3NcmF3zQ6UIvO7eOK4+KW0oIJ OQEp6hMYYOjBVh3QFFXCBB+1c0DJs3h1Q64mp1d8PP0XjAKWt9P0afucgthqAW7bCv7F3Bjj1pu8g 8yQjbXvekajbskXF+dY+f1YnG5yw8BCQxVhOTZk6wb+SqhPMIsYfzvRVCwfn4WNdJWnlnudZp+qaJ YHI/4k7OeJ0bEPuKJgRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJj1M-009Rdg-A2; Thu, 04 Aug 2022 22:08:48 +0000 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizC-009QTi-Jh; Thu, 04 Aug 2022 22:06:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtQCz5v32/edesvksbQEfylD1cJ/Dbsf8f6pYdkECh1iSmet9/tKVkRQFHLcMm3Y8Ii14C91G2t4KWJZZki8jo0AWVxFulQTx1F1g0Ex/3AiDfasHJSAc2czicRyKTPiyqYHlMFGb398wFewdBe/ybBPb4l59NV1qLTW3EyZERozBdvsG/FFgAWT24GHJMnHpPX4SHTzCRqttxMqWwBI9jxAAcgeQcQ7SeSnWE6vesGE0HtNA7DmYLA0/1UF7GjM/wPtnZbUJgk1WtEyGVOI6AvrGY08gqJeo7azztFK5iBS6R1TmI4BXlp5+fQkvHDLay/VqdX7zmIy0a9sqbV92w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jeDeT2WqBjVc1/CaxSnllBIO0s7ckUr2vLbji3tgKbg=; b=Zcy1UHFKWrkpFGooTYnCJg6md7n4b0Cr8jgg9NaDWUs0JjcO5dRgI455aKdgq/WBrOB0Fx39gjajMKPpwFQYOs9Up1dPa1qUQRLMRJ8EqsgudW19w06re9eoRz4pEzj2DRWwUSsEg5oyhw9ccZj1+rKrpCYkWYI0x6A2Iz3QuiiXRmFh/pyZXEr067CL+/shTfOarTc2GfiplT7pf2LDjatoiEh3Qew6dIGgR4xlbL7FdD0E+HxuhSPVGxcPbyBd1OpdvyTOxQo+Z3S1WztWmsxOKZr0li5NS2W0q+M5AGlHSaY0+QJrhNsuWh23UK7nV58vh+Em67HChhzzFzmfqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jeDeT2WqBjVc1/CaxSnllBIO0s7ckUr2vLbji3tgKbg=; b=pofHkK50tbGB1eE2XrSnoFeA56Rth6Gb1WAbRobZNxtreM7zUt2q/QHti0g+VeKkVSZDN660z7yLPAbxrQ1QoHXXi2DTUPYZyd3B02BmUg9mFdtdoE9/ho+jUAJeH0F/KdHc469H+XINwA6+TO6DEt8IHsZu0UTFAl+5pjBueAQehKjomOPk9olVFbzy8cwd9a+T/eGWrMraRXqLk2PDQEJ5p3OQyDwP9a8rtZs88MeXFkuiaQKunndIkzLqzNKZi90kejOXQ2eJWP64brOg9c9kppJhtY04y/ZYFkq5+RB0l3+R1sLI0wt5gz7EGDR17LCK3nVTXoXSqefp9+wBzA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:24 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:24 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v4 6/8] arm64: dts: ls1088a: Add serdes bindings Date: Thu, 4 Aug 2022 18:06:00 -0400 Message-Id: <20220804220602.477589-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b9b60e91-7881-4bcb-912c-08da76659201 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3MTSStfQ47Za3Qxys+/+WhDI+blNMZpFj0DGCRtivp0HufD0PS6wr/KL5Q5hHpFoiUskS8UYsfLcMgbyAnz3h0jimtBM9T1PM04jwy+j9vvd043tjl/wAU1yxm0MjOS9bbgi5/v13Dml6REITOMdiU9/0Hq8PCGfygycGyNw/5Jh3tFs1IOZybD0VxbdR0Dvrw5KB+FJ8M69Afd6rXCjlAaA6UXvd75rm0CyfBRH1aQJgjEU1Qi7Wpl32soMfzK1c7tBimvFrnKuMerTTo6Lb4kkawVl9O744qPgfR6mr4iChxMxq3h3E8KufGWSCo1WZRKgrIhvfWAEFwecOuLKYN9foOsOYQwBn9OiJp2OvB97BX60kMp6SZAxeierjAv61gCOncBMbMGZwq939F8d5AFh/87g0kXZQ/ug3/mKkiAsPfyBdbvXIiYn77mM303zH/LW5X4PN0mPwZMiUMIS+0Wz0SozoDGQsgaYH7g1URydEU/GI42VxK4K3xRzSmTcTUcieU2bSm+XthWzu4NvfYlow/NXAJJBuoUPMspdPzbDdPLQJSwDgs7AMeBDc4dW9V8G6V5bqd0xX5uAQjX8v7R+tyGyeOSjMwmyBYC4SLK21UB7HJEDUrxobVl4pT5cmfRfGMZ0gOpxiNm9/ZB3+otI82DvzvU7OguoocmsWAZ2yRPdcgqbxYbfi1udVYV40f/Dr1E4BjzJgESuKQGxwsLHFXKONy/UqVUXphg5EQSIO6v5R99bUNzlAenlSeU5+t+2jlMMgE1ydIC1NgSSN94rP+5X7hQhlIXebcZxR28= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6fAeQj98R8QGLlxuXI9IFNwMhk+/kXidLi+c7+49Asx9on2zXszTIXyEEYHGe9DJRXDScUNz3++L5KDXjccdXCK5RClHaqzMuH6RlXF8/JbWWF1XpF+KK6PSy3gJ/4QbVA0wBNQOY7ad8MRWX3h2TYjX7iIWsM7w2JaUCsPvC38bGbiWq+RIIo24tqvr2feyAvIa7w8uVfNaz+KRIYS42POd/wEHN8MP+gnlkASncQuHmkyHz2BgL/osc7IZKuQjWZCAm1jRX+EaRk+S0jYFyYxVQ7W6T3VGjT3JnUKXpyketmj/yc4Y2aM9rVXh7Rc+NZ59X/jhMgm89qIuYcGj/3q/kElj7sj/QxHGTA3HOqu0jSlQ/gAcbni61q6PBzYZ6IqxWzCZ5YjInPMn+5GQEp5s0xlV9LjL/mWeI4oZurV6AiCTRfMQuNIyXDOC2UebnQHBEJDo7uuNhgXd67ut6VevnWfRsS96s9XES4v/g6e+LNCqFlMspIBoNEmP0qCPnpJnYHnZS0l4yjrkLUJUZwTtT9TpShdYEXVruLOIS9UYB7bQGv+wLko8YlIdS5/wucbCXKzWsHaxxZSomqmqHLo8dHz4ol54CCRymQ6UYKZg5S6cYTQQUIzvJWxjtYU3vtKxB9+F3XBlC1HMvc/G1d2S8JZbfmxGQfhtU8lZy0Cabc3DIg3+QzWnt4DLrHo9zquMGRfbNtbXMubnd00Pvw5rHdxhcs4/WhaHdvYa2sZ27ygcypPdV/CgT4z/OF2Q2e/1VwlDOWLlALG5hSRwKhmwqfYco1id7TGPEzg1TX2GvKM60YihGEMNw/hX62iLI2pSitC69jh7XVHuPJ1V6E10Ig1YLOLlyT/BIlhAnUtbD4d2GZkfVMbxhmRN9GvH63do0yBd/9BPMfyk1e6FezT50HMh4cxDGz5jqTnUFGopevvocMKRATdc9htogBFdrizJpYXpJBkW9WS2UfUq4vaDrUSEifi1QsjHqC51sGzp34QyATGWkFjlgw3yWvrEF/zYPyVvszGRX/NQ0AvawitYODQwKi31qvx4NcuW8NF21Jv9pR4I4d1cxJdLvpus0V00Kn480QmqarMaxQ8Ic3oZwd/cRA2gKWzjcJzqJ0OmXOphTM0AYR4pCEICY0WE1IwhiJoSnvqJ8OtYP/UNZTsCpSp8+Rzi91ym4PWQNHGfhDS5lHzYulmjTChu31OYmoaea1uG47gKQDX7wiDPtPS67ypN74P6D4ZYTXv6rDki5YeA5JEhvMfl3Hqfj95xQ2jp6BM143YPRQ63XUTrnsAMRBt/dXaGJEquYlyF4B1xSz+FBxlmqpbCFpQgmjb4IQfg3fkXak33c3Am7CO1aCjfynxgqmPonaD8Mku2lXCSf7g3yM1Nqa+beRCUIlsjZjtinSdug8bMpVwyAzsiBw5vrPW57XSDeoMsmXJTIw6xPkFSwr265eYfPB1rc2tVjqaB2uLB/++pgqP9m41m3dhPq9Za4mdvDsY3D6H+q6oI+OLiNpqm4KSutAwi4tf6+byrHyec+D0xSwgACqT5dwp4US8IlX5xd8TiGATte006ewCcpslA5k4P3EmUYIeJzDXrmD04b/VCdb+/+kpImg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b9b60e91-7881-4bcb-912c-08da76659201 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:24.6259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tNt70ihNwvdXFyngm2VnV5lo+4id0ini2Fcu/jJpKufTKicmZ/6GUsUytSaJe4SmVpuVnrqJuApqgusoRVs7Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150634_746023_05098615 X-CRM114-Status: UNSURE ( 7.57 ) X-CRM114-Notice: Please train this message. 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 This adds bindings for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- Changes in v4: - Convert to new bindings Changes in v3: - New arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi index f476b7d8b056..f252e968fb73 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -238,6 +238,24 @@ reset: syscon@1e60000 { reg = <0x0 0x1e60000 0x0 0x10000>; }; + serdes1: serdes@1ea0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + }; + + serdes2: serdes@1eb0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + }; + isc: syscon@1f70000 { compatible = "fsl,ls1088a-isc", "syscon"; reg = <0x0 0x1f70000 0x0 0x10000>; From patchwork Thu Aug 4 22:06:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0FE2C25B06 for ; Thu, 4 Aug 2022 22:09:23 +0000 (UTC) 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=aeeADaZdNTKYr/55itFi3vJdC7VRVQEcdNibet9EDz0=; b=CSASWOF6lNV81a TndK2BEyTvrZ3vjrjuKQ/jPlg8JbWmWw/9DBjAEqcK6oUKdrzAY8k+OBe/IcZWkgDUj3mHKnI4X3A YcxLalLXCLFZR0mooqJ8YesqV0yJy9shtrRO+4QJjUeGrx8Xxu/tnKgoelX65pFC0jyfrVtInnRV9 fREPEGP4jTT7EZak31B0Hd1QQ3GlVoOSxRJfb/nhw4L3crOgSQOouu5npno74XuOT1x7mwUjHFCXY HMyx0KQcNHpF7TZWb/NlooTPkaSDdWYJRmJe3zVxLD4LXtsM2x0Eb8H7xLlv01V/rKk5CT3KloNkw 9Rui3jiQaz1s7iBK8MDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJj1u-009Rtz-Oo; Thu, 04 Aug 2022 22:09:22 +0000 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizE-009QTi-WE; Thu, 04 Aug 2022 22:06:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mJhNbKyeq26RvHxUM8Myfpupatk5aTo4IsUWHP7Ii65i+eYsYzk/AxK42kK/b8xH70hpU3/2XFRxs67McIi4Mp7bKaHfQ5EuWnATL2B+0ZAPC4qm2R9h/ewa/ZBMmCx3RVHqV0yJSI6YuYNlcUHyZlI54/XheH0aLpsJSVj+U+WkPbuXdBCAKjqRPnfiFraFmJye13VQq2ktDMJ3NYKBxJFKVOiPcDiVagYlZeePGaqUb1Y+WUcmFGXNkOQ43PnGk0q3I3ENy3tHIILyFECDnCUJv/VhiqJmENumVSAyv9/TqhSajUT3MyPgF3a7w0uagu2DCl4SU9hnqvT4bGfADg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bvF+CPj/eLlyyZjf2Zzil/gKULCioBp37jPWZ6heAf4=; b=nshIkgR3QPmndD47KqHfbwu0QyB+huJ/A2wj2AAqRvPrSfoPfiOvSLkvvXlbM6wiOUekxhJHD81c8BwDIg3usUXqNcS2/GL8pDH+2+a/xtb+5JteTgyeQud8rW9EhL7dQvUU7Uf/zo+AIVLugpqfyNEX0R8kDbUIn6BzYBiaalJaK/QzIEFzayEwWI0Ns98Mbx8PT/k4RSLUESvzfzOfL+fTHJKQOUwveONVZcYnKcJJhp4bEkS8iAHg8uiWQIdv9UQidkKXb8CABe01r2bATH9Vnfu2GvfKrXBqms9OtRzSJVi96fwAdfskj1m4E0pXzUgs2ywrOrQkh71ZJpkagg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bvF+CPj/eLlyyZjf2Zzil/gKULCioBp37jPWZ6heAf4=; b=KactuDJKvpxl5s+HK4CA/4NxQfFViwkLgRZFVZ6zowQ3UrCZgaBUjhq7m0qssB3JimkHw3p1tMmGzyFSQQctd9wscICtqpuEwri5d4p/TxjPymn9pQYHeE8MlyFOw0NrJeQsp2rwdVr5HbzGLdlxYX3EU0HlWWqqZOjaugiqHuPy3gtYRsbeUMgCUmoces7dXKMNl08dh+dE+IlE6IaM0089G0D5HsjYSz89AI0aJ8r59lrtmF5MefS29zbbsbSR+UQVIE+l7bvoZvFb65ynowsp0EkmNJ/ckXonlYGnls2pPl2RqnHfIccmA2GREnbNDTLiOpeqRlwu1lGkTSj3Tg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:26 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:26 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v4 7/8] arm64: dts: ls1046ardb: Add serdes bindings Date: Thu, 4 Aug 2022 18:06:01 -0400 Message-Id: <20220804220602.477589-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8e19e34-415d-4222-b6ff-08da76659351 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4hcC5eotmgVPADqx53FZZA7QQpvHnN6NxuDZ5S7W4H2Wfk3j9rvZt36/hrEJ8CXaZOd/+Yd1rIyyjysdT9szXGSDh0Wcrkv3eppJgkuEqVPAQ/y+cQuzBoj5RuTwq14lnqoYJ+1GUpBhAxn6ykm3UBlRW7h2KZZL1QPHtTBNyoOVBnAQZpSLYyMwVsdCfdkZ85MD0m2bTqnDm1sVkgS4JvgNPMxJZYqqgpMF5lqCCH9zkkFSflGfyDqK7/oU1p748Hb+5ufDU8tQ4SEDilqwlh6rXgGxsWk9cub4Cp9CdbfGDA6+kPqITxo0QTC+T/pQ38IUE8H/U7SBiIOTTAkkTkjnEX7bBdQM6EDhi0v3tNOhGbIdHg4pEFoiBUtVW5RvVfHbN2gnw42B+yOPz1WpJtk6Zt2ImRfum7PS+khxXvSO8pUknvjjUDehGWsQf5rEcsiVf7Gz+wT+k1mr4h9npq7OJjSIakl9iAfSiltyc+wKsv7jKkAHo0gjK7og8THawAr6Aq6B8C/Iz8PlVpQ9MB/Sv2O5jGlxCvueFH5w+82TMjpMxhUlk1+6P16q3myWPJBUT4N9TFd1Pk1FWUil+wq1r/aBPAW0ibsxYc6GdLF59D3HaNnBJFuKxZQnz3gmEHLXPr7mORqE9JNmUKfZl9gliz0fIyk327KOPVLBa57JqowRVnXF6F9B5jxh9HDAgh6x/Xlm8k9AylZu8l0hD3a+GWE70KDuM+Akv1HcrZxYerhov6oVoCN+7YFC17u4+32iceyoPihiG5UEFhbFHsbBQyoWjHoy4O3GLxpw+TRJQluGmiauLaDLExykpMaIXCz3EI2T2G+0fETTD8NRTQTzUprxPoM8TtjZhKeoe+A= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(966005)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QcU5sBxYDJqIIiiaJqzj2PpwAtUrr9dyLqZ7wne7phjUUbRcFLSJ7pfuov4ID91A4MNmKVrbkgGY8C+/1PFQ3IaLLP2Z603KNwCOpux0qHVjFEPK3a4oIPoczJU+k2H1glRqAAcWLyUxpAzHUdtHbfBpdVXB8naOq2mz8Shtt1KiZIcvuC403POfSGlgKsK0FF6Q2Y4lY3CJ/IMQumoat3on3YwDWwn0cuXxDQMZAmdoISx9pVlzoPxP7iBPlrgGHoc+2KVQ1cVw+7rPsWuCZ97kzUzyrT5z5SvhBRYEmWku7BVERLpIn6vffT/n16sxdTt0uXySYbJshfUQmxZSIo8ABqbSmzoj17Ds3F7TCz7+4V4PELfOupa+hW1Gn5pvmVzwXdzgbu2U1c3U4by4DR3Fq3aMkQgWiHHzrm8JSUj+igVex47KLDyA6hp9ZpaPrhfp3VDZECXdP9T+NOdk+Ervb7exwSomqSq7nRFmOM4nJjdKRVzKxxt8RaKz9hXYGggIIcPMLLGCobYnWeMR8bwQlP1wK2aI9Cyuf79A0QkhBq+3yS+Ppr9W/scI+BnytSBofhWNUK+LswEPE1JiUwTiA85KuFAo1INjIVhNkR3hNT6cABT8unQ89a2WKH7mxiF47t1dz3nEuIJxuMNrtBIwUMPoZ7zUZ2Ct3wsg/sBVokJdwMPxfzQ6z3B0n3zgJHrqFlwpq5JervNb1y7G9S7TQ/UuaXO3isjB10d5e2PXsj4gvro3qe0TwD2diEjOo9PK+IC90p1IXRPkTI63jU0uERf5DZDvQwMVu6kzraOZZOO5okaILKbmW8T2snATYjBZa+ZWuTMpwlT3kkR01GXAKUf+PhQNP+4YKqpX9BQhVWrsCUsU/eOUYNhHRzxKeXy2kKCgk98ohFwbrMAmuVwW1kHrklf1XB+yQ6KjpMAxNqMFpyrVaaHrvUFCEsgK1QPTEM8Im8JWgeuqHp5QQ8pYeSTGzGRo/d32ViCKSDrGuxr274vO1kaJaw0S9QIpDXA7Ytk4rWqalxtXh0NzWiVE0aT4HOh9euNwDA9rQhsjipTe+2UJAzh9w0XpAqt2RJfIWc0pKQykdugJ7/QTYelugJurtjjV9RxENBIdgvoVr7+9byKHoaWQVncO11RcGaOdHTYUSP+K9eW8ozJC05L8seKdI47B1dcZRYJvKno4ecbZLHMm2Q1SPBtHPa0ZrkILv94m8UaZZn2JRUmeAwHReLCgANCWmHc+r60Mm+If7OWgaqhPQkwhrRoGbmxmuHPtOa1lyNID+1sDhOi5Srqdzsj5ZP9WGS4SVhk2Esrx3XC0M0+Cl3X96omM0BRugKxadZ+Hftg99MUZPbcRx8TUlfvGGAqOAx3y26Px8EQBfgvz9lOS1crymGLvHsoOJfVvL8jIuQKJdP4dc2yz0TWFjmbAKqZCkZ6Us19X9zccLSlpHWSblyr17jXEZZh4k5n0WisSfJl3D2OMxvZljAKPSJxIeGlJHE81bGOkJW1DG9r7BI0TgM6g9qeb00pxmZjLHlg6DlHcKnmdMoTB4/2iyxI0DjzA8t6bOfzTUwAQ8fAJHFDWkyVgEnKIOlzpahBDBj75e+lYiLoIbyzing== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8e19e34-415d-4222-b6ff-08da76659351 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:26.2508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: unOBdQccy9sXbnrEE2wqPQ6UtCa8RdpQZRJQtmmFlNxjprEQt22JF483nGSu1VEyU4PcZVxykHtkomJjueAgaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150637_141240_FA886C8C X-CRM114-Status: GOOD ( 15.24 ) 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 This adds appropriate bindings for the macs which use the SerDes. The 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is no driver for this device (and as far as I know all you can do with the 100MHz clocks is gate them), so I have chosen to model it as a single fixed clock. Note: the SerDes1 lane numbering for the LS1046A is *reversed*. This means that Lane A (what the driver thinks is lane 0) uses pins SD1_TX3_P/N. Because this will break ethernet if the serdes is not enabled, enable the serdes driver by default on Layerscape. Signed-off-by: Sean Anderson --- This depends on [1]. [1] https://lore.kernel.org/netdev/20220804194705.459670-4-sean.anderson@seco.com/ Changes in v4: - Convert to new bindings .../boot/dts/freescale/fsl-ls1046a-rdb.dts | 112 ++++++++++++++++++ drivers/phy/freescale/Kconfig | 1 + 2 files changed, 113 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts index 7025aad8ae89..a848556bd7db 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts @@ -10,6 +10,8 @@ /dts-v1/; +#include + #include "fsl-ls1046a.dtsi" / { @@ -26,8 +28,110 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; + + clocks { + clk_100mhz: clock-100mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_156mhz: clock-156mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <156250000>; + }; + }; }; +&serdes1 { + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; + + /* + * XXX: Lane A uses pins SD1_RX3_P/N! That is, the lane numbers and pin + * numbers are _reversed_. In addition, the PCCR documentation is + * _inconsistent_ in its usage of these terms! + * + * PCCR "Lane 0" refers to... + * ==== ===================== + * 0 Lane A + * 2 Lane A + * 8 Lane A + * 9 Lane A + * B Lane D! + */ + serdes1_0: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SGMII.6 */ + sgmii-0 { + fsl,pccr = <0x8>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SGMII.5 */ + sgmii-1 { + fsl,pccr = <0x8>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* SGMII.10 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XFI.10 */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x2>; + fsl,type = ; + }; + }; + + serdes1_3: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* SGMII.9 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XGI.9 */ + xfi-9 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; +}; + + &duart0 { status = "okay"; }; @@ -140,21 +244,29 @@ ethernet@e6000 { ethernet@e8000 { phy-handle = <&sgmii_phy1>; phy-connection-type = "sgmii"; + phys = <&serdes1_1>; + phy-names = "serdes"; }; ethernet@ea000 { phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; + phys = <&serdes1_0>; + phy-names = "serdes"; }; ethernet@f0000 { /* 10GEC1 */ phy-handle = <&aqr106_phy>; phy-connection-type = "xgmii"; + phys = <&serdes1_3>; + phy-names = "serdes"; }; ethernet@f2000 { /* 10GEC2 */ fixed-link = <0 1 1000 0 0>; phy-connection-type = "xgmii"; + phys = <&serdes1_2>; + phy-names = "serdes"; }; mdio@fc000 { diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index fe2a3efe0ba4..9595666213d0 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -43,6 +43,7 @@ config PHY_FSL_LYNX_10G tristate "Freescale Layerscale Lynx 10G SerDes support" select GENERIC_PHY select REGMAP_MMIO + default y if ARCH_LAYERSCAPE help This adds support for the Lynx "SerDes" devices found on various QorIQ SoCs. There may be up to four SerDes devices on each SoC, and each From patchwork Thu Aug 4 22:06:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12936717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBA3BC25B06 for ; Thu, 4 Aug 2022 22:10:55 +0000 (UTC) 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=/LE3QkFlXGHes7LDtmfQUjl0sfYZKxmzr3vivszo4DY=; b=LcVT96C5PuyBUq CEKaQcg62WtC/PiNvCvgczFsSrc64vK7hSG6ad7R6JE+N2kdYuvK751SZikU0fvvbJ2tHd38rkoPN JXbyjk1xWigoFlVikG7Uch5uUJKdFjutF8cicYnXfUI1MrB3CkfZ1WaYVwUogp1A5WEFvZ9X0wbQ5 jx3t8Xz2xCbxttfAuwf3AqnNgV5Y9rOlfwRi/7K+R0kpXAZAz1nh/uvRwOZuatDYTUQIqweojyEQQ 7K98JVNw3PDGoDoxPRUUcSmjDAx93XCkybVeejm4ngfqKaYHh7/PXCH2Vo7vwtTKmsH3Niu5SCRss m2+pFEgo5KXbyBkr1dCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJj3P-009Sbf-Aa; Thu, 04 Aug 2022 22:10:55 +0000 Received: from mail-eopbgr130079.outbound.protection.outlook.com ([40.107.13.79] helo=EUR01-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJizH-009QTi-S5; Thu, 04 Aug 2022 22:06:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ObR15jMLuHDWYuE6brh0Hq9ZStYo2h+ZHYQ4nIFan7jm86cT0T5IPPEVfdwXDnmRgBJWOwNbZhHi2ia5YbFVzB2aQR91kDFACBmeUY/poLZGRJUREqFGbGxEezJF+urTciDn+TC+qKtaay/Zbz9eayxdEu2eqOt6oEwJKYW8GYwV2VwP9CG+ml5a+YXqxQVkkkNS7v+6tDjthvHlE7EPXZ99E2wCO2OjXzsuzebHqGTRKIqqxNTJlaKg3qnccAyWJPaHJWI8X5rsnM5BnO2t9HBMIamBTF6JTPBF211llLYd8WEOdGa4HtrgkkqDiJZ+BC+yx1tysCD9Ps5NO3lmnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oqchtlTiHCYugeUEDYbtK9JXnNGq1U+Kw71k+Lbvo1s=; b=M9ZCbWk1gIm7LDrN16TRwv7D0/LnyCmedBx5IIMrnsU5PewWH2h/BbsfvImaeL9VwAIrEOxgY5M7ihfZsNLy+UoF6ynYyysSgqxtL98jzB+K4m2xh7K0fq6tlqoeiooc92mq61xELSBZBpFCp1Uzvjd/Fjf6jM1e1Ahz3eKcr3/ZiNfElv24Z4qfRvUhv8i/bR62FgtGXkolz0NztVgxoA8t9oS0oJCkGSumsaFa+o6Ell9JIBMoH26EXr18bi7aPpoJHzIkSZGB/aWTPvJE/qfB5bt8o0xUvY9DqRfW79pjpUVczJRwUdW49umqCrD2RZ84gGOTkHM5+4QFJddwLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oqchtlTiHCYugeUEDYbtK9JXnNGq1U+Kw71k+Lbvo1s=; b=Yofo/F+lyQVN0d74jdrKrFaL8aoNHKl0TUMHyA73O++36iU/VTHgz8UXUasPkl5MTmJJpLTfPYw0VigIZUhAG4Rqnl8gst38H6B0gIw0DSqle96mJx5sMS3i/7imGqVu9mNjWlFLbIIPA79rPMLMhH5+iag9TdR7kLFgX/GV2ylZ4r+DEE1lpR1YCf6C+HTmEkyYgPbTeBwWgHHzZRTssnATJaMaULfEBDQVoi3t31ypEUOI2I95v26Vk/dJIUP3Z3aRpYLKbBEwgPIjHw4uftqDBpU8NvtCS6aHdZVnzeGaeWPsp5EDXa/5BRgNkby40QhCEK1vanbShmVjRtXbIw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by AS8PR03MB8419.eurprd03.prod.outlook.com (2603:10a6:20b:527::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Thu, 4 Aug 2022 22:06:27 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::ecaa:a5a9:f0d5:27a2%4]) with mapi id 15.20.5504.014; Thu, 4 Aug 2022 22:06:27 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , linuxppc-dev@lists.ozlabs.org, Rob Herring , linux-arm-kernel@lists.infradead.org, Ioana Ciornei , Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v4 8/8] [WIP] arm64: dts: ls1088ardb: Add serdes bindings Date: Thu, 4 Aug 2022 18:06:02 -0400 Message-Id: <20220804220602.477589-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220804220602.477589-1-sean.anderson@seco.com> References: <20220804220602.477589-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0097.namprd03.prod.outlook.com (2603:10b6:208:32a::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b566126f-5ff3-4c60-f736-08da76659438 X-MS-TrafficTypeDiagnostic: AS8PR03MB8419:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yCg+FW97ZVMv9CsWWNYKXGX6grk9hMTHeK8rtTj+3q+phBqXIOsGjRTEFJQq06BsPAZjw90ym0QD2+KToExHITW60NK2h/YxDpvfVb/62ev90WacrOJMMrdG8HkITWQiQnehUvxjyXmTOTdy0NPV2jB3ckqkXoy4Mx7lOTejGPx3JhUCI9wizTMiig6iEIY6pdIjhACX6UzJ3Ipu0Qqhrfm0FS6ow/4SX0dDklvd8L03BcUnWT3Hb/T2mX8gIiaPg64zX2EvlLhRtxRtj4HkpBNlQPrxJ+rjHahlAIHSLvhLUd0xsth2G3PZsDa54V18Y5dVEeNvBiET7o5DuebX4GqO3OxVFYru13bB1u4td6yjT9jbqttsS2T+sjy9kBqtZfo1HyVT0dWjF1SyrXUqSbRbt4IevBR3XJX5stQwXXRwzJdP1nndzu2xk5WFxVDZ/OABYqEnh+AJUXdCY4yP1mPyvpHGMBiGgCfgBX1JxmhrBBT7C/jqQl4pCnN50AjsfNe1HY+77nn+uqOCHnm+NTWNEgcNg26V0RLBaBqBBwc6WtzYk54ciMJmbdrCLLl3J+6kgMbCSqeMZCs6fMQXj03oMKfS0zHHa8ggehDUmEM3fhKD9fd4YxNbi2drx8xSzewoS/5cj+/drORd+ZNxXFzt+uizLSR4gSPjnFmieVN6toCVX7jbovGDhk4rarh21DS1+vK00HLrtcjg4Lp5ip89d+6r19WYN/vl+kGPm0MUqGQyg4fn6JFA0q8eEEMM7Gzbv3Q0yQXKQUvz3NcAUgBy3trnbYlsACbVk/ikWLE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(396003)(376002)(136003)(39850400004)(346002)(6486002)(36756003)(110136005)(5660300002)(316002)(66556008)(54906003)(66476007)(4326008)(8676002)(66946007)(38350700002)(1076003)(6512007)(86362001)(2616005)(478600001)(186003)(83380400001)(8936002)(6666004)(38100700002)(41300700001)(7416002)(44832011)(6506007)(52116002)(2906002)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qOULPihdtXQs/jZXUiFTkESyv2VdRFK+68at8ktgUKWX3UbNtq1sjpqeVIxtNH/51ydU6TyEdWQXj1m7Kt2tARrmDZmedi5Ptntj0ps45MYY1T6eHJ9+m/FtgZG5sePHwhlDEDJixfucLNwp0tGurkcW9lbMmJWlky6IL5rCPWLvQ9YIe9p0LNHUlgnGVplS60PFRWMF5ylbWG1KAtbtIGNuKRd9IqJKb/qca7WEN/NUDh9JgVZFMjC7gfsbvQUaNCNDNJwVFvECU35irlUHpOujw4suENUVkw18gx4rVodIQg2tfN3HZi1ZB0dWXFjGulclg6faQkTyOWljkZUP6ZE2oN3nYltiHkSH8AKPDXymOr7Hnig0lgldYA7yI+36cB6fA47bccflN3osYoRbugWyTBQ2rNr2BoK9h8lu87p5unvb3UcAAd/s0uliBaPv6BFTkWLDA3Slm4SqB+g0F8DQToS2YYuiim8uppf0fDEPnCLU3Yo2sU8/8OkMOIdw89M5jq/dJnBDh13yF2z93iYY2ec6hwcHcLDOsPECInKHeY8uhT0sAkaixbozyhBsmTMaghsgyj7P5jcECt9UAk3UnpN7QaHmNUIy8rG2hcvaUa8Hxd58uuS5UJ8eftJWjzSHzPiS38n9fL0d/CsDVK7NrJM9jaEiZr2x1KB3kD/ySfGLNgiX7UNiCb3AJ50aRlxNytrawouADmnKdjq4W8sLV/BAaLN1+MWFT3kR5sC+NV8sSWk5tmdpA48NhuKQuBSuXGNvfCNrbeZTIFlGePqIV13xXud6J6QoZYftYj/uTIiEyItrni3I/R7EWrENXks0taDAFVfHKmpi+UNlxhPvGbnL1psPWGgwmOpf8oW8FaBoULxGmu70Ef0ObEkflM8wBU9S0QyMjOELFmPAvEw0hq9qL9xoFviGGWuXMZdNnQZJuwGUVCym1/Tq8NJNAnJifnN1dxzDlCHNWE0HiusFGDJCbXxQjZQjkI2hpoIxVmv6Ep6EoAVYc6Os7oDnQz2qzVpjG6MnO4TUQx6DasuNlZJ3/thfEHgMeH67QUiRlnDlUGPdUBfG3EKcMxgeURrCov3UdwonRkOMfrU1p+aKqEdeWD0srjE00kpzT+hmE2kHYUYJt37SCdwJ3xl3upIDmlBnnHqYCvBadxnepD2NNvjecqO35EUlF4YPi8rAtWL7+baSxs56brIwEwaKMlgBUnCgkSkA5h9VIFFSV9jir+UgokkdY/o2ro4V2BhCrWGseLAhntOJAaY5A9YbXkItDb0mtQ3tgn4kBrv3u0ELFbds5tia3y/q+UbQE2CHkfz6UyEf8nipdp0MueImZL5hGigUYCtmtOZQxf91gqrounv7UWo8YSB5WMKExqAZyoG9KF05wjsmT22BI6cHnHzokrdfVw5vSukKm9U/gOAVkAisCptRaFLgIasR6Q4GURrgLVup4v7U4ilNEi3/fxjwe8rbuqpFCvwut791SLKSbCwy4IXZzahorTC290wf0kUCSWXiL2+HRaHWR7Bhv+MReuKLvi6XqPs/8hgrODaBKzfac1VajZa5S/zVf0YMvF6lXV8ydS4gl7epxtNdpORpQ8/ZSQ2rnopUnQ2RxA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b566126f-5ff3-4c60-f736-08da76659438 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 22:06:27.8288 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EOPewZsdbCNxVldkjs49hgCvPNegaoHwqofL6Lc0J4S96A+YJcbUG5KZy1bKwLhzoc5Y80Wlge8qiXeVzuRq9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB8419 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_150639_958676_C0F90E2F X-CRM114-Status: GOOD ( 12.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 This is a first stab at adding serdes support on the LS1088A. Linux hangs around when the serdes is initialized if the si5341 is enabled, so it's commented out. The MC firmware needs to be fairly new (it must support DPAA2_MAC_FEATURE_PROTOCOL_CHANGE), and the DPC needs to set the macs to MAC_LINK_TYPE_BACKPLANE. For this reason, I think this will be difficult to do in a backwards-compatible manner. I have not really tested this, but hopefully it can be a good starting point. Signed-off-by: Sean Anderson --- Changes in v4: - Convert to new bindings .../boot/dts/freescale/fsl-ls1088a-rdb.dts | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts index 1bfbce69cc8b..7279d914843c 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts @@ -10,17 +10,138 @@ /dts-v1/; +#include + #include "fsl-ls1088a.dtsi" / { model = "LS1088A RDB Board"; compatible = "fsl,ls1088a-rdb", "fsl,ls1088a"; + + clocks { + si5341_xtal: clock-48mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + + clk_100mhz: clock-100mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_156mhz: clock-156mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <156250000>; + }; + }; + + ovdd: regulator-1v8 { + compatible = "regulator-fixed"; + regulator-name = "ovdd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + dvdd: regulator-3v3 { + compatible = "regulator-fixed"; + regulator-name = "dvdd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + +}; + +&serdes1 { + //clocks = <&si5341 0 8>, <&si5341 0 9>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; + + serdes1_0: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SG2 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XFI2 */ + xfi-1 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SG1 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* + * XFI2 + * Table 23-1 and section 23.5.16.4 disagree; this reflects the + * table. + */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* QSGb */ + qsgmii-1 { + fsl,pccr = <0x9>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_3: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* QSGa */ + qsgmii-0 { + fsl,pccr = <0x9>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; +}; + +&dpmac1 { + phys = <&serdes1_1>; }; &dpmac2 { phy-handle = <&mdio2_aquantia_phy>; phy-connection-type = "10gbase-r"; pcs-handle = <&pcs2>; + phys = <&serdes1_0>; }; &dpmac3 { @@ -28,6 +149,7 @@ &dpmac3 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_0>; + phys = <&serdes1_3>; }; &dpmac4 { @@ -35,6 +157,7 @@ &dpmac4 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_1>; + phys = <&serdes1_3>; }; &dpmac5 { @@ -42,6 +165,7 @@ &dpmac5 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_2>; + phys = <&serdes1_3>; }; &dpmac6 { @@ -49,6 +173,7 @@ &dpmac6 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_3>; + phys = <&serdes1_3>; }; &dpmac7 { @@ -56,6 +181,7 @@ &dpmac7 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_0>; + phys = <&serdes1_2>; }; &dpmac8 { @@ -63,6 +189,7 @@ &dpmac8 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_1>; + phys = <&serdes1_2>; }; &dpmac9 { @@ -70,6 +197,7 @@ &dpmac9 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_2>; + phys = <&serdes1_2>; }; &dpmac10 { @@ -77,6 +205,7 @@ &dpmac10 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_3>; + phys = <&serdes1_2>; }; &emdio1 { @@ -142,6 +271,38 @@ i2c-switch@77 { #address-cells = <1>; #size-cells = <0>; + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1>; + + si5341: clock-generator@74 { + #address-cells = <1>; + #clock-cells = <2>; + #size-cells = <0>; + compatible = "silabs,si5341"; + reg = <0x74>; + clocks = <&si5341_xtal>; + clock-names = "xtal"; + vdd-supply = <&ovdd>; + vdda-supply = <&dvdd>; + vddo8-supply = <&ovdd>; + vddo9-supply = <&ovdd>; + silabs,iovdd-33; + status = "disabled"; + + out@8 { + reg = <8>; + silabs,format = <1>; + }; + + out@9 { + reg = <9>; + silabs,format = <1>; + }; + }; + }; + i2c@2 { #address-cells = <1>; #size-cells = <0>;