]> git.ipfire.org Git - people/ms/u-boot.git/blame - doc/driver-model/UDM-serial.txt
Merge branch 'master' of git://git.denx.de/u-boot-arm
[people/ms/u-boot.git] / doc / driver-model / UDM-serial.txt
CommitLineData
15c6935b
MV
1The U-Boot Driver Model Project
2===============================
3Serial I/O analysis
4===================
5Marek Vasut <marek.vasut@gmail.com>
62012-02-20
7
8I) Overview
9-----------
10
11The serial port support currently requires the driver to export the following
12functions:
13
14 serial_putc() ...... Output a character
15 serial_puts() ...... Output string, often done using serial_putc()
16 serial_tstc() ...... Test if incoming character is in a buffer
17 serial_getc() ...... Retrieve incoming character
18 serial_setbrg() .... Configure port options
19 serial_init() ...... Initialize the hardware
20
21The simpliest implementation, supporting only one port, simply defines these six
22functions and calls them. Such calls are scattered all around U-Boot, especiall
23serial_putc(), serial_puts(), serial_tstc() and serial_getc(). The serial_init()
24and serial_setbrg() are often called from platform-dependent places.
25
26It's important to consider current implementation of CONFIG_SERIAL_MULTI though.
27This resides in common/serial.c and behaves as a multiplexer for serial ports.
28This, by calling serial_assign(), allows user to switch I/O from one serial port
29to another. Though the environmental variables "stdin", "stdout", "stderr"
30remain set to "serial".
31
32These variables are managed by the IOMUX. This resides in common/iomux.c and
33manages all console input/output from U-Boot. For serial port, only one IOMUX is
34always registered, called "serial" and the switching of different serial ports
35is done by code in common/serial.c.
36
37On a final note, it's important to mention function default_serial_console(),
38which is platform specific and reports the default serial console for the
39platform, unless proper environment variable overrides this.
40
41II) Approach
42------------
43
44Drivers not using CONFIG_SERIAL_MULTI already will have to be converted to
45similar approach. The probe() function of a driver will call a function
46registering the driver with a STDIO subsystem core, stdio_device_register().
47
48The serial_init() function will now be replaced by probe() function of the
49driver, the rest of the components of the driver will be converted to standard
50STDIO driver calls. See [ UDM-stdio.txt ] for details.
51
52The serial_setbrg() function depends on global data pointer. This is wrong,
53since there is likely to be user willing to configure different baudrate on two
54different serial ports. The function will be replaced with STDIO's "conf()"
55call, with STDIO_CONFIG_SERIAL_BAUDRATE argument.
56
57III) Analysis of in-tree drivers
58--------------------------------
59
566c6e43
MY
60 altera_jtag_uart.c
61 ------------------
15c6935b
MV
62 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
63
566c6e43
MY
64 altera_uart.c
65 -------------
15c6935b
MV
66 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
67
566c6e43
MY
68 arm_dcc.c
69 ---------
15c6935b
MV
70 No support for CONFIG_SERIAL_MULTI. Simple conversion possible, unless used
71 with CONFIG_ARM_DCC_MULTI. Then it registers another separate IOMUX.
72
566c6e43
MY
73 atmel_usart.c
74 -------------
15c6935b
MV
75 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
76
566c6e43
MY
77 mcfuart.c
78 ---------
15c6935b
MV
79 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
80
566c6e43
MY
81 ns16550.c
82 ---------
15c6935b
MV
83 This driver seems complicated and certain consideration will need to be made
84 during conversion. This driver is implemented in very universal manner,
85 therefore it'll be necessary to properly design it's platform_data.
86
566c6e43
MY
87 opencores_yanu.c
88 ----------------
15c6935b
MV
89 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
90
566c6e43
MY
91 sandbox.c
92 ---------
15c6935b
MV
93 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
94
566c6e43
MY
95 serial.c
96 --------
15c6935b
MV
97 This is a complementary part of NS16550 UART driver, see above.
98
566c6e43
MY
99 serial_imx.c
100 ------------
15c6935b
MV
101 No support for CONFIG_SERIAL_MULTI. Simple conversion possible. This driver
102 might be removed in favor of serial_mxc.c .
103
566c6e43
MY
104 serial_ks8695.c
105 ---------------
15c6935b
MV
106 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
107
566c6e43
MY
108 serial_max3100.c
109 ----------------
15c6935b
MV
110 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
111
566c6e43
MY
112 serial_mxc.c
113 ------------
15c6935b
MV
114 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
115
566c6e43
MY
116 serial_pl01x.c
117 --------------
15c6935b
MV
118 No support for CONFIG_SERIAL_MULTI. Simple conversion possible, though this
119 driver in fact contains two drivers in total.
120
566c6e43
MY
121 serial_pxa.c
122 ------------
15c6935b
MV
123 This driver is a bit complicated, but due to clean support for
124 CONFIG_SERIAL_MULTI, there are no expected obstructions throughout the
125 conversion process.
126
566c6e43
MY
127 serial_s3c24x0.c
128 ----------------
15c6935b
MV
129 This driver, being quite ad-hoc might need some work to bring back to shape.
130
566c6e43
MY
131 serial_s5p.c
132 ------------
15c6935b
MV
133 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
134
566c6e43
MY
135 serial_sa1100.c
136 ---------------
15c6935b
MV
137 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
138
566c6e43
MY
139 serial_sh.c
140 -----------
15c6935b
MV
141 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
142
566c6e43
MY
143 serial_xuartlite.c
144 ------------------
15c6935b
MV
145 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
146
566c6e43
MY
147 usbtty.c
148 --------
15c6935b
MV
149 This driver seems very complicated and entangled with USB framework. The
150 conversion might be complicated here.
151
566c6e43
MY
152 arch/powerpc/cpu/mpc512x/serial.c
153 ---------------------------------
15c6935b
MV
154 This driver supports CONFIG_SERIAL_MULTI. This driver will need to be moved to
155 proper place.