From patchwork Mon Nov 25 22:13:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 3234881 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id BE07E9F3A0 for ; Mon, 25 Nov 2013 22:14:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB1E220320 for ; Mon, 25 Nov 2013 22:14:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 435572031C for ; Mon, 25 Nov 2013 22:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752859Ab3KYWOU (ORCPT ); Mon, 25 Nov 2013 17:14:20 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:39666 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727Ab3KYWOT (ORCPT ); Mon, 25 Nov 2013 17:14:19 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAPMEHuc009386; Mon, 25 Nov 2013 16:14:17 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAPMEGmB026937; Mon, 25 Nov 2013 16:14:16 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Mon, 25 Nov 2013 16:14:16 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAPMEFLt018299; Mon, 25 Nov 2013 16:14:16 -0600 Date: Mon, 25 Nov 2013 16:13:48 -0600 From: Felipe Balbi To: Felipe Balbi CC: Taras Kondratiuk , , , Victor Kamensky , Greg Kroah-Hartman , , Subject: Re: [RFC 15/23] usb: musb: raw read and write endian fix Message-ID: <20131125221348.GB18046@saruman.home> Reply-To: References: <1384560086-11994-1-git-send-email-taras.kondratiuk@linaro.org> <1384560086-11994-16-git-send-email-taras.kondratiuk@linaro.org> <20131125220749.GA18046@saruman.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131125220749.GA18046@saruman.home> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, On Mon, Nov 25, 2013 at 04:07:49PM -0600, Felipe Balbi wrote: > On Sat, Nov 16, 2013 at 02:01:18AM +0200, Taras Kondratiuk wrote: > > From: Victor Kamensky > > > > All OMAP IP blocks expect LE data, but CPU may operate in BE mode. > > Need to use endian neutral functions to read/write h/w registers. > > I.e instead of __raw_read[lw] and __raw_write[lw] functions code > > need to use read[lw]_relaxed and write[lw]_relaxed functions. > > If the first simply reads/writes register, the second will byteswap > > it if host operates in BE mode. > > > > Changes are trivial sed like replacement of __raw_xxx functions > > with xxx_relaxed variant. > > > > Signed-off-by: Victor Kamensky > > Signed-off-by: Taras Kondratiuk > > --- > > drivers/usb/musb/musb_io.h | 18 +++++++++--------- > > 1 file changed, 9 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/usb/musb/musb_io.h b/drivers/usb/musb/musb_io.h > > index eebeed7..76f4d2a 100644 > > --- a/drivers/usb/musb/musb_io.h > > +++ b/drivers/usb/musb/musb_io.h > > @@ -42,17 +42,17 @@ > > /* NOTE: these offsets are all in bytes */ > > > > static inline u16 musb_readw(const void __iomem *addr, unsigned offset) > > - { return __raw_readw(addr + offset); } > > + { return readw_relaxed(addr + offset); } > > x86 doesn't provide any of the write?_relaxed methods so this breaks > build on x86 at least. here's an untested patch which would "solve" the problem: I'm not sure if it's correct though. Someone would have to tell me if it's correct or not. For now, I have dropped $subject from my testing/next branch. diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 34f69cb..b6ad164 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -73,6 +73,9 @@ build_mmio_write(__writel, "l", unsigned int, "r", ) #define __raw_readw __readw #define __raw_readl __readl +#define writeb_relaxed(d, a) __writeb(d, a) +#define writew_relaxed(d, a) __writew(d, a) +#define writel_relaxed(d, a) __writel(d, a) #define __raw_writeb __writeb #define __raw_writew __writew #define __raw_writel __writel @@ -85,6 +88,7 @@ build_mmio_read(readq, "q", unsigned long, "=r", :"memory") build_mmio_write(writeq, "q", unsigned long, "r", :"memory") #define readq_relaxed(a) readq(a) +#define writeq_relaxed(d, a) writeq(d, a) #define __raw_readq(a) readq(a) #define __raw_writeq(val, addr) writeq(val, addr)