Fix i2c bus hang on A0 version of the Armada XP SoCs
Subsystems (5)
v3 cover Fix i2c bus hang on A0 version of the Armada XP SoCs
Hi,
This the 3rd (and I hope last) version of the series fixing the i2c bus hang on A0 version of the Armada XP SoCs. It occurred on the early release of the OpenBlocks AX3-4 boards. Indeed the first variants of Armada XP SoCs (A0 stepping) have issues related to the i2c controller which prevent to use the offload mechanism and lead to a kernel hang during boot.
The first patch add a mean to detect the SoCs version at run-time and the second one use this feature in the driver.
These 2 patches should be applied on 3.13-rc and on stable kernel 3.12 as it fixes a regression introduce by the commit 930ab3d403ae "i2c:
mv64xxx: Add I2C Transaction Generator support".
The first patch could be latter be extend to also be used with dove, kirkwood, orion5x and mv78x00 when there will be merged in mvebu.
Thanks,
Gregory
Changelog:
v2 -> v3:
- fixed typo in the comments added in i2c-mv64xxx.c
- used pr_fmt instead of %s __func__ in all the pr_* functions
- added a check on the pointer returned by of_get_next_child()
- added a return immediately after the 1st check to be able to get rid of indenting the entire function code inside the if { ... } block.
v1 -> v2:
- Changed the way to test the return of the function mvebu_get_soc_id in order to make it clearer.
- Removed the superfluous parentheses
- Added Wolfram's acked-by on the 2nd patch
Gregory CLEMENT (2):
ARM: mvebu: Add support to get the ID and the revision of a SoC
i2c: mv64xxx: Fix bus hang on A0 version of the Armada XP SoCs
arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-mvebu/mvebu-soc-id.c | 121 +++++++++++++++++++++++++++++++++++++ drivers/i2c/busses/i2c-mv64xxx.c | 11 +++- include/linux/mvebu-soc-id.h | 32 ++++++++++ 4 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-mvebu/mvebu-soc-id.c create mode 100644 include/linux/mvebu-soc-id.h
Signature · 1 line
1.8.1.2
PATCH v3 1/2 ARM: mvebu: Add support to get the ID and the revision of a SoC
All the mvebu SoCs have information related to their variant and revision that can be read from the PCI control register.
This patch adds support for Armada XP and Armada 370. This reading of the revision and the ID are done before the PCI initialization to avoid any conflicts. Once these data are retrieved, the resources are freed to let the PCI subsystem use it.
--- arch/arm/mach-mvebu/Makefile | 2 +- arch/arm/mach-mvebu/mvebu-soc-id.c | 121 +++++++++++++++++++++++++++++++++++++ include/linux/mvebu-soc-id.h | 32 ++++++++++ 3 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-mvebu/mvebu-soc-id.c create mode 100644 include/linux/mvebu-soc-id.h
arch/arm/mach-mvebu/Makefile +1 -1
@@ -3,7 +3,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \ AFLAGS_coherency_ll.o := -Wa,-march=armv7-a -obj-y += system-controller.o +obj-y += system-controller.o mvebu-soc-id.o obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o obj-$(CONFIG_ARCH_MVEBU) += coherency.o coherency_ll.o pmsu.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o
arch/arm/mach-mvebu/mvebu-soc-id.c new file +121 -0
121 lines not on this page · raw message
include/linux/mvebu-soc-id.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Marvell EBU SoC ID and revision definitions. +* +* Copyright (C) 2014 Marvell Semiconductor +* +* This file is licensed under the terms of the GNU General Public +* License version 2. This program is licensed "as is" without any +* warranty of any kind, whether express or implied. +*/ + +#ifndef __LINUX_MVEBU_SOC_ID_H +#define __LINUX_MVEBU_SOC_ID_H + +/* Armada XP ID */ +#define MV78230_DEV_ID 0x7823 +#define MV78260_DEV_ID 0x7826 +#define MV78460_DEV_ID 0x7846 + +/* Armada XP Revision */ +#define MV78XX0_A0_REV 0x1 +#define MV78XX0_B0_REV 0x2 + +#ifdef CONFIG_ARCH_MVEBU +int mvebu_get_soc_id (u32 *dev,u32 *rev); +#else +static inline int mvebu_get_soc_id (u32 *dev,u32 *rev) +{ +return -1 ; +} +#endif + +#endif /* __LINUX_MVEBU_SOC_ID_H */
Signature · 1 line
1.8.1.2
PATCH v3 2/2 i2c: mv64xxx: Fix bus hang on A0 version of the Armada XP SoCs
In reply to Gregory CLEMENTThe first variants of Armada XP SoCs (A0 stepping) have issues related to the i2c controller which prevent to use the offload mechanism and lead to a kernel hang during boot.
The driver now check the revision of the SoC. If the revision is not more recent than the A0 or if the driver can't get the SoC revision then it disables the offload mechanism.
--- drivers/i2c/busses/i2c-mv64xxx.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-mv64xxx.c +10 -1
@@ -24,6 +24,7 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/delay.h> +#include <linux/mvebu-soc-id.h> #define MV64XXX_I2C_ADDR_ADDR (val) ((val & 0x7f) << 1)#define MV64XXX_I2C_BAUD_DIV_N (val) (val & 0x7)
@@ -779,8 +780,16 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,* Transaction Generator support and the errata fix. */ if (of_device_is_compatible (np,"marvell,mv78230-i2c" )) { - drv_data->offload_enabled = true; +u32 dev, rev; + drv_data->errata_delay = true; +/* +* Only revisons more recent than A0 support the +* offload mechanism. In case we can't get the SoC +* revision we play safe and we don't enable it +*/ +if (mvebu_get_soc_id (&rev, &dev) ==0 && dev >MV78XX0_A0_REV ) + drv_data->offload_enabled = true; } out:
Signature · 1 line
1.8.1.2
Andrew Lunn
maintainerv3 cover Fix i2c bus hang on A0 version of the Armada XP SoCs
In reply to Gregory CLEMENTQuoted 8 lines · Gregory CLEMENT
Hi,
This the 3rd (and I hope last) version of the series fixing the i2c bus hang on A0 version of the Armada XP SoCs. It occurred on the early release of the OpenBlocks AX3-4 boards. Indeed the first variants of Armada XP SoCs (A0 stepping) have issues related to the i2c controller which prevent to use the offload mechanism and lead to a kernel hang during boot.
Hi Gregory
Tested on my OpenBlocks AX3-4 with an A0 SoC.
Thanks
Andrew
v3 cover Fix i2c bus hang on A0 version of the Armada XP SoCs
Quoted 10 lines · Andrew Lunn
Quoted 8 lines · Gregory CLEMENT
Hi,
This the 3rd (and I hope last) version of the series fixing the i2c bus hang on A0 version of the Armada XP SoCs. It occurred on the early release of the OpenBlocks AX3-4 boards. Indeed the first variants of Armada XP SoCs (A0 stepping) have issues related to the i2c controller which prevent to use the offload mechanism and lead to a kernel hang during boot.
Quoted 4 lines
Hi Gregory
Tested on my OpenBlocks AX3-4 with an A0 SoC.
Great! Thanks!
Quoted 1 line
Tested-by Andrew Lunn <[email protected]>
I will let Jason add your tested-by flag when he will get the patches
Quoted 4 lines
Thanks
Andrew
Signature · 4 lines
Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com