Commit 386a4153a2c1455e424f280d636efa3c91864466
Committed by
Stefan Richter
1 parent
78dec56d6a
Exists in
master
and in
4 other branches
firewire: ohci: cache the context run bit
The DMA context run control bit is entirely controlled by software, so it is safe to cache it. This allows the driver to avoid doing an additional MMIO read when queueing an AT packet. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
drivers/firewire/ohci.c
... | ... | @@ -125,6 +125,7 @@ |
125 | 125 | struct fw_ohci *ohci; |
126 | 126 | u32 regs; |
127 | 127 | int total_allocation; |
128 | + bool running; | |
128 | 129 | bool flushing; |
129 | 130 | |
130 | 131 | /* |
... | ... | @@ -1174,6 +1175,7 @@ |
1174 | 1175 | le32_to_cpu(ctx->last->branch_address)); |
1175 | 1176 | reg_write(ohci, CONTROL_CLEAR(ctx->regs), ~0); |
1176 | 1177 | reg_write(ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN | extra); |
1178 | + ctx->running = true; | |
1177 | 1179 | flush_writes(ohci); |
1178 | 1180 | } |
1179 | 1181 | |
... | ... | @@ -1202,6 +1204,7 @@ |
1202 | 1204 | |
1203 | 1205 | ctx->active = false; |
1204 | 1206 | reg_write(ctx->ohci, CONTROL_CLEAR(ctx->regs), CONTEXT_RUN); |
1207 | + ctx->running = false; | |
1205 | 1208 | flush_writes(ctx->ohci); |
1206 | 1209 | |
1207 | 1210 | for (i = 0; i < 10; i++) { |
... | ... | @@ -1232,7 +1235,6 @@ |
1232 | 1235 | struct descriptor *d, *last; |
1233 | 1236 | __le32 *header; |
1234 | 1237 | int z, tcode; |
1235 | - u32 reg; | |
1236 | 1238 | |
1237 | 1239 | d = context_get_descriptors(ctx, 4, &d_bus); |
1238 | 1240 | if (d == NULL) { |
... | ... | @@ -1351,9 +1353,7 @@ |
1351 | 1353 | |
1352 | 1354 | context_append(ctx, d, z, 4 - z); |
1353 | 1355 | |
1354 | - /* If the context isn't already running, start it up. */ | |
1355 | - reg = reg_read(ctx->ohci, CONTROL_SET(ctx->regs)); | |
1356 | - if ((reg & CONTEXT_RUN) == 0) | |
1356 | + if (!ctx->running) | |
1357 | 1357 | context_run(ctx, 0); |
1358 | 1358 | |
1359 | 1359 | return 0; |