aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/include/asm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/xtensa/include/asm')
-rw-r--r--arch/xtensa/include/asm/cacheflush.h10
-rw-r--r--arch/xtensa/include/asm/dma.h3
-rw-r--r--arch/xtensa/include/asm/flat.h12
-rw-r--r--arch/xtensa/include/asm/gpio.h56
-rw-r--r--arch/xtensa/include/asm/io.h9
-rw-r--r--arch/xtensa/include/asm/irq.h7
-rw-r--r--arch/xtensa/include/asm/mmu.h5
-rw-r--r--arch/xtensa/include/asm/mmu_context.h9
-rw-r--r--arch/xtensa/include/asm/nommu.h3
-rw-r--r--arch/xtensa/include/asm/nommu_context.h25
-rw-r--r--arch/xtensa/include/asm/page.h14
-rw-r--r--arch/xtensa/include/asm/pgtable.h13
-rw-r--r--arch/xtensa/include/asm/platform.h11
-rw-r--r--arch/xtensa/include/asm/processor.h8
14 files changed, 160 insertions, 25 deletions
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index 94c4c53a099e..8fc1c0c8de07 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -65,13 +65,17 @@ extern void __flush_invalidate_dcache_range(unsigned long, unsigned long);
65# define __flush_invalidate_dcache_range(p,s) __invalidate_dcache_range(p,s) 65# define __flush_invalidate_dcache_range(p,s) __invalidate_dcache_range(p,s)
66#endif 66#endif
67 67
68#if (DCACHE_WAY_SIZE > PAGE_SIZE) 68#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
69extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long); 69extern void __flush_invalidate_dcache_page_alias(unsigned long, unsigned long);
70#else
71static inline void __flush_invalidate_dcache_page_alias(unsigned long virt,
72 unsigned long phys) { }
70#endif 73#endif
71#if (ICACHE_WAY_SIZE > PAGE_SIZE) 74#if defined(CONFIG_MMU) && (ICACHE_WAY_SIZE > PAGE_SIZE)
72extern void __invalidate_icache_page_alias(unsigned long, unsigned long); 75extern void __invalidate_icache_page_alias(unsigned long, unsigned long);
73#else 76#else
74# define __invalidate_icache_page_alias(v,p) do { } while(0) 77static inline void __invalidate_icache_page_alias(unsigned long virt,
78 unsigned long phys) { }
75#endif 79#endif
76 80
77/* 81/*
diff --git a/arch/xtensa/include/asm/dma.h b/arch/xtensa/include/asm/dma.h
index e30f3abf48f0..137ca3945b07 100644
--- a/arch/xtensa/include/asm/dma.h
+++ b/arch/xtensa/include/asm/dma.h
@@ -44,8 +44,9 @@
44 * the value desired). 44 * the value desired).
45 */ 45 */
46 46
47#ifndef MAX_DMA_ADDRESS
47#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1) 48#define MAX_DMA_ADDRESS (PAGE_OFFSET + XCHAL_KIO_SIZE - 1)
48 49#endif
49 50
50/* Reserve and release a DMA channel */ 51/* Reserve and release a DMA channel */
51extern int request_dma(unsigned int dmanr, const char * device_id); 52extern int request_dma(unsigned int dmanr, const char * device_id);
diff --git a/arch/xtensa/include/asm/flat.h b/arch/xtensa/include/asm/flat.h
new file mode 100644
index 000000000000..94c44abf15e4
--- /dev/null
+++ b/arch/xtensa/include/asm/flat.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_XTENSA_FLAT_H
2#define __ASM_XTENSA_FLAT_H
3
4#define flat_argvp_envp_on_stack() 0
5#define flat_old_ram_flag(flags) (flags)
6#define flat_reloc_valid(reloc, size) ((reloc) <= (size))
7#define flat_get_addr_from_rp(rp, relval, flags, p) get_unaligned(rp)
8#define flat_put_addr_at_rp(rp, val, relval ) put_unaligned(val, rp)
9#define flat_get_relocate_addr(rel) (rel)
10#define flat_set_persistent(relval, p) 0
11
12#endif /* __ASM_XTENSA_FLAT_H */
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
new file mode 100644
index 000000000000..0763b0763960
--- /dev/null
+++ b/arch/xtensa/include/asm/gpio.h
@@ -0,0 +1,56 @@
1/*
2 * Generic GPIO API implementation for xtensa.
3 *
4 * Stolen from x86, which is derived from the generic GPIO API for powerpc:
5 *
6 * Copyright (c) 2007-2008 MontaVista Software, Inc.
7 *
8 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef _ASM_XTENSA_GPIO_H
17#define _ASM_XTENSA_GPIO_H
18
19#include <asm-generic/gpio.h>
20
21#ifdef CONFIG_GPIOLIB
22
23/*
24 * Just call gpiolib.
25 */
26static inline int gpio_get_value(unsigned int gpio)
27{
28 return __gpio_get_value(gpio);
29}
30
31static inline void gpio_set_value(unsigned int gpio, int value)
32{
33 __gpio_set_value(gpio, value);
34}
35
36static inline int gpio_cansleep(unsigned int gpio)
37{
38 return __gpio_cansleep(gpio);
39}
40
41/*
42 * Not implemented, yet.
43 */
44static inline int gpio_to_irq(unsigned int gpio)
45{
46 return -ENOSYS;
47}
48
49static inline int irq_to_gpio(unsigned int irq)
50{
51 return -EINVAL;
52}
53
54#endif /* CONFIG_GPIOLIB */
55
56#endif /* _ASM_XTENSA_GPIO_H */
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 07b7299dab20..d04cd3a625fa 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -69,21 +69,28 @@ static inline void * phys_to_virt(unsigned long address)
69 69
70static inline void *ioremap(unsigned long offset, unsigned long size) 70static inline void *ioremap(unsigned long offset, unsigned long size)
71{ 71{
72#ifdef CONFIG_MMU
72 if (offset >= XCHAL_KIO_PADDR 73 if (offset >= XCHAL_KIO_PADDR
73 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 74 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
74 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); 75 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
75
76 else 76 else
77 BUG(); 77 BUG();
78#else
79 return (void *)offset;
80#endif
78} 81}
79 82
80static inline void *ioremap_nocache(unsigned long offset, unsigned long size) 83static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
81{ 84{
85#ifdef CONFIG_MMU
82 if (offset >= XCHAL_KIO_PADDR 86 if (offset >= XCHAL_KIO_PADDR
83 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 87 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
84 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); 88 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
85 else 89 else
86 BUG(); 90 BUG();
91#else
92 return (void *)offset;
93#endif
87} 94}
88 95
89static inline void iounmap(void *addr) 96static inline void iounmap(void *addr)
diff --git a/arch/xtensa/include/asm/irq.h b/arch/xtensa/include/asm/irq.h
index 1620d1e0e695..dfac82dc52ad 100644
--- a/arch/xtensa/include/asm/irq.h
+++ b/arch/xtensa/include/asm/irq.h
@@ -14,6 +14,13 @@
14#include <platform/hardware.h> 14#include <platform/hardware.h>
15#include <variant/core.h> 15#include <variant/core.h>
16 16
17#ifdef CONFIG_VARIANT_IRQ_SWITCH
18#include <variant/irq.h>
19#else
20static inline void variant_irq_enable(unsigned int irq) { }
21static inline void variant_irq_disable(unsigned int irq) { }
22#endif
23
17#ifndef PLATFORM_NR_IRQS 24#ifndef PLATFORM_NR_IRQS
18# define PLATFORM_NR_IRQS 0 25# define PLATFORM_NR_IRQS 0
19#endif 26#endif
diff --git a/arch/xtensa/include/asm/mmu.h b/arch/xtensa/include/asm/mmu.h
index 44c5bb04c55c..04890d6e2335 100644
--- a/arch/xtensa/include/asm/mmu.h
+++ b/arch/xtensa/include/asm/mmu.h
@@ -11,7 +11,12 @@
11#ifndef _XTENSA_MMU_H 11#ifndef _XTENSA_MMU_H
12#define _XTENSA_MMU_H 12#define _XTENSA_MMU_H
13 13
14#ifndef CONFIG_MMU
15#include <asm/nommu.h>
16#else
17
14/* Default "unsigned long" context */ 18/* Default "unsigned long" context */
15typedef unsigned long mm_context_t; 19typedef unsigned long mm_context_t;
16 20
21#endif /* CONFIG_MMU */
17#endif /* _XTENSA_MMU_H */ 22#endif /* _XTENSA_MMU_H */
diff --git a/arch/xtensa/include/asm/mmu_context.h b/arch/xtensa/include/asm/mmu_context.h
index c0fd8e5b4513..dbd8731a876a 100644
--- a/arch/xtensa/include/asm/mmu_context.h
+++ b/arch/xtensa/include/asm/mmu_context.h
@@ -13,16 +13,20 @@
13#ifndef _XTENSA_MMU_CONTEXT_H 13#ifndef _XTENSA_MMU_CONTEXT_H
14#define _XTENSA_MMU_CONTEXT_H 14#define _XTENSA_MMU_CONTEXT_H
15 15
16#ifndef CONFIG_MMU
17#include <asm/nommu_context.h>
18#else
19
16#include <linux/stringify.h> 20#include <linux/stringify.h>
17#include <linux/sched.h> 21#include <linux/sched.h>
18 22
23#include <variant/core.h>
24
19#include <asm/pgtable.h> 25#include <asm/pgtable.h>
20#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
21#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
22#include <asm-generic/mm_hooks.h> 28#include <asm-generic/mm_hooks.h>
23 29
24#define XCHAL_MMU_ASID_BITS 8
25
26#if (XCHAL_HAVE_TLBS != 1) 30#if (XCHAL_HAVE_TLBS != 1)
27# error "Linux must have an MMU!" 31# error "Linux must have an MMU!"
28#endif 32#endif
@@ -133,4 +137,5 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
133 137
134} 138}
135 139
140#endif /* CONFIG_MMU */
136#endif /* _XTENSA_MMU_CONTEXT_H */ 141#endif /* _XTENSA_MMU_CONTEXT_H */
diff --git a/arch/xtensa/include/asm/nommu.h b/arch/xtensa/include/asm/nommu.h
new file mode 100644
index 000000000000..dce2c438c5ba
--- /dev/null
+++ b/arch/xtensa/include/asm/nommu.h
@@ -0,0 +1,3 @@
1typedef struct {
2 unsigned long end_brk;
3} mm_context_t;
diff --git a/arch/xtensa/include/asm/nommu_context.h b/arch/xtensa/include/asm/nommu_context.h
new file mode 100644
index 000000000000..599e7a2e729d
--- /dev/null
+++ b/arch/xtensa/include/asm/nommu_context.h
@@ -0,0 +1,25 @@
1static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
2{
3}
4
5static inline int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
6{
7 return 0;
8}
9
10static inline void destroy_context(struct mm_struct *mm)
11{
12}
13
14static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
15{
16}
17
18static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
19 struct task_struct *tsk)
20{
21}
22
23static inline void deactivate_mm(struct task_struct *tsk, struct mm_struct *mm)
24{
25}
diff --git a/arch/xtensa/include/asm/page.h b/arch/xtensa/include/asm/page.h
index 11f7dc2dbec7..17e0c5383b10 100644
--- a/arch/xtensa/include/asm/page.h
+++ b/arch/xtensa/include/asm/page.h
@@ -14,6 +14,7 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/types.h> 15#include <asm/types.h>
16#include <asm/cache.h> 16#include <asm/cache.h>
17#include <platform/hardware.h>
17 18
18/* 19/*
19 * Fixed TLB translations in the processor. 20 * Fixed TLB translations in the processor.
@@ -32,8 +33,14 @@
32#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT) 33#define PAGE_SIZE (__XTENSA_UL_CONST(1) << PAGE_SHIFT)
33#define PAGE_MASK (~(PAGE_SIZE-1)) 34#define PAGE_MASK (~(PAGE_SIZE-1))
34 35
36#ifdef CONFIG_MMU
35#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR 37#define PAGE_OFFSET XCHAL_KSEG_CACHED_VADDR
36#define MAX_MEM_PFN XCHAL_KSEG_SIZE 38#define MAX_MEM_PFN XCHAL_KSEG_SIZE
39#else
40#define PAGE_OFFSET 0
41#define MAX_MEM_PFN (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE)
42#endif
43
37#define PGTABLE_START 0x80000000 44#define PGTABLE_START 0x80000000
38 45
39/* 46/*
@@ -150,9 +157,11 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*);
150 * addresses. 157 * addresses.
151 */ 158 */
152 159
160#define ARCH_PFN_OFFSET (PLATFORM_DEFAULT_MEM_START >> PAGE_SHIFT)
161
153#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET) 162#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
154#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) 163#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
155#define pfn_valid(pfn) ((unsigned long)pfn < max_mapnr) 164#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && ((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
156#ifdef CONFIG_DISCONTIGMEM 165#ifdef CONFIG_DISCONTIGMEM
157# error CONFIG_DISCONTIGMEM not supported 166# error CONFIG_DISCONTIGMEM not supported
158#endif 167#endif
@@ -162,8 +171,9 @@ extern void copy_user_page(void*, void*, unsigned long, struct page*);
162#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 171#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
163#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 172#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
164 173
174#ifdef CONFIG_MMU
165#define WANT_PAGE_VIRTUAL 175#define WANT_PAGE_VIRTUAL
166 176#endif
167 177
168#endif /* __ASSEMBLY__ */ 178#endif /* __ASSEMBLY__ */
169 179
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 8014d96b21f1..a138770c358e 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -183,7 +183,15 @@ extern unsigned long empty_zero_page[1024];
183 183
184#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) 184#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
185 185
186#ifdef CONFIG_MMU
186extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)]; 187extern pgd_t swapper_pg_dir[PAGE_SIZE/sizeof(pgd_t)];
188extern void paging_init(void);
189extern void pgtable_cache_init(void);
190#else
191# define swapper_pg_dir NULL
192static inline void paging_init(void) { }
193static inline void pgtable_cache_init(void) { }
194#endif
187 195
188/* 196/*
189 * The pmd contains the kernel virtual address of the pte page. 197 * The pmd contains the kernel virtual address of the pte page.
@@ -383,8 +391,6 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
383 391
384#else 392#else
385 393
386extern void paging_init(void);
387
388#define kern_addr_valid(addr) (1) 394#define kern_addr_valid(addr) (1)
389 395
390extern void update_mmu_cache(struct vm_area_struct * vma, 396extern void update_mmu_cache(struct vm_area_struct * vma,
@@ -398,9 +404,6 @@ extern void update_mmu_cache(struct vm_area_struct * vma,
398#define io_remap_pfn_range(vma,from,pfn,size,prot) \ 404#define io_remap_pfn_range(vma,from,pfn,size,prot) \
399 remap_pfn_range(vma, from, pfn, size, prot) 405 remap_pfn_range(vma, from, pfn, size, prot)
400 406
401
402extern void pgtable_cache_init(void);
403
404typedef pte_t *pte_addr_t; 407typedef pte_t *pte_addr_t;
405 408
406#endif /* !defined (__ASSEMBLY__) */ 409#endif /* !defined (__ASSEMBLY__) */
diff --git a/arch/xtensa/include/asm/platform.h b/arch/xtensa/include/asm/platform.h
index e3d5a48ad495..7d936e58e9be 100644
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -74,16 +74,5 @@ extern int platform_pcibios_fixup (void);
74 */ 74 */
75extern void platform_calibrate_ccount (void); 75extern void platform_calibrate_ccount (void);
76 76
77/*
78 * platform_get_rtc_time returns RTC seconds (returns 0 for no error)
79 */
80extern int platform_get_rtc_time(time_t*);
81
82/*
83 * platform_set_rtc_time set RTC seconds (returns 0 for no error)
84 */
85extern int platform_set_rtc_time(time_t);
86
87
88#endif /* _XTENSA_PLATFORM_H */ 77#endif /* _XTENSA_PLATFORM_H */
89 78
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index 07387d3b99f4..0ea4937c0b61 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -13,6 +13,7 @@
13 13
14#include <variant/core.h> 14#include <variant/core.h>
15#include <asm/coprocessor.h> 15#include <asm/coprocessor.h>
16#include <platform/hardware.h>
16 17
17#include <linux/compiler.h> 18#include <linux/compiler.h>
18#include <asm/ptrace.h> 19#include <asm/ptrace.h>
@@ -25,6 +26,8 @@
25# error Linux requires the Xtensa Windowed Registers Option. 26# error Linux requires the Xtensa Windowed Registers Option.
26#endif 27#endif
27 28
29#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH
30
28/* 31/*
29 * User space process size: 1 GB. 32 * User space process size: 1 GB.
30 * Windowed call ABI requires caller and callee to be located within the same 33 * Windowed call ABI requires caller and callee to be located within the same
@@ -33,7 +36,12 @@
33 * the 1 GB requirement applies to the stack as well. 36 * the 1 GB requirement applies to the stack as well.
34 */ 37 */
35 38
39#ifdef CONFIG_MMU
36#define TASK_SIZE __XTENSA_UL_CONST(0x40000000) 40#define TASK_SIZE __XTENSA_UL_CONST(0x40000000)
41#else
42#define TASK_SIZE (PLATFORM_DEFAULT_MEM_START + PLATFORM_DEFAULT_MEM_SIZE)
43#endif
44
37#define STACK_TOP TASK_SIZE 45#define STACK_TOP TASK_SIZE
38#define STACK_TOP_MAX STACK_TOP 46#define STACK_TOP_MAX STACK_TOP
39 47