From 403cc79f06a135aee00f35cea975f068a72dbd92 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 13 Nov 2018 16:40:10 -0600 Subject: [PATCH] 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 Signed-off-by: David Gibson --- checks.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/checks.c b/checks.c index 1c398d5..ed84e03 100644 --- a/checks.c +++ b/checks.c @@ -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;