From 326f98ac3168cf415f4e1681b3684614bcd79fd3 Mon Sep 17 00:00:00 2001 From: Viresh Kumar Date: Wed, 22 Jun 2016 14:46:41 +0530 Subject: [PATCH] greybus: bootrom: Wait for 10 seconds for mode-switch The greybus SVC core handles events from the SVC serially today. In some cases the SVC operations may take too long, for example trying to activate a dummy interface. If another interface receives a mode-switch mailbox event in that time, the SVC core wouldn't be able to process it in quickly enough and bootrom driver will print following error: bootrom 1-3.3.1: Timed out waiting for Interface Mode Switch from the Module This can be reproduced easily by attaching a 2x2 module along with any other normal module like camera or speaker, and doing a unipro_reset from userspace. The logs suggest this time to be around 6-7 seconds in most of the cases. Attaching multiple modules with dummy interfaces may make this worst. Lets increase the timeout from 5 to 10 seconds for now, also add a FIXME for the same. Testing Done: Tested on EVT 2.0 with camera and a 2x2 module. Signed-off-by: Viresh Kumar Tested-by: Bryan O'Donoghue Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/bootrom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index 70785d4b64a9..84537a07ab7f 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -17,6 +17,12 @@ /* Timeout, in jiffies, within which the next request must be received */ #define NEXT_REQ_TIMEOUT_MS 1000 +/* + * FIXME: Reduce this timeout once svc core handles parallel processing of + * events from the SVC, which are handled sequentially today. + */ +#define MODE_SWITCH_TIMEOUT_MS 10000 + enum next_request_type { NEXT_REQ_FIRMWARE_SIZE, NEXT_REQ_GET_FIRMWARE, @@ -327,7 +333,7 @@ queue_work: * connection. As that can take some time, increase the timeout a bit. */ gb_bootrom_set_timeout(bootrom, NEXT_REQ_MODE_SWITCH, - 5 * NEXT_REQ_TIMEOUT_MS); + MODE_SWITCH_TIMEOUT_MS); return ret; } -- 2.39.5