From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Daniel Mack <daniel@zonque.org>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Wolfram Sang <wsa@the-dreams.de>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>, Felipe Balbi <balbi@ti.com>,
Jiri Slaby <jslaby@suse.cz>,
linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-serial@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp
Date: Mon, 17 Nov 2014 19:44:28 +0100 [thread overview]
Message-ID: <878uj98y5v.fsf@free.fr> (raw)
In-Reply-To: <1416236863-20898-3-git-send-email-dbaryshkov@gmail.com> (Dmitry Eremin-Solenikov's message of "Mon, 17 Nov 2014 18:07:41 +0300")
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> writes:
> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
> drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index 42f7eeb..e4964ee 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -103,8 +103,8 @@ static const char ep0name [] = "ep0";
>
> /* IXP doesn't yet support <linux/clk.h> */
> #define clk_get(dev,name) NULL
> -#define clk_enable(clk) do { } while (0)
> -#define clk_disable(clk) do { } while (0)
> +#define clk_prepare_enable(clk) do { } while (0)
> +#define clk_disable_unprepare(clk) do { } while (0)
> #define clk_put(clk) do { } while (0)
>
> #endif
> @@ -932,7 +932,7 @@ static int pullup(struct pxa25x_udc *udc)
> if (!udc->active) {
> udc->active = 1;
> /* Enable clock for USB device */
> - clk_enable(udc->clk);
> + clk_prepare_enable(udc->clk);
Guess what, Russell's remark on i2c and serial made me cross-check. And there
is a case where this will be called in irq context too ...
See :
-> do_IRQ
-> lubbock_vbus_irq()
-> pxa25x_udc_vbus_session()
-> pullup()
-> clk_prepare_enable()
-> CRACK
Note that your patch is not really the faulty one, I think a threaded irq
instead of the "raw" irq should do the trick. And it is granted on UDC api that
vbus function is called in a "sleeping" context (Felipe correct me if I'm
wrong), so a patch to fix this before your current code would be fine.
Cheers.
--
Robert
WARNING: multiple messages have this Message-ID (diff)
From: robert.jarzmik@free.fr (Robert Jarzmik)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp
Date: Mon, 17 Nov 2014 19:44:28 +0100 [thread overview]
Message-ID: <878uj98y5v.fsf@free.fr> (raw)
In-Reply-To: <1416236863-20898-3-git-send-email-dbaryshkov@gmail.com> (Dmitry Eremin-Solenikov's message of "Mon, 17 Nov 2014 18:07:41 +0300")
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> writes:
> Change clk_enable/disable() calls to clk_prepare_enable() and
> clk_disable_unprepare().
>
> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> ---
> drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index 42f7eeb..e4964ee 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -103,8 +103,8 @@ static const char ep0name [] = "ep0";
>
> /* IXP doesn't yet support <linux/clk.h> */
> #define clk_get(dev,name) NULL
> -#define clk_enable(clk) do { } while (0)
> -#define clk_disable(clk) do { } while (0)
> +#define clk_prepare_enable(clk) do { } while (0)
> +#define clk_disable_unprepare(clk) do { } while (0)
> #define clk_put(clk) do { } while (0)
>
> #endif
> @@ -932,7 +932,7 @@ static int pullup(struct pxa25x_udc *udc)
> if (!udc->active) {
> udc->active = 1;
> /* Enable clock for USB device */
> - clk_enable(udc->clk);
> + clk_prepare_enable(udc->clk);
Guess what, Russell's remark on i2c and serial made me cross-check. And there
is a case where this will be called in irq context too ...
See :
-> do_IRQ
-> lubbock_vbus_irq()
-> pxa25x_udc_vbus_session()
-> pullup()
-> clk_prepare_enable()
-> CRACK
Note that your patch is not really the faulty one, I think a threaded irq
instead of the "raw" irq should do the trick. And it is granted on UDC api that
vbus function is called in a "sleeping" context (Felipe correct me if I'm
wrong), so a patch to fix this before your current code would be fine.
Cheers.
--
Robert
next prev parent reply other threads:[~2014-11-17 18:44 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 15:07 [PATCH V2 1/5] serial: pxa: prepare/unprepare clocks Dmitry Eremin-Solenikov
2014-11-17 15:07 ` Dmitry Eremin-Solenikov
2014-11-17 15:07 ` [PATCH V2 2/5] i2c: " Dmitry Eremin-Solenikov
2014-11-17 15:07 ` Dmitry Eremin-Solenikov
2014-11-17 15:51 ` Russell King - ARM Linux
2014-11-17 15:51 ` Russell King - ARM Linux
[not found] ` <1416236863-20898-2-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-17 18:26 ` Wolfram Sang
2014-11-17 18:26 ` Wolfram Sang
2014-11-17 15:07 ` [PATCH V2 4/5] mfd: t7l66xb: " Dmitry Eremin-Solenikov
2014-11-17 15:07 ` Dmitry Eremin-Solenikov
2014-11-18 13:14 ` Lee Jones
2014-11-18 13:14 ` Lee Jones
[not found] ` <1416236863-20898-1-git-send-email-dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-17 15:07 ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Dmitry Eremin-Solenikov
2014-11-17 15:07 ` Dmitry Eremin-Solenikov
2014-11-17 18:44 ` Robert Jarzmik [this message]
2014-11-17 18:44 ` Robert Jarzmik
2014-11-17 20:05 ` Dmitry Eremin-Solenikov
2014-11-17 20:07 ` Russell King - ARM Linux
2014-11-17 20:09 ` Robert Jarzmik
2014-11-17 23:50 ` Dmitry Eremin-Solenikov
2014-11-19 20:29 ` Robert Jarzmik
2014-11-19 21:11 ` Dmitry Eremin-Solenikov
2014-11-22 13:56 ` Robert Jarzmik
2014-11-22 15:44 ` Dmitry Eremin-Solenikov
2014-11-22 17:18 ` Robert Jarzmik
2014-11-22 17:48 ` Dmitry Eremin-Solenikov
2014-11-22 17:49 ` Robert Jarzmik
2014-11-22 17:51 ` Dmitry Eremin-Solenikov
2014-11-24 7:53 ` Robert Jarzmik
2014-11-26 22:12 ` Robert Jarzmik
2014-11-26 22:19 ` Dmitry Eremin-Solenikov
[not found] ` <87zjbd1tb0.fsf_-_@free.fr>
2014-11-26 22:39 ` Lubbock interrupts fix (was lubbock udc phy) Dmitry Eremin-Solenikov
2014-11-18 15:49 ` [PATCH V2 3/5] usb: gadget: pxa25x_udc: prepare/unprepare clocks in pxa-ssp Felipe Balbi
2014-11-17 15:07 ` [PATCH V2 5/5] mfd: tc6387xb: prepare/unprepare clocks Dmitry Eremin-Solenikov
2014-11-17 15:07 ` Dmitry Eremin-Solenikov
2014-11-18 12:04 ` Lee Jones
2014-11-18 12:04 ` Lee Jones
2014-11-17 15:51 ` [PATCH V2 1/5] serial: pxa: " Russell King - ARM Linux
2014-11-17 15:51 ` Russell King - ARM Linux
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=878uj98y5v.fsf@free.fr \
--to=robert.jarzmik@free.fr \
--cc=balbi@ti.com \
--cc=daniel@zonque.org \
--cc=dbaryshkov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=haojian.zhuang@gmail.com \
--cc=jslaby@suse.cz \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sameo@linux.intel.com \
--cc=wsa@the-dreams.de \
/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.