Skip to content

Commit

Permalink
Merge tag 'pull-14nov18' of git://git.denx.de/u-boot-dm
Browse files Browse the repository at this point in the history
- virtio implementation and supporting patches
- DM_FLAG_PRE_RELOC fixes
- regmap improvements
- minor buildman and sandbox things
  • Loading branch information
trini committed Nov 16, 2018
2 parents f6206f8 + 4c6e27f commit 1d6edcb
Show file tree
Hide file tree
Showing 171 changed files with 7,486 additions and 343 deletions.
19 changes: 19 additions & 0 deletions Documentation/devicetree/bindings/misc/gdsys,iocon_fpga.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gdsys IHS FPGA for CON devices

The gdsys IHS FPGA is the main FPGA on gdsys CON devices. This driver provides
support for enabling and starting the FPGA, as well as verifying working bus
communication.

Required properties:
- compatible: must be "gdsys,iocon_fpga"
- reset-gpios: List of GPIOs controlling the FPGA's reset
- done-gpios: List of GPIOs notifying whether the FPGA's reconfiguration is
done

Example:

FPGA0 {
compatible = "gdsys,iocon_fpga";
reset-gpios = <&PPCPCA 26 0>;
done-gpios = <&GPIO_VB0 19 0>;
};
19 changes: 19 additions & 0 deletions Documentation/devicetree/bindings/misc/gdsys,iocpu_fpga.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gdsys IHS FPGA for CPU devices

The gdsys IHS FPGA is the main FPGA on gdsys CPU devices. This driver provides
support for enabling and starting the FPGA, as well as verifying working bus
communication.

Required properties:
- compatible: must be "gdsys,iocpu_fpga"
- reset-gpios: List of GPIOs controlling the FPGA's reset
- done-gpios: List of GPIOs notifying whether the FPGA's reconfiguration is
done

Example:

FPGA0 {
compatible = "gdsys,iocpu_fpga";
reset-gpios = <&PPCPCA 26 0>;
done-gpios = <&GPIO_VB0 19 0>;
};
16 changes: 16 additions & 0 deletions Documentation/devicetree/bindings/misc/gdsys,soc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
gdsys soc bus driver

This driver provides a simple interface for the busses associated with gdsys
IHS FPGAs. The bus itself contains devices whose register maps are contained
within the FPGA's register space.

Required properties:
- fpga: A phandle to the controlling IHS FPGA

Example:

FPGA0BUS: fpga0bus {
compatible = "gdsys,soc";
ranges = <0x0 0xe0600000 0x00004000>;
fpga = <&FPGA0>;
};
6 changes: 6 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ config SANDBOX
imply LIBAVB
imply CMD_AVB
imply UDP_FUNCTION_FASTBOOT
imply VIRTIO_MMIO
imply VIRTIO_PCI
imply VIRTIO_SANDBOX
imply VIRTIO_BLK
imply VIRTIO_NET

config SH
bool "SuperH architecture"
Expand All @@ -120,6 +125,7 @@ config X86
select CREATE_ARCH_SYMLINK
select DM
select DM_PCI
select HAVE_ARCH_IOMAP
select HAVE_PRIVATE_LIBGCC
select OF_CONTROL
select PCI
Expand Down
1 change: 1 addition & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ source "board/broadcom/bcmns2/Kconfig"
source "board/cavium/thunderx/Kconfig"
source "board/cirrus/edb93xx/Kconfig"
source "board/eets/pdu001/Kconfig"
source "board/emulation/qemu-arm/Kconfig"
source "board/freescale/ls2080a/Kconfig"
source "board/freescale/ls2080aqds/Kconfig"
source "board/freescale/ls2080ardb/Kconfig"
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-stm32mp/bsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ U_BOOT_DRIVER(stm32mp_bsec) = {
.ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata,
.platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata),
.ops = &stm32mp_bsec_ops,
.flags = DM_FLAG_PRE_RELOC,
};

/* bsec IP is not present in device tee, manage IP address by platdata */
Expand Down
22 changes: 22 additions & 0 deletions arch/mips/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,28 @@ __BUILD_CLRSETBITS(bwlq, sfx, end, type)
#define __to_cpu(v) (v)
#define cpu_to__(v) (v)

#define out_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v),a)
#define in_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a))

#define out_le64(a, v) out_arch(q, le64, a, v)
#define out_le32(a, v) out_arch(l, le32, a, v)
#define out_le16(a, v) out_arch(w, le16, a, v)

#define in_le64(a) in_arch(q, le64, a)
#define in_le32(a) in_arch(l, le32, a)
#define in_le16(a) in_arch(w, le16, a)

#define out_be64(a, v) out_arch(q, be64, a, v)
#define out_be32(a, v) out_arch(l, be32, a, v)
#define out_be16(a, v) out_arch(w, be16, a, v)

#define in_be64(a) in_arch(q, be64, a)
#define in_be32(a) in_arch(l, be32, a)
#define in_be16(a) in_arch(w, be16, a)

#define out_8(a, v) __raw_writeb(v, a)
#define in_8(a) __raw_readb(a)

BUILD_CLRSETBITS(b, 8, _, u8)
BUILD_CLRSETBITS(w, le16, le16, u16)
BUILD_CLRSETBITS(w, be16, be16, u16)
Expand Down
11 changes: 10 additions & 1 deletion arch/riscv/lib/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
#include <common.h>
#include <command.h>
#include <image.h>
#include <u-boot/zlib.h>
#include <asm/byteorder.h>
#include <asm/csr.h>
#include <dm/device.h>
#include <dm/root.h>
#include <u-boot/zlib.h>

DECLARE_GLOBAL_DATA_PTR;

Expand Down Expand Up @@ -57,6 +59,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
/* we assume that the kernel is in place */
printf("\nStarting kernel ...\n\n");

/*
* Call remove function of all devices with a removal flag set.
* This may be useful for last-stage operations, like cancelling
* of DMA operation or releasing device internal buffers.
*/
dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);

cleanup_before_linux();

if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
Expand Down
7 changes: 6 additions & 1 deletion arch/sandbox/cpu/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ void *os_malloc(size_t length)
struct os_mem_hdr *hdr;
int page_size = getpagesize();

hdr = mmap(NULL, length + page_size,
/*
* Use an address that is hopefully available to us so that pointers
* to this memory are fairly obvious. If we end up with a different
* address, that's fine too.
*/
hdr = mmap((void *)0x10000000, length + page_size,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
if (hdr == MAP_FAILED)
Expand Down
17 changes: 16 additions & 1 deletion arch/sandbox/dts/test.dts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@
compatible = "denx,u-boot-fdt-test";
};

h-test {
compatible = "denx,u-boot-fdt-test1";
};

clocks {
clk_fixed: clk-fixed {
compatible = "fixed-clock";
Expand Down Expand Up @@ -346,14 +350,17 @@

cpu-test1 {
compatible = "sandbox,cpu_sandbox";
u-boot,dm-pre-reloc;
};

cpu-test2 {
compatible = "sandbox,cpu_sandbox";
u-boot,dm-pre-reloc;
};

cpu-test3 {
compatible = "sandbox,cpu_sandbox";
u-boot,dm-pre-reloc;
};

misc-test {
Expand Down Expand Up @@ -525,7 +532,7 @@

syscon@0 {
compatible = "sandbox,syscon0";
reg = <0x10 4>;
reg = <0x10 16>;
};

syscon@1 {
Expand Down Expand Up @@ -712,6 +719,14 @@
sandbox_tee {
compatible = "sandbox,tee";
};

sandbox_virtio1 {
compatible = "sandbox,virtio1";
};

sandbox_virtio2 {
compatible = "sandbox,virtio2";
};
};

#include "sandbox_pmic.dtsi"
1 change: 1 addition & 0 deletions arch/x86/cpu/baytrail/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,5 @@ U_BOOT_DRIVER(cpu_x86_baytrail_drv) = {
.bind = cpu_x86_bind,
.probe = cpu_x86_baytrail_probe,
.ops = &cpu_x86_baytrail_ops,
.flags = DM_FLAG_PRE_RELOC,
};
1 change: 1 addition & 0 deletions arch/x86/cpu/broadwell/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,4 +764,5 @@ U_BOOT_DRIVER(cpu_x86_broadwell_drv) = {
.probe = cpu_x86_broadwell_probe,
.ops = &cpu_x86_broadwell_ops,
.priv_auto_alloc_size = sizeof(struct cpu_broadwell_priv),
.flags = DM_FLAG_PRE_RELOC,
};
1 change: 1 addition & 0 deletions arch/x86/cpu/cpu_x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ U_BOOT_DRIVER(cpu_x86_drv) = {
.of_match = cpu_x86_ids,
.bind = cpu_x86_bind,
.ops = &cpu_x86_ops,
.flags = DM_FLAG_PRE_RELOC,
};
1 change: 1 addition & 0 deletions arch/x86/cpu/ivybridge/model_206ax.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,5 @@ U_BOOT_DRIVER(cpu_x86_model_206ax_drv) = {
.bind = cpu_x86_bind,
.probe = cpu_x86_model_206ax_probe,
.ops = &cpu_x86_model_206ax_ops,
.flags = DM_FLAG_PRE_RELOC,
};
1 change: 0 additions & 1 deletion arch/x86/cpu/tangier/sysreset.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ U_BOOT_DRIVER(tangier_sysreset) = {
.id = UCLASS_SYSRESET,
.of_match = tangier_sysreset_ids,
.ops = &tangier_sysreset_ops,
.flags = DM_FLAG_PRE_RELOC,
};
66 changes: 66 additions & 0 deletions arch/x86/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,72 @@ static inline void sync(void)
#define __iormb() dmb()
#define __iowmb() dmb()

/*
* Read/write from/to an (offsettable) iomem cookie. It might be a PIO
* access or a MMIO access, these functions don't care. The info is
* encoded in the hardware mapping set up by the mapping functions
* (or the cookie itself, depending on implementation and hw).
*
* The generic routines don't assume any hardware mappings, and just
* encode the PIO/MMIO as part of the cookie. They coldly assume that
* the MMIO IO mappings are not in the low address range.
*
* Architectures for which this is not true can't use this generic
* implementation and should do their own copy.
*/

/*
* We assume that all the low physical PIO addresses (0-0xffff) always
* PIO. That means we can do some sanity checks on the low bits, and
* don't need to just take things for granted.
*/
#define PIO_RESERVED 0x10000UL

/*
* Ugly macros are a way of life.
*/
#define IO_COND(addr, is_pio, is_mmio) do { \
unsigned long port = (unsigned long __force)addr; \
if (port >= PIO_RESERVED) { \
is_mmio; \
} else { \
is_pio; \
} \
} while (0)

static inline u8 ioread8(const volatile void __iomem *addr)
{
IO_COND(addr, return inb(port), return readb(addr));
return 0xff;
}

static inline u16 ioread16(const volatile void __iomem *addr)
{
IO_COND(addr, return inw(port), return readw(addr));
return 0xffff;
}

static inline u32 ioread32(const volatile void __iomem *addr)
{
IO_COND(addr, return inl(port), return readl(addr));
return 0xffffffff;
}

static inline void iowrite8(u8 value, volatile void __iomem *addr)
{
IO_COND(addr, outb(value, port), writeb(value, addr));
}

static inline void iowrite16(u16 value, volatile void __iomem *addr)
{
IO_COND(addr, outw(value, port), writew(value, addr));
}

static inline void iowrite32(u32 value, volatile void __iomem *addr)
{
IO_COND(addr, outl(value, port), writel(value, addr));
}

#include <asm-generic/io.h>

#endif /* _ASM_IO_H */
13 changes: 13 additions & 0 deletions board/emulation/qemu-arm/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if TARGET_QEMU_ARM_32BIT || TARGET_QEMU_ARM_64BIT

config SYS_TEXT_BASE
default 0x00000000

config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
imply VIRTIO_MMIO
imply VIRTIO_PCI
imply VIRTIO_NET
imply VIRTIO_BLK

endif
10 changes: 10 additions & 0 deletions board/emulation/qemu-arm/qemu-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
/*
* Copyright (c) 2017 Tuomas Tynkkynen
*/

#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <virtio_types.h>
#include <virtio.h>

#ifdef CONFIG_ARM64
#include <asm/armv8/mmu.h>
Expand Down Expand Up @@ -58,6 +62,12 @@ struct mm_region *mem_map = qemu_arm64_mem_map;

int board_init(void)
{
/*
* Make sure virtio bus is enumerated so that peripherals
* on the virtio bus can be discovered by their drivers
*/
virtio_init();

return 0;
}

Expand Down
11 changes: 11 additions & 0 deletions board/emulation/qemu-riscv/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,16 @@ config SYS_TEXT_BASE
config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
imply SYS_NS16550
imply VIRTIO_MMIO
imply VIRTIO_NET
imply VIRTIO_BLK
imply CMD_PING
imply CMD_FS_GENERIC
imply DOS_PARTITION
imply EFI_PARTITION
imply ISO_PARTITION
imply CMD_EXT2
imply CMD_EXT4
imply CMD_FAT

endif
9 changes: 9 additions & 0 deletions board/emulation/qemu-riscv/qemu-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
*/

#include <common.h>
#include <dm.h>
#include <fdtdec.h>
#include <virtio_types.h>
#include <virtio.h>

#define MROM_FDT_ADDR 0x1020

int board_init(void)
{
/*
* Make sure virtio bus is enumerated so that peripherals
* on the virtio bus can be discovered by their drivers
*/
virtio_init();

return 0;
}

Expand Down
Loading

0 comments on commit 1d6edcb

Please sign in to comment.