From patchwork Wed Sep 30 12:26:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T. Ivanov" X-Patchwork-Id: 54322 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 921CD22E23 for ; Wed, 30 Sep 2015 12:29:29 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf21648704wic.2 for ; Wed, 30 Sep 2015 05:29:28 -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=EhcN6jlPxGZj4UKcKx/zd9URYBW0dsWZ4ZawyqyPllQ=; b=LJi99RhEiiBtgYnymk/qxZY8YxXhHHjwnRQ3VdUbKZBf/5/4Elr40r7xq0klv6YACs ciiD+Q8x63Tc/+B/tOWwhDdZLH31Ta79pgQZFHsOHZ2swq6lHISbZ/4vRczgdKvIEjt0 okqAYodLUuIThYpaaghlqOmWx2c08qqlqIC7OF7c2k/lS9jtYsWdAFayjGk+M/WgzNVZ fs1bCBDILSQR+ByqOznLln72C0Ei970geIC9do/1nsuSrQRMFVXKSUB6YTmiKqG3u9kY RjfBT9T/v/3Nm8Qh8QZPXYWV/DKa18KXngzJWw2udkUVP6n7x5RAV0iwIR7/MwGrmN2o Sw2g== X-Gm-Message-State: ALoCoQkdIOpnOIC31u1ISPXwW8B3ZGt0rKi6Qc+kET+m4gqLfQ/Jv5rVS6awSWZsX02Jrcm7spOo X-Received: by 10.194.118.65 with SMTP id kk1mr500335wjb.5.1443616168919; Wed, 30 Sep 2015 05:29:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.20.203 with SMTP id 72ls35263lfu.95.gmail; Wed, 30 Sep 2015 05:29:28 -0700 (PDT) X-Received: by 10.152.3.166 with SMTP id d6mr1058259lad.40.1443616168726; Wed, 30 Sep 2015 05:29:28 -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 u9si167211laa.119.2015.09.30.05.29.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 05:29:28 -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 laclj5 with SMTP id lj5so43869829lac.3 for ; Wed, 30 Sep 2015 05:29:28 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr1032439lbd.117.1443616168592; Wed, 30 Sep 2015 05:29:28 -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.59.35 with SMTP id w3csp2725397lbq; Wed, 30 Sep 2015 05:29:27 -0700 (PDT) X-Received: by 10.50.176.228 with SMTP id cl4mr4196064igc.79.1443616167645; Wed, 30 Sep 2015 05:29:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nu9si355595igb.73.2015.09.30.05.29.27; Wed, 30 Sep 2015 05:29:27 -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 S932342AbbI3M3Z (ORCPT + 1 other); Wed, 30 Sep 2015 08:29:25 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:33082 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932544AbbI3M1m (ORCPT ); Wed, 30 Sep 2015 08:27:42 -0400 Received: by wiclk2 with SMTP id lk2so195565062wic.0 for ; Wed, 30 Sep 2015 05:27:40 -0700 (PDT) X-Received: by 10.194.90.47 with SMTP id bt15mr4343690wjb.18.1443616060771; Wed, 30 Sep 2015 05:27:40 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id fs2sm493029wib.12.2015.09.30.05.27.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 05:27:40 -0700 (PDT) From: "Ivan T. Ivanov" To: Andy Gross Cc: Pramod Gurav , David Brown , Srinivas Kandagatla , Greg Kroah-Hartman , Jiri Slaby , Frank Rowand , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH v3 1/6] tty: serial: msm: Add mask value for UART_DM registers Date: Wed, 30 Sep 2015 15:26:58 +0300 Message-Id: <1443616023-28625-2-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443616023-28625-1-git-send-email-ivan.ivanov@linaro.org> References: <1443616023-28625-1-git-send-email-ivan.ivanov@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: ivan.ivanov@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.mailfrom=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: , From: Pramod Gurav The bit masks for RFR_LEVEL1 and STALE_TIMEOUT_MSB values in MR1 and IPR registers respectively are different for UART and UART_DM hardware cores. We have been using UART core mask values for these. Add the same for UART_DM core. There is no bit setting as UART_IPR_RXSTALE_LAST for UART_DM core so do it only for UART core. Signed-off-by: Pramod Gurav Reviewed-by: Stephen Boyd Signed-off-by: Ivan T. Ivanov --- drivers/tty/serial/msm_serial.c | 26 ++++++++++++++++++++------ drivers/tty/serial/msm_serial.h | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index b73889c8ed4b..d08cfd3e1c3a 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c @@ -421,7 +421,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud) static int msm_set_baud_rate(struct uart_port *port, unsigned int baud) { - unsigned int rxstale, watermark; + unsigned int rxstale, watermark, mask; struct msm_port *msm_port = UART_TO_MSM(port); const struct msm_baud_map *entry; @@ -432,8 +432,15 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud) /* RX stale watermark */ rxstale = entry->rxstale; watermark = UART_IPR_STALE_LSB & rxstale; - watermark |= UART_IPR_RXSTALE_LAST; - watermark |= UART_IPR_STALE_TIMEOUT_MSB & (rxstale << 2); + if (msm_port->is_uartdm) { + mask = UART_DM_IPR_STALE_TIMEOUT_MSB; + } else { + watermark |= UART_IPR_RXSTALE_LAST; + mask = UART_IPR_STALE_TIMEOUT_MSB; + } + + watermark |= mask & (rxstale << 2); + msm_write(port, watermark, UART_IPR); /* set RX watermark */ @@ -476,7 +483,7 @@ static void msm_init_clock(struct uart_port *port) static int msm_startup(struct uart_port *port) { struct msm_port *msm_port = UART_TO_MSM(port); - unsigned int data, rfr_level; + unsigned int data, rfr_level, mask; int ret; snprintf(msm_port->name, sizeof(msm_port->name), @@ -496,11 +503,18 @@ static int msm_startup(struct uart_port *port) /* set automatic RFR level */ data = msm_read(port, UART_MR1); - data &= ~UART_MR1_AUTO_RFR_LEVEL1; + + if (msm_port->is_uartdm) + mask = UART_DM_MR1_AUTO_RFR_LEVEL1; + else + mask = UART_MR1_AUTO_RFR_LEVEL1; + + data &= ~mask; data &= ~UART_MR1_AUTO_RFR_LEVEL0; - data |= UART_MR1_AUTO_RFR_LEVEL1 & (rfr_level << 2); + data |= mask & (rfr_level << 2); data |= UART_MR1_AUTO_RFR_LEVEL0 & rfr_level; msm_write(port, data, UART_MR1); + return 0; } diff --git a/drivers/tty/serial/msm_serial.h b/drivers/tty/serial/msm_serial.h index 737f69fe7113..5b7722c3938b 100644 --- a/drivers/tty/serial/msm_serial.h +++ b/drivers/tty/serial/msm_serial.h @@ -20,6 +20,7 @@ #define UART_MR1_AUTO_RFR_LEVEL0 0x3F #define UART_MR1_AUTO_RFR_LEVEL1 0x3FF00 +#define UART_DM_MR1_AUTO_RFR_LEVEL1 0xFFFFFF00 #define UART_MR1_RX_RDY_CTL (1 << 7) #define UART_MR1_CTS_CTL (1 << 6) @@ -78,6 +79,7 @@ #define UART_IPR_RXSTALE_LAST 0x20 #define UART_IPR_STALE_LSB 0x1F #define UART_IPR_STALE_TIMEOUT_MSB 0x3FF80 +#define UART_DM_IPR_STALE_TIMEOUT_MSB 0xFFFFFF80 #define UART_IPR 0x0018 #define UART_TFWR 0x001C