From patchwork Wed Sep 30 12:08:21 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: 54307 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id 7029422E23 for ; Wed, 30 Sep 2015 12:09:24 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf21269832wic.1 for ; Wed, 30 Sep 2015 05:09:23 -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=Uc+rexXw4f+VHrldEaQF46svs/xJYV4HeKKuO6krRDg=; b=YQHuZIOzLFc5MiAJ81c6564+hiXYDFnckj3vxSnwj7H3R4mDQPMjc6CQ5Tyf5VcKiB a4wgne54fq+idBvpSlOYGib6ZGPugMOIeLhr5nVJGGlnMofowin0l565OpnbIQrO8kO+ fQExlBI7SwMFpVLtAzRmXGZLvSvteu3GNU2yBRMo8G0MLYzzNF58nBPIDR5iYXUNrzYh RTmr0027ZAPJ4ePt5JeYtUhTbWsjDUTfwHpaeiDZY1gb5Or+Qt/TRuqK6Dj3oHy0lgNi GHl7ms6Vuv7InqBaeKfQjqZgarbz6i2Sm9Sa4ebZsGuZFTWj2wQ3bQ4+zLArfTC7s8ic 0+sw== X-Gm-Message-State: ALoCoQkJ5yH9b0RBt/+LPfAyDsfX2UNIQk/wYaqQiTxXjQ5fGRPumt7SsdgsY8tN9A4jzR2tDXzZ X-Received: by 10.112.198.33 with SMTP id iz1mr486427lbc.8.1443614963391; Wed, 30 Sep 2015 05:09:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.208.78 with SMTP id h75ls39877lfg.83.gmail; Wed, 30 Sep 2015 05:09:23 -0700 (PDT) X-Received: by 10.112.180.230 with SMTP id dr6mr989910lbc.72.1443614963185; Wed, 30 Sep 2015 05:09:23 -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 mz10si124905lbb.122.2015.09.30.05.09.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2015 05:09:22 -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 lahh2 with SMTP id h2so43343875lah.0 for ; Wed, 30 Sep 2015 05:09:22 -0700 (PDT) X-Received: by 10.152.26.98 with SMTP id k2mr985457lag.41.1443614962679; Wed, 30 Sep 2015 05:09:22 -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 w3csp2713700lbq; Wed, 30 Sep 2015 05:09:21 -0700 (PDT) X-Received: by 10.66.221.193 with SMTP id qg1mr4658636pac.103.1443614960923; Wed, 30 Sep 2015 05:09:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si368094pas.215.2015.09.30.05.09.20; Wed, 30 Sep 2015 05:09:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 S932597AbbI3MJG (ORCPT + 30 others); Wed, 30 Sep 2015 08:09:06 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:32844 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754908AbbI3MI6 (ORCPT ); Wed, 30 Sep 2015 08:08:58 -0400 Received: by wiclk2 with SMTP id lk2so194767327wic.0 for ; Wed, 30 Sep 2015 05:08:57 -0700 (PDT) X-Received: by 10.194.78.135 with SMTP id b7mr83176wjx.53.1443614937692; Wed, 30 Sep 2015 05:08:57 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id s1sm17032154wik.16.2015.09.30.05.08.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Sep 2015 05:08:57 -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 v2 1/6] tty: serial: msm: Add mask value for UART_DM registers Date: Wed, 30 Sep 2015 15:08:21 +0300 Message-Id: <1443614906-2196-2-git-send-email-ivan.ivanov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1443614906-2196-1-git-send-email-ivan.ivanov@linaro.org> References: <1443614906-2196-1-git-send-email-ivan.ivanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@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.51 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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