From patchwork Fri Dec 30 00:01:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 638053 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D318AC5479D for ; Fri, 30 Dec 2022 00:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbiL3ACA (ORCPT ); Thu, 29 Dec 2022 19:02:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234079AbiL3AB4 (ORCPT ); Thu, 29 Dec 2022 19:01:56 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D904417419 for ; Thu, 29 Dec 2022 16:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9GIvoH24egmxzD4cbxXSI1eqAXBdpyqWhFIUKmKxlx/wFA70nCM78yasig2uKb3JP9cR+X6vUITyeiIKqE6mqp+mSaHsT3DpBvid5IuEC6ss3CDzegPIh7vNNXJ5Ryj0+uMmnJ134q3uQ9MaNaSqz27MglmQCCTq1gUFWx2MhiRUKNoq1jV77/g255qryKUL3cxMGIKqVAcyPAaHRgdYmDim2IcEBSkbWMvSUyRJ+kgzWrcuWcMLberw8OSYuvAiEGuWK/HXfxThaDk1+6OuXFB30PA/4C7GB25013wVDw+eV51LhC+dP9bRFSuku/E4f0J7FMpAUvGw+60WrOqqA== 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=AV4YSLSWUEa6icuS3ElbSt+yZKjwyRoBMk3Gdh1j9EM=; b=KgHO1Yk6I//AvLo5h709iE52WzljZxjr/ZpcAfUr6DAYz3U6VvGHGQvMMOq1S6ClA+8fr0gjElf53xtKp2ZRoWaE5auw6+ELDs6iMizkVTNz/LHSEAC9+PFn1MxdBn3GD7iHIs/cxaYPPtLYSK47+3vgW7QAi12Ch4omexb8eA7/sdzlzDVir2LaVxkqhmrGW3RmVJCP6HAJEBaPsrqRtbQDz/pSmV5DY0SPWZSPDIT7/aZPh7uhIr+kKV49t0vSCyb87bruTkCUk5nhMKrIw+nruEtpsdP9E5OYa/5QCPH/3g5Arw079R4eyJL+biGpMJElWneQqS9FSup+TCfwTQ== 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=AV4YSLSWUEa6icuS3ElbSt+yZKjwyRoBMk3Gdh1j9EM=; b=Tmon79roM8m/XR23Nz/IyHuYTOayp6dRjPNLYpx0YClMWSTkTLMma+Iba7Vd6MywcD62u93JNA08dwo/4NNsq4yIUGpANfGIgMiMm1OIP07/Wk0Myf7wwcCR3R7GmJSqhL8aOP1Issc67c/O8nZjGkdZVFXMs7gNVDb25V8AXeIAvhHTIJYCzGovmvPld2tJVJLRI9OzyoixA4joX8WvrmbW0PM2GqvredQT4HiC7Yb75VlprzQEaXa6EnPtdYTP9DRkXKtOxDtQ7JMh2aruxQz7g6ty4m/3y5v2tOtzy79NM0aZITlfYI5zBMAr4SvjdR78MERrAwZNFlBZJyLa6g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:51 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:51 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Rob Herring Subject: [PATCH v9 01/10] dt-bindings: phy: Add 2500BASE-X and 10GBASE-R Date: Thu, 29 Dec 2022 19:01:30 -0500 Message-Id: <20221230000139.2846763-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 61c90757-ecd3-4007-88f7-08dae9f90dc7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RfcpFfcWsgmJbMS2//kFvPBesLdYM2albxdX+K8WS/F7pup/uWr4xM0SmCqR/10NvPE8eosDHYayr6djH72eRHKXBaMtHAe798/k66++c3VdZhtyJkkLgAMkxFnefdLdp01535ElIMKt3sv+Xm0/qYIiVAY6nB2EhUwWaQR3TFrJP+QmGR8mlGXlk7m5WPMjStKA3pfD7dJkZzV1d78vZe99APTkrfEdA7bwreW+l8WruXubJ7rL5bKvaEzAwH3bMH9twDEzhqIURrW/Lqgm9L+7hoZWPri9497Q6N/lRisiSn8GDAJBJw3784tui+4vVAnCbYkfIUVRlUud27u86bAeHhSucLj+pHlBeAcBKGScetTxCE0lOmm0b2u/fdbW/QwHoBlcCvabn6lU4E9SAuDJLmmPEJf+yzQbZaO4tzOj2f4PkpOmULJrLg9qxJq4Dc7/kO7Jwd8dPZ9+MlrRjCqRzHhxVWC85P+o9Ht0IRnHvNWUI85r62LgGNEjIJgGCVbixRHlEf0KBZ12Vgr8Q3DxqEA2DaBWnM1giXarKj443PL3UdWuE405cVJQhrE6+n7H0rTpaND0YvCin8Mvw4fcpOL9pbrH1RAgp/SiYKD15wtSnCJYVESEr58eMFR8WA7N4CwPrcxoB6Ro7ipR7Kx8nZXkYzVO18DTXzI1PPpaRdWuMxOUFYlvAVFdbMOLTBSgh76gC1sVvbvhkKPHusiSgF675rLTcJ7TPQ7hXYc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(966005)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K37vBu/G3j0oaTuaFY1e6dJrlUAoOSGWzw+diawIWw6vGHjgyebyIx1WOXxcYHOlJ+yrpwY4mDWpDuOUvtSvtfAk8Ks5l3Jj866PfGDFZ1Tx4yc+z9OQNp+XPRktEk61fELcJ0+am4ixRdpF9b2R8/mi1dYwZzNSU6k7COMQWXAlab5+ctwb8SWrREjPg6MfYjmP6K5sB618f5zpThOy/nzQYEgp3moN4sCNtOJ9vRDhAuWCqqcp0lV/eXU4WG8N6GJ8D/YGwsq2IsuZXXtthGafk3nypFEVkRYaVCQOtPkvzGypQ+o+HRXVN4win9gbloD12kIMfO1cUZ/ERge2JuMVLcCOzVMQrz5AS5p9GgOv15mOxjzOP1T9ojSbwKIceVNLUfolVCkpRJ7Xjv7amuftaEx4gjCW79Bc1GJNtKSW8BoWUK7RsJWj4lnuF6pNBDtRS2aY8s0Vui1Tlxoi1hOPVxiMuCgMlzb0aJCYuZKf3k+bJw6urk5Hpz5sqk4tTbAhnOT0OtqgGCR7pDthDdpaQab9YLM3sYRKwnjw3tWp1eFjZiBpxoli54W6AbzfaUJoUFr1NtPk1EzAfWJMqD0Dn90VBl0mtcHQML8ERuAIMZaW0jK+YhdE6HJxGdELumuCw0wK2O7GQvVVderOMw8LQG09vzL9w2rtKVZxPnZ9MbF7KB1A4MZw9qQzWImmivC22byFkaaKFK2WmS6dE6yggzbxyR7N/iatgXkYKRKRbkT2y5f4891hgKqAOOnYc5zPLyrTZJnMU8VwnjPx3TRnttXo55L2OXy+eqkgJF+wKk/SWRwXTEURM4kIklf8VSev4YhgFwMwrTw6marY4jRQ7U6v1Yo/tn42vmtl4yFvN0ngGLdRTdi7h+mn4pVWN2CeUGQYpFWKe9eSp4w6CLTsV8bYttdAYSyGFuzoaQn4yYAWDGTqleLZw4AsBIvZpDV1ciWfmoNg3G3gJ0Mnh8eP8837LEXhzyT6yancVKjeFez4CwdJlVw/01uvmz0vWIw1lhw/tTeVAuXPi5Yre1hS0DsP6mzTK9OJAf4i7iB373/8+XqW24A3fl8zWRT5+RWaqA4FH+yC5bBPSU3zcbnqtrJk/9t87n368PacoC+vMy5Xdy2Jmi4jSdcZYj+IRbfoJvjUNogjtAhaskUJdtd2qPDXCw0fOh7cZRe/vNaNzMze5jeruVzJjIEfrOSE2uG1DkFSwKoTnhhcqKkWFW8uCgYzSPAlZHhTU63YFs7uDWUKM4D7neuiTJ/trCbeVGQ4GDPeft5Prk/EKozOP6Dlf4iuvhKiGxQeCl09qZliPQYfWCkSyBpRIf2cTamqKxG5ynsTJjDnnIHHMylpOSjIEGj7+k6ThdxK6B6wmDh3mENOuhRspXi//P4BEFRvaJ0nWexiyp1sE6jStCQcjlhagoNCNXvIhwAzHafYyaVvDG2rtjENWOAZDYzhmo0aLH2dDolyvhhiiZ1fMkRwC5Yr8br6NCRGuDoY7gWSFw8D15aFZGIDIqaN+qIKSojIKARjXeIHAMdv6PlU+CkwtFwBglamh6MfDLZmxuN1/gMqDj38uWESdrebZonpLupVJmFD8GiwcA8qRKTya0ZbMw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61c90757-ecd3-4007-88f7-08dae9f90dc7 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:51.4749 (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: jhcadDxGOYRMCyLcRoF1cyS4OrUuQLlQ+Xb8AqpVrG4rtSdaq502NYi3j20NTykchxFqECVr/4H4iwx6DjsdCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 Acked-by: Rob Herring --- PR increasing phy-type maximum [1]. If this commit could be applied sooner rather than later, I'd appreciate it. This should help avoid another respin if someone else adds another phy type. [1] https://github.com/devicetree-org/dt-schema/pull/85 (no changes since v6) Changes in v6: - Bump PHY_TYPE_2500BASEX to 13, since PHY_TYPE_USXGMII was added in the meantime 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 6b901b342348..5b2b674d8d25 100644 --- a/include/dt-bindings/phy/phy.h +++ b/include/dt-bindings/phy/phy.h @@ -23,5 +23,7 @@ #define PHY_TYPE_DPHY 10 #define PHY_TYPE_CPHY 11 #define PHY_TYPE_USXGMII 12 +#define PHY_TYPE_2500BASEX 13 +#define PHY_TYPE_10GBASER 14 #endif /* _DT_BINDINGS_PHY */ From patchwork Fri Dec 30 00:01:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 638052 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E306BC53210 for ; Fri, 30 Dec 2022 00:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234079AbiL3ACA (ORCPT ); Thu, 29 Dec 2022 19:02:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234095AbiL3AB6 (ORCPT ); Thu, 29 Dec 2022 19:01:58 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D049317418; Thu, 29 Dec 2022 16:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XWXJeZAGxsl8uh5mjrmkRy68apKzNXW00oxjoY40n2c9tzr5D4PTEkxWRuiV4XbofomnWvspXKa82RcpY+spnzAXhIaJ7kbPTUi+OgVlf3RzaDQGEVYm/833LxWhms8VIPnj8Y1pBJS3M0SMHA4q7Oim1m873Zr/G+lRl4Do2Yb4ebOjci/x7q679jpX6p4a0o+sdPZ9p1KY2SeXwSlHYtiaYfh3BpjhU1De7WTbb4pWxTgQnc+o94rrUwaDgM7G/P44oFU2A56VXCE772npYSFh+RgD+ICqCAfjZcecFlUP0Xac/Q/CKyLEmi8XD2V7sx+hfBSdvPYulmkep+iBOQ== 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=BTHZtd8MRl9SlgmY+4Zn7L0GBLX9bXILonMAlCYvifk=; b=ApdEV+I6r/hBRqWLyXE562Bpt7IyzL4XB7KQzBj9pV6wjdMKxD9btO+JA3QuFgKUEOOc/pzVRsngfJ3SAci/ogNchusn0+U5hHcbWQyyjdjUxV3okS/10BqYULlDetaFQ5d2PVYkOu3zo/ZLnPs/iL2XYXInDjUzualx1aVHAxbCXp3SkNf54ICh/zjiOExTD99Fh58pEVt9rj6caH64XQ5Z5zKGXl6bbCK7U/XkPygiEgmhnvl+zIWsXhKKiwlWBlXlYkfqLB/L/R86FCV807xNF1Iepz+8+JbLis9yuS3h78T/C6ea91LXIWPOavxNDNIVFaO1sZMZk3vm3X9glA== 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=BTHZtd8MRl9SlgmY+4Zn7L0GBLX9bXILonMAlCYvifk=; b=aCInkrV+ddZD3HlYynPO5S6yfe6xPlBJPW2kY78IR9uEYImixqmxBJtY0ILUJOVfEZ7oZ78fnE0PJBeVMetMX69czNGe2BUfEf5H48lUdoG+5ACEGCedLrx5nLfXmfLzNG/2U/W7lKp94sEEKQgp/SgdboWp+dfwMlUi93DVGdxnS25ywlWhb6V4g7ZbYJ2g0mBIN2HoBeZzadU49VnKLt05Al3vr+IuLiT6+s2UjEcG0R5kL9qwvsEybGXwr93aap8cwlC/ZC1rDMI6zMltqXdTMnAXlXaUtxlOMAPRIV4dyCbqAhg/qFC5cL+g6j8wcheAyggyca+OQCLn6xwUug== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:53 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:53 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v9 02/10] dt-bindings: phy: Add Lynx 10G phy binding Date: Thu, 29 Dec 2022 19:01:31 -0500 Message-Id: <20221230000139.2846763-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: a1768dc7-0d59-48a7-67b2-08dae9f90ec4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xOy3DxoIsp3xr0hl/hVt2ZPJWK9IllYfIr5wTT4R4QP0ZxKPrW+2EZi9UtRXn5ndC9jpoFs8tXqX16L4O9uACU4rgkqyxjCGmHg+Q3re2HUUrXMOha1dNerMFOOKkhw2j9jwAp03c2E8GlblijRwKCs3mj+RpvJk/woohrfSuOYF5rXDJLSK4uOCJttBb7rSg8DtLyvbufnk4GGlwi4+ZXAeahP2947JrYGwsNPvmeXoDzKDvvChOWOneo5wK8Sd8rAhpALvnUze8dj8eAroO0oT/CMdetH0geJlSaj81XvWXX/eGz9OTfqKYf+zSxqHp3Rg2+ISwJmGivbvD0f/VzLAYwgTY5YHpqkj0DTTAu0ElTt5gWhcqdr1efymSHrhwyti1zg5Q64ma9Yo1J8yIcMqpeuNdyVUQE+uVa/Ogxow0BIN/LPNffUX5VVzZiGWAoHfggolBIy8INHE3WsNs8HC7CHZHpUAMOelnzMHQAywaMLr+/VUfrzVdH7GyI7vxQF6Q7yPUMrEDPx2kZLuVe761/RUZb2RJwwqqjELpQU7AFxej9Qs1OAnykrCckuUu7ZB3dYH4TfDzI+K4WDvqtECEdjKU2Napr474dqqY2ipPo1dPXC2Nl/BifkPP1MUg7Dg0j2aiW2JKBhx+LPgi509CA+XBz94kIc5Q8TBX/E2dmJ+ZDJ9HvwaZuUIAhIpLR2zI/v6Ds19Eoz7BmCXiLbeYqSVJHy5Zkio87h0Aws= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(966005)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C+ICqO9CHeaLMG+E8v09uuKWR06V3oizSFCuvUmlXzhB67PsMcBOOi7dfMpRxl4FLztZdLPABRjxRFWVX5I4BLuTZGwj3gjFw6jyfcRo/StZk/GdFfV4+jvAwOeoSbVAa2yXlZpfXpKOSho9Ascf8RL+kglifgDgnsWkpxkh4F32vf/Mq+4oXchtyRc3Ke2djclxPF12WgbyjciENBnLvFFyHRAY+NTtvHiwjUAJt2zWir+vyt680TSg+5LzVZ4rbUb/a4x74zCpobGYCrfYXzm1GhxT5mWXy/iYYA6SL5hAuJnTPXLgqccl8OfRh9D2s3UeKxjCRdkj70P3hSqSnmqUqU+lRMZqHJ36shoGwiKsXXxIi1uGi5Szz4zIE1Nzf/+eTzRrPY0w1qM1A5jm3ZyORmszeJOdSwbqwRJ55ClY2MR5IKJr8do0XiU0ccv6Ur1JB+Ajwhw26k3wUr40iCUMn5ssIO7yeLQIsFOTPv9DREOiQTJQmpsbIJfLHzXyvJOY/OeeqIeVWUOpVNY16LwHDChkaZDEfdbWOaGM/ABZQzzZc+Qo5rbp9qVu/T76I6aCv+hqLphpxPIo2XZ/D1BVw10Lj05WwPdYCAM9QyJVHzZU4AWKra26w8OKm2YJCGtsZIuqtnSs02nqqg6K/c7nYtgWGMefh1uE1ekA/vV2UFl2PldEskBXKB+5qhk4ehgGjOVfuiE0Wcufv6v2gLnjgCaXmxKtwAXjopeqVEptnQv31Y7EyriDtyWoi7J2XkR366yDsj0vS6MD7CLQlMh59Evwycuqdp8+jkuDCpZ1swOxNK8QuDm6jK1NnBlDd7Ge2joAHNOpP+Il+yNNQpiK20p+GI4X54/2soqr51QcnUhYI0W5A57Xp3GpFttiHffYMkFRj/c2q9SalsRYLMdA5ctRaL3ewcey7r+fGZ+YogKEBTH6a8k/Gw0+3y9/xX9MIlF0y1aHdVBinui8DJsZOOGBannXrq3bYuv5E2SmUz/GfykUPCvy8TXtUT2NFiS4GKloXMYsuZB+eqxnuMg0Kmq/awdVcvT5eElRj0lOvfIhnjr2syzT4fse1l6zm69imUKtjkZXGPhPOATu0Q0CncQ9qoeui9tKqHn/KkIKSUNIHh8t6oprzFwwXhv+2sK3M+6X+9tcptfOquL+vIR84YGmNrM0DCIWOWm+Igo7dP99isY2xJ8ou7AXXpt/+uA9ia47X7hc6o8nDtAMQUl97ILzcXEQVDjM+tKoaX4e7uA3Qp0Wyk0IXSfv4cpxo3At6OqImgXChcPz9wfVH5tiCGk4XLplc1qL9AeM5kZPlKoZI1OBnYwn/zH8NIfQDvuUp6zoGkBIXMDeZfE7+i0oAaofYuy6Sq+YKvp7pQBwD5QkwK9/ZRaIN85IewUo3JX6brKGsZS85INfjOb8WQ2A+gK1wu9jO9dnMMSbyiOoTDtETIQc/yyhgmMN0uuqyV/ASwD31kj8ToMIBCfxQP8dnRUvbqcm2C50qFWmsfDLyc/yt/rMdnZeJMSY2YaIzS3PfJVpUawoBALFN0wksnmEBgpbajCkezER3rIoVxe1qCIcT6j4MANc0fcSEg4ri7J/1zm+HlxTXbloij930w== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1768dc7-0d59-48a7-67b2-08dae9f90ec4 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:53.1008 (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: +t3rTuETxawPZ6ip1Mkr8aTnwe0p5crio8Bk1tpOashhlnv11NqARJcyTUPma30Pkp4PQQnot4YvQAybWVEbHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 v9: - Add fsl,unused-lanes-reserved to allow for a gradual transition between firmware and Linux control of the SerDes - Change phy-type back to fsl,type, as I was getting the error '#phy-cells' is a dependency of 'phy-type' Changes in v7: - Use double quotes everywhere in yaml Changes in v6: - fsl,type -> phy-type 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 | 248 ++++++++++++++++++ 1 file changed, 248 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..7c364f7de85c --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml @@ -0,0 +1,248 @@ +# 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 + + fsl,unused-lanes-reserved: + $ref: /schemas/types.yaml#/definitions/flag + description: | + Unused lanes are reserved for firmware use, and should not be disabled. + Normally, groups containing unused lanes may be reconfigured or disabled + to save power. However, when this property is present, unused lanes will + not be touched until they are used by another driver. This allows + migrating from firmware control of lanes to driver control. + + Lanes not present in any group will never be modified, regardless of the + presence of this property. + + 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 + - 13 # PHY_TYPE_2500BASEX + - 14 # 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 = ; + }; + + /* XFI.9 */ + xfi-1 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + }; +... From patchwork Fri Dec 30 00:01:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 637644 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3990C54EBC for ; Fri, 30 Dec 2022 00:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234095AbiL3ACB (ORCPT ); Thu, 29 Dec 2022 19:02:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234142AbiL3AB7 (ORCPT ); Thu, 29 Dec 2022 19:01:59 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FFE317419; Thu, 29 Dec 2022 16:01:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QQAzXcqFkEoixxDdZPssfF5D86nCUGmIcMwhBMlUzttV/9eRGb0U38X++GEAA9VOL+jK3JjRUjS1H9aWQ9usEqVNQq2WLrWg0XvE+fWiRm+zCFNEbqOJAm7fvphbIFP9FHRGA82m/RIfg+OJX2nAsGS8qKr8BhoubD9KaZoZXKzenDv0DQSV4VgmB4x7Fdt0bBTOxeMt7p1hnmBusMRFniwzTevUbof9GaBQ624/W1UWc32pLXQqnAETiEsWfwJxfZ6LbMxMNXVecxAop/ybZ8lQvsvWaYfk62yoY6re+1b6+/I8mC2jbKrv7QgRVDqvi/HnDzjAEVuT1ZUUNwn8gQ== 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=nHfrKvIf6uhW+PIvN7eGwoBrowmdKIkqx5wJ0m5ZL2o=; b=JVMIl4ofjFJL6+4uGYJbVHYDo0QMnmtZ1z1wIfc0i4qEz2EsAwZrAmyPw0sZJZJqyK2Hl6pw0l5mIYm9OVXs2Iac7XjcCL9LkV78qBtqwK4UXjSFEliQzGQ8oNDbf/TsuuBaRoR/b4pOf0IUNtN0oRdk7SobE6TazuBJzHhO8VnLDCTPXUzlaSDh/z3okEmVJ5dnGUI/X6Hi+ZzjewLgkRseYBK5/lq3aGSk0/rmnO0ZSCW/q5onOXXqqVf11w8P8bFr420YyKimCNfmLdFIjCaIX2TACgVzrUJpvLi5HgqWIb6UmFxzc4gnJP4d/wz+UW6TnMDv78YYwIDcRI5DFQ== 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=nHfrKvIf6uhW+PIvN7eGwoBrowmdKIkqx5wJ0m5ZL2o=; b=eebienqCfz4EIrVssSwOtzfQ7prM9iLFlWlN6dgmr6CXS56En0WeGuHXtgOQAVrZZLraI1X8WgTa9SuMvQHPNr50xFNXB7DC8prGx/E/+TNQHcjY0zBTT+UIylkbpWKqTgVECAd9gfKFGCPjNO6M8zlzsTxpOvdQ5cl/pN2gcaUb8IvHYdzKfwBXxna96H5pKm8V/74hWHNwA2jrmSOpJMshnNnhmgQhvDa4m4IW58xSxT6UH9TnnQYMdcsKPejnCTdK2dLVKdaHEzYRIhIJT2hUX2zv0NXpCwRkrVXBLJYhGeBKyNiUOP6uUIkhq7GUCX+MUo2X41ep6IAbkGt8Eg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:54 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:54 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Rob Herring , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v9 03/10] dt-bindings: clock: Add ids for Lynx 10g PLLs Date: Thu, 29 Dec 2022 19:01:32 -0500 Message-Id: <20221230000139.2846763-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 43a1a240-1220-4934-b09b-08dae9f90fc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RN/3f3A2v7XhazO55F1p9+muRyhl0X4jFw9wyIvysJxutgHvq4y419iN5Na938Mc4tkqkVKm5HzxOfgvp/GsYASvZCb8m2EyrfL6CHBDbDAfR/U/oFb0jWNRfYq3KMGvArPqmgpnVprXxkHtlRJV6zLtRBNPA3rdIu4j5h33E0zSnodhcBSxRju+lX9AlTjfyj3Kv7nVJ3Fc/GPSdKtuuey11GRwrTMPeUzCiWxvpHLhTv4GbOePxV365DQ09kzpNnD/0EuXQt18Vpq42/VOtzmByJQYrxSch+C/18L7UCnVfGWfoliUbwjOMhiEQUXLj6HarHTBEgCaiIed6ZdNfkTWb9M6WglcNK8g12N5svmRiTDi2jLmsLm+TSL2gzGDKOn4wcK7ByKP1a0K4FoaZFuGGOWgXdJPBxw7WxwEax10QYqac6WV9ED0cGNlfu/YWMIC/OFoX5BTGFGaze8RS4axZ3gsuZiwAVvELgGy8tmv6eBn3yITpCZ5c259Xy7qFvrSda3OC965M5DfAY72STKsSqrnEqvUgbMMA1N3rczFS9JFpPXlC+JnmLVj4exjdREsDKeSctdzqiuSurWoaZalU+IJo9dkVG85LbTd752i3et/I72t9fVVGNt/MkPElzAtY+Cd4fN1Yx8XaBhV3LBYl3hV6QgG4Uj1U6UDI8vaBBkfAz1mRZpDwKbmS4l6cB4r1T4uxi9JxkvV2x3Gjw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 03q1QGLqMvYKt30pFIq95KKXGetz4yhLDasHM/7syC2aMt5JEu4RU6a/aQDktbi9b7W6dJegZeR1VjhDDMRXBBs/Gn6z5ue1/X7Jx5NWkqlYFKYux6vKsSOdM/v90UbP1amTRjKHqrN+4JBzRTAepVMrlQK7P5CrKgbsKUtEa6y5DAORUS2NYt9wfyBmYIYyEvJWKLjg+OoyJ0s29uV5hgHqvLeSyk1dCiBttIKDALeyXLjpnQyzlTgSFCf2Zh1NQ03Z0aX4XCfirhKpO/ph8cbzTRU20t5I9p8nbKXYO3S9CnsrDmv+tcur8ljUUavF47uBtXWxcNLUEQ6cx3/tbJMqT1J4iKIQ1efmUz/sJ89gkhGRnwysNN5IVFXI6wWuk+jwjA01GfvVqRf+SYeupoa2L/umRI83E8UmFvS2YhAXSaP/fxwBtQ7fRlO/lKGKbZam4pIZc5I2SfA27dJjrVMRsZERiiUt9uyuqrFL9MKuFoDMZqfFFwIMzatfHGG3QH9cqOinqdJLeZG9NqY4Y+yqdeR7H/PEZPMQHvNnDEyFYhh31eGvJikcOqKgvYO1ZFaH70TNDA26wX0bMnCR6Mbk+tME6VlXJdlfXZdLbh/Y6Of14Rxz09E1sSWScZjEtJQAhjrheC7scHgjtNnr0iwkcMbLqP1cS71GyI+4LYJQD8cqw/DrQJZd3hF2HZ2gsKgI4ZxfKHND3UJeLj7+9vP/d938mwqpSe9IJwWOJuuHH099Xw/7uZKM4A/PnS5KSaSGYYG6Nw2uRBCiRS6PyDFlvGz+b8UeK6bF89E78VcbuDMuMpu9tE9et1vJZwdJmuXr/kED0izyatPm7hunqaAmL65/xWctY3ZSNGyBtiSfbAoDUokBPjKoCyy0C4JyCgNGx8CKColeKvguG7xz0BS8EC8FoNp9toZWjewYwTET9LEs5b8RiLR8N/OGiZ83IW56HtGU/9KhupD5RCytPxs6392bcb76YOy6QsXitua7RGyIyf5YBWlCQf8IOqjk5R8cFXM9XnHUmbQ0uZWFcQa4ePO1Qy0s70kA/3I+SiD/AVWtyxwwFrshjij60P2NqbpQ4FYCNdIJjWnIVh3YgoaERkUnAs5Rx3KHmbR+3E0LrNVdmuVnbDmbaaAp1QYIuZXTiRXpZvIKrVYJpmuKZBFdy74QH8WLc2Awpza72PnuJ7GasT+MbgxZaIN3AHuyGiPf37xWMblsOatkdnuSiZo1SAdxzEhYAfW597QsI20Qx3kN/jk5LSr5ZT+zyQs6tYOf8Tmm5tQNbYxgpSwP+5juK8k115YAEU/xBwbiy619QMuoTwrKvwuVGc0Kpxgi3eD/2NwKJzApeyVUpbWnhYQu00PvROtJ3IA+/X0i+vrLCjNg6r2MZCE82QUJGfaKGQ3dwbD4ZcCEzHpybohnLPlmjZOW/XMK/a3TWCdXOrxBHgtEC0f10QOtlOVJu57uVL/51L/63g6VbQdhIkmNE6Yl3uehSWYa3jBYKZRpfmw4mk5Xv3rtW/vlb7wsW8wPSBPMrhrHDy6D/a9vEP7M3tfdGJDrBYOm+i0345myXpmE4BcVWid+TnoUwH8zFvlR1zp2l/dDA1d3btaK95m1/w== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43a1a240-1220-4934-b09b-08dae9f90fc5 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:54.7870 (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: z7sPDqF0NuDtr7p5e/MuwkeUTVkwVBluIum5L4RW39yhP7r+rSCUWPWUAoD0ZaTLkAMkQ7ceKzDQmeS8T898hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds ids for the Lynx 10g SerDes's internal PLLs. These may be used with assigned-clock* to specify a particular frequency to use. For example, to set the second PLL (at offset 0x20)'s frequency, use LYNX10G_PLLa(1). These are for use only in the device tree, and are not otherwise used by the driver. Signed-off-by: Sean Anderson Acked-by: Rob Herring --- (no changes since v6) Changes in v6: - frequence -> frequency Changes in v5: - Update commit description - Dual id header 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..15362ae85304 --- /dev/null +++ b/include/dt-bindings/clock/fsl,lynx-10g.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ +/* + * 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 Fri Dec 30 00:01:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 637643 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0731C3DA7A for ; Fri, 30 Dec 2022 00:02:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234142AbiL3ACC (ORCPT ); Thu, 29 Dec 2022 19:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234141AbiL3ACB (ORCPT ); Thu, 29 Dec 2022 19:02:01 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD7417418; Thu, 29 Dec 2022 16:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e7a0MgjpVrkEGBCAWcmacUA31qaNaxZeOQeG5WnBclaXgZf0+UonwV+gQeVgjbmtA9um0PwjeLGdHGhYjBrWf5wNTj2di3qNiB0Q0dkzoD3qgUW94SViuDr5BztUOhGgMWvBELiDy1yrdfLf+RBvFCaWXi3IG3AD/fyFNaTkjKZNrMPrrxN+nvEKKFE5N/5DZtn3FK4baivUDz8NpOHqWg2Dzm/hzs/cWK3UOO1JtoArgMLCPF8nTLFB7R5HnevoPDdWhLOU1+wTSeJ5JDxlHRzQjyMEMOC3gXJ25I7V9rjS8RtakWPDoRqO5/Qy0Uhu+avfYyd2nLm1sJyu+7GX+A== 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=8SRTrpKyDVtEfO5t68qKFCb64ktH7XhoraisGZ436M4=; b=H3NAZsGBMI6MByPF7N7kTq/21A7nzk8M+YPblROg6O9mp0r4YFYEVaeFtKIgtG+GEfTQAG6YRHyb+DsQXwEQAk6Bf97jodM7UmIdLLfn1ig/yOXPM3SMmIia4F20sw+WFWFNYn3AILUPt41gzgaiMdTMZpaioaWd5mG/TwY1A64DX+ZnMIboCZiEqpKmsfDmmBoniMr8y6Dx3PWyoHECfRMIYF2cYI1uuCSKUtMqsl0ss9JC3dRW5h7FygotKD4M+/P1UUqxY892zQcITgfqNXN0VPhNvksougyCDihQvc0KhKzg38qv4H5vi9AWDEZ1piylo6g5bqqDk/RxWNLnfw== 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=8SRTrpKyDVtEfO5t68qKFCb64ktH7XhoraisGZ436M4=; b=fylaqnJpFGOaclo+qmGFDBAsURxXsLKcq+VL1316DWFYW/Q2k7NfKOgTMI6RRtz1npNWp1P0h+Hm38V5jEM1rakMiRhRDrsPI4irNB7JOQ84REpXbJON/gCUlHDlISWLQrk8S/YYjvEtadRZ89Z2v32Da/9ye4nfZdPvpwjhGRAd3Awg3RQUyRtzTAOA+PT6BKdRgu/eSEPIamYJAT3KXWrJ/mHpQUpIt1p0DAMAP0Za6Sf3mzL2kfGsMLAf5B7z1oCKMWZLRT3IMr/ZCQqtpciYwfFsbkdB5WG8rFgFWWlhJ4Th+zDLcnX1umm8IUDYEWCb8X23zw6Xw8LHq3QgRA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:56 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:56 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v9 04/10] clk: Add Lynx 10G SerDes PLL driver Date: Thu, 29 Dec 2022 19:01:33 -0500 Message-Id: <20221230000139.2846763-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ea717cd-683c-4cf4-98b2-08dae9f910bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VTdA/5qGz8mWR0JKR5k6YGvVQK3BoLeEvhZCGshfJ1ycYGkdZL0OZEoYf67PjMSjbQf+uVa7aKKFe04gUJlj5LI1hY445UBqOJGU8QgOzcq27huU9An1SD9o74QyCjnq1Bw8epQQ/MTdJrPvXLu15ReIYdvoEWuqXjOqut3+MEMJuJdP9PDqfkNIzZvjwj7eJvGugbez8K5ECVy1utjq9Gd7yxrBpv0KjLq8XOssHLYOg47OtQSBSykbwZWc+2D4SCCbREvax/btZhQxUY13lU1DqVHi8uCkuNGNVwomt+Jf1rd81RRKxGGqjwfRIbPfUXnRiMFfguEyz2Qhkd/pLnGq3kT0HcE+CMjq6DvFMPr3zwfBPORUVZpo0qoiU90qQ46QhXwBpPNqjod++zEL2Vwid/5fqJM9kZGY13ueQXL9s4BC+qNPOJPPp/SvmoWyfpAf7tr0BzcfQawJxcMq0GQ0irEhdhkBr88gW88zQKDZnBOvCwqhH8SVYgRTWcgAb07rcweV/YO1RuYwrqwwbldk7OARZ5D85E5BN/hWTjNCe2qDjDzyY9kgntN+v9RJiPIbkLLAgaU3oZl43pZ41ohGKxxndqkAOTlHSjlWyIwHQCC5g4nWXQwM46KhsN34Hi9P3CgIyBjmw4HbnViYOXtta2EuWAaALunJeExoZy81NAOvfciu23LV4gBezYcsOQmeZEGY0inaK7aGc1+WPIn7Hi9FuWnmEdGu8xG7R4LONtAlxTuQlQOjZ+FHWTT8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(66899015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(30864003)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(966005)(6486002)(52116002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FMcwdk3nrjHkuEhlgQQgBrLBY4r61VIRvxBtcgXGwKpSYfVDHyg2STdZWXcb0Z/IPB8zMkrBIsIH8Ax4uYjf3POQyjC2bkWbDDDkRleereHIStLuxI0NGSwUSzpYhr/qYpM4P5D0BGhIzA5NNR3ZNSWCgUtzFG+5MdnO+80um/V8/J9XbkdKGxJiuWgDI6i+nz4sd928Y9ekTefan8na/dwu1GqTHVt0nJ9KyPRMeuJTFuMGR1134Ea8IuDyceHh0n7QlVER+J2mOjAf/t2r3w96OARdNW7eP1MYsbSKQO9WUJ6gUwggUdZNH9J7RDWlIejHmo2d6HwbSQxQveQ83lagDVKs5yzBMLBa1WA4X1AgTNxjCV1Y67p4rtExS5CW5QuYFlRCYZVna1ccKUhmDSoZKZEEvttvl62sV1A4MBVxlpqtqOaEDOhP6DRBsHB+1iKrXN/Fo7sUFY+WLefKDwSNFeHe7Bellqw4IwgCoKWZWOhDimWqDw2Ste48fnls+UNidFViaHKGfNFM8fBrkf+F+wHfu9ybNd6CnPj2F89DUKyq9FoJB43ZF1y/gKglJhkfFToQTQpZ+uXRyuhFhbu93tH+orYqPqaAC8vCMsEdK8WHRn0wqOliiN/9JvK17oTdREQcq9rDY4hgwYnkfgzs/Fo0HX7IVFAMHDbQ4XUafgiGD8fKlDAz0+KSz0GxoL/kPo7bIUa9Zsdkp9E5MeSAc1Bp1oKyQyx+2f0fTZI2KVhayRFOjFb4/JlPsC8ak+NNy3NEt22iuSxAsRgJKKDoioH7rqf8727Gm+yVT1KJuYoDlJY389cw6NEsmPV1u4VgfM5WOgEhadaTsZQpgtLBsy7f4roKJy0r06uTbARSm9xLRGqLX8iwNxR/lUxA3OXjZjdvO/ke1HqSSVKthehjiVeBm8bAFCS/qS0y+mApnH6e5PWrz4+RTV2EW60P+MoieFrRLuuAKSk9XnTaruOCIOgDiqt7wbfju3qYhrcyss9nQkhT/IjmWQZcxuWP6Ca/N9capkMdPftWwK1+SPVKcyx7KE/p7aKBvDgNBcPwk1oki5LWFpisIA1cUAsexIPC46C8lMzO9EuzrToY62CLp/xJ5rr5ErI2oliGy/HPd2aO+gvjCWs67PJYUFcRn13JchF1PSd5VdqOZyUF99KfKsdI3u4/NXERj7GWj+GIIRstgbwQYNhumS6EBU7sgKuALLy0bBgNcaktjnLdNCVQzHAz9sOcR91wDmnxKxtjbvsxKgtcoQrj5UEE7erBra9I98Qt2sE/89gi1308G7G3skgZyBZDp/BIshD1LfOFssuwIl+HCbX7R5SOXh9zuNM9juV7yWRXhxLhDaatbpdcgvo56K+5BPnggLMxiWmDlxvvRTbttB1ImN7iM/hgdrZSwXCSlvBbU71krjnvdfVjNHwk41/veTwI7YfyRqsO4PO+Av5aQf4KhuuUUFdBhw3i2IA2qlcuaU4kq12cqTHYg9eRCG3gJJUQ6CDqmGeeFxPQRiulB+udL693neEmCYgnZrXNe0GpERDkV2qKJEtthPt5rXPptkK5+aDLVUvq2PFrmXGht7oLfleigat9JQ7Q1Orwd4b3isJpx9MuhA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ea717cd-683c-4cf4-98b2-08dae9f910bd X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:56.4273 (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: YSthoopVgDG+iBwGnyWpu0ZrYMhMNwXxumSlAHKN6qMvi4qeOK1MF1M8A9O3SfcJAcqOt0laeMusIPyym03yxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds support for the PLLs found in Lynx 10G "SerDes" devices found on various NXP QorIQ SoCs. There are two PLLs in each SerDes. This driver has been split from the main PHY driver to allow for better review, even though these PLLs are not present anywhere else besides the SerDes. An auxiliary device is not used as it offers no benefits over a function call (and there is no need to have a separate device). The PLLs are modeled as clocks proper to let 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. Signed-off-by: Sean Anderson --- Changes in v9: - Convert some u32s to unsigned long to match arguments - Switch from round_rate to determine_rate - Drop explicit reference to reference clock - Use .parent_names when requesting parents - Use devm_clk_hw_get_clk to pass clocks back to serdes - Fix indentation - Split off from following patch to allow for better review MAINTAINERS | 7 + drivers/clk/Makefile | 1 + drivers/clk/clk-fsl-lynx-10g.c | 509 +++++++++++++++++++++++++++++++++ drivers/phy/freescale/Kconfig | 6 + include/linux/phy/lynx-10g.h | 16 ++ 5 files changed, 539 insertions(+) create mode 100644 drivers/clk/clk-fsl-lynx-10g.c create mode 100644 include/linux/phy/lynx-10g.h diff --git a/MAINTAINERS b/MAINTAINERS index f61eb221415b..c2802d4e61a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12274,6 +12274,13 @@ S: Maintained W: http://linux-test-project.github.io/ T: git https://github.com/linux-test-project/ltp.git +LYNX 10G SERDES DRIVER +M: Sean Anderson +S: Maintained +F: drivers/clk/clk-fsl-lynx-10g.c +F: include/dt-bindings/clock/fsl,lynx-10g.h +F: include/linux/phy/lynx-10g.h + LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei L: netdev@vger.kernel.org diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index e3ca0d058a25..eebed69f6c58 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_ARCH_SPARX5) += clk-sparx5.o obj-$(CONFIG_COMMON_CLK_EN7523) += clk-en7523.o obj-$(CONFIG_COMMON_CLK_FIXED_MMIO) += clk-fixed-mmio.o obj-$(CONFIG_COMMON_CLK_FSL_FLEXSPI) += clk-fsl-flexspi.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += clk-fsl-lynx-10g.o obj-$(CONFIG_COMMON_CLK_FSL_SAI) += clk-fsl-sai.o obj-$(CONFIG_COMMON_CLK_GEMINI) += clk-gemini.o obj-$(CONFIG_COMMON_CLK_ASPEED) += clk-aspeed.o diff --git a/drivers/clk/clk-fsl-lynx-10g.c b/drivers/clk/clk-fsl-lynx-10g.c new file mode 100644 index 000000000000..61f68b5ae675 --- /dev/null +++ b/drivers/clk/clk-fsl-lynx-10g.c @@ -0,0 +1,509 @@ +// 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 +#include +#include + +#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 + * @dev: The serdes device + * @regmap: Our registers + * @idx: Which PLL this clock is for + */ +struct lynx_clk { + struct clk_hw pll, ex_dly; + 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 unsigned long 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(unsigned long rate) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(rfclk_sel_map); ret++) { + unsigned long rfclk_rate = rfclk_sel_map[ret]; + /* Allow an error of 100ppm */ + unsigned long error = rfclk_rate / 10000; + + if (abs(rate - rfclk_rate) < error) + return ret; + } + + return -EINVAL; +} + +static const unsigned long 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(unsigned long 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 int lynx_pll_determine_rate(struct clk_hw *hw, + struct clk_rate_request *req) +{ + 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)req->rate * HZ_PER_KHZ, req->best_parent_rate); + + frate_sel = lynx_frate_to_sel(req->rate); + if (frate_sel < 0) + return frate_sel; + + /* Try the current parent rate */ + rfclk_sel = lynx_rfclk_to_sel(req->best_parent_rate); + if (rfclk_sel >= 0) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) { + req->rate = mult_frac(req->best_parent_rate, ratio, + HZ_PER_KHZ); + return 0; + } + } + + /* 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(req->best_parent_hw, + new_parent_rate); + if (rfclk_sel != lynx_rfclk_to_sel(new_parent_rate)) + continue; + + req->rate = mult_frac(new_parent_rate, ratio, HZ_PER_KHZ); + req->best_parent_rate = new_parent_rate; + return 0; + } + + 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, + .determine_rate = lynx_pll_determine_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 *ex_dly_parents; + struct clk_parent_data pll_parents[1] = { }; + struct clk_init_data pll_init = { + .ops = &lynx_pll_clk_ops, + .parent_data = 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 lynx_clk *clk; + int ret; + + clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + if (!clk) + return -ENOMEM; + + clk->dev = dev; + clk->regmap = regmap; + clk->idx = index; + + pll_parents[0].fw_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 (!pll_parents[0].fw_name || !pll_init.name || !ex_dly_init.name) { + ret = -ENOMEM; + goto out; + } + + 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(pll_parents[0].fw_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] = devm_clk_hw_get_clk(dev, + hw_data->hws[LYNX10G_PLLa(i)], + NULL); + if (IS_ERR(plls[i])) + return PTR_ERR(plls[i]); + + ex_dlys[i] = devm_clk_hw_get_clk(dev, + hw_data->hws[LYNX10G_PLLa_EX_DLY(i)], + NULL); + if (IS_ERR(ex_dlys[i])) + return PTR_ERR(plls[i]); + } + + 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; +} +EXPORT_SYMBOL_GPL(lynx_clks_init); + +MODULE_AUTHOR("Sean Anderson "); +MODULE_DESCRIPTION("Lynx 10G PLL driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 853958fb2c06..5d461232276f 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -47,3 +47,9 @@ 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 + depends on COMMON_CLK + depends on ARCH_LAYERSCAPE || PPC || COMPILE_TEST + select REGMAP_MMIO diff --git a/include/linux/phy/lynx-10g.h b/include/linux/phy/lynx-10g.h new file mode 100644 index 000000000000..75d9353a867b --- /dev/null +++ b/include/linux/phy/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 */ From patchwork Fri Dec 30 00:01:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 638051 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 424CEC3DA7D for ; Fri, 30 Dec 2022 00:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234266AbiL3ACH (ORCPT ); Thu, 29 Dec 2022 19:02:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234271AbiL3ACF (ORCPT ); Thu, 29 Dec 2022 19:02:05 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E65917419; Thu, 29 Dec 2022 16:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tneus3QX2j1uTbYCC5CMZnqey+n/nmmB5TXLRX0zcl6RtnjXRfDuwvnAJbyrU3/V6/HuRq7luYaj9qi4VK7qtUKgpfoXUWwSvsnL80sACpW8o3zLljfF0PGY0CnqpXHfPf44lY3TrkPNOLOxzHFJiNMuRDEza9fWqciKwYPJ0p/wQLpw5/t9w2OwVFBzGZFMC0ye/kxSzIInGf1xaRJZE0OlCqTZallUYGuHCTGAAa9ozLSoadRPNUveEkvK1FPGytmY2g+g3I79SvQ8Q/UOj0jFJoCuilj3/YyPwemqdJwLEPOd2m/AgodBKaOGc3gysG7WgLekO1YEEJvkeKySGg== 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=XrXuW0UHdvIpj0Cmn/yEmOWmNOYOgPS6eSydCXg/ITE=; b=iI4+DfhEpzM0ZMEOpov3QYPQRUJxIzqS96nAOrTzoQVRzcIMPSSeQSuynvCqjNHVYrf5YhGA6app6pIstj/8jtY40yu3OhTrTpbTp7wR1NtAncvFTkwLKab8qGglFaoAluJu3rWZhUs+nj0Jfq7UdHt10hWyrYELu1obWUxHWQsnuFcDaGKibQOSNXHXFPH5F6GPByPYEIp/1FwqzR7ZQMNaMR9ysfRFCZT4V7DseVLOu61i49EWHdm7GyvNoJMP8CyHfybKqi3n4EHAszHT6cVD+o1iXMko22StltcrHXAbGGjHNDsLfWgmqpvOmh2TtLG8x4/+H0qWkRHgHLUWug== 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=XrXuW0UHdvIpj0Cmn/yEmOWmNOYOgPS6eSydCXg/ITE=; b=iQIujmG79FkDJ1pEMpyYdIkEIDDcc38IQ0BsLaT3uXJIaAmA9y/zhSCkAlzMR2fSFK5cwR5NU2qcMDHTKcfn5RWVP0aMU1rcN9aDy7TDdumgq2zUcM/2I1GWUD1nWJfQsz6ghhRqoZ/aYnVj0l1PXtifGDp65R1Eif4V61OXunzoYQl6niIk5qog9KPDVRJPp74jvKIpd+So7Xodz9/GcKQpelOT7axcjcnwRvH048hfQyq5hXQox9IPA9WkV37c8A8kR8LxtJoJv4D2ieoz38P5RZQ47FpZwIgS53apn+7TJTI3PZ7h8IxOOah2BSZVTnthWlxVqFEwvjd0DNs/1g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:58 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:58 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v9 05/10] phy: fsl: Add Lynx 10G SerDes driver Date: Thu, 29 Dec 2022 19:01:34 -0500 Message-Id: <20221230000139.2846763-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 23018532-6d86-4d62-2888-08dae9f911ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BYxsZTVJe01axIClzyqm+MCdrYzKb5XPL2JogLjzV4QhgkAKlAgNVaqRAQYcQqL419mRVK7u3SnQxXLVKZ4qjDd9i39a/s6vM6sL9vMnlF+EybGceaAu8/a8NiofGvj0eoUnVhIzB0WCUamIUJd55k83hv6cgfWOyLpYUvOWtAK7St4Ek8Gib/p+OdWTIoQq97UXZkF5W1OJTRo91NdnnDMrJAqTGW2mw1A38ob2KV8fCMqRLBGeLFqZ++nU2MDOHRKTdWl1p3ZirT40MJtXwXLmGX95lLcN63cXIRoKmTQi1OnL6UI83XsaPUGz3X0lg5GqExBGmXcrzWHmMXEWWhZgswXydoM7Ew/HDqlTmsg+he1SeCszhDyWhbgq5Pt5vMRva82wY37FZMkRrMPolE+8xR4bv0DVBwgxjf3x+F/eUyvUBaUwV6nioJNAJ2UceEQaMz508qg1YzM1f3w2ySD9blc4JetUIn3zVlwyCmMa6yn5HnDZ+aVmh6/tjudY9jsPPxKP9uYGlyDlz1juYOrEgwh6wfWjamX+zXvD79QFKXFYCroMuwHd5+zrtjwwecJ+5KKUyQwtK/zaaeZMxJPX3YeljLvz6hGe1gROCAR+lVpmFZ319SZizyOghdQn0XWh23CycynMxZecthoze3yHExC6ont8Rv79cKAmlYkXe4eK4Tv0owQoZVQGy3Uca16746nbGjxrFgPOYfSSLov99FKJi9SDhWUHbSQPG+s= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(30864003)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(966005)(6486002)(52116002)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: evhOq/PqvV5QFSiH6ZkFVMukc/1stapPRzdoFJDd7QRf5rjhKjlsiEZIeTUeTeRev4tcstJvY/VprmIl5xu5YuE55Atgu4qwzS84Btm+NZDxfpXBi9AIRvEsOuGErQgKySca7t85qMbXs5IZf7h/IOCgSDk7kV4KzKAs9CF5B0DXGQcTCZfUlGkQrbTxNgw3HbN/Q70N3hNlkYJfu+i8+8YzY0DV8eLTlo8+qlRA40M23xo0prqX3/72oMdkBefVIpffHJit5SlmgSeZ0SQVHPJKHplCnTvvg7Zd/u1v8zE8hXletlV3ZlFJp04ziT1iN2gYmaUp2xASHFbSIiBrV8pz7x0VHieucQmHE/ezK32HvDI9D7qsh08bOEEQ2z+p9FEgkXqzjkQyyxJaA3u5vaCG/b0tSIVDQKoRLClYbUZZLqGOGplAGob1DMvKLS6c9J1iyscNRAq7VSa2Fet2Za3b4HewwKDtYpWOL+vpGPVhmTGVUOyNpPLhYLRv5LHUzMkFfXddvYBA8hr8XeTHzGVxFMPRrFzc6cvcVI4qbwAfHCECtQjQKruXlsbScjOUdSwrOCjDMYYCfn+upJmSJ1tD/ztEzfW/2SxIzk0nI5fElaaScEqGikJj2ZYqQODzIG9hus6SfUc9ukWz+NMl/IMZd8Dzn0DYmj+x3CBGE3FtCOQpWteH4RC71lZpFkZTzCImD8pfAFTLdWvH/15Imyu7M3ZFDN0lMAOhGiGJcNVTEeu8gY4zXsxPgmyBuOdFk/qEqcoFIYm7vNW2PX+8jlrJjAywxHxQ7qTHdvhd1oo8riQT+1rtw+j0NGTCe45c4fuCljlPb1qmU4uBDyPWop5OLti9qR87znYteL/qla8R6xiz1cBy5y0/AJOyxa99nSmsuVF5TkUZ681kpyDYDE84DudGG08rjT9Da5MN5fiQKxbYqhasiyVk228opOE7rgEbX0x6419XvPLo8PXqdKQFL0L9El5H43bsIJMmyKMk30LeZEHPleWe+K/2UCq+OiZDOjlcLErT0zuD31zUoaROGqRQVFK2xFRazDPv93/1zIlsPZWPj1JSZ4/6YwJmyWdPGhUbxPQITvpeaUYrSyeOXgxsec7F5It1RRdMP1mrREU7ahOoX1ySPEq1KxzO9KYzn+fNDLS3q+s6vaiLR4DSG9yoyVV/63Ixl8xqaD48B8HLx/4x1B18OQP5XWeejdmhqBCfYhdtO+64UA0sc+0kFDYIFHkQpVvPq66mdyQ2z1TsrF4kYLmkQjKOqBf74m6jZS44HE8yyCjK3VRDheBkHFdP148yPp0uUfFJ1AHMxlhVJgItmes+ZRMpfe212FU+n+XZgu0bTx5uOp/Qfmc1eVRs77DqpPADdJwu/bcnOQKUUUiphtXcfXUmT5h/DCcozakD+vCAXqeksYYS5Iu4oc9RsZKyNu5PnWOTRRmNa43AC9uQUoLgNr//a83jOG/NJHQu/OLdYHji9wGm9I8c7cUqCK0rpbIKyM97BJOK0BhbEAjqUoJFXk1p4WqFs2EJsXcg0zbwfmC4TQiU2RdHbz7tESxiklqlm/XS5aGGy/Tn4qa/Pjs5lhMH5lUu+OtDG7Rmk7BYAyS6Xkq9Pw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23018532-6d86-4d62-2888-08dae9f911ac X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:58.0532 (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: VKHfphB5xBNKe/hWluC/Ivzxm/TeEvq2k7/7rLTMaX4djYBdwMMAecDTpYJ9tj3sp53vULRKV5odGUVuFMubpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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. 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 v9: - Split off clock "driver" into its own patch to allow for better review. - Add ability to defer lane initialization to phy_init. This allows for easier transitioning between firmware-managed serdes and Linux- managed serdes, as the consumer (such as dpaa2, which knows what the firmware is doing) has the last say on who gets control. - phy-type -> fsl,phy Changes in v8: - Remove unused variable from lynx_ls_mode_init Changes in v7: - Break out call order into generic documentation - Refuse to switch "major" protocols - Update Kconfig to reflect restrictions - Remove set/clear of "pcs reset" bit, since it doesn't seem to fix anything. Changes in v6: - Update MAINTAINERS to include new files - Include bitfield.h and slab.h to allow compilation on non-arm64 arches. - Depend on COMMON_CLK and either layerscape/ppc Changes in v5: - Remove references to PHY_INTERFACE_MODE_1000BASEKX to allow this series to be applied directly to linux/master. - Add fsl,lynx-10g.h to MAINTAINERS 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 | 58 + MAINTAINERS | 2 + drivers/phy/freescale/Kconfig | 18 +- drivers/phy/freescale/Makefile | 1 + drivers/phy/freescale/phy-fsl-lynx-10g.c | 1224 +++++++++++++++++++++ 6 files changed, 1303 insertions(+), 1 deletion(-) create mode 100644 Documentation/driver-api/phy/lynx_10g.rst 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..17f9a9580e24 --- /dev/null +++ b/Documentation/driver-api/phy/lynx_10g.rst @@ -0,0 +1,58 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=========================== +Lynx 10G Phy (QorIQ SerDes) +=========================== + +Using this phy +-------------- + +: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, + }; + +The ``mode_`` functions will generally be common to all SoCs in a series (e.g. +all Layerscape SoCs or all T-series SoCs). + +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 `. Finally, +update the ``mode_conflict``, ``mode_apply``, and ``mode_init`` helpers 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 c2802d4e61a6..f5e2d8188fa4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12277,7 +12277,9 @@ T: git https://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/clk/clk-fsl-lynx-10g.c +F: drivers/phy/freescale/phy-fsl-lynx-10g.c F: include/dt-bindings/clock/fsl,lynx-10g.h F: include/linux/phy/lynx-10g.h diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 5d461232276f..6bebe00f5889 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -49,7 +49,23 @@ config PHY_FSL_LYNX_28G Only useful for a restricted set of Ethernet protocols. config PHY_FSL_LYNX_10G - tristate + tristate "Freescale QorIQ Lynx 10G SerDes support" depends on COMMON_CLK depends on ARCH_LAYERSCAPE || PPC || COMPILE_TEST + 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 + some modes (such as 2.5G SGMII or 1000BASE-KX), or clock setups (as + only as subset of clock configurations are supported by the RCW). + 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 and clk-fsl-lynx-10g. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index cedb328bc4d2..32ad795be7c6 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -3,4 +3,5 @@ obj-$(CONFIG_PHY_FSL_IMX8MQ_USB) += phy-fsl-imx8mq-usb.o obj-$(CONFIG_PHY_MIXEL_LVDS_PHY) += phy-fsl-imx8qm-lvds-phy.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += phy-fsl-lynx-10g.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o 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..e5bf69576b28 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c @@ -0,0 +1,1224 @@ +// 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 + +#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) + +#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_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 + * @initialized: Whether the complete state of @modes has been set + * @prots: The protocol set up by the RCW + */ +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; + bool initialized; + u8 prots; +}; + +/** + * 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 + * @groups: Groups in the serdes + * @group_count: Number of groups in @groups + * @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]; + struct lynx_group *groups; + unsigned int group_count; + unsigned int used_lanes; +}; + +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)); +} + +/* + * 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_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); +} + +/** + * 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; +} + +/** + * lynx_init_late() - Initialize group modes after probe() + * @group: The group of lanes to initialize + * + * Disable all modes for a group, taking care not to disable other groups' + * current modes. This ensures that whenever we select a mode, nothing else is + * interfering. Then, turn off the group. + * + * Return: 0 on success, or -%ENOMEM + */ +static int lynx_init_late(struct lynx_group *group) +{ + int i, j; + struct lynx_priv *serdes = group->serdes; + const struct lynx_mode **modes; + + modes = kcalloc(serdes->group_count, sizeof(*modes), GFP_KERNEL); + if (!modes) + return -ENOMEM; + + for (i = 0; i < serdes->group_count; i++) + modes[i] = lynx_lookup_mode(&serdes->groups[i], + serdes->groups[i].proto); + + for (i = 0; i < group->mode_count; i++) { + for (j = 0; j < serdes->group_count; j++) { + if (!modes[j]) + continue; + + if (group->modes[i].pccr == modes[j]->pccr && + group->modes[i].idx == modes[j]->idx) + goto skip; + } + + serdes->cfg->mode_apply(serdes, &group->modes[i], + LYNX_PROTO_NONE); +skip: ; + } + + kfree(modes); + lynx_power_off_group(group); + group->initialized = true; + return 0; +} + +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 { + if (!group->initialized) + ret = lynx_init_late(group); + + if (!ret) + 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; +} + +/** + * 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_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; + } +} + +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; + + /* + * FIXME: At the moment we don't support switching between major + * protocols. From what I can tell, the serdes is working fine, but + * something goes wrong in the PCS. + */ + if (lynx_proto_params[proto].prots != group->prots) + return -EINVAL; + + 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 lynx_group *group, + struct fwnode_handle *fwnode, bool initialize) +{ + int i, lane_count, ret; + struct device *dev = serdes->dev; + struct fwnode_handle *mode_node; + struct lynx_mode *modes; + struct phy *phy; + u32 *lanes = NULL; + + 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++) { + u32 prots, gcr0; + + 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; + } + + gcr0 = lynx_read(serdes, LNmGCR0(lanes[i])); + prots = FIELD_GET(LNmGCR0_PROTS, gcr0); + if (i && group->prots != prots) { + ret = -EIO; + dev_err(dev, "lane %d protocol does not match lane 0\n", + lanes[i]); + goto out; + } + group->prots = prots; + } + + 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; + + if (initialize) { + /* 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); + group->initialized = true; + } + + 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) +{ + bool init; + int ret, i = 0; + 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; + + serdes->group_count = device_get_child_node_count(dev); + serdes->groups = devm_kcalloc(dev, serdes->group_count, + sizeof(*serdes->groups), GFP_KERNEL); + if (!serdes->groups) + return -ENOMEM; + + init = !device_property_present(dev, "fsl,unused-lanes-reserved"); + device_for_each_child_node(dev, group_node) { + ret = lynx_probe_group(serdes, &serdes->groups[i++], + group_node, init); + if (ret) + return ret; + } + WARN_ON(i != serdes->group_count); + + 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 %u lanes and %u groups\n", + serdes->cfg->lanes, serdes->group_count); + 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 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); + + 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 (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 Fri Dec 30 00:01:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 638050 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D82EAC3DA7A for ; Fri, 30 Dec 2022 00:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234271AbiL3ACI (ORCPT ); Thu, 29 Dec 2022 19:02:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbiL3ACF (ORCPT ); Thu, 29 Dec 2022 19:02:05 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F16E21758D for ; Thu, 29 Dec 2022 16:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OtX51ir24lPQBXyl7OvqMGvd7VgwcxTg6unDleovfWbWpFRqOCnOe0sDn4XCbsyKgYdfADfxR+Ljmsr01M1XC0QwloihNd+gsPa8ZzIIiJ9aoAkZso2eYE6MwO0cB3jxmOFJw2BBS//CXzbNK41GWNADZed+FjwYMrh3FwTJbcR3b0+/slTgULc/Kqpjyfu5BoCnl1p9KvNbQTtP6kEeFlyCBfQLqhPtrdy0ayY0kvxl6+a7MmnOuR5sWWXR/X+vlcSBWoO3xciF+PjPx0k1uo7yGIA24bxi0FfRMnYz3s85oX6iMtsAN8hVHbmzkmdXQLnYt27UkZew/vZMcIYqkg== 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=IgRAFWiZkZEEiOK04PA4RWknYHGg2queJARxsGy6XrM=; b=jQjM/L4UrgdVGqYpRCqGDLPFLz2t2xCwf3U4pQTOc75DZA1C5UHG1xI55fG6g79PQxCuiErHMnuSNcUOYeUz1cCq41+sn6vL+wix4b57dg+RQBZ1R9NN204cjjCrIoxOa4F1Ukp0qepIceLED/UkqxLL1N1Uz8Yr9mmlF4krHKJWKdDCp8k8hPJOxJ2Ld2xvD+R1B7jvRW6lYTfZqSMist2Fuzfdokf7pnOpMw4uqhObNg8sJpP+s0abTagHArV7IkRJvHCer6fpRQjc4YPZ6X/r6qQUVSPJRimJxuEq5gAwfusGTbqo4kXYnsLtn0GPchgNecSp0PCcl4xMRYFWUg== 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=IgRAFWiZkZEEiOK04PA4RWknYHGg2queJARxsGy6XrM=; b=t7CYxz85U4fgGQdfZGNiyXSOB82ABzvsRJZRRJIWk9ewJBpT+kPYrssLCHuMKmnVpnXiICSh5ZPjTRyGH/K6DK0fz1tbjqdyBhJgZMvntjUX1ix78XS3QkjGCtsq819gtweiP6WGa5WZgavAfUtM+N2AylMf/VNguGXAVy7Z7eAZge+mHqcleudxxos+6WBGG/2h5972xniNte3fs0ksyzwEeIHWAVSx/Xiqp1AAqpTMcFxY72pHRkuwls63Za/QkJtTmXlXRMXO08f18zhgOrQ9mg+j6uEl7CF2+16eWup73tFRq4+nw+EtrqvZH9I0/KNOerrCtqoYl/Y0N8QzBw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:01:59 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:01:59 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v9 06/10] arm64: dts: ls1046a: Add serdes bindings Date: Thu, 29 Dec 2022 19:01:35 -0500 Message-Id: <20221230000139.2846763-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b4e1816-a4c1-4167-accc-08dae9f912a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kbZT1mL00W5tzMan8S+CIKP8WFxBridCA5lyhhapBJjDaFQc/ofGHgmjJI+QSGYdjsyMh75wHyN9XXVpvnL9kAAE6mlMuRhpVl48TTQQsISjjjeUNVDrPBHsukZNFHlv1yDs2yDbk/BlGl8UCP97xE0qybiio364/WfZmwtNKe+iIHX/mXl69+myHZb24jf+USfMWl4POSsQ1LgGAknMdm7mc8wu0lywwfDF7wZdEQu6VUeh8iwj7AA/Wv/UdZpGlRjWxMCC+cm+T7vUTxip7K7kJ66sB4ZHWaLFzQnT7NK4tWKljaCDYnHuRzJ09/Qrzm6KLMU7tggN7q7pR0oc9R/ZXtDSONr/deii7jbk89Ku5UHF3vnjT2MxJ7ekhjx+6kWw5Hw6bH07gh1zX9A9sUmXO5D+8Qn2IEJObp4oaIXFnEkDN6r1zErSEdZEbmcYSNtNQRJi628KUxvzcXEe98ubHOH7UyVPrLjda2Texikz4H6hfuVEqp/Exyarq+zb8mxBZCIPm2fr9EtyieOuxoCQUuBagia+np6Vw0GjVHlymoKq9sMWmgcJQdwBO/SbMS5Mgi+DWl7FQZMZxM4kczxCc9f7giVuBT093P5iTSiYrdc1GW5cjH+mAEXS1odRVrOYLhirEbboBWWv89Npz8Ad9efLV+0q8n5Uk5JeUdQ/t5rMd2M0We+4UxXI3fNu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HF2j7MQl1piPCbCwCT4kabfgWuMwzPXKF+86k5fMYwQBEeBlLn3mmrEyrOCF7ezoylPPd2IAm7aKHM8tLeggcP/ifhuHyPzV2FpReKrP0KbcBDu0oJzJfbSNX/Gvp4gyxzG4nEZRu/bjOzZdLE8xcHuVwxyIyYqdql2WAUR/zhqn0bYlS4GVoHWLytAscrLjpkFcdh+HSBYzY5TlKO/TGbhJSZLAtVDpa0kP69sUA5JMZfgW6K4op0j8f78z0JoftdmQss82mkPCYGmrqE2PZKO/5pnC2bqyFA1gIQauVwj4Yrwx34ElWgkp0VtR7EsuPFqYgzY43ATE8Siz/OBmbaKdu8lJrSTT7Q6xJGqfKbImmT1qK8uLh0YVOBAggOd/JdggXkJwKHB9wky0vXO97O7N+9Z6m0igeO6TkpZuPIXKdCU0CQqgselvZOOW4aSKzFeI8vXINqGslx2Oewvk4N5M5ljLD7A8c3Za3TdrOFfthINqNDgvBLrtEX6Jpd2m5P2fVL9E/9RTVm8/YF4ZYnOutZMzHe1PNINR7A+DFpPsY4vE185frZLZKfy65IaJZtxeG3TeoXLJ7GQV9bZLilYosTFHEzftQx72ONKelk0/7VeZZqkYSdxChvi8AncuVeI7sFNudkT90RFV+FHiMhVUqRQ3Jhwcpbiowa5QmgNoAhJQ+/Uyw439A1GDK5Zniiay676LhjkLG4RFq2sKFj1+Gh2SBsBxCQg6wopMQPd6nOzO/ZkzE86RIJT5XBIYdPjXgJBmseAeXYSRi6nMLB5KHOdf/h4VE4P9/mWMpRxZjS41LFWDTLsh8jSBZ7JA11jm9hU66/RMb8JXy6XKoq5HHnVVaJk1QAE/S3u9eH7lH2zhdRCX034b+P4MBobIYJGiJZLO5wvbCqCtFGL0FL6mH/iEA0u/ewoM9+8KWJ+XvpifrvoXosrWLoOhrlspnYXKPbwBBMX/DTomIiHqf0RMnpttGifSk4pc3if/Ler6GL/a1Ue0fDCssP8L0W+hlwVBDdKgV0s4AuWFSaaUNLOPWbxxD9B7rVfkvRWKzxddY2GeFo7IRdvbdvH0fM4Q0PSTStfrJ+WVQ7kQTvECNYIxhaCvdvkqCvDcFl+Te7k9vDKqvpZ0SMif19a6KkKpcRl/bwRVAHg0bS0nWRijxGK9cyMwblrsgccOhWBCIWEsCAG1/s7JhRmHK7m2lfZjoRjddmk/ZLOlxKoCFsFYPxhmvI+X1sgIeM7XLVfGjwqR/NMbXyo9xM0W6dyggkV7Fdjd5A+Z9KEBRWOsagzD0groWc2xFwjxBqUhEBBNx1eZP7TKYDPvrRO/e+hEjtalvf61Mkz/F+VEYdsMHdwlynI93TJ62zIhp/xnsH04qW4nZT0oqNDa1q3bUZCGb0Yr3t7g2Z/vxhjJ2Vdk9reRS08ba8TqBlHB+8VQ9qsga+/nJvBlguU+ecA1rlaDEX2UoEitiV68ANJ3aCQynw+QGyS3+C7uGqIhJN2Ij17HoRytEDbD11ZBLh2oIaACcz1ACsVJJ5QRly7aU3G0V8uxPUi7eI8CeSQ+hSHY1J123xFYi5J/DLpWPivUJhIcgQyqQCcRsbCRtg/sW1wAsUHOfQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b4e1816-a4c1-4167-accc-08dae9f912a1 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:01:59.5842 (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: SlGQSWKRh5RM0RZCS2i6wJk6mpKVf1BdQXB2r+o2B4wmfG5Yy/QQGL1iPnM7nPJjo2iZzdxGHxoUZ2EZfmk8fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 --- (no changes since v4) 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 a01e3cfec77f..12adccd5caae 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -424,6 +424,24 @@ sfp: efuse@1e80000 { clock-names = "sfp"; }; + 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 Fri Dec 30 00:01:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 637642 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9E55C46467 for ; Fri, 30 Dec 2022 00:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234293AbiL3ACJ (ORCPT ); Thu, 29 Dec 2022 19:02:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234196AbiL3ACH (ORCPT ); Thu, 29 Dec 2022 19:02:07 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103651741D for ; Thu, 29 Dec 2022 16:02:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IyXQK53xOkxV+14w69JN2bAHBWjVGL8lNovOlKOrdIkcl91HLOBRBSzNKX3fk0havGAHal6rZcSZKnj9/S0I5k/qd1HGB5MGlsUxeR4ytkdvFyOkhi3gqFbQZy/nhULR6OfU/MqGaO8E81Bt4BrS7zgQdCUAT0EC0c3+dUmxxyqtWRDfZC+dcbAHQ46aw8uc4cS5xkPwMj/03Q/EvZDRA5bKzRTWr/2Ls1W5qGtQQq/RfBkC3IIqq8WTbn1TMDSvgZDQiz7pe4cN+YlVKhrT9RSrwxmGYYJuJL3iRhy3E0hl4WszOn4GBoHIvbs+YKQyxVaN4sV3FCWiqM/Cy3mpxw== 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=Ss4qE5zrYYzG97ZHWTTuWmTqjeYEzIGtMjzy6muwERM=; b=bYfbQZy5z1XthaDEU4E6HxShSoyf5s8xCY0WbnLRDewDHDVkRe1kWPvOYOrjLCdYQBrKw+D14khJxcn7LXgZ/HN/3rO5AwN5OCV0R4KSBCgBzL54IN8eOA6N+2LJgu+SgvwZ455YC9iwoOF1y0rX+EofSPlFFLDXN4mDPi8wWffqUoq+VWpKgtZENXmlj724FTtdgZ0ij/eDGlDnKoYfdl0QPN0o5ovbNEA35XVkuA20UlQkcSMMbRItrwMLhCOiARpBKe2JsPfyfdkwrrxcdUqkY6irkS5vTWM4ewx+tsanpyaA8FGxvRa85GxNqSUsffciF4c+SAz/BDLuxsl4DA== 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=Ss4qE5zrYYzG97ZHWTTuWmTqjeYEzIGtMjzy6muwERM=; b=Blmellj03sdfv/KRtE8ojC84CbQfb6fcqGNW5dOUY21XJLyR8AIZOQ8vBFWCU2M73uhJre1NfB5+SjJaQ2zhfwwhfWTbKR69Dq2Rk08Kp7ly/GNCUgrS4m8dZ6vhXjkiP7J1eDNPv1zfrl+5S/hjez04BoqItIxAuywySPq6E9cP5TiAwvktl0wPydTKAJ40c1WynRRmY83sjzhteYRCaCCGQmowmaoAEAfwDD5xaQX/LfcXLI8FrCxoraVgeyGLOI4WWNnNstySIz6ai9perkwPmDcpVdL0sw2woarO57D7wQJeRXFFkyAcoLN2auuN7CxduxNd1YC+9uypwH2W5Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:02:01 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:02:01 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v9 07/10] arm64: dts: ls1046ardb: Add serdes bindings Date: Thu, 29 Dec 2022 19:01:36 -0500 Message-Id: <20221230000139.2846763-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 90a5ebc1-37d2-43e0-44e7-08dae9f9138e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zIBucs2QKOylxb6jmciLwAQLvS1Q9p/8V481UhKnynkS0iTawIzbcMDcjD4epG+r9Lhsk4646lS7XkKl9JaZ77v7u+ZFrQ2GnKLrIpw8ODvlX4sEys/RBlHKs5omsjQWIN+14I5ePcdTSfaNZmBt4SuzRqNueuLsR4ZjPQY9NXeQR2ZQcWhoiwBvtnN21ICjY4lMhpad2b009yk0yaAn9z17X5gpN0n7PGfrojZ429XftMCSTrNacET6AvbGhfWsR7vTlgGVngQddyvqALAmQmMJi7yJFhkf3498RzI3ETc9CECIEYzjDMzOaVco+6CGJfC0TRvUBtmnL6vhD4QX7rUQ6qTE06HxYIBrgZl4wu7h4Uu78tj08n7vYs9XNS6ekZwx0g8TQ8WA7Mdt95xK6LEfpOyKtAIvraPelL5Ha/N7S5o+7nKUASp/iA3kUmJ84y869Sl57wavQ5lgDtWN5xF1pySXn7a8EnKPGaGucbSmkJ+EpnY7lqteLjPjj8GVqFtBELLPvmJ7+TunwhhyMRsnKHecPY3Z37GMQ9AW3ZKHER8kbOcS919A6URTCL9wJk3NcSPLQc1EffX3PmJ4tU68vTY2d4n6YnZFebiffMg8/tslLlNr8q6q4pEphjeTkHJx9H1z3FIhIWmPnEBPJfSS96EbvcPsIfFlDCIVVFvpob4cesEFiHlGlCeCLhXM9WFggNW0+JtZXMXFFi52uI+MdMtrjof1OPKAd7GagrQIekjC71aIDTk1LDU77w8Y X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(966005)(6486002)(52116002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YkAmMkNoka4gBMPe7uioKVXKZXoQ3TGg2nWaLd8v32aqwlH/0xpT9pkcVRQCSZxbohxzEfcjY3ifchpXoCBf9dB5StEOFgiUuVTIqSpc1zBXdLqmk6oonDWjZO42t0GhBAMsnHE7AppnGPpuzeFNzZj52BHs/QQoNShgtt4lG9QhpdFHdI7FQLxxZynRXHIQvhESZRKJUtkBmCqmnpj524eEQuXpF+7jLWkfEwCmPXmmL7onkSfXx1AQG2Jjt9pQdZu0Buzo8u8tgvKmMN5BAYfz+k/2mCDMOafDFsNfk0WhLJgfNbTa20/MCjU/dceMnEc7bWOJrlBcXiTcQwUZsJ3tvSzA6AWBjAqhS5UM5xsbBGxg0E1HH9XkA5lYGnemRVR0xYmprrIrrPBkO5kaewVYNUBxvgj+nEMjq5w9gjAyOfNyMveaQviOKcre/pKpVcq2nR1ZLTpnyw/qJi/ONI3uWCirVjdDC5EpW6SqgQn0BFHOwGr26pXGbQEdUg1ENm/Y3/8tY/tj7Pi8a37VyHhJ2Pc37C4qhbeO8r4dxIg5reFrYViw56CwbToePKgTSqmj2PTcgiEYZRzyGkHLqJUrNbPIeV3xzRwasYrHmvH9l8DuMFLTEgX3x5duT1m73Gr3TyY+K2l1SWAMiyAgHP+E3F5G5GmuAO91TgtaOGvexv+PjA0r/noIR3h9MAyo2ldhZOWDCB3OqbQeXSCwP1ET/qQUJ0ywsMMlcbhDQMOFeI6ocjkrQJG+Lxi/X4KOY37UegH90U7hzX4WfCyEIdz6KGrZAC08XKj27fseLuYODmnNRqcTWH9cqAJEay58W6tybqwCFW0mHsigOxIgmvDImPSmdZA9RV2iYT51w9i1GfMmlqbwyj/DBRLJtRaQ0pvg9S/UG2bbE870gZv9M4ZHwibo1y7cJRgAwmNlrkWfe0SgehfXozWxap+Fb4ReRs/BParvcPoa01meyAIYc+3oYn03DbntGDIKJL3/YaY65XRG3NSldEOfcaZlnFV0aIS+3CKGH4ZyWPL/yAEZTHFq9ACBjWY00cjv6koFIIFf7A3rqEzmMQVnXvCtMT07YL/XcaB4dmtmK1oP8PYMofuYAv6nRIdCJ8jPJF+cBnIAGrgedarwklMg7ixuw0/P04QNEBlORdwAC24sb7IacIZ71v58qyJLDwiNFfxQtK70xg3Q5dFq6CpRR7but1wl5fu20nwTO3DX0o27EelfwsNNrF/xC4aHAyU6OYp/q67RMYk7tlJLP4UT/Sl20cUflyljUSWnW5R93cpmRliq8FqGj3YWIWnXKZcyDDICDo71Y2FH7WQrAg/XAv3l8Ap4hzj3UOXB7dqqOfUmdxnQFf5TMuJ5o3nBFdrC5spDyHG0yWVMEJh53+gKypbbe6freWD+dZfmxPiY/0+/GyJmnAlm6VuDSVKOrOeEh9pVB/hh425mIi1QBfPZloekScXV8q56Slz9p8HHS2AHk6tKbKZ8f9NZSZF+s5dr9TVZ5iIf0ZKrGFiWxi/vz5nNDf5MHrYn2DHHwDdiXdo5sRawhnfPJ3cT42AHrlGtmvDh3FeJRHp+F6iuMIqmgQLZlqDdHDP3xXQGWXIZhDMJ9m21gg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90a5ebc1-37d2-43e0-44e7-08dae9f9138e X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:02:01.1971 (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: x2FdGRd5Bf5Dh123w9j27guJzV4U8yWqK3u70dzX4+QZ8kpKHthFkiX5Cty5KDhK57t36VMRfPbbBg91nNuvCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 v9: - Fix name of phy mode node - phy-type -> fsl,phy Changes in v8: - Rename serdes phy handles to use _A, _B, etc. instead of _0, _1, etc. This should help remind readers that the numbering corresponds to the physical layout of the registers, and not the lane (pin) number. Changes in v6: - XGI.9 -> XFI.9 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..534f19855b47 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_A: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SGMII.6 */ + sgmii-0 { + fsl,pccr = <0x8>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_B: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SGMII.5 */ + sgmii-1 { + fsl,pccr = <0x8>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_C: 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_D: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* SGMII.9 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* XFI.9 */ + xfi-1 { + 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_B>; + phy-names = "serdes"; }; ethernet@ea000 { phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; + phys = <&serdes1_A>; + phy-names = "serdes"; }; ethernet@f0000 { /* 10GEC1 */ phy-handle = <&aqr106_phy>; phy-connection-type = "xgmii"; + phys = <&serdes1_D>; + phy-names = "serdes"; }; ethernet@f2000 { /* 10GEC2 */ fixed-link = <0 1 1000 0 0>; phy-connection-type = "xgmii"; + phys = <&serdes1_C>; + phy-names = "serdes"; }; mdio@fc000 { diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 6bebe00f5889..b396162dc859 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -54,6 +54,7 @@ config PHY_FSL_LYNX_10G depends on ARCH_LAYERSCAPE || PPC || COMPILE_TEST 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 Fri Dec 30 00:01:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 638049 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB330C53210 for ; Fri, 30 Dec 2022 00:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234194AbiL3ACK (ORCPT ); Thu, 29 Dec 2022 19:02:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234141AbiL3ACI (ORCPT ); Thu, 29 Dec 2022 19:02:08 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86AD31758A for ; Thu, 29 Dec 2022 16:02:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQ0yMYwz19kgq7urM0CbVHF/llUX48+xeh0Q/J47lKLIJyYpoZYAA3pJ3i4sFQzboG4cbMyDSyy7d6iOQ3DwEQXGADgKfA7ZZdbNPerCbLcN9+pzKIzR7g4xqQHX+urgrJHZ6YEZGdRoL1cOTRyQ4Ol8zez0R5C/7dmH3aokcz1wd+mLBu5JFyosVZCNAzGY2cAO+JK014BE2IC/ZHflep7j7liZ7We1Law4wNJ1Ip8rAvbAHCIb6QmwFemgDldQNPRmlUhiVYmr6B7xAPkZcwIl9jneeDdTxGdanqSSp8Hnekfd9LSFdhitacM2C4pO3k0rxrDqQOGflYQdj/xLiw== 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=gmXUHDEBebltIRHzgNcQIJwyOttzR7k9ipV0TPqzEnw=; b=PY/vyii3cBo0BjSDp5rfghqEiO+Pz7LKmr0czS+r9DdozAmCkFaxF9WGG8qtV8u+XcEhfeGpWwW8u2eam3tskqulbFgb2ypd/CqOgsmxMlMp7YINyBgz5FZ3RmC+BS2lEB4CQ3EgGe+XBF61wmRw6dDEPEhrL4e9hX+WNdgU7oxzPunkOyYTQlGGvjnbOrrMbxlPCSiurxy9bWIGjdKL311/UU52BuwGZWYzP5W9lhqvN95iQyzU7/iMGEUmJh4mHADYrSKqn+zYIS72cKzkY7pmaJoNk7sNQC3TMf0WI2SiSuSD+vCWm9ucJwRquptL72oKhi1EA93MLSnPgjFIBA== 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=gmXUHDEBebltIRHzgNcQIJwyOttzR7k9ipV0TPqzEnw=; b=KWkHoI2aVUCTSONImu3Zb50AA1a7QVrWjpi18IkVYIcCcm1Q9W/W1wnBKlI88OqfYxKwyiwVHvEDX0kkI4DRcQ9ptki8Cm6loOKB+CfLt6Y1svKHENdWkIM4MYpHgls8rX+LObFaUZMQdD0B9uqCb6Xc94fklXBuDjmAjVuwjwvpQT68b7bvxFkb4MhFO7gMjJDAeE9Jf45oy8TF5uSLjcwc3nJ5Y31oVsQ7iWDQpsgd/GC3w57X6QTSmXUSRpRhSSquUOrtf16F8RxvsSLChozI32MlELJAFRGPJJngKdARO4baKJeV5cxr8TQjrulOT0qmZDhA+199DJ6zY24EGg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:02:03 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:02:02 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v9 08/10] arm64: dts: ls1088a: Add serdes bindings Date: Thu, 29 Dec 2022 19:01:37 -0500 Message-Id: <20221230000139.2846763-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: c7990ebe-1dc3-4318-6385-08dae9f91483 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CW9OkyAVzeZhBMNExeWC0TGFqzZCwO/4ZBWwnThrweBvqSNQW7wJW7WNZWfHKGWCly4Gy3E4xZy2Aykhfz597Et0RpIyPbEmNMnktS5AbaKQYF6pRwaWCyRhqiFFiF4L+K+ShVzHWVFHl0CMJkz7OcXKGoRPAULBf3ziUOgg9vBFVGJ1Bj4qzHRFzIkgS6sKINTaTl9Jv083yGseM0sbRYSYh61QMj+Y3uQsgtgmJh3QxxlTbbv/5uHs2AGBysXqglYbhARaeIO2vYRYsS67dP/RBiR6z/PC66+CgUOTsrlRYsw5npIR1pW5EWEresOu80ax5/pQtqqilPT2KDxS+YyD3QSQPgsC3NUeRBRW8C3YlLIqX2qQpN+4HLMpMEH+Czlme9mcX2I02e9uvlj8uGIz4rlYaENAPNQwfQc+eyuxy27SE/w5w250r/cy3QYWXlqluWZICztNQLuAcjRL8vhLb3zr/N0TLYdLFRt1xChMrsE+9GuQgKowwz07FsrmAu9iuhevQ3C/O9MYM6PvSjZJ+2RcK5oqfHQr+kR73yBl82BenIP/9wnQuNRW2daffMXsZE+JAzgl3CB914r1LrOEJIOTh3cxHXpP1D1pKhV/tI0vFJZmrjAMoIc4m9IUO6OzNZ3DMXl8YqzE1bsw+xcNH4M93e48x/ZD1X6Lgcs/UtN0c21SmVQcAIsIj3SG X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dft1f+x/E+vNrPAordE1rlxOtIc0DnA7k/c5/S+Sx+XLGKwO0gZqqHB9w4l6xrRTlBETfqfjgUjvNP/fMzI+LjjuS8Z223uRH/iQRHputalmQRSW4R+2rr79+Dk+b8RwXWggzGb7GypfSzhGtAl1CdYyjueqQ1e7ksLDy022l/pESz9nHmuH/eCkzPma0/JPKvFB+pbz372eEbnUCbuepFrycLw2cO7G3S3Vki4Xlfrkq2gWAFX7jvG4NsX6yOtPdXEd9CJ563g9kviK/fHWlLBQa+VcuVtfkdjzpYlZxE9B0uKLKPMXFr2PC1FTOhnSqcOk2L45LSx4y0Yk6U8JPnu1jsP9z813wmV2htm4CfJmsI359ms2h1FY/Z/QhRxs3Cn7sVODeh0TPvpsV0JOVzJ1jJV9Ar5Go+8ZU61UexbN5Op4DWUg9B3za/fkQeNQim7nbPxVDjO0ebnR46EX+vsoh/ates4ozKVKDCf+6W1yPsoFrKZFDoYifBRGnqo4Ey0eFeXBeI20TZY98TuK03Vrcf2+Q/oL5Hdxm7Ar+csWsJUuXJ8I8NaaxE8agPDDJVVwTFfoaQ2nFVCB/SGs/Cu6Ssutw+fJzF+HqjpGnn41TM0lIRJV4/LPmCXzGTSDgcoHxNTGha+CKIucpvD7RIgLc81QIxlEpZncDgOr95ZFpOdFi5kJqchEKsuYrqBdLMuVKxJiy/pnA5IvW2D2jq3fRMZgqZ8wO7imlkQ+SA5PtDPSTdaFJW/wIKOqDzSxejSIlft95ChGA4/99XtrRiugaOi01FvLWiU0bzsxqnYXHk2Xcf9n9EjirS2q8Dx8FVb+kIPKomKZolUylzZi3dSKAffvuulaZoJEXIN0YIiypXLhap9CdOoncn7pAOcQFarAfeb155645CJZoZWgp50K4DSZexwIk9mPejanIwP3Uy++Wr+Lukjeb7Q+TqCoT2H+viyrjlgVBUMWx4tnAzBt4xknW9cZO27EZEHoUIWYUA90Cl9IRXVTeP6pt9PR++bX/MdJAc24HT4VdFpsvh9TsVmRKF/i98Rsv2zx8dtI4NUvwrJlImAsg+EgIunycWxFx4Acgn8x+7D/JZPfZ66Jr8+u2gZvCOczGzcki8Q1K/QVPf5J4lp0/AI9L9H7as12VEI6o62awRFlpnluXGdqts/EeCw+wziCK+Yj6JtvGtk7gxhUu6gdydOLzFMYMz+C72WK5colvjiYvevK2rvqeKZSg3g7cSKWMiuNGHbos/Y75lolFGOncpJqpjGyPfZS32JFK+Ca/KopMDYq+UWXGYT+R51aMWagwJg7g2ZNWiPNzWx5h++766D+4x95W1ylb/3/SBnB9WUmaJI2Wtf+9q/HC2CsZVEKcvsmNKHMFFTjr3VwJFwJTuKLzCSASSp2MO5pyc+/KJ6DBKmEqMUa2V4IulbNjzSrD1ipcP68bOi1UKYc1WSOqDCTmff6ecwf8wpOHYKJn7yjYWNGdOI3DWotEN84Rx0zcpKg9W6hRkjgxIPFWmxSonquEiaAvtyp70jyoZBVORpOsZEaqcacbmX/gyjVK2z7PngbxCvjsb2SsTRtmO1zKowX2/PYq8a8+wVhzkqVgA/coV+WJw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7990ebe-1dc3-4318-6385-08dae9f91483 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:02:02.8661 (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: /Ku9SaZcbBv/ph6kQsakeZkpyrtSOvpo77S/9nsD6flD+D6To/m2sLfSSz3Gq/JTsKwxD1Q166Hu+HHsx6QMBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.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 --- (no changes since v4) 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 260d045dbd9a..ecf9d830e36f 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 Fri Dec 30 00:01:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 637641 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A498EC4708E for ; Fri, 30 Dec 2022 00:02:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234196AbiL3ACL (ORCPT ); Thu, 29 Dec 2022 19:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234204AbiL3ACJ (ORCPT ); Thu, 29 Dec 2022 19:02:09 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 646651741D for ; Thu, 29 Dec 2022 16:02:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iVgxRMgT5ovbPT7RnmlwB6jyc7JT++3cIGyBhEghR6lmtFigpr5kxI26CZeyIUyVtR8keq0VB0dFD03DU5pLA9mkPRoJvG3o14gC8AP6r4IiPr1GW+pDBu1cWAO2uf+X0a7RGqOkIPOHzSChNAXBpT1wK2OWkAugR6obX+9HaiYS6bhbU2iyn6kelWEe8FVTwIQ9X8199humS249PU3Bsf17dlvthTPrtYGiGwv00TfrIN0kCJc/LmkjyWGQ47BloCTZGq6GXnzH52Uoc3pu+gvxwuRcS+9NuCpoJg63g9GUzsuXR3UCZMFhxyy8Ezayjvsrh6kS0lXvpbGLczFnCw== 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=8doVtU5aeGb6h2WadHtENFPYKFwKAzaJ/PBwvCu+7Ts=; b=BTE7nk8DGTu98lbIibNsghZK4dHhuNODeOUBr1v3446FKgf8sscxZWGcYMwKfgdw7PwPozloraPC542n8TOri8sNmX7tObIqqXTEZZ3BfdZwsM/N/Vi0nONpi+OLmd7MIrvmr+bkxss4oDa2jxPhJVU8IzgfOQbpdw713V4h3sFDGWGoyqk94srnPmkpqDlGvRs7aH92UtXt3VZ6B+QzAuvREkD5trzBNzCA6aM5HXlswLmGYfU4dDrlGyKJjidh2Rv9AQRhBDyCgYzJfYCAdGz6nqPNQP5u7dRIipglx76bnsbrTXMwBo7pHPINSchxnsWXDOJ9ZhZhW7G3BnEbkw== 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=8doVtU5aeGb6h2WadHtENFPYKFwKAzaJ/PBwvCu+7Ts=; b=sdtdXz+1xyweEVpX38oRVne4EeK74+xqgchH4QX4uF96heafzz+ZtOsymF/XjndSW+Blr3TnA9kUAXcthBERzFQjrRUQRrgdxWR4ZAJ/5WrvEkSF0ya4io4mCZmY4qqd6z28eD2z8CijJQMXl1SFopd8kZZ/vfleu00BNB/BOuXne9UDMyjkg9BebnqI+nFIkDjcVIsdrsfRGeG+CvazXtkKdwH38xJXJzWRyJyTjQpjQpTD/LuWYmuE6reoaBDz3wQpVG2PB1bKoTRDAlPNo8klSVD5Rd3mQV4R00Qq8gIXF7YorITruH+xKiowgjmIYVEKvnMPBcWHin1Dzz7PXg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:02:04 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:02:04 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v9 09/10] arm64: dts: ls1088a: Prevent PCSs from probing as phys Date: Thu, 29 Dec 2022 19:01:38 -0500 Message-Id: <20221230000139.2846763-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: d837e351-1421-43ec-a52d-08dae9f9158b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NtBxawISM+qWVA/IGvaiSxJM47OoQWwaxK6movfmQifYSNwsMPLLPq1U+/3v8nzSgnxuQhji8R0i9pz/2+hkodjtKOTLhMP8IYabcoyj8JJOz6EczStvvQe0Q658nk0snBQr1ndJtGsX0Eag/gevnbFu4qQsoRmhptEJ9vJ5J9aOK4/yVciAVaQvh9PuQlElA58iuW9Xp0TcAC2QSVFtHX4/FzYGkdQuUWNO9enVHB6LrXXotL+tO8w4ZEjzN2i5UpDK9wXll1Ie+LalYf01W5BqX1lYBHkett7f9DzHmHBOiUicLIXCzpdAhUSnMrxiNOcbJkrdeFUNADTtF/BunsHH4aE/xh7WcLCZa8j0Sj5wAPC471TsaotjZS+lZfyThjbXZtH0A8cTh2brx+rwgTxtCw/eW37yqEzQ4g2SQ42IBh+wI2/SY8oDerOSewG1IpxOSK7cVrx/gDPNehKOROkufIEzbE6kRNUGiPNW0GfFTmR4jZ+w9Z4F8w1LrxNCI6cQu9XZzVdnrFeoFpNOdFTVvrXGcv5TVzwnO3HVorjlt4/Pgj+oCjR8k7YECIF42o/ni0rude2zJQo0J/8ijqsPD+wHAqzc9FtSYVxNGSD9JP0TIHOcQKdFZLjSF0jaN4Zs4CcPfFrD6UredrP+UPb26ZlXV713sB/HoAgGu0KGPmzgN6N5SRXULh96e8ME9Q/FS+KLPAtppXJoVQA0ag== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(6486002)(52116002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IQn2z/riFiqYhvFutRcFiawoYBxvGmeb/VbV9XWBy1XAEjG3Im1NHCElum6rAC44Vl5BH73RH7/cuPlFDLVZYs7Q7lSIO1Exb4YDUMhVUSUmgaSKGpFLiwsYSR0N2bSkLbnP0c5hhhO2TBTovZ1//+KZKxI7AsfB7lWXHan4jigLyWySVrAemDR1F1ywiZwkkdeWmyOULFv+vzCs8OMctakhjLmByCNcjxoZJ0iC/xrHIQTPcDG82QNdLYLjKCseqaiR2ih9ZzY5v5JCazkmXpzC18tjyB/DZznFgH30zNZIZQk/aYZA1Q2zqASWdsjg9F3G3mRA4MFIwvvhKSksP6Ga3M9OS3ZiYh0hK1Qb7EpmD+9aYZi17c7n6Na326913em2Taofkh/5QtKUqS0iqKGCpTxRnNOXZX5R3MnpyQ6r8AyTEpoLBy85PmABR86/fWMPBix6Q/Y3mnXou3hT2zp6D757c1Vl0vXJQb+XYdwM5bgZ7eTbkBhzuK4wfB24119AtNMIBRvEf8l/qBLnYisMmpdw5CARikq7+ox1xtWfQnIC1MwxyM7CfaMUUeJdo55ti27G3iWvaPm2NlJ2Q0auoNREX56Y9sOh4Rbxb5aX81LPed7GeMA7FFMBtJ+F58C1k9V4PKUgTNTYXYrSF+RFSevjS9xgJGPlKIGVmvsO8p7TA7PxValXQAZpabKsjxAan9a27qnWichhxPBFzoGEjW/QdSxOtfOYQnYlvBkSQ9NRnuo5pp3Hd7CxtApfgp1pMQNseNZ3nnRxpgohaAdjDUqCVyzfGHDnt6/7XZAdBIkpWK5RwksO8NZcvOssWAquHeJ+FsO0qAeeKo0jOATpHH8m8C6aJsKrunjMqxar/rk4q91fORf8gqfHSK0aiTvT94Oxn0roecsvpaPEQ5+zj1OgKReJjh9n12pHErDeRv6IkrsiqjhnhGoFkx1/qUT/sLyiRz2j1SMdmU6dFtDh5+J70FhJuClcFL3O2bZ4Hg6BC26C/5BKxbBgF+NBUJKb17igUMYwKiVXnPiki3Ubo8iIE3/sJ9XhKCL8089/J/euHh2xD2qSyMlzw6girxXFvVaNodc/UjmqdcpvV9JqcRCxPsulcF0wegGeY0fWfiiZQFRYPpM7/vtF7ATXQOnH/IqkF/Fgq8V1tWLNRJqCYfwtrl/maTZiBsWtfXHKlov0ZK1dP/rfaISW37LnMvSYt8vhtCCH7Tna/5YbyV47fUFLcZf8WdKDMetVHAiVLqqd0hqKmWwUa3e78x3SzxFCGPC7bQx0S5ezRKRHMXPhRWlM5TmD0jeyWUR1LeIKNW+IB5yoUaVzH05+W13Rk0xaFtIyZHtOSyiG2VVcdP0WLzt2jbTahvoXwHgBx+1kveSPBdzDjFBma3mlAkqW8ZYLCCLYiSF7n+cYzJM11IvRs4OuQdYom+kMpOjI4Y15IV5rkpomu3GP4jC+Hc9U+IoFfxprRUYXx66JnIC167gP76ZcL9Zq+4U/A6fHklB+qVwz9rI3kHwPdNKmBaeP63F31DoiDXB/Fj/UovtunDtN0y6U2Lw98kZ2am61kzIqB2Wa5sRaGfwPiIQu1MN21XeUfMa/l6/VA+vfblyGlw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d837e351-1421-43ec-a52d-08dae9f9158b X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:02:04.4573 (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: 7NTAdwW0JnTRUlQF+sYEUAa2M+mLwEqrTkLG9ypUk0roXv+xHS6US7f5EMOQMBQkgWwidYNsYBLOSriHCBmCfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The internal PCSs are not always accessible during boot (such as if the serdes has deselected the appropriate link mode). Give them appropriate compatible strings so they don't automatically (fail to) probe as genphys. Signed-off-by: Sean Anderson --- (no changes since v8) Changes in v8: - New .../arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi index ecf9d830e36f..3f7536ed2ced 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -823,7 +823,8 @@ pcs_mdio1: mdio@8c07000 { #size-cells = <0>; status = "disabled"; - pcs1: ethernet-phy@0 { + pcs1: ethernet-pcs@0 { + compatible = "fsl,lynx-pcs"; reg = <0>; }; }; @@ -836,7 +837,8 @@ pcs_mdio2: mdio@8c0b000 { #size-cells = <0>; status = "disabled"; - pcs2: ethernet-phy@0 { + pcs2: ethernet-pcs@0 { + compatible = "fsl,lynx-pcs"; reg = <0>; }; }; @@ -849,19 +851,23 @@ pcs_mdio3: mdio@8c0f000 { #size-cells = <0>; status = "disabled"; - pcs3_0: ethernet-phy@0 { + pcs3_0: ethernet-pcs@0 { + compatible = "fsl,lynx-pcs"; reg = <0>; }; - pcs3_1: ethernet-phy@1 { + pcs3_1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; reg = <1>; }; - pcs3_2: ethernet-phy@2 { + pcs3_2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; reg = <2>; }; - pcs3_3: ethernet-phy@3 { + pcs3_3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; reg = <3>; }; }; @@ -874,19 +880,23 @@ pcs_mdio7: mdio@8c1f000 { #size-cells = <0>; status = "disabled"; - pcs7_0: ethernet-phy@0 { + pcs7_0: ethernet-pcs@0 { + compatible = "fsl,lynx-pcs"; reg = <0>; }; - pcs7_1: ethernet-phy@1 { + pcs7_1: ethernet-pcs@1 { + compatible = "fsl,lynx-pcs"; reg = <1>; }; - pcs7_2: ethernet-phy@2 { + pcs7_2: ethernet-pcs@2 { + compatible = "fsl,lynx-pcs"; reg = <2>; }; - pcs7_3: ethernet-phy@3 { + pcs7_3: ethernet-pcs@3 { + compatible = "fsl,lynx-pcs"; reg = <3>; }; }; From patchwork Fri Dec 30 00:01:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 637640 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5222FC54E76 for ; Fri, 30 Dec 2022 00:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234204AbiL3ACM (ORCPT ); Thu, 29 Dec 2022 19:02:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234141AbiL3ACL (ORCPT ); Thu, 29 Dec 2022 19:02:11 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2047.outbound.protection.outlook.com [40.107.21.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796AD17422 for ; Thu, 29 Dec 2022 16:02:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=msFXItchX/olfRvNPArHvrSZMagh9WhbHdU68/gOvWIzTGBaAReHp2yhNyUEqXmaYixX9PUU7uUAWjOCCLM6/csAFy4Hg4qAmxN9LRqoUmAccgk7mbnmHHte8XBf4b82r3mP1CdMsSD/CpOoka3JklrN2sa058TsZ2IAzXuZooD4kN7BM6c+6a925uB6N/BgQZKjYVKTxQFrNn1CG4yHYZMkXS7JTBfzPs7bOcTN+bj4q/EOQMzB5k+zAq3uEIYXpIhVV+8CIybDP3PrgEzEsoHjGLitmZdyl9mxg3q8fhnCGAWyYXfBZKZXX3TzIWfqoNHeVKJ1r/OVJzhifPcMTg== 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=EgA+xGyUKhZul6yfScdpRs6xmUVEJ+3u5IzfiIhlolE=; b=RoFUDxQddA/x9DGnjWaICWolmpymgb/u6EwuH7gUJwPjl/N40Lp0DdhSSO8MFZwvbO9+CxU1DLVgGem51k7hc2bGCtpPv+tGaRWeo6OlyRnI+4H19b0jmAfIljTADhI4jeyq0azwqKtJxb0u0+uoi3FhWWb4yulqVkJHfORfKP/DBUCIpS9v+IHA4fcr9NWgD/ZTJ6mxEs5KsBEmoNHUia0FKY8Xpytzjgh6kR48184raKH/NwXr/VETfGBeVrpPjIwgNvOJEND/2ULQnPkqagU0nA6pTfShp0HAnsT/FF5IoId+KWJAs0iJPBYrIJbkK9KCe41/m0NmkiDZe6TFrA== 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=EgA+xGyUKhZul6yfScdpRs6xmUVEJ+3u5IzfiIhlolE=; b=TwFKYNnlDhT8mPFueJ/zVCaQo/27B0/vCZwI3+Hf3f8FrLIpuPbm1f8QWyek1Mats8PhTkI0KpxjDj0YghHi5gQ+8ylzcUWoN6bLWUoHT3TKPCQqFy05Yr/XcyxdVTMtRYGJ/3F/XV83s75KoJaZ6UEsPBIjACfvhFGwBkAvGaa+3tbtlEqlnf9ytu1jOEuiWyfOz2ePGCHlPi5T44swGx+vgUyIrWu6rONDNBdq2DbdFhnmXRvT5ge06hVLXIF57W3iRHzVEl1sVGg2V2VXvBYWVRUmbauI+DEysD9TSJILsevBhsFS71KqA49BOMcLtFsmfRneCTlwDHs7zBj50g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PAWPR03MB9788.eurprd03.prod.outlook.com (2603:10a6:102:2ef::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.16; Fri, 30 Dec 2022 00:02:06 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::2b95:1fe4:5d8f:22fb%8]) with mapi id 15.20.5944.016; Fri, 30 Dec 2022 00:02:06 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, Camelia Alexandra Groza , Madalin Bucur , Bagas Sanjaya , Rob Herring , Ioana Ciornei , linuxppc-dev@lists.ozlabs.org, devicetree@vger.kernel.org, Krzysztof Kozlowski , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v9 10/10] arm64: dts: ls1088ardb: Add serdes bindings Date: Thu, 29 Dec 2022 19:01:39 -0500 Message-Id: <20221230000139.2846763-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221230000139.2846763-1-sean.anderson@seco.com> References: <20221230000139.2846763-1-sean.anderson@seco.com> X-ClientProxiedBy: BL1P221CA0016.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::29) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PAWPR03MB9788:EE_ X-MS-Office365-Filtering-Correlation-Id: 310a2a0a-7e81-49c2-d298-08dae9f91677 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ebK/N3IrU6Bp7lozKUye9HSrLCRBJvoClvDk3UGiaHlApglSgINmwqup1lT1yLpWTNXBdgtwfJ63L2OiSHSPiCvR86zxcWP8B7P/C3GNR2LmDfDwJtJCB/tbalh+sL2hGf0TL07IzDLwrE+GlTWxuCq4RufypeJW5BNoCIUnnP+nENYph20IcW2yGg1pkljCC83+jeZRjLTa/WfClNRXi/SXwENgj/Yy65mIIiknvyJ97gw1r8ibHd2OijXfmlB/sCtmLX23Sy9ylULw2NCKdYy2+JIS/HQSXWTzNBtRkH3iTqRKEyW0IUgGZjvM5JsWHOw2tCGB3gN9xGvt+ZKpO95evYkunsuJWzpv5+ZgpU6SesptC0hvzDolgWO8R6zHHClfLzW3ggMf1XpFUPFgffJVF5vDmVZ5kr77vj5/G445fjrxNgicDbZppRYcfEGDBv7KdgG1oed2p7bvQBzhY/1raEZDXpUIs0uxU72wLrYGVdnuIYQ9o17WFPv9b37WCaBykoqM2z3Qpb762s0Ha8/VMRU1NrYD5Xutx3+jfqYMkRBv7DOVZLwOjoFZbvVFT38WP6l4H5edNTFTHBKY5OdkmTa8o4G6/IWs3XuRgKv3UP91eQNqUmgbFJ9wMwiCFmO+WSCsdLi+dfpwRiSEIV8IM8K9v/KOY8sOpYkXw65A7K/p/K42FC+o7rFAybzFU1YOLPtStl9tyJFPug5Vow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(366004)(396003)(346002)(376002)(136003)(39850400004)(451199015)(8936002)(83380400001)(4326008)(8676002)(66556008)(66946007)(7416002)(5660300002)(1076003)(66476007)(44832011)(38100700002)(6506007)(186003)(26005)(6512007)(2616005)(38350700002)(6666004)(316002)(86362001)(2906002)(110136005)(36756003)(54906003)(41300700001)(478600001)(6486002)(52116002)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Da9cpYEYxtFA55qVGCWqORdK79PQCL8EE7MvffiCx4ItDA42VQiqczda4xv0TtuoQN9UYHCpmUh2gCHXWMsqOPrc0s+PHpt/Eoy0gYGq1wE43PqJvrw3aM9EA9tmCfQZ7hGLAwaW9lR2/SBtU1eQ6YANNAU3Lpk2FHJDr+tdEet55LtLXTlm5yb0enI4eNIegWt47YVpBOC8cYfgv1jhvSyr8VBT1MeeUGRCFJnA6NpqaPwJFZ6g908lKj9k+xtUveKIqKbnFngwKrKb3p90bUHVgwYuvLxqu0CrdoDounCUILNJC65efZ9U6F4ly0tVj3NQfAH2/WEmaNShVE4m+kKC53Nx5a9OCd2oeEbvWfWNIsD0CwM7W03An2zRZvVLLwerRFNhXFUxEHQ65JXOxS4SjKNxmDCV9Wa5OcnMDNxSk0VTwg6E3ft2+WG5wwjDRLa+6LSBvpok2qjhZZcRN/nOWnO45xCmRDv0Y/3EwgJ1ZtDutMR5dAUAzoAgA600JHEtSQl/daqY8w6mLfHsfA3Vg08bp4U0eWg6W5vaKbgB1sHPEdvixOX7eWP/NRMJXaCGonzS6YAJqyOdcGK+bviDAmC9U1gJKWT5WmwfkqixSWCcC251LUOj9x6g0NeVY36R938ojqEoQphRVWj2iDJYrIZETjj+hY1s9AW4fIz1ytvcN7mmVg/Y5S1qa9gPRhQ0BR/kDBTiWjBou+6ZBHF40oiXqfiTlfO7t/LeSDscCq5w5xmHi9dHWiEkRJytrXkGIMJ3XrXIozE6ZnUEEDO3/SgZnd3VvlMwHNc06BYge66Is9HW8feLTt5KTgGH5H/1YPoH9Vbr/qDhislpZRQSRLSDZC3QXJ3Io8zBIW9g2/uyTNHiM1NSDHTrlCWy0RRjNmNTVnFXNT6PZ7X0HU1Y5pXV+xQNnstiy7NM/LTZOV6LERE6oup6xlszIpsQVUX0X+1JDKF0fxhNz5aB0TnBmKJJEKJ0xNTudha7Ly4GJAI2TYXJKEKcqomVnBGAw0tyjJlRVHSJsJIAhn0c8Y6nbRv8AUEnlSSc0KBwW4UPuiTQ5nPHNB4tE+wxYi7Ww2WgbOOYCneYTpeDDPDpBZfnaCVle1yB6B2TgUxgf0R6Szutw1iRY2qTJegF6qEia0jo0FN0ZASQaxeCa3zZu3gdEYaGIElIFFQPBko2QN8vpH0oxPsgER7ZZzSQkHfG3e2VkZ/JEKmgqG8pwEt//bwXHxQIvTuY/l7KDfo/rOEB5ixideuJ9aIqFQug3XgqZa+U6H31Ou4vuK7XsbnIYpT4rR9DShXQr9QPkDIFD99Ak9USxgY4wgLpfgrK6kDA0+bN5tDITXty8fs5ENDrApUtymiXDLc96AmvqStLr8wFjn4hgI4Rkoe6ImH/qJuPvAsgIj8x1NZlWbIizBxLn7DXdhosSOmqtut2IuN/mK6zaYemLTUHdjtH/YjX/kDSBKBCNTzpdEeYavEf9DPUxPmSGbJfWZWjXyuZZXUvQPPvvc+KiBZJn6p0iKKPBgGwcBiWckt8YgLnuBdmRxuNOw6lATXmTLuwQfrVtDu6MVGzthZWtHDVchx0gVjXjruxmLjprC9pWubiQT4erKogQQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 310a2a0a-7e81-49c2-d298-08dae9f91677 X-MS-Exchange-CrossTenant-AuthSource: DB9PR03MB8847.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Dec 2022 00:02:06.0207 (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: iLGVc4OAZFxRk4gMqT1eolrQ8lNaTcBTa5/XUoyALD+Z5xtwFYQvf+0SaTqIDAftNbBwkbqEIerYghV468dDTw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9788 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds serdes support to the LS1088ARDB. I have tested the QSGMII ports as well as the two 10G ports. The SFP slot is now fully supported, instead of being modeled as a fixed-link. Linux hangs around when the serdes is initialized if the si5341 is enabled with the in-tree driver, so I have modeled it as a two fixed clocks instead. There are a few registers in the QIXIS FPGA which control the SFP GPIOs; I have modeled them as discrete GPIO controllers for now. I never saw the AQR105 interrupt fire; not sure what was going on, but I have removed it to force polling. To enable serdes support, the DPC needs to set the macs to MAC_LINK_TYPE_BACKPLANE. All MACs using the same QSGMII should be converted at once. Additionally, in order to change interface types, the MC firmware must support DPAA2_MAC_FEATURE_PROTOCOL_CHANGE. Signed-off-by: Sean Anderson --- Changes in v9: - Add fsl,unused-lanes-reserved to allow a gradual transition, depending on the mac link type. - Remove unused clocks - Fix some phy mode node names - phy-type -> fsl,phy Changes in v8: - Rename serdes phy handles like the LS1046A - Add SFP slot binding - Fix incorrect lane ordering (it's backwards on the LS1088A just like it is in the LS1046A). - Fix duplicated lane 2 (it should have been lane 3). - Fix incorrectly-documented value for XFI1. - Remove interrupt for aquantia phy. It never fired for whatever reason, preventing the link from coming up. - Add GPIOs for QIXIS FPGA. - Enable MAC1 PCS - Remove si5341 binding Changes in v4: - Convert to new bindings .../boot/dts/freescale/fsl-ls1088a-rdb.dts | 162 +++++++++++++++++- 1 file changed, 160 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts index 1bfbce69cc8b..d75cf52a7616 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts @@ -10,17 +10,137 @@ /dts-v1/; +#include +#include + #include "fsl-ls1088a.dtsi" / { model = "LS1088A RDB Board"; compatible = "fsl,ls1088a-rdb", "fsl,ls1088a"; + + 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>; + }; + }; + + sfp_slot: sfp { + compatible = "sff,sfp"; + i2c-bus = <&sfp_i2c>; + los-gpios = <&los_stat 5 GPIO_ACTIVE_HIGH>; + tx-fault-gpios = <&los_stat 4 GPIO_ACTIVE_HIGH>; + tx-disable-gpios = <&brdcfg9 4 GPIO_ACTIVE_HIGH>; + }; +}; + +&serdes1 { + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + fsl,unused-lanes-reserved; + status = "okay"; + + /* + * XXX: Lane A uses pins SD1_RX3_P/N! That is, the lane numbers and pin + * numbers are _reversed_. + */ + serdes1_A: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* QSGb */ + qsgmii-0 { + fsl,pccr = <0x9>; + fsl,index = <0>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_B: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* QSGa */ + qsgmii-1 { + fsl,pccr = <0x9>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + }; + + serdes1_C: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* SG1 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* + * XFI1 + * Table 23-1 and section 23.5.16.4 disagree; this reflects the + * table. + * + * fsl,cfg is documented as 1, but it is set to 2 by the RCW! + * This is the same as the LS1046A. + */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x2>; + fsl,type = ; + }; + }; + + serdes1_D: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* 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 = ; + }; + }; +}; + +&dpmac1 { + managed = "in-band-status"; + pcs-handle = <&pcs1>; + phys = <&serdes1_C>; + sfp = <&sfp_slot>; }; &dpmac2 { phy-handle = <&mdio2_aquantia_phy>; phy-connection-type = "10gbase-r"; + managed = "in-band-status"; pcs-handle = <&pcs2>; + phys = <&serdes1_D>; }; &dpmac3 { @@ -28,6 +148,7 @@ &dpmac3 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_0>; + phys = <&serdes1_A>; }; &dpmac4 { @@ -35,6 +156,7 @@ &dpmac4 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_1>; + phys = <&serdes1_A>; }; &dpmac5 { @@ -42,6 +164,7 @@ &dpmac5 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_2>; + phys = <&serdes1_A>; }; &dpmac6 { @@ -49,6 +172,7 @@ &dpmac6 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_3>; + phys = <&serdes1_A>; }; &dpmac7 { @@ -56,6 +180,7 @@ &dpmac7 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_0>; + phys = <&serdes1_B>; }; &dpmac8 { @@ -63,6 +188,7 @@ &dpmac8 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_1>; + phys = <&serdes1_B>; }; &dpmac9 { @@ -70,6 +196,7 @@ &dpmac9 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_2>; + phys = <&serdes1_B>; }; &dpmac10 { @@ -77,6 +204,7 @@ &dpmac10 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_3>; + phys = <&serdes1_B>; }; &emdio1 { @@ -128,7 +256,6 @@ &emdio2 { mdio2_aquantia_phy: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c45"; - interrupts-extended = <&extirq 2 IRQ_TYPE_LEVEL_LOW>; reg = <0x0>; }; }; @@ -171,6 +298,12 @@ rtc@51 { interrupts-extended = <&extirq 0 IRQ_TYPE_LEVEL_LOW>; }; }; + + sfp_i2c: i2c@6 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x6>; + }; }; }; @@ -185,8 +318,29 @@ nand@0,0 { }; fpga: board-control@2,0 { - compatible = "fsl,ls1088ardb-fpga", "fsl,fpga-qixis"; + #address-cells = <1>; + #size-cells = <1>; + compatible = "fsl,ls1088ardb-fpga", "fsl,fpga-qixis", + "simple-bus"; reg = <0x2 0x0 0x0000100>; + ranges = <0x0 0x2 0x0 0x0000100>; + + los_stat: gpio-controller@1d { + #gpio-cells = <2>; + compatible = "fsl,fpga-qixis-los-stat", + "ni,169445-nand-gpio"; + reg = <0x1d 0x1>; + reg-names = "dat"; + no-output; + }; + + brdcfg9: gpio-controller@59 { + #gpio-cells = <2>; + compatible = "fsl,fpga-qixis-brdcfg9", + "ni,169445-nand-gpio"; + reg = <0x59 0x1>; + reg-names = "dat"; + }; }; }; @@ -203,6 +357,10 @@ &esdhc { status = "okay"; }; +&pcs_mdio1 { + status = "okay"; +}; + &pcs_mdio2 { status = "okay"; };