0530-spi-bcm2835-Remove-unused-code.patch 2.5 KB

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