]> git.karo-electronics.de Git - linux-beck.git/commit
greybus: bootrom: Implement timeouts to detect Module failures
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 3 May 2016 10:43:12 +0000 (16:13 +0530)
committerGreg Kroah-Hartman <gregkh@google.com>
Wed, 4 May 2016 18:33:18 +0000 (11:33 -0700)
commitc81b1ec7853d083981b6edd1d7397d94b88dd597
tree5f45e6d1e1a280bc3f48c828d1cb19e31f756ae0
parent0634874a584e8bd875a83850c656e5adefc53bde
greybus: bootrom: Implement timeouts to detect Module failures

Its possible that the Module may fail to download the next stage
firmware, or to jump into it and boot into the new personality.

We have already seen examples of both of these cases on EVT 1.5.

This patch implements timeouts in the bootrom bundle driver, which now
expects the next request from the Module to be received at the AP within
1 second of the previous request/response. The time interval can be
increased later if required.

The timeouts are added between:
- AP_READY and FIRMWARE_SIZE operations
- FIRMWARE_SIZE and GET_FIRMWARE operations
- Two GET_FIRMWARE operations
- GET_FIRMWARE and READY_TO_BOOT operations
- READY_TO_BOOT operation and the call to the ->disconnect() event of
  the bootrom bundle (once the new hotplug request is received).

The timeout for the last case is kept at 5 seconds right now (random
value), as it may take a bit longer.

Because 'bootrom->fw' can be accessed simultaneously (from timeout
handler and incoming requests) and one of them can potentially free the
'->fw' structure, a mutex is also added to take care of such races while
accessing 'bootrom->fw' structure.

Also note that the '!bootrom->fw' check is moved to free_firmware()
routine.

Tested on EVT 1.5, by faking errors on certain requests, so that the
bootrom doesn't send any more requests. Normal case is working just
fine for audio and GP modules.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/bootrom.c