From patchwork Wed Jul 31 05:47:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Poddar, Sourav" X-Patchwork-Id: 2836071 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D1E3BC0319 for ; Wed, 31 Jul 2013 05:48:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED850201B6 for ; Wed, 31 Jul 2013 05:48:44 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF792201B4 for ; Wed, 31 Jul 2013 05:48:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V4PH8-00018R-N3; Wed, 31 Jul 2013 05:48:42 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V4PGg-00017j-D2 for spi-devel-general@lists.sourceforge.net; Wed, 31 Jul 2013 05:48:14 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of ti.com designates 198.47.26.153 as permitted sender) client-ip=198.47.26.153; envelope-from=sourav.poddar@ti.com; helo=devils.ext.ti.com; Received: from devils.ext.ti.com ([198.47.26.153]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1V4PGf-00073B-Ge for spi-devel-general@lists.sourceforge.net; Wed, 31 Jul 2013 05:48:14 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6V5m5Po009052; Wed, 31 Jul 2013 00:48:05 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6V5m5Ug007007; Wed, 31 Jul 2013 00:48:05 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Wed, 31 Jul 2013 00:48:05 -0500 Received: from a0131647.apr.dhcp.ti.com (a0131647.apr.dhcp.ti.com [172.24.145.168]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6V5lthS019518; Wed, 31 Jul 2013 00:48:03 -0500 From: Sourav Poddar To: , , Subject: [RFC/PATCH 2/2] driver: spi: Add quad spi read support Date: Wed, 31 Jul 2013 11:17:53 +0530 Message-ID: <1375249673-2585-3-git-send-email-sourav.poddar@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1375249673-2585-1-git-send-email-sourav.poddar@ti.com> References: <1375249673-2585-1-git-send-email-sourav.poddar@ti.com> MIME-Version: 1.0 X-Spam-Score: -3.0 (---) X-Headers-End: 1V4PGf-00073B-Ge Cc: Poddar , linux-omap@vger.kernel.org, Sourav, balbi@ti.com, rnayak@ti.com 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-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Since, qspi controller uses quad read. Configuring the command register, if the transfer of data needs dual or quad lines. This patch has been done on top of the following patch[1], which is just the basic idea of adding dual/quad support in spi framework. $subject patch will undergo changes once the ongoing discussion in the community is freezed. This patch is posted to demonstrate how patch 1 of the series will support quad read. [1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14047 Signed-off-by: Sourav Poddar --- drivers/spi/spi-ti-qspi.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 02b67e9..a8c9587 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -273,6 +273,7 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t) { u8 *rxbuf; int wlen, count, ret; + unsigned cmd = qspi->cmd; count = t->len; rxbuf = t->rx_buf; @@ -282,8 +283,18 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t) dev_dbg(qspi->dev, "rx cmd %08x dc %08x\n", qspi->cmd | QSPI_RD_SNGL, qspi->dc); ti_qspi_write(qspi, qspi->dc, QSPI_SPI_DC_REG); - ti_qspi_write(qspi, qspi->cmd | QSPI_RD_SNGL, - QSPI_SPI_CMD_REG); + switch (t->bitwidth) { + case SPI_BITWIDTH_QUAD: + cmd |= QSPI_RD_QUAD; + break; + case SPI_BITWIDTH_DUAL: + cmd |= QSPI_RD_DUAL; + break; + case SPI_BITWIDTH_SINGLE: + default: + cmd |= QSPI_RD_SNGL; + } + ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); ret = wait_for_completion_timeout(&qspi->transfer_complete, QSPI_COMPLETION_TIMEOUT); if (ret == 0) {