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:
  scc_pata: PIO fixes
  piix/slc90e66: fix PIO1 handling in ->speedproc method (take 2)
  jmicron: PIO fixes
  it8213: PIO fixes (take 2)
  cs5535: PIO fixes
  cs5520: fix PIO auto-tuning in ->ide_dma_check method
  drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc
  drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc
  ide: eliminate warnings in ide-tape.c
  ide: fix runtogether printk's in cmd64x IDE driver
  sis5513: Add FSC Amilo A1630 PCI subvendor/dev to laptops
  alim15x3: Correct HP detect
  ide: Fix an overrun found in the CS5535 IDE driver
  • Loading branch information
Linus Torvalds committed Aug 2, 2007
2 parents 0466887 + 3fcece6 commit 878701d
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 128 deletions.
3 changes: 1 addition & 2 deletions drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,12 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
if (ret)
goto out;

state = kmalloc(sizeof(struct icside_state), GFP_KERNEL);
state = kzalloc(sizeof(struct icside_state), GFP_KERNEL);
if (!state) {
ret = -ENOMEM;
goto release;
}

memset(state, 0, sizeof(state));
state->type = ICS_TYPE_NOTYPE;
state->dev = &ec->dev;

Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ typedef enum {
} idetape_chrdev_direction_t;

struct idetape_bh {
unsigned short b_size;
u32 b_size;
atomic_t b_count;
struct idetape_bh *b_reqnext;
char *b_data;
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/pci/alim15x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_table[] = {
.ident = "HP Pavilion N5430",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"),
DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
},
},
{ }
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/pci/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
switch (rev) {
case 0x07:
case 0x05:
printk("%s: UltraDMA capable", name);
printk("%s: UltraDMA capable\n", name);
break;
case 0x03:
default:
printk("%s: MultiWord DMA force limited", name);
printk("%s: MultiWord DMA force limited\n", name);
break;
case 0x01:
printk("%s: MultiWord DMA limited, "
Expand Down
2 changes: 1 addition & 1 deletion drivers/ide/pci/cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
{
/* Tune the drive for PIO modes up to PIO 4 */
cs5520_tune_drive(drive, 4);
cs5520_tune_drive(drive, 255);

/* Then tell the core to use DMA operations */
return 0;
Expand Down
42 changes: 18 additions & 24 deletions drivers/ide/pci/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* linux/drivers/ide/pci/cs5535.c
*
* Copyright (C) 2004-2005 Advanced Micro Devices, Inc.
* Copyright (C) 2007 Bartlomiej Zolnierkiewicz
*
* History:
* 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com>
Expand Down Expand Up @@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)

/* Set the PIO timings */
if ((speed & XFER_MODE) == XFER_PIO) {
u8 pioa;
u8 piob;
u8 cmd;
ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
u8 cmd, pioa;

pioa = speed - XFER_PIO_0;
piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]),
255, 4);
cmd = pioa < piob ? pioa : piob;
cmd = pioa = speed - XFER_PIO_0;

if (pair->present) {
u8 piob = ide_get_best_pio_mode(pair, 255, 4);

if (piob < cmd)
cmd = piob;
}

/* Write the speed of the current drive */
reg = (cs5535_pio_cmd_timings[cmd] << 16) |
Expand All @@ -116,7 +120,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)

reg &= 0x80000000UL; /* Preserve the PIO format bit */

if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7)
if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_4)
reg |= cs5535_udma_timings[speed - XFER_UDMA_0];
else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0];
Expand Down Expand Up @@ -151,32 +155,22 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
*
* A callback from the upper layers for PIO-only tuning.
*/
static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed)
static void cs5535_tuneproc(ide_drive_t *drive, u8 pio)
{
u8 modes[] = { XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3,
XFER_PIO_4 };

/* cs5535 max pio is pio 4, best_pio will check the blacklist.
i think we don't need to rate_filter the incoming xferspeed
since we know we're only going to choose pio */
xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4);
ide_config_drive_speed(drive, modes[xferspeed]);
cs5535_set_speed(drive, xferspeed);
pio = ide_get_best_pio_mode(drive, pio, 4);
ide_config_drive_speed(drive, XFER_PIO_0 + pio);
cs5535_set_speed(drive, XFER_PIO_0 + pio);
}

static int cs5535_dma_check(ide_drive_t *drive)
{
u8 speed;

drive->init_speed = 0;

if (ide_tune_dma(drive))
return 0;

if (ide_use_fast_pio(drive)) {
speed = ide_get_best_pio_mode(drive, 255, 4);
cs5535_set_drive(drive, speed);
}
if (ide_use_fast_pio(drive))
cs5535_tuneproc(drive, 255);

return -1;
}
Expand Down
33 changes: 17 additions & 16 deletions drivers/ide/pci/it8213.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* it8213_dma_2_pio - return the PIO mode matching DMA
* @xfer_rate: transfer speed
*
* Returns the nearest equivalent PIO timing for the PIO or DMA
* Returns the nearest equivalent PIO timing for the DMA
* mode requested by the controller.
*/

Expand All @@ -35,34 +35,28 @@ static u8 it8213_dma_2_pio (u8 xfer_rate) {
case XFER_UDMA_1:
case XFER_UDMA_0:
case XFER_MW_DMA_2:
case XFER_PIO_4:
return 4;
case XFER_MW_DMA_1:
case XFER_PIO_3:
return 3;
case XFER_SW_DMA_2:
case XFER_PIO_2:
return 2;
case XFER_MW_DMA_0:
case XFER_SW_DMA_1:
case XFER_SW_DMA_0:
case XFER_PIO_1:
case XFER_PIO_0:
case XFER_PIO_SLOW:
default:
return 0;
}
}

/*
* it8213_tuneproc - tune a drive
* it8213_tune_pio - tune a drive
* @drive: drive to tune
* @pio: desired PIO mode
*
* Set the interface PIO mode.
*/

static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
static void it8213_tune_pio(ide_drive_t *drive, const u8 pio)
{
ide_hwif_t *hwif = HWIF(drive);
struct pci_dev *dev = hwif->pci_dev;
Expand All @@ -82,8 +76,6 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
{ 2, 1 },
{ 2, 3 }, };

pio = ide_get_best_pio_mode(drive, pio, 4);

spin_lock_irqsave(&tune_lock, flags);
pci_read_config_word(dev, master_port, &master_data);

Expand Down Expand Up @@ -113,6 +105,13 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
spin_unlock_irqrestore(&tune_lock, flags);
}

static void it8213_tuneproc(ide_drive_t *drive, u8 pio)
{
pio = ide_get_best_pio_mode(drive, pio, 4);
it8213_tune_pio(drive, pio);
ide_config_drive_speed(drive, XFER_PIO_0 + pio);
}

/**
* it8213_tune_chipset - set controller timings
* @drive: Drive to set up
Expand Down Expand Up @@ -193,7 +192,12 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
if (reg55 & w_flag)
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
}
it8213_tuneproc(drive, it8213_dma_2_pio(speed));

if (speed > XFER_PIO_4)
it8213_tune_pio(drive, it8213_dma_2_pio(speed));
else
it8213_tune_pio(drive, speed - XFER_PIO_0);

return ide_config_drive_speed(drive, speed);
}

Expand All @@ -209,13 +213,10 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)

static int it8213_config_drive_for_dma (ide_drive_t *drive)
{
u8 pio;

if (ide_tune_dma(drive))
return 0;

pio = ide_get_best_pio_mode(drive, 255, 4);
it8213_tune_chipset(drive, XFER_PIO_0 + pio);
it8213_tuneproc(drive, 255);

return -1;
}
Expand Down
21 changes: 4 additions & 17 deletions drivers/ide/pci/jmicron.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,10 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
return ATA_CBL_PATA80;
}

static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted)
static void jmicron_tuneproc(ide_drive_t *drive, u8 pio)
{
return;
}

/**
* config_jmicron_chipset_for_pio - set drive timings
* @drive: drive to tune
* @speed we want
*
*/

static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed)
{
u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5);
if (set_speed)
(void) ide_config_drive_speed(drive, speed);
pio = ide_get_best_pio_mode(drive, pio, 5);
ide_config_drive_speed(drive, XFER_PIO_0 + pio);
}

/**
Expand Down Expand Up @@ -132,7 +119,7 @@ static int jmicron_config_drive_for_dma (ide_drive_t *drive)
if (ide_tune_dma(drive))
return 0;

config_jmicron_chipset_for_pio(drive, 1);
jmicron_tuneproc(drive, 255);

return -1;
}
Expand Down
17 changes: 8 additions & 9 deletions drivers/ide/pci/piix.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* linux/drivers/ide/pci/piix.c Version 0.50 Jun 10, 2007
* linux/drivers/ide/pci/piix.c Version 0.51 Jul 6, 2007
*
* Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
* Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
Expand Down Expand Up @@ -109,7 +109,7 @@ static int no_piix_dma;
* piix_dma_2_pio - return the PIO mode matching DMA
* @xfer_rate: transfer speed
*
* Returns the nearest equivalent PIO timing for the PIO or DMA
* Returns the nearest equivalent PIO timing for the DMA
* mode requested by the controller.
*/

Expand All @@ -123,20 +123,14 @@ static u8 piix_dma_2_pio (u8 xfer_rate) {
case XFER_UDMA_1:
case XFER_UDMA_0:
case XFER_MW_DMA_2:
case XFER_PIO_4:
return 4;
case XFER_MW_DMA_1:
case XFER_PIO_3:
return 3;
case XFER_SW_DMA_2:
case XFER_PIO_2:
return 2;
case XFER_MW_DMA_0:
case XFER_SW_DMA_1:
case XFER_SW_DMA_0:
case XFER_PIO_1:
case XFER_PIO_0:
case XFER_PIO_SLOW:
default:
return 0;
}
Expand Down Expand Up @@ -269,6 +263,7 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
case XFER_PIO_4:
case XFER_PIO_3:
case XFER_PIO_2:
case XFER_PIO_1:
case XFER_PIO_0: break;
default: return -1;
}
Expand Down Expand Up @@ -299,7 +294,11 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
}

piix_tune_pio(drive, piix_dma_2_pio(speed));
if (speed > XFER_PIO_4)
piix_tune_pio(drive, piix_dma_2_pio(speed));
else
piix_tune_pio(drive, speed - XFER_PIO_0);

return ide_config_drive_speed(drive, speed);
}

Expand Down
Loading

0 comments on commit 878701d

Please sign in to comment.