From patchwork Fri Jul 31 07:49:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 51743 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by patches.linaro.org (Postfix) with ESMTPS id B6FE722D9C for ; Fri, 31 Jul 2015 07:50:19 +0000 (UTC) Received: by lbcjf8 with SMTP id jf8sf21467798lbc.0 for ; Fri, 31 Jul 2015 00:50:18 -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=OHUDhVpNecyMo3FR8MH4Qjfib3GBnfJqwmUAxDY4V+8=; b=Oo8Ke0TXWvMqy0BW9ayQ+amH+3kFYrf+gm5HX8aEiFviocuU57VV0pwu98iJiy0k3d Yt4pm8iqKLn2cV5JCL0kx/P3cA17IikhvlDJf8cdhWYu6nX2GKi32JGFMzy5lxz0udsJ GEb0zTZ9CmOyY17ZLVsHPMyENzTGNxWKtBQlG2P82q3G7rsrGPdIvuKtA6GxmB93Zi40 pfjw2ECSE/4BlclDUxX894YItOA5dbVWIdvLtNvmpciynDd2FM0rDFr+X9pfBAoXClVV ngmdak6RvzAspkoNHztaWSOg7nN6tVZCco289FY7vthLW7WbBheZDBlATA2uEkiL7tvx tstw== X-Gm-Message-State: ALoCoQl2J5FoXSawvgCMDeVJTLCLfVjpNAmRlDURcxrQgu+oK61EXAdtvvKdsammjx7ZUrdu/16K X-Received: by 10.112.13.200 with SMTP id j8mr518282lbc.14.1438329018694; Fri, 31 Jul 2015 00:50:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.101 with SMTP id s5ls282085lag.108.gmail; Fri, 31 Jul 2015 00:50:18 -0700 (PDT) X-Received: by 10.112.219.200 with SMTP id pq8mr1412458lbc.110.1438329018420; Fri, 31 Jul 2015 00:50:18 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id g1si2888363lab.70.2015.07.31.00.50.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 Jul 2015 00:50:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by labiq1 with SMTP id iq1so4359533lab.3 for ; Fri, 31 Jul 2015 00:50:18 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr1419101lal.35.1438329018328; Fri, 31 Jul 2015 00:50:18 -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.7.198 with SMTP id l6csp202188lba; Fri, 31 Jul 2015 00:50:17 -0700 (PDT) X-Received: by 10.66.121.74 with SMTP id li10mr3925783pab.73.1438329016443; Fri, 31 Jul 2015 00:50:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va7si8512425pac.57.2015.07.31.00.50.15; Fri, 31 Jul 2015 00:50:16 -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 S1750957AbbGaHuP (ORCPT + 1 other); Fri, 31 Jul 2015 03:50:15 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36279 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbbGaHuO (ORCPT ); Fri, 31 Jul 2015 03:50:14 -0400 Received: by pdjr16 with SMTP id r16so39327317pdj.3 for ; Fri, 31 Jul 2015 00:50:13 -0700 (PDT) X-Received: by 10.70.87.195 with SMTP id ba3mr4091662pdb.154.1438329013606; Fri, 31 Jul 2015 00:50:13 -0700 (PDT) Received: from localhost.localdomain ([107.6.117.178]) by smtp.gmail.com with ESMTPSA id b10sm5925694pdo.84.2015.07.31.00.50.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 31 Jul 2015 00:50:12 -0700 (PDT) From: Jun Nie To: peter@hurleysoftware.com, linux@arm.linux.org.uk, andre.przywara@arm.com, 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 v13 4/5] uart: pl011: Improve LCRH register access decision Date: Fri, 31 Jul 2015 15:49:18 +0800 Message-Id: <1438328959-16177-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1438328959-16177-1-git-send-email-jun.nie@linaro.org> References: <1438328959-16177-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.51 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 e1f3bd5..017443d 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -249,6 +249,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); @@ -1649,7 +1654,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, @@ -1784,7 +1789,7 @@ static void pl011_disable_uart(struct uart_amba_port *uap) * 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); }