msm_serial_hs_lite: Don't set UART clock to zero always

Setting UART clock rate to zero is causing multiple issues
and leading to more confusion with other stability issues.
Setting UART clock rate to zero is invalid operation on
recent platforms and throws multiple error messages. Hence
add platform data set_uart_clk_zero to enable setting uart
clock rate to zero operation on required platform for
specific use case.

Also set set_uart_clk_zero for GSBI9 shared between different
processor.

CRs-Fixed: 455466
Change-Id: Iba04d4cf094885b0eae6a9c49ed06f750bcc1024
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
This commit is contained in:
Mayank Rana
2013-02-27 10:04:53 +05:30
parent 217f3364b5
commit 965e9e70da
3 changed files with 15 additions and 5 deletions
+1
View File
@@ -412,6 +412,7 @@ static struct msm_serial_hslite_platform_data uart_gsbi9_pdata = {
.uart_tx_gpio = 67,
.uart_rx_gpio = 66,
.line = 1,
.set_uart_clk_zero = true,
};
static struct resource msm_uart_gsbi9_resources[] = {
@@ -1,4 +1,4 @@
/* Copyright (c) 2011-2012 The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2013 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -23,6 +23,9 @@
* @uart_rx_gpio: GPIO number for UART Rx Line.
* @uart_cts_gpio: GPIO number for UART CTS Line.
* @uart_rfr_gpio: GPIO number for UART RFR Line.
* @set_uart_clk_zero: use this if setting UART Clock to zero is required
* It is mainly required where same UART is used across different processor.
* Make sure that Clock driver for platform support setting clock rate to zero.
* @use_pm: use this to enable power management
* @line: Used to set UART Port number.
*/
@@ -32,6 +35,7 @@ struct msm_serial_hslite_platform_data {
unsigned uart_rx_gpio;
unsigned uart_cts_gpio;
unsigned uart_rfr_gpio;
bool set_uart_clk_zero;
bool use_pm;
int line;
};
+9 -4
View File
@@ -2,7 +2,7 @@
* drivers/serial/msm_serial.c - driver for msm7k serial device and console
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@@ -1257,6 +1257,9 @@ static void msm_hsl_power(struct uart_port *port, unsigned int state,
{
int ret;
struct msm_hsl_port *msm_hsl_port = UART_TO_MSM(port);
struct platform_device *pdev = to_platform_device(port->dev);
const struct msm_serial_hslite_platform_data *pdata =
pdev->dev.platform_data;
switch (state) {
case 0:
@@ -1268,9 +1271,11 @@ static void msm_hsl_power(struct uart_port *port, unsigned int state,
break;
case 3:
clk_en(port, 0);
ret = clk_set_rate(msm_hsl_port->clk, 0);
if (ret)
pr_err("Error setting UART clock rate to zero.\n");
if (pdata && pdata->set_uart_clk_zero) {
ret = clk_set_rate(msm_hsl_port->clk, 0);
if (ret)
pr_err("Error setting UART clock rate to zero.\n");
}
break;
default:
pr_err("Unknown PM state %d\n", state);