Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3008998ybf; Mon, 2 Mar 2020 20:56:53 -0800 (PST) X-Google-Smtp-Source: ADFU+vuvjiwMUXA2b6G6DiZu4vYp8+OKKUC7Yg9as2vb2ShaMKDqNpUDzOb78TbCmzpgLQQiI8F0 X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr1393293oij.0.1583211413489; Mon, 02 Mar 2020 20:56:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583211413; cv=none; d=google.com; s=arc-20160816; b=m/0jKso8CzrECNaMZdvf9Fzi60/nTs0z8VSlQ/DP2n1DByVRgTubFgIA9RmoivKiyk IDxEpr6l/BD6uWu7HKs/0T7t7gTQjb+3G4mf1CwowIq4Vyyj473qdhNrBsNyXmvGR+Wx caF15OcqbesDNQ/++EWl8+beH2MCgwL4VA5mHXI8HHKnnZJvJv4FmZZ2X8QYJ+4YBEkb auMqSmn+yR2AoeMx/Fuagv2ueB57arQWnFfxfbXliohD86RgwlF6JCtyJ1/kZLb+tF4m nlWidQaMoMGEP4tHt1zkZbdBjuEfvpPu/+1+qF47dGaHO4SL8AR69oWd6V2oGIt194Tv n4Ug== 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=hwMP5oZox6Y4kOGUdZo8BHcMoyromC78BYS7tU+3+Fk=; b=WQZnfZED5nWCbqT9PC4adLU9feNiUplhUoZmiNHr5BTWqKNhp3E12zQGaBz40DS3cz 9CoYNRqvYgyU/scGM4WULIyKh4ejIzlwkfrWcdPWoIQrRiFANwE0JPnCLW0X/DWh040m kbGttui6mxPCyU1+S1JYCSYFrGPEJEtqIxvHryCrpd3VuCtK9hS8SAvUKUSTp44tUNNI PpeQW+eNwRjhqTGPpFOqPjqDi+aysqlzGCMDRKduvhB8Dt4nXHErwFT2rWmasaCdUDpW 35Wno3qB/gQYGIFKh4pKdHH9+trGm+8LeEBKFVeDAy1ZJeS0TfrJ0dL1W3IAcP2xGfRN k/gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Yly52uOa; 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 i19si6693282oik.272.2020.03.02.20.56.40; Mon, 02 Mar 2020 20:56:53 -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=Yly52uOa; 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 S1727173AbgCCE4c (ORCPT + 99 others); Mon, 2 Mar 2020 23:56:32 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:47001 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbgCCE4b (ORCPT ); Mon, 2 Mar 2020 23:56:31 -0500 Received: by mail-lj1-f193.google.com with SMTP id h18so1947625ljl.13 for ; Mon, 02 Mar 2020 20:56:30 -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=hwMP5oZox6Y4kOGUdZo8BHcMoyromC78BYS7tU+3+Fk=; b=Yly52uOaENemYmwtIDMOdmo+8VrTj5xg18Z7UUH9uiXajRoem4QSxRLPJFruhRYRYd hdrpfzLuELidowjJAHZFwnCNPKVWkmkQT5CDniucu3T9czdQp5LfCU8weeHwijgWWDRt 8YahMYVv+4tGjxuE6Wc1HGjXpsdeM81uGySPE= 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=hwMP5oZox6Y4kOGUdZo8BHcMoyromC78BYS7tU+3+Fk=; b=XS3P+Of3gTKK5F62ondGl+CYRxNdipHniexkTpj6n0FoTotIAu1+qAyTzA5+l3bFMz 51dqqyWfXv/1khM2TJD8NO6x8BsQ4F5h0aT4MXPPBopXEpG8f5oX/TE0lXJQ9vScnOBx n85RydyJ1NXHzQFG8ktH1Og5nUDqMT0tJ9Js2GzqBD0abWGLf96mn6CCwvYD90KrPEUH b8ruexzwt0LOGXQ+Ky+yhP6SYyAVQOuGkWMceA0GleBQ0AGkO0nys0rlASOVRn8EXM3H ZCUbKHVZjOSElUd6XS44Jb0c/0vO55w73KNOEa+LhpmkVdBf0Tp5rIHSYVNhuPH8fHc8 lTtw== X-Gm-Message-State: ANhLgQ1Y5GiXVXrJligj2niRq8wiGNRu+JNuWnM4gCBrscmoLotjmn9+ SmG0Ii8m69UGSBLbQNsajTHQK+Tp8osa+2lY0MxWfw== X-Received: by 2002:a2e:2243:: with SMTP id i64mr1219121lji.264.1583211389300; Mon, 02 Mar 2020 20:56:29 -0800 (PST) MIME-Version: 1.0 References: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> In-Reply-To: From: Rayagonda Kokatanur Date: Tue, 3 Mar 2020 10:26:17 +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 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; > > Rob