From patchwork Wed Oct 24 11:15:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ohad Ben Cohen X-Patchwork-Id: 1637611 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 56A7EDF238 for ; Wed, 24 Oct 2012 11:15:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758242Ab2JXLPa (ORCPT ); Wed, 24 Oct 2012 07:15:30 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:54830 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599Ab2JXLP2 (ORCPT ); Wed, 24 Oct 2012 07:15:28 -0400 Received: by mail-ie0-f174.google.com with SMTP id k13so432868iea.19 for ; Wed, 24 Oct 2012 04:15:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:x-gm-message-state; bh=hw7OfqlTaY2tHL/jJKxft8TrLFi3suKJF7LD27/o8FY=; b=jiqXcChr/C4ILcO8PcigsKvxhX+mbVxSoviXoglnB3NOw/I+WFM3hrdIekDtL3mx2v LtxKGtfBE2+aDWgvGuoUhg2gqvjMY9ZDxzw/U6C6J2v14OdVeg43iCOm47kcb8E4n9m9 khwmdnkSkfOECauvmHUX+qvS1tZTfWs/EBImGtXFKBZclMBs19/kdHQ/yl+pLbkXCRRv D8T6ILuRqqPN4WIdn1KzqGngn/0Qf5jPriZ8Uz7e8PxRtSf+lDqye7x1sIPrsyHCkfwm dspck1KsMcNlzA7qjFplcoAXmaHxSeO5UpmuO2VlidfQ2RnW5c+2IHTFkQN5xph8OdlY GWTw== Received: by 10.50.57.169 with SMTP id j9mr517589igq.16.1351077327462; Wed, 24 Oct 2012 04:15:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.41.200 with HTTP; Wed, 24 Oct 2012 04:15:06 -0700 (PDT) X-Originating-IP: [93.172.255.235] In-Reply-To: <20121024015418.GC5605@atomide.com> References: <20121012155434.GO28061@n2100.arm.linux.org.uk> <20121012162452.GD30339@atomide.com> <20121016181038.GC15569@atomide.com> <20121016182642.GF15569@atomide.com> <507EA7DB.3070207@compulab.co.il> <20121019170759.GK4730@atomide.com> <20121024015418.GC5605@atomide.com> From: Ohad Ben-Cohen Date: Wed, 24 Oct 2012 13:15:06 +0200 Message-ID: Subject: Re: Errors at boot time from OMAP4430SDP (and a whinge about serial stuff) To: Tony Lindgren Cc: Igor Grinberg , Russell King - ARM Linux , linux-omap@vger.kernel.org, Santosh Shilimkar , "Cousson, Benoit" , Paul Walmsley , Kevin Hilman , Afzal Mohammed , =?ISO-8859-1?Q?P=E9ter_Ujfalusi?= X-Gm-Message-State: ALoCoQl1L3kGkrL+5eob0O5lulGXDsJKb/3KTk95Xx82ZC3vAeczIqXVtaBWTTdP35riVSLZVU3Q Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Wed, Oct 24, 2012 at 3:54 AM, Tony Lindgren wrote: > I don't think mach-davinci has wl12xx_board_init() available? > Maybe leave this out or define also also somewhere for mach-davinci? Yeah let's leave davinci out for now: From 665bcaa7ef0ed385cf1765f2d4503bf84aaf488a Mon Sep 17 00:00:00 2001 From: Ohad Ben-Cohen Date: Sun, 14 Oct 2012 20:16:01 +0200 Subject: [PATCH] ARM: OMAP: don't print any error when wl12xx isn't configured Stop intimidating users with scary wlan error messages in case wl12xx support wasn't even built. In addition, when wl12xx_set_platform_data() fails, don't bother registering wl12xx's fixed regulator device (on the relevant boards). While we're at it, extract the wlan init code to a dedicated function to make (the relevant boards') init code look a bit nicer. Compile tested only. Reported-by: Russell King Signed-off-by: Ohad Ben-Cohen --- arch/arm/mach-omap2/board-4430sdp.c | 7 +++--- arch/arm/mach-omap2/board-omap3evm.c | 6 ++--- arch/arm/mach-omap2/board-omap3pandora.c | 9 +++----- arch/arm/mach-omap2/board-omap4panda.c | 20 ++++++++++++----- arch/arm/mach-omap2/board-zoom-peripherals.c | 15 ++++++++----- arch/arm/mach-omap2/common-board-devices.c | 33 ++++++++++++++++++++++++++++ arch/arm/mach-omap2/common-board-devices.h | 2 ++ 7 files changed, 69 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 3669c12..bc48679 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c @@ -825,10 +825,11 @@ static void __init omap4_sdp4430_wifi_init(void) int ret; omap4_sdp4430_wifi_mux_init(); - omap4_sdp4430_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ); - ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data); + + ret = wl12xx_board_init(&omap4_sdp4430_wlan_data, GPIO_WIFI_IRQ); if (ret) - pr_err("Error setting wl12xx data: %d\n", ret); + return; + ret = platform_device_register(&omap_vwlan_device); if (ret) pr_err("Error registering wl12xx device: %d\n", ret); diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index b9b776b..8e3a075 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -636,10 +636,10 @@ static void __init omap3_evm_wl12xx_init(void) int ret; /* WL12xx WLAN Init */ - omap3evm_wlan_data.irq = gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO); - ret = wl12xx_set_platform_data(&omap3evm_wlan_data); + ret = wl12xx_board_init(&omap3evm_wlan_data, OMAP3EVM_WLAN_IRQ_GPIO); if (ret) - pr_err("error setting wl12xx data: %d\n", ret); + return; + ret = platform_device_register(&omap3evm_wlan_regulator); if (ret) pr_err("error registering wl12xx device: %d\n", ret); diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 00a1f4a..bfdc7aa 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c @@ -543,13 +543,10 @@ static void __init pandora_wl1251_init(void) if (ret < 0) goto fail; - pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); - if (pandora_wl1251_pdata.irq < 0) - goto fail_irq; - pandora_wl1251_pdata.use_eeprom = true; - ret = wl12xx_set_platform_data(&pandora_wl1251_pdata); - if (ret < 0) + + ret = wl12xx_board_init(&pandora_wl1251_pdata, PANDORA_WIFI_IRQ_GPIO); + if (ret) goto fail_irq; return; diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index bfcd397..f203cd9 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -486,24 +486,32 @@ static void omap4_panda_init_rev(void) } } +static void __init omap4_panda_wlan_init(void) +{ + int ret; + + ret = wl12xx_board_init(&omap_panda_wlan_data, GPIO_WIFI_IRQ); + if (ret) + return; + + ret = platform_device_register(&omap_vwlan_device); + if (ret) + pr_err("error registering wl12xx's fixed regulator: %d\n", ret); +} + static void __init omap4_panda_init(void) { int package = OMAP_PACKAGE_CBS; - int ret; if (omap_rev() == OMAP4430_REV_ES1_0) package = OMAP_PACKAGE_CBL; omap4_mux_init(board_mux, NULL, package); - omap_panda_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ); - ret = wl12xx_set_platform_data(&omap_panda_wlan_data); - if (ret) - pr_err("error setting wl12xx data: %d\n", ret); + omap4_panda_wlan_init(); omap4_panda_init_rev(); omap4_panda_i2c_init(); platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); - platform_device_register(&omap_vwlan_device); omap_serial_init(); omap_sdrc_init(NULL, NULL); omap4_twl6030_hsmmc_init(mmc); diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c index c166fe1..c81a2c7 100644 --- a/arch/arm/mach-omap2/board-zoom-peripherals.c +++ b/arch/arm/mach-omap2/board-zoom-peripherals.c @@ -286,19 +286,24 @@ static void enable_board_wakeup_source(void) OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); } -void __init zoom_peripherals_init(void) +static void __init zoom_wlan_init(void) { int ret; - omap_zoom_wlan_data.irq = gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO); - ret = wl12xx_set_platform_data(&omap_zoom_wlan_data); + ret = wl12xx_board_init(&omap_zoom_wlan_data, OMAP_ZOOM_WLAN_IRQ_GPIO); + if (ret) + return; + ret = platform_device_register(&omap_vwlan_device); if (ret) - pr_err("error setting wl12xx data: %d\n", ret); + pr_err("error registering wl12xx's fixed regulator: %d\n", ret); +} +void __init zoom_peripherals_init(void) +{ omap_hsmmc_init(mmc); + zoom_wlan_init(); omap_i2c_init(); - platform_device_register(&omap_vwlan_device); usb_musb_init(NULL); enable_board_wakeup_source(); omap_serial_init(); diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c index 48daac2..02351e9 100644 --- a/arch/arm/mach-omap2/common-board-devices.c +++ b/arch/arm/mach-omap2/common-board-devices.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -141,3 +142,35 @@ void __init omap_nand_flash_init(int options, struct mtd_partition *parts, { } #endif + +#ifdef CONFIG_WL12XX_PLATFORM_DATA +int __init wl12xx_board_init(struct wl12xx_platform_data *wlan_data, int gpio) +{ + int ret; + + wlan_data->irq = gpio_to_irq(gpio); + if (wlan_data->irq < 0) { + ret = wlan_data->irq; + pr_err("wl12xx: gpio_to_irq(%d) failed: %d\n", gpio, ret); + return ret; + } + + ret = wl12xx_set_platform_data(wlan_data); + /* bail out silently in case wl12xx isn't configured */ + if (ret == -ENOSYS) + return ret; + + /* bail out verbosely on any other error */ + if (ret) { + pr_err("error setting wl12xx data: %d\n", ret); + return ret; + } + + return 0; +} +#else /* !CONFIG_WL12XX_PLATFORM_DATA */ +int __init wl12xx_board_init(struct wl12xx_platform_data *wlan_data, int gpio) +{ + return 0; +} +#endif diff --git a/arch/arm/mach-omap2/common-board-devices.h b/arch/arm/mach-omap2/common-board-devices.h index a0b4a428..0e7398f 100644 --- a/arch/arm/mach-omap2/common-board-devices.h +++ b/arch/arm/mach-omap2/common-board-devices.h @@ -7,9 +7,11 @@ struct mtd_partition; struct ads7846_platform_data; +struct wl12xx_platform_data; void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce, struct ads7846_platform_data *board_pdata); void omap_nand_flash_init(int opts, struct mtd_partition *parts, int n_parts); +int wl12xx_board_init(struct wl12xx_platform_data *wlan_data, int gpio); #endif /* __OMAP_COMMON_BOARD_DEVICES__ */