Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030284AbbKDAWM (ORCPT ); Tue, 3 Nov 2015 19:22:12 -0500 Received: from mail-by2on0054.outbound.protection.outlook.com ([207.46.100.54]:19471 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030201AbbKDAVM (ORCPT ); Tue, 3 Nov 2015 19:21:12 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=bestguesspass action=none header.from=xilinx.com; From: Soren Brinkmann To: Greg Kroah-Hartman , Jiri Slaby CC: Michal Simek , , , , "Soren Brinkmann" Subject: [PATCH 5/9] tty: xuartps: Improve startup function Date: Tue, 3 Nov 2015 16:20:46 -0800 Message-ID: <1446596450-20918-6-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446596450-20918-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21918.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD041;1:jFAzewA1mCjC2DJma2fw2P4jC4Ret5VYQCt28iHS9cQM0xt5ZdUdjm2+hheVBjGNOluqKFezdT5UGYkwERZ6Nc6ZwUIGrX7Sh5OWe9PkpDuPGsQ2//06BolXtHnZLFWI0LaJLAAPP42fe62eexUQQBo93qU2GB/wY9e6/Pa5jecjCc6YXeUei3yoM40RvBMp/OEeu8qeqVTpFZwe8ZbD+5Xdd3+EH03CcIyUmHQXbwF7yMR+8dnpmR14JypaYWuMu1Q+NqTLoXcFVs9fcRrKpTisxP4XotzFWFW3QCKENFPiMiY3bWhsVkVSNMeJbov0hhfPzYhEhVJPxMR2kgTYsgIAvVyGqKwRULeTWGGMEoI= X-Forefront-Antispam-Report: CIP:149.199.60.83;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(189002)(199003)(19580395003)(229853001)(16796002)(76176999)(86362001)(19580405001)(76506005)(92566002)(50466002)(106466001)(48376002)(2950100001)(50226001)(6806005)(87936001)(47776003)(5007970100001)(57986006)(5008740100001)(5001770100001)(50986999)(5001920100001)(36756003)(4001430100002)(5001960100002)(5003940100001)(63266004)(77096005)(33646002)(189998001)(36386004)(81156007)(11100500001)(107886002)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2FFO11HUB040;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB040;2:jdgvEB3W7oZDFj3XiFL5o+PPk8JjmrkwBPSPvFIVKzRqFc1sTQMODQmdaYTvRFfJVwAvlk6vTNJ2bO0XC8aa/QdftgE3tSJ7gCfMgViUHM/i3R10d6Sm9QL3Qlq0F9nKWY+UqWfj4sCGkEGmlqkB01v6kX4C3xezrtPY3+rzMII=;3:DVkNfz0hfD8UCZ1mrtGB6ly0hNCiue5AobznYMki6hle7JGlYoGwNTnSj33K4FP5lOJF9eGkj2jGzr55qg3ApTOukTIryqlWtn9K66rg+oULAmbhR7Z+LPLs7snurjwkII/sr9gSCbVHIWQepIV7qhH3hJPYXHYjeB6IgeYGIm4F63ZaormBf3EPLBUYzCVt8gNUUTvMk9agpwrtgt6MVIJxNmqZAht9fkZNM1+Li90dAXYBaJhLfXhG44yr1n9Adx5fTE0woRrw7vxUATu5Ew==;25:agDnH5MOYAJwjU8S2YNPoIf57BMKH5I+LtJVfS/+WtJG/mQspWrHeiQUdnFnB6LOBN1ANxvVkfnDSy6lvh24oQdeIMl0/qiIKkJjgQb9fO+KXzjg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HAoNryqnQc3G3oBYWNpKtKk2IA0+Y+sQejEDl0TM0JiEQHRI274XwPT29HfHQ3V X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(520078)(8121501046)(5005006)(10201501046)(3002001);SRVR:BL2FFO11HUB040;BCL:0;PCL:0;RULEID:;SRVR:BL2FFO11HUB040; X-Forefront-PRVS: 0750463DC9 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2FFO11HUB040;23:saE3GOub/gQ9u8lpZ2oPweu85LbgpAmblnG8IjIQ?= =?us-ascii?Q?v7c0Q5Yoa6o2qKpWna9CO7rHjcA8RZ4JuSV6dlOX0lRkp7IR12QYUGT5prjz?= =?us-ascii?Q?W8x+OemyKVNXTJDWrXee06muKJSY9jALQog2GJSpKSqJFqoNV7IiMChGDBpQ?= =?us-ascii?Q?KUvQ0V5wjnXzaBF+k0vvMZNPQaPGIvYi4lzfrj3QHfSeZXwI8dS7rQIwBlZZ?= =?us-ascii?Q?5rQdcbVcuuZTMyRwrSTdToAe2+IgsSwF7W3wlXwoVoC4BhEhciSUbr4ZCwKa?= =?us-ascii?Q?4RWD5Wt8PjzEqWWxsekGATgBYcLRQTD822YosVFpWH9M8KW2alOjO7EDZtDr?= =?us-ascii?Q?ViptOq5KnBwmeJP4SkGrCk40yAor8nq4P1+kiBk82isGSXa/Usy2dofOgvoV?= =?us-ascii?Q?7Tf8G2FVu4/oyCN1ut6XBG1zNitFGirj01tycrimcXgqRWNN9jVOEc/plZfe?= =?us-ascii?Q?EjumGdW9zdTHPy7+xiET0fi6mi94Hjxj9MrncH9c1mcnTfOdyIOVIStbhhF5?= =?us-ascii?Q?L+4bOFAlGnlUeH3kOQG7e4G1x8JubtseH9W0JweogniBQoxh256A4fxsAh4m?= =?us-ascii?Q?q1A2Q2zFUWRg6xkaBni+hGEzRRmVeMBplGhX3F+op8wsJbCbAXex48CxbYcF?= =?us-ascii?Q?L8DAnMFDvw/YK7eBlHAc6MTrMYxcBIVw2w+V+oJWdoeY2DfPQe3YuBlZSqga?= =?us-ascii?Q?L1fKj5FgVtxOdq+f9zlQsYNUNrCb9JfWwq4Gf+PZoCh1uKgK+rWdlKM+IgWf?= =?us-ascii?Q?+uXJvMeDWNIml3b3iIvCHFMlwWDuzYwLwLSwzwTOTdCU2+bsGsKU2LMIob/F?= =?us-ascii?Q?PeeEUSi1QrgRYNva9FV3ua9eR1ccwCI646xgt1jUtKQOD8DkpI/XFfnPgogW?= =?us-ascii?Q?6RWypUH06Ierd+XV3cYMBaCOHXmLLO+KEfJhYclcbHfw900uOdqv98diNFvT?= =?us-ascii?Q?77FicJr564b3hH16m2oBi4KRizzyIYYJ2IPtHHY/wAmFB6geElWdbWzQE9Hq?= =?us-ascii?Q?Qgc/u2ecnyX/mgCiWsOD8EYhCRgJh4N/qyZ8YsZ7fYNDPgt0E0qoiEOS+E1+?= =?us-ascii?Q?8dTdGQw3QmDiLNvrmOSBha1y5f8dEh2PLMsL5DoMapcrBhIENULW+Qw1QAuk?= =?us-ascii?Q?7J5rggrKHaQ=3D?= X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB040;5:vC8cDxNv5AeOzcezZrsNByLOSUdcIfkwJCAdNRtznB5pYMKvad7VeTn711Z5p+H0prKMtLwb9GHDXNNTcrGljVz3H/uXL+d7/DZDnFHR2n9YFFwWcOkkNT5kPN7Q+1kLG/adUM8k/dgP9DEEKqzQ7Q==;24:sAat/YDvCL4EvPYs8/zFUZ6t6ZNhmGnKCIyQGeFOHpdGM/zjRkyJ9V3uf4Jm551/6EWxK4L/WUL0rYrPc+Mmk+vHsMUlWPFeUgY0cSfcwHE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2015 00:21:10.4277 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2FFO11HUB040 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2492 Lines: 70 The startup function is supposed to initialize the UART for receiving. Hence, don't enable the TX part. Also, protect HW accesses with the port lock. Signed-off-by: Soren Brinkmann --- drivers/tty/serial/xilinx_uartps.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 738df6bb2646..b189e600d4ab 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -755,6 +755,7 @@ static void cdns_uart_set_termios(struct uart_port *port, */ static int cdns_uart_startup(struct uart_port *port) { + unsigned long flags; unsigned int retval = 0, status = 0; retval = request_irq(port->irq, cdns_uart_isr, 0, CDNS_UART_NAME, @@ -762,6 +763,8 @@ static int cdns_uart_startup(struct uart_port *port) if (retval) return retval; + spin_lock_irqsave(&port->lock, flags); + /* Disable the TX and RX */ writel(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS, port->membase + CDNS_UART_CR_OFFSET); @@ -772,15 +775,14 @@ static int cdns_uart_startup(struct uart_port *port) writel(CDNS_UART_CR_TXRST | CDNS_UART_CR_RXRST, port->membase + CDNS_UART_CR_OFFSET); - status = readl(port->membase + CDNS_UART_CR_OFFSET); - - /* Clear the RX disable and TX disable bits and then set the TX enable - * bit and RX enable bit to enable the transmitter and receiver. + /* + * Clear the RX disable bit and then set the RX enable bit to enable + * the receiver. */ - writel((status & ~(CDNS_UART_CR_TX_DIS | CDNS_UART_CR_RX_DIS)) - | (CDNS_UART_CR_TX_EN | CDNS_UART_CR_RX_EN | - CDNS_UART_CR_STOPBRK), - port->membase + CDNS_UART_CR_OFFSET); + status = readl(port->membase + CDNS_UART_CR_OFFSET); + status &= CDNS_UART_CR_RX_DIS; + status |= CDNS_UART_CR_RX_EN; + writel(status, port->membase + CDNS_UART_CR_OFFSET); /* Set the Mode Register with normal mode,8 data bits,1 stop bit, * no parity. @@ -811,6 +813,8 @@ static int cdns_uart_startup(struct uart_port *port) CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_TOUT, port->membase + CDNS_UART_IER_OFFSET); + spin_unlock_irqrestore(&port->lock, flags); + return retval; } -- 2.6.2.3.ga463a5b -- 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/