IDE updates (part 1)
PATCH 1/1 IDE updates (part 1)
What's in:
* platform IDE host driver
(Anton Vorontsov <[email protected]>)
* hook ACPI _PSx method to IDE power on/off
(Shaohua Li <[email protected]>)
* support for ATI SB700 in combined mode
(Shane Huang <[email protected]>)
* various host driver fixes: hpt366, pdc202xx_new, jmicron, amd74xx, via82cxxx, sgiioc4, icside, ide-pmac, siimage... (Sergei, Tejun and me)
* move all mode limiting and the best PIO mode selection logic from host drivers to the core code - this greatly reduces complexity, kills some duplicated code and fixes a bunch of bugs along the way
* Kconfig facelift - as a result of this change users have three less config options to worry about (BLK_DEV_IDEPCI, BLK_DEV_IDEDMA_PCI and IDE_CHIPSETS) and can just select host drivers that they need
Please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/
to receive the following updates:
drivers/acpi/bus.c | 4 +- drivers/ide/Kconfig | 110 ++++++++++++---------- drivers/ide/arm/icside.c | 29 ++---- drivers/ide/cris/ide-cris.c | 13 +-- drivers/ide/ide-acpi.c | 42 +++++++++ drivers/ide/ide-dma.c | 48 +++++++--- drivers/ide/ide-io.c | 39 +++++++- drivers/ide/ide-iops.c | 6 - drivers/ide/ide-lib.c | 85 +++++++++++------ drivers/ide/ide-probe.c | 6 +- drivers/ide/ide.c | 20 +++- drivers/ide/legacy/Makefile | 2 + drivers/ide/legacy/ali14xx.c | 10 +-- drivers/ide/legacy/dtc2278.c | 6 +- drivers/ide/legacy/ht6560b.c | 11 +- drivers/ide/legacy/ide_platform.c | 182 +++++++++++++++++++++++++++++++++++++ drivers/ide/legacy/qd65xx.c | 60 +++++++------ drivers/ide/legacy/umc8672.c | 7 +- drivers/ide/mips/au1xxx-ide.c | 17 +--- drivers/ide/pci/aec62xx.c | 13 +-- drivers/ide/pci/alim15x3.c | 47 +++++----- drivers/ide/pci/amd74xx.c | 29 ++---- drivers/ide/pci/atiixp.c | 22 ++--- drivers/ide/pci/cmd640.c | 35 ++++---- drivers/ide/pci/cmd64x.c | 49 ++++------ drivers/ide/pci/cs5520.c | 57 ++++------- drivers/ide/pci/cs5530.c | 26 ++---- drivers/ide/pci/cs5535.c | 19 ++-- drivers/ide/pci/cy82c693.c | 20 +---- drivers/ide/pci/hpt34x.c | 10 +- drivers/ide/pci/hpt366.c | 44 +++++---- drivers/ide/pci/it8213.c | 28 ++---- drivers/ide/pci/it821x.c | 26 +---- drivers/ide/pci/jmicron.c | 81 ++++++---------- drivers/ide/pci/opti621.c | 19 ++-- drivers/ide/pci/pdc202xx_new.c | 72 ++++++++------- drivers/ide/pci/pdc202xx_old.c | 17 ++-- drivers/ide/pci/piix.c | 40 +++----- drivers/ide/pci/sc1200.c | 32 ++----- drivers/ide/pci/scc_pata.c | 19 +--- drivers/ide/pci/serverworks.c | 15 +-- drivers/ide/pci/sgiioc4.c | 88 +++++++++--------- drivers/ide/pci/siimage.c | 43 +++++---- drivers/ide/pci/sis5513.c | 51 +++++----- drivers/ide/pci/sl82c105.c | 27 +----- drivers/ide/pci/slc90e66.c | 22 +--- drivers/ide/pci/tc86c001.c | 11 +-- drivers/ide/pci/triflex.c | 12 +-- drivers/ide/pci/via82cxxx.c | 32 ++---- drivers/ide/ppc/mpc8xx.c | 21 +---- drivers/ide/ppc/pmac.c | 40 +++------ include/linux/ide.h | 34 ++++++- 52 files changed, 945 insertions(+), 853 deletions(-) create mode 100644 drivers/ide/legacy/ide_platform.c
Anton Vorontsov (1):
ide: Platform IDE driver
Bartlomiej Zolnierkiewicz (17):
ide: add missing ide_rate_filter() calls to ->speedproc()-s
ide: mode limiting fixes for user requested speed changes
sis5513: add ->udma_filter method for chipset_family >= ATA_133
ide: move ide_rate_filter() calls to the upper layer (take 2)
ide: Kconfig face-lift
ide: add ide_set{_max}_pio() (take 4)
amd74xx/via82cxxx: use ide_tune_dma()
sgiioc4: use ide_tune_dma()
icside: fix ->speedproc to return on unsupported modes (take 5)
ide-pmac: PIO mode setup fixes (take 3)
sc1200: remove redundant warning message from sc1200_tune_chipset()
cs5520: don't enable VDMA in ->speedproc
siimage: fix ->set_pio_mode method to select PIO data transfer
alim15x3: PIO mode setup fixes
it8213/piix/slc90e66: don't change DMA settings when programming PIO
sis5513: don't change UDMA settings when programming PIO
ide: use only ->set_pio_mode method for programming PIO modes (take 2)
Sergei Shtylyov (3):
hpt366: MWDMA filter for SATA cards (take 2)
pdc202xx_new: switch to using pci_get_slot() (take 2)
ide: call udma_filter() before resorting to the UltraDMA mask
Shane Huang (1):
atiixp: SB700 contains more than one IDE channel
Shaohua Li (1):
ide: hook ACPI _PSx method to IDE power on/off
Tejun Heo (1):
ide: make jmicron match vendor and device class
drivers/acpi/bus.c +3 -1
@@ -262,10 +262,12 @@ int acpi_bus_set_power(acpi_handle handle, int state) printk(KERN_WARNING PREFIX"Transitioning device [%s] to D%d\n" , device->pnp.bus_id, state); - else + else { + device->power.state = state;ACPI_DEBUG_PRINT ((ACPI_DB_INFO ,"Device [%s] transitioned to D%d\n" , device->pnp.bus_id, state)); + }return result; }
drivers/ide/Kconfig +60 -50
352 lines not on this page · raw message
drivers/ide/arm/icside.c +9 -20
@@ -248,15 +248,9 @@ static void icside_build_sglist(ide_drive_t *drive, struct request *rq)* MW1 80 50 50 150 C * MW2 70 25 25 120 C */ -static int icside_set_speed (ide_drive_t *drive,u8 xfer_mode) +static int icside_set_speed (ide_drive_t *drive,const u8 xfer_mode) { -int on =0 , cycle_time =0 , use_dma_info =0 ; - -/* -* Limit the transfer speed to MW_DMA_2. -*/ -if (xfer_mode >XFER_MW_DMA_2 ) - xfer_mode =XFER_MW_DMA_2 ; +int cycle_time, use_dma_info =0 ;switch (xfer_mode) {case XFER_MW_DMA_2 :
@@ -278,6 +272,8 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode)case XFER_SW_DMA_0 : cycle_time =480 ;break ; +default : +return 1 ; }/*
@@ -289,17 +285,10 @@ static int icside_set_speed(ide_drive_t *drive, u8 xfer_mode) drive->drive_data = cycle_time; -if (cycle_time &&ide_config_drive_speed (drive, xfer_mode) ==0 ) - on =1 ; -else - drive->drive_data =480 ; -printk ("%s: %s selected (peak %dMB/s)\n" , drive->name,ide_xfer_verbose (xfer_mode),2000 / drive->drive_data); - drive->current_speed = xfer_mode; - -return on; +return ide_config_drive_speed (drive, xfer_mode); }static void icside_dma_host_off (ide_drive_t *drive)
@@ -326,8 +315,7 @@ static int icside_dma_check(ide_drive_t *drive) {struct hd_driveid *id = drive->id;ide_hwif_t *hwif =HWIF (drive); -int xfer_mode =XFER_PIO_2 ; -int on; +int xfer_mode =0 ;if (!(id->capability &1 ) || !hwif->autodma) goto out;
@@ -356,9 +344,10 @@ static int icside_dma_check(ide_drive_t *drive) } out: - on =icside_set_speed (drive, xfer_mode); +if (xfer_mode ==0 ) +return -1 ; -return on ?0 :-1 ; +return icside_set_speed (drive, xfer_mode) ?-1 :0 ; }static int icside_dma_end (ide_drive_t *drive)
drivers/ide/cris/ide-cris.c +3 -10
@@ -680,12 +680,10 @@ static void cris_dma_off(ide_drive_t *drive) { } -static void tune_cris_ide (ide_drive_t *drive,u8 pio) +static void cris_set_pio_mode (ide_drive_t *drive,const u8 pio) {int setup, strobe, hold; - pio =ide_get_best_pio_mode (drive, pio,4 ); -switch (pio) {case 0 :
@@ -722,15 +720,10 @@ static void tune_cris_ide(ide_drive_t *drive, u8 pio) (void )ide_config_drive_speed (drive,XFER_PIO_0 + pio); } -static int speed_cris_ide (ide_drive_t *drive,u8 speed) +static int speed_cris_ide (ide_drive_t *drive,const u8 speed) {int cyc =0 , dvs =0 , strobe =0 , hold =0 ; -if (speed >=XFER_PIO_0 && speed <=XFER_PIO_4 ) { -tune_cris_ide (drive, speed -XFER_PIO_0 ); -return ide_config_drive_speed (drive, speed); - } -switch (speed) {case XFER_UDMA_0 :
@@ -797,7 +790,7 @@ init_e100_ide (void)ide_register_hw (&hw,1 , &hwif); hwif->mmio =1 ; hwif->chipset = ide_etrax100; - hwif->tuneproc = &tune_cris_ide; + hwif->set_pio_mode = &cris_set_pio_mode; hwif->speedproc = &speed_cris_ide; hwif->ata_input_data = &cris_ide_input_data; hwif->ata_output_data = &cris_ide_output_data;
drivers/ide/ide-acpi.c +42 -0
54 lines not on this page · raw message
drivers/ide/ide-dma.c +32 -16
88 lines not on this page · raw message
drivers/ide/ide-io.c +35 -4
@@ -201,8 +201,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *return do_rw_taskfile (drive, args);case idedisk_pm_restore_pio:/* Resume step 1 (restore PIO) */ -if (drive->hwif->tuneproc !=NULL ) - drive->hwif->tuneproc (drive,255 ); +ide_set_max_pio (drive);/* * skip idedisk_pm_idle for ATAPI devices */
@@ -788,6 +787,30 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)return ide_started; } +/* +* handle HDIO_SET_PIO_MODE ioctl abusers here, eventually it will go away +*/ +static int set_pio_mode_abuse (ide_hwif_t *hwif,u8 req_pio) +{ +switch (req_pio) { +case 202 : +case 201 : +case 200 : +case 102 : +case 101 : +case 100 : +return (hwif->host_flags &IDE_HFLAG_ABUSE_DMA_MODES ) ?1 :0 ; +case 9 : +case 8 : +return (hwif->host_flags &IDE_HFLAG_ABUSE_PREFETCH ) ?1 :0 ; +case 7 : +case 6 : +return (hwif->host_flags &IDE_HFLAG_ABUSE_FAST_DEVSEL ) ?1 :0 ; +default : +return 0 ; + } +} +/** * do_special - issue some special commands * @drive: drive the command is for
@@ -805,9 +828,17 @@ static ide_startstop_t do_special (ide_drive_t *drive)printk ("%s: do_special: 0x%02x\n" , drive->name, s->all);#endif if (s->b.set_tune) { +ide_hwif_t *hwif = drive->hwif; +u8 req_pio = drive->tune_req; + s->b.set_tune =0 ; -if (HWIF (drive)->tuneproc !=NULL ) -HWIF (drive)->tuneproc (drive, drive->tune_req); + +if (set_pio_mode_abuse (drive->hwif, req_pio)) { +if (hwif->set_pio_mode) + hwif->set_pio_mode (drive, req_pio); + }else +ide_set_pio (drive, req_pio); +return ide_stopped; }else {if (drive->media == ide_disk)
drivers/ide/ide-iops.c +0 -6
@@ -780,12 +780,6 @@ int ide_driveid_update (ide_drive_t *drive)/* * Similar to ide_wait_stat(), except it never calls ide_error internally. -* This is a kludge to handle the new ide_config_drive_speed() function, -* and should not otherwise be used anywhere. Eventually, the tuneproc's -* should be updated to return ide_startstop_t, in which case we can get -* rid of this abomination again. :) -ml -* -* It is gone.......... * * const char *msg == consider adding for verbose errors. */
drivers/ide/ide-lib.c +56 -29
116 lines not on this page · raw message
drivers/ide/ide-probe.c +2 -4
@@ -827,10 +827,8 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))ide_drive_t *drive = &hwif->drives[unit];if (drive->present) { -if (hwif->tuneproc !=NULL && - drive->autotune ==IDE_TUNE_AUTO ) -/* auto-tune PIO mode */ - hwif->tuneproc (drive,255 ); +if (drive->autotune ==IDE_TUNE_AUTO ) +ide_set_max_pio (drive);if (drive->autotune !=IDE_TUNE_DEFAULT && drive->autotune !=IDE_TUNE_AUTO )
drivers/ide/ide.c +16 -4
@@ -396,8 +396,9 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif) hwif->cds = tmp_hwif->cds;#endif - hwif->tuneproc = tmp_hwif->tuneproc; + hwif->set_pio_mode = tmp_hwif->set_pio_mode; hwif->speedproc = tmp_hwif->speedproc; + hwif->mdma_filter = tmp_hwif->mdma_filter; hwif->udma_filter = tmp_hwif->udma_filter; hwif->selectproc = tmp_hwif->selectproc; hwif->reset_poll = tmp_hwif->reset_poll;
@@ -866,8 +867,9 @@ int set_pio_mode(ide_drive_t *drive, int arg)if (arg <0 || arg >255 )return -EINVAL ; -if (!HWIF (drive)->tuneproc) +if (drive->hwif->set_pio_mode ==NULL )return -ENOSYS ; +if (drive->special.b.set_tune)return -EBUSY ;ide_init_drive_cmd (&rq);
@@ -914,6 +916,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)struct request rq;struct request_pm_state rqpm;ide_task_t args; +int ret;/* Call ACPI _GTM only once */ if (!(drive->dn %2 ))
@@ -930,7 +933,14 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg) mesg.event =PM_EVENT_FREEZE ; rqpm.pm_state = mesg.event; -return ide_do_drive_cmd (drive, &rq, ide_wait); + ret =ide_do_drive_cmd (drive, &rq, ide_wait); +/* only call ACPI _PS3 after both drivers are suspended */ +if (!ret && (((drive->dn %2 ) && hwif->drives[0 ].present + && hwif->drives[1 ].present) + || !hwif->drives[0 ].present + || !hwif->drives[1 ].present)) +ide_acpi_set_state (hwif,0 ); +return ret; }static int generic_ide_resume (struct device *dev)
@@ -943,8 +953,10 @@ static int generic_ide_resume(struct device *dev)int err;/* Call ACPI _STM only once */ -if (!(drive->dn %2 )) +if (!(drive->dn %2 )) { +ide_acpi_set_state (hwif,1 );ide_acpi_push_timing (hwif); + }ide_acpi_exec_tfs (drive);
drivers/ide/legacy/Makefile +2 -0
@@ -7,6 +7,8 @@ obj-$(CONFIG_BLK_DEV_UMC8672) += umc8672.o obj-$(CONFIG_BLK_DEV_IDECS) += ide-cs.o +obj-$(CONFIG_BLK_DEV_PLATFORM) += ide_platform.o + # Last of all obj-$(CONFIG_BLK_DEV_HD) += hd.o
drivers/ide/legacy/ali14xx.c +3 -7
@@ -68,8 +68,6 @@ static RegInitializer initData[] __initdata = { {0x35, 0x03}, {0x00, 0x00} }; -#define ALI_MAX_PIO 4 -/* timing parameter registers for each drive */ static struct {u8 reg1, reg2, reg3, reg4; } regTab[4 ] = { {0x03 ,0x26 ,0x04 ,0x27 },/* drive 0 */
@@ -109,7 +107,7 @@ static void outReg (u8 data, u8 reg)* This function computes timing parameters * and sets controller registers accordingly. */ -static void ali14xx_tune_drive (ide_drive_t *drive,u8 pio) +static void ali14xx_set_pio_mode (ide_drive_t *drive,const u8 pio) {int driveNum;int time1, time2;
@@ -117,8 +115,6 @@ static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)unsigned long flags;int bus_speed =system_bus_clock (); - pio =ide_get_best_pio_mode (drive, pio,ALI_MAX_PIO ); -/* calculate timing, according to PIO mode */ time1 =ide_pio_cycle_time (drive, pio); time2 = ide_pio_timings[pio].active_time;
@@ -212,12 +208,12 @@ static int __init ali14xx_probe(void) hwif->chipset = ide_ali14xx; hwif->pio_mask =ATA_PIO4 ; - hwif->tuneproc = &ali14xx_tune_drive; + hwif->set_pio_mode = &ali14xx_set_pio_mode; hwif->mate = mate; mate->chipset = ide_ali14xx; mate->pio_mask =ATA_PIO4 ; - mate->tuneproc = &ali14xx_tune_drive; + mate->set_pio_mode = &ali14xx_set_pio_mode; mate->mate = hwif; mate->channel =1 ;
drivers/ide/legacy/dtc2278.c +2 -4
@@ -67,12 +67,10 @@ static void sub22 (char b, char c) } } -static void tune_dtc2278 (ide_drive_t *drive,u8 pio) +static void dtc2278_set_pio_mode (ide_drive_t *drive,const u8 pio) {unsigned long flags; - pio =ide_get_best_pio_mode (drive, pio,4 ); -if (pio >=3 ) {spin_lock_irqsave (&ide_lock, flags);/*
@@ -124,7 +122,7 @@ static int __init dtc2278_probe(void) hwif->serialized =1 ; hwif->chipset = ide_dtc2278; hwif->pio_mask =ATA_PIO4 ; - hwif->tuneproc = &tune_dtc2278; + hwif->set_pio_mode = &dtc2278_set_pio_mode; hwif->drives[0 ].no_unmask =1 ; hwif->drives[1 ].no_unmask =1 ; hwif->mate = mate;
drivers/ide/legacy/ht6560b.c +6 -5
@@ -199,7 +199,7 @@ static int __init try_to_init_ht6560b(void)return 1 ; } -static u8 ht_pio2timings (ide_drive_t *drive,u8 pio) +static u8 ht_pio2timings (ide_drive_t *drive,const u8 pio) {int active_time, recovery_time;int active_cycles, recovery_cycles;
@@ -208,7 +208,6 @@ static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)if (pio) {unsigned int cycle_time; - pio =ide_get_best_pio_mode (drive, pio,5 ); cycle_time =ide_pio_cycle_time (drive, pio);/*
@@ -277,7 +276,7 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state)#endif } -static void tune_ht6560b (ide_drive_t *drive,u8 pio) +static void ht6560b_set_pio_mode (ide_drive_t *drive,const u8 pio) {unsigned long flags;u8 timing;
@@ -333,15 +332,17 @@ int __init ht6560b_init(void) hwif->chipset = ide_ht6560b; hwif->selectproc = &ht6560b_selectproc; + hwif->host_flags =IDE_HFLAG_ABUSE_PREFETCH ; hwif->pio_mask =ATA_PIO5 ; - hwif->tuneproc = &tune_ht6560b; + hwif->set_pio_mode = &ht6560b_set_pio_mode; hwif->serialized =1 ;/* is this needed? */ hwif->mate = mate; mate->chipset = ide_ht6560b; mate->selectproc = &ht6560b_selectproc; + mate->host_flags =IDE_HFLAG_ABUSE_PREFETCH ; mate->pio_mask =ATA_PIO5 ; - mate->tuneproc = &tune_ht6560b; + mate->set_pio_mode = &ht6560b_set_pio_mode; mate->serialized =1 ;/* is this needed? */ mate->mate = hwif; mate->channel =1 ;
drivers/ide/legacy/ide_platform.c new file +182 -0
182 lines not on this page · raw message
drivers/ide/legacy/qd65xx.c +33 -27
128 lines not on this page · raw message
drivers/ide/legacy/umc8672.c +3 -4
@@ -105,12 +105,11 @@ static void umc_set_speeds (u8 speeds[]) speeds[0], speeds[1], speeds[2], speeds[3]); } -static void tune_umc (ide_drive_t *drive,u8 pio) +static void umc_set_pio_mode (ide_drive_t *drive,const u8 pio) {unsigned long flags;ide_hwgroup_t *hwgroup = ide_hwifs[HWIF (drive)->index^1 ].hwgroup; - pio =ide_get_best_pio_mode (drive, pio,4 );printk ("%s: setting umc8672 to PIO mode%d (speed %d)\n" , drive->name, pio, pio_to_umc[pio]);spin_lock_irqsave (&ide_lock, flags);
@@ -150,12 +149,12 @@ static int __init umc8672_probe(void) hwif->chipset = ide_umc8672; hwif->pio_mask =ATA_PIO4 ; - hwif->tuneproc = &tune_umc; + hwif->set_pio_mode = &umc_set_pio_mode; hwif->mate = mate; mate->chipset = ide_umc8672; mate->pio_mask =ATA_PIO4 ; - mate->tuneproc = &tune_umc; + mate->set_pio_mode = &umc_set_pio_mode; mate->mate = hwif; mate->channel =1 ;
drivers/ide/mips/au1xxx-ide.c +3 -14
@@ -99,18 +99,12 @@ void auide_outsw(unsigned long port, void *addr, u32 count)#endif -static void auide_tune_drive (ide_drive_t *drive,byte pio) +static void au1xxx_set_pio_mode (ide_drive_t *drive,const u8 pio) {int mem_sttime;int mem_stcfg;u8 speed; -/* get the best pio mode for the drive */ - pio =ide_get_best_pio_mode (drive, pio,4 ); - -printk (KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n" , - drive->name, pio); - mem_sttime =0 ; mem_stcfg =au_readl (MEM_STCFG2 );
@@ -175,7 +169,7 @@ static void auide_tune_drive(ide_drive_t *drive, byte pio)ide_config_drive_speed (drive, speed); } -static int auide_tune_chipset (ide_drive_t *drive,u8 speed) +static int auide_tune_chipset (ide_drive_t *drive,const u8 speed) {int mem_sttime;int mem_stcfg;
@@ -183,11 +177,6 @@ static int auide_tune_chipset (ide_drive_t *drive, u8 speed) mem_sttime =0 ; mem_stcfg =au_readl (MEM_STCFG2 ); -if (speed >=XFER_PIO_0 && speed <=XFER_PIO_4 ) { -auide_tune_drive (drive, speed -XFER_PIO_0 ); -return 0 ; - } -switch (speed) {#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA case XFER_MW_DMA_2 :
@@ -712,7 +701,7 @@ static int au_ide_probe(struct device *dev) hwif->OUTSW = auide_outsw;#endif - hwif->tuneproc = &auide_tune_drive; + hwif->set_pio_mode = &au1xxx_set_pio_mode; hwif->speedproc = &auide_tune_chipset;#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
drivers/ide/pci/aec62xx.c +5 -8
@@ -87,12 +87,11 @@ static u8 pci_bus_clock_list_ultra (u8 speed, struct chipset_bus_clock_list_entrreturn chipset_table->ultra_settings; } -static int aec6210_tune_chipset (ide_drive_t *drive,u8 xferspeed) +static int aec6210_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev;u16 d_conf =0 ; -u8 speed =ide_rate_filter (drive, xferspeed);u8 ultra =0 , ultra_conf =0 ;u8 tmp0 =0 , tmp1 =0 , tmp2 =0 ;unsigned long flags;
@@ -115,11 +114,10 @@ static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed)return (ide_config_drive_speed (drive, speed)); } -static int aec6260_tune_chipset (ide_drive_t *drive,u8 xferspeed) +static int aec6260_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev; -u8 speed =ide_rate_filter (drive, xferspeed);u8 unit = (drive->select.b.unit &0x01 );u8 tmp1 =0 , tmp2 =0 ;u8 ultra =0 , drive_conf =0 , ultra_conf =0 ;
@@ -140,9 +138,8 @@ static int aec6260_tune_chipset (ide_drive_t *drive, u8 xferspeed)return (ide_config_drive_speed (drive, speed)); } -static void aec62xx_tune_drive (ide_drive_t *drive,u8 pio) +static void aec_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 ); (void )HWIF (drive)->speedproc (drive, pio +XFER_PIO_0 ); }
@@ -152,7 +149,7 @@ static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -aec62xx_tune_drive (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -203,7 +200,7 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)u8 reg54 =0 , mask = hwif->channel ?0xf0 :0x0f ;unsigned long flags; - hwif->tuneproc = &aec62xx_tune_drive; + hwif->set_pio_mode = &aec_set_pio_mode;if (dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) {if (hwif->mate)
drivers/ide/pci/alim15x3.c +22 -25
117 lines not on this page · raw message
drivers/ide/pci/amd74xx.c +9 -20
@@ -1,5 +1,5 @@/* -* Version 2.21 +* Version 2.22 * * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 * IDE driver for Linux.
@@ -234,7 +234,7 @@ static void amd_set_speed(struct pci_dev *dev, unsigned char dn, struct ide_timi* by upper layers. */ -static int amd_set_drive (ide_drive_t *drive,u8 speed) +static int amd_set_drive (ide_drive_t *drive,const u8 speed) {ide_drive_t *peer =HWIF (drive)->drives + (~drive->dn &1 );struct ide_timing t, p;
@@ -266,32 +266,21 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed) }/* -* amd74xx_tune_drive() is a callback from upper layers for -* PIO-only tuning. +* amd_set_pio_mode() is a callback from upper layers for PIO-only tuning. */ -static void amd74xx_tune_drive (ide_drive_t *drive,u8 pio) +static void amd_set_pio_mode (ide_drive_t *drive,const u8 pio) { -if (pio ==255 ) - pio =ide_get_best_pio_mode (drive,255 ,5 ); - -amd_set_drive (drive,XFER_PIO_0 +min_t (byte, pio,5 )); +amd_set_drive (drive,XFER_PIO_0 + pio); }static int amd74xx_ide_dma_check (ide_drive_t *drive) { -u8 speed =ide_max_dma_mode (drive); - -if (speed ==0 ) { -amd74xx_tune_drive (drive,255 ); -return -1 ; - } - -amd_set_drive (drive, speed); - -if (drive->autodma) +if (ide_tune_dma (drive))return 0 ; +ide_set_max_pio (drive); +return -1 ; }
@@ -409,7 +398,7 @@ static void __devinit init_hwif_amd74xx(ide_hwif_t *hwif) hwif->autodma =0 ; - hwif->tuneproc = &amd74xx_tune_drive; + hwif->set_pio_mode = &amd_set_pio_mode; hwif->speedproc = &amd_set_drive;for (i =0 ; i <2 ; i++) {
drivers/ide/pci/atiixp.c +7 -15
@@ -153,9 +153,8 @@ static void atiixp_tune_pio(ide_drive_t *drive, u8 pio)spin_unlock_irqrestore (&atiixp_lock, flags); } -static void atiixp_tuneproc (ide_drive_t *drive,u8 pio) +static void atiixp_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 );atiixp_tune_pio (drive, pio); (void )ide_config_drive_speed (drive,XFER_PIO_0 + pio); }
@@ -163,28 +162,21 @@ static void atiixp_tuneproc(ide_drive_t *drive, u8 pio)/** * atiixp_tune_chipset - tune a ATIIXP interface * @drive: IDE drive to tune -* @xferspeed: speed to configure +* @speed: speed to configure * * Set a ATIIXP interface channel to the desired speeds. This involves * requires the right timing data into the ATIIXP configuration space * then setting the drive parameters appropriately */ -static int atiixp_speedproc (ide_drive_t *drive,u8 xferspeed) +static int atiixp_speedproc (ide_drive_t *drive,const u8 speed) {struct pci_dev *dev = drive->hwif->pci_dev;unsigned long flags;int timing_shift = (drive->dn &2 ) ?16 :0 + (drive->dn &1 ) ?0 :8 ;u32 tmp32;u16 tmp16; -u8 speed, pio; - - speed =ide_rate_filter (drive, xferspeed); - -if (speed >=XFER_PIO_0 && speed <=XFER_PIO_4 ) { -atiixp_tune_pio (drive, speed -XFER_PIO_0 ); -return ide_config_drive_speed (drive, speed); - } +u8 pio;spin_lock_irqsave (&atiixp_lock, flags);
@@ -233,7 +225,7 @@ static int atiixp_dma_check(ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -atiixp_tuneproc (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -256,7 +248,7 @@ static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) hwif->irq = ch ?15 :14 ; hwif->autodma =0 ; - hwif->tuneproc = &atiixp_tuneproc; + hwif->set_pio_mode = &atiixp_set_pio_mode; hwif->speedproc = &atiixp_speedproc; hwif->drives[0 ].autotune =1 ; hwif->drives[1 ].autotune =1 ;
@@ -325,7 +317,7 @@ static struct pci_device_id atiixp_pci_tbl[] = { { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP300_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, - { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, + { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, };MODULE_DEVICE_TABLE (pci, atiixp_pci_tbl);
drivers/ide/pci/cmd640.c +17 -18
@@ -628,45 +628,40 @@ static void cmd640_set_mode (unsigned int index, u8 pio_mode, unsigned int cycleprogram_drive_counts (index); } -/* -* Drive PIO mode selection: -*/ -static void cmd640_tune_drive (ide_drive_t *drive,u8 mode_wanted) +static void cmd640_set_pio_mode (ide_drive_t *drive,const u8 pio) {unsigned int index =0 , cycle_time;u8 b;while (drive != cmd_drives[index]) {if (++index >3 ) { -printk ("%s: bad news in cmd640_tune_drive\n" , drive->name); +printk (KERN_ERR "%s: bad news in %s\n" , + drive->name, __FUNCTION__);return ; } } -switch (mode_wanted) { +switch (pio) {case 6 :/* set fast-devsel off */ case 7 :/* set fast-devsel on */ - mode_wanted &=1 ; b =get_cmd640_reg (CNTRL ) & ~0x27 ; -if (mode_wanted) +if (pio &1 ) b |=0x27 ;put_cmd640_reg (CNTRL , b); -printk ("%s: %sabled cmd640 fast host timing (devsel)\n" , drive->name, mode_wanted ?"en" :"dis" ); +printk ("%s: %sabled cmd640 fast host timing (devsel)\n" , drive->name, (pio &1 ) ?"en" :"dis" );return ;case 8 :/* set prefetch off */ case 9 :/* set prefetch on */ - mode_wanted &=1 ; -set_prefetch_mode (index, mode_wanted); -printk ("%s: %sabled cmd640 prefetch\n" , drive->name, mode_wanted ?"en" :"dis" ); +set_prefetch_mode (index, pio &1 ); +printk ("%s: %sabled cmd640 prefetch\n" , drive->name, (pio &1 ) ?"en" :"dis" );return ; } - mode_wanted =ide_get_best_pio_mode (drive, mode_wanted,5 ); - cycle_time =ide_pio_cycle_time (drive, mode_wanted); -cmd640_set_mode (index, mode_wanted, cycle_time); + cycle_time =ide_pio_cycle_time (drive, pio); +cmd640_set_mode (index, pio, cycle_time);printk ("%s: selected cmd640 PIO mode%d (%dns)" , - drive->name, mode_wanted, cycle_time); + drive->name, pio, cycle_time);display_clocks (index); }
@@ -766,8 +761,10 @@ int __init ide_probe_for_cmd640x (void) cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); cmd_hwif0->chipset = ide_cmd640;#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED + cmd_hwif0->host_flags =IDE_HFLAG_ABUSE_PREFETCH | +IDE_HFLAG_ABUSE_FAST_DEVSEL ; cmd_hwif0->pio_mask =ATA_PIO5 ; - cmd_hwif0->tuneproc = &cmd640_tune_drive; + cmd_hwif0->set_pio_mode = &cmd640_set_pio_mode;#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ /*
@@ -822,8 +819,10 @@ int __init ide_probe_for_cmd640x (void) cmd_hwif1->mate = cmd_hwif0; cmd_hwif1->channel =1 ;#ifdef CONFIG_BLK_DEV_CMD640_ENHANCED + cmd_hwif1->host_flags =IDE_HFLAG_ABUSE_PREFETCH | +IDE_HFLAG_ABUSE_FAST_DEVSEL ; cmd_hwif1->pio_mask =ATA_PIO5 ; - cmd_hwif1->tuneproc = &cmd640_tune_drive; + cmd_hwif1->set_pio_mode = &cmd640_set_pio_mode;#endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ } printk(KERN_INFO "%s: %sserialized, secondary interface %s\n", cmd_hwif1->name,
drivers/ide/pci/cmd64x.c +19 -30
134 lines not on this page · raw message
drivers/ide/pci/cs5520.c +21 -36
92 lines not on this page · raw message
drivers/ide/pci/cs5530.c +8 -18
@@ -71,19 +71,18 @@ static void cs5530_tunepio(ide_drive_t *drive, u8 pio) }/** -* cs5530_tuneproc - select/set PIO modes +* cs5530_set_pio_mode - set PIO mode +* @drive: drive +* @pio: PIO mode number * -* cs5530_tuneproc() handles selection/setting of PIO modes -* for both the chipset and drive. +* Handles setting of PIO mode for both the chipset and drive. * -* The ide_init_cs5530() routine guarantees that all drives +* The init_hwif_cs5530() routine guarantees that all drives * will have valid default PIO timings set up before we get here. */ -static void cs5530_tuneproc (ide_drive_t *drive,u8 pio)/* pio=255 means "autotune" */ +static void cs5530_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 ); -if (cs5530_set_xfer_mode (drive,XFER_PIO_0 + pio) ==0 )cs5530_tunepio (drive, pio); }
@@ -143,13 +142,11 @@ static int cs5530_config_dma(ide_drive_t *drive)return 1 ; } -static int cs5530_tune_chipset (ide_drive_t *drive,u8 mode) +static int cs5530_tune_chipset (ide_drive_t *drive,const u8 mode) {unsigned long basereg;unsigned int reg, timings =0 ; - mode =ide_rate_filter (drive, mode); -/* * Tell the drive to switch to the new mode; abort on failure. */
@@ -166,13 +163,6 @@ static int cs5530_tune_chipset(ide_drive_t *drive, u8 mode)case XFER_MW_DMA_0 : timings =0x00077771 ;break ;case XFER_MW_DMA_1 : timings =0x00012121 ;break ;case XFER_MW_DMA_2 : timings =0x00002020 ;break ; -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 : -cs5530_tunepio (drive, mode -XFER_PIO_0 ); -return 0 ;default :BUG ();break ;
@@ -308,7 +298,7 @@ static void __devinit init_hwif_cs5530 (ide_hwif_t *hwif)if (hwif->mate) hwif->serialized = hwif->mate->serialized =1 ; - hwif->tuneproc = &cs5530_tuneproc; + hwif->set_pio_mode = &cs5530_set_pio_mode; hwif->speedproc = &cs5530_tune_chipset; basereg =CS5530_BASEREG (hwif);
drivers/ide/pci/cs5535.c +9 -10
@@ -75,7 +75,7 @@ static unsigned int cs5535_udma_timings[5] =* * cs5535_set_speed() configures the chipset to a new speed. */ -static void cs5535_set_speed (ide_drive_t *drive,u8 speed) +static void cs5535_set_speed (ide_drive_t *drive,const u8 speed) {u32 reg =0 , dummy;
@@ -141,23 +141,22 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)*/ static int cs5535_set_drive (ide_drive_t *drive,u8 speed) { - speed =ide_rate_filter (drive, speed);ide_config_drive_speed (drive, speed);cs5535_set_speed (drive, speed);return 0 ; } -/**** -* cs5535_tuneproc - PIO setup -* @drive: drive to set up -* @pio: mode to use (255 for 'best possible') +/** +* cs5535_set_pio_mode - PIO setup +* @drive: drive +* @pio: PIO mode number * * A callback from the upper layers for PIO-only tuning. */ -static void cs5535_tuneproc (ide_drive_t *drive,u8 pio) + +static void cs5535_set_pio_mode (ide_drive_t *drive,const u8 pio) { - 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); }
@@ -170,7 +169,7 @@ static int cs5535_dma_check(ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -cs5535_tuneproc (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -199,7 +198,7 @@ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) hwif->autodma =0 ; - hwif->tuneproc = &cs5535_tuneproc; + hwif->set_pio_mode = &cs5535_set_pio_mode; hwif->speedproc = &cs5535_set_drive; hwif->ide_dma_check = &cs5535_dma_check;
drivers/ide/pci/cy82c693.c +2 -18
@@ -97,9 +97,6 @@#define CY82_INDEX_CHANNEL1 0x31#define CY82_INDEX_TIMEOUT 0x32 -/* the max PIO mode - from datasheet */ -#define CY82C693_MAX_PIO 4 -/* the min and max PCI bus speed in MHz - from datasheet */ #define CY82C963_MIN_BUS_SPEED 25#define CY82C963_MAX_BUS_SPEED 33
@@ -148,9 +145,6 @@ static void compute_clocks (u8 pio, pio_clocks_t *p_pclk)* so you can play with the idebus=xx parameter */ -if (pio >CY82C693_MAX_PIO ) - pio =CY82C693_MAX_PIO ; -/* let's calc the address setup time clocks */ p_pclk->address_time = (u8 )calc_clk (ide_pio_timings[pio].setup_time, bus_speed);
@@ -269,10 +263,7 @@ static int cy82c693_ide_dma_on (ide_drive_t *drive)return __ide_dma_on (drive); } -/* -* tune ide drive - set PIO mode -*/ -static void cy82c693_tune_drive (ide_drive_t *drive,u8 pio) +static void cy82c693_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev;
@@ -329,13 +320,6 @@ static void cy82c693_tune_drive (ide_drive_t *drive, u8 pio) addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);#endif /* CY82C693_DEBUG_LOGS */ -/* first let's calc the pio modes */ - pio =ide_get_best_pio_mode (drive, pio,CY82C693_MAX_PIO ); - -#if CY82C693_DEBUG_INFO -printk (KERN_INFO "%s: Selected PIO mode %d\n" , drive->name, pio); -#endif /* CY82C693_DEBUG_INFO */ -/* let's calc the values for this PIO mode */ compute_clocks (pio, &pclk);
@@ -447,7 +431,7 @@ static void __devinit init_hwif_cy82c693(ide_hwif_t *hwif) hwif->autodma =0 ; hwif->chipset = ide_cy82c693; - hwif->tuneproc = &cy82c693_tune_drive; + hwif->set_pio_mode = &cy82c693_set_pio_mode;if (!hwif->dma_base) { hwif->drives[0 ].autotune =1 ;
drivers/ide/pci/hpt34x.c +4 -6
@@ -43,10 +43,9 @@#define HPT343_DEBUG_DRIVE_INFO 0 -static int hpt34x_tune_chipset (ide_drive_t *drive,u8 xferspeed) +static int hpt34x_tune_chipset (ide_drive_t *drive,const u8 speed) {struct pci_dev *dev =HWIF (drive)->pci_dev; -u8 speed =ide_rate_filter (drive, xferspeed);u32 reg1=0 , tmp1 =0 , reg2 =0 , tmp2 =0 ;u8 hi_speed, lo_speed;
@@ -78,9 +77,8 @@ static int hpt34x_tune_chipset (ide_drive_t *drive, u8 xferspeed)return (ide_config_drive_speed (drive, speed)); } -static void hpt34x_tune_drive (ide_drive_t *drive,u8 pio) +static void hpt34x_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,5 ); (void )hpt34x_tune_chipset (drive, (XFER_PIO_0 + pio)); }
@@ -92,7 +90,7 @@ static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)return -1 ;if (ide_use_fast_pio (drive)) -hpt34x_tune_drive (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -146,7 +144,7 @@ static void __devinit init_hwif_hpt34x(ide_hwif_t *hwif) hwif->autodma =0 ; - hwif->tuneproc = &hpt34x_tune_drive; + hwif->set_pio_mode = &hpt34x_set_pio_mode; hwif->speedproc = &hpt34x_tune_chipset; hwif->drives[0 ].autotune =1 ; hwif->drives[1 ].autotune =1 ;
drivers/ide/pci/hpt366.c +26 -18
113 lines not on this page · raw message
drivers/ide/pci/it8213.c +7 -21
@@ -105,9 +105,8 @@ static void it8213_tune_pio(ide_drive_t *drive, const u8 pio)spin_unlock_irqrestore (&tune_lock, flags); } -static void it8213_tuneproc (ide_drive_t *drive,u8 pio) +static void it8213_set_pio_mode (ide_drive_t *drive,const 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); }
@@ -115,20 +114,16 @@ static void it8213_tuneproc(ide_drive_t *drive, u8 pio)/** * it8213_tune_chipset - set controller timings * @drive: Drive to set up -* @xferspeed: speed we want to achieve +* @speed: speed we want to achieve * -* Tune the ITE chipset for the desired mode. If we can't achieve -* the desired mode then tune for a lower one, but ultimately -* make the thing work. +* Tune the ITE chipset for the desired mode. */ -static int it8213_tune_chipset (ide_drive_t *drive,u8 xferspeed) +static int it8213_tune_chipset (ide_drive_t *drive,const u8 speed) { -ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev;u8 maslave =0x40 ; -u8 speed =ide_rate_filter (drive, xferspeed);int a_speed =3 << (drive->dn *4 );int u_flag =1 << drive->dn;int v_flag =0x01 << drive->dn;
@@ -156,12 +151,6 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)case XFER_MW_DMA_1 :case XFER_SW_DMA_2 :break ; -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 : -break ;default :return -1 ; }
@@ -193,10 +182,7 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)pci_write_config_byte (dev,0x55 , (u8 ) reg55 & ~w_flag); } -if (speed >XFER_PIO_4 ) -it8213_tune_pio (drive,it8213_dma_2_pio (speed)); -else -it8213_tune_pio (drive, speed -XFER_PIO_0 ); +it8213_tune_pio (drive,it8213_dma_2_pio (speed));return ide_config_drive_speed (drive, speed); }
@@ -216,7 +202,7 @@ static int it8213_config_drive_for_dma (ide_drive_t *drive)if (ide_tune_dma (drive))return 0 ; -it8213_tuneproc (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -235,7 +221,7 @@ static void __devinit init_hwif_it8213(ide_hwif_t *hwif)u8 reg42h =0 ; hwif->speedproc = &it8213_tune_chipset; - hwif->tuneproc = &it8213_tuneproc; + hwif->set_pio_mode = &it8213_set_pio_mode; hwif->autodma =0 ;
drivers/ide/pci/it821x.c +6 -20
@@ -274,9 +274,8 @@ static int it821x_tunepio(ide_drive_t *drive, u8 set_pio)return ide_config_drive_speed (drive,XFER_PIO_0 + set_pio); } -static void it821x_tuneproc (ide_drive_t *drive,u8 pio) +static void it821x_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 ); (void )it821x_tunepio (drive, pio); }
@@ -405,32 +404,19 @@ static int it821x_dma_end(ide_drive_t *drive)return ret; } -/** * it821x_tune_chipset - set controller timings * @drive: Drive to set up -* @xferspeed: speed we want to achieve +* @speed: speed we want to achieve * -* Tune the ITE chipset for the desired mode. If we can't achieve -* the desired mode then tune for a lower one, but ultimately -* make the thing work. +* Tune the ITE chipset for the desired mode. */ -static int it821x_tune_chipset (ide_drive_t *drive,byte xferspeed) +static int it821x_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif = drive->hwif;struct it821x_dev *itdev =ide_get_hwifdata (hwif); -u8 speed =ide_rate_filter (drive, xferspeed); - -switch (speed) { -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 : -return it821x_tunepio (drive, speed -XFER_PIO_0 ); - }if (itdev->smart ==0 ) {switch (speed) {
@@ -477,7 +463,7 @@ static int it821x_config_drive_for_dma (ide_drive_t *drive)if (ide_tune_dma (drive))return 0 ; -it821x_tuneproc (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -644,7 +630,7 @@ static void __devinit init_hwif_it821x(ide_hwif_t *hwif) } hwif->speedproc = &it821x_tune_chipset; - hwif->tuneproc = &it821x_tuneproc; + hwif->set_pio_mode = &it821x_set_pio_mode;/* MWDMA/PIO clock switching for pass through mode */ if (!idev->smart) {
drivers/ide/pci/jmicron.c +31 -50
128 lines not on this page · raw message
drivers/ide/pci/opti621.c +10 -9
@@ -47,7 +47,7 @@* The main problem with OPTi is that some timings for master * and slave must be the same. For example, if you have master * PIO 3 and slave PIO 0, driver have to set some timings of -* master for PIO 0. Second problem is that opti621_tune_drive +* master for PIO 0. Second problem is that opti621_set_pio_mode * got only one drive to set, but have to set both drives. * This is solved in compute_pios. If you don't set * the second drive, compute_pios use ide_get_best_pio_mode
@@ -103,7 +103,7 @@#include <asm/io.h> -#define OPTI621_MAX_PIO 3 +//#define OPTI621_MAX_PIO 3 /* In fact, I do not have any PIO 4 drive * (address: 25 ns, data: 70 ns, recovery: 35 ns), * but OPTi 82C621 is programmable and it can do (minimal values):
@@ -136,8 +136,8 @@ static int reg_base;#define PIO_NOT_EXIST 254#define PIO_DONT_KNOW 255 -/* there are stored pio numbers from other calls of opti621_tune_drive */ -static void compute_pios (ide_drive_t *drive,u8 pio) +/* there are stored pio numbers from other calls of opti621_set_pio_mode */ +static void compute_pios (ide_drive_t *drive,const u8 pio)/* Store values into drive->drive_data * second_contr - 0 for primary controller, 1 for secondary * slave_drive - 0 -> pio is for master, 1 -> pio is for slave
@@ -147,12 +147,13 @@ static void compute_pios(ide_drive_t *drive, u8 pio)int d;ide_hwif_t *hwif =HWIF (drive); - drive->drive_data =ide_get_best_pio_mode (drive, pio,OPTI621_MAX_PIO ); + drive->drive_data = pio; +for (d =0 ; d <2 ; ++d) { drive = &hwif->drives[d];if (drive->present) {if (drive->drive_data ==PIO_DONT_KNOW ) - drive->drive_data =ide_get_best_pio_mode (drive,255 ,OPTI621_MAX_PIO ); + drive->drive_data =ide_get_best_pio_mode (drive,255 ,3 );#ifdef OPTI621_DEBUG printk ("%s: Selected PIO mode %d\n" , drive->name, drive->drive_data);
@@ -240,8 +241,7 @@ static void compute_clocks(int pio, pio_clocks_t *clks) } -/* Main tune procedure, called from tuneproc. */ -static void opti621_tune_drive (ide_drive_t *drive,u8 pio) +static void opti621_set_pio_mode (ide_drive_t *drive,const u8 pio) {/* primary and secondary drives share some registers, * so we have to program both drives
@@ -331,7 +331,8 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) hwif->autodma =0 ; hwif->drives[0 ].drive_data =PIO_DONT_KNOW ; hwif->drives[1 ].drive_data =PIO_DONT_KNOW ; - hwif->tuneproc = &opti621_tune_drive; + + hwif->set_pio_mode = &opti621_set_pio_mode;if (!(hwif->dma_base))return ;
drivers/ide/pci/pdc202xx_new.c +39 -33
120 lines not on this page · raw message
drivers/ide/pci/pdc202xx_old.c +9 -8
@@ -63,12 +63,11 @@ static const char *pdc_quirk_drives[] = {static void pdc_old_disable_66MHz_clock (ide_hwif_t *); -static int pdc202xx_tune_chipset (ide_drive_t *drive,u8 xferspeed) +static int pdc202xx_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev;u8 drive_pci =0x60 + (drive->dn <<2 ); -u8 speed =ide_rate_filter (drive, xferspeed);u8 AP =0 ,BP =0 ,CP =0 ;u8 TA =0 ,TB =0 ,TC =0 ;
@@ -143,9 +142,8 @@ static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)return ide_config_drive_speed (drive, speed); } -static void pdc202xx_tune_drive (ide_drive_t *drive,u8 pio) +static void pdc202xx_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 );pdc202xx_tune_chipset (drive,XFER_PIO_0 + pio); }
@@ -191,7 +189,7 @@ static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -pdc202xx_tune_drive (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -307,10 +305,11 @@ static void pdc202xx_reset (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);ide_hwif_t *mate = hwif->mate; - +pdc202xx_reset_host (hwif);pdc202xx_reset_host (mate); -pdc202xx_tune_drive (drive,255 ); + +ide_set_max_pio (drive); } static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev,
@@ -329,7 +328,9 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif) hwif->rqsize =256 ; hwif->autodma =0 ; - hwif->tuneproc = &pdc202xx_tune_drive; + + hwif->set_pio_mode = &pdc202xx_set_pio_mode; + hwif->quirkproc = &pdc202xx_quirkproc;if (hwif->pci_dev->device !=PCI_DEVICE_ID_PROMISE_20246 )
drivers/ide/pci/piix.c +16 -24
@@ -1,5 +1,5 @@/* -* linux/drivers/ide/pci/piix.c Version 0.51 Jul 6, 2007 +* linux/drivers/ide/pci/piix.c Version 0.52 Jul 14, 2007 * * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer * Copyright (C) 1998-2000 Andre Hedrick <[email protected]>
@@ -17,11 +17,11 @@* 41 * 43 * -* | PIO 0 | c0 | 80 | 0 | piix_tune_drive(drive, 0); -* | PIO 2 | SW2 | d0 | 90 | 4 | piix_tune_drive(drive, 2); -* | PIO 3 | MW1 | e1 | a1 | 9 | piix_tune_drive(drive, 3); -* | PIO 4 | MW2 | e3 | a3 | b | piix_tune_drive(drive, 4); -* +* | PIO 0 | c0 | 80 | 0 | +* | PIO 2 | SW2 | d0 | 90 | 4 | +* | PIO 3 | MW1 | e1 | a1 | 9 | +* | PIO 4 | MW2 | e3 | a3 | b | +* * sitre = word40 & 0x4000; primary * sitre = word42 & 0x4000; secondary *
@@ -204,16 +204,16 @@ static void piix_tune_pio (ide_drive_t *drive, u8 pio) }/** -* piix_tune_drive - tune a drive attached to PIIX +* piix_set_pio_mode - set PIO mode * @drive: drive to tune * @pio: desired PIO mode * * Set the drive's PIO mode (might be useful if drive is not registered * in CMOS for any reason). */ -static void piix_tune_drive (ide_drive_t *drive,u8 pio) + +static void piix_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 );piix_tune_pio (drive, pio); (void )ide_config_drive_speed (drive,XFER_PIO_0 + pio); }
@@ -221,19 +221,18 @@ static void piix_tune_drive (ide_drive_t *drive, u8 pio)/** * piix_tune_chipset - tune a PIIX interface * @drive: IDE drive to tune -* @xferspeed: speed to configure +* @speed: speed to configure * * Set a PIIX interface channel to the desired speeds. This involves * requires the right timing data into the PIIX configuration space * then setting the drive parameters appropriately */ - -static int piix_tune_chipset (ide_drive_t *drive,u8 xferspeed) + +static int piix_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev;u8 maslave = hwif->channel ?0x42 :0x40 ; -u8 speed =ide_rate_filter (drive, xferspeed);int a_speed =3 << (drive->dn *4 );int u_flag =1 << drive->dn;int v_flag =0x01 << drive->dn;
@@ -260,11 +259,6 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)case XFER_MW_DMA_2 :case XFER_MW_DMA_1 :case XFER_SW_DMA_2 :break ; -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 :break ;default :return -1 ; }
@@ -294,10 +288,7 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)pci_write_config_byte (dev,0x55 , (u8 ) reg55 & ~w_flag); } -if (speed >XFER_PIO_4 ) -piix_tune_pio (drive,piix_dma_2_pio (speed)); -else -piix_tune_pio (drive, speed -XFER_PIO_0 ); +piix_tune_pio (drive,piix_dma_2_pio (speed));return ide_config_drive_speed (drive, speed); }
@@ -318,7 +309,7 @@ static int piix_config_drive_xfer_rate (ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -piix_tune_drive (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -455,7 +446,8 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif) } hwif->autodma =0 ; - hwif->tuneproc = &piix_tune_drive; + + hwif->set_pio_mode = &piix_set_pio_mode; hwif->speedproc = &piix_tune_chipset; hwif->drives[0 ].autotune =1 ; hwif->drives[1 ].autotune =1 ;
drivers/ide/pci/sc1200.c +9 -23
@@ -138,7 +138,7 @@ out:return mask; } -static int sc1200_tune_chipset (ide_drive_t *drive,u8 mode) +static int sc1200_tune_chipset (ide_drive_t *drive,const u8 mode) {ide_hwif_t *hwif =HWIF (drive);int unit = drive->select.b.unit;
@@ -146,25 +146,11 @@ static int sc1200_tune_chipset(ide_drive_t *drive, u8 mode)unsigned short pci_clock;unsigned int basereg = hwif->channel ?0x50 :0x40 ; - mode =ide_rate_filter (drive, mode); -/* * Tell the drive to switch to the new mode; abort on failure. */ -if (sc1200_set_xfer_mode (drive, mode)) { -printk ("SC1200: set xfer mode failure\n" ); +if (sc1200_set_xfer_mode (drive, mode))return 1 ;/* failure */ - } - -switch (mode) { -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 : -sc1200_tunepio (drive, mode -XFER_PIO_0 ); -return 0 ; - } pci_clock =sc1200_get_pci_clock ();
@@ -274,19 +260,20 @@ static int sc1200_ide_dma_end (ide_drive_t *drive) }/* -* sc1200_tuneproc() handles selection/setting of PIO modes +* sc1200_set_pio_mode() handles setting of PIO modes * for both the chipset and drive. * * All existing BIOSs for this chipset guarantee that all drives * will have valid default PIO timings set up before we get here. */ -static void sc1200_tuneproc (ide_drive_t *drive,byte pio)/* mode=255 means "autotune" */ + +static void sc1200_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif =HWIF (drive);int mode =-1 ;/* -* bad abuse of ->tuneproc interface +* bad abuse of ->set_pio_mode interface */ switch (pio) {case 200 : mode =XFER_UDMA_0 ;break ;
@@ -304,9 +291,6 @@ static void sc1200_tuneproc (ide_drive_t *drive, byte pio) /* mode=255 means "aureturn ; } - pio =ide_get_best_pio_mode (drive, pio,4 ); -printk ("SC1200: %s: setting PIO mode%d\n" , drive->name, pio); -if (sc1200_set_xfer_mode (drive,XFER_PIO_0 + pio) ==0 )sc1200_tunepio (drive, pio); }
@@ -422,7 +406,8 @@ static void __devinit init_hwif_sc1200 (ide_hwif_t *hwif) hwif->ide_dma_end = &sc1200_ide_dma_end;if (!noautodma) hwif->autodma =1 ; - hwif->tuneproc = &sc1200_tuneproc; + + hwif->set_pio_mode = &sc1200_set_pio_mode; hwif->speedproc = &sc1200_tune_chipset; } hwif->atapi_dma =1 ;
@@ -438,6 +423,7 @@ static ide_pci_device_t sc1200_chipset __devinitdata = { .init_hwif = init_hwif_sc1200, .autodma = AUTODMA, .bootable = ON_BOARD, + .host_flags = IDE_HFLAG_ABUSE_DMA_MODES, .pio_mask = ATA_PIO4, };
drivers/ide/pci/scc_pata.c +5 -14
@@ -221,9 +221,8 @@ static void scc_tune_pio(ide_drive_t *drive, const u8 pio)out_be32 ((void __iomem *)pioct_port, reg); } -static void scc_tuneproc (ide_drive_t *drive,u8 pio) +static void scc_set_pio_mode (ide_drive_t *drive,const u8 pio) { - pio =ide_get_best_pio_mode (drive, pio,4 );scc_tune_pio (drive, pio);ide_config_drive_speed (drive,XFER_PIO_0 + pio); }
@@ -231,16 +230,15 @@ static void scc_tuneproc(ide_drive_t *drive, u8 pio)/** * scc_tune_chipset - tune a drive DMA mode * @drive: Drive to set up -* @xferspeed: speed we want to achieve +* @speed: speed we want to achieve * * Load the timing settings for this device mode into the * controller. */ -static int scc_tune_chipset (ide_drive_t *drive,byte xferspeed) +static int scc_tune_chipset (ide_drive_t *drive,const u8 speed) {ide_hwif_t *hwif =HWIF (drive); -u8 speed =ide_rate_filter (drive, xferspeed);struct scc_ports *ports =ide_get_hwifdata (hwif);unsigned long ctl_base = ports->ctl;unsigned long cckctrl_port = ctl_base +0xff0 ;
@@ -272,13 +270,6 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)case XFER_UDMA_0 : idx = speed -XFER_UDMA_0 ;break ; -case XFER_PIO_4 : -case XFER_PIO_3 : -case XFER_PIO_2 : -case XFER_PIO_1 : -case XFER_PIO_0 : -scc_tune_pio (drive, speed -XFER_PIO_0 ); -return ide_config_drive_speed (drive, speed);default :return 1 ; }
@@ -317,7 +308,7 @@ static int scc_config_drive_for_dma(ide_drive_t *drive)return 0 ;if (ide_use_fast_pio (drive)) -scc_tuneproc (drive,255 ); +ide_set_max_pio (drive);return -1 ; }
@@ -718,7 +709,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) hwif->dma_setup = scc_dma_setup; hwif->ide_dma_end = scc_ide_dma_end; hwif->speedproc = scc_tune_chipset; - hwif->tuneproc = scc_tuneproc; + hwif->set_pio_mode = scc_set_pio_mode; hwif->ide_dma_check = scc_config_drive_for_dma; hwif->ide_dma_test_irq = scc_dma_test_irq; hwif->udma_filter = scc_udma_filter;
drivers/ide/pci/serverworks.c +4 -11
@@ -145,7 +145,7 @@ static void svwks_tune_pio(ide_drive_t *drive, const u8 pio) } } -static int svwks_tune_chipset (ide_drive_t *drive,u8 xferspeed)
Lines of this file are not shown. View the raw message.
drivers/ide/pci/sgiioc4.c +44 -44
88 lines not on this page · raw message
drivers/ide/pci/siimage.c +23 -20
43 lines not on this page · raw message
drivers/ide/pci/sis5513.c +25 -26
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 3 lines · Bartlomiej Zolnierkiewicz
*
Kconfigfacelift - as a result of this change users have three less config options to worry about (BLK_DEV_IDEPCI,BLK_DEV_IDEDMA_PCIandIDE_CHIPSETS) and can just select host drivers that they need
Well, it depends on how you look at it. If you have PCI, an on-board IDE
interface and do not want any PCI IDE controllers, then you now have a zillion of options to disable instead of just one. Have a look at "arch/mips/configs/sb1250-swarm_defconfig" for an example (hmm..., CONFIG_BLK_DEV_IDE_SWARM disabled by default -- that should probably be changed; I'll cook a patch). I guess it is not possible to make everyone happy at once though, so please do not treat it as a hard objection. :-)
Maciej
Quoted 10 lines · Maciej W. Rozycki
Quoted 3 lines · Bartlomiej Zolnierkiewicz
*
Kconfigfacelift - as a result of this change users have three less config options to worry about (BLK_DEV_IDEPCI,BLK_DEV_IDEDMA_PCIandIDE_CHIPSETS) and can just select host drivers that they needWell, it depends on how you look at it. If you have PCI, an on-board IDE
interface and do not want any PCI IDE controllers, then you now have a zillion of options to disable instead of just one. Have a look at "arch/mips/configs/sb1250-swarm_defconfig" for an example (hmm...,
I see, having suddenly zillion options to go through and disable may be problem. Fortunately not in this particular case because none of IDE PCI host drivers is enabled by default in drivers/ide/Kconfig.
To be sure I've just checked it with:
ARCH=mips make sb1250-swarm_defconfig menuconfig
and it looks fine (all IDE PCI host drivers are disabled).
However big thanks for raising this point. I was unaware of such side-effect while working on the above change but from now on I'll keep this in mind. :)
Quoted 3 lines
CONFIG_BLK_DEV_IDE_SWARMdisabled by default -- that should probably be changed; I'll cook a patch). I guess it is not possible to make everyone happy at once though, so please do not treat it as a hard objection. :-)
Hmm, it also seems that CONFIG_IDE_GENERIC=y may be removed now because IDE SWARM host driver does the probing itself?
Thanks,
Bart
Quoted 6 lines · Bartlomiej Zolnierkiewicz
Quoted 3 lines
CONFIG_BLK_DEV_IDE_SWARMdisabled by default -- that should probably be changed; I'll cook a patch). I guess it is not possible to make everyone happy at once though, so please do not treat it as a hard objection. :-)Hmm, it also seems that
CONFIG_IDE_GENERIC=ymay be removed now because IDE SWARM host driver does the probing itself?
I do not think it should have relied on it in any way or otherwise
"select" should have been used. I recall confusion around this driver and even recently some breakage happened as a result of some fiddling with include/asm-mips/mach-generic/ide.h and the fact this platform is legacy-free -- there is nothing decoding subtractively on the PCI bus (no south bridge of any kind) and blind pokes at presumed ISA addresses result in bus error exceptions.
I'll have a look at it in due course.
Maciej