Lines Matching defs:spi

15 #include <linux/spi/spi.h>
20 #include <linux/platform_data/spi-s3c64xx.h>
142 * differ in some aspects such as the size of the fifo and spi bus clock
158 * @clk: Pointer to the spi clock.
323 static void s3c64xx_spi_set_cs(struct spi_device *spi, bool enable)
326 spi_master_get_devdata(spi->master);
348 static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
350 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(spi);
355 spi->dma_rx = sdd->rx_dma.ch;
356 spi->dma_tx = sdd->tx_dma.ch;
362 struct spi_device *spi,
655 struct spi_device *spi = msg->spi;
656 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
664 static size_t s3c64xx_spi_max_transfer_size(struct spi_device *spi)
666 struct spi_controller *ctlr = spi->controller;
672 struct spi_device *spi,
695 sdd->cur_mode = spi->mode;
723 s3c64xx_spi_set_cs(spi, true);
730 dev_err(&spi->dev, "failed to enable data path for transfer: %d\n", status);
740 dev_err(&spi->dev,
754 dev_err(&spi->dev, "TX residue: %d\n", s.residue);
761 dev_err(&spi->dev, "RX residue: %d\n", s.residue);
794 struct spi_device *spi)
800 slave_np = spi->dev.of_node;
802 dev_err(&spi->dev, "device node not found\n");
808 dev_err(&spi->dev, "child node 'controller-data' not found\n");
818 of_property_read_u32(data_np, "samsung,spi-feedback-delay", &fb_delay);
830 static int s3c64xx_spi_setup(struct spi_device *spi)
832 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
836 sdd = spi_master_get_devdata(spi->master);
837 if (spi->dev.of_node) {
838 cs = s3c64xx_get_slave_ctrldata(spi);
839 spi->controller_data = cs;
841 /* On non-DT platforms the SPI core will set spi->cs_gpio
843 * is defined by using platform data so spi->cs_gpio value
846 spi->cs_gpio = cs->line;
850 dev_err(&spi->dev, "No CS for SPI(%d)\n", spi->chip_select);
854 if (!spi_get_ctldata(spi)) {
855 if (gpio_is_valid(spi->cs_gpio)) {
856 err = gpio_request_one(spi->cs_gpio, GPIOF_OUT_INIT_HIGH,
857 dev_name(&spi->dev));
859 dev_err(&spi->dev,
861 spi->cs_gpio, err);
866 spi_set_ctldata(spi, cs);
878 if (spi->max_speed_hz > speed)
879 spi->max_speed_hz = speed;
881 psr = clk_get_rate(sdd->src_clk) / 2 / spi->max_speed_hz - 1;
887 if (spi->max_speed_hz < speed) {
897 if (spi->max_speed_hz >= speed) {
898 spi->max_speed_hz = speed;
900 dev_err(&spi->dev, "Can't set %dHz transfer speed\n",
901 spi->max_speed_hz);
909 s3c64xx_spi_set_cs(spi, false);
917 s3c64xx_spi_set_cs(spi, false);
919 if (gpio_is_valid(spi->cs_gpio))
920 gpio_free(spi->cs_gpio);
921 spi_set_ctldata(spi, NULL);
924 if (spi->dev.of_node)
930 static void s3c64xx_spi_cleanup(struct spi_device *spi)
932 struct s3c64xx_spi_csinfo *cs = spi_get_ctldata(spi);
934 if (gpio_is_valid(spi->cs_gpio)) {
935 gpio_free(spi->cs_gpio);
936 if (spi->dev.of_node)
940 * spi->cs_gpio to -ENOENT and .setup()
944 spi->cs_gpio = -ENOENT;
948 spi_set_ctldata(spi, NULL);
954 struct spi_master *spi = sdd->master;
961 dev_err(&spi->dev, "RX overrun\n");
965 dev_err(&spi->dev, "RX underrun\n");
969 dev_err(&spi->dev, "TX overrun\n");
973 dev_err(&spi->dev, "TX underrun\n");
1034 if (of_property_read_u32(dev->of_node, "samsung,spi-src-clk", &temp)) {
1035 dev_warn(dev, "spi bus clock parent not specified, using clock at index 0 as parent\n");
1123 ret = of_alias_get_id(pdev->dev.of_node, "spi");
1151 /* the spi->mode bits understood by this driver: */
1170 sdd->clk = devm_clk_get(&pdev->dev, "spi");
1172 dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
1179 dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
1242 "spi-s3c64xx", sdd);
1461 .name = "s3c2443-spi",
1464 .name = "s3c6410-spi",
1471 { .compatible = "samsung,s3c2443-spi",
1474 { .compatible = "samsung,s3c6410-spi",
1477 { .compatible = "samsung,s5pv210-spi",
1480 { .compatible = "samsung,exynos4210-spi",
1483 { .compatible = "samsung,exynos7-spi",
1486 { .compatible = "samsung,exynos5433-spi",
1495 .name = "s3c64xx-spi",
1503 MODULE_ALIAS("platform:s3c64xx-spi");