| .. | .. |
|---|
| 110 | 110 | return ret; |
|---|
| 111 | 111 | } |
|---|
| 112 | 112 | |
|---|
| 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) |
|---|
| 115 | 115 | { |
|---|
| 116 | 116 | int ret = -1; |
|---|
| 117 | 117 | struct spi_device *spi = NULL; |
|---|
| .. | .. |
|---|
| 301 | 301 | kfree(txbuf); |
|---|
| 302 | 302 | kfree(rxbuf); |
|---|
| 303 | 303 | } else if (!strcmp(cmd, "config")) { |
|---|
| 304 | | - int width; |
|---|
| 304 | + int width, mode; |
|---|
| 305 | 305 | |
|---|
| 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); |
|---|
| 307 | 309 | |
|---|
| 308 | 310 | if (width == 16) |
|---|
| 309 | 311 | bit_per_word = 16; |
|---|
| 310 | 312 | else |
|---|
| 311 | 313 | 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 | + } |
|---|
| 312 | 319 | } else { |
|---|
| 313 | 320 | printk("echo id number size > /dev/spi_misc_test\n"); |
|---|
| 314 | 321 | printk("echo write 0 10 255 > /dev/spi_misc_test\n"); |
|---|
| .. | .. |
|---|
| 316 | 323 | printk("echo read 0 10 255 > /dev/spi_misc_test\n"); |
|---|
| 317 | 324 | printk("echo loop 0 10 255 > /dev/spi_misc_test\n"); |
|---|
| 318 | 325 | 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"); |
|---|
| 320 | 327 | } |
|---|
| 321 | 328 | |
|---|
| 322 | 329 | return n; |
|---|