Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

2020-04-01 Thread Thierry Reding
On Wed, Apr 01, 2020 at 10:35:23PM +0200, Tom Warren wrote:
> -Original Message-
> From: Thierry Reding  
> Sent: Wednesday, April 1, 2020 8:20 AM
> To: Tom Warren 
> Cc: Peter Robinson ; tomcwarren3...@gmail.com; 
> u-boot@lists.denx.de; Stephen Warren ; Jonathan Hunter 
> ; Vishruth Jain 
> Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT
> 
> On Wed, Apr 01, 2020 at 02:03:09AM +0200, Tom Warren wrote:
> > -Original Message-
> > From: Peter Robinson 
> > Sent: Tuesday, March 31, 2020 3:54 AM
> > To: tomcwarren3...@gmail.com
> > Cc: u-boot@lists.denx.de; Stephen Warren ; Thierry 
> > Reding ; Jonathan Hunter ; 
> > Tom Warren ; Vishruth Jain 
> > Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT
> > 
> > External email: Use caution opening links or attachments
> > 
> > 
> > > From: Stephen Warren 
> > >
> > > This adds to the DT the I2C controllers that connect to the board ID 
> > > EEPROM, camera board EEPROM, etc. With this change, you can now 
> > > probe all I2C devices on a TX1 board.
> > >
> > > Signed-off-by: Tom Warren 
> > > ---
> > >  arch/arm/dts/tegra210-p2371-2180.dts | 18 ++
> > >  1 file changed, 18 insertions(+)
> > >
> > > diff --git a/arch/arm/dts/tegra210-p2371-2180.dts
> > > b/arch/arm/dts/tegra210-p2371-2180.dts
> > > index c2f497c..d982b5f 100644
> > > --- a/arch/arm/dts/tegra210-p2371-2180.dts
> > > +++ b/arch/arm/dts/tegra210-p2371-2180.dts
> > > @@ -12,6 +12,9 @@
> > >
> > > aliases {
> > > i2c0 = "/i2c@7000d000";
> > > +   i2c2 = "/i2c@7000c400";
> > > +   i2c3 = "/i2c@7000c500";
> > > +   i2c5 = "/i2c@546c0c00";
> > 
> > I don't think this is correct, it doesn't show up in U-Boot with the 
> > "i2c bus" command where the others do, looking in the tegra210.dtsi it 
> > looks like it should be i2c@546c?
> > [Tom] That I2C address is working in downstream (L4T) TX1 U-Boot.  The 
> > VI_I2C controller is a little weird, it's normal I2C registers are 
> > offset from base by 0xC00.  A different driver is needed, but I 
> > haven't posted it yet upstream.  I should probably drop if from the 
> > DTS for now until I post the VI_I2C driver.
> 
> I think the problem here is that the upstream U-Boot device tree
> doesn't contain an i2c@546c0c00 node. Instead it has i2c@546c,
> which we also have in the upstream kernel. My recollection is that
> that's also the address listed in the Tegra210 system address map of
> the TRM and there are some registers before the regular I2C interface
> at offset 0xc00.
> 
> I've been carrying a patch against the upstream Linux I2C controller
> driver to special-case the VI/I2C to always add that 0xc00 offset when
> accessing registers, which allows us to reuse the existing driver and
> at the same time keeps all registers mapped so we can also access the
> VI/I2C specific registers.
> 
> My recollection is that the U-Boot driver is fairly similar to the
> Linux driver, so I suspect something similar could be done.
> 
> Thierry
> [Tom] Thanks, Thierry. That's my recollection, too, about the VI_I2C
> 0xC00 offset. I'll take a look at what we have in L4T U-Boot for T210
> and address it in a set of patches for upstream soon.  That I2C
> controller isn't used for anything on any Jetson board except on TX1,
> I believe, where it allows U-Boot to talk to the camera add-in board
> to read the board ID. But we've moved all that out to CBoot (board ID
> EEPROM reading), so there isn't a pressing need for it in U-Boot
> anymore, IIRC.

We've had internal discussions about potentially using the ID EEPROMs to
dynamically modify the kernel DTB at runtime (possibly from U-Boot) in
order to support things like different add-in boards.

For example, we currently enable the DSI output in Linux for Jetson TX1.
However, the Jetson TX1 developer kits don't actually ship with that DSI
display (I don't think they even come with the display add-in card), so
this can lead to confusion. The idea was to have U-Boot probe ID EEPROMs
from several sources to determine what to add to the device tree, so
that the kernel DT *source* would only contain the standard developer
kit hardware, but U-Boot (or something else perhaps) could add in extra
nodes for a display module, or camera add-in board, etc.

Note that this is just a vague idea at this time and nothing concrete
has been done to implement this, yet.

Thierry


signature.asc
Description: PGP signature


RE: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

2020-04-01 Thread Tom Warren
-Original Message-
From: Thierry Reding  
Sent: Wednesday, April 1, 2020 8:20 AM
To: Tom Warren 
Cc: Peter Robinson ; tomcwarren3...@gmail.com; 
u-boot@lists.denx.de; Stephen Warren ; Jonathan Hunter 
; Vishruth Jain 
Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

On Wed, Apr 01, 2020 at 02:03:09AM +0200, Tom Warren wrote:
> -Original Message-
> From: Peter Robinson 
> Sent: Tuesday, March 31, 2020 3:54 AM
> To: tomcwarren3...@gmail.com
> Cc: u-boot@lists.denx.de; Stephen Warren ; Thierry 
> Reding ; Jonathan Hunter ; 
> Tom Warren ; Vishruth Jain 
> Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT
> 
> External email: Use caution opening links or attachments
> 
> 
> > From: Stephen Warren 
> >
> > This adds to the DT the I2C controllers that connect to the board ID 
> > EEPROM, camera board EEPROM, etc. With this change, you can now 
> > probe all I2C devices on a TX1 board.
> >
> > Signed-off-by: Tom Warren 
> > ---
> >  arch/arm/dts/tegra210-p2371-2180.dts | 18 ++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/arch/arm/dts/tegra210-p2371-2180.dts
> > b/arch/arm/dts/tegra210-p2371-2180.dts
> > index c2f497c..d982b5f 100644
> > --- a/arch/arm/dts/tegra210-p2371-2180.dts
> > +++ b/arch/arm/dts/tegra210-p2371-2180.dts
> > @@ -12,6 +12,9 @@
> >
> > aliases {
> > i2c0 = "/i2c@7000d000";
> > +   i2c2 = "/i2c@7000c400";
> > +   i2c3 = "/i2c@7000c500";
> > +   i2c5 = "/i2c@546c0c00";
> 
> I don't think this is correct, it doesn't show up in U-Boot with the 
> "i2c bus" command where the others do, looking in the tegra210.dtsi it 
> looks like it should be i2c@546c?
> [Tom] That I2C address is working in downstream (L4T) TX1 U-Boot.  The 
> VI_I2C controller is a little weird, it's normal I2C registers are 
> offset from base by 0xC00.  A different driver is needed, but I 
> haven't posted it yet upstream.  I should probably drop if from the 
> DTS for now until I post the VI_I2C driver.

I think the problem here is that the upstream U-Boot device tree doesn't 
contain an i2c@546c0c00 node. Instead it has i2c@546c, which we also have 
in the upstream kernel. My recollection is that that's also the address listed 
in the Tegra210 system address map of the TRM and there are some registers 
before the regular I2C interface at offset 0xc00.

I've been carrying a patch against the upstream Linux I2C controller driver to 
special-case the VI/I2C to always add that 0xc00 offset when accessing 
registers, which allows us to reuse the existing driver and at the same time 
keeps all registers mapped so we can also access the VI/I2C specific registers.

My recollection is that the U-Boot driver is fairly similar to the Linux 
driver, so I suspect something similar could be done.

Thierry
[Tom] Thanks, Thierry. That's my recollection, too, about the VI_I2C 0xC00 
offset. I'll take a look at what we have in L4T U-Boot for T210 and address it 
in a set of patches for upstream soon.  That I2C controller isn't used for 
anything on any Jetson board except on TX1, I believe, where it allows U-Boot 
to talk to the camera add-in board to read the board ID. But we've moved all 
that out to CBoot (board ID EEPROM reading), so there isn't a pressing need for 
it in U-Boot anymore, IIRC.

--nvpublic


Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

2020-04-01 Thread Thierry Reding
On Wed, Apr 01, 2020 at 02:03:09AM +0200, Tom Warren wrote:
> -Original Message-
> From: Peter Robinson  
> Sent: Tuesday, March 31, 2020 3:54 AM
> To: tomcwarren3...@gmail.com
> Cc: u-boot@lists.denx.de; Stephen Warren ; Thierry Reding 
> ; Jonathan Hunter ; Tom Warren 
> ; Vishruth Jain 
> Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT
> 
> External email: Use caution opening links or attachments
> 
> 
> > From: Stephen Warren 
> >
> > This adds to the DT the I2C controllers that connect to the board ID 
> > EEPROM, camera board EEPROM, etc. With this change, you can now probe 
> > all I2C devices on a TX1 board.
> >
> > Signed-off-by: Tom Warren 
> > ---
> >  arch/arm/dts/tegra210-p2371-2180.dts | 18 ++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/arch/arm/dts/tegra210-p2371-2180.dts 
> > b/arch/arm/dts/tegra210-p2371-2180.dts
> > index c2f497c..d982b5f 100644
> > --- a/arch/arm/dts/tegra210-p2371-2180.dts
> > +++ b/arch/arm/dts/tegra210-p2371-2180.dts
> > @@ -12,6 +12,9 @@
> >
> > aliases {
> > i2c0 = "/i2c@7000d000";
> > +   i2c2 = "/i2c@7000c400";
> > +   i2c3 = "/i2c@7000c500";
> > +   i2c5 = "/i2c@546c0c00";
> 
> I don't think this is correct, it doesn't show up in U-Boot with the
> "i2c bus" command where the others do, looking in the tegra210.dtsi it
> looks like it should be i2c@546c?
> [Tom] That I2C address is working in downstream (L4T) TX1 U-Boot.  The
> VI_I2C controller is a little weird, it's normal I2C registers are
> offset from base by 0xC00.  A different driver is needed, but I
> haven't posted it yet upstream.  I should probably drop if from the
> DTS for now until I post the VI_I2C driver.

I think the problem here is that the upstream U-Boot device tree doesn't
contain an i2c@546c0c00 node. Instead it has i2c@546c, which we also
have in the upstream kernel. My recollection is that that's also the
address listed in the Tegra210 system address map of the TRM and there
are some registers before the regular I2C interface at offset 0xc00.

I've been carrying a patch against the upstream Linux I2C controller
driver to special-case the VI/I2C to always add that 0xc00 offset when
accessing registers, which allows us to reuse the existing driver and at
the same time keeps all registers mapped so we can also access the
VI/I2C specific registers.

My recollection is that the U-Boot driver is fairly similar to the Linux
driver, so I suspect something similar could be done.

Thierry


signature.asc
Description: PGP signature


RE: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

2020-03-31 Thread Tom Warren
-Original Message-
From: Peter Robinson  
Sent: Tuesday, March 31, 2020 3:54 AM
To: tomcwarren3...@gmail.com
Cc: u-boot@lists.denx.de; Stephen Warren ; Thierry Reding 
; Jonathan Hunter ; Tom Warren 
; Vishruth Jain 
Subject: Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

External email: Use caution opening links or attachments


> From: Stephen Warren 
>
> This adds to the DT the I2C controllers that connect to the board ID 
> EEPROM, camera board EEPROM, etc. With this change, you can now probe 
> all I2C devices on a TX1 board.
>
> Signed-off-by: Tom Warren 
> ---
>  arch/arm/dts/tegra210-p2371-2180.dts | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/arch/arm/dts/tegra210-p2371-2180.dts 
> b/arch/arm/dts/tegra210-p2371-2180.dts
> index c2f497c..d982b5f 100644
> --- a/arch/arm/dts/tegra210-p2371-2180.dts
> +++ b/arch/arm/dts/tegra210-p2371-2180.dts
> @@ -12,6 +12,9 @@
>
> aliases {
> i2c0 = "/i2c@7000d000";
> +   i2c2 = "/i2c@7000c400";
> +   i2c3 = "/i2c@7000c500";
> +   i2c5 = "/i2c@546c0c00";

I don't think this is correct, it doesn't show up in U-Boot with the "i2c bus" 
command where the others do, looking in the tegra210.dtsi it looks like it 
should be i2c@546c?
[Tom] That I2C address is working in downstream (L4T) TX1 U-Boot.  The VI_I2C 
controller is a little weird, it's normal I2C registers are offset from base by 
0xC00.  A different driver is needed, but I haven't posted it yet upstream.  I 
should probably drop if from the DTS for now until I post the VI_I2C driver.

--nvpublic

> mmc0 = "/sdhci@700b0600";
> mmc1 = "/sdhci@700b";
> usb0 = "/usb@7d00"; @@ -33,6 +36,11 @@
> };
> };
>
> +   i2c@546c0c00 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> padctl@7009f000 {
> pinctrl-0 = <&padctl_default>;
> pinctrl-names = "default"; @@ -85,6 +93,16 @@
> non-removable;
> };
>
> +   i2c@7000c400 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> +   i2c@7000c500 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> i2c@7000d000 {
> status = "okay";
> clock-frequency = <40>;
> --
> 1.8.2.1.610.g562af5b
>
>
> --
> - This email message is for the sole use of the intended 
> recipient(s) and may contain confidential information.  Any 
> unauthorized review, use, disclosure or distribution is prohibited.  
> If you are not the intended recipient, please contact the sender by 
> reply email and destroy all copies of the original message.
> --
> -


Re: [PATCH 3/3] ARM: tegra: p2371-2180: add I2C nodes to DT

2020-03-31 Thread Peter Robinson
> From: Stephen Warren 
>
> This adds to the DT the I2C controllers that connect to the board ID EEPROM,
> camera board EEPROM, etc. With this change, you can now probe all I2C devices
> on a TX1 board.
>
> Signed-off-by: Tom Warren 
> ---
>  arch/arm/dts/tegra210-p2371-2180.dts | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/arch/arm/dts/tegra210-p2371-2180.dts 
> b/arch/arm/dts/tegra210-p2371-2180.dts
> index c2f497c..d982b5f 100644
> --- a/arch/arm/dts/tegra210-p2371-2180.dts
> +++ b/arch/arm/dts/tegra210-p2371-2180.dts
> @@ -12,6 +12,9 @@
>
> aliases {
> i2c0 = "/i2c@7000d000";
> +   i2c2 = "/i2c@7000c400";
> +   i2c3 = "/i2c@7000c500";
> +   i2c5 = "/i2c@546c0c00";

I don't think this is correct, it doesn't show up in U-Boot with the
"i2c bus" command where the others do, looking in the tegra210.dtsi it
looks like it should be i2c@546c?

> mmc0 = "/sdhci@700b0600";
> mmc1 = "/sdhci@700b";
> usb0 = "/usb@7d00";
> @@ -33,6 +36,11 @@
> };
> };
>
> +   i2c@546c0c00 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> padctl@7009f000 {
> pinctrl-0 = <&padctl_default>;
> pinctrl-names = "default";
> @@ -85,6 +93,16 @@
> non-removable;
> };
>
> +   i2c@7000c400 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> +   i2c@7000c500 {
> +   status = "okay";
> +   clock-frequency = <40>;
> +   };
> +
> i2c@7000d000 {
> status = "okay";
> clock-frequency = <40>;
> --
> 1.8.2.1.610.g562af5b
>
>
> ---
> This email message is for the sole use of the intended recipient(s) and may 
> contain
> confidential information.  Any unauthorized review, use, disclosure or 
> distribution
> is prohibited.  If you are not the intended recipient, please contact the 
> sender by
> reply email and destroy all copies of the original message.
> ---