linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
@ 2020-02-28  8:48 Rayagonda Kokatanur
  2020-02-28 13:49 ` Rob Herring
  0 siblings, 1 reply; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-02-28  8:48 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand, devicetree, linux-kernel,
	bcm-kernel-feedback-list
  Cc: Rayagonda Kokatanur

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 <rayagonda.kokatanur@broadcom.com>
---
 scripts/dtc/Makefile | 2 +-
 scripts/dtc/checks.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
  */
 
+#include <linux/bits.h>
 #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);
 		if (reg > 0x3ff)
 			FAIL_PROP(c, dti, node, prop, "I2C address must be less than 10-bits, got \"0x%x\"",
 				  reg);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-02-28  8:48 [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr Rayagonda Kokatanur
@ 2020-02-28 13:49 ` Rob Herring
  2020-03-03  4:56   ` Rayagonda Kokatanur
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2020-02-28 13:49 UTC (permalink / raw)
  To: Rayagonda Kokatanur
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> ---
>  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
>   */
>
> +#include <linux/bits.h>

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-02-28 13:49 ` Rob Herring
@ 2020-03-03  4:56   ` Rayagonda Kokatanur
  2020-03-03 16:12     ` Frank Rowand
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-03-03  4:56 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
>
> On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > ---
> >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> >   */
> >
> > +#include <linux/bits.h>
>
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-03  4:56   ` Rayagonda Kokatanur
@ 2020-03-03 16:12     ` Frank Rowand
  2020-03-04  5:59     ` Rayagonda Kokatanur
  2020-03-25 19:07     ` Rob Herring
  2 siblings, 0 replies; 9+ messages in thread
From: Frank Rowand @ 2020-03-03 16:12 UTC (permalink / raw)
  To: Rayagonda Kokatanur, Rob Herring
  Cc: devicetree, linux-kernel, maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On 3/2/20 10:56 PM, Rayagonda Kokatanur wrote:
> On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
>>
>> On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
>> <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
>>> ---
>>>  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.

Info about the dtc upstream project:

   https://elinux.org/Device_Tree_Reference#dtc_.28upstream_project.29

And the mail list to submit the patch to:

   https://elinux.org/Device_Tree_Reference#Device-tree_Compiler_and_Tools_Mailing_List

-Frank

>>
>>
>>> 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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
>>>   */
>>>
>>> +#include <linux/bits.h>
>>
>> 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
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-03  4:56   ` Rayagonda Kokatanur
  2020-03-03 16:12     ` Frank Rowand
@ 2020-03-04  5:59     ` Rayagonda Kokatanur
  2020-03-24  5:41       ` Rayagonda Kokatanur
  2020-03-25 19:07     ` Rob Herring
  2 siblings, 1 reply; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-03-04  5:59 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Tue, Mar 3, 2020 at 10:26 AM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
> >
> > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > > ---
> > >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> > >   */
> > >
> > > +#include <linux/bits.h>
> >
> > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-04  5:59     ` Rayagonda Kokatanur
@ 2020-03-24  5:41       ` Rayagonda Kokatanur
  0 siblings, 0 replies; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-03-24  5:41 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Wed, Mar 4, 2020 at 11:29 AM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> On Tue, Mar 3, 2020 at 10:26 AM Rayagonda Kokatanur
> <rayagonda.kokatanur@broadcom.com> wrote:
> >
> > On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
> > >
> > > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > > <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > > > ---
> > > >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> > > >   */
> > > >
> > > > +#include <linux/bits.h>
> > >
> > > 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.
Hi Rob,
Waiting for your answer.

>
> >
> > >
> > > Rob

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-03  4:56   ` Rayagonda Kokatanur
  2020-03-03 16:12     ` Frank Rowand
  2020-03-04  5:59     ` Rayagonda Kokatanur
@ 2020-03-25 19:07     ` Rob Herring
  2020-03-26  4:34       ` Rayagonda Kokatanur
  2 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2020-03-25 19:07 UTC (permalink / raw)
  To: Rayagonda Kokatanur
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Mon, Mar 2, 2020 at 9:56 PM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
> >
> > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > > ---
> > >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> > >   */
> > >
> > > +#include <linux/bits.h>
> >
> > 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.

Rob

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-25 19:07     ` Rob Herring
@ 2020-03-26  4:34       ` Rayagonda Kokatanur
  2020-03-26  5:53         ` Rayagonda Kokatanur
  0 siblings, 1 reply; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-03-26  4:34 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Thu, Mar 26, 2020 at 12:37 AM Rob Herring <robh+dt@kernel.org> wrote:
>
> On Mon, Mar 2, 2020 at 9:56 PM Rayagonda Kokatanur
> <rayagonda.kokatanur@broadcom.com> wrote:
> >
> > On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
> > >
> > > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > > <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > > > ---
> > > >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> > > >   */
> > > >
> > > > +#include <linux/bits.h>
> > >
> > > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr
  2020-03-26  4:34       ` Rayagonda Kokatanur
@ 2020-03-26  5:53         ` Rayagonda Kokatanur
  0 siblings, 0 replies; 9+ messages in thread
From: Rayagonda Kokatanur @ 2020-03-26  5:53 UTC (permalink / raw)
  To: Rob Herring
  Cc: Frank Rowand, devicetree, linux-kernel,
	maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE

On Thu, Mar 26, 2020 at 10:04 AM Rayagonda Kokatanur
<rayagonda.kokatanur@broadcom.com> wrote:
>
> On Thu, Mar 26, 2020 at 12:37 AM Rob Herring <robh+dt@kernel.org> wrote:
> >
> > On Mon, Mar 2, 2020 at 9:56 PM Rayagonda Kokatanur
> > <rayagonda.kokatanur@broadcom.com> wrote:
> > >
> > > On Fri, Feb 28, 2020 at 7:20 PM Rob Herring <robh+dt@kernel.org> wrote:
> > > >
> > > > On Fri, Feb 28, 2020 at 2:48 AM Rayagonda Kokatanur
> > > > <rayagonda.kokatanur@broadcom.com> 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 <rayagonda.kokatanur@broadcom.com>
> > > > > ---
> > > > >  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 <dwg@au1.ibm.com>, IBM Corporation.  2007.
> > > > >   */
> > > > >
> > > > > +#include <linux/bits.h>
> > > >
> > > > 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-03-26  5:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28  8:48 [PATCH v1 1/1] scripts: dtc: mask flags bit when check i2c addr Rayagonda Kokatanur
2020-02-28 13:49 ` Rob Herring
2020-03-03  4:56   ` Rayagonda Kokatanur
2020-03-03 16:12     ` Frank Rowand
2020-03-04  5:59     ` Rayagonda Kokatanur
2020-03-24  5:41       ` Rayagonda Kokatanur
2020-03-25 19:07     ` Rob Herring
2020-03-26  4:34       ` Rayagonda Kokatanur
2020-03-26  5:53         ` Rayagonda Kokatanur

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).