aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@iki.fi>2009-03-03 14:13:50 -0500
committerNicolas Pitre <nico@cam.org>2009-03-03 21:06:12 -0500
commit693599438909de47fbfa4246bf67d6c535f719b5 (patch)
tree1b0b323d6c12c5df3c22c7f7cf8bde7016aec57c /arch/arm/mach-mv78xx0
parent5b99d5348304a32dfca92238d27ac4de2b365175 (diff)
[ARM] mv78xx0: wire i2c support
All the pieces were ready, just matter of assembling them together. Signed-off-by: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-mv78xx0')
-rw-r--r--arch/arm/mach-mv78xx0/common.c76
-rw-r--r--arch/arm/mach-mv78xx0/common.h1
-rw-r--r--arch/arm/mach-mv78xx0/db78x00-bp-setup.c8
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/mv78xx0.h2
4 files changed, 87 insertions, 0 deletions
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 15f9913f4a90..a575daaa62d1 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -14,6 +14,7 @@
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
17#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
18#include <linux/ethtool.h> 19#include <linux/ethtool.h>
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
@@ -518,6 +519,81 @@ void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
518 platform_device_register(&mv78xx0_ge11); 519 platform_device_register(&mv78xx0_ge11);
519} 520}
520 521
522/*****************************************************************************
523 * I2C bus 0
524 ****************************************************************************/
525
526static struct mv64xxx_i2c_pdata mv78xx0_i2c_0_pdata = {
527 .freq_m = 8, /* assumes 166 MHz TCLK */
528 .freq_n = 3,
529 .timeout = 1000, /* Default timeout of 1 second */
530};
531
532static struct resource mv78xx0_i2c_0_resources[] = {
533 {
534 .name = "i2c 0 base",
535 .start = I2C_0_PHYS_BASE,
536 .end = I2C_0_PHYS_BASE + 0x1f,
537 .flags = IORESOURCE_MEM,
538 }, {
539 .name = "i2c 0 irq",
540 .start = IRQ_MV78XX0_I2C_0,
541 .end = IRQ_MV78XX0_I2C_0,
542 .flags = IORESOURCE_IRQ,
543 },
544};
545
546
547static struct platform_device mv78xx0_i2c_0 = {
548 .name = MV64XXX_I2C_CTLR_NAME,
549 .id = 0,
550 .num_resources = ARRAY_SIZE(mv78xx0_i2c_0_resources),
551 .resource = mv78xx0_i2c_0_resources,
552 .dev = {
553 .platform_data = &mv78xx0_i2c_0_pdata,
554 },
555};
556
557/*****************************************************************************
558 * I2C bus 1
559 ****************************************************************************/
560
561static struct mv64xxx_i2c_pdata mv78xx0_i2c_1_pdata = {
562 .freq_m = 8, /* assumes 166 MHz TCLK */
563 .freq_n = 3,
564 .timeout = 1000, /* Default timeout of 1 second */
565};
566
567static struct resource mv78xx0_i2c_1_resources[] = {
568 {
569 .name = "i2c 1 base",
570 .start = I2C_1_PHYS_BASE,
571 .end = I2C_1_PHYS_BASE + 0x1f,
572 .flags = IORESOURCE_MEM,
573 }, {
574 .name = "i2c 1 irq",
575 .start = IRQ_MV78XX0_I2C_1,
576 .end = IRQ_MV78XX0_I2C_1,
577 .flags = IORESOURCE_IRQ,
578 },
579};
580
581
582static struct platform_device mv78xx0_i2c_1 = {
583 .name = MV64XXX_I2C_CTLR_NAME,
584 .id = 1,
585 .num_resources = ARRAY_SIZE(mv78xx0_i2c_1_resources),
586 .resource = mv78xx0_i2c_1_resources,
587 .dev = {
588 .platform_data = &mv78xx0_i2c_1_pdata,
589 },
590};
591
592void __init mv78xx0_i2c_init(void)
593{
594 platform_device_register(&mv78xx0_i2c_0);
595 platform_device_register(&mv78xx0_i2c_1);
596}
521 597
522/***************************************************************************** 598/*****************************************************************************
523 * SATA 599 * SATA
diff --git a/arch/arm/mach-mv78xx0/common.h b/arch/arm/mach-mv78xx0/common.h
index f6274db6192d..befc22475469 100644
--- a/arch/arm/mach-mv78xx0/common.h
+++ b/arch/arm/mach-mv78xx0/common.h
@@ -44,6 +44,7 @@ void mv78xx0_uart0_init(void);
44void mv78xx0_uart1_init(void); 44void mv78xx0_uart1_init(void);
45void mv78xx0_uart2_init(void); 45void mv78xx0_uart2_init(void);
46void mv78xx0_uart3_init(void); 46void mv78xx0_uart3_init(void);
47void mv78xx0_i2c_init(void);
47 48
48extern struct sys_timer mv78xx0_timer; 49extern struct sys_timer mv78xx0_timer;
49 50
diff --git a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
index be0a59a6139e..efdabe04c69e 100644
--- a/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
+++ b/arch/arm/mach-mv78xx0/db78x00-bp-setup.c
@@ -14,6 +14,7 @@
14#include <linux/ata_platform.h> 14#include <linux/ata_platform.h>
15#include <linux/mv643xx_eth.h> 15#include <linux/mv643xx_eth.h>
16#include <linux/ethtool.h> 16#include <linux/ethtool.h>
17#include <linux/i2c.h>
17#include <mach/mv78xx0.h> 18#include <mach/mv78xx0.h>
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -39,6 +40,11 @@ static struct mv_sata_platform_data db78x00_sata_data = {
39 .n_ports = 2, 40 .n_ports = 2,
40}; 41};
41 42
43static struct i2c_board_info __initdata db78x00_i2c_rtc = {
44 I2C_BOARD_INFO("ds1338", 0x68),
45};
46
47
42static void __init db78x00_init(void) 48static void __init db78x00_init(void)
43{ 49{
44 /* 50 /*
@@ -60,6 +66,8 @@ static void __init db78x00_init(void)
60 mv78xx0_sata_init(&db78x00_sata_data); 66 mv78xx0_sata_init(&db78x00_sata_data);
61 mv78xx0_uart0_init(); 67 mv78xx0_uart0_init();
62 mv78xx0_uart2_init(); 68 mv78xx0_uart2_init();
69 mv78xx0_i2c_init();
70 i2c_register_board_info(0, &db78x00_i2c_rtc, 1);
63 } else { 71 } else {
64 mv78xx0_uart1_init(); 72 mv78xx0_uart1_init();
65 mv78xx0_uart3_init(); 73 mv78xx0_uart3_init();
diff --git a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
index 328a02e029a0..582cffc733ad 100644
--- a/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
+++ b/arch/arm/mach-mv78xx0/include/mach/mv78xx0.h
@@ -102,6 +102,8 @@
102#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x10000) 102#define DEV_BUS_VIRT_BASE (MV78XX0_REGS_VIRT_BASE | 0x10000)
103#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE | 0x0030) 103#define SAMPLE_AT_RESET_LOW (DEV_BUS_VIRT_BASE | 0x0030)
104#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE | 0x0034) 104#define SAMPLE_AT_RESET_HIGH (DEV_BUS_VIRT_BASE | 0x0034)
105#define I2C_0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000)
106#define I2C_1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1100)
105#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) 107#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
106#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) 108#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
107#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) 109#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)