From patchwork Thu Jun 19 10:38:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 32207 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 40E4C203F4 for ; Thu, 19 Jun 2014 10:39:11 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf14525848oac.7 for ; Thu, 19 Jun 2014 03:39:10 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=MqwkdTvmEH8mg31R+b3yyZtzutFa1aFmkegMNAKKe8c=; b=OdNPDkmFVqqTMaJmp5OXYPvY42IRptxtaZvzNjWm06PjAqDONhnsPbayIUQZpWo65c QiotLV6jtu2F1sGpChz1xYFAEM9MfMlcuV8hub0GKPqC/N2h4pNj0AczQG0+z37xQkoW fF//IhKo60ywS2m4nz4PIKWnMh/q/dT+HkIcwIwLZf4JiAsfC7GRfb3SoA1YYErxTGCU cB5jvM8ERNbKfXLJNiS4cwzTkYZIQakjNB3OJIjj3ddNtqcuQlp5gOCF+mXSzheGMMAP BNOLGifbMs3b3gJuQctGfGWdjcgM/+I4YK2k31s8VyY8XuFvxBeiXneG3cCqfdvU4CCx UgjA== X-Gm-Message-State: ALoCoQnAF8CcW/KfNmROnuz8JgczWRymW6NXptchKxvLDxrBmos2bVV1Y02zPnMBb2wxfH5qe1I6 X-Received: by 10.42.41.1 with SMTP id n1mr1057410ice.6.1403174350849; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.8 with SMTP id y8ls542834qgy.11.gmail; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) X-Received: by 10.52.101.168 with SMTP id fh8mr2793157vdb.34.1403174350759; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id tt2si2178404vdc.3.2014.06.19.03.39.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Jun 2014 03:39:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ik5so2015019vcb.21 for ; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) X-Received: by 10.58.29.16 with SMTP id f16mr3347025veh.23.1403174350683; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp352002vcb; Thu, 19 Jun 2014 03:39:10 -0700 (PDT) X-Received: by 10.180.37.42 with SMTP id v10mr5266588wij.43.1403174349739; Thu, 19 Jun 2014 03:39:09 -0700 (PDT) Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com [74.125.82.44]) by mx.google.com with ESMTPS id gt4si6267560wib.64.2014.06.19.03.39.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Jun 2014 03:39:09 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.44 as permitted sender) client-ip=74.125.82.44; Received: by mail-wg0-f44.google.com with SMTP id x13so2057685wgg.3 for ; Thu, 19 Jun 2014 03:39:09 -0700 (PDT) X-Received: by 10.194.157.195 with SMTP id wo3mr2301343wjb.130.1403174349089; Thu, 19 Jun 2014 03:39:09 -0700 (PDT) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id hi2sm7881147wjb.29.2014.06.19.03.39.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jun 2014 03:39:08 -0700 (PDT) From: Daniel Thompson To: Jason Wessel Cc: Daniel Thompson , kgdb-bugreport@lists.sourceforge.net, patches@linaro.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, John Stultz , Anton Vorontsov , Colin Cross , Dirk Behme , kernel-team@android.com, Russell King , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Thomas Gleixner , Greg Kroah-Hartman , Jiri Slaby , "David A. Long" , Nicolas Pitre , Catalin Marinas , Frederic Weisbecker , Linus Walleij , Christoffer Dall , kernel@stlinux.com, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, Srinivas Kandagatla , Maxime Coquelin , Patrice Chotard Subject: [PATCH v4 11/13] serial: asc: Adopt readl_/writel_relaxed() Date: Thu, 19 Jun 2014 11:38:21 +0100 Message-Id: <1403174303-25456-12-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1403174303-25456-1-git-send-email-daniel.thompson@linaro.org> References: <1401961994-18033-1-git-send-email-daniel.thompson@linaro.org> <1403174303-25456-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@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.220.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The architectures supported by this driver have expensive implementations of writel(), reliant on spin locks and explicit L2 cache management. These architectures provide a cheaper writel_relaxed() which is much better suited to peripherals that do not perform DMA. The situation with readl()/readl_relaxed()is similar although less acute. This driver does not use DMA and will be more power efficient and more robust (due to absense of spin locks during console I/O) if it uses the relaxed variants. This driver is cross compilable for testing purposes and remains compilable on all architectures by falling back to writel() when writel_relaxed() does not exist. We also include explicit compiler barriers. There are redundant on ARM and SH but important on x86 because it defines "relaxed" differently. Signed-off-by: Daniel Thompson Cc: Srinivas Kandagatla Cc: Maxime Coquelin Cc: Patrice Chotard Cc: Greg Kroah-Hartman Cc: Jiri Slaby Cc: kernel@stlinux.com Cc: linux-serial@vger.kernel.org --- drivers/tty/serial/st-asc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index 4f376d8..58aa1c6 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -152,12 +152,21 @@ static inline struct asc_port *to_asc_port(struct uart_port *port) static inline u32 asc_in(struct uart_port *port, u32 offset) { - return readl(port->membase + offset); + u32 r; + + r = readl_relaxed(port->membase + offset); + barrier(); + return r; } static inline void asc_out(struct uart_port *port, u32 offset, u32 value) { +#ifdef writel_relaxed + writel_relaxed(value, port->membase + offset); + barrier(); +#else writel(value, port->membase + offset); +#endif } /*