Commit 3eb619b2 authored by Rob Herring's avatar Rob Herring
Browse files

scripts/dtc: Update to upstream version v1.6.0-11-g9d7888cbf19c



Sync with upstream dtc primarily to pickup the I2C bus check fixes. The
interrupt_provider check is noisy, so turn it off for now.

This adds the following commits from upstream:

9d7888cbf19c dtc: Consider one-character strings as strings
8259d59f59de checks: Improve i2c reg property checking
fdabcf2980a4 checks: Remove warning for I2C_OWN_SLAVE_ADDRESS
2478b1652c8d libfdt: add extern "C" for C++
f68bfc2668b2 libfdt: trivial typo fix
7be250b4d059 libfdt: Correct condition for reordering blocks
81e0919a3e21 checks: Add interrupt provider test
85e5d839847a Makefile: when building libfdt only, do not add unneeded deps
b28464a550c5 Fix some potential unaligned accesses in dtc

Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent 8c310557
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ extra-$(CHECK_DT_BINDING) += processed-schema-examples.yaml

override DTC_FLAGS := \
	-Wno-avoid_unnecessary_addr_size \
	-Wno-graph_child_address
	-Wno-graph_child_address \
	-Wno-interrupt_provider

$(obj)/processed-schema-examples.yaml: $(DT_DOCS) check_dtschema_version FORCE
	$(call if_changed,mk_schema)
+3 −1
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ quiet_cmd_gzip = GZIP $@
# DTC
# ---------------------------------------------------------------------------
DTC ?= $(objtree)/scripts/dtc/dtc
DTC_FLAGS += -Wno-interrupt_provider

# Disable noisy checks by default
ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),)
@@ -274,7 +275,8 @@ endif

ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),)
DTC_FLAGS += -Wnode_name_chars_strict \
	-Wproperty_name_chars_strict
	-Wproperty_name_chars_strict \
	-Winterrupt_provider
endif

DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
+36 −3
Original line number Diff line number Diff line
@@ -1022,6 +1022,9 @@ static void check_i2c_bus_bridge(struct check *c, struct dt_info *dti, struct no
}
WARNING(i2c_bus_bridge, check_i2c_bus_bridge, NULL, &addr_size_cells);

#define I2C_OWN_SLAVE_ADDRESS	(1U << 30)
#define I2C_TEN_BIT_ADDRESS	(1U << 31)

static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
{
	struct property *prop;
@@ -1044,6 +1047,8 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node
	}

	reg = fdt32_to_cpu(*cells);
	/* Ignore I2C_OWN_SLAVE_ADDRESS */
	reg &= ~I2C_OWN_SLAVE_ADDRESS;
	snprintf(unit_addr, sizeof(unit_addr), "%x", reg);
	if (!streq(unitname, unit_addr))
		FAIL(c, dti, node, "I2C bus unit address format error, expected \"%s\"",
@@ -1051,10 +1056,15 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node

	for (len = prop->val.len; len > 0; len -= 4) {
		reg = fdt32_to_cpu(*(cells++));
		if (reg > 0x3ff)
		/* Ignore I2C_OWN_SLAVE_ADDRESS */
		reg &= ~I2C_OWN_SLAVE_ADDRESS;

		if ((reg & I2C_TEN_BIT_ADDRESS) && ((reg & ~I2C_TEN_BIT_ADDRESS) > 0x3ff))
			FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"",
				  reg);

		else if (reg > 0x7f)
			FAIL_PROP(c, dti, node, prop, "I2C address must be less than 7-bits, got \"0x%x\". Set I2C_TEN_BIT_ADDRESS for 10 bit addresses or fix the property",
				  reg);
	}
}
WARNING(i2c_bus_reg, check_i2c_bus_reg, NULL, &reg_format, &i2c_bus_bridge);
@@ -1547,6 +1557,28 @@ static bool node_is_interrupt_provider(struct node *node)

	return false;
}

static void check_interrupt_provider(struct check *c,
				     struct dt_info *dti,
				     struct node *node)
{
	struct property *prop;

	if (!node_is_interrupt_provider(node))
		return;

	prop = get_property(node, "#interrupt-cells");
	if (!prop)
		FAIL(c, dti, node,
		     "Missing #interrupt-cells in interrupt provider");

	prop = get_property(node, "#address-cells");
	if (!prop)
		FAIL(c, dti, node,
		     "Missing #address-cells in interrupt provider");
}
WARNING(interrupt_provider, check_interrupt_provider, NULL);

static void check_interrupts_property(struct check *c,
				      struct dt_info *dti,
				      struct node *node)
@@ -1604,7 +1636,7 @@ static void check_interrupts_property(struct check *c,

	prop = get_property(irq_node, "#interrupt-cells");
	if (!prop) {
		FAIL(c, dti, irq_node, "Missing #interrupt-cells in interrupt-parent");
		/* We warn about that already in another test. */
		return;
	}

@@ -1828,6 +1860,7 @@ static struct check *check_table[] = {
	&deprecated_gpio_property,
	&gpios_property,
	&interrupts_property,
	&interrupt_provider,

	&alias_paths,

+31 −0
Original line number Diff line number Diff line
@@ -51,6 +51,37 @@ extern int annotate; /* annotate .dts with input source location */

typedef uint32_t cell_t;

static inline uint16_t dtb_ld16(const void *p)
{
	const uint8_t *bp = (const uint8_t *)p;

	return ((uint16_t)bp[0] << 8)
		| bp[1];
}

static inline uint32_t dtb_ld32(const void *p)
{
	const uint8_t *bp = (const uint8_t *)p;

	return ((uint32_t)bp[0] << 24)
		| ((uint32_t)bp[1] << 16)
		| ((uint32_t)bp[2] << 8)
		| bp[3];
}

static inline uint64_t dtb_ld64(const void *p)
{
	const uint8_t *bp = (const uint8_t *)p;

	return ((uint64_t)bp[0] << 56)
		| ((uint64_t)bp[1] << 48)
		| ((uint64_t)bp[2] << 40)
		| ((uint64_t)bp[3] << 32)
		| ((uint64_t)bp[4] << 24)
		| ((uint64_t)bp[5] << 16)
		| ((uint64_t)bp[6] << 8)
		| bp[7];
}

#define streq(a, b)	(strcmp((a), (b)) == 0)
#define strstarts(s, prefix)	(strncmp((s), (prefix), strlen(prefix)) == 0)
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ static void asm_emit_data(void *e, struct data d)
		emit_offset_label(f, m->ref, m->offset);

	while ((d.len - off) >= sizeof(uint32_t)) {
		asm_emit_cell(e, fdt32_to_cpu(*((fdt32_t *)(d.val+off))));
		asm_emit_cell(e, dtb_ld32(d.val + off));
		off += sizeof(uint32_t);
	}

Loading