aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-orion
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2011-05-15 07:32:45 -0400
committerNicolas Pitre <nico@fluxnic.net>2011-05-16 15:08:36 -0400
commitaac7ffa3ed121846b61347028828617c5dd1ce46 (patch)
treeec2590692fef62fe4df9dc772e2552bb17e50892 /arch/arm/plat-orion
parent7e3819d820c9aa3536d15fe7310c054bef1f5f04 (diff)
ARM: orion: Consolidate I2C initialization.
Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Diffstat (limited to 'arch/arm/plat-orion')
-rw-r--r--arch/arm/plat-orion/common.c54
-rw-r--r--arch/arm/plat-orion/include/plat/common.h6
2 files changed, 60 insertions, 0 deletions
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 15c3f353a9b5..bcc1734c91a8 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -15,6 +15,7 @@
15#include <linux/serial_8250.h> 15#include <linux/serial_8250.h>
16#include <linux/mbus.h> 16#include <linux/mbus.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/mv643xx_i2c.h>
18#include <net/dsa.h> 19#include <net/dsa.h>
19 20
20/* Fill in the resources structure and link it into the platform 21/* Fill in the resources structure and link it into the platform
@@ -463,3 +464,56 @@ void __init orion_ge00_switch_init(struct dsa_platform_data *d, int irq)
463 464
464 platform_device_register(&orion_switch_device); 465 platform_device_register(&orion_switch_device);
465} 466}
467
468/*****************************************************************************
469 * I2C
470 ****************************************************************************/
471static struct mv64xxx_i2c_pdata orion_i2c_pdata = {
472 .freq_n = 3,
473 .timeout = 1000, /* Default timeout of 1 second */
474};
475
476static struct resource orion_i2c_resources[2];
477
478static struct platform_device orion_i2c = {
479 .name = MV64XXX_I2C_CTLR_NAME,
480 .id = 0,
481 .dev = {
482 .platform_data = &orion_i2c_pdata,
483 },
484};
485
486static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = {
487 .freq_n = 3,
488 .timeout = 1000, /* Default timeout of 1 second */
489};
490
491static struct resource orion_i2c_1_resources[2];
492
493static struct platform_device orion_i2c_1 = {
494 .name = MV64XXX_I2C_CTLR_NAME,
495 .id = 1,
496 .dev = {
497 .platform_data = &orion_i2c_1_pdata,
498 },
499};
500
501void __init orion_i2c_init(unsigned long mapbase,
502 unsigned long irq,
503 unsigned long freq_m)
504{
505 orion_i2c_pdata.freq_m = freq_m;
506 fill_resources(&orion_i2c, orion_i2c_resources, mapbase,
507 SZ_32 - 1, irq);
508 platform_device_register(&orion_i2c);
509}
510
511void __init orion_i2c_1_init(unsigned long mapbase,
512 unsigned long irq,
513 unsigned long freq_m)
514{
515 orion_i2c_1_pdata.freq_m = freq_m;
516 fill_resources(&orion_i2c_1, orion_i2c_1_resources, mapbase,
517 SZ_32 - 1, irq);
518 platform_device_register(&orion_i2c_1);
519}
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index 3f23258daa61..d107c62d3912 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -66,5 +66,11 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
66 66
67void __init orion_ge00_switch_init(struct dsa_platform_data *d, 67void __init orion_ge00_switch_init(struct dsa_platform_data *d,
68 int irq); 68 int irq);
69void __init orion_i2c_init(unsigned long mapbase,
70 unsigned long irq,
71 unsigned long freq_m);
69 72
73void __init orion_i2c_1_init(unsigned long mapbase,
74 unsigned long irq,
75 unsigned long freq_m);
70#endif 76#endif