1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- --- a/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
- +++ b/arch/mips/include/asm/mach-ath79/ath79_spi_platform.h
- @@ -16,4 +16,8 @@ struct ath79_spi_platform_data {
- unsigned num_chipselect;
- };
-
- +struct ath79_spi_controller_data {
- + unsigned gpio;
- +};
- +
- #endif /* _ATH79_SPI_PLATFORM_H */
- --- a/drivers/spi/spi-ath79.c
- +++ b/drivers/spi/spi-ath79.c
- @@ -79,8 +79,10 @@ static void ath79_spi_chipselect(struct
- }
-
- if (spi->chip_select) {
- + struct ath79_spi_controller_data *cdata = spi->controller_data;
- +
- /* SPI is normally active-low */
- - gpio_set_value(spi->cs_gpio, cs_high);
- + gpio_set_value(cdata->gpio, cs_high);
- } else {
- if (cs_high)
- sp->ioc_base |= AR71XX_SPI_IOC_CS0;
- @@ -116,9 +118,10 @@ static void ath79_spi_disable(struct ath
- static int ath79_spi_setup_cs(struct spi_device *spi)
- {
- struct ath79_spi *sp = ath79_spidev_to_sp(spi);
- + struct ath79_spi_controller_data *cdata = spi->controller_data;
- int status;
-
- - if (spi->chip_select && !gpio_is_valid(spi->cs_gpio))
- + if (spi->chip_select && (!cdata || !gpio_is_valid(cdata->gpio)))
- return -EINVAL;
-
- status = 0;
- @@ -131,7 +134,7 @@ static int ath79_spi_setup_cs(struct spi
- else
- flags |= GPIOF_INIT_HIGH;
-
- - status = gpio_request_one(spi->cs_gpio, flags,
- + status = gpio_request_one(cdata->gpio, flags,
- dev_name(&spi->dev));
- } else {
- if (spi->mode & SPI_CS_HIGH)
- @@ -148,7 +151,8 @@ static int ath79_spi_setup_cs(struct spi
- static void ath79_spi_cleanup_cs(struct spi_device *spi)
- {
- if (spi->chip_select) {
- - gpio_free(spi->cs_gpio);
- + struct ath79_spi_controller_data *cdata = spi->controller_data;
- + gpio_free(cdata->gpio);
- }
- }
-
- @@ -220,7 +224,6 @@ static int ath79_spi_probe(struct platfo
- }
-
- sp = spi_master_get_devdata(master);
- - master->dev.of_node = pdev->dev.of_node;
- platform_set_drvdata(pdev, sp);
-
- pdata = dev_get_platdata(&pdev->dev);
- @@ -300,18 +303,12 @@ static void ath79_spi_shutdown(struct pl
- ath79_spi_remove(pdev);
- }
-
- -static const struct of_device_id ath79_spi_of_match[] = {
- - { .compatible = "qca,ar7100-spi", },
- - { },
- -};
- -
- static struct platform_driver ath79_spi_driver = {
- .probe = ath79_spi_probe,
- .remove = ath79_spi_remove,
- .shutdown = ath79_spi_shutdown,
- .driver = {
- .name = DRV_NAME,
- - .of_match_table = ath79_spi_of_match,
- },
- };
- module_platform_driver(ath79_spi_driver);
|