From patchwork Tue Jun 23 10:09:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 50212 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 56A45216E1 for ; Tue, 23 Jun 2015 10:10:35 +0000 (UTC) Received: by wguu7 with SMTP id u7sf1636729wgu.0 for ; Tue, 23 Jun 2015 03:10:34 -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=E+phyQSj6JZxV5Sme+JvPCb+HUVRu4k+pefgBit9WFU=; b=VI3dW6GP2TiE9ndmjMazAVz3kClpH/tHlC/WNUiLAFqOuWCDrHliraJawMAaML5Vqn GZLeJaS9ZMnFzDwVU0XlLuNiRUdxcr9x+wCg+Yq5dKW8OXes9MfmQLOzwGdGYrO7meqj N9JE8tZdmCrFleuFeVr/Jqll/R2OgPEhAJO7KHsGs1toqLc1762C3HhRN4YSFIjwcxrd zYKPzuIAdcLVIozqwbkihuDrADiT6qLsPOpnVwNlGqhZ3XKlpbOe1Z60QIhKU9u0szlz 74tnKvXnLUJSOd/TlBIneNZ5uCS2YZX3snjBRbZg8BN62gkCYkmSpvfjoybfM6W7sQQk SfUw== X-Gm-Message-State: ALoCoQlJ58h+OXmInyH4A+ICc7YHn/TQVZrI1Yt1fisZdsy2cMzneL/bmJyMczHTJ1vA1oHn1z4g X-Received: by 10.112.53.102 with SMTP id a6mr31623949lbp.16.1435054234675; Tue, 23 Jun 2015 03:10:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.39 with SMTP id dd7ls26522lac.60.gmail; Tue, 23 Jun 2015 03:10:34 -0700 (PDT) X-Received: by 10.112.10.166 with SMTP id j6mr20686757lbb.120.1435054234533; Tue, 23 Jun 2015 03:10:34 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id yi7si18922012lbb.14.2015.06.23.03.10.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2015 03:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lagx9 with SMTP id x9so3355641lag.1 for ; Tue, 23 Jun 2015 03:10:34 -0700 (PDT) X-Received: by 10.152.22.99 with SMTP id c3mr35168318laf.32.1435054234107; Tue, 23 Jun 2015 03:10:34 -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 hn6csp2963399lbb; Tue, 23 Jun 2015 03:10:32 -0700 (PDT) X-Received: by 10.68.138.230 with SMTP id qt6mr68521974pbb.160.1435054231972; Tue, 23 Jun 2015 03:10:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si33982278pdn.89.2015.06.23.03.10.31 for ; Tue, 23 Jun 2015 03:10:31 -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 S1753968AbbFWKKa (ORCPT ); Tue, 23 Jun 2015 06:10:30 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33671 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753865AbbFWKK3 (ORCPT ); Tue, 23 Jun 2015 06:10:29 -0400 Received: by padev16 with SMTP id ev16so4134954pad.0 for ; Tue, 23 Jun 2015 03:10:27 -0700 (PDT) X-Received: by 10.70.90.133 with SMTP id bw5mr68016494pdb.85.1435054227127; Tue, 23 Jun 2015 03:10:27 -0700 (PDT) Received: from localhost.localdomain ([107.6.117.178]) by mx.google.com with ESMTPSA id cq5sm4063415pad.11.2015.06.23.03.10.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jun 2015 03:10:25 -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 v12 4/5] uart: pl011: Improve LCRH register access decision Date: Tue, 23 Jun 2015 18:09:34 +0800 Message-Id: <1435054175-7473-5-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1435054175-7473-1-git-send-email-jun.nie@linaro.org> References: <1435054175-7473-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.45 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 6a16006..fd8967d 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); /*