diff options
author | Kumar Gala <kumar.gala@linaro.org> | 2018-11-13 16:40:10 -0600 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-11-14 14:25:43 +1100 |
commit | 403cc79f06a135aee00f35cea975f068a72dbd92 (patch) | |
tree | b158ab4a21b010d56f9b2ed74b7a8b944dd649f2 | |
parent | baa1d2cf7894a32bf2f640ef40ebce561b2df565 (diff) | |
download | dtc-403cc79f06a135aee00f35cea975f068a72dbd92.zip dtc-403cc79f06a135aee00f35cea975f068a72dbd92.tar.gz dtc-403cc79f06a135aee00f35cea975f068a72dbd92.tar.bz2 |
checks: Update SPI bus check for 'spi-slave'
If the SPI bus controller is being used for 'spi-slave' mode some of the
checks we have need to change:
In 'spi-slave' mode #address-cells should be 0, as any children don't
have a reg property.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | checks.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1036,6 +1036,7 @@ static const struct bus_type spi_bus = { static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct node *node) { + int spi_addr_cells = 1; if (strprefixeq(node->name, node->basenamelen, "spi")) { node->bus = &spi_bus; @@ -1064,7 +1065,9 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no if (node->bus != &spi_bus || !node->children) return; - if (node_addr_cells(node) != 1) + if (get_property(node, "spi-slave")) + spi_addr_cells = 0; + if (node_addr_cells(node) != spi_addr_cells) FAIL(c, dti, node, "incorrect #address-cells for SPI bus"); if (node_size_cells(node) != 0) FAIL(c, dti, node, "incorrect #size-cells for SPI bus"); @@ -1083,6 +1086,9 @@ static void check_spi_bus_reg(struct check *c, struct dt_info *dti, struct node if (!node->parent || (node->parent->bus != &spi_bus)) return; + if (get_property(node->parent, "spi-slave")) + return; + prop = get_property(node, "reg"); if (prop) cells = (cell_t *)prop->val.val; |