From patchwork Wed Nov 13 08:07: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: 13873272 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 B6E90D41C13 for ; Wed, 13 Nov 2024 08:10:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4cdRO14VgoIS5H64PGmgFpT153i6GVh/y5bzFX1MhZc=; b=ujDC79+SKqmp2pY/mUM4E9sui0 U3e+2v0TbFw6tsegluGjZnQG30xpt7UgU1WFzLlSeKOTJ6iuZIrYhbQfOZpVNIpcMR0sOACXhfRfj AxiqW3pUVq8NdZ/iKT+G5kpaIz53r9yBSz++x0qNtRMyyhPh9kcPOYgl+kXUQyGrspNPTH38dtG1m bHjA7BYJjnyDRgo9o0+R/cwe1BAZR0DgyigAmG7Vaq0psp/oUOW79FFgbtF8B/72IEDHPCaB8DWOm unol69fFWhP0Gd8FYf23XyFhxPKUYFPb2fSCP14u6zyTOfdPWm9DdQqe7hU+tCSYLk2+6aHv49CJf fQN8dY1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tB8Ry-000000063wF-0QYa; Wed, 13 Nov 2024 08:10:06 +0000 Received: from mail-am0eur02on2061a.outbound.protection.outlook.com ([2a01:111:f403:2606::61a] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tB8QA-000000063jc-0HZl; Wed, 13 Nov 2024 08:08:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QFIFb35jVDFqgKBINjd0dD3S2uCAu8XsbOmotaPWeEAvCxlh8aUslZbTfvgpoUjbsTzLkWdOmnyZU1btuTQ3yvkS5zYiTYFgwMRLL8hVNFLBATfIT3dyZvDIrzY6rn9JHATVYf6hAv3dTfNnc+6jk0yJGidberTLnqcbMYbvu2jErFR+d32CewMLCYhp1JUyPKyqRiZm1IUMsqflSgY6J1ckY6fdEcaN9nfFI9U1g/rfgH7Muvh9E2Ca5X1c63HTNsZXZQnRWRjwTgZprmUSwgAInWoTOxlLrug45VML3vHUKNu6UscqhR3iygPADD7tNxAO4MhKV/f8/6J6aVXIfQ== 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=4cdRO14VgoIS5H64PGmgFpT153i6GVh/y5bzFX1MhZc=; b=JqJ3ur8RNiMRf/0or69eejTFpyZyyNuHYxmF+y+330oucNhQAOHbWSVN3ix+GQhNcmXWvFc753kcphABxc4lT1hPEIpFjDcoH6N04+MzO47al2FA4CMKLhmpmqZkwjtRlCxt4W69/ANdE+0w+zP+kighpuaaJ48X7bz1dqqp+EL6P79cuFSHXNQM+ccVSrQ8x/lnTis7N9JRsqbfT1m6cCPIHeaamZhGLyLM5AmjmBEXBBfhSLs+wX3Hssc+GtMx38qR2iYBtQRxZj6YGnUyZqJQX7hD5DT82x3X8FxtTfianaBfWFbWeaf3hRMV+kjNZpSodCS6RpUaynfLWZ/Tkg== 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=4cdRO14VgoIS5H64PGmgFpT153i6GVh/y5bzFX1MhZc=; b=l0sE1ozm35+XHUi5JSjacKXot8h5Ctz4iMHOOPtBOJq7ZJfYvt9Qqth/QnjNniYQi9jDvLDGbfPIAKKgpwZPGgdA1CkYKEE0IhRUbKUsHVRn77q6RCN7SUHETG+iZ9MPApb/V8MCD1UBs6zNnHuFU27jDZRffaAciUJ4+hZvyPpFCQ5wyWiU9bL3z4/Ce8C1CKRm/9XU44FL00te8g4zaVQwRwE2ilYBIOfwXNH1vUK7WXWXKPc/Io2Ol4C2/Ip/FNUqGxSVvJ48EsGa+r/hdQtJgzSxhUF1za0JIHEUMGchLddKOOeZtSqdLFfP/Q1IORydPFHRylRzCWNWNxhi8Q== 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 VI0PR04MB10928.eurprd04.prod.outlook.com (2603:10a6:800:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 08:08: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%6]) with mapi id 15.20.8158.013; Wed, 13 Nov 2024 08:08: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, Frank.Li@nxp.com, jun.li@nxp.com, l.stach@pengutronix.de, aford173@gmail.com, hongxing.zhu@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: [PATCH v9 1/3] phy: fsl-imx8mq-usb: add tca function driver for imx95 Date: Wed, 13 Nov 2024 16:07:43 +0800 Message-Id: <20241113080745.2300915-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|VI0PR04MB10928:EE_ X-MS-Office365-Filtering-Correlation-Id: 5bdd4bf6-d0be-4257-e37f-08dd03ba4cf5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: YoHv/hiDiZ3muD/kXKW4Db+Ks3zn5UaAObKYuk5nTrZOfLfS8skAsSxPPQ4kKDV9sO1d95w8m3PYJ1p/wLZB5+SK4QAW99dIvnfCWpxqh+9+QOvlwjWgDHQQSCIbqFpPUAZRN8zf1Hzz1VzevWmN4AEETa6gdBQtqTSRpWmBbGD/9Rt7jxQGid5rAcgBNZayeZ1QjLJDUU+Vf1Mf5NMngW2ANY2YqqGNgq7BGn/irKPy0wljOUQoWtD+jh+LzUSW9h0+0+4T93Co1e7hc6t0N5gQLwT7sLKiB+6OqOqq8ZoqK1L88H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JHZ7jxfZdeSt9RR6D30pNYGqyI8LaVDnbv5crl 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)(7416014)(52116014)(376014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BIqxC4zAbBaEGN/ToNSMbgAczvHbUlemeOneBjjnJNr68zh6sDA85+S9htJvGjVU1G1pXE+2+huBP37Vr5o1DW3YAAqKFrcnx9sah3viZmNEhfOwoeTd0X/1zXq/Ktk7ocePNvvH7Tw5+OCPXbJ3VWgJ4lUNO/OqQbqW/1Euk94FYDQPDbpzEY5jANBaeD+oAG4CjopHryJOgEa9SosakmGEsHueT/pYYVShQjSikfMaIvDarThDb07AOeUDrPMrgqqZbN9VDDFPg5hDt5tkPmBa71v9o4w3OPBYR5U4AwLId2WgzoUdSp87I3FjZCO9EUip+ak6zeiG/3OiK456QIINsjXY9rfKLfO8HizG3gxlGtjnVGnoUon2h/ynvtN3fi/dCIpK3nFNb8DF6ZPOyTrVAJekBN0KKGil9OzI3NuP0P3efowHfkAFrNjTaNt6SxNxD+O+hBsEGXgpX4bQXR/dTP9zg/jnFFuEmcaG7c/JDWjDrbc0Kmkw9rDMScjlIHTswjWgb7U9DVi/boHsKh8ny4SV456YqEqhU0/9v6wOOV1c+UIHdxnKNfjm0VB9vPPIviG25Dnzfs9865pFLwHM4m9jGBak04tfylnMgWRs9hmwFJxJJdx+m0EFntGuMzVIafxbCBRQm4xV/4vNe4lcB2JGHRuyzPcMrzhs6zytz3L2XXs2J9wRrELy5NBC7WLHfLskBfGU5HrLsA4gOZ9aSD4skvD5nhQoPRr6X131b3mWaijHr84a+ZmyUuvFcHkrRgiLu9mNpUOsa9r8AjBYrhXBk+uyHDY4QDN26oqYVQWXCdXy0uKBu0Xl4Tm287fEhFg/haENdDAwQK1yI79NU/vCtShCJm3gGWywr7iWVqA0tCJnrBlNVOccR73Cu4wZT4Er9bSeJoQnh13ooz3zainwfzNvB4lzIN3uGTSYb6yzaI9Lmmm6iLLe3VCyVtNXICMBL3+dgcYoW6l44Dgr34WvjZZNuNXmvXfDVoqSY12i50FNgCTvktHPGUmuSEJTgsBAg5V5Dce96WF7c2SaCX+QzQBz1IYOhmhmvCE0VlJnNptgZuosO0yo96fkxBgfg/fmocQxumtlHfDX8zGr5XTDWidV7pW7W0/qeay3hMOlR08whwm27/bYlC4z3lvO+wYa9Zd6EVTunpdtGgoYAyG9FYYxH2mIHxV0W7E+N2NOBzkZXL37qzGFKNpdxxAMJcSEJLX3u/URQ/Rq0fcGIPw7jc8L8l0WBTzJ0zpS16YDis2Cu8Gf394OAGZVeP17GwVEvpeWVLkGoK2N1ZgcnWMw02npF/1h39sZ2PDtYzzdGg7QxKswkPCUMy7ZvGNJLXNJaiwQnPpk67KjKn+avgSZxn/LDWo5Yhcaz/qy3qundf581EoQSetv0m52YR/OlDGVrSTlnOtgW1jNCKIQlQi3h/P4ekKKA1Jl6axS4CluDTYBzr6M+zEKGPyvGdfglNW+rAhT1H+9zpTMovhZ/QjVXfB+3GtED9Bac22QvkQXWLUD8sYB7uPpPbDamaM0XYqJoOqAO8nXx/JiGGu5Uo1jvcB3hiQSG/O5pqy1zRegMh2i0lEU4tX+iHnM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5bdd4bf6-d0be-4257-e37f-08dd03ba4cf5 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 08:08:04.9545 (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: KT727gIfDpNHNUvAaZCgWsIYYnDZpI0/6XzPmzIHBc7huu76bcRzhlTNvc7GMLRd1G2Jd6MMLG1XgHHC1iUbNQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10928 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241113_000814_293352_C17623B7 X-CRM114-Status: GOOD ( 20.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 Wed Nov 13 08:07: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: 13873273 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 0C215D41C13 for ; Wed, 13 Nov 2024 08:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vfQ2UyccLwHjq1v3mhNUcte08TZc799gkBsNZi2FYPI=; b=aUELCXX+t3VC3TieQqK1fLJRN/ J3RMA+VEAffWq884jnjjxlKHjNp039fNSncEEldyqeqhcoxaCvkoCG+jHXwbZqEB1wngJ+muc2W6r LbaLhPwbpMKbaftKf45KGuYSjkY6d2Gsf+OoIWWnl9xTA/uhj/0Mu2PTdR5HGUR38Y7UfEB5WbyOC Cf2eTpo5uca9OfyskfQLc6olRCxzDRfVR0FcET8jCAEaZCbs235I4irDeCrI2N++cj41dFxga1Nkl btmzxiFkdpKCBcelRUy6OQliXCp4QcYyWDQrBjnVyxYBF8+Ej4CKnzowIltXOwWFYfKjRtXI8PpKz VOSG5HAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tB8Tk-000000064Ay-0ld0; Wed, 13 Nov 2024 08:11:56 +0000 Received: from mail-am0eur02on2061a.outbound.protection.outlook.com ([2a01:111:f403:2606::61a] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tB8QC-000000063jc-1ajM; Wed, 13 Nov 2024 08:08:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lWEgt117S9IP5l1WPLZ7JrLKKFRKxyujNq3tIrGJYwhVnIbD2z9zIrACanfXjkknpJ5LHUs+DR7sVzDFvnMDolgLzaM5HIGRI/CpAf0B7ohXvXkmPYOz8xCI+Bqq1P1nGa6AXGbZO63pUAmk63sIMWhG5gX1woubnNlutjbKoiHVHQp/9s/7e/hHKEFMng62Kt+ZQn8f640BMs7Tr4WRYVUWbuT+15xTzrESxlQ9J1Ni36wIH/4PGoe9Ao5xZ1JCBX3X0DHygyaTBLOC/SCn8GXnpl0waKz1AFa0LtCZQO2XHJjd1qvjuoqo1JOvYH8+PWdOSVIr+HyNapH0l8rq6A== 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=vfQ2UyccLwHjq1v3mhNUcte08TZc799gkBsNZi2FYPI=; b=WW+IfJ36P7peHKovnMesjOzIYAxspPaoTDkMfo/Eu3rVTpyvDK0RtEruRpbx8MUuUMKb+ya0U2tVyqyFyO8ni/bDQpEjZrNoEGIMq+Mqzn6O369DhlzvHz/bH0hsTjpId/iONhO/mcl4s8MLh1iEQoPdcXBpqz9riciIyRZUFBK0L4QqUJjNCI8u6DRyS5iO5m28pv2M0EnoJBrLXaaqBCzNFx8kxOQvT3WpxNiHiUyco7vKyISp26beqW7jSodWdAY74HReAQydaFoKIimvv50NO7Q6Ouwh/H/XwnfmUWa5xj5zIsAFMbXw+EWXslF3HchJg+1yMmsmKX8OUXcWAA== 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=vfQ2UyccLwHjq1v3mhNUcte08TZc799gkBsNZi2FYPI=; b=FWgtDPqSOtFj3zym8WQcoV4SM1LFT4mwY0Sah3K1hmj6M2hC+Fentq9imMgO02Mw1lsN3P/0ckrhGouv41PCyRiwalNijon0JINvmqIW4FTfQyU6VI0ARpYF9OhA60wRbfDosY0bfJPqkkkcdboHalS1NybO3RIg6Do09UcaOYbqgmvvxdsPDCwVXaF9R53eWY6B684LT63q+K623fja57GfF/zNHP0VTMirCEde99euMB6fIF7+o6e4uwt4LmSTNoKAsMEQKClImkabfXTAX2tmPWW0+O/vck92u7+HVLmPkuyc/e3kezCSK/seuQPbekRhMU2/+M5nCq7hzvbcKQ== 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 VI0PR04MB10928.eurprd04.prod.outlook.com (2603:10a6:800:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 08:08:14 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%6]) with mapi id 15.20.8158.013; Wed, 13 Nov 2024 08:08:14 +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, Frank.Li@nxp.com, jun.li@nxp.com, l.stach@pengutronix.de, aford173@gmail.com, hongxing.zhu@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: [PATCH v9 2/3] arm64: dts: imx95: add usb3 related nodes Date: Wed, 13 Nov 2024 16:07:44 +0800 Message-Id: <20241113080745.2300915-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241113080745.2300915-1-xu.yang_2@nxp.com> References: <20241113080745.2300915-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|VI0PR04MB10928:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f93179b-065d-4b99-74f1-08dd03ba524c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: skzZaLFGSwlqp8jIVWsyijaPCqU0xVRoEc7V2oPVH11t0B07Zn4/U8dEalVjgW3Z0ILPs/L2MZyhvEgtCF+QUrDOnpqRKIHx6oESvmUD2qihyVq4y1N2dSkPhclT8tfPYZTkFAlWnFlurqnqq4RlxYKq5qdzK3SBVU4lZJ0taM/g+U6dSrFZjG84Ihq6T3YWlFYi+53r6rFOZxMhJ4EWTM4isFYs0snCcI2PBYK3jljUwD5fIpPbUFdm1edc9UJisDsnoYJWPuFF4nycK8qoN1VHul23TsKMgaVlEvPbpgVbpfs7ZzQG0WIrWsmE5RAJp0KOFNZvpYDkPnIQV2Rfbs8WX2tn8fpaCiOk0DRpEIA8x43p5zZ5aeyNrDJD5ZvZ861F3pxNe3/p13ycE9YB6Ts+hOoC3TPeufdCxBHu6v9XwjFS6zdKrbZ8eH1pQqsRzCipLTa79hRMFsLlFcmYdXxZlSI/Eniu6Hp+TCnk35aOiBEp+UKMyqgIOYuw8TWjlU14rkITcLlh3RaBZdEa6Pyip/uOq7h9s/456ONgwMPHVtG5YC1gwV+i3lBrMAO2Wao3IIRipOGFxQX6SJcONN4x0iBxQkhMrPEA5+9pgWALWTFHvPN3EZvlUEgdSAH1Vtgt2Z3dQB6OUTeQPugiBTCS7o5VtfupMPYSgxo7Y+nrflVUOvp81ZtNJeKkeMsbTLiF7eG61N2KLCnsAdYyNDcVOMj8w0k1nPDuR8nFPRqL/jHQwQu0zPRv7ykidLk6l++rTd86URU6xvvchyG/iu5O4a3UrL4ONJFaI0sOGIP4Q77ogfY4P/PHh518TiQsCMbrw7Duser/Hr332YZOLRxEtWh8HejpmmdqK+FFIuCRprlCDWx0ZNUehmIUmGv99mfjRe7FNfuHSD4c5kGHx0aWQNwNVrgAAMMsOOzFe5rI5+g8LjpZRpidE9ijYyAjIa47jKQwer173lCQZDSfWGth+50rMSdV8M2Y+4VpoySiYR6iZU4JUsvlRPLfYtteo9aJ8UUUjZhA4JYeYHKN83ES9cdD/VnWGH6vwOcz2DCVX3spB6LQXa6n6k6zgeRaxGv3ZjemoJp8Lt8xcc3BlocJ6//HgebXB/7RdM9V8sV7E2DJuJnQo7hCqv9eIpKQs6p3l0J6OeANZ01nVtBmGpzYArPiPY3gAknuX0Ttr512A+okgVVdpFW8+Y3fzBNELOVymhofKOdbiSqsARDrI+KO02Wvwkgg8Uxi6aEdQbXHh/Ck1I7TfucRuo/MwkU0GvjeLH3a3L04mrG8dclGYJn/Awcu6gsqzGMaoElSdD58pZWQh5/TuKwG1A76c+Y4ERer4J/sW057okd1d2mqLNBmj+9P8SxJNEAltaMDmH00SR95i7ZEMwarq1Q0dZuq 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)(7416014)(52116014)(376014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hCirrexMltcl+3dU7YyHUvKNcQZRqwIXwLHLYVPfeSLeLJQX+PNqsvoe2Jz20Mq1iAGSVEdJwkO+tjhhseUcMwxk9LHiahAOqp6XzgVIz+i0txBGwihXEvun2SE3OdGHZV/RCMP4mKEJaz3aCuQjsB+cUJAp7AfIwB2bbAhoEpv5ey3ImubBVPgKaCWQom7FFskR24KrUCodFhzV1p3YSpmeCYlS+MlQ0J0EuEkwu3sDNV78LJFGC+fqGTvK8AI0frD5dVuXt5XPGIAa6Ngq19twQOkrjuJZK2oHz6iKbWA14xp6i7jL5NU93biF/5XWFi7MGMs2B0iNUIZQgSJ1XoGP/SEvE94N3vbRAlOzGplgJf+FDbj3XqY6vRKNuwq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CZC3IyjSBBHKhI8pCEXqzHrFWRjneKocndCEvnTgmKmxo72iJzKhYwrMzaNW7PAXndU7sIbUw14ouk8GwhGU0/SX49wBSzpT6fVSfowNwy40Y4wOnMD6i8c9I1+8okFKikqyjZwkJR X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f93179b-065d-4b99-74f1-08dd03ba524c X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 08:08:14.6917 (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: PLVw/DKcrwE1CKT6rk5c/dEcsffWVzuOcBzCFWu1mIpjni02O/EZ5OwphJPz3YtDDymLNmaJEBRbRaeB7dsi2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10928 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241113_000816_444831_FF47F0BB X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Changes in v9: - 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 Wed Nov 13 08:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13873283 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 2E4B7D41C15 for ; Wed, 13 Nov 2024 08:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jEtsfa2IjSA4q++/5t5XEj4/uRWbf/7HrjPyqzd+aSs=; b=G35F0XHkoxxGqLBPn6CX6pZ+wv xGwdtD5slzOefa+e4yRUQgDm5mZelr6dJ0m+AZe+txahdhtEAmxTZrFZFdZgUJr7NMFOnMGpV4V5G ewlnQ2SBtbKUqKIElXSmv3+7A6acifeKlGOhXCFXz41X448Sy6woHI7XMEe1TqR+OnuNQoc0zam4J ld0Q10aeBthnEvf5p+EVZ2pS32EQ0t5MOQQw99WLwP4RxKpvkjm4gVIXbHLzHiEjtu5qRIuUNaM8h zzg2k7l7BbUkzu8059z6Lp9B+RjxgWXgmMvCDJ/H5wkFE254Sefb3ABNqiOQicbkPq00HgGUcPdLm gyjwUzCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tB8VV-000000064Nb-0Rp6; Wed, 13 Nov 2024 08:13:45 +0000 Received: from mail-vi1eur02on20609.outbound.protection.outlook.com ([2a01:111:f403:2607::609] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tB8QL-000000063mA-0sqT; Wed, 13 Nov 2024 08:08:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p9tIzoJJI+0GRqXHEb3cZFODOM1ouzzdh9cPb3JYJSgrJdKxI7sqUHsT/QPCkoDJE3udyCFZDNriglhhoiRiHB2h/qrueHJ6h3YJzMu7xrgBHlH2BdP++V1wmW9gN43JWtx8dKrjAqePOc90YZiemA5/zmKQfbLL8BbM3LAtipjRiYCoZC2Lc/hNWQJAc5t14lAK8wW707Xf4KewmX9rq6++3EjWXCxLmYBRGSZHZsnvBIjt3FVEjbTgvzJ9TBVwQNbOAa1JPX+UUVutaA2kDE0RLcV75aAc6lYDl8tuXOWqrJg9rm6UsMgUAdL8irF0KTlOTVayFnKAjF85tKesWA== 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=jEtsfa2IjSA4q++/5t5XEj4/uRWbf/7HrjPyqzd+aSs=; b=p+ZULiO1BpJBl3UkL9USP4c9y/ckKMeDYhR4sdF0ajyugZ5D3jNUGtRDw7MKSseLidmGey1WuS0cPO0wYh/On/6vCFeIHCGkG79lC63Q0J6lYln1FouzxrZ7N9yAFfSct2qelCobJNUFqvdhxNCTWrtURAwj3W+6ejMjShnBRjC130lRVSqFqOmScjOgTWPlgCyO8P040Imfk+dWCVEXu9bmFw5gx+hrOoXP7g38mVIY18KbJP5yB2dPkCTviYWCpVJjRHpUnL7SqT64pTm3KH0hfbBGPrCO8biiqYYA8RQ6uIuCVOimy7BR2GT2AE2mvw3uK7iat7c4dnWuZpRCpQ== 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=jEtsfa2IjSA4q++/5t5XEj4/uRWbf/7HrjPyqzd+aSs=; b=ZCs8y7M92K3qLwQxT845oZqrs38DJ/pLC6tbWCGs/jNLGnDDJN6ao3qtP8XVc3qJOM+CT6iAshgkk6ibTA5bWPjjHklKW03Xf7qoCFpxBhXCX9tlDpRC4L5WF0jq7km3ByNWltQU0p6hdEM+f1FDG3Q5XXzIdOWpu5HHtJq3DWD8dd3WmQtEv8nI+RX8VHW7YxVmVgZtp0O39MSR4KW6i/jEa4DGIF7GUB++7EreIbi1VncMDvDYh44byjaI6mjFAUqIFQLeb15ZzAJHp9TIKXpvn09HlP+hSoBY58SBquBpdR55DQONOYhSkluwIrQVOTh/yIO04R9rHxU6VI8KsQ== 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 VI0PR04MB10928.eurprd04.prod.outlook.com (2603:10a6:800:261::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Wed, 13 Nov 2024 08:08:21 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%6]) with mapi id 15.20.8158.013; Wed, 13 Nov 2024 08:08:21 +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, Frank.Li@nxp.com, jun.li@nxp.com, l.stach@pengutronix.de, aford173@gmail.com, hongxing.zhu@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: [PATCH v9 3/3] arm64: dts: imx95-19x19-evk: add typec nodes and enable usb3 node Date: Wed, 13 Nov 2024 16:07:45 +0800 Message-Id: <20241113080745.2300915-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241113080745.2300915-1-xu.yang_2@nxp.com> References: <20241113080745.2300915-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|VI0PR04MB10928:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e468c74-9ce7-486a-6404-08dd03ba56c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|52116014|376014|366016|921020|38350700014; X-Microsoft-Antispam-Message-Info: X8zsCpaGtBiOL5bQYOwz5FF7b68Okpfiy5CDQjgkQTSDgv87w3qJVDAUq/bp1mdd8mfuh9sVhvH96bi9T4Ey0Cnxmh15uM2PZFOMrG230YIJ3dRCcpScH5+IFjwZSUDv9G/0tPeVkB0WASXsY7pZzHdm2aPKnARr9bxsLo56dQ5ch2vX9fMsEnTEIjlXR9r+imD2tLW3WEukMRnZI6tEzQbJi4OtFZK4gu5oEhn3r/zAzgFVlR4eD89aEgqblQ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nBn7wI8hLK19hFodNXn1FjZJFX/89omliu2LszGuWmy8MR2mVqx1nQQnlV8+2Ox8j82K8Ud2whoMLTZt4DXDvxh0 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)(7416014)(52116014)(376014)(366016)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fEBjphhVJ4fvX+Io/JrnY2c4WS+CFGxCVTiUSKCE1Zn4+tFNeGnQb4JSMygoEaUqnDtKN9eO97WeyDK55eSEZ7e55zkl/mJ+egUh8GmHjnxtgq6arKXZsrsy9znljTKfQUuWgDkyvvjEWV22OELMKvOS2hcmJaxVncRYJsAy4RopQL7QkjhVbSOdRjFd1u8sQVqDASoSMrLr3E54B4qVsR03PZ8Kep3SX78LJKM1sny7P5KUjNrXbslK1XSnF+UTW0b5vwzmuIdLHu7WEDdfsNStdld8xOeEd9SEJ7m0Q902oDP7WZzPigld68IH2TmrYI5Y7iSk8TspaihpQkU3pcUyZ1WpvazCd5aqO2AGaf59n0AUKwvV+kMH2WDsWGb3/LHJZmGk92rqTf4XqPMIfGS1o+TwehjeUVcZSI2Cpdcjugct9hgR9mNplt+oN+IeB57svSfiDghf6zS3hWQFv1vUaeLpoW+PpL2ryJgCMit2DqVBBKMx2IS3C4o9atx7E5lkCkemMRmyfWSoNexaurK/wVEHLr17IlEMgo7aKHNFe83clPXfVl/DyuXTCKyGUOKPTTdJDV3tXRWXXO4T1X5lW9nPFfjJpUpYLVdvsGSmuqVJKzcGan+5W75oJ/dKZ2coDQ07NhErbf7SLW9Q13H5znOgs6vlazqBp1TwthrkaD8z8Nc3+7U4oTyoWCytnXn4uI1KjdMvISHZDbIDigJuGvydDfSDOB3fjrMY+mqsLq7VIVRg0PjNgWYI9V/5pPhrUq72iGiM2iRe6yjVIwig02kZ9PgmZcyTiX0Z0TBIRnWzAxvISEohM/g+CqRlPXYEDmoxNx+hp/162eO1cch7qmORuk1zWzYPFF5fwO4hsnvXx8dhgsG/XGhdxdK1qQLyRp2X/OeDNgAktvArz+SLws+++ptUw59GOF4YMY4em63h2sg911Uoh2/wdSeOf4YOx/w0fnskeFUhrGPizzrMFkkO70R9gOnewRAKQyHonC8oPA3W8BzS2ltdSzzz3WDn7XrtDQv3/SlaZDKfEy8zwTDC9UctabgN8yjnVp7ISTxf0ck9fOtCOv0FuO1ht7YsnFdJR46HVW3zdvZ62qBuFn0RVdGJj+AxFdW18f4OvDvU6AMVBBsR/pw3vcKWJkIRS1i2w+gftHlVGhdI6+NXk9AVW4nmuToY2FJvA0dMWQSDdJmdhRr8++3PVxO0vtj3MIr/dIpiE05W3rLnjlcyHGAH85rUqqq9dJJwky6qA8h0GN7yk4j3jnGqqhJbfU40ZmFjGO7m5cqckI8qQ+hNIDgAS3YUMd4IuAu3MLvq1wCLo1toFO5Fse1LNAlRYwYzpN385MV7e65B7qpsgZORSlnKsUyhfPryLlJ8CjAfdzGA2WK+MLFMXj0sT/NZ2TddWtLloadp/wwI1O3fLt98i+UoFFHtTOklvhAeKbcp0yhJakPRQOxs+5vbvgtM1wuKM9rZ53qtA0Ndk2jlnlll07pSmIV/eoI1crAmYftU8FeuYxv4uK9W7BhMt/q+80MUE/jopetybuJph2eo841Eh66QYIIuLu9lfNHHBPghOkZDTxrfJBV7xyKBdeCA X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e468c74-9ce7-486a-6404-08dd03ba56c3 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 08:08:21.3501 (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: vqgdtuji25ePqXyrcLMJKvN6SqAWvIoZOLe5vZdYoSACyA5fTzgzPsQ17R6M/4ytVJGJ8YtOxsWS6PDKWrUkGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10928 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241113_000825_280507_0F86DC70 X-CRM114-Status: GOOD ( 11.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Changes in v9: - add tunning param for usb3_phy --- .../boot/dts/freescale/imx95-19x19-evk.dts | 82 +++++++++++++++++++ 1 file changed, 82 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..cd2b0a39e8c7 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,39 @@ &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 { + fsl,phy-tx-preemp-amp-tune-microamp = <600>; + 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 +614,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