Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1334442ybb; Wed, 25 Mar 2020 21:35:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vutfNakvyw9tPrO4bNc81OdK48afZZBNa1eKYEtqh6ljN5vo9opkVK0G75z+OY4Z8Khr7M+ X-Received: by 2002:aca:5194:: with SMTP id f142mr644573oib.100.1585197357198; Wed, 25 Mar 2020 21:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585197357; cv=none; d=google.com; s=arc-20160816; b=FyRLHv6tPjSeh8s357J4lv64nMy2sF6d42Lg59bdJy3yOjaV5cqQ4w1AcNnCWd38Fd jqcSAoXX9gDDaXV6uZ0E+wCL0pzeK6NFUbgujWUczGRomJ8ETzOSpef9ONXGh5NLbm0w D2pd1ByaTEBbd2etomOAP7zjGPM2NEuc04D9e8L1lGzXroyuzUA8YGa83XDofx1DQf2t UaalRcu0XP3j5sbYTTbGHvD5VpMLMgoXkrpHt8T+fF6dVvR2y3xJDPywl/lnQ/YFJIQb 1kLFuczscifYvxf++1LL4dtxlSIeTvaIKi7y8v4ydKHzg1fFleLFCgDGbvsTy/BwfHfz Q3kQ== 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=8N6jteRVPBSL9hTxDMbTPuUm3mSUhds7WafEAkqE7jw=; b=kei26QYE/HJ7A500JXGWm4AFDxxUI40uKCW/N7KujoZonWGFCGgKsWnbinfaP6qjGy BEB+je4qO4O9eSscSkwGmE0nTqitPic1mHVY7IjaLheMouQrG2EDrbeWtEOP39iCr4Tv /5j5OmB6Xiy75ZgC6PitFTbUYCNYgHUWTCAMvgyFV7n5OMi7QB+1yTEksPhFLXn1DdYE 4eLqpjR53cTpmQ9Esq3M1qGh+V4ux5Jm4w5gDvnKW+1L0W2M6w5nFOJ6P/ey6rNg4Xmj Orp55FkOxEB9B8NXT+3HuqGgYHFm9RZUKXV6bTRkruWDTcrQ5cBkipyOFn7fGGPwvAQB FfmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=KciO4EZK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f128si511173oig.208.2020.03.25.21.35.36; Wed, 25 Mar 2020 21:35:57 -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=@broadcom.com header.s=google header.b=KciO4EZK; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726180AbgCZEei (ORCPT + 99 others); Thu, 26 Mar 2020 00:34:38 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34782 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbgCZEei (ORCPT ); Thu, 26 Mar 2020 00:34:38 -0400 Received: by mail-lf1-f65.google.com with SMTP id e7so3693777lfq.1 for ; Wed, 25 Mar 2020 21:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8N6jteRVPBSL9hTxDMbTPuUm3mSUhds7WafEAkqE7jw=; b=KciO4EZK2hclyE9/T7X1J0ARNvopk2V0eLpCC+8wuGdNqsQE5CdbJY7+BgazwCU0jJ yrnc3M22S6Bo5hRb/q8bG5FKLs5NkMi/ktDfvfK/U+RBYmAOtUza3MQqLjh7Df8M3iLX ZlA+S8usMAK2O5oGjSEhl/klH+DBLtPGLLojs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8N6jteRVPBSL9hTxDMbTPuUm3mSUhds7WafEAkqE7jw=; b=EQgz4MEYTvLJYCQhbsd0M/+d+USmT+myp0/Hv3fXxKLEoYet0Nf9+ElQ3K7BBJ+SdV 8EZ3T9Q4ITBCKsu3/OkvjQc2oyIMXMrBb1H9FGmmobiFezo4KVxpxSyWm9a7i5O2CQkz 4vHkm2/u4/Jrfy0/H8yuLScB/ogsRy5HoEO6VOZYcR2h1JGn+C4M4c7o6hyGOAYd7vzO c4cmhcBgtKm4RicU6kKV0hrV6R56FJ5AtKIks56KFe6jDhjF9GsyBayCASGdpfoo6DMY ofa9Sxhgfna4AH0ZxpomV6T68mQwc9KjRsHPLP1Xb34DepJaKEzBcz1g4aHAuqVUn8Vl 87TA== X-Gm-Message-State: ANhLgQ1oCD8AKoY0SJcnP79MKMBitwpUpC+V1/8pJxEBi2p9TE5eh74s PNA4nvCNpYUNasL6Q+EbwIQifwgMbGNekh1dcLVr8A== X-Received: by 2002:a19:be11:: with SMTP id o17mr4280893lff.168.1585197275279; Wed, 25 Mar 2020 21:34:35 -0700 (PDT) MIME-Version: 1.0 References: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rayagonda Kokatanur Date: Thu, 26 Mar 2020 10:04:23 +0530 Message-ID: Subject: Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr To: Rob Herring 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 Thu, Mar 26, 2020 at 12:37 AM Rob Herring wrote: > > 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. Thank you, will do as per your suggestion and send v2. > > Rob