Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp685799ybf; Fri, 28 Feb 2020 05:50:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxKgSETH2R8YUIoanpyf6BkLR6ph7VaK6fHBcXG3/39KI3HPFvMpvgNNxa3WkB3eQDT25Qn X-Received: by 2002:a9d:5e82:: with SMTP id f2mr3296272otl.240.1582897845848; Fri, 28 Feb 2020 05:50:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582897845; cv=none; d=google.com; s=arc-20160816; b=pC4J9OHUQ5+npTuGrarqAMMcP/5w06wC8+tel60g7v5udfsltYBZ9rvHwZoxiEBBxX Hrd454iCVW+acBTWHnSBxCyMzEp5L6nsg9uz6oSol/T0Wsc2w8JJ6HWw976kLaBFXyrF nD8m8KPm1oRvAptM/HPYrUIBAxnH3YN5FBPob6hESnhUIIy2DXxOPrHwIdlnJvHE/chd ZZ7sAieZYv+dknFPb3ww6+fbqBrWaEMMoYFRmoQ9rYTwvU2xg2JNGDpw/YsE/YBK5P8u Wz1mmGgt3WTPIq33zqKjx934If1qdkl3N9Mhv5l5GT09mAL+ksvCUQy2gvaMPn/PjspR wuTA== 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=o/9VLNwUkUrCJ7dV/sGea6VIXxPkMToM+MSLDCzk7wQ=; b=jwLskGbAah0FQVy8pruvdJPQhsSd9FnDFaBcms0Jd5GxjBxRGkoaLU5zAGYr5G5jZt 4+otSlnpuPf4jhRzBfNRL679hAz6ppwLfoZDocjwhs1XUuK6znnsr9PnqCvJ2pr7nzsd pJKPkLg9IGfPS2JbhzBEfbs9oBzwG8Gu09fG+Mx5x32aNqPjocJwoRb5hb+juMnA/8yg 8CU3JRLwJ1BQeRlbBRFQa1I3AaAwK8TgI9r4zRVlo7a5AWYbkEYdNWRZ9ipFSUwh84xN u9a7Ag5bnB6TUFdQjVEXhd/WQ0DoceJZ6LnTT+AdlvHFXD06GY+RIvQ6ULcBpUI5TXcW HZLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mUnZCSMM; 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 t11si1680643otm.47.2020.02.28.05.50.33; Fri, 28 Feb 2020 05:50:45 -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=@kernel.org header.s=default header.b=mUnZCSMM; 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 S1726766AbgB1NuL (ORCPT + 99 others); Fri, 28 Feb 2020 08:50:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:51814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725892AbgB1NuK (ORCPT ); Fri, 28 Feb 2020 08:50:10 -0500 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 E839A246AC; Fri, 28 Feb 2020 13:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582897810; bh=AenvJB04PGqxvh0r1u1fNLP1JQNsy7lc4FSuIxM11sk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=mUnZCSMM9LEbGnCEw35f28QV3pBkme8CDwX4/BDxk9H2Ji7Vi0TObAnCYbe9XEvQC +95CGAuJPQXEVGi8dnTZP0Q+EbYIODpIFXLzn+EcKT/Zd47JHc412n1RGzMq3KHCPa EC+gibBft58i3mw0DfO4DyUeBXAHiskz1n0IrR98= Received: by mail-qk1-f179.google.com with SMTP id p62so240972qkb.0; Fri, 28 Feb 2020 05:50:09 -0800 (PST) X-Gm-Message-State: APjAAAW61S2/+a8EkfiR/oSS+1Tv/vpJDGBjkAAsbFf8mffVeKOjJYzj lxPD5BbkRRpGbv3GFeOsg8vsb0WQYjV1wynrfA== X-Received: by 2002:a05:620a:12a3:: with SMTP id x3mr4606535qki.254.1582897809072; Fri, 28 Feb 2020 05:50:09 -0800 (PST) MIME-Version: 1.0 References: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> In-Reply-To: <20200228084842.18691-1-rayagonda.kokatanur@broadcom.com> From: Rob Herring Date: Fri, 28 Feb 2020 07:49:57 -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 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. > 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. Rob