public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio-langwell: fix irq conflicts when DT is not used
@ 2013-05-06 23:11 David Cohen
  2013-05-07  7:59 ` Mika Westerberg
  2013-05-20 18:13 ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: David Cohen @ 2013-05-06 23:11 UTC (permalink / raw)
  To: grant.likely, linus.walleij; +Cc: mika.westerberg, linux-kernel, David Cohen

When DT is not used IOAPIC does not register irq domain. As result
IOAPIC won't care about gpio-langwell's virq and may cause conflict if
an irq number is equal to gpio-langwell's virq mapped beforehand.

This patch tells gpio_langwell to not ignore irq_base if != 0 and
preferably use it to avoid the conflict.

If DT is used, irq_base can safely be 0.

Signed-off-by: David Cohen <david.a.cohen@intel.com>
---
 drivers/gpio/gpio-langwell.c |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index c48901a..88644db 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -362,6 +362,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	resource_size_t start, len;
 	struct lnw_gpio *lnw;
 	u32 gpio_base;
+	u32 irq_base;
 	int retval;
 	int ngpio = id->driver_data;
 
@@ -383,6 +384,7 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 		retval = -EFAULT;
 		goto err_ioremap;
 	}
+	irq_base = *(u32 *)base;
 	gpio_base = *((u32 *)base + 1);
 	/* release the IO mapping, since we already get the info from bar1 */
 	iounmap(base);
@@ -403,13 +405,6 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 		goto err_ioremap;
 	}
 
-	lnw->domain = irq_domain_add_linear(pdev->dev.of_node, ngpio,
-					    &lnw_gpio_irq_ops, lnw);
-	if (!lnw->domain) {
-		retval = -ENOMEM;
-		goto err_ioremap;
-	}
-
 	lnw->reg_base = base;
 	lnw->chip.label = dev_name(&pdev->dev);
 	lnw->chip.request = lnw_gpio_request;
@@ -422,6 +417,14 @@ static int lnw_gpio_probe(struct pci_dev *pdev,
 	lnw->chip.ngpio = ngpio;
 	lnw->chip.can_sleep = 0;
 	lnw->pdev = pdev;
+
+	lnw->domain = irq_domain_add_simple(pdev->dev.of_node, ngpio, irq_base,
+					    &lnw_gpio_irq_ops, lnw);
+	if (!lnw->domain) {
+		retval = -ENOMEM;
+		goto err_ioremap;
+	}
+
 	pci_set_drvdata(pdev, lnw);
 	retval = gpiochip_add(&lnw->chip);
 	if (retval) {
-- 
1.7.10.4


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

* Re: [PATCH] gpio-langwell: fix irq conflicts when DT is not used
  2013-05-06 23:11 [PATCH] gpio-langwell: fix irq conflicts when DT is not used David Cohen
@ 2013-05-07  7:59 ` Mika Westerberg
  2013-05-07 16:34   ` David Cohen
  2013-05-20 18:13 ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Mika Westerberg @ 2013-05-07  7:59 UTC (permalink / raw)
  To: David Cohen; +Cc: grant.likely, linus.walleij, linux-kernel

On Mon, May 06, 2013 at 04:11:03PM -0700, David Cohen wrote:
> When DT is not used IOAPIC does not register irq domain. As result
> IOAPIC won't care about gpio-langwell's virq and may cause conflict if
> an irq number is equal to gpio-langwell's virq mapped beforehand.
> 
> This patch tells gpio_langwell to not ignore irq_base if != 0 and
> preferably use it to avoid the conflict.
> 
> If DT is used, irq_base can safely be 0.
> 
> Signed-off-by: David Cohen <david.a.cohen@intel.com>

Presuming that you have tested this on Medfield and it still works there.

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

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

* Re: [PATCH] gpio-langwell: fix irq conflicts when DT is not used
  2013-05-07  7:59 ` Mika Westerberg
@ 2013-05-07 16:34   ` David Cohen
  2013-05-15 17:01     ` David Cohen
  0 siblings, 1 reply; 5+ messages in thread
From: David Cohen @ 2013-05-07 16:34 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: grant.likely, linus.walleij, linux-kernel

On 05/07/2013 12:59 AM, Mika Westerberg wrote:
> On Mon, May 06, 2013 at 04:11:03PM -0700, David Cohen wrote:
>> When DT is not used IOAPIC does not register irq domain. As result
>> IOAPIC won't care about gpio-langwell's virq and may cause conflict if
>> an irq number is equal to gpio-langwell's virq mapped beforehand.
>>
>> This patch tells gpio_langwell to not ignore irq_base if != 0 and
>> preferably use it to avoid the conflict.
>>
>> If DT is used, irq_base can safely be 0.
>>
>> Signed-off-by: David Cohen <david.a.cohen@intel.com>
> Presuming that you have tested this on Medfield and it still works there.

Medfield and Clovertrail :)

Br, David

>
> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>


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

* Re: [PATCH] gpio-langwell: fix irq conflicts when DT is not used
  2013-05-07 16:34   ` David Cohen
@ 2013-05-15 17:01     ` David Cohen
  0 siblings, 0 replies; 5+ messages in thread
From: David Cohen @ 2013-05-15 17:01 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: grant.likely, linus.walleij, linux-kernel

Hi Grant,

On 05/07/2013 09:34 AM, David Cohen wrote:
> On 05/07/2013 12:59 AM, Mika Westerberg wrote:
>> On Mon, May 06, 2013 at 04:11:03PM -0700, David Cohen wrote:
>>> When DT is not used IOAPIC does not register irq domain. As result
>>> IOAPIC won't care about gpio-langwell's virq and may cause conflict if
>>> an irq number is equal to gpio-langwell's virq mapped beforehand.
>>>
>>> This patch tells gpio_langwell to not ignore irq_base if != 0 and
>>> preferably use it to avoid the conflict.
>>>
>>> If DT is used, irq_base can safely be 0.
>>>
>>> Signed-off-by: David Cohen <david.a.cohen@intel.com>
>> Presuming that you have tested this on Medfield and it still works 
>> there.
>
> Medfield and Clovertrail :)
>
> Br, David
>
>>
>> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Kindly ping :)
Comments?

Br, David


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

* Re: [PATCH] gpio-langwell: fix irq conflicts when DT is not used
  2013-05-06 23:11 [PATCH] gpio-langwell: fix irq conflicts when DT is not used David Cohen
  2013-05-07  7:59 ` Mika Westerberg
@ 2013-05-20 18:13 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2013-05-20 18:13 UTC (permalink / raw)
  To: David Cohen; +Cc: Grant Likely, Mika Westerberg, linux-kernel@vger.kernel.org

On Tue, May 7, 2013 at 1:11 AM, David Cohen <david.a.cohen@intel.com> wrote:

> When DT is not used IOAPIC does not register irq domain. As result
> IOAPIC won't care about gpio-langwell's virq and may cause conflict if
> an irq number is equal to gpio-langwell's virq mapped beforehand.
>
> This patch tells gpio_langwell to not ignore irq_base if != 0 and
> preferably use it to avoid the conflict.
>
> If DT is used, irq_base can safely be 0.
>
> Signed-off-by: David Cohen <david.a.cohen@intel.com>

Looks correct. Applied for rc-fixes with Mika's ACK.

Thanks!
Linus Walleij

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

end of thread, other threads:[~2013-05-20 18:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-06 23:11 [PATCH] gpio-langwell: fix irq conflicts when DT is not used David Cohen
2013-05-07  7:59 ` Mika Westerberg
2013-05-07 16:34   ` David Cohen
2013-05-15 17:01     ` David Cohen
2013-05-20 18:13 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox