From: Jouni Hogander Subject: [PATCH 1/8] 34XX: PM: Workaround for taking care of gpio clocks Date: Tue, 17 Jun 2008 10:30:54 +0300 Message-ID: <1213687854-29909-1-git-send-email-jouni.hogander@nokia.com> References: <87iqw85xlo.fsf@trdhcp146196.ntc.nokia.com> Return-path: Received: from smtp.nokia.com ([192.100.122.230]:32509 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218AbYFQHa6 (ORCPT ); Tue, 17 Jun 2008 03:30:58 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m5H7UGSo004276 for ; Tue, 17 Jun 2008 10:30:56 +0300 Received: from localhost.localdomain (trdhcp146197.ntc.nokia.com [172.22.146.197]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id m5H7Us0r013533 for ; Tue, 17 Jun 2008 10:30:54 +0300 In-Reply-To: <87iqw85xlo.fsf@trdhcp146196.ntc.nokia.com> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: linux-omap@vger.kernel.org In omap3 gpios 2-6 are in per domain. Clocks for these should be disabled. This patch is needed until gpio driver disables gpio clocks when they are not needed. Signed-off-by: Jouni Hogander --- arch/arm/mach-omap2/pm34xx.c | 48 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 47 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 40a5828..be3c74f 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c @@ -52,6 +52,34 @@ static void (*saved_idle)(void); static struct powerdomain *mpu_pwrdm; +/* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ +#define NUM_OF_PERGPIOS 5 +static struct clk *gpio_fcks[NUM_OF_PERGPIOS]; +static struct clk *gpio_icks[NUM_OF_PERGPIOS]; + +/* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ +static void per_gpio_clk_enable(void) +{ + int i; + for (i = 1; i < NUM_OF_PERGPIOS + 1; i++) { + clk_enable(gpio_icks[i-1]); + clk_enable(gpio_fcks[i-1]); + } +} + +/* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ +static void per_gpio_clk_disable(void) +{ + int i; + for (i = 1; i < NUM_OF_PERGPIOS + 1; i++) { + clk_disable(gpio_fcks[i-1]); + clk_disable(gpio_icks[i-1]); + } +} + /* PRCM Interrupt Handler for wakeups */ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id) { @@ -168,8 +196,16 @@ static void omap_sram_idle(void) omap2_gpio_prepare_for_retention(); + /* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ + per_gpio_clk_disable(); + _omap_sram_idle(NULL, save_state); + /* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ + per_gpio_clk_enable(); + omap2_gpio_resume_after_retention(); } @@ -354,7 +390,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm) int __init omap3_pm_init(void) { struct power_state *pwrst; - int ret; + char clk_name[11]; + int ret, i; printk(KERN_ERR "Power Management for TI OMAP3.\n"); @@ -388,6 +425,15 @@ int __init omap3_pm_init(void) pm_idle = omap3_pm_idle; + /* XXX This is for gpio fclk hack. Will be removed as gpio driver + * handles fcks correctly */ + for (i = 1; i < NUM_OF_PERGPIOS + 1; i++) { + sprintf(clk_name, "gpio%d_fck", i + 1); + gpio_fcks[i-1] = clk_get(NULL, clk_name); + sprintf(clk_name, "gpio%d_ick", i + 1); + gpio_icks[i-1] = clk_get(NULL, clk_name); + } + err1: return ret; err2: -- 1.5.5