diff mbox series

[4/6] MIPS: Loongson64: Add 2K1000 early_printk_port

Message ID 20210209093224.7085-5-zhangqing@loongson.cn (mailing list archive)
State Superseded
Headers show
Series Add basic support for Loongson-2K1000 | expand

Commit Message

Qing Zhang Feb. 9, 2021, 9:32 a.m. UTC
Distinguish between 3A series CPU and 2K1000 CPU UART0.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
Signed-off-by: Xingxing Su <suxingxing@loongson.cn>
---
 arch/mips/loongson64/init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Jiaxun Yang Feb. 10, 2021, 11:18 a.m. UTC | #1
On Tue, Feb 9, 2021, at 5:32 PM, Qing Zhang wrote:
> Distinguish between 3A series CPU and 2K1000 CPU UART0.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
> Signed-off-by: Xingxing Su <suxingxing@loongson.cn>

Personally I don't like this kind of quirk.
Probably we should use earlycon as Arm later.

- Jiaxun

> ---
>  arch/mips/loongson64/init.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c
> index 8bef1ebab72d..a8ad02d8d088 100644
> --- a/arch/mips/loongson64/init.c
> +++ b/arch/mips/loongson64/init.c
> @@ -120,7 +120,10 @@ void __init prom_init(void)
>  #endif
>  
>  	/* Hardcode to CPU UART 0 */
> -	setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
> +	if ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64R)
> +		setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE), 0, 1024);
> +	else
> +		setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
>  
>  	register_smp_ops(&loongson3_smp_ops);
>  	board_nmi_handler_setup = mips_nmi_setup;
> -- 
> 2.20.1
> 
>
diff mbox series

Patch

diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c
index 8bef1ebab72d..a8ad02d8d088 100644
--- a/arch/mips/loongson64/init.c
+++ b/arch/mips/loongson64/init.c
@@ -120,7 +120,10 @@  void __init prom_init(void)
 #endif
 
 	/* Hardcode to CPU UART 0 */
-	setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
+	if ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64R)
+		setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE), 0, 1024);
+	else
+		setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
 
 	register_smp_ops(&loongson3_smp_ops);
 	board_nmi_handler_setup = mips_nmi_setup;