From patchwork Tue Oct 15 11:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 835731 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011024.outbound.protection.outlook.com [52.101.65.24]) (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 0EC221D4341; Tue, 15 Oct 2024 11:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.24 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990551; cv=fail; b=Us9TFXvGK8vClgOdFmFtRuWQRSLf/C5WnkXU3fQJw25/lw3t+dNwRbrol9gQJ2unc6hUXIMoSFny5cmefLTuJO7DQDD2gEuCii1PXYWl1tkv4ce3j6cX5P6iI0FzoxRS5hKNFnp//hkxHMsyQN2vPAmK8+u5p9X7+EuAGo1biGA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990551; c=relaxed/simple; bh=pTUfaimh4t0RB6FSogAgjOME4sygksbnO3RDTXMUwQk=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=QI6oUPjOWWesC/CUq76BNAm9wdFhaXEMH3u9M5exovozqk4jW5hDy9FTyzf5MFJbC3q4zs26GiVoARt+g5DkCxS2PCWrEUrEgDY5UPR7VWN7H3jA3End3+nPMXFWrgkarFgCLKxsa1Spkf4VeSNmveccYp+xt7qtNCKPLCkw8C8= 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=Orhuf05O; arc=fail smtp.client-ip=52.101.65.24 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="Orhuf05O" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s9s5k+/VxG2ilati91LWzB0ojb9ZAA7zH+vGUUIJJJfEwkofxZPibLokhLx7e4cDcD6TGXe6tyATtZwPYDu073NHKx5ARLD1KOkrI1Qz33A7RDDv73FYnTohQWpOmYXijkmn2ZyH/Bk8skk8AdKkIRMheEElygKFsi5kASFBKXeDvCTMU+Hcp98ol8maXhDeZEChpU+Y5TtVpBH5IFLT8bxsYEbxWe+qdVEV0tNfoHklsWjAzhSjmuM/HV/n15Axy7nP+CUf4dHk5eMjC2FKdQo1moomd3i2/C8x2A9XyrAmPMKkl2QJHsrXT1rUugjdv/ixo9flAFKdXsWfUCZkPQ== 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=N7IqDHdpzCIKRAH+HHS5ld1fjo7FjJ9Q5KoBfc0nR/0=; b=nPMKNQVt5noDi5uQqk104BbaZ6/tIi067dkJe0w7tLIgE4SAYKIjwvgef8Lp1fxXMoqzuwhFtNc1kMB1GRmtLqaLL1JgjtULBu9ggd7FPNV3BSen1FZW27JUm5C4BLp6s/+lD6pqcOoc4/LIsqqzB/9cfP6lE1j6+CBvjj9zJF2fibjldsUsKgbTHx5J2ZFhRmrRMpkPK+Omk1/MVOE1VDnCSraNpxsHSmFWnn/IbaTY3k68v1KBiuXcaI0Fx22+954Rhed/r0/QZyXAvSpTUfb9VzOGHFok68WZh1FUObjuljNnCX2xoOMKOlgPtazRQJQHtSl9ZtzpTttfWnrDtg== 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=N7IqDHdpzCIKRAH+HHS5ld1fjo7FjJ9Q5KoBfc0nR/0=; b=Orhuf05OeWQWM5ymcYB+OOS4J+FDcTsvs4pD3svlRoBgKEvmAoW0CJOXDxQbMhiU76wSKTco18j8402Fzu3SjbBh0+3UnnfjuI2x/1UwUQew+NaHdfCOxSd4fR9X5RYGI+uk1Qgky9ucvPzFF8uf6UGfq/4x2FvonHqJUS5i3D7fXRSsN9Fdsv7nFyvHP9GbK8/BJKprj6WZxFyfIGhZkDAtfFQnVwPIC9MP7TnjsKfrPcYLC3fjwrCIhlnvwjvTQW2OhZ76mgyhds6Bv6RjQLvj9/32Bi2M0tVM5giRLDBxUJedvsCHhEEk7xVy8XLkl7wk5iSeu9Aj/0Xp2os8Cw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by AS8PR04MB7701.eurprd04.prod.outlook.com (2603:10a6:20b:293::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 11:09:05 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 11:09:05 +0000 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, peter.chen@kernel.org, herve.codina@bootlin.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, jun.li@nxp.com Subject: [PATCH v8 1/3] phy: fsl-imx8mq-usb: add tca function driver for imx95 Date: Tue, 15 Oct 2024 19:10:16 +0800 Message-Id: <20241015111018.2388913-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0009.apcprd02.prod.outlook.com (2603:1096:4:1f7::10) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|AS8PR04MB7701:EE_ X-MS-Office365-Filtering-Correlation-Id: bf6c740f-5ba5-492f-3147-08dced09c827 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: uxyeNK69buILuy5rhveKp38uoVlw2d580M48POoc2HQ9/zhShyv4hGPAByzhOmqJjNzQ8srxeL8ZWj6eyi/HkTto7HHk2Owz8nPmDTylZ/4m2l0+B2C5GQDT2GFGQpfZsc5r9Y0iOK9gIb3tdij2+ThwXXri6cQt0VZdM1kDVLnGLfQjG1q26/X7y9OxZjIlDuK7GX4f7t8Bvq8E5SkSjVjRIVgIUNYjvSp5QySEVKi/z5dzy6LfYxT4RKs05R8H/w0FZoitqxeYOui9wsw3Wf/IQHr8aOmhT9HRxy770BSOVLWB2O5HE5iJBHYlEYF5Qo5YaemubYjX6BqeCMGf7TjXuobmK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NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(7416014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2K73RsoLbFYf59J6wlT3PBUjEKWG63q4CzscVoqSGuNS0AcwoTrpT97W1u5GZGsWRrkuhWA55z8Sgh2yG3+Hfumz5cD2WoHdtlCcppl/VmZR6kc32CMj8n8kkxx3t+YR+ZYgN5ckK8EuSeiuPUr3lqPGj278QBsnKRGDb9l5M4wHYCzlOyZuZSzu8ELNjzRR/ZiU8Yz0N0k6Dcc2tyMv7+TB1pFckixC6DPG8iwUk06Mb+AW15w/C5tchejJLHxCs/Vakkkvie/Fq9Vsy65o2pPyXadFKqVSneNpTZb7Un4GNNKhjfJ0SUswIt0qy/njxugK7IFyFYGinBH+NyHuz4RPCoT19IviLtSoNHWrPOmyqZjuheODOjtk5bxrx8CuvHWbVaWkvZS3nTsl3aoJRFWYDQ01YO531fFMc3nzFS23U7mhtpXUZjB8GBE1q8lpZj7d3cCzl91k3qH3Q9vZNUX+itlQTcBwHcD1EOJ0ZK7cuxa8V6klNJUBodOc4oFUsGI/H/dmju/sJaTsNK9Ammnk5uD3k+LxbaBnt3exyeywPFXjJ1FsqO/W2gLTeTYLMcWABXnUdd947nFoRCfwwBIGr+YQVsTaczq0pUYqiHwlWRhuJa000Tjv5B18/EDVocl3UaOZnCX0wR3n/4DafeKfmjitqtryEEJXqHrdyUux9FPXYlRjsqy3xWhOgyrNsqwLpsJCCLFwbBRY/+vXgR4GK+ZZrg/6DlxxsWX93c+20BhPDlog2HtfXtXn2K3KNZ/tbFjkEWxiRp2qPmh2zNTgceXIrjp/u2XWRlBcD9rVRCKTGo7G8l2xY9AMSom9cdOc99iLdfv4U/hSNfPmwrR1+YGO+96coXAjsFrDy07rcma500s6dYz2WE84HZBOT4X7E3OrCpKfueEth/yLL/2kuMj3J5DxttSviAD37DTol40qQtgdob2iV7vJK2h/8iKpOxB/1iDtk656XfE8QFARdwEZQZBr9G9tP96rGOXNeRO+OGpwmbA4rj8SbLFnZEofR2FeqVtFtB+JK92UCNVVPv8Yzi5St7QmmsAPrXRUdSAVXq1MO0bHqNraVQj3ayaMGY9Q7ZfOKNwcZ7V6G2aOb83BitONINxQCp+cha6b8Qgb1V/pRPW+HPtXpZfhnjfAD6W4JfiM7gKzA/+Hj3dGgtppeMCaLmC39bmK9h+SSh75LblD8gHNZtUEPdYzeycFFV9BrsqkaTd0wZ4P7GVbukMw71Mcc+WhP13Gn+bm8WxWOY8FYXvWRFTdaVNk/tylIdOXii8H8gDy8oC0rSLNHrN9Ulm6DbFYll7ZQArDEhAdlikoTItitFi0VbxfXh6LQvboIGyF+b97SgRCAQKNXNPE1yqxvmiM13t3hGtve3LQMzDvrpLrouIJ++vuvAnSnw/zY/VSC3c6qCzvzjfUUCjEQmlw/G7EhH0pIjUv05mg3Rwo2zq+fbdvd8R9AIUhgw7HNN7TriVqTPoQbZUFypG2lnTAjEFWlmo2RkK1aEWZUup/UeEhJtmoR1ps+79Rz+LVd5ifGkXNs60JNdyBaXbg/iGfH+/xhemJqejbPdQR/jkipHDqvHa+1cdY X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf6c740f-5ba5-492f-3147-08dced09c827 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 11:09:05.0539 (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: nigpec1Q58oZo4cIev7SNAnjvTaghiewz7pUNTiorCg/4fH3eN2aWn9jVavi9dCO7eAUUvw7na7eB88TROXihw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7701 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 --- drivers/phy/freescale/Kconfig | 1 + drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 243 +++++++++++++++++++++ 2 files changed, 244 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..f2b2da8cedc3 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,175 @@ 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 = readl(tca->base + TCA_GCFG); + val = FIELD_PREP(TCA_GCFG_OP_MODE, TCA_GCFG_OP_MODE_SYNCMODE); + writel(val, tca->base + TCA_GCFG); + + val = readl(tca->base + TCA_TCPC); + 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 = readl(tca->base + TCA_GCFG); + 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 +540,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 +587,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 +628,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 +640,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, From patchwork Tue Oct 15 11:10:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 836638 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011024.outbound.protection.outlook.com [52.101.65.24]) (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 D8FC41E32D0; Tue, 15 Oct 2024 11:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.24 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990554; cv=fail; b=pBsILEpuCCjoa++wxvktKb6bcxunuC2GDxLNd0GpdtTRPJ1wMzXukvmnlXRYSn3OB8pxw7nJTLgBXQcgdtckDeRInjf4GfprU44VgfQPcK2l6fXfp1AW8QwH8odh8bxUC6v7Luo0Rnwp0DTNUK3cbRsl4qak6S3HKJaVRCmD+9c= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990554; c=relaxed/simple; bh=8kRen0ARFCL4s0Yyy9ISSsl4GUPMe3j5iyTKFfmIV3U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OimYpFRBo0TacoBkd58l6+/bjte4rU/ZEQZdYiXvKMMrU9bpQsDEPdKXR6GoG7qzgukPspgTcItPnAkv0v2nBCCTg8ml7L00aKotKHi2BwevCRqqoUhGWFKKbwqoGd46YQ+zrRFe5rnMu94lKfVDtCHmL9+8lVMB65UOtYs0HLI= 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=EPGdPHYh; arc=fail smtp.client-ip=52.101.65.24 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="EPGdPHYh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sgL+VnUX4ciHfrNe4L2t3se2SbGVrgE433ubrsXTsofE/Fngb4GF2dPugVMVHGJT2gCBG6qVmY4EdHEANxq6z+Ml/7mUUKZUkm2VfpL0wj4N5LxaSZUXcvrJEMkQTtYB3UoVsSb7HZEEPBCWLuspD+/uPetcIJWyw53HJ8uSz9AN9X3/3XAzz+hmR8bWEUzWhFdSYZh4DdrbG07F5Hv7UWmhR7fLkxYoPJPoD2gGZC/ZlJjgJvWr78banJIvV5sYdlvP3UFiWO40ybF6FM1PvD9qQDZedTohEIqLEP1s0uoMVnGm6X2EciQ9tuy/MboQqan8R589cfsE79uLAd90MA== 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=cUXRGFEVrlH/WClrnsaNb/T51Z4z5YUlqjmyjqIxjxc=; b=iCwqEO7FQxmFjgsgmcY6/f6MPsaBsGBCqYTVTBUGcHAfuAxpLst1YvjALg8D5lh3Cby8jf/xU+wOQSlw2VbcZc0Yq40302n/x+UkAdygzsrNe5F4nXYtx61dsnPRcjvEBYrYbLKLvn3qALb2+TPj8u9evg2+Z6SSbhvbFtGKQCxEkoPG/uWz0ZsJId5h/HcIekl12Vb+oNs4cBfDXGKbMw31fWOpvTCWt7bQjLQfHqZaJ/XJ2oAXUNHoXCWsY/zBTxssX+WeaudKDbdKlkXiKhQVb81J8B89u0hicWmvNKY3meD8OnlyMy5rWDl39CRUqfEE35s0vSd+pNCmm3AMFw== 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=cUXRGFEVrlH/WClrnsaNb/T51Z4z5YUlqjmyjqIxjxc=; b=EPGdPHYhsMQdko3+UwgUzOV8ocEkmSe/rE6GIHmLQrf4RoF5mGJJ/9Lt3/STp7Xm2r2oElu2IV9aMQLass30qyrsnekmjLHca8RuWDa13JI78O8KC3qyZABFIK9SiEHuq79GDXqigSPgiVxVnXKB72xqAyiIYBAtLH0tjVo3vw7LpfN6mhjrtbCn7cRk3vSaVHSuC3gpkpym86oJe84p5XazBbvAsb/fCxpMMDobMAvUcXiyijsu0stCBR3/62AD3oHotG921H1NUxi6RacglJdxvd5img6tkD+EgrUcCR/+BSYuQipOeParpk/AijDlsJSd+dON6En86/ewMZKeBw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by AS8PR04MB7701.eurprd04.prod.outlook.com (2603:10a6:20b:293::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 11:09:10 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 11:09:10 +0000 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, peter.chen@kernel.org, herve.codina@bootlin.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, jun.li@nxp.com Subject: [PATCH v8 2/3] arm64: dts: imx95: add usb3 related nodes Date: Tue, 15 Oct 2024 19:10:17 +0800 Message-Id: <20241015111018.2388913-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015111018.2388913-1-xu.yang_2@nxp.com> References: <20241015111018.2388913-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0009.apcprd02.prod.outlook.com (2603:1096:4:1f7::10) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|AS8PR04MB7701:EE_ X-MS-Office365-Filtering-Correlation-Id: dfc64f4c-9f48-4ebe-d988-08dced09cb67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|7416014|1800799024|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: lMJz8fyjVmMbSQZ2w0aBu6SBYf3LPpjzGcTKo88PMv5ftqhBrMKHEPzfR6tAUs6oc8d0OaEW6OtUdF3TNnf8Ja1COpnMUEixiF8yDrXmVwRs50XlwrMsKy24Fg4evVfF10dGEHRziyIHpJP6/RTeOdLSAwAvTTMTGEhUZfu8bO++bw8apfM+JpCbS/xfkDo26yG9qSqrqbNwyT0qt8RyWm6zso2kdXL/fhmOBEi6Buf/DUE8AZGhNQAzbAUOawNHoEbLGhRTvZE1Q/EGj0PvRNJ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04zmJ4v84qIEVj/5nX3KLCPp2MCuA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(7416014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /0j7Z7zAJKc80V4UtR+aKtC+ERqhg5lC6Sk8yCtBg8ykeruZKAT+58k+15VRsNvZG68LLQQ8Soj7p8Z/DerFor1p8nWsvyMad+XLIA0Gm2JBbnDlnYrwCm0rZymBmcrXYIy3Dcqd4zVP0D5gdAYyb1SfvbF712Ks1G42iIka26yh9qtSacqlWJRf0dYY8P3uS7MBeHpdbs6RDz45EqU46FpLw1OaM8w2Y1K6V4b9e6hLtsgYmNgjxCZ49pgyga5L58bN+p6qax/q/cvb/FzN3gbx2lVfGOZnFPBXNwPlmkgs8A/EopMp34JhmCoB9QIUHlXq5GQrjNpq26mhX92UkB+PELS4pWhn+jaDcIRGY24AIYYs+KhoMMQgbESiSwb/LuH5HXxSCDVIY2uAFA7udDKf18m8TZ7kRd5v6LZ84vetM9ncOezPtKWR7vNpTl+oGJmIfOsZUSe7cKGw7FvVb8DhUUrLIWXNe79B3llzW0sh5wK1SbwADt4rVNrqckVr/Zc1+FiQ7N3GVPfau0iOJSc8wmuuw0qsqqplV5PJnx+NvxZXZHW7OzGRRnpNZqmxmTS3l3tshzCU1LTTz/azQkmyWldsgBF6reWmljEJohndVkRj19scOFyRhJ//2L8tDTkDDGlAO7G5RapIb5hZ7J27kVw6lQwbt38u9zBWMCvpaDyzTqWA9aoc7pCs493ECh8Plbt7dpK01InXBrFzIhrgBESu5xBff9fOiRrYE4z2R5RlxPkPCNXg+mQ9tEyhQS3bdK1w0BHnGqkP5SVxb8z/PG0nacaKlkHj0OZ+cfqsHzJMRkSxu9sQ9SN+FkXugdqELt3YN9jZXA0K6TeNF8+9Bzoyn4b/glG086kC8burw5340fcXsRGVc0UMSwVgkR5rZpFDOMp6xiqvobepmYOnJg924t7c7YXFb+ZT9qw5srf9YMK3VwloeHZHruFBpekE88tMAbEWRAeL3kQuaLYozJb7/CfuL0hbcoIz6goMoa8FsHNOXKS4NgWvzsX0IphDMN7Z79aUxw8LeKeD3GmpHYmgSP2hBILdH4rIL2zUD5pqylWW9WvAroQuWlH/V9T0mUppCEOtLFShZQqb+9D6wcpZPcEZiw99r+jv9BAqg03ROKB6c2+3uX+r/PzH5HHcCaWakd77RfdoiQN2OXt3/DMvVLU3yDEOTQJHa+Iy47oTEskwHvWo0V8sm965MiKYUvOQO6fXMgAEL9OxNyNe/LDowEDCixgE82j3TuavpuJh6EFzNy3S2FHcdrWodsyP47lA3oR1Sirox9TCgi1pHxdCZ8rgfQtkbXzUEG1TJBbpCJMv0quSdVXzXun7l+YnFjjuX+ggOIvkx92ZwgUbKsZ+6wdOijHNl3WCHOphXPzkgoTONYCJ7HzGctg032E1h/HZ8T4419WVl9u8ql4lxN+1+euw299qiQXfF4FdzV67WWc7Igz+1BIsGATrYlVEnr8ncaFIx/+klL/RWSPdu0dmU/9J7jnUVU2kPZMqR1reqys3URmh7htuN1IbXsZfXmS+bgij4JvavUwlkXmQ6DZOSpw05VLJvqYzEJUaZzHvklH+W/ppGeDwtq9l X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfc64f4c-9f48-4ebe-d988-08dced09cb67 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 11:09:10.4506 (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: 6GpzRzxt7vWj6VWSW8n2ehw/KlX7q7l+xoatBks4bGlljG3mwiwYlYV5pehQP//nlwhqhhg6SQrywr0kn+fBaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7701 Add usb3 phy and controller nodes for imx95. Signed-off-by: Xu Yang --- Changes in v2: - no changes Changes in v3: - no changes Changes in v4: - reorder nodes Changes in v5: - no changes Changes in v6: - rebase to latest Changes in v7: - no changes Changes in v8: - no changes --- arch/arm64/boot/dts/freescale/imx95.dtsi | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx95.dtsi b/arch/arm64/boot/dts/freescale/imx95.dtsi index 03661e76550f..e3faa8462759 100644 --- a/arch/arm64/boot/dts/freescale/imx95.dtsi +++ b/arch/arm64/boot/dts/freescale/imx95.dtsi @@ -1473,6 +1473,49 @@ smmu: iommu@490d0000 { }; }; + usb3: usb@4c010010 { + compatible = "fsl,imx95-dwc3", "fsl,imx8mp-dwc3"; + reg = <0x0 0x4c010010 0x0 0x04>, + <0x0 0x4c1f0000 0x0 0x20>; + clocks = <&scmi_clk IMX95_CLK_HSIO>, + <&scmi_clk IMX95_CLK_32K>; + clock-names = "hsio", "suspend"; + interrupts = ; + #address-cells = <2>; + #size-cells = <2>; + ranges; + power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>; + dma-ranges = <0x0 0x0 0x0 0x0 0x10 0x0>; + status = "disabled"; + + usb3_dwc3: usb@4c100000 { + compatible = "snps,dwc3"; + reg = <0x0 0x4c100000 0x0 0x10000>; + clocks = <&scmi_clk IMX95_CLK_HSIO>, + <&scmi_clk IMX95_CLK_24M>, + <&scmi_clk IMX95_CLK_32K>; + clock-names = "bus_early", "ref", "suspend"; + interrupts = ; + phys = <&usb3_phy>, <&usb3_phy>; + phy-names = "usb2-phy", "usb3-phy"; + snps,gfladj-refclk-lpm-sel-quirk; + snps,parkmode-disable-ss-quirk; + iommus = <&smmu 0xe>; + }; + }; + + usb3_phy: phy@4c1f0040 { + compatible = "fsl,imx95-usb-phy", "fsl,imx8mp-usb-phy"; + reg = <0x0 0x4c1f0040 0x0 0x40>, + <0x0 0x4c1fc000 0x0 0x100>; + clocks = <&scmi_clk IMX95_CLK_HSIO>; + clock-names = "phy"; + #phy-cells = <0>; + power-domains = <&scmi_devpd IMX95_PD_HSIO_TOP>; + orientation-switch; + status = "disabled"; + }; + pcie0: pcie@4c300000 { compatible = "fsl,imx95-pcie"; reg = <0 0x4c300000 0 0x10000>, From patchwork Tue Oct 15 11:10:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 835730 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013031.outbound.protection.outlook.com [52.101.67.31]) (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 B6E241E3764; Tue, 15 Oct 2024 11:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.31 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990560; cv=fail; b=CDs7PHN92pqd/t+kPflAG4G+2JVs3LQwFghtcL6zFihxoXaSAGROe/DKuGdkUSnS6vr7VnJYSaxHRbBgKbSLw0t30Apl2PoQKtxLEEcgC0YEDWW9O06jE6lE8ZMQHrUVHmoVT1KWEJhsRh/pFqBBfMLFc2MYXFpIF8Ni78Hy9lY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728990560; c=relaxed/simple; bh=JO/xS1jBYfNZLfqvM+1S5CT/NwEXJWS0eB3+A/bi2Wk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Aa6qEHbHeN9onpypevcdPzPWaXA6RTOirzYwEIFg2lGITNSFo/r7NcF/eLa2bRva6Gm4mpCXirdrBLnLXiyPVgYADd32K/SFRSnDGm09dOLGOpMPImlhS4T90TwD+v4gBIvwA0GL8pdnj9DED0XWi6DSyMWe3SxIAtV8z6q6tdE= 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=TONr6Aee; arc=fail smtp.client-ip=52.101.67.31 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="TONr6Aee" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JGtyXKtks8fbRZxcKJVVAFlge3y7Tzt52hSm/fCxkj82NvNnRlHrJQLH3RPKWt+P87zQiwmO9HwBt+/La2I5JGMXqSpLnHUlsISpDzNdtfOTnuqiIq1jtlnjip4603xOJHvSG6bNCoo3n0amHf9QHmYDdYNsVGWzC6UFr5lELURufsa7BXO6cPopAu43bBRv2E1qG4IXeMsbhU3ni0iDAyyPbxuT35KO5uGTFP/fqpqHNEQ1sefoW9CcgtDKOch+lQJF5XWorJbGq3xYnQ6mLWUOR069g0WPTl+mFMW1Qhu7TENHYdQHcTP0PWQrrry/8ONMVv1vJvT2VqxFmMhoCw== 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=s9GBIrA1Z2FAqfNyjsaauVdh1HyWj7rIsACFTdHGRoQ=; b=uFrRC7lEqGPq0ftO0SV7LrzCK6UYR61UhChRoJ7SuWUiPmUAQUihDq90C73cOm/grP13AL8n2ahrTUwicAFZAkknBqeHUIiWclP9hHTG5V7Ftswmw9KKiKRm2cAX5bJiaROED0b7f6E/PhEUqKChBVAC42Nq3iWbmD+AaYPLlT71VFL7GqJYoBRp5sMowlgetK9y2BjDIBx3PGqge5td6sbmaQ0dZIdI4wRWNL/rlXK19MDqgANRJssY17KBTNFqKYYdHgiKEdJz5Xmr3yJ7gxMsn+AZOX5ccHmO475XsaebYGQUO4gPScOJCo0pEtF3hwqBcOsf2p3Tc5w0TnGNVA== 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=s9GBIrA1Z2FAqfNyjsaauVdh1HyWj7rIsACFTdHGRoQ=; b=TONr6Aee1mVO0KXVK+vwquFNAw6AE78/U6VRq//EVPS8Kz9OyJ/LgZt/eyWxbSIuejo5ofBJOYKomyEvZ4ifVF9QQZnJeE5c/zmZxbik/gDENDe9OE8Zdhw0+JpAsxSEIqrYgb4Lguk6dv9GF/eTy8BpBjIuWDoYH41ppqPZBr6C5tHNanH82vdLFQlfWO5GLmjIMaO5CB5cWKmZOdSlySwp88B6LrC4AFncQEzv9NgsGXLVb+YKZDjCpgBNi+EJywppKfGeWM+WGQyBI4yPY/VAsRrp10MbOfAughdcz1LFsyFU4Oj3WwUKV9u1JyxLMkE8YCDT9XqUEDEqnNMWYA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by AS8PR04MB7701.eurprd04.prod.outlook.com (2603:10a6:20b:293::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Tue, 15 Oct 2024 11:09:15 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.8069.016; Tue, 15 Oct 2024 11:09:15 +0000 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, peter.chen@kernel.org, herve.codina@bootlin.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, jun.li@nxp.com Subject: [PATCH v8 3/3] arm64: dts: imx95-19x19-evk: add typec nodes and enable usb3 node Date: Tue, 15 Oct 2024 19:10:18 +0800 Message-Id: <20241015111018.2388913-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015111018.2388913-1-xu.yang_2@nxp.com> References: <20241015111018.2388913-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0009.apcprd02.prod.outlook.com (2603:1096:4:1f7::10) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|AS8PR04MB7701:EE_ X-MS-Office365-Filtering-Correlation-Id: 20bb5aa5-9101-4de2-8cdb-08dced09cea0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA: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4ofX3u5lIuYIYfiTljSafFaHQOSPSydMyY+JuE0yeAduYALtQOPuCKbDYYfz6XzEHWhcjWXlEQBXrdnyqI/qQjtT9+b8kEfn93dodcWSDj7H2QmMJBi/RadiHHFr6C9E6nLWBfgBg88+pt8ZPEFrTFLSgLmV2ItP0jnWIRaxIol2T8TGKdcxZpGaFVT7ORYbkupIqaDlAQwR3FDbYJraFQEEatEY1JaBZ+xiyuQA5XB36ZkO38YK226JW8I42N7TiM7ywCzDO7G9UMuY4vyzCnS9Eb8MCQVYCjKEnaF/mms2IUxcH/M1vvzqIqMdxXZRVXDdjYrYbUTDwOtd21XMEE5xN62+m5JNp+2PUtgj9O02irNY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(7416014)(1800799024)(366016)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HL+wXR+/rtHI51GpTUY/88Hv2Q1OliYBHZDlAZoKWrUrhNktQp4I4+69aFHauceYp82yNnziYY0Wp6tMlpFD9uEMk+nVy3LhWNiqD/b8M1duNsDZQ5WwesoncQ3nkmTB2k3bfcJllRqLX5WHbjse2eSpjH9d9XCqzYsrvbti7aEML8Rn0efYUI75OUHZg92xnq0ePBodd7oNYwz43utGnMEPeb4RdYluSQZg2PLHCkf7Tmvl5dUR31E9B9wu12JxaPZil61sJfM/A7L9X70LPaPK1JQd1GqsUrCewF6TXYjSHhotq7SCnblyhDrRMLZo1dHW7TkXSZBohufULLA92SJC+9PPSMF91P8I8MXmWN9iO9DHtHJaj//T6nxSk3NWvSuUEsdFlrasW5di3/e5pp3YB79u2GHwAEmProt9r3rUeL3O40IqVidO8MvgCTbbpSDk7G21QXf2AXgUIC3N14NoIhiz8zZOjd59D4XRBxvA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Ak7xnHSpbt1ougoyWH937LhMzm4Yva9 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 20bb5aa5-9101-4de2-8cdb-08dced09cea0 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 11:09:15.8519 (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: SB2MfDz+/tecgTvl+tx8A2JaEze524DLiIhbku5arDbixnB2I1KJE0GFfs3t8Hu6HrI8UzqxHF5EGUZeFEwfNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7701 This board has one Type-C port which has USB3 capability. This will add typec nodes and enable usb3 node. Signed-off-by: Xu Yang --- Changes in v2: - no changes Changes in v3: - no changes Changes in v4: - no changes Changes in v5: - correct nodes order Changes in v6: - rebase to latest Changes in v7: - no changes Changes in v8: - no changes --- .../boot/dts/freescale/imx95-19x19-evk.dts | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts index 37a1d4ca1b20..41a4ee4751ed 100644 --- a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts @@ -6,6 +6,7 @@ /dts-v1/; #include +#include #include "imx95.dtsi" / { @@ -250,6 +251,48 @@ i2c7_pcal6524: i2c7-gpio@22 { interrupt-parent = <&gpio5>; interrupts = <16 IRQ_TYPE_LEVEL_LOW>; }; + + ptn5110: tcpc@50 { + compatible = "nxp,ptn5110", "tcpci"; + reg = <0x50>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_typec>; + interrupt-parent = <&gpio5>; + interrupts = <14 IRQ_TYPE_LEVEL_LOW>; + + typec_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + power-role = "dual"; + data-role = "dual"; + try-power-role = "sink"; + source-pdos = ; + sink-pdos = ; + op-sink-microwatt = <0>; + self-powered; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + typec_con_hs: endpoint { + remote-endpoint = <&usb3_data_hs>; + }; + }; + + port@1 { + reg = <1>; + + typec_con_ss: endpoint { + remote-endpoint = <&usb3_data_ss>; + }; + }; + }; + }; + }; }; &lpuart1 { @@ -332,6 +375,38 @@ &sai3 { status = "okay"; }; +&usb3 { + status = "okay"; +}; + +&usb3_dwc3 { + dr_mode = "otg"; + hnp-disable; + srp-disable; + adp-disable; + usb-role-switch; + role-switch-default-mode = "peripheral"; + snps,dis-u1-entry-quirk; + snps,dis-u2-entry-quirk; + status = "okay"; + + port { + usb3_data_hs: endpoint { + remote-endpoint = <&typec_con_hs>; + }; + }; +}; + +&usb3_phy { + status = "okay"; + + port { + usb3_data_ss: endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; +}; + &usdhc1 { pinctrl-names = "default", "state_100mhz", "state_200mhz", "sleep"; pinctrl-0 = <&pinctrl_usdhc1>; @@ -538,6 +613,12 @@ IMX95_PAD_SD2_RESET_B__GPIO3_IO_BIT7 0x31e >; }; + pinctrl_typec: typecgrp { + fsl,pins = < + IMX95_PAD_GPIO_IO34__GPIO5_IO_BIT14 0x31e + >; + }; + pinctrl_usdhc2_gpio: usdhc2gpiogrp { fsl,pins = < IMX95_PAD_SD2_CD_B__GPIO3_IO_BIT0 0x31e