aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-02 14:45:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-02 14:45:42 -0400
commit0a276d1675bc1b8de3ba269ba64b8f3e288d8309 (patch)
treeff552f58874b245f5962487ef53ce27ebcda5857 /drivers
parent25aa6a7ae46c6a041c46a2d314b9ab7c4f2baa41 (diff)
parent08298f0612e5e369d1da89b92cac5d2c71ddb9af (diff)
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Pull SuperH fixes from Paul Mundt. * tag 'sh-for-linus' of git://github.com/pmundt/linux-sh: (24 commits) sh: explicitly include sh_dma.h in setup-sh7722.c sh: ecovec: care CN5 VBUS if USB host mode sh: sh7724: fixup renesas_usbhs clock settings sh: intc: initial irqdomain support. sh: pfc: Fix up init ordering mess. serial: sh-sci: fix compilation breakage, when DMA is enabled dmaengine: shdma: restore partial transfer calculation sh: modify the sh_dmae_slave_config for RSPI in setup-sh7757 sh: Fix up recursive fault in oops with unset TTB. sh: pfc: Build fix for pinctrl_remove_gpio_range() changes. sh: select the fixed regulator driver on several boards sh: ecovec: switch MMC power control to regulators sh: add fixed voltage regulators to se7724 sh: add fixed voltage regulators to sdk7786 sh: add fixed voltage regulators to rsk sh: add fixed voltage regulators to migor sh: add fixed voltage regulators to kfr2r09 sh: add fixed voltage regulators to ap325rxa sh: add fixed voltage regulators to sh7757lcr sh: add fixed voltage regulators to sh2007 ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dma/sh/shdma-base.c9
-rw-r--r--drivers/dma/sh/shdma.c12
-rw-r--r--drivers/sh/intc/Kconfig4
-rw-r--r--drivers/sh/intc/Makefile2
-rw-r--r--drivers/sh/intc/core.c11
-rw-r--r--drivers/sh/intc/internals.h5
-rw-r--r--drivers/sh/intc/irqdomain.c68
-rw-r--r--drivers/sh/pfc/pinctrl.c34
-rw-r--r--drivers/tty/serial/sh-sci.c5
9 files changed, 124 insertions, 26 deletions
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 27f5c781fd73..f4cd946d259d 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -483,6 +483,7 @@ static struct shdma_desc *shdma_add_desc(struct shdma_chan *schan,
483 new->mark = DESC_PREPARED; 483 new->mark = DESC_PREPARED;
484 new->async_tx.flags = flags; 484 new->async_tx.flags = flags;
485 new->direction = direction; 485 new->direction = direction;
486 new->partial = 0;
486 487
487 *len -= copy_size; 488 *len -= copy_size;
488 if (direction == DMA_MEM_TO_MEM || direction == DMA_MEM_TO_DEV) 489 if (direction == DMA_MEM_TO_MEM || direction == DMA_MEM_TO_DEV)
@@ -644,6 +645,14 @@ static int shdma_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
644 case DMA_TERMINATE_ALL: 645 case DMA_TERMINATE_ALL:
645 spin_lock_irqsave(&schan->chan_lock, flags); 646 spin_lock_irqsave(&schan->chan_lock, flags);
646 ops->halt_channel(schan); 647 ops->halt_channel(schan);
648
649 if (ops->get_partial && !list_empty(&schan->ld_queue)) {
650 /* Record partial transfer */
651 struct shdma_desc *desc = list_first_entry(&schan->ld_queue,
652 struct shdma_desc, node);
653 desc->partial = ops->get_partial(schan, desc);
654 }
655
647 spin_unlock_irqrestore(&schan->chan_lock, flags); 656 spin_unlock_irqrestore(&schan->chan_lock, flags);
648 657
649 shdma_chan_ld_cleanup(schan, true); 658 shdma_chan_ld_cleanup(schan, true);
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
index 027c9be97654..f41bcc5267fd 100644
--- a/drivers/dma/sh/shdma.c
+++ b/drivers/dma/sh/shdma.c
@@ -381,6 +381,17 @@ static bool sh_dmae_chan_irq(struct shdma_chan *schan, int irq)
381 return true; 381 return true;
382} 382}
383 383
384static size_t sh_dmae_get_partial(struct shdma_chan *schan,
385 struct shdma_desc *sdesc)
386{
387 struct sh_dmae_chan *sh_chan = container_of(schan, struct sh_dmae_chan,
388 shdma_chan);
389 struct sh_dmae_desc *sh_desc = container_of(sdesc,
390 struct sh_dmae_desc, shdma_desc);
391 return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) <<
392 sh_chan->xmit_shift;
393}
394
384/* Called from error IRQ or NMI */ 395/* Called from error IRQ or NMI */
385static bool sh_dmae_reset(struct sh_dmae_device *shdev) 396static bool sh_dmae_reset(struct sh_dmae_device *shdev)
386{ 397{
@@ -632,6 +643,7 @@ static const struct shdma_ops sh_dmae_shdma_ops = {
632 .start_xfer = sh_dmae_start_xfer, 643 .start_xfer = sh_dmae_start_xfer,
633 .embedded_desc = sh_dmae_embedded_desc, 644 .embedded_desc = sh_dmae_embedded_desc,
634 .chan_irq = sh_dmae_chan_irq, 645 .chan_irq = sh_dmae_chan_irq,
646 .get_partial = sh_dmae_get_partial,
635}; 647};
636 648
637static int __devinit sh_dmae_probe(struct platform_device *pdev) 649static int __devinit sh_dmae_probe(struct platform_device *pdev)
diff --git a/drivers/sh/intc/Kconfig b/drivers/sh/intc/Kconfig
index c88cbccc62b0..a305731742a9 100644
--- a/drivers/sh/intc/Kconfig
+++ b/drivers/sh/intc/Kconfig
@@ -1,3 +1,7 @@
1config SH_INTC
2 def_bool y
3 select IRQ_DOMAIN
4
1comment "Interrupt controller options" 5comment "Interrupt controller options"
2 6
3config INTC_USERIMASK 7config INTC_USERIMASK
diff --git a/drivers/sh/intc/Makefile b/drivers/sh/intc/Makefile
index 44f006d09471..54ec2a0643df 100644
--- a/drivers/sh/intc/Makefile
+++ b/drivers/sh/intc/Makefile
@@ -1,4 +1,4 @@
1obj-y := access.o chip.o core.o handle.o virq.o 1obj-y := access.o chip.o core.o handle.o irqdomain.o virq.o
2 2
3obj-$(CONFIG_INTC_BALANCING) += balancing.o 3obj-$(CONFIG_INTC_BALANCING) += balancing.o
4obj-$(CONFIG_INTC_USERIMASK) += userimask.o 4obj-$(CONFIG_INTC_USERIMASK) += userimask.o
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 7e562ccb6997..2374468615ed 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -25,6 +25,7 @@
25#include <linux/stat.h> 25#include <linux/stat.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/sh_intc.h> 27#include <linux/sh_intc.h>
28#include <linux/irqdomain.h>
28#include <linux/device.h> 29#include <linux/device.h>
29#include <linux/syscore_ops.h> 30#include <linux/syscore_ops.h>
30#include <linux/list.h> 31#include <linux/list.h>
@@ -310,6 +311,8 @@ int __init register_intc_controller(struct intc_desc *desc)
310 311
311 BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */ 312 BUG_ON(k > 256); /* _INTC_ADDR_E() and _INTC_ADDR_D() are 8 bits */
312 313
314 intc_irq_domain_init(d, hw);
315
313 /* register the vectors one by one */ 316 /* register the vectors one by one */
314 for (i = 0; i < hw->nr_vectors; i++) { 317 for (i = 0; i < hw->nr_vectors; i++) {
315 struct intc_vect *vect = hw->vectors + i; 318 struct intc_vect *vect = hw->vectors + i;
@@ -319,8 +322,8 @@ int __init register_intc_controller(struct intc_desc *desc)
319 if (!vect->enum_id) 322 if (!vect->enum_id)
320 continue; 323 continue;
321 324
322 res = irq_alloc_desc_at(irq, numa_node_id()); 325 res = irq_create_identity_mapping(d->domain, irq);
323 if (res != irq && res != -EEXIST) { 326 if (unlikely(res)) {
324 pr_err("can't get irq_desc for %d\n", irq); 327 pr_err("can't get irq_desc for %d\n", irq);
325 continue; 328 continue;
326 } 329 }
@@ -340,8 +343,8 @@ int __init register_intc_controller(struct intc_desc *desc)
340 * IRQ support, each vector still needs to have 343 * IRQ support, each vector still needs to have
341 * its own backing irq_desc. 344 * its own backing irq_desc.
342 */ 345 */
343 res = irq_alloc_desc_at(irq2, numa_node_id()); 346 res = irq_create_identity_mapping(d->domain, irq2);
344 if (res != irq2 && res != -EEXIST) { 347 if (unlikely(res)) {
345 pr_err("can't get irq_desc for %d\n", irq2); 348 pr_err("can't get irq_desc for %d\n", irq2);
346 continue; 349 continue;
347 } 350 }
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index f034a979a16f..7dff08e2a071 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -1,5 +1,6 @@
1#include <linux/sh_intc.h> 1#include <linux/sh_intc.h>
2#include <linux/irq.h> 2#include <linux/irq.h>
3#include <linux/irqdomain.h>
3#include <linux/list.h> 4#include <linux/list.h>
4#include <linux/kernel.h> 5#include <linux/kernel.h>
5#include <linux/types.h> 6#include <linux/types.h>
@@ -66,6 +67,7 @@ struct intc_desc_int {
66 unsigned int nr_sense; 67 unsigned int nr_sense;
67 struct intc_window *window; 68 struct intc_window *window;
68 unsigned int nr_windows; 69 unsigned int nr_windows;
70 struct irq_domain *domain;
69 struct irq_chip chip; 71 struct irq_chip chip;
70 bool skip_suspend; 72 bool skip_suspend;
71}; 73};
@@ -187,6 +189,9 @@ unsigned long intc_get_ack_handle(unsigned int irq);
187void intc_enable_disable_enum(struct intc_desc *desc, struct intc_desc_int *d, 189void intc_enable_disable_enum(struct intc_desc *desc, struct intc_desc_int *d,
188 intc_enum enum_id, int enable); 190 intc_enum enum_id, int enable);
189 191
192/* irqdomain.c */
193void intc_irq_domain_init(struct intc_desc_int *d, struct intc_hw_desc *hw);
194
190/* virq.c */ 195/* virq.c */
191void intc_subgroup_init(struct intc_desc *desc, struct intc_desc_int *d); 196void intc_subgroup_init(struct intc_desc *desc, struct intc_desc_int *d);
192void intc_irq_xlate_set(unsigned int irq, intc_enum id, struct intc_desc_int *d); 197void intc_irq_xlate_set(unsigned int irq, intc_enum id, struct intc_desc_int *d);
diff --git a/drivers/sh/intc/irqdomain.c b/drivers/sh/intc/irqdomain.c
new file mode 100644
index 000000000000..3968f1c3c5c3
--- /dev/null
+++ b/drivers/sh/intc/irqdomain.c
@@ -0,0 +1,68 @@
1/*
2 * IRQ domain support for SH INTC subsystem
3 *
4 * Copyright (C) 2012 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#define pr_fmt(fmt) "intc: " fmt
11
12#include <linux/irqdomain.h>
13#include <linux/sh_intc.h>
14#include <linux/export.h>
15#include "internals.h"
16
17/**
18 * intc_irq_domain_evt_xlate() - Generic xlate for vectored IRQs.
19 *
20 * This takes care of exception vector to hwirq translation through
21 * by way of evt2irq() translation.
22 *
23 * Note: For platforms that use a flat vector space without INTEVT this
24 * basically just mimics irq_domain_xlate_onecell() by way of a nopped
25 * out evt2irq() implementation.
26 */
27static int intc_evt_xlate(struct irq_domain *d, struct device_node *ctrlr,
28 const u32 *intspec, unsigned int intsize,
29 unsigned long *out_hwirq, unsigned int *out_type)
30{
31 if (WARN_ON(intsize < 1))
32 return -EINVAL;
33
34 *out_hwirq = evt2irq(intspec[0]);
35 *out_type = IRQ_TYPE_NONE;
36
37 return 0;
38}
39
40static const struct irq_domain_ops intc_evt_ops = {
41 .xlate = intc_evt_xlate,
42};
43
44void __init intc_irq_domain_init(struct intc_desc_int *d,
45 struct intc_hw_desc *hw)
46{
47 unsigned int irq_base, irq_end;
48
49 /*
50 * Quick linear revmap check
51 */
52 irq_base = evt2irq(hw->vectors[0].vect);
53 irq_end = evt2irq(hw->vectors[hw->nr_vectors - 1].vect);
54
55 /*
56 * Linear domains have a hard-wired assertion that IRQs start at
57 * 0 in order to make some performance optimizations. Lamely
58 * restrict the linear case to these conditions here, taking the
59 * tree penalty for linear cases with non-zero hwirq bases.
60 */
61 if (irq_base == 0 && irq_end == (irq_base + hw->nr_vectors - 1))
62 d->domain = irq_domain_add_linear(NULL, hw->nr_vectors,
63 &intc_evt_ops, NULL);
64 else
65 d->domain = irq_domain_add_tree(NULL, &intc_evt_ops, NULL);
66
67 BUG_ON(!d->domain);
68}
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c
index 0802b6c0d653..2804eaae804e 100644
--- a/drivers/sh/pfc/pinctrl.c
+++ b/drivers/sh/pfc/pinctrl.c
@@ -276,7 +276,6 @@ static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
276 unsigned long config) 276 unsigned long config)
277{ 277{
278 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); 278 struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
279 struct sh_pfc *pfc = pmx->pfc;
280 279
281 /* Validate the new type */ 280 /* Validate the new type */
282 if (config >= PINMUX_FLAG_TYPE) 281 if (config >= PINMUX_FLAG_TYPE)
@@ -326,20 +325,6 @@ static struct pinctrl_desc sh_pfc_pinctrl_desc = {
326 .confops = &sh_pfc_pinconf_ops, 325 .confops = &sh_pfc_pinconf_ops,
327}; 326};
328 327
329int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
330{
331 sh_pfc_pmx = kzalloc(sizeof(struct sh_pfc_pinctrl), GFP_KERNEL);
332 if (unlikely(!sh_pfc_pmx))
333 return -ENOMEM;
334
335 spin_lock_init(&sh_pfc_pmx->lock);
336
337 sh_pfc_pmx->pfc = pfc;
338
339 return 0;
340}
341EXPORT_SYMBOL_GPL(sh_pfc_register_pinctrl);
342
343static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc, 328static inline void __devinit sh_pfc_map_one_gpio(struct sh_pfc *pfc,
344 struct sh_pfc_pinctrl *pmx, 329 struct sh_pfc_pinctrl *pmx,
345 struct pinmux_gpio *gpio, 330 struct pinmux_gpio *gpio,
@@ -481,7 +466,6 @@ static int __devexit sh_pfc_pinctrl_remove(struct platform_device *pdev)
481{ 466{
482 struct sh_pfc_pinctrl *pmx = platform_get_drvdata(pdev); 467 struct sh_pfc_pinctrl *pmx = platform_get_drvdata(pdev);
483 468
484 pinctrl_remove_gpio_range(pmx->pctl, &sh_pfc_gpio_range);
485 pinctrl_unregister(pmx->pctl); 469 pinctrl_unregister(pmx->pctl);
486 470
487 platform_set_drvdata(pdev, NULL); 471 platform_set_drvdata(pdev, NULL);
@@ -507,7 +491,7 @@ static struct platform_device sh_pfc_pinctrl_device = {
507 .id = -1, 491 .id = -1,
508}; 492};
509 493
510static int __init sh_pfc_pinctrl_init(void) 494static int sh_pfc_pinctrl_init(void)
511{ 495{
512 int rc; 496 int rc;
513 497
@@ -521,10 +505,22 @@ static int __init sh_pfc_pinctrl_init(void)
521 return rc; 505 return rc;
522} 506}
523 507
508int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
509{
510 sh_pfc_pmx = kzalloc(sizeof(struct sh_pfc_pinctrl), GFP_KERNEL);
511 if (unlikely(!sh_pfc_pmx))
512 return -ENOMEM;
513
514 spin_lock_init(&sh_pfc_pmx->lock);
515
516 sh_pfc_pmx->pfc = pfc;
517
518 return sh_pfc_pinctrl_init();
519}
520EXPORT_SYMBOL_GPL(sh_pfc_register_pinctrl);
521
524static void __exit sh_pfc_pinctrl_exit(void) 522static void __exit sh_pfc_pinctrl_exit(void)
525{ 523{
526 platform_driver_unregister(&sh_pfc_pinctrl_driver); 524 platform_driver_unregister(&sh_pfc_pinctrl_driver);
527} 525}
528
529subsys_initcall(sh_pfc_pinctrl_init);
530module_exit(sh_pfc_pinctrl_exit); 526module_exit(sh_pfc_pinctrl_exit);
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d4d8c9453cd8..9be296cf7295 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -25,6 +25,7 @@
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/sh_dma.h>
28#include <linux/timer.h> 29#include <linux/timer.h>
29#include <linux/interrupt.h> 30#include <linux/interrupt.h>
30#include <linux/tty.h> 31#include <linux/tty.h>
@@ -1410,8 +1411,8 @@ static void work_fn_rx(struct work_struct *work)
1410 /* Handle incomplete DMA receive */ 1411 /* Handle incomplete DMA receive */
1411 struct tty_struct *tty = port->state->port.tty; 1412 struct tty_struct *tty = port->state->port.tty;
1412 struct dma_chan *chan = s->chan_rx; 1413 struct dma_chan *chan = s->chan_rx;
1413 struct sh_desc *sh_desc = container_of(desc, struct sh_desc, 1414 struct shdma_desc *sh_desc = container_of(desc,
1414 async_tx); 1415 struct shdma_desc, async_tx);
1415 unsigned long flags; 1416 unsigned long flags;
1416 int count; 1417 int count;
1417 1418