Commit a9324f6b authored by Simon Horman's avatar Simon Horman

Merge branch 'devel' of...

Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl into pinmux
parents 44e9ac45 ee341a99
...@@ -98,7 +98,7 @@ announce the pinrange to the pin ctrl subsystem. For example, ...@@ -98,7 +98,7 @@ announce the pinrange to the pin ctrl subsystem. For example,
compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
reg = <0x1460 0x18>; reg = <0x1460 0x18>;
gpio-controller; gpio-controller;
gpio-ranges = <&pinctrl1 20 10>, <&pinctrl2 50 20>; gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
} }
...@@ -107,8 +107,8 @@ where, ...@@ -107,8 +107,8 @@ where,
Next values specify the base pin and number of pins for the range Next values specify the base pin and number of pins for the range
handled by 'qe_pio_e' gpio. In the given example from base pin 20 to handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
pin 29 under pinctrl1 and pin 50 to pin 69 under pinctrl2 is handled pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
by this gpio controller. pinctrl2 with gpio offset 10 is handled by this gpio controller.
The pinctrl node must have "#gpio-range-cells" property to show number of The pinctrl node must have "#gpio-range-cells" property to show number of
arguments to pass with phandle from gpio controllers node. arguments to pass with phandle from gpio controllers node.
One-register-per-pin type device tree based pinctrl driver One-register-per-pin type device tree based pinctrl driver
Required properties: Required properties:
- compatible : "pinctrl-single" - compatible : "pinctrl-single" or "pinconf-single".
"pinctrl-single" means that pinconf isn't supported.
"pinconf-single" means that generic pinconf is supported.
- reg : offset and length of the register set for the mux registers - reg : offset and length of the register set for the mux registers
...@@ -14,9 +16,61 @@ Optional properties: ...@@ -14,9 +16,61 @@ Optional properties:
- pinctrl-single,function-off : function off mode for disabled state if - pinctrl-single,function-off : function off mode for disabled state if
available and same for all registers; if not specified, disabling of available and same for all registers; if not specified, disabling of
pin functions is ignored pin functions is ignored
- pinctrl-single,bit-per-mux : boolean to indicate that one register controls - pinctrl-single,bit-per-mux : boolean to indicate that one register controls
more than one pin more than one pin
- pinctrl-single,drive-strength : array of value that are used to configure
drive strength in the pinmux register. They're value of drive strength
current and drive strength mask.
/* drive strength current, mask */
pinctrl-single,power-source = <0x30 0xf0>;
- pinctrl-single,bias-pullup : array of value that are used to configure the
input bias pullup in the pinmux register.
/* input, enabled pullup bits, disabled pullup bits, mask */
pinctrl-single,bias-pullup = <0 1 0 1>;
- pinctrl-single,bias-pulldown : array of value that are used to configure the
input bias pulldown in the pinmux register.
/* input, enabled pulldown bits, disabled pulldown bits, mask */
pinctrl-single,bias-pulldown = <2 2 0 2>;
* Two bits to control input bias pullup and pulldown: User should use
pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. One bit means
pullup, and the other one bit means pulldown.
* Three bits to control input bias enable, pullup and pulldown. User should
use pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. Input bias
enable bit should be included in pullup or pulldown bits.
* Although driver could set PIN_CONFIG_BIAS_DISABLE, there's no property as
pinctrl-single,bias-disable. Because pinctrl single driver could implement
it by calling pulldown, pullup disabled.
- pinctrl-single,input-schmitt : array of value that are used to configure
input schmitt in the pinmux register. In some silicons, there're two input
schmitt value (rising-edge & falling-edge) in the pinmux register.
/* input schmitt value, mask */
pinctrl-single,input-schmitt = <0x30 0x70>;
- pinctrl-single,input-schmitt-enable : array of value that are used to
configure input schmitt enable or disable in the pinmux register.
/* input, enable bits, disable bits, mask */
pinctrl-single,input-schmitt-enable = <0x30 0x40 0 0x70>;
- pinctrl-single,gpio-range : list of value that are used to configure a GPIO
range. They're value of subnode phandle, pin base in pinctrl device, pin
number in this range, GPIO function value of this GPIO range.
The number of parameters is depend on #pinctrl-single,gpio-range-cells
property.
/* pin base, nr pins & gpio function */
pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1>;
This driver assumes that there is only one register for each pin (unless the This driver assumes that there is only one register for each pin (unless the
pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as
specified in the pinctrl-bindings.txt document in this directory. specified in the pinctrl-bindings.txt document in this directory.
...@@ -42,6 +96,20 @@ Where 0xdc is the offset from the pinctrl register base address for the ...@@ -42,6 +96,20 @@ Where 0xdc is the offset from the pinctrl register base address for the
device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to
be used when applying this change to the register. be used when applying this change to the register.
Optional sub-node: In case some pins could be configured as GPIO in the pinmux
register, those pins could be defined as a GPIO range. This sub-node is required
by pinctrl-single,gpio-range property.
Required properties in sub-node:
- #pinctrl-single,gpio-range-cells : the number of parameters after phandle in
pinctrl-single,gpio-range property.
range: gpio-range {
#pinctrl-single,gpio-range-cells = <3>;
};
Example: Example:
/* SoC common file */ /* SoC common file */
...@@ -76,6 +144,29 @@ control_devconf0: pinmux@48002274 { ...@@ -76,6 +144,29 @@ control_devconf0: pinmux@48002274 {
pinctrl-single,function-mask = <0x5F>; pinctrl-single,function-mask = <0x5F>;
}; };
/* third controller instance for pins in gpio domain */
pmx_gpio: pinmux@d401e000 {
compatible = "pinconf-single";
reg = <0xd401e000 0x0330>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
pinctrl-single,register-width = <32>;
pinctrl-single,function-mask = <7>;
/* sparse GPIO range could be supported */
pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1
&range 12 1 0 &range 13 29 1
&range 43 1 0 &range 44 49 1
&range 94 1 1 &range 96 2 1>;
range: gpio-range {
#pinctrl-single,gpio-range-cells = <3>;
};
};
/* board specific .dts file */ /* board specific .dts file */
&pmx_core { &pmx_core {
...@@ -96,6 +187,15 @@ control_devconf0: pinmux@48002274 { ...@@ -96,6 +187,15 @@ control_devconf0: pinmux@48002274 {
>; >;
}; };
uart0_pins: pinmux_uart0_pins {
pinctrl-single,pins = <
0x208 0 /* UART0_RXD (IOCFG138) */
0x20c 0 /* UART0_TXD (IOCFG139) */
>;
pinctrl-single,bias-pulldown = <0 2 2>;
pinctrl-single,bias-pullup = <0 1 1>;
};
/* map uart2 pins */ /* map uart2 pins */
uart2_pins: pinmux_uart2_pins { uart2_pins: pinmux_uart2_pins {
pinctrl-single,pins = < pinctrl-single,pins = <
...@@ -122,6 +222,11 @@ control_devconf0: pinmux@48002274 { ...@@ -122,6 +222,11 @@ control_devconf0: pinmux@48002274 {
}; };
&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pins>;
};
&uart2 { &uart2 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>; pinctrl-0 = <&uart2_pins>;
......
...@@ -89,7 +89,7 @@ gmac4: eth@5c700000 { ...@@ -89,7 +89,7 @@ gmac4: eth@5c700000 {
pinmux: pinmux@e0700000 { pinmux: pinmux@e0700000 {
compatible = "st,spear1310-pinmux"; compatible = "st,spear1310-pinmux";
reg = <0xe0700000 0x1000>; reg = <0xe0700000 0x1000>;
#gpio-range-cells = <2>; #gpio-range-cells = <3>;
}; };
apb { apb {
...@@ -212,7 +212,7 @@ gpiopinctrl: gpio@d8400000 { ...@@ -212,7 +212,7 @@ gpiopinctrl: gpio@d8400000 {
interrupt-controller; interrupt-controller;
gpio-controller; gpio-controller;
#gpio-cells = <2>; #gpio-cells = <2>;
gpio-ranges = <&pinmux 0 246>; gpio-ranges = <&pinmux 0 0 246>;
status = "disabled"; status = "disabled";
st-plgpio,ngpio = <246>; st-plgpio,ngpio = <246>;
......
...@@ -63,7 +63,7 @@ i2s-rec@b2000000 { ...@@ -63,7 +63,7 @@ i2s-rec@b2000000 {
pinmux: pinmux@e0700000 { pinmux: pinmux@e0700000 {
compatible = "st,spear1340-pinmux"; compatible = "st,spear1340-pinmux";
reg = <0xe0700000 0x1000>; reg = <0xe0700000 0x1000>;
#gpio-range-cells = <2>; #gpio-range-cells = <3>;
}; };
pwm: pwm@e0180000 { pwm: pwm@e0180000 {
...@@ -127,7 +127,7 @@ gpiopinctrl: gpio@e2800000 { ...@@ -127,7 +127,7 @@ gpiopinctrl: gpio@e2800000 {
interrupt-controller; interrupt-controller;
gpio-controller; gpio-controller;
#gpio-cells = <2>; #gpio-cells = <2>;
gpio-ranges = <&pinmux 0 252>; gpio-ranges = <&pinmux 0 0 252>;
status = "disabled"; status = "disabled";
st-plgpio,ngpio = <250>; st-plgpio,ngpio = <250>;
......
...@@ -25,7 +25,7 @@ ahb { ...@@ -25,7 +25,7 @@ ahb {
pinmux: pinmux@b4000000 { pinmux: pinmux@b4000000 {
compatible = "st,spear310-pinmux"; compatible = "st,spear310-pinmux";
reg = <0xb4000000 0x1000>; reg = <0xb4000000 0x1000>;
#gpio-range-cells = <2>; #gpio-range-cells = <3>;
}; };
fsmc: flash@44000000 { fsmc: flash@44000000 {
...@@ -102,7 +102,7 @@ gpiopinctrl: gpio@b4000000 { ...@@ -102,7 +102,7 @@ gpiopinctrl: gpio@b4000000 {
interrupt-controller; interrupt-controller;
gpio-controller; gpio-controller;
#gpio-cells = <2>; #gpio-cells = <2>;
gpio-ranges = <&pinmux 0 102>; gpio-ranges = <&pinmux 0 0 102>;
status = "disabled"; status = "disabled";
st-plgpio,ngpio = <102>; st-plgpio,ngpio = <102>;
......
...@@ -24,7 +24,7 @@ ahb { ...@@ -24,7 +24,7 @@ ahb {
pinmux: pinmux@b3000000 { pinmux: pinmux@b3000000 {
compatible = "st,spear320-pinmux"; compatible = "st,spear320-pinmux";
reg = <0xb3000000 0x1000>; reg = <0xb3000000 0x1000>;
#gpio-range-cells = <2>; #gpio-range-cells = <3>;
}; };
clcd@90000000 { clcd@90000000 {
...@@ -130,7 +130,7 @@ gpiopinctrl: gpio@b3000000 { ...@@ -130,7 +130,7 @@ gpiopinctrl: gpio@b3000000 {
interrupt-controller; interrupt-controller;
gpio-controller; gpio-controller;
#gpio-cells = <2>; #gpio-cells = <2>;
gpio-ranges = <&pinmux 0 102>; gpio-ranges = <&pinmux 0 0 102>;
status = "disabled"; status = "disabled";
st-plgpio,ngpio = <102>; st-plgpio,ngpio = <102>;
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -22,6 +23,7 @@ ...@@ -22,6 +23,7 @@
#include <linux/amba/bus.h> #include <linux/amba/bus.h>
#include <linux/amba/pl061.h> #include <linux/amba/pl061.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <asm/mach/irq.h> #include <asm/mach/irq.h>
...@@ -51,8 +53,7 @@ struct pl061_gpio { ...@@ -51,8 +53,7 @@ struct pl061_gpio {
spinlock_t lock; spinlock_t lock;
void __iomem *base; void __iomem *base;
int irq_base; struct irq_domain *domain;
struct irq_chip_generic *irq_gc;
struct gpio_chip gc; struct gpio_chip gc;
#ifdef CONFIG_PM #ifdef CONFIG_PM
...@@ -60,6 +61,17 @@ struct pl061_gpio { ...@@ -60,6 +61,17 @@ struct pl061_gpio {
#endif #endif
}; };
static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset)
{
/*
* Map back to global GPIO space and request muxing, the direction
* parameter does not matter for this controller.
*/
int gpio = chip->base + offset;
return pinctrl_request_gpio(gpio);
}
static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
{ {
struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
...@@ -122,24 +134,20 @@ static int pl061_to_irq(struct gpio_chip *gc, unsigned offset) ...@@ -122,24 +134,20 @@ static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
{ {
struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
if (chip->irq_base <= 0) return irq_create_mapping(chip->domain, offset);
return -EINVAL;
return chip->irq_base + offset;
} }
static int pl061_irq_type(struct irq_data *d, unsigned trigger) static int pl061_irq_type(struct irq_data *d, unsigned trigger)
{ {
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
struct pl061_gpio *chip = gc->private; int offset = irqd_to_hwirq(d);
int offset = d->irq - chip->irq_base;
unsigned long flags; unsigned long flags;
u8 gpiois, gpioibe, gpioiev; u8 gpiois, gpioibe, gpioiev;
if (offset < 0 || offset >= PL061_GPIO_NR) if (offset < 0 || offset >= PL061_GPIO_NR)
return -EINVAL; return -EINVAL;
raw_spin_lock_irqsave(&gc->lock, flags); spin_lock_irqsave(&chip->lock, flags);
gpioiev = readb(chip->base + GPIOIEV); gpioiev = readb(chip->base + GPIOIEV);
...@@ -168,7 +176,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger) ...@@ -168,7 +176,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
writeb(gpioiev, chip->base + GPIOIEV); writeb(gpioiev, chip->base + GPIOIEV);
raw_spin_unlock_irqrestore(&gc->lock, flags); spin_unlock_irqrestore(&chip->lock, flags);
return 0; return 0;
} }
...@@ -192,31 +200,61 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc) ...@@ -192,31 +200,61 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
chained_irq_exit(irqchip, desc); chained_irq_exit(irqchip, desc);
} }
static void __init pl061_init_gc(struct pl061_gpio *chip, int irq_base) static void pl061_irq_mask(struct irq_data *d)
{ {
struct irq_chip_type *ct; struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
u8 gpioie;
spin_lock(&chip->lock);
gpioie = readb(chip->base + GPIOIE) & ~mask;
writeb(gpioie, chip->base + GPIOIE);
spin_unlock(&chip->lock);
}
static void pl061_irq_unmask(struct irq_data *d)
{
struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
u8 gpioie;
spin_lock(&chip->lock);
gpioie = readb(chip->base + GPIOIE) | mask;
writeb(gpioie, chip->base + GPIOIE);
spin_unlock(&chip->lock);
}
chip->irq_gc = irq_alloc_generic_chip("gpio-pl061", 1, irq_base, static struct irq_chip pl061_irqchip = {
chip->base, handle_simple_irq); .name = "pl061 gpio",
chip->irq_gc->private = chip; .irq_mask = pl061_irq_mask,
.irq_unmask = pl061_irq_unmask,
.irq_set_type = pl061_irq_type,
};
static int pl061_irq_map(struct irq_domain *d, unsigned int virq,
irq_hw_number_t hw)
{
struct pl061_gpio *chip = d->host_data;
ct = chip->irq_gc->chip_types; irq_set_chip_and_handler_name(virq, &pl061_irqchip, handle_simple_irq,
ct->chip.irq_mask = irq_gc_mask_clr_bit; "pl061");
ct->chip.irq_unmask = irq_gc_mask_set_bit; irq_set_chip_data(virq, chip);
ct->chip.irq_set_type = pl061_irq_type; irq_set_irq_type(virq, IRQ_TYPE_NONE);
ct->chip.irq_set_wake = irq_gc_set_wake;
ct->regs.mask = GPIOIE;
irq_setup_generic_chip(chip->irq_gc, IRQ_MSK(PL061_GPIO_NR), return 0;
IRQ_GC_INIT_NESTED_LOCK, IRQ_NOREQUEST, 0);
} }
static const struct irq_domain_ops pl061_domain_ops = {
.map = pl061_irq_map,
.xlate = irq_domain_xlate_twocell,
};
static int pl061_probe(struct amba_device *adev, const struct amba_id *id) static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
{ {
struct device *dev = &adev->dev; struct device *dev = &adev->dev;
struct pl061_platform_data *pdata = dev->platform_data; struct pl061_platform_data *pdata = dev->platform_data;
struct pl061_gpio *chip; struct pl061_gpio *chip;
int ret, irq, i; int ret, irq, i, irq_base;
chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
if (chip == NULL) if (chip == NULL)
...@@ -224,24 +262,31 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -224,24 +262,31 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
if (pdata) { if (pdata) {
chip->gc.base = pdata->gpio_base; chip->gc.base = pdata->gpio_base;
chip->irq_base = pdata->irq_base; irq_base = pdata->irq_base;
} else if (adev->dev.of_node) { if (irq_base <= 0)
return -ENODEV;
} else {
chip->gc.base = -1; chip->gc.base = -1;
chip->irq_base = 0; irq_base = 0;
} else }
return -ENODEV;
if (!devm_request_mem_region(dev, adev->res.start, if (!devm_request_mem_region(dev, adev->res.start,
resource_size(&adev->res), "pl061")) resource_size(&adev->res), "pl061"))
return -EBUSY; return -EBUSY;
chip->base = devm_ioremap(dev, adev->res.start, chip->base = devm_ioremap(dev, adev->res.start,
resource_size(&adev->res)); resource_size(&adev->res));
if (chip->base == NULL) if (!chip->base)
return -ENOMEM; return -ENOMEM;
chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR,
irq_base, &pl061_domain_ops, chip);
if (!chip->domain)
return -ENODEV;
spin_lock_init(&chip->lock); spin_lock_init(&chip->lock);
chip->gc.request = pl061_gpio_request;
chip->gc.direction_input = pl061_direction_input; chip->gc.direction_input = pl061_direction_input;
chip->gc.direction_output = pl061_direction_output; chip->gc.direction_output = pl061_direction_output;
chip->gc.get = pl061_get_value; chip->gc.get = pl061_get_value;
...@@ -259,12 +304,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -259,12 +304,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
/* /*
* irq_chip support * irq_chip support
*/ */
if (chip->irq_base <= 0)
return 0;
pl061_init_gc(chip, chip->irq_base);
writeb(0, chip->base + GPIOIE); /* disable irqs */ writeb(0, chip->base + GPIOIE); /* disable irqs */
irq = adev->irq[0]; irq = adev->irq[0];
if (irq < 0) if (irq < 0)
......
...@@ -203,22 +203,11 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip) ...@@ -203,22 +203,11 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
if (!pctldev) if (!pctldev)
break; break;
/*
* This assumes that the n GPIO pins are consecutive in the
* GPIO number space, and that the pins are also consecutive
* in their local number space. Currently it is not possible
* to add different ranges for one and the same GPIO chip,
* as the code assumes that we have one consecutive range
* on both, mapping 1-to-1.
*
* TODO: make the OF bindings handle multiple sparse ranges
* on the same GPIO chip.
*/
ret = gpiochip_add_pin_range(chip, ret = gpiochip_add_pin_range(chip,
pinctrl_dev_get_devname(pctldev), pinctrl_dev_get_devname(pctldev),
0, /* offset in gpiochip */
pinspec.args[0], pinspec.args[0],
pinspec.args[1]); pinspec.args[1],
pinspec.args[2]);
if (ret) if (ret)
break; break;
......
...@@ -166,6 +166,7 @@ config PINCTRL_SINGLE ...@@ -166,6 +166,7 @@ config PINCTRL_SINGLE
depends on OF depends on OF
select PINMUX select PINMUX
select PINCONF select PINCONF
select GENERIC_PINCONF
help help
This selects the device tree based generic pinctrl driver. This selects the device tree based generic pinctrl driver.
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/machine.h> #include <linux/pinctrl/machine.h>
#include <asm-generic/gpio.h>
#include "core.h" #include "core.h"
#include "devicetree.h" #include "devicetree.h"
#include "pinmux.h" #include "pinmux.h"
...@@ -276,6 +277,39 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio) ...@@ -276,6 +277,39 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
return NULL; return NULL;
} }
/**
* pinctrl_ready_for_gpio_range() - check if other GPIO pins of
* the same GPIO chip are in range
* @gpio: gpio pin to check taken from the global GPIO pin space
*
* This function is complement of pinctrl_match_gpio_range(). If the return
* value of pinctrl_match_gpio_range() is NULL, this function could be used
* to check whether pinctrl device is ready or not. Maybe some GPIO pins
* of the same GPIO chip don't have back-end pinctrl interface.
* If the return value is true, it means that pinctrl device is ready & the
* certain GPIO pin doesn't have back-end pinctrl device. If the return value
* is false, it means that pinctrl device may not be ready.
*/
static bool pinctrl_ready_for_gpio_range(unsigned gpio)
{
struct pinctrl_dev *pctldev;
struct pinctrl_gpio_range *range = NULL;
struct gpio_chip *chip = gpio_to_chip(gpio);
/* Loop over the pin controllers */
list_for_each_entry(pctldev, &pinctrldev_list, node) {
/* Loop over the ranges */
list_for_each_entry(range, &pctldev->gpio_ranges, node) {
/* Check if any gpio range overlapped with gpio chip */
if (range->base + range->npins - 1 < chip->base ||
range->base > chip->base + chip->ngpio - 1)
continue;
return true;
}
}
return false;
}
/** /**
* pinctrl_get_device_gpio_range() - find device for GPIO range * pinctrl_get_device_gpio_range() - find device for GPIO range
* @gpio: the pin to locate the pin controller for * @gpio: the pin to locate the pin controller for
...@@ -443,6 +477,8 @@ int pinctrl_request_gpio(unsigned gpio) ...@@ -443,6 +477,8 @@ int pinctrl_request_gpio(unsigned gpio)
ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
if (ret) { if (ret) {
if (pinctrl_ready_for_gpio_range(gpio))
ret = 0;
mutex_unlock(&pinctrl_mutex); mutex_unlock(&pinctrl_mutex);
return ret; return ret;
} }
...@@ -979,9 +1015,8 @@ static int devm_pinctrl_match(struct device *dev, void *res, void *data) ...@@ -979,9 +1015,8 @@ static int devm_pinctrl_match(struct device *dev, void *res, void *data)
*/ */
void devm_pinctrl_put(struct pinctrl *p) void devm_pinctrl_put(struct pinctrl *p)
{ {
WARN_ON(devres_destroy(p->dev, devm_pinctrl_release, WARN_ON(devres_release(p->dev, devm_pinctrl_release,
devm_pinctrl_match, p)); devm_pinctrl_match, p));
pinctrl_put(p);
} }
EXPORT_SYMBOL_GPL(devm_pinctrl_put); EXPORT_SYMBOL_GPL(devm_pinctrl_put);
......
...@@ -41,7 +41,7 @@ static void dt_free_map(struct pinctrl_dev *pctldev, ...@@ -41,7 +41,7 @@ static void dt_free_map(struct pinctrl_dev *pctldev,
struct pinctrl_map *map, unsigned num_maps) struct pinctrl_map *map, unsigned num_maps)
{ {
if (pctldev) { if (pctldev) {
struct pinctrl_ops *ops = pctldev->desc->pctlops; const struct pinctrl_ops *ops = pctldev->desc->pctlops;
ops->dt_free_map(pctldev, map, num_maps); ops->dt_free_map(pctldev, map, num_maps);
} else { } else {
/* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */ /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */
...@@ -122,7 +122,7 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename, ...@@ -122,7 +122,7 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
{ {
struct device_node *np_pctldev; struct device_node *np_pctldev;
struct pinctrl_dev *pctldev; struct pinctrl_dev *pctldev;
struct pinctrl_ops *ops; const struct pinctrl_ops *ops;
int ret; int ret;
struct pinctrl_map *map; struct pinctrl_map *map;
unsigned num_maps; unsigned num_maps;
......
...@@ -263,7 +263,7 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, ...@@ -263,7 +263,7 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
return; return;
} }
static struct pinconf_ops mvebu_pinconf_ops = { static const struct pinconf_ops mvebu_pinconf_ops = {
.pin_config_group_get = mvebu_pinconf_group_get, .pin_config_group_get = mvebu_pinconf_group_get,
.pin_config_group_set = mvebu_pinconf_group_set, .pin_config_group_set = mvebu_pinconf_group_set,
.pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show, .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show,
...@@ -369,7 +369,7 @@ static int mvebu_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, ...@@ -369,7 +369,7 @@ static int mvebu_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
return -ENOTSUPP; return -ENOTSUPP;
} }
static struct pinmux_ops mvebu_pinmux_ops = { static const struct pinmux_ops mvebu_pinmux_ops = {
.get_functions_count = mvebu_pinmux_get_funcs_count, .get_functions_count = mvebu_pinmux_get_funcs_count,
.get_function_name = mvebu_pinmux_get_func_name, .get_function_name = mvebu_pinmux_get_func_name,
.get_function_groups = mvebu_pinmux_get_groups, .get_function_groups = mvebu_pinmux_get_groups,
...@@ -470,7 +470,7 @@ static void mvebu_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -470,7 +470,7 @@ static void mvebu_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
kfree(map); kfree(map);
} }
static struct pinctrl_ops mvebu_pinctrl_ops = { static const struct pinctrl_ops mvebu_pinctrl_ops = {
.get_groups_count = mvebu_pinctrl_get_groups_count, .get_groups_count = mvebu_pinctrl_get_groups_count,
.get_group_name = mvebu_pinctrl_get_group_name, .get_group_name = mvebu_pinctrl_get_group_name,
.get_group_pins = mvebu_pinctrl_get_group_pins, .get_group_pins = mvebu_pinctrl_get_group_pins,
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#define pr_fmt(fmt) "generic pinconfig core: " fmt #define pr_fmt(fmt) "generic pinconfig core: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -120,4 +121,17 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, ...@@ -120,4 +121,17 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
} }
} }
void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned long config)
{
int i;
for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
if (pinconf_to_config_param(config) != conf_items[i].param)
continue;
seq_printf(s, "%s: 0x%x", conf_items[i].display,
pinconf_to_config_argument(config));
}
}
EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
#endif #endif
...@@ -670,7 +670,7 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d) ...@@ -670,7 +670,7 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d)
struct pinctrl_maps *maps_node; struct pinctrl_maps *maps_node;
struct pinctrl_map const *map; struct pinctrl_map const *map;
struct pinctrl_dev *pctldev = NULL; struct pinctrl_dev *pctldev = NULL;
struct pinconf_ops *confops = NULL; const struct pinconf_ops *confops = NULL;
int i, j; int i, j;
bool found = false; bool found = false;
......
...@@ -98,6 +98,8 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, ...@@ -98,6 +98,8 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
struct seq_file *s, const char *gname); struct seq_file *s, const char *gname);
void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned long config);
#else #else
static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
...@@ -114,4 +116,10 @@ static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, ...@@ -114,4 +116,10 @@ static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
return; return;
} }
static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s,
unsigned long config)
{
return;
}
#endif #endif
...@@ -656,7 +656,7 @@ static void abx500_gpio_disable_free(struct pinctrl_dev *pctldev, ...@@ -656,7 +656,7 @@ static void abx500_gpio_disable_free(struct pinctrl_dev *pctldev,
{ {
} }
static struct pinmux_ops abx500_pinmux_ops = { static const struct pinmux_ops abx500_pinmux_ops = {
.get_functions_count = abx500_pmx_get_funcs_cnt, .get_functions_count = abx500_pmx_get_funcs_cnt,
.get_function_name = abx500_pmx_get_func_name, .get_function_name = abx500_pmx_get_func_name,
.get_function_groups = abx500_pmx_get_func_groups, .get_function_groups = abx500_pmx_get_func_groups,
...@@ -704,7 +704,7 @@ static void abx500_pin_dbg_show(struct pinctrl_dev *pctldev, ...@@ -704,7 +704,7 @@ static void abx500_pin_dbg_show(struct pinctrl_dev *pctldev,
chip->base + offset - 1); chip->base + offset - 1);
} }
static struct pinctrl_ops abx500_pinctrl_ops = { static const struct pinctrl_ops abx500_pinctrl_ops = {
.get_groups_count = abx500_get_groups_cnt, .get_groups_count = abx500_get_groups_cnt,
.get_group_name = abx500_get_group_name, .get_group_name = abx500_get_group_name,
.get_group_pins = abx500_get_group_pins, .get_group_pins = abx500_get_group_pins,
...@@ -778,7 +778,7 @@ int abx500_pin_config_set(struct pinctrl_dev *pctldev, ...@@ -778,7 +778,7 @@ int abx500_pin_config_set(struct pinctrl_dev *pctldev,
return ret; return ret;
} }
static struct pinconf_ops abx500_pinconf_ops = { static const struct pinconf_ops abx500_pinconf_ops = {
.pin_config_get = abx500_pin_config_get, .pin_config_get = abx500_pin_config_get,
.pin_config_set = abx500_pin_config_set, .pin_config_set = abx500_pin_config_set,
}; };
...@@ -834,6 +834,7 @@ static const struct of_device_id abx500_gpio_match[] = { ...@@ -834,6 +834,7 @@ static const struct of_device_id abx500_gpio_match[] = {
{ .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, }, { .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, },
{ .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, }, { .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, },
{ .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, }, { .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, },
{ }
}; };
static int abx500_gpio_probe(struct platform_device *pdev) static int abx500_gpio_probe(struct platform_device *pdev)
......
...@@ -294,7 +294,7 @@ static void at91_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -294,7 +294,7 @@ static void at91_dt_free_map(struct pinctrl_dev *pctldev,
{ {
} }
static struct pinctrl_ops at91_pctrl_ops = { static const struct pinctrl_ops at91_pctrl_ops = {
.get_groups_count = at91_get_groups_count, .get_groups_count = at91_get_groups_count,
.get_group_name = at91_get_group_name, .get_group_name = at91_get_group_name,
.get_group_pins = at91_get_group_pins, .get_group_pins = at91_get_group_pins,
...@@ -696,7 +696,7 @@ static void at91_gpio_disable_free(struct pinctrl_dev *pctldev, ...@@ -696,7 +696,7 @@ static void at91_gpio_disable_free(struct pinctrl_dev *pctldev,
/* Set the pin to some default state, GPIO is usually default */ /* Set the pin to some default state, GPIO is usually default */
} }
static struct pinmux_ops at91_pmx_ops = { static const struct pinmux_ops at91_pmx_ops = {
.get_functions_count = at91_pmx_get_funcs_count, .get_functions_count = at91_pmx_get_funcs_count,
.get_function_name = at91_pmx_get_func_name, .get_function_name = at91_pmx_get_func_name,
.get_function_groups = at91_pmx_get_groups, .get_function_groups = at91_pmx_get_groups,
...@@ -776,7 +776,7 @@ static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, ...@@ -776,7 +776,7 @@ static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
{ {
} }
static struct pinconf_ops at91_pinconf_ops = { static const struct pinconf_ops at91_pinconf_ops = {
.pin_config_get = at91_pinconf_get, .pin_config_get = at91_pinconf_get,
.pin_config_set = at91_pinconf_set, .pin_config_set = at91_pinconf_set,
.pin_config_dbg_show = at91_pinconf_dbg_show, .pin_config_dbg_show = at91_pinconf_dbg_show,
......
...@@ -795,7 +795,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -795,7 +795,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
return err; return err;
} }
static struct pinctrl_ops bcm2835_pctl_ops = { static const struct pinctrl_ops bcm2835_pctl_ops = {
.get_groups_count = bcm2835_pctl_get_groups_count, .get_groups_count = bcm2835_pctl_get_groups_count,
.get_group_name = bcm2835_pctl_get_group_name, .get_group_name = bcm2835_pctl_get_group_name,
.get_group_pins = bcm2835_pctl_get_group_pins, .get_group_pins = bcm2835_pctl_get_group_pins,
...@@ -872,7 +872,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, ...@@ -872,7 +872,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct pinmux_ops bcm2835_pmx_ops = { static const struct pinmux_ops bcm2835_pmx_ops = {
.get_functions_count = bcm2835_pmx_get_functions_count, .get_functions_count = bcm2835_pmx_get_functions_count,
.get_function_name = bcm2835_pmx_get_function_name, .get_function_name = bcm2835_pmx_get_function_name,
.get_function_groups = bcm2835_pmx_get_function_groups, .get_function_groups = bcm2835_pmx_get_function_groups,
...@@ -916,7 +916,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev, ...@@ -916,7 +916,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct pinconf_ops bcm2835_pinconf_ops = { static const struct pinconf_ops bcm2835_pinconf_ops = {
.pin_config_get = bcm2835_pinconf_get, .pin_config_get = bcm2835_pinconf_get,
.pin_config_set = bcm2835_pinconf_set, .pin_config_set = bcm2835_pinconf_set,
}; };
......
...@@ -286,7 +286,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -286,7 +286,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev,
} }
/* list of pinctrl callbacks for the pinctrl core */ /* list of pinctrl callbacks for the pinctrl core */
static struct pinctrl_ops exynos5440_pctrl_ops = { static const struct pinctrl_ops exynos5440_pctrl_ops = {
.get_groups_count = exynos5440_get_group_count, .get_groups_count = exynos5440_get_group_count,
.get_group_name = exynos5440_get_group_name, .get_group_name = exynos5440_get_group_name,
.get_group_pins = exynos5440_get_group_pins, .get_group_pins = exynos5440_get_group_pins,
...@@ -374,7 +374,7 @@ static int exynos5440_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, ...@@ -374,7 +374,7 @@ static int exynos5440_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
} }
/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ /* list of pinmux callbacks for the pinmux vertical in pinctrl core */
static struct pinmux_ops exynos5440_pinmux_ops = { static const struct pinmux_ops exynos5440_pinmux_ops = {
.get_functions_count = exynos5440_get_functions_count, .get_functions_count = exynos5440_get_functions_count,
.get_function_name = exynos5440_pinmux_get_fname, .get_function_name = exynos5440_pinmux_get_fname,
.get_function_groups = exynos5440_pinmux_get_groups, .get_function_groups = exynos5440_pinmux_get_groups,
...@@ -523,7 +523,7 @@ static int exynos5440_pinconf_group_get(struct pinctrl_dev *pctldev, ...@@ -523,7 +523,7 @@ static int exynos5440_pinconf_group_get(struct pinctrl_dev *pctldev,
} }
/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ /* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
static struct pinconf_ops exynos5440_pinconf_ops = { static const struct pinconf_ops exynos5440_pinconf_ops = {
.pin_config_get = exynos5440_pinconf_get, .pin_config_get = exynos5440_pinconf_get,
.pin_config_set = exynos5440_pinconf_set, .pin_config_set = exynos5440_pinconf_set,
.pin_config_group_get = exynos5440_pinconf_group_get, .pin_config_group_get = exynos5440_pinconf_group_get,
......
...@@ -353,7 +353,7 @@ static void falcon_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev, ...@@ -353,7 +353,7 @@ static void falcon_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev,
{ {
} }
static struct pinconf_ops falcon_pinconf_ops = { static const struct pinconf_ops falcon_pinconf_ops = {
.pin_config_get = falcon_pinconf_get, .pin_config_get = falcon_pinconf_get,
.pin_config_set = falcon_pinconf_set, .pin_config_set = falcon_pinconf_set,
.pin_config_group_get = falcon_pinconf_group_get, .pin_config_group_get = falcon_pinconf_group_get,
......
...@@ -207,7 +207,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -207,7 +207,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev,
kfree(map); kfree(map);
} }
static struct pinctrl_ops imx_pctrl_ops = { static const struct pinctrl_ops imx_pctrl_ops = {
.get_groups_count = imx_get_groups_count, .get_groups_count = imx_get_groups_count,
.get_group_name = imx_get_group_name, .get_group_name = imx_get_group_name,
.get_group_pins = imx_get_group_pins, .get_group_pins = imx_get_group_pins,
...@@ -299,7 +299,7 @@ static int imx_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -299,7 +299,7 @@ static int imx_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static struct pinmux_ops imx_pmx_ops = { static const struct pinmux_ops imx_pmx_ops = {
.get_functions_count = imx_pmx_get_funcs_count, .get_functions_count = imx_pmx_get_funcs_count,
.get_function_name = imx_pmx_get_func_name, .get_function_name = imx_pmx_get_func_name,
.get_function_groups = imx_pmx_get_groups, .get_function_groups = imx_pmx_get_groups,
...@@ -397,7 +397,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, ...@@ -397,7 +397,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
} }
} }
static struct pinconf_ops imx_pinconf_ops = { static const struct pinconf_ops imx_pinconf_ops = {
.pin_config_get = imx_pinconf_get, .pin_config_get = imx_pinconf_get,
.pin_config_set = imx_pinconf_set, .pin_config_set = imx_pinconf_set,
.pin_config_dbg_show = imx_pinconf_dbg_show, .pin_config_dbg_show = imx_pinconf_dbg_show,
......
...@@ -169,7 +169,7 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -169,7 +169,7 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct pinctrl_ops ltq_pctrl_ops = { static const struct pinctrl_ops ltq_pctrl_ops = {
.get_groups_count = ltq_get_group_count, .get_groups_count = ltq_get_group_count,
.get_group_name = ltq_get_group_name, .get_group_name = ltq_get_group_name,
.get_group_pins = ltq_get_group_pins, .get_group_pins = ltq_get_group_pins,
...@@ -311,7 +311,7 @@ static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev, ...@@ -311,7 +311,7 @@ static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev,
return info->apply_mux(pctrldev, mfp, pin_func); return info->apply_mux(pctrldev, mfp, pin_func);
} }
static struct pinmux_ops ltq_pmx_ops = { static const struct pinmux_ops ltq_pmx_ops = {
.get_functions_count = ltq_pmx_func_count, .get_functions_count = ltq_pmx_func_count,
.get_function_name = ltq_pmx_func_name, .get_function_name = ltq_pmx_func_name,
.get_function_groups = ltq_pmx_get_groups, .get_function_groups = ltq_pmx_get_groups,
......
...@@ -158,7 +158,7 @@ static void mxs_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -158,7 +158,7 @@ static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
kfree(map); kfree(map);
} }
static struct pinctrl_ops mxs_pinctrl_ops = { static const struct pinctrl_ops mxs_pinctrl_ops = {
.get_groups_count = mxs_get_groups_count, .get_groups_count = mxs_get_groups_count,
.get_group_name = mxs_get_group_name, .get_group_name = mxs_get_group_name,
.get_group_pins = mxs_get_group_pins, .get_group_pins = mxs_get_group_pins,
...@@ -219,7 +219,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -219,7 +219,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static struct pinmux_ops mxs_pinmux_ops = { static const struct pinmux_ops mxs_pinmux_ops = {
.get_functions_count = mxs_pinctrl_get_funcs_count, .get_functions_count = mxs_pinctrl_get_funcs_count,
.get_function_name = mxs_pinctrl_get_func_name, .get_function_name = mxs_pinctrl_get_func_name,
.get_function_groups = mxs_pinctrl_get_func_groups, .get_function_groups = mxs_pinctrl_get_func_groups,
...@@ -319,7 +319,7 @@ static void mxs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, ...@@ -319,7 +319,7 @@ static void mxs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
seq_printf(s, "0x%lx", config); seq_printf(s, "0x%lx", config);
} }
static struct pinconf_ops mxs_pinconf_ops = { static const struct pinconf_ops mxs_pinconf_ops = {
.pin_config_get = mxs_pinconf_get, .pin_config_get = mxs_pinconf_get,
.pin_config_set = mxs_pinconf_set, .pin_config_set = mxs_pinconf_set,
.pin_config_group_get = mxs_pinconf_group_get, .pin_config_group_get = mxs_pinconf_group_get,
......
...@@ -1764,7 +1764,7 @@ int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -1764,7 +1764,7 @@ int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct pinctrl_ops nmk_pinctrl_ops = { static const struct pinctrl_ops nmk_pinctrl_ops = {
.get_groups_count = nmk_get_groups_cnt, .get_groups_count = nmk_get_groups_cnt,
.get_group_name = nmk_get_group_name, .get_group_name = nmk_get_group_name,
.get_group_pins = nmk_get_group_pins, .get_group_pins = nmk_get_group_pins,
...@@ -1975,7 +1975,7 @@ static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev, ...@@ -1975,7 +1975,7 @@ static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev,
/* Set the pin to some default state, GPIO is usually default */ /* Set the pin to some default state, GPIO is usually default */
} }
static struct pinmux_ops nmk_pinmux_ops = { static const struct pinmux_ops nmk_pinmux_ops = {
.get_functions_count = nmk_pmx_get_funcs_cnt, .get_functions_count = nmk_pmx_get_funcs_cnt,
.get_function_name = nmk_pmx_get_func_name, .get_function_name = nmk_pmx_get_func_name,
.get_function_groups = nmk_pmx_get_func_groups, .get_function_groups = nmk_pmx_get_func_groups,
...@@ -2089,7 +2089,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -2089,7 +2089,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
return 0; return 0;
} }
static struct pinconf_ops nmk_pinconf_ops = { static const struct pinconf_ops nmk_pinconf_ops = {
.pin_config_get = nmk_pin_config_get, .pin_config_get = nmk_pin_config_get,
.pin_config_set = nmk_pin_config_set, .pin_config_set = nmk_pin_config_set,
}; };
......
...@@ -53,7 +53,7 @@ static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev, ...@@ -53,7 +53,7 @@ static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
return 0; return 0;
} }
static struct pinctrl_ops pxa3xx_pctrl_ops = { static const struct pinctrl_ops pxa3xx_pctrl_ops = {
.get_groups_count = pxa3xx_get_groups_count, .get_groups_count = pxa3xx_get_groups_count,
.get_group_name = pxa3xx_get_group_name, .get_group_name = pxa3xx_get_group_name,
.get_group_pins = pxa3xx_get_group_pins, .get_group_pins = pxa3xx_get_group_pins,
...@@ -161,7 +161,7 @@ static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev, ...@@ -161,7 +161,7 @@ static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev,
return 0; return 0;
} }
static struct pinmux_ops pxa3xx_pmx_ops = { static const struct pinmux_ops pxa3xx_pmx_ops = {
.get_functions_count = pxa3xx_pmx_get_funcs_count, .get_functions_count = pxa3xx_pmx_get_funcs_count,
.get_function_name = pxa3xx_pmx_get_func_name, .get_function_name = pxa3xx_pmx_get_func_name,
.get_function_groups = pxa3xx_pmx_get_groups, .get_function_groups = pxa3xx_pmx_get_groups,
......
...@@ -214,7 +214,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -214,7 +214,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev,
} }
/* list of pinctrl callbacks for the pinctrl core */ /* list of pinctrl callbacks for the pinctrl core */
static struct pinctrl_ops samsung_pctrl_ops = { static const struct pinctrl_ops samsung_pctrl_ops = {
.get_groups_count = samsung_get_group_count, .get_groups_count = samsung_get_group_count,
.get_group_name = samsung_get_group_name, .get_group_name = samsung_get_group_name,
.get_group_pins = samsung_get_group_pins, .get_group_pins = samsung_get_group_pins,
...@@ -357,7 +357,7 @@ static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, ...@@ -357,7 +357,7 @@ static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
} }
/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ /* list of pinmux callbacks for the pinmux vertical in pinctrl core */
static struct pinmux_ops samsung_pinmux_ops = { static const struct pinmux_ops samsung_pinmux_ops = {
.get_functions_count = samsung_get_functions_count, .get_functions_count = samsung_get_functions_count,
.get_function_name = samsung_pinmux_get_fname, .get_function_name = samsung_pinmux_get_fname,
.get_function_groups = samsung_pinmux_get_groups, .get_function_groups = samsung_pinmux_get_groups,
...@@ -468,7 +468,7 @@ static int samsung_pinconf_group_get(struct pinctrl_dev *pctldev, ...@@ -468,7 +468,7 @@ static int samsung_pinconf_group_get(struct pinctrl_dev *pctldev,
} }
/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ /* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
static struct pinconf_ops samsung_pinconf_ops = { static const struct pinconf_ops samsung_pinconf_ops = {
.pin_config_get = samsung_pinconf_get, .pin_config_get = samsung_pinconf_get,
.pin_config_set = samsung_pinconf_set, .pin_config_set = samsung_pinconf_set,
.pin_config_group_get = samsung_pinconf_group_get, .pin_config_group_get = samsung_pinconf_group_get,
......
This diff is collapsed.
...@@ -979,7 +979,7 @@ static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -979,7 +979,7 @@ static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev,
kfree(map); kfree(map);
} }
static struct pinctrl_ops sirfsoc_pctrl_ops = { static const struct pinctrl_ops sirfsoc_pctrl_ops = {
.get_groups_count = sirfsoc_get_groups_count, .get_groups_count = sirfsoc_get_groups_count,
.get_group_name = sirfsoc_get_group_name, .get_group_name = sirfsoc_get_group_name,
.get_group_pins = sirfsoc_get_group_pins, .get_group_pins = sirfsoc_get_group_pins,
...@@ -1181,7 +1181,7 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev, ...@@ -1181,7 +1181,7 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
return 0; return 0;
} }
static struct pinmux_ops sirfsoc_pinmux_ops = { static const struct pinmux_ops sirfsoc_pinmux_ops = {
.enable = sirfsoc_pinmux_enable, .enable = sirfsoc_pinmux_enable,
.disable = sirfsoc_pinmux_disable, .disable = sirfsoc_pinmux_disable,
.get_functions_count = sirfsoc_pinmux_get_funcs_count, .get_functions_count = sirfsoc_pinmux_get_funcs_count,
......
This diff is collapsed.
...@@ -316,7 +316,7 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, ...@@ -316,7 +316,7 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct pinctrl_ops tegra_pinctrl_ops = { static const struct pinctrl_ops tegra_pinctrl_ops = {
.get_groups_count = tegra_pinctrl_get_groups_count, .get_groups_count = tegra_pinctrl_get_groups_count,
.get_group_name = tegra_pinctrl_get_group_name, .get_group_name = tegra_pinctrl_get_group_name,
.get_group_pins = tegra_pinctrl_get_group_pins, .get_group_pins = tegra_pinctrl_get_group_pins,
...@@ -401,7 +401,7 @@ static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev, ...@@ -401,7 +401,7 @@ static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
pmx_writel(pmx, val, g->mux_bank, g->mux_reg); pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
} }
static struct pinmux_ops tegra_pinmux_ops = { static const struct pinmux_ops tegra_pinmux_ops = {
.get_functions_count = tegra_pinctrl_get_funcs_count, .get_functions_count = tegra_pinctrl_get_funcs_count,
.get_function_name = tegra_pinctrl_get_func_name, .get_function_name = tegra_pinctrl_get_func_name,
.get_function_groups = tegra_pinctrl_get_func_groups, .get_function_groups = tegra_pinctrl_get_func_groups,
...@@ -676,7 +676,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev, ...@@ -676,7 +676,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
} }
#endif #endif
static struct pinconf_ops tegra_pinconf_ops = { static const struct pinconf_ops tegra_pinconf_ops = {
.pin_config_get = tegra_pinconf_get, .pin_config_get = tegra_pinconf_get,
.pin_config_set = tegra_pinconf_set, .pin_config_set = tegra_pinconf_set,
.pin_config_group_get = tegra_pinconf_group_get, .pin_config_group_get = tegra_pinconf_group_get,
......
...@@ -860,7 +860,7 @@ static void u300_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, ...@@ -860,7 +860,7 @@ static void u300_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
seq_printf(s, " " DRIVER_NAME); seq_printf(s, " " DRIVER_NAME);
} }
static struct pinctrl_ops u300_pctrl_ops = { static const struct pinctrl_ops u300_pctrl_ops = {
.get_groups_count = u300_get_groups_count, .get_groups_count = u300_get_groups_count,
.get_group_name = u300_get_group_name, .get_group_name = u300_get_group_name,
.get_group_pins = u300_get_group_pins, .get_group_pins = u300_get_group_pins,
...@@ -1003,7 +1003,7 @@ static int u300_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector, ...@@ -1003,7 +1003,7 @@ static int u300_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
return 0; return 0;
} }
static struct pinmux_ops u300_pmx_ops = { static const struct pinmux_ops u300_pmx_ops = {
.get_functions_count = u300_pmx_get_funcs_count, .get_functions_count = u300_pmx_get_funcs_count,
.get_function_name = u300_pmx_get_func_name, .get_function_name = u300_pmx_get_func_name,
.get_function_groups = u300_pmx_get_groups, .get_function_groups = u300_pmx_get_groups,
...@@ -1046,7 +1046,7 @@ static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, ...@@ -1046,7 +1046,7 @@ static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
return 0; return 0;
} }
static struct pinconf_ops u300_pconf_ops = { static const struct pinconf_ops u300_pconf_ops = {
.is_generic = true, .is_generic = true,
.pin_config_get = u300_pin_config_get, .pin_config_get = u300_pin_config_get,
.pin_config_set = u300_pin_config_set, .pin_config_set = u300_pin_config_set,
......
...@@ -553,7 +553,7 @@ int xway_pinconf_group_set(struct pinctrl_dev *pctldev, ...@@ -553,7 +553,7 @@ int xway_pinconf_group_set(struct pinctrl_dev *pctldev,
return ret; return ret;
} }
static struct pinconf_ops xway_pinconf_ops = { static const struct pinconf_ops xway_pinconf_ops = {
.pin_config_get = xway_pinconf_get, .pin_config_get = xway_pinconf_get,
.pin_config_set = xway_pinconf_set, .pin_config_set = xway_pinconf_set,
.pin_config_group_set = xway_pinconf_group_set, .pin_config_group_set = xway_pinconf_group_set,
......
...@@ -198,7 +198,7 @@ static void spear_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, ...@@ -198,7 +198,7 @@ static void spear_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
kfree(map); kfree(map);
} }
static struct pinctrl_ops spear_pinctrl_ops = { static const struct pinctrl_ops spear_pinctrl_ops = {
.get_groups_count = spear_pinctrl_get_groups_cnt, .get_groups_count = spear_pinctrl_get_groups_cnt,
.get_group_name = spear_pinctrl_get_group_name, .get_group_name = spear_pinctrl_get_group_name,
.get_group_pins = spear_pinctrl_get_group_pins, .get_group_pins = spear_pinctrl_get_group_pins,
...@@ -340,7 +340,7 @@ static void gpio_disable_free(struct pinctrl_dev *pctldev, ...@@ -340,7 +340,7 @@ static void gpio_disable_free(struct pinctrl_dev *pctldev,
gpio_request_endisable(pctldev, range, offset, false); gpio_request_endisable(pctldev, range, offset, false);
} }
static struct pinmux_ops spear_pinmux_ops = { static const struct pinmux_ops spear_pinmux_ops = {
.get_functions_count = spear_pinctrl_get_funcs_count, .get_functions_count = spear_pinctrl_get_funcs_count,
.get_function_name = spear_pinctrl_get_func_name, .get_function_name = spear_pinctrl_get_func_name,
.get_function_groups = spear_pinctrl_get_func_groups, .get_function_groups = spear_pinctrl_get_func_groups,
......
...@@ -118,9 +118,9 @@ struct pinctrl_desc { ...@@ -118,9 +118,9 @@ struct pinctrl_desc {
const char *name; const char *name;
struct pinctrl_pin_desc const *pins; struct pinctrl_pin_desc const *pins;
unsigned int npins; unsigned int npins;
struct pinctrl_ops *pctlops; const struct pinctrl_ops *pctlops;
struct pinmux_ops *pmxops; const struct pinmux_ops *pmxops;
struct pinconf_ops *confops; const struct pinconf_ops *confops;
struct module *owner; struct module *owner;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment