__le16 transfer_status;
} __attribute__((aligned(16)));
+#define control_set(regs) (regs)
+#define control_clear(regs) ((regs) + 4)
+#define command_ptr(regs) ((regs) + 12)
+#define context_match(regs) ((regs) + 16)
+
struct ar_buffer {
struct descriptor descriptor;
struct ar_buffer *next;
struct ar_buffer *current_buffer;
struct ar_buffer *last_buffer;
void *pointer;
- u32 command_ptr;
- u32 control_set;
- u32 control_clear;
+ u32 regs;
struct tasklet_struct tasklet;
};
struct descriptor last;
} d;
- u32 command_ptr;
- u32 control_set;
- u32 control_clear;
+ u32 regs;
struct tasklet_struct tasklet;
};
struct iso_context {
struct fw_iso_context base;
struct tasklet_struct tasklet;
- u32 control_set;
- u32 control_clear;
- u32 command_ptr;
- u32 context_match;
+ u32 regs;
struct descriptor *buffer;
dma_addr_t buffer_bus;
ctx->last_buffer->next = ab;
ctx->last_buffer = ab;
- reg_write(ctx->ohci, ctx->control_set, CONTEXT_WAKE);
+ reg_write(ctx->ohci, control_set(ctx->regs), CONTEXT_WAKE);
flush_writes(ctx->ohci);
return 0;
}
static int
-ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 control_set)
+ar_context_init(struct ar_context *ctx, struct fw_ohci *ohci, u32 regs)
{
struct ar_buffer ab;
- ctx->control_set = control_set;
- ctx->control_clear = control_set + 4;
- ctx->command_ptr = control_set + 12;
- ctx->ohci = ohci;
- ctx->last_buffer = &ab;
+ ctx->regs = regs;
+ ctx->ohci = ohci;
+ ctx->last_buffer = &ab;
tasklet_init(&ctx->tasklet, ar_context_tasklet, (unsigned long)ctx);
ar_context_add_page(ctx);
ctx->current_buffer = ab.next;
ctx->pointer = ctx->current_buffer->data;
- reg_write(ctx->ohci, ctx->command_ptr, ab.descriptor.branch_address);
- reg_write(ctx->ohci, ctx->control_set, CONTEXT_RUN);
+ reg_write(ctx->ohci, command_ptr(ctx->regs), ab.descriptor.branch_address);
+ reg_write(ctx->ohci, control_set(ctx->regs), CONTEXT_RUN);
flush_writes(ctx->ohci);
return 0;
/* FIXME: Document how the locking works. */
if (ohci->generation == packet->generation) {
- reg_write(ctx->ohci, ctx->command_ptr,
+ reg_write(ctx->ohci, command_ptr(ctx->regs),
ctx->descriptor_bus | z);
- reg_write(ctx->ohci, ctx->control_set,
+ reg_write(ctx->ohci, control_set(ctx->regs),
CONTEXT_RUN | CONTEXT_WAKE);
} else {
/* We dont return error codes from this function; all
{
u32 reg;
- reg_write(ctx->ohci, ctx->control_clear, CONTEXT_RUN);
+ reg_write(ctx->ohci, control_clear(ctx->regs), CONTEXT_RUN);
- reg = reg_read(ctx->ohci, ctx->control_set);
+ reg = reg_read(ctx->ohci, control_set(ctx->regs));
if (reg & CONTEXT_ACTIVE)
fw_notify("Tried to stop context, but it is still active "
"(0x%08x).\n", reg);
}
static int
-at_context_init(struct at_context *ctx, struct fw_ohci *ohci, u32 control_set)
+at_context_init(struct at_context *ctx, struct fw_ohci *ohci, u32 regs)
{
INIT_LIST_HEAD(&ctx->list);
if (ctx->descriptor_bus == 0)
return -ENOMEM;
- ctx->control_set = control_set;
- ctx->control_clear = control_set + 4;
- ctx->command_ptr = control_set + 12;
- ctx->ohci = ohci;
+ ctx->regs = regs;
+ ctx->ohci = ohci;
tasklet_init(&ctx->tasklet, at_context_tasklet, (unsigned long)ctx);