Skip to content

Commit

Permalink
Merge branch 'for-next/misc'
Browse files Browse the repository at this point in the history
  • Loading branch information
saschahauer committed Apr 15, 2021
2 parents e61c75c + 94f2da7 commit b463adf
Show file tree
Hide file tree
Showing 94 changed files with 1,368 additions and 3,630 deletions.
68 changes: 68 additions & 0 deletions Documentation/boards/openrisc.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,74 @@
OpenRISC
========

Optaining an OpenRISC toolchain
-------------------------------

Toolchain binaries can be obtained from openrisc.io or our github releases page.
Instructions for building the different toolchains can be found on openrisc.io
or Stafford's toolchain build and release scripts.

See:

* https://github.com/stffrdhrn/gcc/releases
* https://github.com/stffrdhrn/or1k-toolchain-build
* https://openrisc.io/software

Example of downloading and installing a toolchain::

$ curl --remote-name --location \
https://github.com/stffrdhrn/gcc/releases/download/or1k-10.0.0-20190723/or1k-elf-10.0.0-20190723.tar.xz
$ tar -xf or1k-elf-10.0.0-20190723.tar.xz
$ export PATH=$PATH:$PWD/or1k-elf/bin

Running OpenRISC barebox on qemu
------------------------------

Running barebox on qemu is similar to running linux on qemu see more details on
the qemu wiki site at https://wiki.qemu.org/Documentation/Platforms/OpenRISC

Compile the qemu emulator::

$ git clone https://gitlab.com/qemu-project/qemu.git
$ cd qemu
$ mkdir build ; cd build
$ ../configure \
--target-list="or1k-softmmu" \
--enable-fdt \
--disable-kvm \
--disable-xen \
--disable-xkbcommon \
--enable-debug \
--enable-debug-info
$ make

Next compile barebox::

$ make ARCH=openrisc defconfig
...
$ make ARCH=openrisc CROSS_COMPILE=or1k-elf-

Run barebox::

$ <path to qemu source>/build/or1k-softmmu/qemu-system-or1k \
-cpu or1200 \
-M or1k-sim \
-kernel /home/shorne/work/openrisc/barebox/barebox \
-net nic -net tap,ifname=tap0,script=no,downscript=no \
-serial mon:stdio -nographic -gdb tcp::10001 \
-m 32


barebox 2021.02.0-00120-g763c6fee7-dirty #14 Thu Mar 4 05:13:51 JST 2021


Board: or1ksim
mdio_bus: miibus0: probed
malloc space: 0x01b80000 -> 0x01f7ffff (size 4 MiB)

Hit any to stop autoboot: 3
barebox@or1ksim:/

or1ksim
-------

Expand Down
153 changes: 0 additions & 153 deletions Documentation/boards/x86.rst

This file was deleted.

6 changes: 3 additions & 3 deletions Documentation/user/pbl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ This way source code can be shared between regular barebox and PBL. A special
case is ``lwl-y += file.o`` which expands to ``obj-y`` when PBL is disabled
and to ``pbl-y`` when PBL is enabled.

**HINT:** for getting an overview over the binaries, disassemble barebox.bin
(``make barebox.S``) with or without PBL support and also disassemble the
PBL (``make arch/$ARCH/pbl/zbarebox.S``)
**HINT:** for getting an overview over the binaries, disassemble
``barebox.bin`` with or without PBL support and also disassemble the PBL
(``./images/*.pblb``).
34 changes: 6 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ endif

KCONFIG_CONFIG ?= .config

export KCONFIG_CONFIG

# Default file for 'make defconfig'. This may be overridden by arch-Makefile.
export KBUILD_DEFCONFIG := defconfig

Expand Down Expand Up @@ -650,6 +652,9 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
# warn about C99 declaration after statement
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)

# warn about e.g. (unsigned)x < 0
KBUILD_CFLAGS += $(call cc-option,-Wtype-limits)

# disable pointer signed / unsigned warnings in gcc 4.0
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)

Expand Down Expand Up @@ -891,33 +896,6 @@ quiet_cmd_barebox_mkimage = MKIMAGE $@
barebox.uimage: $(KBUILD_BINARY) FORCE
$(call if_changed,barebox_mkimage)

ifdef CONFIG_X86
barebox.S barebox.s: barebox
ifdef CONFIG_X86_HDBOOT
@echo "-------------------------------------------------" > barebox.S
@echo " * MBR content" >> barebox.S
$(Q)$(OBJDUMP) -j .bootsector -mi8086 -d barebox >> barebox.S
@echo "-------------------------------------------------" >> barebox.S
@echo " * Boot loader content" >> barebox.S
$(Q)$(OBJDUMP) -j .bootstrapping -mi8086 -d barebox >> barebox.S
endif
@echo "-------------------------------------------------" >> barebox.S
@echo " * Regular Text content" >> barebox.S
$(Q)$(OBJDUMP) -j .text -d barebox >> barebox.S
@echo "-------------------------------------------------" >> barebox.S
@echo " * Regular Data content" >> barebox.S
$(Q)$(OBJDUMP) -j .data -d barebox >> barebox.S
@echo "-------------------------------------------------" >> barebox.S
@echo " * Commands content" >> barebox.S
$(Q)$(OBJDUMP) -j .barebox_cmd -d barebox >> barebox.S
@echo "-------------------------------------------------" >> barebox.S
@echo " * Init Calls content" >> barebox.S
$(Q)$(OBJDUMP) -j .barebox_initcalls -d barebox >> barebox.S
else
barebox.S barebox.s: barebox FORCE
$(call if_changed,disasm)
endif

# barebox image
barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE
$(call if_changed_rule,barebox__)
Expand Down Expand Up @@ -1119,7 +1097,7 @@ endif # CONFIG_MODULES
# Directories & files removed with 'make clean'
CLEAN_DIRS += $(MODVERDIR)
CLEAN_FILES += barebox System.map include/generated/barebox_default_env.h \
.tmp_version .tmp_barebox* barebox.bin barebox.map barebox.S \
.tmp_version .tmp_barebox* barebox.bin barebox.map \
.tmp_kallsyms* barebox.ldr compile_commands.json \
scripts/bareboxenv-target barebox-flash-image \
barebox.srec barebox.s5p barebox.ubl barebox.zynq \
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boards/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ obj-$(CONFIG_MACH_WAGO_PFC_AM35XX) += wago-pfc-am35xx/
obj-$(CONFIG_MACH_LS1046ARDB) += ls1046ardb/
obj-$(CONFIG_MACH_TQMLS1046A) += tqmls1046a/
obj-$(CONFIG_MACH_MNT_REFORM) += mnt-reform/
obj-$(CONFIG_MACH_SKOV_ARM9CPU) += skov-arm9cpu/
2 changes: 2 additions & 0 deletions arch/arm/boards/skov-arm9cpu/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj-y += board.o
lwl-y += lowlevel.o
84 changes: 84 additions & 0 deletions arch/arm/boards/skov-arm9cpu/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: GPL-2.0+
// SPDX-FileCopyrightText: 2017 Sam Ravnborg <[email protected]>

#include <common.h>
#include <globalvar.h>
#include <magicvar.h>
#include <envfs.h>
#include <init.h>
#include <gpio.h>

#include <linux/sizes.h>

#include <mach/at91sam9263_matrix.h>
#include <mach/at91sam9_sdramc.h>
#include <mach/at91sam9_smc.h>
#include <mach/hardware.h>
#include <mach/iomux.h>

static struct sam9_smc_config ek_nand_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 1,
.ncs_write_setup = 0,
.nwe_setup = 1,

.ncs_read_pulse = 3,
.nrd_pulse = 3,
.ncs_write_pulse = 3,
.nwe_pulse = 3,

.read_cycle = 5,
.write_cycle = 5,

.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
AT91_SMC_EXNWMODE_DISABLE,
.tdf_cycles = 2,
};

BAREBOX_MAGICVAR(board.mem, "The detected memory size in MiB");

static int mem;

/*
* Initialize of SMC must come after we
* probe the at91sam9_smc_driver.
* But is required before we start the other drives.
* Use device_initcall() to maintain this order.
*/
static int skov_arm9_probe(struct device_d *dev)
{
unsigned long csa;

add_generic_device("at91sam9-smc", 0, NULL, AT91SAM9263_BASE_SMC0, 0x200,
IORESOURCE_MEM, NULL);
add_generic_device("at91sam9-smc", 1, NULL, AT91SAM9263_BASE_SMC1, 0x200,
IORESOURCE_MEM, NULL);

csa = readl(AT91SAM9263_BASE_MATRIX + AT91SAM9263_MATRIX_EBI0CSA);
csa |= AT91SAM9263_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA;
writel(csa, AT91SAM9263_BASE_MATRIX + AT91SAM9263_MATRIX_EBI0CSA);

/* configure chip-select 3 (NAND) */
sam9_smc_configure(0, 3, &ek_nand_smc_config);

mem = at91_get_sdram_size(IOMEM(AT91SAM9263_BASE_SDRAMC0));
mem = mem / SZ_1M;
globalvar_add_simple_int("board.mem", &mem, "%u");

return 0;
}

static __maybe_unused struct of_device_id skov_arm9_ids[] = {
{
.compatible = "skov,arm9-cpu",
}, {
/* sentinel */
}
};

static struct driver_d skov_arm9_driver = {
.name = "skov-arm9",
.probe = skov_arm9_probe,
.of_compatible = DRV_OF_COMPAT(skov_arm9_ids),
};
device_platform_driver(skov_arm9_driver);
Loading

0 comments on commit b463adf

Please sign in to comment.