From patchwork Wed Mar 26 11:55:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27112 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3F71F20369 for ; Wed, 26 Mar 2014 11:57:42 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf4606942yha.11 for ; Wed, 26 Mar 2014 04:57:41 -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=YXY2va5y0TRNHDNR3pkVWJwWVurtvReooc54Aufecas=; b=a8QMJBg670VBgWueIeuDB9jz8fR9UTC62iACuVam+XIq7Bwh0PGlR/xJSFSJqoIKTM y0gtd+nw4Yk3X2hOdlT1oIGju49opxkL3Tv9+VdMrUGH04r0jTtkalZjr5kvkxQ8oE+Y e9uFqDpcxdjw43VcjpRUTL+lj7gWDOQmkHzACOEmH8jftcM4sWBSOluw8N8o2TJoHnqC 2/QgkOUBo5YN4AHF8+09jE/6KA7KUzo15QoySh3PacpTg2ebwz9PSQYbT/NEI02p4t9X mrlZQ9zbSwXgU+c/cwfwjCcm9aT0oZTvGX3DZ0TQdsfxi51H2PwcQ2ZPU/VB57zpx4Nh spFw== X-Gm-Message-State: ALoCoQnSZQX6MXh3YYS/6O/lAeoiUextg/bSac4rEIWWRz4kLCaaW3rnc7etJq6KVCRgJjHSptLf X-Received: by 10.58.155.3 with SMTP id vs3mr22266768veb.16.1395835061916; Wed, 26 Mar 2014 04:57:41 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.102.184 with SMTP id w53ls612672qge.45.gmail; Wed, 26 Mar 2014 04:57:41 -0700 (PDT) X-Received: by 10.58.133.15 with SMTP id oy15mr58251637veb.19.1395835061819; Wed, 26 Mar 2014 04:57:41 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id o6si4394387vcn.129.2014.03.26.04.57.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Mar 2014 04:57:41 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id pa12so2185666veb.15 for ; Wed, 26 Mar 2014 04:57:41 -0700 (PDT) X-Received: by 10.53.1.69 with SMTP id be5mr9804671vdd.27.1395835061740; Wed, 26 Mar 2014 04:57:41 -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 i9csp40120vck; Wed, 26 Mar 2014 04:57:41 -0700 (PDT) X-Received: by 10.224.36.18 with SMTP id r18mr21785153qad.74.1395835060919; Wed, 26 Mar 2014 04:57:40 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ik4si8666372qab.269.2014.03.26.04.57.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Mar 2014 04:57:40 -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 1WSmR6-0004kb-OA; Wed, 26 Mar 2014 11:56:00 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WSmR5-0004kL-38 for xen-devel@lists.xen.org; Wed, 26 Mar 2014 11:55:59 +0000 Received: from [85.158.143.35:37978] by server-3.bemta-4.messagelabs.com id 9A/D3-13602-E40C2335; Wed, 26 Mar 2014 11:55:58 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1395834956!988549!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 26506 invoked from network); 26 Mar 2014 11:55:57 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 26 Mar 2014 11:55:57 -0000 X-IronPort-AV: E=Sophos;i="4.97,735,1389744000"; d="scan'208";a="113693626" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 26 Mar 2014 11:55:56 +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; Wed, 26 Mar 2014 07:55:55 -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 1WSmR1-0006Z9-GG; Wed, 26 Mar 2014 11:55:55 +0000 From: Ian Campbell To: Date: Wed, 26 Mar 2014 11:55:55 +0000 Message-ID: <1395834955-9289-2-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395834922.4928.0.camel@kazak.uk.xensource.com> References: <1395834922.4928.0.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH 2/2] 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.170 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 Acked-by: Keir Fraser Reviewed-by: Jan Beulich --- 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 )