Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2423560ybt; Sun, 21 Jun 2020 20:14:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzCsYbzrzQtLg3L4Zv0L3157hlpYfi57t5s+37uQ9SAgktR2UKCvJZu6kCMZqVljKrs+yo X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr15029926edb.181.1592795666376; Sun, 21 Jun 2020 20:14:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592795666; cv=none; d=google.com; s=arc-20160816; b=GquOMtBl+xB/B6hA5g0u2q/NU9yZd7fq1cDgiFSt1GSn7oWDTMk3Z//bn5yVRM1lxE TKO9gmJd3W5En32SdDwwdPyLd8cHDhlUyQiJnwPFMrQwjKzXy3QpEB7T4gMogppXT8+y 6C5HmxgAVPL7X7jCI/fF2oLklPrjmSW/S/1sgDuzN8bWUA1s2s7Sa0hGQI5dpab8CqNw yLgxF62Clp3O92VR0bAdlG7v7T2ffdjzyEkhb6EejRYmYYKfwRqeHBDMnlqvzzTAFIrg zg6i4qU/9SvAgxejzFtgWruyHEGmD0LYwh5ihmCPa0cTlg6fHyMKs16XqLK6vJAnmMZ7 rIng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=c949isyo7HKGnW1Ad1cAo7HT25ekL/Ae8OWsa7R3Ws0=; b=NQX2ChHYxqNj942c31GaikSS+hVPCSkWgujCi3uTzi9YCT7AcjrkPgzeDlsKu9aCGI lKUv+v0mnQCvVB96wPOnc2Vskr+4qWInVM3jnd53jxLUui7fJhmaIgMYiBWybUbZARnb N3TAzMWD2i8f3yDhdazuap0mWZFQsoR/DSRZjLQQrtXjObePdI8QnjtfGiahmM59AMzM 0NmR0dVLPJFmhClG6g7J5k2clKnERdW1uvvefUF9xyYjRgL+xxDggZ2rH26vndgtvn/v NBv0mUB/g9LlD8QgT3hIw3vJ9FXIrjy/OvOuu5+yX6EeEFCT8sF2xDuIjIBoMX7+O8NH ZUtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="PGdnrq/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a25si8091021ejb.697.2020.06.21.20.14.04; Sun, 21 Jun 2020 20:14:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="PGdnrq/Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731142AbgFVDK0 (ORCPT + 99 others); Sun, 21 Jun 2020 23:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbgFVDKZ (ORCPT ); Sun, 21 Jun 2020 23:10:25 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60BE5C061794; Sun, 21 Jun 2020 20:10:25 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id l11so15111957wru.0; Sun, 21 Jun 2020 20:10:25 -0700 (PDT) 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=c949isyo7HKGnW1Ad1cAo7HT25ekL/Ae8OWsa7R3Ws0=; b=PGdnrq/Yi5lFlYXeausei2Zw5XttyDz2AR2Mk7PlmENHhi74J8zaU5B0BHk/J6AeDs 7gp53pLzw3Eq3iZTn8VO3iaZ5FI5149iZCuKuYauOBg8tyQplM4ezGXc2zC6oWmJiwkW KVdG/nA+dATz2WirwgPA86cynecvGh2ONVNbVa7m3LUOYQT9/U/zE5DHCTU6/8h0zuUa Ndtfl/UfDnF8bsqCN1HRZu8HD0rAJjPTyHEyr/gv/ulplWW+y4anJUNRwdBdNJ6x2LA3 Y3yPLS6q50RQYTEx1J9jpDbAyaVFWH+5ZZ/OunJ4cDitmaVwFBgtRymHUVtOYAur9gF3 NAMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=c949isyo7HKGnW1Ad1cAo7HT25ekL/Ae8OWsa7R3Ws0=; b=aZ7wjPuSSHsHdqAm9VegImM5ueEsS/bhz0qxslzZgyF8JO0WI+n8CwyoiiZmotrUQM Gpglt2i3joi6hz/XsSqNWCPUv6W3fwaSSwI9H4RSBQH/dZePiysUDuW9nZpXBAD8a6ht c3N23FqZTVyjnDaLtZB6XEF7Z9EzfOSHIMkqLCGJOlm05eNcujJncVn5TpLbN9Hs0p/d RvXLRhfzewKxyIZB57b6W++D1N1Z+g3glGqGzwM1ghgHkjllXGJPkcpyhpHlQzLP9Tkx MAtJEH1TKUD3UQNj42Ok04Xit9wY2tx1plKd3PExbokCP+8MQGaZw1rM6e9LcuzfI1zU Xc5g== X-Gm-Message-State: AOAM531aETjVYEQ6e47WhRjJOzVMzczYF96ao8+x8hU7xMby0p/LjRLy DNN8wkpJ6dB3/305oyEPeu2cLnIcH6U= X-Received: by 2002:a5d:4bc8:: with SMTP id l8mr1241890wrt.159.1592795423922; Sun, 21 Jun 2020 20:10:23 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id y196sm10031766wmd.11.2020.06.21.20.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jun 2020 20:10:23 -0700 (PDT) From: Joel Stanley To: devicetree-compiler@vger.kernel.org, David Gibson Cc: linux-kernel@vger.kernel.org, Stephen Rothwell , Arnd Bergmann Subject: [PATCH v4 1/2] checks: Remove warning for I2C_OWN_SLAVE_ADDRESS Date: Mon, 22 Jun 2020 12:40:04 +0930 Message-Id: <20200622031005.1890039-2-joel@jms.id.au> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200622031005.1890039-1-joel@jms.id.au> References: <20200622031005.1890039-1-joel@jms.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v4: Add U to define --- checks.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checks.c b/checks.c index a8213c0e13a8..69b0156c940c 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 (1U << 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.27.0