Skip to content

Commit

Permalink
ide: change ->set_pio_mode method parameters
Browse files Browse the repository at this point in the history
Change ->set_pio_mode method parameters to match ->set_piomode method
used in struct ata_port_operations.

Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bzolnier authored and davem330 committed Jan 19, 2010
1 parent 3fccaa1 commit e085b3c
Show file tree
Hide file tree
Showing 44 changed files with 129 additions and 121 deletions.
6 changes: 3 additions & 3 deletions drivers/ide/aec62xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ static void aec6260_set_mode(ide_drive_t *drive, const u8 speed)
local_irq_restore(flags);
}

static void aec_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void aec_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
drive->dma_mode = pio + XFER_PIO_0;
drive->hwif->port_ops->set_dma_mode(drive, pio + XFER_PIO_0);
drive->dma_mode = drive->pio_mode;
hwif->port_ops->set_dma_mode(drive, drive->dma_mode);
}

static int init_chipset_aec62xx(struct pci_dev *dev)
Expand Down
3 changes: 2 additions & 1 deletion drivers/ide/ali14xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ static DEFINE_SPINLOCK(ali14xx_lock);
* This function computes timing parameters
* and sets controller registers accordingly.
*/
static void ali14xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void ali14xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
int driveNum;
int time1, time2;
u8 param1, param2, param3, param4;
unsigned long flags;
int bus_speed = ide_vlb_clk ? ide_vlb_clk : 50;
const u8 pio = drive->pio_mode - XFER_PIO_0;
struct ide_timing *t = ide_timing_find_mode(XFER_PIO_0 + pio);

/* calculate timing, according to PIO mode */
Expand Down
7 changes: 3 additions & 4 deletions drivers/ide/alim15x3.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,22 @@ static void ali_fifo_control(ide_hwif_t *hwif, ide_drive_t *drive, int on)

/**
* ali_set_pio_mode - set host controller for PIO mode
* @hwif: port
* @drive: drive
* @pio: PIO mode number
*
* Program the controller for the given PIO mode.
*/

static void ali_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void ali_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *dev = to_pci_dev(hwif->dev);
int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
unsigned long T = 1000000 / bus_speed; /* PCI clock based */
int port = hwif->channel ? 0x5c : 0x58;
u8 unit = drive->dn & 1;
struct ide_timing t;

ide_timing_compute(drive, XFER_PIO_0 + pio, &t, T, 1);
ide_timing_compute(drive, drive->pio_mode, &t, T, 1);

t.setup = clamp_val(t.setup, 1, 8) & 7;
t.active = clamp_val(t.active, 1, 8) & 7;
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/amd74xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ static void amd_set_drive(ide_drive_t *drive, const u8 speed)
* amd_set_pio_mode() is a callback from upper layers for PIO-only tuning.
*/

static void amd_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void amd_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
amd_set_drive(drive, XFER_PIO_0 + pio);
amd_set_drive(drive, drive->pio_mode);
}

static void amd7409_cable_detect(struct pci_dev *dev)
Expand Down
5 changes: 3 additions & 2 deletions drivers/ide/at91_ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,12 @@ static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
leave_16bit(chipselect, mode);
}

static void at91_ide_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void at91_ide_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
struct ide_timing *timing;
u8 chipselect = drive->hwif->select_data;
u8 chipselect = hwif->select_data;
int use_iordy = 0;
const u8 pio = drive->pio_mode - XFER_PIO_0;

pdbg("chipselect %u pio %u\n", chipselect, pio);

Expand Down
7 changes: 4 additions & 3 deletions drivers/ide/atiixp.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,20 @@ static DEFINE_SPINLOCK(atiixp_lock);

/**
* atiixp_set_pio_mode - set host controller for PIO mode
* @hwif: port
* @drive: drive
* @pio: PIO mode number
*
* Set the interface PIO mode.
*/

static void atiixp_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void atiixp_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
struct pci_dev *dev = to_pci_dev(hwif->dev);
unsigned long flags;
int timing_shift = (drive->dn ^ 1) * 8;
u32 pio_timing_data;
u16 pio_mode_data;
const u8 pio = drive->pio_mode - XFER_PIO_0;

spin_lock_irqsave(&atiixp_lock, flags);

Expand Down
5 changes: 2 additions & 3 deletions drivers/ide/au1xxx-ide.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd,
}
#endif

static void au1xxx_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void au1xxx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
int mem_sttime = 0, mem_stcfg = au_readl(MEM_STCFG2);

/* set pio mode! */
switch(pio) {
switch (drive->pio_mode - XFER_PIO_0) {
case 0:
mem_sttime = SBC_IDE_TIMING(PIO0);

Expand Down
3 changes: 2 additions & 1 deletion drivers/ide/cmd640.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,10 @@ static void cmd640_set_mode(ide_drive_t *drive, unsigned int index,
program_drive_counts(drive, index);
}

static void cmd640_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cmd640_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
unsigned int index = 0, cycle_time;
const u8 pio = drive->pio_mode - XFER_PIO_0;
u8 b;

switch (pio) {
Expand Down
4 changes: 3 additions & 1 deletion drivers/ide/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ static void cmd64x_program_timings(ide_drive_t *drive, u8 mode)
* Special cases are 8: prefetch off, 9: prefetch on (both never worked)
*/

static void cmd64x_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cmd64x_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
const u8 pio = drive->pio_mode - XFER_PIO_0;

/*
* Filter out the prefetch control values
* to prevent PIO5 from being programmed
Expand Down
7 changes: 4 additions & 3 deletions drivers/ide/cs5520.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ static struct pio_clocks cs5520_pio_clocks[]={
{1, 2, 1}
};

static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cs5520_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *pdev = to_pci_dev(hwif->dev);
int controller = drive->dn > 1 ? 1 : 0;
const u8 pio = drive->pio_mode - XFER_PIO_0;

/* 8bit CAT/CRT - 8bit command timing for channel */
pci_write_config_byte(pdev, 0x62 + controller,
Expand All @@ -85,7 +85,8 @@ static void cs5520_set_dma_mode(ide_drive_t *drive, const u8 speed)
{
printk(KERN_ERR "cs55x0: bad ide timing.\n");

cs5520_set_pio_mode(drive, 0);
drive->pio_mode = XFER_PIO_0 + 0;
cs5520_set_pio_mode(drive->hwif, drive);
}

static const struct ide_port_ops cs5520_port_ops = {
Expand Down
7 changes: 4 additions & 3 deletions drivers/ide/cs5530.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ static unsigned int cs5530_pio_timings[2][5] = {

/**
* cs5530_set_pio_mode - set host controller for PIO mode
* @hwif: port
* @drive: drive
* @pio: PIO mode number
*
* Handles setting of PIO mode for the chipset.
*
* The init_hwif_cs5530() routine guarantees that all drives
* will have valid default PIO timings set up before we get here.
*/

static void cs5530_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cs5530_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
unsigned long basereg = CS5530_BASEREG(drive->hwif);
unsigned long basereg = CS5530_BASEREG(hwif);
unsigned int format = (inl(basereg + 4) >> 31) & 1;
const u8 pio = drive->pio_mode - XFER_PIO_0;

outl(cs5530_pio_timings[format][pio], basereg + ((drive->dn & 1)<<3));
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/ide/cs5535.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ static void cs5535_set_dma_mode(ide_drive_t *drive, const u8 speed)

/**
* cs5535_set_pio_mode - set host controller for PIO mode
* @hwif: port
* @drive: drive
* @pio: PIO mode number
*
* A callback from the upper layers for PIO-only tuning.
*/

static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cs5535_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
cs5535_set_speed(drive, XFER_PIO_0 + pio);
cs5535_set_speed(drive, drive->pio_mode);
}

static u8 cs5535_cable_detect(ide_hwif_t *hwif)
Expand Down
7 changes: 4 additions & 3 deletions drivers/ide/cs5536.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ static u8 cs5536_cable_detect(ide_hwif_t *hwif)

/**
* cs5536_set_pio_mode - PIO timing setup
* @hwif: ATA port
* @drive: ATA device
* @pio: PIO mode number
*/

static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cs5536_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
static const u8 drv_timings[5] = {
0x98, 0x55, 0x32, 0x21, 0x20,
Expand All @@ -143,11 +143,12 @@ static void cs5536_set_pio_mode(ide_drive_t *drive, const u8 pio)
0x99, 0x92, 0x90, 0x22, 0x20,
};

struct pci_dev *pdev = to_pci_dev(drive->hwif->dev);
struct pci_dev *pdev = to_pci_dev(hwif->dev);
ide_drive_t *pair = ide_get_pair_dev(drive);
int cshift = (drive->dn & 1) ? IDE_CAST_D1_SHIFT : IDE_CAST_D0_SHIFT;
unsigned long timings = (unsigned long)ide_get_drivedata(drive);
u32 cast;
const u8 pio = drive->pio_mode - XFER_PIO_0;
u8 cmd_pio = pio;

if (pair)
Expand Down
5 changes: 2 additions & 3 deletions drivers/ide/cy82c693.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
outb(data, CY82_DATA_PORT);
}

static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void cy82c693_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *dev = to_pci_dev(hwif->dev);
int bus_speed = ide_pci_clk ? ide_pci_clk : 33;
const unsigned long T = 1000000 / bus_speed;
Expand All @@ -101,7 +100,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
}
}

ide_timing_compute(drive, XFER_PIO_0 + pio, &t, T, 1);
ide_timing_compute(drive, drive->pio_mode, &t, T, 1);

time_16 = clamp_val(t.recover - 1, 0, 15) |
(clamp_val(t.active - 1, 0, 15) << 4);
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/dtc2278.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ static void sub22 (char b, char c)

static DEFINE_SPINLOCK(dtc2278_lock);

static void dtc2278_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void dtc2278_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
unsigned long flags;

if (pio >= 3) {
if (drive->pio_mode >= XFER_PIO_3) {
spin_lock_irqsave(&dtc2278_lock, flags);
/*
* This enables PIO mode4 (3?) on the first interface
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed)
pci_write_config_dword(dev, itr_addr, new_itr);
}

static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void hpt3xx_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
hpt3xx_set_mode(drive, XFER_PIO_0 + pio);
hpt3xx_set_mode(drive, drive->pio_mode);
}

static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
Expand Down
3 changes: 2 additions & 1 deletion drivers/ide/ht6560b.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)
#endif
}

static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void ht6560b_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
unsigned long flags, config;
const u8 pio = drive->pio_mode - XFER_PIO_0;
u8 timing;

switch (pio) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/ide/ide-devsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ static int set_pio_mode(ide_drive_t *drive, int arg)

/* take lock for IDE_DFLAG_[NO_]UNMASK/[NO_]IO_32BIT */
spin_lock_irqsave(&hwif->lock, flags);
port_ops->set_pio_mode(drive, arg);
port_ops->set_pio_mode(hwif, drive);
spin_unlock_irqrestore(&hwif->lock, flags);
} else
port_ops->set_pio_mode(drive, arg);
port_ops->set_pio_mode(hwif, drive);
} else {
int keep_dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);

Expand Down
6 changes: 3 additions & 3 deletions drivers/ide/ide-xfer-mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ int ide_set_pio_mode(ide_drive_t *drive, const u8 mode)
*/
if (port_ops->set_dma_mode == NULL) {
drive->pio_mode = mode;
port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
port_ops->set_pio_mode(hwif, drive);
return 0;
}

if (hwif->host_flags & IDE_HFLAG_POST_SET_MODE) {
if (ide_config_drive_speed(drive, mode))
return -1;
drive->pio_mode = mode;
port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
port_ops->set_pio_mode(hwif, drive);
return 0;
} else {
drive->pio_mode = mode;
port_ops->set_pio_mode(drive, mode - XFER_PIO_0);
port_ops->set_pio_mode(hwif, drive);
return ide_config_drive_speed(drive, mode);
}
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/ide/it8172.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@

#define DRV_NAME "IT8172"

static void it8172_set_pio_mode(ide_drive_t *drive, const u8 pio)
static void it8172_set_pio_mode(ide_hwif_t *hwif, ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
struct pci_dev *dev = to_pci_dev(hwif->dev);
u16 drive_enables;
u32 drive_timing;
const u8 pio = drive->pio_mode - XFER_PIO_0;

/*
* The highest value of DIOR/DIOW pulse width and recovery time
Expand Down Expand Up @@ -98,14 +98,14 @@ static void it8172_set_dma_mode(ide_drive_t *drive, const u8 speed)
pci_write_config_byte(dev, 0x4a, reg4a | u_speed);
} else {
const u8 mwdma_to_pio[] = { 0, 3, 4 };
u8 pio;

pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
pci_write_config_byte(dev, 0x4a, reg4a & ~a_speed);

pio = mwdma_to_pio[speed - XFER_MW_DMA_0];
drive->pio_mode =
mwdma_to_pio[speed - XFER_MW_DMA_0] + XFER_PIO_0;

it8172_set_pio_mode(drive, pio);
it8172_set_pio_mode(hwif, drive);
}
}

Expand Down
Loading

0 comments on commit e085b3c

Please sign in to comment.