diff options
author | Komal Shah <komal_shah802003@yahoo.com> | 2008-09-08 02:41:28 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2008-09-17 03:31:42 -0400 |
commit | d395e6ad98912b52a299999ab667de9a1f393c91 (patch) | |
tree | 1ce5767c12884c6326f702d9eeac998c0af4864c /arch/arm/mach-davinci | |
parent | dce1115bc32d66237102a4c925e1e0a5e82b9945 (diff) |
ARM: DaVinci: i2c setup
Davinci I2C initialization infrastructure; will be used by EVM init.
[ dbrownell@users.sourceforge.net: pass platform data into init code ]
Signed-off-by: Komal Shah <komal_shah802003@yahoo.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/devices.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/i2c.h | 7 |
3 files changed, 54 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 99ac2e55774..bddfbb71706 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | # Common objects | 6 | # Common objects |
7 | obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ | 7 | obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \ |
8 | gpio.o mux.o | 8 | gpio.o mux.o devices.o |
9 | 9 | ||
10 | # Board specific | 10 | # Board specific |
11 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o | 11 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o |
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c new file mode 100644 index 00000000000..3d4b1de8f89 --- /dev/null +++ b/arch/arm/mach-davinci/devices.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * mach-davinci/devices.c | ||
3 | * | ||
4 | * DaVinci platform device setup/initialization | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/dma-mapping.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <asm/mach/map.h> | ||
20 | |||
21 | #include <mach/hardware.h> | ||
22 | #include <mach/i2c.h> | ||
23 | |||
24 | static struct resource i2c_resources[] = { | ||
25 | { | ||
26 | .start = DAVINCI_I2C_BASE, | ||
27 | .end = DAVINCI_I2C_BASE + 0x40, | ||
28 | .flags = IORESOURCE_MEM, | ||
29 | }, | ||
30 | { | ||
31 | .start = IRQ_I2C, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | }; | ||
35 | |||
36 | static struct platform_device davinci_i2c_device = { | ||
37 | .name = "i2c_davinci", | ||
38 | .id = 1, | ||
39 | .num_resources = ARRAY_SIZE(i2c_resources), | ||
40 | .resource = i2c_resources, | ||
41 | }; | ||
42 | |||
43 | void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata) | ||
44 | { | ||
45 | davinci_i2c_device.dev.platform_data = pdata; | ||
46 | (void) platform_device_register(&davinci_i2c_device); | ||
47 | } | ||
48 | |||
diff --git a/arch/arm/mach-davinci/include/mach/i2c.h b/arch/arm/mach-davinci/include/mach/i2c.h index e2f54168abd..c248e9b7e82 100644 --- a/arch/arm/mach-davinci/include/mach/i2c.h +++ b/arch/arm/mach-davinci/include/mach/i2c.h | |||
@@ -14,8 +14,11 @@ | |||
14 | 14 | ||
15 | /* All frequencies are expressed in kHz */ | 15 | /* All frequencies are expressed in kHz */ |
16 | struct davinci_i2c_platform_data { | 16 | struct davinci_i2c_platform_data { |
17 | unsigned int bus_freq; /* standard bus frequency */ | 17 | unsigned int bus_freq; /* standard bus frequency (kHz) */ |
18 | unsigned int bus_delay; /* transaction delay */ | 18 | unsigned int bus_delay; /* post-transaction delay (usec) */ |
19 | }; | 19 | }; |
20 | 20 | ||
21 | /* for board setup code */ | ||
22 | void davinci_init_i2c(struct davinci_i2c_platform_data *); | ||
23 | |||
21 | #endif /* __ASM_ARCH_I2C_H */ | 24 | #endif /* __ASM_ARCH_I2C_H */ |