From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <51D689F3.3070605@ti.com> Date: Fri, 5 Jul 2013 14:25:15 +0530 From: Sourav Poddar MIME-Version: 1.0 To: yuhang wang Subject: Re: SPI: DUAL/QUAD support References: <20130704130017.GA25997@sig21.net> <20130704154927.GE27646@sirena.org.uk> <51D67851.8020402@ti.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-mtd , Johannes Stezenbach , Grant Likely , Mark Brown , linux-mtd@lists.infradead.org, Thomas.Betker@rohde-schwarz.com, spi-devel-general@lists.sourceforge.net, linux-arm-kernel@lists.infradead.org List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Friday 05 July 2013 02:18 PM, yuhang wang wrote: >> To add to all the discussion going on, >> I am using a qspi controller with a spansion flash device. >> I tried using quad read mode bit, and what is required to change in >> my case is the following: >> >> 1. enable quad mode in flash configuration register. >> 2. change my read opcode to QUAD READ opcode according to flash datasheet. >> 3. Configure my qspi controller cmd reg to use 6 PIN whenever quad mode is >> used. >> > Sorry, to the third point I am still not very clear. The first time, > spi controller should send > QUAD READ opcode to your spansion flash with 1 line, then receive datas from > flash with 4 lines. So how does your controller master this process > automatically. > > Please give me some details. > Its like, you pass txbuf and rxbuf from the spi core to your controller driver. So, if your txbuf is not null then configure the controller cmd register with WRITE_SINGLE and if rxbuf is not null then configure the controller cmd register with READ_QUAD. Something like this, if (txbuf) { dra7xxx_writel_data(qspi, *txbuf++, QSPI_SPI_DATA_REG, wlen); dra7xxx_writel(qspi, qspi->dc, QSPI_SPI_DC_REG); dra7xxx_writel(qspi, qspi->cmd | QSPI_WR_SNGL, QSPI_SPI_CMD_REG); wait_for_completion(&qspi->word_complete); } if (rxbuf) { printk("rx cmd %08x dc %08x\n", qspi->cmd | QSPI_RD_QUAD, qspi->dc); dra7xxx_writel(qspi, INT_EN, QSPI_INTR_ENABLE_SET_REG); dra7xxx_writel(qspi, qspi->dc, QSPI_SPI_DC_REG); if (!quad_mode) dra7xxx_writel(qspi, qspi->cmd | QSPI_RD_SNGL, QSPI_SPI_CMD_REG); else dra7xxx_writel(qspi, qspi->cmd | QSPI_RD_QUAD, QSPI_SPI_CMD_REG); ....... } > Thanks