aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorChristina Warren <cawarren@ti.com>2011-09-27 18:33:02 -0500
committerZiyann <jaraidaniel@gmail.com>2014-10-01 12:59:53 +0200
commit69b30ec9056353eb22a78e3542ec0964f67440af (patch)
treebe843a0c3e15b1129fb3596ff5671ed0bc6fb2a2 /arch/arm/plat-omap
parent1b76e3caa824f5acec2ced2169f6b5b2698935a2 (diff)
downloadkernel_samsung_tuna-69b30ec9056353eb22a78e3542ec0964f67440af.zip
kernel_samsung_tuna-69b30ec9056353eb22a78e3542ec0964f67440af.tar.gz
kernel_samsung_tuna-69b30ec9056353eb22a78e3542ec0964f67440af.tar.bz2
OMAP4: I2C: Add hwspinlock support
Adding support for hwspinlock in I2C driver in Blaze and Blaze_Tablet2. Also adding an api omap_i2c_get_hwspinlockid to be used by remote proc to populate the resource table. Change-Id: I5f554ead10806c90442359365dcb8ebff51bf2bf Signed-off-by: Christina Warren <cawarren@ti.com> Conflicts: arch/arm/mach-omap2/board-4430sdp.c arch/arm/mach-omap2/board-44xx-tablet.c arch/arm/plat-omap/include/plat/i2c.h drivers/i2c/busses/i2c-omap.c
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/i2c.c41
-rwxr-xr-xarch/arm/plat-omap/include/plat/i2c.h22
2 files changed, 63 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index f8dc82f..0e8c407 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -250,3 +250,44 @@ int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
return omap_i2c_add_bus(bus_id);
}
+
+/**
+ * omap_register_i2c_bus_board_data - register hwspinlock data
+ * @bus_id: bus id counting from number 1
+ * @pdata: pointer to the I2C bus board data
+ */
+void omap_register_i2c_bus_board_data(int bus_id,
+ struct omap_i2c_bus_board_data *pdata)
+{
+ BUG_ON(bus_id < 1 || bus_id > omap_i2c_nr_ports());
+
+ if ((pdata != NULL) && (pdata->handle != NULL)) {
+ i2c_pdata[bus_id - 1].handle = pdata->handle;
+ i2c_pdata[bus_id - 1].hwspin_lock_timeout =
+ pdata->hwspin_lock_timeout;
+ i2c_pdata[bus_id - 1].hwspin_unlock = pdata->hwspin_unlock;
+ }
+}
+
+/**
+ * omap_i2c_get_hwspinlockid - Get HWSPINLOCK ID for I2C device
+ * @dev: I2C device
+ *
+ * returns the hwspinlock id or -1 if does not exist
+ */
+int omap_i2c_get_hwspinlockid(struct device *dev)
+{
+ struct omap_i2c_bus_platform_data *pdata;
+
+ pdata = dev_get_platdata(dev);
+ if (!pdata) {
+ dev_err(dev, "%s: platform data is missing\n", __func__);
+ return -EINVAL;
+ }
+
+ if (pdata->handle != NULL)
+ return hwspin_lock_get_id(pdata->handle);
+ else
+ return -1;
+}
+EXPORT_SYMBOL_GPL(omap_i2c_get_hwspinlockid);
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
index 1a0730b..eba4503 100755
--- a/arch/arm/plat-omap/include/plat/i2c.h
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -23,8 +23,30 @@
#include <linux/i2c.h>
#include <linux/i2c-omap.h>
+#include <linux/hwspinlock.h>
#include <plat/omap_hwmod.h>
+struct omap_i2c_bus_board_data {
+ struct hwspinlock *handle;
+ int (*hwspin_lock_timeout)(struct hwspinlock *hwlock, unsigned int to);
+ void (*hwspin_unlock)(struct hwspinlock *hwlock);
+};
+
+/**
+ * omap_register_i2c_bus_board_data - register hwspinlock data
+ * @bus_id: bus id counting from number 1
+ * @pdata: pointer to the I2C bus board data
+ */
+void omap_register_i2c_bus_board_data(int bus_id,
+ struct omap_i2c_bus_board_data *pdata);
+
+/**
+ * omap_i2c_get_hwspinlockid - Get HWSPINLOCK ID for I2C device
+ * @dev: I2C device
+ *
+ * returns the hwspinlock id or -1 if does not exist
+ */
+int omap_i2c_get_hwspinlockid(struct device *dev);
#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
extern int omap_register_i2c_bus(int bus_id, u32 clkrate,