From patchwork Fri Jul 26 11:32:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13742667 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 3804FC3DA7F for ; Fri, 26 Jul 2024 11:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=v22QG+jD+3TRSht0K41mBA3ylvVgtPPsPP1aYC+V1aA=; b=i4ho5eursavh5O h4q5S7YIcYH1hlZviFty4vDj5rKCzTOapXPksqSaePNOe2lCc/Q2FPwWDKNojevgZ4uQ8tOz/LNKS ndXKK5SJNZUolkboIO3kO1pW1BYFcm+fAi8sQ1zG6rgoPe6E0SpHbOSnF0axWvI62+Rwl/fLjC9tq pyo8598GjKGtB5Q/KrqeL1JKFQl1H7aNSPgibRnNaaPY6a3Y1Ez8gQgBGdYuzLt9oVga8wrp/D1Nm Y6f/xLkaMxkrep3CFWRhXUlbRWM9Wb94cl/ItTex8avdoBHZApKukIE3MeeuZVXLnM9+3EEQNdoCf 6zSx8viZwg+mMRQr963A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXJBF-00000003jQq-3leE; Fri, 26 Jul 2024 11:32:13 +0000 Received: from mail-northeuropeazlp170120003.outbound.protection.outlook.com ([2a01:111:f403:c200::3] helo=DU2PR03CU002.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sXJB0-00000003jKG-1awB; Fri, 26 Jul 2024 11:31:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UffjPyiMi+quWJOYEZCU7wNRYKtIEg2T0X7SfrNIPAkVXc1qAKGsa0g2nnsAdv5fNliDWOnpTyK0fcA8OLX3bEdqUanjypxLgE/YubUZYNgd9rb9WnMA9wzgLxWzfe2yTCFZBhKFO3/y3iK10IjQAxK9+URT/WlS82qGQLHcue7Gw23+WZkoWFChyXM1QAFOW73msw8G3uBdIMMvh0ke+215Gji/TM02qoq1D/xkVu+aDG3tTzipENOyR5dGY2JE56ST2e1BdDsgTHcqIIrqGV+W081wHsIH/veWo2v/AdTosaGulpruJQ/16x+sJ4N5adJfQZJVfsMVccaNpKLW3A== 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=oDtgLengr5PECs/ga4Qc79rxX1BqZHPO9lPHqLrfj5o=; b=Kr9CPBkbzVlzyFLbLRQOR50pzBQl1gs8+oylE2eVEfmPGWCtP5dvp2xPLPrAIOwJfyOCUo75F0ypN4IP47utKELGFt4cW8jggp4jQFDky9dd9eM0PaHSZ0g3qlkpJ5WfRrQ+KRwEfH8pqEpD/LaFLec1ZwXq2wQRzQQMn+J8Q/tnNr6sKNjhdUmU35npBLhHf4MUs9cbgPGzBu3hMdeoNG8xe546ZMgaxSFMGhOgDrp+eqo+5eN8Js7JK8RCHHlcNoaNGvjSxZ4iY29rqRyQul/FjguGnxvlUlJK+xfyjvtWoaJgCroSaTmY+3FyZU0xzfx6XVZW5IN+9In7YMwJag== 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=oDtgLengr5PECs/ga4Qc79rxX1BqZHPO9lPHqLrfj5o=; b=mmWM4/Jtekca+IJNYTGvX+EmMXJZggOIeK9BAbe6ytZj+9K6lNT2hjqbpqM2DV0ygxaM6Pd0fhxWaxywSTr3PwFYOFxp1xa1C49xi2pxGLt5+V8MlCXR50Xq+FQBV1t8RANoyz1V83Llz+lNiKElUSCb96/96fCU/loWtE57NzMQsEEmKrVy3IGfxzj23/LyhIMY8BQ2oUBgCQ8hkjtORErm4rvIMXx4FtBxil6juIb15AaH3RYcmwNWeMRE8cxjqGovHaBEuRz7+D7ZZAYVl+JrZJkcZ4/uwWPQKxqyNPWJ5+QR3PljLpFkPglp2y/v+ZrmW7khH0WeHEm0+szs/A== 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 AM8PR04MB7875.eurprd04.prod.outlook.com (2603:10a6:20b:236::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.29; Fri, 26 Jul 2024 11:31:51 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%5]) with mapi id 15.20.7784.016; Fri, 26 Jul 2024 11:31:51 +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 v2 1/6] usb: phy: mxs: enable regulator phy-3p0 to improve signal qualilty Date: Fri, 26 Jul 2024 19:32:02 +0800 Message-Id: <20240726113207.3393247-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0047.apcprd02.prod.outlook.com (2603:1096:4:1f5::15) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|AM8PR04MB7875:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b21e910-ddc7-4020-0291-08dcad668b00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|366016|7416014|376014|921020|38350700014; X-Microsoft-Antispam-Message-Info: 8CIGGg4wDZq7FEBHBcK+mWy+rspYmfDFlghX3KGRxYd284B72lhlmE2OyIFIiVrBsnS5kD7fvkb+VOMlh4tnYTSTTFtrUFdxxZY2CTvYSpFVj5mv4xgbeUaMuR5B6jcDNyPWebLrAgc50fJb6YDpEQuJb+Ao8oMiHa/DImo8mkJ6WewYJnQlk8YX4e/bjDlkM9zBBekoeSu3TDxsf7uKPGmHFFee1eOPUR63DGLPjew6mViXGQuB5QaOISJpOpOD14YxWeqmjxK1mEOSE/D6DR3gANzhs/zddfP9IxNSuZ0jYFSZmSSUJwislHpay0YvtO4hs764DxhZh4r/SoWUKi6MknUMLpyk81LYHMW16ME5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CCR9JYdKf5b4Cv/g= 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)(52116014)(366016)(7416014)(376014)(921020)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IFoXSR/KFRddT52XToalTmAmf6GRLjwEujF3q2rxjzskKkcBsQFg6/RYZlmHromdFRQ50mfJOgY4szZADUlXTcYoTAbPCoawDe4R9N85gZtNoet9nGWMcbG0ZoDwm82Lp6Wpwr59ymmifWoAy8UM513c5OdBrLrsGwN0B/kG2zvq1G+oY+pUWMed0E0dIjDGvdE3d8Sv+yAcdJ9NBicUtbjKegNYuvtAcZvsdRVgXB01tA+KSowKbD3Y2qlhdEo6wBxU2ZWuiInpjtL7m8NGvqqe3UM420zhm89m/gK1AL4GF2Rnkq5skVGsBs0YPaMx7Gth7M3B9PPbhuPT7rHanR4OJ1GPUXivs9xLg/Pj2w+NJ0azVgHO9KEvBbKYfk7ZWY3tilLRqGLQWNL6elxJof4JpKLouvTi6rq/YSNh7cfOmzsgPz283csGk5LVILHeRDB58E+KoUxudfXw+Jna6b5prPxtjKKNDvOunWev3xO0VGvF5YKhCygbeFhvEpqfN5kv2eKIxUxkw+b+h0JeiBP6HI7k3Voqw1hP5lUc3ryMtBI3XKnnCtqtnMrIDC+nZVY+r4l5ubhE2M3cYkFT0h/tQz7j0nhCObh6fD/euQGqErpp8368WDUkt8EEz2K6em3xYRJHfYQg7mI8R2ndioD8G+gjT/11xeeDTwuby4AtyJXUFbMpZm7W89gB0T+7uwjVxNZEzkc0cThLG03PmsYRvC25avwN3DTOj0xkFrA9WU1+xpd1CZsAqV331ci49PFy4NKoV3FQeMlz8v0+W8J//vmLeIpHi0QfzUS8OW0v7OA5a+5AeyT2WtHv/YUbWpcS7nfZXxsU/1KfPNpaOf/oaurPUaWmXH3bUzpXA7ArTlVPLInV6NwNftHTVJecss4M/cqX87y/0Y7+b19Q7EjP9s1lI7ejFblR9srUeW+e88tqdjW6TlYO3Dng6Lj7rZkkBm505A2kTac84FzEjgwf47H/4iPwXp4o4gsfJOu1mJYY7gPH92UkQRkhUxSK77N1VHEFHU3z+FcnVSe1JfOJ4Zzo4KoDGxeq663bcBJqA5buZITbkMOi7YwMa3CGZb5g9AXlA40Tti6H2mn+cIkUaa9fcE/O/kojI/WftxNQBoNvjvqcgA0hsQcBne6Cje22nhvGpMk0o//PN9xiW+h+GdNISMtj14XhdLA4vtJHbAeHBkRz8Jy9VStzLm5+GYenq/y8S9m2DAqdlow/IUgcjXxsaN8ZLi0LmPgS6bdw1tvN6OKu6j5eYBW0E75l+zBCs/HMGsp5rIoXsxzF6Xb7AETVjCAsbLwFA9ynOoSgQcXtBMpb1MLsYd3vJC0VkPXojv77oa06znPxc12NiGI4QXxhv8YA6artVeNtsf1urHJnWS4Hl79F2Jeu4g+hRDziMObIrlWCQ7UjRky3E60G+JMk+9o6RvIPZFMfA2iFE6VjTT3Oa4h4MHb/fNTEe51+emLwFQ/hrSDkBpGx6hAJBBK+oKx+qkzbZm4hQSF2Z6CngmsbI532N0Ib1D9EF7UbGhMO0X4y1kpHi5Br346sI5mN9PEtGJI9rgZQbRXcQ8TCFvl4IJoMuBSMmvZd X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b21e910-ddc7-4020-0291-08dcad668b00 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2024 11:31:51.5145 (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: 2wthNgj5LQux5WaU8Q+6C0+SUl/KHxWIkU3Qjmb8XmRzWsPAdZP/+dpphrTLpC3kKvn1fyHPU2IqlY3Ll1hgJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7875 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240726_043158_483321_2541236F X-CRM114-Status: GOOD ( 13.01 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org Enable regulator 'phy-3p0' to pass eye diagram test since it improve signal qualilty. Signed-off-by: Xu Yang Reviewed-by: Peter Chen --- Changes in v2: - rewrite commit message - use dev_err_probe() as suggested by Frank Li --- drivers/usb/phy/phy-mxs-usb.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index 920a32cd094d..d9d29f0b37de 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -18,6 +18,7 @@ #include #include #include +#include #define DRIVER_NAME "mxs_phy" @@ -204,6 +205,7 @@ struct mxs_phy { int port_id; u32 tx_reg_set; u32 tx_reg_mask; + struct regulator *phy_3p0; }; static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) @@ -288,6 +290,16 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy) if (ret) goto disable_pll; + if (mxs_phy->phy_3p0) { + ret = regulator_enable(mxs_phy->phy_3p0); + if (ret) { + dev_err(mxs_phy->phy.dev, + "Failed to enable 3p0 regulator, ret=%d\n", + ret); + return ret; + } + } + /* Power up the PHY */ writel(0, base + HW_USBPHY_PWD); @@ -448,6 +460,9 @@ static void mxs_phy_shutdown(struct usb_phy *phy) if (is_imx7ulp_phy(mxs_phy)) mxs_phy_pll_enable(phy->io_priv, false); + if (mxs_phy->phy_3p0) + regulator_disable(mxs_phy->phy_3p0); + clk_disable_unprepare(mxs_phy->clk); } @@ -789,6 +804,17 @@ static int mxs_phy_probe(struct platform_device *pdev) mxs_phy->clk = clk; mxs_phy->data = of_device_get_match_data(&pdev->dev); + mxs_phy->phy_3p0 = devm_regulator_get(&pdev->dev, "phy-3p0"); + if (PTR_ERR(mxs_phy->phy_3p0) == -ENODEV) + /* not exist */ + mxs_phy->phy_3p0 = NULL; + else if (IS_ERR(mxs_phy->phy_3p0)) + return dev_err_probe(&pdev->dev, PTR_ERR(mxs_phy->phy_3p0), + "Getting regulator error\n"); + + if (mxs_phy->phy_3p0) + regulator_set_voltage(mxs_phy->phy_3p0, 3200000, 3200000); + platform_set_drvdata(pdev, mxs_phy); device_set_wakeup_capable(&pdev->dev, true);