Skip to content

Commit

Permalink
Merge tag 'xtensa-20121218' of git://github.com/czankel/xtensa-linux
Browse files Browse the repository at this point in the history
Pull Xtensa patchset from Chris Zankel:
 "This contains support of device trees, many fixes, and code clean-ups"

* tag 'xtensa-20121218' of git://github.com/czankel/xtensa-linux: (33 commits)
  xtensa: don't try to build DTB when OF is disabled
  xtensa: set the correct ethernet address for xtfpga
  xtensa: clean up files to make them code-style compliant
  xtensa: provide endianness macro for sparse
  xtensa: fix RASID SR initialization
  xtensa: initialize CPENABLE SR when core has one
  xtensa: reset all timers on initialization
  Use for_each_compatible_node() macro.
  xtensa: add XTFPGA DTS
  xtensa: add support for the XTFPGA boards
  xtensa: add device trees support
  xtensa: add IRQ domains support
  xtensa: add U-Boot image support (uImage).
  xtensa: clean up boot make rules
  xtensa: fix mb and wmb definitions
  xtensa: add s32c1i-based spinlock implementations
  xtensa: add s32c1i-based bitops implementations
  xtensa: add s32c1i-based atomic ops implementations
  xtensa: add s32c1i sanity check
  xtensa: add trap_set_handler function
  ...
  • Loading branch information
Linus Torvalds committed Dec 19, 2012
2 parents 1bd12c9 + 055d4db commit 2f0bf92
Show file tree
Hide file tree
Showing 81 changed files with 2,140 additions and 422 deletions.
44 changes: 44 additions & 0 deletions Documentation/xtensa/atomctl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
We Have Atomic Operation Control (ATOMCTL) Register.
This register determines the effect of using a S32C1I instruction
with various combinations of:

1. With and without an Coherent Cache Controller which
can do Atomic Transactions to the memory internally.

2. With and without An Intelligent Memory Controller which
can do Atomic Transactions itself.

The Core comes up with a default value of for the three types of cache ops:

0x28: (WB: Internal, WT: Internal, BY:Exception)

On the FPGA Cards we typically simulate an Intelligent Memory controller
which can implement RCW transactions. For FPGA cards with an External
Memory controller we let it to the atomic operations internally while
doing a Cached (WB) transaction and use the Memory RCW for un-cached
operations.

For systems without an coherent cache controller, non-MX, we always
use the memory controllers RCW, thought non-MX controlers likely
support the Internal Operation.

CUSTOMER-WARNING:
Virtually all customers buy their memory controllers from vendors that
don't support atomic RCW memory transactions and will likely want to
configure this register to not use RCW.

Developers might find using RCW in Bypass mode convenient when testing
with the cache being bypassed; for example studying cache alias problems.

See Section 4.3.12.4 of ISA; Bits:

WB WT BY
5 4 | 3 2 | 1 0
2 Bit
Field
Values WB - Write Back WT - Write Thru BY - Bypass
--------- --------------- ----------------- ----------------
0 Exception Exception Exception
1 RCW Transaction RCW Transaction RCW Transaction
2 Internal Operation Exception Reserved
3 Reserved Reserved Reserved
21 changes: 21 additions & 0 deletions arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ config XTENSA
select GENERIC_KERNEL_EXECVE
select ARCH_WANT_OPTIONAL_GPIOLIB
select CLONE_BACKWARDS
select IRQ_DOMAIN
help
Xtensa processors are 32-bit RISC machines designed by Tensilica
primarily for embedded systems. These processors are both
Expand Down Expand Up @@ -150,6 +151,15 @@ config XTENSA_PLATFORM_S6105
select SERIAL_CONSOLE
select NO_IOPORT

config XTENSA_PLATFORM_XTFPGA
bool "XTFPGA"
select SERIAL_CONSOLE
select ETHOC
select XTENSA_CALIBRATE_CCOUNT
help
XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605).
This hardware is capable of running a full Linux distribution.

endchoice


Expand Down Expand Up @@ -177,6 +187,17 @@ config CMDLINE
time by entering them here. As a minimum, you should specify the
memory size and the root device (e.g., mem=64M root=/dev/nfs).

config USE_OF
bool "Flattened Device Tree support"
select OF
select OF_EARLY_FLATTREE
help
Include support for flattened device tree machine descriptions.

config BUILTIN_DTB
string "DTB to build into the kernel image"
depends on OF

source "mm/Kconfig"

source "drivers/pcmcia/Kconfig"
Expand Down
22 changes: 21 additions & 1 deletion arch/xtensa/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ menu "Kernel hacking"

source "lib/Kconfig.debug"

endmenu
config LD_NO_RELAX
bool "Disable linker relaxation"
default n
help
Enable this function to disable link-time optimizations.
The default linker behavior is to combine identical literal
values to reduce code size and remove unnecessary overhead from
assembler-generated 'longcall' sequences.
Enabling this option improves the link time but increases the
code size, and possibly execution time.

config S32C1I_SELFTEST
bool "Perform S32C1I instruction self-test at boot"
default y
help
Enable this option to test S32C1I instruction behavior at boot.
Correct operation of this instruction requires some cooperation from hardware
external to the processor (such as bus bridge, bus fabric, or memory controller).
It is easy to make wrong hardware configuration, this test should catch it early.

Say 'N' on stable hardware.

endmenu
20 changes: 19 additions & 1 deletion arch/xtensa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ endif
platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
platform-$(CONFIG_XTENSA_PLATFORM_S6105) := s6105
platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga

PLATFORM = $(platform-y)
export PLATFORM
Expand All @@ -49,6 +50,17 @@ KBUILD_CFLAGS += -pipe -mlongcalls

KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)

ifneq ($(CONFIG_LD_NO_RELAX),)
LDFLAGS := --no-relax
endif

ifeq ($(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EB__
endif
ifeq ($(shell echo -e __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EL__
endif

vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))

Expand All @@ -75,6 +87,10 @@ core-y += $(buildvar) $(buildplf)

libs-y += arch/xtensa/lib/ $(LIBGCC)

ifneq ($(CONFIG_BUILTIN_DTB),"")
core-$(CONFIG_OF) += arch/xtensa/boot/
endif

boot := arch/xtensa/boot

all: zImage
Expand All @@ -84,7 +100,9 @@ bzImage : zImage
zImage: vmlinux
$(Q)$(MAKE) $(build)=$(boot) $@

%.dtb:
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

define archhelp
@echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
endef

25 changes: 24 additions & 1 deletion arch/xtensa/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,35 @@ subdir-y := lib
# Subdirs for the boot loader(s)

bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf boot-uboot
bootdir-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += boot-redboot boot-elf boot-uboot


BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o
ifneq ($(CONFIG_BUILTIN_DTB),"")
obj-$(CONFIG_OF) += $(BUILTIN_DTB)
endif

# Rule to build device tree blobs
$(obj)/%.dtb: $(src)/dts/%.dts FORCE
$(call if_changed_dep,dtc)

clean-files := *.dtb.S

zImage Image: $(bootdir-y)

$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)

OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary

vmlinux.bin: vmlinux FORCE
$(call if_changed,objcopy)

vmlinux.bin.gz: vmlinux.bin FORCE
$(call if_changed,gzip)

boot-elf: vmlinux.bin
boot-redboot: vmlinux.bin.gz
boot-uboot: vmlinux.bin.gz
26 changes: 11 additions & 15 deletions arch/xtensa/boot/boot-elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc

ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
Expand All @@ -20,18 +17,17 @@ boot-y := bootstrap.o

OBJS := $(addprefix $(obj)/,$(boot-y))

vmlinux.tmp: vmlinux
$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
$^ $@

Image: vmlinux.tmp $(OBJS) arch/$(ARCH)/boot/boot-elf/boot.lds
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp \
$(obj)/Image.o: vmlinux.bin $(OBJS)
$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.bin \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.lds \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
$(OBJS) $@

zImage: Image
$(obj)/../Image.elf: $(obj)/Image.o $(obj)/boot.lds
$(Q)$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T $(obj)/boot.lds \
--build-id=none \
-o $@ $(obj)/Image.o
$(Q)$(kecho) ' Kernel: $@ is ready'

zImage: $(obj)/../Image.elf
26 changes: 12 additions & 14 deletions arch/xtensa/boot/boot-redboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc
ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
Expand All @@ -21,17 +19,17 @@ LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a

LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)

vmlinux.tmp: vmlinux
$(OBJCOPY) --strip-all -R .comment -R .note.gnu.build-id -O binary \
$^ $@
$(obj)/zImage.o: vmlinux.bin.gz $(OBJS)
$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.bin.gz \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@

vmlinux.tmp.gz: vmlinux.tmp
$(GZIP) $(GZIP_FLAGS) $^ > $@
$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
$(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)

zImage: vmlinux.tmp.gz $(OBJS) $(LIBS)
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp.gz \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/$@.redboot
$(obj)/../zImage.redboot: $(obj)/zImage.elf
$(Q)$(OBJCOPY) -S -O binary $< $@
$(Q)$(kecho) ' Kernel: $@ is ready'

zImage: $(obj)/../zImage.redboot
14 changes: 14 additions & 0 deletions arch/xtensa/boot/boot-uboot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#

UIMAGE_LOADADDR = 0xd0001000
UIMAGE_COMPRESSION = gzip

$(obj)/../uImage: vmlinux.bin.gz FORCE
$(call if_changed,uimage)
$(Q)$(kecho) ' Kernel: $@ is ready'

zImage: $(obj)/../uImage
11 changes: 11 additions & 0 deletions arch/xtensa/boot/dts/lx60.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/dts-v1/;
/include/ "xtfpga.dtsi"
/include/ "xtfpga-flash-4m.dtsi"

/ {
compatible = "xtensa,lx60";
memory@0 {
device_type = "memory";
reg = <0x00000000 0x04000000>;
};
};
11 changes: 11 additions & 0 deletions arch/xtensa/boot/dts/ml605.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/dts-v1/;
/include/ "xtfpga.dtsi"
/include/ "xtfpga-flash-16m.dtsi"

/ {
compatible = "xtensa,ml605";
memory@0 {
device_type = "memory";
reg = <0x00000000 0x08000000>;
};
};
26 changes: 26 additions & 0 deletions arch/xtensa/boot/dts/xtfpga-flash-16m.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/ {
flash: flash@f8000000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0xf8000000 0x01000000>;
bank-width = <2>;
device-width = <2>;
partition@0x0 {
label = "boot loader area";
reg = <0x00000000 0x00400000>;
};
partition@0x400000 {
label = "kernel image";
reg = <0x00400000 0x00600000>;
};
partition@0xa00000 {
label = "data";
reg = <0x00a00000 0x005e0000>;
};
partition@0xfe0000 {
label = "boot environment";
reg = <0x00fe0000 0x00020000>;
};
};
};
18 changes: 18 additions & 0 deletions arch/xtensa/boot/dts/xtfpga-flash-4m.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/ {
flash: flash@f8000000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "cfi-flash";
reg = <0xf8000000 0x00400000>;
bank-width = <2>;
device-width = <2>;
partition@0x0 {
label = "boot loader area";
reg = <0x00000000 0x003f0000>;
};
partition@0x3f0000 {
label = "boot environment";
reg = <0x003f0000 0x00010000>;
};
};
};
Loading

0 comments on commit 2f0bf92

Please sign in to comment.