diff options
author | Andrew Lunn <andrew@lunn.ch> | 2011-05-15 07:32:45 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@fluxnic.net> | 2011-05-16 15:08:36 -0400 |
commit | aac7ffa3ed121846b61347028828617c5dd1ce46 (patch) | |
tree | ec2590692fef62fe4df9dc772e2552bb17e50892 /arch/arm/plat-orion/common.c | |
parent | 7e3819d820c9aa3536d15fe7310c054bef1f5f04 (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/common.c')
-rw-r--r-- | arch/arm/plat-orion/common.c | 54 |
1 files changed, 54 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 | ****************************************************************************/ | ||
471 | static struct mv64xxx_i2c_pdata orion_i2c_pdata = { | ||
472 | .freq_n = 3, | ||
473 | .timeout = 1000, /* Default timeout of 1 second */ | ||
474 | }; | ||
475 | |||
476 | static struct resource orion_i2c_resources[2]; | ||
477 | |||
478 | static 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 | |||
486 | static struct mv64xxx_i2c_pdata orion_i2c_1_pdata = { | ||
487 | .freq_n = 3, | ||
488 | .timeout = 1000, /* Default timeout of 1 second */ | ||
489 | }; | ||
490 | |||
491 | static struct resource orion_i2c_1_resources[2]; | ||
492 | |||
493 | static 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 | |||
501 | void __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 | |||
511 | void __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 | } | ||