This repository was archived by the owner on Dec 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Advantech ADV950 Serial Driver
License
sjlongland/adv950
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a port of the Advantech driver to modern (>=3.19) kernels. As such, it should be noted that this driver comes with absolutely no warranty. Furthermore, I have given no consideration to support for older kernels, nor has this been thoroughly tested. If it builds, consider yourself lucky. I'll be adding further notes here as I get more things working. Long term, I'd like to see this code cleaned up and merged into the standard `8250` serial driver from which it forked (a long time ago by the looks of things). Building procedures, get your kernel sources prepared (`make menuconfig`, followed by perhaps `make bzImage modules` or maybe `make modules_prepare`), then in the kernel source tree, run: ``` $ make modules M=/path/to/adv950/driver ``` With luck, you should find a `adv950.ko` file in `/path/to/adv950/driver`. Create the directory `/lib/modules/$( uname -r )/extra` and plop that `.ko` file in it, then run `depmod -a`. Fingers crossed, you should be able to `modprobe` the driver and it should work. I find the `udev` subsystem autodetects the serial device and attempts to load the driver at boot. The devices appear as `/dev/ttyAPx` device nodes, and `dmesg` looks like this: ``` Mar 5 06:31:58 vk4msl-router kernel: adv950: loading out-of-tree module taints kernel. Mar 5 06:31:58 vk4msl-router kernel: Mar 5 06:31:58 vk4msl-router kernel: =============================================================== Mar 5 06:31:58 vk4msl-router kernel: Advantech PCI-954/952/16C950 Device Drivers. V3.33 [11/07/2011] Mar 5 06:31:58 vk4msl-router kernel: Supports: RS232/422/485 auto detection and setting Mar 5 06:31:58 vk4msl-router kernel: Devices: UNO: UNO2050 [COM3/COM4] Mar 5 06:31:58 vk4msl-router kernel: UNO2059 [COM1~COM4] Mar 5 06:31:58 vk4msl-router kernel: UNOB-2201CB [COM1~COM8] Mar 5 06:31:58 vk4msl-router kernel: UNOB-2176 [COM1~COM4] Mar 5 06:31:58 vk4msl-router kernel: UNO-1150 [COM2/COM3] Mar 5 06:31:58 vk4msl-router kernel: UNO-2679 [COM3~COM6] Mar 5 06:31:58 vk4msl-router kernel: UNO-4672 [COM3~COM10] Mar 5 06:31:58 vk4msl-router kernel: ICOM: PCI-1601, PCI-1602\x0a PCI-1603, PCI-1604\x0a PCI-1610, PCI-1612\x0a PCI-1620, PCI-1622 Mar 5 06:31:58 vk4msl-router kernel: MIC: MIC-3611, MIC-3612 Mar 5 06:31:58 vk4msl-router kernel: MIC-3620, MIC-3621 Mar 5 06:31:58 vk4msl-router kernel: PCM: PCM-3614P/I, PCM-3641P/I Mar 5 06:31:58 vk4msl-router kernel: PCM-3618P/I, PCM-3681P/I Mar 5 06:31:58 vk4msl-router kernel: General: A001, A002, A004 Mar 5 06:31:58 vk4msl-router kernel: A101, A102, A104 Mar 5 06:31:58 vk4msl-router kernel: F001, F002, F004 Mar 5 06:31:58 vk4msl-router kernel: F101, F102, F104 Mar 5 06:31:58 vk4msl-router kernel: A202, A304, A408 Mar 5 06:31:58 vk4msl-router kernel: Advantech Industrial Automation Group. Mar 5 06:31:58 vk4msl-router kernel: =============================================================== Mar 5 06:31:58 vk4msl-router kernel: Serial: 8250/16550 driver, Max support 64 ports, IRQ sharing enabled Mar 5 06:31:58 vk4msl-router kernel: Advantech General COM Port Device Mar 5 06:31:58 vk4msl-router kernel: , function 0, port 0, RS232 Mar 5 06:31:58 vk4msl-router kernel: Mar 5 06:31:58 vk4msl-router kernel: ttyAP0 at I/O 0xef00 (irq = 7) is a 16C950/954 Mar 5 06:31:58 vk4msl-router kernel: Advantech General COM Port Device Mar 5 06:31:58 vk4msl-router kernel: , function 0, port 1, RS232 Mar 5 06:31:58 vk4msl-router kernel: Mar 5 06:31:58 vk4msl-router kernel: ttyAP1 at I/O 0xee00 (irq = 7) is a 16C950/954 ``` Status as of 2017-03-05: The driver loads, device nodes appear, but not much else. -- Stuart Longland <[email protected]> The original README is below. ----------------------------------------------------------------------------- ============================================================================= ADVANTECH industrial comunication cards device driver Installation Guide for Linux Kernel 2.4.x,2.6.x,3.x Copyright (C) 2011, Advantech eAutomation Division. ============================================================================= This README file describes the HOW-TOs of driver installation. 1. Change Logs Version 3.00 <2004-11-29> - Moved code from 2.4.x Version 3.01 <2004-12-02> - Fixed UNO-2050 function 1 offset typing error Version 3.02 <2004-12-03> - Support FC3 Version 3.03 <2004-12-15> - Support UART types can be specified by each port to support some kind of devices did not fully implement with auto detection Version 3.04 <2004-12-30> - Support serial port ioctl TIOCGSERIAL to get serial port jumper setting and store at reserved_char[0]. If value is zero, that means jumper switch to RS232. Otherwise, it would be RS422/485. struct serial_struct serinfo; // get serial port information serinfo.reserved_char[0] = 0; if (ioctl(fd, TIOCGSERIAL, &serinfo) < 0) { perror("Cannot get serial info"); close(fd); return; } // get serial port type configuration if (serinfo.reserved_char[0] == 0) { // RS232 } else { // RS422/485 } Version 3.05 <2005-2-17> - Porting serial driver to 2.4 kernel - Enhance 2.4 and 2.6 serial drivers, Makefile and script file Version 3.06 <2005-4-25> - Remove the folder of 'pclterm' from the package - Test in SuSE 9.2, Mandrake 10.1 and Debian 3.0r2 Version 3.07 <2005-5-31> - Add ICOM cards support PCI-1601A/B/AU/BU, PCI-1602A/B/AU/BU/UP, PCI-1603, PCI-1604UP and PCI-1622CU Version 3.08 <2005-6-14> - Correct PCI-952 2nd port start base address(BAR1) Version 3.09 <2005-6-22> - Fix 2.4 driver which did not set auto DTR correctly Version 3.10 <2005-6-24> - Add code to setup auto DTR after detection Version 3.11 <2005-6-29> - Fix PCI-1622 ports on function 1 detection problem Version 3.12 <2005-7-22> - Add support for UNOB-2201CB carrier board - Add MIC-3612 and MIC-3620 to 2.6 pci_serial_quirks table - Change the value of UART_NR to 64 in the driver for 2.6 kernel Version 3.13 <2005-8-9> - Fix UNOB-2201CB ports on function 1 detection problem Version 3.14 <2005-11-07> - Add support for MIC-3611 Version 3.15 <2006-2-16> - Add support for Mandriva Linux 2006 Version 3.16 <2006-2-16> - Change the SERIAL_NAME to support devfs. Version 3.17 <2006-5-24> - Add support for Debian 3.1r0a (kernel version 2.6.8-2-686) Version 3.18 <2006-6-8> - Add support for SuSE LINUX 10.1 and Fedora Core 5 Verson 3.19 <2006-11-10> -Add support for UNO-2176 Version 3.20 <2007-03-06> - Fix bug in low active type for 485 mode(kernel 2.6) - Support Ubuntu 6.06(add UBUNTU_2_6_15) and RedHat Enterprise Server 4(kernel 2.6) - Support quick response(use setserial to change uart type) - Enable 16C950 trigger level and hardware and software flow control Version 3.21 <2007-05-21> - Add support for PCM-3614P PCM-3618P PCM-3681P PCM-3641P Version 3.22 <2007-09-14> - Support FC6 Version 3.23 <2007-09-30> - Fix the bug in serial8250_get_mctrl Version 3.24 <2007-12-06> - Fix software flow control in 2.4 kernel version for MIC-3612 Version 3.25 <2007-12-06> - Fix bug about flow control in 2.6 kernel - Fix bug about change_speed in 2.4 kernel Version 3.26 <2008-07-07> - to support FC7 and FC8 - to support UNO-1150 - to support MIC-3621 - to support ubuntu 8.04 Version 3.27 <2008-10-08> - Source headers comply with GPL - modify the driver readme Version 3.28 <2008-12-08> - to support UNO-2679, UNO-4672 Version 3.29 <2009-06-03> - to support debian 5.0 - to support patch CONFIG_PREEMPT_RT in kernel - to support A001 A002 A004 A101 A102 A104 devices - to support F001 F002 F004 F101 F102 F104 deivces Version 3.30 <2010-05-06> - to support FC10,FC11,FC12,SUSE 11.2 Madriva 2010 - to support Advantech General COM port Version 3.31 <2010-08-11> - updata to support kernel-2.6.32 and kernel-2.6.33 - to support ubuntu 10.04 and Fedora core 13 Version 3.32 <2010-08-11> - updata to support redhat 7.2 - fix bug for general COM port information - add support Fedora 14 - fix bug about stty Version 3.33 <2010-11-07> - support 2.6.37,2.6.38,2.6.39 and 3.x kernel - support PCIe-1620 2. Test environment +--------------------------+-------------------------+ | Distribution | kernel version | +--------------------------+-------------------------+ | Red Hat 7.2 | 2.4.7-10 | | Red Hat 9 | 2.4.20-8 | | RedHat Enterprise 4 | 2.6.9-34.EL | | Redhat Enterprise 5.4 | 2.6.18-164.el5 | | Fedora Core 6 | 2.6.18-1.2798.fc6 | | Fedora Core 8 | 2.6.23.1-42.fc8 | | Fedora Core 9 | 2.6.25-14.fc9 | | Fedora Core 10 | 2.6.27.5-117.fc10 | | Fedora Core 11 | 2.6.29.4-167.fc11 | | Fedora Core 12 | 2.6.31.5-127.fc12 | | Fedora Core 13 | 2.6.33.3-85.fc13 | | Fedora Core 14 | 2.6.35.6-45.fc14 | | Fedora Core 15 | 2.6.38/2.6.40 | | SUSE 10.1 | 2.6.16.13-4-default | | SUSE 10.3 | 2.6.22.5-31-default | | SUSE 11.2 | 2.6.31.5-0.1-desktop | | SUSE 11.4 | 2.6.37 | | Mandriva 2010 | 2.6.31.5-desktop-1mnb | | Debian 5.0.4 | 2.6.26-2-686 | | Debian 6.0.2 | 2.6.32 | | Ubuntu 8.04 | 2.6.24-19-generic | | ubuntu 9.04 | 2.6.28-11-generic | | Ubuntu 9.10 | 2.6.31-14-generic | | Ubuntu 10.04 | 2.6.32-21-generic | | Ubuntu 11.10 | 3.0.2 | +--------------------------+-------------------------+ 3. Installation 3.1. Login as 'root' before executing the following instructions. 3.2. Uncompress the driver # tar zxvf adv950_vM_NN.tar.gz 3.3. Build the driver a. Build driver for 2.4 kernel # cd adv950_vM_NN/2.4 # make b. Build driver for 2.6 kernel # cd adv950_vM_NN/2.6 # make Note: To compile the source code, you must install kernel development header file package,"gcc" and "make" command. In 2.4 kernel version, you should use "ln" command to make a link named "linux-2.4" in /usr/src/, it link to you kernel development header installed folder. 3.4. Install the driver module # make install to see whether ttyAP0~ttyAP7 exist in /dev/ folder, if not,please execute the following command, # make node 3.5. Test driver and get serial port type configuration # make test 3.6. If you want the Linux bring up module at each boot, please follow the steps showing below a. Build driver b. For 2.4 kernel, add "insmod /YOURLOCATION/adv950_vM_NN/2.4/adv950.o" to to boot up shell script. c. For 2.6 kernel, add "insmod /YOURLOCATION/adv950_vM_NN/2.6/adv950.ko" to to boot up shell script. Fedora core 6 for example: add "insmod /YOURLOCATION/adv950_vM_NN/2.6/adv950.ko" to /etc/rc.d/rc.local 3.7. Uninstall the driver module and clean # make uninstall # make clean
About
Advantech ADV950 Serial Driver
Topics
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published