Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Rob Herring <robh@kernel.org>

+91 -16
+2 -1
Documentation/devicetree/bindings/Makefile
··· 43 43 44 44 override DTC_FLAGS := \ 45 45 -Wno-avoid_unnecessary_addr_size \ 46 - -Wno-graph_child_address 46 + -Wno-graph_child_address \ 47 + -Wno-interrupt_provider 47 48 48 49 $(obj)/processed-schema-examples.yaml: $(DT_DOCS) check_dtschema_version FORCE 49 50 $(call if_changed,mk_schema)
+3 -1
scripts/Makefile.lib
··· 259 259 # DTC 260 260 # --------------------------------------------------------------------------- 261 261 DTC ?= $(objtree)/scripts/dtc/dtc 262 + DTC_FLAGS += -Wno-interrupt_provider 262 263 263 264 # Disable noisy checks by default 264 265 ifeq ($(findstring 1,$(KBUILD_EXTRA_WARN)),) ··· 275 274 276 275 ifneq ($(findstring 2,$(KBUILD_EXTRA_WARN)),) 277 276 DTC_FLAGS += -Wnode_name_chars_strict \ 278 - -Wproperty_name_chars_strict 277 + -Wproperty_name_chars_strict \ 278 + -Winterrupt_provider 279 279 endif 280 280 281 281 DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
+36 -3
scripts/dtc/checks.c
··· 1022 1022 } 1023 1023 WARNING(i2c_bus_bridge, check_i2c_bus_bridge, NULL, &addr_size_cells); 1024 1024 1025 + #define I2C_OWN_SLAVE_ADDRESS (1U << 30) 1026 + #define I2C_TEN_BIT_ADDRESS (1U << 31) 1027 + 1025 1028 static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node) 1026 1029 { 1027 1030 struct property *prop; ··· 1047 1044 } 1048 1045 1049 1046 reg = fdt32_to_cpu(*cells); 1047 + /* Ignore I2C_OWN_SLAVE_ADDRESS */ 1048 + reg &= ~I2C_OWN_SLAVE_ADDRESS; 1050 1049 snprintf(unit_addr, sizeof(unit_addr), "%x", reg); 1051 1050 if (!streq(unitname, unit_addr)) 1052 1051 FAIL(c, dti, node, "I2C bus unit address format error, expected \"%s\"", ··· 1056 1051 1057 1052 for (len = prop->val.len; len > 0; len -= 4) { 1058 1053 reg = fdt32_to_cpu(*(cells++)); 1059 - if (reg > 0x3ff) 1054 + /* Ignore I2C_OWN_SLAVE_ADDRESS */ 1055 + reg &= ~I2C_OWN_SLAVE_ADDRESS; 1056 + 1057 + if ((reg & I2C_TEN_BIT_ADDRESS) && ((reg & ~I2C_TEN_BIT_ADDRESS) > 0x3ff)) 1060 1058 FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"", 1061 1059 reg); 1062 - 1060 + else if (reg > 0x7f) 1061 + 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", 1062 + reg); 1063 1063 } 1064 1064 } 1065 1065 WARNING(i2c_bus_reg, check_i2c_bus_reg, NULL, &reg_format, &i2c_bus_bridge); ··· 1557 1547 1558 1548 return false; 1559 1549 } 1550 + 1551 + static void check_interrupt_provider(struct check *c, 1552 + struct dt_info *dti, 1553 + struct node *node) 1554 + { 1555 + struct property *prop; 1556 + 1557 + if (!node_is_interrupt_provider(node)) 1558 + return; 1559 + 1560 + prop = get_property(node, "#interrupt-cells"); 1561 + if (!prop) 1562 + FAIL(c, dti, node, 1563 + "Missing #interrupt-cells in interrupt provider"); 1564 + 1565 + prop = get_property(node, "#address-cells"); 1566 + if (!prop) 1567 + FAIL(c, dti, node, 1568 + "Missing #address-cells in interrupt provider"); 1569 + } 1570 + WARNING(interrupt_provider, check_interrupt_provider, NULL); 1571 + 1560 1572 static void check_interrupts_property(struct check *c, 1561 1573 struct dt_info *dti, 1562 1574 struct node *node) ··· 1636 1604 1637 1605 prop = get_property(irq_node, "#interrupt-cells"); 1638 1606 if (!prop) { 1639 - FAIL(c, dti, irq_node, "Missing #interrupt-cells in interrupt-parent"); 1607 + /* We warn about that already in another test. */ 1640 1608 return; 1641 1609 } 1642 1610 ··· 1860 1828 &deprecated_gpio_property, 1861 1829 &gpios_property, 1862 1830 &interrupts_property, 1831 + &interrupt_provider, 1863 1832 1864 1833 &alias_paths, 1865 1834
+31
scripts/dtc/dtc.h
··· 51 51 52 52 typedef uint32_t cell_t; 53 53 54 + static inline uint16_t dtb_ld16(const void *p) 55 + { 56 + const uint8_t *bp = (const uint8_t *)p; 57 + 58 + return ((uint16_t)bp[0] << 8) 59 + | bp[1]; 60 + } 61 + 62 + static inline uint32_t dtb_ld32(const void *p) 63 + { 64 + const uint8_t *bp = (const uint8_t *)p; 65 + 66 + return ((uint32_t)bp[0] << 24) 67 + | ((uint32_t)bp[1] << 16) 68 + | ((uint32_t)bp[2] << 8) 69 + | bp[3]; 70 + } 71 + 72 + static inline uint64_t dtb_ld64(const void *p) 73 + { 74 + const uint8_t *bp = (const uint8_t *)p; 75 + 76 + return ((uint64_t)bp[0] << 56) 77 + | ((uint64_t)bp[1] << 48) 78 + | ((uint64_t)bp[2] << 40) 79 + | ((uint64_t)bp[3] << 32) 80 + | ((uint64_t)bp[4] << 24) 81 + | ((uint64_t)bp[5] << 16) 82 + | ((uint64_t)bp[6] << 8) 83 + | bp[7]; 84 + } 54 85 55 86 #define streq(a, b) (strcmp((a), (b)) == 0) 56 87 #define strstarts(s, prefix) (strncmp((s), (prefix), strlen(prefix)) == 0)
+1 -1
scripts/dtc/flattree.c
··· 156 156 emit_offset_label(f, m->ref, m->offset); 157 157 158 158 while ((d.len - off) >= sizeof(uint32_t)) { 159 - asm_emit_cell(e, fdt32_to_cpu(*((fdt32_t *)(d.val+off)))); 159 + asm_emit_cell(e, dtb_ld32(d.val + off)); 160 160 off += sizeof(uint32_t); 161 161 } 162 162
+1 -1
scripts/dtc/libfdt/fdt_rw.c
··· 436 436 return struct_size; 437 437 } 438 438 439 - if (can_assume(LIBFDT_ORDER) | 439 + if (can_assume(LIBFDT_ORDER) || 440 440 !fdt_blocks_misordered_(fdt, mem_rsv_size, struct_size)) { 441 441 /* no further work necessary */ 442 442 err = fdt_move(fdt, buf, bufsize);
+1 -1
scripts/dtc/libfdt/fdt_sw.c
··· 32 32 /* 'memrsv' state: Initial state after fdt_create() 33 33 * 34 34 * Allowed functions: 35 - * fdt_add_reservmap_entry() 35 + * fdt_add_reservemap_entry() 36 36 * fdt_finish_reservemap() [moves to 'struct' state] 37 37 */ 38 38 static int fdt_sw_probe_memrsv_(void *fdt)
+8
scripts/dtc/libfdt/libfdt.h
··· 9 9 #include "libfdt_env.h" 10 10 #include "fdt.h" 11 11 12 + #ifdef __cplusplus 13 + extern "C" { 14 + #endif 15 + 12 16 #define FDT_FIRST_SUPPORTED_VERSION 0x02 13 17 #define FDT_LAST_SUPPORTED_VERSION 0x11 14 18 ··· 2072 2068 /**********************************************************************/ 2073 2069 2074 2070 const char *fdt_strerror(int errval); 2071 + 2072 + #ifdef __cplusplus 2073 + } 2074 + #endif 2075 2075 2076 2076 #endif /* LIBFDT_H */
+4 -4
scripts/dtc/treesource.c
··· 110 110 fprintf(f, "%02"PRIx8, *(const uint8_t*)p); 111 111 break; 112 112 case 2: 113 - fprintf(f, "0x%02"PRIx16, fdt16_to_cpu(*(const fdt16_t*)p)); 113 + fprintf(f, "0x%02"PRIx16, dtb_ld16(p)); 114 114 break; 115 115 case 4: 116 - fprintf(f, "0x%02"PRIx32, fdt32_to_cpu(*(const fdt32_t*)p)); 116 + fprintf(f, "0x%02"PRIx32, dtb_ld32(p)); 117 117 break; 118 118 case 8: 119 - fprintf(f, "0x%02"PRIx64, fdt64_to_cpu(*(const fdt64_t*)p)); 119 + fprintf(f, "0x%02"PRIx64, dtb_ld64(p)); 120 120 break; 121 121 } 122 122 if (p + width < end) ··· 183 183 nnotcelllbl++; 184 184 } 185 185 186 - if ((p[len-1] == '\0') && (nnotstring == 0) && (nnul < (len-nnul)) 186 + if ((p[len-1] == '\0') && (nnotstring == 0) && (nnul <= (len-nnul)) 187 187 && (nnotstringlbl == 0)) { 188 188 return TYPE_STRING; 189 189 } else if (((len % sizeof(cell_t)) == 0) && (nnotcelllbl == 0)) {
+1 -1
scripts/dtc/version_gen.h
··· 1 - #define DTC_VERSION "DTC 1.6.0-g87a656ae" 1 + #define DTC_VERSION "DTC 1.6.0-g9d7888cb"
+3 -3
scripts/dtc/yamltree.c
··· 59 59 sprintf(buf, "0x%"PRIx8, *(uint8_t*)(data + off)); 60 60 break; 61 61 case 2: 62 - sprintf(buf, "0x%"PRIx16, fdt16_to_cpu(*(fdt16_t*)(data + off))); 62 + sprintf(buf, "0x%"PRIx16, dtb_ld16(data + off)); 63 63 break; 64 64 case 4: 65 - sprintf(buf, "0x%"PRIx32, fdt32_to_cpu(*(fdt32_t*)(data + off))); 65 + sprintf(buf, "0x%"PRIx32, dtb_ld32(data + off)); 66 66 m = markers; 67 67 is_phandle = false; 68 68 for_each_marker_of_type(m, REF_PHANDLE) { ··· 73 73 } 74 74 break; 75 75 case 8: 76 - sprintf(buf, "0x%"PRIx64, fdt64_to_cpu(*(fdt64_t*)(data + off))); 76 + sprintf(buf, "0x%"PRIx64, dtb_ld64(data + off)); 77 77 break; 78 78 } 79 79