summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@linux.intel.com>2018-02-01 10:17:30 -0500
committerMark Brown <broonie@kernel.org>2018-02-12 07:04:24 -0500
commit3cc7b0e35745ae4e153f174038df34a79a385b32 (patch)
treeb7ede3d1b917adca6568b7969ba12e8072c77e4f
parent104e51af79a0dbb80627d4db5e1421dd2a2f590c (diff)
spi: pxa2xx: Convert to generalized SPI controller API
Convert to generalized SPI controller API introduced by the commit 8caab75fd2c2 ("spi: Generalize SPI "master" to "controller""). Inside driver variable name "master" is still used to indicate the driver is master only. While at it, change "unsigned cs" to "unsigned int cs" in pxa2xx_spi_fw_translate_cs() to suppress checkpatch warning. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/spi/spi-pxa2xx-dma.c4
-rw-r--r--drivers/spi/spi-pxa2xx.c40
-rw-r--r--drivers/spi/spi-pxa2xx.h2
3 files changed, 25 insertions, 21 deletions
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c
index 04f3eecf5cf3..3d7f66080c57 100644
--- a/drivers/spi/spi-pxa2xx-dma.c
+++ b/drivers/spi/spi-pxa2xx-dma.c
@@ -191,7 +191,7 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data)
191{ 191{
192 struct pxa2xx_spi_master *pdata = drv_data->master_info; 192 struct pxa2xx_spi_master *pdata = drv_data->master_info;
193 struct device *dev = &drv_data->pdev->dev; 193 struct device *dev = &drv_data->pdev->dev;
194 struct spi_master *master = drv_data->master; 194 struct spi_controller *master = drv_data->master;
195 dma_cap_mask_t mask; 195 dma_cap_mask_t mask;
196 196
197 dma_cap_zero(mask); 197 dma_cap_zero(mask);
@@ -215,7 +215,7 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data)
215 215
216void pxa2xx_spi_dma_release(struct driver_data *drv_data) 216void pxa2xx_spi_dma_release(struct driver_data *drv_data)
217{ 217{
218 struct spi_master *master = drv_data->master; 218 struct spi_controller *master = drv_data->master;
219 219
220 if (master->dma_rx) { 220 if (master->dma_rx) {
221 dmaengine_terminate_sync(master->dma_rx); 221 dmaengine_terminate_sync(master->dma_rx);
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 31117f9985ea..713506eff07d 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -962,7 +962,7 @@ static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data,
962 return clk_div << 8; 962 return clk_div << 8;
963} 963}
964 964
965static bool pxa2xx_spi_can_dma(struct spi_master *master, 965static bool pxa2xx_spi_can_dma(struct spi_controller *master,
966 struct spi_device *spi, 966 struct spi_device *spi,
967 struct spi_transfer *xfer) 967 struct spi_transfer *xfer)
968{ 968{
@@ -976,7 +976,7 @@ static bool pxa2xx_spi_can_dma(struct spi_master *master,
976static void pump_transfers(unsigned long data) 976static void pump_transfers(unsigned long data)
977{ 977{
978 struct driver_data *drv_data = (struct driver_data *)data; 978 struct driver_data *drv_data = (struct driver_data *)data;
979 struct spi_master *master = drv_data->master; 979 struct spi_controller *master = drv_data->master;
980 struct spi_message *message = master->cur_msg; 980 struct spi_message *message = master->cur_msg;
981 struct chip_data *chip = spi_get_ctldata(message->spi); 981 struct chip_data *chip = spi_get_ctldata(message->spi);
982 u32 dma_thresh = chip->dma_threshold; 982 u32 dma_thresh = chip->dma_threshold;
@@ -1182,10 +1182,10 @@ static void pump_transfers(unsigned long data)
1182 pxa2xx_spi_write(drv_data, SSCR1, cr1); 1182 pxa2xx_spi_write(drv_data, SSCR1, cr1);
1183} 1183}
1184 1184
1185static int pxa2xx_spi_transfer_one_message(struct spi_master *master, 1185static int pxa2xx_spi_transfer_one_message(struct spi_controller *master,
1186 struct spi_message *msg) 1186 struct spi_message *msg)
1187{ 1187{
1188 struct driver_data *drv_data = spi_master_get_devdata(master); 1188 struct driver_data *drv_data = spi_controller_get_devdata(master);
1189 1189
1190 /* Initial message state*/ 1190 /* Initial message state*/
1191 msg->state = START_STATE; 1191 msg->state = START_STATE;
@@ -1198,9 +1198,9 @@ static int pxa2xx_spi_transfer_one_message(struct spi_master *master,
1198 return 0; 1198 return 0;
1199} 1199}
1200 1200
1201static int pxa2xx_spi_unprepare_transfer(struct spi_master *master) 1201static int pxa2xx_spi_unprepare_transfer(struct spi_controller *master)
1202{ 1202{
1203 struct driver_data *drv_data = spi_master_get_devdata(master); 1203 struct driver_data *drv_data = spi_controller_get_devdata(master);
1204 1204
1205 /* Disable the SSP now */ 1205 /* Disable the SSP now */
1206 pxa2xx_spi_write(drv_data, SSCR0, 1206 pxa2xx_spi_write(drv_data, SSCR0,
@@ -1212,7 +1212,8 @@ static int pxa2xx_spi_unprepare_transfer(struct spi_master *master)
1212static int setup_cs(struct spi_device *spi, struct chip_data *chip, 1212static int setup_cs(struct spi_device *spi, struct chip_data *chip,
1213 struct pxa2xx_spi_chip *chip_info) 1213 struct pxa2xx_spi_chip *chip_info)
1214{ 1214{
1215 struct driver_data *drv_data = spi_master_get_devdata(spi->master); 1215 struct driver_data *drv_data =
1216 spi_controller_get_devdata(spi->controller);
1216 struct gpio_desc *gpiod; 1217 struct gpio_desc *gpiod;
1217 int err = 0; 1218 int err = 0;
1218 1219
@@ -1270,7 +1271,8 @@ static int setup(struct spi_device *spi)
1270 struct pxa2xx_spi_chip *chip_info; 1271 struct pxa2xx_spi_chip *chip_info;
1271 struct chip_data *chip; 1272 struct chip_data *chip;
1272 const struct lpss_config *config; 1273 const struct lpss_config *config;
1273 struct driver_data *drv_data = spi_master_get_devdata(spi->master); 1274 struct driver_data *drv_data =
1275 spi_controller_get_devdata(spi->controller);
1274 uint tx_thres, tx_hi_thres, rx_thres; 1276 uint tx_thres, tx_hi_thres, rx_thres;
1275 1277
1276 switch (drv_data->ssp_type) { 1278 switch (drv_data->ssp_type) {
@@ -1410,7 +1412,8 @@ static int setup(struct spi_device *spi)
1410static void cleanup(struct spi_device *spi) 1412static void cleanup(struct spi_device *spi)
1411{ 1413{
1412 struct chip_data *chip = spi_get_ctldata(spi); 1414 struct chip_data *chip = spi_get_ctldata(spi);
1413 struct driver_data *drv_data = spi_master_get_devdata(spi->master); 1415 struct driver_data *drv_data =
1416 spi_controller_get_devdata(spi->controller);
1414 1417
1415 if (!chip) 1418 if (!chip)
1416 return; 1419 return;
@@ -1575,9 +1578,10 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
1575} 1578}
1576#endif 1579#endif
1577 1580
1578static int pxa2xx_spi_fw_translate_cs(struct spi_master *master, unsigned cs) 1581static int pxa2xx_spi_fw_translate_cs(struct spi_controller *master,
1582 unsigned int cs)
1579{ 1583{
1580 struct driver_data *drv_data = spi_master_get_devdata(master); 1584 struct driver_data *drv_data = spi_controller_get_devdata(master);
1581 1585
1582 if (has_acpi_companion(&drv_data->pdev->dev)) { 1586 if (has_acpi_companion(&drv_data->pdev->dev)) {
1583 switch (drv_data->ssp_type) { 1587 switch (drv_data->ssp_type) {
@@ -1602,7 +1606,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1602{ 1606{
1603 struct device *dev = &pdev->dev; 1607 struct device *dev = &pdev->dev;
1604 struct pxa2xx_spi_master *platform_info; 1608 struct pxa2xx_spi_master *platform_info;
1605 struct spi_master *master; 1609 struct spi_controller *master;
1606 struct driver_data *drv_data; 1610 struct driver_data *drv_data;
1607 struct ssp_device *ssp; 1611 struct ssp_device *ssp;
1608 const struct lpss_config *config; 1612 const struct lpss_config *config;
@@ -1633,7 +1637,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1633 pxa_ssp_free(ssp); 1637 pxa_ssp_free(ssp);
1634 return -ENOMEM; 1638 return -ENOMEM;
1635 } 1639 }
1636 drv_data = spi_master_get_devdata(master); 1640 drv_data = spi_controller_get_devdata(master);
1637 drv_data->master = master; 1641 drv_data->master = master;
1638 drv_data->master_info = platform_info; 1642 drv_data->master_info = platform_info;
1639 drv_data->pdev = pdev; 1643 drv_data->pdev = pdev;
@@ -1651,7 +1655,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1651 master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer; 1655 master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer;
1652 master->fw_translate_cs = pxa2xx_spi_fw_translate_cs; 1656 master->fw_translate_cs = pxa2xx_spi_fw_translate_cs;
1653 master->auto_runtime_pm = true; 1657 master->auto_runtime_pm = true;
1654 master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX; 1658 master->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX;
1655 1659
1656 drv_data->ssp_type = ssp->type; 1660 drv_data->ssp_type = ssp->type;
1657 1661
@@ -1793,7 +1797,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1793 1797
1794 /* Register with the SPI framework */ 1798 /* Register with the SPI framework */
1795 platform_set_drvdata(pdev, drv_data); 1799 platform_set_drvdata(pdev, drv_data);
1796 status = devm_spi_register_master(&pdev->dev, master); 1800 status = devm_spi_register_controller(&pdev->dev, master);
1797 if (status != 0) { 1801 if (status != 0) {
1798 dev_err(&pdev->dev, "problem registering spi master\n"); 1802 dev_err(&pdev->dev, "problem registering spi master\n");
1799 goto out_error_clock_enabled; 1803 goto out_error_clock_enabled;
@@ -1807,7 +1811,7 @@ out_error_clock_enabled:
1807 free_irq(ssp->irq, drv_data); 1811 free_irq(ssp->irq, drv_data);
1808 1812
1809out_error_master_alloc: 1813out_error_master_alloc:
1810 spi_master_put(master); 1814 spi_controller_put(master);
1811 pxa_ssp_free(ssp); 1815 pxa_ssp_free(ssp);
1812 return status; 1816 return status;
1813} 1817}
@@ -1858,7 +1862,7 @@ static int pxa2xx_spi_suspend(struct device *dev)
1858 struct ssp_device *ssp = drv_data->ssp; 1862 struct ssp_device *ssp = drv_data->ssp;
1859 int status; 1863 int status;
1860 1864
1861 status = spi_master_suspend(drv_data->master); 1865 status = spi_controller_suspend(drv_data->master);
1862 if (status != 0) 1866 if (status != 0)
1863 return status; 1867 return status;
1864 pxa2xx_spi_write(drv_data, SSCR0, 0); 1868 pxa2xx_spi_write(drv_data, SSCR0, 0);
@@ -1884,7 +1888,7 @@ static int pxa2xx_spi_resume(struct device *dev)
1884 lpss_ssp_setup(drv_data); 1888 lpss_ssp_setup(drv_data);
1885 1889
1886 /* Start the queue running */ 1890 /* Start the queue running */
1887 status = spi_master_resume(drv_data->master); 1891 status = spi_controller_resume(drv_data->master);
1888 if (status != 0) { 1892 if (status != 0) {
1889 dev_err(dev, "problem starting queue (%d)\n", status); 1893 dev_err(dev, "problem starting queue (%d)\n", status);
1890 return status; 1894 return status;
diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
index 94f7b0713281..513ec6c6e25b 100644
--- a/drivers/spi/spi-pxa2xx.h
+++ b/drivers/spi/spi-pxa2xx.h
@@ -31,7 +31,7 @@ struct driver_data {
31 31
32 /* SPI framework hookup */ 32 /* SPI framework hookup */
33 enum pxa_ssp_type ssp_type; 33 enum pxa_ssp_type ssp_type;
34 struct spi_master *master; 34 struct spi_controller *master;
35 35
36 /* PXA hookup */ 36 /* PXA hookup */
37 struct pxa2xx_spi_master *master_info; 37 struct pxa2xx_spi_master *master_info;