From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18BE3C3DA5D for ; Fri, 19 Jul 2024 07:08:28 +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:In-Reply-To: Content-Type:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qrUOWm+YhdVGGiYBGcOR9AVG9+jtF3lhEfbIQNiW6n8=; b=kyfFDXU/+RJMH1pDn5LgnSOD52 fU008yTR5g6ep4t2fSBSq3pOAqTdJbxsOQh2fw2K75cVJE+QAlH2x9M5ZfD/0Tyn8p1KE7Jglahp1 LKZc/dHBnGwLsFKXDerna7secfTqJUCbHtBNqxxe/peeHL5FfroWGzfOx59Q0GL/vjkTrP9BoNbIS tQdXGpFZiRntgTUz/SIeduKbZB7KHIaFOLO1ViNSHjkLpQpoEmPCqrGH8Nj4lprMxzcSsarBmjE/5 iaXKesFZPOhAxAEP6CQS4BrY7F6Fz70jVQtg419FsJjmQiBMh7ZvbYqzOl42l3izLVa3tYaKD7tmC jcNEeovQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUhiw-00000001siW-1aEe; Fri, 19 Jul 2024 07:08:14 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sUhia-00000001sfz-3vCx; Fri, 19 Jul 2024 07:07:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z+vVk0MZLRp10G4ujhwGAEprqWbCx1NI7mjDG3tGQmu3s2BbzEgvOCzO5WFTQc1ZVEKzUQqTvOMUUx87qzdy+Az9jXGi6EGWsUlcWKYTxE+YATkkcmEPA+3M5wADUCxLiQ4PZMQ0rGS9miMW40H/8krKzRfwzy+LHNdgVjcPmTdQyTDORRcpaToYxu1bBQ+cW1SeJAvMrijTd3oMmWGqTOTgtfmzOEgb+dgOkMINMfsTrqgPua6Xkdpb7u2fAb6tchGTKY9bsx8MqBj01kwWOWpbMRs06V/fDXS1Ga8agz690kYIVsNuzt96hbU+SRRvoV9d3+7WK4xihrTlc3NMdA== 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=qrUOWm+YhdVGGiYBGcOR9AVG9+jtF3lhEfbIQNiW6n8=; b=Vvll1kU2UD/q2KAw47piDpDjFHZFhJwsAVGSOyAKVZnfSOAUHTT/aUrJSi/mwkGhqm+XwVYcVqfosul86lX+dUc9B5C34nC0splSST1rvaG6kGky9fcCcVHoZ/B8teswab8NSdJkrmkumYldi0a6iJGZiuSiPqA+TSn4gZ3UfJlkpwMLJYj0HUE7g+RtjiPPj34xKLsicGiU68u7WFKu5OmaMJ8mWRoItAPqGhlUYZDgm4wEUAf0BF1BHC+NvIFH4NWcULdiqXxwQAOaleTd+a+aQZhSFQjKN03S7E7UN85BGGi7mVFdZK1S3b8BR4Lwu4s0G68pdbgb1unEqafYxQ== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qrUOWm+YhdVGGiYBGcOR9AVG9+jtF3lhEfbIQNiW6n8=; b=Hx/rRw8pFH0p6EHIQeYAblZFAW91maafZKKGr/Vgm627tfZD53S20CQOxfG5f95JV76PINhmTcC3mSJAV5oKJaJwZz7HLgRxF9HhrhEuXf89nPogGggL6UcHzX43AYkJsdWQM/e0XNaX2Yrg14ROE/f2P+OhsBg6szeyGaj8+Dg= 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 PA1PR04MB10365.eurprd04.prod.outlook.com (2603:10a6:102:442::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7784.19; Fri, 19 Jul 2024 07:07:41 +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, 19 Jul 2024 07:07:41 +0000 Date: Fri, 19 Jul 2024 15:05:16 +0800 From: Xu Yang To: Frank Li Cc: 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, 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: Re: [PATCH 1/6] usb: phy: mxs: Using regulator phy-3p0 Message-ID: <20240719070516.bhzt3wglwlu3q4po@hippo> References: <20240718102637.3964232-1-xu.yang_2@nxp.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SI1PR02CA0022.apcprd02.prod.outlook.com (2603:1096:4:1f4::16) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|PA1PR04MB10365:EE_ X-MS-Office365-Filtering-Correlation-Id: d40808cc-9b0e-4114-9f83-08dca7c17afa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|7416014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6ACCgSO9WuhhrpLm4vqO0TItygY+E6+151Yi7a1aEAI/DzcN2Y1RYxXVdQtc?= =?us-ascii?Q?oHSpmf2M4gLEQdF8iAjbQjRZsLGf2UNVRRZy9HLHLweDnEqKuJQ+J4YtBTmM?= =?us-ascii?Q?x2TkvbuZOXLkowWGvZMgxUnF7YM9vWqK3KSE0YnP9wK3KuyAzJyt8JDUDF7Y?= =?us-ascii?Q?ZENrvtQS46H+scMLScNJzOQo9VJCpZ4qcha8/LO3qF5p9DeOOy2D2iNucj5V?= =?us-ascii?Q?7GtDinGEpQiBZfT9DApoboMj1mDz2diqDqXB9vvr7IVYmeRJai7Iw2CFrcTu?= =?us-ascii?Q?ClcquZAjAx+3f03tEegB7pmjdPDKgYHiDTyGr83fhQ/kmqv9YhlMwAeAFBgm?= =?us-ascii?Q?ykTisVgOOGMGiCI1paRuNjGLtZAcLDw7RE74hzlz8lU8rC46+xMSBuZt4u+y?= =?us-ascii?Q?KlXSZVn6zWdCBZ+umgAbZRaRXfI78ScBA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/FPUQSsRRkmbA9BBQ7uSUSxUM3tow0oABFiZk2htjukanWqUD?= =?us-ascii?Q?lKq4404AFFZ96ofTIv5NQb57j3daUiIjkKOsfbHo8rKTQZ40Xg=3D=3D?= 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)(7416014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YvVZCWOD0l4kDNUp0CeLBbGp6GZEldfx1Mzn2gWGflsfGD0J+A2mB4kCcw6M?= =?us-ascii?Q?Q2JLgLu3CbMlUzsfRv7GPbdtRzbMXl6TjAa6TrxX3lQ8YX/8r5Hk/2JSpZRC?= =?us-ascii?Q?WnmidzufZVO+OBkmpI7i+ecp7wk4mp90K58Oknq6djq+lVmBJR1zW0DsLjbk?= =?us-ascii?Q?Eci+H+Zb+4gVrbwhpgrISXiZhdBL/KjvVLNjnzSVkMHveTRDas5ft19PZJqK?= =?us-ascii?Q?mYyEy9HDWsAxMoja4ARl64lKKbm8poE5mQ72nAAYmR+6q613pkJb2FWZUzN2?= =?us-ascii?Q?ZzH2dXPnWhthpQ4gD5r2ZSDhqJGsZndp3hOln4C4L/eAM3ugiknqssLX5suh?= =?us-ascii?Q?fR692vfCloeZp+LeaMoeLcVmZW8lMf+NChKhvl0rctUJlNPQ7gei9U+Eu4YY?= =?us-ascii?Q?rBdpP4irPCmkKFwiCEN05H328QLXOG32x62tWoyeH+pQ73iSQO1Z9dWwbSbh?= =?us-ascii?Q?ePfs+KPC3dKekd4KfBgqRtBh/NtBBR9lL/QEFXW9qYNkBXOF8ExO+CNFVOgM?= =?us-ascii?Q?wB/9Vwbj7a9onibp/CD3F+e7/PnGRwrkoS9KUZ7+ZBwYTW4I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yEEoJblLNqP7gj61WwN22O+AgkBC9mbbBT5GNfyscm5hFUq9oV5?= =?us-ascii?Q?TgLm5t2unTeXQbkeXnx1ymkqfVT8tXVVI0iZWW0zrMQYap/99ahNOsdYmcJl?= =?us-ascii?Q?SaPeUZNZQ/1nSAWlZpPgdxmz7ZpERQ0bYNlMaicy?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d40808cc-9b0e-4114-9f83-08dca7c17afa X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2024 07:07:41.6182 (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: 4HNe2+4Ya45kj/YPLJUteC/R4wXvJSwNB8A8UzPMPH4bbwkvSO+97WeWgO3rTRpt/8D501SH9m1RDphy00N6TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10365 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240719_000753_011313_D70F3708 X-CRM114-Status: GOOD ( 27.40 ) 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 On Thu, Jul 18, 2024 at 10:42:33AM -0400, Frank Li wrote: > On Thu, Jul 18, 2024 at 06:26:32PM +0800, Xu Yang wrote: > > It is one of PHY's power, and we need to enable it to keep signal > > quality good, and pass eye diagram test. > > "Enable regulator 'phy-3p0' to pass eye diagram test since it improve signal > qualilty." > > My question is why it just improve signal quality instead of make it work. > It should not work if no power supply. I'm cleaning up these old local patch and I'm not very clear about the history. But I think this 3p0 is not the main power of phy, it's just one of phy's power. I can only get below info about this reg-3p0: 37.6.2 Regulator 3P0 Register (PMU_REG_3P0) "This register defines the control and status bits for the 3.0V regulator powered by the host USB VBUS pin." I've just tested it works well without this phy-3p0. I'll rewrite the commit message to avoid confusion. > > > > > Signed-off-by: Xu Yang > > --- > > drivers/usb/phy/phy-mxs-usb.c | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c > > index 920a32cd094d..42fcc8ad9492 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,21 @@ 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"); > > Does binding doc update? Yes. > > > + if (PTR_ERR(mxs_phy->phy_3p0) == -EPROBE_DEFER) { > > + return -EPROBE_DEFER; > > + } else if (PTR_ERR(mxs_phy->phy_3p0) == -ENODEV) { > > + /* not exist */ > > + mxs_phy->phy_3p0 = NULL; > > + } else if (IS_ERR(mxs_phy->phy_3p0)) { > > + dev_err(&pdev->dev, "Getting regulator error: %ld\n", > > + PTR_ERR(mxs_phy->phy_3p0)); > > + return PTR_ERR(mxs_phy->phy_3p0); > > + } > > just need call dev_err_probe() Ok. Will change it. > > > + > > + 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); > > -- > > 2.34.1 > >