Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6

* 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6:
gpio: Fix DA9052 GPIO build errors.
gpio: mpc8xxx: don't allow input-only pins to be output for MPC5121
gpio-ml-ioh: Add the irq_disable/irq_enable hooks for ml-ioh irq chip
gpio-ml-ioh: fix a bug in the interrupt handler
gpio: pl061: drop extra check for NULL platform_data

+52 -23
+8 -13
drivers/gpio/gpio-da9052.c
··· 22 22 #include <linux/mfd/da9052/da9052.h> 23 23 #include <linux/mfd/da9052/reg.h> 24 24 #include <linux/mfd/da9052/pdata.h> 25 - #include <linux/mfd/da9052/gpio.h> 26 25 27 26 #define DA9052_INPUT 1 28 27 #define DA9052_OUTPUT_OPENDRAIN 2 ··· 42 43 #define DA9052_GPIO_MASK_UPPER_NIBBLE 0xF0 43 44 #define DA9052_GPIO_MASK_LOWER_NIBBLE 0x0F 44 45 #define DA9052_GPIO_NIBBLE_SHIFT 4 46 + #define DA9052_IRQ_GPI0 16 47 + #define DA9052_GPIO_ODD_SHIFT 7 48 + #define DA9052_GPIO_EVEN_SHIFT 3 45 49 46 50 struct da9052_gpio { 47 51 struct da9052 *da9052; ··· 106 104 static void da9052_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 107 105 { 108 106 struct da9052_gpio *gpio = to_da9052_gpio(gc); 109 - unsigned char register_value = 0; 110 107 int ret; 111 108 112 109 if (da9052_gpio_port_odd(offset)) { 113 - if (value) { 114 - register_value = DA9052_GPIO_ODD_PORT_MODE; 115 110 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 116 111 DA9052_GPIO_0_1_REG, 117 112 DA9052_GPIO_ODD_PORT_MODE, 118 - register_value); 113 + value << DA9052_GPIO_ODD_SHIFT); 119 114 if (ret != 0) 120 115 dev_err(gpio->da9052->dev, 121 116 "Failed to updated gpio odd reg,%d", 122 117 ret); 123 - } 124 118 } else { 125 - if (value) { 126 - register_value = DA9052_GPIO_EVEN_PORT_MODE; 127 119 ret = da9052_reg_update(gpio->da9052, (offset >> 1) + 128 120 DA9052_GPIO_0_1_REG, 129 121 DA9052_GPIO_EVEN_PORT_MODE, 130 - register_value); 122 + value << DA9052_GPIO_EVEN_SHIFT); 131 123 if (ret != 0) 132 124 dev_err(gpio->da9052->dev, 133 125 "Failed to updated gpio even reg,%d", 134 126 ret); 135 - } 136 127 } 137 128 } 138 129 ··· 196 201 .direction_input = da9052_gpio_direction_input, 197 202 .direction_output = da9052_gpio_direction_output, 198 203 .to_irq = da9052_gpio_to_irq, 199 - .can_sleep = 1; 200 - .ngpio = 16; 201 - .base = -1; 204 + .can_sleep = 1, 205 + .ngpio = 16, 206 + .base = -1, 202 207 }; 203 208 204 209 static int __devinit da9052_gpio_probe(struct platform_device *pdev)
+31 -1
drivers/gpio/gpio-ml-ioh.c
··· 332 332 &chip->reg->regs[chip->ch].imask); 333 333 } 334 334 335 + static void ioh_irq_disable(struct irq_data *d) 336 + { 337 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 338 + struct ioh_gpio *chip = gc->private; 339 + unsigned long flags; 340 + u32 ien; 341 + 342 + spin_lock_irqsave(&chip->spinlock, flags); 343 + ien = ioread32(&chip->reg->regs[chip->ch].ien); 344 + ien &= ~(1 << (d->irq - chip->irq_base)); 345 + iowrite32(ien, &chip->reg->regs[chip->ch].ien); 346 + spin_unlock_irqrestore(&chip->spinlock, flags); 347 + } 348 + 349 + static void ioh_irq_enable(struct irq_data *d) 350 + { 351 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 352 + struct ioh_gpio *chip = gc->private; 353 + unsigned long flags; 354 + u32 ien; 355 + 356 + spin_lock_irqsave(&chip->spinlock, flags); 357 + ien = ioread32(&chip->reg->regs[chip->ch].ien); 358 + ien |= 1 << (d->irq - chip->irq_base); 359 + iowrite32(ien, &chip->reg->regs[chip->ch].ien); 360 + spin_unlock_irqrestore(&chip->spinlock, flags); 361 + } 362 + 335 363 static irqreturn_t ioh_gpio_handler(int irq, void *dev_id) 336 364 { 337 365 struct ioh_gpio *chip = dev_id; ··· 367 339 int i, j; 368 340 int ret = IRQ_NONE; 369 341 370 - for (i = 0; i < 8; i++) { 342 + for (i = 0; i < 8; i++, chip++) { 371 343 reg_val = ioread32(&chip->reg->regs[i].istatus); 372 344 for (j = 0; j < num_ports[i]; j++) { 373 345 if (reg_val & BIT(j)) { ··· 398 370 ct->chip.irq_mask = ioh_irq_mask; 399 371 ct->chip.irq_unmask = ioh_irq_unmask; 400 372 ct->chip.irq_set_type = ioh_irq_type; 373 + ct->chip.irq_disable = ioh_irq_disable; 374 + ct->chip.irq_enable = ioh_irq_enable; 401 375 402 376 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE, 403 377 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+13 -5
drivers/gpio/gpio-mpc8xxx.c
··· 132 132 return 0; 133 133 } 134 134 135 + static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) 136 + { 137 + /* GPIO 28..31 are input only on MPC5121 */ 138 + if (gpio >= 28) 139 + return -EINVAL; 140 + 141 + return mpc8xxx_gpio_dir_out(gc, gpio, val); 142 + } 143 + 135 144 static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset) 136 145 { 137 146 struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc); ··· 349 340 mm_gc->save_regs = mpc8xxx_gpio_save_regs; 350 341 gc->ngpio = MPC8XXX_GPIO_PINS; 351 342 gc->direction_input = mpc8xxx_gpio_dir_in; 352 - gc->direction_output = mpc8xxx_gpio_dir_out; 353 - if (of_device_is_compatible(np, "fsl,mpc8572-gpio")) 354 - gc->get = mpc8572_gpio_get; 355 - else 356 - gc->get = mpc8xxx_gpio_get; 343 + gc->direction_output = of_device_is_compatible(np, "fsl,mpc5121-gpio") ? 344 + mpc5121_gpio_dir_out : mpc8xxx_gpio_dir_out; 345 + gc->get = of_device_is_compatible(np, "fsl,mpc8572-gpio") ? 346 + mpc8572_gpio_get : mpc8xxx_gpio_get; 357 347 gc->set = mpc8xxx_gpio_set; 358 348 gc->to_irq = mpc8xxx_gpio_to_irq; 359 349
-4
drivers/gpio/gpio-pl061.c
··· 238 238 int ret, irq, i; 239 239 static DECLARE_BITMAP(init_irq, NR_IRQS); 240 240 241 - pdata = dev->dev.platform_data; 242 - if (pdata == NULL) 243 - return -ENODEV; 244 - 245 241 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 246 242 if (chip == NULL) 247 243 return -ENOMEM;