* [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino
@ 2013-02-03 11:10 Maxime Ripard
2013-02-03 11:10 ` Maxime Ripard
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:10 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
This patchset adds the user LED of the Olinuxino to the device tree.
To do so, we also add a custom of_xlate function to the PIO driver so that
we can use a more convenient format for the gpios from the device tree.
Linus, since you took the dt changes for the pinctrl driver in your tree, maybe you could merge the two first patches, the second patch depending on patches in
your tree.
Thanks,
Maxime
Changes:
- Rebased on top of linus walleij allwinner-pinctrl branch
Maxime Ripard (3):
pinctrl: sunxi: Add of_xlate function
sunxi: dts: Report the pinctrl nodes as gpio-controllers
sunxi: a13-olinuxino: Add user LED to the device tree
arch/arm/boot/dts/sun4i-a10.dtsi | 4 +++-
arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 20 ++++++++++++++++++++
arch/arm/boot/dts/sun5i-a13.dtsi | 4 +++-
drivers/pinctrl/pinctrl-sunxi.c | 20 ++++++++++++++++++++
4 files changed, 46 insertions(+), 2 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Add of_xlate function
2013-02-03 11:10 [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Maxime Ripard
@ 2013-02-03 11:10 ` Maxime Ripard
2013-02-03 11:18 ` Maxime Ripard
2013-02-05 16:37 ` [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Linus Walleij
2 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:10 UTC (permalink / raw)
To: linux-arm-kernel
Since the pin controller of sunxi chips is represented as a single bank
in the driver.
Since this is neither convenient nor represented that way in the
datasheets, define a custom of_xlate function with the layout <bank pin
flag>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/pinctrl/pinctrl-sunxi.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index e4d32c6..80b11e3 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -1261,6 +1261,24 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
writel((value & DATA_PINS_MASK) << index, pctl->membase + reg);
}
+static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec,
+ u32 *flags)
+{
+ int pin, base;
+
+ base = PINS_PER_BANK * gpiospec->args[0];
+ pin = base + gpiospec->args[1];
+
+ if (pin > (gc->base + gc->ngpio))
+ return -EINVAL;
+
+ if (flags)
+ *flags = gpiospec->args[2];
+
+ return pin;
+}
+
static struct gpio_chip sunxi_pinctrl_gpio_chip = {
.owner = THIS_MODULE,
.request = sunxi_pinctrl_gpio_request,
@@ -1269,6 +1287,8 @@ static struct gpio_chip sunxi_pinctrl_gpio_chip = {
.direction_output = sunxi_pinctrl_gpio_direction_output,
.get = sunxi_pinctrl_gpio_get,
.set = sunxi_pinctrl_gpio_set,
+ .of_xlate = sunxi_pinctrl_gpio_of_xlate,
+ .of_gpio_n_cells = 3,
.can_sleep = 0,
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Add of_xlate function
@ 2013-02-03 11:10 ` Maxime Ripard
0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:10 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel, Alejandro Mery, Stefan Roese, linux-kernel
Since the pin controller of sunxi chips is represented as a single bank
in the driver.
Since this is neither convenient nor represented that way in the
datasheets, define a custom of_xlate function with the layout <bank pin
flag>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/pinctrl/pinctrl-sunxi.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index e4d32c6..80b11e3 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -1261,6 +1261,24 @@ static void sunxi_pinctrl_gpio_set(struct gpio_chip *chip,
writel((value & DATA_PINS_MASK) << index, pctl->membase + reg);
}
+static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
+ const struct of_phandle_args *gpiospec,
+ u32 *flags)
+{
+ int pin, base;
+
+ base = PINS_PER_BANK * gpiospec->args[0];
+ pin = base + gpiospec->args[1];
+
+ if (pin > (gc->base + gc->ngpio))
+ return -EINVAL;
+
+ if (flags)
+ *flags = gpiospec->args[2];
+
+ return pin;
+}
+
static struct gpio_chip sunxi_pinctrl_gpio_chip = {
.owner = THIS_MODULE,
.request = sunxi_pinctrl_gpio_request,
@@ -1269,6 +1287,8 @@ static struct gpio_chip sunxi_pinctrl_gpio_chip = {
.direction_output = sunxi_pinctrl_gpio_direction_output,
.get = sunxi_pinctrl_gpio_get,
.set = sunxi_pinctrl_gpio_set,
+ .of_xlate = sunxi_pinctrl_gpio_of_xlate,
+ .of_gpio_n_cells = 3,
.can_sleep = 0,
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] sunxi: dts: Report the pinctrl nodes as gpio-controllers
2013-02-03 11:10 [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Maxime Ripard
@ 2013-02-03 11:18 ` Maxime Ripard
2013-02-03 11:18 ` Maxime Ripard
2013-02-05 16:37 ` [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Linus Walleij
2 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:18 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
arch/arm/boot/dts/sun4i-a10.dtsi | 4 +++-
arch/arm/boot/dts/sun5i-a13.dtsi | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index f99f60d..03d2b53 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -18,11 +18,13 @@
};
soc {
- pinctrl at 01c20800 {
+ pio: pinctrl at 01c20800 {
compatible = "allwinner,sun4i-a10-pinctrl";
reg = <0x01c20800 0x400>;
+ gpio-controller;
#address-cells = <1>;
#size-cells = <0>;
+ #gpio-cells = <3>;
uart0_pins_a: uart0 at 0 {
allwinner,pins = "PB22", "PB23";
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index e112189..945bfac 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -19,11 +19,13 @@
};
soc {
- pinctrl at 01c20800 {
+ pio: pinctrl at 01c20800 {
compatible = "allwinner,sun5i-a13-pinctrl";
reg = <0x01c20800 0x400>;
+ gpio-controller;
#address-cells = <1>;
#size-cells = <0>;
+ #gpio-cells = <3>;
uart1_pins_a: uart1 at 0 {
allwinner,pins = "PE10", "PE11";
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] sunxi: dts: Report the pinctrl nodes as gpio-controllers
@ 2013-02-03 11:18 ` Maxime Ripard
0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:18 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel, Alejandro Mery, Stefan Roese, Russell King,
linux-kernel
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
arch/arm/boot/dts/sun4i-a10.dtsi | 4 +++-
arch/arm/boot/dts/sun5i-a13.dtsi | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
index f99f60d..03d2b53 100644
--- a/arch/arm/boot/dts/sun4i-a10.dtsi
+++ b/arch/arm/boot/dts/sun4i-a10.dtsi
@@ -18,11 +18,13 @@
};
soc {
- pinctrl@01c20800 {
+ pio: pinctrl@01c20800 {
compatible = "allwinner,sun4i-a10-pinctrl";
reg = <0x01c20800 0x400>;
+ gpio-controller;
#address-cells = <1>;
#size-cells = <0>;
+ #gpio-cells = <3>;
uart0_pins_a: uart0@0 {
allwinner,pins = "PB22", "PB23";
diff --git a/arch/arm/boot/dts/sun5i-a13.dtsi b/arch/arm/boot/dts/sun5i-a13.dtsi
index e112189..945bfac 100644
--- a/arch/arm/boot/dts/sun5i-a13.dtsi
+++ b/arch/arm/boot/dts/sun5i-a13.dtsi
@@ -19,11 +19,13 @@
};
soc {
- pinctrl@01c20800 {
+ pio: pinctrl@01c20800 {
compatible = "allwinner,sun5i-a13-pinctrl";
reg = <0x01c20800 0x400>;
+ gpio-controller;
#address-cells = <1>;
#size-cells = <0>;
+ #gpio-cells = <3>;
uart1_pins_a: uart1@0 {
allwinner,pins = "PE10", "PE11";
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] sunxi: a13-olinuxino: Add user LED to the device tree
2013-02-03 11:18 ` Maxime Ripard
@ 2013-02-03 11:18 ` Maxime Ripard
-1 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:18 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 4a1e45d..33d1c7e 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -23,10 +23,30 @@
};
soc {
+ pinctrl at 01c20800 {
+ led_pins_olinuxino: led_pins at 0 {
+ allwinner,pins = "PG9";
+ allwinner,function = "gpio_out";
+ allwinner,drive = <1>;
+ allwinner,pull = <0>;
+ };
+ };
+
uart1: uart at 01c28400 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins_b>;
status = "okay";
};
};
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&led_pins_olinuxino>;
+
+ power {
+ gpios = <&pio 6 9 0>;
+ default-state = "on";
+ };
+ };
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] sunxi: a13-olinuxino: Add user LED to the device tree
@ 2013-02-03 11:18 ` Maxime Ripard
0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-03 11:18 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-arm-kernel, Alejandro Mery, Stefan Roese, Russell King,
linux-kernel
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
arch/arm/boot/dts/sun5i-a13-olinuxino.dts | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
index 4a1e45d..33d1c7e 100644
--- a/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
+++ b/arch/arm/boot/dts/sun5i-a13-olinuxino.dts
@@ -23,10 +23,30 @@
};
soc {
+ pinctrl@01c20800 {
+ led_pins_olinuxino: led_pins@0 {
+ allwinner,pins = "PG9";
+ allwinner,function = "gpio_out";
+ allwinner,drive = <1>;
+ allwinner,pull = <0>;
+ };
+ };
+
uart1: uart@01c28400 {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins_b>;
status = "okay";
};
};
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-names = "default";
+ pinctrl-0 = <&led_pins_olinuxino>;
+
+ power {
+ gpios = <&pio 6 9 0>;
+ default-state = "on";
+ };
+ };
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/3] pinctrl: sunxi: Add of_xlate function
2013-02-03 11:10 ` Maxime Ripard
@ 2013-02-05 16:34 ` Linus Walleij
-1 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2013-02-05 16:34 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Feb 3, 2013 at 12:10 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Since the pin controller of sunxi chips is represented as a single bank
> in the driver.
> Since this is neither convenient nor represented that way in the
> datasheets, define a custom of_xlate function with the layout <bank pin
> flag>
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Applied to my allwinner branch. I will soon lock down this branch
and merge it into devel so I mature my devel branch for the
merge window.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] pinctrl: sunxi: Add of_xlate function
@ 2013-02-05 16:34 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2013-02-05 16:34 UTC (permalink / raw)
To: Maxime Ripard
Cc: linux-arm-kernel, Alejandro Mery, Stefan Roese, linux-kernel
On Sun, Feb 3, 2013 at 12:10 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Since the pin controller of sunxi chips is represented as a single bank
> in the driver.
> Since this is neither convenient nor represented that way in the
> datasheets, define a custom of_xlate function with the layout <bank pin
> flag>
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Applied to my allwinner branch. I will soon lock down this branch
and merge it into devel so I mature my devel branch for the
merge window.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino
2013-02-03 11:10 [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Maxime Ripard
2013-02-03 11:10 ` Maxime Ripard
2013-02-03 11:18 ` Maxime Ripard
@ 2013-02-05 16:37 ` Linus Walleij
2013-02-05 19:05 ` Maxime Ripard
2 siblings, 1 reply; 11+ messages in thread
From: Linus Walleij @ 2013-02-05 16:37 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Feb 3, 2013 at 12:10 PM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> To do so, we also add a custom of_xlate function to the PIO driver so that
> we can use a more convenient format for the gpios from the device tree.
This is now merged.
> Linus, since you took the dt changes for the pinctrl driver in your tree, maybe you could merge
> the two first patches, the second patch depending on patches in
> your tree.
Patch 2/3 does not apply to my tree. You must have something
more in your tree.
Actually I'm the kind of guy who thinks that DT stuff is better off
merged on it's own. In theory that stuff will one day be in its
own git and then we cannot rely on the application order of
changes to device trees vis-a-vis changes to code.
So for my part, just merge the DT stuff wherever you like
as long as there are no conflicts, Acked-by.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino
2013-02-05 16:37 ` [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Linus Walleij
@ 2013-02-05 19:05 ` Maxime Ripard
0 siblings, 0 replies; 11+ messages in thread
From: Maxime Ripard @ 2013-02-05 19:05 UTC (permalink / raw)
To: linux-arm-kernel
Hi Linus,
Le 05/02/2013 17:37, Linus Walleij a ?crit :
> On Sun, Feb 3, 2013 at 12:10 PM, Maxime Ripard
> <maxime.ripard@free-electrons.com> wrote:
>
>> To do so, we also add a custom of_xlate function to the PIO driver so that
>> we can use a more convenient format for the gpios from the device tree.
>
> This is now merged.
Thanks!
>> Linus, since you took the dt changes for the pinctrl driver in your tree, maybe you could merge
>> the two first patches, the second patch depending on patches in
>> your tree.
>
> Patch 2/3 does not apply to my tree. You must have something
> more in your tree.
That's really odd. I can apply it perfectly fine on top of your
allwinner-sunxi branch in the linux-pinctrl tree here.
I tested by cherry-picking the commit 4572f97d from the branch
sunxi-3.8-04-olinuxino-leds, in the git tree found at
https://github.com/mripard/linux.git, but I can't apply it on top of my
own branches because this patch depends on the commits 874b4e45 and
9e2dcb2f you merged into your tree.
Maxime
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-02-05 19:05 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-03 11:10 [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Maxime Ripard
2013-02-03 11:10 ` [PATCH 1/3] pinctrl: sunxi: Add of_xlate function Maxime Ripard
2013-02-03 11:10 ` Maxime Ripard
2013-02-05 16:34 ` Linus Walleij
2013-02-05 16:34 ` Linus Walleij
2013-02-03 11:18 ` [PATCH 2/3] sunxi: dts: Report the pinctrl nodes as gpio-controllers Maxime Ripard
2013-02-03 11:18 ` Maxime Ripard
2013-02-03 11:18 ` [PATCH 3/3] sunxi: a13-olinuxino: Add user LED to the device tree Maxime Ripard
2013-02-03 11:18 ` Maxime Ripard
2013-02-05 16:37 ` [PATCHv2 0/3] Add support for user LED on the A13-Olinuxino Linus Walleij
2013-02-05 19:05 ` Maxime Ripard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.