linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Additional SPI-master parameters per SPI-Device in device-tree
@ 2015-08-04  6:39 Martin Sperl
       [not found] ` <55C05E18.600-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Sperl @ 2015-08-04  6:39 UTC (permalink / raw)
  To: Mark Brown, linux-spi

Hi!

How could we implement additional per spi-device parameters that
are interesting to the spi-master.

Examples for the spi-bcm2835 master for example could be:
* set minimum transfer size for dma to something else but the default
    (of 96 bytes - setting for something high would disable it)
* change polling transfer limits (i.e disable it)

Implementing these on a spi-master level is easy during probe.

So I wonder if the following approach would be acceptable
to implement device-tree parsing on the device for master
specific parameters:

int bcm2835_spi_setup(struct spi_device *spi)
{
   struct bcm2835_spi_dev *cs = spi->controller_state;
   if (!cs) {
     cs = devm_kzalloc(&spi->dev, sizeof(struct bcm2835_spi_dev), 0);
     if (!cs)
         return -ENOMEM;
     spi->controller_state = cs;

     /* parse device-tree and assign to controller_state */
     cs->polling_limit = master_bs->polling_limit;
     of_property_read_u32(nc, "spi-bcm2835-polling-limit", 
&cs->polling_limit);
     cs->dma_limit = master_bs->dma_limit;
     of_property_read_u32(nc, "spi-bcm2835-dma-limit", &cs->polling_limit);
   }
   ...
   return 0;
}

Or would it be better if we included an additional master method
that would get called from spi_add_device to do this kind of setup?
say:
   int add_device(struct spi_master *master, struct spi_device *spi);
(possibly also one called when removing the device)

Thanks,
                 Martin

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-04 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04  6:39 Additional SPI-master parameters per SPI-Device in device-tree Martin Sperl
     [not found] ` <55C05E18.600-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-08-04  9:54   ` Mark Brown
     [not found]     ` <20150804095443.GH20873-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-08-04 10:09       ` Martin Sperl
     [not found]         ` <55C08F70.5070303-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-08-04 11:15           ` Mark Brown
     [not found]             ` <20150804111528.GL20873-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-08-04 11:37               ` Martin Sperl
     [not found]                 ` <55C0A40C.5070806-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2015-08-04 15:00                   ` Mark Brown

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).