ARM LINUX Extended Serial port
Category: Embedded
----xr21v1414 USB Turn serial port
----16c554 Bus extended serial port
For different projects, some items often need to be transferred to a serial port. There are two ways, one with USB to expand, the other with 16c554. Both of these are essentially the same. The cost is also comparable. If both approaches are possible in project design, it is recommended that you use a bus approach. Because the expansion of the serial port will always appear some problems, there is no native serial port to use. But the bus mode is relatively less problematic, and USB expansion of the serial port, I believe in the PC on the taste of its temper.
One, xr21v1414 USB Turn serial port
USB expansion serial port scheme is still a lot of. Here is an example of the xr21v1414 I used. First go to the official online download a kernel corresponding driver, I am using Linux 2.6.18-3.4.x this compatible mode of driver. Link:
http://www.exar.com/common/content/default.aspx?id=10296
Unzip the drive to the drivers/usb/serial/below, then modify the corresponding makefile, KCONIFG on the line. This can support 1410,1412,1414, respectively, 1 Road, 2 Road, 4 road. If the USB is not enough, you can use the gl850g USB hub to expand, and then connect xr21v1414.
Click (here) to collapse or open Makefile:
obj-$ (config_usb_serial_exar_xr21v14xx) + + VIZZINI.O
Kconfig:
Config usb_serial_exar_xr21v14xx
TriState "USB serial Exar xr21v14xx 4 Port serial Driver"
Help
Say Y here if you are want to use 4 port USB to serial adapter.
Second, 16c554 bus extended serial port
Bus expansion serial port, 16C55 series is more commonly used, but also relatively easy to use, the kernel support is very good. This is an ancient drive. ST16C554 is an integrated 4-way standard asynchronous serial transceiver serial expansion chip, its operation method and register usage and 8250 exactly the same, so we can use Linux classic 8250 drive to drive st16c554.
Click (here) to collapse or open//define a good device file
#include <linux/serial_8250.h>
#define PORT (_BASE,_IRQ) \
{//Not iobase,arm IO and memory unified address
. MapBase = (unsigned long) _base, \
. IRQ = _IRQ, \
. uartclk = 115200*16, \
. Iotype = Upio_mem, \//indicates 8-bit read/write
. Flags = upf_boot_autoconf | Upf_ioremap | UPF_AUTO_IRQ, \
. Regshift = 1, \
}
MapBase refers to the physical base site of the 16c554, which is not MEMBASE,IOBASE;.UARTCLK is the frequency of the 16c554 crystal Oscillator, its highest baud rate is. Uartclk/16;.iotype refers to the type of access, related to the hardware connection, Upio_mem refers to a 8-bit bus connection, and Upio_mem32 is represented as a 32-bit bus access mode, that is, access to 16c554 registers, read 32 digits, lower 8 bits ;. Regshift is also related to the physical connection of the hardware, referring to the 16c554 of each address of the 16c554, that is, the A0 of the corresponding CPU.
Click (here) to collapse or open the static struct Plat_serial8250_port serial_8250_data[] = {
PORT (((unsigned long) (mx53_cs0_base_addr+ (0x60000 + 0) <<1)), GPIO_TO_IRQ (cpuname_gpio33)),
PORT (((unsigned long) (mx53_cs0_base_addr+ (0x60000 + 8) <<1)), GPIO_TO_IRQ (cpuname_gpio34)),
PORT ((unsigned long) (mx53_cs0_base_addr+ (0x60000 +) <<1)), GPIO_TO_IRQ (cpuname_gpio35)),
PORT ((unsigned long) (mx53_cs0_base_addr+ (0x60000 +) <<1)), GPIO_TO_IRQ (cpuname_gpio36)),
{},
};
static struct Platform_device Serial_device = {
. Name = "Serial8250",
. id = 0,
. Dev = {
. Platform_data = Serial_8250_data,
},
};
Initialization equipment and GPIO port
Weim_cs_config (); The initialization of the bus must be done before this
Gpio_request (cpuname_gpio34, "34");
Gpio_direction_input (CPUNAME_GPIO34);
Gpio_request (cpuname_gpio35, "35");
Gpio_direction_input (CPUNAME_GPIO35);
Gpio_request (cpuname_gpio36, "36");
Gpio_direction_input (CPUNAME_GPIO36);
Gpio_request (cpuname_gpio33, "33");
Gpio_direction_input (CPUNAME_GPIO33);
Platform_device_register (&serial_device); Registering devices
driver/serial/under 8250.C
Underneath the device driver/char/serial/.
The kernel config diagram is as follows: