* [PATCH][POWERPC] Update fsl_soc to use cell-index property of I2C nodes
@ 2008-06-02 20:09 Timur Tabi
2008-06-03 4:57 ` Kumar Gala
0 siblings, 1 reply; 2+ messages in thread
From: Timur Tabi @ 2008-06-02 20:09 UTC (permalink / raw)
To: linuxppc-dev, galak
Currently, fsl_i2c_of_init() uses the order of the I2C adapter nodes in the
device tree to enumerate the I2C adapters. Instead, let's check for the
cell-index property and use it if it exists.
This is handy for device drivers that need to identify the I2C adapters by
specific numbers. The Freescale MPC8610 ASoC V2 sound drivers are an example.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
This patch is for Kumar's powerpc-next branch.
arch/powerpc/sysdev/fsl_soc.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 167523e..14616d5 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -496,6 +496,8 @@ static int __init fsl_i2c_of_init(void)
struct resource r[2];
struct fsl_i2c_platform_data i2c_data;
const unsigned char *flags = NULL;
+ int idx;
+ const u32 *iprop;
memset(&r, 0, sizeof(r));
memset(&i2c_data, 0, sizeof(i2c_data));
@@ -506,7 +508,10 @@ static int __init fsl_i2c_of_init(void)
of_irq_to_resource(np, 0, &r[1]);
- i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
+ iprop = of_get_property(np, "cell-index", NULL);
+ idx = iprop ? *iprop : i;
+
+ i2c_dev = platform_device_register_simple("fsl-i2c", idx, r, 2);
if (IS_ERR(i2c_dev)) {
ret = PTR_ERR(i2c_dev);
goto err;
@@ -528,7 +533,8 @@ static int __init fsl_i2c_of_init(void)
if (ret)
goto unreg;
- of_register_i2c_devices(np, i++);
+ of_register_i2c_devices(np, idx);
+ i++;
}
return 0;
--
1.5.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][POWERPC] Update fsl_soc to use cell-index property of I2C nodes
2008-06-02 20:09 [PATCH][POWERPC] Update fsl_soc to use cell-index property of I2C nodes Timur Tabi
@ 2008-06-03 4:57 ` Kumar Gala
0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2008-06-03 4:57 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
On Jun 2, 2008, at 3:09 PM, Timur Tabi wrote:
> Currently, fsl_i2c_of_init() uses the order of the I2C adapter nodes
> in the
> device tree to enumerate the I2C adapters. Instead, let's check for
> the
> cell-index property and use it if it exists.
>
> This is handy for device drivers that need to identify the I2C
> adapters by
> specific numbers. The Freescale MPC8610 ASoC V2 sound drivers are
> an example.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
applied.
- k
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-03 4:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-02 20:09 [PATCH][POWERPC] Update fsl_soc to use cell-index property of I2C nodes Timur Tabi
2008-06-03 4:57 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).