Lines Matching full:spi
2 * SPI OF support routines
5 * Support routines for deriving SPI device attachments from the device
12 #include <linux/spi/spi.h>
17 * of_register_spi_devices - Register child devices onto the SPI bus
25 struct spi_device *spi; in of_register_spi_devices() local
36 spi = spi_alloc_device(master); in of_register_spi_devices()
37 if (!spi) { in of_register_spi_devices()
40 spi_dev_put(spi); in of_register_spi_devices()
45 if (of_modalias_node(nc, spi->modalias, in of_register_spi_devices()
46 sizeof(spi->modalias)) < 0) { in of_register_spi_devices()
49 spi_dev_put(spi); in of_register_spi_devices()
58 spi_dev_put(spi); in of_register_spi_devices()
61 spi->chip_select = be32_to_cpup(prop); in of_register_spi_devices()
64 if (of_find_property(nc, "spi-cpha", NULL)) in of_register_spi_devices()
65 spi->mode |= SPI_CPHA; in of_register_spi_devices()
66 if (of_find_property(nc, "spi-cpol", NULL)) in of_register_spi_devices()
67 spi->mode |= SPI_CPOL; in of_register_spi_devices()
68 if (of_find_property(nc, "spi-cs-high", NULL)) in of_register_spi_devices()
69 spi->mode |= SPI_CS_HIGH; in of_register_spi_devices()
72 prop = of_get_property(nc, "spi-max-frequency", &len); in of_register_spi_devices()
74 dev_err(&master->dev, "%s has no 'spi-max-frequency' property\n", in of_register_spi_devices()
76 spi_dev_put(spi); in of_register_spi_devices()
79 spi->max_speed_hz = be32_to_cpup(prop); in of_register_spi_devices()
82 spi->irq = irq_of_parse_and_map(nc, 0); in of_register_spi_devices()
86 spi->dev.of_node = nc; in of_register_spi_devices()
89 request_module(spi->modalias); in of_register_spi_devices()
90 rc = spi_add_device(spi); in of_register_spi_devices()
94 spi_dev_put(spi); in of_register_spi_devices()