Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74592
b: refs/heads/master
c: cc2f81a
h: refs/heads/master
v: v3
  • Loading branch information
Michael Hennerich authored and Linus Torvalds committed Dec 5, 2007
1 parent 2fb06f3 commit b279258
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 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: 131b17d42de6194fa960132c1f62c29923c4f20c
refs/heads/master: cc2f81a695640dd1c0cf12b35ee303460fa6d0bc
28 changes: 22 additions & 6 deletions trunk/drivers/spi/spi_bfin5xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,21 @@ static inline int destroy_queue(struct driver_data *drv_data)
return 0;
}

static int setup_pin_mux(int action)
{

u16 pin_req[] = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0};

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

return 0;
}

static int __init bfin5xx_spi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
Expand All @@ -1184,12 +1199,9 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
return -ENOMEM;
}

if (peripheral_request(P_SPI0_SCK, DRV_NAME) ||
peripheral_request(P_SPI0_MISO, DRV_NAME) ||
peripheral_request(P_SPI0_MOSI, DRV_NAME)) {

if (setup_pin_mux(1)) {
dev_err(&pdev->dev, ": Requesting Peripherals failed\n");
goto out_error_queue_alloc;
goto out_error;
}

drv_data = spi_master_get_devdata(master);
Expand Down Expand Up @@ -1225,9 +1237,11 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "controller probe successfully\n");
return status;

out_error_queue_alloc:
out_error_queue_alloc:
destroy_queue(drv_data);
out_error:
spi_master_put(master);

return status;
}

Expand Down Expand Up @@ -1257,6 +1271,8 @@ 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);

/* Prevent double remove */
platform_set_drvdata(pdev, NULL);

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/asm-blackfin/mach-bf533/portmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define P_SPORT0_DRPRI (P_DONTCARE)

#define P_SPI0_MOSI (P_DONTCARE)
#define P_SPI0_MIS0 (P_DONTCARE)
#define P_SPI0_MISO (P_DONTCARE)
#define P_SPI0_SCK (P_DONTCARE)
#define P_SPI0_SSEL7 (P_DEFINED | P_IDENT(GPIO_PF7))
#define P_SPI0_SSEL6 (P_DEFINED | P_IDENT(GPIO_PF6))
Expand Down

0 comments on commit b279258

Please sign in to comment.