Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1381488ybb; Wed, 25 Mar 2020 22:54:28 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtATMLnJr0wSIPbQe1YBwDB26BSVPc0E0UBWflqkxGITx3BRcDCgGuCYkKIJNi8gBynObUL X-Received: by 2002:a05:6830:18f4:: with SMTP id d20mr2439686otf.91.1585202067835; Wed, 25 Mar 2020 22:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585202067; cv=none; d=google.com; s=arc-20160816; b=xvr8YpMs6QcK4cDoJNEcLcvfmzXgNgBnKPMYI0gNHYQ5VwggQrxkx5IxH8Wa63uxIZ tG279KkE+K+mni7medqZYbJvJIBepWP0ah2HtXGbxuvM0JgesDu4Vf+X9d3oZHYcYI8V JFqnf6cdQ36RIRoIG3cHIrHC5EqUcchQCl3nNHyfKZ/qTMNnhEOjDxuID0YsxpbTxEvw yrDfzAaRmZx+agsWebCCDeqImNyaBEdveacb92CCbnUKACNYpmR5KtJj8s+S4fPLEHQX 0KhUtoDR7PC8qxQbMJaGeGnbSEHL1YtPx3EjX/LJRf9FR+sh2zMvTx2Ix+vAgy+ND4wz u4Tg== 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=OamWJL+Kraa8aO4Mkhy7ZkgdOxINecQMyrACLlFZPL8=; b=mIeoAOoCOjAEpYmQi3o9z76QnQ+OR90ZwJYjxUVtl5wLvIJa8bQ4jYJwLJj8XEJgHQ NmTyze7KMVFVcyZI3UdvAA2cNHw9C2E8MDtVkL1vbF2JX/pWGEmH8cISCFxILGtc0pN5 WFPLxplUgJh610ysPNOEVR9joNywsM1IJgZFlIp2/VaOlRNGZ6ZLc11BTt2fbdvTJsP+ marsJEz/Kco64B8NQLPe2LkUzfLQH0UoHfB1CJ8Mj5Tt16AhenUxru3axi6vRpj9WRAs PHjowIf+ohdgCH+9rPe68uKjHMQ6XbwfYNDNGCXZyqMd0SdyccFZ0299K7Y0ygNqzmks 36Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=DT5EldjK; 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 r3si661420otc.58.2020.03.25.22.54.15; Wed, 25 Mar 2020 22:54:27 -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=DT5EldjK; 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 S1726354AbgCZFxt (ORCPT + 99 others); Thu, 26 Mar 2020 01:53:49 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:44801 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbgCZFxs (ORCPT ); Thu, 26 Mar 2020 01:53:48 -0400 Received: by mail-lj1-f195.google.com with SMTP id p14so5090203lji.11 for ; Wed, 25 Mar 2020 22:53:47 -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=OamWJL+Kraa8aO4Mkhy7ZkgdOxINecQMyrACLlFZPL8=; b=DT5EldjKHxzvFeMbmuQkccpeMvDVkVAh7h2G1YJS+3oTIcBcOxVNUzo0njpHzC07aP qftgGWtlSjcONHnap3ytTGZvdBK5TrQ9qn/Fi3K9645uAI8eYdMrWfTPolE8/Dg6mHpI 4toDx71shQVGj2fSTCpufOkWDU/mXBnc5YV9I= 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=OamWJL+Kraa8aO4Mkhy7ZkgdOxINecQMyrACLlFZPL8=; b=myfNabWiKZxuHlUDTQdUoMFHeUdVWk+Buhiscnewjfr/RX/v3joWxOGbgZp7oqtcPk K8leVVas/ujWto0LhpHrll78wp0/Oqs45UQU+amc3G8NMSZ6iLvnwsgHh7rpX2SEY2GX Iik8F7/pjyCx/chOVUTo/VW/kLy0NPSbk274OK0rOeaXZzp/d9IMX6JM63c5beJEBR27 4k5PSXPz2UHi1h/orEJrC5TTaV0VBSojY+B7T1dpQf42d2OEYudZyign/xwtYz6QiMSd af9mWic7f0rIFC8dPMrkD4fmATskGZPSsplpIBv7+nqeYCmqEExOoPzk2O4TDl1+Wwkq Uyzg== X-Gm-Message-State: AGi0PuYZ56+Qtd/siTFT25Hx5/jt4vkHevjKWv5w/5aZ7ZqGCrM7DWqU COFpAsKQW/Z91TPROciXG60Q34albxkxP5ensnV6cQ== X-Received: by 2002:a2e:8511:: with SMTP id j17mr4191189lji.292.1585202026293; Wed, 25 Mar 2020 22:53:46 -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 11:23:34 +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 10:04 AM Rayagonda Kokatanur wrote: > > 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. Hi Rob, I have pushed separate patch which is prepared against dtc master branch. Please review. > > > > Rob