From patchwork Thu Jul 21 13:52:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shubhrajyoti Datta X-Patchwork-Id: 994962 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6LDrnSj028221 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 21 Jul 2011 13:54:09 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qjth5-00059h-El; Thu, 21 Jul 2011 13:53:39 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Qjth5-0004If-0N; Thu, 21 Jul 2011 13:53:39 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Qjtgj-0004EZ-HU for linux-arm-kernel@lists.infradead.org; Thu, 21 Jul 2011 13:53:21 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p6LDrC0R022508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 21 Jul 2011 08:53:14 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p6LDr8Al020724; Thu, 21 Jul 2011 19:23:11 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Thu, 21 Jul 2011 19:23:11 +0530 Received: from a0393217ubnlt.india.ti.com ([172.24.190.93]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p6LDr2NJ003719; Thu, 21 Jul 2011 19:23:07 +0530 (IST) From: Shubhrajyoti D To: Subject: [PATCHV3 1/4] OMAP: I2C: Reset support Date: Thu, 21 Jul 2011 19:22:58 +0530 Message-ID: <1311256381-25548-2-git-send-email-shubhrajyoti@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1311256381-25548-1-git-send-email-shubhrajyoti@ti.com> References: <1311256381-25548-1-git-send-email-shubhrajyoti@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110721_095317_727891_0C8F4839 X-CRM114-Status: GOOD ( 13.73 ) X-Spam-Score: -3.5 (---) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-3.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [198.47.26.153 listed in list.dnswl.org] -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: khilman@ti.com, balajitk@ti.com, rnayak@ti.com, santosh.shilimkar@ti.com, linux-i2c@vger.kernel.org, Shubhrajyoti D , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 21 Jul 2011 13:54:10 +0000 (UTC) Under some error conditions the i2c driver may do a reset. Adding a reset field and support in the platform. Signed-off-by: Shubhrajyoti D --- arch/arm/plat-omap/i2c.c | 17 +++++++++++++++++ include/linux/i2c-omap.h | 1 + 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c index 2388b8e..98a97b0 100644 --- a/arch/arm/plat-omap/i2c.c +++ b/arch/arm/plat-omap/i2c.c @@ -146,6 +146,22 @@ static struct omap_device_pm_latency omap_i2c_latency[] = { .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, }, }; +/** + * 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; +} static inline int omap2_i2c_add_bus(int bus_id) { @@ -187,6 +203,7 @@ static inline int omap2_i2c_add_bus(int bus_id) */ if (cpu_is_omap34xx()) pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; + 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 98ae49b..8aa91b6 100644 --- a/include/linux/i2c-omap.h +++ b/include/linux/i2c-omap.h @@ -38,6 +38,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); }; #endif