All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL
@ 2012-07-04  3:43 Barry Song
  2012-07-04  3:43 ` [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1 Barry Song
  2012-07-04 11:43 ` [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Arnd Bergmann
  0 siblings, 2 replies; 9+ messages in thread
From: Barry Song @ 2012-07-04  3:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Barry Song <Baohua.Song@csr.com>

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 <Baohua.Song@csr.com>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1
  2012-07-04  3:43 [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Barry Song
@ 2012-07-04  3:43 ` Barry Song
  2012-07-04 11:45   ` Arnd Bergmann
  2012-07-04 11:43 ` [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Arnd Bergmann
  1 sibling, 1 reply; 9+ messages in thread
From: Barry Song @ 2012-07-04  3:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Barry Song <Baohua.Song@csr.com>

Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL
  2012-07-04  3:43 [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Barry Song
  2012-07-04  3:43 ` [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1 Barry Song
@ 2012-07-04 11:43 ` Arnd Bergmann
  2012-07-04 12:15   ` Barry Song
  1 sibling, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2012-07-04 11:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 July 2012, Barry Song wrote:
> From: Barry Song <Baohua.Song@csr.com>
> 
> 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 <Baohua.Song@csr.com>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1
  2012-07-04  3:43 ` [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1 Barry Song
@ 2012-07-04 11:45   ` Arnd Bergmann
  2012-07-04 14:25     ` Barry Song
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2012-07-04 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 July 2012, Barry Song wrote:
> +/* 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL
  2012-07-04 11:43 ` [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Arnd Bergmann
@ 2012-07-04 12:15   ` Barry Song
  2012-07-04 13:10     ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Barry Song @ 2012-07-04 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Arnd,

2012/7/4 Arnd Bergmann <arnd@arndb.de>:
> On Wednesday 04 July 2012, Barry Song wrote:
>> From: Barry Song <Baohua.Song@csr.com>
>>
>> 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 <Baohua.Song@csr.com>
>
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL
  2012-07-04 12:15   ` Barry Song
@ 2012-07-04 13:10     ` Arnd Bergmann
  2012-07-04 14:15       ` Barry Song
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2012-07-04 13:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 04 July 2012, Barry Song wrote:
> > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL
  2012-07-04 13:10     ` Arnd Bergmann
@ 2012-07-04 14:15       ` Barry Song
  0 siblings, 0 replies; 9+ messages in thread
From: Barry Song @ 2012-07-04 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

2012/7/4 Arnd Bergmann <arnd@arndb.de>:
> On Wednesday 04 July 2012, Barry Song wrote:
>> > 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.

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1
  2012-07-04 11:45   ` Arnd Bergmann
@ 2012-07-04 14:25     ` Barry Song
  2012-07-04 22:34       ` Linus Walleij
  0 siblings, 1 reply; 9+ messages in thread
From: Barry Song @ 2012-07-04 14:25 UTC (permalink / raw)
  To: linux-arm-kernel

2012/7/4 Arnd Bergmann <arnd@arndb.de>:
> On Wednesday 04 July 2012, Barry Song wrote:
>> +/* 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1
  2012-07-04 14:25     ` Barry Song
@ 2012-07-04 22:34       ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2012-07-04 22:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jul 4, 2012 at 4:25 PM, Barry Song <21cnbao@gmail.com> wrote:
> 2012/7/4 Arnd Bergmann <arnd@arndb.de>:
>> On Wednesday 04 July 2012, Barry Song wrote:

>>>         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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-07-04 22:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-04  3:43 [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Barry Song
2012-07-04  3:43 ` [PATCH 2/2] ARM: PRIMA2: add PINMUX map for primaII UART1 and SPI0/1 Barry Song
2012-07-04 11:45   ` Arnd Bergmann
2012-07-04 14:25     ` Barry Song
2012-07-04 22:34       ` Linus Walleij
2012-07-04 11:43 ` [PATCH 1/2] ARM: PRIMA2: add of_dev_auxdata table for I2C, SPI, UART and PINCTRL Arnd Bergmann
2012-07-04 12:15   ` Barry Song
2012-07-04 13:10     ` Arnd Bergmann
2012-07-04 14:15       ` Barry Song

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.