diff options
author | Steven Miao <realmz6@gmail.com> | 2013-09-12 04:36:16 -0400 |
---|---|---|
committer | Steven Miao <realmz6@gmail.com> | 2013-09-12 22:42:27 -0400 |
commit | 24a70cf2b28e24aa31c4f9bc310cc274c0a90183 (patch) | |
tree | 83329a8bfaf013146ba394e1285e283df1056f19 /arch/blackfin/mach-common | |
parent | 6e4664525b1db28f8c4e1130957f70a94c19213e (diff) |
blackfin: scb: Add system crossbar init code.
If SCB exists in select blackfin cpu, developer can change the SCB
priority in kernel configuration.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Steven Miao <realmz6@gmail.com>
Diffstat (limited to 'arch/blackfin/mach-common')
-rw-r--r-- | arch/blackfin/mach-common/Makefile | 1 | ||||
-rw-r--r-- | arch/blackfin/mach-common/scb-init.c | 53 |
2 files changed, 54 insertions, 0 deletions
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile index 675466d490d4..f09979204040 100644 --- a/arch/blackfin/mach-common/Makefile +++ b/arch/blackfin/mach-common/Makefile | |||
@@ -10,6 +10,7 @@ obj-$(CONFIG_PM) += pm.o | |||
10 | ifneq ($(CONFIG_BF60x),y) | 10 | ifneq ($(CONFIG_BF60x),y) |
11 | obj-$(CONFIG_PM) += dpmc_modes.o | 11 | obj-$(CONFIG_PM) += dpmc_modes.o |
12 | endif | 12 | endif |
13 | obj-$(CONFIG_SCB_PRIORITY) += scb-init.o | ||
13 | obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o | 14 | obj-$(CONFIG_CPU_VOLTAGE) += dpmc.o |
14 | obj-$(CONFIG_SMP) += smp.o | 15 | obj-$(CONFIG_SMP) += smp.o |
15 | obj-$(CONFIG_BFIN_KERNEL_CLOCK) += clocks-init.o | 16 | obj-$(CONFIG_BFIN_KERNEL_CLOCK) += clocks-init.o |
diff --git a/arch/blackfin/mach-common/scb-init.c b/arch/blackfin/mach-common/scb-init.c new file mode 100644 index 000000000000..2cbfb0b5679e --- /dev/null +++ b/arch/blackfin/mach-common/scb-init.c | |||
@@ -0,0 +1,53 @@ | |||
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 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/errno.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <asm/scb.h> | ||
13 | |||
14 | __attribute__((l1_text)) | ||
15 | inline void scb_mi_write(unsigned long scb_mi_arbw, unsigned int slots, | ||
16 | unsigned char *scb_mi_prio) | ||
17 | { | ||
18 | unsigned int i; | ||
19 | |||
20 | for (i = 0; i < slots; ++i) | ||
21 | bfin_write32(scb_mi_arbw, (i << SCB_SLOT_OFFSET) | scb_mi_prio[i]); | ||
22 | } | ||
23 | |||
24 | __attribute__((l1_text)) | ||
25 | inline void scb_mi_read(unsigned long scb_mi_arbw, unsigned int slots, | ||
26 | unsigned char *scb_mi_prio) | ||
27 | { | ||
28 | unsigned int i; | ||
29 | |||
30 | for (i = 0; i < slots; ++i) { | ||
31 | bfin_write32(scb_mi_arbw, (0xFF << SCB_SLOT_OFFSET) | i); | ||
32 | scb_mi_prio[i] = bfin_read32(scb_mi_arbw); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | __attribute__((l1_text)) | ||
37 | void init_scb(void) | ||
38 | { | ||
39 | unsigned int i, j; | ||
40 | unsigned char scb_tmp_prio[32]; | ||
41 | |||
42 | pr_info("Init System Crossbar\n"); | ||
43 | for (i = 0; scb_data[i].scb_mi_arbr > 0; ++i) { | ||
44 | |||
45 | scb_mi_write(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_data[i].scb_mi_prio); | ||
46 | |||
47 | pr_debug("scb priority at 0x%lx:\n", scb_data[i].scb_mi_arbr); | ||
48 | scb_mi_read(scb_data[i].scb_mi_arbw, scb_data[i].scb_mi_slots, scb_tmp_prio); | ||
49 | for (j = 0; j < scb_data[i].scb_mi_slots; ++j) | ||
50 | pr_debug("slot %d = %d\n", j, scb_tmp_prio[j]); | ||
51 | } | ||
52 | |||
53 | } | ||