Fix eSDHC host version register bug
Subsystems (14)
v6 cover Fix eSDHC host version register bug
This patchset is used to fix a host version register bug in the T4240-R1.0-R2.0 eSDHC controller. To get the SoC version and revision, it's needed to add the GUTS driver to access the global utilities registers.
So, the first three patches are to add the GUTS driver.
The following two patches are to enable GUTS driver support to get SVR in eSDHC driver and fix host version for T4240.
Yangbo Lu (5):
ARM64: dts: ls2080a: add device configuration node
soc: fsl: add GUTS driver for QorIQ platforms
dt: move guts devicetree doc out of powerpc directory powerpc/fsl: move mpc85xx.h to include/linux/fsl
mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
.../bindings/{powerpc => soc}/fsl/guts.txt | 3 +
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 ++
drivers/clk/clk-qoriq.c | 3 +-
drivers/i2c/busses/i2c-mpc.c | 2 +-
drivers/iommu/fsl_pamu.c | 3 +-
drivers/mmc/host/Kconfig | 1 +
drivers/mmc/host/sdhci-of-esdhc.c | 23 ++++
drivers/net/ethernet/freescale/gianfar.c | 2 +-
drivers/soc/Kconfig | 2 +-
drivers/soc/fsl/Kconfig | 8 ++
drivers/soc/fsl/Makefile | 1 +
drivers/soc/fsl/guts.c | 119 +++++++++++++++++++++
include/linux/fsl/guts.h | 100 ++++++++---------
.../asm/mpc85xx.h => include/linux/fsl/svr.h | 4 +-
14 files changed, 220 insertions(+), 57 deletions(-)
rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)
create mode 100644 drivers/soc/fsl/Kconfig
create mode 100644 drivers/soc/fsl/guts.c
rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%)Signature · 1 line
2.1.0.27.g96db324
PATCH v6 1/5 ARM64: dts: ls2080a: add device configuration node
Add the dts node for device configuration unit that provides general purpose configuration and status for the device.
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- Added this patch
Changes for v6:
- None
--- arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/freescale/fsl-ls2080a.dtsi +6 -0
@@ -191,6 +191,12 @@ clocks = <&sysclk>; }; + dcfg: dcfg at 1e00000 { + compatible = "fsl,ls2080a-dcfg", "syscon"; + reg = <0x0 0x1e00000 0x0 0x10000>; + little-endian; + }; + serial0: serial at 21c0500 { compatible = "fsl,ns16550", "ns16550a"; reg = <0x0 0x21c0500 0x0 0x100>;
Signature · 1 line
2.1.0.27.g96db324
PATCH v6 2/5 soc: fsl: add GUTS driver for QorIQ platforms
In reply to Yangbo LuThe global utilities block controls power management, I/O device enabling, power-onreset(POR) configuration monitoring, alternate function selection for multiplexed signals,and clock control.
This patch adds GUTS driver to manage and access global utilities block.
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- Added this patch
Changes for v5:
- Modified copyright info
- Changed MODULE_LICENSE to GPL
- Changed EXPORT_SYMBOL_GPL to EXPORT_SYMBOL
- Made FSL_GUTS user-invisible
- Added a complete compatible list for GUTS
- Stored guts info in file-scope variable
- Added mfspr() getting SVR
- Redefined GUTS APIs
- Called fsl_guts_init rather than using platform driver
- Removed useless parentheses
- Removed useless 'extern' key words
Changes for v6:
- Made guts thread safe in fsl_guts_init
--- drivers/soc/Kconfig | 2 +- drivers/soc/fsl/Kconfig | 8 ++++ drivers/soc/fsl/Makefile | 1 + drivers/soc/fsl/guts.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/fsl/guts.h | 100 ++++++++++++++++++++------------------- 5 files changed, 181 insertions(+), 49 deletions(-) create mode 100644 drivers/soc/fsl/Kconfig create mode 100644 drivers/soc/fsl/guts.c
drivers/soc/Kconfig +1 -1
@@ -2,7 +2,7 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/bcm/Kconfig" source "drivers/soc/brcmstb/Kconfig" -source "drivers/soc/fsl/qe/Kconfig" +source "drivers/soc/fsl/Kconfig" source "drivers/soc/mediatek/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/rockchip/Kconfig"
drivers/soc/fsl/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +# +# Freescale SOC drivers +# + +source "drivers/soc/fsl/qe/Kconfig" + +config FSL_GUTS + bool
drivers/soc/fsl/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_QUICC_ENGINE) += qe/ obj-$(CONFIG_CPM) += qe/ +obj-$(CONFIG_FSL_GUTS) += guts.o
drivers/soc/fsl/guts.c new file +119 -0
119 lines not on this page · raw message
include/linux/fsl/guts.h +52 -48
135 lines not on this page · raw message
Signature · 1 line
2.1.0.27.g96db324
Re: [v6, 2/5] soc: fsl: add GUTS driver for QorIQ platforms
include/linux/fsl/guts.h line 112
Quoted 4 lines · Yangbo Lu
include/linux/fsl/guts.h +4
-0+#ifdef CONFIG_FSL_GUTS +u32 fsl_guts_get_svr (void ); +int fsl_guts_init (void ); +#endif
Don't ifdef prototypes (when not providing a stub alternative).
-Scott
RE: [v6, 2/5] soc: fsl: add GUTS driver for QorIQ platforms
Quoted 14 lines
-----Original Message-----
From: Scott Wood
Sent: Saturday, March 19, 2016 6:55 AM
To: Yangbo Lu; devicetree at vger.kernel.org; linux-arm- kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linuxppc- dev at lists.ozlabs.org; linux-clk at vger.kernel.org; linux- i2c at vger.kernel.org; iommu at lists.linux-foundation.org; netdev at vger.kernel.org; linux-mmc at vger.kernel.org
Cc: Rob Herring; Russell King; Jochen Friedrich; Joerg Roedel; Claudiu Manoil; ulf.hansson at linaro.org; Bhupesh Sharma; Zhao Qiang; Kumar Gala; Santosh Shilimkar; Yang-Leo Li; Xiaobo Xie
Subject: Re: [v6, 2/5] soc: fsl: add GUTS driver for QorIQ platformsOn 03/09/2016 04:18 AM, Yangbo Lu wrote:
Quoted 8 lines
include/linux/fsl/guts.h line 112
Quoted 4 lines
include/linux/fsl/guts.h +4
-0+#ifdef CONFIG_FSL_GUTS +u32 fsl_guts_get_svr (void ); +int fsl_guts_init (void ); +#endif Don't ifdef prototypes (when not providing a stub alternative).
-Scott
[Lu Yangbo-B47093] Ok, will remove the ifdef.
Thank you very much.
PATCH v6 3/5 dt: move guts devicetree doc out of powerpc directory
In reply to Yangbo LuMove guts devicetree doc to Documentation/devicetree/bindings/soc/fsl/ since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property.
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- Added this patch
Changes for v5:
- Modified the description for little-endian property
Changes for v6:
- None
---
Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++
1 file changed, 3 insertions(+)
rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +3 -0
@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device. + - little-endian : Indicates that the global utilities block is little + endian. The default is big endian. + Examples: global-utilities at e0000 { /* global utilities block */ compatible = "fsl,mpc8548-guts";
Signature · 1 line
2.1.0.27.g96db324
Rob Herring
maintainerRe: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
Quoted 29 lines · Yangbo Lu
Move guts devicetree doc to
Documentation/devicetree/bindings/soc/fsl/since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- Added this patch
Changes for v5:
- Modified the description for little-endian property
Changes for v6:
- None--- Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++ 1 file changed, 3 insertions(+) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +0
-0
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +2
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device. + - little-endian : Indicates that the global utilities block is little + endian. The default is big endian.
The default is "the native endianness of the system". So absence on an ARM system would be LE. This property is valid for any simple-bus device, so it isn't really required to document per device. You can, but your description had better match the documented behaviour.
Rob
Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
Quoted 11 lines · On Thursday 17 March 2016 12:06:40 Rob Herring wrote:
Quoted 11 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +0
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device.
Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 2 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +2
-0+ - little-endian : Indicates that the global utilities block is little + endian. The default is big endian.The default is "the native endianness of the system".
This may be what is currently documented, but not what we are doing in practice, as there is no "native endianess" for either PowerPC or ARM -- both allow running big-endian or little-endian kernels and the device registers are fixed.
I think the property here is fine.
Arnd
Rob Herring
maintainerRe: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
Quoted 17 lines · Arnd Bergmann
Quoted 11 lines · On Thursday 17 March 2016 12:06:40 Rob Herring wrote:
Quoted 11 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +0
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device.Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 2 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +2
-0+ - little-endian : Indicates that the global utilities block is little + endian. The default is big endian.The default is "the native endianness of the system".
Quoted 4 lines
This may be what is currently documented, but not what we are doing in practice, as there is no "native endianess" for either PowerPC or ARM -- both allow running big-endian or little-endian kernels and the device registers are fixed.
Notice I said system, not architecture. The way the device registers are fixed is what I mean by native endianness.
If the purpose of adding this property now is to support GUTS on the ARM SoCs, then I'd argue using this property is probably wrong. If the PPC systems are designed with BE device registers and ARM systems with LE, then this property is not needed.
Quoted 1 line
I think the property here is fine.
Unless you have studied the FSL ARM based SoCs, then there is not enough information here to tell.
Rob
Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
Quoted 18 lines · Rob Herring
Quoted 17 lines · Arnd Bergmann
Quoted 15 lines · On Thursday 17 March 2016 12:06:40 Rob Herring wrote:
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 13 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +2
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device. + - little-endian : Indicates that the global utilities block is little + endian. The default is big endian.The default is "the native endianness of the system".
Quoted 7 lines
Quoted 4 lines
This may be what is currently documented, but not what we are doing in practice, as there is no "native endianess" for either PowerPC or ARM -- both allow running big-endian or little-endian kernels and the device registers are fixed.
Notice I said system, not architecture. The way the device registers are fixed is what I mean by native endianness.
I think sometimes it's also hard to define the native endianess of the system too. For whatever reason, we have hardware that having big-endian registers on some on-chip devices but using little-endian registers on other devices. Even if all the devices on certain hardware use registers of the same endianess, it is also hard for the device driver to know what the native endianess really is.
Quoted 10 lines
If the purpose of adding this property now is to support GUTS on the ARM SoCs, then I'd argue using this property is probably wrong. If the PPC systems are designed with BE device registers and ARM systems with LE, then this property is not needed.
Quoted 1 line
I think the property here is fine.
Unless you have studied the FSL ARM based SoCs, then there is not enough information here to tell.
Recent FSL ARM SoCs seems to have more weird endianess issue. :( The same IP could have registers of different endianess on different ARM SoCs. That why we need to define the endianess explicitly in device tree.
Regards,
Leo
Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
In reply to Rob HerringQuoted 33 lines · Rob Herring
Quoted 32 lines · Yangbo Lu
Move guts devicetree doc to
Documentation/devicetree/bindings/soc/fsl/since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- Added this patch
Changes for v5:
- Modified the description for little-endian property
Changes for v6:
- None--- Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++ 1 file changed, 3 insertions(+) rename Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt (91%)Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +0
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device.
Quoted 5 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 2 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +2
-0+ - little-endian : Indicates that the global utilities block is little + endian. The default is big endian.The default is "the native endianness of the system". So absence on an ARM system would be LE.
No. For this binding, the default is big-endian, because that's what existed for this device before an endian property was added.
"endianness of the system" is not a well-defined concept.
Quoted 1 line
This property is valid for any simple-bus device,
Since when does simple-bus mean anything more than that the nodes underneath it can be used without bus-specific knowledge?
Quoted 2 lines
so it isn't really required to document per device. You can, but your description had better match the documented behaviour.
Documented where?
In fact, Documentation/devicetree/bindings/common-properties.txt explicitly says of the endian properties, "If a binding supports these properties, then the binding should also specify the default behavior if none of these properties are present."
-Scott
RE: [v6, 3/5] dt: move guts devicetree doc out of powerpc directory
Quoted 72 lines
-----Original Message-----
From: Scott Wood
Sent: Saturday, March 19, 2016 2:16 AM
To: Rob Herring; Yangbo Lu
Cc: devicetree at vger.kernel.org; linux-arm-kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linuxppc-dev at lists.ozlabs.org; linux- clk at vger.kernel.org; linux-i2c at vger.kernel.org; iommu at lists.linux- foundation.org; netdev at vger.kernel.org; linux-mmc at vger.kernel.org; Russell King; Jochen Friedrich; Joerg Roedel; Claudiu Manoil; ulf.hansson at linaro.org; Bhupesh Sharma; Zhao Qiang; Kumar Gala; Santosh Shilimkar; Yang-Leo Li; Xiaobo Xie
Subject: Re: [v6, 3/5] dt: move guts devicetree doc out of powerpc directoryQuoted 37 lines · Rob Herring
Quoted 36 lines · Yangbo Lu
Move guts devicetree doc to
Documentation/devicetree/bindings/soc/fsl/
since it's used by not only PowerPC but also ARM. And add a specification for 'little-endian' property.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- Added this patch
Changes for v5:
- Modified the description for little-endian property Changes for
v6:
- None--- Documentation/devicetree/bindings/{powerpc => soc}/fsl/guts.txt | 3 +++ 1 file changed, 3 insertions(+) rename Documentation/devicetree/bindings/{powerpc =>
soc}/fsl/guts.txt(91%)Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +0
-0@@ -25,6 +25,9 @@ Recommended properties: - fsl,liodn-bits : Indicates the number of defined bits in the LIODN registers, for those SOCs that have a PAMU device.Quoted 1 line
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 28
Quoted 1 line
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +1
-0+ - little-endian : Indicates that the global utilities block islittle
Quoted 4 lines
Documentation/devicetree/bindings/soc/fsl/guts.txt Recommended properties: · line 29
Quoted 1 line
Documentation/devicetree/bindings/soc/fsl/guts.txt renamed from Documentation/devicetree/bindings/powerpc/fsl/guts.txt +1
-0+ endian. The default is big endian.The default is "the native endianness of the system". So absence on an ARM system would be LE.
No. For this binding, the default is big-endian, because that's what existed for this device before an endian property was added.
"endianness of the system" is not a well-defined concept.
Quoted 1 line
This property is valid for any simple-bus device,
Since when does simple-bus mean anything more than that the nodes underneath it can be used without bus-specific knowledge?
Quoted 2 lines
so it isn't really required to document per device. You can, but your description had better match the documented behaviour.
Quoted 8 lines
Documented where?
In fact,
Documentation/devicetree/bindings/common-properties.txtexplicitly says of the endian properties, "If a binding supports these properties, then the binding should also specify the default behavior if none of these properties are present."-Scott
[Lu Yangbo-B47093] So, Rob, could you accept this patch after so much discussion? :)
PATCH v6 4/5 powerpc/fsl: move mpc85xx.h to include/linux/fsl
In reply to Yangbo LuMove mpc85xx.h to include/linux/fsl and rename it to svr.h as a common header file. It has been used for mpc85xx and it will be used for ARM-based SoC as well.
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
Changes for v5:
- Changed to Move mpc85xx.h to include/linux/fsl/
- Adjusted '#include <linux/fsl/svr.h>' position in file
Changes for v6:
- None
--- drivers/clk/clk-qoriq.c | 3 +-- drivers/i2c/busses/i2c-mpc.c | 2 +- drivers/iommu/fsl_pamu.c | 3 +-- drivers/net/ethernet/freescale/gianfar.c | 2 +- arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h | 4 ++-- 5 files changed, 6 insertions(+), 8 deletions(-) rename arch/powerpc/include/asm/mpc85xx.h => include/linux/fsl/svr.h (97%)
drivers/clk/clk-qoriq.c +1 -2
@@ -13,6 +13,7 @@#include <linux/clk.h> #include <linux/clk-provider.h> #include <linux/fsl/guts.h> +#include <linux/fsl/svr.h> #include <linux/io.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -1148,8 +1149,6 @@ bad_args: }#ifdef CONFIG_PPC -#include <asm/mpc85xx.h> -static const u32 a4510_svrs[]__initconst = { (SVR_P2040 <<8 ) |0x10 ,/* P2040 1.0 */ (SVR_P2040 << 8) | 0x11, /* P2040 1.1 */
drivers/i2c/busses/i2c-mpc.c +1 -1
@@ -27,9 +27,9 @@#include <linux/i2c.h> #include <linux/interrupt.h> #include <linux/delay.h> +#include <linux/fsl/svr.h> #include <asm/mpc52xx.h> -#include <asm/mpc85xx.h> #include <sysdev/fsl_soc.h> #define DRV_NAME "mpc-i2c"
drivers/iommu/fsl_pamu.c +1 -2
@@ -21,11 +21,10 @@#include "fsl_pamu.h" #include <linux/fsl/guts.h> +#include <linux/fsl/svr.h> #include <linux/interrupt.h> #include <linux/genalloc.h> -#include <asm/mpc85xx.h> -/* define indexes for each operation mapping scenario */ #define OMI_QMAN 0x00#define OMI_FMAN 0x01
drivers/net/ethernet/freescale/gianfar.c +1 -1
@@ -86,11 +86,11 @@#include <linux/udp.h> #include <linux/in.h> #include <linux/net_tstamp.h> +#include <linux/fsl/svr.h> #include <asm/io.h> #ifdef CONFIG_PPC #include <asm/reg.h> -#include <asm/mpc85xx.h> #endif #include <asm/irq.h> #include <asm/uaccess.h>
include/linux/fsl/svr.h renamed from arch/powerpc/include/asm/mpc85xx.h +2 -2
@@ -9,8 +9,8 @@* (at your option) any later version. */ -#ifndef __ASM_PPC_MPC85XX_H -#define __ASM_PPC_MPC85XX_H +#ifndef FSL_SVR_H +#define FSL_SVR_H #define SVR_REV (svr) ((svr) & 0xFF)/* SOC design resision */ #define SVR_MAJ (svr) (((svr) >> 4) & 0xF)/* Major revision field*/
Signature · 1 line
2.1.0.27.g96db324
Re: [v6, 4/5] powerpc/fsl: move mpc85xx.h to include/linux/fsl
Quoted 7 lines · Yangbo Lu
Move
mpc85xx.htoinclude/linux/fsland rename it tosvr.has a common header file. It has been used for mpc85xx and it will be used for ARM-based SoC as well.Signed-off-by Yangbo Lu <[email protected]>From a glimpse, looks like proper refactoring. Thanks!
For the I2C part:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160312/d8b2c662/attachment.sig>
PATCH v6 5/5 mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
In reply to Yangbo LuThe eSDHC of T4240-R1.0-R2.0 has incorrect vender version and spec version. Acturally the right version numbers should be VVN=0x13 and SVN = 0x1. This patch adds the GUTS driver support for eSDHC driver to get SVR(System version register). And fix host version to avoid that incorrect version numbers break down the ADMA data transfer.
---
Changes for v2:
- Got SVR through iomap instead of dts
Changes for v3:
- Managed GUTS through syscon instead of iomap in eSDHC driver
Changes for v4:
- Got SVR by GUTS driver instead of SYSCON
Changes for v5:
- Changed to get SVR through API fsl_guts_get_svr()
- Combined patch 4, patch 5 and patch 6 into one
Changes for v6:
- Added 'Acked-by: Ulf Hansson'
--- drivers/mmc/host/Kconfig | 1 + drivers/mmc/host/sdhci-of-esdhc.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+)
drivers/mmc/host/Kconfig +1 -0
@@ -142,6 +142,7 @@ config MMC_SDHCI_OF_ESDHC depends on MMC_SDHCI_PLTFM depends on PPC || ARCH_MXC || ARCH_LAYERSCAPE select MMC_SDHCI_IO_ACCESSORS + select FSL_GUTS help This selects the Freescale eSDHC controller support.
drivers/mmc/host/sdhci-of-esdhc.c +23 -0
@@ -18,6 +18,8 @@#include <linux/of.h> #include <linux/delay.h> #include <linux/module.h> +#include <linux/fsl/svr.h> +#include <linux/fsl/guts.h> #include <linux/mmc/host.h> #include "sdhci-pltfm.h" #include "sdhci-esdhc.h"
@@ -28,6 +30,8 @@struct sdhci_esdhc {u8 vendor_ver;u8 spec_ver; +u32 soc_ver; +u8 soc_rev; };/**
@@ -73,6 +77,8 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,static u16 esdhc_readw_fixup (struct sdhci_host *host,int spec_reg,u32 value) { +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_esdhc *esdhc =sdhci_pltfm_priv (pltfm_host);u16 ret;int shift = (spec_reg &0x2 ) *8 ;
@@ -80,6 +86,13 @@ static u16 esdhc_readw_fixup(struct sdhci_host *host, ret = value &0xffff ; else ret = (value >> shift) &0xffff ; + +/* Workaround for T4240-R1.0-R2.0 eSDHC which has incorrect +* vendor version and spec version information. +*/ +if ((spec_reg ==SDHCI_HOST_VERSION ) && + (esdhc->soc_ver ==SVR_T4240 ) && (esdhc->soc_rev <=0x20 )) + ret = (VENDOR_V_23 <<SDHCI_VENDOR_VER_SHIFT ) |SDHCI_SPEC_200 ;return ret; }
@@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)struct sdhci_pltfm_host *pltfm_host;struct sdhci_esdhc *esdhc;u16 host_ver; +u32 svr; pltfm_host =sdhci_priv (host); esdhc =sdhci_pltfm_priv (pltfm_host); +fsl_guts_init (); + svr =fsl_guts_get_svr (); +if (svr) { + esdhc->soc_ver =SVR_SOC_VER (svr); + esdhc->soc_rev =SVR_REV (svr); + }else { +dev_err (&pdev->dev,"Failed to get SVR value!\n" ); + } + host_ver =sdhci_readw (host,SDHCI_HOST_VERSION ); esdhc->vendor_ver = (host_ver &SDHCI_VENDOR_VER_MASK ) >>SDHCI_VENDOR_VER_SHIFT ;
Signature · 1 line
2.1.0.27.g96db324
Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 8 lines · On Wednesday 09 March 2016 18:08:51 Yangbo Lu wrote:
drivers/mmc/host/sdhci-of-esdhc.c +1
-0@@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)struct sdhci_pltfm_host *pltfm_host;struct sdhci_esdhc *esdhc;u16 host_ver; +u32 svr; pltfm_host =sdhci_priv (host); esdhc =sdhci_pltfm_priv (pltfm_host);
drivers/mmc/host/sdhci-of-esdhc.c static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · line 596
Quoted 10 lines
drivers/mmc/host/sdhci-of-esdhc.c +9
-0+fsl_guts_init (); + svr =fsl_guts_get_svr (); +if (svr) { + esdhc->soc_ver =SVR_SOC_VER (svr); + esdhc->soc_rev =SVR_REV (svr); + }else { +dev_err (&pdev->dev,"Failed to get SVR value!\n" ); + } +
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
RE: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 35 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Monday, March 14, 2016 6:26 AM
To: linuxppc-dev at lists.ozlabs.org
Cc: Yangbo Lu; devicetree at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linux- clk at vger.kernel.org; linux-i2c at vger.kernel.org; iommu at lists.linux- foundation.org; netdev at vger.kernel.org; linux-mmc at vger.kernel.org; ulf.hansson at linaro.org; Zhao Qiang; Russell King; Bhupesh Sharma; Joerg Roedel; Santosh Shilimkar; Scott Wood; Rob Herring; Claudiu Manoil; Kumar Gala; Yang-Leo Li; Xiaobo Xie
Subject: Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240- R1.0-R2.0Review static void esdhc_init(struct platform_device
Quoted 1 line · On Wednesday 09 March 2016 18:08:51 Yangbo Lu wrote:
(quoted diff) +0
-0@@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device*pdev, struct
sdhci_host*host)Quoted 7 lines
drivers/mmc/host/sdhci-of-esdhc.c +1
-0struct sdhci_pltfm_host *pltfm_host;struct sdhci_esdhc *esdhc;u16 host_ver; +u32 svr; pltfm_host =sdhci_priv (host); esdhc =sdhci_pltfm_priv (pltfm_host);drivers/mmc/host/sdhci-of-esdhc.c static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · line 596
Quoted 10 lines
drivers/mmc/host/sdhci-of-esdhc.c +9
-0+fsl_guts_init (); + svr =fsl_guts_get_svr (); +if (svr) { + esdhc->soc_ver =SVR_SOC_VER (svr); + esdhc->soc_rev =SVR_REV (svr); + }else { +dev_err (&pdev->dev,"Failed to get SVR value!\n" ); + } +
Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS in v1 before.
https://patchwork.kernel.org/patch/6834221/
We don't have a separate DTS file for each revision of an SOC and if we did, we'd constantly have people using the wrong one. In addition, the device tree is stable ABI and errata are often discovered after device tree are deployed. See the link for details.
So we decide to read SVR from the device-config/guts MMIO block other than using DTS. Thanks.
Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 44 lines · Yangbo Lu
Quoted 35 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Monday, March 14, 2016 6:26 AM
To: linuxppc-dev at lists.ozlabs.org
Cc: Yangbo Lu; devicetree at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linux- clk at vger.kernel.org; linux-i2c at vger.kernel.org; iommu at lists.linux- foundation.org; netdev at vger.kernel.org; linux-mmc at vger.kernel.org; ulf.hansson at linaro.org; Zhao Qiang; Russell King; Bhupesh Sharma; Joerg Roedel; Santosh Shilimkar; Scott Wood; Rob Herring; Claudiu Manoil; Kumar Gala; Yang-Leo Li; Xiaobo Xie
Subject: Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240- R1.0-R2.0Review static void esdhc_init(struct platform_device
Quoted 1 line · On Wednesday 09 March 2016 18:08:51 Yangbo Lu wrote:
(quoted diff) +0
-0@@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device*pdev, struct
sdhci_host*host)Quoted 7 lines
drivers/mmc/host/sdhci-of-esdhc.c +1
-0struct sdhci_pltfm_host *pltfm_host;struct sdhci_esdhc *esdhc;u16 host_ver; +u32 svr; pltfm_host =sdhci_priv (host); esdhc =sdhci_pltfm_priv (pltfm_host);drivers/mmc/host/sdhci-of-esdhc.c static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · line 596
Quoted 10 lines
drivers/mmc/host/sdhci-of-esdhc.c +9
-0+fsl_guts_init (); + svr =fsl_guts_get_svr (); +if (svr) { + esdhc->soc_ver =SVR_SOC_VER (svr); + esdhc->soc_rev =SVR_REV (svr); + }else { +dev_err (&pdev->dev,"Failed to get SVR value!\n" ); + } +Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS in v1 before.
https://patchwork.kernel.org/patch/6834221/
Quoted 6 lines
We don?t have a separate DTS file for each revision of an SOC and if we did, we'd constantly have people using the wrong one. In addition, the device tree is stable ABI and errata are often discovered after device tree are deployed. See the link for details.
So we decide to read SVR from the device-config/guts MMIO block other than using DTS. Thanks.
Also note that this driver is already only for fsl-specific hardware, and it will still work even if fsl_guts doesn't find anything to bind to -- it just wouldn't be able to detect errata based on SVR in that case.
-Scott
Rob Herring
maintainerRe: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 49 lines · Scott Wood
Quoted 48 lines · Yangbo Lu
Quoted 35 lines
-----Original Message-----
From: Arnd Bergmann [mailto:arnd at arndb.de]
Sent: Monday, March 14, 2016 6:26 AM
To: linuxppc-dev at lists.ozlabs.org
Cc: Yangbo Lu; devicetree at vger.kernel.org; linux-arm-
kernel at lists.infradead.org; linux-kernel at vger.kernel.org; linux- clk at vger.kernel.org; linux-i2c at vger.kernel.org; iommu at lists.linux- foundation.org; netdev at vger.kernel.org; linux-mmc at vger.kernel.org; ulf.hansson at linaro.org; Zhao Qiang; Russell King; Bhupesh Sharma; Joerg Roedel; Santosh Shilimkar; Scott Wood; Rob Herring; Claudiu Manoil; Kumar Gala; Yang-Leo Li; Xiaobo Xie
Subject: Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240- R1.0-R2.0Review static void esdhc_init(struct platform_device
Quoted 1 line · On Wednesday 09 March 2016 18:08:51 Yangbo Lu wrote:
(quoted diff) +0
-0@@ -567,10 +580,20 @@ static void esdhc_init(struct platform_device*pdev, struct
sdhci_host*host)Quoted 7 lines
drivers/mmc/host/sdhci-of-esdhc.c +1
-0struct sdhci_pltfm_host *pltfm_host;struct sdhci_esdhc *esdhc;u16 host_ver; +u32 svr; pltfm_host =sdhci_priv (host); esdhc =sdhci_pltfm_priv (pltfm_host);drivers/mmc/host/sdhci-of-esdhc.c static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) · line 596
Quoted 10 lines
drivers/mmc/host/sdhci-of-esdhc.c +9
-0+fsl_guts_init (); + svr =fsl_guts_get_svr (); +if (svr) { + esdhc->soc_ver =SVR_SOC_VER (svr); + esdhc->soc_rev =SVR_REV (svr); + }else { +dev_err (&pdev->dev,"Failed to get SVR value!\n" ); + } +Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS in v1 before.
https://patchwork.kernel.org/patch/6834221/We don?t have a separate DTS file for each revision of an SOC and if we did, we'd constantly have people using the wrong one. In addition, the device tree is stable ABI and errata are often discovered after device tree are deployed. See the link for details.
Quoted 6 lines
Quoted 2 lines
So we decide to read SVR from the device-config/guts MMIO block other than using DTS. Thanks.
Also note that this driver is already only for fsl-specific hardware, and it will still work even if
fsl_gutsdoesn't find anything to bind to -- it just wouldn't be able to detect errata based on SVR in that case.
IIRC, it is the same IP block as i.MX and Arnd's point is this won't even compile on !PPC. It is things like this that prevent sharing the driver. Dealing with Si revs is a common problem. We should have a common solution. There is soc_device for this purpose.
OTOH, the integration differences may be enough that trying to have a common driver with i.MX would not be worth it.
Rob
Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 18 lines · On Thursday 17 March 2016 12:01:01 Rob Herring wrote:
Quoted 16 lines · Scott Wood
Quoted 15 lines
Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS in v1 before.
https://patchwork.kernel.org/patch/6834221/We don?t have a separate DTS file for each revision of an SOC and if we did, we'd constantly have people using the wrong one. In addition, the device tree is stable ABI and errata are often discovered after device tree are deployed. See the link for details.
So we decide to read SVR from the device-config/guts MMIO block other than using DTS. Thanks.
Quoted 7 lines
Quoted 3 lines
Also note that this driver is already only for fsl-specific hardware, and it will still work even if
fsl_gutsdoesn't find anything to bind to -- it just wouldn't be able to detect errata based on SVR in that case.IIRC, it is the same IP block as i.MX and Arnd's point is this won't even compile on !PPC. It is things like this that prevent sharing the driver.
I think the first four patches take care of building for ARM, but the problem remains if you want to enable COMPILE_TEST as we need for certain automated checking.
Quoted 2 lines
Dealing with Si revs is a common problem. We should have a common solution. There is
soc_devicefor this purpose.
Exactly. The last time this came up, I think we agreed to implement a helper using glob_match() on the soc_device strings. Unfortunately this hasn't happened then, but I'd still prefer that over yet another vendor-specific way of dealing with the generic issue.
Arnd
Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 19 lines · Arnd Bergmann
Quoted 18 lines · On Thursday 17 March 2016 12:01:01 Rob Herring wrote:
Quoted 16 lines · Scott Wood
Quoted 15 lines
Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS in v1 before.
https://patchwork.kernel.org/patch/6834221/We don?t have a separate DTS file for each revision of an SOC and if we did, we'd constantly have people using the wrong one. In addition, the device tree is stable ABI and errata are often discovered after device tree are deployed. See the link for details.
So we decide to read SVR from the device-config/guts MMIO block other than using DTS. Thanks.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Also note that this driver is already only for fsl-specific hardware, and it will still work even if
fsl_gutsdoesn't find anything to bind to -- it just wouldn't be able to detect errata based on SVR in that case.IIRC, it is the same IP block as i.MX and Arnd's point is this won't even compile on !PPC. It is things like this that prevent sharing the driver.
The whole point of using the MMIO SVR instead of the PPC SPR is so that it will work on ARM... The guts driver should build on any platform as long as OF is enabled, and if it doesn't find a node to bind to it will return 0 for SVR, and the eSDHC driver will continue (after printing an error that should be removed) without the ability to test for errata based on SVR.
Quoted 3 lines
I think the first four patches take care of building for ARM, but the problem remains if you want to enable
COMPILE_TESTas we need for certain automated checking.
What specific problem is there with COMPILE_TEST?
Quoted 7 lines
Quoted 2 lines
Dealing with Si revs is a common problem. We should have a common solution. There is
soc_devicefor this purpose.Exactly. The last time this came up, I think we agreed to implement a helper using
glob_match()on thesoc_devicestrings. Unfortunately this hasn't happened then, but I'd still prefer that over yet another vendor-specific way of dealing with the generic issue.
soc_device would require encoding the SVR as a string and then decoding the string, which is more complicated and error prone than having platform-specific code test a platform-specific number. And when would it get registered on arm64, which doesn't have platform code?
-Scott
RE: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240-R1.0-R2.0
Quoted 69 lines
-----Original Message-----
From: Scott Wood
Sent: Saturday, March 19, 2016 2:28 AM
To: Arnd Bergmann; Rob Herring
Cc: Yangbo Lu; linuxppc-dev at lists.ozlabs.org; devicetree at vger.kernel.org; ulf.hansson at linaro.org; Zhao Qiang; Russell King; Bhupesh Sharma; netdev at vger.kernel.org; Joerg Roedel; Kumar Gala; linux-
mmc at vger.kernel.org; linux-kernel at vger.kernel.org; Yang-Leo Li; iommu at lists.linux-foundation.org; linux-i2c at vger.kernel.org; Claudiu Manoil; Santosh Shilimkar; Xiaobo Xie; linux-clk at vger.kernel.org; linux- arm-kernel at lists.infradead.org
Subject: Re: [v6, 5/5] mmc: sdhci-of-esdhc: fix host version for T4240- R1.0-R2.0Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · On Thursday 17 March 2016 12:01:01 Rob Herring wrote:
Quoted 7 lines · Scott Wood
Quoted 7 lines
Quoted 5 lines
This makes the driver non-portable. Better identify the specific workarounds based on the compatible string for this device, or add a boolean DT property for the quirk.
Arnd
[Lu Yangbo-B47093] Hi Arnd, we did have a discussion about using DTS
in v1 before.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
https://patchwork.kernel.org/patch/6834221/
We don't have a separate DTS file for each revision of an SOC and if
we did, we'd constantly have people using the wrong one.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
In addition, the device tree is stable ABI and errata are often
discovered after device tree are deployed.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
See the link for details.
So we decide to read SVR from the device-config/guts MMIO block
other than using DTS.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Thanks.
Also note that this driver is already only for fsl-specific hardware, and it will still work even if
fsl_gutsdoesn't find anything to bind to
-- it just wouldn't be able to detect errata based on SVR in thatcase.
Quoted 4 lines
Quoted 4 lines
IIRC, it is the same IP block as i.MX and Arnd's point is this won't even compile on !PPC. It is things like this that prevent sharing the driver.
The whole point of using the MMIO SVR instead of the PPC SPR is so that it will work on ARM... The guts driver should build on any platform as long as OF is enabled, and if it doesn't find a node to bind to it will return 0 for SVR, and the eSDHC driver will continue (after printing an error that should be removed) without the ability to test for errata based on SVR.
Quoted 3 lines
I think the first four patches take care of building for ARM, but the problem remains if you want to enable
COMPILE_TESTas we need for certain automated checking.What specific problem is there with
COMPILE_TEST?Quoted 7 lines
Quoted 2 lines
Dealing with Si revs is a common problem. We should have a common solution. There is
soc_devicefor this purpose.Exactly. The last time this came up, I think we agreed to implement a helper using
glob_match()on thesoc_devicestrings. Unfortunately this hasn't happened then, but I'd still prefer that over yet another vendor-specific way of dealing with the generic issue.
Quoted 6 lines
soc_devicewould require encoding the SVR as a string and then decoding the string, which is more complicated and error prone than having platform-specific code test a platform-specific number. And when would it get registered on arm64, which doesn't have platform code?-Scott
[Lu Yangbo-B47093] Hi Arnd, could you answer Scott's questions? If you don't oppose this patch, I'd like to rework a new version for merging. Thanks.
:)