All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: Shubhrajyoti <shubhrajyoti@ti.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	"Balbi, Felipe" <balbi@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Munegowda, Keshava" <keshava_mgowda@ti.com>,
	"Govindraj.R" <govindraj.raja@ti.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] ARM: OMAP: USB: fix warning on EHCI PHY reset path
Date: Wed, 28 Mar 2012 13:13:23 +0200	[thread overview]
Message-ID: <4F72F253.5020606@compulab.co.il> (raw)
In-Reply-To: <4F72E1F9.3020400@ti.com>

Hi Shubhrajyoti,

On 03/28/12 12:03, Shubhrajyoti wrote:
> On Tuesday 27 March 2012 07:38 PM, Igor Grinberg wrote:
>> When PHY reset pin is connected to a GPIO on external GPIO chip
>> (e.g. I2C), we should not call the gpio_set_value() function, but
>> gpio_set_value_cansleep().
> Why so ? Whats the error otherwise ?

Otherwise, we get a very confusing warnings:
WARNING: at /home/grinberg/git-repo/linux-omap/drivers/gpio/gpiolib.c:1584 __gpio_set_value+0x5c/0x64()
Modules linked in:
[<c001ae6c>] (unwind_backtrace+0x0/0xfc) from [<c003ba10>] (warn_slowpath_common+0x54/0x64)
[<c003ba10>] (warn_slowpath_common+0x54/0x64) from [<c003ba3c>] (warn_slowpath_null+0x1c/0x24)
[<c003ba3c>] (warn_slowpath_null+0x1c/0x24) from [<c0260860>] (__gpio_set_value+0x5c/0x64)
[<c0260860>] (__gpio_set_value+0x5c/0x64) from [<c035fde8>] (ehci_hcd_omap_probe+0x390/0x6c0)
[<c035fde8>] (ehci_hcd_omap_probe+0x390/0x6c0) from [<c02d59dc>] (platform_drv_probe+0x18/0x1c)
[<c02d59dc>] (platform_drv_probe+0x18/0x1c) from [<c02d44d0>] (really_probe+0x64/0x160)
[<c02d44d0>] (really_probe+0x64/0x160) from [<c02d4614>] (driver_probe_device+0x48/0x60)
[<c02d4614>] (driver_probe_device+0x48/0x60) from [<c02d46c0>] (__driver_attach+0x94/0x98)
[<c02d46c0>] (__driver_attach+0x94/0x98) from [<c02d2f4c>] (bus_for_each_dev+0x54/0x80)
[<c02d2f4c>] (bus_for_each_dev+0x54/0x80) from [<c02d3680>] (bus_add_driver+0xa8/0x2a4)
[<c02d3680>] (bus_add_driver+0xa8/0x2a4) from [<c02d4cbc>] (driver_register+0x78/0x184)
[<c02d4cbc>] (driver_register+0x78/0x184) from [<c062e744>] (ehci_hcd_init+0xd8/0x114)
[<c062e744>] (ehci_hcd_init+0xd8/0x114) from [<c0008758>] (do_one_initcall+0x34/0x184)
[<c0008758>] (do_one_initcall+0x34/0x184) from [<c0612248>] (do_basic_setup+0x34/0x40)
[<c0612248>] (do_basic_setup+0x34/0x40) from [<c06122b8>] (kernel_init+0x64/0xec)
[<c06122b8>] (kernel_init+0x64/0xec) from [<c00154cc>] (kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1e ]---

Because GPIOs can be used from atomic context, there are two versions
of GPIO control functions: gpio_<set|get>_value() and
gpio_<set|get>_value_cansleep().
The warning above means that the atomic context safe function
has been called, but the GPIO chip is not atomic safe - requires an I2C
transaction which may sleep and therefore a warning.

Now, for all on SoC GPIOs, the time for the gpio_set_value_cansleep()
call should not be different then the one for the gpio_set_value().
After my patch, the behavior should not change, but eliminate the warning
for external GPIO chip users.

>> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
>> ---
>> This patch depends on the patch from Keshava [1]:
>> ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue
>>
>> [1] http://www.spinics.net/lists/linux-omap/msg66774.html
>>
>>  drivers/usb/host/ehci-omap.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
>> index 5c78f9e..26e9241 100644
>> --- a/drivers/usb/host/ehci-omap.c
>> +++ b/drivers/usb/host/ehci-omap.c
>> @@ -258,10 +258,10 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
>>  		udelay(10);
>>  
>>  		if (gpio_is_valid(pdata->reset_gpio_port[0]))
>> -			gpio_set_value(pdata->reset_gpio_port[0], 1);
>> +			gpio_set_value_cansleep(pdata->reset_gpio_port[0], 1);
>>  
>>  		if (gpio_is_valid(pdata->reset_gpio_port[1]))
>> -			gpio_set_value(pdata->reset_gpio_port[1], 1);
>> +			gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
>>  	}
>>  
>>  	return 0;
> 
> 

-- 
Regards,
Igor.

  parent reply	other threads:[~2012-03-28 11:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 14:08 [PATCH] ARM: OMAP: USB: fix warning on EHCI PHY reset path Igor Grinberg
2012-03-28  8:52 ` Felipe Balbi
2012-03-28 10:53   ` Raja, Govindraj
     [not found]     ` <CAMrsUdJjwAN4haHOkrGfrpb9HnbsMLyUE4a5aLnCPKC2JdUt_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-03-28 11:33       ` Igor Grinberg
2012-03-28 12:01     ` Munegowda, Keshava
     [not found] ` <4F72E1F9.3020400@ti.com>
2012-03-28 11:13   ` Igor Grinberg [this message]
2012-03-28 13:04     ` Shubhrajyoti Datta
2012-04-19 14:10 ` Igor Grinberg
     [not found]   ` <4F901CCC.9000703-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2012-04-19 15:01     ` Alan Stern
2012-04-20 11:57       ` Felipe Balbi
2012-05-06  6:25         ` Igor Grinberg
2012-05-07  8:09           ` Samuel Ortiz
2012-05-07 11:46             ` Igor Grinberg
     [not found]               ` <4FA7B61B.3020604-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2012-05-07 12:17                 ` Samuel Ortiz
     [not found]           ` <4FA61941.5080603-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2012-05-07 14:04             ` Alan Stern
2012-05-07 14:27               ` Igor Grinberg
     [not found]                 ` <4FA7DBE6.3060809-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2012-05-07 14:48                   ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.1205071046350.1602-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-05-08  7:53                       ` Igor Grinberg
     [not found]                         ` <4FA8D108.7090004-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2012-05-08 16:24                           ` Greg Kroah-Hartman
2012-05-09  6:25                             ` Igor Grinberg
2012-05-09  7:31                             ` Igor Grinberg

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=4F72F253.5020606@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=balbi@ti.com \
    --cc=govindraj.raja@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=keshava_mgowda@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shubhrajyoti@ti.com \
    --cc=stern@rowland.harvard.edu \
    /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.