Skip to content

Commit f2d2b16

Browse files
author
Lucas Tanure
committed
mfd: clsic: Retry clsic_maintenance if firmware_request return EAGAIN
Change-Id: I70089a8f5c7cecc4b1a86f8ce8c7c7400e6a1573 Signed-off-by: Lucas Tanure <[email protected]>
1 parent 8ab63e0 commit f2d2b16

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

drivers/mfd/clsic/clsic-bootsrv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ static int clsic_bootsrv_sendfile(struct clsic *clsic,
356356
bootsrv->fwupdate_status = FWUPDATE_SENDING;
357357

358358
ret = request_firmware(&firmware, filename, clsic->dev);
359+
if (ret == -EAGAIN)
360+
return ret;
359361
if (ret != 0) {
360362
clsic_err(clsic,
361363
"request_firmware failed '%s' = %d (check files)\n",
@@ -595,6 +597,9 @@ int clsic_bootsrv_state_handler(struct clsic *clsic)
595597
default:
596598
clsic_err(clsic, "Unrecognised: %d\n", saved_request);
597599
}
600+
if (ret == -EAGAIN)
601+
clsic->blrequest = saved_request;
602+
598603
return ret;
599604
}
600605

drivers/mfd/clsic/clsic-core.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#include <linux/mfd/clsic/syssrv.h>
2222
#include <linux/mfd/clsic/rassrv.h>
2323

24+
#define CLSIC_BOOT_COMPLETION_TIMEOUT 300
25+
#define CLSIC_RETRY_REQUEST_FW_MS 300
26+
2427
static void clsic_free_service_handler(struct clsic *clsic,
2528
struct clsic_service *handler);
2629
static void clsic_init_sysfs(struct clsic *clsic);
@@ -64,7 +67,7 @@ static void clsic_disable_hard_reset(struct clsic *clsic)
6467
}
6568
}
6669

67-
#define CLSIC_BOOT_COMPLETION_TIMEOUT 300
70+
6871
bool clsic_wait_for_boot_done(struct clsic *clsic)
6972
{
7073
unsigned int val;
@@ -560,6 +563,7 @@ void clsic_maintenance(struct work_struct *data)
560563
struct delayed_work *dw = to_delayed_work(data);
561564
struct clsic *clsic = container_of(dw, struct clsic,
562565
maintenance_handler);
566+
int ret;
563567

564568
trace_clsic_maintenance(clsic->state, clsic->blrequest,
565569
clsic->service_states);
@@ -573,7 +577,14 @@ void clsic_maintenance(struct work_struct *data)
573577
goto pm_complete_exit;
574578

575579
if (clsic->blrequest != CLSIC_BL_IDLE) {
576-
if (clsic_bootsrv_state_handler(clsic) != 0) {
580+
ret = clsic_bootsrv_state_handler(clsic);
581+
if (ret == -EAGAIN) {
582+
schedule_delayed_work(&clsic->maintenance_handler,
583+
msecs_to_jiffies(CLSIC_RETRY_REQUEST_FW_MS));
584+
return;
585+
}
586+
587+
if (ret != 0) {
577588
clsic_err(clsic,
578589
"Bootloader operation failed (%s s: %d b: %d)\n",
579590
clsic_state_to_string(clsic->state),

0 commit comments

Comments
 (0)