慢慢欣赏linux 串口驱动前传uboot传递串口参数

uboot找到默认串口
int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
    =>boot_prep_linux(images);
    =>ret = boot_body_linux(images);
        =>/* allocate space for kernel copy of board info */
        ret = boot_bd_t_linux(images);
        =>ret = image_setup_linux(images);
            =>if (IMAGE_ENABLE_OF_LIBFDT && of_size)
                ret = image_setup_libfdt(images, *of_flat_tree, of_size, lmb);
                    =>fdt_chosen(blob)
                        =>fdt_fixup_stdout(fdt, nodeoffset);
                            =>fdt_setprop(fdt, chosenoff, "linux,stdout-path",  OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1);
                                #define OF_STDOUT_PATH        "/soc@01c00000/serial@01f02800:115200" //其中一个定义,定义默认输出串口
                                //另外一个例子,"/soc@ff0000000/serial@11c500"
    =>boot_jump_linux(images);
 

设备树定义

serial0: serial@11c500 {
            cell-index = <0>;
            device_type = "serial";
            compatible = "ns16550";
            reg = <0x11c500 0x100>;
            clock-frequency = <0>;
            interrupts = <36 2>;
            interrupt-parent = <&mpic>;
        };

        serial1: serial@11c600 {
            cell-index = <1>;
            device_type = "serial";
            compatible = "ns16550";
            reg = <0x11c600 0x100>;
            clock-frequency = <0>;
            interrupts = <36 2>;
            interrupt-parent = <&mpic>;
        };

猜你喜欢

转载自blog.csdn.net/shipinsky/article/details/82533859