scb-init.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * arch/blackfin/mach-common/scb-init.c - reprogram system cross bar priority
  3. *
  4. * Copyright 2012 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/errno.h>
  9. #include <linux/kernel.h>
  10. #include <asm/scb.h>
  11. __attribute__((l1_text))
  12. inline void scb_mi_write(unsigned long scb_mi_arbw, unsigned int slots,
  13. unsigned char *scb_mi_prio)
  14. {
  15. unsigned int i;
  16. for (i = 0; i < slots; ++i)
  17. bfin_write32(scb_mi_arbw, (i << SCB_SLOT_OFFSET) | scb_mi_prio[i]);
  18. }
  19. __attribute__((l1_text))
  20. inline void scb_mi_read(unsigned long scb_mi_arbw, unsigned int slots,
  21. unsigned char *scb_mi_prio)
  22. {
  23. unsigned int i;
  24. for (i = 0; i < slots; ++i) {
  25. bfin_write32(scb_mi_arbw, (0xFF << SCB_SLOT_OFFSET) | i);
  26. scb_mi_prio[i] = bfin_read32(scb_mi_arbw);
  27. }
  28. }
  29. __attribute__((l1_text))
  30. void init_scb(void)
  31. {
  32. unsigned int i, j;
  33. unsigned char scb_tmp_prio[32];
  34. pr_info("Init System Crossbar\n");
  35. for (i = 0; scb_data[i].scb_mi_arbr > 0; ++i) {
  36. scb_mi_write(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_data[i].scb_mi_prio);
  37. pr_debug("scb priority at 0x%lx:\n", scb_data[i].scb_mi_arbr);
  38. scb_mi_read(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_tmp_prio);
  39. for (j = 0; j < scb_data[i].scb_mi_slots; ++j)
  40. pr_debug("slot %d = %d\n", j, scb_tmp_prio[j]);
  41. }
  42. }