From patchwork Wed Nov 20 18:23:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 21656 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7FED923FDC for ; Wed, 20 Nov 2013 18:24:00 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id v1sf18711837yhn.0 for ; Wed, 20 Nov 2013 10:23:59 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=96PHsFykp54UkercNdZbEk5tICw3161cji7GNbDqcXM=; b=Z0ANEV9lqRCVvXfDUzccl4OJQK+JD1wvczb8XIjn4EbSNNVl3so0gX3hr9xjK5RL94 dezDuj6blVjApTXgW+Y452PTTYmdBVO+MD84x5a3f5osnxVQSbEJJovd/2CIL/Xxz96l 5DB6ze+zWLBWNzt/HgI/VaS97YEUMHSj11J1IKScQmtfpmE4yZFUbUFaO7imCiFaRHhJ mbEjpKl/ayW9LKltj8x4YdcavtbsxcFIVJJPEy6sk+b0LgtL7BR20eLAPuu36VpSjU0P n59yMlGYPw6Ki6ZrDiccFzN6Azf/rIWUHbf+02lZUC5rsjbYVY4NEXaXe/f0o6qTs/n4 3tMQ== X-Gm-Message-State: ALoCoQmVs4q2N9oF6R4uNHXAETgBYuxRwxKzaDB5UtzCOV+mVdv5tf5IP15kBa83ySi5hKQQ9ADd X-Received: by 10.52.244.136 with SMTP id xg8mr564979vdc.7.1384971839636; Wed, 20 Nov 2013 10:23:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.103.136 with SMTP id fw8ls176288qeb.20.gmail; Wed, 20 Nov 2013 10:23:59 -0800 (PST) X-Received: by 10.52.64.143 with SMTP id o15mr1325772vds.16.1384971839510; Wed, 20 Nov 2013 10:23:59 -0800 (PST) Received: from mail-vb0-f42.google.com (mail-vb0-f42.google.com [209.85.212.42]) by mx.google.com with ESMTPS id at4si9781102ved.75.2013.11.20.10.23.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 10:23:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.42 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.42; Received: by mail-vb0-f42.google.com with SMTP id w18so659343vbj.15 for ; Wed, 20 Nov 2013 10:23:59 -0800 (PST) X-Received: by 10.220.145.75 with SMTP id c11mr1525086vcv.30.1384971839172; Wed, 20 Nov 2013 10:23:59 -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 u4csp372069vcz; Wed, 20 Nov 2013 10:23:58 -0800 (PST) X-Received: by 10.15.110.75 with SMTP id cg51mr2622451eeb.42.1384971838125; Wed, 20 Nov 2013 10:23:58 -0800 (PST) Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by mx.google.com with ESMTPS id 5si4085083eei.78.2013.11.20.10.23.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 10:23:58 -0800 (PST) Received-SPF: neutral (google.com: 74.125.83.44 is neither permitted nor denied by best guess record for domain of taras.kondratiuk@linaro.org) client-ip=74.125.83.44; Received: by mail-ee0-f44.google.com with SMTP id d51so4246562eek.3 for ; Wed, 20 Nov 2013 10:23:57 -0800 (PST) X-Received: by 10.15.26.131 with SMTP id n3mr2636479eeu.21.1384971837604; Wed, 20 Nov 2013 10:23:57 -0800 (PST) Received: from condor-x220.synapse.com ([195.238.93.36]) by mx.google.com with ESMTPSA id v45sm12584258eef.11.2013.11.20.10.23.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Nov 2013 10:23:57 -0800 (PST) From: Taras Kondratiuk To: Wolfram Sang Cc: Santosh Shilimkar , patches@linaro.org, linaro-networking@linaro.org, linaro-kernel@lists.linaro.org, Sekhar Nori , Kevin Hilman , davinci-linux-open-source@linux.davincidsp.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: davinci: raw read and write endian fix Date: Wed, 20 Nov 2013 20:23:44 +0200 Message-Id: <1384971824-7707-1-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 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.42 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: , I2C IP block 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: Taras Kondratiuk Reviewed-by: Grygorii Strashko --- Based on Linus' master tip (b4789b8). Tested on Keystone2 EVM. drivers/i2c/busses/i2c-davinci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 132369f..a629447 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -125,12 +125,12 @@ static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = { static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev, int reg, u16 val) { - __raw_writew(val, i2c_dev->base + reg); + writew_relaxed(val, i2c_dev->base + reg); } static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg) { - return __raw_readw(i2c_dev->base + reg); + return readw_relaxed(i2c_dev->base + reg); } /* Generate a pulse on the i2c clock pin. */