From patchwork Tue Jun 23 09:02:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 50201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8B7421575 for ; Tue, 23 Jun 2015 09:03:38 +0000 (UTC) Received: by wgfj7 with SMTP id j7sf1151151wgf.1 for ; Tue, 23 Jun 2015 02:03:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=SMwJTeFw3i/LBbniwHRxPsnjATn422gRuzdYwEGQntw=; b=lEk3DZnImKBAGSW9xTAezVShqAcRp9pru8JOZD1uD93SiTHZXdPdmstVU2KKZg5Jm8 mHq8vPvXvCpu6Ct3gH5sdC/E/9dJkCqXVoy0xJLvk8rvCfpMILVP/QItIcKWQS9bj0Ga RaU1MDJaDkMCCr4NEWzhsoiLSQ3oUaCLdTZE51B8JPVjl7K+FiHPTj/REfBnuimNfcjl oldN3nFgnsPIRNqunMSZuHDOvLJRFqmDNAUQDr1135SOeHaJAdXIW0TAQ7YNq98Bt3Ry XMN66LJlFFQi/S+fsQNk8GnPR0Xq/Z0/7Pb0nwydLykldY8KxgFR/k6KyEzjY53untfg Y5wQ== X-Gm-Message-State: ALoCoQlZ4krlkjjfcpHQdNDmf3BQam8Dectj4oFpkCk4Dj9pJvkKg9WDkKTYyTbBor1gKwwcHBjz X-Received: by 10.194.5.229 with SMTP id v5mr23160160wjv.0.1435050218078; Tue, 23 Jun 2015 02:03:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.133 with SMTP id y5ls20373laj.19.gmail; Tue, 23 Jun 2015 02:03:37 -0700 (PDT) X-Received: by 10.112.42.50 with SMTP id k18mr6783268lbl.76.1435050217916; Tue, 23 Jun 2015 02:03:37 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id h8si18767902laf.74.2015.06.23.02.03.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2015 02:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by lagi2 with SMTP id i2so2338902lag.2 for ; Tue, 23 Jun 2015 02:03:37 -0700 (PDT) X-Received: by 10.152.1.40 with SMTP id 8mr34798703laj.56.1435050217798; Tue, 23 Jun 2015 02:03:37 -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.112.108.230 with SMTP id hn6csp2928031lbb; Tue, 23 Jun 2015 02:03:36 -0700 (PDT) X-Received: by 10.68.235.38 with SMTP id uj6mr67462104pbc.57.1435050216048; Tue, 23 Jun 2015 02:03:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id al1si7329873pbc.137.2015.06.23.02.03.35 for ; Tue, 23 Jun 2015 02:03:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753663AbbFWJDe (ORCPT ); Tue, 23 Jun 2015 05:03:34 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:35570 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754569AbbFWJD2 (ORCPT ); Tue, 23 Jun 2015 05:03:28 -0400 Received: by pdbci14 with SMTP id ci14so3085851pdb.2 for ; Tue, 23 Jun 2015 02:03:27 -0700 (PDT) X-Received: by 10.70.52.103 with SMTP id s7mr66278547pdo.117.1435050207488; Tue, 23 Jun 2015 02:03:27 -0700 (PDT) Received: from localhost.localdomain ([107.6.117.179]) by mx.google.com with ESMTPSA id or7sm22506757pdb.9.2015.06.23.02.03.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jun 2015 02:03:26 -0700 (PDT) From: Jun Nie To: peter@hurleysoftware.com, linux@arm.linux.org.uk, Andrew.Jackson@arm.com, gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, shawn.guo@linaro.org Cc: jason.liu@linaro.org, wan.zhijun@zte.com.cn, Jun Nie Subject: [PATCH v11 4/5] uart: pl011: Improve LCRH register access decision Date: Tue, 23 Jun 2015 17:02:28 +0800 Message-Id: <1435050149-21153-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435050149-21153-1-git-send-email-jun.nie@linaro.org> References: <1435050149-21153-1-git-send-email-jun.nie@linaro.org> Sender: linux-serial-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-serial@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: jun.nie@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) 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-Post: , List-Help: , List-Archive: List-Unsubscribe: , Improve LCRH register access decision as ARM PL011 lcrh register serve as both TX and RX, while other SOC may implement TX and RX function with separated register. Signed-off-by: Jun Nie --- drivers/tty/serial/amba-pl011.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 5795b18..5e92d57 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -235,6 +235,11 @@ struct uart_amba_port { #endif }; +static bool is_implemented(struct uart_amba_port *uap, unsigned int reg) +{ + return uap->reg_lut[reg] != (u16)~0; +} + static unsigned int pl011_readw(struct uart_amba_port *uap, int index) { WARN_ON(index > REG_NR); @@ -1684,7 +1689,7 @@ static int pl011_hwinit(struct uart_port *port) static void pl011_write_lcr_h(struct uart_amba_port *uap, unsigned int lcr_h) { pl011_writew(uap, lcr_h, uap->lcrh_rx); - if (uap->lcrh_rx != uap->lcrh_tx) { + if (is_implemented(uap, REG_ST_LCRH_RX)) { int i; /* * Wait 10 PCLKs before writing LCRH_TX register, @@ -1812,7 +1817,7 @@ static void pl011_shutdown(struct uart_port *port) * disable break condition and fifos */ pl011_shutdown_channel(uap, uap->lcrh_rx); - if (uap->lcrh_rx != uap->lcrh_tx) + if (is_implemented(uap, REG_ST_LCRH_RX)) pl011_shutdown_channel(uap, uap->lcrh_tx); /*