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