From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joel Stanley Subject: [PATCH v2 1/2] checks: Remove warning for I2C_OWN_SLAVE_ADDRESS Date: Thu, 28 May 2020 16:50:36 +0930 Message-ID: <20200528072037.1402346-2-joel@jms.id.au> References: <20200528072037.1402346-1-joel@jms.id.au> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FiQqSNUhCv6yJ3YkfxLNYN6qXN3BR0Yb2SyZoRmzP9o=; b=nPbOvky+lTrWfAhyXZSq79WgJY+Sx0uCpikjEAUK8tm7a+LHU/tQtS7R/tIB0lKfWA +SxGyA6kH+Om7lfgQg1sR/+zVHyuURBsM/gLDtm+AnLIVrYb7DlEERys4QO+8SryE42X Do3d7MgpOdEDIaRYhZvXtHMydMzonDOJsfgau5bZ0qZo9cCNZrLsR5vK5qPpoWua/L1d Gz0ITQIawcxFx3fdwbS47+0PzBeYlHA8spRBg4vjgfDFBBdLLxtFKQMfRHezjb3O8IlH DbSIQdbxNhHnfTiBVtKHsyh581Oui2o8OqeGmmdG397ZmZLbisoguQHLsYHCGBtUv+Mx ECuQ== In-Reply-To: <20200528072037.1402346-1-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org> Sender: devicetree-compiler-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: text/plain; charset="us-ascii" To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Gibson Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Stephen Rothwell , Arnd Bergmann 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 or devices that act as a slave, the binding may describe an address that the bus will listen on as a device. Do not warn when this flag is set. See Documentation/devicetree/bindings/i2c/i2c.txt. This fixes the following build warnings reported by Stephen and by Arnd: 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 Reported-by: Arnd Bergmann Signed-off-by: Joel Stanley --- v2: Fix typo --- checks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checks.c b/checks.c index a8213c0e13a8..feb1721f2603 100644 --- a/checks.c +++ b/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); + /* Ignore 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++)); + /* Ignore 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