Skip to contentSkip to conversation

Add pinctrl driver for Allwinner A1X SoCs

PATCH New Maxime Ripard 3 participants 14 messages Dec 10, 2012 – Dec 12, 2012

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10 and A13, and the SoC-specific bits for the A13. It also adds the documentation for the device tree bindings.

This patch set has been tested on a Olimex A13-Olinuxino.

Thanks,
Maxime

Maxime Ripard (6):
ARM: sunxi: Add pinctrl driver for Allwinner SoCs
ARM: pinctrl: sunxi: Add the pinctrl pin set for sun5i
ARM: sunxi: Add pinctrl node to the device tree
ARM: sunxi: Add uart1 pinctrl groups
tty: of_serial: Add pinctrl support
ARM: sunxi: olinuxino: Add muxing for the uart

 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   77 +++
 arch/arm/boot/dts/sun5i-olinuxino.dts              |    2 +
 arch/arm/boot/dts/sun5i.dtsi                       |   21 +
 arch/arm/mach-sunxi/Kconfig                        |    1 +
 drivers/pinctrl/Kconfig                            |    5 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-sunxi.c                    |  555 ++++++++++++++++++++
 drivers/pinctrl/pinctrl-sunxi.h                    |  315 +++++++++++
 drivers/tty/serial/of_serial.c                     |    7 +
 9 files changed, 984 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-sunxi.c
 create mode 100644 drivers/pinctrl/pinctrl-sunxi.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/6 ARM: sunxi: Add pinctrl driver for Allwinner SoCs

The Allwinner SoCs have an IP module that handle both the muxing and the GPIOs.

This IP has 8 banks of 32 bits, with a number of pins actually useful for each of these banks varying from one to another, and depending on the SoC used on the board.

This driver only implements the pinctrl part, the gpio part will come eventually.

---
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   77 ++++
 arch/arm/mach-sunxi/Kconfig                        |    1 +
 drivers/pinctrl/Kconfig                            |    5 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/pinctrl-sunxi.c                    |  435 ++++++++++++++++++++
 drivers/pinctrl/pinctrl-sunxi.h                    |  315 ++++++++++++++
 6 files changed, 834 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-sunxi.c
 create mode 100644 drivers/pinctrl/pinctrl-sunxi.h
Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt new file +77 -0
new file mode 100644
index 0000000..f1968e9
@@ -0,0 +1,77 @@
+* Allwinner A1X Pin Controller
+
+The pins controlled by sunXi pin controller are organized in banks,
+each bank has 32 pins.  Each pin has 7 multiplexing functions, with
+the first two functions being GPIO in and out. The configuration on
+the pins includes drive strength and pull-up.
+
+Required properties:
+- compatible: "allwinner,<soc>-pinctrl". Supported SoCs for now are:
+  sun5i.
+- reg: Should contain the register physical address and length for the
+  pin controller.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices.
+
+A pinctrl node should contain at least one subnodes representing the
+pinctrl groups available on the machine. Each subnode will list the
+pins it needs, and how they should be configured, with regard to muxer
+configuration, drive strength and pullups. If one of these options is
+not set, its actual value will be unspecified.
+
+Required subnode-properties:
+
+
+- allwinner,pin-ids: An integer array. Each integer in the array
+  specify a pin with given mux function, with bank, pin and mux packed
+  as below.
+
+    [15..12] : bank number
+    [11..4]  : pin number
+    [3..0]   : mux selection
+
+  This integer with mux selection packed is used as an entity by both group
+  and config nodes to identify a pin.  The mux selection in the integer takes
+  effects only on group node, and will get ignored by driver with config node,
+  since config node is only meant to set up pin configurations.
+
+  Valid values for these integers are listed below.
+
+- reg: Should be the index of the group nodes for same function.  This property
+  is required only for group nodes, and should not be present in any config
+  nodes.
+
+Optional subnode-properties:
+- allwinner,drive: Integer.
+    0: To be documented
+    1: To be documented
+    2: To be documented
+    3: To be documented
+- allwinner,pull: Integer.
+    0: No resistor
+    1: Pull-up resistor
+    2: Pull-down resistor
+
+Examples:
+
+pinctrl at 01c20800 {
+	compatible = "allwinner,sun5i-pinctrl";
+	reg = <0x01c20800 0x400>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	uart1_pins_a: uart1 at 0 {
+		reg = <0>;
+		allwinner,pin-ids = <0x40a4 0x40b4>;
+		allwinner,drive = <0>;
+		allwinner,pull = <0>;
+	};
+
+	uart1_pins_b: uart1 at 1 {
+		reg = <1>;
+		allwinner,pin-ids = <0x6034 0x6044>;
+		allwinner,drive = <0>;
+		allwinner,pull = <0>;
+	};
+};
arch/arm/mach-sunxi/Kconfig +1 -0
index 3fdd008..8709a39 100644
@@ -7,3 +7,4 @@ config ARCH_SUNXI
 	select PINCTRL
 	select SPARSE_IRQ
 	select SUNXI_TIMER
+	select PINCTRL_SUNXI
\ No newline at end of file
drivers/pinctrl/Kconfig +5 -0
index d96caef..94925ab 100644
@@ -147,6 +147,11 @@ config PINCTRL_SIRF
 	depends on ARCH_PRIMA2
 	select PINMUX
 
+config PINCTRL_SUNXI
+	bool
+	select PINMUX
+	select PINCONF
+
 config PINCTRL_TEGRA
 	bool
 
drivers/pinctrl/Makefile +1 -0
index f395ba5..8f3ddea 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_PINCTRL_PXA168)	+= pinctrl-pxa168.o
 obj-$(CONFIG_PINCTRL_PXA910)	+= pinctrl-pxa910.o
 obj-$(CONFIG_PINCTRL_SINGLE)	+= pinctrl-single.o
 obj-$(CONFIG_PINCTRL_SIRF)	+= pinctrl-sirf.o
+obj-$(CONFIG_PINCTRL_SUNXI)	+= pinctrl-sunxi.o
 obj-$(CONFIG_PINCTRL_TEGRA)	+= pinctrl-tegra.o
 obj-$(CONFIG_PINCTRL_TEGRA20)	+= pinctrl-tegra20.o
 obj-$(CONFIG_PINCTRL_TEGRA30)	+= pinctrl-tegra30.o
drivers/pinctrl/pinctrl-sunxi.c new file +435 -0

435 lines not on this page · raw message

drivers/pinctrl/pinctrl-sunxi.h new file +315 -0

315 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/6 ARM: sunxi: Add pinctrl driver for Allwinner SoCs

Quoted 6 lines · Maxime Ripard

This IP has 8 banks of 32 bits, with a number of pins actually useful for each of these banks varying from one to another, and depending on the SoC used on the board.

This driver only implements the pinctrl part, the gpio part will come eventually.

It's looking pretty nice already :-)

Of course I have some comments...

OK will it be a combined driver so the same file implement both pinctrl and gpio?

(...)

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt line 32

Quoted 7 lines

+- allwinner,pin-ids: An integer array. Each integer in the array

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt new file +6 -0
+  specify a pin with given mux function, with bank, pin and mux packed
+  as below.
+
+    [15..12] : bank number
+    [11..4]  : pin number
+    [3..0]   : mux selection

Why are you using this scheme instead of just open-coding the three things? Well maybe I'm not getting it... Device Trees are usually for reading, not for bitstuffing, that's why I ask.

You should pass all this DT stuff to the devicetree-discuss list because I'm not any good at this (paging Stephen Warren.)

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt line 54

Quoted 4 lines

+- allwinner,pull: Integer.

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt new file +3 -0
+    0: No resistor
+    1: Pull-up resistor
+    2: Pull-down resistor

This seems legit.

drivers/pinctrl/Kconfig config PINCTRL_SIRF · line 153

Quoted 4 lines
drivers/pinctrl/Kconfig +4 -0
+config PINCTRL_SUNXI
+       bool
+       select PINMUX
+       select PINCONF

If your SoC is only simple pinconfig like pull-up/pull-down, why are you not using PINCONF_GENERIC and <linux/pinctrl/pinconf-generic.h>?

(...)

drivers/pinctrl/pinctrl-sunxi.c line 80

Quoted 7 lines
drivers/pinctrl/pinctrl-sunxi.c new file +7 -0
+       ret = of_property_read_u32(node, "allwinner,drive", &val);
+       if (!ret)
+               config |= val << DLEVEL_SHIFT | DLEVEL_PRESENT;
+
+       ret = of_property_read_u32(node, "allwinner,pull", &val);
+       if (!ret)
+               config |= val << PULL_SHIFT | PULL_PRESENT;

So looks nice... but can you use generic pinconfig?

drivers/pinctrl/pinctrl-sunxi.c line 224

Quoted 11 lines
drivers/pinctrl/pinctrl-sunxi.c new file +11 -0
+static void sunxi_pmx_set_config(struct pinctrl_dev *pctldev,
+                                unsigned pin,
+                                u8 config)
+{
+       struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
+
+       u32 val = readl(pctl->membase + CFG_REG(pin));
+       u32 mask = ((1 << CFG_PINS_BITS) - 1) << CFG_OFFSET(pin);
+       writel((val & ~mask) | config << CFG_OFFSET(pin),
+               pctl->membase + CFG_REG(pin));
+}

There is something a bit confusing with the naming here, this is configuring the multiplexing (mux) but named config and CFG, which makes for great misunderstandings... can it be changed to eg just pmx_set() and MUX_OFFSET and MUX_REG() for example?

drivers/pinctrl/pinctrl-sunxi.c line 256

Quoted 4 lines
drivers/pinctrl/pinctrl-sunxi.c new file +4 -0
+static struct of_device_id sunxi_pinctrl_match[] __devinitconst = {
+       {}
+};
+MODULE_DEVICE_TABLE(of, sunxi_pinctrl_match);

This table will not match very much :-/

You should put one example in atleast? Something must have been used to test this...

Quoted 17 lines
drivers/pinctrl/pinctrl-sunxi.c new file +17 -0
+static int __devinit sunxi_pinctrl_parse_group(struct platform_device *pdev,
+                                              struct device_node *node,
+                                              int idx,
+                                              const char **out_name)
+{
+       struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev);
+       struct sunxi_pinctrl_group *group = pctl->groups + idx;
+       struct property *prop;
+       char *group_name;
+       int i;
+       u32 val, proplen;
+
+       group_name = devm_kzalloc(&pdev->dev, strlen(node->name) + 4,
+                                 GFP_KERNEL);
+       if (!group_name)
+               return -ENOMEM;
+       if (of_property_read_u32(node, "reg", &val))

drivers/pinctrl/pinctrl-sunxi.c line 284

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.c new file +10 -0
+               snprintf(group_name, strlen(node->name), "%s", node->name);
+       else
+               snprintf(group_name, strlen(node->name) + 4,
+                        "%s.%d", node->name, val);
+       group->name = group_name;
+
+       prop = of_find_property(node, "allwinner,pin-ids", &proplen);
+       if (!prop)
+               return -EINVAL;
+       group->npins = proplen / sizeof(u32);

So storing one u32 for every pin I guess.

Quoted 8 lines
drivers/pinctrl/pinctrl-sunxi.c new file +8 -0
+       group->pins = devm_kzalloc(&pdev->dev,
+                                  group->npins * sizeof(*group->pins),
+                                  GFP_KERNEL);
+       if (!group->pins)
+               return -ENOMEM;
+
+       group->muxcfg = devm_kzalloc(&pdev->dev,
+                                    group->npins * sizeof(*group->muxcfg),

drivers/pinctrl/pinctrl-sunxi.c line 303

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.c new file +10 -0
+                                    GFP_KERNEL);
+       if (!group->muxcfg)
+               return -ENOMEM;
+
+       of_property_read_u32_array(node, "allwinner,pin-ids", group->pins,
+                                  group->npins);
+       for (i = 0; i < group->npins; i++) {
+               group->muxcfg[i] = MUXID_TO_MUXCFG(group->pins[i]);
+               group->pins[i] = MUXID_TO_PIN(group->pins[i]);
+       }

This loop is rather awkward I mean, instead of bitstuffing muxcfg and pin ID into a single u32 why not just have them as separate attributes.

Then there was somthing about bank ID which I guess is just discarded here?

(...)

Quoted 7 lines
drivers/pinctrl/pinctrl-sunxi.c new file +7 -0
+static int __devinit sunxi_pinctrl_probe(struct platform_device *pdev)
+{
+       struct sunxi_pinctrl *pctl;
+       int i, ret;
+
+       pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
+       if (!pctl)

drivers/pinctrl/pinctrl-sunxi.c line 404

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.c new file +10 -0
+               return -ENOMEM;
+       platform_set_drvdata(pdev, pctl);
+
+       ret = sunxi_pinctrl_probe_dt(pdev, pctl);
+       if (ret) {
+               dev_err(&pdev->dev, "dt probe failed: %d\n", ret);
+               return ret;
+       }
+
+       pctl->data = (struct sunxi_pinctrl_data *)of_match_device(sunxi_pinctrl_match, &pdev->dev)->data;

I can't parse this, what is going on here?
Can you break this statement apart somehow?

(...)

Quoted 10 lines

+++ b/drivers/pinctrl/pinctrl-sunxi.h

drivers/pinctrl/pinctrl-sunxi.h new file +8 -0
+#define PINS_PER_BANK  32
+
+#define CFG_REG(pin)   (round_down(                                    \
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 8) * 0x04, 4))
+#define CFG_OFFSET(pin)        ((pin % 8) * 4)
+
+#define DLEVEL_REG(pin)        (round_down(                                    \

drivers/pinctrl/pinctrl-sunxi.h line 35

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.h new file +10 -0
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 16) * 0x04 +   \
+                               0x14, 4))
+#define DLEVEL_OFFSET(pin)     ((pin % 16) * 2)
+
+#define PULL_REG(pin)  (round_down(                                    \
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 16) * 0x04 +   \
+                               0x1c, 4))
+#define PULL_OFFSET(pin)       ((pin % 16) * 2)

These are impossible to understand. Please convert these to documented static inline functions instead so the code can be maintained in the future.

drivers/pinctrl/pinctrl-sunxi.h line 45

Quoted 9 lines
drivers/pinctrl/pinctrl-sunxi.h new file +9 -0
+#define CFG_PINS_PER_REG       8
+#define CFG_PINS_BITS          4
+#define DLEVEL_PINS_PER_REG    16
+#define DLEVEL_PINS_BITS       2
+#define PULL_PINS_PER_REG      16
+#define PULL_PINS_BITS         2
+
+#define MUXID_TO_PIN(id)       ((((id) >> 12 & 0xf) * 32) + ((id) >> 4 & 0xff))
+#define MUXID_TO_MUXCFG(id)    ((id) & 0xf)

Same here.

Quoted 22 lines
drivers/pinctrl/pinctrl-sunxi.h new file +22 -0
+#define SUNXI_PINCTRL_PIN_PA0  PINCTRL_PIN(0 + 0, "PA0")
+#define SUNXI_PINCTRL_PIN_PA1  PINCTRL_PIN(0 + 1, "PA1")
+#define SUNXI_PINCTRL_PIN_PA2  PINCTRL_PIN(0 + 2, "PA2")
+#define SUNXI_PINCTRL_PIN_PA3  PINCTRL_PIN(0 + 3, "PA3")
+#define SUNXI_PINCTRL_PIN_PA4  PINCTRL_PIN(0 + 4, "PA4")
+#define SUNXI_PINCTRL_PIN_PA5  PINCTRL_PIN(0 + 5, "PA5")
+#define SUNXI_PINCTRL_PIN_PA6  PINCTRL_PIN(0 + 6, "PA6")
+#define SUNXI_PINCTRL_PIN_PA7  PINCTRL_PIN(0 + 7, "PA7")
+#define SUNXI_PINCTRL_PIN_PA8  PINCTRL_PIN(0 + 8, "PA8")
+#define SUNXI_PINCTRL_PIN_PA9  PINCTRL_PIN(0 + 9, "PA9")
+#define SUNXI_PINCTRL_PIN_PA10 PINCTRL_PIN(0 + 10, "PA10")
+#define SUNXI_PINCTRL_PIN_PA11 PINCTRL_PIN(0 + 11, "PA11")
+#define SUNXI_PINCTRL_PIN_PA12 PINCTRL_PIN(0 + 12, "PA12")
+#define SUNXI_PINCTRL_PIN_PA13 PINCTRL_PIN(0 + 13, "PA13")
+#define SUNXI_PINCTRL_PIN_PA14 PINCTRL_PIN(0 + 14, "PA14")
+#define SUNXI_PINCTRL_PIN_PA15 PINCTRL_PIN(0 + 15, "PA15")
+#define SUNXI_PINCTRL_PIN_PA16 PINCTRL_PIN(0 + 16, "PA16")
+#define SUNXI_PINCTRL_PIN_PA17 PINCTRL_PIN(0 + 17, "PA17")
+#define SUNXI_PINCTRL_PIN_PA18 PINCTRL_PIN(0 + 18, "PA18")
+#define SUNXI_PINCTRL_PIN_PA19 PINCTRL_PIN(0 + 19, "PA19")
+#define SUNXI_PINCTRL_PIN_PA20 PINCTRL_PIN(0 + 20, "PA20")
+#define SUNXI_PINCTRL_PIN_PA21 PINCTRL_PIN(0 + 21, "PA21")

drivers/pinctrl/pinctrl-sunxi.h line 85

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.h new file +10 -0
+#define SUNXI_PINCTRL_PIN_PA22 PINCTRL_PIN(0 + 22, "PA22")
+#define SUNXI_PINCTRL_PIN_PA23 PINCTRL_PIN(0 + 23, "PA23")
+#define SUNXI_PINCTRL_PIN_PA24 PINCTRL_PIN(0 + 24, "PA24")
+#define SUNXI_PINCTRL_PIN_PA25 PINCTRL_PIN(0 + 25, "PA25")
+#define SUNXI_PINCTRL_PIN_PA26 PINCTRL_PIN(0 + 26, "PA26")
+#define SUNXI_PINCTRL_PIN_PA27 PINCTRL_PIN(0 + 27, "PA27")
+#define SUNXI_PINCTRL_PIN_PA28 PINCTRL_PIN(0 + 28, "PA28")
+#define SUNXI_PINCTRL_PIN_PA29 PINCTRL_PIN(0 + 29, "PA29")
+#define SUNXI_PINCTRL_PIN_PA30 PINCTRL_PIN(0 + 30, "PA30")
+#define SUNXI_PINCTRL_PIN_PA31 PINCTRL_PIN(0 + 31, "PA31")

0+0, 0+1, 0+2 .... why not just use the scalar? 0, 1, 2, ... 31?

I understand that the zero denotes bank 0 or bank A or somtheing (PA, PB etc) so if you need to keep that, use something like

#define PA_BASE 0

Then

#define SUNXI_PINCTRL_PIN_PA28 PINCTRL_PIN(PA_BASE + 28, "PA28")

which makes more sense.

drivers/pinctrl/pinctrl-sunxi.h line 88

Quoted 2 lines
drivers/pinctrl/pinctrl-sunxi.h new file +2 -0
+#define SUNXI_PINCTRL_PIN_PB0  PINCTRL_PIN(32 + 0, "PB0")
+#define SUNXI_PINCTRL_PIN_PB1  PINCTRL_PIN(32 + 1, "PB1")

(...)

Dito for C, D, E, F, G...

Yours,
Linus Walleij

#3 lore raw

PATCH 1/6 ARM: sunxi: Add pinctrl driver for Allwinner SoCs

Hi Linus,

Le 11/12/2012 01:28, Linus Walleij a ?crit :

Quoted 10 lines
Quoted 6 lines · Maxime Ripard

This IP has 8 banks of 32 bits, with a number of pins actually useful for each of these banks varying from one to another, and depending on the SoC used on the board.

This driver only implements the pinctrl part, the gpio part will come eventually.

Quoted 6 lines

It's looking pretty nice already :-)

Of course I have some comments...

OK will it be a combined driver so the same file implement both pinctrl and gpio?

It's not fixed yet, for now I've done a very draft that is a separate gpio driver, but relies on the pinctrl_*gpio functions.

But since it's still at an early stage, if you have a better solution, I'd be happy to follow it.

Quoted 11 lines

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt line 32

Quoted 7 lines

+- allwinner,pin-ids: An integer array. Each integer in the array

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt new file +6 -0
+  specify a pin with given mux function, with bank, pin and mux packed
+  as below.
+
+    [15..12] : bank number
+    [11..4]  : pin number
+    [3..0]   : mux selection

Why are you using this scheme instead of just open-coding the three things? Well maybe I'm not getting it... Device Trees are usually for reading, not for bitstuffing, that's why I ask.

I'm used to the mxs syntax, so I based my work on it. But after a quick look, it looks like the more recent pinctrl drivers like for bcm2835 or mvebu use strings to give a much more readable dt.

I'll change that.

Quoted 2 lines

You should pass all this DT stuff to the devicetree-discuss list because I'm not any good at this (paging Stephen Warren.)

Ok, I will :)

Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt line 54

Quoted 4 lines

+- allwinner,pull: Integer.

Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt new file +3 -0
+    0: No resistor
+    1: Pull-up resistor
+    2: Pull-down resistor

This seems legit.

Quoted 7 lines

drivers/pinctrl/Kconfig config PINCTRL_SIRF · line 153

Quoted 4 lines
drivers/pinctrl/Kconfig +4 -0
+config PINCTRL_SUNXI
+       bool
+       select PINMUX
+       select PINCONF

If your SoC is only simple pinconfig like pull-up/pull-down, why are you not using PINCONF_GENERIC and <linux/pinctrl/pinconf-generic.h>?

It's not only pull-up/pull-down but also "drive levels". Since we don't have any useful datasheet for these SoCs, we're not quite sure about what this is really about except than it is related to the current of the pin though (thus the "to be documented" in the documentation).

I didn't saw the pinconf-generic infrastructure, I'll switch to it.

Quoted 10 lines

(...)

drivers/pinctrl/pinctrl-sunxi.c line 80

Quoted 7 lines
drivers/pinctrl/pinctrl-sunxi.c new file +7 -0
+       ret = of_property_read_u32(node, "allwinner,drive", &val);
+       if (!ret)
+               config |= val << DLEVEL_SHIFT | DLEVEL_PRESENT;
+
+       ret = of_property_read_u32(node, "allwinner,pull", &val);
+       if (!ret)
+               config |= val << PULL_SHIFT | PULL_PRESENT;

So looks nice... but can you use generic pinconfig?

Yes

Quoted 10 lines
Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.c new file +9 -0
+static void sunxi_pmx_set_config(struct pinctrl_dev *pctldev,
+                                unsigned pin,
+                                u8 config)
+{
+       struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
+
+       u32 val = readl(pctl->membase + CFG_REG(pin));
+       u32 mask = ((1 << CFG_PINS_BITS) - 1) << CFG_OFFSET(pin);
+       writel((val & ~mask) | config << CFG_OFFSET(pin),
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+               pctl->membase + CFG_REG(pin));
+}

There is something a bit confusing with the naming here, this is configuring the multiplexing (mux) but named config and CFG, which makes for great misunderstandings... can it be changed to eg just pmx_set() and MUX_OFFSET and MUX_REG() for example?

You're right, will do.

Quoted 9 lines

drivers/pinctrl/pinctrl-sunxi.c line 256

Quoted 4 lines
drivers/pinctrl/pinctrl-sunxi.c new file +4 -0
+static struct of_device_id sunxi_pinctrl_match[] __devinitconst = {
+       {}
+};
+MODULE_DEVICE_TABLE(of, sunxi_pinctrl_match);

This table will not match very much :-/

You should put one example in atleast? Something must have been used to test this...

Aaah, sorry, I forgot to Cc you in the second patch that adds precisely this part of the driver...

Sorry again.

Quoted 21 lines
Quoted 21 lines
drivers/pinctrl/pinctrl-sunxi.c new file +21 -0
+static int __devinit sunxi_pinctrl_parse_group(struct platform_device *pdev,
+                                              struct device_node *node,
+                                              int idx,
+                                              const char **out_name)
+{
+       struct sunxi_pinctrl *pctl = platform_get_drvdata(pdev);
+       struct sunxi_pinctrl_group *group = pctl->groups + idx;
+       struct property *prop;
+       char *group_name;
+       int i;
+       u32 val, proplen;
+
+       group_name = devm_kzalloc(&pdev->dev, strlen(node->name) + 4,
+                                 GFP_KERNEL);
+       if (!group_name)
+               return -ENOMEM;
+       if (of_property_read_u32(node, "reg", &val))
+               snprintf(group_name, strlen(node->name), "%s", node->name);
+       else
+               snprintf(group_name, strlen(node->name) + 4,
+                        "%s.%d", node->name, val);
Quoted 8 lines

drivers/pinctrl/pinctrl-sunxi.c line 284

Quoted 6 lines
drivers/pinctrl/pinctrl-sunxi.c new file +6 -0
+       group->name = group_name;
+
+       prop = of_find_property(node, "allwinner,pin-ids", &proplen);
+       if (!prop)
+               return -EINVAL;
+       group->npins = proplen / sizeof(u32);

So storing one u32 for every pin I guess.

I'm not sure to understand what you mean here, but the sizeof is definitely useless.

Quoted 22 lines
Quoted 8 lines
drivers/pinctrl/pinctrl-sunxi.c new file +8 -0
+       group->pins = devm_kzalloc(&pdev->dev,
+                                  group->npins * sizeof(*group->pins),
+                                  GFP_KERNEL);
+       if (!group->pins)
+               return -ENOMEM;
+
+       group->muxcfg = devm_kzalloc(&pdev->dev,
+                                    group->npins * sizeof(*group->muxcfg),

drivers/pinctrl/pinctrl-sunxi.c line 303

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.c new file +10 -0
+                                    GFP_KERNEL);
+       if (!group->muxcfg)
+               return -ENOMEM;
+
+       of_property_read_u32_array(node, "allwinner,pin-ids", group->pins,
+                                  group->npins);
+       for (i = 0; i < group->npins; i++) {
+               group->muxcfg[i] = MUXID_TO_MUXCFG(group->pins[i]);
+               group->pins[i] = MUXID_TO_PIN(group->pins[i]);
+       }

This loop is rather awkward I mean, instead of bitstuffing muxcfg and pin ID into a single u32 why not just have them as separate attributes.

Quoted 2 lines

Then there was somthing about bank ID which I guess is just discarded here?

The bankid is just there for convenience for the device tree to make it a bit more readable, but we could keep it in the driver I guess, it would ease the registers address computing.

Of course, this is if we want to keep this syntax, which from your previous comments, isn't what we want.

Quoted 12 lines
Quoted 12 lines
drivers/pinctrl/pinctrl-sunxi.c new file +12 -0
+static int __devinit sunxi_pinctrl_probe(struct platform_device *pdev)
+{
+       struct sunxi_pinctrl *pctl;
+       int i, ret;
+
+       pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
+       if (!pctl)
+               return -ENOMEM;
+       platform_set_drvdata(pdev, pctl);
+
+       ret = sunxi_pinctrl_probe_dt(pdev, pctl);
+       if (ret) {
Quoted 8 lines

drivers/pinctrl/pinctrl-sunxi.c line 404

Quoted 5 lines
drivers/pinctrl/pinctrl-sunxi.c new file +5 -0
+               dev_err(&pdev->dev, "dt probe failed: %d\n", ret);
+               return ret;
+       }
+
+       pctl->data = (struct sunxi_pinctrl_data *)of_match_device(sunxi_pinctrl_match, &pdev->dev)->data;

I can't parse this, what is going on here?
Can you break this statement apart somehow?

Retrieval of the data associated to the compatible, here the pins available for the various SoC variants. This was in the patch I forgot to Cc you, sorry about that.

I guess I could still make this a bit less ugly.

Quoted 16 lines
Quoted 16 lines

+++ b/drivers/pinctrl/pinctrl-sunxi.h

drivers/pinctrl/pinctrl-sunxi.h new file +14 -0
+#define PINS_PER_BANK  32
+
+#define CFG_REG(pin)   (round_down(                                    \
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 8) * 0x04, 4))
+#define CFG_OFFSET(pin)        ((pin % 8) * 4)
+
+#define DLEVEL_REG(pin)        (round_down(                                    \
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 16) * 0x04 +   \
+                               0x14, 4))
+#define DLEVEL_OFFSET(pin)     ((pin % 16) * 2)
+
+#define PULL_REG(pin)  (round_down(                                    \
Quoted 8 lines

drivers/pinctrl/pinctrl-sunxi.h line 35

Quoted 4 lines
drivers/pinctrl/pinctrl-sunxi.h new file +4 -0
+                               (pin / PINS_PER_BANK) * 0x24 +          \
+                               ((pin % PINS_PER_BANK) / 16) * 0x04 +   \
+                               0x1c, 4))
+#define PULL_OFFSET(pin)       ((pin % 16) * 2)

These are impossible to understand. Please convert these to documented static inline functions instead so the code can be maintained in the future.

Ok.

Quoted 11 lines

drivers/pinctrl/pinctrl-sunxi.h line 45

Quoted 9 lines
drivers/pinctrl/pinctrl-sunxi.h new file +9 -0
+#define CFG_PINS_PER_REG       8
+#define CFG_PINS_BITS          4
+#define DLEVEL_PINS_PER_REG    16
+#define DLEVEL_PINS_BITS       2
+#define PULL_PINS_PER_REG      16
+#define PULL_PINS_BITS         2
+
+#define MUXID_TO_PIN(id)       ((((id) >> 12 & 0xf) * 32) + ((id) >> 4 & 0xff))
+#define MUXID_TO_MUXCFG(id)    ((id) & 0xf)

Same here.

Ok. Though, it will probably be removed by the previous changes we discussed.

Quoted 38 lines
Quoted 22 lines
drivers/pinctrl/pinctrl-sunxi.h new file +22 -0
+#define SUNXI_PINCTRL_PIN_PA0  PINCTRL_PIN(0 + 0, "PA0")
+#define SUNXI_PINCTRL_PIN_PA1  PINCTRL_PIN(0 + 1, "PA1")
+#define SUNXI_PINCTRL_PIN_PA2  PINCTRL_PIN(0 + 2, "PA2")
+#define SUNXI_PINCTRL_PIN_PA3  PINCTRL_PIN(0 + 3, "PA3")
+#define SUNXI_PINCTRL_PIN_PA4  PINCTRL_PIN(0 + 4, "PA4")
+#define SUNXI_PINCTRL_PIN_PA5  PINCTRL_PIN(0 + 5, "PA5")
+#define SUNXI_PINCTRL_PIN_PA6  PINCTRL_PIN(0 + 6, "PA6")
+#define SUNXI_PINCTRL_PIN_PA7  PINCTRL_PIN(0 + 7, "PA7")
+#define SUNXI_PINCTRL_PIN_PA8  PINCTRL_PIN(0 + 8, "PA8")
+#define SUNXI_PINCTRL_PIN_PA9  PINCTRL_PIN(0 + 9, "PA9")
+#define SUNXI_PINCTRL_PIN_PA10 PINCTRL_PIN(0 + 10, "PA10")
+#define SUNXI_PINCTRL_PIN_PA11 PINCTRL_PIN(0 + 11, "PA11")
+#define SUNXI_PINCTRL_PIN_PA12 PINCTRL_PIN(0 + 12, "PA12")
+#define SUNXI_PINCTRL_PIN_PA13 PINCTRL_PIN(0 + 13, "PA13")
+#define SUNXI_PINCTRL_PIN_PA14 PINCTRL_PIN(0 + 14, "PA14")
+#define SUNXI_PINCTRL_PIN_PA15 PINCTRL_PIN(0 + 15, "PA15")
+#define SUNXI_PINCTRL_PIN_PA16 PINCTRL_PIN(0 + 16, "PA16")
+#define SUNXI_PINCTRL_PIN_PA17 PINCTRL_PIN(0 + 17, "PA17")
+#define SUNXI_PINCTRL_PIN_PA18 PINCTRL_PIN(0 + 18, "PA18")
+#define SUNXI_PINCTRL_PIN_PA19 PINCTRL_PIN(0 + 19, "PA19")
+#define SUNXI_PINCTRL_PIN_PA20 PINCTRL_PIN(0 + 20, "PA20")
+#define SUNXI_PINCTRL_PIN_PA21 PINCTRL_PIN(0 + 21, "PA21")

drivers/pinctrl/pinctrl-sunxi.h line 85

Quoted 10 lines
drivers/pinctrl/pinctrl-sunxi.h new file +10 -0
+#define SUNXI_PINCTRL_PIN_PA22 PINCTRL_PIN(0 + 22, "PA22")
+#define SUNXI_PINCTRL_PIN_PA23 PINCTRL_PIN(0 + 23, "PA23")
+#define SUNXI_PINCTRL_PIN_PA24 PINCTRL_PIN(0 + 24, "PA24")
+#define SUNXI_PINCTRL_PIN_PA25 PINCTRL_PIN(0 + 25, "PA25")
+#define SUNXI_PINCTRL_PIN_PA26 PINCTRL_PIN(0 + 26, "PA26")
+#define SUNXI_PINCTRL_PIN_PA27 PINCTRL_PIN(0 + 27, "PA27")
+#define SUNXI_PINCTRL_PIN_PA28 PINCTRL_PIN(0 + 28, "PA28")
+#define SUNXI_PINCTRL_PIN_PA29 PINCTRL_PIN(0 + 29, "PA29")
+#define SUNXI_PINCTRL_PIN_PA30 PINCTRL_PIN(0 + 30, "PA30")
+#define SUNXI_PINCTRL_PIN_PA31 PINCTRL_PIN(0 + 31, "PA31")

0+0, 0+1, 0+2 .... why not just use the scalar? 0, 1, 2, ... 31?

I understand that the zero denotes bank 0 or bank A or somtheing (PA, PB etc) so if you need to keep that, use something like

Quoted 7 lines

#define PA_BASE 0

Then

#define SUNXI_PINCTRL_PIN_PA28 PINCTRL_PIN(PA_BASE + 28, "PA28")

which makes more sense.

Ah right. I will make the change.

Thanks,
Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 2/6 ARM: pinctrl: sunxi: Add the pinctrl pin set for sun5i

In reply to Maxime Ripard

Since the Allwinner SoCs variants don't have the same set of pins to handle, we need to declare the pin ranges available.

---
 drivers/pinctrl/pinctrl-sunxi.c |  120 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 120 insertions(+)
drivers/pinctrl/pinctrl-sunxi.c +120 -0
index 1da6d3e..df7e3b7 100644
@@ -26,6 +26,125 @@
 #include "core.h"
 #include "pinctrl-sunxi.h"
 
+static const struct pinctrl_pin_desc sun5i_pinctrl_pins[] = {
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PB0,
+	SUNXI_PINCTRL_PIN_PB1,
+	SUNXI_PINCTRL_PIN_PB2,
+	SUNXI_PINCTRL_PIN_PB3,
+	SUNXI_PINCTRL_PIN_PB4,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PB10,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PB15,
+	SUNXI_PINCTRL_PIN_PB16,
+	SUNXI_PINCTRL_PIN_PB17,
+	SUNXI_PINCTRL_PIN_PB18,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PC0,
+	SUNXI_PINCTRL_PIN_PC1,
+	SUNXI_PINCTRL_PIN_PC2,
+	SUNXI_PINCTRL_PIN_PC3,
+	SUNXI_PINCTRL_PIN_PC4,
+	SUNXI_PINCTRL_PIN_PC5,
+	SUNXI_PINCTRL_PIN_PC6,
+	SUNXI_PINCTRL_PIN_PC7,
+	SUNXI_PINCTRL_PIN_PC8,
+	SUNXI_PINCTRL_PIN_PC9,
+	SUNXI_PINCTRL_PIN_PC10,
+	SUNXI_PINCTRL_PIN_PC11,
+	SUNXI_PINCTRL_PIN_PC12,
+	SUNXI_PINCTRL_PIN_PC13,
+	SUNXI_PINCTRL_PIN_PC14,
+	SUNXI_PINCTRL_PIN_PC15,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PC19,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PD2,
+	SUNXI_PINCTRL_PIN_PD3,
+	SUNXI_PINCTRL_PIN_PD4,
+	SUNXI_PINCTRL_PIN_PD5,
+	SUNXI_PINCTRL_PIN_PD6,
+	SUNXI_PINCTRL_PIN_PD7,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PD10,
+	SUNXI_PINCTRL_PIN_PD11,
+	SUNXI_PINCTRL_PIN_PD12,
+	SUNXI_PINCTRL_PIN_PD13,
+	SUNXI_PINCTRL_PIN_PD14,
+	SUNXI_PINCTRL_PIN_PD15,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PD18,
+	SUNXI_PINCTRL_PIN_PD19,
+	SUNXI_PINCTRL_PIN_PD20,
+	SUNXI_PINCTRL_PIN_PD21,
+	SUNXI_PINCTRL_PIN_PD22,
+	SUNXI_PINCTRL_PIN_PD23,
+	SUNXI_PINCTRL_PIN_PD24,
+	SUNXI_PINCTRL_PIN_PD25,
+	SUNXI_PINCTRL_PIN_PD26,
+	SUNXI_PINCTRL_PIN_PD27,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PE0,
+	SUNXI_PINCTRL_PIN_PE1,
+	SUNXI_PINCTRL_PIN_PE2,
+	SUNXI_PINCTRL_PIN_PE3,
+	SUNXI_PINCTRL_PIN_PE4,
+	SUNXI_PINCTRL_PIN_PE5,
+	SUNXI_PINCTRL_PIN_PE6,
+	SUNXI_PINCTRL_PIN_PE7,
+	SUNXI_PINCTRL_PIN_PE8,
+	SUNXI_PINCTRL_PIN_PE9,
+	SUNXI_PINCTRL_PIN_PE10,
+	SUNXI_PINCTRL_PIN_PE11,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PF0,
+	SUNXI_PINCTRL_PIN_PF1,
+	SUNXI_PINCTRL_PIN_PF2,
+	SUNXI_PINCTRL_PIN_PF3,
+	SUNXI_PINCTRL_PIN_PF4,
+	SUNXI_PINCTRL_PIN_PF5,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PG0,
+	SUNXI_PINCTRL_PIN_PG1,
+	SUNXI_PINCTRL_PIN_PG2,
+	SUNXI_PINCTRL_PIN_PG3,
+	SUNXI_PINCTRL_PIN_PG4,
+	/* Hole */
+	SUNXI_PINCTRL_PIN_PG9,
+	SUNXI_PINCTRL_PIN_PG10,
+	SUNXI_PINCTRL_PIN_PG11,
+	SUNXI_PINCTRL_PIN_PG12,
+};
+
+static struct pinctrl_gpio_range sun5i_pinctrl_ranges[] = {
+	/* PB */
+	SUNXI_GPIO_RANGE(1, 32, 5),
+	SUNXI_GPIO_RANGE(2, 42, 1),
+	SUNXI_GPIO_RANGE(3, 47, 4),
+	/* PC */
+	SUNXI_GPIO_RANGE(4, 64, 16),
+	SUNXI_GPIO_RANGE(5, 83, 1),
+	/* PD */
+	SUNXI_GPIO_RANGE(6, 98, 8),
+	SUNXI_GPIO_RANGE(7, 106, 6),
+	SUNXI_GPIO_RANGE(8, 114, 10),
+	/* PE */
+	SUNXI_GPIO_RANGE(9, 128, 12),
+	/* PF */
+	SUNXI_GPIO_RANGE(10, 160, 6),
+	/* PG */
+	SUNXI_GPIO_RANGE(11, 192, 5),
+	SUNXI_GPIO_RANGE(12, 201, 4),
+};
+
+static const struct sunxi_pinctrl_data sun5i_pinctrl_data = {
+	.ranges = sun5i_pinctrl_ranges,
+	.nranges = ARRAY_SIZE(sun5i_pinctrl_ranges),
+	.pins = sun5i_pinctrl_pins,
+	.npins = ARRAY_SIZE(sun5i_pinctrl_pins),
+};
+
 static int sunxi_pctrl_get_groups_count(struct pinctrl_dev *pctldev)
 {
 	struct sunxi_pinctrl *pctl = pinctrl_dev_get_drvdata(pctldev);
@@ -251,6 +370,7 @@ static struct pinctrl_desc sunxi_pctrl_desc = {
 };
 
 static struct of_device_id sunxi_pinctrl_match[] __devinitconst = {
+	{ .compatible = "allwinner,sun5i-pinctrl", .data = (void *)&sun5i_pinctrl_data },
 	{}
 };
 MODULE_DEVICE_TABLE(of, sunxi_pinctrl_match);
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH 3/6 ARM: sunxi: Add pinctrl node to the device tree

In reply to Maxime Ripard
---
 arch/arm/boot/dts/sun5i.dtsi |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/sun5i.dtsi +7 -0
index 59a2d26..ad42aec 100644
@@ -17,4 +17,11 @@
 	memory {
 		reg = <0x40000000 0x20000000>;
 	};
+
+	pinctrl at 01c20800 {
+		compatible = "allwinner,sun5i-pinctrl";
+		reg = <0x01c20800 0x400>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
 };
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH 4/6 ARM: sunxi: Add uart1 pinctrl groups

In reply to Maxime Ripard
---
 arch/arm/boot/dts/sun5i.dtsi |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
arch/arm/boot/dts/sun5i.dtsi +14 -0
index ad42aec..0fc238d 100644
@@ -23,5 +23,19 @@
 		reg = <0x01c20800 0x400>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+
+		uart1_pins_a: uart1 at 0 {
+			reg = <0>;
+			allwinner,pin-ids = <0x40a4 0x40b4>;
+			allwinner,drive = <0>;
+			allwinner,pull = <0>;
+		};
+
+		uart1_pins_b: uart1 at 1 {
+			reg = <1>;
+			allwinner,pin-ids = <0x6034 0x6044>;
+			allwinner,drive = <0>;
+			allwinner,pull = <0>;
+		};
 	};
 };
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH 5/6 tty: of_serial: Add pinctrl support

In reply to Maxime Ripard

Use pinctrl to configure the SoCs pins directly from the driver.

Cc Alan Cox <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc linux-serial at vger.kernel.org
---
 drivers/tty/serial/of_serial.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/tty/serial/of_serial.c +7 -0
index df443b9..f66bdab 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/serial_core.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
@@ -54,6 +55,7 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
 					int type, struct uart_port *port)
 {
 	struct resource resource;
+	struct pinctrl *pinctrl;
 	struct device_node *np = ofdev->dev.of_node;
 	u32 clk, spd, prop;
 	int ret;
@@ -73,6 +75,11 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
 		return ret;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&ofdev->dev);
+	if (IS_ERR(pinctrl))
+		dev_warn(&ofdev->dev,
+			"pins are not configured from the driver\n");
+
 	spin_lock_init(&port->lock);
 	port->mapbase = resource.start;
 
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 6/6 ARM: sunxi: olinuxino: Add muxing for the uart

In reply to Maxime Ripard
---
 arch/arm/boot/dts/sun5i-olinuxino.dts |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/boot/dts/sun5i-olinuxino.dts +2 -0
index d6ff889..598c1aa 100644
@@ -24,6 +24,8 @@
 
 	soc {
 		uart1: uart at 01c28400 {
+			pinctrl-names = "default";
+			pinctrl-0 = <&uart1_pins_b>;
 			status = "okay";
 		};
 	};
Signature · 1 line
1.7.9.5
#9 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

In reply to Maxime Ripard
Quoted 5 lines · Maxime Ripard

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10 and A13, and the SoC-specific bits for the A13. It also adds the documentation for the device tree bindings.

Hi. I just wanted to comment that there are 3 known sun5i SoCs, not only the A13. The A10s and the A12 are also sun5i. For A10s and A13 there are datasheets available with the pin info. So please don't assume the A13's pins are "sun5i" pins, they are merely aw1626 (aka A13) pins.

cheers,
Alejandro Mery

#10 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

Hi Alejandro,

Le 11/12/2012 22:58, Alejandro Mery a ?crit :

Quoted 9 lines · Maxime Ripard
Quoted 7 lines

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10
and A13, and the SoC-specific bits for the A13. It also adds the documentation
for the device tree bindings.

Quoted 4 lines

Hi. I just wanted to comment that there are 3 known sun5i SoCs, not only the A13. The A10s and the A12 are also sun5i. For A10s and A13 there are datasheets available with the pin info. So please don't assume the A13's pins are "sun5i" pins, they are merely aw1626 (aka A13) pins.

Ok, I will change the naming scheme to something like sun5i-a13. For the other SoC codenames like sun4i, are you aware of several actual SoCs using the same codename, or do we have only sun4i == A10?

Thanks,
Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#11 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

Quoted 12 lines · Maxime Ripard

Hi Alejandro,

Le 11/12/2012 22:58, Alejandro Mery a ?crit :

Quoted 9 lines · Maxime Ripard
Quoted 7 lines

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10
and A13, and the SoC-specific bits for the A13. It also adds the documentation
for the device tree bindings.

Quoted 8 lines
Quoted 4 lines

Hi. I just wanted to comment that there are 3 known sun5i SoCs, not only the A13. The A10s and the A12 are also sun5i. For A10s and A13 there are datasheets available with the pin info. So please don't assume the A13's pins are "sun5i" pins, they are merely aw1626 (aka A13) pins.

Ok, I will change the naming scheme to something like sun5i-a13. For the other SoC codenames like sun4i, are you aware of several actual SoCs using the same codename, or do we have only sun4i == A10?

the A10 is the only sun4i we know of, the A31 is the only sun6i we know of, and the A20 is the only sun7i we know of... they'll soon run out of numbers... :|

Also, to avoid confusions with their poorly chosen marketing name, you could use the internal chip name aw1623 for the A10 and aw1626 for the A13 instead. This value can be read from the BROM and it's commonly used in allwinner sources.

regards,
Alejandro Mery

#12 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

Le 12/12/2012 13:49, Alejandro Mery a ?crit :

Quoted 22 lines · Maxime Ripard
Quoted 12 lines

Hi Alejandro,

Le 11/12/2012 22:58, Alejandro Mery a ?crit :

Quoted 9 lines · Maxime Ripard
Quoted 7 lines

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10
and A13, and the SoC-specific bits for the A13. It also adds the documentation
for the device tree bindings.

Quoted 8 lines
Quoted 4 lines

Hi. I just wanted to comment that there are 3 known sun5i SoCs, not only the A13. The A10s and the A12 are also sun5i. For A10s and A13 there are datasheets available with the pin info. So please don't assume the A13's pins are "sun5i" pins, they are merely aw1626 (aka A13) pins.

Ok, I will change the naming scheme to something like sun5i-a13. For the other SoC codenames like sun4i, are you aware of several actual SoCs using the same codename, or do we have only sun4i == A10?

Quoted 8 lines

the A10 is the only sun4i we know of, the A31 is the only sun6i we know of, and the A20 is the only sun7i we know of... they'll soon run out of numbers... :|

Also, to avoid confusions with their poorly chosen marketing name, you could use the internal chip name aw1623 for the A10 and aw1626 for the A13 instead. This value can be read from the BROM and it's commonly used in allwinner sources.

In what aspect are they poorly named? I'd really like to keep it as understandable as possible, at least in the device tree.

I guess renaming the sun5i dtsi already there and all that relates to the A13 to sun5i-a13 would remove that collision of names, don't you think? Or am I missing something?

Thanks,
Maxime

Signature · 4 lines
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#13 lore raw

cover Add pinctrl driver for Allwinner A1X SoCs

Quoted 32 lines · Maxime Ripard

Le 12/12/2012 13:49, Alejandro Mery a ?crit :

Quoted 22 lines · Maxime Ripard
Quoted 12 lines

Hi Alejandro,

Le 11/12/2012 22:58, Alejandro Mery a ?crit :

Quoted 9 lines · Maxime Ripard
Quoted 7 lines

Hi everyone,

This patch set adds a pinctrl driver for the IP found in the Allwinner A10
and A13, and the SoC-specific bits for the A13. It also adds the documentation
for the device tree bindings.

Quoted 8 lines
Quoted 4 lines

Hi. I just wanted to comment that there are 3 known sun5i SoCs, not only the A13. The A10s and the A12 are also sun5i. For A10s and A13 there are datasheets available with the pin info. So please don't assume the A13's pins are "sun5i" pins, they are merely aw1626 (aka A13) pins.

Ok, I will change the naming scheme to something like sun5i-a13. For the other SoC codenames like sun4i, are you aware of several actual SoCs using the same codename, or do we have only sun4i == A10?

Quoted 8 lines

the A10 is the only sun4i we know of, the A31 is the only sun6i we know of, and the A20 is the only sun7i we know of... they'll soon run out of numbers... :|

Also, to avoid confusions with their poorly chosen marketing name, you could use the internal chip name aw1623 for the A10 and aw1626 for the A13 instead. This value can be read from the BROM and it's commonly used in allwinner sources.

Quoted 6 lines

In what aspect are they poorly named? I'd really like to keep it as understandable as possible, at least in the device tree.

I guess renaming the sun5i dtsi already there and all that relates to the A13 to sun5i-a13 would remove that collision of names, don't you think? Or am I missing something?

fine with me, but "The A10 is an A8, same as the A10s and A13, but the A13 is less than the A10 but larger and A10s is not the plural of A10. And the A20 been like an A10 but A7" doesn't make you dizzy? ;-)

sure prefixing the marketing name with sunxi- or sunNi- removes the ambiguity.

cheers,
Alejandro Mery