1 /*
2  * Global extern defines for blackfin
3  *
4  * Copyright 2006-2009 Analog Devices Inc.
5  *
6  * Licensed under the GPL-2 or later.
7  */
8 
9 #ifndef _BFIN_GLOBAL_H_
10 #define _BFIN_GLOBAL_H_
11 
12 #ifndef __ASSEMBLY__
13 
14 #include <linux/linkage.h>
15 #include <linux/types.h>
16 
17 #if defined(CONFIG_DMA_UNCACHED_4M)
18 # define DMA_UNCACHED_REGION (4 * 1024 * 1024)
19 #elif defined(CONFIG_DMA_UNCACHED_2M)
20 # define DMA_UNCACHED_REGION (2 * 1024 * 1024)
21 #elif defined(CONFIG_DMA_UNCACHED_1M)
22 # define DMA_UNCACHED_REGION (1024 * 1024)
23 #elif defined(CONFIG_DMA_UNCACHED_512K)
24 # define DMA_UNCACHED_REGION (512 * 1024)
25 #elif defined(CONFIG_DMA_UNCACHED_256K)
26 # define DMA_UNCACHED_REGION (256 * 1024)
27 #elif defined(CONFIG_DMA_UNCACHED_128K)
28 # define DMA_UNCACHED_REGION (128 * 1024)
29 #else
30 # define DMA_UNCACHED_REGION (0)
31 #endif
32 
33 extern void bfin_setup_caches(unsigned int cpu);
34 extern void bfin_setup_cpudata(unsigned int cpu);
35 
36 extern unsigned long get_cclk(void);
37 extern unsigned long get_sclk(void);
38 extern unsigned long sclk_to_usecs(unsigned long sclk);
39 extern unsigned long usecs_to_sclk(unsigned long usecs);
40 
41 struct pt_regs;
42 #if defined(CONFIG_DEBUG_VERBOSE)
43 extern void dump_bfin_process(struct pt_regs *regs);
44 extern void dump_bfin_mem(struct pt_regs *regs);
45 extern void dump_bfin_trace_buffer(void);
46 #else
47 #define dump_bfin_process(regs)
48 #define dump_bfin_mem(regs)
49 #define dump_bfin_trace_buffer()
50 #endif
51 
52 /* init functions only */
53 extern int init_arch_irq(void);
54 extern void init_exception_vectors(void);
55 extern void program_IAR(void);
56 
57 extern asmlinkage void lower_to_irq14(void);
58 extern asmlinkage void bfin_return_from_exception(void);
59 extern asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs);
60 extern int bfin_internal_set_wake(unsigned int irq, unsigned int state);
61 
62 extern void *l1_data_A_sram_alloc(size_t);
63 extern void *l1_data_B_sram_alloc(size_t);
64 extern void *l1_inst_sram_alloc(size_t);
65 extern void *l1_data_sram_alloc(size_t);
66 extern void *l1_data_sram_zalloc(size_t);
67 extern void *l2_sram_alloc(size_t);
68 extern void *l2_sram_zalloc(size_t);
69 extern int l1_data_A_sram_free(const void*);
70 extern int l1_data_B_sram_free(const void*);
71 extern int l1_inst_sram_free(const void*);
72 extern int l1_data_sram_free(const void*);
73 extern int l2_sram_free(const void *);
74 extern int sram_free(const void*);
75 
76 #define L1_INST_SRAM		0x00000001
77 #define L1_DATA_A_SRAM		0x00000002
78 #define L1_DATA_B_SRAM		0x00000004
79 #define L1_DATA_SRAM		0x00000006
80 #define L2_SRAM			0x00000008
81 extern void *sram_alloc_with_lsl(size_t, unsigned long);
82 extern int sram_free_with_lsl(const void*);
83 
84 extern void *isram_memcpy(void *dest, const void *src, size_t n);
85 
86 extern const char bfin_board_name[];
87 
88 extern unsigned long bfin_sic_iwr[];
89 extern unsigned vr_wakeup;
90 extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */
91 
92 #endif
93 
94 #endif				/* _BLACKFIN_H_ */
95