Source
50
50
"if set enable loopback mode, where the rx_buf " \
51
51
"is checked to match tx_buf after the spi_message " \
52
52
"is executed");
53
53
54
54
static int loop_req;
55
55
module_param(loop_req, int, 0);
56
56
MODULE_PARM_DESC(loop_req,
57
57
"if set controller will be asked to enable test loop mode. " \
58
58
"If controller supported it, MISO and MOSI will be connected");
59
59
60
+
static int no_cs;
61
+
module_param(no_cs, int, 0);
62
+
MODULE_PARM_DESC(no_cs,
63
+
"if set Chip Select (CS) will not be used");
64
+
60
65
/* run only a specific test */
61
66
static int run_only_test = -1;
62
67
module_param(run_only_test, int, 0);
63
68
MODULE_PARM_DESC(run_only_test,
64
69
"only run the test with this number (0-based !)");
65
70
66
71
/* use vmalloc'ed buffers */
67
72
static int use_vmalloc;
68
73
module_param(use_vmalloc, int, 0644);
69
74
MODULE_PARM_DESC(use_vmalloc,
312
317
},
313
318
},
314
319
315
320
{ /* end of tests sequence */ }
316
321
};
317
322
318
323
static int spi_loopback_test_probe(struct spi_device *spi)
319
324
{
320
325
int ret;
321
326
322
-
if (loop_req) {
323
-
spi->mode = SPI_LOOP | spi->mode;
327
+
if (loop_req || no_cs) {
328
+
spi->mode |= loop_req ? SPI_LOOP : 0;
329
+
spi->mode |= no_cs ? SPI_NO_CS : 0;
324
330
ret = spi_setup(spi);
325
331
if (ret) {
326
-
dev_err(&spi->dev, "SPI setup with SPI_LOOP failed (%d)\n",
332
+
dev_err(&spi->dev, "SPI setup with SPI_LOOP or SPI_NO_CS failed (%d)\n",
327
333
ret);
328
334
return ret;
329
335
}
330
336
}
331
337
332
338
dev_info(&spi->dev, "Executing spi-loopback-tests\n");
333
339
334
340
ret = spi_test_run_tests(spi, spi_tests);
335
341
336
342
dev_info(&spi->dev, "Finished spi-loopback-tests with return: %i\n",