mxser: introduce mxser_16550A_or_MUST helper
[linux-block.git] / Documentation / driver-api / serial / moxa-smartio.rst
CommitLineData
f1374017
MCC
1=============================================================
2MOXA Smartio/Industio Family Device Driver Installation Guide
3=============================================================
4
5.. note::
6
7 This file is outdated. It needs some care in order to make it
8 updated to Kernel 5.0 and upper
9
10Copyright (C) 2008, Moxa Inc.
11
12Date: 01/21/2008
13
14.. Content
15
16 1. Introduction
17 2. System Requirement
18 3. Installation
19 3.1 Hardware installation
20 3.2 Driver files
21 3.3 Device naming convention
22 3.4 Module driver configuration
23 3.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x.
24 3.6 Custom configuration
25 3.7 Verify driver installation
26 4. Utilities
27 5. Setserial
28 6. Troubleshooting
29
301. Introduction
31^^^^^^^^^^^^^^^
32
33 The Smartio/Industio/UPCI family Linux driver supports following multiport
34 boards.
35
36 - 2 ports multiport board
37 CP-102U, CP-102UL, CP-102UF
38 CP-132U-I, CP-132UL,
39 CP-132, CP-132I, CP132S, CP-132IS,
29134367 40 (CP-102, CP-102S)
f1374017
MCC
41
42 - 4 ports multiport board
43 CP-104EL,
44 CP-104UL, CP-104JU,
45 CP-134U, CP-134U-I,
46 C104H/PCI, C104HS/PCI,
47 CP-114, CP-114I, CP-114S, CP-114IS, CP-114UL,
29134367 48 (C114HI, CT-114I),
f1374017
MCC
49 POS-104UL,
50 CB-114,
51 CB-134I
52
53 - 8 ports multiport board
54 CP-118EL, CP-168EL,
55 CP-118U, CP-168U,
56 C168H/PCI,
f1374017
MCC
57 CB-108
58
59 This driver and installation procedure have been developed upon Linux Kernel
60 2.4.x and 2.6.x. This driver supports Intel x86 hardware platform. In order
61 to maintain compatibility, this version has also been properly tested with
62 RedHat, Mandrake, Fedora and S.u.S.E Linux. However, if compatibility problem
63 occurs, please contact Moxa at support@moxa.com.tw.
64
65 In addition to device driver, useful utilities are also provided in this
66 version. They are:
67
68 - msdiag
69 Diagnostic program for displaying installed Moxa
70 Smartio/Industio boards.
71 - msmon
72 Monitor program to observe data count and line status signals.
73 - msterm A simple terminal program which is useful in testing serial
74 ports.
f1374017
MCC
75
76 All the drivers and utilities are published in form of source code under
77 GNU General Public License in this version. Please refer to GNU General
78 Public License announcement in each source code file for more detail.
79
80 In Moxa's Web sites, you may always find latest driver at http://www.moxa.com/.
81
82 This version of driver can be installed as Loadable Module (Module driver)
83 or built-in into kernel (Static driver). You may refer to following
84 installation procedure for suitable one. Before you install the driver,
85 please refer to hardware installation procedure in the User's Manual.
86
87 We assume the user should be familiar with following documents.
88
89 - Serial-HOWTO
90 - Kernel-HOWTO
91
922. System Requirement
93^^^^^^^^^^^^^^^^^^^^^
94
95 - Hardware platform: Intel x86 machine
96 - Kernel version: 2.4.x or 2.6.x
97 - gcc version 2.72 or later
98 - Maximum 4 boards can be installed in combination
99
1003. Installation
101^^^^^^^^^^^^^^^
102
1033.1 Hardware installation
104=========================
105
f1374017
MCC
106PCI/UPCI board
107--------------
108
109 You may need to adjust IRQ usage in BIOS to avoid from IRQ conflict
110 with other ISA devices. Please refer to hardware installation
111 procedure in User's Manual in advance.
112
113PCI IRQ Sharing
114---------------
115
116 Each port within the same multiport board shares the same IRQ. Up to
117 4 Moxa Smartio/Industio PCI Family multiport boards can be installed
118 together on one system and they can share the same IRQ.
119
120
1213.2 Driver files
122================
123
124 The driver file may be obtained from ftp, CD-ROM or floppy disk. The
125 first step, anyway, is to copy driver file "mxser.tgz" into specified
126 directory. e.g. /moxa. The execute commands as below::
127
128 # cd /
129 # mkdir moxa
130 # cd /moxa
131 # tar xvf /dev/fd0
132
133or::
134
135 # cd /
136 # mkdir moxa
137 # cd /moxa
138 # cp /mnt/cdrom/<driver directory>/mxser.tgz .
139 # tar xvfz mxser.tgz
140
141
1423.3 Device naming convention
143============================
144
145 You may find all the driver and utilities files in /moxa/mxser.
146 Following installation procedure depends on the model you'd like to
147 run the driver. If you prefer module driver, please refer to 3.4.
148 If static driver is required, please refer to 3.5.
149
150Dialin and callout port
151-----------------------
152
153 This driver remains traditional serial device properties. There are
154 two special file name for each serial port. One is dial-in port
155 which is named "ttyMxx". For callout port, the naming convention
156 is "cumxx".
157
158Device naming when more than 2 boards installed
159-----------------------------------------------
160
161 Naming convention for each Smartio/Industio multiport board is
162 pre-defined as below.
163
164 ============ =============== ==============
165 Board Num. Dial-in Port Callout port
166 1st board ttyM0 - ttyM7 cum0 - cum7
167 2nd board ttyM8 - ttyM15 cum8 - cum15
168 3rd board ttyM16 - ttyM23 cum16 - cum23
169 4th board ttyM24 - ttym31 cum24 - cum31
170 ============ =============== ==============
171
172.. note::
173
174 Under Kernel 2.6 and upper, the cum Device is Obsolete. So use ttyM*
175 device instead.
176
f1374017
MCC
1773.4 Module driver configuration
178===============================
179
180 Module driver is easiest way to install. If you prefer static driver
181 installation, please skip this paragraph.
182
183
184 ------------- Prepare to use the MOXA driver --------------------
185
1863.4.1 Create tty device with correct major number
187-------------------------------------------------
188
189 Before using MOXA driver, your system must have the tty devices
190 which are created with driver's major number. We offer one shell
191 script "msmknod" to simplify the procedure.
192 This step is only needed to be executed once. But you still
193 need to do this procedure when:
194
195 a. You change the driver's major number. Please refer the "3.7"
196 section.
197 b. Your total installed MOXA boards number is changed. Maybe you
198 add/delete one MOXA board.
199 c. You want to change the tty name. This needs to modify the
200 shell script "msmknod"
201
202 The procedure is::
203
204 # cd /moxa/mxser/driver
205 # ./msmknod
206
207 This shell script will require the major number for dial-in
208 device and callout device to create tty device. You also need
209 to specify the total installed MOXA board number. Default major
210 numbers for dial-in device and callout device are 30, 35. If
211 you need to change to other number, please refer section "3.7"
212 for more detailed procedure.
213 Msmknod will delete any special files occupying the same device
214 naming.
215
2163.4.2 Build the MOXA driver and utilities
217-----------------------------------------
218
219 Before using the MOXA driver and utilities, you need compile the
220 all the source code. This step is only need to be executed once.
221 But you still re-compile the source code if you modify the source
222 code. For example, if you change the driver's major number (see
223 "3.7" section), then you need to do this step again.
224
225 Find "Makefile" in /moxa/mxser, then run
226
227 # make clean; make install
228
229 ..note::
230
231 For Red Hat 9, Red Hat Enterprise Linux AS3/ES3/WS3 & Fedora Core1:
232 # make clean; make installsp1
233
234 For Red Hat Enterprise Linux AS4/ES4/WS4:
235 # make clean; make installsp2
236
237 The driver files "mxser.o" and utilities will be properly compiled
238 and copied to system directories respectively.
239
240------------- Load MOXA driver--------------------
241
2423.4.3 Load the MOXA driver
243--------------------------
244
245 ::
246
29134367 247 # modprobe mxser
f1374017
MCC
248
249 will activate the module driver. You may run "lsmod" to check
29134367 250 if "mxser" is activated.
f1374017
MCC
251
252------------- Load MOXA driver on boot --------------------
253
2543.4.4 Load the mxser driver
255---------------------------
256
257
258 For the above description, you may manually execute
259 "modprobe mxser" to activate this driver and run
260 "rmmod mxser" to remove it.
261
262 However, it's better to have a boot time configuration to
263 eliminate manual operation. Boot time configuration can be
264 achieved by rc file. We offer one "rc.mxser" file to simplify
265 the procedure under "moxa/mxser/driver".
266
f1374017
MCC
267 Run following command for setting rc files::
268
269 # cd /moxa/mxser/driver
270 # cp ./rc.mxser /etc/rc.d
271 # cd /etc/rc.d
272
273 Check "rc.serial" is existed or not. If "rc.serial" doesn't exist,
274 create it by vi, run "chmod 755 rc.serial" to change the permission.
275
276 Add "/etc/rc.d/rc.mxser" in last line.
277
278 Reboot and check if moxa.o activated by "lsmod" command.
279
f1374017
MCC
2803.5 Static driver configuration for Linux kernel 2.4.x and 2.6.x
281================================================================
282
283 Note:
284 To use static driver, you must install the linux kernel
285 source package.
286
2873.5.1 Backup the built-in driver in the kernel
288----------------------------------------------
289
290 ::
291
292 # cd /usr/src/linux/drivers/char
293 # mv mxser.c mxser.c.old
294
295 For Red Hat 7.x user, you need to create link:
296 # cd /usr/src
297 # ln -s linux-2.4 linux
298
2993.5.2 Create link
300-----------------
301 ::
302
303 # cd /usr/src/linux/drivers/char
304 # ln -s /moxa/mxser/driver/mxser.c mxser.c
305
29134367 3063.5.3 Setup kernel configuration
f1374017
MCC
307--------------------------------
308
309 Configure the kernel::
310
311 # cd /usr/src/linux
312 # make menuconfig
313
314 You will go into a menu-driven system. Please select [Character
315 devices][Non-standard serial port support], enable the [Moxa
316 SmartIO support] driver with "[*]" for built-in (not "[M]"), then
317 select [Exit] to exit this program.
318
29134367 3193.5.4 Rebuild kernel
f1374017
MCC
320--------------------
321
322 The following are for Linux kernel rebuilding, for your
323 reference only.
324
325 For appropriate details, please refer to the Linux document:
326
327 a. Run the following commands::
328
329 cd /usr/src/linux
330 make clean # take a few minutes
331 make dep # take a few minutes
332 make bzImage # take probably 10-20 minutes
333 make install # copy boot image to correct position
334
335 f. Please make sure the boot kernel (vmlinuz) is in the
336 correct position.
337 g. If you use 'lilo' utility, you should check /etc/lilo.conf
338 'image' item specified the path which is the 'vmlinuz' path,
339 or you will load wrong (or old) boot kernel image (vmlinuz).
340 After checking /etc/lilo.conf, please run "lilo".
341
342 Note that if the result of "make bzImage" is ERROR, then you have to
343 go back to Linux configuration Setup. Type "make menuconfig" in
344 directory /usr/src/linux.
345
346
29134367 3473.5.5 Make tty device and special file
f1374017
MCC
348--------------------------------------
349
350 ::
351 # cd /moxa/mxser/driver
352 # ./msmknod
353
29134367 3543.5.6 Make utility
f1374017
MCC
355------------------
356
357 ::
358
359 # cd /moxa/mxser/utility
360 # make clean; make install
361
29134367 3623.5.7 Reboot
f1374017
MCC
363------------
364
365
366
3673.6 Custom configuration
368========================
369
370 Although this driver already provides you default configuration, you
371 still can change the device name and major number. The instruction to
372 change these parameters are shown as below.
373
374a. Change Device name
375
376 If you'd like to use other device names instead of default naming
377 convention, all you have to do is to modify the internal code
378 within the shell script "msmknod". First, you have to open "msmknod"
379 by vi. Locate each line contains "ttyM" and "cum" and change them
380 to the device name you desired. "msmknod" creates the device names
381 you need next time executed.
382
383b. Change Major number
384
385 If major number 30 and 35 had been occupied, you may have to select
386 2 free major numbers for this driver. There are 3 steps to change
387 major numbers.
388
3893.6.1 Find free major numbers
390-----------------------------
391
392 In /proc/devices, you may find all the major numbers occupied
393 in the system. Please select 2 major numbers that are available.
394 e.g. 40, 45.
395
3963.6.2 Create special files
397--------------------------
398
399 Run /moxa/mxser/driver/msmknod to create special files with
400 specified major numbers.
401
4023.6.3 Modify driver with new major number
403-----------------------------------------
404
405 Run vi to open /moxa/mxser/driver/mxser.c. Locate the line
406 contains "MXSERMAJOR". Change the content as below::
407
408 #define MXSERMAJOR 40
409 #define MXSERCUMAJOR 45
410
411 3.6.4 Run "make clean; make install" in /moxa/mxser/driver.
412
4133.7 Verify driver installation
414==============================
415
416 You may refer to /var/log/messages to check the latest status
417 log reported by this driver whenever it's activated.
418
4194. Utilities
420^^^^^^^^^^^^
421
422 There are 3 utilities contained in this driver. They are msdiag, msmon and
423 msterm. These 3 utilities are released in form of source code. They should
424 be compiled into executable file and copied into /usr/bin.
425
426 Before using these utilities, please load driver (refer 3.4 & 3.5) and
427 make sure you had run the "msmknod" utility.
428
429msdiag - Diagnostic
430===================
431
432 This utility provides the function to display what Moxa Smartio/Industio
433 board found by driver in the system.
434
435msmon - Port Monitoring
436=======================
437
438 This utility gives the user a quick view about all the MOXA ports'
439 activities. One can easily learn each port's total received/transmitted
440 (Rx/Tx) character count since the time when the monitoring is started.
441
442 Rx/Tx throughputs per second are also reported in interval basis (e.g.
443 the last 5 seconds) and in average basis (since the time the monitoring
444 is started). You can reset all ports' count by <HOME> key. <+> <->
445 (plus/minus) keys to change the displaying time interval. Press <ENTER>
446 on the port, that cursor stay, to view the port's communication
447 parameters, signal status, and input/output queue.
448
449msterm - Terminal Emulation
450===========================
451
452 This utility provides data sending and receiving ability of all tty ports,
453 especially for MOXA ports. It is quite useful for testing simple
454 application, for example, sending AT command to a modem connected to the
455 port or used as a terminal for login purpose. Note that this is only a
456 dumb terminal emulation without handling full screen operation.
457
4585. Setserial
459^^^^^^^^^^^^
460
461 Supported Setserial parameters are listed as below.
462
463 ============== =========================================================
464 uart set UART type(16450-->disable FIFO, 16550A-->enable FIFO)
465 close_delay set the amount of time(in 1/100 of a second) that DTR
466 should be kept low while being closed.
467 closing_wait set the amount of time(in 1/100 of a second) that the
468 serial port should wait for data to be drained while
469 being closed, before the receiver is disable.
470 spd_hi Use 57.6kb when the application requests 38.4kb.
471 spd_vhi Use 115.2kb when the application requests 38.4kb.
472 spd_shi Use 230.4kb when the application requests 38.4kb.
473 spd_warp Use 460.8kb when the application requests 38.4kb.
474 spd_normal Use 38.4kb when the application requests 38.4kb.
475 spd_cust Use the custom divisor to set the speed when the
476 application requests 38.4kb.
477 divisor This option set the custom division.
478 baud_base This option set the base baud rate.
479 ============== =========================================================
480
4816. Troubleshooting
482^^^^^^^^^^^^^^^^^^
483
484 The boot time error messages and solutions are stated as clearly as
485 possible. If all the possible solutions fail, please contact our technical
486 support team to get more help.
487
488
489 Error msg:
490 More than 4 Moxa Smartio/Industio family boards found. Fifth board
491 and after are ignored.
492
493 Solution:
494 To avoid this problem, please unplug fifth and after board, because Moxa
495 driver supports up to 4 boards.
496
497 Error msg:
498 Request_irq fail, IRQ(?) may be conflict with another device.
499
500 Solution:
501 Other PCI or ISA devices occupy the assigned IRQ. If you are not sure
502 which device causes the situation, please check /proc/interrupts to find
503 free IRQ and simply change another free IRQ for Moxa board.
504
505 Error msg:
506 Board #: C1xx Series(CAP=xxx) interrupt number invalid.
507
508 Solution:
509 Each port within the same multiport board shares the same IRQ. Please set
510 one IRQ (IRQ doesn't equal to zero) for one Moxa board.
511
f1374017
MCC
512 Error msg:
513 Couldn't install MOXA Smartio/Industio family driver!
514
515 Solution:
516 Load Moxa driver fail, the major number may conflict with other devices.
517 Please refer to previous section 3.7 to change a free major number for
518 Moxa driver.
519
520 Error msg:
521 Couldn't install MOXA Smartio/Industio family callout driver!
522
523 Solution:
524 Load Moxa callout driver fail, the callout device major number may
525 conflict with other devices. Please refer to previous section 3.7 to
526 change a free callout device major number for Moxa driver.