Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (30 commits)
  ide: make ide_hwif_t.ide_dma_host_on void (v2)
  ide: make ide_hwif_t.ide_dma_{host_off,off_quietly} void (v2)
  ide: add ide_set_dma() helper (v2)
  sgiioc4: fix sgiioc4_ide_dma_check() to enable/disable DMA properly
  ide: disable DMA in ->ide_dma_check for "no IORDY" case (v2)
  ide: convert ide_hwif_t.mmio into flag (v2)
  ide: use PIO/MMIO operations directly where possible (v2)
  ide: add ide_use_fast_pio() helper (v3)
  ide: unexport ide_set_xfer_rate() (v2)
  ide: remove ide_drive_t.usage
  ide: remove ide_pci_device_t tables with only one entry
  ide: remove write-only ide_hwif_t.no_dsc flag
  ide: remove write-only ide_pio_data_t.blacklisted
  sis5513: sis5513_config_xfer_rate() cleanup
  piix: cleanup
  svwks: small cleanup
  cs5530: small cleanup
  hpt366: remove redundant check from init_dma_hpt366()
  trm290: remove redundant CONFIG_BLK_DEV_IDEDMA #ifdef-s
  au1xxx-ide: remove dead code
  ...
  • Loading branch information
Linus Torvalds committed Feb 19, 2007
2 parents 976fd0e + ccf3528 commit dd397a6
Show file tree
Hide file tree
Showing 57 changed files with 1,523 additions and 1,018 deletions.
8 changes: 8 additions & 0 deletions drivers/ide/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,14 @@ config BLK_DEV_IDEDMA_PMAC
to transfer data to and from memory. Saying Y is safe and improves
performance.

config BLK_DEV_IDE_CELLEB
bool "Toshiba's Cell Reference Set IDE support"
depends on PPC_CELLEB
help
This driver provides support for the built-in IDE controller on
Toshiba Cell Reference Board.
If unsure, say Y.

config BLK_DEV_IDE_SWARM
tristate "IDE for Sibyte evaluation boards"
depends on SIBYTE_SB1xxx_SOC
Expand Down
1 change: 1 addition & 0 deletions drivers/ide/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ide-core-$(CONFIG_BLK_DEV_Q40IDE) += legacy/q40ide.o
# built-in only drivers from ppc/
ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o
ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o
ide-core-$(CONFIG_BLK_DEV_IDE_CELLEB) += ppc/scc_pata.o

# built-in only drivers from h8300/
ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o
Expand Down
25 changes: 10 additions & 15 deletions drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,26 +307,24 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode)
return on;
}

static int icside_dma_host_off(ide_drive_t *drive)
static void icside_dma_host_off(ide_drive_t *drive)
{
return 0;
}

static int icside_dma_off_quietly(ide_drive_t *drive)
static void icside_dma_off_quietly(ide_drive_t *drive)
{
drive->using_dma = 0;
return icside_dma_host_off(drive);
}

static int icside_dma_host_on(ide_drive_t *drive)
static void icside_dma_host_on(ide_drive_t *drive)
{
return 0;
}

static int icside_dma_on(ide_drive_t *drive)
{
drive->using_dma = 1;
return icside_dma_host_on(drive);

return 0;
}

static int icside_dma_check(ide_drive_t *drive)
Expand Down Expand Up @@ -365,10 +363,7 @@ static int icside_dma_check(ide_drive_t *drive)
out:
on = icside_set_speed(drive, xfer_mode);

if (on)
return icside_dma_on(drive);
else
return icside_dma_off_quietly(drive);
return on ? 0 : -1;
}

static int icside_dma_end(ide_drive_t *drive)
Expand Down Expand Up @@ -497,9 +492,9 @@ static void icside_dma_init(ide_hwif_t *hwif)
hwif->autodma = autodma;

hwif->ide_dma_check = icside_dma_check;
hwif->ide_dma_host_off = icside_dma_host_off;
hwif->ide_dma_off_quietly = icside_dma_off_quietly;
hwif->ide_dma_host_on = icside_dma_host_on;
hwif->dma_host_off = icside_dma_host_off;
hwif->dma_off_quietly = icside_dma_off_quietly;
hwif->dma_host_on = icside_dma_host_on;
hwif->ide_dma_on = icside_dma_on;
hwif->dma_setup = icside_dma_setup;
hwif->dma_exec_cmd = icside_dma_exec_cmd;
Expand Down Expand Up @@ -556,7 +551,7 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
* Ensure we're using MMIO
*/
default_hwif_mmiops(hwif);
hwif->mmio = 2;
hwif->mmio = 1;

for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
hwif->hw.io_ports[i] = port;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/arm/rapide.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int
hwif->hw.io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl;
hwif->hw.irq = hwif->irq = irq;
hwif->mmio = 2;
hwif->mmio = 1;
default_hwif_mmiops(hwif);

return hwif;
Expand Down
34 changes: 14 additions & 20 deletions drivers/ide/cris/ide-cris.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,9 +682,12 @@ static void cris_ide_input_data (ide_drive_t *drive, void *, unsigned int);
static void cris_ide_output_data (ide_drive_t *drive, void *, unsigned int);
static void cris_atapi_input_bytes(ide_drive_t *drive, void *, unsigned int);
static void cris_atapi_output_bytes(ide_drive_t *drive, void *, unsigned int);
static int cris_dma_off (ide_drive_t *drive);
static int cris_dma_on (ide_drive_t *drive);

static void cris_dma_off(ide_drive_t *drive)
{
}

static void tune_cris_ide(ide_drive_t *drive, u8 pio)
{
int setup, strobe, hold;
Expand Down Expand Up @@ -795,7 +798,7 @@ init_e100_ide (void)
0, 0, cris_ide_ack_intr,
ide_default_irq(0));
ide_register_hw(&hw, &hwif);
hwif->mmio = 2;
hwif->mmio = 1;
hwif->chipset = ide_etrax100;
hwif->tuneproc = &tune_cris_ide;
hwif->speedproc = &speed_cris_ide;
Expand All @@ -814,13 +817,16 @@ init_e100_ide (void)
hwif->OUTBSYNC = &cris_ide_outbsync;
hwif->INB = &cris_ide_inb;
hwif->INW = &cris_ide_inw;
hwif->ide_dma_host_off = &cris_dma_off;
hwif->ide_dma_host_on = &cris_dma_on;
hwif->ide_dma_off_quietly = &cris_dma_off;
hwif->dma_host_off = &cris_dma_off;
hwif->dma_host_on = &cris_dma_on;
hwif->dma_off_quietly = &cris_dma_off;
hwif->udma_four = 0;
hwif->ultra_mask = cris_ultra_mask;
hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */
hwif->swdma_mask = 0x07; /* Singleword DMA 0-2 */
hwif->autodma = 1;
hwif->drives[0].autodma = 1;
hwif->drives[1].autodma = 1;
}

/* Reset pulse */
Expand All @@ -835,11 +841,6 @@ init_e100_ide (void)
cris_ide_set_speed(TYPE_UDMA, ATA_UDMA2_CYC, ATA_UDMA2_DVS, 0);
}

static int cris_dma_off (ide_drive_t *drive)
{
return 0;
}

static int cris_dma_on (ide_drive_t *drive)
{
return 0;
Expand Down Expand Up @@ -1045,17 +1046,10 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)

static int cris_dma_check(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct hd_driveid* id = drive->id;

if (id && (id->capability & 1)) {
if (ide_use_dma(drive)) {
if (cris_config_drive_for_dma(drive))
return hwif->ide_dma_on(drive);
}
}
if (ide_use_dma(drive) && cris_config_drive_for_dma(drive))
return 0;

return hwif->ide_dma_off_quietly(drive);
return -1;
}

static int cris_dma_end(ide_drive_t *drive)
Expand Down
4 changes: 1 addition & 3 deletions drivers/ide/h8300/ide-h8300.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,11 @@ static inline void hwif_setup(ide_hwif_t *hwif)
{
default_hwif_iops(hwif);

hwif->mmio = 2;
hwif->mmio = 1;
hwif->OUTW = mm_outw;
hwif->OUTSW = mm_outsw;
hwif->INW = mm_inw;
hwif->INSW = mm_insw;
hwif->OUTL = NULL;
hwif->INL = NULL;
hwif->OUTSL = NULL;
hwif->INSL = NULL;
}
Expand Down
44 changes: 15 additions & 29 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,15 +687,8 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 sta
static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
{
struct request *rq = HWGROUP(drive)->rq;
ide_hwif_t *hwif = HWIF(drive);
int stat, err, sense_key;

/* We may have bogus DMA interrupts in PIO state here */
if (HWIF(drive)->dma_status && hwif->atapi_irq_bogon) {
stat = hwif->INB(hwif->dma_status);
/* Should we force the bit as well ? */
hwif->OUTB(stat, hwif->dma_status);
}
/* Check for errors. */
stat = HWIF(drive)->INB(IDE_STATUS_REG);
if (stat_ret)
Expand Down Expand Up @@ -930,6 +923,10 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);

if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
/* waiting for CDB interrupt, not DMA yet. */
if (info->dma)
drive->waiting_for_dma = 0;

/* packet command */
ide_execute_command(drive, WIN_PACKETCMD, handler, ATAPI_WAIT_PC, cdrom_timer_expiry);
return ide_started;
Expand Down Expand Up @@ -972,6 +969,10 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
/* Check for errors. */
if (cdrom_decode_status(drive, DRQ_STAT, NULL))
return ide_stopped;

/* Ok, next interrupt will be DMA interrupt. */
if (info->dma)
drive->waiting_for_dma = 1;
} else {
/* Otherwise, we must wait for DRQ to get set. */
if (ide_wait_stat(&startstop, drive, DRQ_STAT,
Expand Down Expand Up @@ -1103,7 +1104,7 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
if (dma) {
info->dma = 0;
if ((dma_error = HWIF(drive)->ide_dma_end(drive)))
__ide_dma_off(drive);
ide_dma_off(drive);
}

if (cdrom_decode_status(drive, 0, &stat))
Expand Down Expand Up @@ -1699,7 +1700,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
if (dma) {
if (dma_error) {
printk(KERN_ERR "ide-cd: dma error\n");
__ide_dma_off(drive);
ide_dma_off(drive);
return ide_error(drive, "dma error", stat);
}

Expand Down Expand Up @@ -1825,7 +1826,7 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
info->dma = 0;
if ((dma_error = HWIF(drive)->ide_dma_end(drive))) {
printk(KERN_ERR "ide-cd: write dma error\n");
__ide_dma_off(drive);
ide_dma_off(drive);
}
}

Expand Down Expand Up @@ -3254,14 +3255,6 @@ int ide_cdrom_setup (ide_drive_t *drive)
if (drive->autotune == IDE_TUNE_DEFAULT ||
drive->autotune == IDE_TUNE_AUTO)
drive->dsc_overlap = (drive->next != drive);
#if 0
drive->dsc_overlap = (HWIF(drive)->no_dsc) ? 0 : 1;
if (HWIF(drive)->no_dsc) {
printk(KERN_INFO "ide-cd: %s: disabling DSC overlap\n",
drive->name);
drive->dsc_overlap = 0;
}
#endif

if (ide_cdrom_register(drive, nslots)) {
printk (KERN_ERR "%s: ide_cdrom_setup failed to register device with the cdrom driver.\n", drive->name);
Expand Down Expand Up @@ -3360,21 +3353,16 @@ static int idecd_open(struct inode * inode, struct file * file)
{
struct gendisk *disk = inode->i_bdev->bd_disk;
struct cdrom_info *info;
ide_drive_t *drive;
int rc = -ENOMEM;

if (!(info = ide_cd_get(disk)))
return -ENXIO;

drive = info->drive;

drive->usage++;

if (!info->buffer)
info->buffer = kmalloc(SECTOR_BUFFER_SIZE,
GFP_KERNEL|__GFP_REPEAT);
if (!info->buffer || (rc = cdrom_open(&info->devinfo, inode, file)))
drive->usage--;
info->buffer = kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL|__GFP_REPEAT);

if (info->buffer)
rc = cdrom_open(&info->devinfo, inode, file);

if (rc < 0)
ide_cd_put(info);
Expand All @@ -3386,10 +3374,8 @@ static int idecd_release(struct inode * inode, struct file * file)
{
struct gendisk *disk = inode->i_bdev->bd_disk;
struct cdrom_info *info = ide_cd_g(disk);
ide_drive_t *drive = info->drive;

cdrom_release (&info->devinfo, file);
drive->usage--;

ide_cd_put(info);

Expand Down
14 changes: 9 additions & 5 deletions drivers/ide/ide-disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct ide_disk_obj {
ide_driver_t *driver;
struct gendisk *disk;
struct kref kref;
unsigned int openers; /* protected by BKL for now */
};

static DEFINE_MUTEX(idedisk_ref_mutex);
Expand Down Expand Up @@ -1081,8 +1082,9 @@ static int idedisk_open(struct inode *inode, struct file *filp)

drive = idkp->drive;

drive->usage++;
if (drive->removable && drive->usage == 1) {
idkp->openers++;

if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK;
Expand All @@ -1106,9 +1108,10 @@ static int idedisk_release(struct inode *inode, struct file *filp)
struct ide_disk_obj *idkp = ide_disk_g(disk);
ide_drive_t *drive = idkp->drive;

if (drive->usage == 1)
if (idkp->openers == 1)
ide_cacheflush_p(drive);
if (drive->removable && drive->usage == 1) {

if (drive->removable && idkp->openers == 1) {
ide_task_t args;
memset(&args, 0, sizeof(ide_task_t));
args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK;
Expand All @@ -1117,7 +1120,8 @@ static int idedisk_release(struct inode *inode, struct file *filp)
if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
drive->doorlocking = 0;
}
drive->usage--;

idkp->openers--;

ide_disk_put(idkp);

Expand Down
Loading

0 comments on commit dd397a6

Please sign in to comment.