summaryrefslogtreecommitdiff
path: root/packages/linux/linux-2.6.18/avr32-arch.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-2.6.18/avr32-arch.patch')
-rw-r--r--packages/linux/linux-2.6.18/avr32-arch.patch19628
1 files changed, 19628 insertions, 0 deletions
diff --git a/packages/linux/linux-2.6.18/avr32-arch.patch b/packages/linux/linux-2.6.18/avr32-arch.patch
new file mode 100644
index 0000000000..76e2b9f492
--- /dev/null
+++ b/packages/linux/linux-2.6.18/avr32-arch.patch
@@ -0,0 +1,19628 @@
+From: Haavard Skinnemoen <hskinnemoen@atmel.com>
+
+This adds support for the Atmel AVR32 architecture as well as the AT32AP7000
+CPU and the AT32STK1000 development board.
+
+AVR32 is a new high-performance 32-bit RISC microprocessor core, designed for
+cost-sensitive embedded applications, with particular emphasis on low power
+consumption and high code density. The AVR32 architecture is not binary
+compatible with earlier 8-bit AVR architectures.
+
+The AVR32 architecture, including the instruction set, is described by the
+AVR32 Architecture Manual, available from
+
+http://www.atmel.com/dyn/resources/prod_documents/doc32000.pdf
+
+The Atmel AT32AP7000 is the first CPU implementing the AVR32 architecture. It
+features a 7-stage pipeline, 16KB instruction and data caches and a full
+Memory Management Unit. It also comes with a large set of integrated
+peripherals, many of which are shared with the AT91 ARM-based controllers from
+Atmel.
+
+Full data sheet is available from
+
+http://www.atmel.com/dyn/resources/prod_documents/doc32003.pdf
+
+while the CPU core implementation including caches and MMU is documented by
+the AVR32 AP Technical Reference, available from
+
+http://www.atmel.com/dyn/resources/prod_documents/doc32001.pdf
+
+Information about the AT32STK1000 development board can be found at
+
+http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3918
+
+including a BSP CD image with an earlier version of this patch, development
+tools (binaries and source/patches) and a root filesystem image suitable for
+booting from SD card.
+
+Alternatively, there's a preliminary "getting started" guide available at
+http://avr32linux.org/twiki/bin/view/Main/GettingStarted which provides links
+to the sources and patches you will need in order to set up a cross-compiling
+environment for avr32-linux.
+
+This patch, as well as the other patches included with the BSP and the
+toolchain patches, is actively supported by Atmel Corporation.
+
+Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
+Signed-off-by: Andrew Morton <akpm@osdl.org>
+---
+
+ MAINTAINERS | 17
+ arch/avr32/Kconfig | 199 +++++
+ arch/avr32/Kconfig.debug | 19
+ arch/avr32/Makefile | 89 ++
+ arch/avr32/boards/atstk1000/Makefile | 2
+ arch/avr32/boards/atstk1000/atstk1002.c | 37
+ arch/avr32/boards/atstk1000/flash.c | 95 ++
+ arch/avr32/boards/atstk1000/setup.c | 50 +
+ arch/avr32/boards/atstk1000/spi.c | 27
+ arch/avr32/boot/images/Makefile | 60 +
+ arch/avr32/boot/u-boot/Makefile | 3
+ arch/avr32/boot/u-boot/empty.S | 1
+ arch/avr32/boot/u-boot/head.S | 60 +
+ arch/avr32/configs/atstk1002_defconfig | 754 +++++++++++++++++++
+ arch/avr32/kernel/Makefile | 18
+ arch/avr32/kernel/asm-offsets.c | 25
+ arch/avr32/kernel/avr32_ksyms.c | 64 +
+ arch/avr32/kernel/cpu.c | 327 ++++++++
+ arch/avr32/kernel/entry-avr32b.S | 678 +++++++++++++++++
+ arch/avr32/kernel/head.S | 42 +
+ arch/avr32/kernel/init_task.c | 38
+ arch/avr32/kernel/irq.c | 71 +
+ arch/avr32/kernel/kprobes.c | 270 +++++++
+ arch/avr32/kernel/module.c | 324 ++++++++
+ arch/avr32/kernel/process.c | 283 +++++++
+ arch/avr32/kernel/ptrace.c | 371 +++++++++
+ arch/avr32/kernel/semaphore.c | 148 +++
+ arch/avr32/kernel/setup.c | 335 ++++++++
+ arch/avr32/kernel/signal.c | 328 ++++++++
+ arch/avr32/kernel/switch_to.S | 35
+ arch/avr32/kernel/sys_avr32.c | 51 +
+ arch/avr32/kernel/syscall-stubs.S | 102 ++
+ arch/avr32/kernel/syscall_table.S | 289 +++++++
+ arch/avr32/kernel/time.c | 238 ++++++
+ arch/avr32/kernel/traps.c | 425 +++++++++++
+ arch/avr32/kernel/vmlinux.lds.c | 139 +++
+ arch/avr32/lib/Makefile | 11
+ arch/avr32/lib/__avr32_asr64.S | 31
+ arch/avr32/lib/__avr32_lsl64.S | 31
+ arch/avr32/lib/__avr32_lsr64.S | 31
+ arch/avr32/lib/clear_user.S | 76 +
+ arch/avr32/lib/copy_user.S | 119 +++
+ arch/avr32/lib/csum_partial.S | 47 +
+ arch/avr32/lib/csum_partial_copy_generic.S | 99 ++
+ arch/avr32/lib/delay.c | 55 +
+ arch/avr32/lib/findbit.S | 155 ++++
+ arch/avr32/lib/io-readsb.S | 49 +
+ arch/avr32/lib/io-readsl.S | 24
+ arch/avr32/lib/io-readsw.S | 43 +
+ arch/avr32/lib/io-writesb.S | 52 +
+ arch/avr32/lib/io-writesl.S | 20
+ arch/avr32/lib/io-writesw.S | 38
+ arch/avr32/lib/libgcc.h | 33
+ arch/avr32/lib/longlong.h | 98 ++
+ arch/avr32/lib/memcpy.S | 62 +
+ arch/avr32/lib/memset.S | 72 +
+ arch/avr32/lib/strncpy_from_user.S | 60 +
+ arch/avr32/lib/strnlen_user.S | 67 +
+ arch/avr32/mach-at32ap/Makefile | 2
+ arch/avr32/mach-at32ap/at32ap.c | 90 ++
+ arch/avr32/mach-at32ap/at32ap7000.c | 876 +++++++++++++++++++++++
+ arch/avr32/mach-at32ap/clock.c | 148 +++
+ arch/avr32/mach-at32ap/clock.h | 30
+ arch/avr32/mach-at32ap/extint.c | 189 ++++
+ arch/avr32/mach-at32ap/hsmc.c | 164 ++++
+ arch/avr32/mach-at32ap/hsmc.h | 127 +++
+ arch/avr32/mach-at32ap/intc.c | 133 +++
+ arch/avr32/mach-at32ap/intc.h | 329 ++++++++
+ arch/avr32/mach-at32ap/pio.c | 118 +++
+ arch/avr32/mach-at32ap/pio.h | 180 ++++
+ arch/avr32/mach-at32ap/sm.h | 242 ++++++
+ arch/avr32/mm/Makefile | 6
+ arch/avr32/mm/cache.c | 150 +++
+ arch/avr32/mm/clear_page.S | 25
+ arch/avr32/mm/copy_page.S | 28
+ arch/avr32/mm/dma-coherent.c | 139 +++
+ arch/avr32/mm/fault.c | 315 ++++++++
+ arch/avr32/mm/init.c | 481 ++++++++++++
+ arch/avr32/mm/ioremap.c | 199 +++++
+ arch/avr32/mm/tlb.c | 378 +++++++++
+ include/asm-avr32/Kbuild | 3
+ include/asm-avr32/a.out.h | 26
+ include/asm-avr32/addrspace.h | 43 +
+ include/asm-avr32/arch-at32ap/at91rm9200_pdc.h | 36
+ include/asm-avr32/arch-at32ap/at91rm9200_usart.h | 123 +++
+ include/asm-avr32/arch-at32ap/board.h | 35
+ include/asm-avr32/arch-at32ap/init.h | 21
+ include/asm-avr32/arch-at32ap/portmux.h | 16
+ include/asm-avr32/arch-at32ap/sm.h | 27
+ include/asm-avr32/arch-at32ap/smc.h | 60 +
+ include/asm-avr32/asm.h | 102 ++
+ include/asm-avr32/atomic.h | 201 +++++
+ include/asm-avr32/auxvec.h | 4
+ include/asm-avr32/bitops.h | 296 +++++++
+ include/asm-avr32/bug.h | 47 +
+ include/asm-avr32/bugs.h | 15
+ include/asm-avr32/byteorder.h | 25
+ include/asm-avr32/cache.h | 29
+ include/asm-avr32/cachectl.h | 11
+ include/asm-avr32/cacheflush.h | 129 +++
+ include/asm-avr32/checksum.h | 156 ++++
+ include/asm-avr32/cputime.h | 6
+ include/asm-avr32/current.h | 15
+ include/asm-avr32/delay.h | 26
+ include/asm-avr32/div64.h | 6
+ include/asm-avr32/dma-mapping.h | 320 ++++++++
+ include/asm-avr32/dma.h | 8
+ include/asm-avr32/elf.h | 110 ++
+ include/asm-avr32/emergency-restart.h | 6
+ include/asm-avr32/errno.h | 6
+ include/asm-avr32/fcntl.h | 6
+ include/asm-avr32/futex.h | 6
+ include/asm-avr32/hardirq.h | 34
+ include/asm-avr32/hw_irq.h | 9
+ include/asm-avr32/intc.h | 128 +++
+ include/asm-avr32/io.h | 286 +++++++
+ include/asm-avr32/ioctl.h | 6
+ include/asm-avr32/ioctls.h | 83 ++
+ include/asm-avr32/ipcbuf.h | 29
+ include/asm-avr32/irq.h | 10
+ include/asm-avr32/irqflags.h | 68 +
+ include/asm-avr32/kdebug.h | 38
+ include/asm-avr32/kmap_types.h | 30
+ include/asm-avr32/kprobes.h | 34
+ include/asm-avr32/linkage.h | 7
+ include/asm-avr32/local.h | 6
+ include/asm-avr32/mach/serial_at91.h | 33
+ include/asm-avr32/mman.h | 17
+ include/asm-avr32/mmu.h | 10
+ include/asm-avr32/mmu_context.h | 148 +++
+ include/asm-avr32/module.h | 28
+ include/asm-avr32/msgbuf.h | 31
+ include/asm-avr32/mutex.h | 9
+ include/asm-avr32/namei.h | 7
+ include/asm-avr32/numnodes.h | 7
+ include/asm-avr32/ocd.h | 78 ++
+ include/asm-avr32/page.h | 112 ++
+ include/asm-avr32/param.h | 23
+ include/asm-avr32/pci.h | 8
+ include/asm-avr32/percpu.h | 6
+ include/asm-avr32/pgalloc.h | 96 ++
+ include/asm-avr32/pgtable-2level.h | 47 +
+ include/asm-avr32/pgtable.h | 408 ++++++++++
+ include/asm-avr32/poll.h | 27
+ include/asm-avr32/posix_types.h | 129 +++
+ include/asm-avr32/processor.h | 147 +++
+ include/asm-avr32/ptrace.h | 154 ++++
+ include/asm-avr32/resource.h | 6
+ include/asm-avr32/scatterlist.h | 21
+ include/asm-avr32/sections.h | 6
+ include/asm-avr32/semaphore.h | 109 ++
+ include/asm-avr32/sembuf.h | 25
+ include/asm-avr32/setup.h | 141 +++
+ include/asm-avr32/shmbuf.h | 42 +
+ include/asm-avr32/shmparam.h | 6
+ include/asm-avr32/sigcontext.h | 34
+ include/asm-avr32/siginfo.h | 6
+ include/asm-avr32/signal.h | 168 ++++
+ include/asm-avr32/socket.h | 53 +
+ include/asm-avr32/sockios.h | 12
+ include/asm-avr32/stat.h | 79 ++
+ include/asm-avr32/statfs.h | 6
+ include/asm-avr32/string.h | 17
+ include/asm-avr32/sysreg.h | 332 ++++++++
+ include/asm-avr32/system.h | 155 ++++
+ include/asm-avr32/termbits.h | 173 ++++
+ include/asm-avr32/termios.h | 80 ++
+ include/asm-avr32/thread_info.h | 106 ++
+ include/asm-avr32/timex.h | 40 +
+ include/asm-avr32/tlb.h | 32
+ include/asm-avr32/tlbflush.h | 40 +
+ include/asm-avr32/topology.h | 6
+ include/asm-avr32/traps.h | 23
+ include/asm-avr32/types.h | 70 +
+ include/asm-avr32/uaccess.h | 335 ++++++++
+ include/asm-avr32/ucontext.h | 12
+ include/asm-avr32/unaligned.h | 25
+ include/asm-avr32/unistd.h | 387 ++++++++++
+ include/asm-avr32/user.h | 64 +
+ include/linux/elf-em.h | 1
+ lib/Kconfig.debug | 4
+ 181 files changed, 18463 insertions(+), 2 deletions(-)
+
+Index: linux-2.6.18-avr32/MAINTAINERS
+===================================================================
+--- linux-2.6.18-avr32.orig/MAINTAINERS 2006-12-04 09:32:57.000000000 +0100
++++ linux-2.6.18-avr32/MAINTAINERS 2006-12-04 09:33:12.000000000 +0100
+@@ -435,6 +435,23 @@ W: http://people.redhat.com/sgrubb/audit
+ T: git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
+ S: Maintained
+
++AVR32 ARCHITECTURE
++P: Atmel AVR32 Support Team
++M: avr32@atmel.com
++P: Haavard Skinnemoen
++M: hskinnemoen@atmel.com
++W: http://www.atmel.com/products/AVR32/
++W: http://avr32linux.org/
++W: http://avrfreaks.net/
++S: Supported
++
++AVR32/AT32AP MACHINE SUPPORT
++P: Atmel AVR32 Support Team
++M: avr32@atmel.com
++P: Haavard Skinnemoen
++M: hskinnemoen@atmel.com
++S: Supported
++
+ AX.25 NETWORK LAYER
+ P: Ralf Baechle
+ M: ralf@linux-mips.org
+Index: linux-2.6.18-avr32/arch/avr32/Kconfig
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/Kconfig 2006-12-04 11:50:25.000000000 +0100
+@@ -0,0 +1,199 @@
++#
++# For a description of the syntax of this configuration file,
++# see Documentation/kbuild/kconfig-language.txt.
++#
++
++mainmenu "Linux Kernel Configuration"
++
++config AVR32
++ bool
++ default y
++ # With EMBEDDED=n, we get lots of stuff automatically selected
++ # that we usually don't need on AVR32.
++ select EMBEDDED
++ help
++ AVR32 is a high-performance 32-bit RISC microprocessor core,
++ designed for cost-sensitive embedded applications, with particular
++ emphasis on low power consumption and high code density.
++
++ There is an AVR32 Linux project with a web page at
++ http://avr32linux.org/.
++
++config UID16
++ bool
++
++config GENERIC_HARDIRQS
++ bool
++ default y
++
++config HARDIRQS_SW_RESEND
++ bool
++ default y
++
++config GENERIC_IRQ_PROBE
++ bool
++ default y
++
++config RWSEM_GENERIC_SPINLOCK
++ bool
++ default y
++
++config GENERIC_TIME
++ bool
++ default y
++
++config RWSEM_XCHGADD_ALGORITHM
++ bool
++
++config GENERIC_BUST_SPINLOCK
++ bool
++
++config GENERIC_ISA_DMA
++ bool
++
++config GENERIC_HWEIGHT
++ bool
++ default y
++
++config GENERIC_CALIBRATE_DELAY
++ bool
++ default y
++
++source "init/Kconfig"
++
++menu "System Type and features"
++
++config SUBARCH_AVR32B
++ bool
++config MMU
++ bool
++config PERFORMANCE_COUNTERS
++ bool
++
++config PLATFORM_AT32AP
++ bool
++ select SUBARCH_AVR32B
++ select MMU
++ select PERFORMANCE_COUNTERS
++
++choice
++ prompt "AVR32 CPU type"
++ default CPU_AT32AP7000
++
++config CPU_AT32AP7000
++ bool "AT32AP7000"
++ select PLATFORM_AT32AP
++endchoice
++
++#
++# CPU Daughterboards for ATSTK1000
++config BOARD_ATSTK1002
++ bool
++
++choice
++ prompt "AVR32 board type"
++ default BOARD_ATSTK1000
++
++config BOARD_ATSTK1000
++ bool "ATSTK1000 evaluation board"
++ select BOARD_ATSTK1002 if CPU_AT32AP7000
++endchoice
++
++choice
++ prompt "Boot loader type"
++ default LOADER_U_BOOT
++
++config LOADER_U_BOOT
++ bool "U-Boot (or similar) bootloader"
++endchoice
++
++config LOAD_ADDRESS
++ hex
++ default 0x10000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y
++
++config ENTRY_ADDRESS
++ hex
++ default 0x90000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y
++
++config PHYS_OFFSET
++ hex
++ default 0x10000000 if CPU_AT32AP7000=y
++
++source "kernel/Kconfig.preempt"
++
++config HAVE_ARCH_BOOTMEM_NODE
++ bool
++ default n
++
++config ARCH_HAVE_MEMORY_PRESENT
++ bool
++ default n
++
++config NEED_NODE_MEMMAP_SIZE
++ bool
++ default n
++
++config ARCH_FLATMEM_ENABLE
++ bool
++ default y
++
++config ARCH_DISCONTIGMEM_ENABLE
++ bool
++ default n
++
++config ARCH_SPARSEMEM_ENABLE
++ bool
++ default n
++
++source "mm/Kconfig"
++
++config OWNERSHIP_TRACE
++ bool "Ownership trace support"
++ default y
++ help
++ Say Y to generate an Ownership Trace message on every context switch,
++ enabling Nexus-compliant debuggers to keep track of the PID of the
++ currently executing task.
++
++# FPU emulation goes here
++
++source "kernel/Kconfig.hz"
++
++config CMDLINE
++ string "Default kernel command line"
++ default ""
++ help
++ If you don't have a boot loader capable of passing a command line string
++ to the kernel, you may specify one here. As a minimum, you should specify
++ the memory size and the root device (e.g., mem=8M, root=/dev/nfs).
++
++endmenu
++
++menu "Bus options"
++
++config PCI
++ bool
++
++source "drivers/pci/Kconfig"
++
++source "drivers/pcmcia/Kconfig"
++
++endmenu
++
++menu "Executable file formats"
++source "fs/Kconfig.binfmt"
++endmenu
++
++source "net/Kconfig"
++
++source "drivers/Kconfig"
++
++source "fs/Kconfig"
++
++source "arch/avr32/Kconfig.debug"
++
++source "security/Kconfig"
++
++source "crypto/Kconfig"
++
++source "lib/Kconfig"
+Index: linux-2.6.18-avr32/arch/avr32/Kconfig.debug
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/Kconfig.debug 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,19 @@
++menu "Kernel hacking"
++
++config TRACE_IRQFLAGS_SUPPORT
++ bool
++ default y
++
++source "lib/Kconfig.debug"
++
++config KPROBES
++ bool "Kprobes"
++ depends on DEBUG_KERNEL
++ help
++ Kprobes allows you to trap at almost any kernel address and
++ execute a callback function. register_kprobe() establishes
++ a probepoint and specifies the callback. Kprobes is useful
++ for kernel debugging, non-intrusive instrumentation and testing.
++ If in doubt, say "N".
++
++endmenu
+Index: linux-2.6.18-avr32/arch/avr32/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/Makefile 2006-12-04 11:50:25.000000000 +0100
+@@ -0,0 +1,89 @@
++#
++# This file is subject to the terms and conditions of the GNU General Public
++# License. See the file "COPYING" in the main directory of this archive
++# for more details.
++#
++# Copyright (C) 2004-2006 Atmel Corporation.
++
++# Default target when executing plain make
++.PHONY: all
++all: uImage vmlinux.elf
++
++KBUILD_DEFCONFIG := atstk1002_defconfig
++
++CFLAGS += -pipe -fno-builtin -mno-pic
++AFLAGS += -mrelax -mno-pic
++CFLAGS_MODULE += -mno-relax
++LDFLAGS_vmlinux += --relax
++
++cpuflags-$(CONFIG_CPU_AP7000) += -mcpu=ap7000
++
++CFLAGS += $(cpuflags-y)
++AFLAGS += $(cpuflags-y)
++
++CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN
++
++head-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/head.o
++head-y += arch/avr32/kernel/head.o
++core-$(CONFIG_PLATFORM_AT32AP) += arch/avr32/mach-at32ap/
++core-$(CONFIG_BOARD_ATSTK1000) += arch/avr32/boards/atstk1000/
++core-$(CONFIG_LOADER_U_BOOT) += arch/avr32/boot/u-boot/
++core-y += arch/avr32/kernel/
++core-y += arch/avr32/mm/
++libs-y += arch/avr32/lib/
++
++archincdir-$(CONFIG_PLATFORM_AT32AP) := arch-at32ap
++
++include/asm-avr32/.arch: $(wildcard include/config/platform/*.h) include/config/auto.conf
++ @echo ' SYMLINK include/asm-avr32/arch -> include/asm-avr32/$(archincdir-y)'
++ifneq ($(KBUILD_SRC),)
++ $(Q)mkdir -p include/asm-avr32
++ $(Q)ln -fsn $(srctree)/include/asm-avr32/$(archincdir-y) include/asm-avr32/arch
++else
++ $(Q)ln -fsn $(archincdir-y) include/asm-avr32/arch
++endif
++ @touch $@
++
++archprepare: include/asm-avr32/.arch
++
++CLEAN_FILES += include/asm-avr32/.arch include/asm-avr32/arch
++
++BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec
++
++.PHONY: $(BOOT_TARGETS) install
++
++boot := arch/$(ARCH)/boot/images
++
++ KBUILD_IMAGE := $(boot)/uImage
++vmlinux.elf: KBUILD_IMAGE := $(boot)/vmlinux.elf
++vmlinux.cso: KBUILD_IMAGE := $(boot)/vmlinux.cso
++uImage.srec: KBUILD_IMAGE := $(boot)/uImage.srec
++uImage: KBUILD_IMAGE := $(boot)/uImage
++
++quiet_cmd_listing = LST $@
++ cmd_listing = avr32-linux-objdump $(OBJDUMPFLAGS) -lS $< > $@
++quiet_cmd_disasm = DIS $@
++ cmd_disasm = avr32-linux-objdump $(OBJDUMPFLAGS) -d $< > $@
++
++vmlinux.elf vmlinux.bin uImage.srec uImage vmlinux.cso: vmlinux
++ $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
++
++install: vmlinux
++ $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
++
++vmlinux.s: vmlinux
++ $(call if_changed,disasm)
++
++vmlinux.lst: vmlinux
++ $(call if_changed,listing)
++
++CLEAN_FILES += vmlinux.s vmlinux.lst
++
++archclean:
++ $(Q)$(MAKE) $(clean)=$(boot)
++
++define archhelp
++ @echo '* vmlinux.elf - ELF image with load address 0'
++ @echo ' vmlinux.cso - PathFinder CSO image'
++ @echo '* uImage - Create a bootable image for U-Boot'
++endef
+Index: linux-2.6.18-avr32/arch/avr32/boot/images/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/boot/images/Makefile 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,60 @@
++#
++# Copyright (C) 2004-2006 Atmel Corporation
++#
++# This file is subject to the terms and conditions of the GNU General Public
++# License. See the file "COPYING" in the main directory of this archive
++# for more details.
++#
++
++MKIMAGE := $(srctree)/scripts/mkuboot.sh
++
++extra-y := vmlinux.bin vmlinux.gz
++
++OBJCOPYFLAGS_vmlinux.bin := -O binary
++$(obj)/vmlinux.bin: vmlinux FORCE
++ $(call if_changed,objcopy)
++
++$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
++ $(call if_changed,gzip)
++
++quiet_cmd_uimage = UIMAGE $@
++ cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T kernel \
++ -C gzip -a $(CONFIG_LOAD_ADDRESS) -e $(CONFIG_ENTRY_ADDRESS) \
++ -n 'Linux-$(KERNELRELEASE)' -d $< $@
++
++targets += uImage uImage.srec
++$(obj)/uImage: $(obj)/vmlinux.gz
++ $(call if_changed,uimage)
++ @echo ' Image $@ is ready'
++
++OBJCOPYFLAGS_uImage.srec := -I binary -O srec
++$(obj)/uImage.srec: $(obj)/uImage
++ $(call if_changed,objcopy)
++
++OBJCOPYFLAGS_vmlinux.elf := --change-section-lma .text-0x80000000 \
++ --change-section-lma __ex_table-0x80000000 \
++ --change-section-lma .rodata-0x80000000 \
++ --change-section-lma .data-0x80000000 \
++ --change-section-lma .init-0x80000000 \
++ --change-section-lma .bss-0x80000000 \
++ --change-section-lma __param-0x80000000 \
++ --change-section-lma __ksymtab-0x80000000 \
++ --change-section-lma __ksymtab_gpl-0x80000000 \
++ --change-section-lma __kcrctab-0x80000000 \
++ --change-section-lma __kcrctab_gpl-0x80000000 \
++ --change-section-lma __ksymtab_strings-0x80000000 \
++ --set-start 0xa0000000
++$(obj)/vmlinux.elf: vmlinux FORCE
++ $(call if_changed,objcopy)
++
++quiet_cmd_sfdwarf = SFDWARF $@
++ cmd_sfdwarf = sfdwarf $< TO $@ GNUAVR IW $(SFDWARF_FLAGS) > $(obj)/sfdwarf.log
++
++$(obj)/vmlinux.cso: $(obj)/vmlinux.elf FORCE
++ $(call if_changed,sfdwarf)
++
++install: $(BOOTIMAGE)
++ sh $(srctree)/install-kernel.sh $<
++
++# Generated files to be removed upon make clean
++clean-files := vmlinux.elf vmlinux.bin vmlinux.gz uImage uImage.srec
+Index: linux-2.6.18-avr32/arch/avr32/boot/u-boot/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/boot/u-boot/Makefile 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,3 @@
++extra-y := head.o
++
++obj-y := empty.o
+Index: linux-2.6.18-avr32/arch/avr32/boot/u-boot/empty.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/boot/u-boot/empty.S 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1 @@
++/* Empty file */
+Index: linux-2.6.18-avr32/arch/avr32/boot/u-boot/head.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/boot/u-boot/head.S 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,60 @@
++/*
++ * Startup code for use with the u-boot bootloader.
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <asm/setup.h>
++
++ /*
++ * The kernel is loaded where we want it to be and all caches
++ * have just been flushed. We get two parameters from u-boot:
++ *
++ * r12 contains a magic number (ATAG_MAGIC)
++ * r11 points to a tag table providing information about
++ * the system.
++ */
++ .section .init.text,"ax"
++ .global _start
++_start:
++ /* Check if the boot loader actually provided a tag table */
++ lddpc r0, magic_number
++ cp.w r12, r0
++ brne no_tag_table
++
++ /* Initialize .bss */
++ lddpc r2, bss_start_addr
++ lddpc r3, end_addr
++ mov r0, 0
++ mov r1, 0
++1: st.d r2++, r0
++ cp r2, r3
++ brlo 1b
++
++ /*
++ * Save the tag table address for later use. This must be done
++ * _after_ .bss has been initialized...
++ */
++ lddpc r0, tag_table_addr
++ st.w r0[0], r11
++
++ /* Jump to loader-independent setup code */
++ rjmp kernel_entry
++
++ .align 2
++magic_number:
++ .long ATAG_MAGIC
++tag_table_addr:
++ .long bootloader_tags
++bss_start_addr:
++ .long __bss_start
++end_addr:
++ .long _end
++
++no_tag_table:
++ sub r12, pc, (. - 2f)
++ bral panic
++2: .asciz "Boot loader didn't provide correct magic number\n"
+Index: linux-2.6.18-avr32/arch/avr32/kernel/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/kernel/Makefile 2006-12-04 11:50:25.000000000 +0100
+@@ -0,0 +1,18 @@
++#
++# Makefile for the Linux/AVR32 kernel.
++#
++
++extra-y := head.o vmlinux.lds
++
++obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o
++obj-y += syscall_table.o syscall-stubs.o irq.o
++obj-y += setup.o traps.o semaphore.o ptrace.o
++obj-y += signal.o sys_avr32.o process.o time.o
++obj-y += init_task.o switch_to.o cpu.o
++obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o
++obj-$(CONFIG_KPROBES) += kprobes.o
++
++USE_STANDARD_AS_RULE := true
++
++%.lds: %.lds.c FORCE
++ $(call if_changed_dep,cpp_lds_S)
+Index: linux-2.6.18-avr32/arch/avr32/kernel/asm-offsets.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/kernel/asm-offsets.c 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,25 @@
++/*
++ * Generate definitions needed by assembly language modules.
++ * This code generates raw asm output which is post-processed
++ * to extract and format the required data.
++ */
++
++#include <linux/thread_info.h>
++
++#define DEFINE(sym, val) \
++ asm volatile("\n->" #sym " %0 " #val : : "i" (val))
++
++#define BLANK() asm volatile("\n->" : : )
++
++#define OFFSET(sym, str, mem) \
++ DEFINE(sym, offsetof(struct str, mem));
++
++void foo(void)
++{
++ OFFSET(TI_task, thread_info, task);
++ OFFSET(TI_exec_domain, thread_info, exec_domain);
++ OFFSET(TI_flags, thread_info, flags);
++ OFFSET(TI_cpu, thread_info, cpu);
++ OFFSET(TI_preempt_count, thread_info, preempt_count);
++ OFFSET(TI_restart_block, thread_info, restart_block);
++}
+Index: linux-2.6.18-avr32/arch/avr32/kernel/avr32_ksyms.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/kernel/avr32_ksyms.c 2006-12-04 11:50:25.000000000 +0100
+@@ -0,0 +1,64 @@
++/*
++ * Export AVR32-specific functions for loadable modules.
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/io.h>
++#include <linux/module.h>
++
++#include <asm/checksum.h>
++#include <asm/uaccess.h>
++#include <asm/delay.h>
++
++/*
++ * GCC functions
++ */
++extern unsigned long long __avr32_lsl64(unsigned long long u, unsigned long b);
++extern unsigned long long __avr32_lsr64(unsigned long long u, unsigned long b);
++extern unsigned long long __avr32_asr64(unsigned long long u, unsigned long b);
++EXPORT_SYMBOL(__avr32_lsl64);
++EXPORT_SYMBOL(__avr32_lsr64);
++EXPORT_SYMBOL(__avr32_asr64);
++
++/*
++ * String functions
++ */
++EXPORT_SYMBOL(memset);
++EXPORT_SYMBOL(memcpy);
++
++/*
++ * Userspace access stuff.
++ */
++EXPORT_SYMBOL(copy_from_user);
++EXPORT_SYMBOL(copy_to_user);
++EXPORT_SYMBOL(__copy_user);
++EXPORT_SYMBOL(strncpy_from_user);
++EXPORT_SYMBOL(__strncpy_from_user);
++EXPORT_SYMBOL(clear_user);
++EXPORT_SYMBOL(__clear_user);
++EXPORT_SYMBOL(csum_partial);
++EXPORT_SYMBOL(csum_partial_copy_generic);
++
++/* Delay loops (lib/delay.S) */
++EXPORT_SYMBOL(__ndelay);
++EXPORT_SYMBOL(__udelay);
++EXPORT_SYMBOL(__const_udelay);
++
++/* Bit operations (lib/findbit.S) */
++EXPORT_SYMBOL(find_first_zero_bit);
++EXPORT_SYMBOL(find_next_zero_bit);
++EXPORT_SYMBOL(find_first_bit);
++EXPORT_SYMBOL(find_next_bit);
++EXPORT_SYMBOL(generic_find_next_zero_le_bit);
++
++/* I/O primitives (lib/io-*.S) */
++EXPORT_SYMBOL(__raw_readsb);
++EXPORT_SYMBOL(__raw_readsw);
++EXPORT_SYMBOL(__raw_readsl);
++EXPORT_SYMBOL(__raw_writesb);
++EXPORT_SYMBOL(__raw_writesw);
++EXPORT_SYMBOL(__raw_writesl);
+Index: linux-2.6.18-avr32/arch/avr32/kernel/cpu.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.18-avr32/arch/avr32/kernel/cpu.c 2006-12-04 09:33:12.000000000 +0100
+@@ -0,0 +1,327 @@
++/*
++ * Copyright (C) 2005-2006 Atmel Corporation
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ */
++#include <linux/init.h>
++#include <linux/sysdev.h>
++#include <linux/seq_file.h>
++#include <linux/cpu.h>
++#include <linux/percpu.h>
++#include <linux/param.h>
++#include <linux/errno.h>
++
++#include <asm/setup.h>
++#include <asm/sysreg.h>
++
++static DEFINE_PER_CPU(struct cpu, cpu_devices);
++
++#ifdef CONFIG_PERFORMANCE_COUNTERS
++
++/*
++ * XXX: If/when a SMP-capable implementation of AVR32 will ever be
++ * made, we must make sure that the code executes on the correct CPU.
++ */
++static ssize_t show_pc0event(struct sys_device *dev, char *buf)
++{
++ unsigned long pccr;
++
++ pccr = sysreg_read(PCCR);
++ return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f);
++}
++static ssize_t store_pc0event(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf || val > 0x3f)
++ return -EINVAL;
++ val = (val << 12) | (sysreg_read(PCCR) & 0xfffc0fff);
++ sysreg_write(PCCR, val);
++ return count;
++}
++static ssize_t show_pc0count(struct sys_device *dev, char *buf)
++{
++ unsigned long pcnt0;
++
++ pcnt0 = sysreg_read(PCNT0);
++ return sprintf(buf, "%lu\n", pcnt0);
++}
++static ssize_t store_pc0count(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf)
++ return -EINVAL;
++ sysreg_write(PCNT0, val);
++
++ return count;
++}
++
++static ssize_t show_pc1event(struct sys_device *dev, char *buf)
++{
++ unsigned long pccr;
++
++ pccr = sysreg_read(PCCR);
++ return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f);
++}
++static ssize_t store_pc1event(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf || val > 0x3f)
++ return -EINVAL;
++ val = (val << 18) | (sysreg_read(PCCR) & 0xff03ffff);
++ sysreg_write(PCCR, val);
++ return count;
++}
++static ssize_t show_pc1count(struct sys_device *dev, char *buf)
++{
++ unsigned long pcnt1;
++
++ pcnt1 = sysreg_read(PCNT1);
++ return sprintf(buf, "%lu\n", pcnt1);
++}
++static ssize_t store_pc1count(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf)
++ return -EINVAL;
++ sysreg_write(PCNT1, val);
++
++ return count;
++}
++
++static ssize_t show_pccycles(struct sys_device *dev, char *buf)
++{
++ unsigned long pccnt;
++
++ pccnt = sysreg_read(PCCNT);
++ return sprintf(buf, "%lu\n", pccnt);
++}
++static ssize_t store_pccycles(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf)
++ return -EINVAL;
++ sysreg_write(PCCNT, val);
++
++ return count;
++}
++
++static ssize_t show_pcenable(struct sys_device *dev, char *buf)
++{
++ unsigned long pccr;
++
++ pccr = sysreg_read(PCCR);
++ return sprintf(buf, "%c\n", (pccr & 1)?'1':'0');
++}
++static ssize_t store_pcenable(struct sys_device *dev, const char *buf,
++ size_t count)
++{
++ unsigned long pccr, val;
++ char *endp;
++
++ val = simple_strtoul(buf, &endp, 0);
++ if (endp == buf)
++ return -EINVAL;
++ if (val)
++ val = 1;
++
++ pccr = sysreg_read(PCCR);
++ pccr = (pccr & ~1UL) | val;
++ sysreg_write(PCCR, pccr);
++
++ return count;
++}
++
++static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event);
++static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count);
++static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event);
++static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count);
++static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles);
++static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable);
++
++#endif /* CONFIG_PERFORMANCE_COUNTERS */
++
++static int __init topology_init(void)
++{
++ int cpu;
++
++ for_each_possible_cpu(cpu) {
++ struct cpu *c = &per_cpu(cpu_devices, cpu);
++
++ register_cpu(c, cpu);
++
++#ifdef CONFIG_PERFORMANCE_COUNTERS
++ sysdev_create_file(&c->sysdev, &attr_pc0event);
++ sysdev_create_file(&c->sysdev, &attr_pc0count);
++ sysdev_create_file(&c->sysdev, &attr_pc1event);
++ sysdev_create_file(&c->sysdev, &attr_pc1count);
++ sysdev_create_file(&c->sysdev, &attr_pccycles);
++ sysdev_create_file(&c->sysdev, &attr_pcenable);
++#endif
++ }
++
++ return 0;
++}
++
++subsys_initcall(topology_init);
++
++static const char *c