16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/slab.h>
30 #define DRIVER_NAME "bestcomm-core"
34 { .compatible =
"fsl,mpc5200-sram", },
35 { .compatible =
"mpc5200-sram", },
60 spin_lock(&bcom_eng->
lock);
63 if (!bcom_eng->
tdt[i].stop) {
64 bcom_eng->
tdt[
i].stop = 0xfffffffful;
69 spin_unlock(&bcom_eng->
lock);
97 memset(tsk->
bd, 0x00, bd_count * bd_size);
124 bcom_disable_task(tsk->
tasknum);
144 u32 *desc_src, *var_src, *inc_src;
149 ": Trying to load invalid microcode\n");
155 ": Trying to load invalid task %d\n", task);
163 desc = bcom_task_desc(task);
164 if (hdr->
desc_size != bcom_task_num_descs(task)) {
166 ": Trying to reload wrong task image "
167 "(%d size %d/%d)!\n",
170 bcom_task_num_descs(task));
180 tdt->
start = start_pa;
184 var = bcom_task_var(task);
185 inc = bcom_task_inc(task);
191 desc_src = (
u32 *)(hdr + 1);
209 int next_drd_has_initiator;
211 bcom_set_tcr_initiator(task, initiator);
217 desc = bcom_task_desc(task);
218 next_drd_has_initiator = 1;
219 num_descs = bcom_task_num_descs(task);
221 for (i=0; i<num_descs; i++, desc++) {
222 if (!bcom_desc_is_drd(*desc))
224 if (next_drd_has_initiator)
226 bcom_set_desc_initiator(desc, initiator);
227 next_drd_has_initiator = !bcom_drd_is_extended(*desc);
238 bcom_enable_task(tsk->
tasknum);
245 bcom_disable_task(tsk->
tasknum);
256 static u32 fdt_ops[] = {
277 bcom_engine_init(
void)
281 unsigned int tdt_size, ctx_size, var_size, fdt_size;
294 if (!bcom_eng->
tdt || !bcom_eng->
ctx || !bcom_eng->
var || !bcom_eng->
fdt) {
311 memcpy(&bcom_eng->
fdt[48], fdt_ops,
sizeof(fdt_ops));
319 bcom_eng->
tdt[
task].context = ctx_pa;
320 bcom_eng->
tdt[
task].var = var_pa;
321 bcom_eng->
tdt[
task].fdt = fdt_pa;
334 bcom_disable_prefetch();
343 bcom_engine_cleanup(
void)
379 of_node_get(op->
dev.of_node);
385 "No SRAM found in device tree\n");
390 of_node_put(ofn_sram);
394 "Error in SRAM init\n");
402 "Can't allocate state structure\n");
404 goto error_sramclean;
413 "Can't get resource\n");
415 goto error_sramclean;
421 "Can't request registers region\n");
423 goto error_sramclean;
428 if (!bcom_eng->
regs) {
430 "Can't map registers\n");
436 rv = bcom_engine_init();
455 of_node_put(op->
dev.of_node);
466 bcom_engine_cleanup();
476 of_node_put(bcom_eng->
ofnode);
486 { .compatible =
"fsl,mpc5200-bestcomm", },
487 { .compatible =
"mpc5200-bestcomm", },
495 .probe = mpc52xx_bcom_probe,
496 .remove = mpc52xx_bcom_remove,
500 .of_match_table = mpc52xx_bcom_of_match,
510 mpc52xx_bcom_init(
void)
516 mpc52xx_bcom_exit(
void)