001-revert_spi_device_tree_support.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
  2. +++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
  3. @@ -16,4 +16,8 @@ struct ath79_spi_platform_data {
  4. unsigned num_chipselect;
  5. };
  6. +struct ath79_spi_controller_data {
  7. + unsigned gpio;
  8. +};
  9. +
  10. #endif /* _ATH79_SPI_PLATFORM_H */
  11. --- a/drivers/spi/spi-ath79.c
  12. +++ b/drivers/spi/spi-ath79.c
  13. @@ -79,8 +79,10 @@ static void ath79_spi_chipselect(struct
  14. }
  15. if (spi->chip_select) {
  16. + struct ath79_spi_controller_data *cdata = spi->controller_data;
  17. +
  18. /* SPI is normally active-low */
  19. - gpio_set_value(spi->cs_gpio, cs_high);
  20. + gpio_set_value(cdata->gpio, cs_high);
  21. } else {
  22. if (cs_high)
  23. sp->ioc_base |= AR71XX_SPI_IOC_CS0;
  24. @@ -116,9 +118,10 @@ static void ath79_spi_disable(struct ath
  25. static int ath79_spi_setup_cs(struct spi_device *spi)
  26. {
  27. struct ath79_spi *sp = ath79_spidev_to_sp(spi);
  28. + struct ath79_spi_controller_data *cdata = spi->controller_data;
  29. int status;
  30. - if (spi->chip_select && !gpio_is_valid(spi->cs_gpio))
  31. + if (spi->chip_select && (!cdata || !gpio_is_valid(cdata->gpio)))
  32. return -EINVAL;
  33. status = 0;
  34. @@ -131,7 +134,7 @@ static int ath79_spi_setup_cs(struct spi
  35. else
  36. flags |= GPIOF_INIT_HIGH;
  37. - status = gpio_request_one(spi->cs_gpio, flags,
  38. + status = gpio_request_one(cdata->gpio, flags,
  39. dev_name(&spi->dev));
  40. } else {
  41. if (spi->mode & SPI_CS_HIGH)
  42. @@ -148,7 +151,8 @@ static int ath79_spi_setup_cs(struct spi
  43. static void ath79_spi_cleanup_cs(struct spi_device *spi)
  44. {
  45. if (spi->chip_select) {
  46. - gpio_free(spi->cs_gpio);
  47. + struct ath79_spi_controller_data *cdata = spi->controller_data;
  48. + gpio_free(cdata->gpio);
  49. }
  50. }
  51. @@ -220,7 +224,6 @@ static int ath79_spi_probe(struct platfo
  52. }
  53. sp = spi_master_get_devdata(master);
  54. - master->dev.of_node = pdev->dev.of_node;
  55. platform_set_drvdata(pdev, sp);
  56. pdata = dev_get_platdata(&pdev->dev);
  57. @@ -300,18 +303,12 @@ static void ath79_spi_shutdown(struct pl
  58. ath79_spi_remove(pdev);
  59. }
  60. -static const struct of_device_id ath79_spi_of_match[] = {
  61. - { .compatible = "qca,ar7100-spi", },
  62. - { },
  63. -};
  64. -
  65. static struct platform_driver ath79_spi_driver = {
  66. .probe = ath79_spi_probe,
  67. .remove = ath79_spi_remove,
  68. .shutdown = ath79_spi_shutdown,
  69. .driver = {
  70. .name = DRV_NAME,
  71. - .of_match_table = ath79_spi_of_match,
  72. },
  73. };
  74. module_platform_driver(ath79_spi_driver);