aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Wu <bryan.wu@analog.com>2007-12-05 02:45:22 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-05 12:21:20 -0500
commit003d922618150eaab53936f57ba8a61f2b601486 (patch)
tree54bd61e6176b0447d2df30dd7b3aab505b0df6ec
parentf452126c2e4b8bbfd8e41ebdf1e734e3bf18f8e9 (diff)
Blackfin SPI driver: move hard coded pin_req to board file
Remove some sort of bloaty code, try to get these pin_req arrays built at compile-time - move this static things to the blackfin board file - add pin_req array to struct bfin5xx_spi_master - tested on BF537/BF548 with SPI flash Signed-off-by: Bryan Wu <bryan.wu@analog.com> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/spi/spi_bfin5xx.c28
-rw-r--r--include/asm-blackfin/bfin5xx_spi.h1
2 files changed, 8 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);
diff --git a/include/asm-blackfin/bfin5xx_spi.h b/include/asm-blackfin/bfin5xx_spi.h
index d4485b37d8e2..1a0b57f6a3d4 100644
--- a/include/asm-blackfin/bfin5xx_spi.h
+++ b/include/asm-blackfin/bfin5xx_spi.h
@@ -152,6 +152,7 @@
152struct bfin5xx_spi_master { 152struct bfin5xx_spi_master {
153 u16 num_chipselect; 153 u16 num_chipselect;
154 u8 enable_dma; 154 u8 enable_dma;
155 u16 pin_req[4];
155}; 156};
156 157
157/* spi_board_info.controller_data for SPI slave devices, 158/* spi_board_info.controller_data for SPI slave devices,