From patchwork Tue Apr 23 07:26:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2475931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 4F3F0DF2E5 for ; Tue, 23 Apr 2013 07:27:15 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUXd5-0001Ps-Dd; Tue, 23 Apr 2013 07:27:07 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUXd2-00018Y-Pf; Tue, 23 Apr 2013 07:27:04 +0000 Received: from mail-ie0-x233.google.com ([2607:f8b0:4001:c03::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UUXcz-000188-L3 for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2013 07:27:02 +0000 Received: by mail-ie0-f179.google.com with SMTP id 16so340083iea.10 for ; Tue, 23 Apr 2013 00:26:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=YcZl8BdK52z4svfWGbRB6lSpbs3a9KjpbIqEGUrAXHE=; b=MX9VZoHdiia+aDOOXHH7gvhGue8KbSbyXpCov9xIgWUI1flLZhGeJvOFHjwuE5e8ao iGHBrK9po36exjpDP5/ihmNaMLrl/4d8QcM1HDCyPOyLHAc1jORN6xYt4lHbufxYuJP2 d/KAqV4ASx9VIp5xhBfeoyR2evLbylJtCgRUzEHDgmBzKWeDK8YhJVqQKIgeZyK74Fg7 Up/46byXSlJjnNfoUn6kWLwPBpDp19hJEAoQmghXa1mEMcjSOjkMMzvFq1U1Dr5xWDMz WT+ttP5fN/G4CniAfIJRYJ4VPXY+jW9mGhM3N5pe5IvkCH3/JagDdhuOT24cSUd4zQGA Gk4Q== MIME-Version: 1.0 X-Received: by 10.50.87.71 with SMTP id v7mr17594339igz.96.1366702016539; Tue, 23 Apr 2013 00:26:56 -0700 (PDT) Received: by 10.42.109.209 with HTTP; Tue, 23 Apr 2013 00:26:56 -0700 (PDT) In-Reply-To: References: <5172B398.7060706@newsguy.com> <517466F6.3000003@newsguy.com> Date: Tue, 23 Apr 2013 09:26:56 +0200 Message-ID: Subject: Re: gpio-pxa initcall level change and machine init breakage From: Linus Walleij To: Haojian Zhuang X-Gm-Message-State: ALoCoQkEK1cvMyZZzIaVmYq7DL5ljdM7u3Q985NFwtu4gyz7LQ3bE+D3JSTU2yTxpDq8MSkvGS7v X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130423_032701_761227_DC11D387 X-CRM114-Status: GOOD ( 18.22 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Robert Jarzmik , Mike Dunn , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Mon, Apr 22, 2013 at 2:58 AM, Haojian Zhuang wrote: > On 22 April 2013 06:23, Mike Dunn wrote: >> Will the big guy see this? Only posted to linux-arm-kernel ML. >> >> Thanks Haojian, >> Mike I guess Haojian is referring to me, not Torvalds ... > Sorry, I forgot to loop him in. > > Linus, > Should I send the revert commit to you? Or will you revert it directly? How hard is it to fix the real problem? I'm looking at arch/arm/mach-pxa/palmtreo.c, would something like this solve the problem: From 5acf99a576f563d48ca5d25b9e5a1bcdd09331eb Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Tue, 23 Apr 2013 09:24:43 +0200 Subject: [PATCH] ARM: pxa: set up Treo GPIOs using device initcall This augments the Treo setup to grab LCD GPIOs at device_initcall() level instead of at init_machine() time, and propagates any returned errors so that deferred probe will work. Signed-off-by: Linus Walleij --- arch/arm/mach-pxa/palmtreo.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) -- 1.7.11.3 (Tell me if gmail screws up the whitespace and I'll send it with git-send-email ...) Yours, Linus Walleij diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c index d82a50b..669b609 100644 --- a/arch/arm/mach-pxa/palmtreo.c +++ b/arch/arm/mach-pxa/palmtreo.c @@ -455,16 +455,20 @@ static void __init palmphone_common_init(void) } #ifdef CONFIG_MACH_TREO680 -void __init treo680_gpio_init(void) +static int __init treo680_gpio_init(void) { unsigned int gpio; + int ret; /* drive all three lcd gpios high initially */ const unsigned long lcd_flags = GPIOF_INIT_HIGH | GPIOF_DIR_OUT; /* * LCD GPIO initialization... + * only run this on the Treo680 */ + if (!machine_is_treo680()) + return 0; /* * This is likely the power to the lcd. Toggling it low/high appears to @@ -474,8 +478,9 @@ void __init treo680_gpio_init(void) * treo680 configures it as gpio. */ gpio = GPIO_NR_TREO680_LCD_POWER; - if (gpio_request_one(gpio, lcd_flags, "LCD power") < 0) - goto fail; + ret = gpio_request_one(gpio, lcd_flags, "LCD power"); + if (ret < 0) + goto fail_lcd_power; /* * These two are called "enables", for lack of a better understanding. @@ -486,28 +491,33 @@ void __init treo680_gpio_init(void) * revisited. */ gpio = GPIO_NR_TREO680_LCD_EN; - if (gpio_request_one(gpio, lcd_flags, "LCD enable") < 0) - goto fail; + ret = gpio_request_one(gpio, lcd_flags, "LCD enable"); + if (ret < 0) + goto fail_lcd_en; gpio = GPIO_NR_TREO680_LCD_EN_N; - if (gpio_request_one(gpio, lcd_flags, "LCD enable_n") < 0) - goto fail; + ret = gpio_request_one(gpio, lcd_flags, "LCD enable_n"); + if (ret < 0) + goto fail_lcd_en_n; /* driving this low turns LCD on */ gpio_set_value(GPIO_NR_TREO680_LCD_EN_N, 0); - return; - fail: - pr_err("gpio %d initialization failed\n", gpio); - gpio_free(GPIO_NR_TREO680_LCD_POWER); + return 0; + +fail_lcd_en_n: gpio_free(GPIO_NR_TREO680_LCD_EN); - gpio_free(GPIO_NR_TREO680_LCD_EN_N); +fail_lcd_en: + gpio_free(GPIO_NR_TREO680_LCD_POWER); +fail_lcd_power: + pr_err("gpio %d initialization failed\n", gpio); + return ret; } +device_initcall(treo680_gpio_init); static void __init treo680_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); palmphone_common_init(); - treo680_gpio_init(); palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, GPIO_NR_TREO680_SD_POWER, 0); treo680_docg4_flash_init();