aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_bfin5xx.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index 6a02bd3ef9fd..d6e9812538c4 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -80,6 +80,9 @@ struct driver_data {
80 /* Regs base of SPI controller */ 80 /* Regs base of SPI controller */
81 void __iomem *regs_base; 81 void __iomem *regs_base;
82 82
83 /* Pin request list */
84 u16 *pin_req;
85
83 /* BFIN hookup */ 86 /* BFIN hookup */
84 struct bfin5xx_spi_master *master_info; 87 struct bfin5xx_spi_master *master_info;
85 88
@@ -1255,25 +1258,6 @@ static inline int destroy_queue(struct driver_data *drv_data)
1255 return 0; 1258 return 0;
1256} 1259}
1257 1260
1258static int setup_pin_mux(int action, int bus_num)
1259{
1260
1261 u16 pin_req[3][4] = {
1262 {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
1263 {P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
1264 {P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0},
1265 };
1266
1267 if (action) {
1268 if (peripheral_request_list(pin_req[bus_num], DRV_NAME))
1269 return -EFAULT;
1270 } else {
1271 peripheral_free_list(pin_req[bus_num]);
1272 }
1273
1274 return 0;
1275}
1276
1277static int __init bfin5xx_spi_probe(struct platform_device *pdev) 1261static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1278{ 1262{
1279 struct device *dev = &pdev->dev; 1263 struct device *dev = &pdev->dev;
@@ -1296,6 +1280,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1296 drv_data->master = master; 1280 drv_data->master = master;
1297 drv_data->master_info = platform_info; 1281 drv_data->master_info = platform_info;
1298 drv_data->pdev = pdev; 1282 drv_data->pdev = pdev;
1283 drv_data->pin_req = platform_info->pin_req;
1299 1284
1300 master->bus_num = pdev->id; 1285 master->bus_num = pdev->id;
1301 master->num_chipselect = platform_info->num_chipselect; 1286 master->num_chipselect = platform_info->num_chipselect;
@@ -1346,7 +1331,8 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
1346 goto out_error_queue_alloc; 1331 goto out_error_queue_alloc;
1347 } 1332 }
1348 1333
1349 if (setup_pin_mux(1, master->bus_num)) { 1334 status = peripheral_request_list(drv_data->pin_req, DRV_NAME);
1335 if (status != 0) {
1350 dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); 1336 dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
1351 goto out_error; 1337 goto out_error;
1352 } 1338 }
@@ -1394,7 +1380,7 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev)
1394 /* Disconnect from the SPI framework */ 1380 /* Disconnect from the SPI framework */
1395 spi_unregister_master(drv_data->master); 1381 spi_unregister_master(drv_data->master);
1396 1382
1397 setup_pin_mux(0, drv_data->master->bus_num); 1383 peripheral_free_list(drv_data->pin_req);
1398 1384
1399 /* Prevent double remove */ 1385 /* Prevent double remove */
1400 platform_set_drvdata(pdev, NULL); 1386 platform_set_drvdata(pdev, NULL);