layerscape: add ls1088ardb device support
[openwrt/staging/lynxis/omap.git] / target / linux / layerscape / patches-4.4 / 7195-increment-MC_CMD_COMPLETION_TIMEOUT_MS.patch
1 From 71d19cd1107fa435d056e08e7d7ef7d8f714cf35 Mon Sep 17 00:00:00 2001
2 From: Lijun Pan <Lijun.Pan@freescale.com>
3 Date: Fri, 31 Jul 2015 15:07:32 -0500
4 Subject: [PATCH 195/226] increment MC_CMD_COMPLETION_TIMEOUT_MS
5
6 5000ms is barely enough for dpsw/dpdmux creation.
7 If MC firmware could run faster, we would decrement the value later on.
8
9 Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
10 (Stuart: resolved merge conflict)
11 Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
12 ---
13 drivers/staging/fsl-mc/bus/mc-sys.c | 38 +++++++++++++++--------------------
14 1 file changed, 16 insertions(+), 22 deletions(-)
15
16 --- a/drivers/staging/fsl-mc/bus/mc-sys.c
17 +++ b/drivers/staging/fsl-mc/bus/mc-sys.c
18 @@ -43,8 +43,10 @@
19
20 /**
21 * Timeout in milliseconds to wait for the completion of an MC command
22 + * 5000 ms is barely enough for dpsw/dpdmux creation
23 + * TODO: if MC firmware could response faster, we should decrease this value
24 */
25 -#define MC_CMD_COMPLETION_TIMEOUT_MS 500
26 +#define MC_CMD_COMPLETION_TIMEOUT_MS 5000
27
28 /*
29 * usleep_range() min and max values used to throttle down polling
30 @@ -327,17 +329,8 @@ static int mc_polling_wait_preemptible(s
31 usleep_range(MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS,
32 MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS);
33
34 - if (time_after_eq(jiffies, jiffies_until_timeout)) {
35 - dev_dbg(mc_io->dev,
36 - "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
37 - mc_io->portal_phys_addr,
38 - (unsigned int)
39 - MC_CMD_HDR_READ_TOKEN(cmd->header),
40 - (unsigned int)
41 - MC_CMD_HDR_READ_CMDID(cmd->header));
42 -
43 + if (time_after_eq(jiffies, jiffies_until_timeout))
44 return -ETIMEDOUT;
45 - }
46 }
47
48 *mc_status = status;
49 @@ -369,17 +362,8 @@ static int mc_polling_wait_atomic(struct
50
51 udelay(MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS);
52 timeout_usecs -= MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS;
53 - if (timeout_usecs == 0) {
54 - dev_dbg(mc_io->dev,
55 - "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
56 - mc_io->portal_phys_addr,
57 - (unsigned int)
58 - MC_CMD_HDR_READ_TOKEN(cmd->header),
59 - (unsigned int)
60 - MC_CMD_HDR_READ_CMDID(cmd->header));
61 -
62 + if (timeout_usecs == 0)
63 return -ETIMEDOUT;
64 - }
65 }
66
67 *mc_status = status;
68 @@ -422,9 +406,19 @@ int mc_send_command(struct fsl_mc_io *mc
69 else
70 error = mc_polling_wait_atomic(mc_io, cmd, &status);
71
72 - if (error < 0)
73 + if (error < 0) {
74 + if (error == -ETIMEDOUT) {
75 + pr_debug("MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
76 + mc_io->portal_phys_addr,
77 + (unsigned int)
78 + MC_CMD_HDR_READ_TOKEN(cmd->header),
79 + (unsigned int)
80 + MC_CMD_HDR_READ_CMDID(cmd->header));
81 + }
82 goto common_exit;
83
84 + }
85 +
86 if (status != MC_CMD_STATUS_OK) {
87 dev_dbg(mc_io->dev,
88 "MC command failed: portal: %#llx, obj handle: %#x, command: %#x, status: %s (%#x)\n",