Snow: Add checking for more i2c error cases
Snow: Add checking for more i2c error cases

There are a number of ways for the i2c to fail, and some are quite
rare and have thus been overlooked.  It's easy enough to handle these
rationally, but we have to check for them.  This checks that the i2c
peripheral is actually in slave mode when it gets a slave event firing
(stopping it from accidentally sending garbage on the tail end of
another request) and makes sure a STOP bit is sent in the event that the
BUSY signal isn't set at the moment we check it (if we check it at the
moment that it is sending a 1, it may not be set).  Finally, if the i2c
can't send a STOP bit, the peripheral is reset to get it back to a sane
state, specifically it needs to not be stuck in master mode forever.

BUG=chrome-os-partner:13380
TEST=Boot machine normally, from AP run "while true; do ectool version;
done" to start a loop of the long transaction that sends lots of
spurious reads too.  Then on the EC, run "pmu 10000" and then "battery
1000" to stress the bus from all sides.  Once the EC is done, stop the
AP's side of the stress test, and make sure the bus is still
functioning.  Tested the resetting, by making it reset the peripheral
every 150 times, and confirmed that the following transfers work just fine.
BRANCH=snow

Change-Id: I265b3cddd25e1fd6ab4e8cf9c7290c875fad89f8
Signed-off-by: Charlie Mooney <c4f45ade001857f07012a75265a97cb07f1531f2@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32188
Reviewed-by: Doug Anderson <49983c4a76b998672954ed5edf4a62db4a336502@chromium.org>

mtk09422/chromiumos-platform-ec,thehobn/ec,alterapraxisptyltd/chromium-ec,md5555/ec,eatbyte/chromium-ec,thehobn/ec,longsleep/ec,akappy7/ChromeOS_EC_LED_Diagnostics,coreboot/chrome-ec,fourier49/BIZ_EC,eatbyte/chromium-ec,mtk09422/chromiumos-platform-ec,gelraen/cros-ec,coreboot/chrome-ec,gelraen/cros-ec,fourier49/BIZ_EC,gelraen/cros-ec,akappy7/ChromeOS_EC_LED_Diagnostics,longsleep/ec,alterapraxisptyltd/chromium-ec,md5555/ec,mtk09422/chromiumos-platform-ec,fourier49/BIZ_EC,thehobn/ec,thehobn/ec,akappy7/ChromeOS_EC_LED_Diagnostics,mtk09422/chromiumos-platform-ec,fourier49/BZ_DEV_EC,fourier49/BIZ_EC,md5555/ec,fourier49/BZ_DEV_EC,eatbyte/chromium-ec,fourier49/BZ_DEV_EC,akappy7/ChromeOS_EC_LED_Diagnostics,gelraen/cros-ec,md5555/ec,coreboot/chrome-ec,akappy7/ChromeOS_EC_LED_Diagnostics,eatbyte/chromium-ec,alterapraxisptyltd/chromium-ec,alterapraxisptyltd/chromium-ec,longsleep/ec,coreboot/chrome-ec,fourier49/BZ_DEV_EC,coreboot/chrome-ec,coreboot/chrome-ec,longsleep/ec