Skip to contentSkip to conversation

PL061 GPIO: Changing *_irq_chip_data with *_irq_data for real irqs.

PATCH RESEND New Viresh KUMAR 2 participants 4 messages Apr 21, 2010 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 PL061 GPIO: Changing *_irq_chip_data with *_irq_data for real irqs.

PL061 driver is using set_irq_chip_data and get_irq_chip_data for real irq lines. It must be using *_irq_data functions instead. As chip_data is used by interrupt controllers also, which makes vic write at incorrect addresses.

---
 drivers/gpio/pl061.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/pl061.c +3 -3
index 3ad1eeb..4b6c22d 100644
@@ -203,7 +203,7 @@ static struct irq_chip pl061_irqchip = {
 
 static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
 {
-	struct list_head *chip_list = get_irq_chip_data(irq);
+	struct list_head *chip_list = get_irq_data(irq);
 	struct list_head *ptr;
 	struct pl061_gpio *chip;
 
@@ -296,9 +296,9 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
 			goto iounmap;
 		}
 		INIT_LIST_HEAD(chip_list);
-		set_irq_chip_data(irq, chip_list);
+		set_irq_data(irq, chip_list);
 	} else
-		chip_list = get_irq_chip_data(irq);
+		chip_list = get_irq_data(irq);
 	list_add(&chip->list, chip_list);
 
 	for (i = 0; i < PL061_GPIO_NR; i++) {
Signature · 1 line
1.6.0.2
#1 lore raw

PATCH RESEND 1/1 PL061 GPIO: Setting gpio val after changing direction to OUT.

pl061_direction_output doesn't set value of gpio to value passed to it. This patch sets value of GPIO pin to requested value after changing direction to OUT.

---
 drivers/gpio/pl061.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/gpio/pl061.c +6 -0
index 4b6c22d..4f172ab 100644
@@ -90,6 +90,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
 	gpiodir = readb(chip->base + GPIODIR);
 	gpiodir |= 1 << offset;
 	writeb(gpiodir, chip->base + GPIODIR);
+
+	/*
+	 * gpio value is set again, because pl061 doesn't allow to set value of
+	 * a gpio pin before configuring it in OUT mode.
+	 */
+	writeb(!!value << offset, chip->base + (1 << (offset + 2)));
 	spin_unlock_irqrestore(&chip->lock, flags);
 
 	return 0;
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH RESEND 1/1 PL061 GPIO: Setting gpio val after changing direction to OUT.

Hi Viresh,

Quoted 5 lines · Viresh KUMAR

pl061_direction_output doesn't set value of gpio to value passed to it. This patch sets value of GPIO pin to requested value after changing direction to OUT.

baruch

Quoted 21 lines
---
 drivers/gpio/pl061.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/gpio/pl061.c +6 -0
index 4b6c22d..4f172ab 100644
@@ -90,6 +90,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
 	gpiodir = readb(chip->base + GPIODIR);
 	gpiodir |= 1 << offset;
 	writeb(gpiodir, chip->base + GPIODIR);
+
+	/*
+	 * gpio value is set again, because pl061 doesn't allow to set value of
+	 * a gpio pin before configuring it in OUT mode.
+	 */
+	writeb(!!value << offset, chip->base + (1 << (offset + 2)));
 	spin_unlock_irqrestore(&chip->lock, flags);
 
 	return 0;
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#3 lore raw

PATCH RESEND 1/1 PL061 GPIO: Changing *_irq_chip_data with *_irq_data for real irqs.

In reply to Viresh KUMAR

Hi Viresh,

Quoted 6 lines · Viresh KUMAR

PL061 driver is using set_irq_chip_data and get_irq_chip_data for real irq lines. It must be using *_irq_data functions instead. As chip_data is used by interrupt controllers also, which makes vic write at incorrect addresses.

baruch

Quoted 29 lines
---
 drivers/gpio/pl061.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/pl061.c +3 -3
index 3ad1eeb..4b6c22d 100644
@@ -203,7 +203,7 @@ static struct irq_chip pl061_irqchip = {
 
 static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
 {
-	struct list_head *chip_list = get_irq_chip_data(irq);
+	struct list_head *chip_list = get_irq_data(irq);
 	struct list_head *ptr;
 	struct pl061_gpio *chip;
 
@@ -296,9 +296,9 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
 			goto iounmap;
 		}
 		INIT_LIST_HEAD(chip_list);
-		set_irq_chip_data(irq, chip_list);
+		set_irq_data(irq, chip_list);
 	} else
-		chip_list = get_irq_chip_data(irq);
+		chip_list = get_irq_data(irq);
 	list_add(&chip->list, chip_list);
 
 	for (i = 0; i < PL061_GPIO_NR; i++) {
Signature · 3 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.2.679.5364, http://www.tkos.co.il -