From patchwork Wed Nov 27 13:48:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 21810 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1C15A23FE8 for ; Wed, 27 Nov 2013 13:48:24 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf15601981vcb.8 for ; Wed, 27 Nov 2013 05:48:23 -0800 (PST) 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=FOhC41qx4PpWre2GtOlV0+KripP2EObFh7xNaRJdirw=; b=AyHFfAq3mcsuEbg6PL+tXb+aG8sRrMVW8R4kma0Xx6EGSjS8qSiDmVPFZGD0aPvAu3 vKE7ygRbTervEMoZM6X7hL1Vxl2SvkiSlgko36XXpnvJa6V+TzIZyTonNh+fgPvhF/lq DTe3bd1Xdlge9TjPW5cPdTYfnDBUERvQUo9bpNRaWZ35ZcEnCcJiZS0rz4MW7uWSI7C7 uVTqRO3Q34Xn0Uai8Rv7Q7OZ0JRs9aEd/3lu6px/UYvIpQeWimtYqmP29S+KN7/hmdxk lDDmmAI+308Fbl1l8XcVBlQ2mcAB/sAZEzNa+9nA/1FmmDg8Nf1h4oMi3efRT3rwEbka pQig== X-Gm-Message-State: ALoCoQk2P/meDLcdEAsJXkaPPj2MdMj62aab0k31Gf8JusCtjEj08ox0Kb8XUCqA1Qen1jANo6A+ X-Received: by 10.224.24.65 with SMTP id u1mr8609324qab.6.1385560103872; Wed, 27 Nov 2013 05:48:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.12.241 with SMTP id b17ls2723636qec.11.gmail; Wed, 27 Nov 2013 05:48:23 -0800 (PST) X-Received: by 10.58.67.168 with SMTP id o8mr11136655vet.22.1385560103719; Wed, 27 Nov 2013 05:48:23 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id p7si1780355vei.62.2013.11.27.05.48.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 05:48:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id p5so4792961vbn.8 for ; Wed, 27 Nov 2013 05:48:23 -0800 (PST) X-Received: by 10.52.157.232 with SMTP id wp8mr29107159vdb.4.1385560103637; Wed, 27 Nov 2013 05:48:23 -0800 (PST) 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.220.174.196 with SMTP id u4csp286521vcz; Wed, 27 Nov 2013 05:48:23 -0800 (PST) X-Received: by 10.152.219.133 with SMTP id po5mr1723180lac.34.1385560102453; Wed, 27 Nov 2013 05:48:22 -0800 (PST) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) by mx.google.com with ESMTPS id yf5si11603754lab.92.2013.11.27.05.48.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 05:48:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.217.170 is neither permitted nor denied by best guess record for domain of taras.kondratiuk@linaro.org) client-ip=209.85.217.170; Received: by mail-lb0-f170.google.com with SMTP id w7so5435059lbi.15 for ; Wed, 27 Nov 2013 05:48:21 -0800 (PST) X-Received: by 10.112.151.42 with SMTP id un10mr28588200lbb.7.1385560101830; Wed, 27 Nov 2013 05:48:21 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id e1sm6920015lbe.0.2013.11.27.05.48.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Nov 2013 05:48:21 -0800 (PST) From: Taras Kondratiuk To: Wolfram Sang Cc: patches@linaro.org, linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, Victor Kamensky , Tony Lindgren , linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: omap: raw read and write endian fix Date: Wed, 27 Nov 2013 15:48:08 +0200 Message-Id: <1385560088-22339-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <20131126124238.GC7427@katana> References: <20131126124238.GC7427@katana> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: , 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 --- Posting this as a saparate patch out of RFC series. RFC: http://patchwork.ozlabs.org/patch/291726/ Only minor comment change is done since RFC patch. Based on v3.13-rc1 drivers/i2c/busses/i2c-omap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index d76228d..90dcc2e 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -266,13 +266,13 @@ static const u8 reg_map_ip_v2[] = { static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, int reg, u16 val) { - __raw_writew(val, i2c_dev->base + + writew_relaxed(val, i2c_dev->base + (i2c_dev->regs[reg] << i2c_dev->reg_shift)); } static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) { - return __raw_readw(i2c_dev->base + + return readw_relaxed(i2c_dev->base + (i2c_dev->regs[reg] << i2c_dev->reg_shift)); } @@ -1162,9 +1162,9 @@ omap_i2c_probe(struct platform_device *pdev) * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2. * On omap1/3/2 Offset 4 is IE Reg the bit [15:14] is 0 at reset. * Also since the omap_i2c_read_reg uses reg_map_ip_* a - * raw_readw is done. + * readw_relaxed is done. */ - rev = __raw_readw(dev->base + 0x04); + rev = readw_relaxed(dev->base + 0x04); dev->scheme = OMAP_I2C_SCHEME(rev); switch (dev->scheme) {