All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "spi: sh-msiof: Avoid invalid clock generator parameters" has been added to the 4.7-stable tree
@ 2016-10-04 15:18 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-10-04 15:18 UTC (permalink / raw)
  To: geert+renesas, broonie, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    spi: sh-msiof: Avoid invalid clock generator parameters

to the 4.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch
and it can be found in the queue-4.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From c3ccf357c3d75bd2924e049b6a991f7c0c111068 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Fri, 5 Aug 2016 10:17:52 +0200
Subject: spi: sh-msiof: Avoid invalid clock generator parameters

From: Geert Uytterhoeven <geert+renesas@glider.be>

commit c3ccf357c3d75bd2924e049b6a991f7c0c111068 upstream.

The conversion from a look-up table to a calculation for clock generator
parameters forgot to take into account that BRDV x 1/1 is valid only if
BRPS is x 1/1 or x 1/2, leading to undefined behavior (e.g. arbitrary
clock rates).

This limitation is documented for the MSIOF module in all supported
SH/R-Mobile and R-Car Gen2/Gen3 ARM SoCs.

Tested on r8a7791/koelsch and r8a7795/salvator-x.

Fixes: 65d5665bb260b034 ("spi: sh-msiof: Update calculation of frequency dividing")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/spi/spi-sh-msiof.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -263,6 +263,9 @@ static void sh_msiof_spi_set_clk_regs(st
 
 	for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) {
 		brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div);
+		/* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */
+		if (sh_msiof_spi_div_table[k].div == 1 && brps > 2)
+			continue;
 		if (brps <= 32) /* max of brdv is 32 */
 			break;
 	}


Patches currently in stable-queue which might be from geert+renesas@glider.be are

queue-4.7/spi-sh-msiof-avoid-invalid-clock-generator-parameters.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-04 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-04 15:18 Patch "spi: sh-msiof: Avoid invalid clock generator parameters" has been added to the 4.7-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.