diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-03 08:22:06 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-03 08:22:06 -0700 |
commit | cf0223503e6198292cdcc864e01eeb5fe7490752 (patch) | |
tree | 5ed99ae5fc7a67ec19df19f4b46b0c04d97db174 /drivers | |
parent | 3f8ddb032afa729d4bad1bf2965d3ec068de6b72 (diff) | |
parent | e857bfd4604a3a4edaf9c7038db880d9f78aecbd (diff) | |
download | linux-cf0223503e6198292cdcc864e01eeb5fe7490752.tar.bz2 |
Merge branch 'sh-latest' of git://github.com/pmundt/linux-sh
* 'sh-latest' of git://github.com/pmundt/linux-sh:
sh: Add default uImage rule for sh7757lcr
sh: modify the asm/sh_eth.h to linux/sh_eth.h in sh7757lcr
sh: userimask.c needs linux/stat.h
sh: pfc: Add GPIO IRQ support
sh: modify the asm/sh_eth.h to linux/sh_eth.h in some boards
sh: pfc: Remove unused gpio_in_use member
sh: add parameters for EHCI and RIIC in clock-sh7757.c
sh: kexec: Add PHYSICAL_START
SH: irq: Remove IRQF_DISABLED
sh: pfc: get_config_reg() shift clean up
sh: intc: Add IRQ trigger bit field check
sh: drop unused Kconfig symbol
sh: Fix implicit declaration of function numa_node_id
sh: kexec: Register crashk_res
sh: ecovec: add renesas_usbhs DMAEngine support
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/sh/intc/chip.c | 9 | ||||
-rw-r--r-- | drivers/sh/intc/userimask.c | 1 | ||||
-rw-r--r-- | drivers/sh/pfc.c | 29 |
3 files changed, 36 insertions, 3 deletions
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c index 33b2ed451e09..e0ada3773786 100644 --- a/drivers/sh/intc/chip.c +++ b/drivers/sh/intc/chip.c @@ -202,11 +202,16 @@ static int intc_set_type(struct irq_data *data, unsigned int type) if (!value) return -EINVAL; + value &= ~SENSE_VALID_FLAG; + ihp = intc_find_irq(d->sense, d->nr_sense, irq); if (ihp) { + /* PINT has 2-bit sense registers, should fail on EDGE_BOTH */ + if (value >= (1 << _INTC_WIDTH(ihp->handle))) + return -EINVAL; + addr = INTC_REG(d, _INTC_ADDR_E(ihp->handle), 0); - intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, - value & ~SENSE_VALID_FLAG); + intc_reg_fns[_INTC_FN(ihp->handle)](addr, ihp->handle, value); } return 0; diff --git a/drivers/sh/intc/userimask.c b/drivers/sh/intc/userimask.c index e32304b66cf1..56bf9336b92b 100644 --- a/drivers/sh/intc/userimask.c +++ b/drivers/sh/intc/userimask.c @@ -13,6 +13,7 @@ #include <linux/sysdev.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/stat.h> #include <asm/sizes.h> #include "internals.h" diff --git a/drivers/sh/pfc.c b/drivers/sh/pfc.c index 75934e3ea34e..e67fe170d8d5 100644 --- a/drivers/sh/pfc.c +++ b/drivers/sh/pfc.c @@ -217,7 +217,7 @@ static int get_config_reg(struct pinmux_info *gpioc, pinmux_enum_t enum_id, if (!r_width) break; - for (n = 0; n < (r_width / f_width) * 1 << f_width; n++) { + for (n = 0; n < (r_width / f_width) * (1 << f_width); n++) { if (config_reg->enum_ids[n] == enum_id) { *crp = config_reg; *indexp = n; @@ -577,6 +577,32 @@ static void sh_gpio_set(struct gpio_chip *chip, unsigned offset, int value) sh_gpio_set_value(chip_to_pinmux(chip), offset, value); } +static int sh_gpio_to_irq(struct gpio_chip *chip, unsigned offset) +{ + struct pinmux_info *gpioc = chip_to_pinmux(chip); + pinmux_enum_t enum_id; + pinmux_enum_t *enum_ids; + int i, k, pos; + + pos = 0; + enum_id = 0; + while (1) { + pos = get_gpio_enum_id(gpioc, offset, pos, &enum_id); + if (pos <= 0 || !enum_id) + break; + + for (i = 0; i < gpioc->gpio_irq_size; i++) { + enum_ids = gpioc->gpio_irq[i].enum_ids; + for (k = 0; enum_ids[k]; k++) { + if (enum_ids[k] == enum_id) + return gpioc->gpio_irq[i].irq; + } + } + } + + return -ENOSYS; +} + int register_pinmux(struct pinmux_info *pip) { struct gpio_chip *chip = &pip->chip; @@ -592,6 +618,7 @@ int register_pinmux(struct pinmux_info *pip) chip->get = sh_gpio_get; chip->direction_output = sh_gpio_direction_output; chip->set = sh_gpio_set; + chip->to_irq = sh_gpio_to_irq; WARN_ON(pip->first_gpio != 0); /* needs testing */ |