开龙主板用多个串口

 

开龙linux源码在https://github.com/lshw/loongson1-linux-3.0

把网口边上的跳线短接到uart, 然后打这个补丁, 打开3个串口


--- ls1c300a_openloongson_v2.0_platform.c.orig  2015-10-24 15:56:24.000000000 +0800
+++ ls1c300a_openloongson_v2.0_platform.c       2015-11-11 15:36:34.011882381 +0800
@@ -131,18 +131,18 @@
        for (p = ls1x_serial8250_port; p->flags != 0; ++p)
                p->uartclk = clk_get_rate(clk);

-#if 0
+#if 1
        /* 设置复用关系(EJTAG) */
        __raw_writel(__raw_readl(LS1X_CBUS_FIRST0) & (~0x0000003f), LS1X_CBUS_FIRST0);
        __raw_writel(__raw_readl(LS1X_CBUS_SECOND0) & (~0x0000003f), LS1X_CBUS_SECOND0);
        __raw_writel(__raw_readl(LS1X_CBUS_THIRD0) & (~0x0000003f), LS1X_CBUS_THIRD0);
-
        /* UART1 */
        __raw_writel(__raw_readl(LS1X_CBUS_FIRST0) & (~0x00060000), LS1X_CBUS_FIRST0);
        __raw_writel(__raw_readl(LS1X_CBUS_FIRST3) & (~0x00000060), LS1X_CBUS_FIRST3);
        __raw_writel(__raw_readl(LS1X_CBUS_SECOND1) & (~0x00000300), LS1X_CBUS_SECOND1);
        __raw_writel(__raw_readl(LS1X_CBUS_SECOND2) & (~0x00003000), LS1X_CBUS_SECOND2);
        __raw_writel(__raw_readl(LS1X_CBUS_FOURTHT0) | 0x0000000c, LS1X_CBUS_FOURTHT0);
+
        /* UART2 */
        __raw_writel(__raw_readl(LS1X_CBUS_SECOND1) & (~0x00000c30), LS1X_CBUS_SECOND1);
        __raw_writel(__raw_readl(LS1X_CBUS_THIRD0) & (~0x18000000), LS1X_CBUS_THIRD0);
 

 

 

串口的接线比较乱,见图:点击打开

 

openloongson.png