From patchwork Fri Mar 21 10:21:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 26802 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87976203AB for ; Fri, 21 Mar 2014 10:23:50 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf7474971iec.0 for ; Fri, 21 Mar 2014 03:23:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=bHUlRNiKNAtX+rfs1nTN9ofTxuGrkTU5YhtkorS1JbY=; b=QMOo1pbicjL6U9hD/qciysdd6XVU0helCq6e3Xr+yJ6wxSS/OIrflNu0xlzN+ssKhF n0kACVRFB8t8wcaXLEEprwxAVkZ5BoH/IJRFlqVv0UHQbdn6jHO31JGj3t8OaIf26RAz JjGB130c4E/9dilP/TDB8hzXYgYdebzRrjStuXJvg/Oqrz+4PYZx0sdC61jvFI0r2Jtv TvEiKUOHxsUxiv+IeVrveLmDoV44QbU+MhbTWFYxVOzt134fWQoHC162n3qafTTaTSiH pbBpxjmw+FrmTJE5fPF0VoG1T0KciRLSWFeNhLltKkDu8RdkL0qSzxdqQYuwOdAfCorW 4nbg== X-Gm-Message-State: ALoCoQkHoECMjY78jb/8uib2c2G6wZUaUmDtXI/6N9yqbPJSkx95vr06wPKOMVtQ9tAwjBCXLCED X-Received: by 10.182.17.69 with SMTP id m5mr17054916obd.6.1395397429944; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.47.50 with SMTP id l47ls628586qga.49.gmail; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) X-Received: by 10.220.164.80 with SMTP id d16mr36409266vcy.15.1395397429786; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) Received: from mail-ve0-f181.google.com (mail-ve0-f181.google.com [209.85.128.181]) by mx.google.com with ESMTPS id yv18si1034741vcb.14.2014.03.21.03.23.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Mar 2014 03:23:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.181; Received: by mail-ve0-f181.google.com with SMTP id oy12so2348261veb.12 for ; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) X-Received: by 10.58.165.68 with SMTP id yw4mr37609569veb.17.1395397429696; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp19771vck; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) X-Received: by 10.140.51.161 with SMTP id u30mr36580826qga.69.1395397429224; Fri, 21 Mar 2014 03:23:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id m34si2790177qge.138.2014.03.21.03.23.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 21 Mar 2014 03:23:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQwa2-0000n5-KG; Fri, 21 Mar 2014 10:21:38 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQwa1-0000n0-EX for xen-devel@lists.xen.org; Fri, 21 Mar 2014 10:21:37 +0000 Received: from [85.158.143.35:36005] by server-1.bemta-4.messagelabs.com id 2D/57-09853-0B21C235; Fri, 21 Mar 2014 10:21:36 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-13.tower-21.messagelabs.com!1395397295!3740371!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4935 invoked from network); 21 Mar 2014 10:21:36 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-13.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 21 Mar 2014 10:21:36 -0000 X-IronPort-AV: E=Sophos;i="4.97,703,1389744000"; d="scan'208";a="112215693" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 21 Mar 2014 10:21:35 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Fri, 21 Mar 2014 06:21:34 -0400 Received: from drall.uk.xensource.com ([10.80.16.71] helo=drall.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WQwZx-0003UE-RT; Fri, 21 Mar 2014 10:21:33 +0000 From: Ian Campbell To: , Date: Fri, 21 Mar 2014 10:21:33 +0000 Message-ID: <1395397293-23286-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395335099.3104.41.camel@kazak.uk.xensource.com> References: <1395335099.3104.41.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: xen-devel@lists.xen.org, julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH v2] ns16550: make some initialisation common X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Should avoid accidents like forgetting to init lsr_mask for DT devices in the future. Signed-off-by: Ian Campbell Acked-by: Julien Grall Reviewed-by: Jan Beulich Acked-by: Keir Fraser --- v2: remember to cc xen-devel... Depends on "ns16550: setup default lsr_mask for DT systems too" --- xen/drivers/char/ns16550.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 2dd32b2..44e13b7 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -1076,6 +1076,21 @@ static void __init ns16550_parse_port_config( serial_register_uart(uart - ns16550_com, &ns16550_driver, uart); } +static void ns16550_init_common(struct ns16550 *uart) +{ + uart->clock_hz = UART_CLOCK_HZ; + +#ifdef HAS_PCI + uart->enable_ro = 0; +#endif + + /* Default is no transmit FIFO. */ + uart->fifo_size = 1; + + /* Default lsr_mask = UART_LSR_THRE */ + uart->lsr_mask = UART_LSR_THRE; +} + void __init ns16550_init(int index, struct ns16550_defaults *defaults) { struct ns16550 *uart; @@ -1085,10 +1100,11 @@ void __init ns16550_init(int index, struct ns16550_defaults *defaults) uart = &ns16550_com[index]; + ns16550_init_common(uart); + uart->baud = (defaults->baud ? : console_has((index == 0) ? "com1" : "com2") ? BAUD_AUTO : 0); - uart->clock_hz = UART_CLOCK_HZ; uart->data_bits = defaults->data_bits; uart->parity = parse_parity_char(defaults->parity); uart->stop_bits = defaults->stop_bits; @@ -1098,16 +1114,6 @@ void __init ns16550_init(int index, struct ns16550_defaults *defaults) uart->reg_width = 1; uart->reg_shift = 0; -#ifdef HAS_PCI - uart->enable_ro = 0; -#endif - - /* Default is no transmit FIFO. */ - uart->fifo_size = 1; - - /* Default lsr_mask = UART_LSR_THRE */ - uart->lsr_mask = UART_LSR_THRE; - ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2); } @@ -1122,15 +1128,12 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev, uart = &ns16550_com[0]; + ns16550_init_common(uart); + uart->baud = BAUD_AUTO; - uart->clock_hz = UART_CLOCK_HZ; uart->data_bits = 8; uart->parity = UART_PARITY_NONE; uart->stop_bits = 1; - /* Default is no transmit FIFO. */ - uart->fifo_size = 1; - /* Default lsr_mask = UART_LSR_THRE */ - uart->lsr_mask = UART_LSR_THRE; res = dt_device_get_address(dev, 0, &uart->io_base, &io_size); if ( res )