From mboxrd@z Thu Jan 1 00:00:00 1970 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 48032E77188 for ; Thu, 16 Jan 2025 03:50:18 +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:In-Reply-To:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hkQqDIZCxt9HC1PSS6OPXfNgZlIXRrZWU0hDOup/tDY=; b=xWDn/ReeiBzh5K D+LMlukw6SMH0Q5ohzJe0J7fxXxyVt35eUH/MKAGse89Fb6RiELtmrIencuzZNF4y7knIqnPJaUee F2NsSwm2lFNDBQxBzvC/BGx2OAjdRzwJSFZyThIju/++OkJoGSB3HAq1Si9PW7NMeqjss/5lWNeal mIO+JScQdx1TbIzFYVq7CgCDF+il5o0GdfhNgemn/UCbb4I/g1AkoW3oZe+ZCtCXuAzweKkSWRtvv Bs3awlgYMYNDRk93xyS8XKWQg6IIRJARBN5DVjyp6oYxe1Cb+1gpWYJBqyk1/cYgFUX/SHZgKhbho q2+pJQNb07ZTa//vqDXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tYGtd-0000000DkoC-1cWy; Thu, 16 Jan 2025 03:50:17 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tYGta-0000000Dknc-2R2x; Thu, 16 Jan 2025 03:50:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H/KssnDUlJut04+MBXEvwQEga5NFRbJTJIVHvxwkc4ReyzO1hylQlMd0sNN6KQFJcdJ30IlxLRPwL5bNqRaY08F32TUTkd18X7pyWWy9Q34sWSW7z/0xf4JhyHF1ryANsJVpWWFVzbM82jOh4+QskeQRCibdkrhvMW0A8hcbp68SNMJ0h0TU5DNLoleveXFAyQTGo64yp1EDmWZ3MIYNxFpPAqItKBujcAkfIHzYtS7mxnMM9MZOuMwviXAhBO4LxbzjDxqXeiqX7WgiYkIA7cffpJe+EcIZvuWsfxHuLRcUP4KqWZ8lPEITXj+djvxx9LyzPLFN3jwrF3XMMj14oQ== 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=4vn5lguTBC1B/66JIydbCPUtENqIf/jI/RrzNIwe3lk=; b=HjeoGBfJlmZkCyi8RW5NOc71KhWdK2qh28dU+nLC8WLfLGZofCQcPR+5nU+pQFJXQJQ6tak/2YHBzCXcpuOz+tpoxnfW9ktFqQInxjRi8476D5SJ4zzUFHMIDVtyT6mncJatVI3Xftb3Yh5WgfyUHY87vKYQGmqReGZLREcirwY6ToUtT4jkHv5ryAXd3LrwSZbdoKpGmS7+0/LmjdLmkvIRp4mbFbsyp+AkanN7A5J6CPCcsnlhRxeSggZpFuZs2e7NF6EWGs/SkI4QF6TujmyoSFffNE2RL9hrTyY9sEtfg1RFHKLIvAT8ljyQd9/J4YU1gbB71t+gd+sVCICdDg== 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=4vn5lguTBC1B/66JIydbCPUtENqIf/jI/RrzNIwe3lk=; b=dSw6u2+I7zG0lVBrWKRLfVklVgyC5VVf6PhzKWmJkFz5exKzarqxmDnyT2IybA7XHfag3vt2LeyPWwwZ168xNyaHA0+cUWx5khv31U39bLfozHX8InljnImVpHqCmTUJp5yL/VxFG4YfSV/cro6jrYOPH3Fg2fi5BTGroK/oozDo29aJpd4e9qsUHc+QRc6DEHXcwK7lhWKL9+SUOgzF9U1a+aZM9+c38bHzVwryR5Sn7YVOzM4IFPeOf3HAS4X2XhMIf/jFabWtRCYp1B+O9b7xtZXWCB+B8Ogg4MxGk3hlRxdhCavQrD3GwyPtteJQGpCp0KKbu0i48YdVq6lj4g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) by GV1PR04MB10703.eurprd04.prod.outlook.com (2603:10a6:150:202::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.13; Thu, 16 Jan 2025 03:50:05 +0000 Received: from PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad]) by PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad%4]) with mapi id 15.20.8356.010; Thu, 16 Jan 2025 03:50:05 +0000 Date: Thu, 16 Jan 2025 11:46:23 +0800 From: Xu Yang To: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, gregkh@linuxfoundation.org, jun.li@nxp.com, alexander.stein@ew.tq-group.com Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v11 1/3] phy: fsl-imx8mq-usb: add tca function driver for imx95 Message-ID: <20250116034623.ig44yqxzptujhwql@hippo> References: <20241204050907.1081781-1-xu.yang_2@nxp.com> <20250106020303.xrpo2pfv4knqszx7@hippo> Content-Disposition: inline In-Reply-To: <20250106020303.xrpo2pfv4knqszx7@hippo> X-ClientProxiedBy: AM0PR03CA0083.eurprd03.prod.outlook.com (2603:10a6:208:69::24) To PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8829:EE_|GV1PR04MB10703:EE_ X-MS-Office365-Filtering-Correlation-Id: f387432c-bbdd-4b8e-de87-08dd35e0dcdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|1800799024|366016|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7e3osrCNsK3fX9l69tRsmwD7KfYSohcNv3S1IrZMSqdI8m4rAycXCdId8fDN?= =?us-ascii?Q?/m7X0gzXu3rrkbmH071Epx0cRAhGKK5MNHEIshbWbnLrhp4l1mMnUTBb5paJ?= =?us-ascii?Q?AxXRdieWiDKUGduI9yDZDOTEItxR/5hSXLIDP1NUGMpelyVP6t16jE8nYKbc?= =?us-ascii?Q?DJnoH3iDqOtpNSgJ5RUxPoH46BjWeJRKcnWRZzTY71KB0iVhNXL3722my0/i?= =?us-ascii?Q?w3bK0f5vFMAq6VE8pU/i9byk6IfYdyOiNNPVFZPOF3D7XJlgzAVgp+2/V6MW?= =?us-ascii?Q?ebbNdvKFO14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fr?= =?us-ascii?Q?YYi+bfUnOP/q+hXOIEkF2WTKIJ1tX48kOyutQoqnCmh8vSK9GVrH79MnHcyE?= =?us-ascii?Q?rc2XfdrX+XRSJaxcVxRSESovzSZ/TjpOQE7G24aT5VPvpjnECVBodMo/fAEd?= =?us-ascii?Q?UCqXMt6J70Oaraj7i+YU4IkTnH1XL3oGm43Fye92IAcIZvsbDeqcCH37AiwP?= =?us-ascii?Q?5bsWvL1YermaFe63Z9D+XGGHQ558Nkq3B8r5GWXSgkJFD9+nDiVf6PXXJ9y7?= =?us-ascii?Q?dIMfamTVnBv1bwj0/D1Cn75Jf8fNw1YVn/zM3FYdLZPGwk/XXMWAPw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8829.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(7416014)(1800799024)(366016)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?PzvEc1aEyj6roZyIIRXZgFhUzJsuAKnazBT8iDQUx5hTavb+nOoBcT+Ttmm/?= =?us-ascii?Q?naI6Z6vgSrqIbHoWfRn4OBARFJMfeJdjFyOpL48sxLRMgIzlKkEyXoLa3Ftt?= =?us-ascii?Q?3uJI0zUpZYGE9RxP0VwZlgM8OisTUulhfnwADFBa9h73FotWYxcYdh5YHARH?= =?us-ascii?Q?7RSsHb8VvuIMD1Fcj3gL+AxGMWmw5YwM7uVoZpuXEe2g6GPaGOxmKt0ke9h7?= =?us-ascii?Q?TZJ/eUGUAGOZxWvC5DurevmgzTG1ij+MLldIGGgL83ZB/RKzSl1pRmTzPNPx?= =?us-ascii?Q?VsxPfrgcWBKwVgoC3qhR9b2yXETf0Ghq7ttymVQFWxSucZAbGh1t9ex9rdyl?= =?us-ascii?Q?Ed1WL5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?us-ascii?Q?oo9pvizb/A3Wat5l7IEPVj0Op5ulrOLJA4BjjUhows7C9rFD7OAhmWI+51v2?= =?us-ascii?Q?ZuPsQ9QA/+BpcGvvvhCjETuCGbk1efTJIvDLrhse3SFGylL/TyCiX6QrGrkd?= =?us-ascii?Q?VgToM8DDdfH04IN+yBo5Iegz2xvX2f3+NEbQWPs29lkiQPLHLfcr9tRVIn8f?= =?us-ascii?Q?Rcwhausywr6jqTyPk42RCDyMymKNsyy3XMEg4DyQJSxtauM9M2iy6GMvOFXT?= =?us-ascii?Q?EqkQQZQm4fKUkTDPz8K3D0wTjBLfJoGR9hT65obkgQNMqmMiHn53rjwV2kgJ?= =?us-ascii?Q?gVuM7rj7LvWgQ4CVWClz7zDRP7tvxHEK1R5UTOz7?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f387432c-bbdd-4b8e-de87-08dd35e0dcdf X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8829.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 03:50:05.7489 (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: OKoPp91YX8amPwxfZFrBPIXrHvUcrgxi8Pbv7/1l9wsKJP+uLDtSovOyXyg4yvOfD4+kGW1DKHkr7KSvL2lylA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10703 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250115_195014_794677_A41FB73A X-CRM114-Status: GOOD ( 34.92 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Hi Vinod, On Mon, Jan 06, 2025 at 10:03:03AM +0800, Xu Yang wrote: > Hi, > > On Wed, Dec 04, 2024 at 01:09:05PM +0800, Xu Yang wrote: > > The i.MX95 USB3 phy has a Type-C Assist block (TCA). This block consists > > two functional blocks (XBar assist and VBus assist) and one system > > access interface using APB. > > > > The primary functionality of XBar assist is: > > - switching lane for flip > > - moving unused lanes into lower power states. > > > > This info can be get from: > > i.MX95 RM Chapter 163.3.8 Type-C assist (TCA) block. > > > > This will add support for TCA block to achieve lane switching and tca > > lower power functionality. > > > > Signed-off-by: Xu Yang > > Reviewed-by: Jun Li > > > > --- > > Changes in v2: > > - return the value of imx95_usb_phy_get_tca() > > Changes in v3: > > - no changes > > Changes in v4: > > - remove compatible check for imx95 > > - check whether tca register region exist or not, yes means has tca, > > otherwise skip tca setup > > Changes in v5: > > - no changes > > Changes in v6: > > - no changes > > Changes in v7: > > - fix sparse warnings in imx95_usb_phy_get_tca() > > Changes in v8: > > - #define TCA_INFO 0xFC -> 0xfc > > Changes in v9: > > - no changes > > Changes in v10: > > - no changes > > Changes in v11: > > - remove some unnecessary readl() as suggested by Amit Singh Tomar > > --- > > drivers/phy/freescale/Kconfig | 1 + > > drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 240 +++++++++++++++++++++ > > 2 files changed, 241 insertions(+) > > > > diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig > > index dcd9acff6d01..81f53564ee15 100644 > > --- a/drivers/phy/freescale/Kconfig > > +++ b/drivers/phy/freescale/Kconfig > > @@ -5,6 +5,7 @@ if (ARCH_MXC && ARM64) || COMPILE_TEST > > config PHY_FSL_IMX8MQ_USB > > tristate "Freescale i.MX8M USB3 PHY" > > depends on OF && HAS_IOMEM > > + depends on TYPEC || TYPEC=n > > select GENERIC_PHY > > default ARCH_MXC && ARM64 > > > > diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > > index adc6394626ce..a974ef94de9a 100644 > > --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > > +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c > > @@ -10,6 +10,7 @@ > > #include > > #include > > #include > > +#include > > > > #define PHY_CTRL0 0x0 > > #define PHY_CTRL0_REF_SSP_EN BIT(2) > > @@ -50,11 +51,66 @@ > > > > #define PHY_TUNE_DEFAULT 0xffffffff > > > > +#define TCA_CLK_RST 0x00 > > +#define TCA_CLK_RST_SW BIT(9) > > +#define TCA_CLK_RST_REF_CLK_EN BIT(1) > > +#define TCA_CLK_RST_SUSPEND_CLK_EN BIT(0) > > + > > +#define TCA_INTR_EN 0x04 > > +#define TCA_INTR_STS 0x08 > > + > > +#define TCA_GCFG 0x10 > > +#define TCA_GCFG_ROLE_HSTDEV BIT(4) > > +#define TCA_GCFG_OP_MODE GENMASK(1, 0) > > +#define TCA_GCFG_OP_MODE_SYSMODE 0 > > +#define TCA_GCFG_OP_MODE_SYNCMODE 1 > > + > > +#define TCA_TCPC 0x14 > > +#define TCA_TCPC_VALID BIT(4) > > +#define TCA_TCPC_LOW_POWER_EN BIT(3) > > +#define TCA_TCPC_ORIENTATION_NORMAL BIT(2) > > +#define TCA_TCPC_MUX_CONTRL GENMASK(1, 0) > > +#define TCA_TCPC_MUX_CONTRL_NO_CONN 0 > > +#define TCA_TCPC_MUX_CONTRL_USB_CONN 1 > > + > > +#define TCA_SYSMODE_CFG 0x18 > > +#define TCA_SYSMODE_TCPC_DISABLE BIT(3) > > +#define TCA_SYSMODE_TCPC_FLIP BIT(2) > > + > > +#define TCA_CTRLSYNCMODE_CFG0 0x20 > > +#define TCA_CTRLSYNCMODE_CFG1 0x20 > > + > > +#define TCA_PSTATE 0x30 > > +#define TCA_PSTATE_CM_STS BIT(4) > > +#define TCA_PSTATE_TX_STS BIT(3) > > +#define TCA_PSTATE_RX_PLL_STS BIT(2) > > +#define TCA_PSTATE_PIPE0_POWER_DOWN GENMASK(1, 0) > > + > > +#define TCA_GEN_STATUS 0x34 > > +#define TCA_GEN_DEV_POR BIT(12) > > +#define TCA_GEN_REF_CLK_SEL BIT(8) > > +#define TCA_GEN_TYPEC_FLIP_INVERT BIT(4) > > +#define TCA_GEN_PHY_TYPEC_DISABLE BIT(3) > > +#define TCA_GEN_PHY_TYPEC_FLIP BIT(2) > > + > > +#define TCA_VBUS_CTRL 0x40 > > +#define TCA_VBUS_STATUS 0x44 > > + > > +#define TCA_INFO 0xfc > > + > > +struct tca_blk { > > + struct typec_switch_dev *sw; > > + void __iomem *base; > > + struct mutex mutex; > > + enum typec_orientation orientation; > > +}; > > + > > struct imx8mq_usb_phy { > > struct phy *phy; > > struct clk *clk; > > void __iomem *base; > > struct regulator *vbus; > > + struct tca_blk *tca; > > u32 pcs_tx_swing_full; > > u32 pcs_tx_deemph_3p5db; > > u32 tx_vref_tune; > > @@ -64,6 +120,172 @@ struct imx8mq_usb_phy { > > u32 comp_dis_tune; > > }; > > > > + > > +static void tca_blk_orientation_set(struct tca_blk *tca, > > + enum typec_orientation orientation); > > + > > +#ifdef CONFIG_TYPEC > > + > > +static int tca_blk_typec_switch_set(struct typec_switch_dev *sw, > > + enum typec_orientation orientation) > > +{ > > + struct imx8mq_usb_phy *imx_phy = typec_switch_get_drvdata(sw); > > + struct tca_blk *tca = imx_phy->tca; > > + int ret; > > + > > + if (tca->orientation == orientation) > > + return 0; > > + > > + ret = clk_prepare_enable(imx_phy->clk); > > + if (ret) > > + return ret; > > + > > + tca_blk_orientation_set(tca, orientation); > > + clk_disable_unprepare(imx_phy->clk); > > + > > + return 0; > > +} > > + > > +static struct typec_switch_dev *tca_blk_get_typec_switch(struct platform_device *pdev, > > + struct imx8mq_usb_phy *imx_phy) > > +{ > > + struct device *dev = &pdev->dev; > > + struct typec_switch_dev *sw; > > + struct typec_switch_desc sw_desc = { }; > > + > > + sw_desc.drvdata = imx_phy; > > + sw_desc.fwnode = dev->fwnode; > > + sw_desc.set = tca_blk_typec_switch_set; > > + sw_desc.name = NULL; > > + > > + sw = typec_switch_register(dev, &sw_desc); > > + if (IS_ERR(sw)) { > > + dev_err(dev, "Error register tca orientation switch: %ld", > > + PTR_ERR(sw)); > > + return NULL; > > + } > > + > > + return sw; > > +} > > + > > +static void tca_blk_put_typec_switch(struct typec_switch_dev *sw) > > +{ > > + typec_switch_unregister(sw); > > +} > > + > > +#else > > + > > +static struct typec_switch_dev *tca_blk_get_typec_switch(struct platform_device *pdev, > > + struct imx8mq_usb_phy *imx_phy) > > +{ > > + return NULL; > > +} > > + > > +static void tca_blk_put_typec_switch(struct typec_switch_dev *sw) {} > > + > > +#endif /* CONFIG_TYPEC */ > > + > > +static void tca_blk_orientation_set(struct tca_blk *tca, > > + enum typec_orientation orientation) > > +{ > > + u32 val; > > + > > + mutex_lock(&tca->mutex); > > + > > + if (orientation == TYPEC_ORIENTATION_NONE) { > > + /* > > + * use Controller Synced Mode for TCA low power enable and > > + * put PHY to USB safe state. > > + */ > > + val = FIELD_PREP(TCA_GCFG_OP_MODE, TCA_GCFG_OP_MODE_SYNCMODE); > > + writel(val, tca->base + TCA_GCFG); > > + > > + val = TCA_TCPC_VALID | TCA_TCPC_LOW_POWER_EN; > > + writel(val, tca->base + TCA_TCPC); > > + > > + goto out; > > + } > > + > > + /* use System Configuration Mode for TCA mux control. */ > > + val = FIELD_PREP(TCA_GCFG_OP_MODE, TCA_GCFG_OP_MODE_SYSMODE); > > + writel(val, tca->base + TCA_GCFG); > > + > > + /* Disable TCA module */ > > + val = readl(tca->base + TCA_SYSMODE_CFG); > > + val |= TCA_SYSMODE_TCPC_DISABLE; > > + writel(val, tca->base + TCA_SYSMODE_CFG); > > + > > + if (orientation == TYPEC_ORIENTATION_REVERSE) > > + val |= TCA_SYSMODE_TCPC_FLIP; > > + else if (orientation == TYPEC_ORIENTATION_NORMAL) > > + val &= ~TCA_SYSMODE_TCPC_FLIP; > > + > > + writel(val, tca->base + TCA_SYSMODE_CFG); > > + > > + /* Enable TCA module */ > > + val &= ~TCA_SYSMODE_TCPC_DISABLE; > > + writel(val, tca->base + TCA_SYSMODE_CFG); > > + > > +out: > > + tca->orientation = orientation; > > + mutex_unlock(&tca->mutex); > > +} > > + > > +static void tca_blk_init(struct tca_blk *tca) > > +{ > > + u32 val; > > + > > + /* reset XBar block */ > > + val = readl(tca->base + TCA_CLK_RST); > > + val &= ~TCA_CLK_RST_SW; > > + writel(val, tca->base + TCA_CLK_RST); > > + > > + udelay(100); > > + > > + /* clear reset */ > > + val |= TCA_CLK_RST_SW; > > + writel(val, tca->base + TCA_CLK_RST); > > + > > + tca_blk_orientation_set(tca, tca->orientation); > > +} > > + > > +static struct tca_blk *imx95_usb_phy_get_tca(struct platform_device *pdev, > > + struct imx8mq_usb_phy *imx_phy) > > +{ > > + struct device *dev = &pdev->dev; > > + struct resource *res; > > + struct tca_blk *tca; > > + > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > > + if (!res) > > + return NULL; > > + > > + tca = devm_kzalloc(dev, sizeof(*tca), GFP_KERNEL); > > + if (!tca) > > + return ERR_PTR(-ENOMEM); > > + > > + tca->base = devm_ioremap_resource(&pdev->dev, res); > > + if (IS_ERR(tca->base)) > > + return ERR_CAST(tca->base); > > + > > + mutex_init(&tca->mutex); > > + > > + tca->orientation = TYPEC_ORIENTATION_NORMAL; > > + tca->sw = tca_blk_get_typec_switch(pdev, imx_phy); > > + > > + return tca; > > +} > > + > > +static void imx95_usb_phy_put_tca(struct imx8mq_usb_phy *imx_phy) > > +{ > > + struct tca_blk *tca = imx_phy->tca; > > + > > + if (!tca) > > + return; > > + > > + tca_blk_put_typec_switch(tca->sw); > > +} > > + > > static u32 phy_tx_vref_tune_from_property(u32 percent) > > { > > percent = clamp(percent, 94U, 124U); > > @@ -315,6 +537,9 @@ static int imx8mp_usb_phy_init(struct phy *phy) > > > > imx8m_phy_tune(imx_phy); > > > > + if (imx_phy->tca) > > + tca_blk_init(imx_phy->tca); > > + > > return 0; > > } > > > > @@ -359,6 +584,8 @@ static const struct of_device_id imx8mq_usb_phy_of_match[] = { > > .data = &imx8mq_usb_phy_ops,}, > > {.compatible = "fsl,imx8mp-usb-phy", > > .data = &imx8mp_usb_phy_ops,}, > > + {.compatible = "fsl,imx95-usb-phy", > > + .data = &imx8mp_usb_phy_ops,}, > > { } > > }; > > MODULE_DEVICE_TABLE(of, imx8mq_usb_phy_of_match); > > @@ -398,6 +625,11 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) > > > > phy_set_drvdata(imx_phy->phy, imx_phy); > > > > + imx_phy->tca = imx95_usb_phy_get_tca(pdev, imx_phy); > > + if (IS_ERR(imx_phy->tca)) > > + return dev_err_probe(dev, PTR_ERR(imx_phy->tca), > > + "failed to get tca\n"); > > + > > imx8m_get_phy_tuning_data(imx_phy); > > > > phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > > @@ -405,8 +637,16 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) > > return PTR_ERR_OR_ZERO(phy_provider); > > } > > > > +static void imx8mq_usb_phy_remove(struct platform_device *pdev) > > +{ > > + struct imx8mq_usb_phy *imx_phy = platform_get_drvdata(pdev); > > + > > + imx95_usb_phy_put_tca(imx_phy); > > +} > > + > > static struct platform_driver imx8mq_usb_phy_driver = { > > .probe = imx8mq_usb_phy_probe, > > + .remove = imx8mq_usb_phy_remove, > > .driver = { > > .name = "imx8mq-usb-phy", > > .of_match_table = imx8mq_usb_phy_of_match, > > -- > > 2.34.1 > > > > Happy New Year! > And a gentle ping. A gentle ping! If no other concerns, please help pick up them since many users are waiting for it. And v6.13 is almost coming. Thanks, Xu Yang -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy