From patchwork Tue Oct 8 06:27:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13825682 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) (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 3CBED1DE4D9; Tue, 8 Oct 2024 06:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368803; cv=fail; b=YHIESBfot5fU6ZYLyKeKVb4IcEJzOhnMyrzBSTvMy3MTaQiubpc1iWX4D8u6qoTi5ZY9Y7P2WyAaeDZhexBxZ1PAdiKLpqVisXfKGWNeWBu4xdNi1Q5vNLxX/g8TqDQaTy6ZLlpjOILTA4z1YHBtZOlyviixihSqUCJvtYAt3YM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368803; c=relaxed/simple; bh=dtvn4k5ZiCvI7MWihjZLHwVLzEi9yPK/UPhAMA36Ju4=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=WrBXaoOfG8UThJdrGWYa2itBgjSPGcdUemXIiNoAtG0rwWUMBpcm/XKwXi2/IjMZqJOd3ixCIjKAVKlEJPNdCfdGN97Squ1VpS9uymvubLWt+wNpL0u8gEqLjWp/rlj8iyHEhxbni4nWtbVdi3khfssow4OYTTBMtFBzh3ywRP8= 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=YYZ2GrNo; arc=fail smtp.client-ip=40.107.22.76 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="YYZ2GrNo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SaNicbri1h5f6ZhCpBStDNDHublmNIwRAzM27FmDW0ZR61+IMKQsFrID0Fp4mRyPHuzuZsSYpOua3YSDImRQrWs2nsQKRp+EVUgqq341vulDONFLo0Lsblh18K9sGCGMUR6oFbM1PKFxXCIcCy15FLaLzGKH8ixeStDxrdUK++VAXoMj74h3fS6zGdM45GbXnT2SKGyYvxgp4Tol0FtdJuN+zYBW5XDP6Vm4BS8epJx4RCtp+VzqDkuDuNKMOSdiYXFxmmilW/tVrRO5nq7VFfswh7zgPskaI1ugYqIAZC5H57cY1q6qYOiduCPShlv64GU0Kht33XP6y3zSuqPilQ== 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=lOb3Bvml0rbY4M17NHrFn1D5X2+lYe+HZ416KcsNvWo=; b=uVfsCNiHExqGiU5cRw1CGkxe1TuNUg3xkaAG1QGd9e8sm+z6PqdLKS1wi3y4OVlleICTL9Y/+hcAGNGPF5fxeGgeXAT6W68cXGM0yKFbF6PJF8pvqO/dtSLMLFas6qCQlOAGIxWp/U5oxNgEGMHtIG7CALC/NXzfZmeZzRG21hoJoNIjeKv2qXB8sa9J0rF1qik2EBrdrD+NrZSjmbMir6QsB8Y+wJWsNK2oZQCEbDcbWG2iSJ/RIKCcJGonFyKEudg1bjSz6Swko74amopluATOdiNWztonSj4bn9YDCHtYxVsdoWJ22DNVrdvkSp5Yq0IqFTW/Rk31jzvcYCMJjg== 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=lOb3Bvml0rbY4M17NHrFn1D5X2+lYe+HZ416KcsNvWo=; b=YYZ2GrNoPhg+/a3Km0ee5fja+fb0cKJR4POIUF7WgOXElNtsD+iJhuEmhYmE3vo71PtpHjWa2HETtwkMMPw41aqRRUdLDPuRt8qJqdQfuJEpENokZV3KOMxgn0WiHbE/MUZI3MW3blKzPGB4AgRJN1SD0AX47b6PAAgtrVUTeI86X6cfbjPakYf48OjCrn9FCkqK/2xvgFvfM78/2c7GcayqdeveZn1BuL3h5q1TVQ3ESDR5K3knVCeHGQbzIBz1YmHnTuK1Z4BWHs2zapZm/9x1d3WpOFRJSNmfrPbxEc96ZVJz8vZfy7hiXQbvYVBl7Ff7TEDFziHYY4lML25erQ== 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 DB8PR04MB6956.eurprd04.prod.outlook.com (2603:10a6:10:11b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24; Tue, 8 Oct 2024 06:26:38 +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.8026.020; Tue, 8 Oct 2024 06:26:38 +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 v6 1/3] phy: fsl-imx8mq-usb: add tca function driver for imx95 Date: Tue, 8 Oct 2024 14:27:42 +0800 Message-Id: <20241008062744.2211539-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGBP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::29) 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_|DB8PR04MB6956:EE_ X-MS-Office365-Filtering-Correlation-Id: a75678dc-6054-4a90-1b0e-08dce7622a0d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: rsTtcG87qAwtED6WTShBMbjYJxn5U8japZNu/sYC1+i2+jJLNrD3dnF4r5v1Vy01Hwkey+k+/3RLVT3sDnh7kKwnxY/NMyVv9q68cV9g0IrCVfnThf8yhU5haxVe3ootUnqRa5Qx4kPg8p53K4MYwHu5UkYGojSk8rVmuQuOVVkHO/LmKO91oeVT22OPGITy71m4DJi9MKVpBeedlX6eMfvP0lcqULxMn3zzYR/tjLOVkcjnnMsErEhHkRlm0Pc6SuyWsAlsNdFklobljTzyjsRxt33NUa6Ru6iD8TxyNW1vaXdGIy9wkIIUPCcD1o4W6zXx6OJDe9fmtttshjFycsKEy1G3h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V:NLI;SFV:NSPM;H:DU2PR04MB8822.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(52116014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kJy1yNUV6pPuJyQhD3u1r+w8Jywn3L5EniAcVV6ztX3hqTuKXmzksTTbh8p9OhoO4hcG9sSfYyXfdhF+oFIoDYKMAnEyRJvPwv0SfF63n7ubxbGRfXlppz3H56RBp8lY9AMCFnNOLmW/u5pcdW9kaz8P83A4mkBlI53bh8I/5J4jCamw3P9EPKzVw2KBT0ySYmXDKxE7YMTEHmOnK72nCJ4wAN3hxEI99q7k77GOOuxCqKPuIDwZg7drDPGeWc3Y73fk2WM1kaZzJu0DuE1oV8DlmnzqhsxXrx10Ay7mL6MzqwaXVP3g1P44u6ScpP4VULGjIgZ4LF6gkiPGBjztJ+1Rkl7BiIXmzAmb39Pkec74oMUBKrk6jh0qpPQGpIrAaID9/sFUBXDs/HTUbk7tSaZRpAar25BYkTnsVtH6KNwXt5xq5qqg4pv3ZFZwPq00yZNwYQAbOgHLHpFx5Z/eiXt1sIDLe5deRy+HpbVyotqcP8O2t9gLPCVpbGF86N46AtSR08sZD1oNL328iEDGVH8R9mf7K8CKgYaQ5PHJNID3HpB7pW5bbDphy0j0hdNoZHdvOUpmtw1CEmPhk6MOGweNMYkQYmA9AA6FdruXNqqE1++JxqCOAQ4k8yO1hV2X3atViRCrUXAa+7FiSnf6aep7A5Khds3MQm0AP+iKRvOESxs+VAjRWLP1MGKjK0r5EuMcTipdlG+Y7nOzTKLlN1jlIJKtWf8D7MDbNH/VFshhsGDoYz/FVuzv7XbigLtBD1kHS0fQhVYVen39a297vx/jyYMgVMr4pTWD4vcIqkA7+iyAJJG8UT/StJhFVwrFh4hWO7fPJTqGuiZRyRhttLWzvUaFsLeRtnRtLN9w3UvgPjY0tEIF2pYueo7XID7U3DOu87OlJUrCbFG6kn5xFBETFP3kC8XIngCrt2V3vUAsQxwtMgl0jjdtHJJDxlUOx8PfVwCu3kaG6+YagDtUsMzPEf0Db+EWKZDs4rSBHCgALVqZKGjfq9uiorTtfKKvYjgLS+1qnv2Ha6kJg7YccXVPbZrXN4onMOY9alhyL/9SsY8IfLvKAiaOdn5xhRWFM4oh9PPYCjPHdjy46CO8FdgAs9oCqmYpcA/aJNDbnxixceZl6QTisqhCQun4RJkVunzKGp1rPpBIYVttLLabOv5txhJ4EZyNvZzpPWPjWBjx29KWY3JGr2B5O6LW6BZJPTmGsmq4LVQRKUjyuaZxNRVPxYJ5PLmIVvq+FVyq7j/bDx7vFh+kUGIAeq+8TKhZyt8MH6t2nu3Ifl33H2r5vGWf0c1ABJTXcrU46hH7oaVjuLqL911WXFSFv/A/zEtwmDnUkgGxKv3NxAj9rhvMWcga8B11M5VDXKUd1zZdJ1/nHfOnESx15Ldj+7yLUd/TszssMmeHT5iRJQ6p1Qj1XlLIryZc/pa1s0PRJ9qRATE4YptJdap/tjYF7QTeQGXOMkJIhqmmo13qRKSiV7HKEaeJ+wV6paOIr7h+QyaK6Cey9i0GJNh56MaVBLS90t6THlu+/qQQnR6tiCzTs1VKBr0/EseHwXOiRIAlIWTUITSqY2eqrDX8b+9yWUjyC7CK X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a75678dc-6054-4a90-1b0e-08dce7622a0d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 06:26:38.1523 (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: sCJcZtlpJy2ovadUPaU6MdbBD30De1HhGNRjY0BLpWfrH+VaTuqBK7gLpEsaYCNauizxRO9dkQExsp30ZJzevg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6956 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 --- 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..f97f86644b2c 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 0; + + 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 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 8 06:27:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13825683 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2044.outbound.protection.outlook.com [40.107.22.44]) (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 154ED1DED58; Tue, 8 Oct 2024 06:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368807; cv=fail; b=gDJuOptFRQVn3M4FEgE65me3dfBRMDewRjtFlgCqrjYNwvQGYG6Zsp66xPwvh+YuMVtPChqddSeDRoB2kNDGNTREcdj+EoGW4W8GnM29Q6cNYknVBo7DZEYtsLG+gBHLyOt9OO/Ch2vL5wrpU5L5DQsc+xLvHlnnkBCq10t2oGo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368807; c=relaxed/simple; bh=UhnJQn9CmXoSKNl6vM0JUXoT+jsxD7LqKcvUkPH78HE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=erddQsNAHQpTxHqpQL+UX/wnjY6v2HdVAM2o6XrvznDQFyRtYlRinravAziPeBdaH1kMhd09P6T3wew8YXuL03qLI2AwCZvu9oaHY9Ivow8lby6+xv+1QQhjxa7DThj3hKJY/mY+Fc2ORKvQetG6lJBF2niFRc2XXrWmjGbxO2A= 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=H7SY2Aup; arc=fail smtp.client-ip=40.107.22.44 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="H7SY2Aup" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OAE6tP/gLxTXLNd3vqRlAp5wmLTey3TljktwNUoGZEnTJj2yPx+Z/1NS+9zHfg65fw+wTAmIbibVi6TVcWRdZp8UXoY8PFq4lBoQz2BqBgpTrOad4mA947p61uMQcEIcOlsk2CzhR2vjkTFYYb+ItTKeVrqH6DTpUl6K6ERy1v7k0lDseT3mPvMNIeLwBFvj7DOehFe507zV8g9wHetzVFodOul3cWVKagtyq1Ut8hYKVdQ/6oCEK1jKGeWGVXS8nfbfSHcwkD0WouQNXlpOG6qI0fvUVdSq984ORVFCgkdKFNJVZ29ZKtDrjEeXkxgOkHgtvVl9sVk79RKsN2uC3w== 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=+nhbXMRL+m9n7Ok7CgcCcKU1Qo/wi171E7jYWa5X8t8=; b=ZymVKNf31DCKwLsb0+KFjKsSL5diSQko2gAzYlpJMTR+RY1ck01PwImyZlAdX/KINuOh2z9qrHLPmTjc2ANXb0wXjZWu0hUl4X4R18RrtUGnIlirx00Ff/f8In6WkDfq39AOPnB2c/9wF0GeXPTKo09O8cN2iJCQX3kgkTZrqt1eE29RsxQ+q+ZUEIprT8cPMQrl4z454CdYAmaLiH6nw9+o4xc6uyjKplxmr6RiUZ5gAEYw5HZ+qIa/+Z4vB8V6q24ug+1c5eRA5hVAIp2OWnx8exUobrkPLSIfv2dnND+xeMXGPZjSDwtxgcioAio1aP57E2NxXmXQ0kBk4Nh0hQ== 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=+nhbXMRL+m9n7Ok7CgcCcKU1Qo/wi171E7jYWa5X8t8=; b=H7SY2AuppdKYM4nVUaqCjSd11YJQSKSvh9tpTpXUFrVPI1HCzvariaSEXCvz8HJKfDkqrb98h2nnNpo+eVCNET+dtjbtsM/spRfJKbv4FNkgBJmWVec9BzXnsa9a/DktwMgCzicYzB3T8EA/YLykfo+P4S5kmndQssXhb5qA3ITEAz0fEusHUzZ3hiAvBBEvIHrab/A9OplktUurQxqcnqquAHED9EnO9JtgVazoeCtdTpyg3PhHRlo3Le8a2QyZHAIx8zkahE0YNmzSkcgAGVEJ7T3LUDxBSLQ7mRYCesOkZaP2OxVQuuzmQ/tvzA5JT3ixRo6MNH37hYoztCW9ZA== 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 DB8PR04MB6956.eurprd04.prod.outlook.com (2603:10a6:10:11b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24; Tue, 8 Oct 2024 06:26:43 +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.8026.020; Tue, 8 Oct 2024 06:26:43 +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 v6 2/3] arm64: dts: imx95: add usb3 related nodes Date: Tue, 8 Oct 2024 14:27:43 +0800 Message-Id: <20241008062744.2211539-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008062744.2211539-1-xu.yang_2@nxp.com> References: <20241008062744.2211539-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGBP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::29) 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_|DB8PR04MB6956:EE_ X-MS-Office365-Filtering-Correlation-Id: f1097933-6bb1-468e-7391-08dce7622d3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: 72OqlD3BTzeaxs/FaLRkocy1Cz0Ugo+AgaLp0mMOiP5TdBkSvsHPvXu46IFlfZl+CrM25i3iWTU6O5DRwERhp23RiFczDc1NNj2RMBkexNDS1Wk9SOCzd696EDlvFXPZhwfqtlrhXRu7WhWzvivoUBEdhpzvYBxP5TeH2FuOkWBgYerU/0dZukXBBscYPp3MSwBcJvrqCYn/ISEnuLH38aCcD0SSA0e/mrKsrE892zfrE74WnXGZ1zfw3bHDOhO6Ug3plf1T5EyNmngUN3LG0V8TMEr6X2kFFUG5M0582eFz2efrtdh17WhNqVQw11tC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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)(1800799024)(376014)(7416014)(52116014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: z61WIhwo2/ZQy8CaTe5JAZ+Y5V1VpmgP8GloR4VoeljNPRIphajNbwMmf4d9JK58R5wyor+t/xS/W+a0SffrnxbipcpmAaK2ITt5yEKrFMG11hNsjCbRunF+qgU5dF0KL/VQV+iVG8l3dK2ly6zYnawwfw+4FNcMAho0muQ0t88DGAytK+S3QJv3QkLQbqDvKKDhLbxK16d7XkjO4m0+8rSOW7GVK8HYjl45b3YnbjPD5n4tPeVW2tG0vtfvHns03p6jC9O9RdO1msluao5MfJcPalc2SvrfTExae5DE8D8ujHVGF117fXhW0RE+e9MQLnr2EavTRBT89JuQQ3L/w3kJ+FrIcfAZyIBCsuQ8PWMPjWwcIGXP08j8HP/ZncN5qJLZor8fKaO0uph7S+pXdbv8lWoEILjfu76P0SGl0Yoh3pdLKe3kpgPrHpRpsLJQ4MNaWklR9GzVZ6iljx/w3aUAy0UHslJ+qZjF6Mi69LzwNXmcZEm8cUP5HGpdEPSedkaHNQqAc52yMaYW0tH4U3MkL+IZK/Kx52FvJiZguLaCmAzVrj+Hq2/DSkYrp4VVSIN+RSA138UqU0AUc4ZvGh+QHGAAkxE28IGFgVT0Tn3JgKKIFPD15/2K0rfr1Kc/h9pG3CMTb/LyB24mGfaGxR1DFSvcF2dSWPSrjUBJavQb/MxaJD8uvsyOyq6QyPuuJuz0n6KLLa0dIND1/pBd+1KH97JaUYfYjEtqBG8XPWFCio6ppktndygBRMZ7iuwCbz9nvOPA0eRAc9Ug/SBM535eunWuwu6KS84XIRfIEycD1/J3nGOMUp8dVQEPlTjmEg3+LTn4GXix1aoPmbx/dmVvlS8oGUV5KTvTfP1wKlXy6GMCZJIsCLH69IbRWQUR7RB/8QHeq5+NqvvETVj7i0Av7YBgpSExue8t+L+jxw3gEhPwcn36qDUHCdSGYb+lP7DUTOvbn3bVDP9aL6HqE8LZpVtruzCzgSQqA55UwUnL6HJ7lsaV2vjxkoasvoyD57uDnQD0m2+PIZ41PqjILkQk+woTbn3udBYXhRwIncnRfuzkZBqlj25vIYvWvD9IZ/+BlviAVDzXsRcdlCxzYDN0W7Z6B0Z4S1P7ziPQTmbkc2TD6AYt1Q886eqpiNZBeyMX7PevovEsoe4ep/7rE4nhnMtA/v7xTBvmeR+JwBSJsDAkFgqiYkjvR2wl/wEJKQbnY1doRtwBt56OJYtDU3EBt9Uk3td1Yf2c7La68+qNje6OHyIT31AjWURuOeO7ZhcKKFuSJmv5EvzhO6IN/6ACWd2xDR0PxaqdLl5ply4FP6G8BtyegU6pGwquyZw0ghZpuF8IO+PJeajIBX3fha1YW/duC9X+RYD4beBPHXTBTd0xDZHrGZmCHMcalSRBjNLw9AQ12W7U0ClN8+iemW2b8Hgr9IqALftpBT5EwguJxmkw177WYZJY4cGPUW/F2YMq6estUVQr0Kl8EKsBBDxrvDsrdmxIGleeTi6C5nG6XLdgIEd4x0OQ9vPTrW/3PE+bEA/SVN3cRbP0xSxcokUDVIJZFYAKjWdAobmJ+9SV121xZ7wH3xLvK09rR6vl X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1097933-6bb1-468e-7391-08dce7622d3d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 06:26:43.4531 (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: +Y3z3tGyuScv3danpbgc0i3lQB0/LsvvA9y7tP3w3M8F6XP5lKj3I4APQqx4FAHZnx2408GyHAYsWZSuIgV/iA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6956 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 --- 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 8 06:27:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13825684 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2060.outbound.protection.outlook.com [40.107.20.60]) (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 3505A1DE4D9; Tue, 8 Oct 2024 06:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368814; cv=fail; b=nyQAECZavXZrWa90NUJrVI6n0WViwqnKidirtpgbCDIs2eaD5YUnL7RWGSk7pbxSffNeqZ3hNRJzd1xy5v34Ldsttg0FDNiQxWhiWLs2nINQV1DlYwhCL87ymyIJKIKhbL0bmwD2bi9vZcSeX6qLNZBur4jusr2WBR7M8TM61Vo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728368814; c=relaxed/simple; bh=J3ys/6zHGL8eOgN7FrqJ6tgJiaTMxqlx8vXRzYTL7J4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=OEK0HlwCKeBeaNsxCZLRFFZRMGnUCI8PhdGDne6OibHY43VE6OwJoJC5fN++F5WWz+O+++0YHerunkS/53dB18G4WdFO6A9M17BG8Ho2jSeucE90SMVPiQqh/LvS/6kt4zAooLvnhYI2ou6kFvCnOpLKaLLSnFlorIEP9+iMB7U= 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=BZEFciZP; arc=fail smtp.client-ip=40.107.20.60 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="BZEFciZP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eLK03X5FG4HR9Ej+8BuYqeRTjFfkDlgmTmHr6YeYwJWu6wfqzaNSXO5YteWT69MQcB3Laqqw4nvXU/zXt8MZ22cjJ6hpo1zEvDfl7Gchml+XNhJcxa1o4efXO0Kwqka41icd81rndwDCEXvF9EEEM+KdU+bGnyupKYjGJUN5Kt/kwHex5AQ1zyCVjBvOnEOoMzmySfc5zj1fBmbCrqSTzHINbSADsujcgBWHrtnBazn6iLrv9QV33jJB/xQ/pNvH4VZ2cnu8Eyk1UjiJaT5uRgi1LbNXQHwGn/IE2+S3ppXuB13JWbw5g3Xh/qPMW8otwSbSfdE7PVrNj+j5AZcyBA== 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=SpG+FR6cAZZtrk30AGNerX2AGPuu7+hXCxPZ1QpoLlU=; b=rnZpUa6fq3KGwSa5I5ouRGudA4SR6JRcgm6roRajv7Fym6hvMaCBOaT8CN5+uASkUcuWr2MTAkt+7Vumc7npyeppVNFSzqqs7EZi4zfV+UkCnj1QmfJwZmknSyWTCnmBhhnR5X2xAPAXnyn8X7J052FT1wkffVptH0wjLyj39rRIX6Hnvx0EJIbQBZNApUYSUiN2cSKNwjwkVPV5IOAk9ZQVcsZUfz9jv+gNaL2RQGN14MdXpzLtFhkY85AItzaY/Rt0RSt9hbQOXH/96jcf7SbCrvB1wOhS+kOUXLmce16g4DdyqL1urisxLbWyrxc9tsvYrPxedknTcq+hkMs61Q== 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=SpG+FR6cAZZtrk30AGNerX2AGPuu7+hXCxPZ1QpoLlU=; b=BZEFciZP/ySj/9L4b8fSERmGIa5tHv96hb9qttl6zaElK4K1I6FlpQkDV0Vm2pnnO+kH9a3BPBFShAwesI7RxGCd62d0WrmiqYzXZXKINmzRcat5DFljxpExVfmxjYB/jAk+PrUHtnvgj5eIIRB4Kqix9UFMOFfwX2lJfxURFSpUpnLeAMq6GXh2npIDcemQFrXOVnJL4Q7qXXBo9kPJJkdPcaz8uKqIHXzy38jlPHReed1+ePYXF9RxH0W2PIN6M0X1+dI7pTJ9ZWk15GuHlUFNLOtsOsQ+rZ4Mr+RDkrSJieIxNZ96meGUo3ourrVJP5E7WErlmNIrPCEElh951A== 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 DB8PR04MB6956.eurprd04.prod.outlook.com (2603:10a6:10:11b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.24; Tue, 8 Oct 2024 06:26:48 +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.8026.020; Tue, 8 Oct 2024 06:26:48 +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 v6 3/3] arm64: dts: imx95-19x19-evk: add typec nodes and enable usb3 node Date: Tue, 8 Oct 2024 14:27:44 +0800 Message-Id: <20241008062744.2211539-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241008062744.2211539-1-xu.yang_2@nxp.com> References: <20241008062744.2211539-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGBP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::29) 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_|DB8PR04MB6956:EE_ X-MS-Office365-Filtering-Correlation-Id: 71f50331-9edf-42e3-45f6-08dce762306d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|52116014|366016|921020|38350700014; X-Microsoft-Antispam-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yl2H7y7PBjccjcm08NS/9JUkxt5WVj9y7HGGoI4ZfQjipT++GQcG+1hMQPQFrHm/M4ARobj6zBUdxPBvNxxly2/tDZPYJajfHhP3Mr/XxZJIeEGBowS/y0H0FmXD/g0ofAQtg+nO3TIAYLChxKExCBeOteHAtXNGDCV9SbwlK44CPhYJl1SiJkosgBiaTIFFYUapMS5q/xCzxs+kskOASOnCKNjHNQWDu4YsKb3R4cZmXxhhSDRAKyDZpx0B0ilrdqhNBDjW7Dfv4pmaQJ1NSBabRplh/MuaiOKTfB4V2UUCaQt7ehA4mlAv/MlCpe1Vn0SQyCD/IWGmWwTQ= 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)(1800799024)(376014)(7416014)(52116014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JKNB+NNbTWQpwLnPo0OCSx+MYn5RF2n/RyA5hrH/HPJ7ELoFTbi0Rf49oYOdGIO8z8YWGutTOoDEdHac505T31OmEMsSdkUwmgbGfsa06As2fLoFGJfhPXfIzLE+nKJ8GyyAoT81IsE38sYYPCkHqyNCuOBZqQRV7eZovSXhhEbUbsWJVE4aOkC3/9raMM5Ruy4ZKdO+mAJnM44VbLgU3U03Hoeig47AgsjIAUWRQlYzw4YIHWyIEaWqHVwo11clkaKN8+n/PqHxGgUkybyQZp2SBPcZb65ROYxu7vg/v+N5qzKwWsqdITbizOOjOPebZpUhFRY+Re/vBCaRVRYFyml0+UZErGqkH2KEg4fpohxAwrtiP9Ds4bamPRDPoEMM1LY01l1RV//9u7VIDOyeC02l75nhBtD/jRV2Y3f6JANQrYlhUpcnxbI2VngxVynkFfc/WPBR1lVDMXqlJBMUw5TdZQlqHXhWucsSejSh+RYfFU23fDDNAqY/6+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/Us6VWxSv2Qw43scmd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71f50331-9edf-42e3-45f6-08dce762306d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2024 06:26:48.6823 (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: YCeLENzbdAzfQpCbpNQ8jX0e3izF/dvFVxrzjfSZ3n2IcbrNsjfnoNRcTrxvDaeC4d7txXHUc9UFRIQQHqw49g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6956 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 --- .../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