You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] avr32 architecture
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. [dmccr@us.ibm.com: Fix more pxx_page macro locations] [bunk@stusta.de: fix `make defconfig'] Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Dave McCracken <dmccr@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
53e62d3aaa
commit
5f97f7f940
+17
@@ -443,6 +443,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
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
#
|
||||
# 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_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"
|
||||
@@ -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
|
||||
@@ -0,0 +1,84 @@
|
||||
#
|
||||
# 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 linux.lst
|
||||
|
||||
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__
|
||||
|
||||
LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
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/ #$(LIBGCC)
|
||||
|
||||
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
|
||||
|
||||
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) $@
|
||||
|
||||
linux.s: vmlinux
|
||||
$(call if_changed,disasm)
|
||||
|
||||
linux.lst: vmlinux
|
||||
$(call if_changed,listing)
|
||||
|
||||
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
|
||||
@@ -0,0 +1,2 @@
|
||||
obj-y += setup.o spi.o
|
||||
obj-$(CONFIG_BOARD_ATSTK1002) += atstk1002.o
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* ATSTK1002 daughterboard-specific init code
|
||||
*
|
||||
* 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 <asm/arch/board.h>
|
||||
|
||||
struct eth_platform_data __initdata eth0_data = {
|
||||
.valid = 1,
|
||||
.mii_phy_addr = 0x10,
|
||||
.is_rmii = 0,
|
||||
.hw_addr = { 0x6a, 0x87, 0x71, 0x14, 0xcd, 0xcb },
|
||||
};
|
||||
|
||||
extern struct lcdc_platform_data atstk1000_fb0_data;
|
||||
|
||||
static int __init atstk1002_init(void)
|
||||
{
|
||||
at32_add_system_devices();
|
||||
|
||||
at32_add_device_usart(1); /* /dev/ttyS0 */
|
||||
at32_add_device_usart(2); /* /dev/ttyS1 */
|
||||
at32_add_device_usart(3); /* /dev/ttyS2 */
|
||||
|
||||
at32_add_device_eth(0, ð0_data);
|
||||
at32_add_device_spi(0);
|
||||
at32_add_device_lcdc(0, &atstk1000_fb0_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
postcore_initcall(atstk1002_init);
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* ATSTK1000 board-specific setup code.
|
||||
*
|
||||
* 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/bootmem.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/linkage.h>
|
||||
|
||||
#include <asm/setup.h>
|
||||
|
||||
#include <asm/arch/board.h>
|
||||
|
||||
/* Initialized by bootloader-specific startup code. */
|
||||
struct tag *bootloader_tags __initdata;
|
||||
|
||||
struct lcdc_platform_data __initdata atstk1000_fb0_data;
|
||||
|
||||
asmlinkage void __init board_early_init(void)
|
||||
{
|
||||
extern void sdram_init(void);
|
||||
|
||||
#ifdef CONFIG_LOADER_STANDALONE
|
||||
sdram_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void __init board_setup_fbmem(unsigned long fbmem_start,
|
||||
unsigned long fbmem_size)
|
||||
{
|
||||
if (!fbmem_size)
|
||||
return;
|
||||
|
||||
if (!fbmem_start) {
|
||||
void *fbmem;
|
||||
|
||||
fbmem = alloc_bootmem_low_pages(fbmem_size);
|
||||
fbmem_start = __pa(fbmem);
|
||||
} else {
|
||||
pg_data_t *pgdat;
|
||||
|
||||
for_each_online_pgdat(pgdat) {
|
||||
if (fbmem_start >= pgdat->bdata->node_boot_start
|
||||
&& fbmem_start <= pgdat->bdata->node_low_pfn)
|
||||
reserve_bootmem_node(pgdat, fbmem_start,
|
||||
fbmem_size);
|
||||
}
|
||||
}
|
||||
|
||||
printk("%luKiB framebuffer memory at address 0x%08lx\n",
|
||||
fbmem_size >> 10, fbmem_start);
|
||||
atstk1000_fb0_data.fbmem_start = fbmem_start;
|
||||
atstk1000_fb0_data.fbmem_size = fbmem_size;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* ATSTK1000 SPI devices
|
||||
*
|
||||
* Copyright (C) 2005 Atmel Norway
|
||||
*
|
||||
* 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/device.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
static struct spi_board_info spi_board_info[] __initdata = {
|
||||
{
|
||||
.modalias = "ltv350qv",
|
||||
.max_speed_hz = 16000000,
|
||||
.bus_num = 0,
|
||||
.chip_select = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static int board_init_spi(void)
|
||||
{
|
||||
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(board_init_spi);
|
||||
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# 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 .initrd-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 \
|
||||
--change-section-lma .got-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* uImage uImage.srec
|
||||
@@ -0,0 +1,3 @@
|
||||
extra-y := head.o
|
||||
|
||||
obj-y := empty.o
|
||||
@@ -0,0 +1 @@
|
||||
/* Empty file */
|
||||
@@ -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"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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)
|
||||
@@ -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);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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/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);
|
||||
@@ -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 *cpu_names[] = {
|
||||
"Morgan",
|
||||
"AP7000",
|
||||
};
|
||||
#define NR_CPU_NAMES ARRAY_SIZE(cpu_names)
|
||||
|
||||
static const char *arch_names[] = {
|
||||
"AVR32A",
|
||||
"AVR32B",
|
||||
};
|
||||
#define NR_ARCH_NAMES ARRAY_SIZE(arch_names)
|
||||
|
||||
static const char *mmu_types[] = {
|
||||
"No MMU",
|
||||
"ITLB and DTLB",
|
||||
"Shared TLB",
|
||||
"MPU"
|
||||
};
|
||||
|
||||
void __init setup_processor(void)
|
||||
{
|
||||
unsigned long config0, config1;
|
||||
unsigned cpu_id, cpu_rev, arch_id, arch_rev, mmu_type;
|
||||
unsigned tmp;
|
||||
|
||||
config0 = sysreg_read(CONFIG0); /* 0x0000013e; */
|
||||
config1 = sysreg_read(CONFIG1); /* 0x01f689a2; */
|
||||
cpu_id = config0 >> 24;
|
||||
cpu_rev = (config0 >> 16) & 0xff;
|
||||
arch_id = (config0 >> 13) & 0x07;
|
||||
arch_rev = (config0 >> 10) & 0x07;
|
||||
mmu_type = (config0 >> 7) & 0x03;
|
||||
|
||||
boot_cpu_data.arch_type = arch_id;
|
||||
boot_cpu_data.cpu_type = cpu_id;
|
||||
boot_cpu_data.arch_revision = arch_rev;
|
||||
boot_cpu_data.cpu_revision = cpu_rev;
|
||||
boot_cpu_data.tlb_config = mmu_type;
|
||||
|
||||
tmp = (config1 >> 13) & 0x07;
|
||||
if (tmp) {
|
||||
boot_cpu_data.icache.ways = 1 << ((config1 >> 10) & 0x07);
|
||||
boot_cpu_data.icache.sets = 1 << ((config1 >> 16) & 0x0f);
|
||||
boot_cpu_data.icache.linesz = 1 << (tmp + 1);
|
||||
}
|
||||
tmp = (config1 >> 3) & 0x07;
|
||||
if (tmp) {
|
||||
boot_cpu_data.dcache.ways = 1 << (config1 & 0x07);
|
||||
boot_cpu_data.dcache.sets = 1 << ((config1 >> 6) & 0x0f);
|
||||
boot_cpu_data.dcache.linesz = 1 << (tmp + 1);
|
||||
}
|
||||
|
||||
if ((cpu_id >= NR_CPU_NAMES) || (arch_id >= NR_ARCH_NAMES)) {
|
||||
printk ("Unknown CPU configuration (ID %02x, arch %02x), "
|
||||
"continuing anyway...\n",
|
||||
cpu_id, arch_id);
|
||||
return;
|
||||
}
|
||||
|
||||
printk ("CPU: %s [%02x] revision %d (%s revision %d)\n",
|
||||
cpu_names[cpu_id], cpu_id, cpu_rev,
|
||||
arch_names[arch_id], arch_rev);
|
||||
printk ("CPU: MMU configuration: %s\n", mmu_types[mmu_type]);
|
||||
printk ("CPU: features:");
|
||||
if (config0 & (1 << 6))
|
||||
printk(" fpu");
|
||||
if (config0 & (1 << 5))
|
||||
printk(" java");
|
||||
if (config0 & (1 << 4))
|
||||
printk(" perfctr");
|
||||
if (config0 & (1 << 3))
|
||||
printk(" ocd");
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
static int c_show(struct seq_file *m, void *v)
|
||||
{
|
||||
unsigned int icache_size, dcache_size;
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
icache_size = boot_cpu_data.icache.ways *
|
||||
boot_cpu_data.icache.sets *
|
||||
boot_cpu_data.icache.linesz;
|
||||
dcache_size = boot_cpu_data.dcache.ways *
|
||||
boot_cpu_data.dcache.sets *
|
||||
boot_cpu_data.dcache.linesz;
|
||||
|
||||
seq_printf(m, "processor\t: %d\n", cpu);
|
||||
|
||||
if (boot_cpu_data.arch_type < NR_ARCH_NAMES)
|
||||
seq_printf(m, "cpu family\t: %s revision %d\n",
|
||||
arch_names[boot_cpu_data.arch_type],
|
||||
boot_cpu_data.arch_revision);
|
||||
if (boot_cpu_data.cpu_type < NR_CPU_NAMES)
|
||||
seq_printf(m, "cpu type\t: %s revision %d\n",
|
||||
cpu_names[boot_cpu_data.cpu_type],
|
||||
boot_cpu_data.cpu_revision);
|
||||
|
||||
seq_printf(m, "i-cache\t\t: %dK (%u ways x %u sets x %u)\n",
|
||||
icache_size >> 10,
|
||||
boot_cpu_data.icache.ways,
|
||||
boot_cpu_data.icache.sets,
|
||||
boot_cpu_data.icache.linesz);
|
||||
seq_printf(m, "d-cache\t\t: %dK (%u ways x %u sets x %u)\n",
|
||||
dcache_size >> 10,
|
||||
boot_cpu_data.dcache.ways,
|
||||
boot_cpu_data.dcache.sets,
|
||||
boot_cpu_data.dcache.linesz);
|
||||
seq_printf(m, "bogomips\t: %lu.%02lu\n",
|
||||
boot_cpu_data.loops_per_jiffy / (500000/HZ),
|
||||
(boot_cpu_data.loops_per_jiffy / (5000/HZ)) % 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *c_start(struct seq_file *m, loff_t *pos)
|
||||
{
|
||||
return *pos < 1 ? (void *)1 : NULL;
|
||||
}
|
||||
|
||||
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
|
||||
{
|
||||
++*pos;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void c_stop(struct seq_file *m, void *v)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct seq_operations cpuinfo_op = {
|
||||
.start = c_start,
|
||||
.next = c_next,
|
||||
.stop = c_stop,
|
||||
.show = c_show
|
||||
};
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Non-board-specific low-level startup code
|
||||
*
|
||||
* 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/linkage.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/thread_info.h>
|
||||
#include <asm/sysreg.h>
|
||||
|
||||
.section .init.text,"ax"
|
||||
.global kernel_entry
|
||||
kernel_entry:
|
||||
/* Initialize status register */
|
||||
lddpc r0, init_sr
|
||||
mtsr SYSREG_SR, r0
|
||||
|
||||
/* Set initial stack pointer */
|
||||
lddpc sp, stack_addr
|
||||
sub sp, -THREAD_SIZE
|
||||
|
||||
#ifdef CONFIG_FRAME_POINTER
|
||||
/* Mark last stack frame */
|
||||
mov lr, 0
|
||||
mov r7, 0
|
||||
#endif
|
||||
|
||||
/* Set up the PIO, SDRAM controller, early printk, etc. */
|
||||
rcall board_early_init
|
||||
|
||||
/* Start the show */
|
||||
lddpc pc, kernel_start_addr
|
||||
|
||||
.align 2
|
||||
init_sr:
|
||||
.long 0x007f0000 /* Supervisor mode, everything masked */
|
||||
stack_addr:
|
||||
.long init_thread_union
|
||||
kernel_start_addr:
|
||||
.long start_kernel
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init_task.h>
|
||||
#include <linux/mqueue.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
static struct fs_struct init_fs = INIT_FS;
|
||||
static struct files_struct init_files = INIT_FILES;
|
||||
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
|
||||
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
|
||||
struct mm_struct init_mm = INIT_MM(init_mm);
|
||||
|
||||
EXPORT_SYMBOL(init_mm);
|
||||
|
||||
/*
|
||||
* Initial thread structure. Must be aligned on an 8192-byte boundary.
|
||||
*/
|
||||
union thread_union init_thread_union
|
||||
__attribute__((__section__(".data.init_task"))) =
|
||||
{ INIT_THREAD_INFO(init_task) };
|
||||
|
||||
/*
|
||||
* Initial task structure.
|
||||
*
|
||||
* All other task structs will be allocated on slabs in fork.c
|
||||
*/
|
||||
struct task_struct init_task = INIT_TASK(init_task);
|
||||
|
||||
EXPORT_SYMBOL(init_task);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user