From: Schrempf Frieder <frieder.schrempf@kontron.De>
To: Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"boris.brezillon@bootlin.com" <boris.brezillon@bootlin.com>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
Marek Vasut <marek.vasut@gmail.com>,
Mark Brown <broonie@kernel.org>, Han Xu <han.xu@nxp.com>
Cc: "dwmw2@infradead.org" <dwmw2@infradead.org>,
"computersforpeace@gmail.com" <computersforpeace@gmail.com>,
"richard@nod.at" <richard@nod.at>,
"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
David Wolfe <david.wolfe@nxp.com>,
Fabio Estevam <fabio.estevam@nxp.com>,
"Prabhakar Kushwaha" <prabhakar.kushwaha@nxp.com>,
"shawnguo@kernel.org" <shawnguo@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 3/9] spi: Add a driver for the Freescale/NXP QuadSPI controller
Date: Thu, 15 Nov 2018 11:43:05 +0000 [thread overview]
Message-ID: <3e9aa917-cf3a-cf0e-8516-4e73d30eb2a1@kontron.de> (raw)
In-Reply-To: <VI1PR04MB57265222E26C013D5D9C009B99DC0@VI1PR04MB5726.eurprd04.prod.outlook.com>
On 15.11.18 07:22, Yogesh Narayan Gaur wrote:
> Hi Frieder,
>
> With below patch on top of your v5, Read/Write/Erase on CS1 is working fine for me.
Ok, are you sure, that AHB read is working too with this patch?
You are removing the memmap_phy offset from SFAR and the SFXXAD register
values.
I can understand that selection of the CS and IP commands will work like
this, but I can't understand how AHB read should work without the base
address of the mapped memory.
I'm afraid I still don't fully understand the background of these
things, but still thank you for testing.
>
> I have tested with JFFS2 mounting and booting also for both CS0 and CS1.
>
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index ce45e8e..4467983 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -490,28 +490,10 @@ static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi)
> {
> unsigned long rate = spi->max_speed_hz;
> int ret, i;
> - u32 map_addr;
>
> if (q->selected == spi->chip_select)
> return;
>
> - /*
> - * In HW there can be a maximum of four chips on two buses with
> - * two chip selects on each bus. We use four chip selects in SW
> - * to differentiate between the four chips.
> - * We use the SFA1AD, SFA2AD, SFB1AD, SFB2AD registers to select
> - * the chip we want to access.
> - */
> - for (i = 0; i < 4; i++) {
> - if (i < spi->chip_select)
> - map_addr = q->memmap_phy;
> - else
> - map_addr = q->memmap_phy +
> - 2 * q->devtype_data->ahb_buf_size;
> -
> - qspi_writel(q, map_addr, q->iobase + QUADSPI_SFA1AD + (i * 4));
> - }
> -
> if (needs_4x_clock(q))
> rate *= 4;
>
> @@ -534,7 +516,9 @@ static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi)
>
> static void fsl_qspi_read_ahb(struct fsl_qspi *q, const struct spi_mem_op *op)
> {
> - memcpy_fromio(op->data.buf.in, q->ahb_addr, op->data.nbytes);
> + memcpy_fromio(op->data.buf.in,
> + q->ahb_addr + q->selected * q->devtype_data->ahb_buf_size,
> + op->data.nbytes);
> }
>
> static void fsl_qspi_fill_txfifo(struct fsl_qspi *q,
> @@ -634,7 +618,9 @@ static int fsl_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
>
> fsl_qspi_select_mem(q, mem->spi);
>
> - qspi_writel(q, q->memmap_phy, base + QUADSPI_SFAR);
> + qspi_writel(q,
> + q->selected * q->devtype_data->ahb_buf_size,
> + base + QUADSPI_SFAR);
>
> qspi_writel(q, qspi_readl(q, base + QUADSPI_MCR) |
> QUADSPI_MCR_CLR_RXF_MASK | QUADSPI_MCR_CLR_TXF_MASK,
> @@ -733,6 +719,19 @@ static int fsl_qspi_default_setup(struct fsl_qspi *q)
> QUADSPI_BUF3CR_ADATSZ(q->devtype_data->ahb_buf_size / 8),
> base + QUADSPI_BUF3CR);
>
> + /*
> + * In HW there can be a maximum of four chips on two buses with
> + * two chip selects on each bus. We use four chip selects in SW
> + * to differentiate between the four chips.
> + * We use the SFA1AD, SFA2AD, SFB1AD, SFB2AD registers to select
> + * the chip we want to access.
> + */
> +
> + qspi_writel(q, q->devtype_data->ahb_buf_size, base + QUADSPI_SFA1AD);
> + qspi_writel(q, q->devtype_data->ahb_buf_size * 2 , base + QUADSPI_SFA2AD);
> + qspi_writel(q, q->devtype_data->ahb_buf_size * 3 , base + QUADSPI_SFB1AD);
> + qspi_writel(q, q->devtype_data->ahb_buf_size * 4 , base + QUADSPI_SFB2AD);
> +
> q->selected = -1;
>
> --
> Regards
> Yogesh Gaur
>
> [..]
>
next prev parent reply other threads:[~2018-11-15 11:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 13:47 [PATCH v5 0/9] Port the FSL QSPI driver to the SPI framework Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 1/9] ARM: dts: Reflect change of FSL QSPI driver and remove unused properties Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 2/9] arm64: " Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 3/9] spi: Add a driver for the Freescale/NXP QuadSPI controller Schrempf Frieder
2018-11-14 8:39 ` Yogesh Narayan Gaur
2018-11-14 8:50 ` Schrempf Frieder
2018-11-14 9:03 ` Schrempf Frieder
2018-11-14 10:43 ` Yogesh Narayan Gaur
2018-11-14 10:46 ` Boris Brezillon
2018-11-14 11:07 ` Schrempf Frieder
2018-11-15 6:22 ` Yogesh Narayan Gaur
2018-11-15 11:43 ` Schrempf Frieder [this message]
2018-11-15 13:12 ` Boris Brezillon
2018-11-15 14:01 ` Schrempf Frieder
2018-11-16 5:41 ` Yogesh Narayan Gaur
2018-11-16 9:42 ` Schrempf Frieder
2018-11-16 9:46 ` Yogesh Narayan Gaur
2018-11-16 10:10 ` Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 4/9] dt-bindings: spi: Move the bindings for the FSL QSPI driver Schrempf Frieder
2018-11-16 22:59 ` Rob Herring
2018-11-13 13:47 ` [PATCH v5 5/9] dt-bindings: spi: Adjust " Schrempf Frieder
2018-11-16 22:59 ` Rob Herring
2018-11-13 13:47 ` [PATCH v5 6/9] mtd: fsl-quadspi: Remove the driver as it was replaced by spi-fsl-qspi.c Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 7/9] ARM: dts: ls1021a: Remove fsl,qspi-has-second-chip as it is not used Schrempf Frieder
2018-11-13 13:47 ` [PATCH v5 8/9] ARM64: dts: ls1046a: " Schrempf Frieder
2018-11-13 13:48 ` [PATCH v5 9/9] MAINTAINERS: Move the Freescale QSPI driver to the SPI framework Schrempf Frieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3e9aa917-cf3a-cf0e-8516-4e73d30eb2a1@kontron.de \
--to=frieder.schrempf@kontron.de \
--cc=boris.brezillon@bootlin.com \
--cc=broonie@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=david.wolfe@nxp.com \
--cc=dwmw2@infradead.org \
--cc=fabio.estevam@nxp.com \
--cc=han.xu@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=prabhakar.kushwaha@nxp.com \
--cc=richard@nod.at \
--cc=shawnguo@kernel.org \
--cc=yogeshnarayan.gaur@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®