Commit 6596b48ccdfe420c7e4862cb0ea315750f002ba8
1 parent
8ece41f15c
Exists in
smarc-8m-android-10.0.0_2.6.0
and in
1 other branch
MLK-18577-4 serial: add simple xen debug output
Add simple debug output when uboot runs in a VM. Needs DM_SERIAL disabled, and XEN_DEBUG_SERIAL enabled. Signed-off-by: Peng Fan <peng.fan@nxp.com> (cherry picked from commit b41475b83c8d7c83bd6069f4fea05d3405e81e50) (cherry picked from commit 695ae513cdf6c671cda5c32e4a2974e3119450d0) (cherry picked from commit d4189c87bbd3a5fd0abc74f7e9ce12a2f86c0de0)
Showing 4 changed files with 79 additions and 0 deletions Inline Diff
drivers/serial/Kconfig
1 | # | 1 | # |
2 | # Serial device configuration | 2 | # Serial device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menu "Serial drivers" | 5 | menu "Serial drivers" |
6 | 6 | ||
7 | config BAUDRATE | 7 | config BAUDRATE |
8 | int "Default baudrate" | 8 | int "Default baudrate" |
9 | default 115200 | 9 | default 115200 |
10 | help | 10 | help |
11 | Select a default baudrate, where "default" has a driver-specific | 11 | Select a default baudrate, where "default" has a driver-specific |
12 | meaning of either setting the baudrate for the early debug UART | 12 | meaning of either setting the baudrate for the early debug UART |
13 | in the SPL stage (most drivers) or for choosing a default baudrate | 13 | in the SPL stage (most drivers) or for choosing a default baudrate |
14 | in the absence of an environment setting (serial_mxc.c). | 14 | in the absence of an environment setting (serial_mxc.c). |
15 | 15 | ||
16 | config REQUIRE_SERIAL_CONSOLE | 16 | config REQUIRE_SERIAL_CONSOLE |
17 | bool "Require a serial port for console" | 17 | bool "Require a serial port for console" |
18 | # Running without a serial console is not supported by the | 18 | # Running without a serial console is not supported by the |
19 | # non-dm serial code | 19 | # non-dm serial code |
20 | depends on DM_SERIAL | 20 | depends on DM_SERIAL |
21 | default y | 21 | default y |
22 | help | 22 | help |
23 | Require a serial port for the console, and panic if none is found | 23 | Require a serial port for the console, and panic if none is found |
24 | during serial port initialization (default y). Set this to n on | 24 | during serial port initialization (default y). Set this to n on |
25 | boards which have no debug serial port whatsoever. | 25 | boards which have no debug serial port whatsoever. |
26 | 26 | ||
27 | config SPECIFY_CONSOLE_INDEX | 27 | config SPECIFY_CONSOLE_INDEX |
28 | bool "Specify the port number used for console" | 28 | bool "Specify the port number used for console" |
29 | default y if !DM_SERIAL || (SPL && !SPL_DM_SERIAL) || \ | 29 | default y if !DM_SERIAL || (SPL && !SPL_DM_SERIAL) || \ |
30 | (TPL && !TPL_DM_SERIAL) | 30 | (TPL && !TPL_DM_SERIAL) |
31 | help | 31 | help |
32 | In various cases, we need to specify which of the UART devices that | 32 | In various cases, we need to specify which of the UART devices that |
33 | a board or SoC has available are to be used for the console device | 33 | a board or SoC has available are to be used for the console device |
34 | in U-Boot. | 34 | in U-Boot. |
35 | 35 | ||
36 | config SERIAL_PRESENT | 36 | config SERIAL_PRESENT |
37 | bool "Provide a serial driver" | 37 | bool "Provide a serial driver" |
38 | depends on DM_SERIAL | 38 | depends on DM_SERIAL |
39 | default y | 39 | default y |
40 | help | 40 | help |
41 | In very space-constrained devices even the full UART driver is too | 41 | In very space-constrained devices even the full UART driver is too |
42 | large. In this case the debug UART can still be used in some cases. | 42 | large. In this case the debug UART can still be used in some cases. |
43 | This option enables the full UART in U-Boot, so if is it disabled, | 43 | This option enables the full UART in U-Boot, so if is it disabled, |
44 | the full UART driver will be omitted, thus saving space. | 44 | the full UART driver will be omitted, thus saving space. |
45 | 45 | ||
46 | config SPL_SERIAL_PRESENT | 46 | config SPL_SERIAL_PRESENT |
47 | bool "Provide a serial driver in SPL" | 47 | bool "Provide a serial driver in SPL" |
48 | depends on DM_SERIAL && SPL | 48 | depends on DM_SERIAL && SPL |
49 | default y | 49 | default y |
50 | help | 50 | help |
51 | In very space-constrained devices even the full UART driver is too | 51 | In very space-constrained devices even the full UART driver is too |
52 | large. In this case the debug UART can still be used in some cases. | 52 | large. In this case the debug UART can still be used in some cases. |
53 | This option enables the full UART in SPL, so if is it disabled, | 53 | This option enables the full UART in SPL, so if is it disabled, |
54 | the full UART driver will be omitted, thus saving space. | 54 | the full UART driver will be omitted, thus saving space. |
55 | 55 | ||
56 | config TPL_SERIAL_PRESENT | 56 | config TPL_SERIAL_PRESENT |
57 | bool "Provide a serial driver in TPL" | 57 | bool "Provide a serial driver in TPL" |
58 | depends on DM_SERIAL && TPL | 58 | depends on DM_SERIAL && TPL |
59 | default y | 59 | default y |
60 | help | 60 | help |
61 | In very space-constrained devices even the full UART driver is too | 61 | In very space-constrained devices even the full UART driver is too |
62 | large. In this case the debug UART can still be used in some cases. | 62 | large. In this case the debug UART can still be used in some cases. |
63 | This option enables the full UART in TPL, so if is it disabled, | 63 | This option enables the full UART in TPL, so if is it disabled, |
64 | the full UART driver will be omitted, thus saving space. | 64 | the full UART driver will be omitted, thus saving space. |
65 | 65 | ||
66 | # Logic to allow us to use the imply keyword to set what the default port | 66 | # Logic to allow us to use the imply keyword to set what the default port |
67 | # should be. The default is otherwise 1. | 67 | # should be. The default is otherwise 1. |
68 | config CONS_INDEX_0 | 68 | config CONS_INDEX_0 |
69 | bool | 69 | bool |
70 | 70 | ||
71 | config CONS_INDEX_2 | 71 | config CONS_INDEX_2 |
72 | bool | 72 | bool |
73 | 73 | ||
74 | config CONS_INDEX_3 | 74 | config CONS_INDEX_3 |
75 | bool | 75 | bool |
76 | 76 | ||
77 | config CONS_INDEX_4 | 77 | config CONS_INDEX_4 |
78 | bool | 78 | bool |
79 | 79 | ||
80 | config CONS_INDEX_5 | 80 | config CONS_INDEX_5 |
81 | bool | 81 | bool |
82 | 82 | ||
83 | config CONS_INDEX_6 | 83 | config CONS_INDEX_6 |
84 | bool | 84 | bool |
85 | 85 | ||
86 | config CONS_INDEX | 86 | config CONS_INDEX |
87 | int "UART used for console" | 87 | int "UART used for console" |
88 | depends on SPECIFY_CONSOLE_INDEX | 88 | depends on SPECIFY_CONSOLE_INDEX |
89 | range 0 6 | 89 | range 0 6 |
90 | default 0 if CONS_INDEX_0 | 90 | default 0 if CONS_INDEX_0 |
91 | default 2 if CONS_INDEX_2 | 91 | default 2 if CONS_INDEX_2 |
92 | default 3 if CONS_INDEX_3 | 92 | default 3 if CONS_INDEX_3 |
93 | default 4 if CONS_INDEX_4 | 93 | default 4 if CONS_INDEX_4 |
94 | default 5 if CONS_INDEX_5 | 94 | default 5 if CONS_INDEX_5 |
95 | default 6 if CONS_INDEX_6 | 95 | default 6 if CONS_INDEX_6 |
96 | default 1 | 96 | default 1 |
97 | help | 97 | help |
98 | Set this to match the UART number of the serial console. | 98 | Set this to match the UART number of the serial console. |
99 | 99 | ||
100 | config DM_SERIAL | 100 | config DM_SERIAL |
101 | bool "Enable Driver Model for serial drivers" | 101 | bool "Enable Driver Model for serial drivers" |
102 | depends on DM | 102 | depends on DM |
103 | select SYS_MALLOC_F | 103 | select SYS_MALLOC_F |
104 | help | 104 | help |
105 | Enable driver model for serial. This replaces | 105 | Enable driver model for serial. This replaces |
106 | drivers/serial/serial.c with the serial uclass, which | 106 | drivers/serial/serial.c with the serial uclass, which |
107 | implements serial_putc() etc. The uclass interface is | 107 | implements serial_putc() etc. The uclass interface is |
108 | defined in include/serial.h. | 108 | defined in include/serial.h. |
109 | 109 | ||
110 | config SERIAL_RX_BUFFER | 110 | config SERIAL_RX_BUFFER |
111 | bool "Enable RX buffer for serial input" | 111 | bool "Enable RX buffer for serial input" |
112 | depends on DM_SERIAL | 112 | depends on DM_SERIAL |
113 | help | 113 | help |
114 | Enable RX buffer support for the serial driver. This enables | 114 | Enable RX buffer support for the serial driver. This enables |
115 | pasting longer strings, even when the RX FIFO of the UART is | 115 | pasting longer strings, even when the RX FIFO of the UART is |
116 | not big enough (e.g. 16 bytes on the normal NS16550). | 116 | not big enough (e.g. 16 bytes on the normal NS16550). |
117 | 117 | ||
118 | config SERIAL_RX_BUFFER_SIZE | 118 | config SERIAL_RX_BUFFER_SIZE |
119 | int "RX buffer size" | 119 | int "RX buffer size" |
120 | depends on SERIAL_RX_BUFFER | 120 | depends on SERIAL_RX_BUFFER |
121 | default 256 | 121 | default 256 |
122 | help | 122 | help |
123 | The size of the RX buffer (needs to be power of 2) | 123 | The size of the RX buffer (needs to be power of 2) |
124 | 124 | ||
125 | config SERIAL_SEARCH_ALL | 125 | config SERIAL_SEARCH_ALL |
126 | bool "Search for serial devices after default one failed" | 126 | bool "Search for serial devices after default one failed" |
127 | depends on DM_SERIAL | 127 | depends on DM_SERIAL |
128 | help | 128 | help |
129 | The serial subsystem only searches for a single serial device | 129 | The serial subsystem only searches for a single serial device |
130 | that was instantiated, but does not check whether it was probed | 130 | that was instantiated, but does not check whether it was probed |
131 | correctly. With this option set, we make successful probing | 131 | correctly. With this option set, we make successful probing |
132 | mandatory and search for fallback serial devices if the default | 132 | mandatory and search for fallback serial devices if the default |
133 | device does not work. | 133 | device does not work. |
134 | 134 | ||
135 | If unsure, say N. | 135 | If unsure, say N. |
136 | 136 | ||
137 | config SPL_DM_SERIAL | 137 | config SPL_DM_SERIAL |
138 | bool "Enable Driver Model for serial drivers in SPL" | 138 | bool "Enable Driver Model for serial drivers in SPL" |
139 | depends on DM_SERIAL && SPL_DM | 139 | depends on DM_SERIAL && SPL_DM |
140 | select SYS_SPL_MALLOC_F | 140 | select SYS_SPL_MALLOC_F |
141 | default y | 141 | default y |
142 | help | 142 | help |
143 | Enable driver model for serial in SPL. This replaces | 143 | Enable driver model for serial in SPL. This replaces |
144 | drivers/serial/serial.c with the serial uclass, which | 144 | drivers/serial/serial.c with the serial uclass, which |
145 | implements serial_putc() etc. The uclass interface is | 145 | implements serial_putc() etc. The uclass interface is |
146 | defined in include/serial.h. | 146 | defined in include/serial.h. |
147 | 147 | ||
148 | config TPL_DM_SERIAL | 148 | config TPL_DM_SERIAL |
149 | bool "Enable Driver Model for serial drivers in TPL" | 149 | bool "Enable Driver Model for serial drivers in TPL" |
150 | depends on DM_SERIAL && TPL_DM | 150 | depends on DM_SERIAL && TPL_DM |
151 | select SYS_TPL_MALLOC_F | 151 | select SYS_TPL_MALLOC_F |
152 | default y if TPL && DM_SERIAL | 152 | default y if TPL && DM_SERIAL |
153 | help | 153 | help |
154 | Enable driver model for serial in TPL. This replaces | 154 | Enable driver model for serial in TPL. This replaces |
155 | drivers/serial/serial.c with the serial uclass, which | 155 | drivers/serial/serial.c with the serial uclass, which |
156 | implements serial_putc() etc. The uclass interface is | 156 | implements serial_putc() etc. The uclass interface is |
157 | defined in include/serial.h. | 157 | defined in include/serial.h. |
158 | 158 | ||
159 | config DEBUG_UART | 159 | config DEBUG_UART |
160 | bool "Enable an early debug UART for debugging" | 160 | bool "Enable an early debug UART for debugging" |
161 | help | 161 | help |
162 | The debug UART is intended for use very early in U-Boot to debug | 162 | The debug UART is intended for use very early in U-Boot to debug |
163 | problems when an ICE or other debug mechanism is not available. | 163 | problems when an ICE or other debug mechanism is not available. |
164 | 164 | ||
165 | To use it you should: | 165 | To use it you should: |
166 | - Make sure your UART supports this interface | 166 | - Make sure your UART supports this interface |
167 | - Enable CONFIG_DEBUG_UART | 167 | - Enable CONFIG_DEBUG_UART |
168 | - Enable the CONFIG for your UART to tell it to provide this interface | 168 | - Enable the CONFIG for your UART to tell it to provide this interface |
169 | (e.g. CONFIG_DEBUG_UART_NS16550) | 169 | (e.g. CONFIG_DEBUG_UART_NS16550) |
170 | - Define the required settings as needed (see below) | 170 | - Define the required settings as needed (see below) |
171 | - Call debug_uart_init() before use | 171 | - Call debug_uart_init() before use |
172 | - Call debug_uart_putc() to output a character | 172 | - Call debug_uart_putc() to output a character |
173 | 173 | ||
174 | Depending on your platform it may be possible to use this UART before | 174 | Depending on your platform it may be possible to use this UART before |
175 | a stack is available. | 175 | a stack is available. |
176 | 176 | ||
177 | If your UART does not support this interface you can probably add | 177 | If your UART does not support this interface you can probably add |
178 | support quite easily. Remember that you cannot use driver model and | 178 | support quite easily. Remember that you cannot use driver model and |
179 | it is preferred to use no stack. | 179 | it is preferred to use no stack. |
180 | 180 | ||
181 | You must not use this UART once driver model is working and the | 181 | You must not use this UART once driver model is working and the |
182 | serial drivers are up and running (done in serial_init()). Otherwise | 182 | serial drivers are up and running (done in serial_init()). Otherwise |
183 | the drivers may conflict and you will get strange output. | 183 | the drivers may conflict and you will get strange output. |
184 | 184 | ||
185 | choice | 185 | choice |
186 | prompt "Select which UART will provide the debug UART" | 186 | prompt "Select which UART will provide the debug UART" |
187 | depends on DEBUG_UART | 187 | depends on DEBUG_UART |
188 | default DEBUG_UART_NS16550 | 188 | default DEBUG_UART_NS16550 |
189 | 189 | ||
190 | config DEBUG_UART_ALTERA_JTAGUART | 190 | config DEBUG_UART_ALTERA_JTAGUART |
191 | bool "Altera JTAG UART" | 191 | bool "Altera JTAG UART" |
192 | help | 192 | help |
193 | Select this to enable a debug UART using the altera_jtag_uart driver. | 193 | Select this to enable a debug UART using the altera_jtag_uart driver. |
194 | You will need to provide parameters to make this work. The driver will | 194 | You will need to provide parameters to make this work. The driver will |
195 | be available until the real driver model serial is running. | 195 | be available until the real driver model serial is running. |
196 | 196 | ||
197 | config DEBUG_UART_ALTERA_UART | 197 | config DEBUG_UART_ALTERA_UART |
198 | bool "Altera UART" | 198 | bool "Altera UART" |
199 | help | 199 | help |
200 | Select this to enable a debug UART using the altera_uart driver. | 200 | Select this to enable a debug UART using the altera_uart driver. |
201 | You will need to provide parameters to make this work. The driver will | 201 | You will need to provide parameters to make this work. The driver will |
202 | be available until the real driver model serial is running. | 202 | be available until the real driver model serial is running. |
203 | 203 | ||
204 | config DEBUG_UART_AR933X | 204 | config DEBUG_UART_AR933X |
205 | bool "QCA/Atheros ar933x" | 205 | bool "QCA/Atheros ar933x" |
206 | depends on AR933X_UART | 206 | depends on AR933X_UART |
207 | help | 207 | help |
208 | Select this to enable a debug UART using the ar933x uart driver. | 208 | Select this to enable a debug UART using the ar933x uart driver. |
209 | You will need to provide parameters to make this work. The | 209 | You will need to provide parameters to make this work. The |
210 | driver will be available until the real driver model serial is | 210 | driver will be available until the real driver model serial is |
211 | running. | 211 | running. |
212 | 212 | ||
213 | config DEBUG_ARC_SERIAL | 213 | config DEBUG_ARC_SERIAL |
214 | bool "ARC UART" | 214 | bool "ARC UART" |
215 | depends on ARC_SERIAL | 215 | depends on ARC_SERIAL |
216 | help | 216 | help |
217 | Select this to enable a debug UART using the ARC UART driver. | 217 | Select this to enable a debug UART using the ARC UART driver. |
218 | You will need to provide parameters to make this work. The | 218 | You will need to provide parameters to make this work. The |
219 | driver will be available until the real driver model serial is | 219 | driver will be available until the real driver model serial is |
220 | running. | 220 | running. |
221 | 221 | ||
222 | config DEBUG_UART_ATMEL | 222 | config DEBUG_UART_ATMEL |
223 | bool "Atmel USART" | 223 | bool "Atmel USART" |
224 | help | 224 | help |
225 | Select this to enable a debug UART using the atmel usart driver. You | 225 | Select this to enable a debug UART using the atmel usart driver. You |
226 | will need to provide parameters to make this work. The driver will | 226 | will need to provide parameters to make this work. The driver will |
227 | be available until the real driver-model serial is running. | 227 | be available until the real driver-model serial is running. |
228 | 228 | ||
229 | config DEBUG_UART_BCM6345 | 229 | config DEBUG_UART_BCM6345 |
230 | bool "BCM6345 UART" | 230 | bool "BCM6345 UART" |
231 | depends on BCM6345_SERIAL | 231 | depends on BCM6345_SERIAL |
232 | help | 232 | help |
233 | Select this to enable a debug UART on BCM6345 SoCs. You | 233 | Select this to enable a debug UART on BCM6345 SoCs. You |
234 | will need to provide parameters to make this work. The driver will | 234 | will need to provide parameters to make this work. The driver will |
235 | be available until the real driver model serial is running. | 235 | be available until the real driver model serial is running. |
236 | 236 | ||
237 | config DEBUG_UART_NS16550 | 237 | config DEBUG_UART_NS16550 |
238 | bool "ns16550" | 238 | bool "ns16550" |
239 | help | 239 | help |
240 | Select this to enable a debug UART using the ns16550 driver. You | 240 | Select this to enable a debug UART using the ns16550 driver. You |
241 | will need to provide parameters to make this work. The driver will | 241 | will need to provide parameters to make this work. The driver will |
242 | be available until the real driver model serial is running. | 242 | be available until the real driver model serial is running. |
243 | 243 | ||
244 | config DEBUG_EFI_CONSOLE | 244 | config DEBUG_EFI_CONSOLE |
245 | bool "EFI" | 245 | bool "EFI" |
246 | depends on EFI_APP | 246 | depends on EFI_APP |
247 | help | 247 | help |
248 | Select this to enable a debug console which calls back to EFI to | 248 | Select this to enable a debug console which calls back to EFI to |
249 | output to the console. This can be useful for early debugging of | 249 | output to the console. This can be useful for early debugging of |
250 | U-Boot when running on top of EFI (Extensive Firmware Interface). | 250 | U-Boot when running on top of EFI (Extensive Firmware Interface). |
251 | This is a type of BIOS used by PCs. | 251 | This is a type of BIOS used by PCs. |
252 | 252 | ||
253 | config DEBUG_UART_S5P | 253 | config DEBUG_UART_S5P |
254 | bool "Samsung S5P" | 254 | bool "Samsung S5P" |
255 | help | 255 | help |
256 | Select this to enable a debug UART using the serial_s5p driver. You | 256 | Select this to enable a debug UART using the serial_s5p driver. You |
257 | will need to provide parameters to make this work. The driver will | 257 | will need to provide parameters to make this work. The driver will |
258 | be available until the real driver-model serial is running. | 258 | be available until the real driver-model serial is running. |
259 | 259 | ||
260 | config DEBUG_UART_MESON | 260 | config DEBUG_UART_MESON |
261 | bool "Amlogic Meson" | 261 | bool "Amlogic Meson" |
262 | depends on MESON_SERIAL | 262 | depends on MESON_SERIAL |
263 | help | 263 | help |
264 | Select this to enable a debug UART using the serial_meson driver. You | 264 | Select this to enable a debug UART using the serial_meson driver. You |
265 | will need to provide parameters to make this work. The driver will | 265 | will need to provide parameters to make this work. The driver will |
266 | be available until the real driver-model serial is running. | 266 | be available until the real driver-model serial is running. |
267 | 267 | ||
268 | config DEBUG_UART_UARTLITE | 268 | config DEBUG_UART_UARTLITE |
269 | bool "Xilinx Uartlite" | 269 | bool "Xilinx Uartlite" |
270 | help | 270 | help |
271 | Select this to enable a debug UART using the serial_uartlite driver. | 271 | Select this to enable a debug UART using the serial_uartlite driver. |
272 | You will need to provide parameters to make this work. The driver will | 272 | You will need to provide parameters to make this work. The driver will |
273 | be available until the real driver-model serial is running. | 273 | be available until the real driver-model serial is running. |
274 | 274 | ||
275 | config DEBUG_UART_ARM_DCC | 275 | config DEBUG_UART_ARM_DCC |
276 | bool "ARM DCC" | 276 | bool "ARM DCC" |
277 | help | 277 | help |
278 | Select this to enable a debug UART using the ARM JTAG DCC port. | 278 | Select this to enable a debug UART using the ARM JTAG DCC port. |
279 | The DCC port can be used for very early debugging and doesn't require | 279 | The DCC port can be used for very early debugging and doesn't require |
280 | any additional setting like address/baudrate/clock. On systems without | 280 | any additional setting like address/baudrate/clock. On systems without |
281 | any serial interface this is the easiest way how to get console. | 281 | any serial interface this is the easiest way how to get console. |
282 | Every ARM core has own DCC port which is the part of debug interface. | 282 | Every ARM core has own DCC port which is the part of debug interface. |
283 | This port is available at least on ARMv6, ARMv7, ARMv8 and XScale | 283 | This port is available at least on ARMv6, ARMv7, ARMv8 and XScale |
284 | architectures. | 284 | architectures. |
285 | 285 | ||
286 | config DEBUG_MVEBU_A3700_UART | 286 | config DEBUG_MVEBU_A3700_UART |
287 | bool "Marvell Armada 3700" | 287 | bool "Marvell Armada 3700" |
288 | help | 288 | help |
289 | Select this to enable a debug UART using the serial_mvebu driver. You | 289 | Select this to enable a debug UART using the serial_mvebu driver. You |
290 | will need to provide parameters to make this work. The driver will | 290 | will need to provide parameters to make this work. The driver will |
291 | be available until the real driver-model serial is running. | 291 | be available until the real driver-model serial is running. |
292 | 292 | ||
293 | config DEBUG_UART_ZYNQ | 293 | config DEBUG_UART_ZYNQ |
294 | bool "Xilinx Zynq" | 294 | bool "Xilinx Zynq" |
295 | help | 295 | help |
296 | Select this to enable a debug UART using the serial_zynq driver. You | 296 | Select this to enable a debug UART using the serial_zynq driver. You |
297 | will need to provide parameters to make this work. The driver will | 297 | will need to provide parameters to make this work. The driver will |
298 | be available until the real driver-model serial is running. | 298 | be available until the real driver-model serial is running. |
299 | 299 | ||
300 | config DEBUG_UART_APBUART | 300 | config DEBUG_UART_APBUART |
301 | depends on LEON3 | 301 | depends on LEON3 |
302 | bool "Gaisler APBUART" | 302 | bool "Gaisler APBUART" |
303 | help | 303 | help |
304 | Select this to enable a debug UART using the serial_leon3 driver. You | 304 | Select this to enable a debug UART using the serial_leon3 driver. You |
305 | will need to provide parameters to make this work. The driver will | 305 | will need to provide parameters to make this work. The driver will |
306 | be available until the real driver model serial is running. | 306 | be available until the real driver model serial is running. |
307 | 307 | ||
308 | config DEBUG_UART_PL010 | 308 | config DEBUG_UART_PL010 |
309 | bool "pl010" | 309 | bool "pl010" |
310 | help | 310 | help |
311 | Select this to enable a debug UART using the pl01x driver with the | 311 | Select this to enable a debug UART using the pl01x driver with the |
312 | PL010 UART type. You will need to provide parameters to make this | 312 | PL010 UART type. You will need to provide parameters to make this |
313 | work. The driver will be available until the real driver model | 313 | work. The driver will be available until the real driver model |
314 | serial is running. | 314 | serial is running. |
315 | 315 | ||
316 | config DEBUG_UART_PL011 | 316 | config DEBUG_UART_PL011 |
317 | bool "pl011" | 317 | bool "pl011" |
318 | help | 318 | help |
319 | Select this to enable a debug UART using the pl01x driver with the | 319 | Select this to enable a debug UART using the pl01x driver with the |
320 | PL011 UART type. You will need to provide parameters to make this | 320 | PL011 UART type. You will need to provide parameters to make this |
321 | work. The driver will be available until the real driver model | 321 | work. The driver will be available until the real driver model |
322 | serial is running. | 322 | serial is running. |
323 | 323 | ||
324 | config DEBUG_UART_PIC32 | 324 | config DEBUG_UART_PIC32 |
325 | bool "Microchip PIC32" | 325 | bool "Microchip PIC32" |
326 | depends on PIC32_SERIAL | 326 | depends on PIC32_SERIAL |
327 | help | 327 | help |
328 | Select this to enable a debug UART using the serial_pic32 driver. You | 328 | Select this to enable a debug UART using the serial_pic32 driver. You |
329 | will need to provide parameters to make this work. The driver will | 329 | will need to provide parameters to make this work. The driver will |
330 | be available until the real driver model serial is running. | 330 | be available until the real driver model serial is running. |
331 | 331 | ||
332 | config DEBUG_UART_MXC | 332 | config DEBUG_UART_MXC |
333 | bool "IMX Serial port" | 333 | bool "IMX Serial port" |
334 | depends on MXC_UART | 334 | depends on MXC_UART |
335 | help | 335 | help |
336 | Select this to enable a debug UART using the serial_mxc driver. You | 336 | Select this to enable a debug UART using the serial_mxc driver. You |
337 | will need to provide parameters to make this work. The driver will | 337 | will need to provide parameters to make this work. The driver will |
338 | be available until the real driver model serial is running. | 338 | be available until the real driver model serial is running. |
339 | 339 | ||
340 | config DEBUG_UART_SANDBOX | 340 | config DEBUG_UART_SANDBOX |
341 | bool "sandbox" | 341 | bool "sandbox" |
342 | depends on SANDBOX_SERIAL | 342 | depends on SANDBOX_SERIAL |
343 | help | 343 | help |
344 | Select this to enable the debug UART using the sandbox driver. This | 344 | Select this to enable the debug UART using the sandbox driver. This |
345 | provides basic serial output from the console without needing to | 345 | provides basic serial output from the console without needing to |
346 | start up driver model. The driver will be available until the real | 346 | start up driver model. The driver will be available until the real |
347 | driver model serial is running. | 347 | driver model serial is running. |
348 | 348 | ||
349 | config DEBUG_UART_SIFIVE | 349 | config DEBUG_UART_SIFIVE |
350 | bool "SiFive UART" | 350 | bool "SiFive UART" |
351 | help | 351 | help |
352 | Select this to enable a debug UART using the serial_sifive driver. You | 352 | Select this to enable a debug UART using the serial_sifive driver. You |
353 | will need to provide parameters to make this work. The driver will | 353 | will need to provide parameters to make this work. The driver will |
354 | be available until the real driver-model serial is running. | 354 | be available until the real driver-model serial is running. |
355 | 355 | ||
356 | config DEBUG_UART_STM32 | 356 | config DEBUG_UART_STM32 |
357 | bool "STMicroelectronics STM32" | 357 | bool "STMicroelectronics STM32" |
358 | depends on STM32_SERIAL | 358 | depends on STM32_SERIAL |
359 | help | 359 | help |
360 | Select this to enable a debug UART using the serial_stm32 driver | 360 | Select this to enable a debug UART using the serial_stm32 driver |
361 | You will need to provide parameters to make this work. | 361 | You will need to provide parameters to make this work. |
362 | The driver will be available until the real driver model | 362 | The driver will be available until the real driver model |
363 | serial is running. | 363 | serial is running. |
364 | 364 | ||
365 | config DEBUG_UART_UNIPHIER | 365 | config DEBUG_UART_UNIPHIER |
366 | bool "UniPhier on-chip UART" | 366 | bool "UniPhier on-chip UART" |
367 | depends on ARCH_UNIPHIER | 367 | depends on ARCH_UNIPHIER |
368 | help | 368 | help |
369 | Select this to enable a debug UART using the UniPhier on-chip UART. | 369 | Select this to enable a debug UART using the UniPhier on-chip UART. |
370 | You will need to provide DEBUG_UART_BASE to make this work. The | 370 | You will need to provide DEBUG_UART_BASE to make this work. The |
371 | driver will be available until the real driver-model serial is | 371 | driver will be available until the real driver-model serial is |
372 | running. | 372 | running. |
373 | 373 | ||
374 | config DEBUG_UART_OMAP | 374 | config DEBUG_UART_OMAP |
375 | bool "OMAP uart" | 375 | bool "OMAP uart" |
376 | help | 376 | help |
377 | Select this to enable a debug UART using the omap ns16550 driver. | 377 | Select this to enable a debug UART using the omap ns16550 driver. |
378 | You will need to provide parameters to make this work. The driver | 378 | You will need to provide parameters to make this work. The driver |
379 | will be available until the real driver model serial is running. | 379 | will be available until the real driver model serial is running. |
380 | 380 | ||
381 | config DEBUG_UART_MTK | 381 | config DEBUG_UART_MTK |
382 | bool "MediaTek High-speed UART" | 382 | bool "MediaTek High-speed UART" |
383 | depends on MTK_SERIAL | 383 | depends on MTK_SERIAL |
384 | help | 384 | help |
385 | Select this to enable a debug UART using the MediaTek High-speed | 385 | Select this to enable a debug UART using the MediaTek High-speed |
386 | UART driver. | 386 | UART driver. |
387 | You will need to provide parameters to make this work. The | 387 | You will need to provide parameters to make this work. The |
388 | driver will be available until the real driver model serial is | 388 | driver will be available until the real driver model serial is |
389 | running. | 389 | running. |
390 | 390 | ||
391 | endchoice | 391 | endchoice |
392 | 392 | ||
393 | config DEBUG_UART_BASE | 393 | config DEBUG_UART_BASE |
394 | hex "Base address of UART" | 394 | hex "Base address of UART" |
395 | depends on DEBUG_UART | 395 | depends on DEBUG_UART |
396 | default 0 if DEBUG_UART_SANDBOX | 396 | default 0 if DEBUG_UART_SANDBOX |
397 | help | 397 | help |
398 | This is the base address of your UART for memory-mapped UARTs. | 398 | This is the base address of your UART for memory-mapped UARTs. |
399 | 399 | ||
400 | A default should be provided by your board, but if not you will need | 400 | A default should be provided by your board, but if not you will need |
401 | to use the correct value here. | 401 | to use the correct value here. |
402 | 402 | ||
403 | config DEBUG_UART_CLOCK | 403 | config DEBUG_UART_CLOCK |
404 | int "UART input clock" | 404 | int "UART input clock" |
405 | depends on DEBUG_UART | 405 | depends on DEBUG_UART |
406 | default 0 if DEBUG_UART_SANDBOX | 406 | default 0 if DEBUG_UART_SANDBOX |
407 | help | 407 | help |
408 | The UART input clock determines the speed of the internal UART | 408 | The UART input clock determines the speed of the internal UART |
409 | circuitry. The baud rate is derived from this by dividing the input | 409 | circuitry. The baud rate is derived from this by dividing the input |
410 | clock down. | 410 | clock down. |
411 | 411 | ||
412 | A default should be provided by your board, but if not you will need | 412 | A default should be provided by your board, but if not you will need |
413 | to use the correct value here. | 413 | to use the correct value here. |
414 | 414 | ||
415 | config DEBUG_UART_SHIFT | 415 | config DEBUG_UART_SHIFT |
416 | int "UART register shift" | 416 | int "UART register shift" |
417 | depends on DEBUG_UART | 417 | depends on DEBUG_UART |
418 | default 0 if DEBUG_UART | 418 | default 0 if DEBUG_UART |
419 | help | 419 | help |
420 | Some UARTs (notably ns16550) support different register layouts | 420 | Some UARTs (notably ns16550) support different register layouts |
421 | where the registers are spaced either as bytes, words or some other | 421 | where the registers are spaced either as bytes, words or some other |
422 | value. Use this value to specify the shift to use, where 0=byte | 422 | value. Use this value to specify the shift to use, where 0=byte |
423 | registers, 2=32-bit word registers, etc. | 423 | registers, 2=32-bit word registers, etc. |
424 | 424 | ||
425 | config DEBUG_UART_BOARD_INIT | 425 | config DEBUG_UART_BOARD_INIT |
426 | bool "Enable board-specific debug UART init" | 426 | bool "Enable board-specific debug UART init" |
427 | depends on DEBUG_UART | 427 | depends on DEBUG_UART |
428 | help | 428 | help |
429 | Some boards need to set things up before the debug UART can be used. | 429 | Some boards need to set things up before the debug UART can be used. |
430 | On these boards a call to debug_uart_init() is insufficient. When | 430 | On these boards a call to debug_uart_init() is insufficient. When |
431 | this option is enabled, the function board_debug_uart_init() will | 431 | this option is enabled, the function board_debug_uart_init() will |
432 | be called when debug_uart_init() is called. You can put any code | 432 | be called when debug_uart_init() is called. You can put any code |
433 | here that is needed to set up the UART ready for use, such as set | 433 | here that is needed to set up the UART ready for use, such as set |
434 | pin multiplexing or enable clocks. | 434 | pin multiplexing or enable clocks. |
435 | 435 | ||
436 | config DEBUG_UART_ANNOUNCE | 436 | config DEBUG_UART_ANNOUNCE |
437 | bool "Show a message when the debug UART starts up" | 437 | bool "Show a message when the debug UART starts up" |
438 | depends on DEBUG_UART | 438 | depends on DEBUG_UART |
439 | help | 439 | help |
440 | Enable this option to show a message when the debug UART is ready | 440 | Enable this option to show a message when the debug UART is ready |
441 | for use. You will see a message like "<debug_uart> " as soon as | 441 | for use. You will see a message like "<debug_uart> " as soon as |
442 | U-Boot has the UART ready for use (i.e. your code calls | 442 | U-Boot has the UART ready for use (i.e. your code calls |
443 | debug_uart_init()). This can be useful just as a check that | 443 | debug_uart_init()). This can be useful just as a check that |
444 | everything is working. | 444 | everything is working. |
445 | 445 | ||
446 | config DEBUG_UART_SKIP_INIT | 446 | config DEBUG_UART_SKIP_INIT |
447 | bool "Skip UART initialization" | 447 | bool "Skip UART initialization" |
448 | depends on DEBUG_UART | 448 | depends on DEBUG_UART |
449 | help | 449 | help |
450 | Select this if the UART you want to use for debug output is already | 450 | Select this if the UART you want to use for debug output is already |
451 | initialized by the time U-Boot starts its execution. | 451 | initialized by the time U-Boot starts its execution. |
452 | 452 | ||
453 | config DEBUG_UART_NS16550_CHECK_ENABLED | 453 | config DEBUG_UART_NS16550_CHECK_ENABLED |
454 | bool "Check if UART is enabled on output" | 454 | bool "Check if UART is enabled on output" |
455 | depends on DEBUG_UART | 455 | depends on DEBUG_UART |
456 | depends on DEBUG_UART_NS16550 | 456 | depends on DEBUG_UART_NS16550 |
457 | help | 457 | help |
458 | Select this if puts()/putc() might be called before the debug UART | 458 | Select this if puts()/putc() might be called before the debug UART |
459 | has been initialized. If this is disabled, putc() might sit in a | 459 | has been initialized. If this is disabled, putc() might sit in a |
460 | tight loop if it is called before debug_uart_init() has been called. | 460 | tight loop if it is called before debug_uart_init() has been called. |
461 | 461 | ||
462 | Note that this does not work for every ns16550-compatible UART and | 462 | Note that this does not work for every ns16550-compatible UART and |
463 | so has to be enabled carefully or you might notice lost characters. | 463 | so has to be enabled carefully or you might notice lost characters. |
464 | 464 | ||
465 | config ALTERA_JTAG_UART | 465 | config ALTERA_JTAG_UART |
466 | bool "Altera JTAG UART support" | 466 | bool "Altera JTAG UART support" |
467 | depends on DM_SERIAL | 467 | depends on DM_SERIAL |
468 | help | 468 | help |
469 | Select this to enable an JTAG UART for Altera devices.The JTAG UART | 469 | Select this to enable an JTAG UART for Altera devices.The JTAG UART |
470 | core implements a method to communicate serial character streams | 470 | core implements a method to communicate serial character streams |
471 | between a host PC and a Qsys system on an Altera FPGA. Please find | 471 | between a host PC and a Qsys system on an Altera FPGA. Please find |
472 | details on the "Embedded Peripherals IP User Guide" of Altera. | 472 | details on the "Embedded Peripherals IP User Guide" of Altera. |
473 | 473 | ||
474 | config ALTERA_JTAG_UART_BYPASS | 474 | config ALTERA_JTAG_UART_BYPASS |
475 | bool "Bypass output when no connection" | 475 | bool "Bypass output when no connection" |
476 | depends on ALTERA_JTAG_UART | 476 | depends on ALTERA_JTAG_UART |
477 | help | 477 | help |
478 | Bypass console output and keep going even if there is no JTAG | 478 | Bypass console output and keep going even if there is no JTAG |
479 | terminal connection with the host. The console output will resume | 479 | terminal connection with the host. The console output will resume |
480 | once the JTAG terminal is connected. Without the bypass, the console | 480 | once the JTAG terminal is connected. Without the bypass, the console |
481 | output will wait forever until a JTAG terminal is connected. If you | 481 | output will wait forever until a JTAG terminal is connected. If you |
482 | not are sure, say Y. | 482 | not are sure, say Y. |
483 | 483 | ||
484 | config ALTERA_UART | 484 | config ALTERA_UART |
485 | bool "Altera UART support" | 485 | bool "Altera UART support" |
486 | depends on DM_SERIAL | 486 | depends on DM_SERIAL |
487 | help | 487 | help |
488 | Select this to enable an UART for Altera devices. Please find | 488 | Select this to enable an UART for Altera devices. Please find |
489 | details on the "Embedded Peripherals IP User Guide" of Altera. | 489 | details on the "Embedded Peripherals IP User Guide" of Altera. |
490 | 490 | ||
491 | config AR933X_UART | 491 | config AR933X_UART |
492 | bool "QCA/Atheros ar933x UART support" | 492 | bool "QCA/Atheros ar933x UART support" |
493 | depends on DM_SERIAL && SOC_AR933X | 493 | depends on DM_SERIAL && SOC_AR933X |
494 | help | 494 | help |
495 | Select this to enable UART support for QCA/Atheros ar933x | 495 | Select this to enable UART support for QCA/Atheros ar933x |
496 | devices. This driver uses driver model and requires a device | 496 | devices. This driver uses driver model and requires a device |
497 | tree binding to operate, please refer to the document at | 497 | tree binding to operate, please refer to the document at |
498 | doc/device-tree-bindings/serial/qca,ar9330-uart.txt. | 498 | doc/device-tree-bindings/serial/qca,ar9330-uart.txt. |
499 | 499 | ||
500 | config ARC_SERIAL | 500 | config ARC_SERIAL |
501 | bool "ARC UART support" | 501 | bool "ARC UART support" |
502 | depends on DM_SERIAL | 502 | depends on DM_SERIAL |
503 | help | 503 | help |
504 | Select this to enable support for ARC UART now typically | 504 | Select this to enable support for ARC UART now typically |
505 | only used in Synopsys DesignWare ARC simulators like nSIM. | 505 | only used in Synopsys DesignWare ARC simulators like nSIM. |
506 | 506 | ||
507 | config ATMEL_USART | 507 | config ATMEL_USART |
508 | bool "Atmel USART support" | 508 | bool "Atmel USART support" |
509 | help | 509 | help |
510 | Select this to enable USART support for Atmel SoCs. It can be | 510 | Select this to enable USART support for Atmel SoCs. It can be |
511 | configured in the device tree, and input clock frequency can | 511 | configured in the device tree, and input clock frequency can |
512 | be got from the clk node. | 512 | be got from the clk node. |
513 | 513 | ||
514 | config SPL_UART_CLOCK | 514 | config SPL_UART_CLOCK |
515 | int "SPL fixed UART input clock" | 515 | int "SPL fixed UART input clock" |
516 | depends on ATMEL_USART && SPL && !SPL_CLK | 516 | depends on ATMEL_USART && SPL && !SPL_CLK |
517 | default 132096000 if ARCH_AT91 | 517 | default 132096000 if ARCH_AT91 |
518 | help | 518 | help |
519 | Provide a fixed clock value as input to the UART controller. This | 519 | Provide a fixed clock value as input to the UART controller. This |
520 | might be needed on platforms which can't enable CONFIG_SPL_CLK | 520 | might be needed on platforms which can't enable CONFIG_SPL_CLK |
521 | because of SPL image size restrictions. | 521 | because of SPL image size restrictions. |
522 | 522 | ||
523 | config BCM283X_MU_SERIAL | 523 | config BCM283X_MU_SERIAL |
524 | bool "Support for BCM283x Mini-UART" | 524 | bool "Support for BCM283x Mini-UART" |
525 | depends on DM_SERIAL && ARCH_BCM283X | 525 | depends on DM_SERIAL && ARCH_BCM283X |
526 | default y | 526 | default y |
527 | help | 527 | help |
528 | Select this to enable Mini-UART support on BCM283X family of SoCs. | 528 | Select this to enable Mini-UART support on BCM283X family of SoCs. |
529 | 529 | ||
530 | config BCM283X_PL011_SERIAL | 530 | config BCM283X_PL011_SERIAL |
531 | bool "Support for BCM283x PL011 UART" | 531 | bool "Support for BCM283x PL011 UART" |
532 | depends on PL01X_SERIAL && ARCH_BCM283X | 532 | depends on PL01X_SERIAL && ARCH_BCM283X |
533 | default y | 533 | default y |
534 | help | 534 | help |
535 | Select this to enable an overriding PL011 driver for BCM283X SoCs | 535 | Select this to enable an overriding PL011 driver for BCM283X SoCs |
536 | that supports automatic disable, so that it only gets used when | 536 | that supports automatic disable, so that it only gets used when |
537 | the UART is actually muxed. | 537 | the UART is actually muxed. |
538 | 538 | ||
539 | config BCM6345_SERIAL | 539 | config BCM6345_SERIAL |
540 | bool "Support for BCM6345 UART" | 540 | bool "Support for BCM6345 UART" |
541 | depends on DM_SERIAL | 541 | depends on DM_SERIAL |
542 | help | 542 | help |
543 | Select this to enable UART on BCM6345 SoCs. | 543 | Select this to enable UART on BCM6345 SoCs. |
544 | 544 | ||
545 | config COREBOOT_SERIAL | 545 | config COREBOOT_SERIAL |
546 | bool "Coreboot UART support" | 546 | bool "Coreboot UART support" |
547 | depends on DM_SERIAL | 547 | depends on DM_SERIAL |
548 | default y if SYS_COREBOOT | 548 | default y if SYS_COREBOOT |
549 | select SYS_NS16550 | 549 | select SYS_NS16550 |
550 | help | 550 | help |
551 | Select this to enable a ns16550-style UART where the platform data | 551 | Select this to enable a ns16550-style UART where the platform data |
552 | comes from the coreboot 'sysinfo' tables. This allows U-Boot to have | 552 | comes from the coreboot 'sysinfo' tables. This allows U-Boot to have |
553 | a serial console on any platform without needing to change the | 553 | a serial console on any platform without needing to change the |
554 | device tree, etc. | 554 | device tree, etc. |
555 | 555 | ||
556 | config CORTINA_UART | 556 | config CORTINA_UART |
557 | bool "Cortina UART support" | 557 | bool "Cortina UART support" |
558 | depends on DM_SERIAL | 558 | depends on DM_SERIAL |
559 | help | 559 | help |
560 | Select this to enable UART support for Cortina-Access UART devices | 560 | Select this to enable UART support for Cortina-Access UART devices |
561 | found on CAxxxx SoCs. | 561 | found on CAxxxx SoCs. |
562 | 562 | ||
563 | config FSL_LINFLEXUART | 563 | config FSL_LINFLEXUART |
564 | bool "Freescale Linflex UART support" | 564 | bool "Freescale Linflex UART support" |
565 | depends on DM_SERIAL | 565 | depends on DM_SERIAL |
566 | help | 566 | help |
567 | Select this to enable the Linflex serial module found on some | 567 | Select this to enable the Linflex serial module found on some |
568 | NXP SoCs like S32V234. | 568 | NXP SoCs like S32V234. |
569 | 569 | ||
570 | config FSL_LPUART | 570 | config FSL_LPUART |
571 | bool "Freescale LPUART support" | 571 | bool "Freescale LPUART support" |
572 | help | 572 | help |
573 | Select this to enable a Low Power UART for Freescale VF610 and | 573 | Select this to enable a Low Power UART for Freescale VF610 and |
574 | QorIQ Layerscape devices. | 574 | QorIQ Layerscape devices. |
575 | 575 | ||
576 | config MVEBU_A3700_UART | 576 | config MVEBU_A3700_UART |
577 | bool "UART support for Armada 3700" | 577 | bool "UART support for Armada 3700" |
578 | default n | 578 | default n |
579 | help | 579 | help |
580 | Choose this option to add support for UART driver on the Marvell | 580 | Choose this option to add support for UART driver on the Marvell |
581 | Armada 3700 SoC. The base address is configured via DT. | 581 | Armada 3700 SoC. The base address is configured via DT. |
582 | 582 | ||
583 | config MCFUART | 583 | config MCFUART |
584 | bool "Freescale ColdFire UART support" | 584 | bool "Freescale ColdFire UART support" |
585 | help | 585 | help |
586 | Choose this option to add support for UART driver on the ColdFire | 586 | Choose this option to add support for UART driver on the ColdFire |
587 | SoC's family. The serial communication channel provides a full-duplex | 587 | SoC's family. The serial communication channel provides a full-duplex |
588 | asynchronous/synchronous receiver and transmitter deriving an | 588 | asynchronous/synchronous receiver and transmitter deriving an |
589 | operating frequency from the internal bus clock or an external clock. | 589 | operating frequency from the internal bus clock or an external clock. |
590 | 590 | ||
591 | config MXC_UART | 591 | config MXC_UART |
592 | bool "IMX serial port support" | 592 | bool "IMX serial port support" |
593 | depends on MX5 || MX6 || MX7 || IMX8M | 593 | depends on MX5 || MX6 || MX7 || IMX8M |
594 | help | 594 | help |
595 | If you have a machine based on a Motorola IMX CPU you | 595 | If you have a machine based on a Motorola IMX CPU you |
596 | can enable its onboard serial port by enabling this option. | 596 | can enable its onboard serial port by enabling this option. |
597 | 597 | ||
598 | config NULLDEV_SERIAL | 598 | config NULLDEV_SERIAL |
599 | bool "Null serial device" | 599 | bool "Null serial device" |
600 | help | 600 | help |
601 | Select this to enable null serial device support. A null serial | 601 | Select this to enable null serial device support. A null serial |
602 | device merely acts as a placeholder for a serial device and does | 602 | device merely acts as a placeholder for a serial device and does |
603 | nothing for all it's operation. | 603 | nothing for all it's operation. |
604 | 604 | ||
605 | config PIC32_SERIAL | 605 | config PIC32_SERIAL |
606 | bool "Support for Microchip PIC32 on-chip UART" | 606 | bool "Support for Microchip PIC32 on-chip UART" |
607 | depends on DM_SERIAL && MACH_PIC32 | 607 | depends on DM_SERIAL && MACH_PIC32 |
608 | default y | 608 | default y |
609 | help | 609 | help |
610 | Support for the UART found on Microchip PIC32 SoC's. | 610 | Support for the UART found on Microchip PIC32 SoC's. |
611 | 611 | ||
612 | config SYS_NS16550 | 612 | config SYS_NS16550 |
613 | bool "NS16550 UART or compatible" | 613 | bool "NS16550 UART or compatible" |
614 | help | 614 | help |
615 | Support NS16550 UART or compatible. This can be enabled in the | 615 | Support NS16550 UART or compatible. This can be enabled in the |
616 | device tree with the correct input clock frequency. If the input | 616 | device tree with the correct input clock frequency. If the input |
617 | clock frequency is not defined in the device tree, the macro | 617 | clock frequency is not defined in the device tree, the macro |
618 | CONFIG_SYS_NS16550_CLK defined in a legacy board header file will | 618 | CONFIG_SYS_NS16550_CLK defined in a legacy board header file will |
619 | be used. It can be a constant or a function to get clock, eg, | 619 | be used. It can be a constant or a function to get clock, eg, |
620 | get_serial_clock(). | 620 | get_serial_clock(). |
621 | 621 | ||
622 | config NS16550_DYNAMIC | 622 | config NS16550_DYNAMIC |
623 | bool "Allow NS16550 to be configured at runtime" | 623 | bool "Allow NS16550 to be configured at runtime" |
624 | default y if SYS_COREBOOT || SYS_SLIMBOOTLOADER | 624 | default y if SYS_COREBOOT || SYS_SLIMBOOTLOADER |
625 | help | 625 | help |
626 | Enable this option to allow device-tree control of the driver. | 626 | Enable this option to allow device-tree control of the driver. |
627 | 627 | ||
628 | Normally this driver is controlled by the following options: | 628 | Normally this driver is controlled by the following options: |
629 | 629 | ||
630 | CONFIG_SYS_NS16550_PORT_MAPPED - indicates that port I/O is used for | 630 | CONFIG_SYS_NS16550_PORT_MAPPED - indicates that port I/O is used for |
631 | access. If not enabled, then the UART is memory-mapped. | 631 | access. If not enabled, then the UART is memory-mapped. |
632 | CONFIG_SYS_NS16550_MEM32 - if memory-mapped, indicates that 32-bit | 632 | CONFIG_SYS_NS16550_MEM32 - if memory-mapped, indicates that 32-bit |
633 | access should be used (instead of 8-bit) | 633 | access should be used (instead of 8-bit) |
634 | CONFIG_SYS_NS16550_REG_SIZE - indicates register width and also | 634 | CONFIG_SYS_NS16550_REG_SIZE - indicates register width and also |
635 | endianness. If positive, big-endian access is used. If negative, | 635 | endianness. If positive, big-endian access is used. If negative, |
636 | little-endian is used. | 636 | little-endian is used. |
637 | 637 | ||
638 | It is not a good practice for a driver to be statically configured, | 638 | It is not a good practice for a driver to be statically configured, |
639 | since it prevents the same driver being used for different types of | 639 | since it prevents the same driver being used for different types of |
640 | UARTs in a system. This option avoids this problem at the cost of a | 640 | UARTs in a system. This option avoids this problem at the cost of a |
641 | slightly increased code size. | 641 | slightly increased code size. |
642 | 642 | ||
643 | config INTEL_MID_SERIAL | 643 | config INTEL_MID_SERIAL |
644 | bool "Intel MID platform UART support" | 644 | bool "Intel MID platform UART support" |
645 | depends on DM_SERIAL && OF_CONTROL | 645 | depends on DM_SERIAL && OF_CONTROL |
646 | depends on INTEL_MID | 646 | depends on INTEL_MID |
647 | select SYS_NS16550 | 647 | select SYS_NS16550 |
648 | help | 648 | help |
649 | Select this to enable a UART for Intel MID platforms. | 649 | Select this to enable a UART for Intel MID platforms. |
650 | This uses the ns16550 driver as a library. | 650 | This uses the ns16550 driver as a library. |
651 | 651 | ||
652 | config PL010_SERIAL | 652 | config PL010_SERIAL |
653 | bool "ARM PL010 driver" | 653 | bool "ARM PL010 driver" |
654 | depends on !DM_SERIAL | 654 | depends on !DM_SERIAL |
655 | help | 655 | help |
656 | Select this to enable a UART for platforms using PL010. | 656 | Select this to enable a UART for platforms using PL010. |
657 | 657 | ||
658 | config PL011_SERIAL | 658 | config PL011_SERIAL |
659 | bool "ARM PL011 driver" | 659 | bool "ARM PL011 driver" |
660 | depends on !DM_SERIAL | 660 | depends on !DM_SERIAL |
661 | help | 661 | help |
662 | Select this to enable a UART for platforms using PL011. | 662 | Select this to enable a UART for platforms using PL011. |
663 | 663 | ||
664 | config PL01X_SERIAL | 664 | config PL01X_SERIAL |
665 | bool "ARM PL010 and PL011 driver" | 665 | bool "ARM PL010 and PL011 driver" |
666 | depends on DM_SERIAL | 666 | depends on DM_SERIAL |
667 | help | 667 | help |
668 | Select this to enable a UART for platforms using PL010 or PL011. | 668 | Select this to enable a UART for platforms using PL010 or PL011. |
669 | 669 | ||
670 | config ROCKCHIP_SERIAL | 670 | config ROCKCHIP_SERIAL |
671 | bool "Rockchip on-chip UART support" | 671 | bool "Rockchip on-chip UART support" |
672 | depends on DM_SERIAL && SPL_OF_PLATDATA | 672 | depends on DM_SERIAL && SPL_OF_PLATDATA |
673 | help | 673 | help |
674 | Select this to enable a debug UART for Rockchip devices when using | 674 | Select this to enable a debug UART for Rockchip devices when using |
675 | CONFIG_SPL_OF_PLATDATA (i.e. a compiled-in device tree replacemenmt). | 675 | CONFIG_SPL_OF_PLATDATA (i.e. a compiled-in device tree replacemenmt). |
676 | This uses the ns16550 driver, converting the platdata from of-platdata | 676 | This uses the ns16550 driver, converting the platdata from of-platdata |
677 | to the ns16550 format. | 677 | to the ns16550 format. |
678 | 678 | ||
679 | config SANDBOX_SERIAL | 679 | config SANDBOX_SERIAL |
680 | bool "Sandbox UART support" | 680 | bool "Sandbox UART support" |
681 | depends on SANDBOX | 681 | depends on SANDBOX |
682 | help | 682 | help |
683 | Select this to enable a seral UART for sandbox. This is required to | 683 | Select this to enable a seral UART for sandbox. This is required to |
684 | operate correctly, otherwise you will see no serial output from | 684 | operate correctly, otherwise you will see no serial output from |
685 | sandbox. The emulated UART will display to the console and console | 685 | sandbox. The emulated UART will display to the console and console |
686 | input will be fed into the UART. This allows you to interact with | 686 | input will be fed into the UART. This allows you to interact with |
687 | U-Boot. | 687 | U-Boot. |
688 | 688 | ||
689 | The operation of the console is controlled by the -t command-line | 689 | The operation of the console is controlled by the -t command-line |
690 | flag. In raw mode, U-Boot sees all characters from the terminal | 690 | flag. In raw mode, U-Boot sees all characters from the terminal |
691 | before they are processed, including Ctrl-C. In cooked mode, Ctrl-C | 691 | before they are processed, including Ctrl-C. In cooked mode, Ctrl-C |
692 | is processed by the terminal, and terminates U-Boot. Valid options | 692 | is processed by the terminal, and terminates U-Boot. Valid options |
693 | are: | 693 | are: |
694 | 694 | ||
695 | -t raw-with-sigs Raw mode, Ctrl-C will terminate U-Boot | 695 | -t raw-with-sigs Raw mode, Ctrl-C will terminate U-Boot |
696 | -t raw Raw mode, Ctrl-C is processed by U-Boot | 696 | -t raw Raw mode, Ctrl-C is processed by U-Boot |
697 | -t cooked Cooked mode, Ctrl-C terminates | 697 | -t cooked Cooked mode, Ctrl-C terminates |
698 | 698 | ||
699 | config SCIF_CONSOLE | 699 | config SCIF_CONSOLE |
700 | bool "Renesas SCIF UART support" | 700 | bool "Renesas SCIF UART support" |
701 | depends on SH || ARCH_RMOBILE | 701 | depends on SH || ARCH_RMOBILE |
702 | help | 702 | help |
703 | Select this to enable Renesas SCIF UART. To operate serial ports | 703 | Select this to enable Renesas SCIF UART. To operate serial ports |
704 | on systems with RCar or SH SoCs, say Y to this option. If unsure, | 704 | on systems with RCar or SH SoCs, say Y to this option. If unsure, |
705 | say N. | 705 | say N. |
706 | 706 | ||
707 | config UNIPHIER_SERIAL | 707 | config UNIPHIER_SERIAL |
708 | bool "Support for UniPhier on-chip UART" | 708 | bool "Support for UniPhier on-chip UART" |
709 | depends on ARCH_UNIPHIER | 709 | depends on ARCH_UNIPHIER |
710 | default y | 710 | default y |
711 | help | 711 | help |
712 | If you have a UniPhier based board and want to use the on-chip | 712 | If you have a UniPhier based board and want to use the on-chip |
713 | serial ports, say Y to this option. If unsure, say N. | 713 | serial ports, say Y to this option. If unsure, say N. |
714 | 714 | ||
715 | config XILINX_UARTLITE | 715 | config XILINX_UARTLITE |
716 | bool "Xilinx Uarlite support" | 716 | bool "Xilinx Uarlite support" |
717 | depends on DM_SERIAL && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || 4xx) | 717 | depends on DM_SERIAL && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || 4xx) |
718 | help | 718 | help |
719 | If you have a Xilinx based board and want to use the uartlite | 719 | If you have a Xilinx based board and want to use the uartlite |
720 | serial ports, say Y to this option. If unsure, say N. | 720 | serial ports, say Y to this option. If unsure, say N. |
721 | 721 | ||
722 | config MESON_SERIAL | 722 | config MESON_SERIAL |
723 | bool "Support for Amlogic Meson UART" | 723 | bool "Support for Amlogic Meson UART" |
724 | depends on DM_SERIAL && ARCH_MESON | 724 | depends on DM_SERIAL && ARCH_MESON |
725 | help | 725 | help |
726 | If you have an Amlogic Meson based board and want to use the on-chip | 726 | If you have an Amlogic Meson based board and want to use the on-chip |
727 | serial ports, say Y to this option. If unsure, say N. | 727 | serial ports, say Y to this option. If unsure, say N. |
728 | 728 | ||
729 | config MSM_SERIAL | 729 | config MSM_SERIAL |
730 | bool "Qualcomm on-chip UART" | 730 | bool "Qualcomm on-chip UART" |
731 | depends on DM_SERIAL | 731 | depends on DM_SERIAL |
732 | help | 732 | help |
733 | Support Data Mover UART used on Qualcomm Snapdragon SoCs. | 733 | Support Data Mover UART used on Qualcomm Snapdragon SoCs. |
734 | It should support all Qualcomm devices with UARTDM version 1.4, | 734 | It should support all Qualcomm devices with UARTDM version 1.4, |
735 | for example APQ8016 and MSM8916. | 735 | for example APQ8016 and MSM8916. |
736 | Single baudrate is supported in current implementation (115200). | 736 | Single baudrate is supported in current implementation (115200). |
737 | 737 | ||
738 | config OMAP_SERIAL | 738 | config OMAP_SERIAL |
739 | bool "Support for OMAP specific UART" | 739 | bool "Support for OMAP specific UART" |
740 | depends on DM_SERIAL | 740 | depends on DM_SERIAL |
741 | default y if (ARCH_OMAP2PLUS || ARCH_K3) | 741 | default y if (ARCH_OMAP2PLUS || ARCH_K3) |
742 | select SYS_NS16550 | 742 | select SYS_NS16550 |
743 | help | 743 | help |
744 | If you have an TI based SoC and want to use the on-chip serial | 744 | If you have an TI based SoC and want to use the on-chip serial |
745 | port, say Y to this option. If unsure say N. | 745 | port, say Y to this option. If unsure say N. |
746 | 746 | ||
747 | config OWL_SERIAL | 747 | config OWL_SERIAL |
748 | bool "Actions Semi OWL UART" | 748 | bool "Actions Semi OWL UART" |
749 | depends on DM_SERIAL && ARCH_OWL | 749 | depends on DM_SERIAL && ARCH_OWL |
750 | help | 750 | help |
751 | If you have a Actions Semi OWL based board and want to use the on-chip | 751 | If you have a Actions Semi OWL based board and want to use the on-chip |
752 | serial port, say Y to this option. If unsure, say N. | 752 | serial port, say Y to this option. If unsure, say N. |
753 | Single baudrate is supported in current implementation (115200). | 753 | Single baudrate is supported in current implementation (115200). |
754 | 754 | ||
755 | config PXA_SERIAL | 755 | config PXA_SERIAL |
756 | bool "PXA serial port support" | 756 | bool "PXA serial port support" |
757 | help | 757 | help |
758 | If you have a machine based on a Marvell XScale PXA2xx CPU you | 758 | If you have a machine based on a Marvell XScale PXA2xx CPU you |
759 | can enable its onboard serial ports by enabling this option. | 759 | can enable its onboard serial ports by enabling this option. |
760 | 760 | ||
761 | config SIFIVE_SERIAL | 761 | config SIFIVE_SERIAL |
762 | bool "SiFive UART support" | 762 | bool "SiFive UART support" |
763 | depends on DM_SERIAL | 763 | depends on DM_SERIAL |
764 | help | 764 | help |
765 | This driver supports the SiFive UART. If unsure say N. | 765 | This driver supports the SiFive UART. If unsure say N. |
766 | 766 | ||
767 | config STI_ASC_SERIAL | 767 | config STI_ASC_SERIAL |
768 | bool "STMicroelectronics on-chip UART" | 768 | bool "STMicroelectronics on-chip UART" |
769 | depends on DM_SERIAL && ARCH_STI | 769 | depends on DM_SERIAL && ARCH_STI |
770 | help | 770 | help |
771 | Select this to enable Asynchronous Serial Controller available | 771 | Select this to enable Asynchronous Serial Controller available |
772 | on STiH410 SoC. This is a basic implementation, it supports | 772 | on STiH410 SoC. This is a basic implementation, it supports |
773 | following baudrate 9600, 19200, 38400, 57600 and 115200. | 773 | following baudrate 9600, 19200, 38400, 57600 and 115200. |
774 | 774 | ||
775 | config STM32_SERIAL | 775 | config STM32_SERIAL |
776 | bool "STMicroelectronics STM32 SoCs on-chip UART" | 776 | bool "STMicroelectronics STM32 SoCs on-chip UART" |
777 | depends on DM_SERIAL && (STM32F4 || STM32F7 || STM32H7 || ARCH_STM32MP) | 777 | depends on DM_SERIAL && (STM32F4 || STM32F7 || STM32H7 || ARCH_STM32MP) |
778 | help | 778 | help |
779 | If you have a machine based on a STM32 F4, F7, H7 or MP1 SOC | 779 | If you have a machine based on a STM32 F4, F7, H7 or MP1 SOC |
780 | you can enable its onboard serial ports, say Y to this option. | 780 | you can enable its onboard serial ports, say Y to this option. |
781 | If unsure, say N. | 781 | If unsure, say N. |
782 | 782 | ||
783 | config ZYNQ_SERIAL | 783 | config ZYNQ_SERIAL |
784 | bool "Cadence (Xilinx Zynq) UART support" | 784 | bool "Cadence (Xilinx Zynq) UART support" |
785 | depends on DM_SERIAL && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_ZYNQMP_R5) | 785 | depends on DM_SERIAL && (MICROBLAZE || ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_ZYNQMP_R5) |
786 | help | 786 | help |
787 | This driver supports the Cadence UART. It is found e.g. in Xilinx | 787 | This driver supports the Cadence UART. It is found e.g. in Xilinx |
788 | Zynq/ZynqMP. | 788 | Zynq/ZynqMP. |
789 | 789 | ||
790 | config MTK_SERIAL | 790 | config MTK_SERIAL |
791 | bool "MediaTek High-speed UART support" | 791 | bool "MediaTek High-speed UART support" |
792 | depends on DM_SERIAL | 792 | depends on DM_SERIAL |
793 | help | 793 | help |
794 | Select this to enable UART support for MediaTek High-speed UART | 794 | Select this to enable UART support for MediaTek High-speed UART |
795 | devices. This driver uses driver model and requires a device | 795 | devices. This driver uses driver model and requires a device |
796 | tree binding to operate. | 796 | tree binding to operate. |
797 | The High-speed UART is compatible with the ns16550a UART and have | 797 | The High-speed UART is compatible with the ns16550a UART and have |
798 | its own high-speed registers. | 798 | its own high-speed registers. |
799 | 799 | ||
800 | config MPC8XX_CONS | 800 | config MPC8XX_CONS |
801 | bool "Console driver for MPC8XX" | 801 | bool "Console driver for MPC8XX" |
802 | depends on MPC8xx | 802 | depends on MPC8xx |
803 | default y | 803 | default y |
804 | 804 | ||
805 | choice | 805 | choice |
806 | prompt "Console port" | 806 | prompt "Console port" |
807 | default 8xx_CONS_SMC1 | 807 | default 8xx_CONS_SMC1 |
808 | depends on MPC8XX_CONS | 808 | depends on MPC8XX_CONS |
809 | help | 809 | help |
810 | Depending on board, select one serial port | 810 | Depending on board, select one serial port |
811 | (CONFIG_8xx_CONS_SMC1 or CONFIG_8xx_CONS_SMC2) | 811 | (CONFIG_8xx_CONS_SMC1 or CONFIG_8xx_CONS_SMC2) |
812 | 812 | ||
813 | config 8xx_CONS_SMC1 | 813 | config 8xx_CONS_SMC1 |
814 | bool "SMC1" | 814 | bool "SMC1" |
815 | 815 | ||
816 | config 8xx_CONS_SMC2 | 816 | config 8xx_CONS_SMC2 |
817 | bool "SMC2" | 817 | bool "SMC2" |
818 | 818 | ||
819 | endchoice | 819 | endchoice |
820 | 820 | ||
821 | config SYS_SMC_RXBUFLEN | 821 | config SYS_SMC_RXBUFLEN |
822 | int "Console Rx buffer length" | 822 | int "Console Rx buffer length" |
823 | depends on MPC8XX_CONS | 823 | depends on MPC8XX_CONS |
824 | default 1 | 824 | default 1 |
825 | help | 825 | help |
826 | With CONFIG_SYS_SMC_RXBUFLEN it is possible to define | 826 | With CONFIG_SYS_SMC_RXBUFLEN it is possible to define |
827 | the maximum receive buffer length for the SMC. | 827 | the maximum receive buffer length for the SMC. |
828 | This option is actual only for 8xx possible. | 828 | This option is actual only for 8xx possible. |
829 | If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE | 829 | If using CONFIG_SYS_SMC_RXBUFLEN also CONFIG_SYS_MAXIDLE |
830 | must be defined, to setup the maximum idle timeout for | 830 | must be defined, to setup the maximum idle timeout for |
831 | the SMC. | 831 | the SMC. |
832 | 832 | ||
833 | config SYS_MAXIDLE | 833 | config SYS_MAXIDLE |
834 | int "maximum idle timeout" | 834 | int "maximum idle timeout" |
835 | depends on MPC8XX_CONS | 835 | depends on MPC8XX_CONS |
836 | default 0 | 836 | default 0 |
837 | 837 | ||
838 | config SYS_BRGCLK_PRESCALE | 838 | config SYS_BRGCLK_PRESCALE |
839 | int "BRG Clock Prescale" | 839 | int "BRG Clock Prescale" |
840 | depends on MPC8XX_CONS | 840 | depends on MPC8XX_CONS |
841 | default 1 | 841 | default 1 |
842 | 842 | ||
843 | config SYS_SDSR | 843 | config SYS_SDSR |
844 | hex "SDSR Value" | 844 | hex "SDSR Value" |
845 | depends on MPC8XX_CONS | 845 | depends on MPC8XX_CONS |
846 | default 0x83 | 846 | default 0x83 |
847 | 847 | ||
848 | config SYS_SDMR | 848 | config SYS_SDMR |
849 | hex "SDMR Value" | 849 | hex "SDMR Value" |
850 | depends on MPC8XX_CONS | 850 | depends on MPC8XX_CONS |
851 | default 0 | 851 | default 0 |
852 | 852 | ||
853 | config XEN_DEBUG_SERIAL | ||
854 | bool "XEN debug serial support" | ||
855 | depends on XEN | ||
856 | help | ||
857 | This is not pv console, it needs CONFIG_VERBOSE_DEBUG in XEN. | ||
858 | |||
853 | endmenu | 859 | endmenu |
854 | 860 |
drivers/serial/Makefile
1 | # SPDX-License-Identifier: GPL-2.0+ | 1 | # SPDX-License-Identifier: GPL-2.0+ |
2 | # | 2 | # |
3 | # (C) Copyright 2006-2009 | 3 | # (C) Copyright 2006-2009 |
4 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 4 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
5 | 5 | ||
6 | ifdef CONFIG_SPL_BUILD | 6 | ifdef CONFIG_SPL_BUILD |
7 | 7 | ||
8 | ifeq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)DM_SERIAL),yy) | 8 | ifeq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)DM_SERIAL),yy) |
9 | obj-y += serial-uclass.o | 9 | obj-y += serial-uclass.o |
10 | else | 10 | else |
11 | obj-y += serial.o | 11 | obj-y += serial.o |
12 | endif | 12 | endif |
13 | 13 | ||
14 | else | 14 | else |
15 | 15 | ||
16 | ifdef CONFIG_DM_SERIAL | 16 | ifdef CONFIG_DM_SERIAL |
17 | obj-y += serial-uclass.o | 17 | obj-y += serial-uclass.o |
18 | else | 18 | else |
19 | obj-y += serial.o | 19 | obj-y += serial.o |
20 | endif | 20 | endif |
21 | 21 | ||
22 | endif | 22 | endif |
23 | 23 | ||
24 | ifdef CONFIG_DM_SERIAL | 24 | ifdef CONFIG_DM_SERIAL |
25 | obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o | 25 | obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o |
26 | else | 26 | else |
27 | obj-$(CONFIG_PL010_SERIAL) += serial_pl01x.o | 27 | obj-$(CONFIG_PL010_SERIAL) += serial_pl01x.o |
28 | obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o | 28 | obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o |
29 | obj-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o | 29 | obj-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o |
30 | endif | 30 | endif |
31 | 31 | ||
32 | obj-$(CONFIG_ALTERA_UART) += altera_uart.o | 32 | obj-$(CONFIG_ALTERA_UART) += altera_uart.o |
33 | obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o | 33 | obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o |
34 | obj-$(CONFIG_AR933X_UART) += serial_ar933x.o | 34 | obj-$(CONFIG_AR933X_UART) += serial_ar933x.o |
35 | obj-$(CONFIG_ARM_DCC) += arm_dcc.o | 35 | obj-$(CONFIG_ARM_DCC) += arm_dcc.o |
36 | obj-$(CONFIG_ATMEL_USART) += atmel_usart.o | 36 | obj-$(CONFIG_ATMEL_USART) += atmel_usart.o |
37 | obj-$(CONFIG_BCM6345_SERIAL) += serial_bcm6345.o | 37 | obj-$(CONFIG_BCM6345_SERIAL) += serial_bcm6345.o |
38 | obj-$(CONFIG_COREBOOT_SERIAL) += serial_coreboot.o | 38 | obj-$(CONFIG_COREBOOT_SERIAL) += serial_coreboot.o |
39 | obj-$(CONFIG_CORTINA_UART) += serial_cortina.o | 39 | obj-$(CONFIG_CORTINA_UART) += serial_cortina.o |
40 | obj-$(CONFIG_EFI_APP) += serial_efi.o | 40 | obj-$(CONFIG_EFI_APP) += serial_efi.o |
41 | obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o | 41 | obj-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o |
42 | obj-$(CONFIG_MCFUART) += serial_mcf.o | 42 | obj-$(CONFIG_MCFUART) += serial_mcf.o |
43 | obj-$(CONFIG_SYS_NS16550) += ns16550.o | 43 | obj-$(CONFIG_SYS_NS16550) += ns16550.o |
44 | obj-$(CONFIG_S5P) += serial_s5p.o | 44 | obj-$(CONFIG_S5P) += serial_s5p.o |
45 | obj-$(CONFIG_MXC_UART) += serial_mxc.o | 45 | obj-$(CONFIG_MXC_UART) += serial_mxc.o |
46 | obj-$(CONFIG_PXA_SERIAL) += serial_pxa.o | 46 | obj-$(CONFIG_PXA_SERIAL) += serial_pxa.o |
47 | obj-$(CONFIG_MESON_SERIAL) += serial_meson.o | 47 | obj-$(CONFIG_MESON_SERIAL) += serial_meson.o |
48 | obj-$(CONFIG_INTEL_MID_SERIAL) += serial_intel_mid.o | 48 | obj-$(CONFIG_INTEL_MID_SERIAL) += serial_intel_mid.o |
49 | ifdef CONFIG_SPL_BUILD | 49 | ifdef CONFIG_SPL_BUILD |
50 | obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o | 50 | obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o |
51 | endif | 51 | endif |
52 | obj-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o | 52 | obj-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o |
53 | obj-$(CONFIG_SANDBOX_SERIAL) += sandbox.o | 53 | obj-$(CONFIG_SANDBOX_SERIAL) += sandbox.o |
54 | obj-$(CONFIG_SCIF_CONSOLE) += serial_sh.o | 54 | obj-$(CONFIG_SCIF_CONSOLE) += serial_sh.o |
55 | obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o | 55 | obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o |
56 | obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o | 56 | obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o |
57 | obj-$(CONFIG_FSL_LINFLEXUART) += serial_linflexuart.o | 57 | obj-$(CONFIG_FSL_LINFLEXUART) += serial_linflexuart.o |
58 | obj-$(CONFIG_ARC_SERIAL) += serial_arc.o | 58 | obj-$(CONFIG_ARC_SERIAL) += serial_arc.o |
59 | obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o | 59 | obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o |
60 | obj-$(CONFIG_STM32_SERIAL) += serial_stm32.o | 60 | obj-$(CONFIG_STM32_SERIAL) += serial_stm32.o |
61 | obj-$(CONFIG_STI_ASC_SERIAL) += serial_sti_asc.o | 61 | obj-$(CONFIG_STI_ASC_SERIAL) += serial_sti_asc.o |
62 | obj-$(CONFIG_PIC32_SERIAL) += serial_pic32.o | 62 | obj-$(CONFIG_PIC32_SERIAL) += serial_pic32.o |
63 | obj-$(CONFIG_BCM283X_MU_SERIAL) += serial_bcm283x_mu.o | 63 | obj-$(CONFIG_BCM283X_MU_SERIAL) += serial_bcm283x_mu.o |
64 | obj-$(CONFIG_BCM283X_PL011_SERIAL) += serial_bcm283x_pl011.o | 64 | obj-$(CONFIG_BCM283X_PL011_SERIAL) += serial_bcm283x_pl011.o |
65 | obj-$(CONFIG_MSM_SERIAL) += serial_msm.o | 65 | obj-$(CONFIG_MSM_SERIAL) += serial_msm.o |
66 | obj-$(CONFIG_MVEBU_A3700_UART) += serial_mvebu_a3700.o | 66 | obj-$(CONFIG_MVEBU_A3700_UART) += serial_mvebu_a3700.o |
67 | obj-$(CONFIG_MPC8XX_CONS) += serial_mpc8xx.o | 67 | obj-$(CONFIG_MPC8XX_CONS) += serial_mpc8xx.o |
68 | obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o | 68 | obj-$(CONFIG_NULLDEV_SERIAL) += serial_nulldev.o |
69 | obj-$(CONFIG_OWL_SERIAL) += serial_owl.o | 69 | obj-$(CONFIG_OWL_SERIAL) += serial_owl.o |
70 | obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o | 70 | obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o |
71 | obj-$(CONFIG_MTK_SERIAL) += serial_mtk.o | 71 | obj-$(CONFIG_MTK_SERIAL) += serial_mtk.o |
72 | obj-$(CONFIG_SIFIVE_SERIAL) += serial_sifive.o | 72 | obj-$(CONFIG_SIFIVE_SERIAL) += serial_sifive.o |
73 | obj-$(CONFIG_XEN_DEBUG_SERIAL) += serial_xen.o | ||
73 | 74 | ||
74 | ifndef CONFIG_SPL_BUILD | 75 | ifndef CONFIG_SPL_BUILD |
75 | obj-$(CONFIG_USB_TTY) += usbtty.o | 76 | obj-$(CONFIG_USB_TTY) += usbtty.o |
76 | endif | 77 | endif |
77 | 78 |
drivers/serial/serial.c
1 | // SPDX-License-Identifier: GPL-2.0+ | 1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | 2 | /* |
3 | * (C) Copyright 2004 | 3 | * (C) Copyright 2004 |
4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <common.h> | 7 | #include <common.h> |
8 | #include <env_internal.h> | 8 | #include <env_internal.h> |
9 | #include <hang.h> | 9 | #include <hang.h> |
10 | #include <serial.h> | 10 | #include <serial.h> |
11 | #include <stdio_dev.h> | 11 | #include <stdio_dev.h> |
12 | #include <post.h> | 12 | #include <post.h> |
13 | #include <linux/compiler.h> | 13 | #include <linux/compiler.h> |
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | 15 | ||
16 | DECLARE_GLOBAL_DATA_PTR; | 16 | DECLARE_GLOBAL_DATA_PTR; |
17 | 17 | ||
18 | static struct serial_device *serial_devices; | 18 | static struct serial_device *serial_devices; |
19 | static struct serial_device *serial_current; | 19 | static struct serial_device *serial_current; |
20 | /* | 20 | /* |
21 | * Table with supported baudrates (defined in config_xyz.h) | 21 | * Table with supported baudrates (defined in config_xyz.h) |
22 | */ | 22 | */ |
23 | static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; | 23 | static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * serial_null() - Void registration routine of a serial driver | 26 | * serial_null() - Void registration routine of a serial driver |
27 | * | 27 | * |
28 | * This routine implements a void registration routine of a serial | 28 | * This routine implements a void registration routine of a serial |
29 | * driver. The registration routine of a particular driver is aliased | 29 | * driver. The registration routine of a particular driver is aliased |
30 | * to this empty function in case the driver is not compiled into | 30 | * to this empty function in case the driver is not compiled into |
31 | * U-Boot. | 31 | * U-Boot. |
32 | */ | 32 | */ |
33 | static void serial_null(void) | 33 | static void serial_null(void) |
34 | { | 34 | { |
35 | } | 35 | } |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * on_baudrate() - Update the actual baudrate when the env var changes | 38 | * on_baudrate() - Update the actual baudrate when the env var changes |
39 | * | 39 | * |
40 | * @name: changed environment variable | 40 | * @name: changed environment variable |
41 | * @value: new value of the environment variable | 41 | * @value: new value of the environment variable |
42 | * @op: operation (create, overwrite, or delete) | 42 | * @op: operation (create, overwrite, or delete) |
43 | * @flags: attributes of environment variable change, | 43 | * @flags: attributes of environment variable change, |
44 | * see flags H_* in include/search.h | 44 | * see flags H_* in include/search.h |
45 | * | 45 | * |
46 | * This will check for a valid baudrate and only apply it if valid. | 46 | * This will check for a valid baudrate and only apply it if valid. |
47 | * | 47 | * |
48 | * Return: 0 on success, 1 on error | 48 | * Return: 0 on success, 1 on error |
49 | */ | 49 | */ |
50 | static int on_baudrate(const char *name, const char *value, enum env_op op, | 50 | static int on_baudrate(const char *name, const char *value, enum env_op op, |
51 | int flags) | 51 | int flags) |
52 | { | 52 | { |
53 | int i; | 53 | int i; |
54 | int baudrate; | 54 | int baudrate; |
55 | 55 | ||
56 | switch (op) { | 56 | switch (op) { |
57 | case env_op_create: | 57 | case env_op_create: |
58 | case env_op_overwrite: | 58 | case env_op_overwrite: |
59 | /* | 59 | /* |
60 | * Switch to new baudrate if new baudrate is supported | 60 | * Switch to new baudrate if new baudrate is supported |
61 | */ | 61 | */ |
62 | baudrate = simple_strtoul(value, NULL, 10); | 62 | baudrate = simple_strtoul(value, NULL, 10); |
63 | 63 | ||
64 | /* Not actually changing */ | 64 | /* Not actually changing */ |
65 | if (gd->baudrate == baudrate) | 65 | if (gd->baudrate == baudrate) |
66 | return 0; | 66 | return 0; |
67 | 67 | ||
68 | for (i = 0; i < ARRAY_SIZE(baudrate_table); ++i) { | 68 | for (i = 0; i < ARRAY_SIZE(baudrate_table); ++i) { |
69 | if (baudrate == baudrate_table[i]) | 69 | if (baudrate == baudrate_table[i]) |
70 | break; | 70 | break; |
71 | } | 71 | } |
72 | if (i == ARRAY_SIZE(baudrate_table)) { | 72 | if (i == ARRAY_SIZE(baudrate_table)) { |
73 | if ((flags & H_FORCE) == 0) | 73 | if ((flags & H_FORCE) == 0) |
74 | printf("## Baudrate %d bps not supported\n", | 74 | printf("## Baudrate %d bps not supported\n", |
75 | baudrate); | 75 | baudrate); |
76 | return 1; | 76 | return 1; |
77 | } | 77 | } |
78 | if ((flags & H_INTERACTIVE) != 0) { | 78 | if ((flags & H_INTERACTIVE) != 0) { |
79 | printf("## Switch baudrate to %d" | 79 | printf("## Switch baudrate to %d" |
80 | " bps and press ENTER ...\n", baudrate); | 80 | " bps and press ENTER ...\n", baudrate); |
81 | udelay(50000); | 81 | udelay(50000); |
82 | } | 82 | } |
83 | 83 | ||
84 | gd->baudrate = baudrate; | 84 | gd->baudrate = baudrate; |
85 | 85 | ||
86 | serial_setbrg(); | 86 | serial_setbrg(); |
87 | 87 | ||
88 | udelay(50000); | 88 | udelay(50000); |
89 | 89 | ||
90 | if ((flags & H_INTERACTIVE) != 0) | 90 | if ((flags & H_INTERACTIVE) != 0) |
91 | while (1) { | 91 | while (1) { |
92 | if (getc() == '\r') | 92 | if (getc() == '\r') |
93 | break; | 93 | break; |
94 | } | 94 | } |
95 | 95 | ||
96 | return 0; | 96 | return 0; |
97 | case env_op_delete: | 97 | case env_op_delete: |
98 | printf("## Baudrate may not be deleted\n"); | 98 | printf("## Baudrate may not be deleted\n"); |
99 | return 1; | 99 | return 1; |
100 | default: | 100 | default: |
101 | return 0; | 101 | return 0; |
102 | } | 102 | } |
103 | } | 103 | } |
104 | U_BOOT_ENV_CALLBACK(baudrate, on_baudrate); | 104 | U_BOOT_ENV_CALLBACK(baudrate, on_baudrate); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * serial_initfunc() - Forward declare of driver registration routine | 107 | * serial_initfunc() - Forward declare of driver registration routine |
108 | * @name: Name of the real driver registration routine. | 108 | * @name: Name of the real driver registration routine. |
109 | * | 109 | * |
110 | * This macro expands onto forward declaration of a driver registration | 110 | * This macro expands onto forward declaration of a driver registration |
111 | * routine, which is then used below in serial_initialize() function. | 111 | * routine, which is then used below in serial_initialize() function. |
112 | * The declaration is made weak and aliases to serial_null() so in case | 112 | * The declaration is made weak and aliases to serial_null() so in case |
113 | * the driver is not compiled in, the function is still declared and can | 113 | * the driver is not compiled in, the function is still declared and can |
114 | * be used, but aliases to serial_null() and thus is optimized away. | 114 | * be used, but aliases to serial_null() and thus is optimized away. |
115 | */ | 115 | */ |
116 | #define serial_initfunc(name) \ | 116 | #define serial_initfunc(name) \ |
117 | void name(void) \ | 117 | void name(void) \ |
118 | __attribute__((weak, alias("serial_null"))); | 118 | __attribute__((weak, alias("serial_null"))); |
119 | 119 | ||
120 | serial_initfunc(atmel_serial_initialize); | 120 | serial_initfunc(atmel_serial_initialize); |
121 | serial_initfunc(mcf_serial_initialize); | 121 | serial_initfunc(mcf_serial_initialize); |
122 | serial_initfunc(mpc85xx_serial_initialize); | 122 | serial_initfunc(mpc85xx_serial_initialize); |
123 | serial_initfunc(mxc_serial_initialize); | 123 | serial_initfunc(mxc_serial_initialize); |
124 | serial_initfunc(ns16550_serial_initialize); | 124 | serial_initfunc(ns16550_serial_initialize); |
125 | serial_initfunc(pl01x_serial_initialize); | 125 | serial_initfunc(pl01x_serial_initialize); |
126 | serial_initfunc(pxa_serial_initialize); | 126 | serial_initfunc(pxa_serial_initialize); |
127 | serial_initfunc(sh_serial_initialize); | 127 | serial_initfunc(sh_serial_initialize); |
128 | serial_initfunc(mtk_serial_initialize); | 128 | serial_initfunc(mtk_serial_initialize); |
129 | serial_initfunc(xen_debug_serial_initialize); | ||
129 | 130 | ||
130 | /** | 131 | /** |
131 | * serial_register() - Register serial driver with serial driver core | 132 | * serial_register() - Register serial driver with serial driver core |
132 | * @dev: Pointer to the serial driver structure | 133 | * @dev: Pointer to the serial driver structure |
133 | * | 134 | * |
134 | * This function registers the serial driver supplied via @dev with | 135 | * This function registers the serial driver supplied via @dev with |
135 | * serial driver core, thus making U-Boot aware of it and making it | 136 | * serial driver core, thus making U-Boot aware of it and making it |
136 | * available for U-Boot to use. On platforms that still require manual | 137 | * available for U-Boot to use. On platforms that still require manual |
137 | * relocation of constant variables, relocation of the supplied structure | 138 | * relocation of constant variables, relocation of the supplied structure |
138 | * is performed. | 139 | * is performed. |
139 | */ | 140 | */ |
140 | void serial_register(struct serial_device *dev) | 141 | void serial_register(struct serial_device *dev) |
141 | { | 142 | { |
142 | #ifdef CONFIG_NEEDS_MANUAL_RELOC | 143 | #ifdef CONFIG_NEEDS_MANUAL_RELOC |
143 | if (dev->start) | 144 | if (dev->start) |
144 | dev->start += gd->reloc_off; | 145 | dev->start += gd->reloc_off; |
145 | if (dev->stop) | 146 | if (dev->stop) |
146 | dev->stop += gd->reloc_off; | 147 | dev->stop += gd->reloc_off; |
147 | if (dev->setbrg) | 148 | if (dev->setbrg) |
148 | dev->setbrg += gd->reloc_off; | 149 | dev->setbrg += gd->reloc_off; |
149 | if (dev->getc) | 150 | if (dev->getc) |
150 | dev->getc += gd->reloc_off; | 151 | dev->getc += gd->reloc_off; |
151 | if (dev->tstc) | 152 | if (dev->tstc) |
152 | dev->tstc += gd->reloc_off; | 153 | dev->tstc += gd->reloc_off; |
153 | if (dev->putc) | 154 | if (dev->putc) |
154 | dev->putc += gd->reloc_off; | 155 | dev->putc += gd->reloc_off; |
155 | if (dev->puts) | 156 | if (dev->puts) |
156 | dev->puts += gd->reloc_off; | 157 | dev->puts += gd->reloc_off; |
157 | #endif | 158 | #endif |
158 | 159 | ||
159 | dev->next = serial_devices; | 160 | dev->next = serial_devices; |
160 | serial_devices = dev; | 161 | serial_devices = dev; |
161 | } | 162 | } |
162 | 163 | ||
163 | /** | 164 | /** |
164 | * serial_initialize() - Register all compiled-in serial port drivers | 165 | * serial_initialize() - Register all compiled-in serial port drivers |
165 | * | 166 | * |
166 | * This function registers all serial port drivers that are compiled | 167 | * This function registers all serial port drivers that are compiled |
167 | * into the U-Boot binary with the serial core, thus making them | 168 | * into the U-Boot binary with the serial core, thus making them |
168 | * available to U-Boot to use. Lastly, this function assigns a default | 169 | * available to U-Boot to use. Lastly, this function assigns a default |
169 | * serial port to the serial core. That serial port is then used as a | 170 | * serial port to the serial core. That serial port is then used as a |
170 | * default output. | 171 | * default output. |
171 | */ | 172 | */ |
172 | void serial_initialize(void) | 173 | void serial_initialize(void) |
173 | { | 174 | { |
174 | atmel_serial_initialize(); | 175 | atmel_serial_initialize(); |
175 | mcf_serial_initialize(); | 176 | mcf_serial_initialize(); |
176 | mpc85xx_serial_initialize(); | 177 | mpc85xx_serial_initialize(); |
177 | mxc_serial_initialize(); | 178 | mxc_serial_initialize(); |
178 | ns16550_serial_initialize(); | 179 | ns16550_serial_initialize(); |
179 | pl01x_serial_initialize(); | 180 | pl01x_serial_initialize(); |
180 | pxa_serial_initialize(); | 181 | pxa_serial_initialize(); |
181 | sh_serial_initialize(); | 182 | sh_serial_initialize(); |
182 | mtk_serial_initialize(); | 183 | mtk_serial_initialize(); |
184 | xen_debug_serial_initialize(); | ||
183 | 185 | ||
184 | serial_assign(default_serial_console()->name); | 186 | serial_assign(default_serial_console()->name); |
185 | } | 187 | } |
186 | 188 | ||
187 | static int serial_stub_start(struct stdio_dev *sdev) | 189 | static int serial_stub_start(struct stdio_dev *sdev) |
188 | { | 190 | { |
189 | struct serial_device *dev = sdev->priv; | 191 | struct serial_device *dev = sdev->priv; |
190 | 192 | ||
191 | return dev->start(); | 193 | return dev->start(); |
192 | } | 194 | } |
193 | 195 | ||
194 | static int serial_stub_stop(struct stdio_dev *sdev) | 196 | static int serial_stub_stop(struct stdio_dev *sdev) |
195 | { | 197 | { |
196 | struct serial_device *dev = sdev->priv; | 198 | struct serial_device *dev = sdev->priv; |
197 | 199 | ||
198 | return dev->stop(); | 200 | return dev->stop(); |
199 | } | 201 | } |
200 | 202 | ||
201 | static void serial_stub_putc(struct stdio_dev *sdev, const char ch) | 203 | static void serial_stub_putc(struct stdio_dev *sdev, const char ch) |
202 | { | 204 | { |
203 | struct serial_device *dev = sdev->priv; | 205 | struct serial_device *dev = sdev->priv; |
204 | 206 | ||
205 | dev->putc(ch); | 207 | dev->putc(ch); |
206 | } | 208 | } |
207 | 209 | ||
208 | static void serial_stub_puts(struct stdio_dev *sdev, const char *str) | 210 | static void serial_stub_puts(struct stdio_dev *sdev, const char *str) |
209 | { | 211 | { |
210 | struct serial_device *dev = sdev->priv; | 212 | struct serial_device *dev = sdev->priv; |
211 | 213 | ||
212 | dev->puts(str); | 214 | dev->puts(str); |
213 | } | 215 | } |
214 | 216 | ||
215 | static int serial_stub_getc(struct stdio_dev *sdev) | 217 | static int serial_stub_getc(struct stdio_dev *sdev) |
216 | { | 218 | { |
217 | struct serial_device *dev = sdev->priv; | 219 | struct serial_device *dev = sdev->priv; |
218 | 220 | ||
219 | return dev->getc(); | 221 | return dev->getc(); |
220 | } | 222 | } |
221 | 223 | ||
222 | static int serial_stub_tstc(struct stdio_dev *sdev) | 224 | static int serial_stub_tstc(struct stdio_dev *sdev) |
223 | { | 225 | { |
224 | struct serial_device *dev = sdev->priv; | 226 | struct serial_device *dev = sdev->priv; |
225 | 227 | ||
226 | return dev->tstc(); | 228 | return dev->tstc(); |
227 | } | 229 | } |
228 | 230 | ||
229 | /** | 231 | /** |
230 | * serial_stdio_init() - Register serial ports with STDIO core | 232 | * serial_stdio_init() - Register serial ports with STDIO core |
231 | * | 233 | * |
232 | * This function generates a proxy driver for each serial port driver. | 234 | * This function generates a proxy driver for each serial port driver. |
233 | * These proxy drivers then register with the STDIO core, making the | 235 | * These proxy drivers then register with the STDIO core, making the |
234 | * serial drivers available as STDIO devices. | 236 | * serial drivers available as STDIO devices. |
235 | */ | 237 | */ |
236 | void serial_stdio_init(void) | 238 | void serial_stdio_init(void) |
237 | { | 239 | { |
238 | struct stdio_dev dev; | 240 | struct stdio_dev dev; |
239 | struct serial_device *s = serial_devices; | 241 | struct serial_device *s = serial_devices; |
240 | 242 | ||
241 | while (s) { | 243 | while (s) { |
242 | memset(&dev, 0, sizeof(dev)); | 244 | memset(&dev, 0, sizeof(dev)); |
243 | 245 | ||
244 | strcpy(dev.name, s->name); | 246 | strcpy(dev.name, s->name); |
245 | dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT; | 247 | dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT; |
246 | 248 | ||
247 | dev.start = serial_stub_start; | 249 | dev.start = serial_stub_start; |
248 | dev.stop = serial_stub_stop; | 250 | dev.stop = serial_stub_stop; |
249 | dev.putc = serial_stub_putc; | 251 | dev.putc = serial_stub_putc; |
250 | dev.puts = serial_stub_puts; | 252 | dev.puts = serial_stub_puts; |
251 | dev.getc = serial_stub_getc; | 253 | dev.getc = serial_stub_getc; |
252 | dev.tstc = serial_stub_tstc; | 254 | dev.tstc = serial_stub_tstc; |
253 | dev.priv = s; | 255 | dev.priv = s; |
254 | 256 | ||
255 | stdio_register(&dev); | 257 | stdio_register(&dev); |
256 | 258 | ||
257 | s = s->next; | 259 | s = s->next; |
258 | } | 260 | } |
259 | } | 261 | } |
260 | 262 | ||
261 | /** | 263 | /** |
262 | * serial_assign() - Select the serial output device by name | 264 | * serial_assign() - Select the serial output device by name |
263 | * @name: Name of the serial driver to be used as default output | 265 | * @name: Name of the serial driver to be used as default output |
264 | * | 266 | * |
265 | * This function configures the serial output multiplexing by | 267 | * This function configures the serial output multiplexing by |
266 | * selecting which serial device will be used as default. In case | 268 | * selecting which serial device will be used as default. In case |
267 | * the STDIO "serial" device is selected as stdin/stdout/stderr, | 269 | * the STDIO "serial" device is selected as stdin/stdout/stderr, |
268 | * the serial device previously configured by this function will be | 270 | * the serial device previously configured by this function will be |
269 | * used for the particular operation. | 271 | * used for the particular operation. |
270 | * | 272 | * |
271 | * Returns 0 on success, negative on error. | 273 | * Returns 0 on success, negative on error. |
272 | */ | 274 | */ |
273 | int serial_assign(const char *name) | 275 | int serial_assign(const char *name) |
274 | { | 276 | { |
275 | struct serial_device *s; | 277 | struct serial_device *s; |
276 | 278 | ||
277 | for (s = serial_devices; s; s = s->next) { | 279 | for (s = serial_devices; s; s = s->next) { |
278 | if (strcmp(s->name, name)) | 280 | if (strcmp(s->name, name)) |
279 | continue; | 281 | continue; |
280 | serial_current = s; | 282 | serial_current = s; |
281 | return 0; | 283 | return 0; |
282 | } | 284 | } |
283 | 285 | ||
284 | return -EINVAL; | 286 | return -EINVAL; |
285 | } | 287 | } |
286 | 288 | ||
287 | /** | 289 | /** |
288 | * serial_reinit_all() - Reinitialize all compiled-in serial ports | 290 | * serial_reinit_all() - Reinitialize all compiled-in serial ports |
289 | * | 291 | * |
290 | * This function reinitializes all serial ports that are compiled | 292 | * This function reinitializes all serial ports that are compiled |
291 | * into U-Boot by calling their serial_start() functions. | 293 | * into U-Boot by calling their serial_start() functions. |
292 | */ | 294 | */ |
293 | void serial_reinit_all(void) | 295 | void serial_reinit_all(void) |
294 | { | 296 | { |
295 | struct serial_device *s; | 297 | struct serial_device *s; |
296 | 298 | ||
297 | for (s = serial_devices; s; s = s->next) | 299 | for (s = serial_devices; s; s = s->next) |
298 | s->start(); | 300 | s->start(); |
299 | } | 301 | } |
300 | 302 | ||
301 | /** | 303 | /** |
302 | * get_current() - Return pointer to currently selected serial port | 304 | * get_current() - Return pointer to currently selected serial port |
303 | * | 305 | * |
304 | * This function returns a pointer to currently selected serial port. | 306 | * This function returns a pointer to currently selected serial port. |
305 | * The currently selected serial port is altered by serial_assign() | 307 | * The currently selected serial port is altered by serial_assign() |
306 | * function. | 308 | * function. |
307 | * | 309 | * |
308 | * In case this function is called before relocation or before any serial | 310 | * In case this function is called before relocation or before any serial |
309 | * port is configured, this function calls default_serial_console() to | 311 | * port is configured, this function calls default_serial_console() to |
310 | * determine the serial port. Otherwise, the configured serial port is | 312 | * determine the serial port. Otherwise, the configured serial port is |
311 | * returned. | 313 | * returned. |
312 | * | 314 | * |
313 | * Returns pointer to the currently selected serial port on success, | 315 | * Returns pointer to the currently selected serial port on success, |
314 | * NULL on error. | 316 | * NULL on error. |
315 | */ | 317 | */ |
316 | static struct serial_device *get_current(void) | 318 | static struct serial_device *get_current(void) |
317 | { | 319 | { |
318 | struct serial_device *dev; | 320 | struct serial_device *dev; |
319 | 321 | ||
320 | if (!(gd->flags & GD_FLG_RELOC)) | 322 | if (!(gd->flags & GD_FLG_RELOC)) |
321 | dev = default_serial_console(); | 323 | dev = default_serial_console(); |
322 | else if (!serial_current) | 324 | else if (!serial_current) |
323 | dev = default_serial_console(); | 325 | dev = default_serial_console(); |
324 | else | 326 | else |
325 | dev = serial_current; | 327 | dev = serial_current; |
326 | 328 | ||
327 | /* We must have a console device */ | 329 | /* We must have a console device */ |
328 | if (!dev) { | 330 | if (!dev) { |
329 | #ifdef CONFIG_SPL_BUILD | 331 | #ifdef CONFIG_SPL_BUILD |
330 | puts("Cannot find console\n"); | 332 | puts("Cannot find console\n"); |
331 | hang(); | 333 | hang(); |
332 | #else | 334 | #else |
333 | panic("Cannot find console\n"); | 335 | panic("Cannot find console\n"); |
334 | #endif | 336 | #endif |
335 | } | 337 | } |
336 | 338 | ||
337 | return dev; | 339 | return dev; |
338 | } | 340 | } |
339 | 341 | ||
340 | /** | 342 | /** |
341 | * serial_init() - Initialize currently selected serial port | 343 | * serial_init() - Initialize currently selected serial port |
342 | * | 344 | * |
343 | * This function initializes the currently selected serial port. This | 345 | * This function initializes the currently selected serial port. This |
344 | * usually involves setting up the registers of that particular port, | 346 | * usually involves setting up the registers of that particular port, |
345 | * enabling clock and such. This function uses the get_current() call | 347 | * enabling clock and such. This function uses the get_current() call |
346 | * to determine which port is selected. | 348 | * to determine which port is selected. |
347 | * | 349 | * |
348 | * Returns 0 on success, negative on error. | 350 | * Returns 0 on success, negative on error. |
349 | */ | 351 | */ |
350 | int serial_init(void) | 352 | int serial_init(void) |
351 | { | 353 | { |
352 | gd->flags |= GD_FLG_SERIAL_READY; | 354 | gd->flags |= GD_FLG_SERIAL_READY; |
353 | return get_current()->start(); | 355 | return get_current()->start(); |
354 | } | 356 | } |
355 | 357 | ||
356 | /** | 358 | /** |
357 | * serial_setbrg() - Configure baud-rate of currently selected serial port | 359 | * serial_setbrg() - Configure baud-rate of currently selected serial port |
358 | * | 360 | * |
359 | * This function configures the baud-rate of the currently selected | 361 | * This function configures the baud-rate of the currently selected |
360 | * serial port. The baud-rate is retrieved from global data within | 362 | * serial port. The baud-rate is retrieved from global data within |
361 | * the serial port driver. This function uses the get_current() call | 363 | * the serial port driver. This function uses the get_current() call |
362 | * to determine which port is selected. | 364 | * to determine which port is selected. |
363 | * | 365 | * |
364 | * Returns 0 on success, negative on error. | 366 | * Returns 0 on success, negative on error. |
365 | */ | 367 | */ |
366 | void serial_setbrg(void) | 368 | void serial_setbrg(void) |
367 | { | 369 | { |
368 | get_current()->setbrg(); | 370 | get_current()->setbrg(); |
369 | } | 371 | } |
370 | 372 | ||
371 | /** | 373 | /** |
372 | * serial_getc() - Read character from currently selected serial port | 374 | * serial_getc() - Read character from currently selected serial port |
373 | * | 375 | * |
374 | * This function retrieves a character from currently selected serial | 376 | * This function retrieves a character from currently selected serial |
375 | * port. In case there is no character waiting on the serial port, | 377 | * port. In case there is no character waiting on the serial port, |
376 | * this function will block and wait for the character to appear. This | 378 | * this function will block and wait for the character to appear. This |
377 | * function uses the get_current() call to determine which port is | 379 | * function uses the get_current() call to determine which port is |
378 | * selected. | 380 | * selected. |
379 | * | 381 | * |
380 | * Returns the character on success, negative on error. | 382 | * Returns the character on success, negative on error. |
381 | */ | 383 | */ |
382 | int serial_getc(void) | 384 | int serial_getc(void) |
383 | { | 385 | { |
384 | return get_current()->getc(); | 386 | return get_current()->getc(); |
385 | } | 387 | } |
386 | 388 | ||
387 | /** | 389 | /** |
388 | * serial_tstc() - Test if data is available on currently selected serial port | 390 | * serial_tstc() - Test if data is available on currently selected serial port |
389 | * | 391 | * |
390 | * This function tests if one or more characters are available on | 392 | * This function tests if one or more characters are available on |
391 | * currently selected serial port. This function never blocks. This | 393 | * currently selected serial port. This function never blocks. This |
392 | * function uses the get_current() call to determine which port is | 394 | * function uses the get_current() call to determine which port is |
393 | * selected. | 395 | * selected. |
394 | * | 396 | * |
395 | * Returns positive if character is available, zero otherwise. | 397 | * Returns positive if character is available, zero otherwise. |
396 | */ | 398 | */ |
397 | int serial_tstc(void) | 399 | int serial_tstc(void) |
398 | { | 400 | { |
399 | return get_current()->tstc(); | 401 | return get_current()->tstc(); |
400 | } | 402 | } |
401 | 403 | ||
402 | /** | 404 | /** |
403 | * serial_putc() - Output character via currently selected serial port | 405 | * serial_putc() - Output character via currently selected serial port |
404 | * @c: Single character to be output from the serial port. | 406 | * @c: Single character to be output from the serial port. |
405 | * | 407 | * |
406 | * This function outputs a character via currently selected serial | 408 | * This function outputs a character via currently selected serial |
407 | * port. This character is passed to the serial port driver responsible | 409 | * port. This character is passed to the serial port driver responsible |
408 | * for controlling the hardware. The hardware may still be in process | 410 | * for controlling the hardware. The hardware may still be in process |
409 | * of transmitting another character, therefore this function may block | 411 | * of transmitting another character, therefore this function may block |
410 | * for a short amount of time. This function uses the get_current() | 412 | * for a short amount of time. This function uses the get_current() |
411 | * call to determine which port is selected. | 413 | * call to determine which port is selected. |
412 | */ | 414 | */ |
413 | void serial_putc(const char c) | 415 | void serial_putc(const char c) |
414 | { | 416 | { |
415 | get_current()->putc(c); | 417 | get_current()->putc(c); |
416 | } | 418 | } |
417 | 419 | ||
418 | /** | 420 | /** |
419 | * serial_puts() - Output string via currently selected serial port | 421 | * serial_puts() - Output string via currently selected serial port |
420 | * @s: Zero-terminated string to be output from the serial port. | 422 | * @s: Zero-terminated string to be output from the serial port. |
421 | * | 423 | * |
422 | * This function outputs a zero-terminated string via currently | 424 | * This function outputs a zero-terminated string via currently |
423 | * selected serial port. This function behaves as an accelerator | 425 | * selected serial port. This function behaves as an accelerator |
424 | * in case the hardware can queue multiple characters for transfer. | 426 | * in case the hardware can queue multiple characters for transfer. |
425 | * The whole string that is to be output is available to the function | 427 | * The whole string that is to be output is available to the function |
426 | * implementing the hardware manipulation. Transmitting the whole | 428 | * implementing the hardware manipulation. Transmitting the whole |
427 | * string may take some time, thus this function may block for some | 429 | * string may take some time, thus this function may block for some |
428 | * amount of time. This function uses the get_current() call to | 430 | * amount of time. This function uses the get_current() call to |
429 | * determine which port is selected. | 431 | * determine which port is selected. |
430 | */ | 432 | */ |
431 | void serial_puts(const char *s) | 433 | void serial_puts(const char *s) |
432 | { | 434 | { |
433 | get_current()->puts(s); | 435 | get_current()->puts(s); |
434 | } | 436 | } |
435 | 437 | ||
436 | /** | 438 | /** |
437 | * default_serial_puts() - Output string by calling serial_putc() in loop | 439 | * default_serial_puts() - Output string by calling serial_putc() in loop |
438 | * @s: Zero-terminated string to be output from the serial port. | 440 | * @s: Zero-terminated string to be output from the serial port. |
439 | * | 441 | * |
440 | * This function outputs a zero-terminated string by calling serial_putc() | 442 | * This function outputs a zero-terminated string by calling serial_putc() |
441 | * in a loop. Most drivers do not support queueing more than one byte for | 443 | * in a loop. Most drivers do not support queueing more than one byte for |
442 | * transfer, thus this function precisely implements their serial_puts(). | 444 | * transfer, thus this function precisely implements their serial_puts(). |
443 | * | 445 | * |
444 | * To optimize the number of get_current() calls, this function only | 446 | * To optimize the number of get_current() calls, this function only |
445 | * calls get_current() once and then directly accesses the putc() call | 447 | * calls get_current() once and then directly accesses the putc() call |
446 | * of the &struct serial_device . | 448 | * of the &struct serial_device . |
447 | */ | 449 | */ |
448 | void default_serial_puts(const char *s) | 450 | void default_serial_puts(const char *s) |
449 | { | 451 | { |
450 | struct serial_device *dev = get_current(); | 452 | struct serial_device *dev = get_current(); |
451 | while (*s) | 453 | while (*s) |
452 | dev->putc(*s++); | 454 | dev->putc(*s++); |
453 | } | 455 | } |
454 | 456 | ||
455 | #if CONFIG_POST & CONFIG_SYS_POST_UART | 457 | #if CONFIG_POST & CONFIG_SYS_POST_UART |
456 | static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE; | 458 | static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE; |
457 | 459 | ||
458 | /** | 460 | /** |
459 | * uart_post_test() - Test the currently selected serial port using POST | 461 | * uart_post_test() - Test the currently selected serial port using POST |
460 | * @flags: POST framework flags | 462 | * @flags: POST framework flags |
461 | * | 463 | * |
462 | * Do a loopback test of the currently selected serial port. This | 464 | * Do a loopback test of the currently selected serial port. This |
463 | * function is only useful in the context of the POST testing framwork. | 465 | * function is only useful in the context of the POST testing framwork. |
464 | * The serial port is first configured into loopback mode and then | 466 | * The serial port is first configured into loopback mode and then |
465 | * characters are sent through it. | 467 | * characters are sent through it. |
466 | * | 468 | * |
467 | * Returns 0 on success, value otherwise. | 469 | * Returns 0 on success, value otherwise. |
468 | */ | 470 | */ |
469 | /* Mark weak until post/cpu/.../uart.c migrate over */ | 471 | /* Mark weak until post/cpu/.../uart.c migrate over */ |
470 | __weak | 472 | __weak |
471 | int uart_post_test(int flags) | 473 | int uart_post_test(int flags) |
472 | { | 474 | { |
473 | unsigned char c; | 475 | unsigned char c; |
474 | int ret, saved_baud, b; | 476 | int ret, saved_baud, b; |
475 | struct serial_device *saved_dev, *s; | 477 | struct serial_device *saved_dev, *s; |
476 | 478 | ||
477 | /* Save current serial state */ | 479 | /* Save current serial state */ |
478 | ret = 0; | 480 | ret = 0; |
479 | saved_dev = serial_current; | 481 | saved_dev = serial_current; |
480 | saved_baud = gd->baudrate; | 482 | saved_baud = gd->baudrate; |
481 | 483 | ||
482 | for (s = serial_devices; s; s = s->next) { | 484 | for (s = serial_devices; s; s = s->next) { |
483 | /* If this driver doesn't support loop back, skip it */ | 485 | /* If this driver doesn't support loop back, skip it */ |
484 | if (!s->loop) | 486 | if (!s->loop) |
485 | continue; | 487 | continue; |
486 | 488 | ||
487 | /* Test the next device */ | 489 | /* Test the next device */ |
488 | serial_current = s; | 490 | serial_current = s; |
489 | 491 | ||
490 | ret = serial_init(); | 492 | ret = serial_init(); |
491 | if (ret) | 493 | if (ret) |
492 | goto done; | 494 | goto done; |
493 | 495 | ||
494 | /* Consume anything that happens to be queued */ | 496 | /* Consume anything that happens to be queued */ |
495 | while (serial_tstc()) | 497 | while (serial_tstc()) |
496 | serial_getc(); | 498 | serial_getc(); |
497 | 499 | ||
498 | /* Enable loop back */ | 500 | /* Enable loop back */ |
499 | s->loop(1); | 501 | s->loop(1); |
500 | 502 | ||
501 | /* Test every available baud rate */ | 503 | /* Test every available baud rate */ |
502 | for (b = 0; b < ARRAY_SIZE(bauds); ++b) { | 504 | for (b = 0; b < ARRAY_SIZE(bauds); ++b) { |
503 | gd->baudrate = bauds[b]; | 505 | gd->baudrate = bauds[b]; |
504 | serial_setbrg(); | 506 | serial_setbrg(); |
505 | 507 | ||
506 | /* | 508 | /* |
507 | * Stick to printable chars to avoid issues: | 509 | * Stick to printable chars to avoid issues: |
508 | * - terminal corruption | 510 | * - terminal corruption |
509 | * - serial program reacting to sequences and sending | 511 | * - serial program reacting to sequences and sending |
510 | * back random extra data | 512 | * back random extra data |
511 | * - most serial drivers add in extra chars (like \r\n) | 513 | * - most serial drivers add in extra chars (like \r\n) |
512 | */ | 514 | */ |
513 | for (c = 0x20; c < 0x7f; ++c) { | 515 | for (c = 0x20; c < 0x7f; ++c) { |
514 | /* Send it out */ | 516 | /* Send it out */ |
515 | serial_putc(c); | 517 | serial_putc(c); |
516 | 518 | ||
517 | /* Make sure it's the same one */ | 519 | /* Make sure it's the same one */ |
518 | ret = (c != serial_getc()); | 520 | ret = (c != serial_getc()); |
519 | if (ret) { | 521 | if (ret) { |
520 | s->loop(0); | 522 | s->loop(0); |
521 | goto done; | 523 | goto done; |
522 | } | 524 | } |
523 | 525 | ||
524 | /* Clean up the output in case it was sent */ | 526 | /* Clean up the output in case it was sent */ |
525 | serial_putc('\b'); | 527 | serial_putc('\b'); |
526 | ret = ('\b' != serial_getc()); | 528 | ret = ('\b' != serial_getc()); |
527 | if (ret) { | 529 | if (ret) { |
528 | s->loop(0); | 530 | s->loop(0); |
529 | goto done; | 531 | goto done; |
530 | } | 532 | } |
531 | } | 533 | } |
532 | } | 534 | } |
533 | 535 | ||
534 | /* Disable loop back */ | 536 | /* Disable loop back */ |
535 | s->loop(0); | 537 | s->loop(0); |
536 | 538 | ||
537 | /* XXX: There is no serial_stop() !? */ | 539 | /* XXX: There is no serial_stop() !? */ |
538 | if (s->stop) | 540 | if (s->stop) |
539 | s->stop(); | 541 | s->stop(); |
540 | } | 542 | } |
541 | 543 | ||
542 | done: | 544 | done: |
543 | /* Restore previous serial state */ | 545 | /* Restore previous serial state */ |
544 | serial_current = saved_dev; | 546 | serial_current = saved_dev; |
545 | gd->baudrate = saved_baud; | 547 | gd->baudrate = saved_baud; |
546 | serial_reinit_all(); | 548 | serial_reinit_all(); |
547 | serial_setbrg(); | 549 | serial_setbrg(); |
548 | 550 | ||
549 | return ret; | 551 | return ret; |
550 | } | 552 | } |
551 | #endif | 553 | #endif |
552 | 554 |
drivers/serial/serial_xen.c
File was created | 1 | /* | |
2 | * Copyright 2018 NXP | ||
3 | * | ||
4 | * SPDX-License-Identifier: GPL-2.0+ | ||
5 | */ | ||
6 | |||
7 | #include <common.h> | ||
8 | #include <dm.h> | ||
9 | #include <errno.h> | ||
10 | #include <serial.h> | ||
11 | |||
12 | extern void xenprintf(const char *buf); | ||
13 | extern void xenprintc(const char c); | ||
14 | #ifndef CONFIG_DM_SERIAL | ||
15 | |||
16 | static void xen_debug_serial_putc(const char c) | ||
17 | { | ||
18 | /* If \n, also do \r */ | ||
19 | if (c == '\n') | ||
20 | serial_putc('\r'); | ||
21 | |||
22 | xenprintc(c); | ||
23 | } | ||
24 | |||
25 | static void xen_debug_serial_puts(const char *buf) | ||
26 | { | ||
27 | xenprintf(buf); | ||
28 | } | ||
29 | |||
30 | static int xen_debug_serial_start(void) | ||
31 | { | ||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | static void xen_debug_serial_setbrg(void) | ||
36 | { | ||
37 | |||
38 | } | ||
39 | |||
40 | static int xen_debug_serial_getc(void) | ||
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | |||
45 | static int xen_debug_serial_tstc(void) | ||
46 | { | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static struct serial_device xen_debug_serial_drv = { | ||
51 | .name = "xen_debug_serial", | ||
52 | .start = xen_debug_serial_start, | ||
53 | .stop = NULL, | ||
54 | .setbrg = xen_debug_serial_setbrg, | ||
55 | .putc = xen_debug_serial_putc, | ||
56 | .puts = xen_debug_serial_puts, | ||
57 | .getc = xen_debug_serial_getc, | ||
58 | .tstc = xen_debug_serial_tstc, | ||
59 | }; | ||
60 | |||
61 | void xen_debug_serial_initialize(void) | ||
62 | { | ||
63 | serial_register(&xen_debug_serial_drv); | ||
64 | } | ||
65 | |||
66 | __weak struct serial_device *default_serial_console(void) | ||
67 | { | ||
68 | return &xen_debug_serial_drv; | ||
69 | } | ||
70 | #endif | ||
71 |