blob: dc47d79287f981278211405c364d7f5afdfdbd81 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Global extern defines for blackfin
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Robin Getz96f10502009-09-24 14:11:24 +00004 * Copyright 2006-2009 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Robin Getz96f10502009-09-24 14:11:24 +00006 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07007 */
8
9#ifndef _BFIN_GLOBAL_H_
10#define _BFIN_GLOBAL_H_
11
12#ifndef __ASSEMBLY__
13
Bryan Wu1394f032007-05-06 14:50:22 -070014#include <linux/linkage.h>
15#include <linux/types.h>
16
Scott Jiangc8d11a02012-05-18 16:27:22 -040017#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 Cai86ad7932008-05-17 16:36:52 +080024# define DMA_UNCACHED_REGION (4 * 1024 * 1024)
25#elif defined(CONFIG_DMA_UNCACHED_2M)
Bryan Wu1394f032007-05-06 14:50:22 -070026# define DMA_UNCACHED_REGION (2 * 1024 * 1024)
27#elif defined(CONFIG_DMA_UNCACHED_1M)
28# define DMA_UNCACHED_REGION (1024 * 1024)
Barry Songc45c0652009-12-02 09:13:36 +000029#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 Wu1394f032007-05-06 14:50:22 -070035#else
36# define DMA_UNCACHED_REGION (0)
37#endif
38
Graf Yang6b3087c2009-01-07 23:14:39 +080039extern void bfin_setup_caches(unsigned int cpu);
40extern void bfin_setup_cpudata(unsigned int cpu);
41
Bryan Wu1394f032007-05-06 14:50:22 -070042extern unsigned long get_cclk(void);
43extern unsigned long get_sclk(void);
Bob Liub5affb02012-05-16 17:37:24 +080044#ifdef CONFIG_BF60x
45extern unsigned long get_sclk0(void);
46extern unsigned long get_sclk1(void);
Bob Liu7c141c12012-05-17 17:15:40 +080047extern unsigned long get_dclk(void);
Bob Liub5affb02012-05-16 17:37:24 +080048#endif
Mike Frysinger2f6cf7bf2007-10-21 22:59:49 +080049extern unsigned long sclk_to_usecs(unsigned long sclk);
50extern unsigned long usecs_to_sclk(unsigned long usecs);
Bryan Wu1394f032007-05-06 14:50:22 -070051
Mike Frysingerbbc51e92009-10-09 07:34:00 +000052struct pt_regs;
Robin Getzd28cff42010-03-11 19:26:38 +000053#if defined(CONFIG_DEBUG_VERBOSE)
Mike Frysinger49dce912007-11-21 16:46:49 +080054extern void dump_bfin_process(struct pt_regs *regs);
Robin Getzb03b08b2007-12-23 22:57:01 +080055extern void dump_bfin_mem(struct pt_regs *regs);
Bryan Wu1394f032007-05-06 14:50:22 -070056extern void dump_bfin_trace_buffer(void);
Robin Getzd28cff42010-03-11 19:26:38 +000057#else
58#define dump_bfin_process(regs)
59#define dump_bfin_mem(regs)
60#define dump_bfin_trace_buffer()
61#endif
Bryan Wu1394f032007-05-06 14:50:22 -070062
Bryan Wu1394f032007-05-06 14:50:22 -070063extern void *l1_data_A_sram_alloc(size_t);
64extern void *l1_data_B_sram_alloc(size_t);
65extern void *l1_inst_sram_alloc(size_t);
66extern void *l1_data_sram_alloc(size_t);
67extern void *l1_data_sram_zalloc(size_t);
Sonic Zhang262c3822008-07-19 15:42:41 +080068extern void *l2_sram_alloc(size_t);
69extern void *l2_sram_zalloc(size_t);
Bryan Wu1394f032007-05-06 14:50:22 -070070extern int l1_data_A_sram_free(const void*);
71extern int l1_data_B_sram_free(const void*);
72extern int l1_inst_sram_free(const void*);
73extern int l1_data_sram_free(const void*);
Sonic Zhang262c3822008-07-19 15:42:41 +080074extern int l2_sram_free(const void *);
Bryan Wu1394f032007-05-06 14:50:22 -070075extern 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 Zhang262c3822008-07-19 15:42:41 +080081#define L2_SRAM 0x00000008
Bryan Wu1394f032007-05-06 14:50:22 -070082extern void *sram_alloc_with_lsl(size_t, unsigned long);
83extern int sram_free_with_lsl(const void*);
84
Robin Getz9df10282008-10-08 18:03:33 +080085extern void *isram_memcpy(void *dest, const void *src, size_t n);
86
Mike Frysinger066954a2007-10-21 22:36:06 +080087extern const char bfin_board_name[];
Bryan Wu1394f032007-05-06 14:50:22 -070088
Michael Hennerichcfefe3c2008-02-09 04:12:37 +080089extern unsigned long bfin_sic_iwr[];
Michael Hennerich4a88d0c2008-08-05 17:38:41 +080090extern unsigned vr_wakeup;
Mike Frysingera9c59c22007-05-21 18:09:32 +080091extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */
Bryan Wu1394f032007-05-06 14:50:22 -070092
Bryan Wu1394f032007-05-06 14:50:22 -070093#endif
94
95#endif /* _BLACKFIN_H_ */