Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Tue, 28 Apr 2009
 08:11:43 -0700
Received: from psmtp.com ([64.18.0.93]) by mail.onstor.com with Microsoft
 SMTPSVC(6.0.3790.3959);	 Tue, 28 Apr 2009 08:11:43 -0700
Received: from source ([213.58.128.207]) by exprod5mx270.postini.com
 ([64.18.4.11]) with SMTP;	Tue, 28 Apr 2009 10:11:42 CDT
Received: from localhost.localdomain ([127.0.0.1]:35556 "EHLO
	ftp.linux-mips.org" rhost-flags-OK-OK-OK-FAIL) by ftp.linux-mips.org	with
 ESMTP id S20025531AbZD1PLj (ORCPT	<rfc822;andy.sharp@onstor.com>); Tue, 28
 Apr 2009 16:11:39 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 28 Apr 2009 16:11:22
 +0100 (BST)
Received: from mba.ocn.ne.jp ([122.1.235.107]:54258 "HELO smtp.mba.ocn.ne.jp"
	rhost-flags-OK-OK-OK-OK) by ftp.linux-mips.org with SMTP	id S20025528AbZD1PLQ
 (ORCPT <rfc822;linux-mips@linux-mips.org>);	Tue, 28 Apr 2009 16:11:16 +0100
Received: from localhost.localdomain (p2111-ipad309funabasi.chiba.ocn.ne.jp
 [123.217.196.111])	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP	id 97A4AAAC9;
 Wed, 29 Apr 2009 00:11:10 +0900 (JST)
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
CC: "ralf@linux-mips.org" <ralf@linux-mips.org>, "dan.j.williams@intel.com"
	<dan.j.williams@intel.com>, "linux-kernel@vger.kernel.org"
	<linux-kernel@vger.kernel.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Tue, 28 Apr 2009 08:11:15 -0700
Subject: [PATCH] txx9dmac: Fix clearing of CHAR register in 32-bit kernel
Thread-Topic: [PATCH] txx9dmac: Fix clearing of CHAR register in 32-bit
 kernel
Thread-Index: AcnIE6P8xFokwOCOQS6fB/Cge/GMKQ==
Message-ID: <1240931475-31326-1-git-send-email-anemo@mba.ocn.ne.jp>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 28 Apr 2009 15:11:43.0148 (UTC)
 FILETIME=[A399F6C0:01C9C813]
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:78.71662/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-neptune: 0/0/0.00/0
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: Iay2Z3UtN4H1EZEtzAu2Ow==
x-list: linux-mips
x-archive-position: 22516
x-ecartis-version: Ecartis v1.0.0
x-original-sender: anemo@mba.ocn.ne.jp
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

The CHAR register is 64-bit width but 32-bit kernel uses its lower
part only.  Be careful of initializing it.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
This patch is against linux-mips.org linux-queue tree.
Please queue this or fold into "DMA: TXx9 Soc DMA Controller driver" patch.

 drivers/dma/txx9dmac.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c
index c655350..9aa9ea9 100644
--- a/drivers/dma/txx9dmac.c
+++ b/drivers/dma/txx9dmac.c
@@ -72,6 +72,16 @@ static void channel64_write_CHAR(const struct txx9dmac_c=
han *dc, dma_addr_t val)
 		channel64_writel(dc, CHAR, val);
 }
=20
+static void channel64_clear_CHAR(const struct txx9dmac_chan *dc)
+{
+#if defined(CONFIG_32BIT) && !defined(CONFIG_64BIT_PHYS_ADDR)
+	channel64_writel(dc, CHAR, 0);
+	channel64_writel(dc, __pad_CHAR, 0);
+#else
+	channel64_writeq(dc, CHAR, 0);
+#endif
+}
+
 static dma_addr_t channel_read_CHAR(const struct txx9dmac_chan *dc)
 {
 	if (is_dmac64(dc))
@@ -318,7 +328,7 @@ static void txx9dmac_reset_chan(struct txx9dmac_chan *d=
c)
 {
 	channel_writel(dc, CCR, TXX9_DMA_CCR_CHRST);
 	if (is_dmac64(dc)) {
-		channel_writeq(dc, CHAR, 0);
+		channel64_clear_CHAR(dc);
 		channel_writeq(dc, SAR, 0);
 		channel_writeq(dc, DAR, 0);
 	} else {
--=20
1.5.6.3


