spidev.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. /*
  2. * spidev.c -- simple synchronous userspace interface to SPI devices
  3. *
  4. * Copyright (C) 2006 SWAPP
  5. * Andrea Paterniani <a.paterniani@swapp-eng.it>
  6. * Copyright (C) 2007 David Brownell (simplification, cleanup)
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #include <linux/init.h>
  23. #include <linux/module.h>
  24. #include <linux/ioctl.h>
  25. #include <linux/fs.h>
  26. #include <linux/device.h>
  27. #include <linux/err.h>
  28. #include <linux/list.h>
  29. #include <linux/errno.h>
  30. #include <linux/mutex.h>
  31. #include <linux/slab.h>
  32. #include <linux/spi/spi.h>
  33. #include <linux/spi/spidev.h>
  34. #include <asm/uaccess.h>
  35. /*
  36. * This supports acccess to SPI devices using normal userspace I/O calls.
  37. * Note that while traditional UNIX/POSIX I/O semantics are half duplex,
  38. * and often mask message boundaries, full SPI support requires full duplex
  39. * transfers. There are several kinds of of internal message boundaries to
  40. * handle chipselect management and other protocol options.
  41. *
  42. * SPI has a character major number assigned. We allocate minor numbers
  43. * dynamically using a bitmask. You must use hotplug tools, such as udev
  44. * (or mdev with busybox) to create and destroy the /dev/spidevB.C device
  45. * nodes, since there is no fixed association of minor numbers with any
  46. * particular SPI bus or device.
  47. */
  48. #define SPIDEV_MAJOR 153 /* assigned */
  49. #define N_SPI_MINORS 32 /* ... up to 256 */
  50. static unsigned long minors[N_SPI_MINORS / BITS_PER_LONG];
  51. /* Bit masks for spi_device.mode management. Note that incorrect
  52. * settings for CS_HIGH and 3WIRE can cause *lots* of trouble for other
  53. * devices on a shared bus: CS_HIGH, because this device will be
  54. * active when it shouldn't be; 3WIRE, because when active it won't
  55. * behave as it should.
  56. *
  57. * REVISIT should changing those two modes be privileged?
  58. */
  59. #define SPI_MODE_MASK (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH \
  60. | SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP)
  61. struct spidev_data {
  62. dev_t devt;
  63. spinlock_t spi_lock;
  64. struct spi_device *spi;
  65. struct list_head device_entry;
  66. /* buffer is NULL unless this device is open (users > 0) */
  67. struct mutex buf_lock;
  68. unsigned users;
  69. u8 *buffer;
  70. };
  71. static LIST_HEAD(device_list);
  72. static DEFINE_MUTEX(device_list_lock);
  73. static unsigned bufsiz = 4096;
  74. module_param(bufsiz, uint, S_IRUGO);
  75. MODULE_PARM_DESC(bufsiz, "data bytes in biggest supported SPI message");
  76. /*-------------------------------------------------------------------------*/
  77. /*
  78. * We can't use the standard synchronous wrappers for file I/O; we
  79. * need to protect against async removal of the underlying spi_device.
  80. */
  81. static void spidev_complete(void *arg)
  82. {
  83. complete(arg);
  84. }
  85. static ssize_t
  86. spidev_sync(struct spidev_data *spidev, struct spi_message *message)
  87. {
  88. DECLARE_COMPLETION_ONSTACK(done);
  89. int status;
  90. message->complete = spidev_complete;
  91. message->context = &done;
  92. spin_lock_irq(&spidev->spi_lock);
  93. if (spidev->spi == NULL)
  94. status = -ESHUTDOWN;
  95. else
  96. status = spi_async(spidev->spi, message);
  97. spin_unlock_irq(&spidev->spi_lock);
  98. if (status == 0) {
  99. wait_for_completion(&done);
  100. status = message->status;
  101. if (status == 0)
  102. status = message->actual_length;
  103. }
  104. return status;
  105. }
  106. static inline ssize_t
  107. spidev_sync_write(struct spidev_data *spidev, size_t len)
  108. {
  109. struct spi_transfer t = {
  110. .tx_buf = spidev->buffer,
  111. .len = len,
  112. };
  113. struct spi_message m;
  114. spi_message_init(&m);
  115. spi_message_add_tail(&t, &m);
  116. return spidev_sync(spidev, &m);
  117. }
  118. static inline ssize_t
  119. spidev_sync_read(struct spidev_data *spidev, size_t len)
  120. {
  121. struct spi_transfer t = {
  122. .rx_buf = spidev->buffer,
  123. .len = len,
  124. };
  125. struct spi_message m;
  126. spi_message_init(&m);
  127. spi_message_add_tail(&t, &m);
  128. return spidev_sync(spidev, &m);
  129. }
  130. /*-------------------------------------------------------------------------*/
  131. /* Read-only message with current device setup */
  132. static ssize_t
  133. spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
  134. {
  135. struct spidev_data *spidev;
  136. ssize_t status = 0;
  137. /* chipselect only toggles at start or end of operation */
  138. if (count > bufsiz)
  139. return -EMSGSIZE;
  140. spidev = filp->private_data;
  141. mutex_lock(&spidev->buf_lock);
  142. status = spidev_sync_read(spidev, count);
  143. if (status > 0) {
  144. unsigned long missing;
  145. missing = copy_to_user(buf, spidev->buffer, status);
  146. if (missing == status)
  147. status = -EFAULT;
  148. else
  149. status = status - missing;
  150. }
  151. mutex_unlock(&spidev->buf_lock);
  152. return status;
  153. }
  154. /* Write-only message with current device setup */
  155. static ssize_t
  156. spidev_write(struct file *filp, const char __user *buf,
  157. size_t count, loff_t *f_pos)
  158. {
  159. struct spidev_data *spidev;
  160. ssize_t status = 0;
  161. unsigned long missing;
  162. /* chipselect only toggles at start or end of operation */
  163. if (count > bufsiz)
  164. return -EMSGSIZE;
  165. spidev = filp->private_data;
  166. mutex_lock(&spidev->buf_lock);
  167. missing = copy_from_user(spidev->buffer, buf, count);
  168. if (missing == 0) {
  169. status = spidev_sync_write(spidev, count);
  170. } else
  171. status = -EFAULT;
  172. mutex_unlock(&spidev->buf_lock);
  173. return status;
  174. }
  175. static int spidev_message(struct spidev_data *spidev,
  176. struct spi_ioc_transfer *u_xfers, unsigned n_xfers)
  177. {
  178. struct spi_message msg;
  179. struct spi_transfer *k_xfers;
  180. struct spi_transfer *k_tmp;
  181. struct spi_ioc_transfer *u_tmp;
  182. unsigned n, total;
  183. u8 *buf;
  184. int status = -EFAULT;
  185. spi_message_init(&msg);
  186. k_xfers = kcalloc(n_xfers, sizeof(*k_tmp), GFP_KERNEL);
  187. if (k_xfers == NULL)
  188. return -ENOMEM;
  189. /* Construct spi_message, copying any tx data to bounce buffer.
  190. * We walk the array of user-provided transfers, using each one
  191. * to initialize a kernel version of the same transfer.
  192. */
  193. mutex_lock(&spidev->buf_lock);
  194. buf = spidev->buffer;
  195. total = 0;
  196. for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers;
  197. n;
  198. n--, k_tmp++, u_tmp++) {
  199. k_tmp->len = u_tmp->len;
  200. total += k_tmp->len;
  201. if (total > bufsiz) {
  202. status = -EMSGSIZE;
  203. goto done;
  204. }
  205. if (u_tmp->rx_buf) {
  206. k_tmp->rx_buf = buf;
  207. if (!access_ok(VERIFY_WRITE, (u8 __user *)
  208. (uintptr_t) u_tmp->rx_buf,
  209. u_tmp->len))
  210. goto done;
  211. }
  212. if (u_tmp->tx_buf) {
  213. k_tmp->tx_buf = buf;
  214. if (copy_from_user(buf, (const u8 __user *)
  215. (uintptr_t) u_tmp->tx_buf,
  216. u_tmp->len))
  217. goto done;
  218. }
  219. buf += k_tmp->len;
  220. k_tmp->cs_change = !!u_tmp->cs_change;
  221. k_tmp->bits_per_word = u_tmp->bits_per_word;
  222. k_tmp->delay_usecs = u_tmp->delay_usecs;
  223. k_tmp->speed_hz = u_tmp->speed_hz;
  224. #ifdef VERBOSE
  225. dev_dbg(&spi->dev,
  226. " xfer len %zd %s%s%s%dbits %u usec %uHz\n",
  227. u_tmp->len,
  228. u_tmp->rx_buf ? "rx " : "",
  229. u_tmp->tx_buf ? "tx " : "",
  230. u_tmp->cs_change ? "cs " : "",
  231. u_tmp->bits_per_word ? : spi->bits_per_word,
  232. u_tmp->delay_usecs,
  233. u_tmp->speed_hz ? : spi->max_speed_hz);
  234. #endif
  235. spi_message_add_tail(k_tmp, &msg);
  236. }
  237. status = spidev_sync(spidev, &msg);
  238. if (status < 0)
  239. goto done;
  240. /* copy any rx data out of bounce buffer */
  241. buf = spidev->buffer;
  242. for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) {
  243. if (u_tmp->rx_buf) {
  244. if (__copy_to_user((u8 __user *)
  245. (uintptr_t) u_tmp->rx_buf, buf,
  246. u_tmp->len)) {
  247. status = -EFAULT;
  248. goto done;
  249. }
  250. }
  251. buf += u_tmp->len;
  252. }
  253. status = total;
  254. done:
  255. mutex_unlock(&spidev->buf_lock);
  256. kfree(k_xfers);
  257. return status;
  258. }
  259. static int
  260. spidev_ioctl(struct inode *inode, struct file *filp,
  261. unsigned int cmd, unsigned long arg)
  262. {
  263. int err = 0;
  264. int retval = 0;
  265. struct spidev_data *spidev;
  266. struct spi_device *spi;
  267. u32 tmp;
  268. unsigned n_ioc;
  269. struct spi_ioc_transfer *ioc;
  270. /* Check type and command number */
  271. if (_IOC_TYPE(cmd) != SPI_IOC_MAGIC)
  272. return -ENOTTY;
  273. /* Check access direction once here; don't repeat below.
  274. * IOC_DIR is from the user perspective, while access_ok is
  275. * from the kernel perspective; so they look reversed.
  276. */
  277. if (_IOC_DIR(cmd) & _IOC_READ)
  278. err = !access_ok(VERIFY_WRITE,
  279. (void __user *)arg, _IOC_SIZE(cmd));
  280. if (err == 0 && _IOC_DIR(cmd) & _IOC_WRITE)
  281. err = !access_ok(VERIFY_READ,
  282. (void __user *)arg, _IOC_SIZE(cmd));
  283. if (err)
  284. return -EFAULT;
  285. /* guard against device removal before, or while,
  286. * we issue this ioctl.
  287. */
  288. spidev = filp->private_data;
  289. spin_lock_irq(&spidev->spi_lock);
  290. spi = spi_dev_get(spidev->spi);
  291. spin_unlock_irq(&spidev->spi_lock);
  292. if (spi == NULL)
  293. return -ESHUTDOWN;
  294. switch (cmd) {
  295. /* read requests */
  296. case SPI_IOC_RD_MODE:
  297. retval = __put_user(spi->mode & SPI_MODE_MASK,
  298. (__u8 __user *)arg);
  299. break;
  300. case SPI_IOC_RD_LSB_FIRST:
  301. retval = __put_user((spi->mode & SPI_LSB_FIRST) ? 1 : 0,
  302. (__u8 __user *)arg);
  303. break;
  304. case SPI_IOC_RD_BITS_PER_WORD:
  305. retval = __put_user(spi->bits_per_word, (__u8 __user *)arg);
  306. break;
  307. case SPI_IOC_RD_MAX_SPEED_HZ:
  308. retval = __put_user(spi->max_speed_hz, (__u32 __user *)arg);
  309. break;
  310. /* write requests */
  311. case SPI_IOC_WR_MODE:
  312. retval = __get_user(tmp, (u8 __user *)arg);
  313. if (retval == 0) {
  314. u8 save = spi->mode;
  315. if (tmp & ~SPI_MODE_MASK) {
  316. retval = -EINVAL;
  317. break;
  318. }
  319. tmp |= spi->mode & ~SPI_MODE_MASK;
  320. spi->mode = (u8)tmp;
  321. retval = spi_setup(spi);
  322. if (retval < 0)
  323. spi->mode = save;
  324. else
  325. dev_dbg(&spi->dev, "spi mode %02x\n", tmp);
  326. }
  327. break;
  328. case SPI_IOC_WR_LSB_FIRST:
  329. retval = __get_user(tmp, (__u8 __user *)arg);
  330. if (retval == 0) {
  331. u8 save = spi->mode;
  332. if (tmp)
  333. spi->mode |= SPI_LSB_FIRST;
  334. else
  335. spi->mode &= ~SPI_LSB_FIRST;
  336. retval = spi_setup(spi);
  337. if (retval < 0)
  338. spi->mode = save;
  339. else
  340. dev_dbg(&spi->dev, "%csb first\n",
  341. tmp ? 'l' : 'm');
  342. }
  343. break;
  344. case SPI_IOC_WR_BITS_PER_WORD:
  345. retval = __get_user(tmp, (__u8 __user *)arg);
  346. if (retval == 0) {
  347. u8 save = spi->bits_per_word;
  348. spi->bits_per_word = tmp;
  349. retval = spi_setup(spi);
  350. if (retval < 0)
  351. spi->bits_per_word = save;
  352. else
  353. dev_dbg(&spi->dev, "%d bits per word\n", tmp);
  354. }
  355. break;
  356. case SPI_IOC_WR_MAX_SPEED_HZ:
  357. retval = __get_user(tmp, (__u32 __user *)arg);
  358. if (retval == 0) {
  359. u32 save = spi->max_speed_hz;
  360. spi->max_speed_hz = tmp;
  361. retval = spi_setup(spi);
  362. if (retval < 0)
  363. spi->max_speed_hz = save;
  364. else
  365. dev_dbg(&spi->dev, "%d Hz (max)\n", tmp);
  366. }
  367. break;
  368. default:
  369. /* segmented and/or full-duplex I/O request */
  370. if (_IOC_NR(cmd) != _IOC_NR(SPI_IOC_MESSAGE(0))
  371. || _IOC_DIR(cmd) != _IOC_WRITE) {
  372. retval = -ENOTTY;
  373. break;
  374. }
  375. tmp = _IOC_SIZE(cmd);
  376. if ((tmp % sizeof(struct spi_ioc_transfer)) != 0) {
  377. retval = -EINVAL;
  378. break;
  379. }
  380. n_ioc = tmp / sizeof(struct spi_ioc_transfer);
  381. if (n_ioc == 0)
  382. break;
  383. /* copy into scratch area */
  384. ioc = kmalloc(tmp, GFP_KERNEL);
  385. if (!ioc) {
  386. retval = -ENOMEM;
  387. break;
  388. }
  389. if (__copy_from_user(ioc, (void __user *)arg, tmp)) {
  390. kfree(ioc);
  391. retval = -EFAULT;
  392. break;
  393. }
  394. /* translate to spi_message, execute */
  395. retval = spidev_message(spidev, ioc, n_ioc);
  396. kfree(ioc);
  397. break;
  398. }
  399. spi_dev_put(spi);
  400. return retval;
  401. }
  402. static int spidev_open(struct inode *inode, struct file *filp)
  403. {
  404. struct spidev_data *spidev;
  405. int status = -ENXIO;
  406. mutex_lock(&device_list_lock);
  407. list_for_each_entry(spidev, &device_list, device_entry) {
  408. if (spidev->devt == inode->i_rdev) {
  409. status = 0;
  410. break;
  411. }
  412. }
  413. if (status == 0) {
  414. if (!spidev->buffer) {
  415. spidev->buffer = kmalloc(bufsiz, GFP_KERNEL);
  416. if (!spidev->buffer) {
  417. dev_dbg(&spidev->spi->dev, "open/ENOMEM\n");
  418. status = -ENOMEM;
  419. }
  420. }
  421. if (status == 0) {
  422. spidev->users++;
  423. filp->private_data = spidev;
  424. nonseekable_open(inode, filp);
  425. }
  426. } else
  427. pr_debug("spidev: nothing for minor %d\n", iminor(inode));
  428. mutex_unlock(&device_list_lock);
  429. return status;
  430. }
  431. static int spidev_release(struct inode *inode, struct file *filp)
  432. {
  433. struct spidev_data *spidev;
  434. int status = 0;
  435. mutex_lock(&device_list_lock);
  436. spidev = filp->private_data;
  437. filp->private_data = NULL;
  438. /* last close? */
  439. spidev->users--;
  440. if (!spidev->users) {
  441. int dofree;
  442. kfree(spidev->buffer);
  443. spidev->buffer = NULL;
  444. /* ... after we unbound from the underlying device? */
  445. spin_lock_irq(&spidev->spi_lock);
  446. dofree = (spidev->spi == NULL);
  447. spin_unlock_irq(&spidev->spi_lock);
  448. if (dofree)
  449. kfree(spidev);
  450. }
  451. mutex_unlock(&device_list_lock);
  452. return status;
  453. }
  454. static struct file_operations spidev_fops = {
  455. .owner = THIS_MODULE,
  456. /* REVISIT switch to aio primitives, so that userspace
  457. * gets more complete API coverage. It'll simplify things
  458. * too, except for the locking.
  459. */
  460. .write = spidev_write,
  461. .read = spidev_read,
  462. .ioctl = spidev_ioctl,
  463. .open = spidev_open,
  464. .release = spidev_release,
  465. };
  466. /*-------------------------------------------------------------------------*/
  467. /* The main reason to have this class is to make mdev/udev create the
  468. * /dev/spidevB.C character device nodes exposing our userspace API.
  469. * It also simplifies memory management.
  470. */
  471. static struct class *spidev_class;
  472. /*-------------------------------------------------------------------------*/
  473. static int spidev_probe(struct spi_device *spi)
  474. {
  475. struct spidev_data *spidev;
  476. int status;
  477. unsigned long minor;
  478. /* Allocate driver data */
  479. spidev = kzalloc(sizeof(*spidev), GFP_KERNEL);
  480. if (!spidev)
  481. return -ENOMEM;
  482. /* Initialize the driver data */
  483. spidev->spi = spi;
  484. spin_lock_init(&spidev->spi_lock);
  485. mutex_init(&spidev->buf_lock);
  486. INIT_LIST_HEAD(&spidev->device_entry);
  487. /* If we can allocate a minor number, hook up this device.
  488. * Reusing minors is fine so long as udev or mdev is working.
  489. */
  490. mutex_lock(&device_list_lock);
  491. minor = find_first_zero_bit(minors, N_SPI_MINORS);
  492. if (minor < N_SPI_MINORS) {
  493. struct device *dev;
  494. spidev->devt = MKDEV(SPIDEV_MAJOR, minor);
  495. dev = device_create(spidev_class, &spi->dev, spidev->devt,
  496. "spidev%d.%d",
  497. spi->master->bus_num, spi->chip_select);
  498. status = IS_ERR(dev) ? PTR_ERR(dev) : 0;
  499. } else {
  500. dev_dbg(&spi->dev, "no minor number available!\n");
  501. status = -ENODEV;
  502. }
  503. if (status == 0) {
  504. set_bit(minor, minors);
  505. spi_set_drvdata(spi, spidev);
  506. list_add(&spidev->device_entry, &device_list);
  507. }
  508. mutex_unlock(&device_list_lock);
  509. if (status != 0)
  510. kfree(spidev);
  511. return status;
  512. }
  513. static int spidev_remove(struct spi_device *spi)
  514. {
  515. struct spidev_data *spidev = spi_get_drvdata(spi);
  516. /* make sure ops on existing fds can abort cleanly */
  517. spin_lock_irq(&spidev->spi_lock);
  518. spidev->spi = NULL;
  519. spi_set_drvdata(spi, NULL);
  520. spin_unlock_irq(&spidev->spi_lock);
  521. /* prevent new opens */
  522. mutex_lock(&device_list_lock);
  523. list_del(&spidev->device_entry);
  524. device_destroy(spidev_class, spidev->devt);
  525. clear_bit(MINOR(spidev->devt), minors);
  526. if (spidev->users == 0)
  527. kfree(spidev);
  528. mutex_unlock(&device_list_lock);
  529. return 0;
  530. }
  531. static struct spi_driver spidev_spi = {
  532. .driver = {
  533. .name = "spidev",
  534. .owner = THIS_MODULE,
  535. },
  536. .probe = spidev_probe,
  537. .remove = __devexit_p(spidev_remove),
  538. /* NOTE: suspend/resume methods are not necessary here.
  539. * We don't do anything except pass the requests to/from
  540. * the underlying controller. The refrigerator handles
  541. * most issues; the controller driver handles the rest.
  542. */
  543. };
  544. /*-------------------------------------------------------------------------*/
  545. static int __init spidev_init(void)
  546. {
  547. int status;
  548. /* Claim our 256 reserved device numbers. Then register a class
  549. * that will key udev/mdev to add/remove /dev nodes. Last, register
  550. * the driver which manages those device numbers.
  551. */
  552. BUILD_BUG_ON(N_SPI_MINORS > 256);
  553. status = register_chrdev(SPIDEV_MAJOR, "spi", &spidev_fops);
  554. if (status < 0)
  555. return status;
  556. spidev_class = class_create(THIS_MODULE, "spidev");
  557. if (IS_ERR(spidev_class)) {
  558. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  559. return PTR_ERR(spidev_class);
  560. }
  561. status = spi_register_driver(&spidev_spi);
  562. if (status < 0) {
  563. class_destroy(spidev_class);
  564. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  565. }
  566. return status;
  567. }
  568. module_init(spidev_init);
  569. static void __exit spidev_exit(void)
  570. {
  571. spi_unregister_driver(&spidev_spi);
  572. class_destroy(spidev_class);
  573. unregister_chrdev(SPIDEV_MAJOR, spidev_spi.driver.name);
  574. }
  575. module_exit(spidev_exit);
  576. MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
  577. MODULE_DESCRIPTION("User mode SPI device interface");
  578. MODULE_LICENSE("GPL");