From: Felipe Balbi <balbi@kernel.org>
To: Vicente Bergas <vicencb@gmail.com>, Robin Murphy <robin.murphy@arm.com>
Cc: Heiko Stuebner <heiko@sntech.de>,
Will Deacon <will.deacon@arm.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Matthias Brugger <mbrugger@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: kexec on rk3399
Date: Thu, 15 Aug 2019 09:06:02 +0300 [thread overview]
Message-ID: <87pnl7t12t.fsf@gmail.com> (raw)
In-Reply-To: <59055782-7fc2-4b16-af8b-a56fb845a43f@gmail.com>
Hi,
Vicente Bergas <vicencb@gmail.com> writes:
> On Wednesday, August 14, 2019 3:12:26 PM CEST, Robin Murphy wrote:
>> On 14/08/2019 13:53, Vicente Bergas wrote:
>>> On Monday, July 22, 2019 4:31:27 PM CEST, Vicente Bergas wrote: ...
>>
>> This particular change looks like it's implicitly specific to
>> RK3399, which wouldn't be ideal. Presumably if the core dwc3
>> driver implemented shutdown correctly (echoing parts of
>> dwc3_remove(), I guess) then the glue layers shouldn't need
>> anything special anyway.
>>
>> Robin.
>
> I just checked simple->resets from dwc3-of-simple.c and it is an array
> with multiple resets whereas dwc->reset from core.c is NULL.
> So the reset seems specific to the glue layers.
> Is there another way than resetting the thing that is
> generic enough to go to core.c and allows kexec?
This is a really odd 'failure'. We do full soft reset during driver
initialization on dwc3. We shouldn't need to assert reset on shutdown,
really.
I think the problem is here:
if (simple->pulse_resets) {
ret = reset_control_reset(simple->resets);
if (ret)
goto err_resetc_put;
} else {
ret = reset_control_deassert(simple->resets);
if (ret)
goto err_resetc_put;
}
Note that if pulse_resets is set, we will run a reset. But if
pulse_resets is false and need_reset is true, we deassert the reset.
I think below patch is enough:
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index bdac3e7d7b18..9a2f3e09aa2e 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -72,7 +72,15 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
ret = reset_control_reset(simple->resets);
if (ret)
goto err_resetc_put;
- } else {
+ }
+
+ if (simple->need_reset) {
+ ret = reset_control_assert(simple->resets);
+ if (ret)
+ goto err_resetc_put;
+
+ usleep_range(1000, 2000);
+
ret = reset_control_deassert(simple->resets);
if (ret)
goto err_resetc_put;
@@ -121,9 +129,6 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
clk_bulk_put_all(simple->num_clocks, simple->clks);
simple->num_clocks = 0;
- if (!simple->pulse_resets)
- reset_control_assert(simple->resets);
-
reset_control_put(simple->resets);
pm_runtime_disable(dev);
Can you test?
--
balbi
WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@kernel.org>
To: Vicente Bergas <vicencb@gmail.com>, Robin Murphy <robin.murphy@arm.com>
Cc: Matthias Brugger <mbrugger@suse.com>,
Heiko Stuebner <heiko@sntech.de>,
Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
linux-usb@vger.kernel.org, Will Deacon <will.deacon@arm.com>,
linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-kernel@lists.infradead.org
Subject: Re: kexec on rk3399
Date: Thu, 15 Aug 2019 09:06:02 +0300 [thread overview]
Message-ID: <87pnl7t12t.fsf@gmail.com> (raw)
In-Reply-To: <59055782-7fc2-4b16-af8b-a56fb845a43f@gmail.com>
Hi,
Vicente Bergas <vicencb@gmail.com> writes:
> On Wednesday, August 14, 2019 3:12:26 PM CEST, Robin Murphy wrote:
>> On 14/08/2019 13:53, Vicente Bergas wrote:
>>> On Monday, July 22, 2019 4:31:27 PM CEST, Vicente Bergas wrote: ...
>>
>> This particular change looks like it's implicitly specific to
>> RK3399, which wouldn't be ideal. Presumably if the core dwc3
>> driver implemented shutdown correctly (echoing parts of
>> dwc3_remove(), I guess) then the glue layers shouldn't need
>> anything special anyway.
>>
>> Robin.
>
> I just checked simple->resets from dwc3-of-simple.c and it is an array
> with multiple resets whereas dwc->reset from core.c is NULL.
> So the reset seems specific to the glue layers.
> Is there another way than resetting the thing that is
> generic enough to go to core.c and allows kexec?
This is a really odd 'failure'. We do full soft reset during driver
initialization on dwc3. We shouldn't need to assert reset on shutdown,
really.
I think the problem is here:
if (simple->pulse_resets) {
ret = reset_control_reset(simple->resets);
if (ret)
goto err_resetc_put;
} else {
ret = reset_control_deassert(simple->resets);
if (ret)
goto err_resetc_put;
}
Note that if pulse_resets is set, we will run a reset. But if
pulse_resets is false and need_reset is true, we deassert the reset.
I think below patch is enough:
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index bdac3e7d7b18..9a2f3e09aa2e 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -72,7 +72,15 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
ret = reset_control_reset(simple->resets);
if (ret)
goto err_resetc_put;
- } else {
+ }
+
+ if (simple->need_reset) {
+ ret = reset_control_assert(simple->resets);
+ if (ret)
+ goto err_resetc_put;
+
+ usleep_range(1000, 2000);
+
ret = reset_control_deassert(simple->resets);
if (ret)
goto err_resetc_put;
@@ -121,9 +129,6 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
clk_bulk_put_all(simple->num_clocks, simple->clks);
simple->num_clocks = 0;
- if (!simple->pulse_resets)
- reset_control_assert(simple->resets);
-
reset_control_put(simple->resets);
pm_runtime_disable(dev);
Can you test?
--
balbi
_______________________________________________
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:[~2019-08-15 6:06 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 14:31 kexec on rk3399 Vicente Bergas
2019-07-22 14:31 ` Vicente Bergas
2019-07-22 14:46 ` Will Deacon
2019-07-22 14:46 ` Will Deacon
2019-07-22 16:08 ` Vicente Bergas
[not found] ` <ebcb52be-2063-4e2c-9a09-fdcacb94f855-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-07-22 14:47 ` Matthias Brugger
2019-07-22 14:47 ` Matthias Brugger
2019-07-22 16:56 ` Vicente Bergas
2019-07-22 14:54 ` Marc Zyngier
2019-07-22 14:54 ` Marc Zyngier
2019-07-22 17:05 ` Vicente Bergas
2019-07-22 17:35 ` Robin Murphy
[not found] ` <8f71e7de-7eaf-58c7-6471-c8eb01e656ce-5wv7dgnIgG8@public.gmane.org>
2019-07-22 18:53 ` Vicente Bergas
2019-07-22 18:53 ` Vicente Bergas
2019-07-23 13:32 ` Robin Murphy
2019-07-23 13:32 ` Robin Murphy
2019-08-14 12:53 ` Vicente Bergas
2019-08-14 12:53 ` Vicente Bergas
2019-08-14 12:53 ` Vicente Bergas
[not found] ` <c6993a1e-6fc2-44ab-b59e-152142e2ff4d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-14 13:06 ` Felipe Balbi
2019-08-14 13:06 ` Felipe Balbi
2019-08-14 13:06 ` Felipe Balbi
2019-08-14 13:15 ` Vicente Bergas
2019-08-14 13:15 ` Vicente Bergas
2019-08-14 13:15 ` Vicente Bergas
2019-08-15 6:00 ` Felipe Balbi
2019-08-15 6:00 ` Felipe Balbi
2019-08-14 13:12 ` Robin Murphy
2019-08-14 13:12 ` Robin Murphy
2019-08-15 1:15 ` Vicente Bergas
2019-08-15 1:15 ` Vicente Bergas
2019-08-15 1:15 ` Vicente Bergas
2019-08-15 6:06 ` Felipe Balbi [this message]
2019-08-15 6:06 ` Felipe Balbi
2019-08-15 11:09 ` Robin Murphy
2019-08-15 11:09 ` Robin Murphy
2019-08-17 17:41 ` [PATCH] usb: dwc3: Add shutdown to platform_driver Vicente Bergas
2019-08-17 17:41 ` Vicente Bergas
2019-08-27 11:45 ` Vicente Bergas
2019-08-27 11:45 ` Vicente Bergas
[not found] ` <8d48017a-64c5-4b25-8d85-113ffcf502c9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-08-27 11:53 ` Felipe Balbi
2019-08-27 11:53 ` Felipe Balbi
2019-08-27 11:53 ` Felipe Balbi
2019-08-27 12:16 ` Vicente Bergas
2019-08-27 12:16 ` Vicente Bergas
2019-09-09 15:07 ` Vicente Bergas
2019-09-09 15:07 ` Vicente Bergas
[not found] ` <0edb55d4-3bad-47ac-9d29-8d994d182e67-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-23 6:31 ` Felipe Balbi
2019-10-23 6:31 ` Felipe Balbi
2019-10-23 6:31 ` Felipe Balbi
2019-10-24 12:15 ` Vicente Bergas
2019-10-24 12:15 ` Vicente Bergas
2019-10-24 12:15 ` Vicente Bergas
2019-10-25 10:25 ` Felipe Balbi
2019-10-25 10:25 ` Felipe Balbi
2019-10-25 10:25 ` Felipe Balbi
2019-10-25 10:42 ` Vicente Bergas
2019-10-25 10:42 ` Vicente Bergas
2019-10-25 10:42 ` Vicente Bergas
2019-09-19 11:36 ` Vicente Bergas
2019-09-19 11:36 ` Vicente Bergas
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=87pnl7t12t.fsf@gmail.com \
--to=balbi@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mbrugger@suse.com \
--cc=robin.murphy@arm.com \
--cc=vicencb@gmail.com \
--cc=will.deacon@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: link
Be 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.