From: Guochun Mao <guochun.mao@mediatek.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 17/18] spi: mtk_qspi: add qspi driver for MT7629 SoC
Date: Thu, 22 Nov 2018 16:58:54 +0800 [thread overview]
Message-ID: <1542877134.4337.28.camel@mhfsdcap03> (raw)
In-Reply-To: <CAMty3ZDkC4_rPgb8b5XYdFfmJWk2BmaOCk8R6XH65CKMZDE_yQ@mail.gmail.com>
On Thu, 2018-11-22 at 11:51 +0530, Jagan Teki wrote:
> On Wed, Nov 21, 2018 at 5:16 PM Guochun Mao <guochun.mao@mediatek.com> wrote:
> >
> > Hi Jagan,
> >
> > On Wed, 2018-11-21 at 15:08 +0530, Jagan Teki wrote:
> >
> > > > > > +static int mtk_qspi_tx_rx(struct mtk_qspi_priv *priv)
> > > > > > +{
> > > > > > + int len = 1 + priv->txlen + priv->rxlen;
> > > > > > + int i, ret, idx;
> > > > > > +
> > > > > > + if (len > MTK_QSPI_MAX_SHIFT)
> > > > > > + return -ERR_INVAL;
> > > > > > +
> > > > > > + writeb(len * 8, &priv->regs->cnt);
> > > > > > +
> > > > > > + /* start at PRGDATA5, go down to PRGDATA0 */
> > > > > > + idx = MTK_QSPI_MAX_RX_TX_SHIFT - 1;
> > > > > > +
> > > > > > + /* opcode */
> > > > > > + writeb(priv->op, &priv->regs->prgdata[idx]);
> > > > > > + idx--;
> > > > > > +
> > > > > > + /* program TX data */
> > > > > > + for (i = 0; i < priv->txlen; i++, idx--)
> > > > > > + writeb(priv->tx[i], &priv->regs->prgdata[idx]);
> > > > > > +
> > > > > > + /* clear out rest of TX registers */
> > > > > > + while (idx >= 0) {
> > > > > > + writeb(0, &priv->regs->prgdata[idx]);
> > > > > > + idx--;
> > > > > > + }
> > > > > > +
> > > > > > + ret = mtk_qspi_execute_cmd(priv, MTK_QSPI_PRG_CMD);
> > > > >
> > > > > What does this execute do?
> > > > It send command to flash, and latch data if need.
> > > >
> > > > > does it intiate the controller register
> > > > > based flash command or so?
> > > > No, it doesn't.
> > > >
> > > > >
> > > > > Do you have Linux driver on the controller?
> > > > Yes, it's drivers/mtd/spi-nor/mtk-quadspi.c
> > >
> > > This sounds more specific to flash controller rather than spi driver.
> > > Can you try to write driver in mtd side itself, like Linux spi-nor.
> > > use UCLASS_SPI_FLASH
> >
> > Sorry, I'm a little confused.
> > There are many files(***qspi.c) those that used for accessing spi flash
> > under folder drivers/spi/.
> > However, there's no specific flash controller driver implemented under
> > drives/mtd, only common spi_flash framework. It's different with kernel.
> > It seems that we only need implement the spi control logic of
> > spi-flash-controller(this part not based on flash, it only do
> > data-xfer), and spi_flash framework will work well base on it.
> > Isn't that the purpose of this architecture?
>
> Understand your point, to be precise the driver may a fall in trouble
> after sometime, if there is an additional flash specific features will
> attach in future. ie reason few of flash controllers in drivers/spi
> were unable to move further to add their features. and ie also reason
> for your driver in Linux which resides in spi-nor.
>
> You can directly write UCLASS_SPI_FLASH like sf_dataflash, I can help
> if any issues with probing setup etc.
Hi Jagan,
Could you reconsider this driver?
The code can match our needs for a considerable time, it's simple and
doesn't disrupt current architecture.
If we switched to MTD_SPI_FLASH, there will inevitably be some
duplicated codes. The current version of code adopts the sf/spi
framework, it can guarantee compatibility and code reusability ratio.
If spi-mem or spi-nor was introduced to uboot in future, we can quickly
implement new version code.
Thanks.
BR,
Guochun
next prev parent reply other threads:[~2018-11-22 8:58 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 7:00 [U-Boot] [PATCH v2 00/18] Add U-Boot support for MediaTek SoCs - MT7623n & MT7629 Ryder Lee
2018-10-12 7:00 ` [U-Boot] [PATCH v2 01/18] tools: MediaTek: add MTK boot header generation to mkimage Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 13:11 ` Ryder Lee
2018-10-12 7:00 ` [U-Boot] [PATCH v2 02/18] arm: dts: MediaTek: add device tree for MT7629 Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 03/18] arm: dts: MediaTek: add device tree for MT7623 Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 04/18] arm: MediaTek: add basic support for MT7629 boards Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 6:44 ` Ryder Lee
2018-10-12 7:00 ` [U-Boot] [PATCH v2 05/18] arm: MediaTek: add basic support for MT7623 boards Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 6:40 ` Ryder Lee
2018-10-12 7:00 ` [U-Boot] [PATCH v2 06/18] clk: MediaTek: add clock driver for MT7629 SoC Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 6:37 ` Ryder Lee
2018-11-03 6:08 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 07/18] clk: MediaTek: add clock driver for MT7623 SoC Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 08/18] timer: MediaTek: add timer driver for MediaTek SoCs Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 09/18] watchdog: MediaTek: add watchdog " Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:00 ` [U-Boot] [PATCH v2 10/18] pinctrl: MediaTek: add pinctrl driver for MT7629 SoC Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 6:08 ` Ryder Lee
2018-11-03 6:08 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 11/18] pinctrl: MediaTek: add pinctrl driver for MT7623 SoC Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-25 6:13 ` Ryder Lee
2018-11-03 6:08 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 12/18] power domain: MediaTek: add power domain driver for MT7629 SoC Ryder Lee
2018-10-25 3:29 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 13/18] power domain: MediaTek: add power domain driver for MT7623 SoC Ryder Lee
2018-10-25 3:30 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 14/18] serial: 16550: allow the driver to support MediaTek serial Ryder Lee
2018-10-25 3:30 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 15/18] ram: MediaTek: add DDR3 driver for MT7629 SoC Ryder Lee
2018-10-25 3:30 ` Simon Glass
2018-10-25 9:38 ` Ryder Lee
2018-10-26 16:53 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 16/18] mmc: mtk-sd: add SD/MMC host controller driver for MT7623 SoC Ryder Lee
2018-10-25 3:30 ` Simon Glass
2018-10-12 7:01 ` [U-Boot] [PATCH v2 17/18] spi: mtk_qspi: add qspi driver for MT7629 SoC Ryder Lee
2018-10-25 3:30 ` Simon Glass
2018-10-26 6:33 ` Jagan Teki
2018-11-14 9:04 ` Jagan Teki
2018-11-14 12:53 ` Guochun Mao
2018-11-21 9:38 ` Jagan Teki
2018-11-21 11:46 ` Guochun Mao
2018-11-22 6:21 ` Jagan Teki
2018-11-22 8:58 ` Guochun Mao [this message]
2018-11-23 5:43 ` Jagan Teki
2018-11-23 8:24 ` Guochun Mao
2018-10-12 7:01 ` [U-Boot] [PATCH v2 18/18] MAINTAINERS: add an entry for MediaTek Ryder Lee
2018-10-25 3:30 ` Simon Glass
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=1542877134.4337.28.camel@mhfsdcap03 \
--to=guochun.mao@mediatek.com \
--cc=u-boot@lists.denx.de \
/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