From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Tegra210: add QSPI driver
Date: Fri, 9 Oct 2015 12:50:50 -0600 [thread overview]
Message-ID: <56180C8A.7020004@wwwdotorg.org> (raw)
In-Reply-To: <95af6148ae9e4948a1f9f51e177682aa@HQMAIL103.nvidia.com>
On 10/09/2015 12:20 PM, Tom Warren wrote:
> From: Yen Lin <yelin@nvidia.com>
>
> Tested on P2571 board with Winbond SPI ROM.
> sf probe 2:0 to see SPI chip. Flashed U-Boot image to SPI, rebooted, read back data to RAM with sf read, then verified crc against original binary file.
> board/nvidia/p2571/pinmux-config-p2571.h | 14 +-
> configs/p2571_defconfig | 1 +
As a general comment, driver changes should be in separate patches to
board changes to enable the driver. The two things are logically
separate, and this also helps when cherry-picking patches between
branches that might not have p2571 support.
> diff --git a/board/nvidia/p2571/pinmux-config-p2571.h b/board/nvidia/p2571/pinmux-config-p2571.h
> - PINCFG(QSPI_SCK_PEE0, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> - PINCFG(QSPI_CS_N_PEE1, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> - PINCFG(QSPI_IO0_PEE2, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> - PINCFG(QSPI_IO1_PEE3, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> - PINCFG(QSPI_IO2_PEE4, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> - PINCFG(QSPI_IO3_PEE5, RSVD1, DOWN, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> +
> + PINCFG(QSPI_SCK_PEE0, QSPI, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
> + PINCFG(QSPI_CS_N_PEE1, QSPI, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
> + PINCFG(QSPI_IO0_PEE2, QSPI, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
> + PINCFG(QSPI_IO1_PEE3, QSPI, NORMAL, NORMAL, INPUT, DISABLE, DEFAULT),
> + PINCFG(QSPI_IO2_PEE4, QSPI, UP, TRISTATE, OUTPUT, DISABLE, DEFAULT),
> + PINCFG(QSPI_IO3_PEE5, QSPI, UP, TRISTATE, OUTPUT, DISABLE, DEFAULT),
The current pinmux matches the syseng-supplied spreadsheet. If the
spreadsheet is wrong, please get syseng to update the spreadsheet first.
The pinmux files must not be manually edited, so we ensure that the
mandated pinmux is used.
> diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c new file mode 100644 index 0000000..d827667
> +static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus) {
> + struct tegra_spi_platdata *plat = bus->platdata;
> + const void *blob = gd->fdt_blob;
> + int node = bus->of_offset;
> +
> + plat->base = fdtdec_get_addr(blob, node, "reg");
I think that should use dev_get_addr() now, since that does the correct
thing w.r.t. #address-cells/#size-cells.
> +static int tegra210_qspi_claim_bus(struct udevice *bus) {
> + /* Clear stale status here */
> + setbits_le32(®s->fifo_status,
> + QSPI_FIFO_STS_ERR |
> + QSPI_FIFO_STS_TX_FIFO_OVF |
> + QSPI_FIFO_STS_TX_FIFO_UNR |
> + QSPI_FIFO_STS_RX_FIFO_OVF |
> + QSPI_FIFO_STS_RX_FIFO_UNR |
> + QSPI_FIFO_STS_TX_FIFO_FULL |
> + QSPI_FIFO_STS_TX_FIFO_EMPTY |
> + QSPI_FIFO_STS_RX_FIFO_FULL |
> + QSPI_FIFO_STS_RX_FIFO_EMPTY);
> + debug("%s: FIFO STATUS = %08x\n", __func__,
> +readl(®s->fifo_status));
Indentation issue.
I would expect at least that setbits_le32() to happen inside the
transfer function so that every transfer is immune to stale status, not
just the first transfer after the bus is cleared.
Actually, it looks like the transfer function already does this, so the
above code can simply be dropped.
Perhaps the other HW-touching code might be moved to, but it's probably
fine to leave it here.
next prev parent reply other threads:[~2015-10-09 18:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 18:15 [U-Boot] [PATCH] Tegra210: add QSPI driver Tom Warren
2015-10-09 18:20 ` Tom Warren
2015-10-09 18:50 ` Stephen Warren [this message]
2015-10-12 21:57 ` Tom Warren
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=56180C8A.7020004@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--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