diff mbox

[V2,2/2] i2c: mv64xxx: Remove internal compatible string from Documentation

Message ID 1406395238-29758-3-git-send-email-andrew@lunn.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Lunn July 26, 2014, 5:20 p.m. UTC
The compatible string "marvell,mv78230-a0-i2c" should only be used
internally when at run time we detect an Armada XP with broken
hardware offload. This string should never appear in DT blobs passed
to the kernel. Hence remove it from the binding Documentation.

Patch proposed by Arnd Bergmann <arnd@arndb.de>

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | 5 -----
 1 file changed, 5 deletions(-)

Comments

Jason Cooper July 28, 2014, 1:22 p.m. UTC | #1
Andrew,

I'm fine with this series wrt to fixing Linux, however:

On Sat, Jul 26, 2014 at 07:20:38PM +0200, Andrew Lunn wrote:
> The compatible string "marvell,mv78230-a0-i2c" should only be used
> internally when at run time we detect an Armada XP with broken
> hardware offload. This string should never appear in DT blobs passed
> to the kernel. Hence remove it from the binding Documentation.
> 
> Patch proposed by Arnd Bergmann <arnd@arndb.de>
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> index 5c30026921ae..6eb6f6e40ba1 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> @@ -9,11 +9,6 @@ Required properties :
>                       - "allwinner,sun6i-a31-i2c"
>                       - "marvell,mv64xxx-i2c"
>                       - "marvell,mv78230-i2c"
> -                     - "marvell,mv78230-a0-i2c"
> -                       * Note: Only use "marvell,mv78230-a0-i2c" for a
> -                         very rare, initial version of the SoC which
> -                         had broken offload support.  Linux
> -                         auto-detects this and sets it appropriately.

I think we're losing knowledge here.  *We* know that attempting to
enable transaction offload on A0 SoCs is bad news.  Other OS's would now
need to dig through the Linux kernel code for clues as to what's
happening.

Perhaps we should retain the info in the form of a note at the bottom of
this file?

thx,

Jason.
Andrew Lunn July 28, 2014, 1:27 p.m. UTC | #2
> > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > index 5c30026921ae..6eb6f6e40ba1 100644
> > --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > @@ -9,11 +9,6 @@ Required properties :
> >                       - "allwinner,sun6i-a31-i2c"
> >                       - "marvell,mv64xxx-i2c"
> >                       - "marvell,mv78230-i2c"
> > -                     - "marvell,mv78230-a0-i2c"
> > -                       * Note: Only use "marvell,mv78230-a0-i2c" for a
> > -                         very rare, initial version of the SoC which
> > -                         had broken offload support.  Linux
> > -                         auto-detects this and sets it appropriately.
> 
> I think we're losing knowledge here.  *We* know that attempting to
> enable transaction offload on A0 SoCs is bad news.  Other OS's would now
> need to dig through the Linux kernel code for clues as to what's
> happening.
> 
> Perhaps we should retain the info in the form of a note at the bottom of
> this file?

Hi Jason

I did wounder about this a bit. I've not looked, but now that XP
datasheets are public, i assume there is an errata for this, so it at
least should be documented by Marvell. But anybody looking in
/proc/device-tree on an A0 is going to see this undocumented string
which might raise questions.

So i'm happy to document it at the end of the binding.

Arnd, what do you say?

      Andrew
Arnd Bergmann July 28, 2014, 1:51 p.m. UTC | #3
On Monday 28 July 2014 15:27:16 Andrew Lunn wrote:
> > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > index 5c30026921ae..6eb6f6e40ba1 100644
> > > --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > @@ -9,11 +9,6 @@ Required properties :
> > >                       - "allwinner,sun6i-a31-i2c"
> > >                       - "marvell,mv64xxx-i2c"
> > >                       - "marvell,mv78230-i2c"
> > > -                     - "marvell,mv78230-a0-i2c"
> > > -                       * Note: Only use "marvell,mv78230-a0-i2c" for a
> > > -                         very rare, initial version of the SoC which
> > > -                         had broken offload support.  Linux
> > > -                         auto-detects this and sets it appropriately.
> > 
> > I think we're losing knowledge here.  *We* know that attempting to
> > enable transaction offload on A0 SoCs is bad news.  Other OS's would now
> > need to dig through the Linux kernel code for clues as to what's
> > happening.
> > 
> > Perhaps we should retain the info in the form of a note at the bottom of
> > this file?
> 
> Hi Jason
> 
> I did wounder about this a bit. I've not looked, but now that XP
> datasheets are public, i assume there is an errata for this, so it at
> least should be documented by Marvell. But anybody looking in
> /proc/device-tree on an A0 is going to see this undocumented string
> which might raise questions.
> 
> So i'm happy to document it at the end of the binding.
> 
> Arnd, what do you say?

The final consequence of the API change would be to no longer
change the compatible string in the fixup, but instead to call an
API from the driver to find out the SoC revision when it encounters
an mv78230-i2c.

I remember this being discussed when the quirk was initially added,
but it seemed cleaner to handle this in the platform code at the time
when it was just for one particular board. Now that it's basically
an accepted feature of the i2c device that you have to know the
SoC version, that should probably become a proper API.

Also, we now have drivers/soc/ and can move the soc-id code there
with a publically documented API.

I agree it's sad to lose the knowledge about the revision, but we
already have that as we now accept the generic string even on the
a0 machines other than ax3.

	Arnd
Andrew Lunn July 28, 2014, 2:12 p.m. UTC | #4
On Mon, Jul 28, 2014 at 03:51:27PM +0200, Arnd Bergmann wrote:
> On Monday 28 July 2014 15:27:16 Andrew Lunn wrote:
> > > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > index 5c30026921ae..6eb6f6e40ba1 100644
> > > > --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > @@ -9,11 +9,6 @@ Required properties :
> > > >                       - "allwinner,sun6i-a31-i2c"
> > > >                       - "marvell,mv64xxx-i2c"
> > > >                       - "marvell,mv78230-i2c"
> > > > -                     - "marvell,mv78230-a0-i2c"
> > > > -                       * Note: Only use "marvell,mv78230-a0-i2c" for a
> > > > -                         very rare, initial version of the SoC which
> > > > -                         had broken offload support.  Linux
> > > > -                         auto-detects this and sets it appropriately.
> > > 
> > > I think we're losing knowledge here.  *We* know that attempting to
> > > enable transaction offload on A0 SoCs is bad news.  Other OS's would now
> > > need to dig through the Linux kernel code for clues as to what's
> > > happening.
> > > 
> > > Perhaps we should retain the info in the form of a note at the bottom of
> > > this file?
> > 
> > Hi Jason
> > 
> > I did wounder about this a bit. I've not looked, but now that XP
> > datasheets are public, i assume there is an errata for this, so it at
> > least should be documented by Marvell. But anybody looking in
> > /proc/device-tree on an A0 is going to see this undocumented string
> > which might raise questions.
> > 
> > So i'm happy to document it at the end of the binding.
> > 
> > Arnd, what do you say?
> 
> The final consequence of the API change would be to no longer
> change the compatible string in the fixup, but instead to call an
> API from the driver to find out the SoC revision when it encounters
> an mv78230-i2c.
> 
> I remember this being discussed when the quirk was initially added,
> but it seemed cleaner to handle this in the platform code at the time
> when it was just for one particular board. Now that it's basically
> an accepted feature of the i2c device that you have to know the
> SoC version, that should probably become a proper API.
> 
> Also, we now have drivers/soc/ and can move the soc-id code there
> with a publically documented API.

Getting the SoC ID and revision seems like something that should be
generic. Would it be better to make this part of drivers/base/soc.c?
mvebu already does a soc_device_register() with the relevant
information.

Add a call something like:

/*
 * Return the soc device attributes for a given soc_dev. If soc_dev is NULL,
 * the first device on the soc bus is returned.
 */
struct soc_device_attribute *soc_attribute_get(struct soc_device * soc_dev);

       Andrew
Arnd Bergmann July 28, 2014, 2:35 p.m. UTC | #5
On Monday 28 July 2014 16:12:17 Andrew Lunn wrote:
> > 
> > I remember this being discussed when the quirk was initially added,
> > but it seemed cleaner to handle this in the platform code at the time
> > when it was just for one particular board. Now that it's basically
> > an accepted feature of the i2c device that you have to know the
> > SoC version, that should probably become a proper API.
> > 
> > Also, we now have drivers/soc/ and can move the soc-id code there
> > with a publically documented API.
> 
> Getting the SoC ID and revision seems like something that should be
> generic. Would it be better to make this part of drivers/base/soc.c?
> mvebu already does a soc_device_register() with the relevant
> information.
> 
> Add a call something like:
> 
> /*
>  * Return the soc device attributes for a given soc_dev. If soc_dev is NULL,
>  * the first device on the soc bus is returned.
>  */
> struct soc_device_attribute *soc_attribute_get(struct soc_device * soc_dev);

Interesting idea, yes.

There could also be a higher-level function that does a strcmp() in addition,
so that a driver can do some variation of

	if (soc_name_is("Armada XP") && soc_revision_is("A0"))
		...

	Arnd
Andrew Lunn July 28, 2014, 3:25 p.m. UTC | #6
> > Add a call something like:
> > 
> > /*
> >  * Return the soc device attributes for a given soc_dev. If soc_dev is NULL,
> >  * the first device on the soc bus is returned.
> >  */
> > struct soc_device_attribute *soc_attribute_get(struct soc_device * soc_dev);
> 
> Interesting idea, yes.

O.K, i will take a shot of implementing this sometime in the next few
weeks. Bit busy at the moment.
 
> There could also be a higher-level function that does a strcmp() in addition,
> so that a driver can do some variation of
> 
> 	if (soc_name_is("Armada XP") && soc_revision_is("A0"))

We don't translate into 'Marketing names'. We just turn the register
values into a stringified number. So it would have to be something
like:

	if (soc_name_is("7826") && soc_revision_is("1"))

	Andrew
Arnd Bergmann July 28, 2014, 3:47 p.m. UTC | #7
On Monday 28 July 2014 17:25:06 Andrew Lunn wrote:
> > > Add a call something like:
> > > 
> > > /*
> > >  * Return the soc device attributes for a given soc_dev. If soc_dev is NULL,
> > >  * the first device on the soc bus is returned.
> > >  */
> > > struct soc_device_attribute *soc_attribute_get(struct soc_device * soc_dev);
> > 
> > Interesting idea, yes.
> 
> O.K, i will take a shot of implementing this sometime in the next few
> weeks. Bit busy at the moment.
>  
> > There could also be a higher-level function that does a strcmp() in addition,
> > so that a driver can do some variation of
> > 
> >       if (soc_name_is("Armada XP") && soc_revision_is("A0"))
> 
> We don't translate into 'Marketing names'. We just turn the register
> values into a stringified number. So it would have to be something
> like:
> 
>         if (soc_name_is("7826") && soc_revision_is("1"))

Hmm, I think that is inconsistent with how the strings are used
on other platforms, where you want something that uniquely identifies
the device in user-readable strings.

I haven't checked how all the others are doing it though.

	Arnd
Andrew Lunn July 28, 2014, 3:52 p.m. UTC | #8
> > We don't translate into 'Marketing names'. We just turn the register
> > values into a stringified number. So it would have to be something
> > like:
> > 
> >         if (soc_name_is("7826") && soc_revision_is("1"))
> 
> Hmm, I think that is inconsistent with how the strings are used
> on other platforms, where you want something that uniquely identifies
> the device in user-readable strings.

Unfortunately, it is not so simple. There are a few different Armada
XP SoCs. E.g. dual core and quad core. And this is pretty normal for
Marvell. There are maybe 5 different Kirkwoods, a few different
Orion5x etc. So at minimum it would of had to be e.g. "Armada XP
7826".

However, it is too late now. This is part of the ABI, and Debian's
flash-kernel is making use of this in order to get the right DT blob.
So we cannot change it.

   Andrew
Arnd Bergmann July 28, 2014, 4:03 p.m. UTC | #9
On Monday 28 July 2014 17:52:56 Andrew Lunn wrote:
> > > We don't translate into 'Marketing names'. We just turn the register
> > > values into a stringified number. So it would have to be something
> > > like:
> > > 
> > >         if (soc_name_is("7826") && soc_revision_is("1"))
> > 
> > Hmm, I think that is inconsistent with how the strings are used
> > on other platforms, where you want something that uniquely identifies
> > the device in user-readable strings.
> 
> Unfortunately, it is not so simple. There are a few different Armada
> XP SoCs. E.g. dual core and quad core. And this is pretty normal for
> Marvell. There are maybe 5 different Kirkwoods, a few different
> Orion5x etc. So at minimum it would of had to be e.g. "Armada XP
> 7826".
> 
> However, it is too late now. This is part of the ABI, and Debian's
> flash-kernel is making use of this in order to get the right DT blob.
> So we cannot change it.
> 

Ok, I see. Let's hope then that "Marvell" as a family name in combination
with those numbers remains unique. A driver will probably have to
check all three, but it could be combined into a single function that
takes NULL as a don't care argument:

	if (soc_is("Marvell", "7826", NULL))
		...

	Arnd
Jason Gunthorpe July 28, 2014, 6:29 p.m. UTC | #10
On Mon, Jul 28, 2014 at 03:51:27PM +0200, Arnd Bergmann wrote:

> I remember this being discussed when the quirk was initially added,
> but it seemed cleaner to handle this in the platform code at the time
> when it was just for one particular board. Now that it's basically
> an accepted feature of the i2c device that you have to know the
> SoC version, that should probably become a proper API.

Reading the SOC ID (which has to come from a PCI-E controller) is
already known to mess up PCI-E. IMHO, reading it should be minimized,
unless we can figure out how to fix that.

At some point we need to push back on the bootloader situation and
require the kernel to be booted with a correct DT.

All the infrastructure was already provided for this, I'm not sure how
we got into the situation where it was OK for bootloaders to ignore
the DT requirements and it is the kernel's job to fix it :(

Jason
Arnd Bergmann July 29, 2014, 10:21 a.m. UTC | #11
On Monday 28 July 2014 12:29:13 Jason Gunthorpe wrote:
> On Mon, Jul 28, 2014 at 03:51:27PM +0200, Arnd Bergmann wrote:
> 
> > I remember this being discussed when the quirk was initially added,
> > but it seemed cleaner to handle this in the platform code at the time
> > when it was just for one particular board. Now that it's basically
> > an accepted feature of the i2c device that you have to know the
> > SoC version, that should probably become a proper API.
> 
> Reading the SOC ID (which has to come from a PCI-E controller) is
> already known to mess up PCI-E. IMHO, reading it should be minimized,
> unless we can figure out how to fix that.
> 
> At some point we need to push back on the bootloader situation and
> require the kernel to be booted with a correct DT.
> 
> All the infrastructure was already provided for this, I'm not sure how
> we got into the situation where it was OK for bootloaders to ignore
> the DT requirements and it is the kernel's job to fix it 

Thomas argued that it's always possible to identify the revision
and that we already need that anyway to work around broken dts file
for ax3, so it would be easier to generalize that hack.

Everybody else (except me) seemed happy with that idea, so I eventually
gave up arguing against it.

	Arnd
Maxime Ripard July 30, 2014, 8:44 a.m. UTC | #12
Hi Arnd,

Sorry for jumping into the discussion like this, but we start having
pretty much the same issues on the Allwinner stuff.

On Mon, Jul 28, 2014 at 03:51:27PM +0200, Arnd Bergmann wrote:
> On Monday 28 July 2014 15:27:16 Andrew Lunn wrote:
> > > > diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > index 5c30026921ae..6eb6f6e40ba1 100644
> > > > --- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > +++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
> > > > @@ -9,11 +9,6 @@ Required properties :
> > > >                       - "allwinner,sun6i-a31-i2c"
> > > >                       - "marvell,mv64xxx-i2c"
> > > >                       - "marvell,mv78230-i2c"
> > > > -                     - "marvell,mv78230-a0-i2c"
> > > > -                       * Note: Only use "marvell,mv78230-a0-i2c" for a
> > > > -                         very rare, initial version of the SoC which
> > > > -                         had broken offload support.  Linux
> > > > -                         auto-detects this and sets it appropriately.
> > > 
> > > I think we're losing knowledge here.  *We* know that attempting to
> > > enable transaction offload on A0 SoCs is bad news.  Other OS's would now
> > > need to dig through the Linux kernel code for clues as to what's
> > > happening.
> > > 
> > > Perhaps we should retain the info in the form of a note at the bottom of
> > > this file?
> > 
> > Hi Jason
> > 
> > I did wounder about this a bit. I've not looked, but now that XP
> > datasheets are public, i assume there is an errata for this, so it at
> > least should be documented by Marvell. But anybody looking in
> > /proc/device-tree on an A0 is going to see this undocumented string
> > which might raise questions.
> > 
> > So i'm happy to document it at the end of the binding.
> > 
> > Arnd, what do you say?
> 
> The final consequence of the API change would be to no longer
> change the compatible string in the fixup, but instead to call an
> API from the driver to find out the SoC revision when it encounters
> an mv78230-i2c.
> 
> I remember this being discussed when the quirk was initially added,
> but it seemed cleaner to handle this in the platform code at the time
> when it was just for one particular board. Now that it's basically
> an accepted feature of the i2c device that you have to know the
> SoC version, that should probably become a proper API.
> 
> Also, we now have drivers/soc/ and can move the soc-id code there
> with a publically documented API.
> 
> I agree it's sad to lose the knowledge about the revision, but we
> already have that as we now accept the generic string even on the
> a0 machines other than ax3.

What's the advantage on pushing the soc-detection to the drivers
themselves?

I'd really liked the idea that mvebu implements following this patch,
with the soc detection and DT fixup being done in the machine, because
it seems like it has a major benefit of centralizing every thing in a
single place.

That way it's much easier to have a status of what's supported and
what's not, that you wouldn't have if every driver was supposed to
handled that itself.

Plus, you seemed to be interested in having the quirks disabled, which
wouldn't be (easily) doable if we move individual quirks to the
drivers.

Thanks,
Maxime
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
index 5c30026921ae..6eb6f6e40ba1 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-mv64xxx.txt
@@ -9,11 +9,6 @@  Required properties :
                      - "allwinner,sun6i-a31-i2c"
                      - "marvell,mv64xxx-i2c"
                      - "marvell,mv78230-i2c"
-                     - "marvell,mv78230-a0-i2c"
-                       * Note: Only use "marvell,mv78230-a0-i2c" for a
-                         very rare, initial version of the SoC which
-                         had broken offload support.  Linux
-                         auto-detects this and sets it appropriately.
  - interrupts      : The interrupt number
 
 Optional properties :