From patchwork Tue Mar 21 20:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665637 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 0225EC76195 for ; Tue, 21 Mar 2023 20:13:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbjCUUNv (ORCPT ); Tue, 21 Mar 2023 16:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjCUUNu (ORCPT ); Tue, 21 Mar 2023 16:13:50 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05hn2238.outbound.protection.outlook.com [52.100.20.238]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266CF4AFF4 for ; Tue, 21 Mar 2023 13:13:42 -0700 (PDT) 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=2UOdy6IOP2FgfalbTRspdS/6BUzYhUE6Jjk/rHm4G3JgaRrx7xz6pS6P8pfUMFc56zRe7hJQa0+BNd3w+B1rLOvaWdBJZwgplE3BjOF1hqnAu2v5szD9GC5Oqt8XwjOmcPj7qPy+5gA46jw41m91AReqJ9RYbBZkYNOhsCXSpUlDqNi3RNnecA64dM2RZoqM9/v2h80n2M4dbQcn0AgC380ouKXVL7nEwdxz0XRae+NdGpsMuT7f6kkKjxZfGmOckz8Y/TIDE124MegeuwfeFEQ8mKUtWhOT30BhIG6tcRUf4S7cIogHSUdPl6pMxaEoK99vsUk5i0E21tdwMwvM1A== Received: from FR3P281CA0077.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1f::10) by AS8PR03MB7956.eurprd03.prod.outlook.com (2603:10a6:20b:427::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:39 +0000 Received: from VI1EUR05FT047.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:1f:cafe::fc) by FR3P281CA0077.outlook.office365.com (2603:10a6:d10:1f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Tue, 21 Mar 2023 20:13:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.81) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.81 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.81; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.81) by VI1EUR05FT047.mail.protection.outlook.com (10.233.243.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:13:39 +0000 Received: from outmta (unknown [192.168.82.140]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id F0E032008026E; Tue, 21 Mar 2023 20:13:38 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.176]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id EFE582008006F; Tue, 21 Mar 2023 20:11:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XpPnHUHJA1B2Iyz+Vr7klsICDFwNHrtyxJRtWEAxsOAaSxjnQFWz/piRzt7dz1gEEAqJ95nDRio6gkEEBo732C4fNaD9dFW6eqVxccvFi0z24zBPzh3MrbqdOI0h8tdH8V4bRj36YIH/bn5qeFXfzD4wGFkyOjhaDZDPwF+s4ZNE4Q0YwMGOANzPub1ZSarAZGpLXxvpKP5u+ZohkmRUx3IzTZcsqVTZ7C2OT19PZWMkhFpqFj8EG/wZMy+eva+BWZhjJCQr5Bvp+xoTpHHBFifsqmlgvZjLOxc3YRMwfFu0KEWFpjPaW5Muo6dfN0atfEZ0l8SrJ3JkmJy+ZPDJVA== 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=MzGkrrb3Q6VubueQFPIkgqzRPBS3PEBkP4/uoos03sv+BiM3jFTqcoPjUFJHo6zN6xlyIjhZL+ltGoqickMzGrWCbyZzrPr1qlJOEg3kPrHygFaCFOLfmyDoUqbnt+cWAiiidgbmvIt8WEb5NMscIeTrYY0vxvc8A05f2jsB7iNG3hxV2t9DZbtCn6D78vceUvIKsdk+Io/rUrT8O7TMKzpKPxNz+8znv0miUFqPeO+rSktXjs22tuUnS2D/fGfVejEphYATVnY8BbrYpHmcBLdkyLzXVKM5gstioPp0YXD5j/VeiRtYxGXSofUkLbjtsk8RbOd944nQo4f/j1/CtA== 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=2UOdy6IOP2FgfalbTRspdS/6BUzYhUE6Jjk/rHm4G3JgaRrx7xz6pS6P8pfUMFc56zRe7hJQa0+BNd3w+B1rLOvaWdBJZwgplE3BjOF1hqnAu2v5szD9GC5Oqt8XwjOmcPj7qPy+5gA46jw41m91AReqJ9RYbBZkYNOhsCXSpUlDqNi3RNnecA64dM2RZoqM9/v2h80n2M4dbQcn0AgC380ouKXVL7nEwdxz0XRae+NdGpsMuT7f6kkKjxZfGmOckz8Y/TIDE124MegeuwfeFEQ8mKUtWhOT30BhIG6tcRUf4S7cIogHSUdPl6pMxaEoK99vsUk5i0E21tdwMwvM1A== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:34 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:34 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Rob Herring Subject: [PATCH v12 01/13] dt-bindings: phy: Add 2500BASE-X and 10GBASE-R Date: Tue, 21 Mar 2023 16:13:00 -0400 Message-Id: <20230321201313.2507539-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|VI1EUR05FT047:EE_|AS8PR03MB7956:EE_ X-MS-Office365-Filtering-Correlation-Id: 12257c99-6966-40ea-556b-08db2a48c29a X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4nFn8dpquRAf0iVnYDPApN5nO8x2F9YFKCLgqSYAjK/h2NouvAcJyhVmkJKKWqaW53/VO9OUyzID986j90FRi9CkAujv+Yfxg0aZwQWsmWf406GP6d9mB0Q3zEwxdXwQjYj1N6SL+DBjUeEq8G5UnXATJb/epGi+9zbXdTL8n+QN/4oxURtaDkqBCCANdfs2619slIukK/9bZNmRLt5KRSKmBVqbu9/ABYPFZXr5okq+teCNZivT7aJ6fxw9nEEtt3vzCJZ1tfDoGd0bNotbLawwgiYrjzOmSZzWVtinvU0/mSw2eVwepEv+eT7PbazQ1zJOcooDITzPBbT5zk4VIqNa3NFxUQ5cuPZ7PEJCoDIFvKxONlTXzX/ycNa7LkNk3dQ7H8ZzGYsEVFkT6C7SLt5bX30XXuE+60VLiYr8cuifabXYNEj5PPVdx6HoFLXeKuqWoVW/CDZv0aNEDdELHl1nCbatOFdqkmw9XKTzy49aINF/kHRLfb+CZcdiJXUQGRzwxM+QUmYvlFrntDpCeEbtYL2pQRfXesw9/zli8R6xyzDKP2vL8EhaEKje8EZNpAu+lagpCODvqSyXqyui6k8BoACkSkeU+kPHtD3fSs8oXf6vVqMRmqEGNM3UtYAd3y5DcfnfzcGTg/Y0q1bd9tqWZGriMs3GQf6JCEzifzex3WhQaPvRVDWTQ5feiemc X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(966005)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT047.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 499bb582-e9b5-485f-f4ee-08db2a48bf5e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gICLEhQnMGpnLT7So+TpFmZRsCYoWSuCfBZoXHOVYB9Ctbtz6mMFI+eHXSwcQJdiJ17Ak15cWZRszq1vlxTrw8qkAFjvqv2DjZEE0GG36AV81BMG+tSztDGUK6cEOLUedbI1urXlTwxFDOn+Nj1YtAlM9VaDjD8X1aAoMpPQ1oIv30yIYwSd2sR5c62f9zZmwu8ye2pwsoVhKXqisc8r7byeiM/QIcaNOMmUBCbY+HXL5MbDAvg4MODm34i5Ls3KuIXrTOSpD44SDoq0LBN4xFU12zt6cFfSILyVMNHXh4bvkb2f0p4HADqTutcUg4Gmd29pUrKv5X4Q9E5DC1r7du/zEtzOIQ/SaEHkNvIwlj/BQ33yFlFnL9NfIeTmXiFURBKLyWA/HxV2a2TJWqF7OgR3iXO51KlvHAVXYrff0yW65EpNGBdtn6ilbj1qQ+UgcfarKN4kjzhiIOjJcsEGonWuDxxDVZRa/SmKDg3N1z8ZsODPRsjLKUzHnMbZM93nINXAigctFS2O7Dycf+i/GhIoyqDxQovjbwzt+fklR4/Y0iEmwtPmXF4ZFJNOE2p6GdrcNS7rEAS2CfY/WOnj+9ZzpFj3/vxIDBsb5VFdjBUPsLwBsnIziAMs4pV7xEOxqfEUpB5FhmAHIyKBrMGSwcuDT8qLivY6UORf9RCToqzlIg67zw8yGprNooGZAQRF6Iw5mqvXt3KKKs4J+IPKYidhvL1YG5hyRK2XKoWmBfLOlzEYsRlCdoC41uE/CT+y X-Forefront-Antispam-Report: CIP:20.160.56.81; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(39860400002)(346002)(136003)(376002)(396003)(5400799012)(451199018)(36840700001)(46966006)(40470700004)(2616005)(6666004)(336012)(6512007)(54906003)(26005)(6506007)(83380400001)(47076005)(966005)(6486002)(4326008)(316002)(1076003)(478600001)(70206006)(186003)(70586007)(110136005)(8676002)(44832011)(34070700002)(7416002)(5660300002)(41300700001)(7596003)(7636003)(82740400003)(8936002)(2906002)(36860700001)(356005)(40460700003)(86362001)(82310400005)(40480700001)(36756003)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:13:39.3182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 12257c99-6966-40ea-556b-08db2a48c29a X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.81]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT047.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7956 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 Tue Mar 21 20:13:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665636 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 47F0EC77B62 for ; Tue, 21 Mar 2023 20:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbjCUUNy (ORCPT ); Tue, 21 Mar 2023 16:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjCUUNw (ORCPT ); Tue, 21 Mar 2023 16:13:52 -0400 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02hn2216.outbound.protection.outlook.com [52.100.202.216]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009C630E9E; Tue, 21 Mar 2023 13:13:45 -0700 (PDT) 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=Iie0Bl1raO6MNQbx9dABBRV7HF/h/2HGK/e4/Sj3ooA=; b=B6VagWthWhKF/Ljj7pkBq3jUtXx0oz5yM/ed9/9CpMIdhtSPllxYB6wp5r94Mgtx21edQHPvVf7prKUIFhNUVpVCeFEEFWYtoqLy7gNPvNFQOoPKXTMIxiVdw0YNpjjySbbbChCKX/2ZSDo2+KYDTUHFxTckYI/YWHFB7a9onZr+rSaRDsJp285XnY66UhfJ2ak1fkyKh607o2Qgj1LZRAA/knoaP2t6k1E8mFkf0fsLN9TZHAL3drOKZNrfQTPjp4xylXzBiAUYSffsaI9l9wySjQry/VxMROObYkmCnFerUAdha+tZEBegw6gJmsGAFZVQ5dwE0Ru1LS+vDiAKLw== Received: from FR0P281CA0176.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b4::15) by PAWPR03MB10135.eurprd03.prod.outlook.com (2603:10a6:102:343::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:42 +0000 Received: from VI1EUR05FT007.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:b4:cafe::a8) by FR0P281CA0176.outlook.office365.com (2603:10a6:d10:b4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:13:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.87) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.87 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.87; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.87) by VI1EUR05FT007.mail.protection.outlook.com (10.233.242.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:13:41 +0000 Received: from outmta (unknown [192.168.82.133]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 312D82008088A; Tue, 21 Mar 2023 20:13:41 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.172]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 016122008006F; Tue, 21 Mar 2023 20:11:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MVsuyelCQEOj7r+fzAODmQlx1KdUGdkD2kPydT3loOgpWIm4GI+bWpsu5UkIBJaEsQmvZXWEZgcqhDXLnvNA13EzD1dkDC6W83nHld1o5WVaL9+ROKwnCg/48Z9MWlXdmWEKXLeeIP4xcQ7StacxqARZKoAL7r4sNKQcH5sAODS53q3XygeRXVNRFOAc9R0SJss5DW+x/N3Dm5jK9NYUfUtHfXNul48eRLtlMu0dVegGWrKjYCYqRsZT1tfkyyvY4kU9hfwVsCx8s9zVtLElyeaaxze8IaUJlRXZdDBQsvaJ4vMvC7pkhd2b20F/whY7sN1BYUDFjeSrNmXFI6iziA== 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=Iie0Bl1raO6MNQbx9dABBRV7HF/h/2HGK/e4/Sj3ooA=; b=jJb8kwSnsLwZmLOcLigdos+2k5nkXT1TNrBKmnESoPP2vc7iBWQPIlkEDIFQQ71MingmGPfNN0SRq7gqEQde3iEYh83nplkBqZDZWnqF4dvAw47iM9G2xdKzgt+d4aGhA2Hoy1ExqdUTwYbbsMri6gIdfsqyA3BXtsr2NN3veaSaaWBwx8ZrsvWBnlX6oqG6D2GeAcCR0lJvfgd2OgdAsIu67Ps+Y1uyR/WSJoIuJH3grXCj2z6XNUoAZHmp0r4EWu4M8RO18qiCnab/yPxKeqgkO3deuIjOSUB69VjZaVvJY338bxF41llfa80PhjnSPO9iMQuLesfbSLiS4jkyQw== 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=Iie0Bl1raO6MNQbx9dABBRV7HF/h/2HGK/e4/Sj3ooA=; b=B6VagWthWhKF/Ljj7pkBq3jUtXx0oz5yM/ed9/9CpMIdhtSPllxYB6wp5r94Mgtx21edQHPvVf7prKUIFhNUVpVCeFEEFWYtoqLy7gNPvNFQOoPKXTMIxiVdw0YNpjjySbbbChCKX/2ZSDo2+KYDTUHFxTckYI/YWHFB7a9onZr+rSaRDsJp285XnY66UhfJ2ak1fkyKh607o2Qgj1LZRAA/knoaP2t6k1E8mFkf0fsLN9TZHAL3drOKZNrfQTPjp4xylXzBiAUYSffsaI9l9wySjQry/VxMROObYkmCnFerUAdha+tZEBegw6gJmsGAFZVQ5dwE0Ru1LS+vDiAKLw== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:36 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:36 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Rob Herring , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v12 02/13] dt-bindings: phy: Add Lynx 10G phy binding Date: Tue, 21 Mar 2023 16:13:01 -0400 Message-Id: <20230321201313.2507539-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|VI1EUR05FT007:EE_|PAWPR03MB10135:EE_ X-MS-Office365-Filtering-Correlation-Id: d6c6b4ba-91d4-48aa-0ef1-08db2a48c3ec X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: tJgSZQBaRmm1ACy9S0OfBJh6YezXSZx6IC+IXDH6CFkmf3+lYVOPVzKqP3ar8WzYM7Bpa7H7leE+3e7s1CVpmvI0tcsFdDybamWrGJmewvGymN0lBw/1Yy3ZMjHTaHSQRCJm9mb+01W67RhvapxVy7HFDLs37MGRLlXUVAO5QqM8tiDup2tnXNksoYe0/JqkqVYYc8+5h8k3R2lU0BgDGIwgQQdt7C0UVHvtyvYAUH3fE2A6pcpTpb6CPmrXcCwD4yj7HRf7VE5zgrkYjSLQP8CnHjVzlAKQYA46bJ+tBjjoYvNvq+0EoUFCgPZw2nC7pVq4OwZBDWXevEoVg/tizT7rMOmV4VJMD3ygzfSg4Bm1hhfaHUClnnVOUIWy+ZJjjBRjg8hb3sTITHLOJseZVboD63IPjwmTyFQXOSmNrhM6ELx+xQdA5Vlx+CND0g2iognvxuxcl1RZqNFFvuCuw9SRFQgaFVeTmQK0eK+06PFNPxYIGblUDpgY/Zj4kVYaWjp8H02WKkCyETu2OVpdEZe9/wxOXPckP5fMnTVtFypc4FQAhKlIIAX4WNRsaZ6/EXEtx1iM3dE4VNtZpuXTt3XAC8m1b9xOAb5qs+EsFeDa+4M/kHkdaPXih1kKGzdjYUfdp9OfolWr7yGbi2wTmsYDwMFCAXrGfCr/yVRWysz04/CFPCyCqDE9nkl1z3G9 X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(966005)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d4956018-5662-4ba5-6362-08db2a48c07d X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0uUWaggjxK4WoN7Zj5JNd4dm3jJkLGuX+AE2jmb4nAeJh8Hvptf8daO52rk5OiT5Ve+wFefJv7Xf5KB9N24EGeU5MMC2fCf+5pTI6idVBoZ4B+iTFeNeZiJpEtrKG6BNy6tTMS3E87BseCxvSB8aESvFwI642muI9CUW+hCMLypBaNYwq6jN432k6PXlG0H9Rj/Vavl7KqfiTY+zvQnOEXRpW1CTY2j3pBmNY25ktdT7wTvF4n2iO1vG8IuCdiQNNVJmvwujysVhWJfDembzqwd525NSxUcXJnwFEni0I5VgMgW1bRwUgtzCZL8tSMsfld0QbGMojIFE1S4NCjkOTY0pUCa8kWoWRbHuJCb9W8AgFFJ58JTUkhdmOw9l7dU81OEA8U7BbnowVAbaM/3surlbyGUqiNWkhw+W+usGvwkXc+1u6i/fQ9XzJMuwAgZcOjDu1tdfbauAd+8+tbq3l604oL6h9risHZNZ6c9G9YDf7cWY/BNOTn1QgTwrQrYsI0eL6vbzn8XfjyGGVfn7+SXSd6S5JVQftEtU0Nm9V6e4YHoMgqwYRVY7534Q0bQmpVyDdFd1qrbZHhxx/+Wk6j2Nn0q4FVYCAbQkg30uEMHIpEQq/V30t/hINK9ZC2dvYYPdDz/SoJTkdat/BjcfkibLVX2Kggr2T1hG5kVJjkPSURb9G2zZ5LGmErlYCJqLV+u3iDgefExohiOxIo4mVTW329pGg435Gkdh3cllFesAgMQnledOg5GZwWvimBR6 X-Forefront-Antispam-Report: CIP:20.160.56.87; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(396003)(39860400002)(136003)(376002)(346002)(451199018)(5400799012)(36840700001)(40470700004)(46966006)(7636003)(7596003)(966005)(6486002)(82740400003)(2906002)(83380400001)(6512007)(8936002)(6506007)(44832011)(7416002)(36756003)(1076003)(40480700001)(82310400005)(5660300002)(40460700003)(36860700001)(34070700002)(2616005)(41300700001)(47076005)(356005)(86362001)(26005)(6666004)(186003)(316002)(54906003)(110136005)(478600001)(336012)(70586007)(70206006)(4326008)(8676002)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:13:41.5159 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6c6b4ba-91d4-48aa-0ef1-08db2a48c3ec X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.87]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB10135 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 Reviewed-by: Rob Herring --- (no changes since v9) 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 Tue Mar 21 20:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665635 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 D6AA4C76195 for ; Tue, 21 Mar 2023 20:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229747AbjCUUOB (ORCPT ); Tue, 21 Mar 2023 16:14:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCUUOA (ORCPT ); Tue, 21 Mar 2023 16:14:00 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03hn2203.outbound.protection.outlook.com [52.100.14.203]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 084FB4A1E0; Tue, 21 Mar 2023 13:13:54 -0700 (PDT) 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=WKcXiQAODHnxVNw1wJA5kYwrolqtzbVpSHRWxMaNQWuR4RNm+wyM0YmxK9W7OLVXb4cV9KZTOYe5+xdsCqg4mxe+F/hv6ujJY4YfNtIOtv5O1nq4nTR7ANUGLCBSGF5n0Hl/gxL37lIYRrR6lr7ICDncLZmL4ZxGF/9boPBLpxUPHbwk8v8Jxt1GEKZURT+VvQPZ1W1JXFthIyOfNuwo7/na976bUkvWTuTi54Caq+nXTkRLn3weEb0D2Cjw1HmRzRXI8FG1SPOphEjGo0/gq26KtgOYW3kBAhf7W9DTPjLMtaq2mzxD71v85L9eVJ5p0aH0iOhfOOme65XKB57z9g== Received: from DU2PR04CA0299.eurprd04.prod.outlook.com (2603:10a6:10:28c::34) by AM9PR03MB7558.eurprd03.prod.outlook.com (2603:10a6:20b:415::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:51 +0000 Received: from DB8EUR05FT011.eop-eur05.prod.protection.outlook.com (2603:10a6:10:28c:cafe::ba) by DU2PR04CA0299.outlook.office365.com (2603:10a6:10:28c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 20:13:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.83) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.83 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.83; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.83) by DB8EUR05FT011.mail.protection.outlook.com (10.233.238.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Tue, 21 Mar 2023 20:13:51 +0000 Received: from outmta (unknown [192.168.82.135]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 1A2DE20080270; Tue, 21 Mar 2023 20:13:51 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.176]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 7D0F52008006F; Tue, 21 Mar 2023 20:12:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lhqzr6JHEWXeaLLKJxIYRORWOquQHPBUp6MQZiscZtdCBtNNi9kFTDxn6QyJA58204G5emqnFvR5hdPaBXCW4smB/JqeTuyxZPb38aSU2ZMEsuRsiSL/pXEzaTfvi0vhrwCDGAlkt7Slt6+eDahRoiILeBidZ/ikkj1Ge51u9H8lesPJ0g1L1GRDGC/M6Ht7wwoLlMJwI19l4jRbpezl9lhWon8i31064/nFY/0eOEcFFzo3ffyOxJt9Zbkpp0PFQbXf7cPgjWZC/iqJelfYgFxen0FfFg4rZ+GBbL3KdB8E3An31+tRYfLcuE0D4gi8RYh8qElwYvhfiyO8zv/GJg== 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=dfoJ+uNJzbXlJdRQS+wrL+OpjoArVO7osu/ndpkyg3ThC1YAb/Xd1PVot3LEw1TKGQVSyA/GuMz0LcVIp1wz+Ntcfby/brcMaS4iBfZCt06hbaEkPZthr7o74/ajD+SSEbkVY3EmK0k5JDPeeRmYyhAonVjIuGfPWhvUtRc8ErlT6MIjPBdpZC9BmMtmGzkWxmZug4MIb2dTapEcqfe7PT3FKoU27Hxp7j5Kp0fhUlahOp/O6n8+Hno8xSpaN7YVs9CGrgAT2YU7N3bcjAhGP8UXRPtJnKN1N19eM9XRrr0rSIYddrCkbXnRjY6R4XHUhs+HU8eLBQIqDuVFcSD4cw== 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=WKcXiQAODHnxVNw1wJA5kYwrolqtzbVpSHRWxMaNQWuR4RNm+wyM0YmxK9W7OLVXb4cV9KZTOYe5+xdsCqg4mxe+F/hv6ujJY4YfNtIOtv5O1nq4nTR7ANUGLCBSGF5n0Hl/gxL37lIYRrR6lr7ICDncLZmL4ZxGF/9boPBLpxUPHbwk8v8Jxt1GEKZURT+VvQPZ1W1JXFthIyOfNuwo7/na976bUkvWTuTi54Caq+nXTkRLn3weEb0D2Cjw1HmRzRXI8FG1SPOphEjGo0/gq26KtgOYW3kBAhf7W9DTPjLMtaq2mzxD71v85L9eVJ5p0aH0iOhfOOme65XKB57z9g== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:41 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:41 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Rob Herring , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v12 05/13] dt-bindings: clock: Add ids for Lynx 10g PLLs Date: Tue, 21 Mar 2023 16:13:04 -0400 Message-Id: <20230321201313.2507539-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|DB8EUR05FT011:EE_|AM9PR03MB7558:EE_ X-MS-Office365-Filtering-Correlation-Id: b558fa81-87ac-4d5f-d0bf-08db2a48c9c9 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: u9aqdYnoNgtBk7HVTVmt7Cd7l0z6dG1GuvuuoOdbRRA73e7VstarQ6N44kM0NSUjUHU9u84A7bemFC0nNpxDi6sYqnOLMK9z2QEJLQ64ZnwiRFgQUuRtuhz+SvsTqTJHMnpuceK3FimpFsi+H4lB4NGfGc5m2HJJrLtxwWbrQ6oap+dHf3PZqXC3evy6cyRaw5iNbCLOhDjwLgLs7Z9Cdfh/vLmuzD+hIxstKaJ5rgQNtppyC+MWI8SnlzuH2yK2MqYPwZSg+8AOEsg6Dt5lXNrj/wWr7nr0lBq7VTxfmOfGBHk0nfmtuEcQjJcuhHnl+/kE7cX4GgrOHD6Hwr3ctfFB9d9UswFTNMdS46HXvBAt3Lr8OUxr6XS2gGHBlF9moQmbAXh7yc1GXQecDDXijZuGn3Gq+T8bHhhDRpb0qcXZXja5Z88waMRZhVKDkXkqx9T4MRS3ACWKq0ZpNkgsRzV5RjnmFuV53B2Q0HCtEA/UyIqaiTkaps9I9bNKYuwjZaLyP2/DlsY1csNFnkunpbJHhh90xYLRPpK6nCU5KYrNUEZwYn2NBk7bwTGgzsmM5rAzUTRmJE6NmyLU/rPeUJkZAXLg/l8IJnlgUNWw7ozQhYzr14RA0aNUFFiboOAEQxysvycbCqfHQijzHwQfNKjysEhxau7Th3GQQiNbiuxtZKSJM5Qj42SOjcCGb0UIhUISMIZXcu9m1VuMlWm1yg== X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB8EUR05FT011.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ce737f1-184b-45e7-7647-08db2a48c3d0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sKJYds07z1QE1fCLxO9uWvWnDS3onpYCv5bJr22lVufNmDtpU28pNAdik5wPGNd5shaymRy8O+RRYfuuFe0ZEBlFG1VGJ/ZB2puAw+beIzDkEWJBQWf0biI3OPpRMYcDGe0sAfGWB4g/9inNIrhNd2MVDvvV/Il2qoIxU9SVzPpxX6TrqhrvdyN9i79LVuXTIZgtq5/maP1CAp6bhZKyBQxAboppghojLLEgWoXeKESc6Qbw0DET0vf4onSmdIlVSP40vpm7lcpMcMqflU1RPEgcAHYX+eieMFpjlecrbwFDcnlHM0PE7ZM88lvURl9IP6WeDRxoiBzIWbOMmcoGkKdp3sUgmgrRQz8a0xLWRcClwvCFJzzhDYRAKqE1iD9mXwcujY1Qm70P1x97LaFvd+w19/ud/nmuDP7hGS0v7znmytW+Ns7kX+7ff8Q9A/xiV7bmw58+TeDtFvY44AmmxS7T0ybFrWcfLoObrTfjAMIL9NzPfN1ryOm4RwY9z71qXHzjILQOSBeGjaXPlgwfbxpmeKCWXyF6mZbau0fXw/pbC2gbCFmf1a4jg6jc3hhqAkCJgUIiJxEgJ7UbTtobb1qdRfZYnaCd4oZBUx9YOATBh4xa1+MMmdchV+fEfL5jCiBELl3mN1mQFx8aELrwaYM+HYbmriiAty/8OB+gpGBqq3ru+K0Jt5x+vHNDX/nz1se+N8A+FhP+5YrUT6dEwZnkgJ/P2MQhVls3QT9c3YsUPXbYO4wMjllE77DBVV69u4L7hWhdZEbOADUKQvMNdA== X-Forefront-Antispam-Report: CIP:20.160.56.83; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(39860400002)(396003)(376002)(136003)(346002)(5400799012)(451199018)(46966006)(36840700001)(40470700004)(2616005)(47076005)(186003)(6486002)(4326008)(6666004)(478600001)(336012)(83380400001)(316002)(70206006)(70586007)(54906003)(6506007)(26005)(6512007)(1076003)(110136005)(8676002)(41300700001)(34070700002)(36860700001)(7416002)(44832011)(5660300002)(7636003)(40460700003)(82740400003)(7596003)(2906002)(356005)(86362001)(82310400005)(36756003)(40480700001)(8936002)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:13:51.3734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b558fa81-87ac-4d5f-d0bf-08db2a48c9c9 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.83]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT011.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7558 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 Tue Mar 21 20:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665634 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 B9670C761A6 for ; Tue, 21 Mar 2023 20:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbjCUUOQ (ORCPT ); Tue, 21 Mar 2023 16:14:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjCUUOP (ORCPT ); Tue, 21 Mar 2023 16:14:15 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01hn2208.outbound.protection.outlook.com [52.100.5.208]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27E675071C; Tue, 21 Mar 2023 13:13:56 -0700 (PDT) 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=2cwc+OH/XDgTmrdJ5lRgll2wCGamL9DPUfWqzsHa6jA=; b=BLseI8bnxadKkz4fDVd8kb7W2Id8xH0uVBtCMYL13cAntlLF+VUEI5qHuhSyC9Yjq8Itd+ExKVNVSzGDeo9f8M/75bG/ZEWIXIVEZQDddLB/g1zNyhv1XjfV3SFqOdYFB58YpMdX3tMvVyYgrpKr438w2hsxyDFhQFgpreGL2vyXL7dSlpO3LPriQm+ZO9oBxflnBFEsJ1BHPph2UpKixNeEI6zhd5fbmfFcNVfhNC9Di+6VzFITVSPQYVoSNyHEsoZKljy5MeBsjJluxotqFQbuDz6E91Io8L+TNM3qndBxUpAVv5YFX0VWYKw5uBm7nGKcPIlobNud+E7pPcUy4w== Received: from DB3PR08CA0017.eurprd08.prod.outlook.com (2603:10a6:8::30) by DU0PR03MB10114.eurprd03.prod.outlook.com (2603:10a6:10:415::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:51 +0000 Received: from DB8EUR05FT036.eop-eur05.prod.protection.outlook.com (2603:10a6:8:0:cafe::6c) by DB3PR08CA0017.outlook.office365.com (2603:10a6:8::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 20:13:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.84) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.84 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.84; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.84) by DB8EUR05FT036.mail.protection.outlook.com (10.233.239.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:13:51 +0000 Received: from outmta (unknown [192.168.82.132]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 1293A2008026E; Tue, 21 Mar 2023 20:13:51 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.170]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id B76DC2008006F; Tue, 21 Mar 2023 20:12:46 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H5IQyCetcmx/8m0EsY27IxENSWZIn9Ns6aFWloG1UfMqcdPqw3Og+IiE0GI6ie7iLTA0Bqc3Hq6GUSS/Qh1po7TXxCF6c53s4VB4YqGuzTK1i2QWXsUZBeA2ly7NG5Y1e1faoWBl2aMynGwIkJ1f5gtzS3pvvyDuMFXCIZo/WdJ9OwDZ4MGyR7I7xXUmk2GabpvEKyAvYTkB+o1K1z8bjK3IqugoxZrMHvn5WCOO7GofgiR0R1nx2q9twzgbbMlseXQ9pAoeHjU+HkRB7Z8ZTlczafyxq9ZHukgB9YWEgnv82yZG+zpoeeVYSedTzR20rpYHgyQYvThH2uHfyf9ioA== 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=2cwc+OH/XDgTmrdJ5lRgll2wCGamL9DPUfWqzsHa6jA=; b=Pwz0K+AjA5u2J4EH8dsK610loC0YVhIsEbyv3bQh7HO/7VMLZwqOTVxhRaa9HLaiH2LeAwN+2E2ukzZYkAz/QaCwVUqz45EhyslIgklWwPAK7dx5NRJSJdSlr/tt3h6mU7OOofJHgJa34B/kZVUnC+g7Qc0cKtsSYFAiD9/gtUbKUpXGkSWEuSbsjeK750CsEkWZXPIrmSiuSohQCRJzR4k4N7Ua7Q5rBUU05F3IPiG7RVaPD8OIIJjNo0Syyk5/wWeEhU3E0tD6iqPfc7SxnOPW/BYjbJkZgyJTfaefeqHLqFrvwe5XUZM0IZ1WMMEO8NcKk1vHC+fVG4KonTXQ8A== 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=2cwc+OH/XDgTmrdJ5lRgll2wCGamL9DPUfWqzsHa6jA=; b=BLseI8bnxadKkz4fDVd8kb7W2Id8xH0uVBtCMYL13cAntlLF+VUEI5qHuhSyC9Yjq8Itd+ExKVNVSzGDeo9f8M/75bG/ZEWIXIVEZQDddLB/g1zNyhv1XjfV3SFqOdYFB58YpMdX3tMvVyYgrpKr438w2hsxyDFhQFgpreGL2vyXL7dSlpO3LPriQm+ZO9oBxflnBFEsJ1BHPph2UpKixNeEI6zhd5fbmfFcNVfhNC9Di+6VzFITVSPQYVoSNyHEsoZKljy5MeBsjJluxotqFQbuDz6E91Io8L+TNM3qndBxUpAVv5YFX0VWYKw5uBm7nGKcPIlobNud+E7pPcUy4w== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:45 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:45 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v12 07/13] phy: fsl: Add Lynx 10G SerDes driver Date: Tue, 21 Mar 2023 16:13:06 -0400 Message-Id: <20230321201313.2507539-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|DB8EUR05FT036:EE_|DU0PR03MB10114:EE_ X-MS-Office365-Filtering-Correlation-Id: a58b0dd0-188e-45ce-2fba-08db2a48c9e0 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: kG9h3x4hm+YQn7Mq/hepsN+hUnpu+Mxiew62btBXFR2CtBFHU2G8nE+XFC3j6VqjgqVB1LQuReSgQwulucRKWwid6pN0AqBidV2xZm4vdtosdMrDdUVDvsRI7D+EaOx/LSYF+0gsoq8uOMhxofuj4Y8bEcyfWIIlppxKtQZJnGGa4Awnbic8/jCh+2pkeHrmolthMzQMaDWYDL0JmFRPLeDnAj2gp8R60nB8d7iSbj8O5uk7tbxST3ofWxLskxm+ZddSZCYyhO81fIbOMj3xGuF8MkDU6CQDXjrQrUefxhWSFO38hyyHkQ+EEoBHjkuHYTTOMTCBOiGxwqeN3IZ58e1FfizaIwNkvZCxdDmXz7+rhtmVqTf1WOA5X6v0HhnVA4oqruQhK+a73AWx9zLfWNEEsqTRzFUfBp5I1BZVzPczZB6tW8iwXR9zg7UMXnxIkVqg+Yt5nY1hTcF5IINDCf5eKjNa0WCBElD5XNJI1Du8b9/apz2cmBc5GMZs4Xq0+vnj2rE0FZeAhsbctyLTBjpVAwWz7PnsOfO37uclJEq6Y3yBGabGTOxVMazO9wH+QMizrN3vFhHGGFvV7rPmnRNj59HK+fgHr2aFpbpuaf8tSepuiqfsyqkh8WoEtWPdzAbro18rYV8uS8Y4hR9AbUybbb5hc6xMVnTezvncCzCsMUt50xUGdngOJNJas9So X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(966005)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(30864003)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003)(579004); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB8EUR05FT036.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0bb28875-dfba-4be5-50dd-08db2a48c60f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Wc0rQCbO8DuwD96x56K/A8zxjLiB54ocqBhhv2x3aSdYVxRI5yPDQ0T3iyoyP6p/eaDvLeFlM4ZqED5oNyruDvqGBmUCZtPS7k0pgOKhmGfh8CPcTF5B+a3Ws7U2j5hoEBWrkrvhew8q6OYs4SFis7eTbFyRv3rpcrRBLyTEgVUHBrVrLsEx+zTHz0whoTrHLxvXG3I9FZJiKqORvOcoKWaonsF/xxcATwfvjWPn/aR3HCj5lLZcQrqPMdRDpgV2fbW3aLA0jqn5hrzFyS8RyO6wkyALzM1YET+EIl2ut+koBwnea33srwmdki22+KihBeP73/dJ2VsFZfDHFLRwUcbwY/Dg/UCzu4gjv7oLL9Hw0MW3xMvfaIxd4e6O/tMcbfr0qfWY/UXZjAH4MtaE2WGL2CdRaMzXIFB1X7phLTl6zb/QSirAthujNV1mv+0nxBfQycUEH/mKQ7tiADk2nsVRQ1KpcVhyZX3Yu/LN3aTh0rRuCzw05kD5l8D6F9VPTzh4RJ7aT6GE6807qkxErHtbkk7xx5FiJj167dTjLX+mC8V2NZGdzbaGoHp3zmp79bvqMA1i4lQIHreEoZunA6kge57ZifXPqIOFFNVHmq9VycM9hcFIrWzAXYXAPWH0HvPdQwm3u9Sx1KftWFs8wIdpiIxpjN3eEzBJA0UBxtRXGDslC/GvhpEfxeuec/2YihDAoKUWk9Jef4yeI8SnMJpHkzj8sg0TUtk8rH+dRJVQCJc/gXqd2DmuEGkNIIwa X-Forefront-Antispam-Report: CIP:20.160.56.84; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(39860400002)(396003)(376002)(136003)(346002)(451199018)(5400799012)(36840700001)(46966006)(40470700004)(82740400003)(86362001)(356005)(7596003)(34070700002)(36756003)(7636003)(478600001)(2906002)(44832011)(8936002)(30864003)(41300700001)(5660300002)(36860700001)(7416002)(40480700001)(82310400005)(6506007)(70586007)(336012)(1076003)(26005)(4326008)(110136005)(54906003)(2616005)(186003)(316002)(47076005)(83380400001)(6512007)(6486002)(6666004)(8676002)(966005)(70206006)(40460700003)(12100799024)(579004); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:13:51.5044 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a58b0dd0-188e-45ce-2fba-08db2a48c9e0 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.84]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: DB8EUR05FT036.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR03MB10114 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 --- (no changes since v10) Changes in v10: - Fix debugging print with incorrect error variable 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 1098ad283eb6..205ccc1bb448 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12205,7 +12205,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..880f718b387f --- /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, lane_count); + 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 compat; + 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; + } + + compat = device_property_present(dev, "fsl,unused-lanes-reserved"); + ret = lynx_clks_init(dev, serdes->regmap, serdes->plls, + serdes->ex_dlys, compat); + 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; + + device_for_each_child_node(dev, group_node) { + ret = lynx_probe_group(serdes, &serdes->groups[i++], + group_node, !compat); + 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 Tue Mar 21 20:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665633 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 0AF88C77B61 for ; Tue, 21 Mar 2023 20:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjCUUOV (ORCPT ); Tue, 21 Mar 2023 16:14:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjCUUOT (ORCPT ); Tue, 21 Mar 2023 16:14:19 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05hn2216.outbound.protection.outlook.com [52.100.20.216]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0494C50718 for ; Tue, 21 Mar 2023 13:14:05 -0700 (PDT) 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=3Dzi6UE2v9qVmQpqrCtfoOE4ZEKRnVlJ9GnYZynAFGA=; b=TEzwlMxDdwwbUZ10lSm+svYLWZ6Z0RXjQenVF1pEHTQ3yOTUru8vRbbDpZX4Kd3EmfuByNK4Qgrju6nGSAoE1RqwTOqVI6mv3u4Y7XTRlZWE5BgMGlXPhov+OT5IDb73ZAVFaOQVBPaGYBJqLle/Fe0rvHm5C+BHvVR0xn20B5ODMgdKHkf55SZQYCXOBqg6+Gy0uuqyhnRigpvYbrAomufZP+5o647V0qWYpMUtpYi0Scml9n4rasl8sJHb0XWuynn7IFxZx2/nRhoRfFVl7E8XX9WKtOqxi/cFU5GtevIzoxPkq/wT2S+IstTehGl3xAGh8/PpNRr71GQDqdu7Tg== Received: from AS9PR06CA0662.eurprd06.prod.outlook.com (2603:10a6:20b:49c::7) by PR3PR03MB6682.eurprd03.prod.outlook.com (2603:10a6:102:7d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:14:02 +0000 Received: from AM6EUR05FT011.eop-eur05.prod.protection.outlook.com (2603:10a6:20b:49c:cafe::d2) by AS9PR06CA0662.outlook.office365.com (2603:10a6:20b:49c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 20:14:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.80) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.80 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.80; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.80) by AM6EUR05FT011.mail.protection.outlook.com (10.233.241.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:14:02 +0000 Received: from outmta (unknown [192.168.82.133]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 318C22008088A; Tue, 21 Mar 2023 20:14:02 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.170]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 81D272008006F; Tue, 21 Mar 2023 20:12:52 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vzcn2h2DvRpC2WOOMlJGK6vQe69QY8cnv8D254Oj5+Rn7HKh32IIZiyujkuTjNVQRUSFSaG//mjG6CBqBmY3OH8k0e+xJrtu/GFMbhfxBo+oh2RBgrtsU3i0pA+xX4UhzO/DxC1LvrHj5qm46T6GKPEZhU1OfIbdR3w21guVfFqLarnBXcH+EMI0K2e0oe0BthiLZP6q7RRrcV4Yn9G5iRSkOCSNh3b3vHFRnwJEOAWr0WpF2X/GMXoyhFzuoVfBoZQXjBrRA25R1ng4YdDU2JtcXzTmjAv0nSKqHf17JOmHjjvDS/wzv39R7rqzoidLqKSjD2REbUADjrEJWlOy4Q== 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=3Dzi6UE2v9qVmQpqrCtfoOE4ZEKRnVlJ9GnYZynAFGA=; b=l8lLrEWLypylkykFj95loyL1xkn3XOUXpf02npZkPL32j1mC6jyAYjU7R8BDB9dy/cvW7qIwokKblrHk198DjhSqxrvhwq6cJyLQssBQTXZXJcQcvwXrT+RHw44V25jV+isGm8mNeStK2katMETyPhmVXCgytWmcjKgfME1UJxx7QsE+090Z55M1Fwe9SnP3o8VAdBRc793Uo1ZcOpKrzPyhshsRyqmDtNSX2N1mywgWu7a/YRUHu+9XkdJIT7cQ5ahka4uNmcf28fWBVYlnZcL6cAQz79Fqi9Q4dOOV5wKe3HJDOYEf3XFl6AfWq/X7pOuGWlK/Jo5GBdbwB4axKw== 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=3Dzi6UE2v9qVmQpqrCtfoOE4ZEKRnVlJ9GnYZynAFGA=; b=TEzwlMxDdwwbUZ10lSm+svYLWZ6Z0RXjQenVF1pEHTQ3yOTUru8vRbbDpZX4Kd3EmfuByNK4Qgrju6nGSAoE1RqwTOqVI6mv3u4Y7XTRlZWE5BgMGlXPhov+OT5IDb73ZAVFaOQVBPaGYBJqLle/Fe0rvHm5C+BHvVR0xn20B5ODMgdKHkf55SZQYCXOBqg6+Gy0uuqyhnRigpvYbrAomufZP+5o647V0qWYpMUtpYi0Scml9n4rasl8sJHb0XWuynn7IFxZx2/nRhoRfFVl7E8XX9WKtOqxi/cFU5GtevIzoxPkq/wT2S+IstTehGl3xAGh8/PpNRr71GQDqdu7Tg== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:49 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:48 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v12 09/13] arm64: dts: ls1046a: Add serdes nodes Date: Tue, 21 Mar 2023 16:13:08 -0400 Message-Id: <20230321201313.2507539-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|AM6EUR05FT011:EE_|PR3PR03MB6682:EE_ X-MS-Office365-Filtering-Correlation-Id: 44ff4b9e-d69b-4891-eb08-08db2a48d054 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Uqn64SCRpStyo9/w+sZR2t3o/QoqPfInw88l5XrrqEZDm9TQZjXOKS2ZCjzz1XxLA4wWTecl/hOzIWeOLud3N6l99VGh202kAIv7cphLkQ8ud2GYQ42m5qA0/4utrzXk6wVSzenuJjw5vi1dnDcH5hMjLkoqcQOlG8S61W2M0oaTyq4QWYAfXHANtMX2QfXvtUdD9suiz7Vf06RcgXAi/eunQmrjtvg+hLnb4aTCvSfSWG1rzgosNA4dJVsB9lnvDKjGQwxcQBGR/8cVgIQGrQ8s5/6kK9/FZCVutvgASbJrpWef17zNdhs7iK5xAP0Lwk7erbrIZTt+G5FTasbuI8Ee6ZI6MhVLlUFjBUQhwp0fh8P760VQal0nwGLnqtVQyLWf80g/gVbNrbOx4lGhrhtMnxs5sT2+2BmeY0hCZ+h1eLlxGeSqb6JvRvNPxRNXuVD2y4T0SenGQgRrsOb+IUTtMGhGCTM436OZYNIxhyEWy/GSKm92UssF9Fj8tsQ92YL2312+Y5hbM10WMZTTAWH45LASitc5Ad+GGYsafj4LSnpOg+LkMhbUESmCoC1tvXt6iNoywPh7opTYXl9ADcfQ8G7xhyR8Ugu0O5eCrk63zxeFC4g5HgYW8JA/ele8a2zugA9WDHAKfIv8UgL6wMyat20Z6Y5rbPhq/L6KKWxUleL4uHvBRtJ4R6LSKAop2oU2Xy5YeKVu8IUgTn1H8g== X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003)(21314003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM6EUR05FT011.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d79c7595-3735-4af0-81ec-08db2a48c822 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NygRff/ZxbonjnIBN3GYBHUAcqQCDvFII/PoxRCnrAGT6bcnIlJjgaB1g+32dlQ/XPfLVm+E5HC0kcwUUZOTEpfQRRDFloeorcs+DSOABWdVJDsqZzvP0o0bjFnOS5yxYHNmUwp2XI7K8j/h2DlcwtB1MAKtlm+gQLeVnNfa/UiR7l7SUNr5fHKYkgIWbTd9Aja4PUdBggrSRe2loJDVbz6kx6XGaArHUQ9BQkVCz8adMR/2hPWNOdKpVty+PaDqTlB7Ob3awRFLNy/V6Q5o0iCiv97z3pOmbC9YM3o5OO6k6AeQW8Y1YcynnK30Bn+mfC+wkvKf5FQM5oJ8jugR0oGKgqnAgf7pP/k1l2Bn2TH9Z7JObYsyTwEI1Sk47xkAM+lJaKayWqNB9B7DJMDbCALq76JFrqA2M1Rr1qMJVdjswZRDLI0/M9yDOueW+hJQbw3JkstBnnsXQjNPzS0MpNarifxlE3X+/IbFVhxf6WJGoNM9yuY7jpXydplJUNFFv2sSzl/hsYZbqjOm3Q2FShA9lFGlYLJ7Pn34MB/1ErVB+0/ts9Lxxy3mSWSaWX+qee6qpS/g1D+V0Qlzjy6v7NbI2CaS1+KxzOFZ42i0J7ygvyWweuoe292UStj0b43MnmA09QACViU36FgfLMvzMJi+5VlvuQYTfpHIaq+EDKx8vvr0LLY36lCn+lE6zbVe1W2LPVkJ0emFVngtNgMyv1oI6Wi1o3Suf1oX8bjh8SiXG7Pvrx4U38J9KxtRoHIYfbaQpv1Epl1H3t+7jeNMIg== X-Forefront-Antispam-Report: CIP:20.160.56.80; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(39860400002)(396003)(376002)(346002)(136003)(451199018)(5400799012)(36840700001)(46966006)(40470700004)(6486002)(54906003)(82310400005)(110136005)(478600001)(356005)(7596003)(316002)(7636003)(8676002)(86362001)(4326008)(82740400003)(6666004)(47076005)(83380400001)(70206006)(336012)(70586007)(8936002)(41300700001)(40460700003)(1076003)(6512007)(2906002)(6506007)(44832011)(186003)(26005)(2616005)(36860700001)(36756003)(34070700002)(7416002)(40480700001)(5660300002)(21314003)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:14:02.3826 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44ff4b9e-d69b-4891-eb08-08db2a48d054 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.80]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT011.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR03MB6682 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds nodes for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- (no changes since v10) Changes in v10: - Move serdes bindings to SoC dtsi - Add support for all (ethernet) serdes modes - Refer to "nodes" instead of "bindings" - Move compatible/reg first 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. .../arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index a01e3cfec77f..f6361fafaef7 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -12,6 +12,7 @@ #include #include #include +#include / { compatible = "fsl,ls1046a"; @@ -424,6 +425,116 @@ sfp: efuse@1e80000 { clock-names = "sfp"; }; + serdes1: serdes@1ea0000 { + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + status = "disabled"; + + /* + * 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 = ; + }; + + /* QSGMII.6,5,10,1 */ + qsgmii-1 { + fsl,pccr = <0x9>; + fsl,index = <1>; + fsl,cfg = <0x1>; + fsl,type = ; + }; + + /* TODO: PCIe.1 */ + }; + + 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 = ; + }; + }; + }; + + serdes2: serdes@1eb0000 { + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + status = "disabled"; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Tue Mar 21 20:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665632 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 58E28C6FD1D for ; Tue, 21 Mar 2023 20:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbjCUUOX (ORCPT ); Tue, 21 Mar 2023 16:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbjCUUOU (ORCPT ); Tue, 21 Mar 2023 16:14:20 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03hn2237.outbound.protection.outlook.com [52.100.14.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984E73CE28 for ; Tue, 21 Mar 2023 13:14:06 -0700 (PDT) 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=Msa/ApeasZWDyIVGMQqmliC9DhgV10v70JxGPKM6HnM=; b=kz2tE0shNrxUaxUtjhtPiPw2vAdzv0wHPcVqursU1tFgIMN6CyV90bO7QcyJGqcvgdGW3oUnjk1q5oKYQcqxoXacsFN+UklPiEu3sJuup+WH9KkcW2Yl/xvYT7d/t6Z8EIcbQf44KrPrbT9PGi/j+3yhz659uGr936zvnLrfbkIdJTxMNGlwWors6R00igzsL/JDmYRe+dx2aSq17ZJuY/CR9jOVytrK3VaCeoFrs+Ib4xlKnY6ICsqW7d2dndz3/PnEivbG5b6quKaNx/MzMYEnz/WqeDiDsWS3IScB0SCOZnXNzYcP8flUuMYeLaWfZOvaAkenUXJcWfG8AEb1Xw== Received: from FR0P281CA0179.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b4::19) by DU2PR03MB7845.eurprd03.prod.outlook.com (2603:10a6:10:2d0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:14:02 +0000 Received: from VI1EUR05FT007.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:b4:cafe::bc) by FR0P281CA0179.outlook.office365.com (2603:10a6:d10:b4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Tue, 21 Mar 2023 20:14:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.83) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.83 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.83; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.83) by VI1EUR05FT007.mail.protection.outlook.com (10.233.242.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Tue, 21 Mar 2023 20:14:02 +0000 Received: from outmta (unknown [192.168.82.140]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 2A4022008026E; Tue, 21 Mar 2023 20:14:02 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.170]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id B008E2008006F; Tue, 21 Mar 2023 20:12:56 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xhonhixuu6WRZutT6AzpbvwLF+crKjxvnT9VW85shMmvIm8C5bEC/baBKqvkXr/uuoWwj8rvButL1DQ+vgMUHCT4fRMu8+9Vdvsd+K9TxM2svnjP8xZx8psfikDgMbfwo/FzA8aR4+iqE//n3J8ONyxTz6Ehx2oz3hQD1DnysKUznWTrJ/zWzEPKYCmqKZdz7kkQbL+6CNZaN5QX8cWOtjlf1kQ3SqgY6aZky/pALQabs5sIy+I06mXe2s8bBEa5cQ2a1Xq904shHrtGeoChQ4ZkO3lJoeEA4WL1uHyh0o1TjoztL/gK84V8WqdotAwRw9OWQ3kJmxPRF0nc/fKPYQ== 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=Msa/ApeasZWDyIVGMQqmliC9DhgV10v70JxGPKM6HnM=; b=RjOxK2LMvn71bvcEgcpADNdQO0Os1L+oPAX5TxTnNB0tjwmHMVPoGl73bmZl6IVzCrka7BR+1A7XzT3YNp4VFyG+zULY7B6ubEOM3Pw5Xy+jGVv4eOIWFjREsqQ/qWmkin419Oth4sSXvu2rV4yKFRhWbn8py88SGLkyWHjWZZSm18HjAEJTCNcWXcB/kpk7xT+UrQ3sRkTOnWyO3VRooL4ZwNTz0AgcQdi99ZdAw2IuLHWNhZK/iTYAGWfpTG4CVRUYpmCeXnJc6CXJaRJM6FEp2bx18SCvK6WUlj0mtU5SXj2PsM4bbCDD0Ce+L23Cqv7b82xXbmNzj808EOzPnQ== 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=Msa/ApeasZWDyIVGMQqmliC9DhgV10v70JxGPKM6HnM=; b=kz2tE0shNrxUaxUtjhtPiPw2vAdzv0wHPcVqursU1tFgIMN6CyV90bO7QcyJGqcvgdGW3oUnjk1q5oKYQcqxoXacsFN+UklPiEu3sJuup+WH9KkcW2Yl/xvYT7d/t6Z8EIcbQf44KrPrbT9PGi/j+3yhz659uGr936zvnLrfbkIdJTxMNGlwWors6R00igzsL/JDmYRe+dx2aSq17ZJuY/CR9jOVytrK3VaCeoFrs+Ib4xlKnY6ICsqW7d2dndz3/PnEivbG5b6quKaNx/MzMYEnz/WqeDiDsWS3IScB0SCOZnXNzYcP8flUuMYeLaWfZOvaAkenUXJcWfG8AEb1Xw== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:50 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:50 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v12 10/13] arm64: dts: ls1046ardb: Add serdes descriptions Date: Tue, 21 Mar 2023 16:13:09 -0400 Message-Id: <20230321201313.2507539-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|VI1EUR05FT007:EE_|DU2PR03MB7845:EE_ X-MS-Office365-Filtering-Correlation-Id: 8063dd99-4dc2-47c1-7f43-08db2a48d05f X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ftnXvB5r6nDNDHkIix2zge/tg8mwHu9jvwVm1nJ30UeRd03dJbILaCbGAc7gkVO4ghnRD76liQXGS7DRzgxApGa/a7r6B0Qc4vz12M1stPWSrs6e3HgGsPKTApOLRjsPY9zhve1+joXdLaHdBDqVmdVpG7kpGdxYGhLW+T+VUbQ3yKQFPk8T6n8yqwRJrk4gBRn8eWNxVZIig2AKZ8EaVu68SDAWj+/wBv9zep3QZuNktEC6PxQgeyKF+zchGECD7rAHwsoeR/1k0kbcWovZAZg0JfbVDpL1GeecEsvbb15qYQUsbNyY6l6TOYo1r1RPeSSnT3n7eNN4Fnp9C/HTNxjFZcewEkRQROctWXWzsTCGDCghLmersg5N8O9VruWoY6icbdSc72GTvJsftycLsvOTFyelB7jYfa/GXUddlolOFeG3Km8CTHBN1LBnmU4FbYJhisdKpXRMLg1nF+TDXRGQrT7c9XVlPFGhkT8JV1+q4wi51ZQJ8GLzhwDtA4LEX5gNaS7hUJxboFaFucDXx5fMM1phCVT98VhZ+nl93x940dEP6/FgDdclc5qmh7pJK9Xi723IUOj/C3xNid3zReoIbcIuWWYLQ71sR0A1XXGr3nE7ElbrAs0c5djEMnDeOKenfWLuG2HC8ukDQ54KQ7BLtfhcVecq2uZ5fkMEKMlDgi9w8CecFPYkMQ/wJhZgwR7IZ/ez9ZZ+Hd2iX/2pwg== X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a8ab6373-0f1a-4dd6-251d-08db2a48c92e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NdT6dS6l9CPzoQeyqYPqjzCnsYWH/QyH9Z4h31y8TXca6XMh7GHy7Q94oTLK5sAEmGVhBtR6jsTUTEZVi0RVUozvM2NvYsVFxbwdV3icfBHyS/DlHtoWINqi6Jgwhkq3WF+PAewsljtz8hnmvu4zMp+qo78I+8IdvT/06UrYa+5VPgoxAghTDtPfGTfAGbmpm65FdPXKa06Z2mEF+FYTtIwD5xaAa43uNKIb6TuwSkd9u8wsSk7n2ghkySYKubFK++4VKC4iYtaAkASNMpaT4mZnX7a7POw/MP0A+KbesdsH7C8UvqNao+1w/Ycnma2sNAkOtAQ2Z6mMK7lGo7QeoGPJLD/IbFH15xiLXo92DfTNKAFP6JYNqFTCzS7+vggruPcYTVepK0Q1phM125AdWqF0Q0CcNx/s2n4oWOqe1PTJwCwyqto8QB7D+CR+LFHUCM9d04vsi9uLDTF2WQpxaRTU00+1WFIkjnoWtZRUEC1Ss0UpL/3+De77eVir7RW9hj3gJIxCmqt2sPJcTyZREQEAIWPbm1f1nTeDdOuBJ3bkBSg8kYi//FlLJXiG1SO2DUq0SndmYFJwtPOMZ7XkdlAn3C2XmNUYhA1EsxN+fzu/WtbrpcZmNL3UvMd/NhBaXcbLc+sahbgMXiFnhCEelmI+616zmP0756biiMI6mmcheWNA1dWBn1iDrLYmy5b/hDFG6lxqCfKgcA4lUmTre8XuJFUkykslFnHKBo01CODUkHPYsVYkKz62t/UfhEHKur/296vxSRNpJO8UwDv44w== X-Forefront-Antispam-Report: CIP:20.160.56.83; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(346002)(136003)(376002)(396003)(39860400002)(451199018)(5400799012)(36840700001)(46966006)(40470700004)(2616005)(47076005)(54906003)(34070700002)(83380400001)(82310400005)(6512007)(7416002)(6506007)(6486002)(478600001)(316002)(1076003)(26005)(5660300002)(6666004)(186003)(7636003)(36860700001)(110136005)(356005)(7596003)(86362001)(336012)(40460700003)(82740400003)(70586007)(40480700001)(70206006)(41300700001)(44832011)(2906002)(8936002)(8676002)(4326008)(36756003)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:14:02.4207 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8063dd99-4dc2-47c1-7f43-08db2a48d05f X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.83]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT007.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR03MB7845 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds appropriate descriptions 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. Signed-off-by: Sean Anderson --- (no changes since v10) Changes in v10: - Move serdes descriptions to SoC dtsi - Don't use /clocks - Use "descriptions" instead of "bindings" - Split off defconfig change into separate patch 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 | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts index 07f6cc6e354a..0d6dcfd1630a 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts @@ -26,6 +26,24 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; + + 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"; }; &duart0 { @@ -140,21 +158,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 */ phy-connection-type = "10gbase-r"; managed = "in-band-status"; + phys = <&serdes1_C>; + phy-names = "serdes"; }; mdio@fc000 { From patchwork Tue Mar 21 20:13:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 665631 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 9CC10C6FD20 for ; Tue, 21 Mar 2023 20:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbjCUUOZ (ORCPT ); Tue, 21 Mar 2023 16:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229968AbjCUUOX (ORCPT ); Tue, 21 Mar 2023 16:14:23 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05hn2233.outbound.protection.outlook.com [52.100.174.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 989733CE32 for ; Tue, 21 Mar 2023 13:14:06 -0700 (PDT) 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=KRYpM7cadK4H2I/4/ZOEGk8tk3qrwrnoYUeGqpL3XbQ=; b=YdUA4i88N9sgZ7IWl51qHo2s91aGudMlRfMOr5grCpWVQmEDRtjtI5egXUGbg+Du5JUZDC+LlTb1J5gKTqxVpXXsVZDz1yF0PBcrtIr0zdZ5Xqhcp8kukeRG0O1Bhm7vayrf4HyOLKD5q+kK04suE20a721eeULtIyhPYEAiINNrWDPZmbWTVLhkx3AbEzlVYD9FRknpiB8zMT+6vQf4h6pKaoC0eiqYaS4pGytp09IUviwvdjtkI8j1qongeiGHzObnVGES7bOQr71jJc332FdbP9KqrgDcMvKwX2/ndLPpS4DyeTiOaYKDA64THv1hSRW7xUpsGH/st4tw30rJ3w== Received: from AS4P250CA0020.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::9) by DB9PR03MB7241.eurprd03.prod.outlook.com (2603:10a6:10:229::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:14:02 +0000 Received: from VI1EUR05FT003.eop-eur05.prod.protection.outlook.com (2603:10a6:20b:5e3:cafe::f9) by AS4P250CA0020.outlook.office365.com (2603:10a6:20b:5e3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 20:14:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.86) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.86 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.86; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.86) by VI1EUR05FT003.mail.protection.outlook.com (10.233.243.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.16 via Frontend Transport; Tue, 21 Mar 2023 20:14:01 +0000 Received: from outmta (unknown [192.168.82.135]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id 4A3CB2008026F; Tue, 21 Mar 2023 20:14:01 +0000 (UTC) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (unknown [104.47.51.170]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id EDD812008006F; Tue, 21 Mar 2023 20:12:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GF6zeq3Nx8+zzddU118Hyv4e1K11griyzzHQvkuFZgKhLiS4byK2VJdXpjXencZ1fotimHTPjfmPyFl4ROPuGwPdCmeyquTeSuXqlC2eLU79CGrFUwJLC/OcoTgMQhE3UFhGL6fnZmGcCJFos7a3wpisdTgLlMDI0ko4qivyDo3D9uGemOT1KaS28Jnqf3Z3q6dhyJmpYK/OJCXESSwvXnVI2sc0gGGqKPiaWGx9GZa4CZItduL+MoOMYUdX++u2wV1NHaTi6hUQj6BmJXuHbFDiS4UgAXSadb3T3zqyYBG21SolUcvyQrf1ck/AxW1pHyhyGQZXF7/KV0NrGI3Upg== 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=KRYpM7cadK4H2I/4/ZOEGk8tk3qrwrnoYUeGqpL3XbQ=; b=CAIe10JPQMpD+nzKCVZIpA9dZc77B57tG6Ba00XS2beQdfkt9Bg53m4YneohZk9duaREfTYMgoFYa2qFtypPoCSdjco3xpK/pSZGb7jG9ztCqkmR8yy21+UENoOoSQvcu0AS8z92HlKoNVr6QZdwJaF+XC/rYMU81a6zN2FhtUYBsvBKDAq68WetrfmyM9Y78qSUhtA2/0JIav2IL9v+cYt4X/puh+jzxtU6gB+uC/LtTciAI+vzblChaM+ktNBZRBIXOmKPe4LZfGevs3GmVFg4AuL/+yGPqlG7P8E9FXphJ5OjgxQyV7+/L8hd6GEyktRwo2p3nFSoURDK4Uroew== 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=KRYpM7cadK4H2I/4/ZOEGk8tk3qrwrnoYUeGqpL3XbQ=; b=YdUA4i88N9sgZ7IWl51qHo2s91aGudMlRfMOr5grCpWVQmEDRtjtI5egXUGbg+Du5JUZDC+LlTb1J5gKTqxVpXXsVZDz1yF0PBcrtIr0zdZ5Xqhcp8kukeRG0O1Bhm7vayrf4HyOLKD5q+kK04suE20a721eeULtIyhPYEAiINNrWDPZmbWTVLhkx3AbEzlVYD9FRknpiB8zMT+6vQf4h6pKaoC0eiqYaS4pGytp09IUviwvdjtkI8j1qongeiGHzObnVGES7bOQr71jJc332FdbP9KqrgDcMvKwX2/ndLPpS4DyeTiOaYKDA64THv1hSRW7xUpsGH/st4tw30rJ3w== Authentication-Results-Original: 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 AM9PR03MB7044.eurprd03.prod.outlook.com (2603:10a6:20b:2d9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 20:13:55 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::dbcf:1089:3242:614e%6]) with mapi id 15.20.6178.037; Tue, 21 Mar 2023 20:13:55 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Madalin Bucur , Camelia Alexandra Groza , Bagas Sanjaya , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v12 13/13] arm64: dts: ls1088ardb: Add serdes descriptions Date: Tue, 21 Mar 2023 16:13:12 -0400 Message-Id: <20230321201313.2507539-14-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20230321201313.2507539-1-sean.anderson@seco.com> References: <20230321201313.2507539-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR20CA0026.namprd20.prod.outlook.com (2603:10b6:208:e8::39) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|AM9PR03MB7044:EE_|VI1EUR05FT003:EE_|DB9PR03MB7241:EE_ X-MS-Office365-Filtering-Correlation-Id: c60176e9-440f-4f05-060e-08db2a48cfe1 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: sb1UBlLpI9TkHy/Styz/owwLydn7R+gVkfCKWc4TfQn6Z55pSiNxq5PA1QHM/hlKMUUr6FxSTvV6as7dLCHwZflmV9VCvVmRMp2tLhbsIeZ16yEovRnRLalQ5ne7C2OUuVVqK5/pKdi9xzSN18jlO90wScCzlodDjNtdK+iHf9yLRiggQ6quHVUnd8DmPQPV2IIWNYWt0xxj6dKeufTcb0Ygo/rAL7AZXIN955+SUxx5n1xyY2lH4MMBtNriByI6w2BGwlNvLgUYAQ/YxaAXAD+30jesz3ARrgdxYvWVFrhAdOFDV86qaIGR9gS4lJkmCINhxxmC9VTv4dsmDDWZMNR6bnVUzXiUkaqxPfbjJ6f11mhlVdQX7NwsiGrp+T7hwRLu187bJbjWcd20bH1egSqJP/LE7J6RZ6A1Uw7F+kT/Sq4llgaUeQ3YTK+iixBiFutvQdQLY2end/mMUm2KTDMMei0ZVKv8rLF9R5/4P3uDRpVVmGWN6yQW7ee6gPrV85e8mEfNVtU52FSHEHge0FdDExOpPibbwRup7F5+32a0O2Ng7MYLoxBsglwtSw11EDCcOnDYjCF0xMvv5So/e7GXfQgEyITPyjb9/6ONktYktp1+i5T67f4E++NVtdXs4cqN9hvhOzl39QIqDZnROz2lKRqkxPteqkGXkIE4eAPXy8CSx6s4yJU3igZSGknP X-Forefront-Antispam-Report-Untrusted: 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:(13230025)(376002)(396003)(346002)(39860400002)(366004)(136003)(451199018)(2616005)(54906003)(83380400001)(6512007)(7416002)(6506007)(6486002)(478600001)(316002)(1076003)(26005)(52116002)(5660300002)(6666004)(186003)(110136005)(86362001)(38350700002)(38100700002)(66946007)(41300700001)(44832011)(2906002)(8936002)(66476007)(66556008)(8676002)(4326008)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7044 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT003.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: bd5a262e-0c98-48d0-3c46-08db2a48cc3c X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bQTzN80Aq0EmubICUkxgbYkHRV1u6QK1R2XKjhVL+RQF/bWuvvi0JjYjuMobxuQJl6IGC2rIAofLIlGqAlHpt38/dAC+XohWMg+QgY6cwUEWlCfb50kuqZKMuENiav48Nwpf1C1KMaJPAH2Fdra24sAAeYkLBRIYsLZ1OHkVigaTli+8L9Obffcxv21X3HcOOS9RnuoNrJWxORdsjG4mbhrjjMpks4KiKfbDVZ4fEK1/DW7bt/kt5p8amUNPUtBBiEVqQhCon7LV8o0XnhtsqvDpAfEsTyC6lyq4O6gx25U6WU4470wg9//CPbcr2SYwPrmrNSsbF6KEoZAAAN8/5r/1cbhbMOtLhCR6cFbWpAAIXE1cPbCYDDApJNuslGsEi8cKlZpyokUAy579ipMd9sKohG6ugmPGkQCVpNa+r++QsoeVeiro3y4p3kQkb19lQWiRsXeguEFNNnStvukkbTAPbl0j6SMBvzoPZ2CeYG1GNBbxV199bw77L43TTRGerHmnu0EdNo5/ovWokifD4bq8vMqIeYSQV5/8TCkpGiv/bLg9VUa5REx3eQgAMiKYY/XdJ191tMkuSfKx+cLjncO8pY3TRMl217jld2abmPxjh7kxy5D0VurFFqOi9eDy9oO7/ICrnEVulfyYrwxZNhVu1iFaLZXLB/6cYEuU9RJRTnw3dDjNPt0iezmpKPnmbmAeACFRXjr75giFMp4iU20YaYJyPKWx783KYclxXiYgxFZCNTsMCrv7HccDzHLB X-Forefront-Antispam-Report: CIP:20.160.56.86; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230025)(376002)(39860400002)(136003)(346002)(396003)(451199018)(5400799012)(36840700001)(46966006)(40470700004)(2616005)(6486002)(47076005)(186003)(4326008)(6666004)(478600001)(83380400001)(336012)(316002)(70586007)(110136005)(26005)(70206006)(8676002)(6506007)(1076003)(6512007)(54906003)(34070700002)(36860700001)(44832011)(41300700001)(5660300002)(8936002)(7416002)(40460700003)(7636003)(82740400003)(2906002)(7596003)(356005)(40480700001)(36756003)(86362001)(82310400005)(12100799024); DIR:OUT; SFP:1501; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 20:14:01.5606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c60176e9-440f-4f05-060e-08db2a48cfe1 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.86]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT003.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB7241 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 --- (no changes since v10) Changes in v10: - Move serdes bindings to SoC dtsi - Use "descriptions" instead of "bindings" - Don't use /clocks - Add missing gpio-controller properties 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 | 82 ++++++++++++++++++- 1 file changed, 80 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 ee8e932628d1..ede537b644e8 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts @@ -10,17 +10,55 @@ /dts-v1/; +#include + #include "fsl-ls1088a.dtsi" / { model = "LS1088A RDB Board"; compatible = "fsl,ls1088a-rdb", "fsl,ls1088a"; + + 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"; +}; + +&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 +66,7 @@ &dpmac3 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_0>; + phys = <&serdes1_A>; }; &dpmac4 { @@ -35,6 +74,7 @@ &dpmac4 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_1>; + phys = <&serdes1_A>; }; &dpmac5 { @@ -42,6 +82,7 @@ &dpmac5 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_2>; + phys = <&serdes1_A>; }; &dpmac6 { @@ -49,6 +90,7 @@ &dpmac6 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_3>; + phys = <&serdes1_A>; }; &dpmac7 { @@ -56,6 +98,7 @@ &dpmac7 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_0>; + phys = <&serdes1_B>; }; &dpmac8 { @@ -63,6 +106,7 @@ &dpmac8 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_1>; + phys = <&serdes1_B>; }; &dpmac9 { @@ -70,6 +114,7 @@ &dpmac9 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_2>; + phys = <&serdes1_B>; }; &dpmac10 { @@ -77,6 +122,7 @@ &dpmac10 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_3>; + phys = <&serdes1_B>; }; &emdio1 { @@ -128,7 +174,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 +216,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 +236,31 @@ 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"; + gpio-controller; + no-output; + }; + + brdcfg9: gpio-controller@59 { + #gpio-cells = <2>; + compatible = "fsl,fpga-qixis-brdcfg9", + "ni,169445-nand-gpio"; + reg = <0x59 0x1>; + reg-names = "dat"; + gpio-controller; + }; }; }; @@ -203,6 +277,10 @@ &esdhc { status = "okay"; }; +&pcs_mdio1 { + status = "okay"; +}; + &pcs_mdio2 { status = "okay"; };