hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/spi/spi-rockchip-test.c
....@@ -110,8 +110,8 @@
110110 return ret;
111111 }
112112
113
-int spi_write_then_read_slt(int id, const void *txbuf, unsigned n_tx,
114
- void *rxbuf, unsigned n_rx)
113
+int spi_write_then_read_slt(int id, const void *txbuf, unsigned int n_tx,
114
+ void *rxbuf, unsigned int n_rx)
115115 {
116116 int ret = -1;
117117 struct spi_device *spi = NULL;
....@@ -301,14 +301,21 @@
301301 kfree(txbuf);
302302 kfree(rxbuf);
303303 } else if (!strcmp(cmd, "config")) {
304
- int width;
304
+ int width, mode;
305305
306
- sscanf(argv[0], "%d", &width);
306
+ sscanf(argv[0], "%d", &id);
307
+ sscanf(argv[1], "%d", &width);
308
+ sscanf(argv[2], "mode=0x%x", &mode);
307309
308310 if (width == 16)
309311 bit_per_word = 16;
310312 else
311313 bit_per_word = 8;
314
+
315
+ if (mode) {
316
+ g_spi_test_data[id]->spi->mode = mode;
317
+ spi_setup(g_spi_test_data[id]->spi);
318
+ }
312319 } else {
313320 printk("echo id number size > /dev/spi_misc_test\n");
314321 printk("echo write 0 10 255 > /dev/spi_misc_test\n");
....@@ -316,7 +323,7 @@
316323 printk("echo read 0 10 255 > /dev/spi_misc_test\n");
317324 printk("echo loop 0 10 255 > /dev/spi_misc_test\n");
318325 printk("echo setspeed 0 1000000 > /dev/spi_misc_test\n");
319
- printk("echo config 8 > /dev/spi_misc_test\n");
326
+ printk("echo config 0 8 mode=0xb > /dev/spi_misc_test\n");
320327 }
321328
322329 return n;