Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4172504ybf; Tue, 3 Mar 2020 22:00:32 -0800 (PST) X-Google-Smtp-Source: ADFU+vtQ/9MjYDqe5jIVUWQ4dyfLLaSPu8Qah8yuRcHGq6tTaZGNuKEwuCh6XCotVlYK6bm+kiP0 X-Received: by 2002:aca:bfc6:: with SMTP id p189mr697444oif.21.1583301632566; Tue, 03 Mar 2020 22:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583301632; cv=none; d=google.com; s=arc-20160816; b=vA/1+DomXEfX1rUp+xYFRMebJJ4m9bg2z5lGo7O0m1ixLClabWSNy3fZHRSI+vqP8f /2ncNTAC72yb8npnIbtvvR4NQ5iTo8eZPEW+HXRqLz5fvMwZU0LT/3qdt8Ik+bQugg0c HNuycALElmkvcQxGHVllGxrUzw4wxSO9dRH7Tm7spAShRBAGUJvQJODVIQankHJQBqlc tBlLWOe148Mz9A6CsA2kF5v0xcqvE5K3XRyW3TLUIVKt/gFQdLIve8IdJuS/S9osNM8J 0CozCXP5takUk3UhBHEp+drui0fIIfceDYlwK2h79kZFEuwmp+3dDnbjjUHaP78NprQT RMHA== 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=8yOktjIgVtQ+DxYaitW0rtjAH3g7r6cgxIGLvI0hfKc=; b=mRqverHDg5vA2N7ZQpw2l8+tIojggPSuGKl2kg+pT351PtPc+bitzA8mmIm+amiplP 860mmiV2mgCv0f7EVadc9M3/rn+y/BbFxF5DTwHYxxDQPNlbYE+jGFRW49/pmf3pAsBN Flm3oWfq0VEJBSAmadamOHt1QsLseguK+TPL1ieQoUV1sBlLCVoHBTso5YKyknK48jqv rg1/RNPLRpa4l+Ib7FuwvMfpcUUefrZEuQ3urkXlALPEiB5wMtwVCY2ZYkIozseWjubF fDVxBOcQQ/lhyA3GRLwBrYu1a8cpNVxnV8FlLB4Awxhta2hA7N9dW+EorlTzCLSc09oV BHMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QMTuLltf; 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 e7si592133oti.301.2020.03.03.22.00.19; Tue, 03 Mar 2020 22:00:32 -0800 (PST) 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=QMTuLltf; 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 S1727595AbgCDF7x (ORCPT + 99 others); Wed, 4 Mar 2020 00:59:53 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:38490 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725795AbgCDF7x (ORCPT ); Wed, 4 Mar 2020 00:59:53 -0500 Received: by mail-lf1-f66.google.com with SMTP id x22so459844lff.5 for ; Tue, 03 Mar 2020 21:59:51 -0800 (PST) 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=8yOktjIgVtQ+DxYaitW0rtjAH3g7r6cgxIGLvI0hfKc=; b=QMTuLltflpz8krzhzZvU/ySvNdJM9N55orENO2/SPexZXiDlLnDMEED0/Bk1ycYWMN wDu6T4rZAaq3xHA6j8mJe+Td8UZuIiSueaE2wLYxkNFugQHnxzwmRgzx4Ap0MndqZSs4 neTszAjSL81tpO1v0Wp9ERLGx+E4USTPNkxXg= 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=8yOktjIgVtQ+DxYaitW0rtjAH3g7r6cgxIGLvI0hfKc=; b=YI5REfq0sEtmSPNjUM57E5pbYMQ99/FNgkD/pZ9Yarj+yv0XowAG1rwI4gGWpuceWi nujDsaYbw8BDKWYxdbgyPuVbYZ4Y6QG46nSPVNZQGDTI9Uy3dKomzPtNU3408iXsVgxB Dq0ZTycljLtJWv1C1iDDnH5gfyY4ML85iyg3jvgy6NLyWcOL+WeHe7U6s+bwE8YdiXdb knZAyD5EHZ9Qn+jjXYwY5KaWZ5YLpOxVHOXg3Y5sdOcfE2JOQjs+FkOEYVKBbhsc3mC5 6VMczO8lG2FRP6OfoJ7951hpqeHICBGtZ//ALTD+VqMR0P9Vx/LNAO/NuhRnK95vhtFZ nqtg== X-Gm-Message-State: ANhLgQ0uzkpxKasrJGxtht15PYDkbKEFcaVPw3nxJ3pgSt+4Xr+GmP+f MJmIdyDd9UxIViaFchyjzUWRwft3QTKyvf5xK5Cw3g== X-Received: by 2002:ac2:4948:: with SMTP id o8mr949362lfi.201.1583301590650; Tue, 03 Mar 2020 21:59:50 -0800 (PST) MIME-Version: 1.0 References: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rayagonda Kokatanur Date: Wed, 4 Mar 2020 11:29:39 +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 Tue, Mar 3, 2020 at 10:26 AM 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; Hi Rob, waiting for your answer. > > > > > Rob