blob: 153e03ed80d6d896531715ab2c728d080428cc1f [file] [log] [blame]
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +10001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2018 Miklós Márton martonmiklosqdev@gmail.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#include <ctype.h>
19#include <inttypes.h>
20#include <string.h>
21#include <stdio.h>
22#include <stdlib.h>
23#include <ni845x.h>
24#include <unistd.h>
25
26#include "flash.h"
27#include "programmer.h"
28#include "spi.h"
29
30#define NI845x_FIND_DEVICE_NO_DEVICE_FOUND -301701
31
32enum USB845x_type {
33 USB8451 = 0x7166,
34 USB8452 = 0x7514,
35 Unknown_NI845X_Device
36};
37
38enum voltage_coerce_mode {
39 USE_LOWER,
40 USE_HIGHER
41};
42
43static const struct spi_master spi_programmer_ni845x;
44
45static unsigned char CS_number; // use chip select 0 as default
46static enum USB845x_type device_pid = Unknown_NI845X_Device;
47
48static uInt32 device_handle;
49static NiHandle configuration_handle;
50static uint16_t io_voltage_in_mV;
51static bool ignore_io_voltage_limits;
52
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +100053// USB-8452 supported voltages, keep this array in ascending order!
54static const uint8_t usb8452_io_voltages_in_100mV[5] = {
55 kNi845x12Volts,
56 kNi845x15Volts,
57 kNi845x18Volts,
58 kNi845x25Volts,
59 kNi845x33Volts
60};
61
62/* Copied from dediprog.c */
63/* Might be useful for other USB devices as well. static for now. */
64static int parse_voltage(char *voltage)
65{
66 char *tmp = NULL;
67 int i;
68 int millivolt = 0, fraction = 0;
69
70 if (!voltage || !strlen(voltage)) {
71 msg_perr("Empty voltage= specified.\n");
72 return -1;
73 }
74 millivolt = (int)strtol(voltage, &tmp, 0);
75 voltage = tmp;
76 /* Handle "," and "." as decimal point. Everything after it is assumed
77 * to be in decimal notation.
78 */
79 if ((*voltage == '.') || (*voltage == ',')) {
80 voltage++;
81 for (i = 0; i < 3; i++) {
82 fraction *= 10;
83 /* Don't advance if the current character is invalid,
84 * but continue multiplying.
85 */
86 if ((*voltage < '0') || (*voltage > '9'))
87 continue;
88 fraction += *voltage - '0';
89 voltage++;
90 }
91 /* Throw away remaining digits. */
92 voltage += strspn(voltage, "0123456789");
93 }
94 /* The remaining string must be empty or "mV" or "V". */
95 tolower_string(voltage);
96
97 /* No unit or "V". */
98 if ((*voltage == '\0') || !strncmp(voltage, "v", 1)) {
99 millivolt *= 1000;
100 millivolt += fraction;
101 } else if (!strncmp(voltage, "mv", 2) || !strncmp(voltage, "millivolt", 9)) {
102 /* No adjustment. fraction is discarded. */
103 } else {
104 /* Garbage at the end of the string. */
105 msg_perr("Garbage voltage= specified.\n");
106 return -1;
107 }
108 return millivolt;
109}
110
111static void ni845x_report_error(const char *const func, const int32 err)
112{
113 static char buf[1024];
114
115 ni845xStatusToString(err, sizeof(buf), buf);
116 msg_perr("%s failed with: %s (%d)\n", func, buf, (int)err);
117}
118
119static void ni845x_report_warning(const char *const func, const int32 err)
120{
121 static char buf[1024];
122
123 ni845xStatusToString(err, sizeof(buf), buf);
124 msg_pwarn("%s failed with: %s (%d)\n", func, buf, (int)err);
125}
126
127/**
Anastasia Klimchukad79bd92021-02-15 15:04:20 +1100128 * @brief ni845x_spi_open_resource
129 * @param resource_handle the resource handle returned by the ni845xFindDevice or ni845xFindDeviceNext
130 * @param opened_handle the opened handle from the ni845xOpen
131 * @return the 0 on successful competition, negative error code on failure positive code on warning
132 */
133static int32 ni845x_spi_open_resource(char *resource_handle, uInt32 *opened_handle)
134{
135 // NI-845x driver loads the FPGA bitfile at the first time
136 // which can take couple seconds
137 if (device_pid == USB8452)
138 msg_pwarn("Opening NI-8452, this might take a while for the first time\n");
139
140 int32 tmp = ni845xOpen(resource_handle, opened_handle);
141
142 if (tmp < 0)
143 ni845x_report_error("ni845xOpen", tmp);
144 else if (tmp > 0)
145 ni845x_report_warning("ni845xOpen", tmp);
146 return tmp;
147}
148
149/**
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +1000150 * @param serial a null terminated string containing the serial number of the specific device or NULL
151 * @return the 0 on successful completition, negative error code on failure
152 */
153static int ni845x_spi_open(const char *serial, uInt32 *return_handle)
154{
155 char resource_name[256];
156 NiHandle device_find_handle;
157 uInt32 found_devices_count = 0;
158 int32 tmp = 0;
159
160 unsigned int vid, pid, usb_bus;
161 unsigned long int serial_as_number;
162 int ret = -1;
163
164 tmp = ni845xFindDevice(resource_name, &device_find_handle, &found_devices_count);
165 if (tmp != 0) {
166 // supress warning if no device found
167 if (tmp != NI845x_FIND_DEVICE_NO_DEVICE_FOUND)
168 ni845x_report_error("ni845xFindDevice", tmp);
169 return -1;
170 }
171
172 for (; found_devices_count; --found_devices_count) {
173 // Read the serial number and the PID here
174 // VISA resource name format example:
175 // USB0::0x3923::0x7514::DEADBEEF::RAW
176 // where the 0x7514 is the PID
177 // and the DEADBEEF is the serial of the device
178 if (sscanf(resource_name,
179 "USB%u::0x%04X::0x%04X::%08lX::RAW",
180 &usb_bus, &vid, &pid, &serial_as_number) != 4) {
181 // malformed resource string detected
182 msg_pwarn("Warning: Unable to parse the %s NI-845x resource string.\n",
183 resource_name);
184 msg_pwarn("Please report a bug at flashrom@flashrom.org\n");
185 continue;
186 }
187
188 device_pid = pid;
189
190 if (!serial || strtol(serial, NULL, 16) == serial_as_number)
191 break;
192
193 if (found_devices_count > 1) {
194 tmp = ni845xFindDeviceNext(device_find_handle, resource_name);
195 if (tmp) {
196 ni845x_report_error("ni845xFindDeviceNext", tmp);
197 goto _close_ret;
198 }
199 }
200 }
201
202 if (found_devices_count)
203 ret = ni845x_spi_open_resource(resource_name, return_handle);
204
205_close_ret:
206 tmp = ni845xCloseFindDeviceHandle(device_find_handle);
207 if (tmp) {
208 ni845x_report_error("ni845xCloseFindDeviceHandle", tmp);
209 return -1;
210 }
211 return ret;
212}
213
214/**
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +1000215 * @brief usb8452_spi_set_io_voltage sets the IO voltage for the USB-8452 devices
216 * @param requested_io_voltage_mV the desired IO voltage in mVolts
217 * @param set_io_voltage_mV the IO voltage which was set in mVolts
218 * @param coerce_mode if set to USE_LOWER the closest supported IO voltage which is lower or equal to
219 * the requested_io_voltage_mV will be selected. Otherwise the next closest supported voltage will be choosen
220 * which is higher or equal to the requested_io_voltage_mV.
221 * @return 0 on success, negative on error, positive on warning
222 */
223static int usb8452_spi_set_io_voltage(uint16_t requested_io_voltage_mV,
224 uint16_t *set_io_voltage_mV,
225 enum voltage_coerce_mode coerce_mode)
226{
227 int i = 0;
228 uint8_t selected_voltage_100mV = 0;
229 uint8_t requested_io_voltage_100mV = 0;
230
231 if (device_pid == USB8451) {
232 io_voltage_in_mV = 3300;
233 msg_pwarn("USB-8451 does not support the changing of the SPI IO voltage\n");
234 return 0;
235 }
236
237 // limit the IO voltage to 3.3V
238 if (requested_io_voltage_mV > 3300) {
239 msg_pinfo("USB-8452 maximum IO voltage is 3.3V\n");
240 return -1;
241 }
242 requested_io_voltage_100mV = (requested_io_voltage_mV / 100.0f);
243
244 // usb8452_io_voltages_in_100mV contains the supported voltage levels in increasing order
245 for (i = (ARRAY_SIZE(usb8452_io_voltages_in_100mV) - 1); i > 0; --i) {
246 if (requested_io_voltage_100mV >= usb8452_io_voltages_in_100mV[i])
247 break;
248 }
249
250 if (coerce_mode == USE_LOWER) {
251 if (requested_io_voltage_100mV < usb8452_io_voltages_in_100mV[0]) {
252 msg_perr("Unable to set the USB-8452 IO voltage below %.1fV "
253 "(the minimum supported IO voltage is %.1fV)\n",
254 (float)requested_io_voltage_100mV / 10.0f,
255 (float)usb8452_io_voltages_in_100mV[0] / 10.0f);
256 return -1;
257 }
258 selected_voltage_100mV = usb8452_io_voltages_in_100mV[i];
259 } else {
260 if (i == ARRAY_SIZE(usb8452_io_voltages_in_100mV) - 1)
261 selected_voltage_100mV = usb8452_io_voltages_in_100mV[i];
262 else
263 selected_voltage_100mV = usb8452_io_voltages_in_100mV[i + 1];
264 }
265
266 if (requested_io_voltage_100mV < usb8452_io_voltages_in_100mV[0]) {
267 /* unsupported / would have to round up */
268 msg_pwarn("The USB-8452 does not support the %.1fV IO voltage\n",
269 requested_io_voltage_mV / 1000.0f);
270 selected_voltage_100mV = kNi845x12Volts;
271 msg_pwarn("The output voltage is set to 1.2V (this is the lowest voltage)\n");
272 msg_pwarn("Supported IO voltages:\n");
273 for (i = 0; i < ARRAY_SIZE(usb8452_io_voltages_in_100mV); i++) {
274 msg_pwarn("%.1fV", (float)usb8452_io_voltages_in_100mV[i] / 10.0f);
275 if (i != ARRAY_SIZE(usb8452_io_voltages_in_100mV) - 1)
276 msg_pwarn(", ");
277 }
278 msg_pwarn("\n");
279 } else if (selected_voltage_100mV != requested_io_voltage_100mV) {
280 /* we rounded down/up */
281 msg_pwarn("USB-8452 IO voltage forced to: %.1f V\n",
282 (float)selected_voltage_100mV / 10.0f);
283 } else {
284 /* exact match */
285 msg_pinfo("USB-8452 IO voltage set to: %.1f V\n",
286 (float)selected_voltage_100mV / 10.0f);
287 }
288
289 if (set_io_voltage_mV)
290 *set_io_voltage_mV = (selected_voltage_100mV * 100);
291
292 i = ni845xSetIoVoltageLevel(device_handle, selected_voltage_100mV);
293 if (i != 0) {
294 ni845x_report_error("ni845xSetIoVoltageLevel", i);
295 return -1;
296 }
297 return 0;
298}
299
300/**
301 * @brief ni845x_spi_set_speed sets the SPI SCK speed
302 * @param SCK_freq_in_KHz SCK speed in KHz
303 * @return
304 */
305static int ni845x_spi_set_speed(uint16_t SCK_freq_in_KHz)
306{
307 int32 i = ni845xSpiConfigurationSetClockRate(configuration_handle, SCK_freq_in_KHz);
308 uInt16 clock_freq_read_KHz;
309
310 if (i != 0) {
311 ni845x_report_error("ni845xSpiConfigurationSetClockRate", i);
312 return -1;
313 }
314
315 // read back the clock frequency and notify the user if it is not the same as it was requested
316 i = ni845xSpiConfigurationGetClockRate(configuration_handle, &clock_freq_read_KHz);
317 if (i != 0) {
318 ni845x_report_error("ni845xSpiConfigurationGetClockRate", i);
319 return -1;
320 }
321
322 if (clock_freq_read_KHz != SCK_freq_in_KHz) {
323 msg_pinfo("SPI clock frequency forced to: %d KHz (requested: %d KHz)\n",
324 (int)clock_freq_read_KHz, (int)SCK_freq_in_KHz);
325 } else {
326 msg_pinfo("SPI clock frequency set to: %d KHz\n", (int)SCK_freq_in_KHz);
327 }
328 return 0;
329}
330
331/**
332 * @brief ni845x_spi_print_available_devices prints a list of the available devices
333 */
334static void ni845x_spi_print_available_devices(void)
335{
336 char resource_handle[256], device_type_string[16];
337 NiHandle device_find_handle;
338 uInt32 found_devices_count = 0;
339 int32 tmp = 0;
340 unsigned int pid, vid, usb_bus;
341 unsigned long int serial_as_number;
342
343 tmp = ni845xFindDevice(resource_handle, &device_find_handle, &found_devices_count);
344 if (tmp != 0) {
345 // supress warning if no device found
346 if (tmp != NI845x_FIND_DEVICE_NO_DEVICE_FOUND)
347 ni845x_report_error("ni845xFindDevice", tmp);
348 return;
349 }
350
351 if (found_devices_count) {
352 msg_pinfo("Available devices:\n");
353 do {
354 tmp = sscanf(resource_handle, "USB%d::0x%04X::0x%04X::%08lX::RAW",
355 &usb_bus, &vid, &pid, &serial_as_number);
356 if (tmp == 4) {
357 switch (pid) {
358 case USB8451:
359 snprintf(device_type_string,
360 ARRAY_SIZE(device_type_string), "USB-8451");
361 break;
362 case USB8452:
363 snprintf(device_type_string,
364 ARRAY_SIZE(device_type_string), "USB-8452");
365 break;
366 default:
367 snprintf(device_type_string,
368 ARRAY_SIZE(device_type_string), "Unknown device");
369 break;
370 }
371 msg_pinfo("- %lX (%s)\n", serial_as_number, device_type_string);
372
373 found_devices_count--;
374 if (found_devices_count) {
375 tmp = ni845xFindDeviceNext(device_find_handle, resource_handle);
376 if (tmp)
377 ni845x_report_error("ni845xFindDeviceNext", tmp);
378 }
379 }
380 } while (found_devices_count);
381 }
382
383 tmp = ni845xCloseFindDeviceHandle(device_find_handle);
384 if (tmp)
385 ni845x_report_error("ni845xCloseFindDeviceHandle", tmp);
386}
387
Anastasia Klimchukad79bd92021-02-15 15:04:20 +1100388static int ni845x_spi_shutdown(void *data)
389{
390 int32 ret = 0;
391
392 if (configuration_handle != 0) {
393 ret = ni845xSpiConfigurationClose(configuration_handle);
394 if (ret)
395 ni845x_report_error("ni845xSpiConfigurationClose", ret);
396 }
397
398 if (device_handle != 0) {
399 ret = ni845xClose(device_handle);
400 if (ret)
401 ni845x_report_error("ni845xClose", ret);
402 }
403 return 0;
404}
405
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +1000406int ni845x_spi_init(void)
407{
408 char *speed_str = NULL;
409 char *CS_str = NULL;
410 char *voltage = NULL;
411 char *endptr = NULL;
412 int requested_io_voltage_mV = 1200; // default the IO voltage to 1.2V
413 int spi_speed_KHz = 1000; // selecting 1 MHz SCK is a good bet
414 char *serial_number = NULL; // by default open the first connected device
415 char *ignore_io_voltage_limits_str = NULL;
416 int32 tmp = 0;
417
418 // read the cs parameter (which Chip select should we use)
419 CS_str = extract_programmer_param("cs");
420 if (CS_str) {
421 CS_number = CS_str[0] - '0';
422 free(CS_str);
423 if (strlen(CS_str) > 1 || CS_number < 0 || 7 < CS_number) {
424 msg_perr("Only CS 0-7 supported\n");
425 return 1;
426 }
427 }
428
429 voltage = extract_programmer_param("voltage");
430 if (voltage != NULL) {
431 requested_io_voltage_mV = parse_voltage(voltage);
432 free(voltage);
433 if (requested_io_voltage_mV < 0)
434 return 1;
435 }
436
437 serial_number = extract_programmer_param("serial");
438
439 speed_str = extract_programmer_param("spispeed");
440 if (speed_str) {
441 spi_speed_KHz = strtoul(speed_str, &endptr, 0);
442 if (*endptr) {
443 msg_perr("The spispeed parameter passed with invalid format: %s\n",
444 speed_str);
445 msg_perr("Please pass the parameter with a simple number in kHz\n");
446 return 1;
447 }
448 free(speed_str);
449 }
450
451 ignore_io_voltage_limits = false;
452 ignore_io_voltage_limits_str = extract_programmer_param("ignore_io_voltage_limits");
453 if (ignore_io_voltage_limits_str
454 && strcmp(ignore_io_voltage_limits_str, "yes") == 0) {
455 ignore_io_voltage_limits = true;
456 }
457
458 if (ni845x_spi_open(serial_number, &device_handle)) {
459 if (serial_number) {
460 msg_pinfo("Could not find any connected NI USB-8451/8452 with serialnumber: %s!\n",
461 serial_number);
462 ni845x_spi_print_available_devices();
463 msg_pinfo("Check the S/N field on the bottom of the device,\n"
464 "or use 'lsusb -v -d 3923:7166 | grep Serial' for USB-8451\n"
465 "or 'lsusb -v -d 3923:7514 | grep Serial' for USB-8452\n");
466 free(serial_number);
467 } else {
468 msg_pinfo("Could not find any connected NI USB-845x device!\n");
469 }
470 return 1;
471 }
472 free(serial_number);
473
474 // open the SPI config handle
475 tmp = ni845xSpiConfigurationOpen(&configuration_handle);
476 if (tmp != 0) {
477 ni845x_report_error("ni845xSpiConfigurationOpen", tmp);
478 ni845x_spi_shutdown(NULL);
479 return 1;
480 }
481
482 if (usb8452_spi_set_io_voltage(requested_io_voltage_mV, &io_voltage_in_mV, USE_LOWER) < 0) {
483 ni845x_spi_shutdown(NULL);
484 return 1; // no alert here usb8452_spi_set_io_voltage already printed that
485 }
486
487 if (ni845x_spi_set_speed(spi_speed_KHz)) {
488 msg_perr("Unable to set SPI speed\n");
489 ni845x_spi_shutdown(NULL);
490 return 1;
491 }
492
493 if (register_shutdown(ni845x_spi_shutdown, NULL)) {
494 ni845x_spi_shutdown(NULL);
495 return 1;
496 }
497
498 register_spi_master(&spi_programmer_ni845x);
499
500 return 0;
501}
502
Edward O'Callaghanc9a51f12020-10-03 00:36:18 +1000503static void ni845x_warn_over_max_voltage(const struct flashctx *flash)
504{
505 if (device_pid == USB8451) {
506 msg_pwarn("The %s chip maximum voltage is %.1fV, while the USB-8451 "
507 "IO voltage levels are 3.3V.\n"
508 "Ignoring this because ignore_io_voltage_limits parameter is set.\n",
509 flash->chip->name,
510 flash->chip->voltage.max / 1000.0f);
511 } else if (device_pid == USB8452) {
512 msg_pwarn("The %s chip maximum voltage is %.1fV, while the USB-8452 "
513 "IO voltage is set to %.1fV.\n"
514 "Ignoring this because ignore_io_voltage_limits parameter is set.\n",
515 flash->chip->name,
516 flash->chip->voltage.max / 1000.0f,
517 io_voltage_in_mV / 1000.0f);
518 }
519}
520
521static int ni845x_spi_io_voltage_check(const struct flashctx *flash)
522{
523 static bool first_transmit = true;
524
525 if (first_transmit && flash->chip) {
526 first_transmit = false;
527 if (io_voltage_in_mV > flash->chip->voltage.max) {
528 if (ignore_io_voltage_limits) {
529 ni845x_warn_over_max_voltage(flash);
530 return 0;
531 }
532
533 if (device_pid == USB8451) {
534 msg_perr("The %s chip maximum voltage is %.1fV, while the USB-8451 "
535 "IO voltage levels are 3.3V.\nAborting operations\n",
536 flash->chip->name,
537 flash->chip->voltage.max / 1000.0f);
538 return -1;
539 } else if (device_pid == USB8452) {
540 msg_perr("Lowering IO voltage because the %s chip maximum voltage is %.1fV, "
541 "(%.1fV was set)\n",
542 flash->chip->name,
543 flash->chip->voltage.max / 1000.0f,
544 io_voltage_in_mV / 1000.0f);
545 if (usb8452_spi_set_io_voltage(flash->chip->voltage.max,
546 &io_voltage_in_mV,
547 USE_LOWER)) {
548 msg_perr("Unable to lower the IO voltage below "
549 "the chip's maximum voltage\n");
550 return -1;
551 }
552 }
553 } else if (io_voltage_in_mV < flash->chip->voltage.min) {
554 if (device_pid == USB8451) {
555 msg_pwarn("Flash operations might be unreliable, because the %s chip's "
556 "minimum voltage is %.1fV, while the USB-8451's "
557 "IO voltage levels are 3.3V.\n",
558 flash->chip->name,
559 flash->chip->voltage.min / 1000.0f);
560 return ignore_io_voltage_limits ? 0 : -1;
561 } else if (device_pid == USB8452) {
562 msg_pwarn("Raising the IO voltage because the %s chip's "
563 "minimum voltage is %.1fV, "
564 "(%.1fV was set)\n",
565 flash->chip->name,
566 flash->chip->voltage.min / 1000.0f,
567 io_voltage_in_mV / 1000.0f);
568 if (usb8452_spi_set_io_voltage(flash->chip->voltage.min,
569 &io_voltage_in_mV,
570 USE_HIGHER)) {
571 msg_pwarn("Unable to raise the IO voltage above the chip's "
572 "minimum voltage\n"
573 "Flash operations might be unreliable.\n");
574 return ignore_io_voltage_limits ? 0 : -1;
575 }
576 }
577 }
578 }
579 return 0;
580}
581
582static int ni845x_spi_transmit(struct flashctx *flash,
583 unsigned int write_cnt,
584 unsigned int read_cnt,
585 const unsigned char *write_arr,
586 unsigned char *read_arr)
587{
588 uInt32 read_size = 0;
589 uInt8 *transfer_buffer = NULL;
590 int32 ret = 0;
591
592 if (ni845x_spi_io_voltage_check(flash))
593 return -1;
594
595 transfer_buffer = calloc(write_cnt + read_cnt, sizeof(uInt8));
596 if (transfer_buffer == NULL) {
597 msg_gerr("Memory allocation failed!\n");
598 return -1;
599 }
600
601 memcpy(transfer_buffer, write_arr, write_cnt);
602
603 ret = ni845xSpiWriteRead(device_handle,
604 configuration_handle,
605 (write_cnt + read_cnt), transfer_buffer, &read_size, transfer_buffer);
606 if (ret < 0) {
607 // Negative specifies an error, meaning the function did not perform the expected behavior.
608 ni845x_report_error("ni845xSpiWriteRead", ret);
609 free(transfer_buffer);
610 return -1;
611 } else if (ret > 0) {
612 // Positive specifies a warning, meaning the function performed as expected,
613 // but a condition arose that might require attention.
614 ni845x_report_warning("ni845xSpiWriteRead", ret);
615 }
616
617 if (read_cnt != 0 && read_arr != NULL) {
618 if ((read_cnt + write_cnt) != read_size) {
619 msg_perr("%s: expected and returned read count mismatch: %u expected, %ld recieved\n",
620 __func__, read_cnt, read_size);
621 free(transfer_buffer);
622 return -1;
623 }
624 memcpy(read_arr, &transfer_buffer[write_cnt], read_cnt);
625 }
626 free(transfer_buffer);
627 return 0;
628}
629
630static const struct spi_master spi_programmer_ni845x = {
631 .max_data_read = MAX_DATA_READ_UNLIMITED,
632 .max_data_write = MAX_DATA_WRITE_UNLIMITED,
633 .command = ni845x_spi_transmit,
634 .multicommand = default_spi_send_multicommand,
635 .read = default_spi_read,
636 .write_256 = default_spi_write_256,
637 .write_aai = default_spi_write_aai,
638};