Steven Miao | 24a70cf | 2013-09-12 16:36:16 +0800 | [diff] [blame] | 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 | |
Steven Miao | 24a70cf | 2013-09-12 16:36:16 +0800 | [diff] [blame] | 9 | #include <linux/errno.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <asm/scb.h> |
| 12 | |
| 13 | __attribute__((l1_text)) |
| 14 | inline void scb_mi_write(unsigned long scb_mi_arbw, unsigned int slots, |
| 15 | unsigned char *scb_mi_prio) |
| 16 | { |
| 17 | unsigned int i; |
| 18 | |
| 19 | for (i = 0; i < slots; ++i) |
| 20 | bfin_write32(scb_mi_arbw, (i << SCB_SLOT_OFFSET) | scb_mi_prio[i]); |
| 21 | } |
| 22 | |
| 23 | __attribute__((l1_text)) |
| 24 | inline void scb_mi_read(unsigned long scb_mi_arbw, unsigned int slots, |
| 25 | unsigned char *scb_mi_prio) |
| 26 | { |
| 27 | unsigned int i; |
| 28 | |
| 29 | for (i = 0; i < slots; ++i) { |
| 30 | bfin_write32(scb_mi_arbw, (0xFF << SCB_SLOT_OFFSET) | i); |
| 31 | scb_mi_prio[i] = bfin_read32(scb_mi_arbw); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | __attribute__((l1_text)) |
| 36 | void init_scb(void) |
| 37 | { |
| 38 | unsigned int i, j; |
| 39 | unsigned char scb_tmp_prio[32]; |
| 40 | |
| 41 | pr_info("Init System Crossbar\n"); |
| 42 | for (i = 0; scb_data[i].scb_mi_arbr > 0; ++i) { |
| 43 | |
| 44 | scb_mi_write(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_data[i].scb_mi_prio); |
| 45 | |
| 46 | pr_debug("scb priority at 0x%lx:\n", scb_data[i].scb_mi_arbr); |
| 47 | scb_mi_read(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_tmp_prio); |
| 48 | for (j = 0; j < scb_data[i].scb_mi_slots; ++j) |
| 49 | pr_debug("slot %d = %d\n", j, scb_tmp_prio[j]); |
| 50 | } |
| 51 | |
| 52 | } |