提交 0cf975e1 编写于 作者: L Linus Torvalds

Merge branch 'cris' of git://www.jni.nu/cris

* 'cris' of git://www.jni.nu/cris: (158 commits)
  CRIS v32: Remove hwregs/timer_defs.h, it is now architecture specific.
  CRIS v32: Change drivers/i2c.c locking.
  CRIS v32: Rewrite ARTPEC-3 gpio driver to avoid volatiles and general cleanup.
  CRIS: Add new timerfd syscall entries.
  MAINTAINERS: Add my information for the CRIS port.
  CRIS v32: Correct spelling of bandwidth in function name.
  CRIS v32: Clean up nandflash.c for ARTPEC-3 and ETRAX FS.
  CRIS v10: Cleanup of drivers/gpio.c
  CRIS v10: drivers/net/cris/eth_v10.c rename LED defines to CRIS_LED to avoid name clash.
  CRIS: Make io_pwm_set_period members unsigned in etraxgpio.h
  CRIS: Move ETRAX_AXISFLASHMAP to common Kconfig file.
  CRIS: Drop regs parameter from call to profile_tick in kernel/time.c
  CRIS v32: Fix minor formatting issue in mach-a3/io.c
  CRIS v32: Initialize GIO even if we're rambooting in kernel/head.S
  CRIS v32: Remove kernel/arbiter.c, it now exists in machine dependent directory.
  CRIS v32: Minor changes to avoid errors in asm-cris/arch-v32/hwregs/reg_rdwr.h
  CRIS v32: arch-v32/hwregs/intr_vect_defs.h moved to machine dependent directory.
  CRIS v32: Correct offset for TASK_pid in asm-cris/arch-v32/offset.h
  CRIS v32: Move register map header to machine dependent directory.
  CRIS v32: Let compiler know that memory is clobbered after a break op.
  ...
......@@ -1173,6 +1173,8 @@ S: Orphan
CRIS PORT
P: Mikael Starvik
M: starvik@axis.com
P: Jesper Nilsson
M: jesper.nilsson@axis.com
L: dev-etrax@axis.com
W: http://developer.axis.com
S: Maintained
......
......@@ -13,10 +13,6 @@ config ZONE_DMA
bool
default y
config NO_DMA
bool
default y
config RWSEM_GENERIC_SPINLOCK
bool
default y
......@@ -24,6 +20,10 @@ config RWSEM_GENERIC_SPINLOCK
config RWSEM_XCHGADD_ALGORITHM
bool
config GENERIC_IOMAP
bool
default y
config ARCH_HAS_ILOG2_U32
bool
default n
......@@ -44,13 +44,13 @@ config GENERIC_CALIBRATE_DELAY
bool
default y
config IRQ_PER_CPU
bool
default y
config NO_IOPORT
def_bool y
config FORCE_MAX_ZONEORDER
int
default 6
config CRIS
bool
default y
......@@ -97,17 +97,15 @@ config ETRAX_FAST_TIMER
timers).
This is needed if CONFIG_ETRAX_SERIAL_FAST_TIMER is enabled.
config PREEMPT
bool "Preemptible Kernel"
config ETRAX_KMALLOCED_MODULES
bool "Enable module allocation with kmalloc"
help
This option reduces the latency of the kernel when reacting to
real-time or interactive events by allowing a low priority process to
be preempted even if it is in kernel mode executing a system call.
This allows applications to run more reliably even when the system is
under load.
Enable module allocation with kmalloc instead of vmalloc.
config OOM_REBOOT
bool "Enable reboot at out of memory"
Say Y here if you are building a kernel for a desktop, embedded
or real-time system. Say N if you are unsure.
source "kernel/Kconfig.preempt"
source mm/Kconfig
......@@ -134,24 +132,124 @@ config SVINTO_SIM
help
Support the xsim ETRAX Simulator.
config ETRAXFS
bool "ETRAX-FS-V32"
help
Support CRIS V32.
config CRIS_MACH_ARTPEC3
bool "ARTPEC-3"
help
Support Axis ARTPEC-3.
endchoice
config ETRAX_VCS_SIM
bool "VCS Simulator"
help
Setup hardware to be run in the VCS simulator.
config ETRAX_ARCH_V10
bool
default y if ETRAX100LX || ETRAX100LX_V2
default n if !(ETRAX100LX || ETRAX100LX_V2)
config ETRAX_ARCH_V32
bool
default y if (ETRAXFS || CRIS_MACH_ARTPEC3)
default n if !(ETRAXFS || CRIS_MACH_ARTPEC3)
config ETRAX_DRAM_SIZE
int "DRAM size (dec, in MB)"
default "8"
help
Size of DRAM (decimal in MB) typically 2, 8 or 16.
config ETRAX_VMEM_SIZE
int "Video memory size (dec, in MB)"
depends on ETRAX_ARCH_V32 && !ETRAXFS
default 8 if !ETRAXFS
help
Size of Video accessible memory (decimal, in MB).
config ETRAX_FLASH_BUSWIDTH
int "Buswidth of flash in bytes"
int "Buswidth of NOR flash in bytes"
default "2"
help
Width in bytes of the Flash bus (1, 2 or 4). Is usually 2.
Width in bytes of the NOR Flash bus (1, 2 or 4). Is usually 2.
config ETRAX_NANDFLASH_BUSWIDTH
int "Buswidth of NAND flash in bytes"
default "1"
help
Width in bytes of the NAND flash (1 or 2).
config ETRAX_FLASH1_SIZE
int "FLASH1 size (dec, in MB. 0 = Unknown)"
default "0"
choice
prompt "Product debug-port"
default ETRAX_DEBUG_PORT0
config ETRAX_DEBUG_PORT0
bool "Serial-0"
help
Choose a serial port for the ETRAX debug console. Default to
port 0.
config ETRAX_DEBUG_PORT1
bool "Serial-1"
help
Use serial port 1 for the console.
config ETRAX_DEBUG_PORT2
bool "Serial-2"
help
Use serial port 2 for the console.
config ETRAX_DEBUG_PORT3
bool "Serial-3"
help
Use serial port 3 for the console.
config ETRAX_DEBUG_PORT_NULL
bool "disabled"
help
Disable serial-port debugging.
endchoice
choice
prompt "Kernel GDB port"
depends on ETRAX_KGDB
default ETRAX_KGDB_PORT0
help
Choose a serial port for kernel debugging. NOTE: This port should
not be enabled under Drivers for built-in interfaces (as it has its
own initialization code) and should not be the same as the debug port.
config ETRAX_KGDB_PORT0
bool "Serial-0"
help
Use serial port 0 for kernel debugging.
config ETRAX_KGDB_PORT1
bool "Serial-1"
help
Use serial port 1 for kernel debugging.
config ETRAX_KGDB_PORT2
bool "Serial-2"
help
Use serial port 2 for kernel debugging.
config ETRAX_KGDB_PORT3
bool "Serial-3"
help
Use serial port 3 for kernel debugging.
endchoice
source arch/cris/arch-v10/Kconfig
source arch/cris/arch-v32/Kconfig
......@@ -165,6 +263,387 @@ menu "Drivers for built-in interfaces"
source arch/cris/arch-v10/drivers/Kconfig
source arch/cris/arch-v32/drivers/Kconfig
config ETRAX_AXISFLASHMAP
bool "Axis flash-map support"
select MTD
select MTD_CFI
select MTD_CFI_AMDSTD
select MTD_JEDECPROBE if ETRAX_ARCH_V32
select MTD_CHAR
select MTD_BLOCK
select MTD_PARTITIONS
select MTD_CONCAT
select MTD_COMPLEX_MAPPINGS
help
This option enables MTD mapping of flash devices. Needed to use
flash memories. If unsure, say Y.
config ETRAX_RTC
bool "Real Time Clock support"
depends on ETRAX_I2C
help
Enables drivers for the Real-Time Clock battery-backed chips on
some products. The kernel reads the time when booting, and
the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc
device. You can check the time with cat /proc/rtc, but
normal time reading should be done using libc function time and
friends.
choice
prompt "RTC chip"
depends on ETRAX_RTC
default ETRAX_PCF8563 if ETRAX_ARCH_V32
default ETRAX_DS1302 if ETRAX_ARCH_V10
config ETRAX_DS1302
depends on ETRAX_ARCH_V10
bool "DS1302"
help
Enables the driver for the DS1302 Real-Time Clock battery-backed
chip on some products.
config ETRAX_PCF8563
bool "PCF8563"
help
Enables the driver for the PCF8563 Real-Time Clock battery-backed
chip on some products.
endchoice
config ETRAX_SYNCHRONOUS_SERIAL
bool "Synchronous serial-port support"
help
Select this to enable the synchronous serial port driver.
config ETRAX_SYNCHRONOUS_SERIAL_PORT0
bool "Synchronous serial port 0 enabled"
depends on ETRAX_SYNCHRONOUS_SERIAL
help
Enabled synchronous serial port 0.
config ETRAX_SYNCHRONOUS_SERIAL0_DMA
bool "Enable DMA on synchronous serial port 0."
depends on ETRAX_SYNCHRONOUS_SERIAL_PORT0
help
A synchronous serial port can run in manual or DMA mode.
Selecting this option will make it run in DMA mode.
config ETRAX_SYNCHRONOUS_SERIAL_PORT1
bool "Synchronous serial port 1 enabled"
depends on ETRAX_SYNCHRONOUS_SERIAL && (ETRAXFS || ETRAX_ARCH_V10)
help
Enabled synchronous serial port 1.
config ETRAX_SYNCHRONOUS_SERIAL1_DMA
bool "Enable DMA on synchronous serial port 1."
depends on ETRAX_SYNCHRONOUS_SERIAL_PORT1
help
A synchronous serial port can run in manual or DMA mode.
Selecting this option will make it run in DMA mode.
choice
prompt "Network LED behavior"
depends on ETRAX_ETHERNET
default ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
config ETRAX_NETWORK_LED_ON_WHEN_LINK
bool "LED_on_when_link"
help
Selecting LED_on_when_link will light the LED when there is a
connection and will flash off when there is activity.
Selecting LED_on_when_activity will light the LED only when
there is activity.
This setting will also affect the behaviour of other activity LEDs
e.g. Bluetooth.
config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
bool "LED_on_when_activity"
help
Selecting LED_on_when_link will light the LED when there is a
connection and will flash off when there is activity.
Selecting LED_on_when_activity will light the LED only when
there is activity.
This setting will also affect the behaviour of other activity LEDs
e.g. Bluetooth.
endchoice
choice
prompt "Ser0 DMA out channel"
depends on ETRAX_SERIAL_PORT0
default ETRAX_SERIAL_PORT0_DMA6_OUT if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT0_NO_DMA_OUT if ETRAX_ARCH_V10
config ETRAX_SERIAL_PORT0_NO_DMA_OUT
bool "Ser0 uses no DMA for output"
help
Do not use DMA for ser0 output.
config ETRAX_SERIAL_PORT0_DMA6_OUT
bool "Ser0 uses DMA6 for output"
depends on ETRAXFS
help
Enables the DMA6 output channel for ser0 (ttyS0).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT0_DMA0_OUT
bool "Ser0 uses DMA0 for output"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA0 output channel for ser0 (ttyS0).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser0 DMA in channel "
depends on ETRAX_SERIAL_PORT0
default ETRAX_SERIAL_PORT0_NO_DMA_IN if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT0_DMA7_IN if ETRAX_ARCH_V10
help
What DMA channel to use for ser0.
config ETRAX_SERIAL_PORT0_NO_DMA_IN
bool "Ser0 uses no DMA for input"
help
Do not use DMA for ser0 input.
config ETRAX_SERIAL_PORT0_DMA7_IN
bool "Ser0 uses DMA7 for input"
depends on ETRAXFS
help
Enables the DMA7 input channel for ser0 (ttyS0).
If you do not enable DMA, an interrupt for each character will be
used when receiving data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT0_DMA1_IN
bool "Ser0 uses DMA1 for input"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA1 input channel for ser0 (ttyS0).
If you do not enable DMA, an interrupt for each character will be
used when receiveing data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser1 DMA in channel "
depends on ETRAX_SERIAL_PORT1
default ETRAX_SERIAL_PORT1_NO_DMA_IN if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT1_DMA9_IN if ETRAX_ARCH_V10
help
What DMA channel to use for ser1.
config ETRAX_SERIAL_PORT1_NO_DMA_IN
bool "Ser1 uses no DMA for input"
help
Do not use DMA for ser1 input.
config ETRAX_SERIAL_PORT1_DMA5_IN
bool "Ser1 uses DMA5 for input"
depends on ETRAX_ARCH_V32
help
Enables the DMA5 input channel for ser1 (ttyS1).
If you do not enable DMA, an interrupt for each character will be
used when receiving data.
Normally you want this on, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT1_DMA9_IN
depends on ETRAX_ARCH_V10
bool "Ser1 uses DMA9 for input"
endchoice
choice
prompt "Ser1 DMA out channel"
depends on ETRAX_SERIAL_PORT1
default ETRAX_SERIAL_PORT1_NO_DMA_OUT if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT1_DMA8_OUT if ETRAX_ARCH_V10
help
What DMA channel to use for ser1.
config ETRAX_SERIAL_PORT1_NO_DMA_OUT
bool "Ser1 uses no DMA for output"
help
Do not use DMA for ser1 output.
config ETRAX_SERIAL_PORT1_DMA8_OUT
depends on ETRAX_ARCH_V10
bool "Ser1 uses DMA8 for output"
config ETRAX_SERIAL_PORT1_DMA4_OUT
depends on ETRAX_ARCH_V32
bool "Ser1 uses DMA4 for output"
help
Enables the DMA4 output channel for ser1 (ttyS1).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want this on, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser2 DMA out channel"
depends on ETRAX_SERIAL_PORT2
default ETRAX_SERIAL_PORT2_NO_DMA_OUT if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT2_DMA2_OUT if ETRAX_ARCH_V10
config ETRAX_SERIAL_PORT2_NO_DMA_OUT
bool "Ser2 uses no DMA for output"
help
Do not use DMA for ser2 output.
config ETRAX_SERIAL_PORT2_DMA2_OUT
bool "Ser2 uses DMA2 for output"
depends on ETRAXFS || ETRAX_ARCH_V10
help
Enables the DMA2 output channel for ser2 (ttyS2).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT2_DMA6_OUT
bool "Ser2 uses DMA6 for output"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA6 output channel for ser2 (ttyS2).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser2 DMA in channel"
depends on ETRAX_SERIAL_PORT2
default ETRAX_SERIAL_PORT2_NO_DMA_IN if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT2_DMA3_IN if ETRAX_ARCH_V10
help
What DMA channel to use for ser2.
config ETRAX_SERIAL_PORT2_NO_DMA_IN
bool "Ser2 uses no DMA for input"
help
Do not use DMA for ser2 input.
config ETRAX_SERIAL_PORT2_DMA3_IN
bool "Ser2 uses DMA3 for input"
depends on ETRAXFS || ETRAX_ARCH_V10
help
Enables the DMA3 input channel for ser2 (ttyS2).
If you do not enable DMA, an interrupt for each character will be
used when receiving data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT2_DMA7_IN
bool "Ser2 uses DMA7 for input"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA7 input channel for ser2 (ttyS2).
If you do not enable DMA, an interrupt for each character will be
used when receiveing data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser3 DMA in channel"
depends on ETRAX_SERIAL_PORT3
default ETRAX_SERIAL_PORT3_NO_DMA_IN if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT3_DMA5_IN if ETRAX_ARCH_V10
help
What DMA channel to use for ser3.
config ETRAX_SERIAL_PORT3_NO_DMA_IN
bool "Ser3 uses no DMA for input"
help
Do not use DMA for ser3 input.
config ETRAX_SERIAL_PORT3_DMA5_IN
depends on ETRAX_ARCH_V10
bool "DMA 5"
config ETRAX_SERIAL_PORT3_DMA9_IN
bool "Ser3 uses DMA9 for input"
depends on ETRAXFS
help
Enables the DMA9 input channel for ser3 (ttyS3).
If you do not enable DMA, an interrupt for each character will be
used when receiving data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT3_DMA3_IN
bool "Ser3 uses DMA3 for input"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA3 input channel for ser3 (ttyS3).
If you do not enable DMA, an interrupt for each character will be
used when receiveing data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
choice
prompt "Ser3 DMA out channel"
depends on ETRAX_SERIAL_PORT3
default ETRAX_SERIAL_PORT3_NO_DMA_OUT if ETRAX_ARCH_V32
default ETRAX_SERIAL_PORT3_DMA4_OUT if ETRAX_ARCH_V10
config ETRAX_SERIAL_PORT3_NO_DMA_OUT
bool "Ser3 uses no DMA for output"
help
Do not use DMA for ser3 output.
config ETRAX_SERIAL_PORT3_DMA4_OUT
depends on ETRAX_ARCH_V10
bool "DMA 4"
config ETRAX_SERIAL_PORT3_DMA8_OUT
bool "Ser3 uses DMA8 for output"
depends on ETRAXFS
help
Enables the DMA8 output channel for ser3 (ttyS3).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
config ETRAX_SERIAL_PORT3_DMA2_OUT
bool "Ser3 uses DMA2 for output"
depends on CRIS_MACH_ARTPEC3
help
Enables the DMA2 output channel for ser3 (ttyS3).
If you do not enable DMA, an interrupt for each character will be
used when transmitting data.
Normally you want to use DMA, unless you use the DMA channel for
something else.
endchoice
endmenu
source "drivers/base/Kconfig"
......@@ -178,22 +657,10 @@ source "drivers/pnp/Kconfig"
source "drivers/block/Kconfig"
source "drivers/md/Kconfig"
source "drivers/ide/Kconfig"
source "drivers/scsi/Kconfig"
source "drivers/ieee1394/Kconfig"
source "drivers/message/i2o/Kconfig"
source "drivers/net/Kconfig"
source "drivers/isdn/Kconfig"
source "drivers/telephony/Kconfig"
source "drivers/i2c/Kconfig"
source "drivers/rtc/Kconfig"
......@@ -205,17 +672,8 @@ source "drivers/input/Kconfig"
source "drivers/char/Kconfig"
#source drivers/misc/Config.in
source "drivers/media/Kconfig"
source "fs/Kconfig"
source "sound/Kconfig"
source "drivers/pcmcia/Kconfig"
source "drivers/pci/Kconfig"
source "drivers/usb/Kconfig"
source "arch/cris/Kconfig.debug"
......
# $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $
#
# cris/Makefile
#
# This file is included by the global makefile so that you can add your own
......@@ -10,28 +10,36 @@
# License. See the file "COPYING" in the main directory of this archive
# for more details.
# A bug in ld prevents us from having a (constant-value) symbol in a
# "ORIGIN =" or "LENGTH =" expression.
arch-y := v10
arch-$(CONFIG_ETRAX_ARCH_V10) := v10
arch-$(CONFIG_ETRAX_ARCH_V32) := v32
# No config avaiable for make clean etc
# No config available for make clean etc
mach-y := fs
mach-$(CONFIG_CRIS_MACH_ARTPEC3) := a3
mach-$(CONFIG_ETRAXFS) := fs
ifneq ($(arch-y),)
SARCH := arch-$(arch-y)
else
SARCH :=
endif
ifneq ($(mach-y),)
MACH := mach-$(mach-y)
else
MACH :=
endif
LD = $(CROSS_COMPILE)ld -mcrislinux
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
KBUILD_AFLAGS += -mlinux
KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe
KBUILD_AFLAGS += -mlinux -march=$(arch-y) -Iinclude/asm/arch/mach -Iinclude/asm/arch
KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe -Iinclude/asm/arch/mach -Iinclude/asm/arch
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
......@@ -44,6 +52,9 @@ LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
ifdef CONFIG_ETRAX_ARCH_V32
core-y += arch/$(ARCH)/$(SARCH)/$(MACH)/
endif
drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
......@@ -52,79 +63,69 @@ SRC_ARCH = $(srctree)/arch/$(ARCH)
# cris object files path
OBJ_ARCH = $(objtree)/arch/$(ARCH)
target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot
target_boot_dir = $(OBJ_ARCH)/boot
src_boot_dir = $(SRC_ARCH)/boot
target_compressed_dir = $(OBJ_ARCH)/boot/compressed
src_compressed_dir = $(SRC_ARCH)/boot/compressed
target_rescue_dir = $(OBJ_ARCH)/boot/rescue
src_rescue_dir = $(SRC_ARCH)/boot/rescue
export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir
vmlinux.bin: vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
timage: vmlinux.bin
cat vmlinux.bin cramfs.img >timage
simimage: timage
cp vmlinux.bin simvmlinux.bin
# the following will remake timage without compiling the kernel
# it does of course require that all object files exist...
cramfs:
## cramfs - Creates a cramfs image
mkcramfs -b 8192 -m romfs_meta.txt root cramfs.img
cat vmlinux.bin cramfs.img >timage
boot := arch/$(ARCH)/boot
MACHINE := arch/$(ARCH)/$(SARCH)
clinux: vmlinux.bin decompress.bin rescue.bin
all: zImage
decompress.bin: $(target_boot_dir)
@$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin
zImage Image: vmlinux
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
$(target_rescue_dir)/rescue.bin: $(target_boot_dir)
@$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin
zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin
## zImage - Compressed kernel (gzip)
@$(MAKE) -f $(src_boot_dir)/Makefile zImage
$(target_boot_dir): $(target_boot_arch_dir)
ln -sfn $< $@
$(target_boot_arch_dir):
mkdir -p $@
compressed: zImage
archmrproper:
archclean:
@if [ -d arch/$(ARCH)/boot ]; then \
$(MAKE) $(clean)=arch/$(ARCH)/boot ; \
fi
rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
rm -rf $(LD_SCRIPT).tmp
archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch
archprepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch FORCE
# Create some links to make all tools happy
$(SRC_ARCH)/.links:
@rm -rf $(SRC_ARCH)/drivers
@ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers
@ln -sfn $(SARCH)/drivers $(SRC_ARCH)/drivers
@rm -rf $(SRC_ARCH)/boot
@ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot
@ln -sfn $(SARCH)/boot $(SRC_ARCH)/boot
@rm -rf $(SRC_ARCH)/lib
@ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
@ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
@ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
@ln -sfn $(SRC_ARCH)/$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
@ln -sfn $(SARCH)/lib $(SRC_ARCH)/lib
@rm -f $(SRC_ARCH)/arch/mach
@rm -rf $(SRC_ARCH)/arch
@ln -sfn $(SARCH) $(SRC_ARCH)/arch
ifdef CONFIG_ETRAX_ARCH_V32
@ln -sfn ../$(SARCH)/$(MACH) $(SRC_ARCH)/arch/mach
endif
@rm -rf $(SRC_ARCH)/kernel/vmlinux.lds.S
@ln -sfn ../$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
@rm -rf $(SRC_ARCH)/kernel/asm-offsets.c
@ln -sfn ../$(SARCH)/kernel/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c
@touch $@
# Create link to sub arch includes
$(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
@echo ' Making $(srctree)/include/asm-$(ARCH)/arch -> $(srctree)/include/asm-$(ARCH)/$(SARCH) symlink'
@rm -f include/asm-$(ARCH)/arch
@ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch
@echo ' SYMLINK include/asm-$(ARCH)/arch -> include/asm-$(ARCH)/$(SARCH)'
@rm -f $(srctree)/include/asm-$(ARCH)/arch/mach
@rm -f $(srctree)/include/asm-$(ARCH)/arch
@ln -sf $(SARCH) $(srctree)/include/asm-$(ARCH)/arch
ifdef CONFIG_ETRAX_ARCH_V32
@ln -sf $(MACH) $(srctree)/include/asm-$(ARCH)/arch/mach
endif
@touch $@
archclean:
$(Q)if [ -e arch/$(ARCH)/boot ]; then \
$(MAKE) $(clean)=arch/$(ARCH)/boot; \
fi
CLEAN_FILES += \
$(MACHINE)/boot/zImage \
$(MACHINE)/boot/compressed/decompress.bin \
$(MACHINE)/boot/compressed/piggy.gz \
$(MACHINE)/boot/rescue/rescue.bin \
$(SRC_ARCH)/.links \
$(srctree)/include/asm-$(ARCH)/.arch
MRPROPER_FILES += \
$(SRC_ARCH)/drivers \
$(SRC_ARCH)/boot \
$(SRC_ARCH)/lib \
$(SRC_ARCH)/arch \
$(SRC_ARCH)/kernel/vmlinux.lds.S \
$(SRC_ARCH)/kernel/asm-offsets.c
define archhelp
echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
echo '* Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
endef
if ETRAX_ARCH_V10
menu "CRIS v10 options"
# ETRAX 100LX v1 has a MMU "feature" requiring a low mapping
config CRIS_LOW_MAP
bool
......@@ -228,69 +230,6 @@ config ETRAX_LED12R
For products with only one or two controllable LEDs,
set this to same as CONFIG_ETRAX_LED1G (normally 2).
choice
prompt "Product debug-port"
depends on ETRAX_ARCH_V10
default ETRAX_DEBUG_PORT0
config ETRAX_DEBUG_PORT0
bool "Serial-0"
help
Choose a serial port for the ETRAX debug console. Default to
port 0.
config ETRAX_DEBUG_PORT1
bool "Serial-1"
help
Use serial port 1 for the console.
config ETRAX_DEBUG_PORT2
bool "Serial-2"
help
Use serial port 2 for the console.
config ETRAX_DEBUG_PORT3
bool "Serial-3"
help
Use serial port 3 for the console.
config ETRAX_DEBUG_PORT_NULL
bool "disabled"
help
Disable serial-port debugging.
endchoice
choice
prompt "Kernel GDB port"
depends on ETRAX_KGDB
default ETRAX_KGDB_PORT0
help
Choose a serial port for kernel debugging. NOTE: This port should
not be enabled under Drivers for built-in interfaces (as it has its
own initialization code) and should not be the same as the debug port.
config ETRAX_KGDB_PORT0
bool "Serial-0"
help
Use serial port 0 for kernel debugging.
config ETRAX_KGDB_PORT1
bool "Serial-1"
help
Use serial port 1 for kernel debugging.
config ETRAX_KGDB_PORT2
bool "Serial-2"
help
Use serial port 2 for kernel debugging.
config ETRAX_KGDB_PORT3
bool "Serial-3"
help
Use serial port 3 for kernel debugging.
endchoice
choice
prompt "Product rescue-port"
......@@ -454,4 +393,6 @@ config ETRAX_POWERBUTTON_BIT
help
Configure where power button is connected.
endmenu
endif
#
# arch/cris/boot/Makefile
# arch/cris/arch-v10/boot/Makefile
#
target = $(target_boot_dir)
src = $(src_boot_dir)
zImage: compressed/vmlinuz
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
compressed/vmlinuz:
@$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz
subdir- := compressed rescue
targets := Image
clean:
@$(MAKE) -f $(src)/compressed/Makefile clean
$(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
$(obj)/compressed/vmlinux: $(obj)/Image FORCE
$(Q)$(MAKE) $(build)=$(obj)/compressed $@
$(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
$(obj)/zImage: $(obj)/compressed/vmlinux
@cp $< $@
@echo ' Kernel: $@ is ready'
#
# create a compressed vmlinuz image from the binary vmlinux.bin file
# arch/cris/arch-v10/boot/compressed/Makefile
#
target = $(target_compressed_dir)
src = $(src_compressed_dir)
CC = gcc-cris -melf $(LINUXINCLUDE)
CFLAGS = -O2
ccflags-y += -O2
LD = ld-cris
ldflags-y += -T $(obj)/decompress.ld
OBJECTS = $(obj)/head.o $(obj)/misc.o
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
OBJECTS = $(target)/head.o $(target)/misc.o
# files to compress
SYSTEM = $(objtree)/vmlinux.bin
quiet_cmd_image = BUILD $@
cmd_image = cat $(obj)/decompress.bin $(obj)/piggy.gz > $@
all: $(target_compressed_dir)/vmlinuz
targets := vmlinux piggy.gz decompress.o decompress.bin
$(target)/decompress.bin: $(OBJECTS)
$(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
$(obj)/decompress.o: $(OBJECTS) FORCE
$(call if_changed,ld)
# Create vmlinuz image in top-level build directory
$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
@echo " COMPR vmlinux.bin --> vmlinuz"
@cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
@rm -f piggy.img
$(obj)/decompress.bin: $(obj)/decompress.o FORCE
$(call if_changed,objcopy)
$(target)/head.o: $(src)/head.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
$(obj)/head.o: $(obj)/head.S .config
@$(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
$(target)/misc.o: $(src)/misc.c
$(CC) -D__KERNEL__ -c $< -o $@
$(obj)/misc.o: $(obj)/misc.c .config
@$(CC) -D__KERNEL__ -c $< -o $@
# gzip the kernel image
$(obj)/vmlinux: $(obj)/piggy.gz $(obj)/decompress.bin FORCE
$(call if_changed,image)
piggy.img: $(SYSTEM)
@cat $(SYSTEM) | gzip -f -9 > piggy.img
$(target):
mkdir -p $(target)
clean:
rm -f piggy.img $(objtree)/vmlinuz
$(obj)/piggy.gz: $(obj)/../Image FORCE
$(call if_changed,gzip)
/*
* misc.c
*
* $Id: misc.c,v 1.6 2003/10/27 08:04:31 starvik Exp $
*
* This is a collection of several routines from gzip-1.0.3
* This is a collection of several routines from gzip-1.0.3
* adapted for Linux.
*
* malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
* puts by Nick Holloway 1993, better puts by Martin Mares 1995
* adaptation for Linux/CRIS Axis Communications AB, 1999
*
*
*/
/* where the piggybacked kernel image expects itself to live.
......
#
# Makefile for rescue code
# Makefile for rescue (bootstrap) code
#
target = $(target_rescue_dir)
src = $(src_rescue_dir)
CC = gcc-cris -mlinux $(LINUXINCLUDE)
CFLAGS = -O2
ccflags-y += -O2
asflags-y += -traditional
LD = gcc-cris -mlinux -nostdlib
ldflags-y += -T $(obj)/rescue.ld
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
obj-$(CONFIG_ETRAX_AXISFLASHMAP) = head.o
OBJECT := $(obj)/head.o
all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
targets := rescue.o rescue.bin
$(target)/rescue.bin: $(target) $(target)/head.o
$(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
# Place a copy in top-level build directory
cp -p $(target)/rescue.bin $(objtree)
$(obj)/rescue.o: $(OBJECT) FORCE
$(call if_changed,ld)
$(target)/testrescue.bin: $(target) $(target)/testrescue.o
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
$(obj)/rescue.bin: $(obj)/rescue.o FORCE
$(call if_changed,objcopy)
cp -p $(obj)/rescue.bin $(objtree)
$(obj)/testrescue.bin: $(obj)/testrescue.o
$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/testrescue.o tr.bin
# Pad it to 784 bytes
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat tr.bin tmp2423 >testrescue_tmp.bin
dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
dd if=testrescue_tmp.bin of=$(obj)/testrescue.bin bs=1 count=784
rm tr.bin tmp2423 testrescue_tmp.bin
$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
$(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
$(obj)/kimagerescue.bin: $(obj)/kimagerescue.o
$(OBJCOPY) $(OBJCOPYFLAGS) $(obj)/kimagerescue.o ktr.bin
# Pad it to 784 bytes, that's what the rescue loader expects
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
dd if=kimagerescue_tmp.bin of=$(obj)/kimagerescue.bin bs=1 count=784
rm ktr.bin tmp2423 kimagerescue_tmp.bin
$(target):
mkdir -p $(target)
$(target)/head.o: $(src)/head.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
$(target)/testrescue.o: $(src)/testrescue.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
$(target)/kimagerescue.o: $(src)/kimagerescue.S
$(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
clean:
rm -f $(target)/*.o $(target)/*.bin
fastdep:
modules:
modules-install:
/* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $
*
/*
* Rescue code, made to reside at the beginning of the
* flash-memory. when it starts, it checks a partition
* table at the first sector after the rescue sector.
......@@ -23,20 +22,20 @@
* Partition table format:
*
* Code transparency:
*
*
* 2 bytes [opcode 'nop']
* 2 bytes [opcode 'di']
* 4 bytes [opcode 'ba <offset>', 8-bit or 16-bit version]
* 2 bytes [opcode 'nop', delay slot]
*
* Table validation (at +10):
*
* Table validation (at +10):
*
* 2 bytes [magic/version word for partitiontable - 0xef, 0xbe]
* 2 bytes [length of all entries plus the end marker]
* 4 bytes [checksum for the partitiontable itself]
*
* Entries, each with the following format, last has offset -1:
*
* Entries, each with the following format, last has offset -1:
*
* 4 bytes [offset in bytes, from start of flash]
* 4 bytes [length in bytes of partition]
* 4 bytes [checksum, simple longword sum]
......@@ -47,9 +46,9 @@
* End marker
*
* 4 bytes [-1]
*
*
* 10 bytes [0, padding]
*
*
* Bit 0 in flags signifies RW or RO. The rescue code only bothers
* to check the checksum for RO partitions, since the others will
* change their data without updating the checksums. A 1 in bit 0
......@@ -59,26 +58,29 @@
*
* During the wait for serial input, the status LED will flash so the
* user knows something went wrong.
*
* Copyright (C) 1999, 2000, 2001, 2002, 2003 Axis Communications AB
*
* Copyright (C) 1999-2007 Axis Communications AB
*/
#ifdef CONFIG_ETRAX_AXISFLASHMAP
#define ASSEMBLER_MACROS_ONLY
#include <asm/arch/sv_addr_ag.h>
;; The partitiontable is looked for at the first sector after the boot
;; sector. Sector size is 65536 bytes in all flashes we use.
#define PTABLE_START CONFIG_ETRAX_PTABLE_SECTOR
#define PTABLE_MAGIC 0xbeef
;; The normal Etrax100 on-chip boot ROM does serial boot at 0x380000f0.
;; That is not where we put our downloaded serial boot-code. The length is
;; enough for downloading code that loads the rest of itself (after
;; having setup the DRAM etc). It is the same length as the on-chip
;; ROM loads, so the same host loader can be used to load a rescued
;; product as well as one booted through the Etrax serial boot code.
;; That is not where we put our downloaded serial boot-code.
;; The length is enough for downloading code that loads the rest
;; of itself (after having setup the DRAM etc).
;; It is the same length as the on-chip ROM loads, so the same
;; host loader can be used to load a rescued product as well as
;; one booted through the Etrax serial boot code.
#define CODE_START 0x40000000
#define CODE_LENGTH 784
......@@ -102,7 +104,7 @@
#define SERRECC R_SERIAL2_REC_CTRL
#define SERRDAT R_SERIAL2_REC_DATA
#define SERSTAT R_SERIAL2_STATUS
#endif
#endif
#ifdef CONFIG_ETRAX_RESCUE_SER3
#define SERXOFF R_SERIAL3_XOFF
#define SERBAUD R_SERIAL3_BAUD
......@@ -115,60 +117,61 @@
#define RAM_INIT_MAGIC 0x56902387
.text
;; This is the entry point of the rescue code
;; 0x80000000 if loaded in flash (as it should be)
;; since etrax actually starts at address 2 when booting from flash, we
;; Since etrax actually starts at address 2 when booting from flash, we
;; put a nop (2 bytes) here first so we dont accidentally skip the di
nop
nop
di
jump in_cache ; enter cached area instead
in_cache:
;; first put a jump test to give a possibility of upgrading the rescue code
;; without erasing/reflashing the sector. we put a longword of -1 here and if
;; it is not -1, we jump using the value as jump target. since we can always
;; change 1's to 0's without erasing the sector, it is possible to add new
;; First put a jump test to give a possibility of upgrading the
;; rescue code without erasing/reflashing the sector.
;; We put a longword of -1 here and if it is not -1, we jump using
;; the value as jump target. Since we can always change 1's to 0's
;; without erasing the sector, it is possible to add new
;; code after this and altering the jumptarget in an upgrade.
jtcd: move.d [jumptarget], $r0
cmp.d 0xffffffff, $r0
beq no_newjump
nop
jump [$r0]
jumptarget:
jumptarget:
.dword 0xffffffff ; can be overwritten later to insert new code
no_newjump:
#ifdef CONFIG_ETRAX_ETHERNET
#ifdef CONFIG_ETRAX_ETHERNET
;; Start MII clock to make sure it is running when tranceiver is reset
move.d 0x3, $r0 ; enable = on, phy = mii_clk
move.d $r0, [R_NETWORK_GEN_CONFIG]
#endif
;; We need to setup the bus registers before we start using the DRAM
#include "../../lib/dram_init.S"
;; we now should go through the checksum-table and check the listed
;; partitions for errors.
move.d PTABLE_START, $r3
move.d [$r3], $r0
cmp.d NOP_DI, $r0 ; make sure the nop/di is there...
bne do_rescue
nop
;; skip the code transparency block (10 bytes).
addq 10, $r3
;; check for correct magic
move.w [$r3+], $r0
cmp.w PTABLE_MAGIC, $r0
bne do_rescue ; didn't recognize - trig rescue
......@@ -186,11 +189,11 @@ no_newjump:
cmp.d $r0, $r4
bne do_rescue ; didn't match - trig rescue
nop
;; ptable is ok. validate each entry.
moveq -1, $r7
ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
bne notfirst ; check if it is the partition containing ptable
nop ; yes..
......@@ -199,7 +202,7 @@ ploop: move.d [$r3+], $r1 ; partition offset (from ptable start)
sub.d $r8, $r2 ; minus the ptable length
ba bosse
nop
notfirst:
notfirst:
cmp.d -1, $r1 ; the end of the ptable ?
beq flash_ok ; if so, the flash is validated
move.d [$r3+], $r2 ; partition length
......@@ -213,47 +216,46 @@ bosse: move.d [$r3+], $r5 ; checksum
bpl 1f
nop
move.d $r1, $r7 ; remember boot partition offset
1:
1:
add.d PTABLE_START, $r1
jsr checksum ; checksum the partition
cmp.d $r0, $r5
beq ploop ; checksums matched, go to next entry
nop
;; otherwise fall through to the rescue code.
do_rescue:
;; setup port PA and PB default initial directions and data
;; (so we can flash LEDs, and so that DTR and others are set)
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
move.b $r0, [R_PORT_PA_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
move.b $r0, [R_PORT_PA_DATA]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
move.b $r0, [R_PORT_PB_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
move.b $r0, [R_PORT_PB_DATA]
;; setup the serial port at 115200 baud
moveq 0, $r0
move.d $r0, [SERXOFF]
move.d $r0, [SERXOFF]
move.b 0x99, $r0
move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
move.b 0x40, $r0 ; rec enable
move.b $r0, [SERRECC]
move.b 0x40, $r0 ; rec enable
move.b $r0, [SERRECC]
moveq 0, $r1 ; "timer" to clock out a LED red flash
move.d CODE_START, $r3 ; destination counter
movu.w CODE_LENGTH, $r4; length
wait_ser:
addq 1, $r1
#ifndef CONFIG_ETRAX_NO_LEDS
......@@ -272,20 +274,20 @@ wait_ser:
nop
1: not $r0 ; clear bit
and.d $r0, $r2
2:
2:
#ifdef CONFIG_ETRAX_PA_LEDS
move.b $r2, [R_PORT_PA_DATA]
#endif
move.b $r2, [R_PORT_PA_DATA]
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b $r2, [R_PORT_PB_DATA]
move.b $r2, [R_PORT_PB_DATA]
#endif
#ifdef CONFIG_ETRAX_90000000_LEDS
move.b $r2, [0x90000000]
#endif
#endif
;; check if we got something on the serial port
move.b [SERSTAT], $r0
btstq 0, $r0 ; data_avail
bpl wait_ser
......@@ -295,14 +297,15 @@ wait_ser:
move.b [SERRDAT], $r0
move.b $r0, [$r3+]
subq 1, $r4 ; decrease length
bne wait_ser
nop
;; jump into downloaded code
move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is initialized
move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
; initialized
jump CODE_START
flash_ok:
......@@ -313,7 +316,8 @@ flash_ok:
nop
move.d PTABLE_START, $r7; otherwise use the ptable start
1:
move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is initialized
move.d RAM_INIT_MAGIC, $r8 ; Tell next product that DRAM is
; initialized
jump $r7 ; boot!
......@@ -327,7 +331,8 @@ checksum:
moveq 0, $r0
moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
;; If the first physical flash memory is exceeded wrap to the second one.
;; If the first physical flash memory is exceeded wrap to the
;; second one
btstq 26, $r1 ; Are we addressing first flash?
bpl 1f
nop
......@@ -351,3 +356,5 @@ checksum:
3: move.d MEM_CSE1_START, $r1 ; wrap to second flash
ba 2b
nop
#endif
/* $Id: kimagerescue.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $
*
/*
* Rescue code to be prepended on a kimage and copied to the
* rescue serial port.
* This is called from the rescue code, it will copy received data to
......@@ -7,13 +6,13 @@
*/
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
#include <asm/arch/sv_addr_ag.h>
#define CODE_START 0x40004000
#define CODE_LENGTH 784
#define TIMEOUT_VALUE 1000
#ifdef CONFIG_ETRAX_RESCUE_SER0
#define SERXOFF R_SERIAL0_XOFF
#define SERBAUD R_SERIAL0_BAUD
......@@ -34,7 +33,7 @@
#define SERRECC R_SERIAL2_REC_CTRL
#define SERRDAT R_SERIAL2_REC_DATA
#define SERSTAT R_SERIAL2_STATUS
#endif
#endif
#ifdef CONFIG_ETRAX_RESCUE_SER3
#define SERXOFF R_SERIAL3_XOFF
#define SERBAUD R_SERIAL3_BAUD
......@@ -48,54 +47,55 @@
;; 0x80000000 if loaded in flash (as it should be)
;; since etrax actually starts at address 2 when booting from flash, we
;; put a nop (2 bytes) here first so we dont accidentally skip the di
nop
nop
di
#ifndef CONFIG_SVINTO_SIM
#ifndef CONFIG_SVINTO_SIM
;; setup port PA and PB default initial directions and data
;; (so we can flash LEDs, and so that DTR and others are set)
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DIR, $r0
move.b $r0, [R_PORT_PA_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PA_DATA, $r0
move.b $r0, [R_PORT_PA_DATA]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DIR, $r0
move.b $r0, [R_PORT_PB_DIR]
move.b CONFIG_ETRAX_DEF_R_PORT_PB_DATA, $r0
move.b $r0, [R_PORT_PB_DATA]
;; We need to setup the bus registers before we start using the DRAM
#include "../../lib/dram_init.S"
#endif
;; Setup the stack to a suitably high address.
;; We assume 8 MB is the minimum DRAM in an eLinux
;; product and put the sp at the top for now.
move.d 0x40800000, $sp
;; setup the serial port at 115200 baud
moveq 0, $r0
move.d $r0, [SERXOFF]
move.d $r0, [SERXOFF]
move.b 0x99, $r0
move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit and receive
move.b $r0, [SERBAUD] ; 115.2kbaud for both transmit
; and receive
move.b 0x40, $r0 ; rec enable
move.b $r0, [SERRECC]
move.b $r0, [SERRECC]
moveq 0, $r1 ; "timer" to clock out a LED red flash
move.d CODE_START, $r3 ; destination counter
moveq 0, $r1 ; "timer" to clock out a LED red flash
move.d CODE_START, $r3 ; destination counter
move.d CODE_LENGTH, $r4 ; length
move.d TIMEOUT_VALUE, $r5 ; "timeout" until jump
wait_ser:
addq 1, $r1
subq 1, $r5 ; decrease timeout
beq jump_start ; timed out
subq 1, $r5 ; decrease timeout
beq jump_start ; timed out
nop
#ifndef CONFIG_ETRAX_NO_LEDS
#ifdef CONFIG_ETRAX_PA_LEDS
......@@ -111,21 +111,21 @@ wait_ser:
or.d $r0, $r2 ; set bit
ba 2f
nop
1: not $r0 ; clear bit
1: not $r0 ; clear bit
and.d $r0, $r2
2:
2:
#ifdef CONFIG_ETRAX_PA_LEDS
move.b $r2, [R_PORT_PA_DATA]
#endif
#endif
#ifdef CONFIG_ETRAX_PB_LEDS
move.b $r2, [R_PORT_PB_DATA]
#endif
#endif
;; check if we got something on the serial port
move.b [SERSTAT], $r0
btstq 0, $r0 ; data_avail
btstq 0, $r0 ; data_avail
bpl wait_ser
nop
......@@ -134,7 +134,7 @@ wait_ser:
move.b [SERRDAT], $r0
move.b $r0, [$r3+]
move.d TIMEOUT_VALUE, $r5 ; reset "timeout"
subq 1, $r4 ; decrease length
subq 1, $r4 ; decrease length
bne wait_ser
nop
jump_start:
......
/* $Id: testrescue.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $
*
/*
* Simple testcode to download by the rescue block.
* Just lits some LEDs to show it was downloaded correctly.
*
* Just lights some LEDs to show it was downloaded correctly.
*
* Copyright (C) 1999 Axis Communications AB
*/
#define ASSEMBLER_MACROS_ONLY
#include <asm/sv_addr_ag.h>
#include <asm/arch/sv_addr_ag.h>
.text
......@@ -16,11 +15,10 @@
moveq -1, $r2
move.b $r2, [R_PORT_PA_DIR]
moveq 0, $r2
move.b $r2, [R_PORT_PA_DATA]
move.b $r2, [R_PORT_PA_DATA]
endless:
nop
ba endless
nop
......@@ -9,37 +9,6 @@ config ETRAX_ETHERNET
This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
controller.
choice
prompt "Network LED behavior"
depends on ETRAX_ETHERNET
default ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
config ETRAX_NETWORK_LED_ON_WHEN_LINK
bool "LED_on_when_link"
help
Selecting LED_on_when_link will light the LED when there is a
connection and will flash off when there is activity.
Selecting LED_on_when_activity will light the LED only when
there is activity.
This setting will also affect the behaviour of other activity LEDs
e.g. Bluetooth.
config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
bool "LED_on_when_activity"
help
Selecting LED_on_when_link will light the LED when there is a
connection and will flash off when there is activity.
Selecting LED_on_when_activity will light the LED only when
there is activity.
This setting will also affect the behaviour of other activity LEDs
e.g. Bluetooth.
endchoice
config ETRAX_SERIAL
bool "Serial-port support"
depends on ETRAX_ARCH_V10
......@@ -83,32 +52,6 @@ config ETRAX_SERIAL_PORT0
Normally you want this on, unless you use external DMA 1 that uses
the same DMA channels.
choice
prompt "Ser0 DMA out assignment"
depends on ETRAX_SERIAL_PORT0
default ETRAX_SERIAL_PORT0_DMA6_OUT
config ETRAX_SERIAL_PORT0_NO_DMA_OUT
bool "No DMA out"
config ETRAX_SERIAL_PORT0_DMA6_OUT
bool "DMA 6"
endchoice
choice
prompt "Ser0 DMA in assignment"
depends on ETRAX_SERIAL_PORT0
default ETRAX_SERIAL_PORT0_DMA7_IN
config ETRAX_SERIAL_PORT0_NO_DMA_IN
bool "No DMA in"
config ETRAX_SERIAL_PORT0_DMA7_IN
bool "DMA 7"
endchoice
choice
prompt "Ser0 DTR, RI, DSR and CD assignment"
depends on ETRAX_SERIAL_PORT0
......@@ -197,32 +140,6 @@ config ETRAX_SERIAL_PORT1
help
Enables the ETRAX 100 serial driver for ser1 (ttyS1).
choice
prompt "Ser1 DMA out assignment"
depends on ETRAX_SERIAL_PORT1
default ETRAX_SERIAL_PORT1_DMA8_OUT
config ETRAX_SERIAL_PORT1_NO_DMA_OUT
bool "No DMA out"
config ETRAX_SERIAL_PORT1_DMA8_OUT
bool "DMA 8"
endchoice
choice
prompt "Ser1 DMA in assignment"
depends on ETRAX_SERIAL_PORT1
default ETRAX_SERIAL_PORT1_DMA9_IN
config ETRAX_SERIAL_PORT1_NO_DMA_IN
bool "No DMA in"
config ETRAX_SERIAL_PORT1_DMA9_IN
bool "DMA 9"
endchoice
choice
prompt "Ser1 DTR, RI, DSR and CD assignment"
depends on ETRAX_SERIAL_PORT1
......@@ -314,32 +231,6 @@ config ETRAX_SERIAL_PORT2
help
Enables the ETRAX 100 serial driver for ser2 (ttyS2).
choice
prompt "Ser2 DMA out assignment"
depends on ETRAX_SERIAL_PORT2
default ETRAX_SERIAL_PORT2_DMA2_OUT
config ETRAX_SERIAL_PORT2_NO_DMA_OUT
bool "No DMA out"
config ETRAX_SERIAL_PORT2_DMA2_OUT
bool "DMA 2"
endchoice
choice
prompt "Ser2 DMA in assignment"
depends on ETRAX_SERIAL_PORT2
default ETRAX_SERIAL_PORT2_DMA3_IN
config ETRAX_SERIAL_PORT2_NO_DMA_IN
bool "No DMA in"
config ETRAX_SERIAL_PORT2_DMA3_IN
bool "DMA 3"
endchoice
choice
prompt "Ser2 DTR, RI, DSR and CD assignment"
depends on ETRAX_SERIAL_PORT2
......@@ -428,32 +319,6 @@ config ETRAX_SERIAL_PORT3
help
Enables the ETRAX 100 serial driver for ser3 (ttyS3).
choice
prompt "Ser3 DMA out assignment"
depends on ETRAX_SERIAL_PORT3
default ETRAX_SERIAL_PORT3_DMA4_OUT
config ETRAX_SERIAL_PORT3_NO_DMA_OUT
bool "No DMA out"
config ETRAX_SERIAL_PORT3_DMA4_OUT
bool "DMA 4"
endchoice
choice
prompt "Ser3 DMA in assignment"
depends on ETRAX_SERIAL_PORT3
default ETRAX_SERIAL_PORT3_DMA5_IN
config ETRAX_SERIAL_PORT3_NO_DMA_IN
bool "No DMA in"
config ETRAX_SERIAL_PORT3_DMA5_IN
bool "DMA 5"
endchoice
choice
prompt "Ser3 DTR, RI, DSR and CD assignment"
depends on ETRAX_SERIAL_PORT3
......@@ -563,21 +428,6 @@ config ETRAX_USB_HOST_PORT2
depends on ETRAX_USB_HOST
default n
config ETRAX_AXISFLASHMAP
bool "Axis flash-map support"
depends on ETRAX_ARCH_V10
select MTD
select MTD_CFI
select MTD_CFI_AMDSTD
select MTD_CHAR
select MTD_BLOCK
select MTD_PARTITIONS
select MTD_CONCAT
select MTD_COMPLEX_MAPPINGS
help
This option enables MTD mapping of flash devices. Needed to use
flash memories. If unsure, say Y.
config ETRAX_PTABLE_SECTOR
int "Byte-offset of partition table sector"
depends on ETRAX_AXISFLASHMAP
......@@ -731,37 +581,6 @@ config ETRAX_PB_CHANGEABLE_BITS
Bit set = changeable.
You probably want 00 here.
config ETRAX_RTC
bool "Real Time Clock support"
depends on ETRAX_ARCH_V10
help
Enables drivers for the Real-Time Clock battery-backed chips on
some products. The kernel reads the time when booting, and
the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc
device, major 121. You can check the time with cat /proc/rtc, but
normal time reading should be done using libc function time and
friends.
choice
prompt "RTC chip"
depends on ETRAX_RTC
default ETRAX_DS1302
config ETRAX_DS1302
bool "DS1302"
help
Enables the driver for the DS1302 Real-Time Clock battery-backed
chip on some products.
config ETRAX_PCF8563
bool "PCF8563"
help
Enables the driver for the PCF8563 Real-Time Clock battery-backed
chip on some products.
endchoice
config ETRAX_DS1302_RST_ON_GENERIC_PORT
bool "DS1302 RST on Generic Port"
depends on ETRAX_DS1302
......
......@@ -2,11 +2,11 @@
# Makefile for Etrax-specific drivers
#
obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
obj-$(CONFIG_ETRAX_I2C) += i2c.o
obj-$(CONFIG_ETRAX_I2C_EEPROM) += eeprom.o
obj-$(CONFIG_ETRAX_GPIO) += gpio.o
obj-$(CONFIG_ETRAX_DS1302) += ds1302.o
obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
obj-$(CONFIG_ETRAX_I2C) += i2c.o
obj-$(CONFIG_ETRAX_I2C_EEPROM) += eeprom.o
obj-$(CONFIG_ETRAX_GPIO) += gpio.o
obj-$(CONFIG_ETRAX_DS1302) += ds1302.o
obj-$(CONFIG_ETRAX_PCF8563) += pcf8563.o
obj-$(CONFIG_ETRAX_SYNCHRONOUS_SERIAL) += sync_serial.o
......@@ -10,129 +10,6 @@
* tells us what other partitions to define. If there isn't, we use a default
* partition split defined below.
*
* $Log: axisflashmap.c,v $
* Revision 1.11 2004/11/15 10:27:14 starvik
* Corrected typo (Thanks to Milton Miller <miltonm@bga.com>).
*
* Revision 1.10 2004/08/16 12:37:22 starvik
* Merge of Linux 2.6.8
*
* Revision 1.8 2004/05/14 07:58:03 starvik
* Merge of changes from 2.4
*
* Revision 1.6 2003/07/04 08:27:37 starvik
* Merge of Linux 2.5.74
*
* Revision 1.5 2002/12/11 13:13:57 starvik
* Added arch/ to v10 specific includes
* Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
*
* Revision 1.4 2002/11/20 11:56:10 starvik
* Merge of Linux 2.5.48
*
* Revision 1.3 2002/11/13 14:54:13 starvik
* Copied from linux 2.4
*
* Revision 1.28 2002/10/01 08:08:43 jonashg
* The first partition ends at the start of the partition table.
*
* Revision 1.27 2002/08/21 09:23:13 jonashg
* Speling.
*
* Revision 1.26 2002/08/21 08:35:20 jonashg
* Cosmetic change to printouts.
*
* Revision 1.25 2002/08/21 08:15:42 jonashg
* Made it compile even without CONFIG_MTD_CONCAT defined.
*
* Revision 1.24 2002/08/20 13:12:35 jonashg
* * New approach to probing. Probe cse0 and cse1 separately and (mtd)concat
* the results.
* * Removed compile time tests concerning how the mtdram driver has been
* configured. The user will know about the misconfiguration at runtime
* instead. (The old approach made it impossible to use mtdram for anything
* else than RAM boot).
*
* Revision 1.23 2002/05/13 12:12:28 johana
* Allow compile without CONFIG_MTD_MTDRAM but warn at compiletime and
* be informative at runtime.
*
* Revision 1.22 2002/05/13 10:24:44 johana
* Added #if checks on MTDRAM CONFIG
*
* Revision 1.21 2002/05/06 16:05:20 johana
* Removed debug printout.
*
* Revision 1.20 2002/05/06 16:03:00 johana
* No more cramfs as root hack in generic code.
* It's handled by axisflashmap using mtdram.
*
* Revision 1.19 2002/03/15 17:10:28 bjornw
* Changed comment about cached access since we changed this before
*
* Revision 1.18 2002/03/05 17:06:15 jonashg
* Try amd_flash probe before cfi_probe since amd_flash driver can handle two
* (or more) flash chips of different model and the cfi driver cannot.
*
* Revision 1.17 2001/11/12 19:42:38 pkj
* Fixed compiler warnings.
*
* Revision 1.16 2001/11/08 11:18:58 jonashg
* Always read from uncached address to avoid problems with flushing
* cachelines after write and MTD-erase. No performance loss have been
* seen yet.
*
* Revision 1.15 2001/10/19 12:41:04 jonashg
* Name of probe has changed in MTD.
*
* Revision 1.14 2001/09/21 07:14:10 jonashg
* Made root filesystem (cramfs) use mtdblock driver when booting from flash.
*
* Revision 1.13 2001/08/15 13:57:35 jonashg
* Entire MTD updated to the linux 2.4.7 version.
*
* Revision 1.12 2001/06/11 09:50:30 jonashg
* Oops, 2MB is 0x200000 bytes.
*
* Revision 1.11 2001/06/08 11:39:44 jonashg
* Changed sizes and offsets in axis_default_partitions to use
* CONFIG_ETRAX_PTABLE_SECTOR.
*
* Revision 1.10 2001/05/29 09:42:03 jonashg
* Use macro for end marker length instead of sizeof.
*
* Revision 1.9 2001/05/29 08:52:52 jonashg
* Gave names to the magic fours (size of the ptable end marker).
*
* Revision 1.8 2001/05/28 15:36:20 jonashg
* * Removed old comment about ptable location in flash (it's a CONFIG_ option).
* * Variable ptable was initialized twice to the same value.
*
* Revision 1.7 2001/04/05 13:41:46 markusl
* Updated according to review remarks
*
* Revision 1.6 2001/03/07 09:21:21 bjornw
* No need to waste .data
*
* Revision 1.5 2001/03/06 16:27:01 jonashg
* Probe the entire flash area for flash devices.
*
* Revision 1.4 2001/02/23 12:47:15 bjornw
* Uncached flash in LOW_MAP moved from 0xe to 0x8
*
* Revision 1.3 2001/02/16 12:11:45 jonashg
* MTD driver amd_flash is now included in MTD CVS repository.
* (It's now in drivers/mtd).
*
* Revision 1.2 2001/02/09 11:12:22 jonashg
* Support for AMD compatible non-CFI flash chips.
* Only tested with Toshiba TC58FVT160 so far.
*
* Revision 1.1 2001/01/12 17:01:18 bjornw
* * Added axisflashmap.c, a physical mapping for MTD that reads and understands
* Axis partition-table format.
*
*
*/
#include <linux/module.h>
......@@ -235,7 +112,7 @@ static struct map_info map_cse1 = {
};
/* If no partition-table was found, we use this default-set. */
#define MAX_PARTITIONS 7
#define MAX_PARTITIONS 7
#define NUM_DEFAULT_PARTITIONS 3
/*
......@@ -300,6 +177,15 @@ static struct mtd_partition axis_partitions[MAX_PARTITIONS] = {
},
};
#ifdef CONFIG_ETRAX_AXISFLASHMAP_MTD0WHOLE
/* Main flash device */
static struct mtd_partition main_partition = {
.name = "main",
.size = 0,
.offset = 0
};
#endif
/*
* Probe a chip select for AMD-compatible (JEDEC) or CFI-compatible flash
* chips in that order (because the amd_flash-driver is faster).
......@@ -316,15 +202,14 @@ static struct mtd_info *probe_cs(struct map_info *map_cs)
mtd_cs = do_map_probe("cfi_probe", map_cs);
#endif
#ifdef CONFIG_MTD_JEDECPROBE
if (!mtd_cs) {
if (!mtd_cs)
mtd_cs = do_map_probe("jedec_probe", map_cs);
}
#endif
return mtd_cs;
}
/*
/*
* Probe each chip select individually for flash chips. If there are chips on
* both cse0 and cse1, the mtd_info structs will be concatenated to one struct
* so that MTD partitions can cross chip boundries.
......@@ -351,7 +236,7 @@ static struct mtd_info *flash_probe(void)
if (mtd_cse0 && mtd_cse1) {
#ifdef CONFIG_MTD_CONCAT
struct mtd_info *mtds[] = { mtd_cse0, mtd_cse1 };
/* Since the concatenation layer adds a small overhead we
* could try to figure out if the chips in cse0 and cse1 are
* identical and reprobe the whole cse0+cse1 window. But since
......@@ -372,7 +257,7 @@ static struct mtd_info *flash_probe(void)
/* The best we can do now is to only use what we found
* at cse0.
*/
*/
mtd_cse = mtd_cse0;
map_destroy(mtd_cse1);
}
......@@ -395,7 +280,7 @@ static int __init init_axis_flash(void)
struct partitiontable_head *ptable_head = NULL;
struct partitiontable_entry *ptable;
int use_default_ptable = 1; /* Until proven otherwise. */
const char *pmsg = " /dev/flash%d at 0x%08x, size 0x%08x\n";
const char pmsg[] = " /dev/flash%d at 0x%08x, size 0x%08x\n";
if (!(mymtd = flash_probe())) {
/* There's no reason to use this module if no flash chip can
......@@ -435,7 +320,7 @@ static int __init init_axis_flash(void)
unsigned long offset = CONFIG_ETRAX_PTABLE_SECTOR;
unsigned char *p;
unsigned long csum = 0;
ptable = (struct partitiontable_entry *)
((unsigned long)ptable_head + sizeof(*ptable_head));
......@@ -490,6 +375,16 @@ static int __init init_axis_flash(void)
pidx++;
}
#ifdef CONFIG_ETRAX_AXISFLASHMAP_MTD0WHOLE
if (mymtd) {
main_partition.size = mymtd->size;
err = add_mtd_partitions(mymtd, &main_partition, 1);
if (err)
panic("axisflashmap: Could not initialize "
"partition for whole main mtd device!\n");
}
#endif
if (mymtd) {
if (use_default_ptable) {
printk(KERN_INFO " Using default partition table.\n");
......@@ -499,9 +394,8 @@ static int __init init_axis_flash(void)
err = add_mtd_partitions(mymtd, axis_partitions, pidx);
}
if (err) {
if (err)
panic("axisflashmap could not add MTD partitions!\n");
}
}
if (!romfs_in_flash) {
......@@ -515,25 +409,24 @@ static int __init init_axis_flash(void)
#else
struct mtd_info *mtd_ram;
mtd_ram = kmalloc(sizeof(struct mtd_info),
GFP_KERNEL);
if (!mtd_ram) {
mtd_ram = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
if (!mtd_ram)
panic("axisflashmap couldn't allocate memory for "
"mtd_info!\n");
}
printk(KERN_INFO " Adding RAM partition for romfs image:\n");
printk(pmsg, pidx, romfs_start, romfs_length);
err = mtdram_init_device(mtd_ram, (void*)romfs_start,
romfs_length, "romfs");
if (err) {
printk(pmsg, pidx, (unsigned)romfs_start,
(unsigned)romfs_length);
err = mtdram_init_device(mtd_ram,
(void *)romfs_start,
romfs_length,
"romfs");
if (err)
panic("axisflashmap could not initialize MTD RAM "
"device!\n");
}
#endif
}
return err;
}
......
......@@ -333,7 +333,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
ds1302_writereg(RTC_TRICKLECHARGER, tcs_val);
return 0;
}
case RTC_VLOW_RD:
case RTC_VL_READ:
{
/* TODO:
* Implement voltage low detection support
......@@ -342,7 +342,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
" is not supported\n");
return 0;
}
case RTC_VLOW_SET:
case RTC_VL_CLR:
{
/* TODO:
* Nothing to do since Voltage Low detection is not supported
......
......@@ -19,77 +19,6 @@
*! Sep 03 1999 Edgar Iglesias Added bail-out stuff if we get interrupted
*! in the spin-lock.
*!
*! $Log: eeprom.c,v $
*! Revision 1.12 2005/06/19 17:06:46 starvik
*! Merge of Linux 2.6.12.
*!
*! Revision 1.11 2005/01/26 07:14:46 starvik
*! Applied diff from kernel janitors (Nish Aravamudan).
*!
*! Revision 1.10 2003/09/11 07:29:48 starvik
*! Merge of Linux 2.6.0-test5
*!
*! Revision 1.9 2003/07/04 08:27:37 starvik
*! Merge of Linux 2.5.74
*!
*! Revision 1.8 2003/04/09 05:20:47 starvik
*! Merge of Linux 2.5.67
*!
*! Revision 1.6 2003/02/10 07:19:28 starvik
*! Removed misplaced ;
*!
*! Revision 1.5 2002/12/11 13:13:57 starvik
*! Added arch/ to v10 specific includes
*! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
*!
*! Revision 1.4 2002/11/20 11:56:10 starvik
*! Merge of Linux 2.5.48
*!
*! Revision 1.3 2002/11/18 13:16:06 starvik
*! Linux 2.5 port of latest 2.4 drivers
*!
*! Revision 1.8 2001/06/15 13:24:29 jonashg
*! * Added verification of pointers from userspace in read and write.
*! * Made busy counter volatile.
*! * Added define for initial write delay.
*! * Removed warnings by using loff_t instead of unsigned long.
*!
*! Revision 1.7 2001/06/14 15:26:54 jonashg
*! Removed test because condition is always true.
*!
*! Revision 1.6 2001/06/14 15:18:20 jonashg
*! Kb -> kB (makes quite a difference if you don't know if you have 2k or 16k).
*!
*! Revision 1.5 2001/06/14 14:39:51 jonashg
*! Forgot to use name when registering the driver.
*!
*! Revision 1.4 2001/06/14 14:35:47 jonashg
*! * Gave driver a name and used it in printk's.
*! * Cleanup.
*!
*! Revision 1.3 2001/03/19 16:04:46 markusl
*! Fixed init of fops struct
*!
*! Revision 1.2 2001/03/19 10:35:07 markusl
*! 2.4 port of eeprom driver
*!
*! Revision 1.8 2000/05/18 10:42:25 edgar
*! Make sure to end write cycle on _every_ write
*!
*! Revision 1.7 2000/01/17 17:41:01 johana
*! Adjusted probing and return -ENOSPC when writing outside EEPROM
*!
*! Revision 1.6 2000/01/17 15:50:36 johana
*! Added adaptive timing adjustments and fixed autoprobing for 2k and 16k(?)
*! EEPROMs
*!
*! Revision 1.5 1999/09/03 15:07:37 edgar
*! Added bail-out check to the spinlock
*!
*! Revision 1.4 1999/09/03 12:11:17 bjornw
*! Proper atomicity (need to use spinlocks, not if's). users -> busy.
*!
*!
*! (c) 1999 Axis Communications AB, Lund, Sweden
*!*****************************************************************************/
......@@ -103,10 +32,10 @@
#include <asm/uaccess.h>
#include "i2c.h"
#define D(x)
#define D(x)
/* If we should use adaptive timing or not: */
//#define EEPROM_ADAPTIVE_TIMING
/* #define EEPROM_ADAPTIVE_TIMING */
#define EEPROM_MAJOR_NR 122 /* use a LOCAL/EXPERIMENTAL major for now */
#define EEPROM_MINOR_NR 0
......
此差异已折叠。
......@@ -6,85 +6,9 @@
*! kernel modules (i2c_writereg/readreg) and from userspace using
*! ioctl()'s
*!
*! Nov 30 1998 Torbjorn Eliasson Initial version.
*! Bjorn Wesen Elinux kernel version.
*! Jan 14 2000 Johan Adolfsson Fixed PB shadow register stuff -
*! don't use PB_I2C if DS1302 uses same bits,
*! use PB.
*! $Log: i2c.c,v $
*! Revision 1.13 2005/03/07 13:13:07 starvik
*! Added spinlocks to protect states etc
*!
*! Revision 1.12 2005/01/05 06:11:22 starvik
*! No need to do local_irq_disable after local_irq_save.
*!
*! Revision 1.11 2004/12/13 12:21:52 starvik
*! Added I/O and DMA allocators from Linux 2.4
*!
*! Revision 1.9 2004/08/24 06:49:14 starvik
*! Whitespace cleanup
*!
*! Revision 1.8 2004/06/08 08:48:26 starvik
*! Removed unused code
*!
*! Revision 1.7 2004/05/28 09:26:59 starvik
*! Modified I2C initialization to work in 2.6.
*!
*! Revision 1.6 2004/05/14 07:58:03 starvik
*! Merge of changes from 2.4
*!
*! Revision 1.4 2002/12/11 13:13:57 starvik
*! Added arch/ to v10 specific includes
*! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer)
*!
*! Revision 1.3 2002/11/20 11:56:11 starvik
*! Merge of Linux 2.5.48
*!
*! Revision 1.2 2002/11/18 13:16:06 starvik
*! Linux 2.5 port of latest 2.4 drivers
*!
*! Revision 1.9 2002/10/31 15:32:26 starvik
*! Update Port B register and shadow even when running with hardware support
*! to avoid glitches when reading bits
*! Never set direction to out in i2c_inbyte
*! Removed incorrect clock toggling at end of i2c_inbyte
*!
*! Revision 1.8 2002/08/13 06:31:53 starvik
*! Made SDA and SCL line configurable
*! Modified i2c_inbyte to work with PCF8563
*!
*! Revision 1.7 2001/04/04 13:11:36 markusl
*! Updated according to review remarks
*!
*! Revision 1.6 2001/03/19 12:43:00 markusl
*! Made some symbols unstatic (used by the eeprom driver)
*!
*! Revision 1.5 2001/02/27 13:52:48 bjornw
*! malloc.h -> slab.h
*!
*! Revision 1.4 2001/02/15 07:17:40 starvik
*! Corrected usage if port_pb_i2c_shadow
*!
*! Revision 1.3 2001/01/26 17:55:13 bjornw
*! * Made I2C_USES_PB_NOT_PB_I2C a CONFIG option instead of assigning it
*! magically. Config.in needs to set it for the options that need it, like
*! Dallas 1302 support. Actually, it should be default since it screws up
*! the PB bits even if you don't use I2C..
*! * Include linux/config.h to get the above
*!
*! Revision 1.2 2001/01/18 15:49:30 bjornw
*! 2.4 port of I2C including some cleanups (untested of course)
*!
*! Revision 1.1 2001/01/18 15:35:25 bjornw
*! Verbatim copy of the Etrax i2c driver, 2.0 elinux version
*!
*!
*! ---------------------------------------------------------------------------
*!
*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
*! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN
*!
*!***************************************************************************/
/* $Id: i2c.c,v 1.13 2005/03/07 13:13:07 starvik Exp $ */
/****************** INCLUDE FILES SECTION ***********************************/
......@@ -622,7 +546,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
* last received byte needs to be nacked
* instead of acked
*/
i2c_sendack();
i2c_sendnack();
/*
* end sequence
*/
......@@ -708,6 +632,7 @@ i2c_init(void)
if (!first) {
return res;
}
first = 0;
/* Setup and enable the Port B I2C interface */
......
......@@ -8,14 +8,13 @@
* low detector are also provided. All address and data are transferred
* serially via two-line bidirectional I2C-bus. Maximum bus speed is
* 400 kbits/s. The built-in word address register is incremented
* automatically after each written or read bute.
* automatically after each written or read byte.
*
* Copyright (c) 2002, Axis Communications AB
* Copyright (c) 2002-2007, Axis Communications AB
* All rights reserved.
*
* Author: Tobias Anderberg <tobiasa@axis.com>.
*
* $Id: pcf8563.c,v 1.11 2005/03/07 13:13:07 starvik Exp $
*/
#include <linux/module.h>
......@@ -27,19 +26,19 @@
#include <linux/ioctl.h>
#include <linux/delay.h>
#include <linux/bcd.h>
#include <linux/capability.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/arch/svinto.h>
#include <asm/rtc.h>
#include "i2c.h"
#define PCF8563_MAJOR 121 /* Local major number. */
#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
#define PCF8563_MAJOR 121 /* Local major number. */
#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
#define PCF8563_NAME "PCF8563"
#define DRIVER_VERSION "$Revision: 1.11 $"
#define DRIVER_VERSION "$Revision: 1.24 $"
/* I2C bus slave registers. */
#define RTC_I2C_READ 0xa3
......@@ -49,71 +48,88 @@
#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
static DEFINE_SPINLOCK(rtc_lock); /* Protect state etc */
static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
static const unsigned char days_in_month[] =
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
/* Cache VL bit value read at driver init since writing the RTC_SECOND
* register clears the VL status.
*/
static int voltage_low;
static const struct file_operations pcf8563_fops = {
.owner = THIS_MODULE,
.ioctl = pcf8563_ioctl,
};
unsigned char
pcf8563_readreg(int reg)
pcf8563_readreg(int reg)
{
unsigned char res = i2c_readreg(RTC_I2C_READ, reg);
/* The PCF8563 does not return 0 for unimplemented bits */
switch(reg)
{
case RTC_SECONDS:
case RTC_MINUTES:
res &= 0x7f;
break;
case RTC_HOURS:
case RTC_DAY_OF_MONTH:
res &= 0x3f;
break;
case RTC_MONTH:
res = (res & 0x1f) - 1; /* PCF8563 returns month in range 1-12 */
break;
unsigned char res = rtc_read(reg);
/* The PCF8563 does not return 0 for unimplemented bits. */
switch (reg) {
case RTC_SECONDS:
case RTC_MINUTES:
res &= 0x7F;
break;
case RTC_HOURS:
case RTC_DAY_OF_MONTH:
res &= 0x3F;
break;
case RTC_WEEKDAY:
res &= 0x07;
break;
case RTC_MONTH:
res &= 0x1F;
break;
case RTC_CONTROL1:
res &= 0xA8;
break;
case RTC_CONTROL2:
res &= 0x1F;
break;
case RTC_CLOCKOUT_FREQ:
case RTC_TIMER_CONTROL:
res &= 0x83;
break;
}
return res;
}
void
pcf8563_writereg(int reg, unsigned char val)
pcf8563_writereg(int reg, unsigned char val)
{
#ifdef CONFIG_ETRAX_RTC_READONLY
if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR))
return;
#endif
rtc_write(reg, val);
}
void
get_rtc_time(struct rtc_time *tm)
{
tm->tm_sec = rtc_read(RTC_SECONDS);
tm->tm_min = rtc_read(RTC_MINUTES);
tm->tm_sec = rtc_read(RTC_SECONDS);
tm->tm_min = rtc_read(RTC_MINUTES);
tm->tm_hour = rtc_read(RTC_HOURS);
tm->tm_mday = rtc_read(RTC_DAY_OF_MONTH);
tm->tm_mon = rtc_read(RTC_MONTH);
tm->tm_wday = rtc_read(RTC_WEEKDAY);
tm->tm_mon = rtc_read(RTC_MONTH);
tm->tm_year = rtc_read(RTC_YEAR);
if (tm->tm_sec & 0x80)
printk(KERN_WARNING "%s: RTC Low Voltage - date/time is not reliable!\n", PCF8563_NAME);
if (tm->tm_sec & 0x80) {
printk(KERN_ERR "%s: RTC Voltage Low - reliable date/time "
"information is no longer guaranteed!\n", PCF8563_NAME);
}
tm->tm_year = BCD_TO_BIN(tm->tm_year) + ((tm->tm_mon & 0x80) ? 100 : 0);
tm->tm_sec &= 0x7f;
tm->tm_min &= 0x7f;
tm->tm_hour &= 0x3f;
tm->tm_mday &= 0x3f;
tm->tm_mon &= 0x1f;
tm->tm_year = BCD_TO_BIN(tm->tm_year) +
((tm->tm_mon & 0x80) ? 100 : 0);
tm->tm_sec &= 0x7F;
tm->tm_min &= 0x7F;
tm->tm_hour &= 0x3F;
tm->tm_mday &= 0x3F;
tm->tm_wday &= 0x07; /* Not coded in BCD. */
tm->tm_mon &= 0x1F;
BCD_TO_BIN(tm->tm_sec);
BCD_TO_BIN(tm->tm_min);
......@@ -126,17 +142,24 @@ get_rtc_time(struct rtc_time *tm)
int __init
pcf8563_init(void)
{
int ret;
if ((ret = i2c_init())) {
printk(KERN_CRIT "pcf8563_init: failed to init i2c\n");
return ret;
static int res;
static int first = 1;
if (!first)
return res;
first = 0;
/* Initiate the i2c protocol. */
res = i2c_init();
if (res < 0) {
printk(KERN_CRIT "pcf8563_init: Failed to init i2c.\n");
return res;
}
/*
* First of all we need to reset the chip. This is done by
* clearing control1, control2 and clk freq, clear the
* Voltage Low bit, and resetting all alarms.
* clearing control1, control2 and clk freq and resetting
* all alarms.
*/
if (rtc_write(RTC_CONTROL1, 0x00) < 0)
goto err;
......@@ -147,34 +170,36 @@ pcf8563_init(void)
if (rtc_write(RTC_CLOCKOUT_FREQ, 0x00) < 0)
goto err;
/* Clear the VL bit in the seconds register. */
ret = rtc_read(RTC_SECONDS);
if (rtc_write(RTC_SECONDS, (ret & 0x7f)) < 0)
if (rtc_write(RTC_TIMER_CONTROL, 0x03) < 0)
goto err;
/* Reset the alarms. */
if (rtc_write(RTC_MINUTE_ALARM, 0x00) < 0)
if (rtc_write(RTC_MINUTE_ALARM, 0x80) < 0)
goto err;
if (rtc_write(RTC_HOUR_ALARM, 0x00) < 0)
if (rtc_write(RTC_HOUR_ALARM, 0x80) < 0)
goto err;
if (rtc_write(RTC_DAY_ALARM, 0x00) < 0)
if (rtc_write(RTC_DAY_ALARM, 0x80) < 0)
goto err;
if (rtc_write(RTC_WEEKDAY_ALARM, 0x00) < 0)
if (rtc_write(RTC_WEEKDAY_ALARM, 0x80) < 0)
goto err;
/* Check for low voltage, and warn about it.. */
if (rtc_read(RTC_SECONDS) & 0x80)
printk(KERN_WARNING "%s: RTC Low Voltage - date/time is not reliable!\n", PCF8563_NAME);
return 0;
/* Check for low voltage, and warn about it. */
if (rtc_read(RTC_SECONDS) & 0x80) {
voltage_low = 1;
printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
"date/time information is no longer guaranteed!\n",
PCF8563_NAME);
}
return res;
err:
printk(KERN_INFO "%s: Error initializing chip.\n", PCF8563_NAME);
return -1;
res = -1;
return res;
}
void __exit
......@@ -187,8 +212,8 @@ pcf8563_exit(void)
* ioctl calls for this driver. Why return -ENOTTY upon error? Because
* POSIX says so!
*/
int
pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
int pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
/* Some sanity checks. */
if (_IOC_TYPE(cmd) != RTC_MAGIC)
......@@ -198,124 +223,146 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
return -ENOTTY;
switch (cmd) {
case RTC_RD_TIME:
{
struct rtc_time tm;
spin_lock(&rtc_lock);
get_rtc_time(&tm);
if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) {
spin_unlock(&rtc_lock);
return -EFAULT;
}
spin_unlock(&rtc_lock);
return 0;
}
break;
case RTC_SET_TIME:
{
#ifdef CONFIG_ETRAX_RTC_READONLY
return -EPERM;
#else
int leap;
int century;
struct rtc_time tm;
memset(&tm, 0, sizeof (struct rtc_time));
if (!capable(CAP_SYS_TIME))
return -EPERM;
if (copy_from_user(&tm, (struct rtc_time *) arg, sizeof(struct rtc_time)))
return -EFAULT;
/* Convert from struct tm to struct rtc_time. */
tm.tm_year += 1900;
tm.tm_mon += 1;
leap = ((tm.tm_mon == 2) && ((tm.tm_year % 4) == 0)) ? 1 : 0;
/* Perform some sanity checks. */
if ((tm.tm_year < 1970) ||
(tm.tm_mon > 12) ||
(tm.tm_mday == 0) ||
(tm.tm_mday > days_in_month[tm.tm_mon] + leap) ||
(tm.tm_hour >= 24) ||
(tm.tm_min >= 60) ||
(tm.tm_sec >= 60))
return -EINVAL;
century = (tm.tm_year >= 2000) ? 0x80 : 0;
tm.tm_year = tm.tm_year % 100;
BIN_TO_BCD(tm.tm_year);
BIN_TO_BCD(tm.tm_mday);
BIN_TO_BCD(tm.tm_hour);
BIN_TO_BCD(tm.tm_min);
BIN_TO_BCD(tm.tm_sec);
tm.tm_mon |= century;
spin_lock(&rtc_lock);
rtc_write(RTC_YEAR, tm.tm_year);
rtc_write(RTC_MONTH, tm.tm_mon);
rtc_write(RTC_DAY_OF_MONTH, tm.tm_mday);
rtc_write(RTC_HOURS, tm.tm_hour);
rtc_write(RTC_MINUTES, tm.tm_min);
rtc_write(RTC_SECONDS, tm.tm_sec);
spin_unlock(&rtc_lock);
return 0;
#endif /* !CONFIG_ETRAX_RTC_READONLY */
}
case RTC_VLOW_RD:
{
int vl_bit = 0;
if (rtc_read(RTC_SECONDS) & 0x80) {
vl_bit = 1;
printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
"date/time information is no longer guaranteed!\n",
PCF8563_NAME);
}
if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))
return -EFAULT;
return 0;
}
case RTC_RD_TIME:
{
struct rtc_time tm;
case RTC_VLOW_SET:
{
/* Clear the VL bit in the seconds register */
int ret = rtc_read(RTC_SECONDS);
mutex_lock(&rtc_lock);
memset(&tm, 0, sizeof tm);
get_rtc_time(&tm);
rtc_write(RTC_SECONDS, (ret & 0x7F));
if (copy_to_user((struct rtc_time *) arg, &tm,
sizeof tm)) {
spin_unlock(&rtc_lock);
return -EFAULT;
}
mutex_unlock(&rtc_lock);
return 0;
return 0;
}
case RTC_SET_TIME:
{
int leap;
int year;
int century;
struct rtc_time tm;
memset(&tm, 0, sizeof tm);
if (!capable(CAP_SYS_TIME))
return -EPERM;
if (copy_from_user(&tm, (struct rtc_time *) arg, sizeof tm))
return -EFAULT;
/* Convert from struct tm to struct rtc_time. */
tm.tm_year += 1900;
tm.tm_mon += 1;
/*
* Check if tm.tm_year is a leap year. A year is a leap
* year if it is divisible by 4 but not 100, except
* that years divisible by 400 _are_ leap years.
*/
year = tm.tm_year;
leap = (tm.tm_mon == 2) &&
((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
/* Perform some sanity checks. */
if ((tm.tm_year < 1970) ||
(tm.tm_mon > 12) ||
(tm.tm_mday == 0) ||
(tm.tm_mday > days_in_month[tm.tm_mon] + leap) ||
(tm.tm_wday >= 7) ||
(tm.tm_hour >= 24) ||
(tm.tm_min >= 60) ||
(tm.tm_sec >= 60))
return -EINVAL;
century = (tm.tm_year >= 2000) ? 0x80 : 0;
tm.tm_year = tm.tm_year % 100;
BIN_TO_BCD(tm.tm_year);
BIN_TO_BCD(tm.tm_mon);
BIN_TO_BCD(tm.tm_mday);
BIN_TO_BCD(tm.tm_hour);
BIN_TO_BCD(tm.tm_min);
BIN_TO_BCD(tm.tm_sec);
tm.tm_mon |= century;
mutex_lock(&rtc_lock);
rtc_write(RTC_YEAR, tm.tm_year);
rtc_write(RTC_MONTH, tm.tm_mon);
rtc_write(RTC_WEEKDAY, tm.tm_wday); /* Not coded in BCD. */
rtc_write(RTC_DAY_OF_MONTH, tm.tm_mday);
rtc_write(RTC_HOURS, tm.tm_hour);
rtc_write(RTC_MINUTES, tm.tm_min);
rtc_write(RTC_SECONDS, tm.tm_sec);
mutex_unlock(&rtc_lock);
return 0;
}
case RTC_VL_READ:
if (voltage_low) {
printk(KERN_ERR "%s: RTC Voltage Low - "
"reliable date/time information is no "
"longer guaranteed!\n", PCF8563_NAME);
}
default:
return -ENOTTY;
if (copy_to_user((int *) arg, &voltage_low, sizeof(int)))
return -EFAULT;
return 0;
case RTC_VL_CLR:
{
/* Clear the VL bit in the seconds register in case
* the time has not been set already (which would
* have cleared it). This does not really matter
* because of the cached voltage_low value but do it
* anyway for consistency. */
int ret = rtc_read(RTC_SECONDS);
rtc_write(RTC_SECONDS, (ret & 0x7F));
/* Clear the cached value. */
voltage_low = 0;
return 0;
}
default:
return -ENOTTY;
}
return 0;
}
static int __init
pcf8563_register(void)
static int __init pcf8563_register(void)
{
pcf8563_init();
if (pcf8563_init() < 0) {
printk(KERN_INFO "%s: Unable to initialize Real-Time Clock "
"Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
return -1;
}
if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
printk(KERN_INFO "%s: Unable to get major number %d for RTC device.\n",
PCF8563_NAME, PCF8563_MAJOR);
return -1;
}
printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
return 0;
printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME,
DRIVER_VERSION);
/* Check for low voltage, and warn about it. */
if (voltage_low) {
printk(KERN_WARNING "%s: RTC Voltage Low - reliable date/time "
"information is no longer guaranteed!\n", PCF8563_NAME);
}
return 0;
}
module_init(pcf8563_register);
......
此差异已折叠。
/* Serialport functions for debugging
*
* Copyright (c) 2000 Axis Communications AB
* Copyright (c) 2000-2007 Axis Communications AB
*
* Authors: Bjorn Wesen
*
......@@ -11,96 +11,6 @@
* enableDebugIRQ()
* init_etrax_debug()
*
* $Log: debugport.c,v $
* Revision 1.27 2005/06/10 10:34:14 starvik
* Real console support
*
* Revision 1.26 2005/06/07 07:06:07 starvik
* Added LF->CR translation to make ETRAX customers happy.
*
* Revision 1.25 2005/03/08 08:56:47 mikaelam
* Do only set index as port->index if port is defined, otherwise use the index from the command line
*
* Revision 1.24 2005/01/19 10:26:33 mikaelam
* Return the cris serial driver in console device driver callback function
*
* Revision 1.23 2005/01/14 10:12:17 starvik
* KGDB on separate port.
* Console fixes from 2.4.
*
* Revision 1.22 2005/01/11 16:06:13 starvik
* typo
*
* Revision 1.21 2005/01/11 13:49:14 starvik
* Added raw_printk to be used where we don't trust the console.
*
* Revision 1.20 2004/12/27 11:18:32 starvik
* Merge of Linux 2.6.10 (not functional yet).
*
* Revision 1.19 2004/10/21 07:26:16 starvik
* Made it possible to specify console settings on kernel command line.
*
* Revision 1.18 2004/10/19 13:07:37 starvik
* Merge of Linux 2.6.9
*
* Revision 1.17 2004/09/29 10:33:46 starvik
* Resolved a dealock when printing debug from kernel.
*
* Revision 1.16 2004/08/24 06:12:19 starvik
* Whitespace cleanup
*
* Revision 1.15 2004/08/16 12:37:19 starvik
* Merge of Linux 2.6.8
*
* Revision 1.14 2004/05/17 13:11:29 starvik
* Disable DMA until real serial driver is up
*
* Revision 1.13 2004/05/14 07:58:01 starvik
* Merge of changes from 2.4
*
* Revision 1.12 2003/09/11 07:29:49 starvik
* Merge of Linux 2.6.0-test5
*
* Revision 1.11 2003/07/07 09:53:36 starvik
* Revert all the 2.5.74 merge changes to make the console work again
*
* Revision 1.9 2003/02/17 17:07:23 starvik
* Solved the problem with corrupted debug output (from Linux 2.4)
* * Wait until DMA, FIFO and pipe is empty before and after transmissions
* * Buffer data until a FIFO flush can be triggered.
*
* Revision 1.8 2003/01/22 06:48:36 starvik
* Fixed warnings issued by GCC 3.2.1
*
* Revision 1.7 2002/12/12 08:26:32 starvik
* Don't use C-comments inside CVS comments
*
* Revision 1.6 2002/12/11 15:42:02 starvik
* Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
*
* Revision 1.5 2002/11/20 06:58:03 starvik
* Compiles with kgdb
*
* Revision 1.4 2002/11/19 14:35:24 starvik
* Changes from linux 2.4
* Changed struct initializer syntax to the currently preferred notation
*
* Revision 1.3 2002/11/06 09:47:03 starvik
* Modified for new interrupt macros
*
* Revision 1.2 2002/01/21 15:21:50 bjornw
* Update for kdev_t changes
*
* Revision 1.6 2001/04/17 13:58:39 orjanf
* * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
*
* Revision 1.5 2001/03/26 14:22:05 bjornw
* Namechange of some config options
*
* Revision 1.4 2000/10/06 12:37:26 bjornw
* Use physical addresses when talking to DMA
*
*
*/
#include <linux/console.h>
......@@ -112,6 +22,8 @@
#include <asm/arch/svinto.h>
#include <asm/io.h> /* Get SIMCOUT. */
extern void reset_watchdog(void);
struct dbg_port
{
unsigned int index;
......@@ -188,7 +100,9 @@ struct dbg_port ports[]=
}
};
#ifdef CONFIG_ETRAX_SERIAL
extern struct tty_driver *serial_driver;
#endif
struct dbg_port* port =
#if defined(CONFIG_ETRAX_DEBUG_PORT0)
......@@ -368,11 +282,12 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
{
int i;
unsigned long flags;
local_irq_save(flags);
if (!port)
return;
local_irq_save(flags);
/* Send data */
for (i = 0; i < len; i++) {
/* LF -> CRLF */
......@@ -386,26 +301,16 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
;
*port->write = buf[i];
}
local_irq_restore(flags);
}
int raw_printk(const char *fmt, ...)
{
static char buf[1024];
int printed_len;
static int first = 1;
if (first) {
/* Force reinitialization of the port to get manual mode. */
port->started = 0;
start_port(port);
first = 0;
}
va_list args;
va_start(args, fmt);
printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
console_write_direct(NULL, buf, strlen(buf));
return printed_len;
/*
* Feed the watchdog, otherwise it will reset the chip during boot.
* The time to send an ordinary boot message line (10-90 chars)
* varies between 1-8ms at 115200. What makes up for the additional
* 90ms that allows the watchdog to bite?
*/
reset_watchdog();
local_irq_restore(flags);
}
static void
......@@ -500,6 +405,7 @@ console_setup(struct console *co, char *options)
return 0;
}
/* This is a dummy serial device that throws away anything written to it.
* This is used when no debug output is wanted.
*/
......@@ -555,7 +461,13 @@ etrax_console_device(struct console* co, int *index)
{
if (port)
*index = port->index;
else
*index = 0;
#ifdef CONFIG_ETRAX_SERIAL
return port ? serial_driver : &dummy_driver;
#else
return &dummy_driver;
#endif
}
static struct console sercons = {
......
/* Wrapper for DMA channel allocator that updates DMA client muxing.
* Copyright 2004, Axis Communications AB
* $Id: dma.c,v 1.1 2004/12/13 12:21:51 starvik Exp $
* Copyright 2004-2007, Axis Communications AB
*/
#include <linux/kernel.h>
......
/* $Id: entry.S,v 1.28 2005/06/20 05:06:30 starvik Exp $
*
/*
* linux/arch/cris/entry.S
*
* Copyright (C) 2000, 2001, 2002 Axis Communications AB
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
* $Log: entry.S,v $
* Revision 1.28 2005/06/20 05:06:30 starvik
* Remove unnecessary diff to kernel.org tree
*
* Revision 1.27 2005/03/04 08:16:16 starvik
* Merge of Linux 2.6.11.
*
* Revision 1.26 2005/01/11 13:49:47 starvik
* Added NMI handler.
*
* Revision 1.25 2004/12/27 11:18:32 starvik
* Merge of Linux 2.6.10 (not functional yet).
*
* Revision 1.24 2004/12/22 10:41:23 starvik
* Updates to make v10 compile with the latest SMP aware generic code (even
* though v10 will never have SMP).
*
* Revision 1.23 2004/10/19 13:07:37 starvik
* Merge of Linux 2.6.9
*
* Revision 1.22 2004/06/21 10:29:55 starvik
* Merge of Linux 2.6.7
*
* Revision 1.21 2004/06/09 05:30:27 starvik
* Clean up multiple interrupt handling.
* Prevent interrupts from interrupting each other.
* Handle all active interrupts.
*
* Revision 1.20 2004/06/08 08:55:32 starvik
* Removed unused code
*
* Revision 1.19 2004/06/04 11:56:15 starvik
* Implemented page table lookup for refills in assembler for improved performance.
*
* Revision 1.18 2004/05/11 12:28:25 starvik
* Merge of Linux 2.6.6
*
* Revision 1.17 2003/09/11 07:29:49 starvik
* Merge of Linux 2.6.0-test5
*
* Revision 1.16 2003/07/04 08:27:41 starvik
* Merge of Linux 2.5.74
*
* Revision 1.15 2003/04/09 07:32:55 starvik
* resume should return task_struct, not thread_info
*
* Revision 1.14 2003/04/09 05:20:44 starvik
* Merge of Linux 2.5.67
*
* Revision 1.13 2002/12/11 15:42:02 starvik
* Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/*.c
*
* Revision 1.12 2002/12/10 09:00:10 starvik
* Merge of Linux 2.5.51
*
* Revision 1.11 2002/12/05 07:53:10 starvik
* Corrected constants used with btstq
*
* Revision 1.10 2002/11/27 08:45:10 starvik
* pid is in task_struct, not thread_info
*
* Revision 1.9 2002/11/26 09:52:05 starvik
* Added preemptive kernel scheduling (if CONFIG_PREEMPT)
*
* Revision 1.8 2002/11/20 11:56:11 starvik
* Merge of Linux 2.5.48
*
* Revision 1.7 2002/11/18 13:02:42 starvik
* Added fourth parameter to do_notify_resume
* Minor cleanup
*
* Revision 1.6 2002/11/11 10:37:50 starvik
* Use new asm-offset defines
* Modified for new location of current->work etc
* Removed SYMBOL_NAME from syscalls
* Added some new syscalls
*
* Revision 1.5 2002/11/05 06:45:11 starvik
* Merge of Linux 2.5.45
*
* Revision 1.4 2002/02/05 15:41:31 bjornw
* Rewritten to conform better to current 2.5 code (similar to arch/i386)
*
* Revision 1.3 2002/01/21 15:22:20 bjornw
* NICE_DOGGY fix from 2.4 arch/cris
*
* Revision 1.37 2001/12/07 17:03:55 bjornw
* Call a c-hook called watchdog_bite_hook instead of show_registers directly
*
* Revision 1.36 2001/11/22 13:36:36 bjornw
* * In ret_from_intr, check regs->dccr for usermode reentrance instead of
* DCCR explicitly (because the latter might not reflect current reality)
* * In mmu_bus_fault, set $r9 _after_ calling the C-code instead of before
* since $r9 is call-clobbered and is potentially needed afterwards
*
* Revision 1.35 2001/10/30 17:10:15 bjornw
* Add some syscalls
*
* Revision 1.34 2001/10/01 14:45:03 bjornw
* Removed underscores and added register prefixes
*
* Revision 1.33 2001/08/21 13:48:01 jonashg
* Added fix by HP to avoid oops when doing a hard_reset_now.
*
* Revision 1.32 2001/08/14 04:32:02 hp
* In _resume, add comment why R9 is saved; don't sound like it's call-saved.
*
* Revision 1.31 2001/07/25 16:07:42 bjornw
* softirq_active/mask -> softirq_pending only
*
* Revision 1.30 2001/07/05 01:03:32 hp
* - include asm/errno.h to get ENOSYS.
* - Use ENOSYS, not local constant LENOSYS; tweak comments.
* - Explain why .include, not #include is used.
* - Make oops-register-dump if watchdog bits and it's not expected.
* - Don't jsr, use jump _hard_reset_now, and skip spurious nop.
* - Use correct section attribute for section .rodata.
* - Adjust sys_ni_syscall fill number.
*
* Revision 1.29 2001/06/25 14:07:00 hp
* Fix review comment.
* * head.S: Use IO_STATE, IO_FIELD and IO_MASK constructs instead of
* magic numbers. Add comment that -traditional must not be used.
* * entry.S (SYMBOL_NAME): Change redefinition to use ## concatenation.
* Correct and update comment.
* * Makefile (.S.o): Don't use -traditional. Add comment why the
* toplevel rule can't be used (now that there's a reason).
*
* Revision 1.28 2001/06/21 02:00:40 hp
* * entry.S: Include asm/unistd.h.
* (_sys_call_table): Use section .rodata, not .data.
* (_kernel_thread): Move from...
* * process.c: ... here.
* * entryoffsets.c (VAL): Break out from...
* (OF): Use VAL.
* (LCLONE_VM): New asmified value from CLONE_VM.
*
* Revision 1.27 2001/05/29 11:25:27 markusl
* In case of "spurious_interrupt", do hard_reset instead of hanging system in a loop...
*
* Revision 1.26 2001/05/15 15:46:03 bjornw
* Include config.h now that we use some CONFIG_ options
*
* Revision 1.25 2001/05/15 05:38:47 hp
* Tweaked code in _ret_from_sys_call
*
* Revision 1.24 2001/05/15 05:27:49 hp
* Save r9 in r1 over function call rather than on stack.
*
* Revision 1.23 2001/05/15 05:10:00 hp
* Generate entry.S structure offsets from C
*
* Revision 1.22 2001/04/17 13:58:39 orjanf
* * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
*
* Revision 1.21 2001/04/17 11:33:29 orjanf
* Updated according to review:
* * Included asm/sv_addr_ag.h to get macro for internal register.
* * Corrected comment regarding system call argument passing.
* * Removed comment about instruction being in a delay slot.
* * Added comment about SYMBOL_NAME macro.
*
* Revision 1.20 2001/04/12 08:51:07 hp
* - Add entry for sys_fcntl64. In fact copy last piece from i386 including ...
* - .rept to fill table to safe state with sys_ni_syscall.
*
* Revision 1.19 2001/04/04 09:43:32 orjanf
* * Moved do_sigtrap from traps.c to entry.S.
* * LTASK_PID need not be global anymore.
*
* Revision 1.18 2001/03/26 09:25:02 markusl
* Updated after review, should now handle USB interrupts correctly.
*
* Revision 1.17 2001/03/21 16:12:55 bjornw
* * Always make room for the cpu status record in the frame, in order to
* use the same framelength and layout for both mmu busfaults and normal
* irqs. No need to check for the explicit CRIS_FRAME_FIXUP type anymore.
* * Fixed bug with using addq for popping the stack in the epilogue - it
* destroyed the flag register. Use instructions that don't affect the
* flag register instead.
* * Removed write to R_PORT_PA_DATA during spurious_interrupt
*
* Revision 1.16 2001/03/20 19:43:02 bjornw
* * Get rid of esp0 setting
* * Give a 7th argument to a systemcall - the stackframe
*
* Revision 1.15 2001/03/05 13:14:30 bjornw
* Spelling fix
*
* Revision 1.14 2001/02/23 08:36:36 perf
* New ABI; syscallnr=r9, arg5=mof, arg6=srp.
* Corrected tracesys call check.
*
* Revision 1.13 2001/02/15 08:40:55 perf
* H-P by way of perf;
* - (_system_call): Don't read system call function address into r1.
* - (RBFExit): There is no such thing as a null pop. Adjust sp by addq.
* - (_system_call): Don't use r10 and don't save and restore it.
* - (THREAD_ESP0): New constant.
* - (_system_call): Inline set_esp0.
*
* Revision 1.12 2001/01/31 17:56:25 orjanf
* Added definition of LTASK_PID and made it global.
*
* Revision 1.11 2001/01/10 21:13:29 bjornw
* SYMBOL_NAME is defined incorrectly for the compiler options we currently use
*
* Revision 1.10 2000/12/18 23:47:56 bjornw
* * Added syscall trace support (ptrace), completely untested of course
* * Removed redundant check for NULL entries in syscall_table
*
* Revision 1.9 2000/11/21 16:40:51 bjornw
* * New frame type used when an SBFS frame needs to be popped without
* actually restarting the instruction
* * Enable interrupts in signal_return (they did so in x86, I hope it's a good
* idea)
*
* Revision 1.8 2000/11/17 16:53:35 bjornw
* Added detection of frame-type in Rexit, so that mmu_bus_fault can
* use ret_from_intr in the return-path to check for signals (like SEGV)
* and other foul things that might have occurred during the fault.
*
* Revision 1.7 2000/10/06 15:04:28 bjornw
* Include mof in register savings
*
* Revision 1.6 2000/09/12 16:02:44 bjornw
* Linux-2.4.0-test7 derived updates
*
* Revision 1.5 2000/08/17 15:35:15 bjornw
* 2.4.0-test6 changed local_irq_count and friends API
*
* Revision 1.4 2000/08/02 13:59:30 bjornw
* Removed olduname and uname from the syscall list
*
* Revision 1.3 2000/07/31 13:32:58 bjornw
* * Export ret_from_intr
* * _resume updated (prev/last tjohejsan)
* * timer_interrupt obsolete
* * SIGSEGV detection in mmu_bus_fault temporarily disabled
*
*
*/
/*
......@@ -1167,9 +924,11 @@ sys_call_table:
.long sys_epoll_pwait
.long sys_utimensat /* 320 */
.long sys_signalfd
.long sys_ni_syscall
.long sys_timerfd_create
.long sys_eventfd
.long sys_fallocate
.long sys_timerfd_settime /* 325 */
.long sys_timerfd_gettime
/*
* NOTE!! This doesn't have to be exact - we just have
......
......@@ -31,15 +31,12 @@
#define DEBUG_LOG_INCLUDED
#define FAST_TIMER_LOG
//#define FAST_TIMER_TEST
/* #define FAST_TIMER_TEST */
#define FAST_TIMER_SANITY_CHECKS
#ifdef FAST_TIMER_SANITY_CHECKS
#define SANITYCHECK(x) x
static int sanity_failed;
#else
#define SANITYCHECK(x)
#endif
#define D1(x)
......@@ -226,23 +223,19 @@ void start_one_shot_timer(struct fast_timer *t,
do_gettimeofday_fast(&t->tv_set);
tmp = fast_timer_list;
SANITYCHECK({ /* Check so this is not in the list already... */
while (tmp != NULL)
{
if (tmp == t)
{
printk(KERN_WARNING
"timer name: %s data: 0x%08lX already in list!\n", name, data);
sanity_failed++;
goto done;
}
else
{
tmp = tmp->next;
}
}
tmp = fast_timer_list;
});
#ifdef FAST_TIMER_SANITY_CHECKS
/* Check so this is not in the list already... */
while (tmp != NULL) {
if (tmp == t) {
printk(KERN_WARNING "timer name: %s data: "
"0x%08lX already in list!\n", name, data);
sanity_failed++;
goto done;
} else
tmp = tmp->next;
}
tmp = fast_timer_list;
#endif
t->delay_us = delay_us;
t->function = function;
......
/* $Id: head.S,v 1.10 2005/06/20 05:12:54 starvik Exp $
*
/*
* Head of the kernel - alter with care
*
* Copyright (C) 2000, 2001 Axis Communications AB
*
* Authors: Bjorn Wesen (bjornw@axis.com)
*
* $Log: head.S,v $
* Revision 1.10 2005/06/20 05:12:54 starvik
* Remove unnecessary diff to kernel.org tree
*
* Revision 1.9 2004/12/13 12:21:51 starvik
* Added I/O and DMA allocators from Linux 2.4
*
* Revision 1.8 2004/11/22 11:41:14 starvik
* Kernel command line may be supplied to kernel. Not used by Axis but may
* be used by customers.
*
* Revision 1.7 2004/05/14 07:58:01 starvik
* Merge of changes from 2.4
*
* Revision 1.6 2003/04/28 05:31:46 starvik
* Added section attributes
*
* Revision 1.5 2002/12/11 15:42:02 starvik
* Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/*.c
*
* Revision 1.4 2002/11/07 09:00:44 starvik
* Names changed for init sections
* init_task_union -> init_thread_union
*
* Revision 1.3 2002/02/05 15:38:23 bjornw
* Oops.. non-CRAMFS_MAGIC should jump over the copying, not into it...
*
* Revision 1.2 2001/12/18 13:35:19 bjornw
* Applied the 2.4.13->2.4.16 CRIS patch to 2.5.1 (is a copy of 2.4.15).
*
* Revision 1.43 2001/11/08 15:09:43 starvik
* Only start MII clock if Ethernet is configured
*
* Revision 1.42 2001/11/08 14:37:34 starvik
* Start MII clock early to make sure that it is running at tranceiver reset
*
* Revision 1.41 2001/10/29 14:55:58 pkj
* Corrected pa$r0 to par0.
*
* Revision 1.40 2001/10/03 14:59:57 pkj
* Added support for resetting the Bluetooth hardware.
*
* Revision 1.39 2001/10/01 14:45:03 bjornw
* Removed underscores and added register prefixes
*
* Revision 1.38 2001/09/21 07:14:11 jonashg
* Made root filesystem (cramfs) use mtdblock driver when booting from flash.
*
* Revision 1.37 2001/09/11 13:44:29 orjanf
* Decouple usage of serial ports for debug and kgdb.
*
* Revision 1.36 2001/06/29 12:39:31 pkj
* Added support for mirroring the first flash to just below the
* second one, to make them look consecutive to cramfs.
*
* Revision 1.35 2001/06/25 14:07:00 hp
* Fix review comment.
* * head.S: Use IO_STATE, IO_FIELD and IO_MASK constructs instead of
* magic numbers. Add comment that -traditional must not be used.
* * entry.S (SYMBOL_NAME): Change redefinition to use ## concatenation.
* Correct and update comment.
* * Makefile (.S.o): Don't use -traditional. Add comment why the
* toplevel rule can't be used (now that there's a reason).
*
* Revision 1.34 2001/05/15 07:08:14 hp
* Tweak "notice" to reflect that both r8 r9 are used
*
* Revision 1.33 2001/05/15 06:40:05 hp
* Put bulk of code in .text.init, data in .data.init
*
* Revision 1.32 2001/05/15 06:18:56 hp
* Execute review comment: s/bcc/bhs/g; s/bcs/blo/g
*
* Revision 1.31 2001/05/15 06:08:40 hp
* Add sentence about autodetecting the bit31-MMU-bug
*
* Revision 1.30 2001/05/15 06:00:05 hp
* Update comment: LOW_MAP is not forced on xsim anymore.
*
* Revision 1.29 2001/04/18 12:51:59 orjanf
* * Reverted review change regarding the use of bcs/bcc.
* * Removed non-working LED-clearing code.
*
* Revision 1.28 2001/04/17 13:58:39 orjanf
* * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
*
* Revision 1.27 2001/04/17 11:42:35 orjanf
* Changed according to review:
* * Added comment explaining memory map bug.
* * Changed bcs and bcc to blo and bhs, respectively.
* * Removed mentioning of Stallone and Olga boards.
*
* Revision 1.26 2001/04/06 12:31:07 jonashg
* Check for cramfs in flash before RAM instead of RAM before flash.
*
* Revision 1.25 2001/04/04 06:23:53 starvik
* Initialize DRAM if not already initialized
*
* Revision 1.24 2001/04/03 11:12:00 starvik
* Removed dram init (done by rescue or etrax100boot
* Corrected include
*
* Revision 1.23 2001/04/03 09:53:03 starvik
* Include hw_settings.S
*
* Revision 1.22 2001/03/26 14:23:26 bjornw
* Namechange of some config options
*
* Revision 1.21 2001/03/08 12:14:41 bjornw
* * Config name for ETRAX IDE was renamed
* * Removed G27 auto-setting when JULIETTE is chosen (need to make this
* a new config option later)
*
* Revision 1.20 2001/02/23 12:47:56 bjornw
* MMU regs during LOW_MAP updated to reflect a newer reality
*
* Revision 1.19 2001/02/19 11:12:07 bjornw
* Changed comment header format
*
* Revision 1.18 2001/02/15 07:25:38 starvik
* Added support for synchronous serial ports
*
* Revision 1.17 2001/02/08 15:53:13 starvik
* Last commit removed some important ifdefs
*
* Revision 1.16 2001/02/08 15:20:38 starvik
* Include dram_init.S as inline
*
* Revision 1.15 2001/01/29 18:12:01 bjornw
* Corrected some comments
*
* Revision 1.14 2001/01/29 13:11:29 starvik
* Include dram_init.S (with DRAM/SDRAM initialization)
*
* Revision 1.13 2001/01/23 14:54:57 markusl
* Updated for USB
* i.e. added r_gen_config settings
*
* Revision 1.12 2001/01/19 16:16:29 perf
* Added temporary mapping of 0x0c->0x0c to avoid flash loading confusion.
* Renamed serial options from ETRAX100 to ETRAX.
*
* Revision 1.11 2001/01/16 16:31:38 bjornw
* * Changed name and semantics of running_from_flash to romfs_in_flash,
* set by head.S to indicate to setup.c whether there is a cramfs image
* after the kernels BSS or not. Should work for all three boot-cases
* (DRAM with cramfs in DRAM, DRAM with cramfs in flash (compressed boot),
* and flash with cramfs in flash)
*
* Revision 1.10 2001/01/16 14:12:21 bjornw
* * Check for cramfs start passed in r9 from the decompressor, if all other
* cramfs options fail (if we boot from DRAM but don't find a cramfs image
* after the kernel in DRAM, it is probably still in the flash)
* * Check magic in cramfs detection when booting from flash directly
*
* Revision 1.9 2001/01/15 17:17:02 bjornw
* * Corrected the code that detects the cramfs lengths
* * Added a comment saying that the above does not work due to other
* reasons..
*
* Revision 1.8 2001/01/15 16:27:51 jonashg
* Made boot after flashing work.
* * end destination is __vmlinux_end in RAM.
* * _romfs_start moved because of virtual memory.
*
* Revision 1.7 2000/11/21 13:55:29 bjornw
* Use CONFIG_CRIS_LOW_MAP for the low VM map instead of explicit CPU type
*
* Revision 1.6 2000/10/06 12:36:55 bjornw
* Forgot swapper_pg_dir when changing memory map..
*
* Revision 1.5 2000/10/04 16:49:30 bjornw
* * Fixed memory mapping in LX
* * Check for cramfs instead of romfs
*
*/
#define ASSEMBLER_MACROS_ONLY
......@@ -595,11 +419,17 @@ no_command_line:
moveq 0,$r0
;; Select or disable serial port 2
#ifdef CONFIG_ETRAX_SERIAL_PORT2
or.d IO_STATE (R_GEN_CONFIG, ser2, select),$r0
#else
or.d IO_STATE (R_GEN_CONFIG, ser2, disable),$r0
#endif
;; Init interfaces (disable them).
or.d IO_STATE (R_GEN_CONFIG, scsi0, disable) \
| IO_STATE (R_GEN_CONFIG, ata, disable) \
| IO_STATE (R_GEN_CONFIG, par0, disable) \
| IO_STATE (R_GEN_CONFIG, ser2, disable) \
| IO_STATE (R_GEN_CONFIG, mio, disable) \
| IO_STATE (R_GEN_CONFIG, scsi1, disable) \
| IO_STATE (R_GEN_CONFIG, scsi0w, disable) \
......@@ -801,6 +631,41 @@ no_command_line:
| IO_STATE (R_SERIAL1_TR_CTRL, tr_bitnr, tr_8bit),$r0
move.b $r0,[R_SERIAL1_TR_CTRL]
#ifdef CONFIG_ETRAX_SERIAL_PORT2
;; setup the serial port 2 at 115200 baud for debug purposes
moveq IO_STATE (R_SERIAL2_XOFF, tx_stop, enable) \
| IO_STATE (R_SERIAL2_XOFF, auto_xoff, disable) \
| IO_FIELD (R_SERIAL2_XOFF, xoff_char, 0),$r0
move.d $r0,[R_SERIAL2_XOFF]
; 115.2kbaud for both transmit and receive
move.b IO_STATE (R_SERIAL2_BAUD, tr_baud, c115k2Hz) \
| IO_STATE (R_SERIAL2_BAUD, rec_baud, c115k2Hz),$r0
move.b $r0,[R_SERIAL2_BAUD]
; Set up and enable the serial2 receiver.
move.b IO_STATE (R_SERIAL2_REC_CTRL, dma_err, stop) \
| IO_STATE (R_SERIAL2_REC_CTRL, rec_enable, enable) \
| IO_STATE (R_SERIAL2_REC_CTRL, rts_, active) \
| IO_STATE (R_SERIAL2_REC_CTRL, sampling, middle) \
| IO_STATE (R_SERIAL2_REC_CTRL, rec_stick_par, normal) \
| IO_STATE (R_SERIAL2_REC_CTRL, rec_par, even) \
| IO_STATE (R_SERIAL2_REC_CTRL, rec_par_en, disable) \
| IO_STATE (R_SERIAL2_REC_CTRL, rec_bitnr, rec_8bit),$r0
move.b $r0,[R_SERIAL2_REC_CTRL]
; Set up and enable the serial2 transmitter.
move.b IO_FIELD (R_SERIAL2_TR_CTRL, txd, 0) \
| IO_STATE (R_SERIAL2_TR_CTRL, tr_enable, enable) \
| IO_STATE (R_SERIAL2_TR_CTRL, auto_cts, disabled) \
| IO_STATE (R_SERIAL2_TR_CTRL, stop_bits, one_bit) \
| IO_STATE (R_SERIAL2_TR_CTRL, tr_stick_par, normal) \
| IO_STATE (R_SERIAL2_TR_CTRL, tr_par, even) \
| IO_STATE (R_SERIAL2_TR_CTRL, tr_par_en, disable) \
| IO_STATE (R_SERIAL2_TR_CTRL, tr_bitnr, tr_8bit),$r0
move.b $r0,[R_SERIAL2_TR_CTRL]
#endif
#ifdef CONFIG_ETRAX_SERIAL_PORT3
;; setup the serial port 3 at 115200 baud for debug purposes
......
/* $Id: irq.c,v 1.4 2005/01/04 12:22:28 starvik Exp $
*
/*
* linux/arch/cris/kernel/irq.c
*
* Copyright (c) 2000-2002 Axis Communications AB
......@@ -18,10 +17,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
/* From kgdb.c. */
extern void kgdb_init(void);
extern void breakpoint(void);
#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
......
......@@ -17,66 +17,8 @@
*! Jun 17 1999 Hendrik Ruijter Added gdb 4.18 support. 'X', 'qC' and 'qL'.
*! Jul 21 1999 Bjorn Wesen eLinux port
*!
*! $Log: kgdb.c,v $
*! Revision 1.6 2005/01/14 10:12:17 starvik
*! KGDB on separate port.
*! Console fixes from 2.4.
*!
*! Revision 1.5 2004/10/07 13:59:08 starvik
*! Corrected call to set_int_vector
*!
*! Revision 1.4 2003/04/09 05:20:44 starvik
*! Merge of Linux 2.5.67
*!
*! Revision 1.3 2003/01/21 19:11:08 starvik
*! Modified include path for new dir layout
*!
*! Revision 1.2 2002/11/19 14:35:24 starvik
*! Changes from linux 2.4
*! Changed struct initializer syntax to the currently preferred notation
*!
*! Revision 1.1 2001/12/17 13:59:27 bjornw
*! Initial revision
*!
*! Revision 1.6 2001/10/09 13:10:03 matsfg
*! Added $ on registers and removed some underscores
*!
*! Revision 1.5 2001/04/17 13:58:39 orjanf
*! * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
*!
*! Revision 1.4 2001/02/23 13:45:19 bjornw
*! config.h check
*!
*! Revision 1.3 2001/01/31 18:08:23 orjanf
*! Removed kgdb_handle_breakpoint from being the break 8 handler.
*!
*! Revision 1.2 2001/01/12 14:22:25 orjanf
*! Updated kernel debugging support to work with ETRAX 100LX.
*!
*! Revision 1.1 2000/07/10 16:25:21 bjornw
*! Initial revision
*!
*! Revision 1.1.1.1 1999/12/03 14:57:31 bjornw
*! * Initial version of arch/cris, the latest CRIS architecture with an MMU.
*! Mostly copied from arch/etrax100 with appropriate renames of files.
*! The mm/ subdir is copied from arch/i386.
*! This does not compile yet at all.
*!
*!
*! Revision 1.4 1999/07/22 17:25:25 bjornw
*! Dont wait for + in putpacket if we havent hit the initial breakpoint yet. Added a kgdb_init function which sets up the break and irq vectors.
*!
*! Revision 1.3 1999/07/21 19:51:18 bjornw
*! Check if the interrupting char is a ctrl-C, ignore otherwise.
*!
*! Revision 1.2 1999/07/21 18:09:39 bjornw
*! Ported to eLinux architecture, and added some kgdb documentation.
*!
*!
*!---------------------------------------------------------------------------
*!
*! $Id: kgdb.c,v 1.6 2005/01/14 10:12:17 starvik Exp $
*!
*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
*!
*!**************************************************************************/
......
/* $Id: process.c,v 1.12 2004/12/27 11:18:32 starvik Exp $
*
/*
* linux/arch/cris/kernel/process.c
*
* Copyright (C) 1995 Linus Torvalds
......
......@@ -65,6 +65,7 @@ void
ptrace_disable(struct task_struct *child)
{
/* Todo - pending singlesteps? */
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
}
/*
......
/* $Id: shadows.c,v 1.2 2004/12/13 12:21:51 starvik Exp $
*
/*
* Various shadow registers. Defines for these are in include/asm-etrax100/io.h
*/
......
/* $Id: traps.c,v 1.4 2005/04/24 18:47:55 starvik Exp $
/*
* Helper functions for trap handlers
*
* linux/arch/cris/arch-v10/traps.c
* Copyright (C) 2000-2007, Axis Communications AB.
*
* Heler functions for trap handlers
*
* Copyright (C) 2000-2002 Axis Communications AB
*
* Authors: Bjorn Wesen
* Hans-Peter Nilsson
* Authors: Bjorn Wesen
* Hans-Peter Nilsson
*
*/
......@@ -15,124 +12,119 @@
#include <asm/uaccess.h>
#include <asm/arch/sv_addr_ag.h>
extern int raw_printk(const char *fmt, ...);
void
show_registers(struct pt_regs * regs)
void
show_registers(struct pt_regs *regs)
{
/* We either use rdusp() - the USP register, which might not
correspond to the current process for all cases we're called,
or we use the current->thread.usp, which is not up to date for
the current process. Experience shows we want the USP
register. */
/*
* It's possible to use either the USP register or current->thread.usp.
* USP might not correspond to the current process for all cases this
* function is called, and current->thread.usp isn't up to date for the
* current process. Experience shows that using USP is the way to go.
*/
unsigned long usp = rdusp();
raw_printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
regs->irp, regs->srp, regs->dccr, usp, regs->mof );
raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
regs->irp, regs->srp, regs->dccr, usp, regs->mof);
printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
regs->r0, regs->r1, regs->r2, regs->r3);
raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
regs->r4, regs->r5, regs->r6, regs->r7);
raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
regs->r8, regs->r9, regs->r10, regs->r11);
raw_printk("r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n",
regs->r12, regs->r13, regs->orig_r10, regs);
raw_printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
raw_printk("Process %s (pid: %d, stackpage=%08lx)\n",
printk("r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n",
regs->r12, regs->r13, regs->orig_r10, (long unsigned)regs);
printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
printk("Process %s (pid: %d, stackpage=%08lx)\n",
current->comm, current->pid, (unsigned long)current);
/*
* When in-kernel, we also print out the stack and code at the
* time of the fault..
*/
if (! user_mode(regs)) {
int i;
* When in-kernel, we also print out the stack and code at the
* time of the fault..
*/
if (!user_mode(regs)) {
int i;
show_stack(NULL, (unsigned long*)usp);
show_stack(NULL, (unsigned long *)usp);
/* Dump kernel stack if the previous dump wasn't one. */
/*
* If the previous stack-dump wasn't a kernel one, dump the
* kernel stack now.
*/
if (usp != 0)
show_stack (NULL, NULL);
raw_printk("\nCode: ");
if(regs->irp < PAGE_OFFSET)
goto bad;
/* Often enough the value at regs->irp does not point to
the interesting instruction, which is most often the
_previous_ instruction. So we dump at an offset large
enough that instruction decoding should be in sync at
the interesting point, but small enough to fit on a row
(sort of). We point out the regs->irp location in a
ksymoops-friendly way by wrapping the byte for that
address in parentheses. */
for(i = -12; i < 12; i++)
{
unsigned char c;
if(__get_user(c, &((unsigned char*)regs->irp)[i])) {
bad:
raw_printk(" Bad IP value.");
break;
}
show_stack(NULL, NULL);
printk("\nCode: ");
if (regs->irp < PAGE_OFFSET)
goto bad_value;
/*
* Quite often the value at regs->irp doesn't point to the
* interesting instruction, which often is the previous
* instruction. So dump at an offset large enough that the
* instruction decoding should be in sync at the interesting
* point, but small enough to fit on a row. The regs->irp
* location is pointed out in a ksymoops-friendly way by
* wrapping the byte for that address in parenthesises.
*/
for (i = -12; i < 12; i++) {
unsigned char c;
if (__get_user(c, &((unsigned char *)regs->irp)[i])) {
bad_value:
printk(" Bad IP value.");
break;
}
if (i == 0)
raw_printk("(%02x) ", c);
printk("(%02x) ", c);
else
raw_printk("%02x ", c);
}
raw_printk("\n");
}
printk("%02x ", c);
}
printk("\n");
}
}
/* Called from entry.S when the watchdog has bitten
* We print out something resembling an oops dump, and if
* we have the nice doggy development flag set, we halt here
* instead of rebooting.
*/
extern void reset_watchdog(void);
extern void stop_watchdog(void);
void
watchdog_bite_hook(struct pt_regs *regs)
arch_enable_nmi(void)
{
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
local_irq_disable();
stop_watchdog();
show_registers(regs);
while(1) /* nothing */;
#else
show_registers(regs);
#endif
asm volatile ("setf m");
}
/* This is normally the 'Oops' routine */
void
die_if_kernel(const char * str, struct pt_regs * regs, long err)
extern void (*nmi_handler)(struct pt_regs *);
void handle_nmi(struct pt_regs *regs)
{
if(user_mode(regs))
return;
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
/* This printout might take too long and trigger the
* watchdog normally. If we're in the nice doggy
* development mode, stop the watchdog during printout.
*/
stop_watchdog();
#endif
raw_printk("%s: %04lx\n", str, err & 0xffff);
show_registers(regs);
#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
reset_watchdog();
#endif
do_exit(SIGSEGV);
if (nmi_handler)
nmi_handler(regs);
/* Wait until nmi is no longer active. (We enable NMI immediately after
returning from this function, and we don't want it happening while
exiting from the NMI interrupt handler.) */
while (*R_IRQ_MASK0_RD & IO_STATE(R_IRQ_MASK0_RD, nmi_pin, active))
;
}
void arch_enable_nmi(void)
#ifdef CONFIG_DEBUG_BUGVERBOSE
void
handle_BUG(struct pt_regs *regs)
{
asm volatile("setf m");
struct bug_frame f;
unsigned char c;
unsigned long irp = regs->irp;
if (__copy_from_user(&f, (const void __user *)(irp - 8), sizeof f))
return;
if (f.prefix != BUG_PREFIX || f.magic != BUG_MAGIC)
return;
if (__get_user(c, f.filename))
f.filename = "<bad filename>";
printk("kernel BUG at %s:%d!\n", f.filename, f.line);
}
#endif
/* $Id: checksum.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $
/*
* A fast checksum routine using movem
* Copyright (c) 1998-2001 Axis Communications AB
*
......@@ -61,8 +61,6 @@ _mloop: movem [$r10+],$r9 ; read 10 longwords
ax
addq 0,$r12
ax ; do it again, since we might have generated a carry
addq 0,$r12
subq 10*4,$r11
bge _mloop
......@@ -88,10 +86,6 @@ _word_loop:
lsrq 16,$r13 ; r13 = checksum >> 16
and.d $r9,$r12 ; checksum = checksum & 0xffff
add.d $r13,$r12 ; checksum += r13
move.d $r12,$r13 ; do the same again, maybe we got a carry last add
lsrq 16,$r13
and.d $r9,$r12
add.d $r13,$r12
_no_fold:
cmpq 2,$r11
......
/* $Id: checksumcopy.S,v 1.1 2001/12/17 13:59:27 bjornw Exp $
/*
* A fast checksum+copy routine using movem
* Copyright (c) 1998, 2001 Axis Communications AB
*
......@@ -67,8 +67,6 @@ _mloop: movem [$r10+],$r9 ; read 10 longwords
ax
addq 0,$r13
ax ; do it again, since we might have generated a carry
addq 0,$r13
subq 10*4,$r12
bge _mloop
......@@ -91,10 +89,6 @@ _word_loop:
lsrq 16,$r9 ; r0 = checksum >> 16
and.d 0xffff,$r13 ; checksum = checksum & 0xffff
add.d $r9,$r13 ; checksum += r0
move.d $r13,$r9 ; do the same again, maybe we got a carry last add
lsrq 16,$r9
and.d 0xffff,$r13
add.d $r9,$r13
_no_fold:
cmpq 2,$r12
......
/* $Id: dram_init.S,v 1.4 2003/09/22 09:21:59 starvik Exp $
*
/*
* DRAM/SDRAM initialization - alter with care
* This file is intended to be included from other assembler files
*
......@@ -8,60 +7,7 @@
*
* Copyright (C) 2000, 2001 Axis Communications AB
*
* Authors: Mikael Starvik (starvik@axis.com)
*
* $Log: dram_init.S,v $
* Revision 1.4 2003/09/22 09:21:59 starvik
* Decompresser is linked to 0x407xxxxx and sdram commands are at 0x000xxxxx
* so we need to mask off 12 bits.
*
* Revision 1.3 2003/03/31 09:38:37 starvik
* Corrected calculation of end of sdram init commands
*
* Revision 1.2 2002/11/19 13:33:29 starvik
* Changes from Linux 2.4
*
* Revision 1.13 2002/10/30 07:42:28 starvik
* Always read SDRAM command sequence from flash
*
* Revision 1.12 2002/08/09 11:37:37 orjanf
* Added double initialization work-around for Samsung SDRAMs.
*
* Revision 1.11 2002/06/04 11:43:21 starvik
* Check if mrs_data is specified in kernelconfig (necessary for MCM)
*
* Revision 1.10 2001/10/04 12:00:21 martinnn
* Added missing underscores.
*
* Revision 1.9 2001/10/01 14:47:35 bjornw
* Added register prefixes and removed underscores
*
* Revision 1.8 2001/05/15 07:12:45 hp
* Copy warning from head.S about r8 and r9
*
* Revision 1.7 2001/04/18 12:05:39 bjornw
* Fixed comments, and explicitly include config.h to be sure its there
*
* Revision 1.6 2001/04/10 06:20:16 starvik
* Delay should be 200us, not 200ns
*
* Revision 1.5 2001/04/09 06:01:13 starvik
* Added support for 100 MHz SDRAMs
*
* Revision 1.4 2001/03/26 14:24:01 bjornw
* Namechange of some config options
*
* Revision 1.3 2001/03/23 08:29:41 starvik
* Corrected calculation of mrs_data
*
* Revision 1.2 2001/02/08 15:20:00 starvik
* Corrected SDRAM initialization
* Should now be included as inline
*
* Revision 1.1 2001/01/29 13:08:02 starvik
* Initial version
* This file should be included from all assembler files that needs to
* initialize DRAM/SDRAM.
* Authors: Mikael Starvik (starvik@axis.com)
*
*/
......
/* $Id: old_checksum.c,v 1.3 2003/10/27 08:04:32 starvik Exp $
*
/*
* INET An implementation of the TCP/IP protocol suite for the LINUX
* operating system. INET is implemented using the BSD Socket
* interface as the means of communication with the user level.
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
#
# arch/cris/arch-v32/boot/Makefile
#
target = $(target_boot_dir)
src = $(src_boot_dir)
zImage: compressed/vmlinuz
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary -R .note -R .comment
compressed/vmlinuz: $(objtree)/vmlinux
@$(MAKE) -f $(src)/compressed/Makefile $(objtree)/vmlinuz
subdir- := compressed rescue
targets := Image
clean:
rm -f zImage tools/build compressed/vmlinux.out
@$(MAKE) -f $(src)/compressed/Makefile clean
$(obj)/Image: vmlinux FORCE
$(call if_changed,objcopy)
@echo ' Kernel: $@ is ready'
$(obj)/compressed/vmlinux: $(obj)/Image FORCE
$(Q)$(MAKE) $(build)=$(obj)/compressed $@
$(Q)$(MAKE) $(build)=$(obj)/rescue $(obj)/rescue/rescue.bin
$(obj)/zImage: $(obj)/compressed/vmlinux
@cp $< $@
@echo ' Kernel: $@ is ready'
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册