From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/8] tegra2: spi: Add SPI driver for Tegra2 SOC
Date: Sat, 5 Nov 2011 13:13:46 -0400 [thread overview]
Message-ID: <201111051313.47495.vapier@gentoo.org> (raw)
In-Reply-To: <CAPnjgZ2oo+E8KuzDQh1JRgf_a=LjG52Dkqdrj41oX8hC=m-9hA@mail.gmail.com>
On Saturday 05 November 2011 10:36:30 Simon Glass wrote:
> On Thu, Nov 3, 2011 at 6:36 PM, Mike Frysinger wrote:
> > On Thursday 03 November 2011 18:41:34 Simon Glass wrote:
> >> --- /dev/null
> >> +++ b/drivers/spi/tegra2_spi.c
> >>
> >> +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> >> +{
> >> + /* Tegra2 SPI-Flash - only 1 device ('bus/cs') */
> >> + if (bus > 0 && cs != 0)
> >> + return 0;
> >> + else
> >> + return 1;
> >> +}
> >
> > shouldn't that be "||" and not "&&" ?
>
> This function should be removed as it doesn't print enough errors.
this func is part of the SPI API. you can't remove it ;).
> >> +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
> >> + unsigned int max_hz, unsigned int mode)
> >> +{
> >> + struct tegra_spi_slave *spi;
> >> +
> >> + if (!spi_cs_is_valid(bus, cs))
> >> + return NULL;
> >> +
> >> + if (bus != 0) {
> >> + printf("SPI error: unsupported bus %d\n", bus);
> >> + return NULL;
> >> + }
> >> + if (cs != 0) {
> >> + printf("SPI error: unsupported chip select %d on bus
> >> %d\n", + cs, bus);
> >> + return NULL;
> >> + }
> >
> > doesn't spi_cs_is_valid() make these two later checks redundant ?
>
> Yes - have removed the function.
i think this is the wrong direction ... other SPI buses are not warning about
invalid bus/cs combos and that seems to be fine. i don't think the tegra spi
bus needs to be uniquely verbose.
> >> + reg = readl(®s->status);
> >> + writel(reg, ®s->status); /* Clear all SPI events via R/W */
> >
> > are these R1C or W1C bits ? if the latter, you could just write -1 and
> > avoid the read altogether ...
>
> The next line is:
>
> debug("spi_xfer entry: STATUS = %08x\n", reg);
>
> and I didn't want to remove that, so I need to keep the read
> unfortunately. It could perhaps be this if you are keen:
>
> writel(-1, ®s->status); /* Clear all SPI events via R/W */
> debug("spi_xfer entry: STATUS = %08x\n", readl(®->status));
what you have now is fine if you prefer it that way
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111105/45020a50/attachment.pgp
next prev parent reply other threads:[~2011-11-05 17:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-03 22:41 [U-Boot] [PATCH v2 0/8] tegra2: Implement SPI flash and saved environment Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 1/8] tegra2: Tidy UART selection Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 2/8] tegra2: Add UARTB support Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 3/8] tegra2: spi: Add SPI driver for Tegra2 SOC Simon Glass
2011-11-04 1:36 ` Mike Frysinger
2011-11-05 14:36 ` Simon Glass
2011-11-05 17:13 ` Mike Frysinger [this message]
2011-11-05 19:17 ` Simon Glass
2011-11-06 8:41 ` Mike Frysinger
2011-11-03 22:41 ` [U-Boot] [PATCH v2 4/8] tegra2: config: Enable SPI flash on Seaboard Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 5/8] tegra2: Enable SPI environment " Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 6/8] tegra2: Implement SPI / UART GPIO switch Simon Glass
2011-11-04 1:44 ` Mike Frysinger
2011-11-05 14:43 ` Simon Glass
2011-11-05 17:11 ` Mike Frysinger
2011-11-05 19:05 ` Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 7/8] tegra2: spi: Support SPI / UART switch Simon Glass
2011-11-03 22:41 ` [U-Boot] [PATCH v2 8/8] tegra2: Plumb in SPI/UART switch code 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=201111051313.47495.vapier@gentoo.org \
--to=vapier@gentoo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.