root/drivers/block/dtc2278.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sub22
  2. tune_dtc2278
  3. init_dtc2278

   1 /*
   2  *  linux/drivers/block/dtc2278.c       Version 0.01  Feb 06, 1996
   3  *
   4  *  Copyright (C) 1996  Linus Torvalds & author (see below)
   5  */
   6 
   7 #undef REALLY_SLOW_IO           /* most systems can safely undef this */
   8 
   9 #include <linux/types.h>
  10 #include <linux/kernel.h>
  11 #include <linux/delay.h>
  12 #include <linux/timer.h>
  13 #include <linux/mm.h>
  14 #include <linux/ioport.h>
  15 #include <linux/blkdev.h>
  16 #include <linux/hdreg.h>
  17 #include <asm/io.h>
  18 #include "ide.h"
  19 
  20 /*
  21  * From: andy@cercle.cts.com (Dyan Wile)
  22  *
  23  * Below is a patch for DTC-2278 - alike software-programmable controllers
  24  * The code enables the secondary IDE controller and the PIO4 (3?) timings on
  25  * the primary (EIDE). You may probably have to enable the 32-bit support to
  26  * get the full speed. You better get the disk interrupts disabled ( hdparm -u0
  27  * /dev/hd.. ) for the drives connected to the EIDE interface. (I get my
  28  * filesystem  corrupted with -u1, but under heavy disk load only :-)
  29  *
  30  * From: mlord@bnr.ca -- this chipset is now forced to use the "serialize" feature,
  31  * which hopefully will make it more reliable to use.. maybe it has the same bugs
  32  * as the CMD640B and RZ1000 ??
  33  */
  34 
  35 static void sub22 (char b, char c)
     /* [previous][next][first][last][top][bottom][index][help] */
  36 {
  37         int i;
  38 
  39         for(i = 0; i < 3; ++i) {
  40                 inb(0x3f6);
  41                 outb_p(b,0xb0);
  42                 inb(0x3f6);
  43                 outb_p(c,0xb4);
  44                 inb(0x3f6);
  45                 if(inb(0xb4) == c) {
  46                         outb_p(7,0xb0);
  47                         inb(0x3f6);
  48                         return; /* success */
  49                 }
  50         }
  51 }
  52 
  53 static void tune_dtc2278 (ide_drive_t *drive, byte pio_mode)
     /* [previous][next][first][last][top][bottom][index][help] */
  54 {
  55         unsigned long flags;
  56 
  57         if (pio_mode != 255) {  /* auto-tune not yet supported here */
  58                 if (pio_mode >= 3) {
  59                         save_flags(flags);
  60                         cli();
  61                         /*
  62                          * This enables PIO mode4 (3?) on the first interface
  63                          */
  64                         sub22(1,0xc3);
  65                         sub22(0,0xa0);
  66                         restore_flags(flags);
  67                 } else {
  68                         /* we don't know how to set it back again.. */
  69                 }
  70         }
  71 }
  72 
  73 void init_dtc2278 (void)
     /* [previous][next][first][last][top][bottom][index][help] */
  74 {
  75         unsigned long flags;
  76 
  77         save_flags(flags);
  78         cli();
  79         /*
  80          * This enables the second interface
  81          */
  82         outb_p(4,0xb0);
  83         inb(0x3f6);
  84         outb_p(0x20,0xb4);
  85         inb(0x3f6);
  86         restore_flags(flags);
  87 
  88         ide_hwifs[0].serialized = 1;
  89         ide_hwifs[0].chipset = ide_dtc2278;
  90         ide_hwifs[1].chipset = ide_dtc2278;
  91         ide_hwifs[0].tuneproc = &tune_dtc2278;
  92 }

/* [previous][next][first][last][top][bottom][index][help] */