]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: DaVinci: i2c setup
authorKomal Shah <komal_shah802003@yahoo.com>
Mon, 8 Sep 2008 06:41:28 +0000 (23:41 -0700)
committerKevin Hilman <khilman@deeprootsystems.com>
Wed, 17 Sep 2008 07:31:42 +0000 (00:31 -0700)
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>
arch/arm/mach-davinci/Makefile
arch/arm/mach-davinci/devices.c [new file with mode: 0644]
arch/arm/mach-davinci/include/mach/i2c.h

index 99ac2e55774dcdf1c9b316ec9972a5d267765f89..bddfbb7170648fb382e656f83bc51e2df1ecf8da 100644 (file)
@@ -5,7 +5,7 @@
 
 # Common objects
 obj-y                  := time.o irq.o clock.o serial.o io.o id.o psc.o \
-                          gpio.o mux.o
+                          gpio.o mux.o devices.o
 
 # Board specific
 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 (file)
index 0000000..3d4b1de
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * mach-davinci/devices.c
+ *
+ * DaVinci platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
+#include <linux/io.h>
+
+#include <asm/mach/map.h>
+
+#include <mach/hardware.h>
+#include <mach/i2c.h>
+
+static struct resource i2c_resources[] = {
+       {
+               .start          = DAVINCI_I2C_BASE,
+               .end            = DAVINCI_I2C_BASE + 0x40,
+               .flags          = IORESOURCE_MEM,
+       },
+       {
+               .start          = IRQ_I2C,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device davinci_i2c_device = {
+       .name           = "i2c_davinci",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(i2c_resources),
+       .resource       = i2c_resources,
+};
+
+void __init davinci_init_i2c(struct davinci_i2c_platform_data *pdata)
+{
+       davinci_i2c_device.dev.platform_data = pdata;
+       (void) platform_device_register(&davinci_i2c_device);
+}
+
index e2f54168abd1273d0773ed929422d320a29e528f..c248e9b7e82517c619b0fe74db18c4d3e88a2797 100644 (file)
 
 /* All frequencies are expressed in kHz */
 struct davinci_i2c_platform_data {
-       unsigned int    bus_freq;       /* standard bus frequency */
-       unsigned int    bus_delay;      /* transaction delay */
+       unsigned int    bus_freq;       /* standard bus frequency (kHz) */
+       unsigned int    bus_delay;      /* post-transaction delay (usec) */
 };
 
+/* for board setup code */
+void davinci_init_i2c(struct davinci_i2c_platform_data *);
+
 #endif /* __ASM_ARCH_I2C_H */