From patchwork Wed Dec 1 09:29:18 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Mingkai-B21284 X-Patchwork-Id: 370831 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB1AKmFu027258 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Dec 2010 10:21:14 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PNjnp-0003x6-IT; Wed, 01 Dec 2010 10:20:45 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1PNjno-0003x1-2E for spi-devel-general@lists.sourceforge.net; Wed, 01 Dec 2010 10:20:44 +0000 X-ACL-Warn: Received: from am1ehsobe001.messaging.microsoft.com ([213.199.154.204] helo=AM1EHSOBE001.bigfish.com) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.69) id 1PNjnm-000146-Lq for spi-devel-general@lists.sourceforge.net; Wed, 01 Dec 2010 10:20:44 +0000 Received: from mail18-am1-R.bigfish.com (10.3.201.246) by AM1EHSOBE001.bigfish.com (10.3.204.21) with Microsoft SMTP Server id 14.1.225.8; Wed, 1 Dec 2010 10:05:26 +0000 Received: from mail18-am1 (localhost.localdomain [127.0.0.1]) by mail18-am1-R.bigfish.com (Postfix) with ESMTP id 6FE925A04B3 for ; Wed, 1 Dec 2010 10:05:26 +0000 (UTC) X-SpamScore: 5 X-BigFish: VS5(zza615mzz1202hzz8275bhz2dh2a8h691h668h67dh61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:az33egw02.freescale.net; RD:az33egw02.freescale.net; EFVD:NLI Received: from mail18-am1 (localhost.localdomain [127.0.0.1]) by mail18-am1 (MessageSwitch) id 1291197926250120_8389; Wed, 1 Dec 2010 10:05:26 +0000 (UTC) Received: from AM1EHSMHS007.bigfish.com (unknown [10.3.201.250]) by mail18-am1.bigfish.com (Postfix) with ESMTP id 39D4F145004C for ; Wed, 1 Dec 2010 10:05:26 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by AM1EHSMHS007.bigfish.com (10.3.207.107) with Microsoft SMTP Server (TLS) id 14.1.225.8; Wed, 1 Dec 2010 10:05:23 +0000 Received: from de01smr01.freescale.net (de01smr01.freescale.net [10.208.0.31]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id oB1A5KP1004471 for ; Wed, 1 Dec 2010 03:05:21 -0700 (MST) Received: from zch01exm21.fsl.freescale.net (zch01exm21.ap.freescale.net [10.192.129.205]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id oB1AM7hX019475 for ; Wed, 1 Dec 2010 04:22:08 -0600 (CST) Received: from localhost ([10.193.20.106]) by zch01exm21.fsl.freescale.net with Microsoft SMTPSVC(6.0.3790.4675); Wed, 1 Dec 2010 18:06:38 +0800 From: Mingkai Hu To: , Subject: [PATCH] eSPI: change the read behavior of the SPIRF Date: Wed, 1 Dec 2010 17:29:18 +0800 Message-ID: <1291195758-12322-1-git-send-email-Mingkai.hu@freescale.com> X-Mailer: git-send-email 1.6.4 X-OriginalArrivalTime: 01 Dec 2010 10:06:38.0753 (UTC) FILETIME=[71BF7110:01CB913F] MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. X-Headers-End: 1PNjnm-000146-Lq Cc: kumar.gala@freescale.com, tie-fei.zang@freescale.com, Mingkai Hu X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 10:21:14 +0000 (UTC) diff --git a/drivers/spi/spi_fsl_espi.c b/drivers/spi/spi_fsl_espi.c index e3b4f64..ae78926 100644 --- a/drivers/spi/spi_fsl_espi.c +++ b/drivers/spi/spi_fsl_espi.c @@ -507,16 +507,29 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) /* We need handle RX first */ if (events & SPIE_NE) { - u32 rx_data; + u32 rx_data, tmp; + u8 rx_data_8; /* Spin until RX is done */ while (SPIE_RXCNT(events) < min(4, mspi->len)) { cpu_relax(); events = mpc8xxx_spi_read_reg(®_base->event); } - mspi->len -= 4; - rx_data = mpc8xxx_spi_read_reg(®_base->receive); + if (mspi->len >= 4) { + rx_data = mpc8xxx_spi_read_reg(®_base->receive); + } else { + tmp = mspi->len; + rx_data = 0; + while (tmp--) { + rx_data_8 = in_8((u8 *)®_base->receive); + rx_data |= (rx_data_8 << (tmp * 8)); + } + + rx_data <<= (4 - mspi->len) * 8; + } + + mspi->len -= 4; if (mspi->rx) mspi->get_rx(rx_data, mspi);