1 From b62450cf229c50ad2ce819dd02a09726909cc89a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
3 Date: Fri, 27 May 2022 22:15:24 +0200
4 Subject: [PATCH] serial: Replace CONFIG_DEBUG_UART_BASE by
5 CONFIG_VAL(DEBUG_UART_BASE)
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 CONFIG_VAL(DEBUG_UART_BASE) expands to CONFIG_DEBUG_UART_BASE or
11 CONFIG_SPL_DEBUG_UART_BASE or CONFIG_TPL_DEBUG_UART_BASE and allows boards
12 to set different values for SPL, TPL and U-Boot Proper.
14 For ns16550 driver this support is there since commit d293759d55cc
15 ("serial: ns16550: Add support for SPL_DEBUG_UART_BASE").
17 Signed-off-by: Pali Rohár <pali@kernel.org>
19 arch/arm/mach-uniphier/debug-uart/debug-uart.c | 4 ++--
20 arch/x86/cpu/apollolake/cpu_common.c | 2 +-
21 board/eets/pdu001/board.c | 2 +-
22 drivers/serial/altera_jtag_uart.c | 2 +-
23 drivers/serial/altera_uart.c | 4 ++--
24 drivers/serial/atmel_usart.c | 4 ++--
25 drivers/serial/serial_ar933x.c | 4 ++--
26 drivers/serial/serial_arc.c | 4 ++--
27 drivers/serial/serial_bcm6345.c | 4 ++--
28 drivers/serial/serial_linflexuart.c | 4 ++--
29 drivers/serial/serial_meson.c | 2 +-
30 drivers/serial/serial_msm_geni.c | 6 +++---
31 drivers/serial/serial_mt7620.c | 4 ++--
32 drivers/serial/serial_mtk.c | 4 ++--
33 drivers/serial/serial_mvebu_a3700.c | 4 ++--
34 drivers/serial/serial_mxc.c | 4 ++--
35 drivers/serial/serial_omap.c | 4 ++--
36 drivers/serial/serial_pic32.c | 4 ++--
37 drivers/serial/serial_pl01x.c | 4 ++--
38 drivers/serial/serial_s5p.c | 4 ++--
39 drivers/serial/serial_sifive.c | 4 ++--
40 drivers/serial/serial_stm32.c | 4 ++--
41 drivers/serial/serial_xuartlite.c | 4 ++--
42 drivers/serial/serial_zynq.c | 4 ++--
43 24 files changed, 45 insertions(+), 45 deletions(-)
45 --- a/arch/arm/mach-uniphier/debug-uart/debug-uart.c
46 +++ b/arch/arm/mach-uniphier/debug-uart/debug-uart.c
49 static void _debug_uart_putc(int c)
51 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
52 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
54 while (!(readl(base + UNIPHIER_UART_LSR) & UART_LSR_THRE))
56 @@ -57,7 +57,7 @@ void sg_set_iectrl(unsigned int pin)
57 void _debug_uart_init(void)
59 #ifdef CONFIG_SPL_BUILD
60 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
61 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
64 switch (uniphier_get_soc_id()) {
65 --- a/arch/x86/cpu/apollolake/cpu_common.c
66 +++ b/arch/x86/cpu/apollolake/cpu_common.c
67 @@ -72,7 +72,7 @@ static void pch_uart_init(void)
70 #ifdef CONFIG_DEBUG_UART
71 - apl_uart_init(PCH_DEV_UART, CONFIG_DEBUG_UART_BASE);
72 + apl_uart_init(PCH_DEV_UART, CONFIG_VAL(DEBUG_UART_BASE));
76 --- a/board/eets/pdu001/board.c
77 +++ b/board/eets/pdu001/board.c
78 @@ -273,7 +273,7 @@ void board_debug_uart_init(void)
81 /* done by pin controller driver if not debugging */
82 - enable_uart_pin_mux(CONFIG_DEBUG_UART_BASE);
83 + enable_uart_pin_mux(CONFIG_VAL(DEBUG_UART_BASE));
87 --- a/drivers/serial/altera_jtag_uart.c
88 +++ b/drivers/serial/altera_jtag_uart.c
89 @@ -134,7 +134,7 @@ static inline void _debug_uart_init(void
91 static inline void _debug_uart_putc(int ch)
93 - struct altera_jtaguart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
94 + struct altera_jtaguart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
97 u32 st = readl(®s->control);
98 --- a/drivers/serial/altera_uart.c
99 +++ b/drivers/serial/altera_uart.c
100 @@ -123,7 +123,7 @@ U_BOOT_DRIVER(altera_uart) = {
102 static inline void _debug_uart_init(void)
104 - struct altera_uart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
105 + struct altera_uart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
108 div = (CONFIG_DEBUG_UART_CLOCK / CONFIG_BAUDRATE) - 1;
109 @@ -132,7 +132,7 @@ static inline void _debug_uart_init(void
111 static inline void _debug_uart_putc(int ch)
113 - struct altera_uart_regs *regs = (void *)CONFIG_DEBUG_UART_BASE;
114 + struct altera_uart_regs *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
117 u32 st = readl(®s->status);
118 --- a/drivers/serial/atmel_usart.c
119 +++ b/drivers/serial/atmel_usart.c
120 @@ -319,14 +319,14 @@ U_BOOT_DRIVER(serial_atmel) = {
121 #ifdef CONFIG_DEBUG_UART_ATMEL
122 static inline void _debug_uart_init(void)
124 - atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
125 + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_VAL(DEBUG_UART_BASE);
127 _atmel_serial_init(usart, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
130 static inline void _debug_uart_putc(int ch)
132 - atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_DEBUG_UART_BASE;
133 + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_VAL(DEBUG_UART_BASE);
135 while (!(readl(&usart->csr) & USART3_BIT(TXRDY)))
137 --- a/drivers/serial/serial_ar933x.c
138 +++ b/drivers/serial/serial_ar933x.c
139 @@ -199,7 +199,7 @@ U_BOOT_DRIVER(serial_ar933x) = {
141 static inline void _debug_uart_init(void)
143 - void __iomem *regs = (void *)CONFIG_DEBUG_UART_BASE;
144 + void __iomem *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
145 u32 val, scale, step;
148 @@ -227,7 +227,7 @@ static inline void _debug_uart_init(void
150 static inline void _debug_uart_putc(int c)
152 - void __iomem *regs = (void *)CONFIG_DEBUG_UART_BASE;
153 + void __iomem *regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
157 --- a/drivers/serial/serial_arc.c
158 +++ b/drivers/serial/serial_arc.c
159 @@ -137,7 +137,7 @@ U_BOOT_DRIVER(serial_arc) = {
161 static inline void _debug_uart_init(void)
163 - struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
164 + struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_VAL(DEBUG_UART_BASE);
165 int arc_console_baud = CONFIG_DEBUG_UART_CLOCK / (CONFIG_BAUDRATE * 4) - 1;
167 writeb(arc_console_baud & 0xff, ®s->baudl);
168 @@ -146,7 +146,7 @@ static inline void _debug_uart_init(void
170 static inline void _debug_uart_putc(int c)
172 - struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_DEBUG_UART_BASE;
173 + struct arc_serial_regs *regs = (struct arc_serial_regs *)CONFIG_VAL(DEBUG_UART_BASE);
175 while (!(readb(®s->status) & UART_TXEMPTY))
177 --- a/drivers/serial/serial_bcm6345.c
178 +++ b/drivers/serial/serial_bcm6345.c
179 @@ -269,7 +269,7 @@ U_BOOT_DRIVER(bcm6345_serial) = {
180 #ifdef CONFIG_DEBUG_UART_BCM6345
181 static inline void _debug_uart_init(void)
183 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
184 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
186 bcm6345_serial_init(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
188 @@ -285,7 +285,7 @@ static inline void wait_xfered(void __io
190 static inline void _debug_uart_putc(int ch)
192 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
193 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
196 writel(ch, base + UART_FIFO_REG);
197 --- a/drivers/serial/serial_linflexuart.c
198 +++ b/drivers/serial/serial_linflexuart.c
199 @@ -201,14 +201,14 @@ U_BOOT_DRIVER(serial_linflex) = {
201 static inline void _debug_uart_init(void)
203 - struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;
204 + struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_VAL(DEBUG_UART_BASE);
206 linflex_serial_init_internal(base);
209 static inline void _debug_uart_putc(int ch)
211 - struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_DEBUG_UART_BASE;
212 + struct linflex_fsl *base = (struct linflex_fsl *)CONFIG_VAL(DEBUG_UART_BASE);
214 /* XXX: Is this OK? Should this use the non-DM version? */
215 _linflex_serial_putc(base, ch);
216 --- a/drivers/serial/serial_meson.c
217 +++ b/drivers/serial/serial_meson.c
218 @@ -182,7 +182,7 @@ static inline void _debug_uart_init(void
220 static inline void _debug_uart_putc(int ch)
222 - struct meson_uart *regs = (struct meson_uart *)CONFIG_DEBUG_UART_BASE;
223 + struct meson_uart *regs = (struct meson_uart *)CONFIG_VAL(DEBUG_UART_BASE);
225 while (readl(®s->status) & AML_UART_TX_FULL)
227 --- a/drivers/serial/serial_msm_geni.c
228 +++ b/drivers/serial/serial_msm_geni.c
229 @@ -569,7 +569,7 @@ U_BOOT_DRIVER(serial_msm_geni) = {
230 #ifdef CONFIG_DEBUG_UART_MSM_GENI
232 static struct msm_serial_data init_serial_data = {
233 - .base = CONFIG_DEBUG_UART_BASE
234 + .base = CONFIG_VAL(DEBUG_UART_BASE)
237 /* Serial dumb device, to reuse driver code */
238 @@ -587,7 +587,7 @@ static struct udevice init_dev = {
240 static inline void _debug_uart_init(void)
242 - phys_addr_t base = CONFIG_DEBUG_UART_BASE;
243 + phys_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
245 geni_serial_init(&init_dev);
246 geni_serial_baud(base, CLK_DIV, CONFIG_BAUDRATE);
247 @@ -596,7 +596,7 @@ static inline void _debug_uart_init(void
249 static inline void _debug_uart_putc(int ch)
251 - phys_addr_t base = CONFIG_DEBUG_UART_BASE;
252 + phys_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
254 writel(DEF_TX_WM, base + SE_GENI_TX_WATERMARK_REG);
255 qcom_geni_serial_setup_tx(base, 1);
256 --- a/drivers/serial/serial_mt7620.c
257 +++ b/drivers/serial/serial_mt7620.c
258 @@ -220,7 +220,7 @@ static inline void _debug_uart_init(void
260 struct mt7620_serial_plat plat;
262 - plat.regs = (void *)CONFIG_DEBUG_UART_BASE;
263 + plat.regs = (void *)CONFIG_VAL(DEBUG_UART_BASE);
264 plat.clock = CONFIG_DEBUG_UART_CLOCK;
266 writel(0, &plat.regs->ier);
267 @@ -233,7 +233,7 @@ static inline void _debug_uart_init(void
268 static inline void _debug_uart_putc(int ch)
270 struct mt7620_serial_regs __iomem *regs =
271 - (void *)CONFIG_DEBUG_UART_BASE;
272 + (void *)CONFIG_VAL(DEBUG_UART_BASE);
274 while (!(readl(®s->lsr) & UART_LSR_THRE))
276 --- a/drivers/serial/serial_mtk.c
277 +++ b/drivers/serial/serial_mtk.c
278 @@ -426,7 +426,7 @@ static inline void _debug_uart_init(void
280 struct mtk_serial_priv priv;
282 - priv.regs = (void *) CONFIG_DEBUG_UART_BASE;
283 + priv.regs = (void *) CONFIG_VAL(DEBUG_UART_BASE);
284 priv.clock = CONFIG_DEBUG_UART_CLOCK;
286 writel(0, &priv.regs->ier);
287 @@ -439,7 +439,7 @@ static inline void _debug_uart_init(void
288 static inline void _debug_uart_putc(int ch)
290 struct mtk_serial_regs __iomem *regs =
291 - (void *) CONFIG_DEBUG_UART_BASE;
292 + (void *) CONFIG_VAL(DEBUG_UART_BASE);
294 while (!(readl(®s->lsr) & UART_LSR_THRE))
296 --- a/drivers/serial/serial_mvebu_a3700.c
297 +++ b/drivers/serial/serial_mvebu_a3700.c
298 @@ -321,7 +321,7 @@ U_BOOT_DRIVER(serial_mvebu) = {
300 static inline void _debug_uart_init(void)
302 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
303 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
304 u32 parent_rate, divider;
307 @@ -349,7 +349,7 @@ static inline void _debug_uart_init(void
309 static inline void _debug_uart_putc(int ch)
311 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
312 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
314 while (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL)
316 --- a/drivers/serial/serial_mxc.c
317 +++ b/drivers/serial/serial_mxc.c
318 @@ -372,7 +372,7 @@ U_BOOT_DRIVER(serial_mxc) = {
320 static inline void _debug_uart_init(void)
322 - struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
323 + struct mxc_uart *base = (struct mxc_uart *)CONFIG_VAL(DEBUG_UART_BASE);
325 _mxc_serial_init(base, false);
326 _mxc_serial_setbrg(base, CONFIG_DEBUG_UART_CLOCK,
327 @@ -381,7 +381,7 @@ static inline void _debug_uart_init(void
329 static inline void _debug_uart_putc(int ch)
331 - struct mxc_uart *base = (struct mxc_uart *)CONFIG_DEBUG_UART_BASE;
332 + struct mxc_uart *base = (struct mxc_uart *)CONFIG_VAL(DEBUG_UART_BASE);
334 while (!(readl(&base->ts) & UTS_TXEMPTY))
336 --- a/drivers/serial/serial_omap.c
337 +++ b/drivers/serial/serial_omap.c
338 @@ -66,7 +66,7 @@ static inline int serial_in_shift(void *
340 static inline void _debug_uart_init(void)
342 - struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE;
343 + struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
346 baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK,
347 @@ -85,7 +85,7 @@ static inline void _debug_uart_init(void
349 static inline void _debug_uart_putc(int ch)
351 - struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE;
352 + struct ns16550 *com_port = (struct ns16550 *)CONFIG_VAL(DEBUG_UART_BASE);
354 while (!(serial_din(&com_port->lsr) & UART_LSR_THRE))
356 --- a/drivers/serial/serial_pic32.c
357 +++ b/drivers/serial/serial_pic32.c
358 @@ -187,14 +187,14 @@ U_BOOT_DRIVER(pic32_serial) = {
360 static inline void _debug_uart_init(void)
362 - void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
363 + void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
365 pic32_serial_init(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
368 static inline void _debug_uart_putc(int ch)
370 - writel(ch, CONFIG_DEBUG_UART_BASE + U_TXR);
371 + writel(ch, CONFIG_VAL(DEBUG_UART_BASE) + U_TXR);
375 --- a/drivers/serial/serial_pl01x.c
376 +++ b/drivers/serial/serial_pl01x.c
377 @@ -403,7 +403,7 @@ U_BOOT_DRIVER(serial_pl01x) = {
378 static void _debug_uart_init(void)
380 #ifndef CONFIG_DEBUG_UART_SKIP_INIT
381 - struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
382 + struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_VAL(DEBUG_UART_BASE);
383 enum pl01x_type type;
385 if (IS_ENABLED(CONFIG_DEBUG_UART_PL011))
386 @@ -419,7 +419,7 @@ static void _debug_uart_init(void)
388 static inline void _debug_uart_putc(int ch)
390 - struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
391 + struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_VAL(DEBUG_UART_BASE);
393 while (pl01x_putc(regs, ch) == -EAGAIN)
395 --- a/drivers/serial/serial_s5p.c
396 +++ b/drivers/serial/serial_s5p.c
397 @@ -276,7 +276,7 @@ static inline void _debug_uart_init(void
398 if (IS_ENABLED(CONFIG_DEBUG_UART_SKIP_INIT))
401 - struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
402 + struct s5p_uart *uart = (struct s5p_uart *)CONFIG_VAL(DEBUG_UART_BASE);
404 s5p_serial_init(uart);
405 #if CONFIG_IS_ENABLED(ARCH_APPLE)
406 @@ -288,7 +288,7 @@ static inline void _debug_uart_init(void
408 static inline void _debug_uart_putc(int ch)
410 - struct s5p_uart *uart = (struct s5p_uart *)CONFIG_DEBUG_UART_BASE;
411 + struct s5p_uart *uart = (struct s5p_uart *)CONFIG_VAL(DEBUG_UART_BASE);
413 #if CONFIG_IS_ENABLED(ARCH_APPLE)
414 while (readl(&uart->ufstat) & S5L_TX_FIFO_FULL);
415 --- a/drivers/serial/serial_sifive.c
416 +++ b/drivers/serial/serial_sifive.c
417 @@ -212,7 +212,7 @@ U_BOOT_DRIVER(serial_sifive) = {
418 static inline void _debug_uart_init(void)
420 struct uart_sifive *regs =
421 - (struct uart_sifive *)CONFIG_DEBUG_UART_BASE;
422 + (struct uart_sifive *)CONFIG_VAL(DEBUG_UART_BASE);
424 _sifive_serial_setbrg(regs, CONFIG_DEBUG_UART_CLOCK,
426 @@ -222,7 +222,7 @@ static inline void _debug_uart_init(void
427 static inline void _debug_uart_putc(int ch)
429 struct uart_sifive *regs =
430 - (struct uart_sifive *)CONFIG_DEBUG_UART_BASE;
431 + (struct uart_sifive *)CONFIG_VAL(DEBUG_UART_BASE);
433 while (_sifive_serial_putc(regs, ch) == -EAGAIN)
435 --- a/drivers/serial/serial_stm32.c
436 +++ b/drivers/serial/serial_stm32.c
437 @@ -270,7 +270,7 @@ static inline struct stm32_uart_info *_d
439 static inline void _debug_uart_init(void)
441 - fdt_addr_t base = CONFIG_DEBUG_UART_BASE;
442 + fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
443 struct stm32_uart_info *uart_info = _debug_uart_info();
445 _stm32_serial_init(base, uart_info);
446 @@ -281,7 +281,7 @@ static inline void _debug_uart_init(void
448 static inline void _debug_uart_putc(int c)
450 - fdt_addr_t base = CONFIG_DEBUG_UART_BASE;
451 + fdt_addr_t base = CONFIG_VAL(DEBUG_UART_BASE);
452 struct stm32_uart_info *uart_info = _debug_uart_info();
454 while (_stm32_serial_putc(base, uart_info, c) == -EAGAIN)
455 --- a/drivers/serial/serial_xuartlite.c
456 +++ b/drivers/serial/serial_xuartlite.c
457 @@ -143,7 +143,7 @@ U_BOOT_DRIVER(serial_uartlite) = {
459 static inline void _debug_uart_init(void)
461 - struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE;
462 + struct uartlite *regs = (struct uartlite *)CONFIG_VAL(DEBUG_UART_BASE);
465 uart_out32(®s->control, 0);
466 @@ -159,7 +159,7 @@ static inline void _debug_uart_init(void
468 static inline void _debug_uart_putc(int ch)
470 - struct uartlite *regs = (struct uartlite *)CONFIG_DEBUG_UART_BASE;
471 + struct uartlite *regs = (struct uartlite *)CONFIG_VAL(DEBUG_UART_BASE);
473 while (uart_in32(®s->status) & SR_TX_FIFO_FULL)
475 --- a/drivers/serial/serial_zynq.c
476 +++ b/drivers/serial/serial_zynq.c
477 @@ -295,7 +295,7 @@ U_BOOT_DRIVER(serial_zynq) = {
478 #ifdef CONFIG_DEBUG_UART_ZYNQ
479 static inline void _debug_uart_init(void)
481 - struct uart_zynq *regs = (struct uart_zynq *)CONFIG_DEBUG_UART_BASE;
482 + struct uart_zynq *regs = (struct uart_zynq *)CONFIG_VAL(DEBUG_UART_BASE);
484 _uart_zynq_serial_init(regs);
485 _uart_zynq_serial_setbrg(regs, CONFIG_DEBUG_UART_CLOCK,
486 @@ -304,7 +304,7 @@ static inline void _debug_uart_init(void
488 static inline void _debug_uart_putc(int ch)
490 - struct uart_zynq *regs = (struct uart_zynq *)CONFIG_DEBUG_UART_BASE;
491 + struct uart_zynq *regs = (struct uart_zynq *)CONFIG_VAL(DEBUG_UART_BASE);
493 while (_uart_zynq_serial_putc(regs, ch) == -EAGAIN)