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: 3218781 Return-Path: X-Original-To: patchwork-davinci@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 7B1869F3A0 for ; Thu, 21 Nov 2013 14:26:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4CC41202AB for ; Thu, 21 Nov 2013 14:26:46 +0000 (UTC) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF3DC2078A for ; Thu, 21 Nov 2013 14:26:43 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id rALEPS2N024603; Thu, 21 Nov 2013 08:25:28 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id rALEPRAN031911; Thu, 21 Nov 2013 08:25:27 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Thu, 21 Nov 2013 08:25:26 -0600 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id rALEPQL9025161; Thu, 21 Nov 2013 08:25:26 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C824F8062C; Thu, 21 Nov 2013 08:25:25 -0600 (CST) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dlelxv84.itg.ti.com (dlelxv84.itg.ti.com [172.17.0.246]) by linux.omap.com (Postfix) with ESMTP id E2CE880626 for ; Wed, 20 Nov 2013 12:24:00 -0600 (CST) Received: from white.ext.ti.com (white.ext.ti.com [192.94.93.38]) by dlelxv84.itg.ti.com (8.14.3/8.13.8) with ESMTP id rAKIO0qa020358 for ; Wed, 20 Nov 2013 12:24:00 -0600 Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id rAKINxMb022374 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 20 Nov 2013 12:24:00 -0600 Received: from [216.82.242.147:27561] by server-13.bemta-8.messagelabs.com id 68/61-10295-F3EFC825; Wed, 20 Nov 2013 18:23:59 +0000 X-Env-Sender: taras.kondratiuk@linaro.org X-Msg-Ref: server-5.tower-95.messagelabs.com!1384971838!20790223!1 X-Originating-IP: [74.125.83.50] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.9.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30515 invoked from network); 20 Nov 2013 18:23:59 -0000 Received: from mail-ee0-f50.google.com (HELO mail-ee0-f50.google.com) (74.125.83.50) by server-5.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 20 Nov 2013 18:23:59 -0000 Received: by mail-ee0-f50.google.com with SMTP id e53so2377716eek.37 for ; Wed, 20 Nov 2013 10:23:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=96PHsFykp54UkercNdZbEk5tICw3161cji7GNbDqcXM=; b=KvK3mwFkRpDtIHsgFTvi1OlIw1pW14bu2XfPX2Ci5GieGGBcUh9FSf0w+JMNp8cY4T E5YkBlijPxOXFGJl9NvVK+QsFi+EVVBs3y8G8OV9BSGTdtjP9+q4lKg1C6lFSC4AGK2n cXyAUQzVXzuADlmI2ECCacklGnjcWtZZG5ACPLaovkXR8Dfa/Tx0e6um7/EcmQeeMshE 77S6MS4MsA0dEdXMq0WeWeEjAZo29oSEXrlKpGbL347YCD+8PIthnRix+ALVAXC8LFmd RxyQxWzQh/xIPaTBxeZju+dyhHTVspiXI1FxuBd7HwX14vLnhX5yq6kiWBlSBSZXbw7l ieqg== X-Gm-Message-State: ALoCoQmG9MpJ2BvfZTJutJJzmgWy6Loy7LWWcr5YHWsKlbqzcQrR7RmCVPFvgWpZVdLYT6HRjGAj 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 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-Mailman-Approved-At: Thu, 21 Nov 2013 08:25:23 -0600 CC: , , , Kevin Hilman , , Santosh Shilimkar , , X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham 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 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. */