15 #include <linux/kernel.h>
16 #include <linux/module.h>
25 #include <linux/bitops.h>
31 #define DRV_NAME "ath79-spi"
52 return spi_master_get_devdata(spi->
master);
86 static int ath79_spi_setup_cs(
struct spi_device *spi)
88 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
129 static void ath79_spi_cleanup_cs(
struct spi_device *spi)
131 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
144 static int ath79_spi_setup(
struct spi_device *spi)
152 status = ath79_spi_setup_cs(spi);
159 ath79_spi_cleanup_cs(spi);
164 static void ath79_spi_cleanup(
struct spi_device *spi)
166 ath79_spi_cleanup_cs(spi);
173 struct ath79_spi *sp = ath79_spidev_to_sp(spi);
177 for (word <<= (32 - bits);
likely(bits); bits--) {
180 if (word & (1 << 31))
204 if (master ==
NULL) {
205 dev_err(&pdev->
dev,
"failed to allocate spi master\n");
209 sp = spi_master_get_devdata(master);
210 platform_set_drvdata(pdev, sp);
212 pdata = pdev->
dev.platform_data;
214 master->
setup = ath79_spi_setup;
215 master->
cleanup = ath79_spi_cleanup;
221 sp->
bitbang.master = spi_master_get(master);
222 sp->
bitbang.chipselect = ath79_spi_chipselect;
248 platform_set_drvdata(pdev,
NULL);
249 spi_master_put(sp->
bitbang.master);
256 struct ath79_spi *sp = platform_get_drvdata(pdev);
260 platform_set_drvdata(pdev,
NULL);
261 spi_master_put(sp->
bitbang.master);
267 .probe = ath79_spi_probe,