* [PATCH] dtc: Remove warning for I2C_OWN_SLAVE_ADDRESS
@ 2020-05-08 6:39 Joel Stanley
2020-05-08 6:43 ` Joel Stanley
0 siblings, 1 reply; 2+ messages in thread
From: Joel Stanley @ 2020-05-08 6:39 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: devicetree, linux-kernel, Stephen Rothwell, Andrew Jeffery
dtc does a sanity check on reg properties that they are within the 10
bit address range for i2c slave addresses. In the case of multi-master
buses the binding may describe an address that the bus will listen on as
a device. Do not warn when this flag is set.
This fixes the following build warnings reported by Stephen:
arch/arm/boot/dts/aspeed-bmc-facebook-yosemitev2.dts:126.11-130.4:
Warning (i2c_bus_reg): /ahb/apb/bus@1e78a000/i2c-bus@80/ipmb1@10:
I2C bus unit address format error, expected "40000010"
arch/arm/boot/dts/aspeed-bmc-facebook-yosemitev2.dts:128.3-30:
Warning (i2c_bus_reg): /ahb/apb/bus@1e78a000/i2c-bus@80/ipmb1@10:reg:
I2C address must be less than 10-bits, got "0x40000010"
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
scripts/dtc/checks.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
index 4b3c486f1399..986754f858cf 100644
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -1022,6 +1022,8 @@ 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 (1 << 30)
+
static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
{
struct property *prop;
@@ -1044,6 +1046,8 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node
}
reg = fdt32_to_cpu(*cells);
+ /* Ingore 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,6 +1055,8 @@ 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++));
+ /* Ingore I2C_OWN_SLAVE_ADDRESS */
+ reg &= ~I2C_OWN_SLAVE_ADDRESS;
if (reg > 0x3ff)
FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"",
reg);
--
2.26.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] dtc: Remove warning for I2C_OWN_SLAVE_ADDRESS
2020-05-08 6:39 [PATCH] dtc: Remove warning for I2C_OWN_SLAVE_ADDRESS Joel Stanley
@ 2020-05-08 6:43 ` Joel Stanley
0 siblings, 0 replies; 2+ messages in thread
From: Joel Stanley @ 2020-05-08 6:43 UTC (permalink / raw)
To: Rob Herring, Frank Rowand
Cc: devicetree, Linux Kernel Mailing List, Stephen Rothwell, Andrew Jeffery
On Fri, 8 May 2020 at 06:39, Joel Stanley <joel@jms.id.au> wrote:
>
> dtc does a sanity check on reg properties that they are within the 10
> bit address range for i2c slave addresses. In the case of multi-master
> buses the binding may describe an address that the bus will listen on as
> a device. Do not warn when this flag is set.
>
> This fixes the following build warnings reported by Stephen:
>
> arch/arm/boot/dts/aspeed-bmc-facebook-yosemitev2.dts:126.11-130.4:
> Warning (i2c_bus_reg): /ahb/apb/bus@1e78a000/i2c-bus@80/ipmb1@10:
> I2C bus unit address format error, expected "40000010"
> arch/arm/boot/dts/aspeed-bmc-facebook-yosemitev2.dts:128.3-30:
> Warning (i2c_bus_reg): /ahb/apb/bus@1e78a000/i2c-bus@80/ipmb1@10:reg:
> I2C address must be less than 10-bits, got "0x40000010"
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> scripts/dtc/checks.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
> index 4b3c486f1399..986754f858cf 100644
> --- a/scripts/dtc/checks.c
> +++ b/scripts/dtc/checks.c
> @@ -1022,6 +1022,8 @@ 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 (1 << 30)
> +
> static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node *node)
> {
> struct property *prop;
> @@ -1044,6 +1046,8 @@ static void check_i2c_bus_reg(struct check *c, struct dt_info *dti, struct node
> }
>
> reg = fdt32_to_cpu(*cells);
> + /* Ingore I2C_OWN_SLAVE_ADDRESS */
Obviously that should say "Ignore", and similarly below. The wonders
of Friday afternoon patches.
> + 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,6 +1055,8 @@ 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++));
> + /* Ingore I2C_OWN_SLAVE_ADDRESS */
> + reg &= ~I2C_OWN_SLAVE_ADDRESS;
> if (reg > 0x3ff)
> FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"",
> reg);
> --
> 2.26.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-08 6:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08 6:39 [PATCH] dtc: Remove warning for I2C_OWN_SLAVE_ADDRESS Joel Stanley
2020-05-08 6:43 ` Joel Stanley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).