Blame view

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