From patchwork Tue Dec 1 11:02:56 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 63913 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB1B8CrR009653 for ; Tue, 1 Dec 2009 11:08:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753474AbZLALHu (ORCPT ); Tue, 1 Dec 2009 06:07:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753181AbZLALHu (ORCPT ); Tue, 1 Dec 2009 06:07:50 -0500 Received: from smtp.nokia.com ([192.100.122.233]:59455 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753462AbZLALHt (ORCPT ); Tue, 1 Dec 2009 06:07:49 -0500 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nB1B7d5V011074; Tue, 1 Dec 2009 13:07:40 +0200 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 1 Dec 2009 13:07:36 +0200 Received: from mgw-sa01.ext.nokia.com ([147.243.1.47]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 1 Dec 2009 13:07:36 +0200 Received: from esdhcp04058.research.nokia.com (esdhcp04137.research.nokia.com [172.21.41.37]) by mgw-sa01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with SMTP id nB1B7WOI025034; Tue, 1 Dec 2009 13:07:33 +0200 Date: Tue, 1 Dec 2009 13:02:56 +0200 From: Mika Westerberg To: ext Tony Lindgren Cc: Peter Barada , Grant Likely , "linux-omap@vger.kernel.org" , Olof Johansson Subject: Re: Preventing OMAP3 serial driver to take control of all UARTs Message-ID: <20091201110256.GB17675@esdhcp04058.research.nokia.com> References: <20091130084651.GA17675@esdhcp04058.research.nokia.com> <1259599010.4649.51.camel@thunk> <20091130194031.GV4348@atomide.com> <1259613066.4649.127.camel@thunk> <20091130210957.GY4348@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091130210957.GY4348@atomide.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-OriginalArrivalTime: 01 Dec 2009 11:07:36.0495 (UTC) FILETIME=[7D27D3F0:01CA7276] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 2e17b57..fe46560 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -631,24 +631,55 @@ void __init omap_serial_early_init(void) } } +/** + * omap_serial_init_port() - initialize single serial port + * @port: serial port number (0-3) + * + * This function initialies serial driver for given @port only. + * Platforms can call this function instead of omap_serial_init() + * if they don't plan to use all available UARTs as serial ports. + * + * Don't mix calls to omap_serial_init_port() and omap_serial_init(), + * use only one of the two. + */ +void __init omap_serial_init_port(int port) +{ + struct omap_uart_state *uart; + struct platform_device *pdev; + struct device *dev; + + BUG_ON(port < 0); + BUG_ON(port >= ARRAY_SIZE(omap_uart)); + + uart = &omap_uart[port]; + pdev = &uart->pdev; + dev = &pdev->dev; + + omap_uart_reset(uart); + omap_uart_idle_init(uart); + + if (WARN_ON(platform_device_register(pdev))) + return; + + if ((cpu_is_omap34xx() && uart->padconf) || + (uart->wk_en && uart->wk_mask)) { + device_init_wakeup(dev, true); + DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); + } +} + +/** + * omap_serial_init() - intialize all supported serial ports + * + * Initializes all available UARTs as serial ports. Platforms + * can call this function when they want to have default behaviour + * for serial ports (e.g initialize them all as serial ports). + */ void __init omap_serial_init(void) { int i; for (i = 0; i < ARRAY_SIZE(omap_uart); i++) { - struct omap_uart_state *uart = &omap_uart[i]; - struct platform_device *pdev = &uart->pdev; - struct device *dev = &pdev->dev; - - omap_uart_reset(uart); - omap_uart_idle_init(uart); - - if (WARN_ON(platform_device_register(pdev))) - continue; - if ((cpu_is_omap34xx() && uart->padconf) || - (uart->wk_en && uart->wk_mask)) { - device_init_wakeup(dev, true); - DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); - } + omap_serial_init_port(i); } } diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h index 9951345..f5a4a92 100644 --- a/arch/arm/plat-omap/include/plat/serial.h +++ b/arch/arm/plat-omap/include/plat/serial.h @@ -53,6 +53,7 @@ #ifndef __ASSEMBLER__ extern void __init omap_serial_early_init(void); extern void omap_serial_init(void); +extern void omap_serial_init_port(int port); extern int omap_uart_can_sleep(void); extern void omap_uart_check_wakeup(void); extern void omap_uart_prepare_suspend(void);