1
2		CDU31A/CDU33A Driver Info
3		-------------------------
4
5Information on the Sony CDU31A/CDU33A CDROM driver for the Linux
6kernel.
7
8   Corey Minyard (minyard@metronet.com)
9
10   Colossians 3:17
11
12Crude 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
21This device driver handles Sony CDU31A/CDU33A CDROM drives and
22provides a complete block-level interface as well as an ioctl()
23interface as specified in include/linux/cdrom.h).  With this
24interface, CDROMs can be accessed, standard audio CDs can be played
25back normally, and CD audio information can be read off the drive.
26
27Note that this will only work for CDU31A/CDU33A drives.  Some vendors
28market their drives as CDU31A compatible.  They lie.  Their drives are
29really CDU31A hardware interface compatible (they can plug into the
30same card).  They are not software compatible.
31
32Setting Up the Hardware
33-----------------------
34
35The CDU31A driver is unable to safely tell if an interface card is
36present that it can use because the interface card does not announce
37its presence in any way besides placing 4 I/O locations in memory.  It
38used to just probe memory and attempt commands, but Linus wisely asked
39me to remove that because it could really screw up other hardware in
40the system.
41
42Because of this, you must tell the kernel where the drive interface
43is, what interrupts are used, and possibly if you are on a PAS-16
44soundcard.
45
46If you have the Sony CDU31A/CDU33A drive interface card, the following
47diagram will help you set it up.  If you have another card, you are on
48your own.  You need to make sure that the I/O address and interrupt is
49not used by another card in the system.  You will need to know the I/O
50address and interrupt you have set.  Note that use of interrupts is
51highly recommended, if possible, it really cuts down on CPU used.
52Unfortunately, most soundcards do not support interrupts for their
53CDROM interfaces.  By default, the Sony interface card comes with
54interrupts 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
102Note that if you have another interface card, you will need to look at
103the documentation to find the I/O base address.  This is specified to
104the SLCD.SYS driver for DOS with the /B: parameter, so you can look at
105you DOS driver setup to find the address, if necessary.
106
107Configuring the Kernel
108----------------------
109
110You must tell the kernel where the drive is at boot time.  This can be
111done at the Linux boot prompt, by using LILO, or by using Bootlin.
112Note that this is no substitute for HOWTOs and LILO documentation, if
113you are confused please read those for info on bootline configuration
114and LILO.
115
116At the linux boot prompt, press the ALT key and add the following line
117after the boot name (you can let the kernel boot, it will tell you the
118default boot name while booting):
119
120	cdu31a=<base address>,<interrupt>[,PAS]
121
122The base address needs to have "0x" in front of it, since it is in
123hex.  For instance, to configure a drive at address 320 on interrupt 5,
124use the following:
125
126	cdu31a=0x320,5
127
128I use the following boot line:
129
130	cdu31a=0x1f88,0,PAS
131
132because I have a PAS-16 which does not support interrupt for the
133CDU31A interface.
134
135Adding this as an append line at the beginning of the /etc/lilo.conf
136file will set it for lilo configurations.  I have the following as the
137first line in my lilo.conf file:
138
139	append="cdu31a=0x1f88,0"
140
141I'm not sure how to set up Bootlin (I have never used it), if someone
142would like to fill in this section please do.
143
144
145Configuring as a Module
146-----------------------
147
148The driver supports loading as a module.  However, you must specify
149the boot address and interrupt on the boot line to insmod.  You can't
150use modprobe to load it, since modprobe doesn't support setting
151variables.
152
153Anyway, 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
157You 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
166Driver Special Features
167-----------------------
168
169This section describes features beyond the normal audio and CD-ROM
170functions of the drive.
171
1722048 byte buffer mode
173
174If a disk is mounted with -o block=2048, data is copied straight from
175the drive data port to the buffer.  Otherwise, the readahead buffer
176must be involved to hold the other 1K of data when a 1K block
177operation is done.  Note that with 2048 byte blocks you cannot execute
178files from the CD.
179
180XA compatibility
181
182The driver should support XA disks for both the CDU31A and CDU33A.  It
183does this transparently, the using program doesn't need to set it.
184
185Multi-Session
186
187A multi-session disk looks just like a normal disk to the user.  Just
188mount one normally, and all the data should be there.  A special
189thanks to Koen for help with this!
190
191Raw sector I/O
192
193Using the CDROMREADAUDIO it is possible to read raw audio and data
194tracks.  Both operations return 2352 bytes per sector.  On the data
195tracks, the first 12 bytes is not returned by the drive and the value
196of that data is indeterminate.
197