brcm2708: update 3.10 patches with raspberrypi/rpi-3.10.y of 27 Apr. 2014
[openwrt/staging/blogic.git] / target / linux / brcm2708 / patches-3.10 / 0046-spi-spi-bcm2708-respect-per-transfer-SPI-clock-speed.patch
1 From 78948302252dcffa18716390f784ba03e4320c67 Mon Sep 17 00:00:00 2001
2 From: Kamal Mostafa <kamal@whence.com>
3 Date: Mon, 22 Oct 2012 15:52:44 -0700
4 Subject: [PATCH 046/196] spi/spi-bcm2708: respect per-transfer SPI clock
5 speed_hz value
6
7 The bcm2708 SPI driver's bcm2708_process_transfer() was ignoring the
8 per-transfer speed_hz value even when it was provided (it always just
9 used the spi device's max_speed_hz value). Now, per-transfer speed_hz
10 values are respected.
11
12 Also added debug print to bcm2708_setup_state() to help keep an eye on
13 the configured SPI parameters.
14
15 Signed-off-by: Kamal Mostafa <kamal@whence.com>
16 ---
17 drivers/spi/spi-bcm2708.c | 7 ++++++-
18 1 file changed, 6 insertions(+), 1 deletion(-)
19
20 diff --git a/drivers/spi/spi-bcm2708.c b/drivers/spi/spi-bcm2708.c
21 index 8513704..b74aa32 100644
22 --- a/drivers/spi/spi-bcm2708.c
23 +++ b/drivers/spi/spi-bcm2708.c
24 @@ -259,6 +259,10 @@ static int bcm2708_setup_state(struct spi_master *master,
25 if (state) {
26 state->cs = cs;
27 state->cdiv = cdiv;
28 + dev_dbg(dev, "setup: want %d Hz; "
29 + "bus_hz=%lu / cdiv=%u == %lu Hz; "
30 + "mode %u: cs 0x%08X\n",
31 + hz, bus_hz, cdiv, bus_hz/cdiv, mode, cs);
32 }
33
34 return 0;
35 @@ -277,7 +281,8 @@ static int bcm2708_process_transfer(struct bcm2708_spi *bs,
36
37 if (xfer->bits_per_word || xfer->speed_hz) {
38 ret = bcm2708_setup_state(spi->master, &spi->dev, &state,
39 - spi->max_speed_hz, spi->chip_select, spi->mode,
40 + xfer->speed_hz ? xfer->speed_hz : spi->max_speed_hz,
41 + spi->chip_select, spi->mode,
42 spi->bits_per_word);
43 if (ret)
44 return ret;
45 --
46 1.9.1
47