* [PATCH] i2c-mpc: add support for arch/powerpc/ tree
@ 2007-03-02 10:47 Domen Puncer
2007-03-05 10:08 ` [PATCH alternative] lite5200(b) support for i2c Domen Puncer
0 siblings, 1 reply; 7+ messages in thread
From: Domen Puncer @ 2007-03-02 10:47 UTC (permalink / raw)
To: linuxppc-embedded
Add I2C support for mpc5200 powerpc tree.
Tested to work on eeprom on lite5200b.
Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
---
I'm not sure how this relates to FSL_SOC config option and
fsl_i2c_of_init. Comments?
Domen
arch/powerpc/boot/dts/lite5200b.dts | 2
drivers/i2c/busses/i2c-mpc.c | 80 +++++++++++++++++++++++++++++++++++-
2 files changed, 80 insertions(+), 2 deletions(-)
Index: grant.git/arch/powerpc/boot/dts/lite5200b.dts
===================================================================
--- grant.git.orig/arch/powerpc/boot/dts/lite5200b.dts
+++ grant.git/arch/powerpc/boot/dts/lite5200b.dts
@@ -328,6 +328,7 @@
reg = <3d00 40>;
interrupts = <2 f 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
i2c@3d40 {
@@ -337,6 +338,7 @@
reg = <3d40 40>;
interrupts = <2 10 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
sram@8000 {
device_type = "sram";
Index: grant.git/drivers/i2c/busses/i2c-mpc.c
===================================================================
--- grant.git.orig/drivers/i2c/busses/i2c-mpc.c
+++ grant.git/drivers/i2c/busses/i2c-mpc.c
@@ -20,6 +20,10 @@
#include <linux/pci.h>
#include <linux/platform_device.h>
+#ifdef CONFIG_PPC_MERGE
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+#endif
#include <asm/io.h>
#include <linux/fsl_devices.h>
#include <linux/i2c.h>
@@ -287,25 +291,50 @@ static struct i2c_adapter mpc_ops = {
.retries = 1
};
+#ifdef CONFIG_PPC_MERGE
+static int fsl_i2c_probe(struct of_device *op, const struct of_device_id *match)
+#else
static int fsl_i2c_probe(struct platform_device *pdev)
+#endif
{
int result = 0;
struct mpc_i2c *i2c;
struct fsl_i2c_platform_data *pdata;
+#ifdef CONFIG_PPC_MERGE
+ struct resource __r;
+ struct resource *r = &__r;
+
+ result = of_address_to_resource(op->node, 0, r);
+ if (result) {
+ printk(KERN_ERR "i2c-mpc - error parsing device node resource\n");
+ return result;
+ }
+
+ pdata = (struct fsl_i2c_platform_data *) op->dev.platform_data;
+#else
struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pdata = (struct fsl_i2c_platform_data *) pdev->dev.platform_data;
+#endif
if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) {
return -ENOMEM;
}
+#ifdef CONFIG_PPC_MERGE
+ i2c->irq = irq_of_parse_and_map(op->node, 0);
+ if (get_property(op->node, "dfsrr", NULL))
+ i2c->flags = FSL_I2C_DEV_SEPARATE_DFSRR;
+ if (get_property(op->node, "fsl5200-clocking", NULL))
+ i2c->flags = FSL_I2C_DEV_CLOCK_5200;
+#else
i2c->irq = platform_get_irq(pdev, 0);
+ i2c->flags = pdata->device_flags;
+#endif
if (i2c->irq < 0) {
result = -ENXIO;
goto fail_get_irq;
}
- i2c->flags = pdata->device_flags;
init_waitqueue_head(&i2c->queue);
i2c->base = ioremap((phys_addr_t)r->start, MPC_I2C_REGION);
@@ -325,11 +354,16 @@ static int fsl_i2c_probe(struct platform
}
mpc_i2c_setclock(i2c);
- platform_set_drvdata(pdev, i2c);
i2c->adap = mpc_ops;
i2c_set_adapdata(&i2c->adap, i2c);
+#ifdef CONFIG_PPC_MERGE
+ dev_set_drvdata(&op->dev, i2c);
+ i2c->adap.dev.parent = &op->dev;
+#else
+ platform_set_drvdata(pdev, i2c);
i2c->adap.dev.parent = &pdev->dev;
+#endif
if ((result = i2c_add_adapter(&i2c->adap)) < 0) {
printk(KERN_ERR "i2c-mpc - failed to add adapter\n");
goto fail_add;
@@ -348,21 +382,54 @@ static int fsl_i2c_probe(struct platform
return result;
};
+#ifdef CONFIG_PPC_MERGE
+static int fsl_i2c_remove(struct of_device *op)
+#else
static int fsl_i2c_remove(struct platform_device *pdev)
+#endif
{
+#ifdef CONFIG_PPC_MERGE
+ struct mpc_i2c *i2c = dev_get_drvdata(&op->dev);
+#else
struct mpc_i2c *i2c = platform_get_drvdata(pdev);
+#endif
i2c_del_adapter(&i2c->adap);
+#ifdef CONFIG_PPC_MERGE
+ dev_set_drvdata(&op->dev, NULL);
+#else
platform_set_drvdata(pdev, NULL);
+#endif
if (i2c->irq != 0)
free_irq(i2c->irq, i2c);
+#ifdef CONFIG_PPC_MERGE
+ irq_dispose_mapping(i2c->irq);
+#endif
iounmap(i2c->base);
kfree(i2c);
return 0;
};
+#ifdef CONFIG_PPC_MERGE
+static struct of_device_id fsl_i2c_of_match[] = {
+ { .compatible = "mpc5200-i2c", },
+ {},
+};
+
+static struct of_platform_driver fsl_i2c_driver = {
+ .name = "fsl-i2c",
+ .owner = THIS_MODULE,
+ .match_table = fsl_i2c_of_match,
+ .probe = fsl_i2c_probe,
+ .remove = fsl_i2c_remove,
+ .driver = {
+ .name = "fsl-i2c",
+ .owner = THIS_MODULE,
+ },
+};
+#else
/* Structure for a device driver */
static struct platform_driver fsl_i2c_driver = {
.probe = fsl_i2c_probe,
@@ -372,15 +439,24 @@ static struct platform_driver fsl_i2c_dr
.name = "fsl-i2c",
},
};
+#endif
static int __init fsl_i2c_init(void)
{
+#ifdef CONFIG_PPC_MERGE
+ return of_register_platform_driver(&fsl_i2c_driver);
+#else
return platform_driver_register(&fsl_i2c_driver);
+#endif
}
static void __exit fsl_i2c_exit(void)
{
+#ifdef CONFIG_PPC_MERGE
+ of_unregister_platform_driver(&fsl_i2c_driver);
+#else
platform_driver_unregister(&fsl_i2c_driver);
+#endif
}
module_init(fsl_i2c_init);
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH alternative] lite5200(b) support for i2c
2007-03-02 10:47 [PATCH] i2c-mpc: add support for arch/powerpc/ tree Domen Puncer
@ 2007-03-05 10:08 ` Domen Puncer
2007-03-05 10:24 ` Sylvain Munaut
0 siblings, 1 reply; 7+ messages in thread
From: Domen Puncer @ 2007-03-05 10:08 UTC (permalink / raw)
To: linuxppc-embedded
Add fsl-i2c to lite5200 i2c nodes in device tree, and enable FSL_SOC.
Tested to work with built-in eeprom on lite5200b.
Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
---
This patch obsoletes the previous one, and is shorter too :-)
arch/powerpc/Kconfig | 1 +
arch/powerpc/boot/dts/lite5200.dts | 6 ++++--
arch/powerpc/boot/dts/lite5200b.dts | 6 ++++--
3 files changed, 9 insertions(+), 4 deletions(-)
Index: grant.git/arch/powerpc/Kconfig
===================================================================
--- grant.git.orig/arch/powerpc/Kconfig
+++ grant.git/arch/powerpc/Kconfig
@@ -128,6 +128,7 @@ config CLASSIC32
bool "52xx/6xx/7xx/74xx"
select PPC_FPU
select 6xx
+ select FSL_SOC
help
There are four families of PowerPC chips supported. The more common
types (601, 603, 604, 740, 750, 7400), the Motorola embedded
Index: grant.git/arch/powerpc/boot/dts/lite5200b.dts
===================================================================
--- grant.git.orig/arch/powerpc/boot/dts/lite5200b.dts
+++ grant.git/arch/powerpc/boot/dts/lite5200b.dts
@@ -323,20 +323,22 @@
i2c@3d00 {
device_type = "i2c";
- compatible = "mpc5200b-i2c\0mpc5200-i2c";
+ compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
cell-index = <0>;
reg = <3d00 40>;
interrupts = <2 f 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
i2c@3d40 {
device_type = "i2c";
- compatible = "mpc5200b-i2c\0mpc5200-i2c";
+ compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
cell-index = <1>;
reg = <3d40 40>;
interrupts = <2 10 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
sram@8000 {
device_type = "sram";
Index: grant.git/arch/powerpc/boot/dts/lite5200.dts
===================================================================
--- grant.git.orig/arch/powerpc/boot/dts/lite5200.dts
+++ grant.git/arch/powerpc/boot/dts/lite5200.dts
@@ -318,20 +318,22 @@
i2c@3d00 {
device_type = "i2c";
- compatible = "mpc5200-i2c";
+ compatible = "mpc5200-i2c\0fsl-i2c";
cell-index = <0>;
reg = <3d00 40>;
interrupts = <2 f 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
i2c@3d40 {
device_type = "i2c";
- compatible = "mpc5200-i2c";
+ compatible = "mpc5200-i2c\0fsl-i2c";
cell-index = <1>;
reg = <3d40 40>;
interrupts = <2 10 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
sram@8000 {
device_type = "sram";
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH alternative] lite5200(b) support for i2c
2007-03-05 10:08 ` [PATCH alternative] lite5200(b) support for i2c Domen Puncer
@ 2007-03-05 10:24 ` Sylvain Munaut
2007-03-05 10:40 ` [PATCH try3] " Domen Puncer
0 siblings, 1 reply; 7+ messages in thread
From: Sylvain Munaut @ 2007-03-05 10:24 UTC (permalink / raw)
To: Domen Puncer; +Cc: linuxppc-embedded
Domen Puncer wrote:
> Add fsl-i2c to lite5200 i2c nodes in device tree, and enable FSL_SOC.
>
> Tested to work with built-in eeprom on lite5200b.
>
>
> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
>
> ---
> This patch obsoletes the previous one, and is shorter too :-)
>
>
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/boot/dts/lite5200.dts | 6 ++++--
> arch/powerpc/boot/dts/lite5200b.dts | 6 ++++--
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> Index: grant.git/arch/powerpc/Kconfig
> ===================================================================
> --- grant.git.orig/arch/powerpc/Kconfig
> +++ grant.git/arch/powerpc/Kconfig
> @@ -128,6 +128,7 @@ config CLASSIC32
> bool "52xx/6xx/7xx/74xx"
> select PPC_FPU
> select 6xx
> + select FSL_SOC
> help
> There are four families of PowerPC chips supported. The more common
> types (601, 603, 604, 740, 750, 7400), the Motorola embedded
>
>
I would put the select FSL_SOC under the PPC_MPC52xx symbol and not the
CLASSIC32 one.
Otherwise, looks good.
Sylvain
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH try3] lite5200(b) support for i2c
2007-03-05 10:24 ` Sylvain Munaut
@ 2007-03-05 10:40 ` Domen Puncer
2007-03-05 10:53 ` Sylvain Munaut
0 siblings, 1 reply; 7+ messages in thread
From: Domen Puncer @ 2007-03-05 10:40 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: linuxppc-embedded
Add fsl-i2c to mpc5200 i2c node in device tree, and enable FSL_SOC.
Tested to work with built-in eeprom on lite5200b.
Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
---
D'oh, of course it makes more sense under PPC_MPC52xx.
arch/powerpc/Kconfig | 1 +
arch/powerpc/boot/dts/lite5200.dts | 6 ++++--
arch/powerpc/boot/dts/lite5200b.dts | 6 ++++--
3 files changed, 9 insertions(+), 4 deletions(-)
Index: grant.git/arch/powerpc/Kconfig
===================================================================
--- grant.git.orig/arch/powerpc/Kconfig
+++ grant.git/arch/powerpc/Kconfig
@@ -434,6 +434,7 @@ config PPC_CHRP
config PPC_MPC52xx
bool
+ select FSL_SOC
default n
config PPC_MPC5200
Index: grant.git/arch/powerpc/boot/dts/lite5200b.dts
===================================================================
--- grant.git.orig/arch/powerpc/boot/dts/lite5200b.dts
+++ grant.git/arch/powerpc/boot/dts/lite5200b.dts
@@ -323,20 +323,22 @@
i2c@3d00 {
device_type = "i2c";
- compatible = "mpc5200b-i2c\0mpc5200-i2c";
+ compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
cell-index = <0>;
reg = <3d00 40>;
interrupts = <2 f 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
i2c@3d40 {
device_type = "i2c";
- compatible = "mpc5200b-i2c\0mpc5200-i2c";
+ compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
cell-index = <1>;
reg = <3d40 40>;
interrupts = <2 10 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
sram@8000 {
device_type = "sram";
Index: grant.git/arch/powerpc/boot/dts/lite5200.dts
===================================================================
--- grant.git.orig/arch/powerpc/boot/dts/lite5200.dts
+++ grant.git/arch/powerpc/boot/dts/lite5200.dts
@@ -318,20 +318,22 @@
i2c@3d00 {
device_type = "i2c";
- compatible = "mpc5200-i2c";
+ compatible = "mpc5200-i2c\0fsl-i2c";
cell-index = <0>;
reg = <3d00 40>;
interrupts = <2 f 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
i2c@3d40 {
device_type = "i2c";
- compatible = "mpc5200-i2c";
+ compatible = "mpc5200-i2c\0fsl-i2c";
cell-index = <1>;
reg = <3d40 40>;
interrupts = <2 10 0>;
interrupt-parent = <500>;
+ fsl5200-clocking;
};
sram@8000 {
device_type = "sram";
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH try3] lite5200(b) support for i2c
2007-03-05 10:40 ` [PATCH try3] " Domen Puncer
@ 2007-03-05 10:53 ` Sylvain Munaut
2007-03-05 14:53 ` Kumar Gala
0 siblings, 1 reply; 7+ messages in thread
From: Sylvain Munaut @ 2007-03-05 10:53 UTC (permalink / raw)
To: Domen Puncer; +Cc: linuxppc-embedded
Domen Puncer wrote:
> Add fsl-i2c to mpc5200 i2c node in device tree, and enable FSL_SOC.
>
> Tested to work with built-in eeprom on lite5200b.
>
>
> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
>
Acked-by: Sylvain Munaut <tnt@246tNt.com>
I'll make sure this is included in my next merge batch to Paul.
Sylvain
> ---
> D'oh, of course it makes more sense under PPC_MPC52xx.
>
> arch/powerpc/Kconfig | 1 +
> arch/powerpc/boot/dts/lite5200.dts | 6 ++++--
> arch/powerpc/boot/dts/lite5200b.dts | 6 ++++--
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> Index: grant.git/arch/powerpc/Kconfig
> ===================================================================
> --- grant.git.orig/arch/powerpc/Kconfig
> +++ grant.git/arch/powerpc/Kconfig
> @@ -434,6 +434,7 @@ config PPC_CHRP
>
> config PPC_MPC52xx
> bool
> + select FSL_SOC
> default n
>
> config PPC_MPC5200
> Index: grant.git/arch/powerpc/boot/dts/lite5200b.dts
> ===================================================================
> --- grant.git.orig/arch/powerpc/boot/dts/lite5200b.dts
> +++ grant.git/arch/powerpc/boot/dts/lite5200b.dts
> @@ -323,20 +323,22 @@
>
> i2c@3d00 {
> device_type = "i2c";
> - compatible = "mpc5200b-i2c\0mpc5200-i2c";
> + compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
> cell-index = <0>;
> reg = <3d00 40>;
> interrupts = <2 f 0>;
> interrupt-parent = <500>;
> + fsl5200-clocking;
> };
>
> i2c@3d40 {
> device_type = "i2c";
> - compatible = "mpc5200b-i2c\0mpc5200-i2c";
> + compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c";
> cell-index = <1>;
> reg = <3d40 40>;
> interrupts = <2 10 0>;
> interrupt-parent = <500>;
> + fsl5200-clocking;
> };
> sram@8000 {
> device_type = "sram";
> Index: grant.git/arch/powerpc/boot/dts/lite5200.dts
> ===================================================================
> --- grant.git.orig/arch/powerpc/boot/dts/lite5200.dts
> +++ grant.git/arch/powerpc/boot/dts/lite5200.dts
> @@ -318,20 +318,22 @@
>
> i2c@3d00 {
> device_type = "i2c";
> - compatible = "mpc5200-i2c";
> + compatible = "mpc5200-i2c\0fsl-i2c";
> cell-index = <0>;
> reg = <3d00 40>;
> interrupts = <2 f 0>;
> interrupt-parent = <500>;
> + fsl5200-clocking;
> };
>
> i2c@3d40 {
> device_type = "i2c";
> - compatible = "mpc5200-i2c";
> + compatible = "mpc5200-i2c\0fsl-i2c";
> cell-index = <1>;
> reg = <3d40 40>;
> interrupts = <2 10 0>;
> interrupt-parent = <500>;
> + fsl5200-clocking;
> };
> sram@8000 {
> device_type = "sram";
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH try3] lite5200(b) support for i2c
2007-03-05 10:53 ` Sylvain Munaut
@ 2007-03-05 14:53 ` Kumar Gala
2007-03-05 14:55 ` Kumar Gala
0 siblings, 1 reply; 7+ messages in thread
From: Kumar Gala @ 2007-03-05 14:53 UTC (permalink / raw)
To: Sylvain Munaut; +Cc: Domen Puncer, linuxppc-embedded
On Mar 5, 2007, at 4:53 AM, Sylvain Munaut wrote:
> Domen Puncer wrote:
>> Add fsl-i2c to mpc5200 i2c node in device tree, and enable FSL_SOC.
>>
>> Tested to work with built-in eeprom on lite5200b.
>>
>>
>> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
>>
> Acked-by: Sylvain Munaut <tnt@246tNt.com>
>
>
> I'll make sure this is included in my next merge batch to Paul.
Driver patches should go via the driver subsystem maintainers and not
Paul.
- k
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH try3] lite5200(b) support for i2c
2007-03-05 14:53 ` Kumar Gala
@ 2007-03-05 14:55 ` Kumar Gala
0 siblings, 0 replies; 7+ messages in thread
From: Kumar Gala @ 2007-03-05 14:55 UTC (permalink / raw)
To: Kumar Gala; +Cc: Sylvain Munaut, Domen Puncer, linuxppc-embedded
On Mar 5, 2007, at 8:53 AM, Kumar Gala wrote:
>
> On Mar 5, 2007, at 4:53 AM, Sylvain Munaut wrote:
>
>> Domen Puncer wrote:
>>> Add fsl-i2c to mpc5200 i2c node in device tree, and enable FSL_SOC.
>>>
>>> Tested to work with built-in eeprom on lite5200b.
>>>
>>>
>>> Signed-off-by: Domen Puncer <domen.puncer@telargo.com>
>>>
>> Acked-by: Sylvain Munaut <tnt@246tNt.com>
>>
>>
>> I'll make sure this is included in my next merge batch to Paul.
>
> Driver patches should go via the driver subsystem maintainers and not
> Paul.
Sorry, ignore me. I was looking at Domen's initial patch which
touched drivers/i2c/busses/i2c-mpc.c
- k
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-03-05 14:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-02 10:47 [PATCH] i2c-mpc: add support for arch/powerpc/ tree Domen Puncer
2007-03-05 10:08 ` [PATCH alternative] lite5200(b) support for i2c Domen Puncer
2007-03-05 10:24 ` Sylvain Munaut
2007-03-05 10:40 ` [PATCH try3] " Domen Puncer
2007-03-05 10:53 ` Sylvain Munaut
2007-03-05 14:53 ` Kumar Gala
2007-03-05 14:55 ` 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).