Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Global extern defines for blackfin |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 4 | * Copyright 2006-2009 Analog Devices Inc. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 5 | * |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 6 | * Licensed under the GPL-2 or later. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #ifndef _BFIN_GLOBAL_H_ |
| 10 | #define _BFIN_GLOBAL_H_ |
| 11 | |
| 12 | #ifndef __ASSEMBLY__ |
| 13 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 14 | #include <linux/linkage.h> |
| 15 | #include <linux/types.h> |
| 16 | |
Scott Jiang | c8d11a0 | 2012-05-18 16:27:22 -0400 | [diff] [blame] | 17 | #if defined(CONFIG_DMA_UNCACHED_32M) |
| 18 | # define DMA_UNCACHED_REGION (32 * 1024 * 1024) |
| 19 | #elif defined(CONFIG_DMA_UNCACHED_16M) |
| 20 | # define DMA_UNCACHED_REGION (16 * 1024 * 1024) |
| 21 | #elif defined(CONFIG_DMA_UNCACHED_8M) |
| 22 | # define DMA_UNCACHED_REGION (8 * 1024 * 1024) |
| 23 | #elif defined(CONFIG_DMA_UNCACHED_4M) |
Cliff Cai | 86ad793 | 2008-05-17 16:36:52 +0800 | [diff] [blame] | 24 | # define DMA_UNCACHED_REGION (4 * 1024 * 1024) |
| 25 | #elif defined(CONFIG_DMA_UNCACHED_2M) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 26 | # define DMA_UNCACHED_REGION (2 * 1024 * 1024) |
| 27 | #elif defined(CONFIG_DMA_UNCACHED_1M) |
| 28 | # define DMA_UNCACHED_REGION (1024 * 1024) |
Barry Song | c45c065 | 2009-12-02 09:13:36 +0000 | [diff] [blame] | 29 | #elif defined(CONFIG_DMA_UNCACHED_512K) |
| 30 | # define DMA_UNCACHED_REGION (512 * 1024) |
| 31 | #elif defined(CONFIG_DMA_UNCACHED_256K) |
| 32 | # define DMA_UNCACHED_REGION (256 * 1024) |
| 33 | #elif defined(CONFIG_DMA_UNCACHED_128K) |
| 34 | # define DMA_UNCACHED_REGION (128 * 1024) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 35 | #else |
| 36 | # define DMA_UNCACHED_REGION (0) |
| 37 | #endif |
| 38 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 39 | extern void bfin_setup_caches(unsigned int cpu); |
| 40 | extern void bfin_setup_cpudata(unsigned int cpu); |
| 41 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 42 | extern unsigned long get_cclk(void); |
| 43 | extern unsigned long get_sclk(void); |
Bob Liu | b5affb0 | 2012-05-16 17:37:24 +0800 | [diff] [blame] | 44 | #ifdef CONFIG_BF60x |
| 45 | extern unsigned long get_sclk0(void); |
| 46 | extern unsigned long get_sclk1(void); |
Bob Liu | 7c141c1 | 2012-05-17 17:15:40 +0800 | [diff] [blame] | 47 | extern unsigned long get_dclk(void); |
Bob Liu | b5affb0 | 2012-05-16 17:37:24 +0800 | [diff] [blame] | 48 | #endif |
Mike Frysinger | 2f6cf7bf | 2007-10-21 22:59:49 +0800 | [diff] [blame] | 49 | extern unsigned long sclk_to_usecs(unsigned long sclk); |
| 50 | extern unsigned long usecs_to_sclk(unsigned long usecs); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 51 | |
Mike Frysinger | bbc51e9 | 2009-10-09 07:34:00 +0000 | [diff] [blame] | 52 | struct pt_regs; |
Robin Getz | d28cff4 | 2010-03-11 19:26:38 +0000 | [diff] [blame] | 53 | #if defined(CONFIG_DEBUG_VERBOSE) |
Mike Frysinger | 49dce91 | 2007-11-21 16:46:49 +0800 | [diff] [blame] | 54 | extern void dump_bfin_process(struct pt_regs *regs); |
Robin Getz | b03b08b | 2007-12-23 22:57:01 +0800 | [diff] [blame] | 55 | extern void dump_bfin_mem(struct pt_regs *regs); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 56 | extern void dump_bfin_trace_buffer(void); |
Robin Getz | d28cff4 | 2010-03-11 19:26:38 +0000 | [diff] [blame] | 57 | #else |
| 58 | #define dump_bfin_process(regs) |
| 59 | #define dump_bfin_mem(regs) |
| 60 | #define dump_bfin_trace_buffer() |
| 61 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 62 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 63 | extern void *l1_data_A_sram_alloc(size_t); |
| 64 | extern void *l1_data_B_sram_alloc(size_t); |
| 65 | extern void *l1_inst_sram_alloc(size_t); |
| 66 | extern void *l1_data_sram_alloc(size_t); |
| 67 | extern void *l1_data_sram_zalloc(size_t); |
Sonic Zhang | 262c382 | 2008-07-19 15:42:41 +0800 | [diff] [blame] | 68 | extern void *l2_sram_alloc(size_t); |
| 69 | extern void *l2_sram_zalloc(size_t); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 70 | extern int l1_data_A_sram_free(const void*); |
| 71 | extern int l1_data_B_sram_free(const void*); |
| 72 | extern int l1_inst_sram_free(const void*); |
| 73 | extern int l1_data_sram_free(const void*); |
Sonic Zhang | 262c382 | 2008-07-19 15:42:41 +0800 | [diff] [blame] | 74 | extern int l2_sram_free(const void *); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 75 | extern int sram_free(const void*); |
| 76 | |
| 77 | #define L1_INST_SRAM 0x00000001 |
| 78 | #define L1_DATA_A_SRAM 0x00000002 |
| 79 | #define L1_DATA_B_SRAM 0x00000004 |
| 80 | #define L1_DATA_SRAM 0x00000006 |
Sonic Zhang | 262c382 | 2008-07-19 15:42:41 +0800 | [diff] [blame] | 81 | #define L2_SRAM 0x00000008 |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 82 | extern void *sram_alloc_with_lsl(size_t, unsigned long); |
| 83 | extern int sram_free_with_lsl(const void*); |
| 84 | |
Robin Getz | 9df1028 | 2008-10-08 18:03:33 +0800 | [diff] [blame] | 85 | extern void *isram_memcpy(void *dest, const void *src, size_t n); |
| 86 | |
Mike Frysinger | 066954a | 2007-10-21 22:36:06 +0800 | [diff] [blame] | 87 | extern const char bfin_board_name[]; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 88 | |
Michael Hennerich | cfefe3c | 2008-02-09 04:12:37 +0800 | [diff] [blame] | 89 | extern unsigned long bfin_sic_iwr[]; |
Michael Hennerich | 4a88d0c | 2008-08-05 17:38:41 +0800 | [diff] [blame] | 90 | extern unsigned vr_wakeup; |
Mike Frysinger | a9c59c2 | 2007-05-21 18:09:32 +0800 | [diff] [blame] | 91 | extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 92 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 93 | #endif |
| 94 | |
| 95 | #endif /* _BLACKFIN_H_ */ |