From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Grant Likely
<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
Chris Boot <bootc-1Slo4GeK4H1eoWH0uzbU5w@public.gmane.org>,
linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] spi: add driver for BCM2835
Date: Wed, 6 Mar 2013 12:05:22 +0800 [thread overview]
Message-ID: <20130306040520.GA4896@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1362538142-19246-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
[-- Attachment #1.1: Type: text/plain, Size: 2218 bytes --]
On Tue, Mar 05, 2013 at 07:49:02PM -0700, Stephen Warren wrote:
> +Optional properties:
> +- brcm,realtime: Boolean. Indicates the driver should operate with realtime
> + priority to minimise the transfer latency on the bus.
This isn't obviously something that ought to be in DT, it'll depend on
the OS, kernel version and so on. Indeed I don't think this is used any
more as the generic pump code Linus did handles it already in a runtime
tunable way?
> +static irqreturn_t bcm2835_spi_interrupt(int irq, void *dev_id)
> +{
> + if (cs & BCM2835_SPI_CS_DONE) {
> + }
> + } else if (cs & BCM2835_SPI_CS_RXR) {
> + /* read 12 bytes of data */
I'd feel happier if these were independent statements in case both are
asserted simultaneously.
> + return IRQ_HANDLED;
What if neither of the statuses asserted?
> + switch (bpw) {
> + case 8:
> + break;
> + default:
> + dev_err(&spi->dev, "unsupported bits_per_word=%d\n", bpw);
> + return -EINVAL;
> + }
> + if (!(spi->mode & SPI_NO_CS) &&
> + (spi->chip_select > spi->master->num_chipselect)) {
> + dev_err(&spi->dev,
> + "invalid chipselect %u\n",
> + spi->chip_select);
> + return -EINVAL;
>` + }
This seems like stuff the core should be able to do for you.
> + list_for_each_entry(tfr, &mesg->transfers, transfer_list) {
> + err = bcm2835_spi_check_transfer(spi, tfr);
> + if (err)
> + goto out;
> +
> + err = bcm2835_spi_start_transfer(spi, tfr);
> + if (err)
> + goto out;
> +
> + timeout = wait_for_completion_timeout(&bs->done,
> + msecs_to_jiffies(BCM2835_SPI_TIMEOUT_MS));
> + if (!timeout) {
> + err = -ETIMEDOUT;
> + goto out;
> + }
But I wanted to transfer 10G in a single message at 1kHz! :P
> + /* initialise the hardware */
> + clk_prepare_enable(bs->clk);
> + bcm2835_wr(bs, BCM2835_SPI_CS,
> + BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
It'd be nice to only enable the clock during transfers.
> +static int bcm2835_spi_remove(struct platform_device *pdev)
> +{
> + struct spi_master *master = platform_get_drvdata(pdev);
> + struct bcm2835_spi *bs = spi_master_get_devdata(master);
> +
> + spi_unregister_master(master);
> + free_irq(bs->irq, master);
Should these be the other way around?
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 206 bytes --]
_______________________________________________
linux-rpi-kernel mailing list
linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
next prev parent reply other threads:[~2013-03-06 4:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-06 2:49 [PATCH] spi: add driver for BCM2835 Stephen Warren
[not found] ` <1362538142-19246-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-06 4:05 ` Mark Brown [this message]
[not found] ` <20130306040520.GA4896-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2013-03-06 4:27 ` Stephen Warren
[not found] ` <5136C5AB.7020301-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-06 4:33 ` Mark Brown
2013-03-08 5:48 ` Stephen Warren
2013-03-08 6:12 ` Stephen Warren
[not found] ` <5139815E.7020502-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-03-12 19:06 ` Mark Brown
2013-03-06 10:55 ` Jonas Gorski
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=20130306040520.GA4896@opensource.wolfsonmicro.com \
--to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
--cc=bootc-1Slo4GeK4H1eoWH0uzbU5w@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).