aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorMartin Michlmayr <tbm@cyrius.com>2009-03-23 14:13:21 -0400
committerNicolas Pitre <nico@cam.org>2009-03-23 14:42:00 -0400
commit6574e001b4bc616022ee706a338fbbac26a9cedd (patch)
treea6ae13e971229206bfb940d501026d08d90f6650 /arch/arm/mach-kirkwood
parent569106c70e49ad67c69fa7d43a2a5218e63a4619 (diff)
[ARM] Kirkwood: Hook up I2C
Hook up I2C on Marvell Kirkwood. Tested on a QNAP TS-219 which has RTC connected through I2C. Signed-off-by: Martin Michlmayr <tbm@cyrius.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/common.c40
-rw-r--r--arch/arm/mach-kirkwood/common.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h1
3 files changed, 42 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 9f012551794d..19b03f62c3f4 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/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/spi/orion_spi.h> 19#include <linux/spi/orion_spi.h>
19#include <net/dsa.h> 20#include <net/dsa.h>
@@ -371,6 +372,45 @@ void __init kirkwood_spi_init()
371 372
372 373
373/***************************************************************************** 374/*****************************************************************************
375 * I2C
376 ****************************************************************************/
377static struct mv64xxx_i2c_pdata kirkwood_i2c_pdata = {
378 .freq_m = 8, /* assumes 166 MHz TCLK */
379 .freq_n = 3,
380 .timeout = 1000, /* Default timeout of 1 second */
381};
382
383static struct resource kirkwood_i2c_resources[] = {
384 {
385 .name = "i2c",
386 .start = I2C_PHYS_BASE,
387 .end = I2C_PHYS_BASE + 0x1f,
388 .flags = IORESOURCE_MEM,
389 }, {
390 .name = "i2c",
391 .start = IRQ_KIRKWOOD_TWSI,
392 .end = IRQ_KIRKWOOD_TWSI,
393 .flags = IORESOURCE_IRQ,
394 },
395};
396
397static struct platform_device kirkwood_i2c = {
398 .name = MV64XXX_I2C_CTLR_NAME,
399 .id = 0,
400 .num_resources = ARRAY_SIZE(kirkwood_i2c_resources),
401 .resource = kirkwood_i2c_resources,
402 .dev = {
403 .platform_data = &kirkwood_i2c_pdata,
404 },
405};
406
407void __init kirkwood_i2c_init(void)
408{
409 platform_device_register(&kirkwood_i2c);
410}
411
412
413/*****************************************************************************
374 * UART0 414 * UART0
375 ****************************************************************************/ 415 ****************************************************************************/
376static struct plat_serial8250_port kirkwood_uart0_data[] = { 416static struct plat_serial8250_port kirkwood_uart0_data[] = {
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9e5282684d58..c66a25066cea 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -37,6 +37,7 @@ void kirkwood_pcie_init(void);
37void kirkwood_sata_init(struct mv_sata_platform_data *sata_data); 37void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
38void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data); 38void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data);
39void kirkwood_spi_init(void); 39void kirkwood_spi_init(void);
40void kirkwood_i2c_init(void);
40void kirkwood_uart0_init(void); 41void kirkwood_uart0_init(void);
41void kirkwood_uart1_init(void); 42void kirkwood_uart1_init(void);
42 43
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index d3db30fe763b..38c986853590 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -93,6 +93,7 @@
93#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034) 93#define DEVICE_ID (DEV_BUS_VIRT_BASE | 0x0034)
94#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300) 94#define RTC_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0300)
95#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600) 95#define SPI_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x0600)
96#define I2C_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x1000)
96#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000) 97#define UART0_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2000)
97#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000) 98#define UART0_VIRT_BASE (DEV_BUS_VIRT_BASE | 0x2000)
98#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100) 99#define UART1_PHYS_BASE (DEV_BUS_PHYS_BASE | 0x2100)