Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032717AbbKEHVl (ORCPT ); Thu, 5 Nov 2015 02:21:41 -0500 Received: from mail-by2on0095.outbound.protection.outlook.com ([207.46.100.95]:54912 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030868AbbKEHVh (ORCPT ); Thu, 5 Nov 2015 02:21:37 -0500 X-Greylist: delayed 111627 seconds by postgrey-1.27 at vger.kernel.org; Thu, 05 Nov 2015 02:21:37 EST Authentication-Results: spf=pass (sender IP is 149.199.60.100) 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 v2 05/10] tty: xuartps: Improve startup function Date: Wed, 4 Nov 2015 23:21:14 -0800 Message-ID: <1446708079-1105-6-git-send-email-soren.brinkmann@xilinx.com> X-Mailer: git-send-email 2.6.2.3.ga463a5b In-Reply-To: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> References: <1446708079-1105-1-git-send-email-soren.brinkmann@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-21920.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD045;1:/oxOK3DDCRMLMbCS2u+11qLr/Kh45SjkWGJGASLwImbLCw59TMUKOY5TYXk0BCEq/Dwjer0+CRTHlh7fknohZ71CoiYpx9rG5tOLh4OJrrBK2I208p8vb/mB/UL1+v83NIPELxs3UvzwZlyfRWPZTFd7ccspdujrGdv/CVYVUyHZcKmzA0nProyXtARgYUBDmpaNMoM0hjsXw88aWvwqstv/SiIWwQkia0wVMGblNZIkyKghnQ4LYUCRlrhRkLA8UmlU2XotNTTt3eJYV6paMDA0FJtNGRAYbBQi4CXA+uhPkUGsvY71az1b/0Ees+VoNvwgzfEB2AS5gkfpbnu8b2oMVmiQw6/xsdg4VDhgAcI= X-Forefront-Antispam-Report: CIP:149.199.60.100;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(36386004)(19580405001)(5003940100001)(16796002)(81156007)(76176999)(47776003)(229853001)(57986006)(92566002)(86362001)(4001430100002)(5001770100001)(63266004)(50986999)(76506005)(33646002)(2950100001)(189998001)(19580395003)(575784001)(77096005)(50226001)(106466001)(5001960100002)(11100500001)(36756003)(48376002)(5007970100001)(5008740100001)(87936001)(6806005)(50466002)(107886002)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2FFO11HUB008;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;PTR:unknown-60-100.xilinx.com,xapps1.xilinx.com;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB008;2:WG938qY0lspqcn2nB/b5kXeeJ/FAYQO6u06G9768O8DWwjrGBMhk1ORfr/YhFtTiHwuDwe0sdET6aZovjN12N0Ba+iN3nFJ2Y6ATvNghZNLrPJtgQqon47T63ynd8ilf8YdooC6WDRjFjZzuezzIvYBTC0gf3AkaqrJzjSv8un8=;3:d/y7ONY+7iPwpHFCHlptk4pEREBDjrGue2wCLbsx+GyxNYyNRs/w7sCD4BU49Sj9+OOJRWastIko6P+UYyBcKj4KGZcctBNYcL2ixJIl/hP1FRHiUkfKdsB09YdGOZ0dmpbfswNCjp8dZMoOIpQtedCRPznR2W5Rvu5cRDqusRoyPfYeM2GwPY42f7woB22o2QE4UPTAQBEcEaodQmzbSsSRpJ1BCJ32ieIpG9oiGIVEPz/IZD8UWrIo8VxWeUfpnb+vaMuy5CO3QdvUQBl9Hw==;25:/kwfajyBlc2gamoCYa4N2ufFhMXEPmKGlFawUq+hwaw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iqED22NSOqa4hUio6Rl1xuv2y9aFNt1gv1S7or4ZAxiDgeAm0aFZJwfkp+GBpimftK4Fvitcw0TRH0yoqob/4dByE+CwmBZt4p5PNcq2AUZVXzPspZwr9rI5ep28hIwK6kfZmyhylAKF9Ac X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:BL2FFO11HUB008;BCL:0;PCL:0;RULEID:;SRVR:BL2FFO11HUB008; X-Forefront-PRVS: 0751474A44 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BL2FFO11HUB008;23:lszkAXEXLf1pIc58bgJSji5cts91s0UUrv+aqdwg?= =?us-ascii?Q?5CkhTzZsXQDBi/fTzkqsf8gMnxttx2wRwejmByF5ORHu/7qFgm9Ln0p8c551?= =?us-ascii?Q?scSnEBsWhRbmHa2yCZbX8tCSv0B240qIhdyLqc3YznNU9ipH4kIVfhB2SOof?= =?us-ascii?Q?V3P+z2YqTyZfUOWWVjQlkXOBO7KG8s438L3SbRUH8PBa2F6HFDoX+Mi06PAz?= =?us-ascii?Q?dZb1PgVsSWCk+ZAMe/xhzTrIvyKSbuM91YI9EKXcC3Pgm/gNTksJqrWEmWkl?= =?us-ascii?Q?fHa51vk4gCjyNeFgZW2v9FAVCWC/JUnPyeuqmcf32Qt2gb6W4E3nD2TuRqVA?= =?us-ascii?Q?DAS3gyBtaN+5m4vR7QDc62L58NpqJT96hIYAlbG3AupV3kR7wdZ1QlypWUo3?= =?us-ascii?Q?+qVR0VT97+SEjshMocD7Naa2ZzbR2cfdSC3IwSzMNU+zGa3WqNyDM2wWrq3u?= =?us-ascii?Q?Y6szqi6PgHJVIrbKO1uA0+8s1DnPeQIL666HfvsiWpwPY84RjWPuvECUkrJ9?= =?us-ascii?Q?ajHBBQkAnwlJdkGTm7N8U8qrLpeDuCGoXLRZbMikok7LeJw/vyCnrE28Jqyu?= =?us-ascii?Q?AKr6ZZ7v7RjYINhvjX1Nr78N8yZhhogh3OQXnSQlhDugRSwg3LLtJYpT3OWn?= =?us-ascii?Q?OdHU4s6xN4RMdnoUg6mtCKRctoFDwh93aIjlZtFyx2ilYXlgKEYxEUKLVpcs?= =?us-ascii?Q?c+i8fF6SpIb7KRsaoi06c62vX2CgFCWfzUg9X1qqBl3fHyQDjXE93n73xTWi?= =?us-ascii?Q?CsRuv2aGddyxtSZsyXSpsdXLp883FQd5lCAXoVDtQ8F9w2kqYWamp0Ubc7kZ?= =?us-ascii?Q?XTTivDLpKB1q8VOgiyeV2hbsfkeBXG6jEm24wEFLLHKKVsiOZsGshusu8qFR?= =?us-ascii?Q?GybKJIERbC9H5XgVnydf9g03p3jqDMyJ2wq3wcfhVCACXwl9TVEpE6r8l/WG?= =?us-ascii?Q?Ha03KMFfP1apkGZFIN3D5+zR/jX9M7yzglTx8wPYh9V5DMkoI53fCWDC+gHN?= =?us-ascii?Q?pNSjbYyThSLWa/g+QkukfWoGYG0iaQjZs9m3Kq0ZAgjllBKxsTAi7EQuvf9m?= =?us-ascii?Q?e/9rYGjwOM39ij1f44B6npN/PirmtuoKgVvgkvkEpjAfca07KLBK8+C1j24l?= =?us-ascii?Q?fUhprxDhQW4pR0vbsizPfWe9v0HsKKUJ?= X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11HUB008;5:HVCShZJscCJsL3XhgqxF8FFG1ap9YzfBvOpvnQs+UsXGA6E/he9ua/SBr4WEIUHwEP+XHRTL2uxitHh9bYPLN2lHcruZsVE5cpZEosJi9kKB738ukp7RYUthqP3mTweZnX81cj6Sp6H+sRVAbmvRMw==;24:cE94qC9u3Ay4kUMS86VM6fjuNwU06JKIa0+HeUXSFL7rb8EDPmH8/iYw12psvgCLCJEU2Ukh6LES2DuqxHcXHqym6rrTdVq6tPCQWYR+TD8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2015 07:21:35.2930 (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.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2FFO11HUB008 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 b7fc30639292..167e0f4bcf7a 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/