PabloPL / linux

Linux kernel source tree
Other
17 stars 0 forks source link

when i select console on samsung soc serial port , it cant entry console #47

Closed LazyCat-xiao closed 3 years ago

LazyCat-xiao commented 3 years ago

my bootargs is 'console=ttySAC1 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk', dmeg is stop 'printk: bootconsole [earlycon0] disabled'

LazyCat-xiao commented 3 years ago

kernel 5.8 5.9 5.10 is same

xc-racer99 commented 3 years ago

Are you wanting the console for debug output or to login at? If you're wanting debug output, trying setting the stdout property of chosen, ie like https://github.com/xc-racer99/linux/blob/modem-audio/arch/arm/boot/dts/s5pv210-galaxys.dts#L14

Also, depending on the baud rate you've chosen, make sure that the clocks are properly setup. There can be multiple clock providers for the uart.

LazyCat-xiao commented 3 years ago

yes i want to login at uart. i add "stdout-path" in my dts but is not work. i add some print info and i find it stop at uart driver (samsung_tty.c at 2081 line "clk_disable_unprepare(ourport->baudclk);"). i comment it and it can work but i input something have some mistakes.

LazyCat-xiao commented 3 years ago

i try to edit samsung_tty.c and it working orgin

    if (!s3c24xx_uart_drv.state) {
        ret = uart_register_driver(&s3c24xx_uart_drv);
        if (ret < 0) {
            pr_err("Failed to register Samsung UART driver\n");
            return ret;
        }
    }

    dev_dbg(&pdev->dev, "%s: adding port\n", __func__);
    uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
    platform_set_drvdata(pdev, &ourport->port);

    clk_disable_unprepare(ourport->clk);
    if (!IS_ERR(ourport->baudclk))
        clk_disable_unprepare(ourport->baudclk);
    ret = s3c24xx_serial_cpufreq_register(ourport);
    if (ret < 0)
        dev_err(&pdev->dev, "failed to add cpufreq notifier\n");
    probe_index++;
    return 0;

before

    if (ret < 0)
        dev_err(&pdev->dev, "failed to add cpufreq notifier\n");

    dev_dbg(&pdev->dev, "%s: adding port\n", __func__);
    uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
    platform_set_drvdata(pdev, &ourport->port);

         probe_index++;
    return 0;
PabloPL commented 3 years ago

Are You using correct uart ? In bootargs whihc You posted, there is ttySAC1 where on Your uboot github we can see that it's using ttySAC2 (https://github.com/LazyCat-xiao/x210-uboot202010/blob/master/arch/arm/dts/x210.dts#L18) the same like it's used on Samsung Aries phones (https://github.com/xc-racer99/u-boot-aries/blob/v2018.09-aries/arch/arm/dts/s5pc1xx-aries.dts#L19).

So instead of

console=ttySAC1 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk'

please try

console=ttySAC2 root=/dev/mmcblk0p1 rw rootwait ignore_loglevel earlyprintk'

So that would mean that uboot is using ttySAC2 as console where linux kernel is using ttySAC1, so that's why You're loosing logs after kernel boots.

LazyCat-xiao commented 3 years ago

i disable uart1 in kernel device tree so ttySAC1 is uart2. in 5.8 or late i select console on uart cant boot stop diable console. i adjust the code and it can entry console.