38 #include <hwregs/reg_map.h>
43 #include <hwregs/intr_vect.h>
46 #include <linux/signal.h>
47 #include <linux/errno.h>
50 #include <asm/irq_regs.h>
62 #define NUMBER_OF_BP 4
63 #define SDRAM_BANDWIDTH 400000000
64 #define INTMEM_BANDWIDTH 400000000
65 #define NBR_OF_SLOTS 64
66 #define NBR_OF_REGIONS 2
67 #define NBR_OF_CLIENTS 15
69 #define UNASSIGNED 100
114 crisv32_foo_arbiter_irq(
int irq,
void *
dev_id);
116 crisv32_bar_arbiter_irq(
int irq,
void *
dev_id);
131 static void crisv32_arbiter_config(
int arbiter,
int region,
int unused_slots)
149 for (client = 0; client < arbiters[arbiter].
nbr_clients; client++) {
183 interval = NBR_OF_SLOTS /
187 while (pos < NBR_OF_SLOTS) {
208 client = (client + 1) %
214 client = (client + 1) % arbiters[arbiter].
nbr_clients;
219 rw_l2_slots, slot, val[slot]);
222 rw_intm_slots, slot, val[slot]);
225 rw_ddr2_slots, slot, val[slot]);
232 static void crisv32_arbiter_init(
void)
266 #ifndef CONFIG_ETRAX_KGDB
289 int total_assigned = 0;
290 int total_clients = 0;
294 crisv32_arbiter_init();
296 if (client & 0xffff0000) {
301 for (i = 0; i < arbiters[arbiter].
nbr_clients; i++) {
308 ? 0 : NBR_OF_SLOTS / (max_bandwidth[region] /
bandwidth);
318 if (total_assigned + req > NBR_OF_SLOTS)
323 crisv32_arbiter_config(arbiter, region, NBR_OF_SLOTS - total_assigned);
347 int total_assigned = 0;
350 if (client & 0xffff0000)
356 for (i = 0; i < arbiters[arbiter].
nbr_clients; i++)
359 crisv32_arbiter_config(arbiter, region, NBR_OF_SLOTS - total_assigned);
363 unsigned long clients,
unsigned long accesses,
371 crisv32_arbiter_init();
373 if (start > 0x80000000) {
375 "physical address", start);
379 spin_lock(&arbiter_lock);
381 if (clients & 0xffff)
383 if (clients & 0xffff0000)
386 for (arbiter = 0; arbiter <
ARBITERS; arbiter++) {
391 if (!watches[arbiter][i].used) {
400 watches[arbiter][
i].
used = 1;
402 watches[arbiter][
i].
end = start +
size;
403 watches[arbiter][
i].
cb = cb;
405 ret |= (i + 1) << (arbiter + 8);
410 watches[arbiter][i].start);
412 watches[arbiter][i].instance,
414 watches[arbiter][i].
end);
416 watches[arbiter][i].instance,
419 watches[arbiter][i].instance,
426 watches[arbiter][i].start);
428 watches[arbiter][i].instance,
430 watches[arbiter][i].
end);
432 watches[arbiter][i].instance,
435 watches[arbiter][i].instance,
436 rw_clients, clients >> 16);
450 rw_intr_mask, intr_mask);
453 rw_intr_mask, intr_mask);
455 spin_unlock(&arbiter_lock);
461 spin_unlock(&arbiter_lock);
473 crisv32_arbiter_init();
475 spin_lock(&arbiter_lock);
477 for (arbiter = 0; arbiter <
ARBITERS; arbiter++) {
487 id2 = (
id & (0xff << (arbiter + 8))) >> (arbiter + 8);
492 spin_unlock(&arbiter_lock);
496 memset(&watches[arbiter][id2], 0,
516 spin_unlock(&arbiter_lock);
524 crisv32_foo_arbiter_irq(
int irq,
void *
dev_id)
535 .
bp0 = 1, .bp1 = 1, .bp2 = 1, .bp3 = 1
538 unsigned arbiter = (unsigned)dev_id;
543 watch = &watches[arbiter][0];
544 else if (masked_intr.
bp1)
545 watch = &watches[arbiter][1];
546 else if (masked_intr.
bp2)
547 watch = &watches[arbiter][2];
548 else if (masked_intr.
bp3)
549 watch = &watches[arbiter][3];
557 r_first =
REG_RD(marb_foo_bp, watch->
instance, r_brk_first_client);
580 crisv32_bar_arbiter_irq(
int irq,
void *dev_id)
591 .
bp0 = 1, .bp1 = 1, .bp2 = 1, .bp3 = 1
594 unsigned arbiter = (unsigned)dev_id;
599 watch = &watches[arbiter][0];
600 else if (masked_intr.
bp1)
601 watch = &watches[arbiter][1];
602 else if (masked_intr.
bp2)
603 watch = &watches[arbiter][2];
604 else if (masked_intr.
bp3)
605 watch = &watches[arbiter][3];
613 r_first =
REG_RD(marb_bar_bp, watch->
instance, r_brk_first_client);