From 38a874b5e526dd965029227aba4176b2d66a6288 Mon Sep 17 00:00:00 2001 From: Shubhrajyoti D Date: Fri, 2 Dec 2011 14:51:12 +0530 Subject: OMAP: I2C: Reset support Under some error conditions the i2c driver may do a reset. Adding a reset field and support in the device-specific code. Change-Id: I1093774aa6ba419da92047f28a087b2d29ff6750 Signed-off-by: Shubhrajyoti D Signed-off-by: Jon Hunter --- arch/arm/plat-omap/i2c.c | 19 +++++++++++++++++++ include/linux/i2c-omap.h | 1 + 2 files changed, 20 insertions(+) diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index f25b240..23b7d83 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -75,6 +75,22 @@ static struct omap_i2c_bus_platform_data i2c_pdata[OMAP_I2C_MAX_CONTROLLERS]; static struct platform_device omap_i2c_devices[] = { I2C_DEV_BUILDER(1, i2c_resources[0], &i2c_pdata[0]), }; +/** + * omap2_i2c_reset - reset the omap i2c module. + * @dev: struct device* + */ + +static int omap2_i2c_reset(struct device *dev) +{ + int r = 0; + struct platform_device *pdev = to_platform_device(dev); + struct omap_device *odev = to_omap_device(pdev); + struct omap_hwmod *oh; + + oh = odev->hwmods[0]; + r = omap_hwmod_reset(oh); + return r; +} #define OMAP_I2C_CMDLINE_SETUP (BIT(31)) @@ -151,6 +167,9 @@ static inline int omap2_i2c_add_bus(int bus_id) */ if (cpu_is_omap34xx() || cpu_is_omap44xx()) pdata->needs_wakeup_latency = true; + + pdata->device_reset = omap2_i2c_reset; + od = omap_device_build(name, bus_id, oh, pdata, sizeof(struct omap_i2c_bus_platform_data), omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h index 0eb4439..9dc3569 100644 --- a/include/linux/i2c-omap.h +++ b/include/linux/i2c-omap.h @@ -21,6 +21,7 @@ struct omap_i2c_bus_platform_data { int (*device_enable) (struct platform_device *pdev); int (*device_shutdown) (struct platform_device *pdev); int (*device_idle) (struct platform_device *pdev); + int (*device_reset) (struct device *dev); struct hwspinlock *handle; int (*hwspin_lock_timeout)(struct hwspinlock *hwlock, unsigned int to); -- cgit v1.1