diff options
Diffstat (limited to 'drivers/spi/spi_bfin5xx.c')
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 805f03bb5ef9..759a6fc9b4d4 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -1167,6 +1167,21 @@ static inline int destroy_queue(struct driver_data *drv_data) | |||
1167 | return 0; | 1167 | return 0; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | static int setup_pin_mux(int action) | ||
1171 | { | ||
1172 | |||
1173 | u16 pin_req[] = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0}; | ||
1174 | |||
1175 | if (action) { | ||
1176 | if (peripheral_request_list(pin_req, DRV_NAME)) | ||
1177 | return -EFAULT; | ||
1178 | } else { | ||
1179 | peripheral_free_list(pin_req); | ||
1180 | } | ||
1181 | |||
1182 | return 0; | ||
1183 | } | ||
1184 | |||
1170 | static int __init bfin5xx_spi_probe(struct platform_device *pdev) | 1185 | static int __init bfin5xx_spi_probe(struct platform_device *pdev) |
1171 | { | 1186 | { |
1172 | struct device *dev = &pdev->dev; | 1187 | struct device *dev = &pdev->dev; |
@@ -1184,12 +1199,9 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1184 | return -ENOMEM; | 1199 | return -ENOMEM; |
1185 | } | 1200 | } |
1186 | 1201 | ||
1187 | if (peripheral_request(P_SPI0_SCK, DRV_NAME) || | 1202 | if (setup_pin_mux(1)) { |
1188 | peripheral_request(P_SPI0_MISO, DRV_NAME) || | ||
1189 | peripheral_request(P_SPI0_MOSI, DRV_NAME)) { | ||
1190 | |||
1191 | dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); | 1203 | dev_err(&pdev->dev, ": Requesting Peripherals failed\n"); |
1192 | goto out_error_queue_alloc; | 1204 | goto out_error; |
1193 | } | 1205 | } |
1194 | 1206 | ||
1195 | drv_data = spi_master_get_devdata(master); | 1207 | drv_data = spi_master_get_devdata(master); |
@@ -1225,9 +1237,11 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1225 | dev_dbg(&pdev->dev, "controller probe successfully\n"); | 1237 | dev_dbg(&pdev->dev, "controller probe successfully\n"); |
1226 | return status; | 1238 | return status; |
1227 | 1239 | ||
1228 | out_error_queue_alloc: | 1240 | out_error_queue_alloc: |
1229 | destroy_queue(drv_data); | 1241 | destroy_queue(drv_data); |
1242 | out_error: | ||
1230 | spi_master_put(master); | 1243 | spi_master_put(master); |
1244 | |||
1231 | return status; | 1245 | return status; |
1232 | } | 1246 | } |
1233 | 1247 | ||
@@ -1257,6 +1271,8 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) | |||
1257 | /* Disconnect from the SPI framework */ | 1271 | /* Disconnect from the SPI framework */ |
1258 | spi_unregister_master(drv_data->master); | 1272 | spi_unregister_master(drv_data->master); |
1259 | 1273 | ||
1274 | setup_pin_mux(0); | ||
1275 | |||
1260 | /* Prevent double remove */ | 1276 | /* Prevent double remove */ |
1261 | platform_set_drvdata(pdev, NULL); | 1277 | platform_set_drvdata(pdev, NULL); |
1262 | 1278 | ||