From patchwork Tue Oct 18 23:11:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98977C4332F for ; Tue, 18 Oct 2022 23:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W09BBUPyVCn2avhawP134YpnzQ15AgZu+7mn9XmiHd4=; b=2d6u43bwD9u2f9 /3WHGQc6prokWcrqGivrARHWcZl8WfAoWxAx5DvCqszxkHJrPwi3PtLSkxj2TQOm4+hk2FVnd7Khs dK7d6wJ7o9k6Ag/4zgGoi8T4/CBwd+CkQ/VQYxZH1ISCo8MjWZhF6NbBagjWZVERoug3Uu4gsHTgt EC2Tm1ujwS1ewv0LuDIeAA9J+0Aof70JXaXb6t2JzK4gffO7+e6LcDqFIxK13bqPnaVDRe5wSl7QQ NbIPmviAdtg1OhTbcrfm42ax4yYtpOnp9qxPovAn6RxhRZ7AonwFpWBuUFz1oJZDbqd/U4p2j0qv0 4fHVVF+RBhFEt3Jv/oKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkC-00AqsU-Is; Tue, 18 Oct 2022 23:11:32 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvk8-00AqqD-KJ; Tue, 18 Oct 2022 23:11:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I9p+LRSbGmOQ2q3RVlp+VLPvzsc7/6tgk/mRLQOKndyoxahpYl6TPS1nlmd4IddXpv9rMOqRD9ntOOZpFPnbS+P2zSbb5El53Emh1n6nbb0Sx/3WjzSHaOPBEigM4SbRvZlmuZ2m3PZub3vNTt+CH47NFNNmPW254kVH5Kvz9TX0jz6k3598FWDdfC2Q8V496IY4/0ylsHWzppBj5nj6M1p91L4XUuHnk6i5sEW7C2lsGOw9slLCLofSszKt7btbsOsL+8rhvAMqrFXvhi/wZyhjPpFIb+JxIrRDe2EgHw0uCCtBg9piP8cpsoLR6oHwZzidV27PMuVVU3XFYnooew== 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=Cqm1buUjXXpoPpHKK2gqMH1fL6YbpyTqvm2DhL7vQlv/sEgEG8RNzp6F+atCO1+XQYa/Q2ey/Ad78ajv/5ZylrriFB7xaiKCHxlXfQfNmrlXyMMAN/GBL0Jx+jpawwBRTTDpI4/3AJymAVZuqLLbTOMs2NTSz5X4Fr8O6yC9uxMoEKXeDbowAsWND9j/mor0tOox0OM6t9PSlPDLq5WFZv57Lgd3yd1b9uIx24+HGqD2yjMkmsFVYQLgaNrffEnm33wLwYH6tgMzIvuvEBr3MHPYBRvBqAaGRniNCQc61rPs+hzo6VVSRE/bm0Tb5gWnl4BXTq0GLksRHNxHubiplw== 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=RrTJ/LMiIIXZ+IWLc9b9tkeENHVoTVIMMVvlwgLyAfLgWxiO3SQ2LeHxAj89WcZlj8iRZxtOXhGBn5tpRWfoFhFmLwdNTo4WSqRDcn05dw6EucxyjLUgEKGrACuxSt1WuwZCbITuqRIpjdgtGVQVTkB5LwtTwi8okV+nNL+o5Zc69O2F52qDV/LfnABvyLUXKJZe7dlcUp7DluYCogYSaYtg6LKY1BAx+DUbJPFYCy2baDGF0znN42LzZvL/VAXP6Ji0CN0C07KiIT+O7DJCdEOfZxq0808XZU25LxeDdzPID3Nyr3DFFk1VOojdP5PWR4LyvI72EKMXx8bT/K1/YA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:25 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:25 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Rob Herring Subject: [PATCH v7 1/8] dt-bindings: phy: Add 2500BASE-X and 10GBASE-R Date: Tue, 18 Oct 2022 19:11:05 -0400 Message-Id: <20221018231112.2142074-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: d34e35a8-d667-401e-5d6b-08dab15e1430 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OjmlDQ6+w4DftxNRuD7V8q8n8b2Hi5TjLxubuC1777WlkXkxjEhwJ8Yosezzv9hXyHgOpeeCIM8PzBBzTlLJobZf/If/eIVT8YBldjoajWUxIfdZ+g+33SjETlylGBjNVMidd5rPcYQp9U1KWo5JRipS8kvE+kZR5CIA9NFfEDsYYZF4QIcvCspMuUZ9dcmzB3WG0kP+5X30vtJuCP2GSzstOpVHo/0kj2G0iseWpKAEbSP5/RUUzc01zDkDZVq0OK6lSt58W3qk7rUAMMNPRd9oKn9mJBjX6AD1VCrVGDM+7Wf2IdRZZszDHJEKT5RAnnfIrNPA7pxz6Y9f4V6rUVVJZ3QljAvSjtF6WKaYUmsQeGWfTCI3sgyldIjeVt7B8OupOclUS/LMVzMkFlYic17hhKmnbjivhQl4zCcIRP/mKyOE2D+MiBsbqP5ohZ5dQc+xvP2MfI2zJDuHEFVBKyL28skieLCoXJP4FxeyvQponR/5N5zTZUWRXpd2BTCO6S8fqrcoNGuJ0S8PGgOa9AF5Sj1O51a3sBFyjoWPUKMV3z3tZZHJKuvMHt00v5wvaZdAz8rTWvq313ptVZ2vZLePqD1w0mrJV+P11E1gA1QaQdadZWxyH8Qr9krqUUKhJYag7pixGhcAGebu41gCE8ejUVP3gdjZoNtEcr633SpAfB5vnfIZW1Et87D5cpubhFOOlyou0EkpjxgqlK4dhsNGdQyKtOZshaiSS4n1YZtZV/It2dSI9ECrSy9tT9fgYV6E3y+9sGV+KS1+JsJCcOVP7gvceROCoHniDCG1Pfc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(966005)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TBW7yKmO7O8gOY3rF40dLM8MX9be05RMMX1tG7J0R9RkPo9NrwSyYrcHR1uoAEVhbbBAMjLjLtXnkd4WI4ePghtLK/SOLX1PoLzIJ1TMtfj+uToOnRp+UEdeHdHqw6TGfyPVm2XceStisGAwezvMH2Zmntx2eXlIIx4MaksvUbeSDaVhHbUHipf5a213ePPXi0ApcyutaiAIMBlXIzpwBeRaunc+Jg1mgSEkvi7LjZxPhRcXEPhx/QXI3cgogM2zmGQ8+W9Tqncs+D7wJmSBY4xk8ruF86gYP1UqacrK7YH9pB5PZ/iIK6yMvnqjd2CKGSV0uNA5Pk0IiPae2TroV6mvnAHZQpF0FN5UK2dYAzAc9jLKzvK4Dr2W187tpIWhH7xSeqpQeMCktK4V1W5FWHOKqfpEslcKhDwQlyPKXg/NpVnwtPN/hg8smR9o19NFgqsKsE9NowyqSsBP+t207+scqZAGp9mjdoQ4hw1oMHU3RowT4dU+ntSbm2fxr6syNHx+OiylefTkDG+KZ1bWjMSb7awGCRj+hZ+kOxYPwBHQQRwZg+9J0ItJfZe5BYmYc4Z2cA4VSaqLUrDL8UBJ3oJzm6v90DGo6W7Fzto4h1CZ/CkVRnTGw7ch2fS+CyUAfWAu7HepQwO4XYqkbXW4vRvMr4KAMjc/liqCS2LPq4ShB0uU0SI5favnoUOf0AA93qwX3Fruo+AuIbQ3RR1N6NYShKtZ1ZDtXVBsPxqBCk+pa+PAkgecZoICSDMiTBtTviAhpk8bxPWir0Al2EMFmdRjIuNwWqi6v6TNpjn7tw2KndwR5v3rgXS/CHvYjD1bnfoJuaGxpB4dlMcG7p16JKJErzaT4jXn1RF5+VCR91nqAUJko/Im629hxsmIpHyPL2YyDBPaU6bsIiHHnkCHwPOtOJao673bAx8RBpSjbbNCFsiTLH9kNJlKLyS2l6Yh/d24ZB465YtNbV+NSnaOqgTVddE7R+d+ykxUf6T76/P7ccJqcuBGvEn2+immFUASku3nRrbqxfznN62OpE3I7K20FokvT5KPZgypNR/k+GYqJ1cUnVf2IzzMUFogrTXohSP8pGF2D38CU/WA7RTCiA7dWZKGt7BqN9q4Nbb1gr9uTfG/zr0Ep5coQ6vsrfyCQAdYBZG1ZsqJqldWMgG9Buxe4G9FfWEXW14EonxdbN9MOzyPKTYr4/SM60un2z0Cb0MsgA0NaLIgXsKBTxGjMrBYyrkM+UHYXoD1VmC7Pb57hZUv48GK0sDf7zigtP0++G6toJjvSguQNzw1mh4VU+9x3W0s9nRAL0k+gnpy8nGQJNHs6wsyuRWOajT46CkJO034kyDX4ZjG5BJ4ENYYV7JjWhaa79h0LwO3QQP+cwJlM+OvWi/ieIQweUt3hzsg8R+On24/3ZruyA4/IJfEopOSEk9GFEbMJa0a5PWcnmnA9CRRUgsYQ1J7fDvtbLuR8QI/yXHF1UoHkXZSZ+IulGpMEGS5T8tvnBByWgUIYqm7Wr1BT0wHEXUX+0BPwEE61n6AjXXLJGCeZP15boF4IZxRNRV6cYJVbuXpFS7uKzHPQrn6LtfUBQI2VXQbKzrXpVZG/Hsn4hEOa5JEEI66XQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: d34e35a8-d667-401e-5d6b-08dab15e1430 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:25.1508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ry7bQ48rEApK4GIxEZpZ7CQIMq/mkvrzUxqlSTx6/dYboexEF5ApOhSZ0zOr0W/sm976moMTDAm5A9JwbC7Yvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161129_049416_A9147A5B X-CRM114-Status: UNSURE ( 9.17 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds some modes necessary for Lynx 10G support. 2500BASE-X, also known as 2.5G SGMII, is 1000BASE-X/SGMII overclocked to 3.125 GHz, with autonegotiation disabled. 10GBASE-R, also known as XFI, is the protocol spoken between the PMA and PMD ethernet layers for 10GBASE-T and 10GBASE-S/L/E. It is typically used to communicate directly with SFP+ modules, or with 10GBASE-T phys. Signed-off-by: Sean Anderson 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 Oct 18 23:11:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45794C43219 for ; Tue, 18 Oct 2022 23:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WvMJqejDYb4ljwZV2Ohf7U3EEwJvdrM0EC4cPnQjZPI=; b=krmiAoTmagA2zn C9ylGXxQyYglYpnBWPPR7PETmECFese8nI6tA4YAU7N+vuTqlw10C+zo7r6/qaIL2/mH1y4bq/MuS rkmnugSRQohwkS+/EvIPuboazR1vbsg2mC7sbVVeaqNCOXhKbv8OMLTDtwscI80jVm4o/68DuklwV kNnHRe/buLGFfLSOyv1622UYTj/jzAFyLap53O5VOtjsUTeDrpa6IJsQQGbAoMmgy/qQ7fm6IUPZ1 2RNvWtaeTXTtl9pxniS5dmYqTZp0gyGgynKRguJlW1RLBb4SyRX5grYCzYjjmxhdDZ6AeTTgocRH8 5Zl6UBjR1+VErZdEjHnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvka-00Ar07-H9; Tue, 18 Oct 2022 23:11:56 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkB-00AqqD-Fw; Tue, 18 Oct 2022 23:11:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eWmWiY6HXWF2Zwgsw8ltXkuH7sK3enJpH4cJkNH+NFHyFAvGCs0p7iIdEd5cgqy6gMHhMagVe8os0Q+APCAh+9jpRuoKTmuaeYvcD2qMwfrHmII0NJhas2br6I0/+zy+67WUVqvTmjb9xn8pmaZ7mIDEAXVdb+KHcqhgDGeq12QrIvCIv1S706l9+iy6kYY6Hwwv5ysRd1AwDirypJ8pdreR9LbJFxBCBQfTS0UBOD5RhDQxllGCF0VgVjoj7ilSp51lIdsQFtvw7PfqCUFUgK2GCD28Lpo6YLTv8uCoDD5ymADd5GT2Hyvh6e2m0OIs0N5aOfhNvDZ3+WZThoxisw== 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=1U/01l0e2dithoMlaIAqdfzbPV9jw2reG9G7wp+CC9g=; b=BBrv/7WqO3zybohZg7Gjk6JzIuFLDaI4pofAyI6kztTxeTmiBlpOPtgEToNnWD9m1UI0yno0g5bHK9UyNJQ3asB9yFLsGE0lHepvhBYMVenD9P82nz6q56cd9fG0BIonySLs6vrbvCJFqtsCJxC8UVHqDpl8hVX+etoWL5ToCPDGJHhIndjjZKADZUzRQfUetdanCt+7lSVuf7MKg9xGgWof2puittxHAvpEGuwg6tugv3x4+uCAm45zkJxPd6SGWFhWU+TlIDG2uEu8L+cjghCxjRaFGBvcPX6/M/uWr9gjXj3dl33V9P4ZavVHLuwd3Ng8USUG+4GqDREAOajPww== 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=1U/01l0e2dithoMlaIAqdfzbPV9jw2reG9G7wp+CC9g=; b=eUxXP6NC6OOiEy/gDc3IdUDQ8zR549HgIw8AYCCcAr19ZP2sSHaOpmLLbtjJqZsy+FXamEkpLQLlzFgLIR6paiUyIwii/O3SaJBggCQ8I19qNuCWBLfDu+YJ1iDIG/ncWLXLNgUbIz3w+g3fsH7tkxixvCUdF8sm8TDnmelAC/7Qt3ZL76y0KrL8jNU/TdOe/Xt/4c05PaNoOtCoXmq5ygISK8smveLloyHdZW6dZmLz71evzsz85fe6d3cHw5iem4l64LRuLtMaMAVlI+nWu7PZPNKtqt4euuUiTYqy5ScNYOswbnXXoKZ7kr1cQNN7ZJeI6lOD0G35EBPRKH0NYg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:27 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:27 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Rob Herring , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v7 2/8] dt-bindings: phy: Add Lynx 10G phy binding Date: Tue, 18 Oct 2022 19:11:06 -0400 Message-Id: <20221018231112.2142074-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: ce9789f2-3774-4528-c2a0-08dab15e153d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: shblc5wFqWz/1XNMPNU7pBMozChKoJzvcH8QoPjL2093sIDkESU0pWe+TJo0e0t0/mJXe8KynS83jOv/aX9Rp8xjBaNjfORg194uPACMV16D5ysTjRiUTsTr50YX0hJ/GWIOCYcSOxKeGxQ+K8KYy7UYtv0ufqAuwP+l//n4/70Cv6A169xhOadPvoSCczr3eWmx9EyiiGpqM6gpMDmVGqoApwWxbUhh4c3x4XwQ75dBTrMZ3KMUOG+CAie9MhTbR3DCzGC6OTHf3OR97UgtCX/xM5Q3moHZAM8QyLo75OAH1PgguCADUwgxrPqUW+x84OCNo7FNlN02rQ4vlz7sWbUZuaywx7Euvwl+GEJfFPlD1cc1M4V/YeYRACc3Ca9Mk0fMPjSblM4imdfUzzVdR6eFRP9K/a1A6UI7gW5n4sQtbJgm3Ak5JsaxsXJTcgk5M/S8bjFf8gBiNChQC6HpIVLRfcgralU08oIpOX++YNaAebcBCM+nqABDNWz6dZe4AWyYPXinAD57mYLgkRNRhoEkRKVACzIwGLJhmZkYB/LLYV2oeJflGzpFr+8lrmPrMVw3nSnaqa3198p/gETXSLkUA+A/yYcT2ekgcU0fIlGlyDR3WLCyOrc/ichU47Jp3jsQgISR2fxQJF4YkCxatU5SB6rURarcOvhBUxsWKrD8BVJ7SnDKmPgzQou6JPmPcMiNnO1cmy2FLlisOwxUllwL1V/uYi/Cpml+Rg/+IklyjL3luhVMpEX/H/mFOg/RQp2tGV02pkyMqQ2aRnZrGS3ABfz0YGJwodjQ21mXwN8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(966005)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mi8nTfNaIIAcxz0FYiiYTmGkkcZVfzUVi/qcEVhoqz9XeVNTJ+lw8fTFHve07mHxYPR+hPUVqGRes8JHHUGfJ9y5mBenY4R0lmg0lq2gBEBtqEOctpCfmVYPDu5iH7YR3edMS8X/dAam3N5fxyVPrKMmz3dZuzAPadJ3GrvzwTQNvUBWdDDvb7ZHcDVznoLT2Y0yIMlSYhzjWogl5knu3UXH3sRSj36bOIZOwzFxDL1ZO7+OqxntSytSlfXC8xRPH96OwH+4AEXuVhK050sahpLGqUj0/XwTIWDfq/1R3D3wn/lz9s+Q63py7G73RqVee6KR6jIAkR3VYFhtvnCKAGG4AASLpmd34zBlykgVmHpPaZyH2Eml5IrLdFlNeslytmbIExAt4sWtUzODhJ+wnJ9R4E1hFTUo4XXMVTt7OOSdRGAFaNg/fyan53cRb8U8Z5W1kifdsCCLTSUfMg6OKDjPW9+ZzwFpnEurWsggVzIYiu1G9Srmu0655zFGR2v588YivZwksZg/Pqk5Ph//ulZep1s1aVc0Njybi87ldjchDteVfwTS6sNICMuW4uHXRwmm+I5mvg98BTeRFZHA7n3CC0FklW2cf2TvRjyxR4TEueWLSPqTmURdweBRw2nVaKU854FxkgGXKamLaOKnAq6JUbAgK/3fQMEsh+cvlogbd4q4+eCTry6A80NRMD8Qedjym2qA+83Pj1iocGMSTNoZPVGuVKnegNfB/JSY9OVwESuUhyfT8czySfGvd9bKjzcvRNKwVy190NdwI/hP1+OGvHtr5peeF9DcQKyxo/YjShH+SilvL6LWzceP44OpnQLMhiJTcT4lFD92CiZ13DHQSIQTkhC0LSdOhnMQODASoG9jhUKx/2UZCKa5OUkEZhp4LFvjlVADdlqs0pBUokngrCFruprpgznwHrq/fhot8mXAzO6O4fVpNNItYz4FMGnLLf9lHV2lzTQnVFNgWTTM6U9ewZtlBtydSX5+uZf2dV6x4i9+jA+S4fDevSitRHbZwAoiAR8xbRW2EpwH3b+g0g6KwbGqRCE8mMlpd9ZVD7GIZeyXmplakAFKj/ZeM2jedMuwu7+jYxat3MvZix21MwkJ5y114WG0v4FGZAXhr/Cizp3vrh/eeWzzomDACh4sQZCgv2TOyxW/+RJLIoKliv6eXkvJ/TDKKgYPxb5q4+MMpXRP8A0gFtAKWKwkFow1dPY2XEOBrqke5qNX4HUaov5meD3bPAEc9L7aorwMiIH0XFuAyXQ+uHNFJaPszcKRupsnDP6Za6qlyiJqDqnigpbYRo8Co+OkItQdA5Ue17xOBZLmhWWIxXGFrVA5cG6ejBbIiWfYvrhgfDc8E+/tN4gaZcG89OYYu7ANU1h/5S7VqhcFT7F2qIaS4Qszjsrw1btzMmjzGBwwfujHWmR8g7B6LPq52HU1dPoJXfuxdBUQQbewb//kI+pbNrioSFgpBXBOLHraQ6e3bRGZ0UvBDKwF3iaG7FWMA1Co6ufxrdOqlzXKzCu3y1sBUm2wCGf++WF2XR9GwzGZGLs2tPEhzwQc2iY9Mv4obChrbtHogoiuMkTnib9TwgqqBSrBlndtXbqmHPlmF8sOn6oqww== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce9789f2-3774-4528-c2a0-08dab15e153d X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:26.9476 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +0LYwhg1Q+2vJrTCPMdlxeMqcR0Qt8bAKrwBdifz2J8ZyzGMfL6FWdcLyFuK8UINECEMw7/bc49jdEKiAo0f5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161131_722922_027F8180 X-CRM114-Status: GOOD ( 25.03 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds a binding for the SerDes module found on QorIQ processors. Each phy is a subnode of the top-level device, possibly supporting multiple lanes and protocols. This "thick" #phy-cells is used due to allow for better organization of parameters. Note that the particular parameters necessary to select a protocol-controller/lane combination vary across different SoCs, and even within different SerDes on the same SoC. The driver is designed to be able to completely reconfigure lanes at runtime. Generally, the phy consumer can select the appropriate protocol using set_mode. There are two PLLs, each of which can be used as the master clock for each lane. Each PLL has its own reference. For the moment they are required, because it simplifies the driver implementation. Absent reference clocks can be modeled by a fixed-clock with a rate of 0. Signed-off-by: Sean Anderson Reviewed-by: Rob Herring Acked-by: Krzysztof Kozlowski --- 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 | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml new file mode 100644 index 000000000000..f326fdc159c5 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,lynx-10g.yaml @@ -0,0 +1,236 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,lynx-10g.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP Lynx 10G SerDes + +maintainers: + - Sean Anderson + +description: | + These Lynx "SerDes" devices are found in NXP's QorIQ line of processors. The + SerDes provides up to eight lanes. Each lane may be configured individually, + or may be combined with adjacent lanes for a multi-lane protocol. The SerDes + supports a variety of protocols, including up to 10G Ethernet, PCIe, SATA, and + others. The specific protocols supported for each lane depend on the + particular SoC. + +properties: + compatible: + items: + - enum: + - fsl,ls1046a-serdes + - fsl,ls1088a-serdes + - const: fsl,lynx-10g + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + "#clock-cells": + const: 1 + description: | + The cell contains an ID as described in dt-bindings/clock/fsl,lynx-10g.h. + Note that when assigning a rate to a PLL, the PLL's rate is divided by + 1000 to avoid overflow. A rate of 5000000 corresponds to 5GHz. + + clocks: + maxItems: 2 + description: | + Clock for each PLL reference clock input. + + clock-names: + minItems: 2 + maxItems: 2 + items: + enum: + - ref0 + - ref1 + + reg: + maxItems: 1 + +patternProperties: + "^phy@": + type: object + + description: | + A contiguous group of lanes which will be configured together. Each group + corresponds to one phy device. Lanes not described by any group will be + left as-is. + + properties: + "#phy-cells": + const: 0 + + reg: + minItems: 1 + maxItems: 8 + description: + The lanes in the group. These must be listed in order. The first lane + will have the FIRST_LANE bit set in GCR0. The order of lanes also + determines the reset order (TRSTDIR). + + patternProperties: + "^(q?sgmii|xfi)": + type: object + + description: | + A protocol controller which may control the group of lanes. Each + controller is selected through the PCCRs. In addition to protocols + desired for use by the OS, protocols which may have been configured + by the bootloader must also be described. This ensures that only one + protocol controller is attached to a group of lanes at once. + + properties: + fsl,pccr: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the PCCR which configures this protocol controller. + This is the same as the register name suffix. For example, PCCR8 + would use a value of 8 for an offset of 0x220 (0x200 + 4 * 8). + + fsl,index: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + The index of the protocol controller. This corresponds to the + suffix in the documentation. For example, PEXa would be 0, PEXb + 1, etc. Generally, higher fields occupy lower bits. + + fsl,cfg: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 1 + description: | + The configuration value to program into the protocol controller + field. + + phy-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 + - phy-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>; + phy-type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SGMII.5 */ + sgmii-1 { + fsl,pccr = <0x8>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* SGMII.10 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* XFI.10 */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x2>; + phy-type = ; + }; + }; + + serdes1_3: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* SGMII.9 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* XFI.9 */ + xfi-9 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + }; +... From patchwork Tue Oct 18 23:11:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C166C43217 for ; Tue, 18 Oct 2022 23:11:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OILcQGnJNIYL3R5ubpVCCemczVkIiMa3PbNAaDL+UdA=; b=ZXWICD/wJfJzmK azrgUsUJ5/bD7yf/vPMVabwC42B990MoHC8KySz0Lv3MBsjOnxiWDF0Lh3CBopvOwxKyh4xLZgFnn 1AuWU9mLs67vUiZpLCkC7L4glAVPLoFSWa/tBQoj7zYuSxMJkpipmzde+VHZOfoaFOSTpZRlraZIp i5GBTOeyzoLIOkAJUtBYe6dMGBBsRQ0aU/B5scBxt2gt9MXlqw+R9D8up7KYD5AaHk2eecrlboSCq +6CoTbnlBELwakj+D7Q0I31ovsgGD8CaEzhWNU+hM0UTOnQvanj+xcOYlWHMMFcyolb7PamKs04aH 7UJ93sEBx4eHUfXuHs4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvka-00Ar0G-Mx; Tue, 18 Oct 2022 23:11:56 +0000 Received: from mail-eopbgr60044.outbound.protection.outlook.com ([40.107.6.44] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkC-00AqrD-DA; Tue, 18 Oct 2022 23:11:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S3Bk22s1lNmY+WFykdYxFtrdml9SGG7LTRS9Gox/l8HGJCvrNR9mE0jSVFhnAUAPP878D9V7Lc5lhSvX9PkNT7H65XXdzuJERg3yg3L+xZdeUDnPhd8Xca8ZcYu+55LjjwKpqYKmY7nI0m7CaIJceKGGd3GmDUsZyZE4FsckFDYSu6TZIjFJ6efb4tOLJgxaKFzh3T7d4MqnGFIQzoXZyWk+XkwohVsuML7denfwPtplhIHeoncSLGtyFteo+JRwZvyFOegfRiU3byXWEsBB6SIYIeR8REau8btAKPEP5cF1HfvmvnQYq2/790kNQ7sI5z/8H9aUEt6JWqIS4J2FMA== 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=P5XTNRTW2LGMp7+EupsJIUf+ClgL/wdCPCUA1tb0CHDoQhUp58QskV0XhSmHLN4iBcAc8loemSjQomeUA3YwBZhmRmEdMZK/oVyz+yeswrKamoJLeO8LAiFoQL18WNvL80YAGFdeZWWhguiX4/3ZtMbJhAeauhLf/6sTcp8m8a554rbeZPiJs4LVgQCzoGJTs0ad7D6E7GsgkC8z8NgHKw9Nz53lm7WyG7z6/sotRq9L2PCjGwq4fQAKZQzgEVf+LdkmMAOWUj4128kGAIHxwvYSLHQJ1PHOHQOSQIjH6vL4g8SJfJ3ZAG9ZF24VWeBLcrFO4mHMnYY1NnnZJY4s8w== 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=G2oh05vuBrpPKpn1mtoWvHn02C6X3Pf8V75r/bYBh6jO1HiP2ZprhSMYmAvjB469DnyLyohFE01GXxDmaT3qcKbQt06oxhp09GLcCmGf6ZDIx3LDID4AQRb8ELgquy1XSUMHy5+TgBv4kBuyG35i6I1VkuEFQemkPdhMq8YsI/2Sa/UJlQEgjq25oGMW0wj56VXeMhJ9WpYQTckUUtRBixcYCjG7ynZN4x4J8gXOstY76sFK6ccx64MhhfK0MY08p0+J/cjZiS6HFvLouOCfQk0y16GEbn2W+wyre+3zBVrJH0F0bKe4LPBYqeQUZfNQB2wPU0sdU+8s16XBEv58NQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by PAWPR03MB9642.eurprd03.prod.outlook.com (2603:10a6:102:2e9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.30; Tue, 18 Oct 2022 23:11:28 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:28 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Rob Herring , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org Subject: [PATCH v7 3/8] dt-bindings: clock: Add ids for Lynx 10g PLLs Date: Tue, 18 Oct 2022 19:11:07 -0400 Message-Id: <20221018231112.2142074-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|PAWPR03MB9642:EE_ X-MS-Office365-Filtering-Correlation-Id: 59fadede-ddff-4a51-6335-08dab15e1646 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UwhAkoQKzJ7DdKnWzzFSxAL4xw82O9oDp0OlS2HHDTN1+FsC1sWKHC9f3AAIhW28OESamXrRzlBRln0NUpDqTf4bQbskgaLq8XM9YWn4dthaQjqloeZXyfw1ONk3ymX5LKOzNOMfONUL2P7g7JHUAVSSLXfaf/49BTl2gdwLTokuIRQ2tvEr8kC5RJ3B4xSWv+2jo4pd6juxavSTlgnEsvdqeWW/VpG+iGl6X9ktPRSPbHVLQKiysFyWVTZ4Q6dOGhybByR2lkYOQiYC3l0yqZbGrA4Hj5WBEIIpZHWfVjrqGvxUsxdattbb37CoCnUPVeHR6DjYnh7LqoVvsjQ+lYT1POrkTgKFUWmcyl6XMdgkaQW+B435z5ssMajlmee4MiP8jd0DjyL3+i4TQQI8jDsV5O6AmMWH/cdhWhwd6AoRDDlK6H1UP4/6QgkUzm3eRiZqmpnx6RluojZyRqeygf3kQPZbA/YR9SPvoPuhPDBNMSYPOSYp0bLNRG0y79LCJOwfK8P0GX0OCP0qABOKtl8vvrZKbgy6hjFo1NNFMooZfbNy2ftTyiEL3JU96j9cmdKa4i/HIVpS034SHLEwMaXleGnawv5uAL1CZT7xlVXoPo+3rshjPdSr0H524WWCyRquRDbbfbgozpHv2MweaNIqJDNz3kox9d5X8lg1q9dTWmlCNIgexjDwvgDwUKvtyQPPg/iU8FWlgFm2PDnNPD98CrGvNopktQsCxOALAqaI49MW89oDeURZT0dGWmwCr5CS0WVTvkPxI6Yb+y00XQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39850400004)(451199015)(6506007)(6512007)(110136005)(26005)(2906002)(86362001)(4326008)(8676002)(5660300002)(66476007)(7416002)(8936002)(36756003)(44832011)(66556008)(38350700002)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kUx2r0VUgWVwp4MYPGJMGtYnvYO6yNQtZUKM/5oP5Deli/UH4SZJJW0phJH4UiKcppp8FkxPirb0KP59cJ783Fgqz6enbiB8r9FgJLHkwhSJ+fKFzVSbKBOvHTe8sewOO6noIh9bgsaoJeiJcp7un6zhS0O0I1lKmhJm3mKRismiMw1wQ/i8IOjXsHXZdEoHIFcdyGkxN+fWlDUQIvjJIL43DwZ3EJS9PkAaUjJto5i9+dopm9g73hAfCQnJEttBEeUMF3oxGs54w6nRrekJTgQ6bCVPQypy9VszPlw9IOShmjB0SZkv/Xi/4nd0hMvVvMnaZke3qDROko82TtV4okqcuwU/3SqE4DLSHw6cAD4vsKNcZ7Iu+1JcYZ5kGldntUGU1SJDlUSDPVJilOF4o3NyLYNjnLpsLJ1Dh6gpokjGYIP2P4a8eA5E7THcLpBVrZTXFPNvUeHJWfDbaG3s4b3MZ1H2CRlJm5WtTfGwGQdAo5sTTWrIsScK0V5ETR9ueqfaf3K3jNUmozf0jj+DQmg7GAozy3tPakUH87ClOC0oWoUUoZs1BnOWggPIfVK7Y0I7TegcT6O/xDUfU6H+PWWAYHTnmapMr43uUbNuG/9vdQL2i/v7vCfIuL1BZ5dhQAIuyzOjTyaRlW48fZN1u5yJgZctCrdS4lbU42OWz4M/4Uvp31E4k9QsJtzzCtAEtnKyeFdJObEosRdlAAmdXORaXzSzIXERXmEvxuLF+0X6Qycg68zdvLUk7lxRHLvhAEsxHPZoHoes7umSZnAyfAbIKhYwIFeaXeVXiBMc9ETybKdHlu9zQleJkAVe4Ec0wwgD6Y8TnY368ODID4EVv0Go/8FUkdVuv5LJYs19A3tDcJ/xt73KUq+32VLHQmcZTGaL2ZNmSFTXiYQUXRx1Z4ficQMQz6TdD0ChGdrdfujcPecQEgdIRZhm9EBJxGKLTde2S3RQFiyLiB3McES80S/fYcZSVGBYep6GLlRwoCqvknOozfSyGAQBB/k1n2xsmxc1h2TBkGRwpv6yAG4nyiFDsrWewkhV2UytUDUj+awKCgZyWTwwmSvBXhQYxs8M0IHvZ0PgRWvYjvl5d4XykvtQFIJmBtaN4SwPzPgrEUJMBQ+dFRCPo5gncDaA199B3Voec53nT3f5eS8FUN8tlUC7kCJdXucvty8wwuyyOcu9Q/W7Um0huRo2ETzUkKJj/MYEGbq0nLJdIpl7pgOHXnYzRV8qgW/giVOlE6FDrkQdnT3uCw9aRZCPyUGyyJJqy7kTIAZaqRKVcLuhg7RUNCC+ySRXLIwWCkiP7EF80qgIY06p2NTQmwSk2BXcMKeaqZahg0kgLlnYDC3yMp6Xqy20yfzJpoRO4+iDt0WtNuI9erGY7PNUSDQR2dF9Zym2am1MdUttP+Bh2R8UY8C956fZ2c767khtmMU9rq3tcQVV0SrPSzixq+bU+VUGtI0R4erULddVjLpn++wUZ4BXzCzWfHG3JWuAHiZgk8ytAkcgOPvjk5ojykGgWc1Mmd9OQU6syT471eO7h/hh9KNfYfpajoeBd4XEaskL0+Jj8mQdremLxVsezHyB5hCS6cOEtgiREln2s6xS82BGtF0rDA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59fadede-ddff-4a51-6335-08dab15e1646 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:28.6506 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rnRAa9g/mA2TZASycRSw9G3i/KBc90rojXi7bi0O6Rme26safipNFpk0soaADJdERGxXlettzHLcVdPNvRr3tg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9642 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161132_473448_6330DD42 X-CRM114-Status: GOOD ( 13.43 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds ids for the Lynx 10g SerDes's internal PLLs. These may be used 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 Acked-by: Stephen Boyd --- (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 Oct 18 23:11:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03744C433FE for ; Tue, 18 Oct 2022 23:12:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/KmCDq82iGEFFJX9XF8GVzeWQkxU1lQg5EKzP3sgLeY=; b=11F0VX4vNuhDIy DDJoFk+kGZIqHjyz31dNoLOGp7asa1yxKZWKuY08wQSIW88Si+JtH2qerz7eumlh7VriQV4FMTvkD 5rldi/IP68bhepmRBfQzM8oKOszYZ+tL8460ko5jlt/vJ59o4wH+fDPXazrQlZAhQAjD+NwH9I+zP RFb8A2jVvCz5AluJGU7dFygxXIWAHGp5gFgGctJlfAPAOyUoWR4njRQCFFgNMqeeVDrV4nd3wZox8 4Z179tdGXSISDFZ0Q3PNATeMiL5X2VD/hFbCocuztEDHeeJLKcPI82wWQp+UTL49hl+Truv+xauOt DtDvEBnFFqMzAH5eQt1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvl5-00ArAx-8l; Tue, 18 Oct 2022 23:12:27 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkE-00AqqD-4Z; Tue, 18 Oct 2022 23:11:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NhNbd+Jrw0Hacxna0/xvmYJKXP0wgpGpsg/E970C3gNSvk8L8x6XB1rArzUpCjzWftTeVz0Q8Fk+aALYSt//zzqQBe50POBTl8nCSqtU0YfcGUulqs34ThrvXap9mN9CLu1hjgOGSpeyPATI8WGwFTtJKLlRhja8PyNO2bf6wFowdM6/OCDbFFiOAdSCW3xgrclNQKuhNO8nxFoBLw0WOwCLH+5Z9ynGcn7FM9QAiy3B43kJ8yAopjYSKb3stdBn7LSHCML9kkAMGdhEyCmk9J1qHoC/Mrc5lgkrgmS3hGDH8DZ5Ky6/xBhtzMkxr7DAauWBrrqqj8NPdZl1avrYAw== 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=6dsiLYd9w8FvXDshLkuZILQKYSYVnc6aGlWTpH3njMw=; b=TqpzHbcdAud/FmwKz2DM5CrB4yxMEak3lEnyTnX081CwT8QxrdroEAGfmwm12B8B0zHrWQvxbF5Ml5Mb8lfU930YXUkKaSzNe8dYZKecPK/QqeSXWkFOzF/AVtNWQXrgdCVoVvJZiZWnbqcwoJHUwvka/SEycGW2G4vF3TUk1pY9gLJsSWmB5TjJoKaQXgev0fyL0MfaupUMgHcyfG3RULS1EnKNrpBE9vzdSQzeUFCjva7P7V+9aH2HdlURmIh4KEArfaQ4mbS+2YC+QRlL0oCUvlDleItYGCe47+u6SxQcrDk88OO+toRGOsaZLLfW0ITAQk6e46kvNP7ua/YdBQ== 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=6dsiLYd9w8FvXDshLkuZILQKYSYVnc6aGlWTpH3njMw=; b=0rN5bve7tY7fK2/iMi0HOfiCuX3ZQDO9c9ARyoLEOeKeBD1XlzEie7BsBdk1oMbYZIcYEhDdDMGehqlk2pXYBM2n1j8Cfk0XZ89Cvv22L2DpQy3cbNOdtL47dVeDLWY7fVtw0ilZFcOX7LK/fw9bovxqLZECEoJSDjNrhQEvH7UEPz1tzHxvLgXtBwwx5icNE/X1L2AQpxvF2rTdBgh7mj7M0DBxVnxW7g4x9iZku2L4l+CR2tUsZP6+8OOVxp+e0GugZJM/hfMkl2AnVgmfJuCigm0FygC6bUz0gJYshG30kuBx8TryrBaWDBQnYRODBNIL+kYtbMUMrSKto5rt1Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:30 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:30 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Jonathan Corbet , Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v7 4/8] phy: fsl: Add Lynx 10G SerDes driver Date: Tue, 18 Oct 2022 19:11:08 -0400 Message-Id: <20221018231112.2142074-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: 955fac2e-b751-4f1a-daf5-08dab15e1766 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bzf09xr0WGSxHk3jdSV4csW/unFCW71hFlsktaP9OpQs2pn9fAvIPWvwmJKj9x8e1ROw30bfZ7hcEl3ebJnoGhOxurA88dvmuNwvcijLLr/x1s6GMCpnJeTG+xKgBg9/DaE/vXK4mFol0PMQIC+jmhLBb7L82WnM5ayoscS8G16BIyMHaNcJ88QUQ4L23N33T2cKYG3Q5PNe2baixLTRJzNQwCJoYchBnUWmC8rEj29NVY3jWFCeXPQX+3Q0h/crkDzPqGaJvNBVum0VF8lRXeuGd5VzHZxctqOs7hUN0QIIVdXSmi8zoM27Q93oGE4NxmrwOSlNI/G2lRWMXHW7zSr9iBm7cNZ8Qxg3Mb/E8G/nxSksDgzsSYppdQsOqwdL7tHuNIM7Qs3BRIkii2LbqZTDTln9uYpjnsovefj5j6y3bLrLqxL9WGtFpaulZznF57e13mD3azTwnq4NPUz13SbU/fq+J+RHz4YgA6ZKUfAKPZjLNCJpmMUKei7PATrWG867vdyDVSBcivllFJmPtsBInft2PUoG7k5XGv1M2fC2N5vqDF9dY9ZDzLd2dkJYSOrsaDQzpWURL+8bONkLXFOCDtV4YkZUqmZyM/rN9q4V70GI9D/PU4gnalIl5p8DaV89knVCDfdRzfYCE0PXNNXEy5MBdAk5ai5NsSfQg2yxJ6rJWvwOrzGaQCRJ5/OocAc9uIt2qujl3jDzbRo5XZoldjT8OZ+2F/w9l3D0qNydpX+drPAEWWustXsLYdplOSpFs0vYoEVbS9pd3oxYvYtf7r42vkbqTmXe6EgZdzJ4L2FRzibl6xmhp17lZjDW X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(30864003)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(966005)(2616005)(186003)(478600001)(54906003)(6666004)(21314003)(579004)(559001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YkfSyfeREurqREOFsMpBv/V2eVtDgpXPTY1QJ5RrXQzZ1F6GSyhSmALGvSdibYJ5ZzrbYuFrv6Rs8wUTHAc9Cr26ZNyobWMx35VDxoDBSfySwrQRVModbIxMwxqHiDeLnUPtB3tcbk3Z/nOUwcWUE+WGI2/mOGG6Ys7fmsaDpnSzVR2jJpGdJAKu+5h81FwQ14JbI/8thfjCDWz85CSucMY/CDOF9F6dBfz9DKw6WzFg5tj/Xb+t4dNt42bJX+AeLmUhLkf864YsTVqq5Ni58OIdHp5wqz2yZCYMlXR1V9+0l3JYz51b3CjWRNA46vb+cxTP+QRWdZ+Pj2uCOKlTzjkhfw5qwj5NCjTBRs0wVaseWe2+VcGGyC3gjIu6ureZOYoY/Y+6y34FMWjterUYa/hTr49BhubY97XTHQ6EBZ/FJMz5D7XV64oG4gEgiRW7BDFkjCun0zz7lNwzzXwbIDPSgMfakAwAEemXyYRQe3KkBAvy+jLbx7tilSd5xGl32ZFvyuaRK6afUQk/6IcoNl8yuDYGHjJLuKqmKtgFVK/CcMCifBy8N/eLDeICCwGOiR9/jeYI0KQDW7JFLvcoIffii05+ehUrtwLLoSDiMKniO0mckBMrzZb5bK4b4/e1n24uHZxvkPPcxsWK9jnTgEGYY8MJf2Tx/iCvPqgj4s/V53YjKOIvGyik6OTP0yII/UMWxT7a9NGtkyRZmMtd4oTF1AgxxvRgG7cp1CrylSy1Q18GSnB9Wpg93tyeo5MeNUr999aCpEAsinmk9iaUjqsC0uduZRLkZmdCve5Zy8ogx7MlYB5FEA3q4xWCKGCtonzyk8mbb2CPd4r6uG+9IiCXJSP3ElLWYJVJ4qCslXy56R5FF/WSvm7/xGrMb415g+c+yxPkARJA3thya9a+RzretdVTokQlGYkDXP5nHuajdULQD2btxKJkznlkcT8sCjka0yMkk/N/aOmmEJxpORaJg19NdeNX3JaD1bExvcVKshxnu2SFYPbCmScyKx/ljsgKp/zjwYUsNMeryCH3d8yzzwQ6Q3T3Psl1X2qVBRBAKGYFFaSO8Sq4+BpMoHVh4zrK7+TICk28GgVwyqCwgpzI2nIEmVJy/5TdAH0Gczae19g+gboYVx/QqWhKcZi/0VSRf0m2EeEQ6BCEf9I0+EgS4X6jW28Xj8AwlEJlo/O43E8gyRBYnBOWshPuHfwXOLkEMAEpmeVrX5ZFZOQuBIJwnBYs2XoETL/M/eC5fkB2sj1NaRmiZ+tWstOnTOJyI414ENeoRQqrTmartf24tM72Zki2dwQboJLeDD8AvQWFeJId/1e734cQ9NjQ6YkBU+sAwR/cDqxOfRTtcb+y3xYDIKpQU+AikhY0qE9m3fzRjT81G4m1KIYz3Vp31bwiMH+g4lEndJckr7QL8rbNc0yqTLrQPn5OHBdeoy9qNeoqdhruWt0NvjJnJYTFHRBnDfkABotAc83i3i/Dq+O5qHj4udUwxVSio+5YNxK9nuLsJ6RL6lqpSwUXjivmhOFdLb5vzr3bcxtp9YFdD7RgHwgp2cW96q9m/Iu+KXjLayMsVz010svFNjleZ725ZAV518yYR3ETnkLy6fdE6q+ueg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 955fac2e-b751-4f1a-daf5-08dab15e1766 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:30.5723 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rXq1WEGU46Q/QL7Np31Zt0lHP8LzdhoiZEuvOv+sQtog3UDHKTaJufdQs7lL8v1eysPciLlXwuEiaSQ/v4h1fA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161134_412441_1872F329 X-CRM114-Status: GOOD ( 35.25 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds support for the Lynx 10G "SerDes" devices found on various NXP QorIQ SoCs. There may be up to four SerDes devices on each SoC, each supporting up to eight lanes. Protocol support for each SerDes is highly heterogeneous, with each SoC typically having a totally different selection of supported protocols for each lane. Additionally, the SerDes devices on each SoC also have differing support. One SerDes will typically support Ethernet on most lanes, while the other will typically support PCIe on most lanes. There is wide hardware support for this SerDes. It is present on QorIQ T-Series and Layerscape processors. Because each SoC typically has specific instructions and exceptions for its SerDes, I have limited the initial scope of this module to just the LS1046A and LS1088A. Additionally, I have only added support for Ethernet protocols. There is not a great need for dynamic reconfiguration for other protocols (except perhaps for M.2 cards), so support for them may never be added. Nevertheless, I have tried to provide an obvious path for adding support for other SoCs as well as other protocols. SATA just needs support for configuring LNmSSCR0. PCIe may need to configure the equalization registers. It also uses multiple lanes. I have tried to write the driver with multi-lane support in mind, so there should not need to be any large changes. Although there are 6 protocols supported, I have only tested SGMII and XFI. The rest have been implemented as described in the datasheet. Most of these protocols should work "as-is", but 10GBASE-KR will need PCS support for link training. The PLLs are modeled as clocks proper. This lets us take advantage of the existing clock infrastructure. I have not given the same treatment to the per-lane clocks because they need to be programmed in-concert with the rest of the lane settings. One tricky thing is that the VCO (PLL) rate exceeds 2^32 (maxing out at around 5GHz). This will be a problem on 32-bit platforms, since clock rates are stored as unsigned longs. To work around this, the pll clock rate is generally treated in units of kHz. The PLLs are configured rather interestingly. Instead of the usual direct programming of the appropriate divisors, the input and output clock rates are selected directly. Generally, the only restriction is that the input and output must be integer multiples of each other. This suggests some kind of internal look-up table. The datasheets generally list out the supported combinations explicitly, and not all input/output combinations are documented. I'm not sure if this is due to lack of support, or due to an oversight. If this becomes an issue, then some combinations can be blacklisted (or whitelisted). This may also be necessary for other SoCs which have more stringent clock requirements. Unlike some other phys where e.g. PCIe x4 will use 4 separate phys all configured for PCIe, this driver uses one phy configured to use 4 lanes. This is because while the individual lanes may be configured individually, the protocol selection acts on all lanes at once. Additionally, the order which lanes should be configured in is specified by the datasheet. To coordinate this, lanes are reserved in phy_init, and released in phy_exit. This driver was written with reference to the LS1046A reference manual. However, it was informed by reference manuals for all processors with mEMACs, especially the T4240 (which appears to have a "maxed-out" configuration). The earlier P-series processors appear to be similar, but have a different overall register layout (using "banks" instead of separate SerDes). Perhaps this those use a "5G Lynx SerDes." Signed-off-by: Sean Anderson --- Changes in 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 | 7 + drivers/phy/freescale/Kconfig | 22 + drivers/phy/freescale/Makefile | 3 + drivers/phy/freescale/lynx-10g.h | 16 + drivers/phy/freescale/phy-fsl-lynx-10g-clk.c | 503 ++++++++ drivers/phy/freescale/phy-fsl-lynx-10g.c | 1167 ++++++++++++++++++ 8 files changed, 1777 insertions(+) create mode 100644 Documentation/driver-api/phy/lynx_10g.rst create mode 100644 drivers/phy/freescale/lynx-10g.h create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g-clk.c create mode 100644 drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/Documentation/driver-api/phy/index.rst b/Documentation/driver-api/phy/index.rst index 69ba1216de72..c9b7a4698dab 100644 --- a/Documentation/driver-api/phy/index.rst +++ b/Documentation/driver-api/phy/index.rst @@ -7,6 +7,7 @@ Generic PHY Framework .. toctree:: phy + lynx_10g samsung-usb2 .. only:: subproject and html diff --git a/Documentation/driver-api/phy/lynx_10g.rst b/Documentation/driver-api/phy/lynx_10g.rst new file mode 100644 index 000000000000..ebbf4dd86726 --- /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 `. Update +the ``mode_conflict``, ``mode_apply``, and ``mode_init`` helpers are updated to +support your protocol. + +You may need to modify :c:func:`lynx_set_mode` in order to support your +protocol. This can happen when you have added members to :c:type:`struct +lynx_proto_params `. It can also happen if you have specific +clocking requirements, or protocol-specific registers to program. + +Internal API Reference +---------------------- + +.. kernel-doc:: drivers/phy/freescale/phy-fsl-lynx-10g.c diff --git a/MAINTAINERS b/MAINTAINERS index a96c60c787af..d17dcc98fd86 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12083,6 +12083,13 @@ S: Maintained W: http://linux-test-project.github.io/ T: git git://github.com/linux-test-project/ltp.git +LYNX 10G SERDES DRIVER +M: Sean Anderson +S: Maintained +F: Documentation/driver-api/phy/lynx_10g.rst +F: drivers/phy/freescale/*lynx-10g* +F: include/dt-bindings/clock/fsl,lynx-10g.h + LYNX 28G SERDES PHY DRIVER M: Ioana Ciornei L: netdev@vger.kernel.org diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 853958fb2c06..a6ccccf9e39b 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -47,3 +47,25 @@ config PHY_FSL_LYNX_28G found on NXP's Layerscape platforms such as LX2160A. Used to change the protocol running on SerDes lanes at runtime. Only useful for a restricted set of Ethernet protocols. + +config PHY_FSL_LYNX_10G + tristate "Freescale 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-drv. diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index cedb328bc4d2..1f18936507e0 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -3,4 +3,7 @@ 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 +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g.o +phy-fsl-lynx-10g-drv-y += phy-fsl-lynx-10g-clk.o +obj-$(CONFIG_PHY_FSL_LYNX_10G) += phy-fsl-lynx-10g-drv.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o diff --git a/drivers/phy/freescale/lynx-10g.h b/drivers/phy/freescale/lynx-10g.h new file mode 100644 index 000000000000..75d9353a867b --- /dev/null +++ b/drivers/phy/freescale/lynx-10g.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2022 Sean Anderson + */ + +#ifndef LYNX_10G +#define LYNX_10G + +struct clk; +struct device; +struct regmap; + +int lynx_clks_init(struct device *dev, struct regmap *regmap, + struct clk *plls[2], struct clk *ex_dlys[2]); + +#endif /* LYNX 10G */ diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c new file mode 100644 index 000000000000..6ec32bdfb9dd --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g-clk.c @@ -0,0 +1,503 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This file contains the implementation for the PLLs found on Lynx 10G phys. + * + * XXX: The VCO rate of the PLLs can exceed ~4GHz, which is the maximum rate + * expressable in an unsigned long. To work around this, rates are specified in + * kHz. This is as if there was a division by 1000 in the PLL. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#define PLL_STRIDE 0x20 +#define PLLa(a, off) ((a) * PLL_STRIDE + (off)) +#define PLLaRSTCTL(a) PLLa(a, 0x00) +#define PLLaCR0(a) PLLa(a, 0x04) + +#define PLLaRSTCTL_RSTREQ BIT(31) +#define PLLaRSTCTL_RST_DONE BIT(30) +#define PLLaRSTCTL_RST_ERR BIT(29) +#define PLLaRSTCTL_PLLRST_B BIT(7) +#define PLLaRSTCTL_SDRST_B BIT(6) +#define PLLaRSTCTL_SDEN BIT(5) + +#define PLLaRSTCTL_ENABLE_SET (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_PLLRST_B | \ + PLLaRSTCTL_SDRST_B | PLLaRSTCTL_SDEN) +#define PLLaRSTCTL_ENABLE_MASK (PLLaRSTCTL_ENABLE_SET | PLLaRSTCTL_RST_ERR) + +#define PLLaCR0_POFF BIT(31) +#define PLLaCR0_RFCLK_SEL GENMASK(30, 28) +#define PLLaCR0_PLL_LCK BIT(23) +#define PLLaCR0_FRATE_SEL GENMASK(19, 16) +#define PLLaCR0_DLYDIV_SEL GENMASK(1, 0) + +#define PLLaCR0_DLYDIV_SEL_16 0b01 + +/** + * struct lynx_clk - Driver data for the PLLs + * @pll: The PLL clock + * @ex_dly: The "PLLa_ex_dly_clk" clock + * @ref: Our reference clock + * @dev: The serdes device + * @regmap: Our registers + * @idx: Which PLL this clock is for + */ +struct lynx_clk { + struct clk_hw pll, ex_dly; + struct clk_hw *ref; + struct device *dev; + struct regmap *regmap; + unsigned int idx; +}; + +static u32 lynx_read(struct lynx_clk *clk, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(clk->regmap, reg, &ret)); + return ret; +} + +static void lynx_write(struct lynx_clk *clk, u32 val, u32 reg) +{ + WARN_ON_ONCE(regmap_write(clk->regmap, reg, val)); +} + +static struct lynx_clk *lynx_pll_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, pll); +} + +static struct lynx_clk *lynx_ex_dly_to_clk(struct clk_hw *hw) +{ + return container_of(hw, struct lynx_clk, ex_dly); +} + +static void lynx_pll_stop(struct lynx_clk *clk) +{ + u32 rstctl; + + rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + rstctl &= ~PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + + ndelay(50); + + rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + rstctl &= ~(PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B); + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + + ndelay(100); +} + +static void lynx_pll_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0; + + dev_dbg(clk->dev, "disable pll%d\n", clk->idx); + + lynx_pll_stop(clk); + + cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + cr0 |= PLLaCR0_POFF; + lynx_write(clk, cr0, PLLaCR0(clk->idx)); +} + +static int lynx_pll_reset(struct lynx_clk *clk) +{ + int ret; + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + + rstctl |= PLLaRSTCTL_RSTREQ; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + ret = read_poll_timeout(lynx_read, rstctl, + rstctl & (PLLaRSTCTL_RST_DONE | PLLaRSTCTL_RST_ERR), + 100, 5000, true, clk, PLLaRSTCTL(clk->idx)); + if (rstctl & PLLaRSTCTL_RST_ERR) + ret = -EIO; + if (ret) { + dev_err(clk->dev, "pll%d reset failed\n", clk->idx); + return ret; + } + + rstctl |= PLLaRSTCTL_SDEN | PLLaRSTCTL_PLLRST_B | PLLaRSTCTL_SDRST_B; + lynx_write(clk, rstctl, PLLaRSTCTL(clk->idx)); + return 0; +} + +static int lynx_pll_prepare(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 rstctl = lynx_read(clk, PLLaRSTCTL(clk->idx)); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + /* + * "Enabling" the PLL involves resetting it (and all attached lanes). + * Avoid doing this if we are already enabled. + */ + if (!(cr0 & PLLaCR0_POFF) && + (rstctl & PLLaRSTCTL_ENABLE_MASK) == PLLaRSTCTL_ENABLE_SET) { + dev_dbg(clk->dev, "pll%d already prepared\n", clk->idx); + return 0; + } + + dev_dbg(clk->dev, "prepare pll%d\n", clk->idx); + + cr0 &= ~PLLaCR0_POFF; + lynx_write(clk, cr0, PLLaCR0(clk->idx)); + + return lynx_pll_reset(clk); +} + +static int lynx_pll_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + bool enabled = !(cr0 & PLLaCR0_POFF); + + dev_dbg(clk->dev, "pll%d %s enabled\n", clk->idx, + enabled ? "is" : "is not"); + + return enabled; +} + +static const u32 rfclk_sel_map[8] = { + [0b000] = 100000000, + [0b001] = 125000000, + [0b010] = 156250000, + [0b011] = 150000000, +}; + +/** + * lynx_rfclk_to_sel() - Convert a reference clock rate to a selector + * @rate: The reference clock rate + * + * To allow for some variation in the reference clock rate, up to 100ppm of + * error is allowed. + * + * Return: An appropriate selector for @rate, or -%EINVAL. + */ +static int lynx_rfclk_to_sel(u32 rate) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(rfclk_sel_map); ret++) { + u32 rfclk_rate = rfclk_sel_map[ret]; + /* Allow an error of 100ppm */ + u32 error = rfclk_rate / 10000; + + if (rate > rfclk_rate - error && rate < rfclk_rate + error) + return ret; + } + + return -EINVAL; +} + +static const u32 frate_sel_map[16] = { + [0b0000] = 5000000, + [0b0101] = 3750000, + [0b0110] = 5156250, + [0b0111] = 4000000, + [0b1001] = 3125000, + [0b1010] = 3000000, +}; + +/** + * lynx_frate_to_sel() - Convert a VCO clock rate to a selector + * @rate_khz: The VCO frequency, in kHz + * + * Return: An appropriate selector for @rate_khz, or -%EINVAL. + */ +static int lynx_frate_to_sel(u32 rate_khz) +{ + int ret; + + for (ret = 0; ret < ARRAY_SIZE(frate_sel_map); ret++) + if (frate_sel_map[ret] == rate_khz) + return ret; + + return -EINVAL; +} + +static u32 lynx_pll_ratio(u32 frate_sel, u32 rfclk_sel) +{ + u64 frate; + u32 rfclk, error, ratio; + + frate = frate_sel_map[frate_sel] * (u64)HZ_PER_KHZ; + rfclk = rfclk_sel_map[rfclk_sel]; + + if (!frate || !rfclk) + return 0; + + ratio = div_u64_rem(frate, rfclk, &error); + if (!error) + return ratio; + return 0; +} + +static unsigned long lynx_pll_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + u32 frate_sel = FIELD_GET(PLLaCR0_FRATE_SEL, cr0); + u32 rfclk_sel = FIELD_GET(PLLaCR0_RFCLK_SEL, cr0); + u32 ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + unsigned long ret; + + /* Ensure that the parent matches our rfclk selector */ + if (rfclk_sel == lynx_rfclk_to_sel(parent_rate)) + ret = mult_frac(parent_rate, ratio, HZ_PER_KHZ); + else + ret = 0; + + dev_dbg(clk->dev, "recalc pll%d new=%llu parent=%lu\n", clk->idx, + (u64)ret * HZ_PER_KHZ, parent_rate); + return ret; +} + +static long lynx_pll_round_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long *parent_rate) +{ + int frate_sel, rfclk_sel; + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 ratio; + + dev_dbg(clk->dev, "round pll%d new=%llu parent=%lu\n", clk->idx, + (u64)rate_khz * HZ_PER_KHZ, *parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + /* Try the current parent rate */ + rfclk_sel = lynx_rfclk_to_sel(*parent_rate); + if (rfclk_sel >= 0) { + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (ratio) + return mult_frac(*parent_rate, ratio, HZ_PER_KHZ); + } + + /* Try all possible parent rates */ + for (rfclk_sel = 0; + rfclk_sel < ARRAY_SIZE(rfclk_sel_map); + rfclk_sel++) { + unsigned long new_parent_rate; + + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (!ratio) + continue; + + /* Ensure the reference clock can produce this rate */ + new_parent_rate = rfclk_sel_map[rfclk_sel]; + new_parent_rate = clk_hw_round_rate(clk->ref, new_parent_rate); + if (rfclk_sel != lynx_rfclk_to_sel(new_parent_rate)) + continue; + + *parent_rate = new_parent_rate; + return mult_frac(new_parent_rate, ratio, HZ_PER_KHZ); + } + + return -EINVAL; +} + +static int lynx_pll_set_rate(struct clk_hw *hw, unsigned long rate_khz, + unsigned long parent_rate) +{ + int frate_sel, rfclk_sel; + struct lynx_clk *clk = lynx_pll_to_clk(hw); + u32 ratio, cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + dev_dbg(clk->dev, "set rate pll%d new=%llu parent=%lu\n", clk->idx, + (u64)rate_khz * HZ_PER_KHZ, parent_rate); + + frate_sel = lynx_frate_to_sel(rate_khz); + if (frate_sel < 0) + return frate_sel; + + rfclk_sel = lynx_rfclk_to_sel(parent_rate); + if (rfclk_sel < 0) + return rfclk_sel; + + ratio = lynx_pll_ratio(frate_sel, rfclk_sel); + if (!ratio) + return -EINVAL; + + lynx_pll_stop(clk); + cr0 &= ~(PLLaCR0_RFCLK_SEL | PLLaCR0_FRATE_SEL); + cr0 |= FIELD_PREP(PLLaCR0_RFCLK_SEL, rfclk_sel); + cr0 |= FIELD_PREP(PLLaCR0_FRATE_SEL, frate_sel); + lynx_write(clk, cr0, PLLaCR0(clk->idx)); + /* Don't bother resetting if it's off */ + if (cr0 & PLLaCR0_POFF) + return 0; + return lynx_pll_reset(clk); +} + +static const struct clk_ops lynx_pll_clk_ops = { + .prepare = lynx_pll_prepare, + .disable = lynx_pll_disable, + .is_enabled = lynx_pll_is_enabled, + .recalc_rate = lynx_pll_recalc_rate, + .round_rate = lynx_pll_round_rate, + .set_rate = lynx_pll_set_rate, +}; + +static void lynx_ex_dly_disable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + lynx_write(clk, PLLaCR0(clk->idx), cr0); +} + +static int lynx_ex_dly_enable(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + u32 cr0 = lynx_read(clk, PLLaCR0(clk->idx)); + + cr0 &= ~PLLaCR0_DLYDIV_SEL; + cr0 |= FIELD_PREP(PLLaCR0_DLYDIV_SEL, PLLaCR0_DLYDIV_SEL_16); + lynx_write(clk, PLLaCR0(clk->idx), cr0); + return 0; +} + +static int lynx_ex_dly_is_enabled(struct clk_hw *hw) +{ + struct lynx_clk *clk = lynx_ex_dly_to_clk(hw); + + return lynx_read(clk, PLLaCR0(clk->idx)) & PLLaCR0_DLYDIV_SEL; +} + +static unsigned long lynx_ex_dly_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + return parent_rate / 16; +} + +static const struct clk_ops lynx_ex_dly_clk_ops = { + .enable = lynx_ex_dly_enable, + .disable = lynx_ex_dly_disable, + .is_enabled = lynx_ex_dly_is_enabled, + .recalc_rate = lynx_ex_dly_recalc_rate, +}; + +static int lynx_clk_init(struct clk_hw_onecell_data *hw_data, + struct device *dev, struct regmap *regmap, + unsigned int index) +{ + const struct clk_hw *pll_parents, *ex_dly_parents; + struct clk_init_data pll_init = { + .ops = &lynx_pll_clk_ops, + .parent_hws = &pll_parents, + .num_parents = 1, + .flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_PARENT | + CLK_OPS_PARENT_ENABLE, + }; + struct clk_init_data ex_dly_init = { + .ops = &lynx_ex_dly_clk_ops, + .parent_hws = &ex_dly_parents, + .num_parents = 1, + }; + struct clk *ref; + struct lynx_clk *clk; + char *ref_name; + int ret; + + clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL); + if (!clk) + return -ENOMEM; + + clk->dev = dev; + clk->regmap = regmap; + clk->idx = index; + + ref_name = kasprintf(GFP_KERNEL, "ref%d", index); + pll_init.name = kasprintf(GFP_KERNEL, "%s.pll%d_khz", dev_name(dev), + index); + ex_dly_init.name = kasprintf(GFP_KERNEL, "%s.pll%d_ex_dly_khz", + dev_name(dev), index); + if (!ref_name || !pll_init.name || !ex_dly_init.name) { + ret = -ENOMEM; + goto out; + } + + ref = devm_clk_get(dev, ref_name); + if (IS_ERR(clk->ref)) { + ret = PTR_ERR(clk->ref); + dev_err_probe(dev, ret, "could not get %s\n", ref_name); + goto out; + } + + clk->ref = __clk_get_hw(ref); + pll_parents = clk->ref; + clk->pll.init = &pll_init; + ret = devm_clk_hw_register(dev, &clk->pll); + if (ret) { + dev_err_probe(dev, ret, "could not register %s\n", + pll_init.name); + goto out; + } + + ex_dly_parents = &clk->pll; + clk->ex_dly.init = &ex_dly_init; + ret = devm_clk_hw_register(dev, &clk->ex_dly); + if (ret) + dev_err_probe(dev, ret, "could not register %s\n", + ex_dly_init.name); + + hw_data->hws[LYNX10G_PLLa(index)] = &clk->pll; + hw_data->hws[LYNX10G_PLLa_EX_DLY(index)] = &clk->ex_dly; + +out: + kfree(ref_name); + kfree(pll_init.name); + kfree(ex_dly_init.name); + return ret; +} + +#define NUM_PLLS 2 +#define NUM_CLKS (NUM_PLLS * LYNX10G_CLKS_PER_PLL) + +int lynx_clks_init(struct device *dev, struct regmap *regmap, + struct clk *plls[2], struct clk *ex_dlys[2]) +{ + int ret, i; + struct clk_hw_onecell_data *hw_data; + + hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, NUM_CLKS), + GFP_KERNEL); + if (!hw_data) + return -ENOMEM; + hw_data->num = NUM_CLKS; + + for (i = 0; i < NUM_PLLS; i++) { + ret = lynx_clk_init(hw_data, dev, regmap, i); + if (ret) + return ret; + + plls[i] = hw_data->hws[LYNX10G_PLLa(i)]->clk; + ex_dlys[i] = hw_data->hws[LYNX10G_PLLa_EX_DLY(i)]->clk; + } + + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, hw_data); + if (ret) + dev_err_probe(dev, ret, "could not register clock provider\n"); + + return ret; +} diff --git a/drivers/phy/freescale/phy-fsl-lynx-10g.c b/drivers/phy/freescale/phy-fsl-lynx-10g.c new file mode 100644 index 000000000000..908fe7593d93 --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-lynx-10g.c @@ -0,0 +1,1167 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2022 Sean Anderson + * + * This driver is for the Lynx 10G phys found on many QorIQ devices, including + * the Layerscape series. + */ + +#include +#include +#include +#include +#include +#include + +#include "lynx-10g.h" + +#define TCALCR 0x90 +#define TCALCR1 0x94 +#define RCALCR 0xa0 +#define RCALCR1 0xa4 + +#define CALCR_CALRST_B BIT(27) + +#define LS_PCCR_BASE 0x200 +#define PCCR_STRIDE 0x4 + +#define LS_PCCRa(a) (LS_PCCR_BASE + (a) * PCCR_STRIDE) + +#define PCCR8_SGMIIa_KX BIT(3) +#define PCCR8_SGMIIa_MASK GENMASK(3, 0) +#define PCCR8_SGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCR9_QSGMIIa_MASK GENMASK(2, 0) +#define PCCR9_QSGMIIa_SHIFT(a) (28 - (a) * 4) + +#define PCCRB_XFIa_MASK GENMASK(2, 0) +#define PCCRB_XFIa_SHIFT(a) (28 - (a) * 4) + +#define LANE_BASE 0x800 +#define LANE_STRIDE 0x40 +#define LNm(m, off) (LANE_BASE + (m) * LANE_STRIDE + (off)) +#define LNmGCR0(m) LNm(m, 0x00) +#define LNmGCR1(m) LNm(m, 0x04) +#define LNmSSCR0(m) LNm(m, 0x0C) +#define LNmRECR0(m) LNm(m, 0x10) +#define LNmRECR1(m) LNm(m, 0x14) +#define LNmTECR0(m) LNm(m, 0x18) +#define LNmSSCR1(m) LNm(m, 0x1C) +#define LNmTTLCR0(m) LNm(m, 0x20) + +#define LNmGCR0_RPLL_LES BIT(31) +#define LNmGCR0_RRAT_SEL GENMASK(29, 28) +#define LNmGCR0_TPLL_LES BIT(27) +#define LNmGCR0_TRAT_SEL GENMASK(25, 24) +#define LNmGCR0_RRST_B BIT(22) +#define LNmGCR0_TRST_B BIT(21) +#define LNmGCR0_RX_PD BIT(20) +#define LNmGCR0_TX_PD BIT(19) +#define LNmGCR0_IF20BIT_EN BIT(18) +#define LNmGCR0_FIRST_LANE BIT(16) +#define LNmGCR0_TTRM_VM_SEL GENMASK(13, 12) +#define LNmGCR0_PROTS GENMASK(11, 7) + +#define LNmGCR0_RAT_SEL_SAME 0b00 +#define LNmGCR0_RAT_SEL_HALF 0b01 +#define LNmGCR0_RAT_SEL_QUARTER 0b10 +#define LNmGCR0_RAT_SEL_DOUBLE 0b11 + +#define LNmGCR0_PROTS_PCIE 0b00000 +#define LNmGCR0_PROTS_SGMII 0b00001 +#define LNmGCR0_PROTS_SATA 0b00010 +#define LNmGCR0_PROTS_XFI 0b01010 + +#define LNmGCR1_RDAT_INV BIT(31) +#define LNmGCR1_TDAT_INV BIT(30) +#define LNmGCR1_OPAD_CTL BIT(26) +#define LNmGCR1_REIDL_TH GENMASK(22, 20) +#define LNmGCR1_REIDL_EX_SEL GENMASK(19, 18) +#define LNmGCR1_REIDL_ET_SEL GENMASK(17, 16) +#define LNmGCR1_REIDL_EX_MSB BIT(15) +#define LNmGCR1_REIDL_ET_MSB BIT(14) +#define LNmGCR1_REQ_CTL_SNP BIT(13) +#define LNmGCR1_REQ_CDR_SNP BIT(12) +#define LNmGCR1_TRSTDIR BIT(7) +#define LNmGCR1_REQ_BIN_SNP BIT(6) +#define LNmGCR1_ISLEW_RCTL GENMASK(5, 4) +#define LNmGCR1_OSLEW_RCTL GENMASK(1, 0) + +#define LNmRECR0_RXEQ_BST BIT(28) +#define LNmRECR0_GK2OVD GENMASK(27, 24) +#define LNmRECR0_GK3OVD GENMASK(19, 16) +#define LNmRECR0_GK2OVD_EN BIT(15) +#define LNmRECR0_GK3OVD_EN BIT(14) +#define LNmRECR0_OSETOVD_EN BIT(13) +#define LNmRECR0_BASE_WAND GENMASK(11, 10) +#define LNmRECR0_OSETOVD GENMASK(6, 0) + +#define LNmRECR0_BASE_WAND_OFF 0b00 +#define LNmRECR0_BASE_WAND_DEFAULT 0b01 +#define LNmRECR0_BASE_WAND_ALTERNATE 0b10 +#define LNmRECR0_BASE_WAND_OSETOVD 0b11 + +#define LNmTECR0_TEQ_TYPE GENMASK(29, 28) +#define LNmTECR0_SGN_PREQ BIT(26) +#define LNmTECR0_RATIO_PREQ GENMASK(25, 22) +#define LNmTECR0_SGN_POST1Q BIT(21) +#define LNmTECR0_RATIO_PST1Q GENMASK(20, 16) +#define LNmTECR0_ADPT_EQ GENMASK(13, 8) +#define LNmTECR0_AMP_RED GENMASK(5, 0) + +#define LNmTECR0_TEQ_TYPE_NONE 0b00 +#define LNmTECR0_TEQ_TYPE_POST 0b01 +#define LNmTECR0_TEQ_TYPE_BOTH 0b10 + +#define LNmTTLCR0_FLT_SEL GENMASK(29, 24) + +#define LS_SGMII_BASE 0x1800 +#define LS_QSGMII_BASE 0x1880 +#define LS_XFI_BASE 0x1980 + +#define PCS_STRIDE 0x10 +#define CR_STRIDE 0x4 +#define PCSa(a, base, cr) (base + (a) * PCS_STRIDE + (cr) * CR_STRIDE) + +#define PCSaCR1_MDEV_PORT GENMASK(31, 27) + +#define LS_SGMIIaCR1(a) PCSa(a, LS_SGMII_BASE, 1) +#define SGMIIaCR1_SGPCS_EN BIT(11) + +enum lynx_protocol { + LYNX_PROTO_NONE = 0, + LYNX_PROTO_SGMII, + LYNX_PROTO_SGMII25, /* Not tested */ + LYNX_PROTO_1000BASEKX, /* Not tested */ + LYNX_PROTO_QSGMII, /* Not tested */ + LYNX_PROTO_XFI, + LYNX_PROTO_10GKR, /* Link training unimplemented */ + LYNX_PROTO_LAST, +}; + +static const char lynx_proto_str[][16] = { + [LYNX_PROTO_NONE] = "unknown", + [LYNX_PROTO_SGMII] = "SGMII", + [LYNX_PROTO_SGMII25] = "2.5G SGMII", + [LYNX_PROTO_1000BASEKX] = "1000BASE-KX", + [LYNX_PROTO_QSGMII] = "QSGMII", + [LYNX_PROTO_XFI] = "XFI", + [LYNX_PROTO_10GKR] = "10GBASE-KR", +}; + +#define PROTO_MASK(proto) BIT(LYNX_PROTO_##proto) + +/** + * struct lynx_proto_params - Parameters for configuring a protocol + * @frate_khz: The PLL rate, in kHz + * @rat_sel: The divider to get the line rate + * @if20bit: Whether the proto is 20 bits or 10 bits + * @prots: Lane protocol select + * @reidl_th: Receiver electrical idle detection threshold + * @reidl_ex: Exit electrical idle filter + * @reidl_et: Enter idle filter + * @slew: Slew control + * @baseline_wander: Enable baseline wander correction + * @gain: Adaptive equalization gain override + * @offset_override: Adaptive equalization offset override + * @preq_ratio: Ratio of full swing transition bit to pre-cursor + * @postq_ratio: Ratio of full swing transition bit to first post-cursor. + * @adpt_eq: Transmitter Adjustments for 8G/10G + * @amp_red: Overall TX Amplitude Reduction + * @flt_sel: TTL configuration selector + */ +struct lynx_proto_params { + u32 frate_khz; + u8 rat_sel; + u8 prots; + u8 reidl_th; + u8 reidl_ex; + u8 reidl_et; + u8 slew; + u8 gain; + u8 baseline_wander; + u8 offset_override; + u8 preq_ratio; + u8 postq_ratio; + u8 adpt_eq; + u8 amp_red; + u8 flt_sel; + bool if20bit; +}; + +static const struct lynx_proto_params lynx_proto_params[] = { + [LYNX_PROTO_SGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .reidl_th = 0b001, + .reidl_ex = 0b011, + .reidl_et = 0b100, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .adpt_eq = 0b110000, + .amp_red = 0b000110, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_1000BASEKX] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_QUARTER, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .gain = 0b1111, + .offset_override = 0b0011111, + .adpt_eq = 0b110000, + .flt_sel = 0b111001, + }, + [LYNX_PROTO_SGMII25] = { + .frate_khz = 3125000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = false, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b10, + .offset_override = 0b0011111, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + }, + [LYNX_PROTO_QSGMII] = { + .frate_khz = 5000000, + .rat_sel = LNmGCR0_RAT_SEL_SAME, + .if20bit = true, + .prots = LNmGCR0_PROTS_SGMII, + .slew = 0b01, + .offset_override = 0b0011111, + .postq_ratio = 0b00110, + .adpt_eq = 0b110000, + .amp_red = 0b000010, + }, + [LYNX_PROTO_XFI] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .if20bit = true, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .postq_ratio = 0b00011, + .adpt_eq = 0b110000, + .amp_red = 0b000111, + }, + [LYNX_PROTO_10GKR] = { + .frate_khz = 5156250, + .rat_sel = LNmGCR0_RAT_SEL_DOUBLE, + .if20bit = true, + .prots = LNmGCR0_PROTS_XFI, + .slew = 0b01, + .baseline_wander = LNmRECR0_BASE_WAND_DEFAULT, + .offset_override = 0b1011111, + .preq_ratio = 0b0011, + .postq_ratio = 0b01100, + .adpt_eq = 0b110000, + }, +}; + +/** + * struct lynx_mode - A single configuration of a protocol controller + * @protos: A bitmask of the &enum lynx_protocol this mode supports + * @pccr: The number of the PCCR which contains this mode + * @idx: The index of the protocol controller. For example, SGMIIB would have + * index 1. + * @cfg: The value to program into the controller to select this mode + * + * The serdes has multiple protocol controllers which can be each be selected + * independently. Depending on their configuration, they may use multiple lanes + * at once (e.g. AUI or PCIe x4). Additionally, multiple protocols may be + * supported by a single mode (XFI and 10GKR differ only in their protocol + * parameters). + */ +struct lynx_mode { + u16 protos; + u8 pccr; + u8 idx; + u8 cfg; +}; + +static_assert(LYNX_PROTO_LAST - 1 <= + sizeof_field(struct lynx_mode, protos) * BITS_PER_BYTE); + +struct lynx_priv; + +/** + * struct lynx_cfg - Configuration for a particular serdes + * @lanes: Number of lanes + * @endian: Endianness of the registers + * @mode_conflict: Determine whether a protocol controller is already in use + * (by another group). + * @mode_apply: Apply a given protocol. This includes programming the + * appropriate config into the PCCR, as well as enabling/disabling + * any other registers (such as the enabling MDIO access). + * %LYNX_PROTO_NONE may be used to clear any associated registers. + * @mode_init: Finish initializing a mode. All fields are filled in except for + * protos. Type is one of PHY_TYPE_*. mode->protos should be filled + * in, and the other fields should be sanity-checked. + */ +struct lynx_cfg { + unsigned int lanes; + enum regmap_endian endian; + bool (*mode_conflict)(struct lynx_priv *serdes, + const struct lynx_mode *mode); + void (*mode_apply)(struct lynx_priv *serdes, + const struct lynx_mode *mode, + enum lynx_protocol proto); + int (*mode_init)(struct lynx_priv *serdes, struct lynx_mode *mode, + int type); +}; + +/** + * struct lynx_priv - Driver data for the serdes + * @lock: A lock protecting "common" registers in @regmap, as well as the + * members of this struct. Lane-specific registers are protected by the + * phy's lock. PLL registers are protected by the clock's lock. + * @dev: The serdes device + * @regmap: The backing regmap + * @cfg: SoC-specific configuration + * @plls: The PLLs + * @ex_dlys: The "ex_dly" clocks + * @used_lanes: Bitmap of the lanes currently used by phys + */ +struct lynx_priv { + struct mutex lock; + struct device *dev; + struct regmap *regmap; + const struct lynx_cfg *cfg; + struct clk *plls[2], *ex_dlys[2]; + unsigned int used_lanes; +}; + +/** + * struct lynx_group - Driver data for a group of lanes + * @serdes: The parent serdes + * @pll: The currently-used pll + * @ex_dly: The ex_dly clock, if used + * @modes: Valid protocol controller configurations + * @mode_count: Number of modes in @modes + * @first_lane: The first lane in the group + * @last_lane: The last lane in the group + * @proto: The currently-configured protocol + * @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; + u8 prots; +}; + +static u32 lynx_read(struct lynx_priv *serdes, u32 reg) +{ + unsigned int ret = 0; + + WARN_ON_ONCE(regmap_read(serdes->regmap, reg, &ret)); + dev_vdbg(serdes->dev, "%.8x <= %.8x\n", ret, reg); + return ret; +} + +static void lynx_write(struct lynx_priv *serdes, u32 val, u32 reg) +{ + dev_vdbg(serdes->dev, "%.8x => %.8x\n", val, reg); + WARN_ON_ONCE(regmap_write(serdes->regmap, reg, val)); +} + +/** + * lynx_lane_bitmap() - Get a bitmap for a group of lanes + * @group: The group of lanes + * + * Return: A mask containing all bits between @group->first and @group->last + */ +static unsigned int lynx_lane_bitmap(struct lynx_group *group) +{ + if (group->first_lane > group->last_lane) + return GENMASK(group->first_lane, group->last_lane); + else + return GENMASK(group->last_lane, group->first_lane); +} + +static int lynx_init(struct phy *phy) +{ + int ret = 0; + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + unsigned int lane_mask = lynx_lane_bitmap(group); + + mutex_lock(&serdes->lock); + if (serdes->used_lanes & lane_mask) + ret = -EBUSY; + else + serdes->used_lanes |= lane_mask; + mutex_unlock(&serdes->lock); + return ret; +} + +static int lynx_exit(struct phy *phy) +{ + struct lynx_group *group = phy_get_drvdata(phy); + struct lynx_priv *serdes = group->serdes; + + clk_disable_unprepare(group->ex_dly); + group->ex_dly = NULL; + + clk_disable_unprepare(group->pll); + clk_rate_exclusive_put(group->pll); + group->pll = NULL; + + mutex_lock(&serdes->lock); + serdes->used_lanes &= ~lynx_lane_bitmap(group); + mutex_unlock(&serdes->lock); + return 0; +} + +/* + * This is tricky. If first_lane=1 and last_lane=0, the condition will see 2, + * 1, 0. But the loop body will see 1, 0. We do this to avoid underflow. We + * can't pull the same trick when incrementing, because then we might have to + * start at -1 if (e.g.) first_lane = 0. + */ +#define for_range(val, start, end) \ + for (val = start < end ? start : start + 1; \ + start < end ? val <= end : val-- > end; \ + start < end ? val++ : 0) +#define for_each_lane(lane, group) \ + for_range(lane, group->first_lane, group->last_lane) +#define for_each_lane_reverse(lane, group) \ + for_range(lane, group->last_lane, group->first_lane) + +static int lynx_power_on(struct phy *phy) +{ + int i; + struct lynx_group *group = phy_get_drvdata(phy); + u32 gcr0; + + for_each_lane(i, group) { + gcr0 = lynx_read(group->serdes, LNmGCR0(i)); + gcr0 &= ~(LNmGCR0_RX_PD | LNmGCR0_TX_PD); + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + + usleep_range(15, 30); + gcr0 |= LNmGCR0_RRST_B | LNmGCR0_TRST_B; + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + } + + return 0; +} + +static void lynx_power_off_group(struct lynx_group *group) +{ + int i; + + for_each_lane_reverse(i, group) { + u32 gcr0 = lynx_read(group->serdes, LNmGCR0(i)); + + gcr0 |= LNmGCR0_RX_PD | LNmGCR0_TX_PD; + gcr0 &= ~(LNmGCR0_RRST_B | LNmGCR0_TRST_B); + lynx_write(group->serdes, gcr0, LNmGCR0(i)); + } +} + +static int lynx_power_off(struct phy *phy) +{ + lynx_power_off_group(phy_get_drvdata(phy)); + return 0; +} + +/** + * lynx_lookup_proto() - Convert a phy-subsystem mode to a protocol + * @mode: The mode to convert + * @submode: The submode of @mode + * + * Return: A corresponding serdes-specific mode + */ +static enum lynx_protocol lynx_lookup_proto(enum phy_mode mode, int submode) +{ + switch (mode) { + case PHY_MODE_ETHERNET: + switch (submode) { + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_1000BASEX: + return LYNX_PROTO_SGMII; + case PHY_INTERFACE_MODE_2500BASEX: + return LYNX_PROTO_SGMII25; + case PHY_INTERFACE_MODE_QSGMII: + return LYNX_PROTO_QSGMII; + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_10GBASER: + return LYNX_PROTO_XFI; + case PHY_INTERFACE_MODE_10GKR: + return LYNX_PROTO_10GKR; + default: + return LYNX_PROTO_NONE; + } + default: + return LYNX_PROTO_NONE; + } +} + +/** + * lynx_lookup_mode() - Get the mode for a group/protocol combination + * @group: The group of lanes to use + * @proto: The protocol to use + * + * Return: An appropriate mode to use, or %NULL if none match. + */ +static const struct lynx_mode *lynx_lookup_mode(struct lynx_group *group, + enum lynx_protocol proto) +{ + int i; + + for (i = 0; i < group->mode_count; i++) { + const struct lynx_mode *mode = &group->modes[i]; + + if (BIT(proto) & mode->protos) + return mode; + } + + return NULL; +} + +static int lynx_validate(struct phy *phy, enum phy_mode phy_mode, int submode, + union phy_configure_opts *opts) +{ + enum lynx_protocol proto; + struct lynx_group *group = phy_get_drvdata(phy); + const struct lynx_mode *mode; + + proto = lynx_lookup_proto(phy_mode, submode); + if (proto == LYNX_PROTO_NONE) + return -EINVAL; + + /* Nothing to do */ + if (proto == group->proto) + return 0; + + /* + * 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 fwnode_handle *fwnode) +{ + int i, lane_count, ret; + struct device *dev = serdes->dev; + struct fwnode_handle *mode_node; + struct lynx_group *group; + struct lynx_mode *modes; + struct phy *phy; + u32 *lanes = NULL; + + group = devm_kzalloc(dev, sizeof(*group), GFP_KERNEL); + if (!group) + return -ENOMEM; + group->serdes = serdes; + + lane_count = fwnode_property_count_u32(fwnode, "reg"); + if (lane_count < 0) { + dev_err(dev, "could not read %s from %pfwP: %d\n", + "reg", fwnode, ret); + return lane_count; + } + + lanes = kcalloc(lane_count, sizeof(*lanes), GFP_KERNEL); + if (!lanes) + return -ENOMEM; + + ret = fwnode_property_read_u32_array(fwnode, "reg", lanes, lane_count); + if (ret) { + dev_err(dev, "could not read %s from %pfwP: %d\n", + "reg", fwnode, ret); + goto out; + } + + group->first_lane = lanes[0]; + group->last_lane = lanes[lane_count - 1]; + for (i = 0; i < lane_count; i++) { + 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, "phy-type", &val); + if (ret) + goto out; + + ret = serdes->cfg->mode_init(serdes, mode, val); + if (ret) + goto out; + + dev_dbg(dev, "mode PCCR%X.%s%c_CFG=%x on lanes %u to %u\n", + mode->pccr, lynx_proto_str[__ffs(mode->protos)], + 'A' + mode->idx, mode->cfg, group->first_lane, + group->last_lane); + } + + WARN_ON(i != group->mode_count); + group->modes = modes; + + /* Deselect anything configured by the RCW/bootloader */ + for (i = 0; i < group->mode_count; i++) + serdes->cfg->mode_apply(serdes, &group->modes[i], + LYNX_PROTO_NONE); + + /* Disable the lanes for now */ + lynx_power_off_group(group); + + phy = devm_phy_create(dev, to_of_node(fwnode), &lynx_phy_ops); + ret = PTR_ERR_OR_ZERO(phy); + if (ret) + dev_err_probe(dev, ret, "could not create phy\n"); + else + phy_set_drvdata(phy, group); + +out: + kfree(lanes); + return ret; +} + +static int lynx_probe(struct platform_device *pdev) +{ + int ret; + struct device *dev = &pdev->dev; + struct fwnode_handle *group_node; + struct lynx_priv *serdes; + struct phy_provider *provider; + struct regmap_config regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .disable_locking = true, + }; + struct resource *res; + void __iomem *base; + + serdes = devm_kzalloc(dev, sizeof(*serdes), GFP_KERNEL); + if (!serdes) + return -ENOMEM; + + serdes->dev = dev; + platform_set_drvdata(pdev, serdes); + mutex_init(&serdes->lock); + serdes->cfg = device_get_match_data(dev); + + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(base)) { + ret = PTR_ERR(base); + dev_err_probe(dev, ret, "could not get/map registers\n"); + return ret; + } + + regmap_config.val_format_endian = serdes->cfg->endian; + regmap_config.max_register = res->end - res->start; + serdes->regmap = devm_regmap_init_mmio(dev, base, ®map_config); + if (IS_ERR(serdes->regmap)) { + ret = PTR_ERR(serdes->regmap); + dev_err_probe(dev, ret, "could not create regmap\n"); + return ret; + } + + ret = lynx_clks_init(dev, serdes->regmap, serdes->plls, + serdes->ex_dlys); + if (ret) + return ret; + + device_for_each_child_node(dev, group_node) { + ret = lynx_probe_group(serdes, group_node); + if (ret) + return ret; + } + + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + ret = PTR_ERR_OR_ZERO(provider); + if (ret) + dev_err_probe(dev, ret, "could not register phy provider\n"); + else + dev_info(dev, "probed with %d lanes\n", serdes->cfg->lanes); + return ret; +} + +/* + * These are common helpers for the PCCRs found on (most) Layerscape SoCs. + * There is an earlier layout used on most T-series SoCs, as well as the + * LS1020A/21A/22A. + */ + +static int lynx_ls_pccr_params(const struct lynx_mode *mode, u32 *off, + u32 *shift, u32 *mask) +{ + if (mode->protos & PROTO_MASK(SGMII)) { + *off = LS_PCCRa(0x8); + *mask = PCCR8_SGMIIa_MASK; + *shift = PCCR8_SGMIIa_SHIFT(mode->idx); + } else if (mode->protos & PROTO_MASK(QSGMII)) { + *off = LS_PCCRa(0x9); + *mask = PCCR9_QSGMIIa_MASK; + *shift = PCCR9_QSGMIIa_SHIFT(mode->idx); + } else if (mode->protos & PROTO_MASK(XFI)) { + *off = LS_PCCRa(0xB); + *mask = PCCRB_XFIa_MASK; + *shift = PCCRB_XFIa_SHIFT(mode->idx); + } else { + return -EINVAL; + } + + return 0; +} + +static bool lynx_ls_mode_conflict(struct lynx_priv *serdes, + const struct lynx_mode *mode) +{ + u32 off, shift, mask; + + if (WARN_ON_ONCE(lynx_ls_pccr_params(mode, &off, &shift, &mask))) + return true; + + return (lynx_read(serdes, off) >> shift) & mask; +} + +static void lynx_ls_mode_apply(struct lynx_priv *serdes, + const struct lynx_mode *mode, + enum lynx_protocol proto) +{ + u32 base, pccr, off, shift, mask; + + if (WARN_ON_ONCE(proto != LYNX_PROTO_NONE && + !(mode->protos & BIT(proto)))) + return; + if (WARN_ON_ONCE(lynx_ls_pccr_params(mode, &off, &shift, &mask))) + return; + + dev_dbg(serdes->dev, "applying %s to PCCR%X.%s%c_CFG\n", + lynx_proto_str[proto], mode->pccr, + lynx_proto_str[__ffs(mode->protos)], 'A' + mode->idx); + + base = 0; + if (mode->protos & PROTO_MASK(SGMII)) + base = LS_SGMII_BASE; + else if (mode->protos & PROTO_MASK(QSGMII)) + base = LS_QSGMII_BASE; + else if (mode->protos & PROTO_MASK(XFI)) + base = LS_XFI_BASE; + + 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 Oct 18 23:11:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011191 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59830C4332F for ; Tue, 18 Oct 2022 23:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8Kh4sPaPJoRRsvW5y48Rs0Gu6xn6G8JTI1IbyQngwho=; b=mYV8iCJ0eYF7GC vCHTEMv8Guu2QQk3wEy1Kri17iZThvYiM8Z5ndezt42k0kukoFyQlUrCa0gZZlO+sZIGIkbJhYZ1H UQFhnstih9sjIg23/CrZrpha/YIXLESrKs4Z7Ap86If7Y4yIY83QtyA6iaRcRqaKNg1Hj91tTGlRj BpYBXWgFoDXzy/B71xT4qidWN0a6b/EQnVNDEKViDuxuPgwSb9KvAXwckn72HZm10X99bmnZuob2U 8jnpdY/hYlQmFxIQCaSnPO9+MA6uyB7ZKp9VIvxNJI2WR8NT9fCZCuymQjEDlinSKBW+h8ciukJca HRxTJnRV3oRpVDoLzRWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvlX-00ArKn-Eo; Tue, 18 Oct 2022 23:12:55 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkK-00AqqD-8r; Tue, 18 Oct 2022 23:11:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pfc8iKs6KHHsV2ujZe1lfVF8vnjnMZmmjbMxwmHKyEhDrSRDs4xhnDuFSh35vrJVenUT/Igq7xRoQoFWfKwwKIqgRUNGtiJxeRNFdjdkWrUL3XPsZacsjy9O3zuV6k6kC1pF4Pb2m2UlmIqiKKhUWfsOhEEoInDVtd9+5DJSGs0ZbBgHRyc67ZCoOQi7Fd/LJ3Qj4KuNIGoUSgjcZByc/z1WWjocjdGit2aZ0+8Bis/5OpQMdUo+Z/ggNqfOfDgkRAtowa7eVI1TNQ4v4pnmkc1GEIaSULozURXCWr18d/RbdqZlPrmZYqspLVWLzf46VuuRlxWGsRJn3kj9Ze9I0Q== 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=Nqu94qYNvf9w4pfsAbSJlc3AqtD97kwBepOGm9ixucs=; b=c62CEImigKCcmEPSZyWy1fNcyk0XlcwootY9PFpGU6S1x1bWAzXHZJRBvi1eNJUmKEfQCC4q09OBNmW5Rnd8F4WOSQHNK2UhPdzfZRSgaHmB7IfpWe+x/RlPCAwHtREQmdOw1GJz7R42m0FzYkqLzHIUy/EVLG94z3VdS8ZWF81GA3bx0HJPcBm3Gxa9XsSxRzrxMwmy9p9Ydl2UE8T+zqrjzpB3udZo76mYYY9L6PiZbtoOyh19QA/LF11+0RMw2WPtVxPskSrnMlz2OCda6vN1vJzjWxi0rvREt03Fm+ssjmms/uCHhVf6WAbTkcZwYTigaflQN13Yxx3u1bEq4g== 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=Nqu94qYNvf9w4pfsAbSJlc3AqtD97kwBepOGm9ixucs=; b=czxnYGq146n3xir3CkKtPZbUxL97QTCNK4hQrXAsLs8PvfCwXiW3WeO4gPue9DRJgtM1fPQ0yC0+6AsfziM1H/UPtmXUK6SCaxUoyAUPGOgqAhuqxxOhYqphIBo5AEqE3+6AS2tpwE4mpnG+gjDwXB37P2BRIujkdhdSl7ZYYra0Fw+DDI51INsZD76Ldgr7sfi97EZrrGtPo1s006L41H/ERadJ8ke839uFBvmtU5FDU1gXCKwV3R2SdsVQXT9OKW01tbOuYNOzzyN5mvDxkVyEmCA9EX+gRfg8oeZhlCueVGG2cj57siEuFLtZx1E8Qzb6BiWhuhK9ZYXtWtrJsg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:32 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:32 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v7 5/8] arm64: dts: ls1046a: Add serdes bindings Date: Tue, 18 Oct 2022 19:11:09 -0400 Message-Id: <20221018231112.2142074-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: 73a5c2ff-95f1-4bcd-548a-08dab15e1868 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kq4jKEmixoB5shxTfuUd3F8VIUegchBvH5roky52ZpUDIsLYQS0AYVisrpFskM3AU4cmhtkbSLEa8YRFTfNGvIkXJ/MwgK9lAb9/dl4WazeETj/RpnwysW3OalFZrvwjwzoeGnXOr/Nubh4ugNUyGSQF/HO0ZCz71sFhLe4Mi9Z8LfJYv/UErtulqjm5TrgHQUan++1WbHvIHKgg5GIXSdCFzxs9QOowbWwmm7xxIPXLWIgGyEtCRviuiBEt2hy76xhcpHwwh6yCydpurgaoJybpeZoSoioiOpNhfB/p5UoPFbBPniAAorggiPLlfAhL2Gqm3Padat50DxkWM8JmFwGEK3RIAK/QY/Q7FlPSLirP612OCzxYd0Ux0CMDrRUpI15GRuI2bBkNYLhPVSNHtg4+tiKa9HlfksBKE7hKaFqQ3IXYGTNoE7MD8BEw9cizr+t7MxpxhJogVdMb2uR48XSQ6l9TV+UUZT6z4zPL8Q/rw8PBBHsEKGAWBbq1X/0BdL9BPIf1QVhOr77jPIb4vWirrOCxSf1uFgyCUPskhad1AnEUlSS4Y+mFU1Mg8mOdyXyLxBMmdTGGbN3jIDwV5U6lbq8JyMKzFe98kXS/dJsfrUI8ZhXqrWArK0lgKk5KfE6EHIXYyPJxRs5cFYzDsOyITcFZUtNotdDpT/z8q3qeGXkl8kjubbOn+y/IRFdTFZ7EBO1mmA0TYEn9te6D74Q6212e4e8rFWbRDRm5VXl3wNn3tbPM5fgVSyHcNGis X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /o604zPh2UW7nHPg7AIvuxixHIFmGr8SBXOp1RGDqfN0rhjyUQRIZwZBFxNWPIBoKdoMNV8pORbj5SYQd8Ghg6EhpA6w9lf1EpnxRzNHQAD7fHkNT8eibxirSfEnxi5jAAiCX/W0mWIBw0wilC6woDUgbm79puYe4bdcKf2rN/b796SeLB4xAo8TzAlnCXpNpikbGQ1EFOGyFEee2m5BKZUxnw+gH+Ij3tCthN2VICSLEVYjRVO1526AfYMClJk/DiA7g3EJ7BrPOOyk4680EHoF1mGo1sNRA4v+6eqNjlU/BPck+kBXZKO8adMvbqC8Xgo3k1sp+SjGAwPRZmH0a1GPn4PjT7zvvz3b5P/ZUPvAqq1rzuppGdNuj59hS42TtGAb20V6iyLiL9P1xnkvJm1E1InEvuRJEzDX4puT2yM6z3/VzaZdpBWxqO5he4YtEgZtc/lDO/1EfQUjSFoobpJt2AayR3PulG+sU4nMSPWX+CAwG9x1ltefJXi92HI8EgM5yA0JW/hFsWC7bzbfodp7OmBbP/r8FzFj7/YUIXM+znYTW6TzD0+f64RjwIkVdvZCN83tK7MLAJIQqQXqW9Vgn8ETNlMALbfm6GugCO14DzIICInb9kup8ramyvuy3p1WsjVcv3cpS5PJ7pAaiMJJ0NYxQj3uDDJwq5wZLdve7c0MpHrwQJjqNBIzjhy8aJgc7vVLTdo1T4bDZ8yni9GtH2Ug0RR6f1w0+o4+Gg6ZTu0jtmf3W3dirBNxYlMwcyv21s+cj1JvQLJm7jIc+SOQ9SfsmPdCLbhOaYDL0Gq88pkO1LDCts8JdAf7gqoVkNw/gc6/RASFWSVulsAX3fZ2AU5KGUa29tdlYMi7+UMs5N8I+JrznkeXr2awwoaf9RremjMMuzG77Q9Sqw+7xGB5vfvH7ama2K/gpgjogMmA2Yalo8+wKNMfT50lw2PkhzHa8rqEm00v/vpbFryL5jS8Hp1+jv1BJXJF4bDEe2G5+UbwhF9yfmCKJ+zF/lE295MDtWsjprAbk4Q7pR5iw+gC9d7LsEFofbL0rOeLhTGZ0jvlsmLtRzSxd/VnOcn5yJCecL9deiyJB26ysOYRl5vswwOFhO1HeTOYrBuljriI8fc3lKIoEX7yJcF+5MMoA0VtAwoCucCUNcNKnwToe9gQHlRbdWF6d5isd39+2zseLojjeRR7hg5IMyw2Hn+wTsieYTP+EY3M5CK/YucdireZ3UMqmeg+4SGp2URBqi4x4gLyaLyEJ9U9q22mVCaawpWgsweAhhfLLPCoaHsKPYX31Q7YYgEVsTeKbI0Nl58wCdxE1rtvzhkIsIM9kiOcYXRtTqVTLXKvGcQ/ciA1WM496uWekGODCTcn0wzUjg/A492/oboeOgFGVrdi+QrM1hSZyiQo36vp/h0KzYhbiaLuRsbr9Gxe0+r0dXgAPRSh9fNbMd1HQvCDKpUxOQ+wXxWpbp6ZARIwrDWFg9kLSZmEO2n/pHZa7yrYEvoTCRpMbL19SK/srQsCUZYM5/b80wvfQB9hiimRFU811L5Zjlz+RuPbbt3m9N2nWRJgr85vKYZZExjPQAV3tk79y5QJOiPrtLxiWOZNFvfupF55UA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73a5c2ff-95f1-4bcd-548a-08dab15e1868 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:32.1972 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xI8+X4mJLQ05r2A7yG9GBGA53g9rbI6C1DNI1sxUUdMU1tstKQ+59wrXyLQhbEBzk/Xlpwl47M3q+RlsRZF5aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161140_962242_608DD1B3 X-CRM114-Status: UNSURE ( 8.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds bindings for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- (no changes since v4) Changes in v4: - Convert to new bindings Changes in v3: - Describe modes in device tree Changes in v2: - Use one phy cell for SerDes1, since no lanes can be grouped - Disable SerDes by default to prevent breaking boards inadvertently. arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi index 3d9e29824bb2..8f986b4f5efc 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi @@ -423,6 +423,24 @@ sfp: efuse@1e80000 { clock-names = "sfp"; }; + serdes1: serdes@1ea0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + }; + + serdes2: serdes@1eb0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1046a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + }; + dcfg: dcfg@1ee0000 { compatible = "fsl,ls1046a-dcfg", "syscon"; reg = <0x0 0x1ee0000 0x0 0x1000>; From patchwork Tue Oct 18 23:11:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AD65C433FE for ; Tue, 18 Oct 2022 23:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PaYE4cQzWTrKZ4wJes2bLIIYSHzJp1rA5wXguNcRvA0=; b=rsqvLeevPHOg5H tNJwOSLir1btXpHqa5vIEmPC0SJP+gP6o/VrNPTomNGU3Uunpb4CBA4Xg7mfzeyprMTnJ8JcEQFjj P3ozcR06OzPpyeXcH4IlxntsgcpFnkBJYCIa3ZxhquUGZbeYjR8F3oEFXbrsuu2ipIywPSIt10tuV i6qwJ9b30NlWjsR70ICj+xr2sSGYJsVhc2JFW7qNv5Cw3VW18wo7UStxUaPj0l+f6kuxC32Vq8zTt HtI99Y+iLGQvkO6BqHiAybt2KfpvuDJQNgdOtYlkTvjGWNu7jftrE3U+Wpp5TFjDo0CSYct3ZBiot /PogE+DutErdRTI0hyWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvmH-00ArhW-Ez; Tue, 18 Oct 2022 23:13:41 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkM-00AqqD-Ph; Tue, 18 Oct 2022 23:11:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ovfk0KrqyKbB1Qi592bhN2x1Dzxtq3+qx6nJkP/fxWf2o3xBLiR/Dkto9sRKJrraq2DAatxQBAg1qUdEQE2JP+GbO+lGBT3S63ZPtVTCzR3/O5Wp7GscC1Qo/2lW73C5yEM2iq5stmv2D0+MGH7rWBmORBPesLqDzW+KrZWC3uXYH/TDB9cXkSvxNzEIULZ8pNBZwM7wJp6BXIkgAcaSXe5Sa4/6K1w005rnql+0h5oI7Xa05KJjV24oFYXeyjlMLr7jaUTCqoIEJSumEq590/ZirlgtL1zJMhRkuewjEyL+MzvJ8vFPdnQKfFUn+UFn5FeUJtDoTiWZQ/Uqq6dPqw== 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=4rZnDIYRgiOMpogZa0b1T6zno6/ylouqK4NkpBXH1y4=; b=eSL14fRsZakoQkguFmSBeOJlIz8UHh7HP5mciH6JKBVGlpQzjLwaSmcRdu/FzusS8bURAttUaBeyv06WGuC46jIFzWR2WPvgdCIW5UVrMKPfVHcUWwizOf/d6edMeOJe6AOuna2AQSdvojh9QqY/L5zzt/oekOx+ePiz4CJiT4P5FyvVC7xiS9WgpiyEx3jmXaNtZrcUoIgINEJsWjg2xgtyrzm0xidhesrbyp4skx6P6NIMkO58Tt5/NZMq6MH67+22tbGp+uTf3BloXDZN1b8k/00+GqRRglLXJgdOt9SDG3ZoLkEeWaSAzC1CmjnpmgL3bPg+ywsEgoe2Ae2ExA== 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=4rZnDIYRgiOMpogZa0b1T6zno6/ylouqK4NkpBXH1y4=; b=ns1RkOHGYLzdEtW26LI9I85erhaek7Pyn7I63WkjOflU/ofyyyV3ha/2EzcEAhgKCoigAq0n7A5izBUOlbjg0IVxaxPZmblcunyN9erSKZZfNUm5mrH+1OkqQS5T+Iv4s0rYvKJpjydXpGH2M4B/GK3gXb+rxc74vfbWQteYGW6uml7KvWEN7/GD6LLANFP8y1LYtsQb8nLcogL/4WdKxETIsSrOOBJ8zlnyScqKlMCD+U3XkUPsIDqr7igOD2faKhCGx3XqsthKckcGkSXK2ZRYqMVgvl9C4P+aPFXy8TDwi4RfV+BwtkRP4f/5mwBoDiyHwx3EWlWduNTA6kK8Qw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:33 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:33 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v7 6/8] arm64: dts: ls1088a: Add serdes bindings Date: Tue, 18 Oct 2022 19:11:10 -0400 Message-Id: <20221018231112.2142074-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: c3885b56-4071-48f2-bbb4-08dab15e1956 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XscFpAsIH3HJvdZ5WW1slE49jJn5s0R6PCF91NMW43s0w8Ke3/XAxQFDJVImRZmt8k6SCwQ7UWRsJVpjUXJ26Q7E7W/HiAST74x4+mLaaB4Kwr5RCRbX9iA65USiev5vLhlanj5cbdPwullv9IVpjY3WlBCI7Omi19o67jI42ra52D5WYtxkpGy1OzqflhEeVEi8BP2wIkXsEYRUAH2JIS48JYypYDzk3Nmc9smKO2wSUF7de1TytGWRJI52nt+DyBp+am4xMlPsb8VLinhacBVcOYP4b8a3ah2ltl2+nR1A8tLquDcvTXvSPHp4shv1vgZ6GhzVPsybxdBx540VwDrq8SI8dhuz30D9hhk0jf9p329iHZZNhcK3F2OBJLYu25OPPHfBr/eiw9uMOuWRZ4s0nSWWZb08o/bt41L3bIBIRptQi9EaVu1F37l1XeRZlpC6w8wsLuw9N6yrzyZMGKaQOlSfgAWKEmMr9yXfpbGK/M8QJzxvwnwIy5WAyqPvQl/qcbSshVWsteQCx+T3rm3Rl++nR38UTgkEoO7OdLEms++UbFHNbZvmZC0NQlVDUSDv9T6WNAEN04XBOWX2z4y8njDbY+2JhkraOzGsuTxqu00x4cxoh2R2FV2ZIdIBP3IVqR6uLQtbfqnqFTC+onipSpsaYIXTDaUpukF+mXI1a7031VMSpTBgt/sVRlIb208hPv+VAmc71+kB4N/fJDIzpg/439SASrlLRFrxAQfuu52fQgh1+9PghWLV0wvM X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jmDtTIaQGNYeuakimU2gbPbwVfTamKvYHV45emNWf11b7IRDkDp/NfBXHzfjY4ioQZKkNVqx4GxlrWIDNpPjB3Dpi2wy5CX47nI5kx+d1e2nW64czscGaq5WU8F/ZljgGHiFcE8EvdnzHauJBg9S3OVgcsvC2TtHKpZgqpDAgW0+dKE/+ZQsiK0H2IPYq5Rq1NdsnkfT4F/8SKW8xVcqg8z4Xjzx5veYD8oE+h7vZATxFJ7vQG+KUs7UJ6ZcUy5Iww3g/8ETPqSsvBAILJDx+pmuTMAWoVGIQ7hlCKRF8OqqCDn/mwVad7rWxQ60jJADR4OwJ7Ew0AyhgXuxA0pvl04mbZPHD3fPkoZ7H3qMZCrjN4tx6gl2UERnuMw/UvVgvbG4l+X7sUSbSn0FANSg+eXu3yaGj5Mj09+mnPSA00pVmbeSc9C73KJEzk3RLv7YfPab1u3is5sFzXCaBave54Krl6cRsAOzdgB8p5bk/cMrl65qWbz9QrjjEAbrHf2C5iumsXBE8Zzt4ZIjBPtXrr4y3j6+erZvAiobEhp2RlVEMAYYikvWFu53mc9fHkptoFrKgtyYseTwAh+EHEY1WoFa29UJgpZy9od23ay1Ilub5H6OQPg2TupM9gdjQ0DyisUIzjkWNlAA6QosJ/wgB3xxPj4CuPG37H48yN9U8qTq2UpKEuX6WUPOLpsHOfJ1gtYYCGX+Az53WJqCxOcIjFVPMahouQla5ktE0YWsGh0WC5BdX1ttnMiA4t+FDROxqF1S1azIMz+kNJMl3Lvg9inn0qa+hpxREIZAOD7Eok452lpHTIrpVg2g8SPtn/N0c1YZ1RM1/hQocHAy6lSDvsnU9kHxaGmPxOvZlVpznCmi64w38ZgmpBbhIqejXUbLWlpy/doeJfITU0LxtntcDm+jV9oSsayqkxd9BhEzIrqdeT0LjdQeIEKYaRJcn3ZelF/vt1T3T3fEiongxsbLNdKAk1cePXSHvosDb3zXbyWII6BmX39seiDI1F7TGANMusBOjGmsc234Vghe9JhEKdFzMCzwNdrnN+QdZ2LoEb0MrC7XKEMH+CjwKApqztafohSc+C6SECaM0eFaiWXEBm0Jaw/xMJ/kNaby3b3i8wVy+LnP7FJohvCK0YnyeCRpQvr0KVduWtTJynJhPG/CV17OoSfkULZck5lpK9uD+2tlIpAmseMHLckKZsZTYbjSy9pLeCBw6cL37zt/jqCXFnWRhhBPnV+oB0YflI9Dqw5l8+Zdhfl3Qx7LIyBQM0CuCTa/i49rfGqYA36siMoEtNtbJ0aCQ/4HHzUloVPPscK/RHyqj9raCMCfwWRNot83KNE94SjsdYcCau/dvdrohc4xExu+/6usFDG7mfbph31CA2b4wSC2lPPV6JBU4cG0GfkVfQP3XeB2Ds6Dko3IZ23RjEadt87tfV+WZUv6j61ehZY9Q4dw77Ku02keNT5q+GlHOHZf/Q5AfbKSOePUcd5dycWKAJwMoOkPvG1C6Bu+cNpawBUIiGMgeoGXMKKpfsgVtCG6hHib+ibUgYaAnTXvdDxsEJR01lbZZmBIh0o7m3DldJCCr/ZjGTJR86tLWja89qwBAHGLa22+IPCNCg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: c3885b56-4071-48f2-bbb4-08dab15e1956 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:33.8534 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0LnBNwdI59DkH9T4rbz/caR5mZ+Gc/x003RD+ZoEu+aWAk3MEOVFv9V37UD9yVT0u1z12jaSObgzkoOZuQerqg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161142_866552_4878F88C X-CRM114-Status: UNSURE ( 7.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds bindings for the SerDes devices. They are disabled by default to prevent any breakage on existing boards. Signed-off-by: Sean Anderson --- (no changes since v4) Changes in v4: - Convert to new bindings Changes in v3: - New arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi index 421d879013d7..3810d66f8725 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi @@ -238,6 +238,24 @@ reset: syscon@1e60000 { reg = <0x0 0x1e60000 0x0 0x10000>; }; + serdes1: serdes@1ea0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1ea0000 0x0 0x2000>; + status = "disabled"; + }; + + serdes2: serdes@1eb0000 { + #address-cells = <1>; + #size-cells = <0>; + #clock-cells = <1>; + compatible = "fsl,ls1088a-serdes", "fsl,lynx-10g"; + reg = <0x0 0x1eb0000 0x0 0x2000>; + status = "disabled"; + }; + isc: syscon@1f70000 { compatible = "fsl,ls1088a-isc", "syscon"; reg = <0x0 0x1f70000 0x0 0x10000>; From patchwork Tue Oct 18 23:11:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011193 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85555C433FE for ; Tue, 18 Oct 2022 23:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EhlbLMY3cCZxkZ9x6MpMxsBnpq9zc+MCT53i5riTrz8=; b=Jr8A8tqm1/R0JI GOtvDuGef28V+X1UUbU3XZLlo+w3I3aBz/9N+v82fHiv/QOpBFonXcV743zsMK1n374Ma2pP6+cvm IRjHrcv8bzvthcd0e5oP9D9kCExv/yJjJ9YheyulaKVjlZyUgDkQjkl1r/cmLZOLFTHECLyw0SHSY Pxx8VZOUYn2BorkDh2kjJo+v1SmwsmUuS5nrLqxOKA/BFE0wzxPHf0K5PWH4y6FYOH4QelUsVp+Ut EhwoI0nmHX0zK5tSwLR6JyUQTuc56aJIIbWwpSDj8yQjeaXJjamq96XjkTdpxXw1rhn4jCkiZj2H+ 0tXM+YJ5EGEGCB9OJgWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvms-00As5A-ET; Tue, 18 Oct 2022 23:14:18 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkO-00AqqD-Jb; Tue, 18 Oct 2022 23:11:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dd6TCp5SoSuMr58AeLunmXo8/KqEqoxpHFRL1qEqn+UyiCOXZ9AVz8gLCM4fuTpZ6c5vlU/t60/fSKLZhwAzFVR5XxQFwOiZHxAC5KRTIq4GM8DreL+yxkoX3vP2OEkVpNSbyfPzIB1vzTCM0kSUOOkBMI0wTH0ZnZkzzvBF4R5zuXs/oWWj4qZQzBi9r5NTFNvFT6iGAkVCH1SvD006atX5ARgbtdk34VY9xChqmUn8FA+7qE+57drdKynt5nv4f/5+WTXDnuYQOBT8XYQ1anpNdjlIkM+1GsYyDcORQdnGE16YweddcFl4jdO3qeMVxxbensUxec9+CPGIA3bX7A== 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=nVno0eCXEjiERCkt74LI6z3yAklh4xF38QFIhk+Iqfc=; b=hZ12ZA5XjvuMo7VgB9dcmdb6jK2beC9Mha6rUCkX4gd8VAoekKz/8Efxv8bs8wyWNoi0mnL2sXXvoXgcmysZvOQhNnOrU4kmRlDGhRyKqgku2fx1gp0+x5nG4TQIZBk1adyJYC8ja0toJc6udk67bT+X78LrRQnkcvvHpRt7muuOtflRWQydKJUkGc20zu/knmJ/35iD1WHDnDCsUTcS86SYXaaeXYSstCL65HYCsNuCZYLVGTW7NoF8aWtomgw42/ZywJP8OV6p1T5fep71zsuuRH+4uiHHyuSxDbxDxVSpXAQ+8Pk7DSaiUrtervnlSLAeJQKV1nyF7NY3hXh17g== 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=nVno0eCXEjiERCkt74LI6z3yAklh4xF38QFIhk+Iqfc=; b=lZWO/Gc026Thl2lIf1V71pDDsfy1ZzzkdBlTnzWuf8zk9kni453uUg6N8Pr55n1pKizNmmVoRmX+q67Nl2HsWu11r8m3fsSyganM2wFsM+ZJwvXPYO2IJz1U82PbgYoyH4oskRSzvi6ofiYPpUfJow+0Ayqsi2nKznWJgcyjJVYn1ozCmJ9yXCqIwqH+lsAXTcBwXA9OawolCW6V1Ya6TljSl3n1RqN9ZzQLELX8GZAAb3/7oJ/ncyU6v14SEMXiO/ChW4opMxjMsq1Vz+/pprP/gooaxnSl1vUrpxmK8USs+MRCKWVrtD5k338KrP55Ul+r/HKYFrux/2RtPCP6aA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:35 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:35 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v7 7/8] arm64: dts: ls1046ardb: Add serdes bindings Date: Tue, 18 Oct 2022 19:11:11 -0400 Message-Id: <20221018231112.2142074-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: 78fd30f7-b551-4040-97a0-08dab15e1a5a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8NGsE9/jP6iaaTqiPRPjkgPl4SYdFODOIhf/d1/saWJ/JRjeNl6mi4LeT4mLW/bcT1iZKfy7RZsTQ9JEsaEF/bV5pXeOMSYjimi+Kt09BbV6DPBThCNjerP2xTsZz5+fUoyahXZF71cvP+R1nlFjEitsPYRvwnlUJMzqTW5sn70KUbovXhu9PuSl7KofgurMTQrQeINRt+Wpn1jHOFXeWC9kgzeqsO2FHzXm5Vxr2a0lwywqLN6RKqEbgYldqXR7TGNehrWfkmjUukJxHF6LwfcCdAv2Wnht1hIyPkMhfX+DoS5tozB/mp4AdDIddbnRFnEzUNzMRmKP8OCEAi4rn57okcUYj+BGQtQVd1n/MA9LPRC7q1thvUQrOyWOHkNUqiaI7vunYi0OzE5yFsIIDQdhMJokVVy5CBHtYJilo5RHDC6Thbky7bm3LDdTodgPFFWRoyUk7nMUVpz6fUrSxYGBa63GR2YulCRhHlawNi885K4EAu7XedA2NFfkB8FKzsfz2GiiNQxyHVEbFtd9vmRo5cyoNpk7/V8itLml6bfWCnAOinporqVJGKLciL3X7iDSjnmWOuzHIzNt36kvILOFOQTOdRM2WGC8PuqvI6dBcLM64sow1V5Y7mU66JXQrlw4aANzZNrFr4gjcd4ajZ7qWhzqXnNoHAj37i/48YkbE94xtlF5Bt46vIkUMzgkrMUESOGZZp5BSWCd6ohyYka+PbsvaDnLtgeNHKu2vzdC5dnGE9/On831u9GPuDoS8iXM3Lt9ijBSpX6sYcdPizKVH+bIDDCwijCWDRJqnfixhUJETCuBq+uRQNr553un X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(966005)(2616005)(186003)(478600001)(54906003)(6666004)(21314003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iPGiO1u7j+LOF8Gfysix9p+CHyh7GDkRHjsrMLHS0LuiK52+PjTC+gXB8BIwgno5bORbr3SsFe0/EiF8i/2k1y2GMRdEnaupIH67SnlRqNTO73A1+V4T/+EBrPQG35SQMOk4I7GNJRaeZOd3L4q68QxRYrZIbCX63B7VzromqJq13cxSHkz/J3lniwqtAmFKdNViL8v5IVh9gnW4F2PY+PB9izeIrLth6dyvYkirYH4zDOm5YhSRZdmRHiFoYeSIPi7TfuPgTqR6Vu2aTBzLXL+9vaKeGpvDfWeSyn2euH55v2OZodLv3aL4tRwok2hFsaZjKCbfxwhOZl2EheVMxFD/4YAcCUPtG49SwuHIYjn29zFYxANwnYHT7h9dvT5BwEFCL7AZsNzT17gqBBHXgDLWbJEAhYUdg5Ihji2m8wCm9e2oo3OKXIcegmLqrTnOkPPJ6unVPKzFHPyg4UbgU1KcIWPBXFml84zhVni8hYUOZabZ6XrPn+QnZeXHp49I47vBq4fTiNbYlf2RWsjXKF61y9C/xGq6WIxM2Qz1l12M7ow6wM97mEr9znSzHOXxZfe5apexpEjxgpNRCojvLDEEBxsjkeArilu51jJyvVW3NRFhqj+9zs1tu9vRppGR13uNhKG/LAQUUrzYWnv/DsLHjII47Iy+N1h8preEkbguSbHPV+/QMiUpI+kAGcOqZazo5zSNw4qm1OKhf4vyzIZ4yihVECg1BSTwSIh8yznSeq7JrP6BNhOkOj7RbsGCDXBVm/DEP0SY/7bbFSsXx9Z535MolmxP0FlH5r84ZwCDfGftnncWlkJIHN0g98Ba4DbbWP7lcKVBUO1X84cViNCEA+TzKqxNXfEQ9KKnlI2DLRcKpuTLZrqqjzUzKo9HX8aGPdK87HWvUa8P7r5uh5M7cNhq5COjkBwxntqcYqc0wSOH/fMqYQ9PWWnqyelrjVoCGzFaYxexIit1Yv9vBxvGPaSQTeCgHYPeVa970ur+86XEIE+HU9YXZLZ6E06/ozC0XwHU2/oo8ySVzRu+TAPx7RP1zUJNfOMxHD0/xe403ouSIr097cXQPCUZvObSzraRlBBhr00W2WHlysEFvmpv/kalGwNmhLz0T7ZqJKk0N+PLRsKpmGDfJpln6L1oDBmt60Yi+CZME3BH/sVaNmwnHA4zRPgILexQbSI6yJcqB85rqQNYVQXkHMKpHWomLn1ewdWjn5TgpmarLUN+DOQv6DGbNeCurI40x04OmuEUloxhaSDWT3dbX5tTQHSmVtVBRYiboEgMEBP9GHVMH/VSdifNT9gHmVo3gYggjW+hk45sUIQ54LpllzYnLud7LChnQT5jgzql+GacTwQYxESF4WqBrOJb/W99X8Z/oMD3OhM2xW6B51+RId1k9RaespSPl8ITEgqAvyzzaa1ucnN5xiEFJ+l/WASTKCed76vc38T0mTtUwfBSwz0vxdTES0fgc2LIXRqJ8Z3/aB7Si0XvxPSZX4TODHHUBRJNMXfEeN3KaJSzR82JrHMYEhnt/nDPsXYRVpPGjA2fyflcrRl6R79L1aXQCGfSqwnUfA8PDmcn8XSLDlId9Z1z0KLo4ouyOAggJSfljpcPwDuolg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78fd30f7-b551-4040-97a0-08dab15e1a5a X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:35.4939 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oZc/4XVd/7RdhUQfTbt0YJ8Ah13erJYOnYjbcgGYGfFvpRA7tBIzkNr/ALqxB7EQgtLJdoURgxlKXo08rxSqLg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161144_701351_D332B2AF X-CRM114-Status: GOOD ( 14.94 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This adds appropriate bindings for the macs which use the SerDes. The 156.25MHz fixed clock is a crystal. The 100MHz clocks (there are actually 3) come from a Renesas 6V49205B at address 69 on i2c0. There is no driver for this device (and as far as I know all you can do with the 100MHz clocks is gate them), so I have chosen to model it as a single fixed clock. Note: the SerDes1 lane numbering for the LS1046A is *reversed*. This means that Lane A (what the driver thinks is lane 0) uses pins SD1_TX3_P/N. Because this will break ethernet if the serdes is not enabled, enable the serdes driver by default on Layerscape. Signed-off-by: Sean Anderson --- This depends on [1]. [1] https://lore.kernel.org/netdev/20220804194705.459670-4-sean.anderson@seco.com/ (no changes since v6) Changes in v6: - XGI.9 -> XFI.9 Changes in v4: - Convert to new bindings .../boot/dts/freescale/fsl-ls1046a-rdb.dts | 112 ++++++++++++++++++ drivers/phy/freescale/Kconfig | 1 + 2 files changed, 113 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts index 7025aad8ae89..81d725a15e27 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts @@ -10,6 +10,8 @@ /dts-v1/; +#include + #include "fsl-ls1046a.dtsi" / { @@ -26,8 +28,110 @@ aliases { chosen { stdout-path = "serial0:115200n8"; }; + + clocks { + clk_100mhz: clock-100mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_156mhz: clock-156mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <156250000>; + }; + }; }; +&serdes1 { + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; + + /* + * XXX: Lane A uses pins SD1_RX3_P/N! That is, the lane numbers and pin + * numbers are _reversed_. In addition, the PCCR documentation is + * _inconsistent_ in its usage of these terms! + * + * PCCR "Lane 0" refers to... + * ==== ===================== + * 0 Lane A + * 2 Lane A + * 8 Lane A + * 9 Lane A + * B Lane D! + */ + serdes1_0: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SGMII.6 */ + sgmii-0 { + fsl,pccr = <0x8>; + fsl,index = <0>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SGMII.5 */ + sgmii-1 { + fsl,pccr = <0x8>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* SGMII.10 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* XFI.10 */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x2>; + phy-type = ; + }; + }; + + serdes1_3: phy@3 { + #phy-cells = <0>; + reg = <3>; + + /* SGMII.9 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* XFI.9 */ + xfi-9 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; +}; + + &duart0 { status = "okay"; }; @@ -140,21 +244,29 @@ ethernet@e6000 { ethernet@e8000 { phy-handle = <&sgmii_phy1>; phy-connection-type = "sgmii"; + phys = <&serdes1_1>; + phy-names = "serdes"; }; ethernet@ea000 { phy-handle = <&sgmii_phy2>; phy-connection-type = "sgmii"; + phys = <&serdes1_0>; + phy-names = "serdes"; }; ethernet@f0000 { /* 10GEC1 */ phy-handle = <&aqr106_phy>; phy-connection-type = "xgmii"; + phys = <&serdes1_3>; + phy-names = "serdes"; }; ethernet@f2000 { /* 10GEC2 */ fixed-link = <0 1 1000 0 0>; phy-connection-type = "xgmii"; + phys = <&serdes1_2>; + phy-names = "serdes"; }; mdio@fc000 { diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index a6ccccf9e39b..bcecbea72d31 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -54,6 +54,7 @@ config PHY_FSL_LYNX_10G depends on ARCH_LAYERSCAPE || PPC || COMPILE_TEST select GENERIC_PHY select REGMAP_MMIO + default y if ARCH_LAYERSCAPE help This adds support for the Lynx "SerDes" devices found on various QorIQ SoCs. There may be up to four SerDes devices on each SoC, and each From patchwork Tue Oct 18 23:11:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 13011194 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CD55C433FE for ; Tue, 18 Oct 2022 23:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cZZSXDFuIQWgNwUpmRMT+GpKp4pdhKp3KwQbZ0tJ9ds=; b=31yUUb6b3pIF+b x0mFarKCVOsPin+Chj6NioClXvEwN6KrcTpnMF3VTIMP46OvmcAjKc1VLN2a+Mm6C3iosf4wzR/u2 pdlE58oKKstqybX+GouNsme5F/q24mZ64LsEvSlSnHs9NEHxsQJKYuNM8jWC8jlxDG5fWmmaIG+YT FAjvrS2FZjycKzLtoljOdCrG/pN5V5FqNQ/WfkchogdlupgpCHUpguAq0/RfelmJeY9lkB7fZ9+zI THQMB8GhoAyzLxG3598u31mEWhKBCYMxodVd3SA0jGfi6KhZJFoAr7QuOD0w1hp29Hs7ZHWLShWoA VT+UBdYojWyoxoJf5Fgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvnj-00AsYK-Pl; Tue, 18 Oct 2022 23:15:11 +0000 Received: from mail-eopbgr80081.outbound.protection.outlook.com ([40.107.8.81] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okvkQ-00AqqD-SZ; Tue, 18 Oct 2022 23:11:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/yoBNuCdHKzCHftVbvxuLHPp84b8DgECp/gqlzhBIAAs0pN2V8Bs0XNX+RshH7WsI7+Twd3VfHuF4Bz0Pym4JGHHdK+AGarOmAhcPswf1iXWP0zB3zPGNGbu8/iN2FX0D3dAr/6Gf2Cd+N03F099FsoFQdB26jSY+slu8RTHdehBzY7H/zIBrFaPahVAjF4ca/5DdLPj/x30gtkGhS24HiPodSO6yyiFGtXwwAVHc6Lp+QoQgUEvbxYP/L2z/LCew13B+Nm4Kn0bxaiQ4W7rPAUAK9AKijE3iKZe3lmiRnxQPWLeepB23LwfEIje1pEZsVOAF5a8pLxlEJHBtkH7g== 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=SkYKwvMqL99mlQrVS3hHZ3x4LOcthYYfh12oDwFTxYE=; b=fw/3x36FZ1vB1/flDcKNT6yJwRSXZ3R7LfB8PmJ+JUGV6Zjl7ZkY/ef+SIEc1MwQoNKd8syt2eNa6stOg7o2JBC6SaAbu2gcvqp2gry40okPHuCEv8tl+ytPZVjHlM57DeQ0qS5mNMAyPPOR7fu0nLLNRFaBxzRdINhx4SEFjfULATrejIIwYhldvl0UJEzJraqclCXORhaXCXVexUKimSGTFXj9eOHOrC8PDlGT7Fmb62QxLSXD7MqaZkvdDRjC3b/NWMNPGP4iTn0qAjGMeYeaOiRbcbLNX5w+tHRxoc1mOSCDl6sMRHZR7iCr9/xh7TNtgE6616IWw0/cvF0u5g== 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=SkYKwvMqL99mlQrVS3hHZ3x4LOcthYYfh12oDwFTxYE=; b=qaw2t0wLbWj5Fsw8uBo9xrHwR8tdoMgUJX7wEnyAENvSKJfJcmiXv3Ra0JV8YghK4ZHptOU1gdrnnmn7u0fevmKw269UlllBZYqOzwFb8tDtqETTXpDoIQcH8UyFYiaQSTjlzXCLkusj4NCKCBs+B/7IvQOuysSYGUIEaOrFhHLkSHmOz3BF95RjjWRJajV8S6HnaQqJt5tHoQ2fEnnvG/JVEgczPQvXlpGAjFp80i0TmnuMPeVkYHJOH7bTY3tnNIiTrmhnlxJtk9dg57mbZ+6mXa4eVzb8zPeHpgVCeo2IebidPlQ1KrEuwznsIh4pH8Uw52VVpUZ5ZXgMKAR84Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DBAPR03MB6421.eurprd03.prod.outlook.com (2603:10a6:10:198::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26; Tue, 18 Oct 2022 23:11:37 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::204a:de22:b651:f86d%6]) with mapi id 15.20.5723.034; Tue, 18 Oct 2022 23:11:37 +0000 From: Sean Anderson To: Vinod Koul , Kishon Vijay Abraham I , linux-phy@lists.infradead.org Cc: Camelia Alexandra Groza , Krzysztof Kozlowski , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Madalin Bucur , Rob Herring , Ioana Ciornei , Sean Anderson , Li Yang , Shawn Guo Subject: [PATCH v7 8/8] [WIP] arm64: dts: ls1088ardb: Add serdes bindings Date: Tue, 18 Oct 2022 19:11:12 -0400 Message-Id: <20221018231112.2142074-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20221018231112.2142074-1-sean.anderson@seco.com> References: <20221018231112.2142074-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR18CA0007.namprd18.prod.outlook.com (2603:10b6:208:23c::12) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR03MB4972:EE_|DBAPR03MB6421:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a2cd09a-579b-4e41-611d-08dab15e1b4b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JaJ3M6FayGY9xZ77eh/rM/Y06uho5XRlyp+Qwtzkg3BaeCvXkX1iwgmByYBADYcS8hDLSzpAxsj3YS8c5G0dQhIlSHhVWbRjOsHalDKLCn3ZDPTAbk3RQBcLosIgOZNuuyX9AgkQbHJuwv44qYapTtNR+anWMpta4pDJ9nhdNeXzcNaimf7c2+XU4o4m8zRPYbzMTiiOZNOKh3VHRewyYc9smFHk7Je6sVYDSaupvmOaLja4T+1Ag09bFIOOeMDEO1Kp9rnHYKKAl0RTg4nTgZHXAZtU86cWwcDkqJH/8bY+cdP3eMaunJLww98gSBDQxQXKBNLrlVBe4vO1q+nEqTRhTgSg/Xm0iQhvqClhGsw1spF/p/9vhM3A3UVFl2QDwmxTDvCusNTT9UFZ/MtgWo2fWWQVuH/IOzuLD4UgqvUnQj3xMVOX+dqdm0Yc1eETodUHFlzhQknXhMAdiZspiPw4wtpovn0hGunPnYPxoH0AyOfutIdb3ln+xL5W4qg9oVMDdNdDZJqbReag+EQh6IJkbHL7rGV8naLI65bHdgAfOjgW5gPY0bjmFdRFILp12WDM9MTgcBIyjwmmfHbN7R3pQPKOOj0FonMWCFZvx5ImtuhxG35k7Vq658t6JEQg+M+AnyJ/GyM2FurzSooTZn2imY6iG5IMAkKsY6hPlQQ1j4U+DYPSG9BqoxQkzhz1XVMLzzu5KZtH4XUtYUVfgEOKxgwvutzF5r1oEBQl4R9zv5Pr/4sD5FRxA/oe4bkd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(376002)(136003)(396003)(366004)(39840400004)(451199015)(6506007)(6512007)(110136005)(26005)(86362001)(66476007)(8676002)(38350700002)(7416002)(5660300002)(36756003)(44832011)(2906002)(8936002)(4326008)(66556008)(38100700002)(41300700001)(66946007)(83380400001)(316002)(1076003)(52116002)(6486002)(2616005)(186003)(478600001)(54906003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 98trJZPTKZ3Dmcsu4HtT7uwnMdlrgCb+WZPLUJwgkHy5geKm7IUSe4WTw74AEt2Esor6Gg19jL4EZQo5lncOZYGmly0MP8yHhSwir9jHK7farvJM7tmEe9kjWVh7KV9gReByQqZB+o6xmQQBTF/vg+lmn1gXU3AHx/PuWqrvyHBdgkgUJ4yXK8CSQTZErqpURcve50hVSeMIyfbl5aK1F2h12pmsebS0y6uAsDCk5Y/bk8iaN2rxkxlyRxOoCvR7EwH3RFk1U89iGUm756HB4HOHdzgrh6uQM27NGcggZv+3Lp0oQdu2v0H/DTjQ5EozGWfIcpiK0557ax0G/hoYRaq/b0cJTYq65E20T+qYL0ZxoAI2+OIrxp8zLq7P7mtmKAe9BMiHIehrlCI3q3wTHO1a3TYjAO5NZD7uQi35RyMQptQzXM9cW0JWDNFU1LXcPAi/tIwD6SbwJ/JCZCS9hYzW9NGczDEB83LXbWh2FBtB6aGaBBG5hVhFV8L/uMCUJ2smsjEnBmPZKjm0w/XRpNrDLtjiVfczp9Avgd6v+u6OSEGYLZIjtjgQ730dlnIPahzQvqfdUuumqbGrY0obDhvPVSpByL7EGbIXOBHKbgip4PYISTqOTalP35X6uIGP9QqWNhPKx429bja7U3U8ucG55192xyy1gKQLOtQkLpQY9MJdV45GmC3WUanxqWnu8vLCL1W3QLxubj+DPTPGSZtwMJ+9cqiUHSRmgsBw763nbmQECi4y3TmFAoh25TlWHedoZkrUy/dJBGkU0V9eqCX1UIne7Z8HuEwTxrIgwA1/JbLopAKgd6y2wrvA66tVs3w6ky6UARe2QDrUGJFl17hthUYr7fm3iHWeFj/0e4Xqjagalxccd5+xcJuRYxQCwDXzBlBNibNBkC9UNpbLV18/n3qvcT1b5wS4Zbp1XDYn3HF0qdG4AUWlXNNW2Kff8LBBT0LHk17FbdvCh9DYRXCMuO0g/bSS5cws8J9HWdoNris4+Vq3+n3SmvFkGHw2wXexbhA9ljrO7CPKeB++cEuATxQWQfYo5wnNw6zCHwJF5Mku0a/h4dm5o0w6sW9/Xj5rapLQs6n/o32hpiI0dnW/Xu7HxSRUKwHL+cjArGmWrRIIVUfsKSxhnqXMoRuuWYyxR65jEuBMtmVKv1yo5ZozofWU/IIL2OVWzkdlwWEOpXj9xBdh8Ha9DLuw3CIPI+myQBBbmjjZHUMfvFlbZmmvcQdw6l026Z+9pAZKO7blKi8V5Jtvtl3qCcc+t/VTVT+xXcGd9vpzqsFWisTFfYUDgJuXVcZbeBzFlbLb+fV9UTnx5+3nEWCMrOPjc5bIJhZdRTQ0gQl+q/qzuFkgDHzCAV7G57l0/ZdwTci8BxW0CH0T+kNi7DdZQJW1vC5pMrBqwa5FozV064CKuSNxeDMbU52xTcR81ocsR9Ac8FGxIPDORlSk7BI7GuXfY/SZbBEzRpPTIck59QTGlj5Ova+YaC7W0Qwmaq6QMHo5zHh8dswmBeJnGYkW0PNhCm1akzuTnGPQtyoOv3S5tEiOGi1qTDWOEUgJhKiGt6RehNiBYIfdY7GTnPjJm9hL2NV1KRm44tlCBm5c6KhVRLYsmQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a2cd09a-579b-4e41-611d-08dab15e1b4b X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 23:11:37.1032 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9AAmZlzBIr4fRD1u3LB8tcJcufu+kW0L2nsTozSc9YyWUiddYwxQBc8ypAkjn45sMi8OIiDIg3lzyrTHMcDDJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR03MB6421 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_161146_989537_341B13AA X-CRM114-Status: GOOD ( 12.75 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This is a first stab at adding serdes support on the LS1088A. Linux hangs around when the serdes is initialized if the si5341 is enabled, so it's commented out. The MC firmware needs to be fairly new (it must support DPAA2_MAC_FEATURE_PROTOCOL_CHANGE), and the DPC needs to set the macs to MAC_LINK_TYPE_BACKPLANE. For this reason, I think this will be difficult to do in a backwards-compatible manner. I have not finished testing this, but hopefully it can be a good starting point. Signed-off-by: Sean Anderson --- (no changes since v4) Changes in v4: - Convert to new bindings .../boot/dts/freescale/fsl-ls1088a-rdb.dts | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts index 1bfbce69cc8b..5c502048d887 100644 --- a/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts +++ b/arch/arm64/boot/dts/freescale/fsl-ls1088a-rdb.dts @@ -10,17 +10,138 @@ /dts-v1/; +#include + #include "fsl-ls1088a.dtsi" / { model = "LS1088A RDB Board"; compatible = "fsl,ls1088a-rdb", "fsl,ls1088a"; + + clocks { + si5341_xtal: clock-48mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <48000000>; + }; + + clk_100mhz: clock-100mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <100000000>; + }; + + clk_156mhz: clock-156mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <156250000>; + }; + }; + + ovdd: regulator-1v8 { + compatible = "regulator-fixed"; + regulator-name = "ovdd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; + + dvdd: regulator-3v3 { + compatible = "regulator-fixed"; + regulator-name = "dvdd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + +}; + +&serdes1 { + //clocks = <&si5341 0 8>, <&si5341 0 9>; + clocks = <&clk_100mhz>, <&clk_156mhz>; + clock-names = "ref0", "ref1"; + status = "okay"; + + serdes1_0: phy@0 { + #phy-cells = <0>; + reg = <0>; + + /* SG2 */ + sgmii-3 { + fsl,pccr = <0x8>; + fsl,index = <3>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* XFI2 */ + xfi-1 { + fsl,pccr = <0xb>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_1: phy@1 { + #phy-cells = <0>; + reg = <1>; + + /* SG1 */ + sgmii-2 { + fsl,pccr = <0x8>; + fsl,index = <2>; + fsl,cfg = <0x1>; + phy-type = ; + }; + + /* + * XFI2 + * Table 23-1 and section 23.5.16.4 disagree; this reflects the + * table. + */ + xfi-0 { + fsl,pccr = <0xb>; + fsl,index = <0>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_2: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* QSGb */ + qsgmii-1 { + fsl,pccr = <0x9>; + fsl,index = <1>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; + + serdes1_3: phy@2 { + #phy-cells = <0>; + reg = <2>; + + /* QSGa */ + qsgmii-0 { + fsl,pccr = <0x9>; + fsl,index = <0>; + fsl,cfg = <0x1>; + phy-type = ; + }; + }; +}; + +&dpmac1 { + phys = <&serdes1_1>; }; &dpmac2 { phy-handle = <&mdio2_aquantia_phy>; phy-connection-type = "10gbase-r"; pcs-handle = <&pcs2>; + phys = <&serdes1_0>; }; &dpmac3 { @@ -28,6 +149,7 @@ &dpmac3 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_0>; + phys = <&serdes1_3>; }; &dpmac4 { @@ -35,6 +157,7 @@ &dpmac4 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_1>; + phys = <&serdes1_3>; }; &dpmac5 { @@ -42,6 +165,7 @@ &dpmac5 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_2>; + phys = <&serdes1_3>; }; &dpmac6 { @@ -49,6 +173,7 @@ &dpmac6 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs3_3>; + phys = <&serdes1_3>; }; &dpmac7 { @@ -56,6 +181,7 @@ &dpmac7 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_0>; + phys = <&serdes1_2>; }; &dpmac8 { @@ -63,6 +189,7 @@ &dpmac8 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_1>; + phys = <&serdes1_2>; }; &dpmac9 { @@ -70,6 +197,7 @@ &dpmac9 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_2>; + phys = <&serdes1_2>; }; &dpmac10 { @@ -77,6 +205,7 @@ &dpmac10 { phy-connection-type = "qsgmii"; managed = "in-band-status"; pcs-handle = <&pcs7_3>; + phys = <&serdes1_2>; }; &emdio1 { @@ -142,6 +271,38 @@ i2c-switch@77 { #address-cells = <1>; #size-cells = <0>; + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x1>; + + si5341: clock-generator@74 { + #address-cells = <1>; + #clock-cells = <2>; + #size-cells = <0>; + compatible = "silabs,si5341"; + reg = <0x74>; + clocks = <&si5341_xtal>; + clock-names = "xtal"; + vdd-supply = <&ovdd>; + vdda-supply = <&dvdd>; + vddo8-supply = <&ovdd>; + vddo9-supply = <&ovdd>; + silabs,iovdd-33; + status = "disabled"; + + out@8 { + reg = <8>; + silabs,format = <1>; + }; + + out@9 { + reg = <9>; + silabs,format = <1>; + }; + }; + }; + i2c@2 { #address-cells = <1>; #size-cells = <0>;