From patchwork Thu Oct 10 06:19:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13829550 X-Patchwork-Delegate: kuba@kernel.org Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013058.outbound.protection.outlook.com [52.101.67.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65D681A3BAD; Thu, 10 Oct 2024 06:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728542080; cv=fail; b=SYlT+pv9icUg/Ro9h5NBDKcNFgFDqYT4VNO8DlDGXTSWZL/qrAhjyr6GQAyoI9s5pHreU9jg4VPeGegSCa8j7yw7gLI/v5SkRbmFhKhpFq2Dg+ph0QrDydkHsnGS0bi7T2frflkWEbfxm/81ZeZZw0Xd8/v1mkYTS3dhmIZKMYY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728542080; c=relaxed/simple; bh=DFH2U2tcOlWRuXkuhE0ZkIsZiTkJb+ZQSOIA6x1GP7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Rulk1VXeyJJ0D+6lEPBeSy46PBtf2LcRlaxeHOQPWEhOVvk7wHTyQJC5G1CPgGujdj2n3JeaoqeDslMI3xjr4UYT8SosMZF/lSbhC2I120Ug5i8qAUzNtf1y1xg3wy729Y2wrUIRJXozpZ2yNSoD1zIkOLAAbnU8Z8uzyrqQ634= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=j8ty+avO; arc=fail smtp.client-ip=52.101.67.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="j8ty+avO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sDTRTmnudXRWSrmJLDB98TVVgC75d8dpvQtkIKrOQ2wwshxteuChgiXM9SFK7N3kWiK2FiEFX0KhxNfKjtz+3q1n+WaSeeR6OgOy2BLaiD/UbNSzaTxICrJ7LAC37lyzBb9U0aqWNTuUTTtu/imuuQpN3wfc8mEx/VuKWid15FQkhiplPLUO5fgqbsX3+Wtmz22DwFdrPDuRCoFobIOvotyKLHikjDaaJNVQ1h+O67x2YtWpZ3IoWQ3m+7bS5npaNAOb3QwMswzHz85r0YYFUo3F8HC3AM/pk/E7fz2KimQJFiIWKmSfVMWP4zn1uLh3MA1Gk56U1wQrsONvtdT/OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bDrBoty0lUlmxgxuE87jPcziV4yOASuLFXUfqLmJvA4=; b=uLEV+snJs4fkmk51YwcuY/tEFiYVSzZpBiC38p85naagoep8nZMNuvw47sJ2MI9GDZu135gW0fWzOa3vA84EXhe1Iv7yFlQyz0+sXD/lKNc6Oo7jZqK0JOBvoV5HvlkV/YkHBhfe9I6vIZkqQ3iQQ8zzPOM/UhIr6KnP7OSDjtunUH9pQ/a871dKHAw/LBbo2F6iM5Sj/WHb2DaLKLRQHNaoElcHNgsYlpI0rwz7Xt9dxW3oMmg+gCi9Jd/goPfLZcL0juuU7q7rvx0/ekTT3wuC+bVVF+4dsI+Q+Bbjk+HKlCgx89It7R+TZJpxymSzsNL1XTiE3/fTVqpEPSkSJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bDrBoty0lUlmxgxuE87jPcziV4yOASuLFXUfqLmJvA4=; b=j8ty+avO+oucTdVxhxNAn7jL6r9qtNP96SqyO8DidveDf/rAquVs+wZTKoJ7Suc/pqOc6kdfXoYBGSKL8roOVaTth9jEoyvfRAja4zixeFFWsuVdvu2ZCogbm5bmwyVSbSHNFIIzNIRyrNNfDcR+97an8Bk/JQ1koyBf0UeAXISHkh0QT8aT3Mf0XgXODxzVMIpKLvLJkRv6KnWNhwjxCoSyxuPpOthyurGPagQnxq5uGyCGGN4EoLKT7OarPuIg9gg79p6Jkyw9clhsmWaMUkRuHw/l3Zo6BTjP9FEONAD9iYQcMYCwv3GySv2McL2JANyg331MgJftYqx3VAyLKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by AS8PR04MB8101.eurprd04.prod.outlook.com (2603:10a6:20b:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 06:34:34 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Thu, 10 Oct 2024 06:34:34 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, andrei.botila@oss.nxp.com, linux@armlinux.org.uk, horms@kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v5 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Date: Thu, 10 Oct 2024 14:19:43 +0800 Message-Id: <20241010061944.266966-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010061944.266966-1-wei.fang@nxp.com> References: <20241010061944.266966-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR01CA0003.apcprd01.prod.exchangelabs.com (2603:1096:4:191::16) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8101:EE_ X-MS-Office365-Filtering-Correlation-Id: 149c16d2-fa45-4ca7-67d7-08dce8f59add X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: sBAk6F0DrKiam3/TBS687WcWwP/Ee/ELJmJd9hcTwySxKUcLVtLBld3dNgMEe+gcLQOoAULKxiuP6O4nszz1yNdkMqTA50TAJdKOUjHitw5YHFTSrU0g1cfDa/J5kuSfk2xiSKx5bcZMaN6a5iU7m/MQAb9WS+2PO25NEcNu1rlDMVvkybMtLfKOyNwUzB3kvecoAzI6i3p6n0oHe+klLwLHCFW+L2yI37jmGnhXnZoVS8pkb5tGREjIy3QdE24AG3cVrrcENZ1KGti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BQg0nC70hxngjN0jRpuCc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jAOS8Znef548MrrAZXVcSr6EPh2DQ0aipIdWlTTrV5LN+SWFpMkIjDGxh00T4YfmLCqKIe7ktUCS5Ut32PfXKJ9rYpyOPJvG8i5dESKq1tuP5tB5zSqpcYZ3K9j5QShBMo3o+mAs7g5PvWZGvKfAgteg1CpKprStK1z3BfGIkMXbXPLlIp3ugV9LeqByvS2n2Uib9u3RgFf0Tfq+t+UE07FjrZSOA0DrOF4qpppcdH3uijbNj7lFLwBfjtly/QW7ZjT6IgZuMC7REqO2FPRIIEXVMAQ3Q1xcMFvyMl5xnGc42XyBcX0yHr1C6SmkdzLX0tClBoWKun+wFPrsdkNYGOhSRjVHt5AXLvI3BRv+IpU4QiCE+vdde0SgMtxnXtrDDohoX6U1iByra55Q48RgckdXFB50F5wZWUpK2GjTInq/CeIbN4s+kaUYnRB2cuOhMRvYGm6qMx8jH3SdUaWc+fO01pIbJxiktuV7LcjU/f1x59/BO6xOYfbyyG8aFRiAkK8Xh7lv5E5h7nvpW7hu7KQzzJBmslGDUlq3KezRAuVZx3FCS4JA4EeafY9HsX/GzssPupKqYynRDY4X3uOhOsIKLBE938HRckIDva3v6YGTGd3NDKtYUmv6ofHMmoW/7xBaKmXua7GuY/ZXAr6HHostXiNm/jguOsTX2VMTdLnrxeRUDBWZc6CbcMflbD/oPax6vrKnH3xsUe/rgSS5alpnHTIYFfRs/0+Td55CV3hNVoCBcgcEZc0TRCax/0tZaLEgKeD7djX5MZ/8UOBf2fiIuAe5krye4mVbtwBZhSlBxxoQTm1xUaG5TVI09LBWGTTARGEv2bpI2e9gYjQ2+WW7S3yt9tdCQKzADvt9DVWNM4vF/3iqVWwEX5QIbXU67LEwQdw2cM/3Be1rG/M1m4tPTk+YkE7UR3B6kLPyBRhkt57z94NAuvj/UyC9LYOhSWkK3YhJ4WTSrjS1MVQ/GAzvaLby27jLZwgEpGv3ifTOy0FFY8MZiUxuUCF9p8wjUXXh5PJElpf9ssjt0xFBCYF7Dz7/udtsw6TSjBW/uhHO4HDJ139kOT7CXt2EqggF9q+BINCA7HwmOOXN5eWxXpJZucWhA/EcKdHo9FNRTEhYYY3VqFYBd6KlS92tgnU9mMn9ACktuL7Qr02agi+uOdCxLKHauUGdJ+gipBfFBGoWfKHks+zsvl+AeColKVeCXxx+gvw4JzpBTpeyxrtWnrBpBW0gh65M25pvAQ0NYjBh9NqzICDO92asR7KgQlvBfD1HA7qOs1owfbpkybWDLJAex7i5dBfjP0LN6hAABoW4DgTz9ntKF/PpQ8sx/uBJJs9OZyf6dMx6k4wto3VVfvzKP0NwwmMgLj4QZ/LBd6hV8Kwt0HxBmad6+Il4CsXthKNDno4Q6dAZ+SL8GkYxqTZhFnlwRV1qeLmkrpre78+eULxwze5bzRrm3dEQ5Rc3cs70LmSs/6q1MRN09I5o+p5shYsU6CloQe12L6tjYtYq1aAqrdcZC1Lkbxx5Hw2JEs1ofTEic2RFIf3xqCaeqwk7jaHCIUvCiDHv++ImuGKiuyifPcvJrLWSF8+mdgRj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 149c16d2-fa45-4ca7-67d7-08dce8f59add X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 06:34:34.4621 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LNwxWOHsHR/UnwnLosMxnAElpkI6sdQfUHpo2UaKBbZCKBHm2EoGP7SqOV5/IPHMzAhYOoWqOixUqJvrxJ+5hg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8101 X-Patchwork-Delegate: kuba@kernel.org Per the RMII specification, the REF_CLK is sourced from MAC to PHY or from an external source. But for TJA11xx PHYs, they support to output a 50MHz RMII reference clock on REF_CLK pin. Previously the "nxp,rmii-refclk-in" was added to indicate that in RMII mode, if this property present, REF_CLK is input to the PHY, otherwise it is output. This seems inappropriate now. Because according to the RMII specification, the REF_CLK is originally input, so there is no need to add an additional "nxp,rmii-refclk-in" property to declare that REF_CLK is input. Unfortunately, because the "nxp,rmii-refclk-in" property has been added for a while, and we cannot confirm which DTS use the TJA1100 and TJA1101 PHYs, changing it to switch polarity will cause an ABI break. But fortunately, this property is only valid for TJA1100 and TJA1101. For TJA1103/TJA1104/TJA1120/TJA1121 PHYs, this property is invalid because they use the nxp-c45-tja11xx driver, which is a different driver from TJA1100/TJA1101. Therefore, for PHYs using nxp-c45-tja11xx driver, add "nxp,rmii-refclk-out" property to support outputting RMII reference clock on REF_CLK pin. Signed-off-by: Wei Fang Reviewed-by: Rob Herring (Arm) --- V2 changes: 1. Change the property name from "nxp,reverse-mode" to "nxp,phy-output-refclk". 2. Simplify the description of the property. 3. Modify the subject and commit message. V3 changes: 1. Keep the "nxp,rmii-refclk-in" property for TJA1100 and TJA1101. 2. Rephrase the commit message and subject. V4 changes: 1. Change the property name from "nxp,phy-output-refclk" to "nxp,rmii-refclk-out", which means the opposite of "nxp,rmii-refclk-in". 2. Refactor the patch after fixing the original issue with this YAML. V5 changes: 1. Reword the description of "nxp,rmii-refclk-out" property. --- .../devicetree/bindings/net/nxp,tja11xx.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml index a754a61adc2d..5f9f7efff538 100644 --- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml +++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml @@ -62,6 +62,22 @@ allOf: reference clock output when RMII mode enabled. Only supported on TJA1100 and TJA1101. + - if: + properties: + compatible: + contains: + enum: + - ethernet-phy-id001b.b010 + - ethernet-phy-id001b.b013 + - ethernet-phy-id001b.b030 + - ethernet-phy-id001b.b031 + + then: + properties: + nxp,rmii-refclk-out: + type: boolean + description: Enable 50MHz RMII reference clock output on REF_CLK pin. + patternProperties: "^ethernet-phy@[0-9a-f]+$": type: object From patchwork Thu Oct 10 06:19:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13829551 X-Patchwork-Delegate: kuba@kernel.org Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazon11010061.outbound.protection.outlook.com [52.101.69.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E335C19DF95; Thu, 10 Oct 2024 06:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.69.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728542084; cv=fail; b=pwQLFJtWvNlRf9NigyGqeLrMltAfsL7j4aHUtxE/y1ys+mZSg3VSmRCfNV84HpaJEq2BM80z4bN+JKwSpV+7C4b/tUALtM/TXKFlEHYn8B/uS/EDmOEY6Ac+4aFfQxhK/aT/MfZAeNZdr+624abFbW11dQkBhcbQk1QnMF8EEQ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728542084; c=relaxed/simple; bh=OmnnzJFWPKnKzbN4t6iMA8QHfnS4uBIc5LmVcHZCHYQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=GbpuP8INC8RZUG8AjfEB+MjCX2oteetcV6inCFHtIFd/ETgAZrv9GqB7Z5SfW0aPVcD/z0xS2LO2znFGiiAa/NpTBCDurwNbdmu3BQL6OUylmjCz1rhl3wQntjU05AW7JG+MSl5i71rc+90cJQglqipqurIe2VSXePaq5UVMIw8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=mXiHYHnE; arc=fail smtp.client-ip=52.101.69.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="mXiHYHnE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q+jFS0ONc1WRBVFtSRDrdDTiz7gshV4W/fOxW1+siYtibxcAKubpaNuAbhdnldSbWt1WpOU6csSeV4xL9cVgIJs+/cQz4IeA8IRZnpu6txFU+Y7IZT2Xi38d+y4/aCRdj5/q/oxE9a0wMsHrmATN8Y6OwLa/80WtB9j222O1SLnEC4Jgrw1205I3mfuztZ6wT92ZZGUqrKKc1oLpIqCIMUwS19rfnIlHz5c64jvxvQIyIhxIlclFb1uIxh8oVhCpl2WUwP9iEUnHpD/UKXlzQsPiN+uIbu0PFCgYE/J18qS+EMZ0DZk55u/GkX0LlJlBEFf8ylHd2s0wp86Vui8oCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gazQZpnL3yw8d0QcAL4ds6NBA8uJCwuGERfmN8WNCyI=; b=sd8yvJ22zMR3fmw/E9xc/L0WTPQT/xRNaZX4lcyqDCtKDZFrzGmcOrLwBnKr0ijld9s5KlSASkJE8OSOh738/5m8merq3xs5Aqm0sOUoUkLJj1NZFvcryFwp3aNJxvxGI6L8o14x1x8SappM01PwH3XaN5+A79QMAUbQLAXIBVKbZMbNJjMRkvavrDRUktI8Mv57PvsTLNZ8uRvzoV/5TrFYFoo6yLrhHsRenkUo6BYAzP8TCyYootKgjDX2bL1czUfNXCOYszGqXd3SZDX96YeWtmZYB3x12loGFtI0x43m1N5Z0+thGIQi24JGjo21e8PlqUvKuNfWpP5HsXddVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gazQZpnL3yw8d0QcAL4ds6NBA8uJCwuGERfmN8WNCyI=; b=mXiHYHnEDkGzi6UJvvkSnSzTZGWKjVNnF3i+E50nNA/aR7tXn/dyh4isJUidiY19UsURuwaD6jwThkbAV4Ntikxrvpf9/VRFzL9jSnayNk5CtqBy8o8WWTt5yS/yAKduzR8PWiium9pa70zYjm1axVxbStw+7jTGXLHoU9ZBNzk5Q5RCAb9GYXNHzPGFFUF5ytbb0rUEFO0CxUb+t+fBqgEZh5Vxdeq9VnoB3FVP9paKvUWAwUtTBbMYVi939j1XaOmVncmjPS//83ZEk6koHiwNgX1mXBt5FYDonGXTyoBdxOV2fSRAZA+xIMOo0yQttARppFznrfKGlQ7GIlDe0Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) by AS8PR04MB8101.eurprd04.prod.outlook.com (2603:10a6:20b:3f6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 06:34:40 +0000 Received: from PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db]) by PAXPR04MB8510.eurprd04.prod.outlook.com ([fe80::a7c2:e2fa:8e04:40db%7]) with mapi id 15.20.8026.019; Thu, 10 Oct 2024 06:34:39 +0000 From: Wei Fang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com, andrei.botila@oss.nxp.com, linux@armlinux.org.uk, horms@kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v5 net-next 2/2] net: phy: c45-tja11xx: add support for outputting RMII reference clock Date: Thu, 10 Oct 2024 14:19:44 +0800 Message-Id: <20241010061944.266966-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010061944.266966-1-wei.fang@nxp.com> References: <20241010061944.266966-1-wei.fang@nxp.com> X-ClientProxiedBy: SI2PR01CA0003.apcprd01.prod.exchangelabs.com (2603:1096:4:191::16) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|AS8PR04MB8101:EE_ X-MS-Office365-Filtering-Correlation-Id: 974434b5-b63d-47f3-97ad-08dce8f59e07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: b51F7dAyeJ/jJLhL24/oucysrZVl59eZ1v4hsHe0nW/Vk3ssDNMTp9EuJ6wogO49RhgIPBWdwLcz6Qws3pn5yMskEbASJnkYXI49PSNbsDVXcPIt2ETzqzwwYKMPh3HGTjthYDado6EvWUsDNWnRYE7d4o8or7+wE8lO5A5edF6etCF/e1vZff8uB9s5AoAbDLr4+SpnScb2sFWCoiThMzNVlANvbuXJ2iJlhCWL6itmq9OvQrFRlLIjbTI5yICXhEBkaXNjuPJNHolLq2vCc2Qw9/SqvfR25sYJv95JTTzqdJ7toqGD7ZWSzRh9y1vo94oObnGLPW/3QTgdIBjfzSZqLqgNsjMXwPIl0bVcZ8jpJ80TvDTmt0dGhk0m8VKbnAq+jZraxtEBH44TAOgMBBcN4ettOEuqsSQ+vzrKWZCI2IWOWFTYEF0nETM2gB4b4I1N+kBwM8QC+4P78jMMJvETvQO6GChjmb0zdIkSzgJh2fBHuuLYmVtv5Bbm+uwM4/eKPBpWMTC2oju5e47tsyqfTkwvpKC+9cFd3c+ynZ5PVWmWjDkOSy+jQb/bA1T9C411J9VNMtzwYv8cbNqOl2Zh79GPAxP3gvvx8+2YeNOq+WK2mW187rWBjxrykErINWXZKODBzMnOxYIzYbqQ69IDBh3GGC+sVwdPz85PXyJQthx8IbQS2i/IwirmDlW2yyqCxHdR1xlIhl7Q7+S3rsp3tNYah/TFjCZsNjSYfiJpAO5Vdd8Y8kJ0coyMeAgoCj5Bk4jOP0zyI/3vLfHNxCtlPAhxM4TAXGq6KOZijiTnqFtCw2NsAZZlNwLEw8L5jM50eGcki0uQTP0jLUsvTYIOSibEel52FHHsCzOefZXmMh7oBlweL8bdvXsKUJJ3wQHHVfC7YcdllURv9+roZTdqDYr1g7cS3Yt5RII2OM6RWlAGB6aGeRKxSPyULZFitV1+usTOnXvrncrs8DpKMsLR74Uy5AeFT2aTzpJ1tuKw2hxV6UfjzEze+VBFMrFkIqEVKXLWJXB0wT//W9D2QDFSWB/EwEkpRe1jQ9KmRK6E7R68VHX/Ub5Vsql0MbVyLBFay23N+qnD1L3HFApVDuZaV83Z74sbc7GNFEGo3w01ViNfHVcz+W7A84V9/5Tlka7/YwvFlgZq+wnkHq6cgecaX+u+c9uFb3EBSNYVXXnZ3V5q4oa/JGN+gmaGtP4t8s8ktgYuXx5irgfYk1OL3cFelfDCJSUrlrq1wCTN2VbnN8HXTZHIGDhFivEN6mLibgBLY7qIaX166Ov0YWli/4sHxn5wvwPEUxIQ9CkkTRXDxAsr2MH+LO3h7aPX2K47ay1YG3pvzHaNWJlcZVfySg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8510.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UdEBo8M8en8zBVP9pxwIuPycDfhEy+BPTsYPrEobbK27TDVNp05tZCTrXh4JWk3wxGSmxwyc2lHUCHpTML6OWiYZS3O2e3gIq1XRlPo4EosaoS7z8IwpLZW9TBY35wsd6M2IA5nORFvz6ebtGvfI0P4rSLPlsrUDn1L/fXojCBpZylyO/375HbV3//2G/CgouAw5y1mL3/pUCefuKsddawfyALotkBOlGE/qfuBPM0iQjh9DINNt5+mhcFUT9T+1Rb7ki2I5nUT/Gwifzju3QO/WruLgYQzc7xMYCcbZyH8faTW7HGSOe4mmVjTDxXTs4o5X+xPA4tFiqK8V/vxNp8U5mWAeOWCvMumOJs7mlanXUG3PIgVlObD/9rSGDOgGogy2hR1PuVGQBsX8W/3FE5OpzUvVoUf4q6rMBkOb9uYif5ylE1jOug8kPKA6KO6J7tzPYpIUMOObAnhWhWXSOkJTSdn/v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oRoO6tKSuGvVJ5f7q6QkkQ2dc6qBdos/U7c229EtDFdYA+cn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 974434b5-b63d-47f3-97ad-08dce8f59e07 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 06:34:39.8298 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bMxIF1JixswP3G8qz+DmxOSyvRzKPO3mnCVWFfKrXUKE+Il3KrB7IbQXeWTIgRsoGQf/EFCZk320UkQFypIchg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8101 X-Patchwork-Delegate: kuba@kernel.org For TJA11xx PHYs, they have the capability to output 50MHz reference clock on REF_CLK pin in RMII mode, which is called "revRMII" mode in the PHY data sheet. Signed-off-by: Wei Fang --- V2 changes: 1. Change the property name. 2. Modify the subject and commit message. V3 changes: No changes. V4 changes: 1. Change the property name based on patch 1. V5 changes: 1. Fix a typo in the title. 2. Based on Russel's suggestion, add comment to MII_BASIC_CONFIG_REV and the basic_config variable to make the code clearer. --- drivers/net/phy/nxp-c45-tja11xx.c | 30 +++++++++++++++++++++++++++++- drivers/net/phy/nxp-c45-tja11xx.h | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index 5af5ade4fc64..7e328c2a29a4 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,8 @@ #define NXP_C45_SKB_CB(skb) ((struct nxp_c45_skb_cb *)(skb)->cb) +#define TJA11XX_REVERSE_MODE BIT(0) + struct nxp_c45_phy; struct nxp_c45_skb_cb { @@ -1510,6 +1513,8 @@ static int nxp_c45_get_delays(struct phy_device *phydev) static int nxp_c45_set_phy_mode(struct phy_device *phydev) { + struct nxp_c45_phy *priv = phydev->priv; + u16 basic_config; int ret; ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_ABILITIES); @@ -1561,8 +1566,15 @@ static int nxp_c45_set_phy_mode(struct phy_device *phydev) phydev_err(phydev, "rmii mode not supported\n"); return -EINVAL; } + + basic_config = MII_BASIC_CONFIG_RMII; + + /* This is not PHY_INTERFACE_MODE_REVRMII */ + if (priv->flags & TJA11XX_REVERSE_MODE) + basic_config |= MII_BASIC_CONFIG_REV; + phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG, - MII_BASIC_CONFIG_RMII); + basic_config); break; case PHY_INTERFACE_MODE_SGMII: if (!(ret & SGMII_ABILITY)) { @@ -1623,6 +1635,20 @@ static int nxp_c45_get_features(struct phy_device *phydev) return genphy_c45_pma_read_abilities(phydev); } +static int nxp_c45_parse_dt(struct phy_device *phydev) +{ + struct device_node *node = phydev->mdio.dev.of_node; + struct nxp_c45_phy *priv = phydev->priv; + + if (!IS_ENABLED(CONFIG_OF_MDIO)) + return 0; + + if (of_property_read_bool(node, "nxp,rmii-refclk-out")) + priv->flags |= TJA11XX_REVERSE_MODE; + + return 0; +} + static int nxp_c45_probe(struct phy_device *phydev) { struct nxp_c45_phy *priv; @@ -1642,6 +1668,8 @@ static int nxp_c45_probe(struct phy_device *phydev) phydev->priv = priv; + nxp_c45_parse_dt(phydev); + mutex_init(&priv->ptp_lock); phy_abilities = phy_read_mmd(phydev, MDIO_MMD_VEND1, diff --git a/drivers/net/phy/nxp-c45-tja11xx.h b/drivers/net/phy/nxp-c45-tja11xx.h index f364fca68f0b..8b5fc383752b 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.h +++ b/drivers/net/phy/nxp-c45-tja11xx.h @@ -28,6 +28,7 @@ struct nxp_c45_phy { int extts_index; bool extts; struct nxp_c45_macsec *macsec; + u32 flags; }; #if IS_ENABLED(CONFIG_MACSEC)