Lines Matching +full:rtl8382 +full:- +full:spi

1 // SPDX-License-Identifier: GPL-2.0-only
6 #include <linux/spi/spi.h>
12 /* SPI Flash Configuration Register */
17 /* SPI Flash Control and Status Register */
27 /* SPI Flash Data Register */
30 #define REG(x) (rtspi->base + x)
33 static void rt_set_cs(struct spi_device *spi, bool active) in rt_set_cs() argument
35 struct rtspi *rtspi = spi_controller_get_devdata(spi->controller); in rt_set_cs()
93 static int transfer_one(struct spi_controller *ctrl, struct spi_device *spi, in transfer_one() argument
101 tx_buf = xfer->tx_buf; in transfer_one()
102 rx_buf = xfer->rx_buf; in transfer_one()
103 cnt = xfer->len; in transfer_one()
108 cnt -= 4; in transfer_one()
113 cnt--; in transfer_one()
119 cnt -= 4; in transfer_one()
124 cnt--; in transfer_one()
137 /* Turn on big-endian byte ordering */ in init_hw()
156 ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*rtspi)); in realtek_rtl_spi_probe()
158 dev_err(&pdev->dev, "Error allocating SPI controller\n"); in realtek_rtl_spi_probe()
159 return -ENOMEM; in realtek_rtl_spi_probe()
164 rtspi->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); in realtek_rtl_spi_probe()
165 if (IS_ERR(rtspi->base)) { in realtek_rtl_spi_probe()
166 dev_err(&pdev->dev, "Could not map SPI register address"); in realtek_rtl_spi_probe()
167 return -ENOMEM; in realtek_rtl_spi_probe()
172 ctrl->dev.of_node = pdev->dev.of_node; in realtek_rtl_spi_probe()
173 ctrl->flags = SPI_CONTROLLER_HALF_DUPLEX; in realtek_rtl_spi_probe()
174 ctrl->set_cs = rt_set_cs; in realtek_rtl_spi_probe()
175 ctrl->transfer_one = transfer_one; in realtek_rtl_spi_probe()
177 err = devm_spi_register_controller(&pdev->dev, ctrl); in realtek_rtl_spi_probe()
179 dev_err(&pdev->dev, "Could not register SPI controller\n"); in realtek_rtl_spi_probe()
180 return -ENODEV; in realtek_rtl_spi_probe()
188 { .compatible = "realtek,rtl8380-spi" },
189 { .compatible = "realtek,rtl8382-spi" },
190 { .compatible = "realtek,rtl8391-spi" },
191 { .compatible = "realtek,rtl8392-spi" },
192 { .compatible = "realtek,rtl8393-spi" },
200 .name = "realtek-rtl-spi",
209 MODULE_DESCRIPTION("Realtek RTL SPI driver");