* [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11
@ 2013-06-13 7:00 Simon Horman
2013-06-13 7:00 ` [PATCH 0/1] gpio-rcar: Add DT support Simon Horman
2013-06-15 0:46 ` [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Olof Johansson
0 siblings, 2 replies; 6+ messages in thread
From: Simon Horman @ 2013-06-13 7:00 UTC (permalink / raw)
To: linux-arm-kernel
Hi Olof, Hi Arnd,
This pull request is based on renesas-pinmux-for-v3.11 which you have
previously pulled. It provides the GPIO R-Car driver. I have broken this
pull-request out from a separate pull request I plan to send with further
pinmux updates as it relates specifically to DT. And I wanted to give you
the option of merging it separately.
The following changes since commit 5fcf4a3c3a5bc08bf72a50ef1332501a3c1b96bb:
ARM: shmobile: marzen: Use RCAR_GP_PIN macro (2013-06-05 17:18:24 +0900)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-gpio-rcar-for-v3.11
for you to fetch changes up to 159f8a0209aff155af7f6fcdedd4a4484dd19c23:
gpio-rcar: Add DT support (2013-06-12 21:48:09 +0900)
----------------------------------------------------------------
Renesas ARM based SoC GPIO R-Car updates for v3.11
DT support to GPIO R-Car driver by Laurent Pinchart.
----------------------------------------------------------------
Laurent Pinchart (1):
gpio-rcar: Add DT support
.../devicetree/bindings/gpio/renesas,gpio-rcar.txt | 52 +++++++++++++++++
drivers/gpio/gpio-rcar.c | 66 ++++++++++++++++++----
2 files changed, 108 insertions(+), 10 deletions(-)
create mode 100644 Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 0/1] gpio-rcar: Add DT support 2013-06-13 7:00 [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Simon Horman @ 2013-06-13 7:00 ` Simon Horman 2013-06-15 0:47 ` Olof Johansson 2013-06-15 0:46 ` [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Olof Johansson 1 sibling, 1 reply; 6+ messages in thread From: Simon Horman @ 2013-06-13 7:00 UTC (permalink / raw) To: linux-arm-kernel From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Add DT bindings for the gpio-rcar driver and read the device configuration from the DT node at probe time if available. Cc: devicetree-discuss at lists.ozlabs.org Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> --- .../devicetree/bindings/gpio/renesas,gpio-rcar.txt | 52 +++++++++++++++++ drivers/gpio/gpio-rcar.c | 66 ++++++++++++++++++---- 2 files changed, 108 insertions(+), 10 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt diff --git a/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt new file mode 100644 index 0000000..46d76a0 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt @@ -0,0 +1,52 @@ +* Renesas R-Car GPIO Controller + +Required Properties: + + - compatible: should be one of the following. + - "renesas,gpio-r8a7778": for R8A7778 (R-Mobile M1) compatible GPIO controller. + - "renesas,gpio-r8a7779": for R8A7779 (R-Car H1) compatible GPIO controller. + - "renesas,gpio-r8a7790": for R8A7790 (R-Car H2) compatible GPIO controller. + - "renesas,gpio-rcar": for generic R-Car GPIO controller. + + - reg: Base address and length of each memory resource used by the GPIO + controller hardware module. + + - interrupt-parent: phandle of the parent interrupt controller. + - interrupts: Interrupt specifier for the controllers interrupt. + + - gpio-controller: Marks the device node as a gpio controller. + - #gpio-cells: Should be 2. The first cell is the GPIO number and the second + cell is used to specify optional parameters as bit flags. Only the GPIO + active low flag (bit 0) is currently supported. + - gpio-ranges: Range of pins managed by the GPIO controller as a 4-cells + tuple using the following syntax. + + <[phandle of the pin controller node] + 0 + [index of the first pin] + [number of pins]> + +Please refer to gpio.txt in this directory for details of the common GPIO +bindings used by client devices. + +Example: R8A7779 (R-Car H1) GPIO controller nodes + + gpio0: gpio at ffc40000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc40000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 141 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 0 32>; + }; + ... + gpio6: gpio at ffc46000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc46000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 147 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 192 9>; + }; diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index d173d56..5a693dd 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -51,6 +51,8 @@ struct gpio_rcar_priv { #define FILONOFF 0x28 #define BOTHEDGE 0x4c +#define RCAR_MAX_GPIO_PER_BANK 32 + static inline u32 gpio_rcar_read(struct gpio_rcar_priv *p, int offs) { return ioread32(p->base + offs); @@ -274,9 +276,39 @@ static struct irq_domain_ops gpio_rcar_irq_domain_ops = { .map = gpio_rcar_irq_domain_map, }; +static void gpio_rcar_parse_pdata(struct gpio_rcar_priv *p) +{ + struct gpio_rcar_config *pdata = p->pdev->dev.platform_data; +#ifdef CONFIG_OF + struct device_node *np = p->pdev->dev.of_node; + struct of_phandle_args args; + int ret; +#endif + + if (pdata) + p->config = *pdata; +#ifdef CONFIG_OF + else if (np) { + ret = of_parse_phandle_with_args(np, "gpio-ranges", + "#gpio-range-cells", 0, &args); + p->config.number_of_pins = ret == 0 && args.args_count == 3 + ? args.args[2] + : RCAR_MAX_GPIO_PER_BANK; + p->config.gpio_base = -1; + } +#endif + + if (p->config.number_of_pins == 0 || + p->config.number_of_pins > RCAR_MAX_GPIO_PER_BANK) { + dev_warn(&p->pdev->dev, + "Invalid number of gpio lines %u, using %u\n", + p->config.number_of_pins, RCAR_MAX_GPIO_PER_BANK); + p->config.number_of_pins = RCAR_MAX_GPIO_PER_BANK; + } +} + static int gpio_rcar_probe(struct platform_device *pdev) { - struct gpio_rcar_config *pdata = pdev->dev.platform_data; struct gpio_rcar_priv *p; struct resource *io, *irq; struct gpio_chip *gpio_chip; @@ -291,14 +323,14 @@ static int gpio_rcar_probe(struct platform_device *pdev) goto err0; } - /* deal with driver instance configuration */ - if (pdata) - p->config = *pdata; - p->pdev = pdev; - platform_set_drvdata(pdev, p); spin_lock_init(&p->lock); + /* Get device configuration from DT node or platform data. */ + gpio_rcar_parse_pdata(p); + + platform_set_drvdata(pdev, p); + io = platform_get_resource(pdev, IORESOURCE_MEM, 0); irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); @@ -325,6 +357,7 @@ static int gpio_rcar_probe(struct platform_device *pdev) gpio_chip->set = gpio_rcar_set; gpio_chip->to_irq = gpio_rcar_to_irq; gpio_chip->label = name; + gpio_chip->dev = &pdev->dev; gpio_chip->owner = THIS_MODULE; gpio_chip->base = p->config.gpio_base; gpio_chip->ngpio = p->config.number_of_pins; @@ -371,10 +404,12 @@ static int gpio_rcar_probe(struct platform_device *pdev) p->config.irq_base, ret); } - ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0, - gpio_chip->base, gpio_chip->ngpio); - if (ret < 0) - dev_warn(&pdev->dev, "failed to add pin range\n"); + if (p->config.pctl_name) { + ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0, + gpio_chip->base, gpio_chip->ngpio); + if (ret < 0) + dev_warn(&pdev->dev, "failed to add pin range\n"); + } return 0; @@ -397,11 +432,22 @@ static int gpio_rcar_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id gpio_rcar_of_table[] = { + { + .compatible = "renesas,gpio-rcar", + }, +}; + +MODULE_DEVICE_TABLE(of, gpio_rcar_of_table); +#endif + static struct platform_driver gpio_rcar_device_driver = { .probe = gpio_rcar_probe, .remove = gpio_rcar_remove, .driver = { .name = "gpio_rcar", + .of_match_table = of_match_ptr(gpio_rcar_of_table), } }; -- 1.8.2.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 0/1] gpio-rcar: Add DT support 2013-06-13 7:00 ` [PATCH 0/1] gpio-rcar: Add DT support Simon Horman @ 2013-06-15 0:47 ` Olof Johansson 2013-06-15 11:31 ` Laurent Pinchart 0 siblings, 1 reply; 6+ messages in thread From: Olof Johansson @ 2013-06-15 0:47 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jun 13, 2013 at 04:00:26PM +0900, Simon Horman wrote: > From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > Add DT bindings for the gpio-rcar driver and read the device > configuration from the DT node at probe time if available. > > Cc: devicetree-discuss at lists.ozlabs.org > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Hi, I don't see this cc/acked by Linus or Grant/Rob. However, the binding looks very vanilla to me, so I'll merge it anyway. -Olof ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/1] gpio-rcar: Add DT support 2013-06-15 0:47 ` Olof Johansson @ 2013-06-15 11:31 ` Laurent Pinchart 2013-06-17 2:07 ` Simon Horman 0 siblings, 1 reply; 6+ messages in thread From: Laurent Pinchart @ 2013-06-15 11:31 UTC (permalink / raw) To: linux-arm-kernel Hi Olof, On Friday 14 June 2013 17:47:51 Olof Johansson wrote: > On Thu, Jun 13, 2013 at 04:00:26PM +0900, Simon Horman wrote: > > From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > > > Add DT bindings for the gpio-rcar driver and read the device > > configuration from the DT node at probe time if available. > > > > Cc: devicetree-discuss at lists.ozlabs.org > > Signed-off-by: Laurent Pinchart > > <laurent.pinchart+renesas@ideasonboard.com> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au> > > Hi, > > I don't see this cc/acked by Linus or Grant/Rob. The patch has been acked by Linus, but it seems the ack got lost somewhere. https://patchwork.kernel.org/patch/2596901/ > However, the binding looks very vanilla to me, so I'll merge it anyway. Thank you. -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/1] gpio-rcar: Add DT support 2013-06-15 11:31 ` Laurent Pinchart @ 2013-06-17 2:07 ` Simon Horman 0 siblings, 0 replies; 6+ messages in thread From: Simon Horman @ 2013-06-17 2:07 UTC (permalink / raw) To: linux-arm-kernel On Sat, Jun 15, 2013 at 01:31:08PM +0200, Laurent Pinchart wrote: > Hi Olof, > > On Friday 14 June 2013 17:47:51 Olof Johansson wrote: > > On Thu, Jun 13, 2013 at 04:00:26PM +0900, Simon Horman wrote: > > > From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > > > > > > Add DT bindings for the gpio-rcar driver and read the device > > > configuration from the DT node at probe time if available. > > > > > > Cc: devicetree-discuss at lists.ozlabs.org > > > Signed-off-by: Laurent Pinchart > > > <laurent.pinchart+renesas@ideasonboard.com> > > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au> > > > > Hi, > > > > I don't see this cc/acked by Linus or Grant/Rob. > > The patch has been acked by Linus, but it seems the ack got lost somewhere. > > https://patchwork.kernel.org/patch/2596901/ Sorry for missing that. > > However, the binding looks very vanilla to me, so I'll merge it anyway. > > Thank you. > > -- > Regards, > > Laurent Pinchart > > -- > To unsubscribe from this list: send the line "unsubscribe linux-sh" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 2013-06-13 7:00 [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Simon Horman 2013-06-13 7:00 ` [PATCH 0/1] gpio-rcar: Add DT support Simon Horman @ 2013-06-15 0:46 ` Olof Johansson 1 sibling, 0 replies; 6+ messages in thread From: Olof Johansson @ 2013-06-15 0:46 UTC (permalink / raw) To: linux-arm-kernel On Thu, Jun 13, 2013 at 04:00:25PM +0900, Simon Horman wrote: > Hi Olof, Hi Arnd, > > This pull request is based on renesas-pinmux-for-v3.11 which you have > previously pulled. It provides the GPIO R-Car driver. I have broken this > pull-request out from a separate pull request I plan to send with further > pinmux updates as it relates specifically to DT. And I wanted to give you > the option of merging it separately. > > The following changes since commit 5fcf4a3c3a5bc08bf72a50ef1332501a3c1b96bb: > > ARM: shmobile: marzen: Use RCAR_GP_PIN macro (2013-06-05 17:18:24 +0900) > > are available in the git repository at: > > git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git tags/renesas-gpio-rcar-for-v3.11 > > for you to fetch changes up to 159f8a0209aff155af7f6fcdedd4a4484dd19c23: > > gpio-rcar: Add DT support (2013-06-12 21:48:09 +0900) Pulled. See comment on patch though. -Olof ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-17 2:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-13 7:00 [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Simon Horman 2013-06-13 7:00 ` [PATCH 0/1] gpio-rcar: Add DT support Simon Horman 2013-06-15 0:47 ` Olof Johansson 2013-06-15 11:31 ` Laurent Pinchart 2013-06-17 2:07 ` Simon Horman 2013-06-15 0:46 ` [GIT PULL 0/1] Renesas ARM based SoC GPIO R-Car updates for v3.11 Olof Johansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).