cros_ec: Limit commands to 128 bytes when v2 EC protocol is supported

When EC reports that both v2 and v3 protocol are supported, it may
indicates the kernel only support protocol v2.
In that case, the kernel may not support large commands and crash.

BUG=chromium:733407
BRANCH=none
TEST=Use flashrom -p ec -V -r /tmp/ec.bin.
On pit, without the change, we try to send 512 long commands and fail at
kernel level.
With that changes:
On pit: uses 128 bytes commands.
On glimmer: uses 128 bytes as well (v2 and v3 supported, even if we run
kernel 4.4).
On cyan: uses 248 bytes commands (only v3 supported, in EC since
cl/291411).

Change-Id: I89b8b9d9171c6737895b278854a13151add8fe59
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/611011
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit cf540ef8391df0c094546751e6e0aeb82c956eff)
Reviewed-on: https://chromium-review.googlesource.com/611489
1 file changed