From patchwork Thu May 26 16:45:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 821342 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4QGjPRw029323 for ; Thu, 26 May 2011 16:45:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932373Ab1EZQp2 (ORCPT ); Thu, 26 May 2011 12:45:28 -0400 Received: from na3sys009aog112.obsmtp.com ([74.125.149.207]:34668 "EHLO na3sys009aog112.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932347Ab1EZQp1 (ORCPT ); Thu, 26 May 2011 12:45:27 -0400 Received: from mail-ew0-f42.google.com ([209.85.215.42]) (using TLSv1) by na3sys009aob112.postini.com ([74.125.148.12]) with SMTP ID DSNKTd6Dps2qHpcAI7XwRZfnmk9++76gnXnq@postini.com; Thu, 26 May 2011 09:45:27 PDT Received: by mail-ew0-f42.google.com with SMTP id 2so429537ewy.15 for ; Thu, 26 May 2011 09:45:26 -0700 (PDT) Received: by 10.213.0.209 with SMTP id 17mr2166255ebc.30.1306428326299; Thu, 26 May 2011 09:45:26 -0700 (PDT) Received: from localhost.localdomain (a62-248-131-233.elisa-laajakaista.fi [62.248.131.233]) by mx.google.com with ESMTPS id t52sm312419eej.0.2011.05.26.09.45.24 (version=SSLv3 cipher=OTHER); Thu, 26 May 2011 09:45:25 -0700 (PDT) From: Tomi Valkeinen To: Kevin Hilman , Paul Walmsley Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tomi Valkeinen Subject: [PATCH 2/3] OMAP: add omap_device_reset() Date: Thu, 26 May 2011 19:45:06 +0300 Message-Id: <1306428307-1360-3-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306428307-1360-1-git-send-email-tomi.valkeinen@ti.com> References: <1306428307-1360-1-git-send-email-tomi.valkeinen@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 26 May 2011 16:45:29 +0000 (UTC) Add omap_device_reset() function which can be used to reset the hwmods associated with the given platform device. Signed-off-by: Tomi Valkeinen --- arch/arm/plat-omap/include/plat/omap_device.h | 1 + arch/arm/plat-omap/omap_device.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h index 70d31d0..bcf1b35 100644 --- a/arch/arm/plat-omap/include/plat/omap_device.h +++ b/arch/arm/plat-omap/include/plat/omap_device.h @@ -108,6 +108,7 @@ int omap_device_align_pm_lat(struct platform_device *pdev, u32 new_wakeup_lat_limit); struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); int omap_device_get_context_loss_count(struct platform_device *pdev); +int omap_device_reset(struct platform_device *pdev); /* Other */ diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index 9753f71..4e6fc1b 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -324,6 +324,29 @@ int omap_device_get_context_loss_count(struct platform_device *pdev) } /** + * omap_device_reset - reset hwmods of given device + * @pdev: struct platform_device * + * + * Reset all hwmods associated with the given device. If a reset of a hwmod + * fails the rest of the hwmods are skipped and the error is returned. + */ +int omap_device_reset(struct platform_device *pdev) +{ + struct omap_device *od; + int i, r; + + od = _find_by_pdev(pdev); + + for (i = 0; i < od->hwmods_cnt; i++) { + r = omap_hwmod_reset(od->hwmods[i]); + if (r) + return r; + } + + return 0; +} + +/** * omap_device_count_resources - count number of struct resource entries needed * @od: struct omap_device * *