From patchwork Tue Oct 28 08:28:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 39650 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2A8224046 for ; Tue, 28 Oct 2014 08:28:39 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id m15sf123105wgh.4 for ; Tue, 28 Oct 2014 01:28:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=7BPmAXaN5K9YDw407Vg3lEvt3bIJz8NV533XmQyEuwk=; b=TYs90SiXtihrDcxbGR3Zg0fYK5rEPZeNvNUqspn6WBN0j8Vlg/AO625ek8dXKVXvHF NrtLvW8qPex0QTS04VPKVH6v4Ozfox4CDgf7YMBdc1cMFK8RvQro2hVHfyJImXIIjAms 4QhXKIqONzoFqke7XTptZywR4Y/m2pYP4z/Zr5rdQyoVOBKDfQFxenzN22jpC5MHkLma nWMa8czG4eEMIZnmFtkmPVK8bFJPVBy+9uAVVONsEYLQI8cnm5NIkj59UNxcBKdsSWrF P96N5edNOKXKG2bOlWec8QGb7LJHOJLSsxIr5VvvzntkILXCzrG3UPkqNMq4tAhWV8Mj EyKQ== X-Gm-Message-State: ALoCoQnKMUitRKUFiwvlyDP3m944dinMH3gKxKKlqdY0B9mdk01uTw7l7ppKsf7v3C+Cf20s9wGN X-Received: by 10.152.26.72 with SMTP id j8mr348881lag.3.1414484919075; Tue, 28 Oct 2014 01:28:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.200 with SMTP id y8ls26874lal.93.gmail; Tue, 28 Oct 2014 01:28:38 -0700 (PDT) X-Received: by 10.152.43.77 with SMTP id u13mr1511452lal.98.1414484918931; Tue, 28 Oct 2014 01:28:38 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id qv3si1227538lbb.86.2014.10.28.01.28.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Oct 2014 01:28:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gq15so157433lab.1 for ; Tue, 28 Oct 2014 01:28:38 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr2054453lbw.66.1414484918810; Tue, 28 Oct 2014 01:28:38 -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.84.229 with SMTP id c5csp437251lbz; Tue, 28 Oct 2014 01:28:38 -0700 (PDT) X-Received: by 10.68.163.65 with SMTP id yg1mr1742569pbb.21.1414484917283; Tue, 28 Oct 2014 01:28:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c6si676306pdn.138.2014.10.28.01.28.36 for ; Tue, 28 Oct 2014 01:28:37 -0700 (PDT) Received-SPF: none (google.com: linux-serial-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759176AbaJ1I23 (ORCPT ); Tue, 28 Oct 2014 04:28:29 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:42796 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755335AbaJ1I21 (ORCPT ); Tue, 28 Oct 2014 04:28:27 -0400 Received: from vsmta14.fe.internet.bosch.com (unknown [10.4.98.54]) by imta23.fe.bosch.de (Postfix) with ESMTP id CCD301580220 for ; Tue, 28 Oct 2014 09:28:25 +0100 (CET) Received: from localhost (vsgw22.fe.internet.bosch.com [10.4.98.11]) by vsmta14.fe.internet.bosch.com (Postfix) with SMTP id BF00CA40684 for ; Tue, 28 Oct 2014 09:28:25 +0100 (CET) Received: from hi-z5661.hi.de.bosch.com (10.34.211.28) by SI-HUB1000.de.bosch.com (10.4.103.106) with Microsoft SMTP Server id 14.3.195.1; Tue, 28 Oct 2014 09:28:12 +0100 Received: from hi-z5661.hi.de.bosch.com (localhost [127.0.0.1]) by hi-z5661.hi.de.bosch.com (Postfix) with ESMTP id 7F70441375; Tue, 28 Oct 2014 09:28:12 +0100 (CET) From: Dirk Behme To: CC: Daniel Thompson , Dirk Behme , Greg Kroah-Hartman , Jiri Slaby , Huang Shijie Subject: [PATCH 1/2] serial: imx: clean up imx_poll_put_char() Date: Tue, 28 Oct 2014 09:28:07 +0100 Message-ID: <1414484888-6229-1-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 1.8.2 MIME-Version: 1.0 X-TM-AS-MML: disable 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: dirk.behme@de.bosch.com 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.42 as permitted sender) smtp.mail=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: Daniel Thompson imx_put_poll_char() has been simplified to remove the code to disable interrupts. The present code can corrupt register state when re-entered from FIQ handler. Switch to _relaxed() MMIO functions (which are safe for polled I/O and needed to avoid taking spin locks). Signed-off-by: Daniel Thompson Signed-off-by: Dirk Behme Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: Huang Shijie Cc: linux-serial@vger.kernel.org --- drivers/tty/serial/imx.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 8f62a3c..0b6f14b 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1509,42 +1509,28 @@ imx_verify_port(struct uart_port *port, struct serial_struct *ser) #if defined(CONFIG_CONSOLE_POLL) static int imx_poll_get_char(struct uart_port *port) { - if (!(readl(port->membase + USR2) & USR2_RDR)) + if (!(readl_relaxed(port->membase + USR2) & USR2_RDR)) return NO_POLL_CHAR; - return readl(port->membase + URXD0) & URXD_RX_DATA; + return readl_relaxed(port->membase + URXD0) & URXD_RX_DATA; } static void imx_poll_put_char(struct uart_port *port, unsigned char c) { - struct imx_port_ucrs old_ucr; unsigned int status; - /* save control registers */ - imx_port_ucrs_save(port, &old_ucr); - - /* disable interrupts */ - writel(UCR1_UARTEN, port->membase + UCR1); - writel(old_ucr.ucr2 & ~(UCR2_ATEN | UCR2_RTSEN | UCR2_ESCI), - port->membase + UCR2); - writel(old_ucr.ucr3 & ~(UCR3_DCD | UCR3_RI | UCR3_DTREN), - port->membase + UCR3); - /* drain */ do { - status = readl(port->membase + USR1); + status = readl_relaxed(port->membase + USR1); } while (~status & USR1_TRDY); /* write */ - writel(c, port->membase + URTX0); + writel_relaxed(c, port->membase + URTX0); /* flush */ do { - status = readl(port->membase + USR2); + status = readl_relaxed(port->membase + USR2); } while (~status & USR2_TXDC); - - /* restore control registers */ - imx_port_ucrs_restore(port, &old_ucr); } #endif