[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

Subsystems: arm port, the rest

STALE5175d

9 messages, 4 authors, 2012-07-04 · open the first message on its own page

[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

From: Barry Song <hidden>
Date: 2012-07-04 03:43:19

From: Barry Song <redacted>

This patch adds lookup table for attaching a specific name and platform_data
pointer to devices like i2c, spi, uart and pinctrl as they get created by
of_platform_populate().  Ideally this table would not exist.

Signed-off-by: Barry Song <redacted>
---
 arch/arm/mach-prima2/prima2.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c
index 8f0429d..82f5c0d 100644
--- a/arch/arm/mach-prima2/prima2.c
+++ b/arch/arm/mach-prima2/prima2.c
@@ -13,8 +13,26 @@
 #include <asm/mach/arch.h>
 #include <linux/of.h>
 #include <linux/of_platform.h>
+#include <linux/pinctrl/machine.h>
 #include "common.h"
 
+/*
+ * Lookup table for attaching a specific name and platform_data pointer to
+ * devices as they get created by of_platform_populate().  Ideally this table
+ * would not exist.
+ */
+struct of_dev_auxdata prima2_auxdata_lookup[] __initdata = {
+	OF_DEV_AUXDATA("sirf,prima2-uart", 0xb0050000, "uart0", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-uart", 0xb0060000, "uart1", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-uart", 0xb0070000, "uart2", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-spi", 0xb00d0000, "spi0", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-spi", 0xb0170000, "spi1", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-i2c", 0xb00e0000, "i2c0", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-i2c", 0xb00f0000, "i2c1", NULL),
+	OF_DEV_AUXDATA("sirf,prima2-gpio-pinmux", 0xb0120000, "pinctrl0", NULL),
+	{},
+};
+
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 	{ .compatible = "simple-bus", },
 	{},
@@ -22,7 +40,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 
 void __init sirfsoc_mach_init(void)
 {
-	of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
+	of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL);
 }
 
 void __init sirfsoc_init_late(void)
-- 
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

[PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1

From: Barry Song <hidden>
Date: 2012-07-04 03:43:20

From: Barry Song <redacted>

Signed-off-by: Barry Song <redacted>
---
 arch/arm/mach-prima2/prima2.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c
index 82f5c0d..b2bb33d 100644
--- a/arch/arm/mach-prima2/prima2.c
+++ b/arch/arm/mach-prima2/prima2.c
@@ -33,6 +33,13 @@ struct of_dev_auxdata prima2_auxdata_lookup[] __initdata = {
 	{},
 };
 
+/* Padmux settings */
+static struct pinctrl_map prima2_padmux_map[] = {
+       PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"),
+};
+
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 	{ .compatible = "simple-bus", },
 	{},
@@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 void __init sirfsoc_mach_init(void)
 {
 	of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL);
+	pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map));
 }
 
 void __init sirfsoc_init_late(void)
-- 
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-07-04 11:43:04

On Wednesday 04 July 2012, Barry Song wrote:
From: Barry Song <redacted>

This patch adds lookup table for attaching a specific name and platform_data
pointer to devices like i2c, spi, uart and pinctrl as they get created by
of_platform_populate().  Ideally this table would not exist.

Signed-off-by: Barry Song <redacted>
Hi Barry,

I don't understand. Which subsystem relies on the short names here?

If it's about the pinctrl and clock parts, can't you just uses the
generate names like "b0050000.uart" directly?

	Arnd

[PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-07-04 11:45:28

On Wednesday 04 July 2012, Barry Song wrote:
quoted hunk
+/* Padmux settings */
+static struct pinctrl_map prima2_padmux_map[] = {
+       PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"),
+};
+
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
        { .compatible = "simple-bus", },
        {},
@@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 void __init sirfsoc_mach_init(void)
 {
        of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL);
+       pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map));
 }
I haven't been following pinctrl too closely, but isn't this something
that would normally be represented by putting the lookup table into the
device tree?

	Arnd

[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

From: Barry Song <hidden>
Date: 2012-07-04 12:15:51

Hi Arnd,

2012/7/4 Arnd Bergmann [off-list ref]:
On Wednesday 04 July 2012, Barry Song wrote:
quoted
From: Barry Song <redacted>

This patch adds lookup table for attaching a specific name and platform_data
pointer to devices like i2c, spi, uart and pinctrl as they get created by
of_platform_populate().  Ideally this table would not exist.

Signed-off-by: Barry Song <redacted>
Hi Barry,

I don't understand. Which subsystem relies on the short names here?

If it's about the pinctrl and clock parts, can't you just uses the
generate names like "b0050000.uart" directly?
yes. names like "b0050000.uart"  really work, and i have enabled and
tested names like that in clock driver.
but would people think them ugly?

and what would the clock driver support two SoCs whose uarts have
different map base address?
        Arnd
-barry

[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-07-04 13:10:49

On Wednesday 04 July 2012, Barry Song wrote:
quoted
If it's about the pinctrl and clock parts, can't you just uses the
generate names like "b0050000.uart" directly?
yes. names like "b0050000.uart"  really work, and i have enabled and
tested names like that in clock driver.
but would people think them ugly?
No, that's fine.
 
and what would the clock driver support two SoCs whose uarts have
different map base address?
If they are different SoCs, then it would be likely be a different clock
that is connected to the UART.

A better solution is to use the new DT clock bindings to replace the
clock lookup in the source code. Have a look at
git://git.linaro.org/people/mturquette/linux.git to see how others
do this in new kernels.

	Arnd

[PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL

From: Barry Song <hidden>
Date: 2012-07-04 14:15:28

2012/7/4 Arnd Bergmann [off-list ref]:
On Wednesday 04 July 2012, Barry Song wrote:
quoted
quoted
If it's about the pinctrl and clock parts, can't you just uses the
generate names like "b0050000.uart" directly?
yes. names like "b0050000.uart"  really work, and i have enabled and
tested names like that in clock driver.
but would people think them ugly?
No, that's fine.
quoted
and what would the clock driver support two SoCs whose uarts have
different map base address?
If they are different SoCs, then it would be likely be a different clock
that is connected to the UART.

A better solution is to use the new DT clock bindings to replace the
clock lookup in the source code. Have a look at
git://git.linaro.org/people/mturquette/linux.git to see how others
do this in new kernels.
ok. thanks. recently i have missed many threads due to some other work issues.
i'll look into Rob Herring's "clk: add DT clock binding support".
        Arnd
-barry

[PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1

From: Barry Song <hidden>
Date: 2012-07-04 14:25:22

2012/7/4 Arnd Bergmann [off-list ref]:
On Wednesday 04 July 2012, Barry Song wrote:
quoted
+/* Padmux settings */
+static struct pinctrl_map prima2_padmux_map[] = {
+       PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"),
+       PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"),
+};
+
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
        { .compatible = "simple-bus", },
        {},
@@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 void __init sirfsoc_mach_init(void)
 {
        of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL);
+       pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map));
 }
I haven't been following pinctrl too closely, but isn't this something
that would normally be represented by putting the lookup table into the
device tree?
i'd like to see that. i am not sure whether i have missed anything
since i only saw the pinctrl_register_mappings samples.
would linus clarify?
        Arnd
-barry

[PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1

From: Linus Walleij <hidden>
Date: 2012-07-04 22:34:02

On Wed, Jul 4, 2012 at 4:25 PM, Barry Song [off-list ref] wrote:
2012/7/4 Arnd Bergmann [off-list ref]:
quoted
On Wednesday 04 July 2012, Barry Song wrote:
quoted
quoted
        of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL);
+       pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map));
 }
I haven't been following pinctrl too closely, but isn't this something
that would normally be represented by putting the lookup table into the
device tree?
i'd like to see that. i am not sure whether i have missed anything
since i only saw the pinctrl_register_mappings samples.
would linus clarify?
You can do it either way, but for a DT:ed platform it makes sense to have
it in device tree.

Check drivers/pinctrl/devicetree.c for how that code works, the bindings
are in
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
There are example usecases in arch/arm/boot/dts/*

This was all implemented by Stephen Warren so he's the reference
to this codepath.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help