From: Richard Zhu <hongxing.zhu@nxp.com> To: Lucas Stach <l.stach@pengutronix.de>, "bhelgaas@google.com" <bhelgaas@google.com>, "lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com> Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>, dl-linux-imx <linux-imx@nxp.com>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "kernel@pengutronix.de" <kernel@pengutronix.de> Subject: RE: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link never came up Date: Wed, 20 Oct 2021 03:22:28 +0000 [thread overview] Message-ID: <AS8PR04MB8676D56073721F622FCB419E8CBE9@AS8PR04MB8676.eurprd04.prod.outlook.com> (raw) In-Reply-To: <AS8PR04MB8676CC1AFB9399776F75156F8CBD9@AS8PR04MB8676.eurprd04.prod.outlook.com> > -----Original Message----- > From: Richard Zhu > Sent: Tuesday, October 19, 2021 3:40 PM > To: Lucas Stach <l.stach@pengutronix.de>; bhelgaas@google.com; > lorenzo.pieralisi@arm.com > Cc: linux-pci@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de > Subject: RE: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link > never came up > > > -----Original Message----- > > From: Lucas Stach <l.stach@pengutronix.de> > > Sent: Saturday, October 16, 2021 2:23 AM > > To: Richard Zhu <hongxing.zhu@nxp.com>; bhelgaas@google.com; > > lorenzo.pieralisi@arm.com > > Cc: linux-pci@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > kernel@pengutronix.de > > Subject: Re: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when > > link never came up > > > > Am Freitag, dem 15.10.2021 um 14:05 +0800 schrieb Richard Zhu: > > > When PCIe PHY link never came up and vpcie regulator is present, > > > there would be following dump when try to put the regulator. > > > Disable this regulator to fix this dump when link never came up. > > > > > > imx6q-pcie 33800000.pcie: Phy link never came up > > > imx6q-pcie: probe of 33800000.pcie failed with error -110 > > > ------------[ cut here ]------------ > > > WARNING: CPU: 3 PID: 119 at drivers/regulator/core.c:2256 > > _regulator_put.part.0+0x14c/0x158 > > > Modules linked in: > > > CPU: 3 PID: 119 Comm: kworker/u8:2 Not tainted > > 5.13.0-rc7-next-20210625-94710-ge4e92b2588a3 #10 > > > Hardware name: FSL i.MX8MM EVK board (DT) > > > Workqueue: events_unbound async_run_entry_fn > > > pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) > > > pc : _regulator_put.part.0+0x14c/0x158 > > > lr : regulator_put+0x34/0x48 > > > sp : ffff8000122ebb30 > > > x29: ffff8000122ebb30 x28: ffff800011be7000 x27: > 0000000000000000 > > > x26: 0000000000000000 x25: 0000000000000000 x24: > ffff00000025f2bc > > > x23: ffff00000025f2c0 x22: ffff00000025f010 x21: ffff8000122ebc18 > > > x20: ffff800011e3fa60 x19: ffff00000375fd80 x18: 0000000000000010 > > > x17: 000000040044ffff x16: 00400032b5503510 x15: > > 0000000000000108 > > > x14: ffff0000003cc938 x13: 00000000ffffffea x12: 0000000000000000 > > > x11: 0000000000000000 x10: ffff80001076ba88 x9 : ffff80001076a540 > > > x8 : ffff00000025f2c0 x7 : ffff0000001f4450 x6 : ffff000000176cd8 > > > x5 : ffff000003857880 x4 : 0000000000000000 x3 : ffff800011e3fe30 > > > x2 : ffff0000003cc4c0 x1 : 0000000000000000 x0 : 0000000000000001 > > > Call trace: > > > _regulator_put.part.0+0x14c/0x158 > > > regulator_put+0x34/0x48 > > > devm_regulator_release+0x10/0x18 > > > release_nodes+0x38/0x60 > > > devres_release_all+0x88/0xd0 > > > really_probe+0xd0/0x2e8 > > > __driver_probe_device+0x74/0xd8 > > > driver_probe_device+0x7c/0x108 > > > __device_attach_driver+0x8c/0xd0 > > > bus_for_each_drv+0x74/0xc0 > > > __device_attach_async_helper+0xb4/0xd8 > > > async_run_entry_fn+0x30/0x100 > > > process_one_work+0x19c/0x320 > > > worker_thread+0x48/0x418 > > > kthread+0x14c/0x158 > > > ret_from_fork+0x10/0x18 > > > ---[ end trace 3664ca4a50ce849b ]--- > > > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > > --- > > > drivers/pci/controller/dwc/pci-imx6.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c > > > b/drivers/pci/controller/dwc/pci-imx6.c > > > index 3372775834a2..cc837f8bf6d4 100644 > > > --- a/drivers/pci/controller/dwc/pci-imx6.c > > > +++ b/drivers/pci/controller/dwc/pci-imx6.c > > > @@ -853,6 +853,8 @@ static int imx6_pcie_start_link(struct dw_pcie > *pci) > > > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), > > > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); > > > imx6_pcie_reset_phy(imx6_pcie); > > > + if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > > 0) > > > + regulator_disable(imx6_pcie->vpcie); > > > > This doesn't seem like the right place to add this. I guess it would > > be better to have proper error handling after dw_pcie_host_init to > > roll back things like the clock and regulator enable. > [Richard Zhu] This is good suggestion. It's make sense that move the regulator > disable to the dw_pcie_host_init error handling since the regulator have the > enabled check, before to disable it. > But it seems that there are some potential problems when do the similar > operations to the clocks disable here. > Because that the dw_pcie_host_init might have some error returns when the > host_init is not invoked at all. > How to handle this situation although this is one corner case? > [Richard Zhu] I have an idea to handle this case. Add one more callback(e.x: host_exit() ) into dw_pcie_host_ops struct, then do the host_exit() when there is a error return after host_init() is invoked. How about this solution? I would send the v3 patch-set later if you don't say no to this method. BR Richard > Best Regards > Richard Zhu > > > > Regards, > > Lucas > > > > > return ret; > > > } > > > > >
WARNING: multiple messages have this Message-ID (diff)
From: Richard Zhu <hongxing.zhu@nxp.com> To: Lucas Stach <l.stach@pengutronix.de>, "bhelgaas@google.com" <bhelgaas@google.com>, "lorenzo.pieralisi@arm.com" <lorenzo.pieralisi@arm.com> Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>, dl-linux-imx <linux-imx@nxp.com>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "kernel@pengutronix.de" <kernel@pengutronix.de> Subject: RE: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link never came up Date: Wed, 20 Oct 2021 03:22:28 +0000 [thread overview] Message-ID: <AS8PR04MB8676D56073721F622FCB419E8CBE9@AS8PR04MB8676.eurprd04.prod.outlook.com> (raw) In-Reply-To: <AS8PR04MB8676CC1AFB9399776F75156F8CBD9@AS8PR04MB8676.eurprd04.prod.outlook.com> > -----Original Message----- > From: Richard Zhu > Sent: Tuesday, October 19, 2021 3:40 PM > To: Lucas Stach <l.stach@pengutronix.de>; bhelgaas@google.com; > lorenzo.pieralisi@arm.com > Cc: linux-pci@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > kernel@pengutronix.de > Subject: RE: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link > never came up > > > -----Original Message----- > > From: Lucas Stach <l.stach@pengutronix.de> > > Sent: Saturday, October 16, 2021 2:23 AM > > To: Richard Zhu <hongxing.zhu@nxp.com>; bhelgaas@google.com; > > lorenzo.pieralisi@arm.com > > Cc: linux-pci@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>; > > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > kernel@pengutronix.de > > Subject: Re: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when > > link never came up > > > > Am Freitag, dem 15.10.2021 um 14:05 +0800 schrieb Richard Zhu: > > > When PCIe PHY link never came up and vpcie regulator is present, > > > there would be following dump when try to put the regulator. > > > Disable this regulator to fix this dump when link never came up. > > > > > > imx6q-pcie 33800000.pcie: Phy link never came up > > > imx6q-pcie: probe of 33800000.pcie failed with error -110 > > > ------------[ cut here ]------------ > > > WARNING: CPU: 3 PID: 119 at drivers/regulator/core.c:2256 > > _regulator_put.part.0+0x14c/0x158 > > > Modules linked in: > > > CPU: 3 PID: 119 Comm: kworker/u8:2 Not tainted > > 5.13.0-rc7-next-20210625-94710-ge4e92b2588a3 #10 > > > Hardware name: FSL i.MX8MM EVK board (DT) > > > Workqueue: events_unbound async_run_entry_fn > > > pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) > > > pc : _regulator_put.part.0+0x14c/0x158 > > > lr : regulator_put+0x34/0x48 > > > sp : ffff8000122ebb30 > > > x29: ffff8000122ebb30 x28: ffff800011be7000 x27: > 0000000000000000 > > > x26: 0000000000000000 x25: 0000000000000000 x24: > ffff00000025f2bc > > > x23: ffff00000025f2c0 x22: ffff00000025f010 x21: ffff8000122ebc18 > > > x20: ffff800011e3fa60 x19: ffff00000375fd80 x18: 0000000000000010 > > > x17: 000000040044ffff x16: 00400032b5503510 x15: > > 0000000000000108 > > > x14: ffff0000003cc938 x13: 00000000ffffffea x12: 0000000000000000 > > > x11: 0000000000000000 x10: ffff80001076ba88 x9 : ffff80001076a540 > > > x8 : ffff00000025f2c0 x7 : ffff0000001f4450 x6 : ffff000000176cd8 > > > x5 : ffff000003857880 x4 : 0000000000000000 x3 : ffff800011e3fe30 > > > x2 : ffff0000003cc4c0 x1 : 0000000000000000 x0 : 0000000000000001 > > > Call trace: > > > _regulator_put.part.0+0x14c/0x158 > > > regulator_put+0x34/0x48 > > > devm_regulator_release+0x10/0x18 > > > release_nodes+0x38/0x60 > > > devres_release_all+0x88/0xd0 > > > really_probe+0xd0/0x2e8 > > > __driver_probe_device+0x74/0xd8 > > > driver_probe_device+0x7c/0x108 > > > __device_attach_driver+0x8c/0xd0 > > > bus_for_each_drv+0x74/0xc0 > > > __device_attach_async_helper+0xb4/0xd8 > > > async_run_entry_fn+0x30/0x100 > > > process_one_work+0x19c/0x320 > > > worker_thread+0x48/0x418 > > > kthread+0x14c/0x158 > > > ret_from_fork+0x10/0x18 > > > ---[ end trace 3664ca4a50ce849b ]--- > > > > > > Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> > > > --- > > > drivers/pci/controller/dwc/pci-imx6.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c > > > b/drivers/pci/controller/dwc/pci-imx6.c > > > index 3372775834a2..cc837f8bf6d4 100644 > > > --- a/drivers/pci/controller/dwc/pci-imx6.c > > > +++ b/drivers/pci/controller/dwc/pci-imx6.c > > > @@ -853,6 +853,8 @@ static int imx6_pcie_start_link(struct dw_pcie > *pci) > > > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), > > > dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); > > > imx6_pcie_reset_phy(imx6_pcie); > > > + if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > > 0) > > > + regulator_disable(imx6_pcie->vpcie); > > > > This doesn't seem like the right place to add this. I guess it would > > be better to have proper error handling after dw_pcie_host_init to > > roll back things like the clock and regulator enable. > [Richard Zhu] This is good suggestion. It's make sense that move the regulator > disable to the dw_pcie_host_init error handling since the regulator have the > enabled check, before to disable it. > But it seems that there are some potential problems when do the similar > operations to the clocks disable here. > Because that the dw_pcie_host_init might have some error returns when the > host_init is not invoked at all. > How to handle this situation although this is one corner case? > [Richard Zhu] I have an idea to handle this case. Add one more callback(e.x: host_exit() ) into dw_pcie_host_ops struct, then do the host_exit() when there is a error return after host_init() is invoked. How about this solution? I would send the v3 patch-set later if you don't say no to this method. BR Richard > Best Regards > Richard Zhu > > > > Regards, > > Lucas > > > > > return ret; > > > } > > > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-10-20 3:22 UTC|newest] Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-15 6:05 [RESEND v2 0/5] PCI: imx6: refine codes and add compliance tests mode support Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 6:05 ` [RESEND v2 1/5] PCI: imx6: Encapsulate the clock enable into one standalone function Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 18:13 ` Lucas Stach 2021-10-15 18:13 ` Lucas Stach 2021-10-19 7:32 ` Richard Zhu 2021-10-19 7:32 ` Richard Zhu 2021-10-15 6:05 ` [RESEND v2 2/5] PCI: imx6: Add the error propagation from host_init Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 18:16 ` Lucas Stach 2021-10-15 18:16 ` Lucas Stach 2021-10-19 7:33 ` Richard Zhu 2021-10-19 7:33 ` Richard Zhu 2021-10-15 6:05 ` [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link never came up Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 18:22 ` Lucas Stach 2021-10-15 18:22 ` Lucas Stach 2021-10-19 7:39 ` Richard Zhu 2021-10-19 7:39 ` Richard Zhu 2021-10-20 3:22 ` Richard Zhu [this message] 2021-10-20 3:22 ` Richard Zhu 2021-10-15 18:34 ` Fabio Estevam 2021-10-15 18:34 ` Fabio Estevam 2021-10-19 7:44 ` Richard Zhu 2021-10-19 7:44 ` Richard Zhu 2021-10-15 6:05 ` [RESEND v2 4/5] PCI: imx6: Fix the clock reference handling unbalance " Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 18:24 ` Lucas Stach 2021-10-15 18:24 ` Lucas Stach 2021-10-19 7:43 ` Richard Zhu 2021-10-19 7:43 ` Richard Zhu 2021-10-15 18:49 ` Bjorn Helgaas 2021-10-15 18:49 ` Bjorn Helgaas 2021-10-15 18:51 ` Bjorn Helgaas 2021-10-15 18:51 ` Bjorn Helgaas 2021-10-19 7:56 ` Richard Zhu 2021-10-19 7:56 ` Richard Zhu 2021-10-22 8:02 ` Richard Zhu 2021-10-22 8:02 ` Richard Zhu 2021-10-23 9:53 ` Krzysztof Wilczyński 2021-10-23 9:53 ` Krzysztof Wilczyński 2021-10-25 2:35 ` Richard Zhu 2021-10-25 2:35 ` Richard Zhu 2021-10-26 22:21 ` Bjorn Helgaas 2021-10-26 22:21 ` Bjorn Helgaas 2021-10-27 1:30 ` Richard Zhu 2021-10-27 1:30 ` Richard Zhu 2021-10-26 16:38 ` Bjorn Helgaas 2021-10-26 16:38 ` Bjorn Helgaas 2021-10-27 1:29 ` Richard Zhu 2021-10-27 1:29 ` Richard Zhu 2021-10-19 7:45 ` Richard Zhu 2021-10-19 7:45 ` Richard Zhu 2021-10-15 6:05 ` [RESEND v2 5/5] PCI: imx6: Add the compliance tests mode support Richard Zhu 2021-10-15 6:05 ` Richard Zhu 2021-10-15 18:28 ` Lucas Stach 2021-10-15 18:28 ` Lucas Stach 2021-10-19 8:12 ` Richard Zhu 2021-10-19 8:12 ` Richard Zhu
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=AS8PR04MB8676D56073721F622FCB419E8CBE9@AS8PR04MB8676.eurprd04.prod.outlook.com \ --to=hongxing.zhu@nxp.com \ --cc=bhelgaas@google.com \ --cc=kernel@pengutronix.de \ --cc=l.stach@pengutronix.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-imx@nxp.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pci@vger.kernel.org \ --cc=lorenzo.pieralisi@arm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.