aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS4
-rw-r--r--drivers/ide/ide-cd.c66
-rw-r--r--drivers/ide/ide-cd.h3
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cs5535.c2
5 files changed, 42 insertions, 37 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 3d567fd2e0a1..79c711e6074b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1870,8 +1870,10 @@ T: quilt kernel.org/pub/linux/kernel/people/bart/pata-2.6/
1870S: Maintained 1870S: Maintained
1871 1871
1872IDE/ATAPI CDROM DRIVER 1872IDE/ATAPI CDROM DRIVER
1873P: Borislav Petkov
1874M: bbpetkov@yahoo.de
1873L: linux-ide@vger.kernel.org 1875L: linux-ide@vger.kernel.org
1874S: Unmaintained 1876S: Maintained
1875 1877
1876IDE/ATAPI FLOPPY DRIVERS 1878IDE/ATAPI FLOPPY DRIVERS
1877P: Paul Bristow 1879P: Paul Bristow
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 92ac658dac33..c7d77f0ad892 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1068,8 +1068,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1068 return 0; 1068 return 0;
1069 else if (ireason == 0) { 1069 else if (ireason == 0) {
1070 /* Whoops... The drive is expecting to receive data from us! */ 1070 /* Whoops... The drive is expecting to receive data from us! */
1071 printk(KERN_ERR "%s: read_intr: Drive wants to transfer data the " 1071 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1072 "wrong way!\n", drive->name); 1072 drive->name, __FUNCTION__);
1073 1073
1074 /* Throw some data at the drive so it doesn't hang 1074 /* Throw some data at the drive so it doesn't hang
1075 and quit this request. */ 1075 and quit this request. */
@@ -1086,8 +1086,8 @@ int cdrom_read_check_ireason (ide_drive_t *drive, int len, int ireason)
1086 return 0; 1086 return 0;
1087 } else { 1087 } else {
1088 /* Drive wants a command packet, or invalid ireason... */ 1088 /* Drive wants a command packet, or invalid ireason... */
1089 printk(KERN_ERR "%s: read_intr: bad interrupt reason %x\n", drive->name, 1089 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1090 ireason); 1090 drive->name, __FUNCTION__, ireason);
1091 } 1091 }
1092 1092
1093 cdrom_end_request(drive, 0); 1093 cdrom_end_request(drive, 0);
@@ -1112,8 +1112,11 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
1112 */ 1112 */
1113 if (dma) { 1113 if (dma) {
1114 info->dma = 0; 1114 info->dma = 0;
1115 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) 1115 dma_error = HWIF(drive)->ide_dma_end(drive);
1116 if (dma_error) {
1117 printk(KERN_ERR "%s: DMA read error\n", drive->name);
1116 ide_dma_off(drive); 1118 ide_dma_off(drive);
1119 }
1117 } 1120 }
1118 1121
1119 if (cdrom_decode_status(drive, 0, &stat)) 1122 if (cdrom_decode_status(drive, 0, &stat))
@@ -1443,7 +1446,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1443 return ide_stopped; 1446 return ide_stopped;
1444 1447
1445 /* Read the interrupt reason and the transfer length. */ 1448 /* Read the interrupt reason and the transfer length. */
1446 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1449 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1447 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1450 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1448 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1451 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1449 1452
@@ -1484,7 +1487,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1484 if (thislen > len) thislen = len; 1487 if (thislen > len) thislen = len;
1485 1488
1486 /* The drive wants to be written to. */ 1489 /* The drive wants to be written to. */
1487 if ((ireason & 3) == 0) { 1490 if (ireason == 0) {
1488 if (!rq->data) { 1491 if (!rq->data) {
1489 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1492 blk_dump_rq_flags(rq, "cdrom_pc_intr, write");
1490 goto confused; 1493 goto confused;
@@ -1506,9 +1509,9 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
1506 } 1509 }
1507 1510
1508 /* Same drill for reading. */ 1511 /* Same drill for reading. */
1509 else if ((ireason & 3) == 2) { 1512 else if (ireason == 2) {
1510 if (!rq->data) { 1513 if (!rq->data) {
1511 blk_dump_rq_flags(rq, "cdrom_pc_intr, write"); 1514 blk_dump_rq_flags(rq, "cdrom_pc_intr, read");
1512 goto confused; 1515 goto confused;
1513 } 1516 }
1514 /* Transfer the data. */ 1517 /* Transfer the data. */
@@ -1632,8 +1635,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1632 return 0; 1635 return 0;
1633 else if (ireason == 2) { 1636 else if (ireason == 2) {
1634 /* Whoops... The drive wants to send data. */ 1637 /* Whoops... The drive wants to send data. */
1635 printk(KERN_ERR "%s: write_intr: wrong transfer direction!\n", 1638 printk(KERN_ERR "%s: %s: wrong transfer direction!\n",
1636 drive->name); 1639 drive->name, __FUNCTION__);
1637 1640
1638 while (len > 0) { 1641 while (len > 0) {
1639 int dum = 0; 1642 int dum = 0;
@@ -1642,8 +1645,8 @@ static int cdrom_write_check_ireason(ide_drive_t *drive, int len, int ireason)
1642 } 1645 }
1643 } else { 1646 } else {
1644 /* Drive wants a command packet, or invalid ireason... */ 1647 /* Drive wants a command packet, or invalid ireason... */
1645 printk(KERN_ERR "%s: write_intr: bad interrupt reason %x\n", 1648 printk(KERN_ERR "%s: %s: bad interrupt reason 0x%02x\n",
1646 drive->name, ireason); 1649 drive->name, __FUNCTION__, ireason);
1647 } 1650 }
1648 1651
1649 cdrom_end_request(drive, 0); 1652 cdrom_end_request(drive, 0);
@@ -1805,8 +1808,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1805 /* Check for errors. */ 1808 /* Check for errors. */
1806 if (dma) { 1809 if (dma) {
1807 info->dma = 0; 1810 info->dma = 0;
1808 if ((dma_error = HWIF(drive)->ide_dma_end(drive))) { 1811 dma_error = HWIF(drive)->ide_dma_end(drive);
1809 printk(KERN_ERR "ide-cd: write dma error\n"); 1812 if (dma_error) {
1813 printk(KERN_ERR "%s: DMA write error\n", drive->name);
1810 ide_dma_off(drive); 1814 ide_dma_off(drive);
1811 } 1815 }
1812 } 1816 }
@@ -1826,7 +1830,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1826 } 1830 }
1827 1831
1828 /* Read the interrupt reason and the transfer length. */ 1832 /* Read the interrupt reason and the transfer length. */
1829 ireason = HWIF(drive)->INB(IDE_IREASON_REG); 1833 ireason = HWIF(drive)->INB(IDE_IREASON_REG) & 0x3;
1830 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG); 1834 lowcyl = HWIF(drive)->INB(IDE_BCOUNTL_REG);
1831 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG); 1835 highcyl = HWIF(drive)->INB(IDE_BCOUNTH_REG);
1832 1836
@@ -1839,8 +1843,9 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1839 */ 1843 */
1840 uptodate = 1; 1844 uptodate = 1;
1841 if (rq->current_nr_sectors > 0) { 1845 if (rq->current_nr_sectors > 0) {
1842 printk(KERN_ERR "%s: write_intr: data underrun (%d blocks)\n", 1846 printk(KERN_ERR "%s: %s: data underrun (%d blocks)\n",
1843 drive->name, rq->current_nr_sectors); 1847 drive->name, __FUNCTION__,
1848 rq->current_nr_sectors);
1844 uptodate = 0; 1849 uptodate = 0;
1845 } 1850 }
1846 cdrom_end_request(drive, uptodate); 1851 cdrom_end_request(drive, uptodate);
@@ -1860,7 +1865,8 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
1860 int this_transfer; 1865 int this_transfer;
1861 1866
1862 if (!rq->current_nr_sectors) { 1867 if (!rq->current_nr_sectors) {
1863 printk(KERN_ERR "ide-cd: write_intr: oops\n"); 1868 printk(KERN_ERR "%s: %s: confused, missing data\n",
1869 drive->name, __FUNCTION__);
1864 break; 1870 break;
1865 } 1871 }
1866 1872
@@ -2688,14 +2694,14 @@ void ide_cdrom_update_speed (ide_drive_t *drive, struct atapi_capabilities_page
2688 if (!drive->id->model[0] && 2694 if (!drive->id->model[0] &&
2689 !strncmp(drive->id->fw_rev, "241N", 4)) { 2695 !strncmp(drive->id->fw_rev, "241N", 4)) {
2690 CDROM_STATE_FLAGS(drive)->current_speed = 2696 CDROM_STATE_FLAGS(drive)->current_speed =
2691 (((unsigned int)cap->curspeed) + (176/2)) / 176; 2697 (le16_to_cpu(cap->curspeed) + (176/2)) / 176;
2692 CDROM_CONFIG_FLAGS(drive)->max_speed = 2698 CDROM_CONFIG_FLAGS(drive)->max_speed =
2693 (((unsigned int)cap->maxspeed) + (176/2)) / 176; 2699 (le16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2694 } else { 2700 } else {
2695 CDROM_STATE_FLAGS(drive)->current_speed = 2701 CDROM_STATE_FLAGS(drive)->current_speed =
2696 (ntohs(cap->curspeed) + (176/2)) / 176; 2702 (be16_to_cpu(cap->curspeed) + (176/2)) / 176;
2697 CDROM_CONFIG_FLAGS(drive)->max_speed = 2703 CDROM_CONFIG_FLAGS(drive)->max_speed =
2698 (ntohs(cap->maxspeed) + (176/2)) / 176; 2704 (be16_to_cpu(cap->maxspeed) + (176/2)) / 176;
2699 } 2705 }
2700} 2706}
2701 2707
@@ -2909,6 +2915,9 @@ static int ide_cdrom_register (ide_drive_t *drive, int nslots)
2909 if (!CDROM_CONFIG_FLAGS(drive)->ram) 2915 if (!CDROM_CONFIG_FLAGS(drive)->ram)
2910 devinfo->mask |= CDC_RAM; 2916 devinfo->mask |= CDC_RAM;
2911 2917
2918 if (CDROM_CONFIG_FLAGS(drive)->no_speed_select)
2919 devinfo->mask |= CDC_SELECT_SPEED;
2920
2912 devinfo->disk = info->disk; 2921 devinfo->disk = info->disk;
2913 return register_cdrom(devinfo); 2922 return register_cdrom(devinfo);
2914} 2923}
@@ -3161,7 +3170,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
3161 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; 3170 CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
3162 /* the 3231 model does not support the SET_CD_SPEED command */ 3171 /* the 3231 model does not support the SET_CD_SPEED command */
3163 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) 3172 else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
3164 cdi->mask |= CDC_SELECT_SPEED; 3173 CDROM_CONFIG_FLAGS(drive)->no_speed_select = 1;
3165 3174
3166#if ! STANDARD_ATAPI 3175#if ! STANDARD_ATAPI
3167 /* by default Sanyo 3 CD changer support is turned off and 3176 /* by default Sanyo 3 CD changer support is turned off and
@@ -3504,15 +3513,8 @@ static int ide_cd_probe(ide_drive_t *drive)
3504 g->driverfs_dev = &drive->gendev; 3513 g->driverfs_dev = &drive->gendev;
3505 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE; 3514 g->flags = GENHD_FL_CD | GENHD_FL_REMOVABLE;
3506 if (ide_cdrom_setup(drive)) { 3515 if (ide_cdrom_setup(drive)) {
3507 struct cdrom_device_info *devinfo = &info->devinfo;
3508 ide_proc_unregister_driver(drive, &ide_cdrom_driver); 3516 ide_proc_unregister_driver(drive, &ide_cdrom_driver);
3509 kfree(info->buffer); 3517 ide_cd_release(&info->kref);
3510 kfree(info->toc);
3511 kfree(info->changer_info);
3512 if (devinfo->handle == drive && unregister_cdrom(devinfo))
3513 printk (KERN_ERR "%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
3514 kfree(info);
3515 drive->driver_data = NULL;
3516 goto failed; 3518 goto failed;
3517 } 3519 }
3518 3520
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index 228b29c5d2e4..1b302fe2724d 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -91,7 +91,8 @@ struct ide_cd_config_flags {
91 __u8 close_tray : 1; /* can close the tray */ 91 __u8 close_tray : 1; /* can close the tray */
92 __u8 writing : 1; /* pseudo write in progress */ 92 __u8 writing : 1; /* pseudo write in progress */
93 __u8 mo_drive : 1; /* drive is an MO device */ 93 __u8 mo_drive : 1; /* drive is an MO device */
94 __u8 reserved : 2; 94 __u8 no_speed_select : 1; /* SET_CD_SPEED command is unsupported. */
95 __u8 reserved : 1;
95 byte max_speed; /* Max speed of the drive */ 96 byte max_speed; /* Max speed of the drive */
96}; 97};
97#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags)) 98#define CDROM_CONFIG_FLAGS(drive) (&(((struct cdrom_info *)(drive->driver_data))->config_flags))
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 51fca441c294..bc553337b1be 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/cmd64x.c Version 1.51 Nov 8, 2007 2 * linux/drivers/ide/pci/cmd64x.c Version 1.52 Dec 24, 2007
3 * 3 *
4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. 4 * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines.
5 * Due to massive hardware bugs, UltraDMA is only supported 5 * Due to massive hardware bugs, UltraDMA is only supported
@@ -564,6 +564,7 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
564 .init_chipset = init_chipset_cmd64x, 564 .init_chipset = init_chipset_cmd64x,
565 .init_hwif = init_hwif_cmd64x, 565 .init_hwif = init_hwif_cmd64x,
566 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 566 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
567 .chipset = ide_cmd646,
567 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 568 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
568 .pio_mask = ATA_PIO5, 569 .pio_mask = ATA_PIO5,
569 .mwdma_mask = ATA_MWDMA2, 570 .mwdma_mask = ATA_MWDMA2,
@@ -573,7 +574,6 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = {
573 .init_chipset = init_chipset_cmd64x, 574 .init_chipset = init_chipset_cmd64x,
574 .init_hwif = init_hwif_cmd64x, 575 .init_hwif = init_hwif_cmd64x,
575 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 576 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
576 .chipset = ide_cmd646,
577 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE, 577 .host_flags = IDE_HFLAG_ABUSE_PREFETCH | IDE_HFLAG_BOOTABLE,
578 .pio_mask = ATA_PIO5, 578 .pio_mask = ATA_PIO5,
579 .mwdma_mask = ATA_MWDMA2, 579 .mwdma_mask = ATA_MWDMA2,
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 9094916e3780..ddcbeba671e1 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -49,7 +49,7 @@
49#define ATAC_BM0_PRD 0x04 49#define ATAC_BM0_PRD 0x04
50#define CS5535_CABLE_DETECT 0x48 50#define CS5535_CABLE_DETECT 0x48
51 51
52/* Format I PIO settings. We seperate out cmd and data for safer timings */ 52/* Format I PIO settings. We separate out cmd and data for safer timings */
53 53
54static unsigned int cs5535_pio_cmd_timings[5] = 54static unsigned int cs5535_pio_cmd_timings[5] =
55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 }; 55{ 0xF7F4, 0x53F3, 0x13F1, 0x5131, 0x1131 };