linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
@ 2014-09-17 13:47 Loic Poulain
  2014-09-18  7:49 ` Mika Westerberg
  2014-09-23 15:44 ` Linus Walleij
  0 siblings, 2 replies; 10+ messages in thread
From: Loic Poulain @ 2014-09-17 13:47 UTC (permalink / raw)
  To: linus.walleij, heikki.krogerus, mika.westerberg, mathias.nyman,
	samuel.ortiz
  Cc: linux-kernel, Loic Poulain

Direct Irq En bit can be initialized to a bad value.
This bit has to be cleared for io access mode.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
---
 v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning

 drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
index 701a646..77db3db 100644
--- a/drivers/pinctrl/pinctrl-baytrail.c
+++ b/drivers/pinctrl/pinctrl-baytrail.c
@@ -230,10 +230,13 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
 	spin_lock_irqsave(&vg->lock, flags);
 	value = readl(reg);

+	WARN(value & BYT_DIRECT_IRQ_EN, "Clearing direct_irq_en bit");
+
 	/* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits
 	 * are used to indicate high and low level triggering
 	 */
-	value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL);
+	value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG |
+		   BYT_TRIG_LVL);

 	switch (type) {
 	case IRQ_TYPE_LEVEL_HIGH:
--
1.8.3.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-17 13:47 [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit Loic Poulain
@ 2014-09-18  7:49 ` Mika Westerberg
  2014-09-18  9:31   ` Loic Poulain
  2014-09-18  9:41   ` Samuel Ortiz
  2014-09-23 15:44 ` Linus Walleij
  1 sibling, 2 replies; 10+ messages in thread
From: Mika Westerberg @ 2014-09-18  7:49 UTC (permalink / raw)
  To: Loic Poulain
  Cc: linus.walleij, heikki.krogerus, mathias.nyman, samuel.ortiz,
	linux-kernel, Eric Ernst

On Wed, Sep 17, 2014 at 03:47:01PM +0200, Loic Poulain wrote:
> Direct Irq En bit can be initialized to a bad value.
> This bit has to be cleared for io access mode.

+Eric

I would like to have a bit better explanation *why* this bit needs to be
cleared.

Also want to ask Eric (who added the WARN()), is there something
preventing us to do this? I remember last time you said that we are not
supposed to change this bit runtime.

My preference is that we get rid of the WARN() and just unconditionally
clear the bit.

> 
> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
> ---
>  v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning
> 
>  drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
> index 701a646..77db3db 100644
> --- a/drivers/pinctrl/pinctrl-baytrail.c
> +++ b/drivers/pinctrl/pinctrl-baytrail.c
> @@ -230,10 +230,13 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
>  	spin_lock_irqsave(&vg->lock, flags);
>  	value = readl(reg);
> 
> +	WARN(value & BYT_DIRECT_IRQ_EN, "Clearing direct_irq_en bit");
> +

I wonder how the average user react when this pops up in the dmesg :-)

>  	/* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits
>  	 * are used to indicate high and low level triggering
>  	 */
> -	value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL);
> +	value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG |
> +		   BYT_TRIG_LVL);
> 
>  	switch (type) {
>  	case IRQ_TYPE_LEVEL_HIGH:
> --
> 1.8.3.2

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-18  7:49 ` Mika Westerberg
@ 2014-09-18  9:31   ` Loic Poulain
  2014-09-18  9:53     ` Mika Westerberg
  2014-09-18  9:41   ` Samuel Ortiz
  1 sibling, 1 reply; 10+ messages in thread
From: Loic Poulain @ 2014-09-18  9:31 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: linus.walleij, heikki.krogerus, mathias.nyman, samuel.ortiz,
	linux-kernel, Eric Ernst

Warn seems necessary because we unconditionally change
the pin behavior, I didn't meet any case where direct irq is truly
used on our platform. But maybe it could happen?
Don't want to cause any hidden regression.

Moreover if it is confirmed that is an hardware issue (BIOS),
We can just keep this patch locally as a workaround and revert
it later once our BIOS fixed.

Regards,
Loic

On 18/09/2014 09:49, Mika Westerberg wrote:
> On Wed, Sep 17, 2014 at 03:47:01PM +0200, Loic Poulain wrote:
>> Direct Irq En bit can be initialized to a bad value.
>> This bit has to be cleared for io access mode.
> +Eric
>
> I would like to have a bit better explanation *why* this bit needs to be
> cleared.
>
> Also want to ask Eric (who added the WARN()), is there something
> preventing us to do this? I remember last time you said that we are not
> supposed to change this bit runtime.
>
> My preference is that we get rid of the WARN() and just unconditionally
> clear the bit.
>
>> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
>> ---
>>   v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning
>>
>>   drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c
>> index 701a646..77db3db 100644
>> --- a/drivers/pinctrl/pinctrl-baytrail.c
>> +++ b/drivers/pinctrl/pinctrl-baytrail.c
>> @@ -230,10 +230,13 @@ static int byt_irq_type(struct irq_data *d, unsigned type)
>>   	spin_lock_irqsave(&vg->lock, flags);
>>   	value = readl(reg);
>>
>> +	WARN(value & BYT_DIRECT_IRQ_EN, "Clearing direct_irq_en bit");
>> +
> I wonder how the average user react when this pops up in the dmesg :-)
>
>>   	/* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits
>>   	 * are used to indicate high and low level triggering
>>   	 */
>> -	value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL);
>> +	value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG |
>> +		   BYT_TRIG_LVL);
>>
>>   	switch (type) {
>>   	case IRQ_TYPE_LEVEL_HIGH:
>> --
>> 1.8.3.2

-- 
Intel Open Source Technology Center
http://oss.intel.com/


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-18  7:49 ` Mika Westerberg
  2014-09-18  9:31   ` Loic Poulain
@ 2014-09-18  9:41   ` Samuel Ortiz
  2014-09-18  9:55     ` Mika Westerberg
  1 sibling, 1 reply; 10+ messages in thread
From: Samuel Ortiz @ 2014-09-18  9:41 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Loic Poulain, linus.walleij, heikki.krogerus, mathias.nyman,
	linux-kernel, Eric Ernst

Hi Mika,

On Thu, Sep 18, 2014 at 10:49:43AM +0300, Mika Westerberg wrote:
> On Wed, Sep 17, 2014 at 03:47:01PM +0200, Loic Poulain wrote:
> > Direct Irq En bit can be initialized to a bad value.
> > This bit has to be cleared for io access mode.
> 
> +Eric
> 
> I would like to have a bit better explanation *why* this bit needs to be
> cleared.
> 
> Also want to ask Eric (who added the WARN()), is there something
> preventing us to do this? I remember last time you said that we are not
> supposed to change this bit runtime.
> 
> My preference is that we get rid of the WARN() and just unconditionally
> clear the bit.
I'd keep the warn though, as it most likely shows a buggy firmware
implementation.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-18  9:31   ` Loic Poulain
@ 2014-09-18  9:53     ` Mika Westerberg
  0 siblings, 0 replies; 10+ messages in thread
From: Mika Westerberg @ 2014-09-18  9:53 UTC (permalink / raw)
  To: Loic Poulain
  Cc: linus.walleij, heikki.krogerus, mathias.nyman, samuel.ortiz,
	linux-kernel, Eric Ernst

On Thu, Sep 18, 2014 at 11:31:35AM +0200, Loic Poulain wrote:
> Warn seems necessary because we unconditionally change
> the pin behavior, I didn't meet any case where direct irq is truly
> used on our platform. But maybe it could happen?
> Don't want to cause any hidden regression.

The datasheet says 

"""
This bit should be cleared if io access mode is selected
for this pad
"""

If I interpret it right, it means that whenever this pad is functioning
as a GPIO the flag should be cleared. That's precisely the case here.

> Moreover if it is confirmed that is an hardware issue (BIOS),
> We can just keep this patch locally as a workaround and revert
> it later once our BIOS fixed.

True but only if there aren't any machines out there with this flaw in
the BIOS.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-18  9:41   ` Samuel Ortiz
@ 2014-09-18  9:55     ` Mika Westerberg
  2014-09-18 23:59       ` eric ernst
  0 siblings, 1 reply; 10+ messages in thread
From: Mika Westerberg @ 2014-09-18  9:55 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Loic Poulain, linus.walleij, heikki.krogerus, mathias.nyman,
	linux-kernel, Eric Ernst

On Thu, Sep 18, 2014 at 11:41:13AM +0200, Samuel Ortiz wrote:
> Hi Mika,
> 
> On Thu, Sep 18, 2014 at 10:49:43AM +0300, Mika Westerberg wrote:
> > On Wed, Sep 17, 2014 at 03:47:01PM +0200, Loic Poulain wrote:
> > > Direct Irq En bit can be initialized to a bad value.
> > > This bit has to be cleared for io access mode.
> > 
> > +Eric
> > 
> > I would like to have a bit better explanation *why* this bit needs to be
> > cleared.
> > 
> > Also want to ask Eric (who added the WARN()), is there something
> > preventing us to do this? I remember last time you said that we are not
> > supposed to change this bit runtime.
> > 
> > My preference is that we get rid of the WARN() and just unconditionally
> > clear the bit.
> I'd keep the warn though, as it most likely shows a buggy firmware
> implementation.

Fair enough :)

Maybe it could be more informative.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-18  9:55     ` Mika Westerberg
@ 2014-09-18 23:59       ` eric ernst
  0 siblings, 0 replies; 10+ messages in thread
From: eric ernst @ 2014-09-18 23:59 UTC (permalink / raw)
  To: Mika Westerberg, Samuel Ortiz
  Cc: Loic Poulain, linus.walleij, heikki.krogerus, mathias.nyman,
	linux-kernel


On 14-09-18 02:55 AM, Mika Westerberg wrote:
> On Thu, Sep 18, 2014 at 11:41:13AM +0200, Samuel Ortiz wrote:
>> Hi Mika,
>>
>> On Thu, Sep 18, 2014 at 10:49:43AM +0300, Mika Westerberg wrote:
>>> On Wed, Sep 17, 2014 at 03:47:01PM +0200, Loic Poulain wrote:
>>>> Direct Irq En bit can be initialized to a bad value.
>>>> This bit has to be cleared for io access mode.
>>> +Eric
>>>
>>> I would like to have a bit better explanation *why* this bit needs to be
>>> cleared.
>>>
>>> Also want to ask Eric (who added the WARN()), is there something
>>> preventing us to do this? I remember last time you said that we are not
>>> supposed to change this bit runtime.
>>>
>>> My preference is that we get rid of the WARN() and just unconditionally
>>> clear the bit.
>> I'd keep the warn though, as it most likely shows a buggy firmware
>> implementation.
> Fair enough :)
>
> Maybe it could be more informative.
Agreed - I think its safest to say "you're shooting yourself in the 
foot," rather than reinforcing what we think are the right pad settings.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-17 13:47 [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit Loic Poulain
  2014-09-18  7:49 ` Mika Westerberg
@ 2014-09-23 15:44 ` Linus Walleij
  2014-09-23 18:36   ` Westerberg, Mika
  1 sibling, 1 reply; 10+ messages in thread
From: Linus Walleij @ 2014-09-23 15:44 UTC (permalink / raw)
  To: Loic Poulain
  Cc: Heikki Krogerus, Westerberg, Mika, Mathias Nyman, Samuel Ortiz,
	linux-kernel

On Wed, Sep 17, 2014 at 3:47 PM, Loic Poulain <loic.poulain@intel.com> wrote:

> Direct Irq En bit can be initialized to a bad value.
> This bit has to be cleared for io access mode.
>
> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
> ---
>  v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning

I can't figure out if the maintainers like this patch or not.

If you want it applied, please ACK it explicitly.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-23 15:44 ` Linus Walleij
@ 2014-09-23 18:36   ` Westerberg, Mika
  2014-09-24  8:44     ` Loic Poulain
  0 siblings, 1 reply; 10+ messages in thread
From: Westerberg, Mika @ 2014-09-23 18:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Loic Poulain, Heikki Krogerus, Mathias Nyman, Samuel Ortiz, linux-kernel

On Tue, Sep 23, 2014 at 05:44:43PM +0200, Linus Walleij wrote:
> On Wed, Sep 17, 2014 at 3:47 PM, Loic Poulain <loic.poulain@intel.com> wrote:
> 
> > Direct Irq En bit can be initialized to a bad value.
> > This bit has to be cleared for io access mode.
> >
> > Signed-off-by: Loic Poulain <loic.poulain@intel.com>
> > ---
> >  v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning
> 
> I can't figure out if the maintainers like this patch or not.
> 
> If you want it applied, please ACK it explicitly.

I would like to get a bit better information in the changelog and the
warning message should be more informative. I'll ACK it after that is
done.

Loic, are you going to do that?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit
  2014-09-23 18:36   ` Westerberg, Mika
@ 2014-09-24  8:44     ` Loic Poulain
  0 siblings, 0 replies; 10+ messages in thread
From: Loic Poulain @ 2014-09-24  8:44 UTC (permalink / raw)
  To: Westerberg, Mika, Linus Walleij
  Cc: Heikki Krogerus, Mathias Nyman, Samuel Ortiz, linux-kernel

Yes I'm going to do a v3.

Regards,
Loic

On 23/09/2014 20:36, Westerberg, Mika wrote:
> On Tue, Sep 23, 2014 at 05:44:43PM +0200, Linus Walleij wrote:
>> On Wed, Sep 17, 2014 at 3:47 PM, Loic Poulain <loic.poulain@intel.com> wrote:
>>
>>> Direct Irq En bit can be initialized to a bad value.
>>> This bit has to be cleared for io access mode.
>>>
>>> Signed-off-by: Loic Poulain <loic.poulain@intel.com>
>>> ---
>>>   v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning
>> I can't figure out if the maintainers like this patch or not.
>>
>> If you want it applied, please ACK it explicitly.
> I would like to get a bit better information in the changelog and the
> warning message should be more informative. I'll ACK it after that is
> done.
>
> Loic, are you going to do that?

-- 
Intel Open Source Technology Center
http://oss.intel.com/


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-09-24  8:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-17 13:47 [PATCHv2] pinctrl: baytrail: Clear DIRECT_IRQ bit Loic Poulain
2014-09-18  7:49 ` Mika Westerberg
2014-09-18  9:31   ` Loic Poulain
2014-09-18  9:53     ` Mika Westerberg
2014-09-18  9:41   ` Samuel Ortiz
2014-09-18  9:55     ` Mika Westerberg
2014-09-18 23:59       ` eric ernst
2014-09-23 15:44 ` Linus Walleij
2014-09-23 18:36   ` Westerberg, Mika
2014-09-24  8:44     ` Loic Poulain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).