From patchwork Tue Oct 8 07:07:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13825786 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011053.outbound.protection.outlook.com [52.101.70.53]) (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 7CD81433DF for ; Tue, 8 Oct 2024 07:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728372223; cv=fail; b=mv9Hmz99zzCt04HlCDzHB3Ll0xtRfTfAHDZzq8O1D7Enea7KEm1v+SaZvyni/m7X9IXALnSOwrqwCRJ8t3eL6U1Bvez69/8hqfUeUEUcfmcaowm41d4s2acaS72zfYq6Exe949bjiHWF/YCPMRyK5kT5O1FC3gwnF60LC2o8akY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728372223; c=relaxed/simple; bh=3Ie6lylrWIzCpt4i4mFfMpYAwWuMCLcbo8Lm0vDGG+k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=aVAk8yd1ugWqINtJ5NY5UyWxGt0J9QhzMfRCkmXmXeRuXt2RmbGwMkSyJn4DMwiluXJgmR1Dzm12bLapkRwx7hxz0MNvNXgtBA01vpXgGQjDzKhCFZDSRIt3+loOsUBeIX2HIZwyzq8cydtjOa42oneDTg4SZR4RTsH+kZvs4kU= 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=ffoV7tYO; arc=fail smtp.client-ip=52.101.70.53 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="ffoV7tYO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ReWaWpJZXwMpVHIZTsotnjy9bsXekiDIYiCNNskdnsJsGSjoF4liKAUXHKtppQLOVZaF2F445c+WzkoEZRy1VbKm4LdVlqoDIRkW4G+KKPsAg05CQTUltzXUaX/4fivXvtX3oPZ/gAzIyT/xxeR4qszGZB4L6ATi7pRT7YqPfXIIAVlCViwjAfalBoJsdEDGpJ03ynqINZTxOeK+RtuBL6BeSlIVlvQIyw7g6M1bAPqPPkuH4CoytT9mHuuo7gKwxU/6ly771APazn+JIcCGELi89h08WVbjOgjtFL1FiM+jucfWHrJ/ZDdSPvS7QM+/NFYRUQh24a+W5/lm7nV6Rg== 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=Lzw7SdsouHuA+JImjTIUqXwltWwkmmR0EZBAL5sN8as=; b=dLcORJAVXenXnX3N9K2Mlho/9pAZDqKJ7cBICtfM1aJLogpklK/8BC/qTQp8EO+44wonrk31Hom4i1QObmgNTvIewmQLBnFCDf51jbY9lDhaoqZd0wXxRgCSf+VNRmq2AEF+qguHetwf3YE3jlfWXj5C3equ3iJs/T0CCHCUk3YJ2/9jagZiAupB4FpUp065nvyWpGEYTHjqad64LgHZ3fNSeqp/fTaWGB1eX5Zc8Qx+8tZFl10h/VaiHILPfB5eAZGy5hFGS6a5PA2aFhteHN5yXAZO09sXAIzNoD9URE5jF54/ic9JtK0QUQ+CubsOzvVrnrXEeuilNdRDGJFWuw== 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=Lzw7SdsouHuA+JImjTIUqXwltWwkmmR0EZBAL5sN8as=; b=ffoV7tYOzmoNLoj5UiEvyGLr8vJnLkGscOpNPBW4Zcyv8R49ngK2Wu7VQnraYecpPrpgXhfqp8EUrPwUhH46KVziNcI3za0Spdj81O0GANu6PhXl9tmdPLr8BnIiemFdq1L9ZgxHkfqwZS+QKruIsUJmnI8LspM+5CLIW4n51MtTe4mQu02361AjzhKuxYMeYtPsYrZfSGp3KWLRJIKstHao9NAIOh2YegYtmT2FsRaw+yRRMqixJWyYczI/IMozNsukNYIGNGIwocp0JlFR2wAirgC3XWdA9CQe0F1bC4AQsM8GyzkEidcKCmt4DiIxcEA62z1kKs3/NebiFCgZwQ== 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 DU0PR04MB9564.eurprd04.prod.outlook.com (2603:10a6:10:316::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 07:23:37 +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; Tue, 8 Oct 2024 07:23:36 +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 Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v2 net-next 1/2] dt-bindings: net: tja11xx: add "nxp,rmii-refclk-out" property Date: Tue, 8 Oct 2024 15:07:07 +0800 Message-Id: <20241008070708.1985805-2-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008070708.1985805-1-wei.fang@nxp.com> References: <20241008070708.1985805-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR01CA0190.apcprd01.prod.exchangelabs.com (2603:1096:4:189::11) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|DU0PR04MB9564:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e2c4b79-af88-4236-2e7e-08dce76a1f97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: ApkEMIBueRFAmaxobHinvn8aE4HenLJdeTTnLi358gnl/ojHXs52xoqXJs/GS5+Fqexvm+t4FRQeK+lmutYBFRSisSddrmqeKo2yMLE0TwRux629Hcfym1lSZ3/bQPklHs1ZkLHbJ4LOywgDtJ5DZRGzfevg8N4pcTxkjFJbcJgdIQpGrYMdBWkF1+roFsukM0PXobthV7J2KvW8fumgzq0zgnAQsJvSmTd4uY2aiqDKkODI58kZ8lZtHY491E3xOfU6UMc93lHZyLSTV6YsfxssmZ2SQa0ZHzSMu0pEKc8V6nxEu/bafbJQy4Fvl2GfIKQ04Qd+pDW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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)(52116014)(7416014)(376014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: drdAj+IXgaLbsdd1utTikBDJt0eMPKLDd3cenXs/8aceLzvl0XeTFVr3e1tV1ttp0bLwSB26vpYAWh7VZ9Lnowrk6CdstjJdn7BjqLTsAiFM2cyMIJwAyne5DrLKIiiL/Vycle8pMVXlEjVTfpptcviPiEOndh3hYVIlIu0FRoLNBaSFNYgRGW/5KajrP+yVLFxmnoFdPn6gPKj6tjzqZU/+c5uJZu2M/Y+1CpOBQ3bccF3HXbg4oMwdCpkOe7tjRCZwngJrjwxzxQRwMdXZgq/eFyx/DrkDJ6OpWWkvVY00Eql2EzY9tf1+CIL/cwL5BYaY3Y/KJ7B0aVU1h25KG6asVqIQQLtOd6Z7RpL2cNZeKJ336qY9ZoIc3cXYvXGA6qB7uAhsyqW6mwYmOr7Rp+7+UaCbdxLQBWoeON6+uMi9VKlxzvxrxce0Y/eyuAky6FN+oTSvi1SqxjzC24N0u6YZIFsHF8Mh12Hlva0n6xogW1nsv4e4CmyNv1HNEVCS6XwjVYNR0XsWLeTMW/BMC1k2fqazPQGlZeNiYs2WG4I158OsPF9u/TPqAg+BHMVumxqZUmImbu/osZIUQBVIfCqzrYoGesOKsaYb81ogPg4RmI9gA/SNShaqoj+zbyj4cq0/TF8dudmEnB0QVxB1BmK1BlsqmQ1mZxLaWkSo9w0WwNd3hAbaLqjp654kpZOEBAwe6CsRlA8nZc/sG2bbMCfl5Undr/KG6CUR6xORVuaSTfinD3QxCp50qJ2ArnjFu6kxxGO4DNrTLQFWkgmn5ZgAZVvYxtjH7WxUCmUmqBPBFIDR3RXU9MdY5baBhVjT+B1zZ47bbHjC/tPzVtSy/psNnFcN7nzpZPUW9J9LfchHaXqjfcICyKnlmd07zqvpICpLRE0ei06JESP4OFlDTOl6tCxLRO3quZM3hJQKeq8nZaKLTLFkdqBwyV83aXsEdFEbIBSDHraMrRU1DhBGfevmPNd+cBbftzny3fiiatSXbV0t9i8fNgabOnyKgEg7wEh/RnBp/sSXgBvV4rFWZKV12MmjGpr7jIpnARyfUB8pOyzPFJGSHD58QUgs4kaKi9NvePLCiP4H7U4EDRS3C+avBBKC5kmwakJcjhiuJB6L90wtPQ9OMBiAuhbyZePK3tQIcKPTEaHIgNAJmmoK951wePxdAlhRS7WVm3U7NaHdKM0/lIYRXoSU2WzQNwtYnVFZX5IGjzCOYsUTYjSSW7wa3DqPilUvZsK8WZXVAnCSwADJUJ+apRPsONExY0cgSYOs3BIRXZQ1TUTwuNCXJB1T5gnfsg/CNm+2j2TNXelO7AZQqHSCon63LbhWSRJlEYsK+ADxlsZkjTsNlkN4K62AScPPvxg1RcYVS8g21/BOQHT2LVVduyNzCiUwZov/CkuAVl1nM+IUZoAtV742V0C9y6FKuuvxmRcTnw6U+xcKSap+gs2doHmCM2rSJCLkf8SEUAigByOBO4pMWZuCMauYncWXnxMS8Q4eyuzodHRFZFOH6ZiM+m7NR53hKlGZltJGbZfZnL2itRvfLQp65X2Zg489p0Wp4ykDeuJR1AG+KR+t+0JZvkag/Hxo/Wl2 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e2c4b79-af88-4236-2e7e-08dce76a1f97 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 07:23:36.4179 (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: 59NA5EwG4hi5PJPFBaiL2mJLtBPueB6mQrfqgaSgLZ8lelQGrxwW5bM5xOhTnGY+YR6nnnXUigTUHCLV8Z+pIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9564 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 is 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 --- 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. V3 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. --- .../devicetree/bindings/net/nxp,tja11xx.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml index a754a61adc2d..1e688c7a497d 100644 --- a/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml +++ b/Documentation/devicetree/bindings/net/nxp,tja11xx.yaml @@ -62,6 +62,24 @@ 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. This + property is only applicable to nxp-c45-tja11xx driver. + patternProperties: "^ethernet-phy@[0-9a-f]+$": type: object From patchwork Tue Oct 8 07:07:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Fang X-Patchwork-Id: 13825787 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011053.outbound.protection.outlook.com [52.101.70.53]) (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 8D50A204926 for ; Tue, 8 Oct 2024 07:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728372225; cv=fail; b=mVcdYrcVUjWRIDvylwsz0RAGrnR8KH2PdvQQIhiqLTS3G0PvAu+W9SAKBXJ0rSfRkzizYiOdb04gTf8kwpZyIM/kfY2wethS3vTjHtY2yyOjOZiQRPsd5OqvsiFH3aUHeH82ATqkAu78rOxmFvU2c9AoNfILPvW4uwSmmGrUzjc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728372225; c=relaxed/simple; bh=iHXq2EXMqHDOtVFj9RomghryepF/dkX1fp6kKaL0+Q8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=jabYIGHeoTdu4gXKX9UY9STiYizvvn1iU1DLVLR3Y1NuJnoLfulodbHFDS8GQPhV/hahzWLbQP/TvVeKNILo9kce6kmb+jqkL/3wAFzRhl24HqlhPZ0cWoiLu8k/CYAlbJ65y9dywU3j3bYTNopBLq2ZLw2agnAwMBH4hAJ954c= 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=LM5t1H0o; arc=fail smtp.client-ip=52.101.70.53 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="LM5t1H0o" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FNn0Fgu/HiDdDfO98jJRNm1TQBtJKypWVDo/IrMPfRzTF6o1vGNaxuBWt5sHmyYY63DD1vaIHl05Lzo6JmUXJmGCtl/H6GuyyEHWeAS/FrpGgZRbCipbsEihd5WrqVo5FbtnTHPOkjjhTuqkK3zSiKt36tCMfWwof15PPY57WxuAZFdz3dIZ6ddySsvdM8xvN51sWgpZtvEDFaAIwP38PSbCWSYVg711tM/WLHnrKM23MEOcL1Ew98dGeArFPXyj3zyGm8u3cip0MLC6BKlC8Jtm0wcUNUFNHzJcNatqEX+nyqt/GBXQt4jws1NOF63xgoVD0TYvQgo8gLZFhtdKhw== 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=e5ubiVxsqJp0DsXK+Bmy4zK7XVU+XTOKX1rmkYO2ZIk=; b=oA/oRXlcR4mrX9MooUb98Qq9sJVaZBhqWGsYWlK6XMVUib31SMp/1yEqW+ZIe2d11P7Ndlbp3YLTZu+4U6jy1cUsBbm8P7T1bGnu0yYFPlxU7qu34q/GahoOjmKpEVg1xb6/FLQCWniQbnaaE+K0vE/gvO/alXLQBNvnka6sCSDWEq42bUL+bdaCcevCszt9+tkYMt2T6J4n/nGZnQPY2Ug9WiDzai6mFa7q+bmc/pKPpgGPDfmOfOTiKnboqcMiPiG8EjAtFl1SHLCUom7KllucE6a/+Hk25oe11MLlWiJssbrOB/pSawGkuNvoKYwtulRqh1KIVUisfI+FUxxJ7g== 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=e5ubiVxsqJp0DsXK+Bmy4zK7XVU+XTOKX1rmkYO2ZIk=; b=LM5t1H0oDvWOmWumH9Mbk6WR6uRLHq7a1+68e8b5cKWi3t2KhH4QGEfgk0plSJxNKC6HfmRHYALlekoBscgrXUJ3dgtuyu8Qb4pnjketfK8oQyRMOAzHrwkEKtWxGceIcqqMIONcOoGLpJtqsfna8f+gBTgoNFxpdItL9vTR+9vQgwWOqy04ZpM4QoJ9NyVhJUs1SxL+Wb5PH3hP28zw/axeuizLzMpEE+1uprzZGEc0xYR0ZvJpY/rhP6hXRffc2dinoffUWYX+/iDaORkPXUrib9xCDbQ5SfElBsh++PnCh9/mYCO1wzMKH6F23+4qW7RHaMJvGSKT/8/s7SRGkg== 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 DU0PR04MB9564.eurprd04.prod.outlook.com (2603:10a6:10:316::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Tue, 8 Oct 2024 07:23:41 +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; Tue, 8 Oct 2024 07:23:41 +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 Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v2 net-next 2/2] net: phy: c45-tja11xx: add support for outputing RMII reference clock Date: Tue, 8 Oct 2024 15:07:08 +0800 Message-Id: <20241008070708.1985805-3-wei.fang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008070708.1985805-1-wei.fang@nxp.com> References: <20241008070708.1985805-1-wei.fang@nxp.com> X-ClientProxiedBy: SG2PR01CA0190.apcprd01.prod.exchangelabs.com (2603:1096:4:189::11) To PAXPR04MB8510.eurprd04.prod.outlook.com (2603:10a6:102:211::7) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8510:EE_|DU0PR04MB9564:EE_ X-MS-Office365-Filtering-Correlation-Id: f4616c1c-ca27-47ee-a2fb-08dce76a2292 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|1800799024|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: uA/QeIN3LcxctS5gQAugroAX81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iREcADTK6Wz++MPZwFedT5KPUgZbN2JJE8W2glTU9+ufQBNktigPijoz2CVkwWzwPULRY5qjdf+nqNFJV5mEBfldvvVUrvM70DTH8jRl76hH2GF/0JPku5Ax8ua9l9oQka4kZsvjqkFAyRMvlfmthvLxHz002TEhIgj9WjCwqnYK+HjDGUn1x3ibw3111BYKeeVEHFlIZfF9m567aYaB0SbdwvZH1F9z482CyoxwElL2VNU1FCC53wsLN0pBasmbKa/n4OvVjtORn3QRoSiw= 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)(52116014)(7416014)(376014)(1800799024)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JvXIpfs07B96Tg7XJqGxXpVWY5TTjsN5I2Zh2D5GAjwWlQyswmCpDH01uYStW8/7inKVPMy6lC1PkU+iXj4HjaJI72Mt3qIYXgRm0MaEFj/Db47uXfpJuYtVBz5bERm4W8Cmo5kCARxahFqqerJ2qlhs9IgxJmNysFPaHSdRMlAT13iQLExJyYQvexDjca6dW73GviWCavm/bLDu17YFOv+jygjLGIEUXCbxhYp5O+42rquAiDCoUml6bv9mBRtjHhXurg8lAWdsLI2riNJmOXUYj/+SW2XlznW912qRGMxB0+qrIKz2enOY3JYwekWwbsnhC47IoHwd0tHDOuNg+S3U0+tS3FQVwGHnQZIJO317HoFNy0pYiW+inAKSK1ZXqZtCyqOhhnPMdn+TR1EJtdmKBEmDaUwVEbveODrFzyq7aMLTQykoYtl+BUZI7F3zq+UORtnFqQrPkKpyVMgUWdouJ/Dy3QY3k2xbU0ZOgk/31xBNM/2p5V2p6GVJzSJXXPZEYYwnOkfV4aNti0u9Yc0yOTNovh8UF9Damy9/Ohghd7R2hTusZ96V0CjvZagKsmX/yfBgVq4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-Exchange-CrossTenant-AuthSource: PAXPR04MB8510.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 07:23:41.4751 (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: 3XLo7OfThhl8yHGzBkaGY6xmFo2Ul0dbe+Mzzxk3rr4dQhKx+9cS5pMyylqSWsuB4xO35JDTOolnwDR9rCfozA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR04MB9564 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. --- drivers/net/phy/nxp-c45-tja11xx.c | 29 +++++++++++++++++++++++++++-- drivers/net/phy/nxp-c45-tja11xx.h | 1 + 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index 5af5ade4fc64..3fe630a72ff1 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,7 @@ 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; int ret; ret = phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_ABILITIES); @@ -1561,8 +1565,13 @@ static int nxp_c45_set_phy_mode(struct phy_device *phydev) phydev_err(phydev, "rmii mode not supported\n"); return -EINVAL; } - phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG, - MII_BASIC_CONFIG_RMII); + + if (priv->flags & TJA11XX_REVERSE_MODE) + phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG, + MII_BASIC_CONFIG_RMII | MII_BASIC_CONFIG_REV); + else + phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_MII_BASIC_CONFIG, + MII_BASIC_CONFIG_RMII); break; case PHY_INTERFACE_MODE_SGMII: if (!(ret & SGMII_ABILITY)) { @@ -1623,6 +1632,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 +1665,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)