Browse Source

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>
main
Kumar Gala 6 years ago committed by David Gibson
parent
commit
403cc79f06
  1. 8
      checks.c

8
checks.c

@ -1036,6 +1036,7 @@ static const struct bus_type spi_bus = { @@ -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 @@ -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 @@ -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;

Loading…
Cancel
Save