Additional SPI-master parameters per SPI-Device in device-tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux