diff mbox

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

Message ID 1341373400-15763-1-git-send-email-Barry.Song@csr.com
State New, archived
Headers show

Commit Message

Barry Song July 4, 2012, 3:43 a.m. UTC
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(-)

Comments

Arnd Bergmann July 4, 2012, 11:43 a.m. UTC | #1
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
Barry Song July 4, 2012, 12:15 p.m. UTC | #2
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
Arnd Bergmann July 4, 2012, 1:10 p.m. UTC | #3
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
Barry Song July 4, 2012, 2:15 p.m. UTC | #4
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
diff mbox

Patch

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)