diff options
author | Sonic Zhang <sonic.adi@gmail.com> | 2007-10-16 04:43:27 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-17 20:49:02 -0400 |
commit | 858c9c406688bc7244986b5836265071edfd1d3f (patch) | |
tree | a57c25ae4d03505032f897ce8fcca9d1a3ccaecf /drivers/ata | |
parent | 01839f6ddef011878e905d72786d95cee21ca039 (diff) |
Update libata driver for bf548 atapi controller against the 2.6.24 tree.
Changes:
1. Remove irq_ack() and port_disable() methods
2. Acocomodate for the libata-link patches
3. Change Kconfig ATAPI mode option into a module param.
4. Add supported WMDMA mode.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/Kconfig | 7 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 77 |
2 files changed, 37 insertions, 47 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index f4dc0e395976..ba63619ae5df 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -650,11 +650,4 @@ config PATA_BF54X | |||
650 | 650 | ||
651 | If unsure, say N. | 651 | If unsure, say N. |
652 | 652 | ||
653 | config PATA_BF54X_DMA | ||
654 | bool "DMA mode" | ||
655 | depends on PATA_BF54X | ||
656 | default y | ||
657 | help | ||
658 | Enable DMA mode for Blackfin ATAPI controller. | ||
659 | |||
660 | endif # ATA | 653 | endif # ATA |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 747549e4563a..b5e38426b815 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1092,14 +1092,15 @@ static unsigned int bfin_bus_softreset(struct ata_port *ap, | |||
1092 | * Note: Original code is ata_std_softreset(). | 1092 | * Note: Original code is ata_std_softreset(). |
1093 | */ | 1093 | */ |
1094 | 1094 | ||
1095 | static int bfin_std_softreset(struct ata_port *ap, unsigned int *classes, | 1095 | static int bfin_std_softreset(struct ata_link *link, unsigned int *classes, |
1096 | unsigned long deadline) | 1096 | unsigned long deadline) |
1097 | { | 1097 | { |
1098 | struct ata_port *ap = link->ap; | ||
1098 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; | 1099 | unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; |
1099 | unsigned int devmask = 0, err_mask; | 1100 | unsigned int devmask = 0, err_mask; |
1100 | u8 err; | 1101 | u8 err; |
1101 | 1102 | ||
1102 | if (ata_port_offline(ap)) { | 1103 | if (ata_link_offline(link)) { |
1103 | classes[0] = ATA_DEV_NONE; | 1104 | classes[0] = ATA_DEV_NONE; |
1104 | goto out; | 1105 | goto out; |
1105 | } | 1106 | } |
@@ -1122,9 +1123,11 @@ static int bfin_std_softreset(struct ata_port *ap, unsigned int *classes, | |||
1122 | } | 1123 | } |
1123 | 1124 | ||
1124 | /* determine by signature whether we have ATA or ATAPI devices */ | 1125 | /* determine by signature whether we have ATA or ATAPI devices */ |
1125 | classes[0] = ata_dev_try_classify(ap, 0, &err); | 1126 | classes[0] = ata_dev_try_classify(&ap->link.device[0], |
1127 | devmask & (1 << 0), &err); | ||
1126 | if (slave_possible && err != 0x81) | 1128 | if (slave_possible && err != 0x81) |
1127 | classes[1] = ata_dev_try_classify(ap, 1, &err); | 1129 | classes[1] = ata_dev_try_classify(&ap->link.device[1], |
1130 | devmask & (1 << 1), &err); | ||
1128 | 1131 | ||
1129 | out: | 1132 | out: |
1130 | return 0; | 1133 | return 0; |
@@ -1167,7 +1170,7 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) | |||
1167 | static void bfin_data_xfer(struct ata_device *adev, unsigned char *buf, | 1170 | static void bfin_data_xfer(struct ata_device *adev, unsigned char *buf, |
1168 | unsigned int buflen, int write_data) | 1171 | unsigned int buflen, int write_data) |
1169 | { | 1172 | { |
1170 | struct ata_port *ap = adev->ap; | 1173 | struct ata_port *ap = adev->link->ap; |
1171 | unsigned int words = buflen >> 1; | 1174 | unsigned int words = buflen >> 1; |
1172 | unsigned short *buf16 = (u16 *) buf; | 1175 | unsigned short *buf16 = (u16 *) buf; |
1173 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | 1176 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; |
@@ -1206,7 +1209,10 @@ static void bfin_irq_clear(struct ata_port *ap) | |||
1206 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | 1209 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; |
1207 | 1210 | ||
1208 | pr_debug("in atapi irq clear\n"); | 1211 | pr_debug("in atapi irq clear\n"); |
1209 | ATAPI_SET_INT_STATUS(base, 0x1FF); | 1212 | |
1213 | ATAPI_SET_INT_STATUS(base, ATAPI_GET_INT_STATUS(base)|ATAPI_DEV_INT | ||
1214 | | MULTI_DONE_INT | UDMAIN_DONE_INT | UDMAOUT_DONE_INT | ||
1215 | | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT); | ||
1210 | } | 1216 | } |
1211 | 1217 | ||
1212 | /** | 1218 | /** |
@@ -1234,33 +1240,6 @@ static unsigned char bfin_irq_on(struct ata_port *ap) | |||
1234 | } | 1240 | } |
1235 | 1241 | ||
1236 | /** | 1242 | /** |
1237 | * bfin_irq_ack - Acknowledge a device interrupt. | ||
1238 | * @ap: Port on which interrupts are enabled. | ||
1239 | * | ||
1240 | * Note: Original code is ata_irq_ack(). | ||
1241 | */ | ||
1242 | |||
1243 | static unsigned char bfin_irq_ack(struct ata_port *ap, unsigned int chk_drq) | ||
1244 | { | ||
1245 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | ||
1246 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | ||
1247 | unsigned char status; | ||
1248 | |||
1249 | pr_debug("in atapi irq ack\n"); | ||
1250 | status = ata_busy_wait(ap, bits, 1000); | ||
1251 | if (status & bits) | ||
1252 | if (ata_msg_err(ap)) | ||
1253 | dev_err(ap->dev, "abnormal status 0x%X\n", status); | ||
1254 | |||
1255 | /* get controller status; clear intr, err bits */ | ||
1256 | ATAPI_SET_INT_STATUS(base, ATAPI_GET_INT_STATUS(base)|ATAPI_DEV_INT | ||
1257 | | MULTI_DONE_INT | UDMAIN_DONE_INT | UDMAOUT_DONE_INT | ||
1258 | | MULTI_TERM_INT | UDMAIN_TERM_INT | UDMAOUT_TERM_INT); | ||
1259 | |||
1260 | return bfin_bmdma_status(ap); | ||
1261 | } | ||
1262 | |||
1263 | /** | ||
1264 | * bfin_bmdma_freeze - Freeze DMA controller port | 1243 | * bfin_bmdma_freeze - Freeze DMA controller port |
1265 | * @ap: port to freeze | 1244 | * @ap: port to freeze |
1266 | * | 1245 | * |
@@ -1308,8 +1287,9 @@ void bfin_bmdma_thaw(struct ata_port *ap) | |||
1308 | * Note: Original code is ata_std_postreset(). | 1287 | * Note: Original code is ata_std_postreset(). |
1309 | */ | 1288 | */ |
1310 | 1289 | ||
1311 | static void bfin_std_postreset(struct ata_port *ap, unsigned int *classes) | 1290 | static void bfin_std_postreset(struct ata_link *link, unsigned int *classes) |
1312 | { | 1291 | { |
1292 | struct ata_port *ap = link->ap; | ||
1313 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; | 1293 | void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; |
1314 | 1294 | ||
1315 | /* re-enable interrupts */ | 1295 | /* re-enable interrupts */ |
@@ -1395,7 +1375,6 @@ static struct scsi_host_template bfin_sht = { | |||
1395 | }; | 1375 | }; |
1396 | 1376 | ||
1397 | static const struct ata_port_operations bfin_pata_ops = { | 1377 | static const struct ata_port_operations bfin_pata_ops = { |
1398 | .port_disable = ata_port_disable, | ||
1399 | .set_piomode = bfin_set_piomode, | 1378 | .set_piomode = bfin_set_piomode, |
1400 | .set_dmamode = bfin_set_dmamode, | 1379 | .set_dmamode = bfin_set_dmamode, |
1401 | 1380 | ||
@@ -1423,7 +1402,6 @@ static const struct ata_port_operations bfin_pata_ops = { | |||
1423 | .irq_handler = ata_interrupt, | 1402 | .irq_handler = ata_interrupt, |
1424 | .irq_clear = bfin_irq_clear, | 1403 | .irq_clear = bfin_irq_clear, |
1425 | .irq_on = bfin_irq_on, | 1404 | .irq_on = bfin_irq_on, |
1426 | .irq_ack = bfin_irq_ack, | ||
1427 | 1405 | ||
1428 | .port_start = bfin_port_start, | 1406 | .port_start = bfin_port_start, |
1429 | .port_stop = bfin_port_stop, | 1407 | .port_stop = bfin_port_stop, |
@@ -1437,11 +1415,7 @@ static struct ata_port_info bfin_port_info[] = { | |||
1437 | | ATA_FLAG_NO_LEGACY, | 1415 | | ATA_FLAG_NO_LEGACY, |
1438 | .pio_mask = 0x1f, /* pio0-4 */ | 1416 | .pio_mask = 0x1f, /* pio0-4 */ |
1439 | .mwdma_mask = 0, | 1417 | .mwdma_mask = 0, |
1440 | #ifdef CONFIG_PATA_BF54X_DMA | ||
1441 | .udma_mask = ATA_UDMA5, | ||
1442 | #else | ||
1443 | .udma_mask = 0, | 1418 | .udma_mask = 0, |
1444 | #endif | ||
1445 | .port_ops = &bfin_pata_ops, | 1419 | .port_ops = &bfin_pata_ops, |
1446 | }, | 1420 | }, |
1447 | }; | 1421 | }; |
@@ -1607,9 +1581,25 @@ static struct platform_driver bfin_atapi_driver = { | |||
1607 | }, | 1581 | }, |
1608 | }; | 1582 | }; |
1609 | 1583 | ||
1584 | #define ATAPI_MODE_SIZE 10 | ||
1585 | static char bfin_atapi_mode[ATAPI_MODE_SIZE]; | ||
1586 | |||
1610 | static int __init bfin_atapi_init(void) | 1587 | static int __init bfin_atapi_init(void) |
1611 | { | 1588 | { |
1612 | pr_info("register bfin atapi driver\n"); | 1589 | pr_info("register bfin atapi driver\n"); |
1590 | |||
1591 | switch(bfin_atapi_mode[0]) { | ||
1592 | case 'p': | ||
1593 | case 'P': | ||
1594 | break; | ||
1595 | case 'm': | ||
1596 | case 'M': | ||
1597 | bfin_port_info[0].mwdma_mask = ATA_MWDMA2; | ||
1598 | break; | ||
1599 | default: | ||
1600 | bfin_port_info[0].udma_mask = ATA_UDMA5; | ||
1601 | }; | ||
1602 | |||
1613 | return platform_driver_register(&bfin_atapi_driver); | 1603 | return platform_driver_register(&bfin_atapi_driver); |
1614 | } | 1604 | } |
1615 | 1605 | ||
@@ -1620,6 +1610,13 @@ static void __exit bfin_atapi_exit(void) | |||
1620 | 1610 | ||
1621 | module_init(bfin_atapi_init); | 1611 | module_init(bfin_atapi_init); |
1622 | module_exit(bfin_atapi_exit); | 1612 | module_exit(bfin_atapi_exit); |
1613 | /* | ||
1614 | * ATAPI mode: | ||
1615 | * pio/PIO | ||
1616 | * udma/UDMA (default) | ||
1617 | * mwdma/MWDMA | ||
1618 | */ | ||
1619 | module_param_string(bfin_atapi_mode, bfin_atapi_mode, ATAPI_MODE_SIZE, 0); | ||
1623 | 1620 | ||
1624 | MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); | 1621 | MODULE_AUTHOR("Sonic Zhang <sonic.zhang@analog.com>"); |
1625 | MODULE_DESCRIPTION("PATA driver for blackfin 54x ATAPI controller"); | 1622 | MODULE_DESCRIPTION("PATA driver for blackfin 54x ATAPI controller"); |