aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:11:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:11:46 -0400
commit1ea4f4f8405cc1ceec23f2d261bc3775785e6712 (patch)
treea43ced12b9acf357623088d479fa69f3f00d2997 /arch/xtensa
parentdea77ccdc93448d81e495a57bc1c1e97be4fdfe8 (diff)
parent70cefe765433529fc894fd1995a1d5883cb33e05 (diff)
Merge tag 'xtensa-next-20121008' of git://github.com/czankel/xtensa-linux
Pull Xtensa patchset from Chris Zankel: "The Xtensa tree has been broken for some time now, and this patchset brings it back to life. It has been part of the linux-next tree for some time. Most changes are inside the xtensa subdirectory; the other changes mostly add another rule to already existing #ifdefs to exclude Xtensa, where required. The only 'common' change is to add two more sections ('.xt.prop' and '.xt.lit') to the white list in modpost." * tag 'xtensa-next-20121008' of git://github.com/czankel/xtensa-linux: (27 commits) xtensa: Setup CROSS_COMPILE at the top xtensa: drop CONFIG_EMBEDDED_RAMDISK xtensa: fix TIOCGSERIAL and TIOCSSERIAL definitions xtensa: provide dummy gcc intrinsics xtensa: add missing symbol exports parport: disable for xtensa arch xtensa: rename MISC SR definition to avoid name clashes hisax: disable build for big-endian xtensa xtensa: fix CODA build xtensa: fix parallel make xtensa: ISS: drop unused io.c xtensa: ISS: exit simulator in case of halt or poweroff xtensa: ISS: change keyboard polling rate xtensa: ISS: add platform_pcibios_init xtensa: ISS: add dummy serial.h for ISS platform xtensa: change default platform clock frequency to 10MHz xtensa: add ARCH_WANT_OPTIONAL_GPIOLIB to xtensa config xtensa: set NO_IOPORT to 'n' by default xtensa: adopt generic io routines xtensa: fix ioremap ...
Diffstat (limited to 'arch/xtensa')
-rw-r--r--arch/xtensa/Kconfig23
-rw-r--r--arch/xtensa/Makefile34
-rw-r--r--arch/xtensa/boot/Makefile2
-rw-r--r--arch/xtensa/boot/boot-elf/Makefile24
-rw-r--r--arch/xtensa/boot/boot-elf/boot.lds.S7
-rw-r--r--arch/xtensa/boot/boot-redboot/Makefile12
-rw-r--r--arch/xtensa/boot/boot-redboot/boot.ld7
-rw-r--r--arch/xtensa/boot/boot-redboot/bootstrap.S10
-rw-r--r--arch/xtensa/boot/ramdisk/Makefile23
-rw-r--r--arch/xtensa/configs/s6105_defconfig5
-rw-r--r--arch/xtensa/include/asm/io.h172
-rw-r--r--arch/xtensa/include/asm/ioctls.h4
-rw-r--r--arch/xtensa/include/asm/regs.h2
-rw-r--r--arch/xtensa/kernel/Makefile3
-rw-r--r--arch/xtensa/kernel/io.c75
-rw-r--r--arch/xtensa/kernel/irq.c4
-rw-r--r--arch/xtensa/kernel/pci-dma.c4
-rw-r--r--arch/xtensa/kernel/pci.c2
-rw-r--r--arch/xtensa/kernel/platform.c4
-rw-r--r--arch/xtensa/kernel/setup.c12
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S5
-rw-r--r--arch/xtensa/kernel/xtensa_ksyms.c25
-rw-r--r--arch/xtensa/platforms/iss/Makefile4
-rw-r--r--arch/xtensa/platforms/iss/console.c15
-rw-r--r--arch/xtensa/platforms/iss/include/platform/serial.h0
-rw-r--r--arch/xtensa/platforms/iss/include/platform/simcall.h53
-rw-r--r--arch/xtensa/platforms/iss/io.c32
-rw-r--r--arch/xtensa/platforms/iss/network.c49
-rw-r--r--arch/xtensa/platforms/iss/setup.c14
29 files changed, 157 insertions, 469 deletions
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 744f5ee4ba41..cdcb48adee4c 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -11,6 +11,9 @@ config XTENSA
11 select HAVE_GENERIC_HARDIRQS 11 select HAVE_GENERIC_HARDIRQS
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select GENERIC_CPU_DEVICES 13 select GENERIC_CPU_DEVICES
14 select MODULES_USE_ELF_RELA
15 select GENERIC_PCI_IOMAP
16 select ARCH_WANT_OPTIONAL_GPIOLIB
14 help 17 help
15 Xtensa processors are 32-bit RISC machines designed by Tensilica 18 Xtensa processors are 32-bit RISC machines designed by Tensilica
16 primarily for embedded systems. These processors are both 19 primarily for embedded systems. These processors are both
@@ -35,7 +38,7 @@ config ARCH_HAS_ILOG2_U64
35 def_bool n 38 def_bool n
36 39
37config NO_IOPORT 40config NO_IOPORT
38 def_bool y 41 def_bool n
39 42
40config HZ 43config HZ
41 int 44 int
@@ -142,6 +145,7 @@ config XTENSA_PLATFORM_XT2000
142config XTENSA_PLATFORM_S6105 145config XTENSA_PLATFORM_S6105
143 bool "S6105" 146 bool "S6105"
144 select SERIAL_CONSOLE 147 select SERIAL_CONSOLE
148 select NO_IOPORT
145 149
146endchoice 150endchoice
147 151
@@ -205,23 +209,6 @@ source "drivers/Kconfig"
205 209
206source "fs/Kconfig" 210source "fs/Kconfig"
207 211
208menu "Xtensa initrd options"
209 depends on BLK_DEV_INITRD
210
211config EMBEDDED_RAMDISK
212 bool "Embed root filesystem ramdisk into the kernel"
213
214config EMBEDDED_RAMDISK_IMAGE
215 string "Filename of gzipped ramdisk image"
216 depends on EMBEDDED_RAMDISK
217 default "ramdisk.gz"
218 help
219 This is the filename of the ramdisk image to be built into the
220 kernel. Relative pathnames are relative to arch/xtensa/boot/ramdisk/.
221 The ramdisk image is not part of the kernel distribution; you must
222 provide one yourself.
223endmenu
224
225source "arch/xtensa/Kconfig.debug" 212source "arch/xtensa/Kconfig.debug"
226 213
227source "security/Kconfig" 214source "security/Kconfig"
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index f973754ddf90..bb5ba61723f7 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -21,6 +21,18 @@ variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
21VARIANT = $(variant-y) 21VARIANT = $(variant-y)
22export VARIANT 22export VARIANT
23 23
24# Test for cross compiling
25
26ifneq ($(VARIANT),)
27 COMPILE_ARCH = $(shell uname -m)
28
29 ifneq ($(COMPILE_ARCH), xtensa)
30 ifndef CROSS_COMPILE
31 CROSS_COMPILE = xtensa_$(VARIANT)-
32 endif
33 endif
34endif
35
24# Platform configuration 36# Platform configuration
25 37
26platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 38platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
@@ -31,7 +43,7 @@ PLATFORM = $(platform-y)
31export PLATFORM 43export PLATFORM
32 44
33# temporarily until string.h is fixed 45# temporarily until string.h is fixed
34KBUILD_CFLAGS += -ffreestanding 46KBUILD_CFLAGS += -ffreestanding -D__linux__
35 47
36KBUILD_CFLAGS += -pipe -mlongcalls 48KBUILD_CFLAGS += -pipe -mlongcalls
37 49
@@ -48,24 +60,6 @@ endif
48 60
49KBUILD_DEFCONFIG := iss_defconfig 61KBUILD_DEFCONFIG := iss_defconfig
50 62
51# ramdisk/initrd support
52# You need a compressed ramdisk image, named ramdisk.gz in
53# arch/xtensa/boot/ramdisk
54
55core-$(CONFIG_EMBEDDED_RAMDISK) += arch/xtensa/boot/ramdisk/
56
57# Test for cross compiling
58
59ifneq ($(VARIANT),)
60 COMPILE_ARCH = $(shell uname -m)
61
62 ifneq ($(COMPILE_ARCH), xtensa)
63 ifndef CROSS_COMPILE
64 CROSS_COMPILE = xtensa_$(VARIANT)-
65 endif
66 endif
67endif
68
69# Only build variant and/or platform if it includes a Makefile 63# Only build variant and/or platform if it includes a Makefile
70 64
71buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/) 65buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
@@ -87,7 +81,7 @@ all: zImage
87 81
88bzImage : zImage 82bzImage : zImage
89 83
90zImage zImage.initrd: vmlinux 84zImage: vmlinux
91 $(Q)$(MAKE) $(build)=$(boot) $@ 85 $(Q)$(MAKE) $(build)=$(boot) $@
92 86
93define archhelp 87define archhelp
diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile
index 70fd1453e172..4018f8994196 100644
--- a/arch/xtensa/boot/Makefile
+++ b/arch/xtensa/boot/Makefile
@@ -25,7 +25,7 @@ bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
25bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf 25bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf
26 26
27 27
28zImage zImage.initrd Image Image.initrd: $(bootdir-y) 28zImage Image: $(bootdir-y)
29 29
30$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \ 30$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
31 $(addprefix $(obj)/,$(host-progs)) 31 $(addprefix $(obj)/,$(host-progs))
diff --git a/arch/xtensa/boot/boot-elf/Makefile b/arch/xtensa/boot/boot-elf/Makefile
index 08e8814f8c71..f10992b89027 100644
--- a/arch/xtensa/boot/boot-elf/Makefile
+++ b/arch/xtensa/boot/boot-elf/Makefile
@@ -20,34 +20,18 @@ boot-y := bootstrap.o
20 20
21OBJS := $(addprefix $(obj)/,$(boot-y)) 21OBJS := $(addprefix $(obj)/,$(boot-y))
22 22
23Image: vmlinux $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds 23vmlinux.tmp: vmlinux
24 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \ 24 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
25 vmlinux vmlinux.tmp 25 $^ $@
26 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
27 --add-section image=vmlinux.tmp \
28 --set-section-flags image=contents,alloc,load,load,data \
29 $(OBJS) $@.tmp
30 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
31 -T arch/$(ARCH)/boot/boot-elf/boot.lds \
32 -o arch/$(ARCH)/boot/$@.elf $@.tmp
33 rm -f $@.tmp vmlinux.tmp
34 26
35Image.initrd: vmlinux $(OBJS) 27Image: vmlinux.tmp $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
36 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
37 --add-section .initrd=arch/$(ARCH)/boot/ramdisk \
38 --set-section-flags .initrd=contents,alloc,load,load,data \
39 vmlinux vmlinux.tmp
40 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
41 --add-section image=vmlinux.tmp \ 29 --add-section image=vmlinux.tmp \
42 --set-section-flags image=contents,alloc,load,load,data \ 30 --set-section-flags image=contents,alloc,load,load,data \
43 $(OBJS) $@.tmp 31 $(OBJS) $@.tmp
44 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \ 32 $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
45 -T $(srctree)/arch/$(ARCH)/boot/boot-elf/boot.ld \ 33 -T arch/$(ARCH)/boot/boot-elf/boot.lds \
46 -o arch/$(ARCH)/boot/$@.elf $@.tmp 34 -o arch/$(ARCH)/boot/$@.elf $@.tmp
47 rm -f $@.tmp vmlinux.tmp
48
49 35
50zImage: Image 36zImage: Image
51 37
52zImage.initrd: Image.initrd
53
diff --git a/arch/xtensa/boot/boot-elf/boot.lds.S b/arch/xtensa/boot/boot-elf/boot.lds.S
index 4e53b74dc44b..7b646e0a6486 100644
--- a/arch/xtensa/boot/boot-elf/boot.lds.S
+++ b/arch/xtensa/boot/boot-elf/boot.lds.S
@@ -33,13 +33,6 @@ SECTIONS
33 33
34 __reloc_end = . ; 34 __reloc_end = . ;
35 35
36 .initrd ALIGN(0x10) :
37 {
38 boot_initrd_start = . ;
39 *(.initrd)
40 boot_initrd_end = .;
41 }
42
43 . = ALIGN(0x10); 36 . = ALIGN(0x10);
44 __image_load = . ; 37 __image_load = . ;
45 .image 0xd0001000: 38 .image 0xd0001000:
diff --git a/arch/xtensa/boot/boot-redboot/Makefile b/arch/xtensa/boot/boot-redboot/Makefile
index 872029b84435..25a78c6b1530 100644
--- a/arch/xtensa/boot/boot-redboot/Makefile
+++ b/arch/xtensa/boot/boot-redboot/Makefile
@@ -21,15 +21,17 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
21 21
22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
23 23
24zImage: vmlinux $(OBJS) $(LIBS) 24vmlinux.tmp: vmlinux
25 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \ 25 $(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
26 vmlinux vmlinux.tmp 26 $^ $@
27 gzip -vf9 vmlinux.tmp 27
28vmlinux.tmp.gz: vmlinux.tmp
29 $(GZIP) $(GZIP_FLAGS) $^ > $@
30
31zImage: vmlinux.tmp.gz $(OBJS) $(LIBS)
28 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \ 32 $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
29 --add-section image=vmlinux.tmp.gz \ 33 --add-section image=vmlinux.tmp.gz \
30 --set-section-flags image=contents,alloc,load,load,data \ 34 --set-section-flags image=contents,alloc,load,load,data \
31 $(OBJS) $@.tmp 35 $(OBJS) $@.tmp
32 $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC) 36 $(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
33 $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot 37 $(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
34 rm -f $@.tmp $@.elf vmlinux.tmp.gz
35
diff --git a/arch/xtensa/boot/boot-redboot/boot.ld b/arch/xtensa/boot/boot-redboot/boot.ld
index 774db20d11f7..5bbcaf9e830d 100644
--- a/arch/xtensa/boot/boot-redboot/boot.ld
+++ b/arch/xtensa/boot/boot-redboot/boot.ld
@@ -31,13 +31,6 @@ SECTIONS
31 31
32 __reloc_end = . ; 32 __reloc_end = . ;
33 33
34 .initrd ALIGN(0x10) :
35 {
36 boot_initrd_start = . ;
37 *(.initrd)
38 boot_initrd_end = .;
39 }
40
41 . = ALIGN(0x10); 34 . = ALIGN(0x10);
42 __image_load = . ; 35 __image_load = . ;
43 .image 0xd0001000: AT(__image_load) 36 .image 0xd0001000: AT(__image_load)
diff --git a/arch/xtensa/boot/boot-redboot/bootstrap.S b/arch/xtensa/boot/boot-redboot/bootstrap.S
index 5582e8cfac8f..4c316cd28a54 100644
--- a/arch/xtensa/boot/boot-redboot/bootstrap.S
+++ b/arch/xtensa/boot/boot-redboot/bootstrap.S
@@ -226,17 +226,7 @@ _reloc:
226 226
227 isync 227 isync
228 228
229 movi a5, __start
230 movi a3, boot_initrd_start
231 movi a4, boot_initrd_end
232 sub a3, a3, a5
233 sub a4, a4, a5
234 add a3, a0, a3
235 add a4, a0, a4
236
237 # a2 Boot parameter list 229 # a2 Boot parameter list
238 # a3 initrd_start (virtual load address)
239 # a4 initrd_end (virtual load address)
240 230
241 movi a0, _image_start 231 movi a0, _image_start
242 jx a0 232 jx a0
diff --git a/arch/xtensa/boot/ramdisk/Makefile b/arch/xtensa/boot/ramdisk/Makefile
deleted file mode 100644
index b12f76352438..000000000000
--- a/arch/xtensa/boot/ramdisk/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# Makefile for a ramdisk image
3#
4
5BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)
6
7ifeq ($(BIG_ENDIAN),1)
8OBJCOPY_ARGS := -O elf32-xtensa-be
9else
10OBJCOPY_ARGS := -O elf32-xtensa-le
11endif
12
13obj-y = ramdisk.o
14
15RAMDISK_IMAGE = arch/$(ARCH)/boot/ramdisk/$(CONFIG_EMBEDDED_RAMDISK_IMAGE)
16
17arch/$(ARCH)/boot/ramdisk/ramdisk.o:
18 $(Q)echo -e "dummy:" | $(AS) -o $@;
19 $(Q)$(OBJCOPY) $(OBJCOPY_ARGS) \
20 --add-section .initrd=$(RAMDISK_IMAGE) \
21 --set-section-flags .initrd=contents,alloc,load,load,data \
22 arch/$(ARCH)/boot/ramdisk/ramdisk.o $@
23
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index 550e8ed5b5c6..eaf1b8fc6556 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -541,11 +541,6 @@ CONFIG_MSDOS_PARTITION=y
541# CONFIG_DLM is not set 541# CONFIG_DLM is not set
542 542
543# 543#
544# Xtensa initrd options
545#
546# CONFIG_EMBEDDED_RAMDISK is not set
547
548#
549# Kernel hacking 544# Kernel hacking
550# 545#
551CONFIG_PRINTK_TIME=y 546CONFIG_PRINTK_TIME=y
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 4beb43c087d3..e6be5b9091c2 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -25,184 +25,54 @@
25#define XCHAL_KIO_SIZE 0x10000000 25#define XCHAL_KIO_SIZE 0x10000000
26 26
27#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x)) 27#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
28#define IO_SPACE_LIMIT ~0
28 29
30#ifdef CONFIG_MMU
29/* 31/*
30 * swap functions to change byte order from little-endian to big-endian and 32 * Return the virtual address for the specified bus memory.
31 * vice versa.
32 */
33
34static inline unsigned short _swapw (unsigned short v)
35{
36 return (v << 8) | (v >> 8);
37}
38
39static inline unsigned int _swapl (unsigned int v)
40{
41 return (v << 24) | ((v & 0xff00) << 8) | ((v >> 8) & 0xff00) | (v >> 24);
42}
43
44/*
45 * Change virtual addresses to physical addresses and vv.
46 * These are trivial on the 1:1 Linux/Xtensa mapping
47 */
48
49static inline unsigned long virt_to_phys(volatile void * address)
50{
51 return __pa(address);
52}
53
54static inline void * phys_to_virt(unsigned long address)
55{
56 return __va(address);
57}
58
59/*
60 * virt_to_bus and bus_to_virt are deprecated.
61 */
62
63#define virt_to_bus(x) virt_to_phys(x)
64#define bus_to_virt(x) phys_to_virt(x)
65
66/*
67 * Return the virtual (cached) address for the specified bus memory.
68 * Note that we currently don't support any address outside the KIO segment. 33 * Note that we currently don't support any address outside the KIO segment.
69 */ 34 */
70 35static inline void __iomem *ioremap_nocache(unsigned long offset,
71static inline void *ioremap(unsigned long offset, unsigned long size) 36 unsigned long size)
72{ 37{
73#ifdef CONFIG_MMU
74 if (offset >= XCHAL_KIO_PADDR 38 if (offset >= XCHAL_KIO_PADDR
75 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 39 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
76 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); 40 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
77 else 41 else
78 BUG(); 42 BUG();
79#else
80 return (void *)offset;
81#endif
82} 43}
83 44
84static inline void *ioremap_nocache(unsigned long offset, unsigned long size) 45static inline void __iomem *ioremap_cache(unsigned long offset,
46 unsigned long size)
85{ 47{
86#ifdef CONFIG_MMU
87 if (offset >= XCHAL_KIO_PADDR 48 if (offset >= XCHAL_KIO_PADDR
88 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 49 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
89 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); 50 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
90 else 51 else
91 BUG(); 52 BUG();
92#else
93 return (void *)offset;
94#endif
95}
96
97static inline void iounmap(void *addr)
98{
99} 53}
100 54
101/* 55#define ioremap_wc ioremap_nocache
102 * Generic I/O
103 */
104
105#define readb(addr) \
106 ({ unsigned char __v = (*(volatile unsigned char *)(addr)); __v; })
107#define readw(addr) \
108 ({ unsigned short __v = (*(volatile unsigned short *)(addr)); __v; })
109#define readl(addr) \
110 ({ unsigned int __v = (*(volatile unsigned int *)(addr)); __v; })
111#define writeb(b, addr) (void)((*(volatile unsigned char *)(addr)) = (b))
112#define writew(b, addr) (void)((*(volatile unsigned short *)(addr)) = (b))
113#define writel(b, addr) (void)((*(volatile unsigned int *)(addr)) = (b))
114 56
115static inline __u8 __raw_readb(const volatile void __iomem *addr) 57static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
116{
117 return *(__force volatile __u8 *)(addr);
118}
119static inline __u16 __raw_readw(const volatile void __iomem *addr)
120{
121 return *(__force volatile __u16 *)(addr);
122}
123static inline __u32 __raw_readl(const volatile void __iomem *addr)
124{ 58{
125 return *(__force volatile __u32 *)(addr); 59 return ioremap_nocache(offset, size);
126} 60}
127static inline void __raw_writeb(__u8 b, volatile void __iomem *addr) 61
128{ 62static inline void iounmap(volatile void __iomem *addr)
129 *(__force volatile __u8 *)(addr) = b;
130}
131static inline void __raw_writew(__u16 b, volatile void __iomem *addr)
132{
133 *(__force volatile __u16 *)(addr) = b;
134}
135static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
136{ 63{
137 *(__force volatile __u32 *)(addr) = b;
138} 64}
139 65#endif /* CONFIG_MMU */
140/* These are the definitions for the x86 IO instructions
141 * inb/inw/inl/outb/outw/outl, the "string" versions
142 * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
143 * inb_p/inw_p/...
144 * The macros don't do byte-swapping.
145 */
146
147#define inb(port) readb((u8 *)((port)))
148#define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)))
149#define inw(port) readw((u16 *)((port)))
150#define outw(val, port) writew((val),(u16 *)((unsigned long)(port)))
151#define inl(port) readl((u32 *)((port)))
152#define outl(val, port) writel((val),(u32 *)((unsigned long)(port)))
153
154#define inb_p(port) inb((port))
155#define outb_p(val, port) outb((val), (port))
156#define inw_p(port) inw((port))
157#define outw_p(val, port) outw((val), (port))
158#define inl_p(port) inl((port))
159#define outl_p(val, port) outl((val), (port))
160
161extern void insb (unsigned long port, void *dst, unsigned long count);
162extern void insw (unsigned long port, void *dst, unsigned long count);
163extern void insl (unsigned long port, void *dst, unsigned long count);
164extern void outsb (unsigned long port, const void *src, unsigned long count);
165extern void outsw (unsigned long port, const void *src, unsigned long count);
166extern void outsl (unsigned long port, const void *src, unsigned long count);
167
168#define IO_SPACE_LIMIT ~0
169
170#define memset_io(a,b,c) memset((void *)(a),(b),(c))
171#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
172#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
173
174/* At this point the Xtensa doesn't provide byte swap instructions */
175
176#ifdef __XTENSA_EB__
177# define in_8(addr) (*(u8*)(addr))
178# define in_le16(addr) _swapw(*(u16*)(addr))
179# define in_le32(addr) _swapl(*(u32*)(addr))
180# define out_8(b, addr) *(u8*)(addr) = (b)
181# define out_le16(b, addr) *(u16*)(addr) = _swapw(b)
182# define out_le32(b, addr) *(u32*)(addr) = _swapl(b)
183#elif defined(__XTENSA_EL__)
184# define in_8(addr) (*(u8*)(addr))
185# define in_le16(addr) (*(u16*)(addr))
186# define in_le32(addr) (*(u32*)(addr))
187# define out_8(b, addr) *(u8*)(addr) = (b)
188# define out_le16(b, addr) *(u16*)(addr) = (b)
189# define out_le32(b, addr) *(u32*)(addr) = (b)
190#else
191# error processor byte order undefined!
192#endif
193
194
195/*
196 * Convert a physical pointer to a virtual kernel pointer for /dev/mem access
197 */
198#define xlate_dev_mem_ptr(p) __va(p)
199 66
200/* 67/*
201 * Convert a virtual cached pointer to an uncached pointer 68 * Generic I/O
202 */ 69 */
203#define xlate_dev_kmem_ptr(p) p 70#define readb_relaxed readb
204 71#define readw_relaxed readw
72#define readl_relaxed readl
205 73
206#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
207 75
76#include <asm-generic/io.h>
77
208#endif /* _XTENSA_IO_H */ 78#endif /* _XTENSA_IO_H */
diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h
index fd1d1369a407..2aa4cd9f0cec 100644
--- a/arch/xtensa/include/asm/ioctls.h
+++ b/arch/xtensa/include/asm/ioctls.h
@@ -71,8 +71,8 @@
71#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) 71#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)
72#define TIOCLINUX _IOW('T', 28, char) 72#define TIOCLINUX _IOW('T', 28, char)
73#define TIOCCONS _IO('T', 29) 73#define TIOCCONS _IO('T', 29)
74#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) 74#define TIOCGSERIAL 0x803C541E /*_IOR('T', 30, struct serial_struct)*/
75#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) 75#define TIOCSSERIAL 0x403C541F /*_IOW('T', 31, struct serial_struct)*/
76#define TIOCPKT _IOW('T', 32, int) 76#define TIOCPKT _IOW('T', 32, int)
77# define TIOCPKT_DATA 0 77# define TIOCPKT_DATA 0
78# define TIOCPKT_FLUSHREAD 1 78# define TIOCPKT_FLUSHREAD 1
diff --git a/arch/xtensa/include/asm/regs.h b/arch/xtensa/include/asm/regs.h
index d4baed246928..a3075b12aff1 100644
--- a/arch/xtensa/include/asm/regs.h
+++ b/arch/xtensa/include/asm/regs.h
@@ -66,7 +66,7 @@
66#define ICOUNTLEVEL 237 66#define ICOUNTLEVEL 237
67#define EXCVADDR 238 67#define EXCVADDR 238
68#define CCOMPARE 240 68#define CCOMPARE 240
69#define MISC 244 69#define MISC_SR 244
70 70
71/* Special names for read-only and write-only interrupt registers. */ 71/* Special names for read-only and write-only interrupt registers. */
72 72
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index 59fc3fe15572..f36cef5a62ff 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
6 6
7obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \ 7obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \
8 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ 8 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \
9 pci-dma.o io.o 9 pci-dma.o
10 10
11obj-$(CONFIG_KGDB) += xtensa-stub.o 11obj-$(CONFIG_KGDB) += xtensa-stub.o
12obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
@@ -24,6 +24,7 @@ obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
24# Replicate rules in scripts/Makefile.build 24# Replicate rules in scripts/Makefile.build
25 25
26sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \ 26sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \
27 -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \
27 -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g' 28 -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g'
28 29
29quiet_cmd__cpp_lds_S = LDS $@ 30quiet_cmd__cpp_lds_S = LDS $@
diff --git a/arch/xtensa/kernel/io.c b/arch/xtensa/kernel/io.c
deleted file mode 100644
index 5b65269b1d2f..000000000000
--- a/arch/xtensa/kernel/io.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/xtensa/io.c
3 *
4 * IO primitives
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * Copied from sparc.
12 *
13 * Chris Zankel <chris@zankel.net>
14 *
15 */
16
17#include <asm/io.h>
18#include <asm/byteorder.h>
19
20void outsb(unsigned long addr, const void *src, unsigned long count) {
21 while (count) {
22 count -= 1;
23 writeb(*(const char *)src, addr);
24 src += 1;
25 addr += 1;
26 }
27}
28
29void outsw(unsigned long addr, const void *src, unsigned long count) {
30 while (count) {
31 count -= 2;
32 writew(*(const short *)src, addr);
33 src += 2;
34 addr += 2;
35 }
36}
37
38void outsl(unsigned long addr, const void *src, unsigned long count) {
39 while (count) {
40 count -= 4;
41 writel(*(const long *)src, addr);
42 src += 4;
43 addr += 4;
44 }
45}
46
47void insb(unsigned long addr, void *dst, unsigned long count) {
48 while (count) {
49 count -= 1;
50 *(unsigned char *)dst = readb(addr);
51 dst += 1;
52 addr += 1;
53 }
54}
55
56void insw(unsigned long addr, void *dst, unsigned long count) {
57 while (count) {
58 count -= 2;
59 *(unsigned short *)dst = readw(addr);
60 dst += 2;
61 addr += 2;
62 }
63}
64
65void insl(unsigned long addr, void *dst, unsigned long count) {
66 while (count) {
67 count -= 4;
68 /*
69 * XXX I am sure we are in for an unaligned trap here.
70 */
71 *(unsigned long *)dst = readl(addr);
72 dst += 4;
73 addr += 4;
74 }
75}
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 4340ee076bd5..98e77c3ef1c3 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -84,12 +84,12 @@ static void xtensa_irq_unmask(struct irq_data *d)
84static void xtensa_irq_enable(struct irq_data *d) 84static void xtensa_irq_enable(struct irq_data *d)
85{ 85{
86 variant_irq_enable(d->irq); 86 variant_irq_enable(d->irq);
87 xtensa_irq_unmask(d->irq); 87 xtensa_irq_unmask(d);
88} 88}
89 89
90static void xtensa_irq_disable(struct irq_data *d) 90static void xtensa_irq_disable(struct irq_data *d)
91{ 91{
92 xtensa_irq_mask(d->irq); 92 xtensa_irq_mask(d);
93 variant_irq_disable(d->irq); 93 variant_irq_disable(d->irq);
94} 94}
95 95
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 2783fda76ddc..2d9cc6dbfd78 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <linux/module.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
26 27
@@ -62,6 +63,7 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag)
62 63
63 return (void*)uncached; 64 return (void*)uncached;
64} 65}
66EXPORT_SYMBOL(dma_alloc_coherent);
65 67
66void dma_free_coherent(struct device *hwdev, size_t size, 68void dma_free_coherent(struct device *hwdev, size_t size,
67 void *vaddr, dma_addr_t dma_handle) 69 void *vaddr, dma_addr_t dma_handle)
@@ -73,6 +75,7 @@ void dma_free_coherent(struct device *hwdev, size_t size,
73 75
74 free_pages(addr, get_order(size)); 76 free_pages(addr, get_order(size));
75} 77}
78EXPORT_SYMBOL(dma_free_coherent);
76 79
77 80
78void consistent_sync(void *vaddr, size_t size, int direction) 81void consistent_sync(void *vaddr, size_t size, int direction)
@@ -92,3 +95,4 @@ void consistent_sync(void *vaddr, size_t size, int direction)
92 break; 95 break;
93 } 96 }
94} 97}
98EXPORT_SYMBOL(consistent_sync);
diff --git a/arch/xtensa/kernel/pci.c b/arch/xtensa/kernel/pci.c
index 54354de38a70..126c18839409 100644
--- a/arch/xtensa/kernel/pci.c
+++ b/arch/xtensa/kernel/pci.c
@@ -333,7 +333,7 @@ __pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma,
333 int prot = pgprot_val(vma->vm_page_prot); 333 int prot = pgprot_val(vma->vm_page_prot);
334 334
335 /* Set to write-through */ 335 /* Set to write-through */
336 prot &= ~_PAGE_NO_CACHE; 336 prot = (prot & _PAGE_CA_MASK) | _PAGE_CA_WT;
337#if 0 337#if 0
338 if (!write_combine) 338 if (!write_combine)
339 prot |= _PAGE_WRITETHRU; 339 prot |= _PAGE_WRITETHRU;
diff --git a/arch/xtensa/kernel/platform.c b/arch/xtensa/kernel/platform.c
index 1b91a97f1d84..97230e46cbe7 100644
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -40,8 +40,8 @@ _F(int, pcibios_fixup, (void), { return 0; });
40#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT 40#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
41_F(void, calibrate_ccount, (void), 41_F(void, calibrate_ccount, (void),
42{ 42{
43 printk ("ERROR: Cannot calibrate cpu frequency! Assuming 100MHz.\n"); 43 pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n");
44 ccount_per_jiffy = 100 * (1000000UL/HZ); 44 ccount_per_jiffy = 10 * (1000000UL/HZ);
45}); 45});
46#endif 46#endif
47 47
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 17e746f7be60..270360d9806c 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -60,8 +60,6 @@ struct rtc_ops *rtc_ops;
60#ifdef CONFIG_BLK_DEV_INITRD 60#ifdef CONFIG_BLK_DEV_INITRD
61extern void *initrd_start; 61extern void *initrd_start;
62extern void *initrd_end; 62extern void *initrd_end;
63extern void *__initrd_start;
64extern void *__initrd_end;
65int initrd_is_mapped = 0; 63int initrd_is_mapped = 0;
66extern int initrd_below_start_ok; 64extern int initrd_below_start_ok;
67#endif 65#endif
@@ -79,10 +77,6 @@ static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
79 77
80sysmem_info_t __initdata sysmem; 78sysmem_info_t __initdata sysmem;
81 79
82#ifdef CONFIG_BLK_DEV_INITRD
83int initrd_is_mapped;
84#endif
85
86#ifdef CONFIG_MMU 80#ifdef CONFIG_MMU
87extern void init_mmu(void); 81extern void init_mmu(void);
88#else 82#else
@@ -197,12 +191,6 @@ static int __init parse_bootparam(const bp_tag_t* tag)
197 191
198void __init init_arch(bp_tag_t *bp_start) 192void __init init_arch(bp_tag_t *bp_start)
199{ 193{
200
201#ifdef CONFIG_BLK_DEV_INITRD
202 initrd_start = &__initrd_start;
203 initrd_end = &__initrd_end;
204#endif
205
206 sysmem.nr_banks = 0; 194 sysmem.nr_banks = 0;
207 195
208#ifdef CONFIG_CMDLINE_BOOL 196#ifdef CONFIG_CMDLINE_BOOL
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index ee2e2089483d..255154f820b7 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -222,11 +222,6 @@ SECTIONS
222 . = ALIGN(0x10); 222 . = ALIGN(0x10);
223 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) } 223 .bootstrap : { *(.bootstrap.literal .bootstrap.text .bootstrap.data) }
224 224
225 . = ALIGN(0x1000);
226 __initrd_start = .;
227 .initrd : { *(.initrd) }
228 __initrd_end = .;
229
230 .ResetVector.text XCHAL_RESET_VECTOR_VADDR : 225 .ResetVector.text XCHAL_RESET_VECTOR_VADDR :
231 { 226 {
232 *(.ResetVector.text) 227 *(.ResetVector.text)
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c
index c9a7c5b74a0d..a8b9f1fd1e17 100644
--- a/arch/xtensa/kernel/xtensa_ksyms.c
+++ b/arch/xtensa/kernel/xtensa_ksyms.c
@@ -39,8 +39,12 @@
39EXPORT_SYMBOL(memset); 39EXPORT_SYMBOL(memset);
40EXPORT_SYMBOL(memcpy); 40EXPORT_SYMBOL(memcpy);
41EXPORT_SYMBOL(memmove); 41EXPORT_SYMBOL(memmove);
42EXPORT_SYMBOL(__strncpy_user);
43EXPORT_SYMBOL(clear_page);
44EXPORT_SYMBOL(copy_page);
42 45
43EXPORT_SYMBOL(kernel_thread); 46EXPORT_SYMBOL(kernel_thread);
47EXPORT_SYMBOL(empty_zero_page);
44 48
45/* 49/*
46 * gcc internal math functions 50 * gcc internal math functions
@@ -56,6 +60,7 @@ extern unsigned int __udivsi3(unsigned int, unsigned int);
56extern unsigned int __umodsi3(unsigned int, unsigned int); 60extern unsigned int __umodsi3(unsigned int, unsigned int);
57extern unsigned long long __umoddi3(unsigned long long, unsigned long long); 61extern unsigned long long __umoddi3(unsigned long long, unsigned long long);
58extern unsigned long long __udivdi3(unsigned long long, unsigned long long); 62extern unsigned long long __udivdi3(unsigned long long, unsigned long long);
63extern int __ucmpdi2(int, int);
59 64
60EXPORT_SYMBOL(__ashldi3); 65EXPORT_SYMBOL(__ashldi3);
61EXPORT_SYMBOL(__ashrdi3); 66EXPORT_SYMBOL(__ashrdi3);
@@ -68,11 +73,31 @@ EXPORT_SYMBOL(__udivsi3);
68EXPORT_SYMBOL(__umodsi3); 73EXPORT_SYMBOL(__umodsi3);
69EXPORT_SYMBOL(__udivdi3); 74EXPORT_SYMBOL(__udivdi3);
70EXPORT_SYMBOL(__umoddi3); 75EXPORT_SYMBOL(__umoddi3);
76EXPORT_SYMBOL(__ucmpdi2);
77
78void __xtensa_libgcc_window_spill(void)
79{
80 BUG();
81}
82EXPORT_SYMBOL(__xtensa_libgcc_window_spill);
83
84unsigned long __sync_fetch_and_and_4(unsigned long *p, unsigned long v)
85{
86 BUG();
87}
88EXPORT_SYMBOL(__sync_fetch_and_and_4);
89
90unsigned long __sync_fetch_and_or_4(unsigned long *p, unsigned long v)
91{
92 BUG();
93}
94EXPORT_SYMBOL(__sync_fetch_and_or_4);
71 95
72#ifdef CONFIG_NET 96#ifdef CONFIG_NET
73/* 97/*
74 * Networking support 98 * Networking support
75 */ 99 */
100EXPORT_SYMBOL(csum_partial);
76EXPORT_SYMBOL(csum_partial_copy_generic); 101EXPORT_SYMBOL(csum_partial_copy_generic);
77#endif /* CONFIG_NET */ 102#endif /* CONFIG_NET */
78 103
diff --git a/arch/xtensa/platforms/iss/Makefile b/arch/xtensa/platforms/iss/Makefile
index af96e314d71f..b7d1a5c0ff7f 100644
--- a/arch/xtensa/platforms/iss/Makefile
+++ b/arch/xtensa/platforms/iss/Makefile
@@ -4,5 +4,5 @@
4# "prom monitor" library routines under Linux. 4# "prom monitor" library routines under Linux.
5# 5#
6 6
7obj-y = io.o console.o setup.o network.o 7obj-y = console.o setup.o
8 8obj-$(CONFIG_NET) += network.o
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 2cd3d3a3400b..8ab47edd7c82 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -33,7 +33,7 @@
33#endif 33#endif
34 34
35#define SERIAL_MAX_NUM_LINES 1 35#define SERIAL_MAX_NUM_LINES 1
36#define SERIAL_TIMER_VALUE (20 * HZ) 36#define SERIAL_TIMER_VALUE (HZ / 10)
37 37
38static struct tty_driver *serial_driver; 38static struct tty_driver *serial_driver;
39static struct tty_port serial_port; 39static struct tty_port serial_port;
@@ -41,19 +41,6 @@ static struct timer_list serial_timer;
41 41
42static DEFINE_SPINLOCK(timer_lock); 42static DEFINE_SPINLOCK(timer_lock);
43 43
44int errno;
45
46static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
47static int __simc (int a, int b, int c, int d, int e, int f)
48{
49 int ret;
50 __asm__ __volatile__ ("simcall\n"
51 "mov %0, a2\n"
52 "mov %1, a3\n" : "=a" (ret), "=a" (errno)
53 : : "a2", "a3");
54 return ret;
55}
56
57static char *serial_version = "0.1"; 44static char *serial_version = "0.1";
58static char *serial_name = "ISS serial driver"; 45static char *serial_name = "ISS serial driver";
59 46
diff --git a/arch/xtensa/platforms/iss/include/platform/serial.h b/arch/xtensa/platforms/iss/include/platform/serial.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/arch/xtensa/platforms/iss/include/platform/serial.h
diff --git a/arch/xtensa/platforms/iss/include/platform/simcall.h b/arch/xtensa/platforms/iss/include/platform/simcall.h
index b7952c06a2b7..8c43bfea05e1 100644
--- a/arch/xtensa/platforms/iss/include/platform/simcall.h
+++ b/arch/xtensa/platforms/iss/include/platform/simcall.h
@@ -57,6 +57,59 @@
57#define XTISS_SELECT_ONE_WRITE 2 57#define XTISS_SELECT_ONE_WRITE 2
58#define XTISS_SELECT_ONE_EXCEPT 3 58#define XTISS_SELECT_ONE_EXCEPT 3
59 59
60static int errno;
61
62static inline int __simc(int a, int b, int c, int d, int e, int f)
63{
64 int ret;
65 register int a1 asm("a2") = a;
66 register int b1 asm("a3") = b;
67 register int c1 asm("a4") = c;
68 register int d1 asm("a5") = d;
69 register int e1 asm("a6") = e;
70 register int f1 asm("a7") = f;
71 __asm__ __volatile__ (
72 "simcall\n"
73 "mov %0, a2\n"
74 "mov %1, a3\n"
75 : "=a" (ret), "=a" (errno), "+r"(a1), "+r"(b1)
76 : "r"(c1), "r"(d1), "r"(e1), "r"(f1)
77 : );
78 return ret;
79}
80
81static inline int simc_open(char *file, int flags, int mode)
82{
83 return __simc(SYS_open, (int) file, flags, mode, 0, 0);
84}
85
86static inline int simc_close(int fd)
87{
88 return __simc(SYS_close, fd, 0, 0, 0, 0);
89}
90
91static inline int simc_ioctl(int fd, int request, void *arg)
92{
93 return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
94}
95
96static inline int simc_read(int fd, void *buf, size_t count)
97{
98 return __simc(SYS_read, fd, (int) buf, count, 0, 0);
99}
100
101static inline int simc_write(int fd, void *buf, size_t count)
102{
103 return __simc(SYS_write, fd, (int) buf, count, 0, 0);
104}
105
106static inline int simc_poll(int fd)
107{
108 struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
109
110 return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,
111 0, 0);
112}
60 113
61#endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */ 114#endif /* _XTENSA_PLATFORM_ISS_SIMCALL_H */
62 115
diff --git a/arch/xtensa/platforms/iss/io.c b/arch/xtensa/platforms/iss/io.c
deleted file mode 100644
index 571d0b24f895..000000000000
--- a/arch/xtensa/platforms/iss/io.c
+++ /dev/null
@@ -1,32 +0,0 @@
1/* This file isn't really needed right now. */
2
3#if 0
4
5#include <asm/io.h>
6#include <platform/platform-iss/simcall.h>
7
8extern int __simc ();
9
10
11char iss_serial_getc()
12{
13 char c;
14 __simc( SYS_read, 0, &c, 1 );
15 return c;
16}
17
18void iss_serial_putc( char c )
19{
20 __simc( SYS_write, 1, &c, 1 );
21}
22
23void iss_serial_puts( char *s )
24{
25 if( s != 0 && *s != 0 )
26 __simc( SYS_write, 1, s, strlen(s) );
27}
28
29/*#error Need I/O ports to specific hardware!*/
30
31#endif
32
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 7dde24456427..7d0fea6d7f20 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -101,55 +101,6 @@ struct iss_net_private {
101 101
102}; 102};
103 103
104/* ======================= ISS SIMCALL INTERFACE =========================== */
105
106/* Note: __simc must _not_ be declared inline! */
107
108static int errno;
109
110static int __simc (int a, int b, int c, int d, int e, int f) __attribute__((__noinline__));
111static int __simc (int a, int b, int c, int d, int e, int f)
112{
113 int ret;
114 __asm__ __volatile__ ("simcall\n"
115 "mov %0, a2\n"
116 "mov %1, a3\n" : "=a" (ret), "=a" (errno)
117 : : "a2", "a3");
118 return ret;
119}
120
121static int inline simc_open(char *file, int flags, int mode)
122{
123 return __simc(SYS_open, (int) file, flags, mode, 0, 0);
124}
125
126static int inline simc_close(int fd)
127{
128 return __simc(SYS_close, fd, 0, 0, 0, 0);
129}
130
131static int inline simc_ioctl(int fd, int request, void *arg)
132{
133 return __simc(SYS_ioctl, fd, request, (int) arg, 0, 0);
134}
135
136static int inline simc_read(int fd, void *buf, size_t count)
137{
138 return __simc(SYS_read, fd, (int) buf, count, 0, 0);
139}
140
141static int inline simc_write(int fd, void *buf, size_t count)
142{
143 return __simc(SYS_write, fd, (int) buf, count, 0, 0);
144}
145
146static int inline simc_poll(int fd)
147{
148 struct timeval tv = { .tv_sec = 0, .tv_usec = 0 };
149
150 return __simc(SYS_select_one, fd, XTISS_SELECT_ONE_READ, (int)&tv,0,0);
151}
152
153/* ================================ HELPERS ================================ */ 104/* ================================ HELPERS ================================ */
154 105
155 106
diff --git a/arch/xtensa/platforms/iss/setup.c b/arch/xtensa/platforms/iss/setup.c
index f60c8cf6dfbe..927acf378ea3 100644
--- a/arch/xtensa/platforms/iss/setup.c
+++ b/arch/xtensa/platforms/iss/setup.c
@@ -38,16 +38,22 @@ void __init platform_init(bp_tag_t* bootparam)
38 38
39} 39}
40 40
41#ifdef CONFIG_PCI
42void platform_pcibios_init(void)
43{
44}
45#endif
46
41void platform_halt(void) 47void platform_halt(void)
42{ 48{
43 printk (" ** Called platform_halt(), looping forever! **\n"); 49 pr_info(" ** Called platform_halt() **\n");
44 while (1); 50 __asm__ __volatile__("movi a2, 1\nsimcall\n");
45} 51}
46 52
47void platform_power_off(void) 53void platform_power_off(void)
48{ 54{
49 printk (" ** Called platform_power_off(), looping forever! **\n"); 55 pr_info(" ** Called platform_power_off() **\n");
50 while (1); 56 __asm__ __volatile__("movi a2, 1\nsimcall\n");
51} 57}
52void platform_restart(void) 58void platform_restart(void)
53{ 59{