|
@@ -38,7 +38,7 @@
|
|
*/
|
|
*/
|
|
struct altera_gpio_chip {
|
|
struct altera_gpio_chip {
|
|
struct of_mm_gpio_chip mmchip;
|
|
struct of_mm_gpio_chip mmchip;
|
|
- spinlock_t gpio_lock;
|
|
|
|
|
|
+ raw_spinlock_t gpio_lock;
|
|
int interrupt_trigger;
|
|
int interrupt_trigger;
|
|
int mapped_irq;
|
|
int mapped_irq;
|
|
};
|
|
};
|
|
@@ -53,12 +53,12 @@ static void altera_gpio_irq_unmask(struct irq_data *d)
|
|
altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
mm_gc = &altera_gc->mmchip;
|
|
mm_gc = &altera_gc->mmchip;
|
|
|
|
|
|
- spin_lock_irqsave(&altera_gc->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags);
|
|
intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
/* Set ALTERA_GPIO_IRQ_MASK bit to unmask */
|
|
/* Set ALTERA_GPIO_IRQ_MASK bit to unmask */
|
|
intmask |= BIT(irqd_to_hwirq(d));
|
|
intmask |= BIT(irqd_to_hwirq(d));
|
|
writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
- spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
static void altera_gpio_irq_mask(struct irq_data *d)
|
|
static void altera_gpio_irq_mask(struct irq_data *d)
|
|
@@ -71,12 +71,12 @@ static void altera_gpio_irq_mask(struct irq_data *d)
|
|
altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d));
|
|
mm_gc = &altera_gc->mmchip;
|
|
mm_gc = &altera_gc->mmchip;
|
|
|
|
|
|
- spin_lock_irqsave(&altera_gc->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&altera_gc->gpio_lock, flags);
|
|
intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
intmask = readl(mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
/* Clear ALTERA_GPIO_IRQ_MASK bit to mask */
|
|
/* Clear ALTERA_GPIO_IRQ_MASK bit to mask */
|
|
intmask &= ~BIT(irqd_to_hwirq(d));
|
|
intmask &= ~BIT(irqd_to_hwirq(d));
|
|
writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
writel(intmask, mm_gc->regs + ALTERA_GPIO_IRQ_MASK);
|
|
- spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&altera_gc->gpio_lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -143,14 +143,14 @@ static void altera_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
|
|
|
|
- spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
|
|
data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
|
|
if (value)
|
|
if (value)
|
|
data_reg |= BIT(offset);
|
|
data_reg |= BIT(offset);
|
|
else
|
|
else
|
|
data_reg &= ~BIT(offset);
|
|
data_reg &= ~BIT(offset);
|
|
writel(data_reg, mm_gc->regs + ALTERA_GPIO_DATA);
|
|
writel(data_reg, mm_gc->regs + ALTERA_GPIO_DATA);
|
|
- spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
|
|
static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
|
|
@@ -163,12 +163,12 @@ static int altera_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
|
|
|
|
- spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
/* Set pin as input, assumes software controlled IP */
|
|
/* Set pin as input, assumes software controlled IP */
|
|
gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
|
|
gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
|
|
gpio_ddr &= ~BIT(offset);
|
|
gpio_ddr &= ~BIT(offset);
|
|
writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
|
|
writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
|
|
- spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -184,7 +184,7 @@ static int altera_gpio_direction_output(struct gpio_chip *gc,
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
mm_gc = to_of_mm_gpio_chip(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
chip = gpiochip_get_data(gc);
|
|
|
|
|
|
- spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&chip->gpio_lock, flags);
|
|
/* Sets the GPIO value */
|
|
/* Sets the GPIO value */
|
|
data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
|
|
data_reg = readl(mm_gc->regs + ALTERA_GPIO_DATA);
|
|
if (value)
|
|
if (value)
|
|
@@ -197,7 +197,7 @@ static int altera_gpio_direction_output(struct gpio_chip *gc,
|
|
gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
|
|
gpio_ddr = readl(mm_gc->regs + ALTERA_GPIO_DIR);
|
|
gpio_ddr |= BIT(offset);
|
|
gpio_ddr |= BIT(offset);
|
|
writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
|
|
writel(gpio_ddr, mm_gc->regs + ALTERA_GPIO_DIR);
|
|
- spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&chip->gpio_lock, flags);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -266,7 +266,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
|
|
if (!altera_gc)
|
|
if (!altera_gc)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
|
|
|
|
- spin_lock_init(&altera_gc->gpio_lock);
|
|
|
|
|
|
+ raw_spin_lock_init(&altera_gc->gpio_lock);
|
|
|
|
|
|
if (of_property_read_u32(node, "altr,ngpio", ®))
|
|
if (of_property_read_u32(node, "altr,ngpio", ®))
|
|
/* By default assume maximum ngpio */
|
|
/* By default assume maximum ngpio */
|