diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dma/ipu/ipu_idmac.c | 8 | ||||
-rw-r--r-- | drivers/dma/ipu/ipu_irq.c | 14 | ||||
-rw-r--r-- | drivers/gpio/gpio-mxc.c | 56 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 1 | ||||
-rw-r--r-- | drivers/media/video/mx1_camera.c | 1 | ||||
-rw-r--r-- | drivers/tty/serial/imx.c | 6 |
6 files changed, 46 insertions, 40 deletions
diff --git a/drivers/dma/ipu/ipu_idmac.c b/drivers/dma/ipu/ipu_idmac.c index 5ec72044ea4c..c7573e50aa14 100644 --- a/drivers/dma/ipu/ipu_idmac.c +++ b/drivers/dma/ipu/ipu_idmac.c | |||
@@ -1663,7 +1663,6 @@ static void __exit ipu_idmac_exit(struct ipu *ipu) | |||
1663 | 1663 | ||
1664 | static int __init ipu_probe(struct platform_device *pdev) | 1664 | static int __init ipu_probe(struct platform_device *pdev) |
1665 | { | 1665 | { |
1666 | struct ipu_platform_data *pdata = pdev->dev.platform_data; | ||
1667 | struct resource *mem_ipu, *mem_ic; | 1666 | struct resource *mem_ipu, *mem_ic; |
1668 | int ret; | 1667 | int ret; |
1669 | 1668 | ||
@@ -1671,7 +1670,7 @@ static int __init ipu_probe(struct platform_device *pdev) | |||
1671 | 1670 | ||
1672 | mem_ipu = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1671 | mem_ipu = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1673 | mem_ic = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1672 | mem_ic = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
1674 | if (!pdata || !mem_ipu || !mem_ic) | 1673 | if (!mem_ipu || !mem_ic) |
1675 | return -EINVAL; | 1674 | return -EINVAL; |
1676 | 1675 | ||
1677 | ipu_data.dev = &pdev->dev; | 1676 | ipu_data.dev = &pdev->dev; |
@@ -1688,10 +1687,9 @@ static int __init ipu_probe(struct platform_device *pdev) | |||
1688 | goto err_noirq; | 1687 | goto err_noirq; |
1689 | 1688 | ||
1690 | ipu_data.irq_err = ret; | 1689 | ipu_data.irq_err = ret; |
1691 | ipu_data.irq_base = pdata->irq_base; | ||
1692 | 1690 | ||
1693 | dev_dbg(&pdev->dev, "fn irq %u, err irq %u, irq-base %u\n", | 1691 | dev_dbg(&pdev->dev, "fn irq %u, err irq %u\n", |
1694 | ipu_data.irq_fn, ipu_data.irq_err, ipu_data.irq_base); | 1692 | ipu_data.irq_fn, ipu_data.irq_err); |
1695 | 1693 | ||
1696 | /* Remap IPU common registers */ | 1694 | /* Remap IPU common registers */ |
1697 | ipu_data.reg_ipu = ioremap(mem_ipu->start, resource_size(mem_ipu)); | 1695 | ipu_data.reg_ipu = ioremap(mem_ipu->start, resource_size(mem_ipu)); |
diff --git a/drivers/dma/ipu/ipu_irq.c b/drivers/dma/ipu/ipu_irq.c index a71f55e72be9..fa95bcc3de1f 100644 --- a/drivers/dma/ipu/ipu_irq.c +++ b/drivers/dma/ipu/ipu_irq.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/module.h> | ||
17 | 18 | ||
18 | #include <mach/ipu.h> | 19 | #include <mach/ipu.h> |
19 | 20 | ||
@@ -354,10 +355,12 @@ static struct irq_chip ipu_irq_chip = { | |||
354 | /* Install the IRQ handler */ | 355 | /* Install the IRQ handler */ |
355 | int __init ipu_irq_attach_irq(struct ipu *ipu, struct platform_device *dev) | 356 | int __init ipu_irq_attach_irq(struct ipu *ipu, struct platform_device *dev) |
356 | { | 357 | { |
357 | struct ipu_platform_data *pdata = dev->dev.platform_data; | 358 | unsigned int irq, i; |
358 | unsigned int irq, irq_base, i; | 359 | int irq_base = irq_alloc_descs(-1, 0, CONFIG_MX3_IPU_IRQS, |
360 | numa_node_id()); | ||
359 | 361 | ||
360 | irq_base = pdata->irq_base; | 362 | if (irq_base < 0) |
363 | return irq_base; | ||
361 | 364 | ||
362 | for (i = 0; i < IPU_IRQ_NR_BANKS; i++) | 365 | for (i = 0; i < IPU_IRQ_NR_BANKS; i++) |
363 | irq_bank[i].ipu = ipu; | 366 | irq_bank[i].ipu = ipu; |
@@ -387,15 +390,16 @@ int __init ipu_irq_attach_irq(struct ipu *ipu, struct platform_device *dev) | |||
387 | irq_set_handler_data(ipu->irq_err, ipu); | 390 | irq_set_handler_data(ipu->irq_err, ipu); |
388 | irq_set_chained_handler(ipu->irq_err, ipu_irq_err); | 391 | irq_set_chained_handler(ipu->irq_err, ipu_irq_err); |
389 | 392 | ||
393 | ipu->irq_base = irq_base; | ||
394 | |||
390 | return 0; | 395 | return 0; |
391 | } | 396 | } |
392 | 397 | ||
393 | void ipu_irq_detach_irq(struct ipu *ipu, struct platform_device *dev) | 398 | void ipu_irq_detach_irq(struct ipu *ipu, struct platform_device *dev) |
394 | { | 399 | { |
395 | struct ipu_platform_data *pdata = dev->dev.platform_data; | ||
396 | unsigned int irq, irq_base; | 400 | unsigned int irq, irq_base; |
397 | 401 | ||
398 | irq_base = pdata->irq_base; | 402 | irq_base = ipu->irq_base; |
399 | 403 | ||
400 | irq_set_chained_handler(ipu->irq_fn, NULL); | 404 | irq_set_chained_handler(ipu->irq_fn, NULL); |
401 | irq_set_handler_data(ipu->irq_fn, NULL); | 405 | irq_set_handler_data(ipu->irq_fn, NULL); |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c89c4c1e668d..04691d3abe60 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/io.h> | 24 | #include <linux/io.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/irqdomain.h> | ||
26 | #include <linux/gpio.h> | 27 | #include <linux/gpio.h> |
27 | #include <linux/platform_device.h> | 28 | #include <linux/platform_device.h> |
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
@@ -33,8 +34,6 @@ | |||
33 | #include <asm-generic/bug.h> | 34 | #include <asm-generic/bug.h> |
34 | #include <asm/mach/irq.h> | 35 | #include <asm/mach/irq.h> |
35 | 36 | ||
36 | #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) | ||
37 | |||
38 | enum mxc_gpio_hwtype { | 37 | enum mxc_gpio_hwtype { |
39 | IMX1_GPIO, /* runs on i.mx1 */ | 38 | IMX1_GPIO, /* runs on i.mx1 */ |
40 | IMX21_GPIO, /* runs on i.mx21 and i.mx27 */ | 39 | IMX21_GPIO, /* runs on i.mx21 and i.mx27 */ |
@@ -61,7 +60,7 @@ struct mxc_gpio_port { | |||
61 | void __iomem *base; | 60 | void __iomem *base; |
62 | int irq; | 61 | int irq; |
63 | int irq_high; | 62 | int irq_high; |
64 | int virtual_irq_start; | 63 | struct irq_domain *domain; |
65 | struct bgpio_chip bgc; | 64 | struct bgpio_chip bgc; |
66 | u32 both_edges; | 65 | u32 both_edges; |
67 | }; | 66 | }; |
@@ -144,14 +143,15 @@ static LIST_HEAD(mxc_gpio_ports); | |||
144 | 143 | ||
145 | static int gpio_set_irq_type(struct irq_data *d, u32 type) | 144 | static int gpio_set_irq_type(struct irq_data *d, u32 type) |
146 | { | 145 | { |
147 | u32 gpio = irq_to_gpio(d->irq); | ||
148 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 146 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
149 | struct mxc_gpio_port *port = gc->private; | 147 | struct mxc_gpio_port *port = gc->private; |
150 | u32 bit, val; | 148 | u32 bit, val; |
149 | u32 gpio_idx = d->hwirq; | ||
150 | u32 gpio = port->bgc.gc.base + gpio_idx; | ||
151 | int edge; | 151 | int edge; |
152 | void __iomem *reg = port->base; | 152 | void __iomem *reg = port->base; |
153 | 153 | ||
154 | port->both_edges &= ~(1 << (gpio & 31)); | 154 | port->both_edges &= ~(1 << gpio_idx); |
155 | switch (type) { | 155 | switch (type) { |
156 | case IRQ_TYPE_EDGE_RISING: | 156 | case IRQ_TYPE_EDGE_RISING: |
157 | edge = GPIO_INT_RISE_EDGE; | 157 | edge = GPIO_INT_RISE_EDGE; |
@@ -168,7 +168,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) | |||
168 | edge = GPIO_INT_HIGH_LEV; | 168 | edge = GPIO_INT_HIGH_LEV; |
169 | pr_debug("mxc: set GPIO %d to high trigger\n", gpio); | 169 | pr_debug("mxc: set GPIO %d to high trigger\n", gpio); |
170 | } | 170 | } |
171 | port->both_edges |= 1 << (gpio & 31); | 171 | port->both_edges |= 1 << gpio_idx; |
172 | break; | 172 | break; |
173 | case IRQ_TYPE_LEVEL_LOW: | 173 | case IRQ_TYPE_LEVEL_LOW: |
174 | edge = GPIO_INT_LOW_LEV; | 174 | edge = GPIO_INT_LOW_LEV; |
@@ -180,11 +180,11 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) | |||
180 | return -EINVAL; | 180 | return -EINVAL; |
181 | } | 181 | } |
182 | 182 | ||
183 | reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */ | 183 | reg += GPIO_ICR1 + ((gpio_idx & 0x10) >> 2); /* ICR1 or ICR2 */ |
184 | bit = gpio & 0xf; | 184 | bit = gpio_idx & 0xf; |
185 | val = readl(reg) & ~(0x3 << (bit << 1)); | 185 | val = readl(reg) & ~(0x3 << (bit << 1)); |
186 | writel(val | (edge << (bit << 1)), reg); | 186 | writel(val | (edge << (bit << 1)), reg); |
187 | writel(1 << (gpio & 0x1f), port->base + GPIO_ISR); | 187 | writel(1 << gpio_idx, port->base + GPIO_ISR); |
188 | 188 | ||
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
@@ -217,15 +217,13 @@ static void mxc_flip_edge(struct mxc_gpio_port *port, u32 gpio) | |||
217 | /* handle 32 interrupts in one status register */ | 217 | /* handle 32 interrupts in one status register */ |
218 | static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat) | 218 | static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat) |
219 | { | 219 | { |
220 | u32 gpio_irq_no_base = port->virtual_irq_start; | ||
221 | |||
222 | while (irq_stat != 0) { | 220 | while (irq_stat != 0) { |
223 | int irqoffset = fls(irq_stat) - 1; | 221 | int irqoffset = fls(irq_stat) - 1; |
224 | 222 | ||
225 | if (port->both_edges & (1 << irqoffset)) | 223 | if (port->both_edges & (1 << irqoffset)) |
226 | mxc_flip_edge(port, irqoffset); | 224 | mxc_flip_edge(port, irqoffset); |
227 | 225 | ||
228 | generic_handle_irq(gpio_irq_no_base + irqoffset); | 226 | generic_handle_irq(irq_find_mapping(port->domain, irqoffset)); |
229 | 227 | ||
230 | irq_stat &= ~(1 << irqoffset); | 228 | irq_stat &= ~(1 << irqoffset); |
231 | } | 229 | } |
@@ -276,10 +274,9 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc) | |||
276 | */ | 274 | */ |
277 | static int gpio_set_wake_irq(struct irq_data *d, u32 enable) | 275 | static int gpio_set_wake_irq(struct irq_data *d, u32 enable) |
278 | { | 276 | { |
279 | u32 gpio = irq_to_gpio(d->irq); | ||
280 | u32 gpio_idx = gpio & 0x1F; | ||
281 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 277 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
282 | struct mxc_gpio_port *port = gc->private; | 278 | struct mxc_gpio_port *port = gc->private; |
279 | u32 gpio_idx = d->hwirq; | ||
283 | 280 | ||
284 | if (enable) { | 281 | if (enable) { |
285 | if (port->irq_high && (gpio_idx >= 16)) | 282 | if (port->irq_high && (gpio_idx >= 16)) |
@@ -296,12 +293,12 @@ static int gpio_set_wake_irq(struct irq_data *d, u32 enable) | |||
296 | return 0; | 293 | return 0; |
297 | } | 294 | } |
298 | 295 | ||
299 | static void __init mxc_gpio_init_gc(struct mxc_gpio_port *port) | 296 | static void __init mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) |
300 | { | 297 | { |
301 | struct irq_chip_generic *gc; | 298 | struct irq_chip_generic *gc; |
302 | struct irq_chip_type *ct; | 299 | struct irq_chip_type *ct; |
303 | 300 | ||
304 | gc = irq_alloc_generic_chip("gpio-mxc", 1, port->virtual_irq_start, | 301 | gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base, |
305 | port->base, handle_level_irq); | 302 | port->base, handle_level_irq); |
306 | gc->private = port; | 303 | gc->private = port; |
307 | 304 | ||
@@ -352,7 +349,7 @@ static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | |||
352 | struct mxc_gpio_port *port = | 349 | struct mxc_gpio_port *port = |
353 | container_of(bgc, struct mxc_gpio_port, bgc); | 350 | container_of(bgc, struct mxc_gpio_port, bgc); |
354 | 351 | ||
355 | return port->virtual_irq_start + offset; | 352 | return irq_find_mapping(port->domain, offset); |
356 | } | 353 | } |
357 | 354 | ||
358 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) | 355 | static int __devinit mxc_gpio_probe(struct platform_device *pdev) |
@@ -360,6 +357,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
360 | struct device_node *np = pdev->dev.of_node; | 357 | struct device_node *np = pdev->dev.of_node; |
361 | struct mxc_gpio_port *port; | 358 | struct mxc_gpio_port *port; |
362 | struct resource *iores; | 359 | struct resource *iores; |
360 | int irq_base; | ||
363 | int err; | 361 | int err; |
364 | 362 | ||
365 | mxc_gpio_get_hw(pdev); | 363 | mxc_gpio_get_hw(pdev); |
@@ -432,20 +430,30 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
432 | if (err) | 430 | if (err) |
433 | goto out_bgpio_remove; | 431 | goto out_bgpio_remove; |
434 | 432 | ||
435 | /* | 433 | irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); |
436 | * In dt case, we use gpio number range dynamically | 434 | if (irq_base < 0) { |
437 | * allocated by gpio core. | 435 | err = irq_base; |
438 | */ | 436 | goto out_gpiochip_remove; |
439 | port->virtual_irq_start = MXC_GPIO_IRQ_START + (np ? port->bgc.gc.base : | 437 | } |
440 | pdev->id * 32); | 438 | |
439 | port->domain = irq_domain_add_legacy(np, 32, irq_base, 0, | ||
440 | &irq_domain_simple_ops, NULL); | ||
441 | if (!port->domain) { | ||
442 | err = -ENODEV; | ||
443 | goto out_irqdesc_free; | ||
444 | } | ||
441 | 445 | ||
442 | /* gpio-mxc can be a generic irq chip */ | 446 | /* gpio-mxc can be a generic irq chip */ |
443 | mxc_gpio_init_gc(port); | 447 | mxc_gpio_init_gc(port, irq_base); |
444 | 448 | ||
445 | list_add_tail(&port->node, &mxc_gpio_ports); | 449 | list_add_tail(&port->node, &mxc_gpio_ports); |
446 | 450 | ||
447 | return 0; | 451 | return 0; |
448 | 452 | ||
453 | out_irqdesc_free: | ||
454 | irq_free_descs(irq_base, 32); | ||
455 | out_gpiochip_remove: | ||
456 | WARN_ON(gpiochip_remove(&port->bgc.gc) < 0); | ||
449 | out_bgpio_remove: | 457 | out_bgpio_remove: |
450 | bgpio_remove(&port->bgc); | 458 | bgpio_remove(&port->bgc); |
451 | out_iounmap: | 459 | out_iounmap: |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 8d6b504d65c4..370031ac8200 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #include <linux/of_i2c.h> | 53 | #include <linux/of_i2c.h> |
54 | #include <linux/pinctrl/consumer.h> | 54 | #include <linux/pinctrl/consumer.h> |
55 | 55 | ||
56 | #include <mach/irqs.h> | ||
57 | #include <mach/hardware.h> | 56 | #include <mach/hardware.h> |
58 | #include <mach/i2c.h> | 57 | #include <mach/i2c.h> |
59 | 58 | ||
diff --git a/drivers/media/video/mx1_camera.c b/drivers/media/video/mx1_camera.c index 4296a8350298..d2e6f82ecfac 100644 --- a/drivers/media/video/mx1_camera.c +++ b/drivers/media/video/mx1_camera.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/fiq.h> | 43 | #include <asm/fiq.h> |
44 | #include <mach/dma-mx1-mx2.h> | 44 | #include <mach/dma-mx1-mx2.h> |
45 | #include <mach/hardware.h> | 45 | #include <mach/hardware.h> |
46 | #include <mach/irqs.h> | ||
46 | #include <mach/mx1_camera.h> | 47 | #include <mach/mx1_camera.h> |
47 | 48 | ||
48 | /* | 49 | /* |
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 4ef747307ecb..d5c689d6217e 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -169,7 +169,6 @@ | |||
169 | #define SERIAL_IMX_MAJOR 207 | 169 | #define SERIAL_IMX_MAJOR 207 |
170 | #define MINOR_START 16 | 170 | #define MINOR_START 16 |
171 | #define DEV_NAME "ttymxc" | 171 | #define DEV_NAME "ttymxc" |
172 | #define MAX_INTERNAL_IRQ MXC_INTERNAL_IRQS | ||
173 | 172 | ||
174 | /* | 173 | /* |
175 | * This determines how often we check the modem status signals | 174 | * This determines how often we check the modem status signals |
@@ -741,10 +740,7 @@ static int imx_startup(struct uart_port *port) | |||
741 | 740 | ||
742 | /* do not use RTS IRQ on IrDA */ | 741 | /* do not use RTS IRQ on IrDA */ |
743 | if (!USE_IRDA(sport)) { | 742 | if (!USE_IRDA(sport)) { |
744 | retval = request_irq(sport->rtsirq, imx_rtsint, | 743 | retval = request_irq(sport->rtsirq, imx_rtsint, 0, |
745 | (sport->rtsirq < MAX_INTERNAL_IRQ) ? 0 : | ||
746 | IRQF_TRIGGER_FALLING | | ||
747 | IRQF_TRIGGER_RISING, | ||
748 | DRIVER_NAME, sport); | 744 | DRIVER_NAME, sport); |
749 | if (retval) | 745 | if (retval) |
750 | goto error_out3; | 746 | goto error_out3; |