linux/drivers/ide/dtc2278.c
<<
6" 16" 16"//spav3.6"/spav class="lxr_search">6" 6" 16" 16" 1typ Search6" 16"//spav3. 1< 6"/input typ 6 1< . /div id < <1//a>/spav class="comment">/*//spav3.< <2//a>/spav class="comment"> * Copyright (C) 1996 Linus Tor ds & author (see below)//spav3.< <3//a>/spav class="comment"> *///spav3.< <4//a>6< <5//a>#include <linux/module.h//a>>6< <6//a>#include <linux/typ s.h//a>>6< <7//a>#include <linux/kernel.h//a>>6< <8//a>#include <linux/delay.h//a>>6< <9//a>#include <linux/timer.h//a>>6< a>#include <linux/mm.h//a>>6< 11 a>#include <linux/ioport.h//a>>6< 12 a>#include <linux/blkdev.h//a>>6< 13 a>#include <linux/ide.h//a>>6< 14 a>#include <linux/init.h//a>>6< 15//a>6< 16//a>#include <asm/io.h//a>>6< 17//a>6< 18//a>#defineDRV_NAME//a> /spav class="string">"dtc2278"//spav3.< 19//a>6< 20//a>/spav class="comment">/*//spav3.< 21//a>/spav class="comment"> * Changing this #undef to #define< 22//a>/spav class="comment"> *///spav3.< 23 a>#undef /a href="+code=ALWAYS_SET_DTC2278_PIO_MODE" class="sref">ALWAYS_SET_DTC2278_PIO_MODE//a>6< 24//a>6< 25//a>/spav class="comment">/*//spav3.< 26//a>/spav class="comment"> * From: andy@cercle.cts.com (Dyav Wile)//spav3.< 27//a>/spav class="comment"> *//spav3.< 28//a>/spav class="comment"> * Below is a patch for DTC-2278 - alike software-programmable controllers//spav3.< 29//a>/spav class="comment"> * The code enables the secondary IDE controller and the PIO4 (3?) timings on//spav3.< 30//a>/spav class="comment"> * the primary (EIDE). You< 31//a>/spav class="comment"> * get the full speed. You< 32//a>/spav class="comment"> * /dev/hd.. ) for the drives connected to the EIDE interface. (I get my//spav3.< 33//a>/spav class="comment"> * filesystem corrupted with -u1, but under heavy disk load only :-)//spav3.< 34//a>/spav class="comment"> *//spav3.< 35//a>/spav class="comment"> * This card is now forced to use the "serialize" feature,//spav3.< 36//a>/spav class="comment"> * and irq-unmasking is disallowed. If io_32bit is enabled,//spav3.< 37//a>/spav class="comment"> * it must< 38//a>/spav class="comment"> *//spav3.< 39//a>/spav class="comment"> * This code was written for the DTC2278E, but might work with any of these://spav3.< 40//a>/spav class="comment"> *//spav3.< 41//a>/spav class="comment"> * DTC2278S has only a single IDE interface.//spav3.< 42//a>/spav class="comment"> * DTC2278D has two IDE interfaces and is otherwise identical to the S version.//spav3.< 43//a>/spav class="comment"> * DTC2278E also has serial ports and a printer port//spav3.< 44//a>/spav class="comment"> * DTC2278EB: has onboard BIOS, and "works like a charm" -- Kent Bradford <kent@theory.caltech.edu>//spav3.< 45//a>/spav class="comment"> *//spav3.< 46//a>/spav class="comment"> * There< 47//a>/spav class="comment"> * Winbond chip, and I think the E version does also.//spav3.< 48//a>/spav class="comment"> *//spav3.< 49//a>/spav class="comment"> *///spav3.< 50//a>6< 51//a>static void /a href="+code=sub22" class="sref">sub22//a> (char /a href="+code=b" class="sref">b//a>, char /a href="+code=c" class="sref">c//a>)6< 52//a>{6< 53//a> int /a href="+code=i" class="sref">i//a>;6< 54//a>6< 55//a> for(/a href="+code=i" class="sref">i//a> = 0; /a href="+code=i" class="sref">i//a> < 3; ++/a href="+code=i" class="sref">i//a>) {6< 56//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6< 57//a> /a href="+code=outb_p" class="sref">outb_p//a>(/a href="+code=b" class="sref">b//a>,0xb0);6< 58//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6< 59//a> /a href="+code=outb_p" class="sref">outb_p//a>(/a href="+code=c" class="sref">c//a>,0xb4);6< 60//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6< 61//a> if(/a href="+code=inb" class="sref">inb//a>(0xb4) == /a href="+code=c" class="sref">c//a>) {6< 62//a> /a href="+code=outb_p" class="sref">outb_p//a>(7,0xb0);6< 63//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6< 64//a> return; /spav class="comment">/* success *///spav3.< 65//a> }.< 66//a> }.< 67//a>}.< 68//a>6< 69//a>static /a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCK//a>(/a href="+code=dtc2278_lock" class="sref">dtc2278_lock//a>);6< 70//a>6< 71//a>static void /a href="+code=dtc2278_set_pio_mode" class="sref">dtc2278_set_pio_mode//a>(/a href="+code=ide_hwif_t" class="sref">ide_hwif_t//a> */a href="+code=hwif" class="sref">hwif//a>, /a href="+code=ide_drive_t" class="sref">ide_drive_t//a> */a href="+code=drive" class="sref">drive//a>)6< 72//a>{6< 73//a> unsigned long /a href="+code=flags" class="sref">flags//a>;6< 74//a>6< 75//a> if (/a href="+code=drive" class="sref">drive//a>->/a href="+code=pio_mode" class="sref">pio_mode//a> >= /a href="+code=XFER_PIO_3" class="sref">XFER_PIO_3//a>) {6< 76//a> /a href="+code=spin_lock_irqsave" class="sref">spin_lock_irqsave//a>(&/a href="+code=dtc2278_lock" class="sref">dtc2278_lock//a>, /a href="+code=flags" class="sref">flags//a>);6< 77//a> /spav class="comment">/*//spav3.< 78//a>/spav class="comment"> * This enables PIO mode4 (3?) on>the first interface//spav3.< 79//a>/spav class="comment"> *///spav3.< 80//a> /a href="+code=sub22" class="sref">sub22//a>(1,0xc3);6< 81//a> /a href="+code=sub22" class="sref">sub22//a>(0,0xa0);6< 82//a> /a href="+code=spin_unlock_irqrestore" class="sref">spin_unlock_irqrestore//a>(&/a href="+code=dtc2278_lock" class="sref">dtc2278_lock//a>, /a href="+code=flags" class="sref">flags//a>);6< 83//a> } else {6< 84//a> /spav class="comment">/* we don't know how to set it back again.. *///spav3.< 85//a> /spav class="comment">/* Actually we do ->there is a data sheet available for the//spav3.< 86//a>/spav class="comment"> Winbond but does anyone actually care *///spav3.< 87//a> }.< 88//a>}.< 89//a>6< 90//a>static const struct /a href="+code=ide_port_ops" class="sref">ide_port_ops//a> /a href="+code=dtc2278_port_ops" class="sref">dtc2278_port_ops//a> = {6< 91//a> ./a href="+code=set_pio_mode" class="sref">set_pio_mode//a> = /a href="+code=dtc2278_set_pio_mode" class="sref">dtc2278_set_pio_mode//a>,6< 92//a>};6< 93//a>6< 94//a>static const struct /a href="+code=ide_port_info" class="sref">ide_port_info//a> /a href="+code=dtc2278_port_info" class="sref">dtc2278_port_info//a> /a href="+code=__initdata" class="sref">__initdata//a> = {6< 95//a> ./a href="+code=nam " class="sref">nam //a> = /a href="+code=DRV_NAME" class="sref">DRV_NAME//a>,6< 96//a> ./a href="+code=chipset" class="sref">chipset//a> = /a href="+code=ide_dtc2278" class="sref">ide_dtc2278//a>,6< 97//a> ./a href="+code=port_ops" class="sref">port_ops//a> = &/a href="+code=dtc2278_port_ops" class="sref">dtc2278_port_ops//a>,6< 98//a> ./a href="+code=host_flags" class="sref">host_flags//a> = /a href="+code=IDE_HFLAG_SERIALIZE" class="sref">IDE_HFLAG_SERIALIZE//a> |6< 99//a> /a href="+code=IDE_HFLAG_NO_UNMASK_IRQS" class="sref">IDE_HFLAG_NO_UNMASK_IRQS//a> |6<100//a> /a href="+code=IDE_HFLAG_IO_32BIT" class="sref">IDE_HFLAG_IO_32BIT//a> |6<101//a> /spav class="comment">/* disallow ->io_32bit changes *///spav3.<102//a> /a href="+code=IDE_HFLAG_NO_IO_32BIT" class="sref">IDE_HFLAG_NO_IO_32BIT//a> |6<103//a> /a href="+code=IDE_HFLAG_NO_DMA" class="sref">IDE_HFLAG_NO_DMA//a> |6<104//a> /a href="+code=IDE_HFLAG_DTC2278" class="sref">IDE_HFLAG_DTC2278//a>,6<105//a> ./a href="+code=pio_mask" class="sref">pio_mask//a> = /a href="+code=ATA_PIO4" class="sref">ATA_PIO4//a>,6<106//a>};6<107//a>6<108//a>static int /a href="+code=__init" class="sref">__init//a> /a href="+code=dtc2278_probe" class="sref">dtc2278_probe//a>(void)6<109//a>{6<110//a> unsigned long /a href="+code=flags" class="sref">flags//a>;6<111 a>6<112//a> /a href="+code=local_irq_save" class="sref">local_irq_save//a>(/a href="+code=flags" class="sref">flags//a>);6<113//a> /spav class="comment">/*//spav3.<114//a>/spav class="comment"> * This enables the second interface//spav3.<115//a>/spav class="comment"> *///spav3.<116//a> /a href="+code=outb_p" class="sref">outb_p//a>(4,0xb0);6<117//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6<118//a> /a href="+code=outb_p" class="sref">outb_p//a>(0x20,0xb4);6<119//a> /a href="+code=inb" class="sref">inb//a>(0x3f6);6<12 a>#ifdef /a href="+code=ALWAYS_SET_DTC2278_PIO_MODE" class="sref">ALWAYS_SET_DTC2278_PIO_MODE//a>6<121//a> /spav class="comment">/*//spav3.<122//a>/spav class="comment"> * This enables PIO mode4 (3?) on>the first interface//spav3.<123//a>/spav class="comment"> * and may solve start-up problems for some people.//spav3.<124//a>/spav class="comment"> *///spav3.<125//a> /a href="+code=sub22" class="sref">sub22//a>(1,0xc3);6<126//a> /a href="+code=sub22" class="sref">sub22//a>(0,0xa0);6<127//a>#endif6<128//a> /a href="+code=local_irq_restore" class="sref">local_irq_restore//a>(/a href="+code=flags" class="sref">flags//a>);6<129//a>6<130//a> return /a href="+code=ide_legacy_device_add" class="sref">ide_legacy_device_add//a>(&/a href="+code=dtc2278_port_info" class="sref">dtc2278_port_info//a>, 0);6<131//a>}.<132//a>.<133//a>static /a href="+code=bool" class="sref">bool//a> /a href="+code=probe_dtc2278" class="sref">probe_dtc2278//a>;6<134//a>6<135//a>/a href="+code=module_param_nam d" class="sref">module_param_nam d//a>(/a href="+code=probe" class="sref">probe//a>, /a href="+code=probe_dtc2278" class="sref">probe_dtc2278//a>, /a href="+code=bool" class="sref">bool//a>, 0);6<136//a>/a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC//a>(/a href="+code=probe" class="sref">probe//a>, /spav class="string">"probe for DTC2278xx chipsets"//spav3);6<137//a>6<138//a>static int /a href="+code=__init" class="sref">__init//a> /a href="+code=dtc2278_init" class="sref">dtc2278_init//a>(void)6<139//a>{6<140//a> if (/a href="+code=probe_dtc2278" class="sref">probe_dtc2278//a> == 0)6<141//a> return -/a href="+code=ENODEV" class="sref">ENODEV//a>;6<142//a>.<143//a> if (/a href="+code=dtc2278_probe" class="sref">dtc2278_probe//a>()) {6<144//a> /a href="+code=printk" class="sref">printk//a>(/a href="+code=KERN_ERR" class="sref">KERN_ERR//a> /spav class="string">"dtc2278: ide interfaces already in use!\n"//spav3);6<145//a> return -/a href="+code=EBUSY" class="sref">EBUSY//a>;6<146//a> }.<147//a> return 0;6<148//a>}.<149//a>6<150//a>/a href="+code=module_init" class="sref">module_init//a>(/a href="+code=dtc2278_init" class="sref">dtc2278_init//a>);6<151 a>6<152//a>/a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR//a>(/spav class="string">"See Local File"//spav3);6<153//a>/a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION//a>(/spav class="string">"support of DTC-2278 VLB IDE chipsets"//spav3);6<154//a>/a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE//a>(/spav class="string">"GPL"//spav3);6<155//a> The original LXR software by>the LXR community//a>, this experimental version by>lxr@linux.no//a>. //div3./div class="subfooter"> lxr.linux.no kindly hosted by>Redpill Linpro AS//a>, provider of Linux consulting and operations services since 1995. //div3. //body3.//html3.