From patchwork Mon Feb 28 14:39:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Govindraj.R" X-Patchwork-Id: 595681 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1SEG8Pe022946 for ; Mon, 28 Feb 2011 14:16:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754351Ab1B1OQF (ORCPT ); Mon, 28 Feb 2011 09:16:05 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:35779 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754334Ab1B1OQC (ORCPT ); Mon, 28 Feb 2011 09:16:02 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p1SEFp4J023726 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Feb 2011 08:15:53 -0600 Received: from ucmsshproxy.india.ext.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with SMTP id p1SEFkZo028068; Mon, 28 Feb 2011 19:45:46 +0530 (IST) Received: from localhost (unknown [10.24.244.190]) by ucmsshproxy.india.ext.ti.com (Postfix) with ESMTP id 526D2158004; Mon, 28 Feb 2011 19:45:46 +0530 (IST) From: "Govindraj.R" To: linux-omap@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: "Govindraj.R" , Tony Lindgren , Benoit Cousson , Kevin Hilman , Paul Walmsley , Rajendra Nayak Subject: [PATCH 2/7] OMAP2+: mux: Enable wakeup for wakeup enable requested pads Date: Mon, 28 Feb 2011 20:09:13 +0530 Message-Id: <1298903958-6496-3-git-send-email-govindraj.raja@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298903958-6496-1-git-send-email-govindraj.raja@ti.com> References: <1298903958-6496-1-git-send-email-govindraj.raja@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 (demeter1.kernel.org [140.211.167.41]); Mon, 28 Feb 2011 14:16:08 +0000 (UTC) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 98148b6..5338b93 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -317,6 +317,24 @@ err1: return NULL; } +/* Gets the wakeup status of given pad from omap-hwmod */ +int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux) +{ + int i; + unsigned int val = -EINVAL; + + for (i = 0; i < hmux->nr_pads; i++) { + struct omap_device_pad *pad = &hmux->pads[i]; + + val = omap_mux_read(pad->partition, pad->mux->reg_offset); + } + + if (val > 0 && val & OMAP_WAKEUP_EVENT) + return 1; + else + return 0; +} + /* Assumes the calling function takes care of locking */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) { @@ -342,6 +360,9 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) break; flags &= ~OMAP_DEVICE_PAD_ENABLED; val = pad->idle; + if (flags & OMAP_DEVICE_PAD_WAKEUP) + val |= OMAP_WAKEUP_EN; + pr_debug("%s: Idling %s %x\n", __func__, pad->name, val); break; @@ -358,6 +379,8 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state) }; if (val >= 0) { + val |= omap_mux_read(pad->partition, + pad->mux->reg_offset); omap_mux_write(pad->partition, val, pad->mux->reg_offset); pad->flags = flags; diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index a4ab17a..84a8fc2 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -220,8 +220,21 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); + +/** + * omap_hwmod_mux_wakeup - omap hwmod check given pad had wakeup event + * @hmux: Pads for a hwmod + * + * Called only from omap_hwmod.c, do not use. + */ +int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux); #else +static inline int omap_hwmod_mux_wakeup(struct omap_hwmod_mux_info *hmux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 9e89a58..893dae1 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2239,3 +2239,16 @@ u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) return ret; } + +/** + * omap_hwmod_pad_wakeup_status - get pad wakeup status if mux is available. + * @oh: struct omap_hwmod * + * + * Returns the wake_up status bit of available pad mux pin. + */ +int omap_hmwod_pad_wakeup_status(struct omap_hwmod *oh) +{ + if (oh->mux) + return omap_hwmod_mux_wakeup(oh->mux); + return -EINVAL; +} diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index fedd829..4100be0 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -588,6 +588,7 @@ int omap_hwmod_for_each_by_class(const char *classname, int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); +int omap_hmwod_pad_wakeup_status(struct omap_hwmod *oh); /* * Chip variant-specific hwmod init routines - XXX should be converted * to use initcalls once the initial boot ordering is straightened out