brcm2708: update linux 4.4 patches to latest version
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0530-spi-bcm2835-Remove-unused-code.patch
1 From c78b3b917d305e617ad11d147c9668b1df338208 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 8 Nov 2016 21:35:38 +0000
4 Subject: [PATCH] spi-bcm2835: Remove unused code
5
6 ---
7  drivers/spi/spi-bcm2835.c | 66 -----------------------------------------------
8  1 file changed, 66 deletions(-)
9
10 --- a/drivers/spi/spi-bcm2835.c
11 +++ b/drivers/spi/spi-bcm2835.c
12 @@ -679,17 +679,8 @@ static void bcm2835_spi_set_cs(struct sp
13         bcm2835_wr(bs, BCM2835_SPI_CS, cs);
14  }
15  
16 -static int chip_match_name(struct gpio_chip *chip, void *data)
17 -{
18 -       return !strcmp(chip->label, data);
19 -}
20 -
21  static int bcm2835_spi_setup(struct spi_device *spi)
22  {
23 -       int err;
24 -       struct gpio_chip *chip;
25 -       struct device_node *pins;
26 -       u32 pingroup_index;
27         /*
28          * sanity checking the native-chipselects
29          */
30 @@ -707,63 +698,6 @@ static int bcm2835_spi_setup(struct spi_
31                 return -EINVAL;
32         }
33  
34 -#if 0
35 -       /* now translate native cs to GPIO */
36 -       /* first look for chip select pins in the devices pin groups */
37 -       for (pingroup_index = 0;
38 -            (pins = of_parse_phandle(spi->master->dev.of_node,
39 -                                    "pinctrl-0",
40 -                                     pingroup_index)) != 0;
41 -            pingroup_index++) {
42 -               u32 pin;
43 -               u32 pin_index;
44 -               for (pin_index = 0;
45 -                    of_property_read_u32_index(pins,
46 -                                               "brcm,pins",
47 -                                               pin_index,
48 -                                               &pin) == 0;
49 -                    pin_index++) {
50 -                       if (((spi->chip_select == 0) &&
51 -                            ((pin == 8) || (pin == 36) || (pin == 46))) ||
52 -                           ((spi->chip_select == 1) &&
53 -                            ((pin == 7) || (pin == 35)))) {
54 -                               spi->cs_gpio = pin;
55 -                               break;
56 -                       }
57 -               }
58 -               of_node_put(pins);
59 -       }
60 -       /* if that fails, assume GPIOs 7-11 are used */
61 -       if (!gpio_is_valid(spi->cs_gpio) ) {
62 -               /* get the gpio chip for the base */
63 -               chip = gpiochip_find("pinctrl-bcm2835", chip_match_name);
64 -               if (!chip)
65 -                       return 0;
66 -
67 -               /* and calculate the real CS */
68 -               spi->cs_gpio = chip->base + 8 - spi->chip_select;
69 -       }
70 -
71 -       /* and set up the "mode" and level */
72 -       dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n",
73 -                spi->chip_select, spi->cs_gpio);
74 -
75 -       /* set up GPIO as output and pull to the correct level */
76 -       err = gpio_direction_output(spi->cs_gpio,
77 -                                   (spi->mode & SPI_CS_HIGH) ? 0 : 1);
78 -       if (err) {
79 -               dev_err(&spi->dev,
80 -                       "could not set CS%i gpio %i as output: %i",
81 -                       spi->chip_select, spi->cs_gpio, err);
82 -               return err;
83 -       }
84 -       /* the implementation of pinctrl-bcm2835 currently does not
85 -        * set the GPIO value when using gpio_direction_output
86 -        * so we are setting it here explicitly
87 -        */
88 -       gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
89 -#endif
90 -
91         return 0;
92  }
93