From patchwork Tue Jul 13 14:59:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ye janboe X-Patchwork-Id: 111807 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6DFCr1e012130 for ; Tue, 13 Jul 2010 15:12:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756905Ab0GMPMv (ORCPT ); Tue, 13 Jul 2010 11:12:51 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:55314 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756850Ab0GMPMu (ORCPT ); Tue, 13 Jul 2010 11:12:50 -0400 Received: by pzk26 with SMTP id 26so1352297pzk.19 for ; Tue, 13 Jul 2010 08:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=I9BghZ5NxIao3U03qorqrF/RD1Zg++PhgBtar613p4w=; b=w40Sa6yPgFqVyLsYyF/5z4GEGeUOhhqPFT2aQ5f409N65iLqLNynlTK+IrrYo3HOUn DqzNtqzlzUDb3T5yaqNdhGPtdi14BcKCzLdAUVS5LPpznOjpZRjVhExus+DG9hEqv9Fj 2wCNKUQZqn6Js8QCvrEn6TgA+X7fppHljFLAI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=MVvAB2NgiKnmA2PtIfd3oJLVOb5I4EzKLfkcN7jDxB8LI3YqElpbz5qDEegMEvN8yY a2y1bq6G4Z71BdaQPxrKfB3PhUaQFEovRMiPk7t5PdDoe7op3hx9rrZu5/xX8zD891lt KT4DCkDkGXCvJf06lnBSHUaJnXGyuLOI0cq9M= Received: by 10.142.215.7 with SMTP id n7mr19514887wfg.63.1279033207411; Tue, 13 Jul 2010 08:00:07 -0700 (PDT) Received: from localhost.localdomain ([222.130.218.212]) by mx.google.com with ESMTPS id n2sm6246980wfl.13.2010.07.13.08.00.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 13 Jul 2010 08:00:06 -0700 (PDT) Date: Tue, 13 Jul 2010 22:59:53 +0800 From: janboe To: khilman@deeprootsystems.com Cc: linux-omap@vger.kernel.org Subject: [PATCH] omap: gpio: omap3_gpio_pads_init current only works for omap3 Message-ID: <20100713145953.GA17852@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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.3 (demeter.kernel.org [140.211.167.41]); Tue, 13 Jul 2010 15:12:53 +0000 (UTC) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 0838c72..bae2649 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -379,6 +379,62 @@ struct gpio_pad { static struct gpio_pad *gpio_pads; static u16 gpio_pad_map[OMAP34XX_GPIO_AMT]; + +/* + * Following pad init code in addition to the context / restore hooks are + * needed to fix glitches in GPIO outputs during off-mode. See OMAP3 + * errate section 1.158 + */ +static int __init omap3_gpio_pads_init(void) +{ + int i, j, min, max, gpio_amt; + u16 offset; + + gpio_amt = 0; + + for (i = 0; i < ARRAY_SIZE(gpio_pads_config); i++) { + min = gpio_pads_config[i].min; + max = gpio_pads_config[i].max; + offset = gpio_pads_config[i].offset; + + for (j = min; j <= max; j++) { + /* + * Check if pad has been configured as GPIO + * (mux mode 4.) + */ + if ((omap_ctrl_readw(offset) & 0x7) == 4) { + gpio_pad_map[j] = offset; + if (j > 31) + gpio_amt++; + } + offset += 2; + } + } + gpio_pads = kmalloc(sizeof(struct gpio_pad) * (gpio_amt + 1), + GFP_KERNEL); + + if (gpio_pads == NULL) { + printk(KERN_ERR "FATAL: Failed to allocate gpio_pads\n"); + return -ENOMEM; + } + + gpio_amt = 0; + for (i = 0; i < OMAP34XX_GPIO_AMT; i++) { + /* + * First module (gpio 0...31) is ignored as it is + * in wakeup domain and does not need special + * handling during off mode. + */ + if (gpio_pad_map[i] && i > 31) { + gpio_pads[gpio_amt].gpio = i; + gpio_pads[gpio_amt].offset = gpio_pad_map[i]; + gpio_amt++; + } + } + gpio_pads[gpio_amt].gpio = -1; + return 0; +} +late_initcall(omap3_gpio_pads_init); #endif #ifdef CONFIG_ARCH_OMAP4 @@ -1750,62 +1806,6 @@ static struct clk * gpio5_fck; #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4) static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS]; - -/* - * Following pad init code in addition to the context / restore hooks are - * needed to fix glitches in GPIO outputs during off-mode. See OMAP3 - * errate section 1.158 - */ -static int __init omap3_gpio_pads_init(void) -{ - int i, j, min, max, gpio_amt; - u16 offset; - - gpio_amt = 0; - - for (i = 0; i < ARRAY_SIZE(gpio_pads_config); i++) { - min = gpio_pads_config[i].min; - max = gpio_pads_config[i].max; - offset = gpio_pads_config[i].offset; - - for (j = min; j <= max; j++) { - /* - * Check if pad has been configured as GPIO - * (mux mode 4.) - */ - if ((omap_ctrl_readw(offset) & 0x7) == 4) { - gpio_pad_map[j] = offset; - if (j > 31) - gpio_amt++; - } - offset += 2; - } - } - gpio_pads = kmalloc(sizeof(struct gpio_pad) * (gpio_amt + 1), - GFP_KERNEL); - - if (gpio_pads == NULL) { - printk(KERN_ERR "FATAL: Failed to allocate gpio_pads\n"); - return -ENOMEM; - } - - gpio_amt = 0; - for (i = 0; i < OMAP34XX_GPIO_AMT; i++) { - /* - * First module (gpio 0...31) is ignored as it is - * in wakeup domain and does not need special - * handling during off mode. - */ - if (gpio_pad_map[i] && i > 31) { - gpio_pads[gpio_amt].gpio = i; - gpio_pads[gpio_amt].offset = gpio_pad_map[i]; - gpio_amt++; - } - } - gpio_pads[gpio_amt].gpio = -1; - return 0; -} -late_initcall(omap3_gpio_pads_init); #endif static void __init omap_gpio_show_rev(void)