Skip to contentSkip to conversation

pinctrl: baytrail: Clear DIRECT_IRQ bit

PATCH Superseded Loic Poulain 5 participants 10 messages Sep 17, 2014 – Sep 24, 2014 Pin control

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pinctrl: baytrail: Clear DIRECT_IRQ bit

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

---
v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning

 drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-baytrail.c +4 -1
index 701a646..77db3db 100644
@@ -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

#1 lore raw
Quoted 2 lines · Loic Poulain

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.

Quoted 13 lines

---
v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning

 drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-baytrail.c +0 -0
index 701a646..77db3db 100644

drivers/pinctrl/pinctrl-baytrail.c static int byt_irq_type(struct irq_data *d, unsigned type) · line 234

Quoted 5 lines
drivers/pinctrl/pinctrl-baytrail.c +2 -0
@@ -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 :-)

Quoted 11 lines
drivers/pinctrl/pinctrl-baytrail.c +2 -2
 	/* 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

#2 lore raw

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

Quoted 45 lines · Mika Westerberg
Quoted 2 lines · Loic Poulain

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.

Quoted 12 lines

---
v2: Apply over ff998356b644ebe723127bd9eec6040b59a4a4f6 + add Warning

  drivers/pinctrl/pinctrl-baytrail.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pinctrl/pinctrl-baytrail.c +0 -0
index 701a646..77db3db 100644

drivers/pinctrl/pinctrl-baytrail.c static int byt_irq_type(struct irq_data *d, unsigned type) · line 234

Quoted 5 lines
drivers/pinctrl/pinctrl-baytrail.c +2 -0
@@ -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 :-)

Quoted 11 lines
drivers/pinctrl/pinctrl-baytrail.c +2 -2
  	/* 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

Signature · 2 lines
Intel Open Source Technology Center
http://oss.intel.com/
#3 lore raw
Quoted 4 lines · Loic Poulain

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.

Quoted 3 lines

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.

#4 lore raw
In reply to Mika Westerberg

Hi Mika,

Quoted 9 lines · Mika Westerberg
Quoted 2 lines · Loic Poulain

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.

Quoted 6 lines

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.

Signature · 13 lines
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.
#5 lore raw
Quoted 12 lines · Samuel Ortiz

Hi Mika,

Quoted 9 lines · Mika Westerberg
Quoted 2 lines · Loic Poulain

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.

Quoted 8 lines
Quoted 6 lines

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.

#6 lore raw
Quoted 16 lines · Mika Westerberg
Quoted 15 lines · Samuel Ortiz

Hi Mika,

Quoted 12 lines · Mika Westerberg
Quoted 2 lines · Loic Poulain

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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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.

#7 lore raw
In reply to Loic Poulain
Quoted 6 lines · Loic Poulain

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

---
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

#8 lore raw
Quoted 5 lines · Linus Walleij
Quoted 3 lines · Loic Poulain

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

Quoted 7 lines
Quoted 3 lines

---
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?

#9 lore raw

Yes I'm going to do a v3.

Regards,
Loic

Quoted 17 lines · Mika
Quoted 11 lines · Linus Walleij
Quoted 6 lines · Loic Poulain

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

---
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?

Signature · 2 lines
Intel Open Source Technology Center
http://oss.intel.com/