[PATCH] MIPS: DEBUG_LL_UART_DIVISOR is 0, use a0 instead
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Sep 11 10:07:43 EDT 2020
On 9/11/20 2:33 PM, Du Huanpeng wrote:
> this make it possiable pass a0 as divisor to calculate uart baudrate
> in run time on boot.
This is not Ok. Your last commit has your board pass the divisor in a0 now, but other
boards, like the netgear-wg102, don't. Your change might break their UART because the
code there doesn't expect that a0 needs to have a valid value. If you want to do this,
you should migrate all users of this function all at once to supply a valid divisor
(probably `move a0, DEBUG_LL_UART_DIVISOR`).
It's same thing in C. You don't add a new parameter to a function without checking
that all callsites handle this correctly.
>
> Signed-off-by: Du Huanpeng <u74147 at gmail.com>
> ---
> arch/mips/include/asm/debug_ll_ns16550.h | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h
> index df58c4c..a33587a 100644
> --- a/arch/mips/include/asm/debug_ll_ns16550.h
> +++ b/arch/mips/include/asm/debug_ll_ns16550.h
> @@ -66,6 +66,9 @@ static inline void PUTC_LL(char ch)
> sb t1, UART_LCR(t0) /* Write it out */
>
> li t1, DEBUG_LL_UART_DIVISOR
> +#if DEBUG_LL_UART_DIVISOR == 0
> + move t1, a0
> +#endif
> sb t1, UART_DLL(t0) /* write low order byte */
> srl t1, t1, 8
> sb t1, UART_DLM(t0) /* write high order byte */
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list