Message ID | 1406395238-29758-3-git-send-email-andrew@lunn.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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.
> > 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
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
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
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
> > 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
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
> > 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
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
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
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
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 --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 :
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(-)