Skip to content

Commit

Permalink
Merge tag 'dm-pull-24jul19-take3' of https://gitlab.denx.de/u-boot/cu…
Browse files Browse the repository at this point in the history
…stodians/u-boot-dm

Minor driver-model fixes and tweaks
A few device-tree fixes
Binman support for extracting files from an image
  • Loading branch information
trini committed Jul 24, 2019
2 parents a9aa4c5 + 44e02e3 commit f9b65c7
Show file tree
Hide file tree
Showing 87 changed files with 8,158 additions and 923 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Run binman and dtoc testsuite:
./tools/buildman/buildman -P sandbox_spl &&
export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
./tools/binman/binman -t &&
./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test &&
./tools/dtoc/dtoc -t

# Test sandbox with test.py
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ addons:
- device-tree-compiler
- lzop
- liblz4-tool
- lzma-alone
- libisl15
- clang-7
- srecord
Expand Down Expand Up @@ -146,7 +147,7 @@ script:
if [[ -n "${TEST_PY_TOOLS}" ]]; then
PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"
./tools/binman/binman -t &&
./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test &&
./tools/patman/patman --test &&
./tools/buildman/buildman -t &&
PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,9 @@ u-boot.ldr: u-boot
# ---------------------------------------------------------------------------
# Use 'make BINMAN_DEBUG=1' to enable debugging
quiet_cmd_binman = BINMAN $@
cmd_binman = $(srctree)/tools/binman/binman -u -d u-boot.dtb -O . -m \
cmd_binman = $(srctree)/tools/binman/binman build -u -d u-boot.dtb -O . -m \
-I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
$(if $(BINMAN_DEBUG),-D) $(BINMAN_$(@F)) $<
$(if $(BINMAN_DEBUG),-D) $(BINMAN_$(@F))

OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex

Expand Down
27 changes: 15 additions & 12 deletions common/fdt_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,30 +671,33 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose) {

dma_range[0] = 0;
if (size >= 0x100000000ull)
dma_range[0] |= FDT_PCI_MEM64;
dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM64);
else
dma_range[0] |= FDT_PCI_MEM32;
dma_range[0] |= cpu_to_fdt32(FDT_PCI_MEM32);
if (hose->regions[r].flags & PCI_REGION_PREFETCH)
dma_range[0] |= FDT_PCI_PREFETCH;
dma_range[0] |= cpu_to_fdt32(FDT_PCI_PREFETCH);
#ifdef CONFIG_SYS_PCI_64BIT
dma_range[1] = bus_start >> 32;
dma_range[1] = cpu_to_fdt32(bus_start >> 32);
#else
dma_range[1] = 0;
#endif
dma_range[2] = bus_start & 0xffffffff;
dma_range[2] = cpu_to_fdt32(bus_start & 0xffffffff);

if (addrcell == 2) {
dma_range[3] = phys_start >> 32;
dma_range[4] = phys_start & 0xffffffff;
dma_range[3] = cpu_to_fdt32(phys_start >> 32);
dma_range[4] = cpu_to_fdt32(phys_start & 0xffffffff);
} else {
dma_range[3] = phys_start & 0xffffffff;
dma_range[3] = cpu_to_fdt32(phys_start & 0xffffffff);
}

if (sizecell == 2) {
dma_range[3 + addrcell + 0] = size >> 32;
dma_range[3 + addrcell + 1] = size & 0xffffffff;
dma_range[3 + addrcell + 0] =
cpu_to_fdt32(size >> 32);
dma_range[3 + addrcell + 1] =
cpu_to_fdt32(size & 0xffffffff);
} else {
dma_range[3 + addrcell + 0] = size & 0xffffffff;
dma_range[3 + addrcell + 0] =
cpu_to_fdt32(size & 0xffffffff);
}

dma_range += (3 + addrcell + sizecell);
Expand Down Expand Up @@ -1552,7 +1555,7 @@ u64 fdt_get_base_address(const void *fdt, int node)

prop = fdt_getprop(fdt, node, "reg", &size);

return prop ? fdt_translate_address(fdt, node, prop) : 0;
return prop ? fdt_translate_address(fdt, node, prop) : OF_BAD_ADDR;
}

/*
Expand Down
2 changes: 2 additions & 0 deletions drivers/clk/clk-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ static int clk_of_xlate_default(struct clk *clk,
else
clk->id = 0;

clk->data = 0;

return 0;
}

Expand Down
17 changes: 12 additions & 5 deletions drivers/core/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ int device_probe(struct udevice *dev)
if (dev->parent && device_get_uclass_id(dev) != UCLASS_PINCTRL)
pinctrl_select_state(dev, "default");

if (dev->parent && device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
if (CONFIG_IS_ENABLED(POWER_DOMAIN) && dev->parent &&
device_get_uclass_id(dev) != UCLASS_POWER_DOMAIN) {
if (!power_domain_get(dev, &pd))
power_domain_on(&pd);
}
Expand All @@ -409,10 +410,16 @@ int device_probe(struct udevice *dev)
goto fail;
}

/* Process 'assigned-{clocks/clock-parents/clock-rates}' properties */
ret = clk_set_defaults(dev);
if (ret)
goto fail;
/* Only handle devices that have a valid ofnode */
if (dev_of_valid(dev)) {
/*
* Process 'assigned-{clocks/clock-parents/clock-rates}'
* properties
*/
ret = clk_set_defaults(dev);
if (ret)
goto fail;
}

if (drv->probe) {
ret = drv->probe(dev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/core/ofnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,5 +884,5 @@ int ofnode_set_enabled(ofnode node, bool value)
if (value)
return ofnode_write_string(node, "status", "okay");
else
return ofnode_write_string(node, "status", "disable");
return ofnode_write_string(node, "status", "disabled");
}
4 changes: 4 additions & 0 deletions drivers/timer/timer-uclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ static int timer_pre_probe(struct udevice *dev)
int err;
ulong ret;

/* It is possible that a timer device has a null ofnode */
if (!dev_of_valid(dev))
return 0;

err = clk_get_by_index(dev, 0, &timer_clk);
if (!err) {
ret = clk_get_rate(&timer_clk);
Expand Down
4 changes: 2 additions & 2 deletions fs/cbfs/cbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void swap_file_header(struct cbfs_fileheader *dest,
memcpy(&dest->magic, &src->magic, sizeof(dest->magic));
dest->len = be32_to_cpu(src->len);
dest->type = be32_to_cpu(src->type);
dest->checksum = be32_to_cpu(src->checksum);
dest->attributes_offset = be32_to_cpu(src->attributes_offset);
dest->offset = be32_to_cpu(src->offset);
}

Expand Down Expand Up @@ -108,7 +108,7 @@ static int file_cbfs_next_file(u8 *start, u32 size, u32 align,
newNode->name = (char *)fileHeader +
sizeof(struct cbfs_fileheader);
newNode->name_length = name_len;
newNode->checksum = header.checksum;
newNode->attributes_offset = header.attributes_offset;

step = header.len;
if (step % align)
Expand Down
16 changes: 14 additions & 2 deletions include/cbfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ enum cbfs_filetype {
CBFS_TYPE_CMOS_LAYOUT = 0x01aa
};

enum {
CBFS_HEADER_MAGIC = 0x4f524243,
};

/**
* struct cbfs_header - header at the start of a CBFS region
*
* All fields use big-endian format.
*
* @magic: Magic number (CBFS_HEADER_MAGIC)
*/
struct cbfs_header {
u32 magic;
u32 version;
Expand All @@ -54,7 +65,8 @@ struct cbfs_fileheader {
u8 magic[8];
u32 len;
u32 type;
u32 checksum;
/* offset to struct cbfs_file_attribute or 0 */
u32 attributes_offset;
u32 offset;
} __packed;

Expand All @@ -65,7 +77,7 @@ struct cbfs_cachenode {
u32 data_length;
char *name;
u32 name_length;
u32 checksum;
u32 attributes_offset;
} __packed;

extern enum cbfs_result file_cbfs_result;
Expand Down
2 changes: 1 addition & 1 deletion include/dm/read.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname,
/**
* dev_read_name() - get the name of a device's node
*
* @node: valid node to look up
* @dev: Device to read from
* @return name of node
*/
const char *dev_read_name(struct udevice *dev);
Expand Down
2 changes: 1 addition & 1 deletion include/dm/uclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ int uclass_first_device_err(enum uclass_id id, struct udevice **devp);
*
* The device returned is probed if necessary, and ready for use
*
* This function is useful to start iterating through a list of devices which
* This function is useful to iterate through a list of devices which
* are functioning correctly and can be probed.
*
* @devp: On entry, pointer to device to lookup. On exit, returns pointer
Expand Down
9 changes: 6 additions & 3 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ run_test "sandbox_flattree" ./test/py/test.py --bd sandbox_flattree --build \
-k test_ut

# Set up a path to dtc (device-tree compiler) and libfdt.py, a library it
# provides and which is built by the sandbox_spl config.
# provides and which is built by the sandbox_spl config. Also set up the path
# to tools build by the build.
DTC_DIR=build-sandbox_spl/scripts/dtc
export PYTHONPATH=${DTC_DIR}/pylibfdt
export DTC=${DTC_DIR}/dtc
TOOLS_DIR=build-sandbox_spl/tools

run_test "binman" ./tools/binman/binman -t
run_test "binman" ./tools/binman/binman --toolpath ${TOOLS_DIR} test
run_test "patman" ./tools/patman/patman --test

[ "$1" == "quick" ] && skip=--skip-net-tests
Expand All @@ -49,7 +51,8 @@ run_test "dtoc" ./tools/dtoc/dtoc -t
# This needs you to set up Python test coverage tools.
# To enable Python test coverage on Debian-type distributions (e.g. Ubuntu):
# $ sudo apt-get install python-pytest python-coverage
run_test "binman code coverage" ./tools/binman/binman -T
export PATH=$PATH:${TOOLS_DIR}
run_test "binman code coverage" ./tools/binman/binman test -T
run_test "dtoc code coverage" ./tools/dtoc/dtoc -T
run_test "fdt code coverage" ./tools/dtoc/test_fdt -T

Expand Down
3 changes: 3 additions & 0 deletions tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ HOSTCFLAGS_mkexynosspl.o := -pedantic
ifdtool-objs := $(LIBFDT_OBJS) ifdtool.o
hostprogs-$(CONFIG_X86) += ifdtool

ifwitool-objs := ifwitool.o
hostprogs-$(CONFIG_X86)$(CONFIG_SANDBOX) += ifwitool

hostprogs-$(CONFIG_MX23) += mxsboot
hostprogs-$(CONFIG_MX28) += mxsboot
HOSTCFLAGS_mxsboot.o := -pedantic
Expand Down
Loading

0 comments on commit f9b65c7

Please sign in to comment.