blob: c6a8ab0521202b3cac1e64181dd2e4fa42e6b7b1 [file] [log] [blame]
Marek Vasut909bbcc2012-08-08 01:42:17 +00001The 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
60 1) altera_jtag_uart.c
61 ---------------------
62 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
63
64 2) altera_uart.c
65 ----------------
66 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
67
68 3) arm_dcc.c
69 ------------
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
73 4) atmel_usart.c
74 ----------------
75 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
76
77 5) mcfuart.c
78 ------------
79 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
80
81 6) ns16550.c
82 ------------
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
87 7) ns9750_serial.c
88 ------------------
89 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
90
91 8) opencores_yanu.c
92 -------------------
93 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
94
95 9) s3c4510b_uart.c
96 ------------------
97 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
98
99 10) s3c64xx.c
100 -------------
101 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
102
103 11) sandbox.c
104 -------------
105 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
106
107 12) serial.c
108 ------------
109 This is a complementary part of NS16550 UART driver, see above.
110
111 13) serial_clps7111.c
112 ---------------------
113 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
114
115 14) serial_imx.c
116 ----------------
117 No support for CONFIG_SERIAL_MULTI. Simple conversion possible. This driver
118 might be removed in favor of serial_mxc.c .
119
120 15) serial_ixp.c
121 ----------------
122 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
123
124 16) serial_ks8695.c
125 -------------------
126 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
127
Marek Vasutc9e35f32012-10-03 08:54:08 +0000128 17) serial_max3100.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000129 --------------------
130 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
131
Marek Vasutc9e35f32012-10-03 08:54:08 +0000132 18) serial_mxc.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000133 ----------------
134 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
135
Marek Vasutc9e35f32012-10-03 08:54:08 +0000136 19) serial_netarm.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000137 -------------------
138 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
139
Marek Vasutc9e35f32012-10-03 08:54:08 +0000140 20) serial_pl01x.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000141 ------------------
142 No support for CONFIG_SERIAL_MULTI. Simple conversion possible, though this
143 driver in fact contains two drivers in total.
144
Marek Vasutc9e35f32012-10-03 08:54:08 +0000145 21) serial_pxa.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000146 ----------------
147 This driver is a bit complicated, but due to clean support for
148 CONFIG_SERIAL_MULTI, there are no expected obstructions throughout the
149 conversion process.
150
Marek Vasutc9e35f32012-10-03 08:54:08 +0000151 22) serial_s3c24x0.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000152 --------------------
153 This driver, being quite ad-hoc might need some work to bring back to shape.
154
Marek Vasutc9e35f32012-10-03 08:54:08 +0000155 23) serial_s3c44b0.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000156 --------------------
157 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
158
Marek Vasutc9e35f32012-10-03 08:54:08 +0000159 24) serial_s5p.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000160 ----------------
161 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
162
Marek Vasutc9e35f32012-10-03 08:54:08 +0000163 25) serial_sa1100.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000164 -------------------
165 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
166
Marek Vasutc9e35f32012-10-03 08:54:08 +0000167 26) serial_sh.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000168 ---------------
169 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
170
Marek Vasutc9e35f32012-10-03 08:54:08 +0000171 27) serial_xuartlite.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000172 ----------------------
173 No support for CONFIG_SERIAL_MULTI. Simple conversion possible.
174
Marek Vasutc9e35f32012-10-03 08:54:08 +0000175 28) usbtty.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000176 ------------
177 This driver seems very complicated and entangled with USB framework. The
178 conversion might be complicated here.
179
Marek Vasutc9e35f32012-10-03 08:54:08 +0000180 29) arch/powerpc/cpu/mpc512x/serial.c
Marek Vasut909bbcc2012-08-08 01:42:17 +0000181 -------------------------------------
182 This driver supports CONFIG_SERIAL_MULTI. This driver will need to be moved to
183 proper place.