Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | CDU31A/CDU33A Driver Info |
| 3 | ------------------------- |
| 4 | |
| 5 | Information on the Sony CDU31A/CDU33A CDROM driver for the Linux |
| 6 | kernel. |
| 7 | |
| 8 | Corey Minyard (minyard@metronet.com) |
| 9 | |
| 10 | Colossians 3:17 |
| 11 | |
| 12 | Crude Table of Contents |
| 13 | ----------------------- |
| 14 | |
| 15 | Setting Up the Hardware |
| 16 | Configuring the Kernel |
| 17 | Configuring as a Module |
| 18 | Driver Special Features |
| 19 | |
| 20 | |
| 21 | This device driver handles Sony CDU31A/CDU33A CDROM drives and |
| 22 | provides a complete block-level interface as well as an ioctl() |
| 23 | interface as specified in include/linux/cdrom.h). With this |
| 24 | interface, CDROMs can be accessed, standard audio CDs can be played |
| 25 | back normally, and CD audio information can be read off the drive. |
| 26 | |
| 27 | Note that this will only work for CDU31A/CDU33A drives. Some vendors |
| 28 | market their drives as CDU31A compatible. They lie. Their drives are |
| 29 | really CDU31A hardware interface compatible (they can plug into the |
| 30 | same card). They are not software compatible. |
| 31 | |
| 32 | Setting Up the Hardware |
| 33 | ----------------------- |
| 34 | |
| 35 | The CDU31A driver is unable to safely tell if an interface card is |
| 36 | present that it can use because the interface card does not announce |
| 37 | its presence in any way besides placing 4 I/O locations in memory. It |
| 38 | used to just probe memory and attempt commands, but Linus wisely asked |
| 39 | me to remove that because it could really screw up other hardware in |
| 40 | the system. |
| 41 | |
| 42 | Because of this, you must tell the kernel where the drive interface |
| 43 | is, what interrupts are used, and possibly if you are on a PAS-16 |
| 44 | soundcard. |
| 45 | |
| 46 | If you have the Sony CDU31A/CDU33A drive interface card, the following |
| 47 | diagram will help you set it up. If you have another card, you are on |
| 48 | your own. You need to make sure that the I/O address and interrupt is |
| 49 | not used by another card in the system. You will need to know the I/O |
| 50 | address and interrupt you have set. Note that use of interrupts is |
| 51 | highly recommended, if possible, it really cuts down on CPU used. |
| 52 | Unfortunately, most soundcards do not support interrupts for their |
| 53 | CDROM interfaces. By default, the Sony interface card comes with |
| 54 | interrupts disabled. |
| 55 | |
| 56 | +----------+-----------------+----------------------+ |
| 57 | | JP1 | 34 Pin Conn | | |
| 58 | | JP2 +-----------------+ | |
| 59 | | JP3 | |
| 60 | | JP4 | |
| 61 | | +--+ |
| 62 | | | +-+ |
| 63 | | | | | External |
| 64 | | | | | Connector |
| 65 | | | | | |
| 66 | | | +-+ |
| 67 | | +--+ |
| 68 | | | |
| 69 | | +--------+ |
| 70 | | | |
| 71 | +------------------------------------------+ |
| 72 | |
| 73 | JP1 sets the Base Address, using the following settings: |
| 74 | |
| 75 | Address Pin 1 Pin 2 |
| 76 | ------- ----- ----- |
| 77 | 0x320 Short Short |
| 78 | 0x330 Short Open |
| 79 | 0x340 Open Short |
| 80 | 0x360 Open Open |
| 81 | |
| 82 | JP2 and JP3 configure the DMA channel; they must be set the same. |
| 83 | |
| 84 | DMA Pin 1 Pin 2 Pin 3 |
| 85 | --- ----- ----- ----- |
| 86 | 1 On Off On |
| 87 | 2 Off On Off |
| 88 | 3 Off Off On |
| 89 | |
| 90 | JP4 Configures the IRQ: |
| 91 | |
| 92 | IRQ Pin 1 Pin 2 Pin 3 Pin 4 |
| 93 | --- ----- ----- ----- ----- |
| 94 | 3 Off Off On Off |
| 95 | 4 Off Off* Off On |
| 96 | 5 On Off Off Off |
| 97 | 6 Off On Off Off |
| 98 | |
| 99 | The documentation states to set this for interrupt |
| 100 | 4, but I think that is a mistake. |
| 101 | |
| 102 | Note that if you have another interface card, you will need to look at |
| 103 | the documentation to find the I/O base address. This is specified to |
| 104 | the SLCD.SYS driver for DOS with the /B: parameter, so you can look at |
| 105 | you DOS driver setup to find the address, if necessary. |
| 106 | |
| 107 | Configuring the Kernel |
| 108 | ---------------------- |
| 109 | |
| 110 | You must tell the kernel where the drive is at boot time. This can be |
| 111 | done at the Linux boot prompt, by using LILO, or by using Bootlin. |
| 112 | Note that this is no substitute for HOWTOs and LILO documentation, if |
| 113 | you are confused please read those for info on bootline configuration |
| 114 | and LILO. |
| 115 | |
| 116 | At the linux boot prompt, press the ALT key and add the following line |
| 117 | after the boot name (you can let the kernel boot, it will tell you the |
| 118 | default boot name while booting): |
| 119 | |
| 120 | cdu31a=<base address>,<interrupt>[,PAS] |
| 121 | |
| 122 | The base address needs to have "0x" in front of it, since it is in |
| 123 | hex. For instance, to configure a drive at address 320 on interrupt 5, |
| 124 | use the following: |
| 125 | |
| 126 | cdu31a=0x320,5 |
| 127 | |
| 128 | I use the following boot line: |
| 129 | |
| 130 | cdu31a=0x1f88,0,PAS |
| 131 | |
| 132 | because I have a PAS-16 which does not support interrupt for the |
| 133 | CDU31A interface. |
| 134 | |
| 135 | Adding this as an append line at the beginning of the /etc/lilo.conf |
| 136 | file will set it for lilo configurations. I have the following as the |
| 137 | first line in my lilo.conf file: |
| 138 | |
| 139 | append="cdu31a=0x1f88,0" |
| 140 | |
| 141 | I'm not sure how to set up Bootlin (I have never used it), if someone |
| 142 | would like to fill in this section please do. |
| 143 | |
| 144 | |
| 145 | Configuring as a Module |
| 146 | ----------------------- |
| 147 | |
| 148 | The driver supports loading as a module. However, you must specify |
| 149 | the boot address and interrupt on the boot line to insmod. You can't |
| 150 | use modprobe to load it, since modprobe doesn't support setting |
| 151 | variables. |
| 152 | |
| 153 | Anyway, I use the following line to load my driver as a module |
| 154 | |
| 155 | /sbin/insmod /lib/modules/`uname -r`/misc/cdu31a.o cdu31a_port=0x1f88 |
| 156 | |
| 157 | You can set the following variables in the driver: |
| 158 | |
| 159 | cdu31a_port=<I/O address> - sets the base I/O. If hex, put 0x in |
| 160 | front of it. This must be specified. |
| 161 | |
| 162 | cdu31a_irq=<interrupt> - Sets the interrupt number. Leaving this |
| 163 | off will turn interrupts off. |
| 164 | |
| 165 | |
| 166 | Driver Special Features |
| 167 | ----------------------- |
| 168 | |
| 169 | This section describes features beyond the normal audio and CD-ROM |
| 170 | functions of the drive. |
| 171 | |
| 172 | 2048 byte buffer mode |
| 173 | |
| 174 | If a disk is mounted with -o block=2048, data is copied straight from |
| 175 | the drive data port to the buffer. Otherwise, the readahead buffer |
| 176 | must be involved to hold the other 1K of data when a 1K block |
| 177 | operation is done. Note that with 2048 byte blocks you cannot execute |
| 178 | files from the CD. |
| 179 | |
| 180 | XA compatibility |
| 181 | |
| 182 | The driver should support XA disks for both the CDU31A and CDU33A. It |
| 183 | does this transparently, the using program doesn't need to set it. |
| 184 | |
| 185 | Multi-Session |
| 186 | |
| 187 | A multi-session disk looks just like a normal disk to the user. Just |
| 188 | mount one normally, and all the data should be there. A special |
| 189 | thanks to Koen for help with this! |
| 190 | |
| 191 | Raw sector I/O |
| 192 | |
| 193 | Using the CDROMREADAUDIO it is possible to read raw audio and data |
| 194 | tracks. Both operations return 2352 bytes per sector. On the data |
| 195 | tracks, the first 12 bytes is not returned by the drive and the value |
| 196 | of that data is indeterminate. |