kernel: update 3.14 to 3.14.18
[openwrt.git] / target / linux / ipq806x / patches / 0068-spi-qup-Convert-ot-let-spi-core-handle-checking-tran.patch
1 From a4b122f945c564e47a42a9665b484785e86648de Mon Sep 17 00:00:00 2001
2 From: Axel Lin <axel.lin@ingics.com>
3 Date: Fri, 21 Feb 2014 09:34:16 +0800
4 Subject: [PATCH 068/182] spi: qup: Convert ot let spi core handle checking
5  transfer speed
6
7 Set master->max_speed_hz then spi core will handle checking transfer speed.
8 So we can remove the same checking in this driver.
9
10 Also remove checking spi->chip_select in spi_qup_setup(), the checking is done
11 by spi core.
12
13 Signed-off-by: Axel Lin <axel.lin@ingics.com>
14 Acked-by: Ivan T. Ivanov <iivanov@mm-sol.com>
15 Signed-off-by: Mark Brown <broonie@linaro.org>
16 ---
17  drivers/spi/spi-qup.c |   15 +--------------
18  1 file changed, 1 insertion(+), 14 deletions(-)
19
20 --- a/drivers/spi/spi-qup.c
21 +++ b/drivers/spi/spi-qup.c
22 @@ -134,7 +134,6 @@ struct spi_qup {
23         struct clk              *cclk;  /* core clock */
24         struct clk              *iclk;  /* interface clock */
25         int                     irq;
26 -       u32                     max_speed_hz;
27         spinlock_t              lock;
28  
29         int                     in_fifo_sz;
30 @@ -517,18 +516,6 @@ static int spi_qup_setup(struct spi_devi
31         struct spi_qup *controller = spi_master_get_devdata(spi->master);
32         struct spi_qup_device *chip = spi_get_ctldata(spi);
33  
34 -       if (spi->chip_select >= spi->master->num_chipselect) {
35 -               dev_err(controller->dev, "invalid chip_select %d\n",
36 -                       spi->chip_select);
37 -               return -EINVAL;
38 -       }
39 -
40 -       if (spi->max_speed_hz > controller->max_speed_hz) {
41 -               dev_err(controller->dev, "invalid max_speed_hz %d\n",
42 -                       spi->max_speed_hz);
43 -               return -EINVAL;
44 -       }
45 -
46         if (!chip) {
47                 /* First setup */
48                 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
49 @@ -629,6 +616,7 @@ static int spi_qup_probe(struct platform
50         master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
51         master->num_chipselect = SPI_NUM_CHIPSELECTS;
52         master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
53 +       master->max_speed_hz = max_freq;
54         master->setup = spi_qup_setup;
55         master->cleanup = spi_qup_cleanup;
56         master->set_cs = spi_qup_set_cs;
57 @@ -645,7 +633,6 @@ static int spi_qup_probe(struct platform
58         controller->iclk = iclk;
59         controller->cclk = cclk;
60         controller->irq = irq;
61 -       controller->max_speed_hz = max_freq;
62  
63         spin_lock_init(&controller->lock);
64         init_completion(&controller->done);