Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp923799ybb; Wed, 25 Mar 2020 12:09:28 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtiqH6ZnD2VTPj03OFlbkHl/Q3zz4UrgG8V6aTfJoAIg+WvucrukB96ka8vswmsI3pLUvKF X-Received: by 2002:a9d:5a9:: with SMTP id 38mr3346366otd.331.1585163368272; Wed, 25 Mar 2020 12:09:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585163368; cv=none; d=google.com; s=arc-20160816; b=Z3AeyvoubXkfGBn0/j/N+MCAd8VMIhsZKlJavUysJ+QVS2288bos9ra9DSW43jZmU4 77uhXTw3klZEEuHM94LKRDKmjNZMpTBvrac7XUtx9tF461ISccNgai18V5o5BTDhfgQC 0gzjLg1/oE/5CzY6nsivY44Z2xfiOErqjOgryMTjxJij81nxzBTHWK7MCPlomqUJXNwJ Kuam3+0UGdYcVvWe443LEgt0F3NZ1uGldej+LcgnjcjreBx9veDBXYjPH8Unt5wsieSm uO1+oAk5YwXvvolnEft3JuBVEm7GHIEhZiHi4Ds/5oJ0Apu6O/zjdZIQ+lJgIbmJratg NPaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QygK5uqCOWZDp/6lrqG0VlnOW9Kmg97R8cy+YkqoBqo=; b=vk5e2ItVP7vJfuJLwHNtmbTYZv5l/T+CxEbidnzGqNEQdzjNFHH4nYQTlAKxihcmDc hRf7zpZUx3TS2AYTTwkD/5K7FPq7zWN/dXWdHNLtjrtkOUl3ffSoevNTw+VTDUEoYmh+ jAAnJ/SPv+4VX2JJx7TOgEfLW56jkFAZh8keMAJm+HQWlD8twLL/ZHhYtCbsr/T/sXmm +pK9kfYP0f+g+LuZHwbnBkiV+HfzdjgRJvRTUFbtrK43kpErNvRPleHjzk3XbqPzeAeI M4e9OdizJbf8xWHZBz6K+biDMb/tWf1wc9Q12XFb03NyCgSuMwJG8EvHCDsgoRd/L+vI YWlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AvNzVfws; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si149977oie.27.2020.03.25.12.09.02; Wed, 25 Mar 2020 12:09:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AvNzVfws; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727652AbgCYTH7 (ORCPT + 99 others); Wed, 25 Mar 2020 15:07:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:58452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727027AbgCYTH7 (ORCPT ); Wed, 25 Mar 2020 15:07:59 -0400 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 78E4D20714; Wed, 25 Mar 2020 19:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585163278; bh=26Uk9meXN96js/gICre78nVAjflPsXGx6aYynHLKmGM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AvNzVfwsdnqkrxQA3Q54688/DCKofvQC6qVJnKLKNUAHGTtn/glf39ws7XSzGyjyK DHlQ9CRU1d5aMFU6cDgTsp/E+WIaxcwoZ7pSlyS+RsCa213Zyx80G7kxDYwrYSJpfw fQ64BNPKo5N2iJxYJT6DPUH272YT//TfiC386tPY= Received: by mail-qt1-f181.google.com with SMTP id i3so3174372qtv.8; Wed, 25 Mar 2020 12:07:58 -0700 (PDT) X-Gm-Message-State: ANhLgQ0gOoaNzaD+wq+W3uVDHpZb3ZuNBvRqe6DqZVI70un/tWt8YdWy 7vQ8GZEuaWQV0+WJd7ACm9Y7pJRRzrFSx0NOWw== X-Received: by 2002:ac8:59:: with SMTP id i25mr4605237qtg.110.1585163272778; Wed, 25 Mar 2020 12:07:52 -0700 (PDT) MIME-Version: 1.0 References: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rob Herring Date: Wed, 25 Mar 2020 13:07:41 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr To: Rayagonda Kokatanur Cc: Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 2, 2020 at 9:56 PM Rayagonda Kokatanur wrote: > > On Fri, Feb 28, 2020 at 7:20 PM Rob Herring wrote: > > > > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur > > wrote: > > > > > > Generally i2c addr should not be greater than 10-bit. The highest 2 bits > > > are used for I2C_TEN_BIT_ADDRESS and I2C_OWN_SLAVE_ADDRESS. Need to mask > > > these flags if check slave addr valid. > > > > > > Signed-off-by: Rayagonda Kokatanur > > > --- > > > scripts/dtc/Makefile | 2 +- > > > scripts/dtc/checks.c | 5 +++++ > > > 2 files changed, 6 insertions(+), 1 deletion(-) > > > > dtc changes must be submitted against upstream dtc. > > Please let me know link to clone the upstream dtc branch. > > > > > > > diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile > > > index 3acbb410904c..c5e8d6a9e73c 100644 > > > --- a/scripts/dtc/Makefile > > > +++ b/scripts/dtc/Makefile > > > @@ -9,7 +9,7 @@ dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \ > > > dtc-objs += dtc-lexer.lex.o dtc-parser.tab.o > > > > > > # Source files need to get at the userspace version of libfdt_env.h to compile > > > -HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt > > > +HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt -I$(srctree)/tools/include > > > > > > ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),) > > > ifneq ($(CHECK_DTBS),) > > > diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c > > > index 756f0fa9203f..17c9ed4137b5 100644 > > > --- a/scripts/dtc/checks.c > > > +++ b/scripts/dtc/checks.c > > > @@ -3,6 +3,7 @@ > > > * (C) Copyright David Gibson , IBM Corporation. 2007. > > > */ > > > > > > +#include > > > > Not a UAPI header not that that would be much better as dtc also builds on Mac. > > > > > #include "dtc.h" > > > #include "srcpos.h" > > > > > > @@ -17,6 +18,9 @@ > > > #define TRACE(c, fmt, ...) do { } while (0) > > > #endif > > > > > > +#define I2C_TEN_BIT_ADDRESS BIT(31) > > > +#define I2C_OWN_SLAVE_ADDRESS BIT(30) > > > + > > > enum checkstatus { > > > UNCHECKED = 0, > > > PREREQ, > > > @@ -1048,6 +1052,7 @@ 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++)); > > > + reg &= ~(I2C_OWN_SLAVE_ADDRESS | I2C_TEN_BIT_ADDRESS); > > > > I'd just mask the top byte so we don't have to update on the next flag we add. > Do you mean something like this, shown below ? > reg &= 0xFFFF_FC000; Yes, but as I said, the 'top byte', so 0xFF000000. Rob