diff mbox

bus: mvebu-mbus: fix support of MBus window 13

Message ID 1421596214-15924-1-git-send-email-andrew@lunn.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Lunn Jan. 18, 2015, 3:50 p.m. UTC
On Armada XP, 375 and 38x the MBus window 13 has the remap capability,
like windows 0 to 7. However, the mvebu-mbus driver isn't currently
taking into account this special case, which means that when window 13
is actually used, the remap registers are left to 0, making the device
using this MBus window unavailable.

As a minimal fix for stable, don't use window 13. A full fix will
follow later.

Fixes: fddddb52a6c ("bus: introduce an Marvell EBU MBus driver")
Cc: <stable@vger.kernel.org> # v3.10+
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 drivers/bus/mvebu-mbus.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Andrew Lunn Jan. 18, 2015, 3:53 p.m. UTC | #1
On Sun, Jan 18, 2015 at 04:50:14PM +0100, Andrew Lunn wrote:
> On Armada XP, 375 and 38x the MBus window 13 has the remap capability,
> like windows 0 to 7. However, the mvebu-mbus driver isn't currently
> taking into account this special case, which means that when window 13
> is actually used, the remap registers are left to 0, making the device
> using this MBus window unavailable.
> 
> As a minimal fix for stable, don't use window 13. A full fix will
> follow later.

Hi Gregory, Michal

We need a minimal fix which can be back ported to stable, since the
real fix is large. Thomas is now on vacation for a week, so i've tried
to produce a fix. Please could you test this and let me know if it
works.

Thanks

	Andrew

> 
> Fixes: fddddb52a6c ("bus: introduce an Marvell EBU MBus driver")
> Cc: <stable@vger.kernel.org> # v3.10+
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  drivers/bus/mvebu-mbus.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index eb7682dc123b..81bf297f1034 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -210,12 +210,25 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
>  }
>  
>  /* Checks whether the given window number is available */
> +
> +/* On Armada XP, 375 and 38x the MBus window 13 has the remap
> + * capability, like windows 0 to 7. However, the mvebu-mbus driver
> + * isn't currently taking into account this special case, which means
> + * that when window 13 is actually used, the remap registers are left
> + * to 0, making the device using this MBus window unavailable. The
> + * quick fix for stable is to not use window 13. A follow up patch
> + * will correctly handle this window.
> +*/
>  static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
>  				     const int win)
>  {
>  	void __iomem *addr = mbus->mbuswins_base +
>  		mbus->soc->win_cfg_offset(win);
>  	u32 ctrl = readl(addr + WIN_CTRL_OFF);
> +
> +	if (win == 13)
> +		return false;
> +
>  	return !(ctrl & WIN_CTRL_ENABLE);
>  }
>  
> -- 
> 2.1.4
>
Thomas Petazzoni Jan. 18, 2015, 4:29 p.m. UTC | #2
Dear Andrew Lunn,

On Sun, 18 Jan 2015 16:50:14 +0100, Andrew Lunn wrote:
> On Armada XP, 375 and 38x the MBus window 13 has the remap capability,
> like windows 0 to 7. However, the mvebu-mbus driver isn't currently
> taking into account this special case, which means that when window 13
> is actually used, the remap registers are left to 0, making the device
> using this MBus window unavailable.
> 
> As a minimal fix for stable, don't use window 13. A full fix will
> follow later.
> 
> Fixes: fddddb52a6c ("bus: introduce an Marvell EBU MBus driver")
> Cc: <stable@vger.kernel.org> # v3.10+
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Thanks a lot for doing this!

Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thomas
Andrew Lunn Jan. 19, 2015, 10:14 p.m. UTC | #3
On Sun, Jan 18, 2015 at 04:50:14PM +0100, Andrew Lunn wrote:
> On Armada XP, 375 and 38x the MBus window 13 has the remap capability,
> like windows 0 to 7. However, the mvebu-mbus driver isn't currently
> taking into account this special case, which means that when window 13
> is actually used, the remap registers are left to 0, making the device
> using this MBus window unavailable.
> 
> As a minimal fix for stable, don't use window 13. A full fix will
> follow later.
> 
> Fixes: fddddb52a6c ("bus: introduce an Marvell EBU MBus driver")
> Cc: <stable@vger.kernel.org> # v3.10+
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>

Added to mvebu/fixes-3 with Thomas's Reviewed-by:

      Andrew 

> ---
>  drivers/bus/mvebu-mbus.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index eb7682dc123b..81bf297f1034 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -210,12 +210,25 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
>  }
>  
>  /* Checks whether the given window number is available */
> +
> +/* On Armada XP, 375 and 38x the MBus window 13 has the remap
> + * capability, like windows 0 to 7. However, the mvebu-mbus driver
> + * isn't currently taking into account this special case, which means
> + * that when window 13 is actually used, the remap registers are left
> + * to 0, making the device using this MBus window unavailable. The
> + * quick fix for stable is to not use window 13. A follow up patch
> + * will correctly handle this window.
> +*/
>  static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
>  				     const int win)
>  {
>  	void __iomem *addr = mbus->mbuswins_base +
>  		mbus->soc->win_cfg_offset(win);
>  	u32 ctrl = readl(addr + WIN_CTRL_OFF);
> +
> +	if (win == 13)
> +		return false;
> +
>  	return !(ctrl & WIN_CTRL_ENABLE);
>  }
>  
> -- 
> 2.1.4
>
diff mbox

Patch

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index eb7682dc123b..81bf297f1034 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -210,12 +210,25 @@  static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
 }
 
 /* Checks whether the given window number is available */
+
+/* On Armada XP, 375 and 38x the MBus window 13 has the remap
+ * capability, like windows 0 to 7. However, the mvebu-mbus driver
+ * isn't currently taking into account this special case, which means
+ * that when window 13 is actually used, the remap registers are left
+ * to 0, making the device using this MBus window unavailable. The
+ * quick fix for stable is to not use window 13. A follow up patch
+ * will correctly handle this window.
+*/
 static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
 				     const int win)
 {
 	void __iomem *addr = mbus->mbuswins_base +
 		mbus->soc->win_cfg_offset(win);
 	u32 ctrl = readl(addr + WIN_CTRL_OFF);
+
+	if (win == 13)
+		return false;
+
 	return !(ctrl & WIN_CTRL_ENABLE);
 }