diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 223 |
1 files changed, 112 insertions, 111 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index bdad0bbd0a43..d1ff34f3f6bd 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #define DRV_NAME "bfin-spi" | 30 | #define DRV_NAME "bfin-spi" |
31 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" | 31 | #define DRV_AUTHOR "Bryan Wu, Luke Yang" |
32 | #define DRV_DESC "Blackfin BF5xx on-chip SPI Controller Driver" | 32 | #define DRV_DESC "Blackfin on-chip SPI Controller Driver" |
33 | #define DRV_VERSION "1.0" | 33 | #define DRV_VERSION "1.0" |
34 | 34 | ||
35 | MODULE_AUTHOR(DRV_AUTHOR); | 35 | MODULE_AUTHOR(DRV_AUTHOR); |
@@ -161,7 +161,7 @@ static u16 hz_to_spi_baud(u32 speed_hz) | |||
161 | return spi_baud; | 161 | return spi_baud; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int flush(struct driver_data *drv_data) | 164 | static int bfin_spi_flush(struct driver_data *drv_data) |
165 | { | 165 | { |
166 | unsigned long limit = loops_per_jiffy << 1; | 166 | unsigned long limit = loops_per_jiffy << 1; |
167 | 167 | ||
@@ -175,7 +175,7 @@ static int flush(struct driver_data *drv_data) | |||
175 | } | 175 | } |
176 | 176 | ||
177 | /* Chip select operation functions for cs_change flag */ | 177 | /* Chip select operation functions for cs_change flag */ |
178 | static void cs_active(struct driver_data *drv_data, struct chip_data *chip) | 178 | static void bfin_spi_cs_active(struct driver_data *drv_data, struct chip_data *chip) |
179 | { | 179 | { |
180 | u16 flag = read_FLAG(drv_data); | 180 | u16 flag = read_FLAG(drv_data); |
181 | 181 | ||
@@ -185,7 +185,7 @@ static void cs_active(struct driver_data *drv_data, struct chip_data *chip) | |||
185 | write_FLAG(drv_data, flag); | 185 | write_FLAG(drv_data, flag); |
186 | } | 186 | } |
187 | 187 | ||
188 | static void cs_deactive(struct driver_data *drv_data, struct chip_data *chip) | 188 | static void bfin_spi_cs_deactive(struct driver_data *drv_data, struct chip_data *chip) |
189 | { | 189 | { |
190 | u16 flag = read_FLAG(drv_data); | 190 | u16 flag = read_FLAG(drv_data); |
191 | 191 | ||
@@ -200,7 +200,7 @@ static void cs_deactive(struct driver_data *drv_data, struct chip_data *chip) | |||
200 | } | 200 | } |
201 | 201 | ||
202 | /* stop controller and re-config current chip*/ | 202 | /* stop controller and re-config current chip*/ |
203 | static void restore_state(struct driver_data *drv_data) | 203 | static void bfin_spi_restore_state(struct driver_data *drv_data) |
204 | { | 204 | { |
205 | struct chip_data *chip = drv_data->cur_chip; | 205 | struct chip_data *chip = drv_data->cur_chip; |
206 | 206 | ||
@@ -214,18 +214,18 @@ static void restore_state(struct driver_data *drv_data) | |||
214 | write_BAUD(drv_data, chip->baud); | 214 | write_BAUD(drv_data, chip->baud); |
215 | 215 | ||
216 | bfin_spi_enable(drv_data); | 216 | bfin_spi_enable(drv_data); |
217 | cs_active(drv_data, chip); | 217 | bfin_spi_cs_active(drv_data, chip); |
218 | } | 218 | } |
219 | 219 | ||
220 | /* used to kick off transfer in rx mode */ | 220 | /* used to kick off transfer in rx mode */ |
221 | static unsigned short dummy_read(struct driver_data *drv_data) | 221 | static unsigned short bfin_spi_dummy_read(struct driver_data *drv_data) |
222 | { | 222 | { |
223 | unsigned short tmp; | 223 | unsigned short tmp; |
224 | tmp = read_RDBR(drv_data); | 224 | tmp = read_RDBR(drv_data); |
225 | return tmp; | 225 | return tmp; |
226 | } | 226 | } |
227 | 227 | ||
228 | static void null_writer(struct driver_data *drv_data) | 228 | static void bfin_spi_null_writer(struct driver_data *drv_data) |
229 | { | 229 | { |
230 | u8 n_bytes = drv_data->n_bytes; | 230 | u8 n_bytes = drv_data->n_bytes; |
231 | 231 | ||
@@ -237,20 +237,20 @@ static void null_writer(struct driver_data *drv_data) | |||
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | static void null_reader(struct driver_data *drv_data) | 240 | static void bfin_spi_null_reader(struct driver_data *drv_data) |
241 | { | 241 | { |
242 | u8 n_bytes = drv_data->n_bytes; | 242 | u8 n_bytes = drv_data->n_bytes; |
243 | dummy_read(drv_data); | 243 | bfin_spi_dummy_read(drv_data); |
244 | 244 | ||
245 | while (drv_data->rx < drv_data->rx_end) { | 245 | while (drv_data->rx < drv_data->rx_end) { |
246 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 246 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
247 | cpu_relax(); | 247 | cpu_relax(); |
248 | dummy_read(drv_data); | 248 | bfin_spi_dummy_read(drv_data); |
249 | drv_data->rx += n_bytes; | 249 | drv_data->rx += n_bytes; |
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | static void u8_writer(struct driver_data *drv_data) | 253 | static void bfin_spi_u8_writer(struct driver_data *drv_data) |
254 | { | 254 | { |
255 | dev_dbg(&drv_data->pdev->dev, | 255 | dev_dbg(&drv_data->pdev->dev, |
256 | "cr8-s is 0x%x\n", read_STAT(drv_data)); | 256 | "cr8-s is 0x%x\n", read_STAT(drv_data)); |
@@ -267,12 +267,12 @@ static void u8_writer(struct driver_data *drv_data) | |||
267 | cpu_relax(); | 267 | cpu_relax(); |
268 | } | 268 | } |
269 | 269 | ||
270 | static void u8_cs_chg_writer(struct driver_data *drv_data) | 270 | static void bfin_spi_u8_cs_chg_writer(struct driver_data *drv_data) |
271 | { | 271 | { |
272 | struct chip_data *chip = drv_data->cur_chip; | 272 | struct chip_data *chip = drv_data->cur_chip; |
273 | 273 | ||
274 | while (drv_data->tx < drv_data->tx_end) { | 274 | while (drv_data->tx < drv_data->tx_end) { |
275 | cs_active(drv_data, chip); | 275 | bfin_spi_cs_active(drv_data, chip); |
276 | 276 | ||
277 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); | 277 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); |
278 | while (read_STAT(drv_data) & BIT_STAT_TXS) | 278 | while (read_STAT(drv_data) & BIT_STAT_TXS) |
@@ -280,13 +280,13 @@ static void u8_cs_chg_writer(struct driver_data *drv_data) | |||
280 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | 280 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
281 | cpu_relax(); | 281 | cpu_relax(); |
282 | 282 | ||
283 | cs_deactive(drv_data, chip); | 283 | bfin_spi_cs_deactive(drv_data, chip); |
284 | 284 | ||
285 | ++drv_data->tx; | 285 | ++drv_data->tx; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | static void u8_reader(struct driver_data *drv_data) | 289 | static void bfin_spi_u8_reader(struct driver_data *drv_data) |
290 | { | 290 | { |
291 | dev_dbg(&drv_data->pdev->dev, | 291 | dev_dbg(&drv_data->pdev->dev, |
292 | "cr-8 is 0x%x\n", read_STAT(drv_data)); | 292 | "cr-8 is 0x%x\n", read_STAT(drv_data)); |
@@ -298,7 +298,7 @@ static void u8_reader(struct driver_data *drv_data) | |||
298 | /* clear TDBR buffer before read(else it will be shifted out) */ | 298 | /* clear TDBR buffer before read(else it will be shifted out) */ |
299 | write_TDBR(drv_data, 0xFFFF); | 299 | write_TDBR(drv_data, 0xFFFF); |
300 | 300 | ||
301 | dummy_read(drv_data); | 301 | bfin_spi_dummy_read(drv_data); |
302 | 302 | ||
303 | while (drv_data->rx < drv_data->rx_end - 1) { | 303 | while (drv_data->rx < drv_data->rx_end - 1) { |
304 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 304 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
@@ -313,12 +313,12 @@ static void u8_reader(struct driver_data *drv_data) | |||
313 | ++drv_data->rx; | 313 | ++drv_data->rx; |
314 | } | 314 | } |
315 | 315 | ||
316 | static void u8_cs_chg_reader(struct driver_data *drv_data) | 316 | static void bfin_spi_u8_cs_chg_reader(struct driver_data *drv_data) |
317 | { | 317 | { |
318 | struct chip_data *chip = drv_data->cur_chip; | 318 | struct chip_data *chip = drv_data->cur_chip; |
319 | 319 | ||
320 | while (drv_data->rx < drv_data->rx_end) { | 320 | while (drv_data->rx < drv_data->rx_end) { |
321 | cs_active(drv_data, chip); | 321 | bfin_spi_cs_active(drv_data, chip); |
322 | read_RDBR(drv_data); /* kick off */ | 322 | read_RDBR(drv_data); /* kick off */ |
323 | 323 | ||
324 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 324 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
@@ -327,13 +327,13 @@ static void u8_cs_chg_reader(struct driver_data *drv_data) | |||
327 | cpu_relax(); | 327 | cpu_relax(); |
328 | 328 | ||
329 | *(u8 *) (drv_data->rx) = read_SHAW(drv_data); | 329 | *(u8 *) (drv_data->rx) = read_SHAW(drv_data); |
330 | cs_deactive(drv_data, chip); | 330 | bfin_spi_cs_deactive(drv_data, chip); |
331 | 331 | ||
332 | ++drv_data->rx; | 332 | ++drv_data->rx; |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | static void u8_duplex(struct driver_data *drv_data) | 336 | static void bfin_spi_u8_duplex(struct driver_data *drv_data) |
337 | { | 337 | { |
338 | /* in duplex mode, clk is triggered by writing of TDBR */ | 338 | /* in duplex mode, clk is triggered by writing of TDBR */ |
339 | while (drv_data->rx < drv_data->rx_end) { | 339 | while (drv_data->rx < drv_data->rx_end) { |
@@ -348,12 +348,12 @@ static void u8_duplex(struct driver_data *drv_data) | |||
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | static void u8_cs_chg_duplex(struct driver_data *drv_data) | 351 | static void bfin_spi_u8_cs_chg_duplex(struct driver_data *drv_data) |
352 | { | 352 | { |
353 | struct chip_data *chip = drv_data->cur_chip; | 353 | struct chip_data *chip = drv_data->cur_chip; |
354 | 354 | ||
355 | while (drv_data->rx < drv_data->rx_end) { | 355 | while (drv_data->rx < drv_data->rx_end) { |
356 | cs_active(drv_data, chip); | 356 | bfin_spi_cs_active(drv_data, chip); |
357 | 357 | ||
358 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); | 358 | write_TDBR(drv_data, (*(u8 *) (drv_data->tx))); |
359 | 359 | ||
@@ -363,14 +363,14 @@ static void u8_cs_chg_duplex(struct driver_data *drv_data) | |||
363 | cpu_relax(); | 363 | cpu_relax(); |
364 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); | 364 | *(u8 *) (drv_data->rx) = read_RDBR(drv_data); |
365 | 365 | ||
366 | cs_deactive(drv_data, chip); | 366 | bfin_spi_cs_deactive(drv_data, chip); |
367 | 367 | ||
368 | ++drv_data->rx; | 368 | ++drv_data->rx; |
369 | ++drv_data->tx; | 369 | ++drv_data->tx; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | 372 | ||
373 | static void u16_writer(struct driver_data *drv_data) | 373 | static void bfin_spi_u16_writer(struct driver_data *drv_data) |
374 | { | 374 | { |
375 | dev_dbg(&drv_data->pdev->dev, | 375 | dev_dbg(&drv_data->pdev->dev, |
376 | "cr16 is 0x%x\n", read_STAT(drv_data)); | 376 | "cr16 is 0x%x\n", read_STAT(drv_data)); |
@@ -387,12 +387,12 @@ static void u16_writer(struct driver_data *drv_data) | |||
387 | cpu_relax(); | 387 | cpu_relax(); |
388 | } | 388 | } |
389 | 389 | ||
390 | static void u16_cs_chg_writer(struct driver_data *drv_data) | 390 | static void bfin_spi_u16_cs_chg_writer(struct driver_data *drv_data) |
391 | { | 391 | { |
392 | struct chip_data *chip = drv_data->cur_chip; | 392 | struct chip_data *chip = drv_data->cur_chip; |
393 | 393 | ||
394 | while (drv_data->tx < drv_data->tx_end) { | 394 | while (drv_data->tx < drv_data->tx_end) { |
395 | cs_active(drv_data, chip); | 395 | bfin_spi_cs_active(drv_data, chip); |
396 | 396 | ||
397 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); | 397 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); |
398 | while ((read_STAT(drv_data) & BIT_STAT_TXS)) | 398 | while ((read_STAT(drv_data) & BIT_STAT_TXS)) |
@@ -400,13 +400,13 @@ static void u16_cs_chg_writer(struct driver_data *drv_data) | |||
400 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | 400 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
401 | cpu_relax(); | 401 | cpu_relax(); |
402 | 402 | ||
403 | cs_deactive(drv_data, chip); | 403 | bfin_spi_cs_deactive(drv_data, chip); |
404 | 404 | ||
405 | drv_data->tx += 2; | 405 | drv_data->tx += 2; |
406 | } | 406 | } |
407 | } | 407 | } |
408 | 408 | ||
409 | static void u16_reader(struct driver_data *drv_data) | 409 | static void bfin_spi_u16_reader(struct driver_data *drv_data) |
410 | { | 410 | { |
411 | dev_dbg(&drv_data->pdev->dev, | 411 | dev_dbg(&drv_data->pdev->dev, |
412 | "cr-16 is 0x%x\n", read_STAT(drv_data)); | 412 | "cr-16 is 0x%x\n", read_STAT(drv_data)); |
@@ -418,7 +418,7 @@ static void u16_reader(struct driver_data *drv_data) | |||
418 | /* clear TDBR buffer before read(else it will be shifted out) */ | 418 | /* clear TDBR buffer before read(else it will be shifted out) */ |
419 | write_TDBR(drv_data, 0xFFFF); | 419 | write_TDBR(drv_data, 0xFFFF); |
420 | 420 | ||
421 | dummy_read(drv_data); | 421 | bfin_spi_dummy_read(drv_data); |
422 | 422 | ||
423 | while (drv_data->rx < (drv_data->rx_end - 2)) { | 423 | while (drv_data->rx < (drv_data->rx_end - 2)) { |
424 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 424 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
@@ -433,7 +433,7 @@ static void u16_reader(struct driver_data *drv_data) | |||
433 | drv_data->rx += 2; | 433 | drv_data->rx += 2; |
434 | } | 434 | } |
435 | 435 | ||
436 | static void u16_cs_chg_reader(struct driver_data *drv_data) | 436 | static void bfin_spi_u16_cs_chg_reader(struct driver_data *drv_data) |
437 | { | 437 | { |
438 | struct chip_data *chip = drv_data->cur_chip; | 438 | struct chip_data *chip = drv_data->cur_chip; |
439 | 439 | ||
@@ -444,19 +444,19 @@ static void u16_cs_chg_reader(struct driver_data *drv_data) | |||
444 | /* clear TDBR buffer before read(else it will be shifted out) */ | 444 | /* clear TDBR buffer before read(else it will be shifted out) */ |
445 | write_TDBR(drv_data, 0xFFFF); | 445 | write_TDBR(drv_data, 0xFFFF); |
446 | 446 | ||
447 | cs_active(drv_data, chip); | 447 | bfin_spi_cs_active(drv_data, chip); |
448 | dummy_read(drv_data); | 448 | bfin_spi_dummy_read(drv_data); |
449 | 449 | ||
450 | while (drv_data->rx < drv_data->rx_end - 2) { | 450 | while (drv_data->rx < drv_data->rx_end - 2) { |
451 | cs_deactive(drv_data, chip); | 451 | bfin_spi_cs_deactive(drv_data, chip); |
452 | 452 | ||
453 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 453 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
454 | cpu_relax(); | 454 | cpu_relax(); |
455 | cs_active(drv_data, chip); | 455 | bfin_spi_cs_active(drv_data, chip); |
456 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); | 456 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); |
457 | drv_data->rx += 2; | 457 | drv_data->rx += 2; |
458 | } | 458 | } |
459 | cs_deactive(drv_data, chip); | 459 | bfin_spi_cs_deactive(drv_data, chip); |
460 | 460 | ||
461 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) | 461 | while (!(read_STAT(drv_data) & BIT_STAT_RXS)) |
462 | cpu_relax(); | 462 | cpu_relax(); |
@@ -464,7 +464,7 @@ static void u16_cs_chg_reader(struct driver_data *drv_data) | |||
464 | drv_data->rx += 2; | 464 | drv_data->rx += 2; |
465 | } | 465 | } |
466 | 466 | ||
467 | static void u16_duplex(struct driver_data *drv_data) | 467 | static void bfin_spi_u16_duplex(struct driver_data *drv_data) |
468 | { | 468 | { |
469 | /* in duplex mode, clk is triggered by writing of TDBR */ | 469 | /* in duplex mode, clk is triggered by writing of TDBR */ |
470 | while (drv_data->tx < drv_data->tx_end) { | 470 | while (drv_data->tx < drv_data->tx_end) { |
@@ -479,12 +479,12 @@ static void u16_duplex(struct driver_data *drv_data) | |||
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | static void u16_cs_chg_duplex(struct driver_data *drv_data) | 482 | static void bfin_spi_u16_cs_chg_duplex(struct driver_data *drv_data) |
483 | { | 483 | { |
484 | struct chip_data *chip = drv_data->cur_chip; | 484 | struct chip_data *chip = drv_data->cur_chip; |
485 | 485 | ||
486 | while (drv_data->tx < drv_data->tx_end) { | 486 | while (drv_data->tx < drv_data->tx_end) { |
487 | cs_active(drv_data, chip); | 487 | bfin_spi_cs_active(drv_data, chip); |
488 | 488 | ||
489 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); | 489 | write_TDBR(drv_data, (*(u16 *) (drv_data->tx))); |
490 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) | 490 | while (!(read_STAT(drv_data) & BIT_STAT_SPIF)) |
@@ -493,7 +493,7 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data) | |||
493 | cpu_relax(); | 493 | cpu_relax(); |
494 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); | 494 | *(u16 *) (drv_data->rx) = read_RDBR(drv_data); |
495 | 495 | ||
496 | cs_deactive(drv_data, chip); | 496 | bfin_spi_cs_deactive(drv_data, chip); |
497 | 497 | ||
498 | drv_data->rx += 2; | 498 | drv_data->rx += 2; |
499 | drv_data->tx += 2; | 499 | drv_data->tx += 2; |
@@ -501,7 +501,7 @@ static void u16_cs_chg_duplex(struct driver_data *drv_data) | |||
501 | } | 501 | } |
502 | 502 | ||
503 | /* test if ther is more transfer to be done */ | 503 | /* test if ther is more transfer to be done */ |
504 | static void *next_transfer(struct driver_data *drv_data) | 504 | static void *bfin_spi_next_transfer(struct driver_data *drv_data) |
505 | { | 505 | { |
506 | struct spi_message *msg = drv_data->cur_msg; | 506 | struct spi_message *msg = drv_data->cur_msg; |
507 | struct spi_transfer *trans = drv_data->cur_transfer; | 507 | struct spi_transfer *trans = drv_data->cur_transfer; |
@@ -520,7 +520,7 @@ static void *next_transfer(struct driver_data *drv_data) | |||
520 | * caller already set message->status; | 520 | * caller already set message->status; |
521 | * dma and pio irqs are blocked give finished message back | 521 | * dma and pio irqs are blocked give finished message back |
522 | */ | 522 | */ |
523 | static void giveback(struct driver_data *drv_data) | 523 | static void bfin_spi_giveback(struct driver_data *drv_data) |
524 | { | 524 | { |
525 | struct chip_data *chip = drv_data->cur_chip; | 525 | struct chip_data *chip = drv_data->cur_chip; |
526 | struct spi_transfer *last_transfer; | 526 | struct spi_transfer *last_transfer; |
@@ -541,7 +541,7 @@ static void giveback(struct driver_data *drv_data) | |||
541 | msg->state = NULL; | 541 | msg->state = NULL; |
542 | 542 | ||
543 | if (!drv_data->cs_change) | 543 | if (!drv_data->cs_change) |
544 | cs_deactive(drv_data, chip); | 544 | bfin_spi_cs_deactive(drv_data, chip); |
545 | 545 | ||
546 | /* Not stop spi in autobuffer mode */ | 546 | /* Not stop spi in autobuffer mode */ |
547 | if (drv_data->tx_dma != 0xFFFF) | 547 | if (drv_data->tx_dma != 0xFFFF) |
@@ -551,7 +551,7 @@ static void giveback(struct driver_data *drv_data) | |||
551 | msg->complete(msg->context); | 551 | msg->complete(msg->context); |
552 | } | 552 | } |
553 | 553 | ||
554 | static irqreturn_t dma_irq_handler(int irq, void *dev_id) | 554 | static irqreturn_t bfin_spi_dma_irq_handler(int irq, void *dev_id) |
555 | { | 555 | { |
556 | struct driver_data *drv_data = dev_id; | 556 | struct driver_data *drv_data = dev_id; |
557 | struct chip_data *chip = drv_data->cur_chip; | 557 | struct chip_data *chip = drv_data->cur_chip; |
@@ -601,10 +601,10 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
601 | msg->actual_length += drv_data->len_in_bytes; | 601 | msg->actual_length += drv_data->len_in_bytes; |
602 | 602 | ||
603 | if (drv_data->cs_change) | 603 | if (drv_data->cs_change) |
604 | cs_deactive(drv_data, chip); | 604 | bfin_spi_cs_deactive(drv_data, chip); |
605 | 605 | ||
606 | /* Move to next transfer */ | 606 | /* Move to next transfer */ |
607 | msg->state = next_transfer(drv_data); | 607 | msg->state = bfin_spi_next_transfer(drv_data); |
608 | } | 608 | } |
609 | 609 | ||
610 | /* Schedule transfer tasklet */ | 610 | /* Schedule transfer tasklet */ |
@@ -619,7 +619,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
619 | return IRQ_HANDLED; | 619 | return IRQ_HANDLED; |
620 | } | 620 | } |
621 | 621 | ||
622 | static void pump_transfers(unsigned long data) | 622 | static void bfin_spi_pump_transfers(unsigned long data) |
623 | { | 623 | { |
624 | struct driver_data *drv_data = (struct driver_data *)data; | 624 | struct driver_data *drv_data = (struct driver_data *)data; |
625 | struct spi_message *message = NULL; | 625 | struct spi_message *message = NULL; |
@@ -644,7 +644,7 @@ static void pump_transfers(unsigned long data) | |||
644 | if (message->state == ERROR_STATE) { | 644 | if (message->state == ERROR_STATE) { |
645 | dev_dbg(&drv_data->pdev->dev, "transfer: we've hit an error\n"); | 645 | dev_dbg(&drv_data->pdev->dev, "transfer: we've hit an error\n"); |
646 | message->status = -EIO; | 646 | message->status = -EIO; |
647 | giveback(drv_data); | 647 | bfin_spi_giveback(drv_data); |
648 | return; | 648 | return; |
649 | } | 649 | } |
650 | 650 | ||
@@ -652,7 +652,7 @@ static void pump_transfers(unsigned long data) | |||
652 | if (message->state == DONE_STATE) { | 652 | if (message->state == DONE_STATE) { |
653 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); | 653 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); |
654 | message->status = 0; | 654 | message->status = 0; |
655 | giveback(drv_data); | 655 | bfin_spi_giveback(drv_data); |
656 | return; | 656 | return; |
657 | } | 657 | } |
658 | 658 | ||
@@ -666,10 +666,10 @@ static void pump_transfers(unsigned long data) | |||
666 | } | 666 | } |
667 | 667 | ||
668 | /* Setup the transfer state based on the type of transfer */ | 668 | /* Setup the transfer state based on the type of transfer */ |
669 | if (flush(drv_data) == 0) { | 669 | if (bfin_spi_flush(drv_data) == 0) { |
670 | dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n"); | 670 | dev_err(&drv_data->pdev->dev, "pump_transfers: flush failed\n"); |
671 | message->status = -EIO; | 671 | message->status = -EIO; |
672 | giveback(drv_data); | 672 | bfin_spi_giveback(drv_data); |
673 | return; | 673 | return; |
674 | } | 674 | } |
675 | 675 | ||
@@ -703,31 +703,31 @@ static void pump_transfers(unsigned long data) | |||
703 | drv_data->n_bytes = 1; | 703 | drv_data->n_bytes = 1; |
704 | width = CFG_SPI_WORDSIZE8; | 704 | width = CFG_SPI_WORDSIZE8; |
705 | drv_data->read = chip->cs_change_per_word ? | 705 | drv_data->read = chip->cs_change_per_word ? |
706 | u8_cs_chg_reader : u8_reader; | 706 | bfin_spi_u8_cs_chg_reader : bfin_spi_u8_reader; |
707 | drv_data->write = chip->cs_change_per_word ? | 707 | drv_data->write = chip->cs_change_per_word ? |
708 | u8_cs_chg_writer : u8_writer; | 708 | bfin_spi_u8_cs_chg_writer : bfin_spi_u8_writer; |
709 | drv_data->duplex = chip->cs_change_per_word ? | 709 | drv_data->duplex = chip->cs_change_per_word ? |
710 | u8_cs_chg_duplex : u8_duplex; | 710 | bfin_spi_u8_cs_chg_duplex : bfin_spi_u8_duplex; |
711 | break; | 711 | break; |
712 | 712 | ||
713 | case 16: | 713 | case 16: |
714 | drv_data->n_bytes = 2; | 714 | drv_data->n_bytes = 2; |
715 | width = CFG_SPI_WORDSIZE16; | 715 | width = CFG_SPI_WORDSIZE16; |
716 | drv_data->read = chip->cs_change_per_word ? | 716 | drv_data->read = chip->cs_change_per_word ? |
717 | u16_cs_chg_reader : u16_reader; | 717 | bfin_spi_u16_cs_chg_reader : bfin_spi_u16_reader; |
718 | drv_data->write = chip->cs_change_per_word ? | 718 | drv_data->write = chip->cs_change_per_word ? |
719 | u16_cs_chg_writer : u16_writer; | 719 | bfin_spi_u16_cs_chg_writer : bfin_spi_u16_writer; |
720 | drv_data->duplex = chip->cs_change_per_word ? | 720 | drv_data->duplex = chip->cs_change_per_word ? |
721 | u16_cs_chg_duplex : u16_duplex; | 721 | bfin_spi_u16_cs_chg_duplex : bfin_spi_u16_duplex; |
722 | break; | 722 | break; |
723 | 723 | ||
724 | default: | 724 | default: |
725 | /* No change, the same as default setting */ | 725 | /* No change, the same as default setting */ |
726 | drv_data->n_bytes = chip->n_bytes; | 726 | drv_data->n_bytes = chip->n_bytes; |
727 | width = chip->width; | 727 | width = chip->width; |
728 | drv_data->write = drv_data->tx ? chip->write : null_writer; | 728 | drv_data->write = drv_data->tx ? chip->write : bfin_spi_null_writer; |
729 | drv_data->read = drv_data->rx ? chip->read : null_reader; | 729 | drv_data->read = drv_data->rx ? chip->read : bfin_spi_null_reader; |
730 | drv_data->duplex = chip->duplex ? chip->duplex : null_writer; | 730 | drv_data->duplex = chip->duplex ? chip->duplex : bfin_spi_null_writer; |
731 | break; | 731 | break; |
732 | } | 732 | } |
733 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); | 733 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); |
@@ -741,7 +741,7 @@ static void pump_transfers(unsigned long data) | |||
741 | } | 741 | } |
742 | dev_dbg(&drv_data->pdev->dev, | 742 | dev_dbg(&drv_data->pdev->dev, |
743 | "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", | 743 | "transfer: drv_data->write is %p, chip->write is %p, null_wr is %p\n", |
744 | drv_data->write, chip->write, null_writer); | 744 | drv_data->write, chip->write, bfin_spi_null_writer); |
745 | 745 | ||
746 | /* speed and width has been set on per message */ | 746 | /* speed and width has been set on per message */ |
747 | message->state = RUNNING_STATE; | 747 | message->state = RUNNING_STATE; |
@@ -756,7 +756,7 @@ static void pump_transfers(unsigned long data) | |||
756 | write_STAT(drv_data, BIT_STAT_CLR); | 756 | write_STAT(drv_data, BIT_STAT_CLR); |
757 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); | 757 | cr = (read_CTRL(drv_data) & (~BIT_CTL_TIMOD)); |
758 | if (drv_data->cs_change) | 758 | if (drv_data->cs_change) |
759 | cs_active(drv_data, chip); | 759 | bfin_spi_cs_active(drv_data, chip); |
760 | 760 | ||
761 | dev_dbg(&drv_data->pdev->dev, | 761 | dev_dbg(&drv_data->pdev->dev, |
762 | "now pumping a transfer: width is %d, len is %d\n", | 762 | "now pumping a transfer: width is %d, len is %d\n", |
@@ -811,7 +811,7 @@ static void pump_transfers(unsigned long data) | |||
811 | * in this mode | 811 | * in this mode |
812 | */ | 812 | */ |
813 | message->status = 0; | 813 | message->status = 0; |
814 | giveback(drv_data); | 814 | bfin_spi_giveback(drv_data); |
815 | return; | 815 | return; |
816 | } | 816 | } |
817 | 817 | ||
@@ -919,9 +919,9 @@ static void pump_transfers(unsigned long data) | |||
919 | /* Update total byte transfered */ | 919 | /* Update total byte transfered */ |
920 | message->actual_length += drv_data->len_in_bytes; | 920 | message->actual_length += drv_data->len_in_bytes; |
921 | /* Move to next transfer of this msg */ | 921 | /* Move to next transfer of this msg */ |
922 | message->state = next_transfer(drv_data); | 922 | message->state = bfin_spi_next_transfer(drv_data); |
923 | if (drv_data->cs_change) | 923 | if (drv_data->cs_change) |
924 | cs_deactive(drv_data, chip); | 924 | bfin_spi_cs_deactive(drv_data, chip); |
925 | } | 925 | } |
926 | /* Schedule next transfer tasklet */ | 926 | /* Schedule next transfer tasklet */ |
927 | tasklet_schedule(&drv_data->pump_transfers); | 927 | tasklet_schedule(&drv_data->pump_transfers); |
@@ -930,7 +930,7 @@ static void pump_transfers(unsigned long data) | |||
930 | } | 930 | } |
931 | 931 | ||
932 | /* pop a msg from queue and kick off real transfer */ | 932 | /* pop a msg from queue and kick off real transfer */ |
933 | static void pump_messages(struct work_struct *work) | 933 | static void bfin_spi_pump_messages(struct work_struct *work) |
934 | { | 934 | { |
935 | struct driver_data *drv_data; | 935 | struct driver_data *drv_data; |
936 | unsigned long flags; | 936 | unsigned long flags; |
@@ -958,7 +958,7 @@ static void pump_messages(struct work_struct *work) | |||
958 | 958 | ||
959 | /* Setup the SSP using the per chip configuration */ | 959 | /* Setup the SSP using the per chip configuration */ |
960 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); | 960 | drv_data->cur_chip = spi_get_ctldata(drv_data->cur_msg->spi); |
961 | restore_state(drv_data); | 961 | bfin_spi_restore_state(drv_data); |
962 | 962 | ||
963 | list_del_init(&drv_data->cur_msg->queue); | 963 | list_del_init(&drv_data->cur_msg->queue); |
964 | 964 | ||
@@ -987,7 +987,7 @@ static void pump_messages(struct work_struct *work) | |||
987 | * got a msg to transfer, queue it in drv_data->queue. | 987 | * got a msg to transfer, queue it in drv_data->queue. |
988 | * And kick off message pumper | 988 | * And kick off message pumper |
989 | */ | 989 | */ |
990 | static int transfer(struct spi_device *spi, struct spi_message *msg) | 990 | static int bfin_spi_transfer(struct spi_device *spi, struct spi_message *msg) |
991 | { | 991 | { |
992 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); | 992 | struct driver_data *drv_data = spi_master_get_devdata(spi->master); |
993 | unsigned long flags; | 993 | unsigned long flags; |
@@ -1031,7 +1031,7 @@ static u16 ssel[][MAX_SPI_SSEL] = { | |||
1031 | }; | 1031 | }; |
1032 | 1032 | ||
1033 | /* first setup for new devices */ | 1033 | /* first setup for new devices */ |
1034 | static int setup(struct spi_device *spi) | 1034 | static int bfin_spi_setup(struct spi_device *spi) |
1035 | { | 1035 | { |
1036 | struct bfin5xx_spi_chip *chip_info = NULL; | 1036 | struct bfin5xx_spi_chip *chip_info = NULL; |
1037 | struct chip_data *chip; | 1037 | struct chip_data *chip; |
@@ -1105,7 +1105,7 @@ static int setup(struct spi_device *spi) | |||
1105 | return -ENODEV; | 1105 | return -ENODEV; |
1106 | } | 1106 | } |
1107 | if (set_dma_callback(drv_data->dma_channel, | 1107 | if (set_dma_callback(drv_data->dma_channel, |
1108 | dma_irq_handler, drv_data) < 0) { | 1108 | bfin_spi_dma_irq_handler, drv_data) < 0) { |
1109 | dev_dbg(&spi->dev, "Unable to set dma callback\n"); | 1109 | dev_dbg(&spi->dev, "Unable to set dma callback\n"); |
1110 | return -EPERM; | 1110 | return -EPERM; |
1111 | } | 1111 | } |
@@ -1126,28 +1126,29 @@ static int setup(struct spi_device *spi) | |||
1126 | chip->n_bytes = 1; | 1126 | chip->n_bytes = 1; |
1127 | chip->width = CFG_SPI_WORDSIZE8; | 1127 | chip->width = CFG_SPI_WORDSIZE8; |
1128 | chip->read = chip->cs_change_per_word ? | 1128 | chip->read = chip->cs_change_per_word ? |
1129 | u8_cs_chg_reader : u8_reader; | 1129 | bfin_spi_u8_cs_chg_reader : bfin_spi_u8_reader; |
1130 | chip->write = chip->cs_change_per_word ? | 1130 | chip->write = chip->cs_change_per_word ? |
1131 | u8_cs_chg_writer : u8_writer; | 1131 | bfin_spi_u8_cs_chg_writer : bfin_spi_u8_writer; |
1132 | chip->duplex = chip->cs_change_per_word ? | 1132 | chip->duplex = chip->cs_change_per_word ? |
1133 | u8_cs_chg_duplex : u8_duplex; | 1133 | bfin_spi_u8_cs_chg_duplex : bfin_spi_u8_duplex; |
1134 | break; | 1134 | break; |
1135 | 1135 | ||
1136 | case 16: | 1136 | case 16: |
1137 | chip->n_bytes = 2; | 1137 | chip->n_bytes = 2; |
1138 | chip->width = CFG_SPI_WORDSIZE16; | 1138 | chip->width = CFG_SPI_WORDSIZE16; |
1139 | chip->read = chip->cs_change_per_word ? | 1139 | chip->read = chip->cs_change_per_word ? |
1140 | u16_cs_chg_reader : u16_reader; | 1140 | bfin_spi_u16_cs_chg_reader : bfin_spi_u16_reader; |
1141 | chip->write = chip->cs_change_per_word ? | 1141 | chip->write = chip->cs_change_per_word ? |
1142 | u16_cs_chg_writer : u16_writer; | 1142 | bfin_spi_u16_cs_chg_writer : bfin_spi_u16_writer; |
1143 | chip->duplex = chip->cs_change_per_word ? | 1143 | chip->duplex = chip->cs_change_per_word ? |
1144 | u16_cs_chg_duplex : u16_duplex; | 1144 | bfin_spi_u16_cs_chg_duplex : bfin_spi_u16_duplex; |
1145 | break; | 1145 | break; |
1146 | 1146 | ||
1147 | default: | 1147 | default: |
1148 | dev_err(&spi->dev, "%d bits_per_word is not supported\n", | 1148 | dev_err(&spi->dev, "%d bits_per_word is not supported\n", |
1149 | chip->bits_per_word); | 1149 | chip->bits_per_word); |
1150 | kfree(chip); | 1150 | if (chip_info) |
1151 | kfree(chip); | ||
1151 | return -ENODEV; | 1152 | return -ENODEV; |
1152 | } | 1153 | } |
1153 | 1154 | ||
@@ -1164,7 +1165,7 @@ static int setup(struct spi_device *spi) | |||
1164 | peripheral_request(ssel[spi->master->bus_num] | 1165 | peripheral_request(ssel[spi->master->bus_num] |
1165 | [chip->chip_select_num-1], spi->modalias); | 1166 | [chip->chip_select_num-1], spi->modalias); |
1166 | 1167 | ||
1167 | cs_deactive(drv_data, chip); | 1168 | bfin_spi_cs_deactive(drv_data, chip); |
1168 | 1169 | ||
1169 | return 0; | 1170 | return 0; |
1170 | } | 1171 | } |
@@ -1173,7 +1174,7 @@ static int setup(struct spi_device *spi) | |||
1173 | * callback for spi framework. | 1174 | * callback for spi framework. |
1174 | * clean driver specific data | 1175 | * clean driver specific data |
1175 | */ | 1176 | */ |
1176 | static void cleanup(struct spi_device *spi) | 1177 | static void bfin_spi_cleanup(struct spi_device *spi) |
1177 | { | 1178 | { |
1178 | struct chip_data *chip = spi_get_ctldata(spi); | 1179 | struct chip_data *chip = spi_get_ctldata(spi); |
1179 | 1180 | ||
@@ -1185,7 +1186,7 @@ static void cleanup(struct spi_device *spi) | |||
1185 | kfree(chip); | 1186 | kfree(chip); |
1186 | } | 1187 | } |
1187 | 1188 | ||
1188 | static inline int init_queue(struct driver_data *drv_data) | 1189 | static inline int bfin_spi_init_queue(struct driver_data *drv_data) |
1189 | { | 1190 | { |
1190 | INIT_LIST_HEAD(&drv_data->queue); | 1191 | INIT_LIST_HEAD(&drv_data->queue); |
1191 | spin_lock_init(&drv_data->lock); | 1192 | spin_lock_init(&drv_data->lock); |
@@ -1195,10 +1196,10 @@ static inline int init_queue(struct driver_data *drv_data) | |||
1195 | 1196 | ||
1196 | /* init transfer tasklet */ | 1197 | /* init transfer tasklet */ |
1197 | tasklet_init(&drv_data->pump_transfers, | 1198 | tasklet_init(&drv_data->pump_transfers, |
1198 | pump_transfers, (unsigned long)drv_data); | 1199 | bfin_spi_pump_transfers, (unsigned long)drv_data); |
1199 | 1200 | ||
1200 | /* init messages workqueue */ | 1201 | /* init messages workqueue */ |
1201 | INIT_WORK(&drv_data->pump_messages, pump_messages); | 1202 | INIT_WORK(&drv_data->pump_messages, bfin_spi_pump_messages); |
1202 | drv_data->workqueue = create_singlethread_workqueue( | 1203 | drv_data->workqueue = create_singlethread_workqueue( |
1203 | dev_name(drv_data->master->dev.parent)); | 1204 | dev_name(drv_data->master->dev.parent)); |
1204 | if (drv_data->workqueue == NULL) | 1205 | if (drv_data->workqueue == NULL) |
@@ -1207,7 +1208,7 @@ static inline int init_queue(struct driver_data *drv_data) | |||
1207 | return 0; | 1208 | return 0; |
1208 | } | 1209 | } |
1209 | 1210 | ||
1210 | static inline int start_queue(struct driver_data *drv_data) | 1211 | static inline int bfin_spi_start_queue(struct driver_data *drv_data) |
1211 | { | 1212 | { |
1212 | unsigned long flags; | 1213 | unsigned long flags; |
1213 | 1214 | ||
@@ -1229,7 +1230,7 @@ static inline int start_queue(struct driver_data *drv_data) | |||
1229 | return 0; | 1230 | return 0; |
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | static inline int stop_queue(struct driver_data *drv_data) | 1233 | static inline int bfin_spi_stop_queue(struct driver_data *drv_data) |
1233 | { | 1234 | { |
1234 | unsigned long flags; | 1235 | unsigned long flags; |
1235 | unsigned limit = 500; | 1236 | unsigned limit = 500; |
@@ -1258,11 +1259,11 @@ static inline int stop_queue(struct driver_data *drv_data) | |||
1258 | return status; | 1259 | return status; |
1259 | } | 1260 | } |
1260 | 1261 | ||
1261 | static inline int destroy_queue(struct driver_data *drv_data) | 1262 | static inline int bfin_spi_destroy_queue(struct driver_data *drv_data) |
1262 | { | 1263 | { |
1263 | int status; | 1264 | int status; |
1264 | 1265 | ||
1265 | status = stop_queue(drv_data); | 1266 | status = bfin_spi_stop_queue(drv_data); |
1266 | if (status != 0) | 1267 | if (status != 0) |
1267 | return status; | 1268 | return status; |
1268 | 1269 | ||
@@ -1271,7 +1272,7 @@ static inline int destroy_queue(struct driver_data *drv_data) | |||
1271 | return 0; | 1272 | return 0; |
1272 | } | 1273 | } |
1273 | 1274 | ||
1274 | static int __init bfin5xx_spi_probe(struct platform_device *pdev) | 1275 | static int __init bfin_spi_probe(struct platform_device *pdev) |
1275 | { | 1276 | { |
1276 | struct device *dev = &pdev->dev; | 1277 | struct device *dev = &pdev->dev; |
1277 | struct bfin5xx_spi_master *platform_info; | 1278 | struct bfin5xx_spi_master *platform_info; |
@@ -1297,9 +1298,9 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1297 | 1298 | ||
1298 | master->bus_num = pdev->id; | 1299 | master->bus_num = pdev->id; |
1299 | master->num_chipselect = platform_info->num_chipselect; | 1300 | master->num_chipselect = platform_info->num_chipselect; |
1300 | master->cleanup = cleanup; | 1301 | master->cleanup = bfin_spi_cleanup; |
1301 | master->setup = setup; | 1302 | master->setup = bfin_spi_setup; |
1302 | master->transfer = transfer; | 1303 | master->transfer = bfin_spi_transfer; |
1303 | 1304 | ||
1304 | /* Find and map our resources */ | 1305 | /* Find and map our resources */ |
1305 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1306 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -1324,13 +1325,13 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1324 | } | 1325 | } |
1325 | 1326 | ||
1326 | /* Initial and start queue */ | 1327 | /* Initial and start queue */ |
1327 | status = init_queue(drv_data); | 1328 | status = bfin_spi_init_queue(drv_data); |
1328 | if (status != 0) { | 1329 | if (status != 0) { |
1329 | dev_err(dev, "problem initializing queue\n"); | 1330 | dev_err(dev, "problem initializing queue\n"); |
1330 | goto out_error_queue_alloc; | 1331 | goto out_error_queue_alloc; |
1331 | } | 1332 | } |
1332 | 1333 | ||
1333 | status = start_queue(drv_data); | 1334 | status = bfin_spi_start_queue(drv_data); |
1334 | if (status != 0) { | 1335 | if (status != 0) { |
1335 | dev_err(dev, "problem starting queue\n"); | 1336 | dev_err(dev, "problem starting queue\n"); |
1336 | goto out_error_queue_alloc; | 1337 | goto out_error_queue_alloc; |
@@ -1356,7 +1357,7 @@ static int __init bfin5xx_spi_probe(struct platform_device *pdev) | |||
1356 | return status; | 1357 | return status; |
1357 | 1358 | ||
1358 | out_error_queue_alloc: | 1359 | out_error_queue_alloc: |
1359 | destroy_queue(drv_data); | 1360 | bfin_spi_destroy_queue(drv_data); |
1360 | out_error_no_dma_ch: | 1361 | out_error_no_dma_ch: |
1361 | iounmap((void *) drv_data->regs_base); | 1362 | iounmap((void *) drv_data->regs_base); |
1362 | out_error_ioremap: | 1363 | out_error_ioremap: |
@@ -1367,7 +1368,7 @@ out_error_get_res: | |||
1367 | } | 1368 | } |
1368 | 1369 | ||
1369 | /* stop hardware and remove the driver */ | 1370 | /* stop hardware and remove the driver */ |
1370 | static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) | 1371 | static int __devexit bfin_spi_remove(struct platform_device *pdev) |
1371 | { | 1372 | { |
1372 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1373 | struct driver_data *drv_data = platform_get_drvdata(pdev); |
1373 | int status = 0; | 1374 | int status = 0; |
@@ -1376,7 +1377,7 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) | |||
1376 | return 0; | 1377 | return 0; |
1377 | 1378 | ||
1378 | /* Remove the queue */ | 1379 | /* Remove the queue */ |
1379 | status = destroy_queue(drv_data); | 1380 | status = bfin_spi_destroy_queue(drv_data); |
1380 | if (status != 0) | 1381 | if (status != 0) |
1381 | return status; | 1382 | return status; |
1382 | 1383 | ||
@@ -1401,12 +1402,12 @@ static int __devexit bfin5xx_spi_remove(struct platform_device *pdev) | |||
1401 | } | 1402 | } |
1402 | 1403 | ||
1403 | #ifdef CONFIG_PM | 1404 | #ifdef CONFIG_PM |
1404 | static int bfin5xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | 1405 | static int bfin_spi_suspend(struct platform_device *pdev, pm_message_t state) |
1405 | { | 1406 | { |
1406 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1407 | struct driver_data *drv_data = platform_get_drvdata(pdev); |
1407 | int status = 0; | 1408 | int status = 0; |
1408 | 1409 | ||
1409 | status = stop_queue(drv_data); | 1410 | status = bfin_spi_stop_queue(drv_data); |
1410 | if (status != 0) | 1411 | if (status != 0) |
1411 | return status; | 1412 | return status; |
1412 | 1413 | ||
@@ -1416,7 +1417,7 @@ static int bfin5xx_spi_suspend(struct platform_device *pdev, pm_message_t state) | |||
1416 | return 0; | 1417 | return 0; |
1417 | } | 1418 | } |
1418 | 1419 | ||
1419 | static int bfin5xx_spi_resume(struct platform_device *pdev) | 1420 | static int bfin_spi_resume(struct platform_device *pdev) |
1420 | { | 1421 | { |
1421 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1422 | struct driver_data *drv_data = platform_get_drvdata(pdev); |
1422 | int status = 0; | 1423 | int status = 0; |
@@ -1425,7 +1426,7 @@ static int bfin5xx_spi_resume(struct platform_device *pdev) | |||
1425 | bfin_spi_enable(drv_data); | 1426 | bfin_spi_enable(drv_data); |
1426 | 1427 | ||
1427 | /* Start the queue running */ | 1428 | /* Start the queue running */ |
1428 | status = start_queue(drv_data); | 1429 | status = bfin_spi_start_queue(drv_data); |
1429 | if (status != 0) { | 1430 | if (status != 0) { |
1430 | dev_err(&pdev->dev, "problem starting queue (%d)\n", status); | 1431 | dev_err(&pdev->dev, "problem starting queue (%d)\n", status); |
1431 | return status; | 1432 | return status; |
@@ -1434,29 +1435,29 @@ static int bfin5xx_spi_resume(struct platform_device *pdev) | |||
1434 | return 0; | 1435 | return 0; |
1435 | } | 1436 | } |
1436 | #else | 1437 | #else |
1437 | #define bfin5xx_spi_suspend NULL | 1438 | #define bfin_spi_suspend NULL |
1438 | #define bfin5xx_spi_resume NULL | 1439 | #define bfin_spi_resume NULL |
1439 | #endif /* CONFIG_PM */ | 1440 | #endif /* CONFIG_PM */ |
1440 | 1441 | ||
1441 | MODULE_ALIAS("platform:bfin-spi"); | 1442 | MODULE_ALIAS("platform:bfin-spi"); |
1442 | static struct platform_driver bfin5xx_spi_driver = { | 1443 | static struct platform_driver bfin_spi_driver = { |
1443 | .driver = { | 1444 | .driver = { |
1444 | .name = DRV_NAME, | 1445 | .name = DRV_NAME, |
1445 | .owner = THIS_MODULE, | 1446 | .owner = THIS_MODULE, |
1446 | }, | 1447 | }, |
1447 | .suspend = bfin5xx_spi_suspend, | 1448 | .suspend = bfin_spi_suspend, |
1448 | .resume = bfin5xx_spi_resume, | 1449 | .resume = bfin_spi_resume, |
1449 | .remove = __devexit_p(bfin5xx_spi_remove), | 1450 | .remove = __devexit_p(bfin_spi_remove), |
1450 | }; | 1451 | }; |
1451 | 1452 | ||
1452 | static int __init bfin5xx_spi_init(void) | 1453 | static int __init bfin_spi_init(void) |
1453 | { | 1454 | { |
1454 | return platform_driver_probe(&bfin5xx_spi_driver, bfin5xx_spi_probe); | 1455 | return platform_driver_probe(&bfin_spi_driver, bfin_spi_probe); |
1455 | } | 1456 | } |
1456 | module_init(bfin5xx_spi_init); | 1457 | module_init(bfin_spi_init); |
1457 | 1458 | ||
1458 | static void __exit bfin5xx_spi_exit(void) | 1459 | static void __exit bfin_spi_exit(void) |
1459 | { | 1460 | { |
1460 | platform_driver_unregister(&bfin5xx_spi_driver); | 1461 | platform_driver_unregister(&bfin_spi_driver); |
1461 | } | 1462 | } |
1462 | module_exit(bfin5xx_spi_exit); | 1463 | module_exit(bfin_spi_exit); |