08577fce2af4d12159e0295d3beea0d31ecdf9b8
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.9 / 950-0017-spi-bcm2835-Remove-unused-code.patch
1 From 21f7f9d8146dd9e5a860198781febf78aafee3d1 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 | 61 -----------------------------------------------
8 1 file changed, 61 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,58 +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 -#endif
85 -
86 return 0;
87 }
88