Merge tag 'pinctrl-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 21 Jan 2014 18:14:10 +0000 (10:14 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 21 Jan 2014 18:14:10 +0000 (10:14 -0800)
Pull bulk pin control changes from Linus Walleij:
 "This has been queued and tested for a while.  Lots of action here,
  like in the GPIO tree, embedded stuff like this is really hot now it
  seems.  Details in the signed tag.  I'm especially happy about the
  Qualcomm driver as it is used in such a huge subset of mobile handsets
  out there, and these platforms in general need better upstream support

   - New driver for the Qualcomm TLMM pin controller and its msm8x74
     subdriver.

   - New driver for the Broadcom Capri BCM281xx SoC.

   - New subdriver for the imx25 pin controller.

   - New subdriver for the Tegra124 pin controller.

   - Lock GPIO lines as IRQs for select combined pin control and GPIO
     drivers for baytrail and sirf.

   - Some semi-big refactorings and extenstions to the sirf driver.

   - Lots of patching, cleanup and fixing in the Renesas "PFC" driver
     and associated subdrivers as usual.  It is settling down a little
     bit now it seems.

   - Minor fixes and incremental updates here and there as usual"

* tag 'pinctrl-v3.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (72 commits)
  pinctrl: sunxi: Honor GPIO output initial vaules
  pinctrl: capri: add dependency on OF
  ARM: bcm11351: Enable pinctrl for Broadcom Capri SoCs
  ARM: pinctrl: Add Broadcom Capri pinctrl driver
  pinctrl: Add pinctrl binding for Broadcom Capri SoCs
  pinctrl: Add void * to pinctrl_pin_desc
  pinctrl: st: Fix a typo in probe
  pinctrl: Fix some typos and grammar issues in the documentation
  pinctrl: sirf: lock IRQs when starting them
  pinctrl: sirf: put gpio interrupt pin into input status automatically
  pinctrl: sirf: use only one irq_domain for the whole device node
  pinctrl: single: fix infinite loop caused by bad mask
  pinctrl: single: fix pcs_disable with bits_per_mux
  pinctrl: single: fix DT bindings documentation
  pinctrl: as3722: Set pin to output mode for some function
  pinctrl: sirf: add pin group for USP0 with only RX or TX frame sync
  pinctrl: sirf: fix the pins of sdmmc5 connected with TriG
  pinctrl: sirf: add lost usp1_uart_nostreamctrl group for atlas6
  pinctrl: sunxi: Add Allwinner A20 clock output pin functions
  pinctrl/lantiq: fix typo
  ...

1  2 
drivers/pinctrl/pinctrl-as3722.c
drivers/pinctrl/pinctrl-at91.c
drivers/pinctrl/pinctrl-baytrail.c
drivers/pinctrl/pinctrl-nomadik.c
drivers/pinctrl/pinctrl-sunxi.c
drivers/pinctrl/sh-pfc/pfc-r8a7740.c
drivers/pinctrl/sh-pfc/pfc-sh7372.c
drivers/pinctrl/sh-pfc/sh_pfc.h

@@@ -250,6 -250,26 +250,26 @@@ static int as3722_pinctrl_enable(struc
                return ret;
        }
        as_pci->gpio_control[group].io_function = function;
+       switch (val) {
+       case AS3722_GPIO_IOSF_SD0_OUT:
+       case AS3722_GPIO_IOSF_PWR_GOOD_OUT:
+       case AS3722_GPIO_IOSF_Q32K_OUT:
+       case AS3722_GPIO_IOSF_PWM_OUT:
+       case AS3722_GPIO_IOSF_SD6_LOW_VOLT_LOW:
+               ret = as3722_update_bits(as_pci->as3722, gpio_cntr_reg,
+                       AS3722_GPIO_MODE_MASK, AS3722_GPIO_MODE_OUTPUT_VDDH);
+               if (ret < 0) {
+                       dev_err(as_pci->dev, "GPIO%d_CTRL update failed %d\n",
+                               group, ret);
+                       return ret;
+               }
+               as_pci->gpio_control[group].mode_prop =
+                               AS3722_GPIO_MODE_OUTPUT_VDDH;
+               break;
+       default:
+               break;
+       }
        return ret;
  }
  
@@@ -531,7 -551,7 +551,7 @@@ static const struct gpio_chip as3722_gp
        .direction_input        = as3722_gpio_direction_input,
        .direction_output       = as3722_gpio_direction_output,
        .to_irq                 = as3722_gpio_to_irq,
 -      .can_sleep              = 1,
 +      .can_sleep              = true,
        .ngpio                  = AS3722_PIN_NUM,
        .base                   = -1,
  };
@@@ -118,7 -118,7 +118,7 @@@ struct at91_pin_group 
  };
  
  /**
-  * struct at91_pinctrl_mux_ops - describes an At91 mux ops group
+  * struct at91_pinctrl_mux_ops - describes an AT91 mux ops group
   * on new IP with support for periph C and D the way to mux in
   * periph A and B has changed
   * So provide the right call back
@@@ -722,7 -722,8 +722,8 @@@ static int at91_pinconf_get(struct pinc
        unsigned pin;
        int div;
  
-       dev_dbg(info->dev, "%s:%d, pin_id=%d, config=0x%lx", __func__, __LINE__, pin_id, *config);
+       *config = 0;
+       dev_dbg(info->dev, "%s:%d, pin_id=%d", __func__, __LINE__, pin_id);
        pio = pin_to_controller(info, pin_to_bank(pin_id));
        pin = pin_id % MAX_NB_GPIO_PER_BANK;
  
@@@ -783,10 -784,35 +784,35 @@@ static int at91_pinconf_set(struct pinc
        return 0;
  }
  
+ #define DBG_SHOW_FLAG(flag) do {              \
+       if (config & flag) {                    \
+               if (num_conf)                   \
+                       seq_puts(s, "|");       \
+               seq_puts(s, #flag);             \
+               num_conf++;                     \
+       }                                       \
+ } while (0)
  static void at91_pinconf_dbg_show(struct pinctrl_dev *pctldev,
                                   struct seq_file *s, unsigned pin_id)
  {
+       unsigned long config;
+       int ret, val, num_conf = 0;
+       ret = at91_pinconf_get(pctldev, pin_id, &config);
+       DBG_SHOW_FLAG(MULTI_DRIVE);
+       DBG_SHOW_FLAG(PULL_UP);
+       DBG_SHOW_FLAG(PULL_DOWN);
+       DBG_SHOW_FLAG(DIS_SCHMIT);
+       DBG_SHOW_FLAG(DEGLITCH);
+       DBG_SHOW_FLAG(DEBOUNCE);
+       if (config & DEBOUNCE) {
+               val = config >> DEBOUNCE_VAL_SHIFT;
+               seq_printf(s, "(%d)", val);
+       }
  
+       return;
  }
  
  static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
@@@ -1339,13 -1365,11 +1365,11 @@@ void at91_pinctrl_gpio_suspend(void
                __raw_writel(backups[i], pio + PIO_IDR);
                __raw_writel(wakeups[i], pio + PIO_IER);
  
-               if (!wakeups[i]) {
-                       clk_unprepare(gpio_chips[i]->clock);
-                       clk_disable(gpio_chips[i]->clock);
-               } else {
+               if (!wakeups[i])
+                       clk_disable_unprepare(gpio_chips[i]->clock);
+               else
                        printk(KERN_DEBUG "GPIO-%c may wake for %08x\n",
                               'A'+i, wakeups[i]);
-               }
        }
  }
  
@@@ -1361,10 -1385,8 +1385,8 @@@ void at91_pinctrl_gpio_resume(void
  
                pio = gpio_chips[i]->regbase;
  
-               if (!wakeups[i]) {
-                       if (clk_prepare(gpio_chips[i]->clock) == 0)
-                               clk_enable(gpio_chips[i]->clock);
-               }
+               if (!wakeups[i])
+                       clk_prepare_enable(gpio_chips[i]->clock);
  
                __raw_writel(wakeups[i], pio + PIO_IDR);
                __raw_writel(backups[i], pio + PIO_IER);
@@@ -1396,7 -1418,7 +1418,7 @@@ static void gpio_irq_handler(unsigned i
        chained_irq_enter(chip, desc);
        for (;;) {
                /* Reading ISR acks pending (edge triggered) GPIO interrupts.
-                * When there none are pending, we're finished unless we need
+                * When there are none pending, we're finished unless we need
                 * to process multiple banks (like ID_PIOCDE on sam9263).
                 */
                isr = readl_relaxed(pio + PIO_ISR) & readl_relaxed(pio + PIO_IMR);
@@@ -1505,7 -1527,7 +1527,7 @@@ static int at91_gpio_of_irq_setup(struc
                prev = gpio_chips[at91_gpio->pioc_idx - 1];
  
        /* The top level handler handles one bank of GPIOs, except
-        * on some SoC it can handles up to three...
+        * on some SoC it can handle up to three...
         * We only set up the handler for the first of the list.
         */
        if (prev && prev->next == at91_gpio)
@@@ -1527,7 -1549,7 +1549,7 @@@ static struct gpio_chip at91_gpio_templ
        .set                    = at91_gpio_set,
        .to_irq                 = at91_gpio_to_irq,
        .dbg_show               = at91_gpio_dbg_show,
 -      .can_sleep              = 0,
 +      .can_sleep              = false,
        .ngpio                  = MAX_NB_GPIO_PER_BANK,
  };
  
@@@ -29,6 -29,7 +29,6 @@@
  #include <linux/gpio.h>
  #include <linux/irqdomain.h>
  #include <linux/acpi.h>
 -#include <linux/acpi_gpio.h>
  #include <linux/platform_device.h>
  #include <linux/seq_file.h>
  #include <linux/io.h>
@@@ -285,13 -286,19 +285,19 @@@ static void byt_gpio_dbg_show(struct se
        spin_lock_irqsave(&vg->lock, flags);
  
        for (i = 0; i < vg->chip.ngpio; i++) {
+               const char *label;
                offs = vg->range->pins[i] * 16;
                conf0 = readl(vg->reg_base + offs + BYT_CONF0_REG);
                val = readl(vg->reg_base + offs + BYT_VAL_REG);
  
+               label = gpiochip_is_requested(chip, i);
+               if (!label)
+                       label = "Unrequested";
                seq_printf(s,
-                          " gpio-%-3d %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n",
+                          " gpio-%-3d (%-20.20s) %s %s %s pad-%-3d offset:0x%03x mux:%d %s%s%s\n",
                           i,
+                          label,
                           val & BYT_INPUT_EN ? "  " : "in",
                           val & BYT_OUTPUT_EN ? "   " : "out",
                           val & BYT_LEVEL ? "hi" : "lo",
@@@ -365,11 -372,33 +371,33 @@@ static void byt_irq_mask(struct irq_dat
  {
  }
  
+ static unsigned int byt_irq_startup(struct irq_data *d)
+ {
+       struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
+       if (gpio_lock_as_irq(&vg->chip, irqd_to_hwirq(d)))
+               dev_err(vg->chip.dev,
+                       "unable to lock HW IRQ %lu for IRQ\n",
+                       irqd_to_hwirq(d));
+       byt_irq_unmask(d);
+       return 0;
+ }
+ static void byt_irq_shutdown(struct irq_data *d)
+ {
+       struct byt_gpio *vg = irq_data_get_irq_chip_data(d);
+       byt_irq_mask(d);
+       gpio_unlock_as_irq(&vg->chip, irqd_to_hwirq(d));
+ }
  static struct irq_chip byt_irqchip = {
        .name = "BYT-GPIO",
        .irq_mask = byt_irq_mask,
        .irq_unmask = byt_irq_unmask,
        .irq_set_type = byt_irq_type,
+       .irq_startup = byt_irq_startup,
+       .irq_shutdown = byt_irq_shutdown,
  };
  
  static void byt_gpio_irq_init_hw(struct byt_gpio *vg)
@@@ -460,7 -489,7 +488,7 @@@ static int byt_gpio_probe(struct platfo
        gc->set = byt_gpio_set;
        gc->dbg_show = byt_gpio_dbg_show;
        gc->base = -1;
 -      gc->can_sleep = 0;
 +      gc->can_sleep = false;
        gc->dev = dev;
  
        ret = gpiochip_add(gc);
  
                irq_set_handler_data(hwirq, vg);
                irq_set_chained_handler(hwirq, byt_gpio_irq_handler);
 -
 -              /* Register interrupt handlers for gpio signaled acpi events */
 -              acpi_gpiochip_request_interrupts(gc);
        }
  
        pm_runtime_enable(dev);
@@@ -846,14 -846,14 +846,14 @@@ static void nmk_gpio_dbg_show_one(struc
                   (mode < 0) ? "unknown" : modes[mode],
                   pull ? "pull" : "none");
  
-       if (label && !is_out) {
-               int             irq = gpio_to_irq(gpio);
+       if (!is_out) {
+               int irq = gpio_to_irq(gpio);
                struct irq_desc *desc = irq_to_desc(irq);
  
                /* This races with request_irq(), set_irq_type(),
                 * and set_irq_wake() ... but those are "rare".
                 */
-               if (irq >= 0 && desc->action) {
+               if (irq > 0 && desc && desc->action) {
                        char *trigger;
                        u32 bitmask = nmk_gpio_get_bitmask(gpio);
  
@@@ -904,7 -904,7 +904,7 @@@ static struct gpio_chip nmk_gpio_templa
        .set                    = nmk_gpio_set_output,
        .to_irq                 = nmk_gpio_to_irq,
        .dbg_show               = nmk_gpio_dbg_show,
 -      .can_sleep              = 0,
 +      .can_sleep              = false,
  };
  
  void nmk_gpio_clocks_enable(void)
@@@ -469,12 -469,6 +469,6 @@@ static int sunxi_pinctrl_gpio_get(struc
        return val;
  }
  
- static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
-                                       unsigned offset, int value)
- {
-       return pinctrl_gpio_direction_output(chip->base + offset);
- }
  static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
                                unsigned offset, int value)
  {
        spin_unlock_irqrestore(&pctl->lock, flags);
  }
  
+ static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
+                                       unsigned offset, int value)
+ {
+       sunxi_pinctrl_gpio_set(chip, offset, value);
+       return pinctrl_gpio_direction_output(chip->base + offset);
+ }
  static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
                                const struct of_phandle_args *gpiospec,
                                u32 *flags)
@@@ -547,7 -548,7 +548,7 @@@ static struct gpio_chip sunxi_pinctrl_g
        .of_xlate               = sunxi_pinctrl_gpio_of_xlate,
        .to_irq                 = sunxi_pinctrl_gpio_to_irq,
        .of_gpio_n_cells        = 3,
 -      .can_sleep              = 0,
 +      .can_sleep              = false,
  };
  
  static int sunxi_pinctrl_irq_set_type(struct irq_data *d,
@@@ -1543,7 -1543,7 +1543,7 @@@ static const u16 pinmux_data[] = 
  #define R8A7740_PIN_O(pin)            SH_PFC_PIN_CFG(pin, __O)
  #define R8A7740_PIN_O_PU_PD(pin)      SH_PFC_PIN_CFG(pin, __O | __PUD)
  
- static struct sh_pfc_pin pinmux_pins[] = {
+ static const struct sh_pfc_pin pinmux_pins[] = {
        /* Table 56-1 (I/O and Pull U/D) */
        R8A7740_PIN_IO_PD(0),           R8A7740_PIN_IO_PD(1),
        R8A7740_PIN_IO_PD(2),           R8A7740_PIN_IO_PD(3),
@@@ -3234,17 -3234,6 +3234,6 @@@ static const struct sh_pfc_function pin
        SH_PFC_FUNCTION(tpu0),
  };
  
- #undef PORTCR
- #define PORTCR(nr, reg)                                                       \
-       {                                                               \
-               PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) {             \
-                       _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT),     \
-                               PORT##nr##_FN0, PORT##nr##_FN1,         \
-                               PORT##nr##_FN2, PORT##nr##_FN3,         \
-                               PORT##nr##_FN4, PORT##nr##_FN5,         \
-                               PORT##nr##_FN6, PORT##nr##_FN7 }        \
-       }
  static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        PORTCR(0,       0xe6050000), /* PORT0CR */
        PORTCR(1,       0xe6050001), /* PORT1CR */
@@@ -3720,8 -3709,8 +3709,8 @@@ static void __iomem *r8a7740_pinmux_por
                const struct r8a7740_portcr_group *group =
                        &r8a7740_portcr_offsets[i];
  
 -              if (i <= group->end_pin)
 +              if (pin <= group->end_pin)
-                       return pfc->window->virt + group->offset + pin;
+                       return pfc->windows->virt + group->offset + pin;
        }
  
        return NULL;
@@@ -844,7 -844,7 +844,7 @@@ static const u16 pinmux_data[] = 
  #define SH7372_PIN_O(pin)             SH_PFC_PIN_CFG(pin, __O)
  #define SH7372_PIN_O_PU_PD(pin)               SH_PFC_PIN_CFG(pin, __O | __PUD)
  
- static struct sh_pfc_pin pinmux_pins[] = {
+ static const struct sh_pfc_pin pinmux_pins[] = {
        /* Table 57-1 (I/O and Pull U/D) */
        SH7372_PIN_IO_PD(0),            SH7372_PIN_IO_PD(1),
        SH7372_PIN_O(2),                SH7372_PIN_I_PD(3),
@@@ -2118,17 -2118,6 +2118,6 @@@ static const struct sh_pfc_function pin
        SH_PFC_FUNCTION(usb1),
  };
  
- #undef PORTCR
- #define PORTCR(nr, reg)                                                       \
-       {                                                               \
-               PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) {             \
-                       _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT),     \
-                               PORT##nr##_FN0, PORT##nr##_FN1,         \
-                               PORT##nr##_FN2, PORT##nr##_FN3,         \
-                               PORT##nr##_FN4, PORT##nr##_FN5,         \
-                               PORT##nr##_FN6, PORT##nr##_FN7 }        \
-       }
  static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        PORTCR(0,       0xE6051000), /* PORT0CR */
        PORTCR(1,       0xE6051001), /* PORT1CR */
@@@ -2584,8 -2573,8 +2573,8 @@@ static void __iomem *sh7372_pinmux_port
                const struct sh7372_portcr_group *group =
                        &sh7372_portcr_offsets[i];
  
 -              if (i <= group->end_pin)
 +              if (pin <= group->end_pin)
-                       return pfc->window->virt + group->offset + pin;
+                       return pfc->windows->virt + group->offset + pin;
        }
  
        return NULL;
@@@ -76,12 -76,13 +76,13 @@@ struct pinmux_cfg_reg 
  
  #define PINMUX_CFG_REG(name, r, r_width, f_width) \
        .reg = r, .reg_width = r_width, .field_width = f_width,         \
-       .enum_ids = (u16 [(r_width / f_width) * (1 << f_width)])
+       .enum_ids = (const u16 [(r_width / f_width) * (1 << f_width)])
  
  #define PINMUX_CFG_REG_VAR(name, r, r_width, var_fw0, var_fwn...) \
        .reg = r, .reg_width = r_width, \
-       .var_field_width = (unsigned long [r_width]) { var_fw0, var_fwn, 0 }, \
-       .enum_ids = (u16 [])
+       .var_field_width = (const unsigned long [r_width]) \
+               { var_fw0, var_fwn, 0 }, \
+       .enum_ids = (const u16 [])
  
  struct pinmux_data_reg {
        unsigned long reg, reg_width;
  
  #define PINMUX_DATA_REG(name, r, r_width) \
        .reg = r, .reg_width = r_width, \
-       .enum_ids = (u16 [r_width]) \
+       .enum_ids = (const u16 [r_width]) \
  
  struct pinmux_irq {
        int irq;
-       unsigned short *gpios;
+       const short *gpios;
  };
  
  #define PINMUX_IRQ(irq_nr, ids...)                       \
-       { .irq = irq_nr, .gpios = (unsigned short []) { ids, 0 } }      \
+       { .irq = irq_nr, .gpios = (const short []) { ids, -1 } }
  
  struct pinmux_range {
        u16 begin;
@@@ -254,7 -255,7 +255,7 @@@ struct sh_pfc_soc_info 
  #define PINMUX_GPIO(_pin)                                             \
        [GPIO_##_pin] = {                                               \
                .pin = (u16)-1,                                         \
 -              .name = __stringify(name),                              \
 +              .name = __stringify(GPIO_##_pin),                       \
                .enum_id = _pin##_DATA,                                 \
        }
  
  #define PORTCR(nr, reg)                                                       \
        {                                                               \
                PINMUX_CFG_REG("PORT" nr "CR", reg, 8, 4) {             \
-                       _PCRH(PORT##nr##_IN, PORT##nr##_IN_PD,          \
-                             PORT##nr##_IN_PU, PORT##nr##_OUT),        \
+                       _PCRH(PORT##nr##_IN, 0, 0, PORT##nr##_OUT),     \
                                PORT##nr##_FN0, PORT##nr##_FN1,         \
                                PORT##nr##_FN2, PORT##nr##_FN3,         \
                                PORT##nr##_FN4, PORT##nr##_FN5,         \