root/drivers/block/umc8672.c

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

DEFINITIONS

This source file includes following definitions.
  1. out_umc
  2. in_umc
  3. init_umc8672

   1 /*
   2  *  linux/drivers/block/umc8672.c       Version 0.01  Nov 16, 1995
   3  *
   4  *  Copyright (C) 1995  Linus Torvalds & author (see below)
   5  */
   6 
   7 /*
   8  *  Principal Author/Maintainer:  PODIEN@hml2.atlas.de (Wolfram Podien)
   9  *
  10  *  This file provides support for the advanced features
  11  *  of the UMC 8672 IDE interface.
  12  *
  13  *  Version 0.01        Initial version, hacked out of ide.c,
  14  *                      and #include'd rather than compiled separately.
  15  *                      This will get cleaned up in a subsequent release.
  16  */
  17 
  18 /*
  19  * VLB Controller Support from 
  20  * Wolfram Podien
  21  * Rohoefe 3
  22  * D28832 Achim
  23  * Germany
  24  *
  25  * To enable UMC8672 support there must a lilo line like
  26  * append="hd=umc8672"...
  27  * To set the speed according to the abilities of the hardware there must be a
  28  * line like
  29  * #define UMC_DRIVE0 11
  30  * in the beginning of the driver, which sets the speed of drive 0 to 11 (there
  31  * are some lines present). 0 - 11 are allowed speed values. These values are
  32  * the results from the DOS speed test programm supplied from UMC. 11 is the 
  33  * highest speed (about PIO mode 3)
  34  */
  35 
  36 /*
  37  * The speeds will eventually become selectable using hdparm via ioctl's,
  38  * but for now they are coded here:
  39  */
  40 #define UMC_DRIVE0      11              /* DOS messured drive Speeds */
  41 #define UMC_DRIVE1      11              /* 0 - 11 allowed */
  42 #define UMC_DRIVE2      11              /* 11 = Highest Speed */
  43 #define UMC_DRIVE3      11              /* In case of crash reduce speed */
  44 
  45 void out_umc (char port,char wert)
     /* [previous][next][first][last][top][bottom][index][help] */
  46 {
  47         outb_p (port,0x108);
  48         outb_p (wert,0x109);
  49 }
  50 
  51 byte in_umc (char port)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         outb_p (port,0x108);
  54         return inb_p (0x109);
  55 }
  56 
  57 void init_umc8672(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  58 {
  59         int i,tmp;
  60         int speed [4];
  61 /*      0    1    2    3    4    5    6    7    8    9    10   11      */
  62         char speedtab [3][12] = {
  63         {0xf ,0xb ,0x2 ,0x2 ,0x2 ,0x1 ,0x1 ,0x1 ,0x1 ,0x1 ,0x1 ,0x1 },
  64         {0x3 ,0x2 ,0x2 ,0x2 ,0x2 ,0x2 ,0x1 ,0x1 ,0x1 ,0x1 ,0x1 ,0x1 },
  65         {0xff,0xcb,0xc0,0x58,0x36,0x33,0x23,0x22,0x21,0x11,0x10,0x0}};
  66 
  67         cli ();
  68         outb_p (0x5A,0x108); /* enable umc */
  69         if (in_umc (0xd5) != 0xa0)
  70         {
  71                 sti ();
  72                 printk ("UMC8672 not found\n");
  73                 return;  
  74         }
  75         speed[0] = UMC_DRIVE0;
  76         speed[1] = UMC_DRIVE1;
  77         speed[2] = UMC_DRIVE2;
  78         speed[3] = UMC_DRIVE3;
  79         for (i = 0;i < 4;i++)
  80         {
  81                 if ((speed[i] < 0) || (speed[i] > 11))
  82                 {
  83                         sti ();
  84                         printk ("UMC 8672 drive speed out of range. Drive %d Speed %d\n",
  85                                 i, speed[i]);
  86                         printk ("UMC support aborted\n");
  87                         return; 
  88                 }
  89         }
  90         out_umc (0xd7,(speedtab[0][speed[2]] | (speedtab[0][speed[3]]<<4)));
  91         out_umc (0xd6,(speedtab[0][speed[0]] | (speedtab[0][speed[1]]<<4)));
  92         tmp = 0;
  93         for (i = 3; i >= 0; i--)
  94         {
  95                 tmp = (tmp << 2) | speedtab[1][speed[i]];
  96         }
  97         out_umc (0xdc,tmp);
  98         for (i = 0;i < 4; i++)
  99         {
 100                 out_umc (0xd0+i,speedtab[2][speed[i]]);
 101                 out_umc (0xd8+i,speedtab[2][speed[i]]);
 102         }
 103         outb_p (0xa5,0x108); /* disable umc */
 104         sti ();
 105         printk ("Speeds for UMC8672 \n");
 106         for (i = 0;i < 4;i++)
 107                  printk ("Drive %d speed %d\n",i,speed[i]);
 108 }

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