Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74607
b: refs/heads/master
c: 003d922
h: refs/heads/master
i:
  74605: 337a32b
  74603: 6ae4967
  74599: 5589ec5
  74591: 2fb06f3
v: v3
  • Loading branch information
Bryan Wu authored and Linus Torvalds committed Dec 5, 2007
1 parent 6b88dcc commit 0636f1e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f452126c2e4b8bbfd8e41ebdf1e734e3bf18f8e9
refs/heads/master: 003d922618150eaab53936f57ba8a61f2b601486
28 changes: 7 additions & 21 deletions trunk/drivers/spi/spi_bfin5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ struct driver_data {
/* Regs base of SPI controller */
void __iomem *regs_base;

/* Pin request list */
u16 *pin_req;

/* BFIN hookup */
struct bfin5xx_spi_master *master_info;

Expand Down Expand Up @@ -1255,25 +1258,6 @@ static inline int destroy_queue(struct driver_data *drv_data)
return 0;
}

static int setup_pin_mux(int action, int bus_num)
{

u16 pin_req[3][4] = {
{P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
{P_SPI1_SCK, P_SPI1_MISO, P_SPI1_MOSI, 0},
{P_SPI2_SCK, P_SPI2_MISO, P_SPI2_MOSI, 0},
};

if (action) {
if (peripheral_request_list(pin_req[bus_num], DRV_NAME))
return -EFAULT;
} else {
peripheral_free_list(pin_req[bus_num]);
}

return 0;
}

static int __init bfin5xx_spi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand All @@ -1296,6 +1280,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
drv_data->master = master;
drv_data->master_info = platform_info;
drv_data->pdev = pdev;
drv_data->pin_req = platform_info->pin_req;

master->bus_num = pdev->id;
master->num_chipselect = platform_info->num_chipselect;
Expand Down Expand Up @@ -1346,7 +1331,8 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
goto out_error_queue_alloc;
}

if (setup_pin_mux(1, master->bus_num)) {
status = peripheral_request_list(drv_data->pin_req, DRV_NAME);
if (status != 0) {
dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
goto out_error;
}
Expand Down Expand Up @@ -1394,7 +1380,7 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev)
/* Disconnect from the SPI framework */
spi_unregister_master(drv_data->master);

setup_pin_mux(0, drv_data->master->bus_num);
peripheral_free_list(drv_data->pin_req);

/* Prevent double remove */
platform_set_drvdata(pdev, NULL);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-blackfin/bfin5xx_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
struct bfin5xx_spi_master {
u16 num_chipselect;
u8 enable_dma;
u16 pin_req[4];
};

/* spi_board_info.controller_data for SPI slave devices,
Expand Down

0 comments on commit 0636f1e

Please sign in to comment.