aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/include/asm')
-rw-r--r--arch/blackfin/include/asm/bfin-global.h5
-rw-r--r--arch/blackfin/include/asm/bfrom.h85
-rw-r--r--arch/blackfin/include/asm/cacheflush.h2
-rw-r--r--arch/blackfin/include/asm/cplb.h8
-rw-r--r--arch/blackfin/include/asm/cplbinit.h16
-rw-r--r--arch/blackfin/include/asm/cpumask.h6
-rw-r--r--arch/blackfin/include/asm/dma-mapping.h11
-rw-r--r--arch/blackfin/include/asm/kgdb.h21
-rw-r--r--arch/blackfin/include/asm/mmu_context.h79
-rw-r--r--arch/blackfin/include/asm/processor.h6
-rw-r--r--arch/blackfin/include/asm/ptrace.h2
-rw-r--r--arch/blackfin/include/asm/traps.h5
12 files changed, 188 insertions, 58 deletions
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index 7ba70de66f2b..56dcb0a2d244 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -63,7 +63,6 @@ extern void bfin_dcache_init(void);
63extern void init_exception_vectors(void); 63extern void init_exception_vectors(void);
64extern void program_IAR(void); 64extern void program_IAR(void);
65 65
66extern void bfin_reset(void);
67extern asmlinkage void lower_to_irq14(void); 66extern asmlinkage void lower_to_irq14(void);
68extern asmlinkage void bfin_return_from_exception(void); 67extern asmlinkage void bfin_return_from_exception(void);
69extern asmlinkage void evt14_softirq(void); 68extern asmlinkage void evt14_softirq(void);
@@ -92,6 +91,8 @@ extern int sram_free(const void*);
92extern void *sram_alloc_with_lsl(size_t, unsigned long); 91extern void *sram_alloc_with_lsl(size_t, unsigned long);
93extern int sram_free_with_lsl(const void*); 92extern int sram_free_with_lsl(const void*);
94 93
94extern void *isram_memcpy(void *dest, const void *src, size_t n);
95
95extern const char bfin_board_name[]; 96extern const char bfin_board_name[];
96 97
97extern unsigned long bfin_sic_iwr[]; 98extern unsigned long bfin_sic_iwr[];
@@ -104,7 +105,7 @@ extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
104 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[], 105 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
105 _ebss_l2[], _l2_lma_start[]; 106 _ebss_l2[], _l2_lma_start[];
106 107
107/* only used when CONFIG_MTD_UCLINUX */ 108/* only used when MTD_UCLINUX */
108extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size; 109extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
109 110
110#ifdef CONFIG_BFIN_ICACHE_LOCK 111#ifdef CONFIG_BFIN_ICACHE_LOCK
diff --git a/arch/blackfin/include/asm/bfrom.h b/arch/blackfin/include/asm/bfrom.h
new file mode 100644
index 000000000000..cfe8024c3b2f
--- /dev/null
+++ b/arch/blackfin/include/asm/bfrom.h
@@ -0,0 +1,85 @@
1/* Blackfin on-chip ROM API
2 *
3 * Copyright 2008 Analog Devices Inc.
4 *
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef __BFROM_H__
9#define __BFROM_H__
10
11#include <linux/types.h>
12
13/* Possible syscontrol action flags */
14#define SYSCTRL_READ 0x00000000 /* read registers */
15#define SYSCTRL_WRITE 0x00000001 /* write registers */
16#define SYSCTRL_SYSRESET 0x00000002 /* perform system reset */
17#define SYSCTRL_CORERESET 0x00000004 /* perform core reset */
18#define SYSCTRL_SOFTRESET 0x00000006 /* perform core and system reset */
19#define SYSCTRL_VRCTL 0x00000010 /* read/write VR_CTL register */
20#define SYSCTRL_EXTVOLTAGE 0x00000020 /* VDDINT supplied externally */
21#define SYSCTRL_INTVOLTAGE 0x00000000 /* VDDINT generated by on-chip regulator */
22#define SYSCTRL_OTPVOLTAGE 0x00000040 /* For Factory Purposes Only */
23#define SYSCTRL_PLLCTL 0x00000100 /* read/write PLL_CTL register */
24#define SYSCTRL_PLLDIV 0x00000200 /* read/write PLL_DIV register */
25#define SYSCTRL_LOCKCNT 0x00000400 /* read/write PLL_LOCKCNT register */
26#define SYSCTRL_PLLSTAT 0x00000800 /* read/write PLL_STAT register */
27
28typedef struct ADI_SYSCTRL_VALUES {
29 uint16_t uwVrCtl;
30 uint16_t uwPllCtl;
31 uint16_t uwPllDiv;
32 uint16_t uwPllLockCnt;
33 uint16_t uwPllStat;
34} ADI_SYSCTRL_VALUES;
35
36static uint32_t (* const bfrom_SysControl)(uint32_t action_flags, ADI_SYSCTRL_VALUES *power_settings, void *reserved) = (void *)0xEF000038;
37
38/* We need a dedicated function since we need to screw with the stack pointer
39 * when resetting. The on-chip ROM will save/restore registers on the stack
40 * when doing a system reset, so the stack cannot be outside of the chip.
41 */
42__attribute__((__noreturn__))
43static inline void bfrom_SoftReset(void *new_stack)
44{
45 while (1)
46 __asm__ __volatile__(
47 "sp = %[stack];"
48 "jump (%[bfrom_syscontrol]);"
49 : : [bfrom_syscontrol] "p"(bfrom_SysControl),
50 "q0"(SYSCTRL_SOFTRESET),
51 "q1"(0),
52 "q2"(NULL),
53 [stack] "p"(new_stack)
54 );
55}
56
57/* OTP Functions */
58static uint32_t (* const bfrom_OtpCommand)(uint32_t command, uint32_t value) = (void *)0xEF000018;
59static uint32_t (* const bfrom_OtpRead)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)0xEF00001A;
60static uint32_t (* const bfrom_OtpWrite)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)0xEF00001C;
61
62/* otp command: defines for "command" */
63#define OTP_INIT 0x00000001
64#define OTP_CLOSE 0x00000002
65
66/* otp read/write: defines for "flags" */
67#define OTP_LOWER_HALF 0x00000000 /* select upper/lower 64-bit half (bit 0) */
68#define OTP_UPPER_HALF 0x00000001
69#define OTP_NO_ECC 0x00000010 /* do not use ECC */
70#define OTP_LOCK 0x00000020 /* sets page protection bit for page */
71#define OTP_CHECK_FOR_PREV_WRITE 0x00000080
72
73/* Return values for all functions */
74#define OTP_SUCCESS 0x00000000
75#define OTP_MASTER_ERROR 0x001
76#define OTP_WRITE_ERROR 0x003
77#define OTP_READ_ERROR 0x005
78#define OTP_ACC_VIO_ERROR 0x009
79#define OTP_DATA_MULT_ERROR 0x011
80#define OTP_ECC_MULT_ERROR 0x021
81#define OTP_PREV_WR_ERROR 0x041
82#define OTP_DATA_SB_WARN 0x100
83#define OTP_ECC_SB_WARN 0x200
84
85#endif
diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h
index d81a77545a04..5ef9e35e9c3b 100644
--- a/arch/blackfin/include/asm/cacheflush.h
+++ b/arch/blackfin/include/asm/cacheflush.h
@@ -30,8 +30,6 @@
30#ifndef _BLACKFIN_CACHEFLUSH_H 30#ifndef _BLACKFIN_CACHEFLUSH_H
31#define _BLACKFIN_CACHEFLUSH_H 31#define _BLACKFIN_CACHEFLUSH_H
32 32
33#include <asm/cplb.h>
34
35extern void blackfin_icache_dcache_flush_range(unsigned int, unsigned int); 33extern void blackfin_icache_dcache_flush_range(unsigned int, unsigned int);
36extern void blackfin_icache_flush_range(unsigned int, unsigned int); 34extern void blackfin_icache_flush_range(unsigned int, unsigned int);
37extern void blackfin_dcache_flush_range(unsigned int, unsigned int); 35extern void blackfin_dcache_flush_range(unsigned int, unsigned int);
diff --git a/arch/blackfin/include/asm/cplb.h b/arch/blackfin/include/asm/cplb.h
index 05d6f05fb748..9e8b4035fcec 100644
--- a/arch/blackfin/include/asm/cplb.h
+++ b/arch/blackfin/include/asm/cplb.h
@@ -55,7 +55,13 @@
55#endif 55#endif
56 56
57#define L1_DMEMORY (CPLB_LOCK | CPLB_COMMON) 57#define L1_DMEMORY (CPLB_LOCK | CPLB_COMMON)
58#define L2_MEMORY (CPLB_COMMON) 58#ifdef CONFIG_BFIN_L2_CACHEABLE
59#define L2_IMEMORY (SDRAM_IGENERIC)
60#define L2_DMEMORY (SDRAM_DGENERIC)
61#else
62#define L2_IMEMORY (CPLB_COMMON)
63#define L2_DMEMORY (CPLB_COMMON)
64#endif
59#define SDRAM_DNON_CHBL (CPLB_COMMON) 65#define SDRAM_DNON_CHBL (CPLB_COMMON)
60#define SDRAM_EBIU (CPLB_COMMON) 66#define SDRAM_EBIU (CPLB_COMMON)
61#define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY) 67#define SDRAM_OOPS (CPLB_VALID | ANOMALY_05000158_WORKAROUND | CPLB_LOCK | CPLB_DIRTY)
diff --git a/arch/blackfin/include/asm/cplbinit.h b/arch/blackfin/include/asm/cplbinit.h
index 0eb1c1b685a7..d179b747ff03 100644
--- a/arch/blackfin/include/asm/cplbinit.h
+++ b/arch/blackfin/include/asm/cplbinit.h
@@ -90,6 +90,20 @@ extern u_long dpdt_swapcount_table[];
90extern unsigned long reserved_mem_dcache_on; 90extern unsigned long reserved_mem_dcache_on;
91extern unsigned long reserved_mem_icache_on; 91extern unsigned long reserved_mem_icache_on;
92 92
93extern void generate_cpl_tables(void); 93extern void generate_cplb_tables(void);
94
95static inline int bfin_addr_dcachable(unsigned long addr)
96{
97#ifdef CONFIG_BFIN_DCACHE
98 if (addr < (_ramend - DMA_UNCACHED_REGION))
99 return 1;
100#endif
101
102 if (reserved_mem_dcache_on &&
103 addr >= _ramend && addr < physical_mem_end)
104 return 1;
105
106 return 0;
107}
94 108
95#endif 109#endif
diff --git a/arch/blackfin/include/asm/cpumask.h b/arch/blackfin/include/asm/cpumask.h
deleted file mode 100644
index b20a8e9012cb..000000000000
--- a/arch/blackfin/include/asm/cpumask.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_BLACKFIN_CPUMASK_H
2#define _ASM_BLACKFIN_CPUMASK_H
3
4#include <asm-generic/cpumask.h>
5
6#endif /* _ASM_BLACKFIN_CPUMASK_H */
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h
index 1a13c2fc3667..ede748d67efd 100644
--- a/arch/blackfin/include/asm/dma-mapping.h
+++ b/arch/blackfin/include/asm/dma-mapping.h
@@ -80,4 +80,15 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
80extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 80extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
81 int nhwentries, enum dma_data_direction direction); 81 int nhwentries, enum dma_data_direction direction);
82 82
83static inline void dma_sync_single_for_cpu(struct device *dev,
84 dma_addr_t handle, size_t size,
85 enum dma_data_direction dir)
86{
87}
88
89static inline void dma_sync_single_for_device(struct device *dev,
90 dma_addr_t handle, size_t size,
91 enum dma_data_direction dir)
92{
93}
83#endif /* _BLACKFIN_DMA_MAPPING_H */ 94#endif /* _BLACKFIN_DMA_MAPPING_H */
diff --git a/arch/blackfin/include/asm/kgdb.h b/arch/blackfin/include/asm/kgdb.h
index 0f73847fd6bc..26ebac6646d8 100644
--- a/arch/blackfin/include/asm/kgdb.h
+++ b/arch/blackfin/include/asm/kgdb.h
@@ -124,9 +124,16 @@ enum regnames {
124/* Number of bytes of registers. */ 124/* Number of bytes of registers. */
125#define NUMREGBYTES BFIN_NUM_REGS*4 125#define NUMREGBYTES BFIN_NUM_REGS*4
126 126
127#define BREAKPOINT() asm(" EXCPT 2;"); 127static inline void arch_kgdb_breakpoint(void)
128#define BREAK_INSTR_SIZE 2 128{
129#define HW_BREAKPOINT_NUM 6 129 asm(" EXCPT 2;");
130}
131#define BREAK_INSTR_SIZE 2
132#define CACHE_FLUSH_IS_SAFE 1
133#define HW_INST_WATCHPOINT_NUM 6
134#define HW_WATCHPOINT_NUM 8
135#define TYPE_INST_WATCHPOINT 0
136#define TYPE_DATA_WATCHPOINT 1
130 137
131/* Instruction watchpoint address control register bits mask */ 138/* Instruction watchpoint address control register bits mask */
132#define WPPWR 0x1 139#define WPPWR 0x1
@@ -163,10 +170,11 @@ enum regnames {
163#define WPDAEN1 0x8 170#define WPDAEN1 0x8
164#define WPDCNTEN0 0x10 171#define WPDCNTEN0 0x10
165#define WPDCNTEN1 0x20 172#define WPDCNTEN1 0x20
173
166#define WPDSRC0 0xc0 174#define WPDSRC0 0xc0
167#define WPDACC0 0x300 175#define WPDACC0_OFFSET 8
168#define WPDSRC1 0xc00 176#define WPDSRC1 0xc00
169#define WPDACC1 0x3000 177#define WPDACC1_OFFSET 12
170 178
171/* Watchpoint status register bits mask */ 179/* Watchpoint status register bits mask */
172#define STATIA0 0x1 180#define STATIA0 0x1
@@ -178,7 +186,4 @@ enum regnames {
178#define STATDA0 0x40 186#define STATDA0 0x40
179#define STATDA1 0x80 187#define STATDA1 0x80
180 188
181extern void kgdb_print(const char *fmt, ...);
182extern void init_kgdb_uart(void);
183
184#endif 189#endif
diff --git a/arch/blackfin/include/asm/mmu_context.h b/arch/blackfin/include/asm/mmu_context.h
index 8529552a981f..35593dda2a4d 100644
--- a/arch/blackfin/include/asm/mmu_context.h
+++ b/arch/blackfin/include/asm/mmu_context.h
@@ -45,49 +45,12 @@ extern unsigned long l1_stack_len;
45extern int l1sram_free(const void*); 45extern int l1sram_free(const void*);
46extern void *l1sram_alloc_max(void*); 46extern void *l1sram_alloc_max(void*);
47 47
48static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
49{
50}
51
52/* Called when creating a new context during fork() or execve(). */
53static inline int
54init_new_context(struct task_struct *tsk, struct mm_struct *mm)
55{
56#ifdef CONFIG_MPU
57 unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
58 mm->context.page_rwx_mask = (unsigned long *)p;
59 memset(mm->context.page_rwx_mask, 0,
60 page_mask_nelts * 3 * sizeof(long));
61#endif
62 return 0;
63}
64
65static inline void free_l1stack(void) 48static inline void free_l1stack(void)
66{ 49{
67 nr_l1stack_tasks--; 50 nr_l1stack_tasks--;
68 if (nr_l1stack_tasks == 0) 51 if (nr_l1stack_tasks == 0)
69 l1sram_free(l1_stack_base); 52 l1sram_free(l1_stack_base);
70} 53}
71static inline void destroy_context(struct mm_struct *mm)
72{
73 struct sram_list_struct *tmp;
74
75 if (current_l1_stack_save == mm->context.l1_stack_save)
76 current_l1_stack_save = NULL;
77 if (mm->context.l1_stack_save)
78 free_l1stack();
79
80 while ((tmp = mm->context.sram_list)) {
81 mm->context.sram_list = tmp->next;
82 sram_free(tmp->addr);
83 kfree(tmp);
84 }
85#ifdef CONFIG_MPU
86 if (current_rwx_mask == mm->context.page_rwx_mask)
87 current_rwx_mask = NULL;
88 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
89#endif
90}
91 54
92static inline unsigned long 55static inline unsigned long
93alloc_l1stack(unsigned long length, unsigned long *stack_base) 56alloc_l1stack(unsigned long length, unsigned long *stack_base)
@@ -134,6 +97,7 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
134 } 97 }
135#endif 98#endif
136 99
100#ifdef CONFIG_APP_STACK_L1
137 /* L1 stack switching. */ 101 /* L1 stack switching. */
138 if (!next_mm->context.l1_stack_save) 102 if (!next_mm->context.l1_stack_save)
139 return; 103 return;
@@ -144,6 +108,7 @@ static inline void switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_m
144 } 108 }
145 current_l1_stack_save = next_mm->context.l1_stack_save; 109 current_l1_stack_save = next_mm->context.l1_stack_save;
146 memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len); 110 memcpy(l1_stack_base, current_l1_stack_save, l1_stack_len);
111#endif
147} 112}
148 113
149#ifdef CONFIG_MPU 114#ifdef CONFIG_MPU
@@ -180,4 +145,44 @@ static inline void update_protections(struct mm_struct *mm)
180} 145}
181#endif 146#endif
182 147
148static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
149{
150}
151
152/* Called when creating a new context during fork() or execve(). */
153static inline int
154init_new_context(struct task_struct *tsk, struct mm_struct *mm)
155{
156#ifdef CONFIG_MPU
157 unsigned long p = __get_free_pages(GFP_KERNEL, page_mask_order);
158 mm->context.page_rwx_mask = (unsigned long *)p;
159 memset(mm->context.page_rwx_mask, 0,
160 page_mask_nelts * 3 * sizeof(long));
161#endif
162 return 0;
163}
164
165static inline void destroy_context(struct mm_struct *mm)
166{
167 struct sram_list_struct *tmp;
168
169#ifdef CONFIG_APP_STACK_L1
170 if (current_l1_stack_save == mm->context.l1_stack_save)
171 current_l1_stack_save = 0;
172 if (mm->context.l1_stack_save)
173 free_l1stack();
174#endif
175
176 while ((tmp = mm->context.sram_list)) {
177 mm->context.sram_list = tmp->next;
178 sram_free(tmp->addr);
179 kfree(tmp);
180 }
181#ifdef CONFIG_MPU
182 if (current_rwx_mask == mm->context.page_rwx_mask)
183 current_rwx_mask = NULL;
184 free_pages((unsigned long)mm->context.page_rwx_mask, page_mask_order);
185#endif
186}
187
183#endif 188#endif
diff --git a/arch/blackfin/include/asm/processor.h b/arch/blackfin/include/asm/processor.h
index 6f3995b119d8..e3e9b41fa8db 100644
--- a/arch/blackfin/include/asm/processor.h
+++ b/arch/blackfin/include/asm/processor.h
@@ -134,6 +134,12 @@ static inline uint32_t __pure bfin_revid(void)
134 return revid; 134 return revid;
135} 135}
136 136
137static inline uint16_t __pure bfin_cpuid(void)
138{
139 return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
140
141}
142
137static inline uint32_t __pure bfin_compiled_revid(void) 143static inline uint32_t __pure bfin_compiled_revid(void)
138{ 144{
139#if defined(CONFIG_BF_REV_0_0) 145#if defined(CONFIG_BF_REV_0_0)
diff --git a/arch/blackfin/include/asm/ptrace.h b/arch/blackfin/include/asm/ptrace.h
index a45a80e54adc..e3f086dc7268 100644
--- a/arch/blackfin/include/asm/ptrace.h
+++ b/arch/blackfin/include/asm/ptrace.h
@@ -158,6 +158,8 @@ extern void show_regs(struct pt_regs *);
158#define PT_SEQSTAT 8 158#define PT_SEQSTAT 8
159#define PT_IPEND 4 159#define PT_IPEND 4
160 160
161#define PT_ORIG_R0 208
162#define PT_ORIG_P0 212
161#define PT_SYSCFG 216 163#define PT_SYSCFG 216
162#define PT_TEXT_ADDR 220 164#define PT_TEXT_ADDR 220
163#define PT_TEXT_END_ADDR 224 165#define PT_TEXT_END_ADDR 224
diff --git a/arch/blackfin/include/asm/traps.h b/arch/blackfin/include/asm/traps.h
index f0e5f940d9ca..34f7295fb070 100644
--- a/arch/blackfin/include/asm/traps.h
+++ b/arch/blackfin/include/asm/traps.h
@@ -59,6 +59,9 @@
59 level " or a 16-bit register is accessed with a 32-bit instruction.\n" 59 level " or a 16-bit register is accessed with a 32-bit instruction.\n"
60#define HWC_x3(level) \ 60#define HWC_x3(level) \
61 "External Memory Addressing Error\n" 61 "External Memory Addressing Error\n"
62#define EXC_0x04(level) \
63 "Unimplmented exception occured\n" \
64 level " - Maybe you forgot to install a custom exception handler?\n"
62#define HWC_x12(level) \ 65#define HWC_x12(level) \
63 "Performance Monitor Overflow\n" 66 "Performance Monitor Overflow\n"
64#define HWC_x18(level) \ 67#define HWC_x18(level) \
@@ -84,7 +87,7 @@
84 level " a particular processor implementation.\n" 87 level " a particular processor implementation.\n"
85#define EXC_0x22(level) \ 88#define EXC_0x22(level) \
86 "Illegal instruction combination\n" \ 89 "Illegal instruction combination\n" \
87 level " - See section for multi-issue rules in the ADSP-BF53x Blackfin\n" \ 90 level " - See section for multi-issue rules in the Blackfin\n" \
88 level " Processor Instruction Set Reference.\n" 91 level " Processor Instruction Set Reference.\n"
89#define EXC_0x23(level) \ 92#define EXC_0x23(level) \
90 "Data access CPLB protection violation\n" \ 93 "Data access CPLB protection violation\n" \