diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_arasan_cf.c | 37 | ||||
-rw-r--r-- | drivers/clocksource/Kconfig | 1 | ||||
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 33 | ||||
-rw-r--r-- | drivers/clocksource/exynos_mct.c | 1 | ||||
-rw-r--r-- | drivers/irqchip/Makefile | 1 | ||||
-rw-r--r-- | drivers/irqchip/irq-armada-370-xp.c | 288 | ||||
-rw-r--r-- | drivers/spi/spi-pl022.c | 43 | ||||
-rw-r--r-- | drivers/tty/serial/amba-pl011.c | 64 |
8 files changed, 403 insertions, 65 deletions
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 405022d302c3..7638121cb5d1 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -209,8 +209,6 @@ struct arasan_cf_dev { | |||
209 | struct dma_chan *dma_chan; | 209 | struct dma_chan *dma_chan; |
210 | /* Mask for DMA transfers */ | 210 | /* Mask for DMA transfers */ |
211 | dma_cap_mask_t mask; | 211 | dma_cap_mask_t mask; |
212 | /* dma channel private data */ | ||
213 | void *dma_priv; | ||
214 | /* DMA transfer work */ | 212 | /* DMA transfer work */ |
215 | struct work_struct work; | 213 | struct work_struct work; |
216 | /* DMA delayed finish work */ | 214 | /* DMA delayed finish work */ |
@@ -308,6 +306,7 @@ static void cf_card_detect(struct arasan_cf_dev *acdev, bool hotplugged) | |||
308 | static int cf_init(struct arasan_cf_dev *acdev) | 306 | static int cf_init(struct arasan_cf_dev *acdev) |
309 | { | 307 | { |
310 | struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); | 308 | struct arasan_cf_pdata *pdata = dev_get_platdata(acdev->host->dev); |
309 | unsigned int if_clk; | ||
311 | unsigned long flags; | 310 | unsigned long flags; |
312 | int ret = 0; | 311 | int ret = 0; |
313 | 312 | ||
@@ -325,8 +324,12 @@ static int cf_init(struct arasan_cf_dev *acdev) | |||
325 | 324 | ||
326 | spin_lock_irqsave(&acdev->host->lock, flags); | 325 | spin_lock_irqsave(&acdev->host->lock, flags); |
327 | /* configure CF interface clock */ | 326 | /* configure CF interface clock */ |
328 | writel((pdata->cf_if_clk <= CF_IF_CLK_200M) ? pdata->cf_if_clk : | 327 | /* TODO: read from device tree */ |
329 | CF_IF_CLK_166M, acdev->vbase + CLK_CFG); | 328 | if_clk = CF_IF_CLK_166M; |
329 | if (pdata && pdata->cf_if_clk <= CF_IF_CLK_200M) | ||
330 | if_clk = pdata->cf_if_clk; | ||
331 | |||
332 | writel(if_clk, acdev->vbase + CLK_CFG); | ||
330 | 333 | ||
331 | writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); | 334 | writel(TRUE_IDE_MODE | CFHOST_ENB, acdev->vbase + OP_MODE); |
332 | cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); | 335 | cf_interrupt_enable(acdev, CARD_DETECT_IRQ, 1); |
@@ -357,12 +360,6 @@ static void dma_callback(void *dev) | |||
357 | complete(&acdev->dma_completion); | 360 | complete(&acdev->dma_completion); |
358 | } | 361 | } |
359 | 362 | ||
360 | static bool filter(struct dma_chan *chan, void *slave) | ||
361 | { | ||
362 | chan->private = slave; | ||
363 | return true; | ||
364 | } | ||
365 | |||
366 | static inline void dma_complete(struct arasan_cf_dev *acdev) | 363 | static inline void dma_complete(struct arasan_cf_dev *acdev) |
367 | { | 364 | { |
368 | struct ata_queued_cmd *qc = acdev->qc; | 365 | struct ata_queued_cmd *qc = acdev->qc; |
@@ -530,8 +527,7 @@ static void data_xfer(struct work_struct *work) | |||
530 | 527 | ||
531 | /* request dma channels */ | 528 | /* request dma channels */ |
532 | /* dma_request_channel may sleep, so calling from process context */ | 529 | /* dma_request_channel may sleep, so calling from process context */ |
533 | acdev->dma_chan = dma_request_channel(acdev->mask, filter, | 530 | acdev->dma_chan = dma_request_slave_channel(acdev->host->dev, "data"); |
534 | acdev->dma_priv); | ||
535 | if (!acdev->dma_chan) { | 531 | if (!acdev->dma_chan) { |
536 | dev_err(acdev->host->dev, "Unable to get dma_chan\n"); | 532 | dev_err(acdev->host->dev, "Unable to get dma_chan\n"); |
537 | goto chan_request_fail; | 533 | goto chan_request_fail; |
@@ -798,6 +794,7 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
798 | struct ata_host *host; | 794 | struct ata_host *host; |
799 | struct ata_port *ap; | 795 | struct ata_port *ap; |
800 | struct resource *res; | 796 | struct resource *res; |
797 | u32 quirk; | ||
801 | irq_handler_t irq_handler = NULL; | 798 | irq_handler_t irq_handler = NULL; |
802 | int ret = 0; | 799 | int ret = 0; |
803 | 800 | ||
@@ -817,12 +814,17 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
817 | return -ENOMEM; | 814 | return -ENOMEM; |
818 | } | 815 | } |
819 | 816 | ||
817 | if (pdata) | ||
818 | quirk = pdata->quirk; | ||
819 | else | ||
820 | quirk = CF_BROKEN_UDMA; /* as it is on spear1340 */ | ||
821 | |||
820 | /* if irq is 0, support only PIO */ | 822 | /* if irq is 0, support only PIO */ |
821 | acdev->irq = platform_get_irq(pdev, 0); | 823 | acdev->irq = platform_get_irq(pdev, 0); |
822 | if (acdev->irq) | 824 | if (acdev->irq) |
823 | irq_handler = arasan_cf_interrupt; | 825 | irq_handler = arasan_cf_interrupt; |
824 | else | 826 | else |
825 | pdata->quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; | 827 | quirk |= CF_BROKEN_MWDMA | CF_BROKEN_UDMA; |
826 | 828 | ||
827 | acdev->pbase = res->start; | 829 | acdev->pbase = res->start; |
828 | acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, | 830 | acdev->vbase = devm_ioremap_nocache(&pdev->dev, res->start, |
@@ -859,17 +861,16 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
859 | INIT_WORK(&acdev->work, data_xfer); | 861 | INIT_WORK(&acdev->work, data_xfer); |
860 | INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); | 862 | INIT_DELAYED_WORK(&acdev->dwork, delayed_finish); |
861 | dma_cap_set(DMA_MEMCPY, acdev->mask); | 863 | dma_cap_set(DMA_MEMCPY, acdev->mask); |
862 | acdev->dma_priv = pdata->dma_priv; | ||
863 | 864 | ||
864 | /* Handle platform specific quirks */ | 865 | /* Handle platform specific quirks */ |
865 | if (pdata->quirk) { | 866 | if (quirk) { |
866 | if (pdata->quirk & CF_BROKEN_PIO) { | 867 | if (quirk & CF_BROKEN_PIO) { |
867 | ap->ops->set_piomode = NULL; | 868 | ap->ops->set_piomode = NULL; |
868 | ap->pio_mask = 0; | 869 | ap->pio_mask = 0; |
869 | } | 870 | } |
870 | if (pdata->quirk & CF_BROKEN_MWDMA) | 871 | if (quirk & CF_BROKEN_MWDMA) |
871 | ap->mwdma_mask = 0; | 872 | ap->mwdma_mask = 0; |
872 | if (pdata->quirk & CF_BROKEN_UDMA) | 873 | if (quirk & CF_BROKEN_UDMA) |
873 | ap->udma_mask = 0; | 874 | ap->udma_mask = 0; |
874 | } | 875 | } |
875 | ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; | 876 | ap->flags |= ATA_FLAG_PIO_POLLING | ATA_FLAG_NO_ATAPI; |
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 7bc6e51757ee..c20de4a85cbd 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
@@ -65,6 +65,7 @@ config CLKSRC_DBX500_PRCMU_SCHED_CLOCK | |||
65 | 65 | ||
66 | config ARM_ARCH_TIMER | 66 | config ARM_ARCH_TIMER |
67 | bool | 67 | bool |
68 | select CLKSRC_OF if OF | ||
68 | 69 | ||
69 | config CLKSRC_METAG_GENERIC | 70 | config CLKSRC_METAG_GENERIC |
70 | def_bool y if METAG | 71 | def_bool y if METAG |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index d7ad425ab9b3..a2b254189782 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -248,14 +248,16 @@ static void __cpuinit arch_timer_stop(struct clock_event_device *clk) | |||
248 | static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, | 248 | static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self, |
249 | unsigned long action, void *hcpu) | 249 | unsigned long action, void *hcpu) |
250 | { | 250 | { |
251 | struct clock_event_device *evt = this_cpu_ptr(arch_timer_evt); | 251 | /* |
252 | 252 | * Grab cpu pointer in each case to avoid spurious | |
253 | * preemptible warnings | ||
254 | */ | ||
253 | switch (action & ~CPU_TASKS_FROZEN) { | 255 | switch (action & ~CPU_TASKS_FROZEN) { |
254 | case CPU_STARTING: | 256 | case CPU_STARTING: |
255 | arch_timer_setup(evt); | 257 | arch_timer_setup(this_cpu_ptr(arch_timer_evt)); |
256 | break; | 258 | break; |
257 | case CPU_DYING: | 259 | case CPU_DYING: |
258 | arch_timer_stop(evt); | 260 | arch_timer_stop(this_cpu_ptr(arch_timer_evt)); |
259 | break; | 261 | break; |
260 | } | 262 | } |
261 | 263 | ||
@@ -337,22 +339,14 @@ out: | |||
337 | return err; | 339 | return err; |
338 | } | 340 | } |
339 | 341 | ||
340 | static const struct of_device_id arch_timer_of_match[] __initconst = { | 342 | static void __init arch_timer_init(struct device_node *np) |
341 | { .compatible = "arm,armv7-timer", }, | ||
342 | { .compatible = "arm,armv8-timer", }, | ||
343 | {}, | ||
344 | }; | ||
345 | |||
346 | int __init arch_timer_init(void) | ||
347 | { | 343 | { |
348 | struct device_node *np; | ||
349 | u32 freq; | 344 | u32 freq; |
350 | int i; | 345 | int i; |
351 | 346 | ||
352 | np = of_find_matching_node(NULL, arch_timer_of_match); | 347 | if (arch_timer_get_rate()) { |
353 | if (!np) { | 348 | pr_warn("arch_timer: multiple nodes in dt, skipping\n"); |
354 | pr_err("arch_timer: can't find DT node\n"); | 349 | return; |
355 | return -ENODEV; | ||
356 | } | 350 | } |
357 | 351 | ||
358 | /* Try to determine the frequency from the device tree or CNTFRQ */ | 352 | /* Try to determine the frequency from the device tree or CNTFRQ */ |
@@ -378,7 +372,7 @@ int __init arch_timer_init(void) | |||
378 | if (!arch_timer_ppi[PHYS_SECURE_PPI] || | 372 | if (!arch_timer_ppi[PHYS_SECURE_PPI] || |
379 | !arch_timer_ppi[PHYS_NONSECURE_PPI]) { | 373 | !arch_timer_ppi[PHYS_NONSECURE_PPI]) { |
380 | pr_warn("arch_timer: No interrupt available, giving up\n"); | 374 | pr_warn("arch_timer: No interrupt available, giving up\n"); |
381 | return -EINVAL; | 375 | return; |
382 | } | 376 | } |
383 | } | 377 | } |
384 | 378 | ||
@@ -387,5 +381,8 @@ int __init arch_timer_init(void) | |||
387 | else | 381 | else |
388 | arch_timer_read_counter = arch_counter_get_cntpct; | 382 | arch_timer_read_counter = arch_counter_get_cntpct; |
389 | 383 | ||
390 | return arch_timer_register(); | 384 | arch_timer_register(); |
385 | arch_timer_arch_init(); | ||
391 | } | 386 | } |
387 | CLOCKSOURCE_OF_DECLARE(armv7_arch_timer, "arm,armv7-timer", arch_timer_init); | ||
388 | CLOCKSOURCE_OF_DECLARE(armv8_arch_timer, "arm,armv8-timer", arch_timer_init); | ||
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index 661026834b23..13a9e4923a03 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/of_address.h> | 24 | #include <linux/of_address.h> |
25 | #include <linux/clocksource.h> | 25 | #include <linux/clocksource.h> |
26 | 26 | ||
27 | #include <asm/arch_timer.h> | ||
28 | #include <asm/localtimer.h> | 27 | #include <asm/localtimer.h> |
29 | 28 | ||
30 | #include <plat/cpu.h> | 29 | #include <plat/cpu.h> |
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index c28fcccf4a0d..cda4cb5f7327 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -2,6 +2,7 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o | |||
2 | 2 | ||
3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o | 3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o |
4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o | 4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o |
5 | obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o | ||
5 | obj-$(CONFIG_ARCH_MXS) += irq-mxs.o | 6 | obj-$(CONFIG_ARCH_MXS) += irq-mxs.o |
6 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o | 7 | obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o |
7 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 8 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c new file mode 100644 index 000000000000..bb328a366122 --- /dev/null +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -0,0 +1,288 @@ | |||
1 | /* | ||
2 | * Marvell Armada 370 and Armada XP SoC IRQ handling | ||
3 | * | ||
4 | * Copyright (C) 2012 Marvell | ||
5 | * | ||
6 | * Lior Amsalem <alior@marvell.com> | ||
7 | * Gregory CLEMENT <gregory.clement@free-electrons.com> | ||
8 | * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | ||
9 | * Ben Dooks <ben.dooks@codethink.co.uk> | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | ||
12 | * License version 2. This program is licensed "as is" without any | ||
13 | * warranty of any kind, whether express or implied. | ||
14 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/io.h> | ||
22 | #include <linux/of_address.h> | ||
23 | #include <linux/of_irq.h> | ||
24 | #include <linux/irqdomain.h> | ||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/exception.h> | ||
27 | #include <asm/smp_plat.h> | ||
28 | #include <asm/mach/irq.h> | ||
29 | |||
30 | #include "irqchip.h" | ||
31 | |||
32 | /* Interrupt Controller Registers Map */ | ||
33 | #define ARMADA_370_XP_INT_SET_MASK_OFFS (0x48) | ||
34 | #define ARMADA_370_XP_INT_CLEAR_MASK_OFFS (0x4C) | ||
35 | |||
36 | #define ARMADA_370_XP_INT_CONTROL (0x00) | ||
37 | #define ARMADA_370_XP_INT_SET_ENABLE_OFFS (0x30) | ||
38 | #define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) | ||
39 | #define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) | ||
40 | |||
41 | #define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) | ||
42 | |||
43 | #define ARMADA_370_XP_SW_TRIG_INT_OFFS (0x4) | ||
44 | #define ARMADA_370_XP_IN_DRBEL_MSK_OFFS (0xc) | ||
45 | #define ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS (0x8) | ||
46 | |||
47 | #define ARMADA_370_XP_MAX_PER_CPU_IRQS (28) | ||
48 | |||
49 | #define ARMADA_370_XP_TIMER0_PER_CPU_IRQ (5) | ||
50 | |||
51 | #define IPI_DOORBELL_START (0) | ||
52 | #define IPI_DOORBELL_END (8) | ||
53 | #define IPI_DOORBELL_MASK 0xFF | ||
54 | |||
55 | static DEFINE_RAW_SPINLOCK(irq_controller_lock); | ||
56 | |||
57 | static void __iomem *per_cpu_int_base; | ||
58 | static void __iomem *main_int_base; | ||
59 | static struct irq_domain *armada_370_xp_mpic_domain; | ||
60 | |||
61 | /* | ||
62 | * In SMP mode: | ||
63 | * For shared global interrupts, mask/unmask global enable bit | ||
64 | * For CPU interrupts, mask/unmask the calling CPU's bit | ||
65 | */ | ||
66 | static void armada_370_xp_irq_mask(struct irq_data *d) | ||
67 | { | ||
68 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | ||
69 | |||
70 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) | ||
71 | writel(hwirq, main_int_base + | ||
72 | ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS); | ||
73 | else | ||
74 | writel(hwirq, per_cpu_int_base + | ||
75 | ARMADA_370_XP_INT_SET_MASK_OFFS); | ||
76 | } | ||
77 | |||
78 | static void armada_370_xp_irq_unmask(struct irq_data *d) | ||
79 | { | ||
80 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | ||
81 | |||
82 | if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) | ||
83 | writel(hwirq, main_int_base + | ||
84 | ARMADA_370_XP_INT_SET_ENABLE_OFFS); | ||
85 | else | ||
86 | writel(hwirq, per_cpu_int_base + | ||
87 | ARMADA_370_XP_INT_CLEAR_MASK_OFFS); | ||
88 | } | ||
89 | |||
90 | #ifdef CONFIG_SMP | ||
91 | static int armada_xp_set_affinity(struct irq_data *d, | ||
92 | const struct cpumask *mask_val, bool force) | ||
93 | { | ||
94 | unsigned long reg; | ||
95 | unsigned long new_mask = 0; | ||
96 | unsigned long online_mask = 0; | ||
97 | unsigned long count = 0; | ||
98 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | ||
99 | int cpu; | ||
100 | |||
101 | for_each_cpu(cpu, mask_val) { | ||
102 | new_mask |= 1 << cpu_logical_map(cpu); | ||
103 | count++; | ||
104 | } | ||
105 | |||
106 | /* | ||
107 | * Forbid mutlicore interrupt affinity | ||
108 | * This is required since the MPIC HW doesn't limit | ||
109 | * several CPUs from acknowledging the same interrupt. | ||
110 | */ | ||
111 | if (count > 1) | ||
112 | return -EINVAL; | ||
113 | |||
114 | for_each_cpu(cpu, cpu_online_mask) | ||
115 | online_mask |= 1 << cpu_logical_map(cpu); | ||
116 | |||
117 | raw_spin_lock(&irq_controller_lock); | ||
118 | |||
119 | reg = readl(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); | ||
120 | reg = (reg & (~online_mask)) | new_mask; | ||
121 | writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); | ||
122 | |||
123 | raw_spin_unlock(&irq_controller_lock); | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | #endif | ||
128 | |||
129 | static struct irq_chip armada_370_xp_irq_chip = { | ||
130 | .name = "armada_370_xp_irq", | ||
131 | .irq_mask = armada_370_xp_irq_mask, | ||
132 | .irq_mask_ack = armada_370_xp_irq_mask, | ||
133 | .irq_unmask = armada_370_xp_irq_unmask, | ||
134 | #ifdef CONFIG_SMP | ||
135 | .irq_set_affinity = armada_xp_set_affinity, | ||
136 | #endif | ||
137 | }; | ||
138 | |||
139 | static int armada_370_xp_mpic_irq_map(struct irq_domain *h, | ||
140 | unsigned int virq, irq_hw_number_t hw) | ||
141 | { | ||
142 | armada_370_xp_irq_mask(irq_get_irq_data(virq)); | ||
143 | if (hw != ARMADA_370_XP_TIMER0_PER_CPU_IRQ) | ||
144 | writel(hw, per_cpu_int_base + | ||
145 | ARMADA_370_XP_INT_CLEAR_MASK_OFFS); | ||
146 | else | ||
147 | writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS); | ||
148 | irq_set_status_flags(virq, IRQ_LEVEL); | ||
149 | |||
150 | if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) { | ||
151 | irq_set_percpu_devid(virq); | ||
152 | irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip, | ||
153 | handle_percpu_devid_irq); | ||
154 | |||
155 | } else { | ||
156 | irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip, | ||
157 | handle_level_irq); | ||
158 | } | ||
159 | set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | #ifdef CONFIG_SMP | ||
165 | void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq) | ||
166 | { | ||
167 | int cpu; | ||
168 | unsigned long map = 0; | ||
169 | |||
170 | /* Convert our logical CPU mask into a physical one. */ | ||
171 | for_each_cpu(cpu, mask) | ||
172 | map |= 1 << cpu_logical_map(cpu); | ||
173 | |||
174 | /* | ||
175 | * Ensure that stores to Normal memory are visible to the | ||
176 | * other CPUs before issuing the IPI. | ||
177 | */ | ||
178 | dsb(); | ||
179 | |||
180 | /* submit softirq */ | ||
181 | writel((map << 8) | irq, main_int_base + | ||
182 | ARMADA_370_XP_SW_TRIG_INT_OFFS); | ||
183 | } | ||
184 | |||
185 | void armada_xp_mpic_smp_cpu_init(void) | ||
186 | { | ||
187 | /* Clear pending IPIs */ | ||
188 | writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | ||
189 | |||
190 | /* Enable first 8 IPIs */ | ||
191 | writel(IPI_DOORBELL_MASK, per_cpu_int_base + | ||
192 | ARMADA_370_XP_IN_DRBEL_MSK_OFFS); | ||
193 | |||
194 | /* Unmask IPI interrupt */ | ||
195 | writel(0, per_cpu_int_base + ARMADA_370_XP_INT_CLEAR_MASK_OFFS); | ||
196 | } | ||
197 | #endif /* CONFIG_SMP */ | ||
198 | |||
199 | static struct irq_domain_ops armada_370_xp_mpic_irq_ops = { | ||
200 | .map = armada_370_xp_mpic_irq_map, | ||
201 | .xlate = irq_domain_xlate_onecell, | ||
202 | }; | ||
203 | |||
204 | static asmlinkage void __exception_irq_entry | ||
205 | armada_370_xp_handle_irq(struct pt_regs *regs) | ||
206 | { | ||
207 | u32 irqstat, irqnr; | ||
208 | |||
209 | do { | ||
210 | irqstat = readl_relaxed(per_cpu_int_base + | ||
211 | ARMADA_370_XP_CPU_INTACK_OFFS); | ||
212 | irqnr = irqstat & 0x3FF; | ||
213 | |||
214 | if (irqnr > 1022) | ||
215 | break; | ||
216 | |||
217 | if (irqnr > 0) { | ||
218 | irqnr = irq_find_mapping(armada_370_xp_mpic_domain, | ||
219 | irqnr); | ||
220 | handle_IRQ(irqnr, regs); | ||
221 | continue; | ||
222 | } | ||
223 | #ifdef CONFIG_SMP | ||
224 | /* IPI Handling */ | ||
225 | if (irqnr == 0) { | ||
226 | u32 ipimask, ipinr; | ||
227 | |||
228 | ipimask = readl_relaxed(per_cpu_int_base + | ||
229 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS) | ||
230 | & IPI_DOORBELL_MASK; | ||
231 | |||
232 | writel(~IPI_DOORBELL_MASK, per_cpu_int_base + | ||
233 | ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS); | ||
234 | |||
235 | /* Handle all pending doorbells */ | ||
236 | for (ipinr = IPI_DOORBELL_START; | ||
237 | ipinr < IPI_DOORBELL_END; ipinr++) { | ||
238 | if (ipimask & (0x1 << ipinr)) | ||
239 | handle_IPI(ipinr, regs); | ||
240 | } | ||
241 | continue; | ||
242 | } | ||
243 | #endif | ||
244 | |||
245 | } while (1); | ||
246 | } | ||
247 | |||
248 | static int __init armada_370_xp_mpic_of_init(struct device_node *node, | ||
249 | struct device_node *parent) | ||
250 | { | ||
251 | u32 control; | ||
252 | |||
253 | main_int_base = of_iomap(node, 0); | ||
254 | per_cpu_int_base = of_iomap(node, 1); | ||
255 | |||
256 | BUG_ON(!main_int_base); | ||
257 | BUG_ON(!per_cpu_int_base); | ||
258 | |||
259 | control = readl(main_int_base + ARMADA_370_XP_INT_CONTROL); | ||
260 | |||
261 | armada_370_xp_mpic_domain = | ||
262 | irq_domain_add_linear(node, (control >> 2) & 0x3ff, | ||
263 | &armada_370_xp_mpic_irq_ops, NULL); | ||
264 | |||
265 | if (!armada_370_xp_mpic_domain) | ||
266 | panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n"); | ||
267 | |||
268 | irq_set_default_host(armada_370_xp_mpic_domain); | ||
269 | |||
270 | #ifdef CONFIG_SMP | ||
271 | armada_xp_mpic_smp_cpu_init(); | ||
272 | |||
273 | /* | ||
274 | * Set the default affinity from all CPUs to the boot cpu. | ||
275 | * This is required since the MPIC doesn't limit several CPUs | ||
276 | * from acknowledging the same interrupt. | ||
277 | */ | ||
278 | cpumask_clear(irq_default_affinity); | ||
279 | cpumask_set_cpu(smp_processor_id(), irq_default_affinity); | ||
280 | |||
281 | #endif | ||
282 | |||
283 | set_handle_irq(armada_370_xp_handle_irq); | ||
284 | |||
285 | return 0; | ||
286 | } | ||
287 | |||
288 | IRQCHIP_DECLARE(armada_370_xp_mpic, "marvell,mpic", armada_370_xp_mpic_of_init); | ||
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index b0fe393c882c..371cc66f1a0e 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -1139,6 +1139,35 @@ err_no_rxchan: | |||
1139 | return -ENODEV; | 1139 | return -ENODEV; |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | static int pl022_dma_autoprobe(struct pl022 *pl022) | ||
1143 | { | ||
1144 | struct device *dev = &pl022->adev->dev; | ||
1145 | |||
1146 | /* automatically configure DMA channels from platform, normally using DT */ | ||
1147 | pl022->dma_rx_channel = dma_request_slave_channel(dev, "rx"); | ||
1148 | if (!pl022->dma_rx_channel) | ||
1149 | goto err_no_rxchan; | ||
1150 | |||
1151 | pl022->dma_tx_channel = dma_request_slave_channel(dev, "tx"); | ||
1152 | if (!pl022->dma_tx_channel) | ||
1153 | goto err_no_txchan; | ||
1154 | |||
1155 | pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
1156 | if (!pl022->dummypage) | ||
1157 | goto err_no_dummypage; | ||
1158 | |||
1159 | return 0; | ||
1160 | |||
1161 | err_no_dummypage: | ||
1162 | dma_release_channel(pl022->dma_tx_channel); | ||
1163 | pl022->dma_tx_channel = NULL; | ||
1164 | err_no_txchan: | ||
1165 | dma_release_channel(pl022->dma_rx_channel); | ||
1166 | pl022->dma_rx_channel = NULL; | ||
1167 | err_no_rxchan: | ||
1168 | return -ENODEV; | ||
1169 | } | ||
1170 | |||
1142 | static void terminate_dma(struct pl022 *pl022) | 1171 | static void terminate_dma(struct pl022 *pl022) |
1143 | { | 1172 | { |
1144 | struct dma_chan *rxchan = pl022->dma_rx_channel; | 1173 | struct dma_chan *rxchan = pl022->dma_rx_channel; |
@@ -1167,6 +1196,11 @@ static inline int configure_dma(struct pl022 *pl022) | |||
1167 | return -ENODEV; | 1196 | return -ENODEV; |
1168 | } | 1197 | } |
1169 | 1198 | ||
1199 | static inline int pl022_dma_autoprobe(struct pl022 *pl022) | ||
1200 | { | ||
1201 | return 0; | ||
1202 | } | ||
1203 | |||
1170 | static inline int pl022_dma_probe(struct pl022 *pl022) | 1204 | static inline int pl022_dma_probe(struct pl022 *pl022) |
1171 | { | 1205 | { |
1172 | return 0; | 1206 | return 0; |
@@ -2226,8 +2260,13 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2226 | goto err_no_irq; | 2260 | goto err_no_irq; |
2227 | } | 2261 | } |
2228 | 2262 | ||
2229 | /* Get DMA channels */ | 2263 | /* Get DMA channels, try autoconfiguration first */ |
2230 | if (platform_info->enable_dma) { | 2264 | status = pl022_dma_autoprobe(pl022); |
2265 | |||
2266 | /* If that failed, use channels from platform_info */ | ||
2267 | if (status == 0) | ||
2268 | platform_info->enable_dma = 1; | ||
2269 | else if (platform_info->enable_dma) { | ||
2231 | status = pl022_dma_probe(pl022); | 2270 | status = pl022_dma_probe(pl022); |
2232 | if (status != 0) | 2271 | if (status != 0) |
2233 | platform_info->enable_dma = 0; | 2272 | platform_info->enable_dma = 0; |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index b2e9e177a354..8ab70a620919 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -267,7 +267,7 @@ static void pl011_sgbuf_free(struct dma_chan *chan, struct pl011_sgbuf *sg, | |||
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
270 | static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | 270 | static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *uap) |
271 | { | 271 | { |
272 | /* DMA is the sole user of the platform data right now */ | 272 | /* DMA is the sole user of the platform data right now */ |
273 | struct amba_pl011_data *plat = uap->port.dev->platform_data; | 273 | struct amba_pl011_data *plat = uap->port.dev->platform_data; |
@@ -281,20 +281,25 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
281 | struct dma_chan *chan; | 281 | struct dma_chan *chan; |
282 | dma_cap_mask_t mask; | 282 | dma_cap_mask_t mask; |
283 | 283 | ||
284 | /* We need platform data */ | 284 | chan = dma_request_slave_channel(dev, "tx"); |
285 | if (!plat || !plat->dma_filter) { | ||
286 | dev_info(uap->port.dev, "no DMA platform data\n"); | ||
287 | return; | ||
288 | } | ||
289 | 285 | ||
290 | /* Try to acquire a generic DMA engine slave TX channel */ | ||
291 | dma_cap_zero(mask); | ||
292 | dma_cap_set(DMA_SLAVE, mask); | ||
293 | |||
294 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_tx_param); | ||
295 | if (!chan) { | 286 | if (!chan) { |
296 | dev_err(uap->port.dev, "no TX DMA channel!\n"); | 287 | /* We need platform data */ |
297 | return; | 288 | if (!plat || !plat->dma_filter) { |
289 | dev_info(uap->port.dev, "no DMA platform data\n"); | ||
290 | return; | ||
291 | } | ||
292 | |||
293 | /* Try to acquire a generic DMA engine slave TX channel */ | ||
294 | dma_cap_zero(mask); | ||
295 | dma_cap_set(DMA_SLAVE, mask); | ||
296 | |||
297 | chan = dma_request_channel(mask, plat->dma_filter, | ||
298 | plat->dma_tx_param); | ||
299 | if (!chan) { | ||
300 | dev_err(uap->port.dev, "no TX DMA channel!\n"); | ||
301 | return; | ||
302 | } | ||
298 | } | 303 | } |
299 | 304 | ||
300 | dmaengine_slave_config(chan, &tx_conf); | 305 | dmaengine_slave_config(chan, &tx_conf); |
@@ -304,7 +309,18 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
304 | dma_chan_name(uap->dmatx.chan)); | 309 | dma_chan_name(uap->dmatx.chan)); |
305 | 310 | ||
306 | /* Optionally make use of an RX channel as well */ | 311 | /* Optionally make use of an RX channel as well */ |
307 | if (plat->dma_rx_param) { | 312 | chan = dma_request_slave_channel(dev, "rx"); |
313 | |||
314 | if (!chan && plat->dma_rx_param) { | ||
315 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param); | ||
316 | |||
317 | if (!chan) { | ||
318 | dev_err(uap->port.dev, "no RX DMA channel!\n"); | ||
319 | return; | ||
320 | } | ||
321 | } | ||
322 | |||
323 | if (chan) { | ||
308 | struct dma_slave_config rx_conf = { | 324 | struct dma_slave_config rx_conf = { |
309 | .src_addr = uap->port.mapbase + UART01x_DR, | 325 | .src_addr = uap->port.mapbase + UART01x_DR, |
310 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | 326 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, |
@@ -313,12 +329,6 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
313 | .device_fc = false, | 329 | .device_fc = false, |
314 | }; | 330 | }; |
315 | 331 | ||
316 | chan = dma_request_channel(mask, plat->dma_filter, plat->dma_rx_param); | ||
317 | if (!chan) { | ||
318 | dev_err(uap->port.dev, "no RX DMA channel!\n"); | ||
319 | return; | ||
320 | } | ||
321 | |||
322 | dmaengine_slave_config(chan, &rx_conf); | 332 | dmaengine_slave_config(chan, &rx_conf); |
323 | uap->dmarx.chan = chan; | 333 | uap->dmarx.chan = chan; |
324 | 334 | ||
@@ -360,6 +370,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
360 | struct dma_uap { | 370 | struct dma_uap { |
361 | struct list_head node; | 371 | struct list_head node; |
362 | struct uart_amba_port *uap; | 372 | struct uart_amba_port *uap; |
373 | struct device *dev; | ||
363 | }; | 374 | }; |
364 | 375 | ||
365 | static LIST_HEAD(pl011_dma_uarts); | 376 | static LIST_HEAD(pl011_dma_uarts); |
@@ -370,7 +381,7 @@ static int __init pl011_dma_initcall(void) | |||
370 | 381 | ||
371 | list_for_each_safe(node, tmp, &pl011_dma_uarts) { | 382 | list_for_each_safe(node, tmp, &pl011_dma_uarts) { |
372 | struct dma_uap *dmau = list_entry(node, struct dma_uap, node); | 383 | struct dma_uap *dmau = list_entry(node, struct dma_uap, node); |
373 | pl011_dma_probe_initcall(dmau->uap); | 384 | pl011_dma_probe_initcall(dmau->dev, dmau->uap); |
374 | list_del(node); | 385 | list_del(node); |
375 | kfree(dmau); | 386 | kfree(dmau); |
376 | } | 387 | } |
@@ -379,18 +390,19 @@ static int __init pl011_dma_initcall(void) | |||
379 | 390 | ||
380 | device_initcall(pl011_dma_initcall); | 391 | device_initcall(pl011_dma_initcall); |
381 | 392 | ||
382 | static void pl011_dma_probe(struct uart_amba_port *uap) | 393 | static void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
383 | { | 394 | { |
384 | struct dma_uap *dmau = kzalloc(sizeof(struct dma_uap), GFP_KERNEL); | 395 | struct dma_uap *dmau = kzalloc(sizeof(struct dma_uap), GFP_KERNEL); |
385 | if (dmau) { | 396 | if (dmau) { |
386 | dmau->uap = uap; | 397 | dmau->uap = uap; |
398 | dmau->dev = dev; | ||
387 | list_add_tail(&dmau->node, &pl011_dma_uarts); | 399 | list_add_tail(&dmau->node, &pl011_dma_uarts); |
388 | } | 400 | } |
389 | } | 401 | } |
390 | #else | 402 | #else |
391 | static void pl011_dma_probe(struct uart_amba_port *uap) | 403 | static void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
392 | { | 404 | { |
393 | pl011_dma_probe_initcall(uap); | 405 | pl011_dma_probe_initcall(dev, uap); |
394 | } | 406 | } |
395 | #endif | 407 | #endif |
396 | 408 | ||
@@ -1096,7 +1108,7 @@ static inline bool pl011_dma_rx_running(struct uart_amba_port *uap) | |||
1096 | 1108 | ||
1097 | #else | 1109 | #else |
1098 | /* Blank functions if the DMA engine is not available */ | 1110 | /* Blank functions if the DMA engine is not available */ |
1099 | static inline void pl011_dma_probe(struct uart_amba_port *uap) | 1111 | static inline void pl011_dma_probe(struct device *dev, struct uart_amba_port *uap) |
1100 | { | 1112 | { |
1101 | } | 1113 | } |
1102 | 1114 | ||
@@ -2155,7 +2167,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
2155 | uap->port.ops = &amba_pl011_pops; | 2167 | uap->port.ops = &amba_pl011_pops; |
2156 | uap->port.flags = UPF_BOOT_AUTOCONF; | 2168 | uap->port.flags = UPF_BOOT_AUTOCONF; |
2157 | uap->port.line = i; | 2169 | uap->port.line = i; |
2158 | pl011_dma_probe(uap); | 2170 | pl011_dma_probe(&dev->dev, uap); |
2159 | 2171 | ||
2160 | /* Ensure interrupts from this UART are masked and cleared */ | 2172 | /* Ensure interrupts from this UART are masked and cleared */ |
2161 | writew(0, uap->port.membase + UART011_IMSC); | 2173 | writew(0, uap->port.membase + UART011_IMSC); |