msm8909+android5.1.1--打开调试(debug)串口

msm8909+android5.1.1--打开调试(debug)串口

1.共同修改的地方

(1)kernel\arch\arm\configs\msm8909-1gb-CB03_defconfig

使以下项有效

CONFIG_SERIAL_MSM_HSL=y

CONFIG_SERIAL_MSM_HSL_CONSOLE=y

 

增加以下项

CONFIG_DEBUG_LL=y

CONFIG_EARLY_PRINTK=y

 

(2)Root/bootable/bootloader/lk/project/msms8909.mk

确保DEFINES += WITH_DEBUG_UART=1

 

2.V1.0主板

msm8909+android5.1.1--打开调试(debug)串口_第1张图片

图1

UART1_TX-------GPIO_4

UART1_RX-------GPIO_5

 

(3)device\qcom\sepolicy\common\file_contexts----需要make –j4才生效

使以下项有效

/dev/ttyHSL0u:object_r:console_device:s0

 

(4)kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

使以下项不生效

spi0 = &spi_0; /* SPI0 controller device*/

使以下项有效

 

?
1
2
3
4
5
6
7
8
9
blsp1_uart1:serial @78af000 {
         compatible= "qcom,msm-lsuart-v14" ;
         reg= < 0x78af000 0x200 >;
         interrupts= < 0 107 0 >;
         status= "disabled" ;
         clocks= <&clock_gcc clk_gcc_blsp1_uart1_apps_clk>,
                 <&clock_gcc clk_gcc_blsp1_ahb_clk>;
         clock-names= "core_clk" , "iface_clk" ;
  };

 

(5)kernel\arch\arm\boot\dts\qcom\msm8909-qrd-cb03.dtsi

使以下项有效

 

?
1
2
3
4
5
&blsp1_uart1 {
        status= "ok" ;
        pinctrl-names= "default" ;
        pinctrl- 0 = <&uart_console_sleep>;
};

 

3.V1.1主板

msm8909+android5.1.1--打开调试(debug)串口_第2张图片

 

图2

UART2_TX-------GPIO_20

UART2_RX-------GPIO_21

msm8909+android5.1.1--打开调试(debug)串口_第3张图片

 

图3

 

UART_VDD_EN------I2C扩展IC XRA1201的P6引脚。

 

所做的修改如下

(1)\bootable\bootloader\lk\platform\msm8909\ msm8909-clock.c

msm_clocks_msm8909[]增加:

 

?
1
2
CLK_LOOKUP( "uart2_iface_clk" ,gcc_blsp1_ahb_clk.c),
CLK_LOOKUP( "uart2_core_clk" ,  gcc_blsp1_uart2_apps_clk.c),

 

(2)bootable\bootloader\lk\target\msm8909\init.c

target_early_init()函数下

 

?
1
2
3
uart_dm_init( 1 , 0 , BLSP1_UART0_BASE);
改为
uart_dm_init( 2 , 0 , BLSP_UART1_BASE);

 

(3)\bootable\bootloader\lk\platform\msm8909\gpio.c

target_early_init()--->uart_dm_init(id)--->gpio_config_uart_dm()

 

?
1
2
3
4
5
6
7
8
/* configure rx gpio */
        gpio_tlmm_config( 5 , 2 , GPIO_INPUT, GPIO_NO_PULL,
                             GPIO_8MA,GPIO_DISABLE);
  
        /*configure tx gpio */
        gpio_tlmm_config( 4 , 2 , GPIO_OUTPUT, GPIO_NO_PULL,
                             GPIO_8MA,GPIO_DISABLE);
        #endif

 

改为

 

?
1
2
3
4
5
6
7
/* configure rx gpio */
        gpio_tlmm_config( 21 , 3 , GPIO_INPUT, GPIO_NO_PULL,
                             GPIO_8MA,GPIO_DISABLE);
  
        /*configure tx gpio */
        gpio_tlmm_config( 20 , 3 , GPIO_OUTPUT, GPIO_NO_PULL,
                             GPIO_8MA,GPIO_DISABLE);

 

(4)\kernel\arch\arm\mach-msm\include\mach\msm_iomap-8909.h

#define MSM_DEBUG_UART_PHYS 0x78AF000改为0x78B0000

 

(5)device\qcom\sepolicy\common\file_contexts

增加:

/dev/ttyHSL1 u:object_r:console_device:s0

如果有/dev/ttyHSL0 u:object_r:console_device:s0也不影响。

 

(6)kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

确保下面有效

 

?
1
2
3
4
5
6
7
8
9
blsp1_uart2: serial @78b0000 {
               compatible= "qcom,msm-lsuart-v14" ;
               reg= < 0x78b0000 0x200 >;
               interrupts= < 0 108 0 >;
               status= "disabled" ;
               clocks= <&clock_gcc clk_gcc_blsp1_uart2_apps_clk>,
                       <&clock_gcc clk_gcc_blsp1_ahb_clk>;
               clock-names= "core_clk" , "iface_clk" ;
        };

 

同时注释掉blsp1_uart1,因为BLSP1是作为SPI。

 

(7)\kernel\drivers\misc\msmgpio_ctrl.c

msmgpio_ctrl_probe()增加

gpio_direction_output(pdata->uart1_vcc,1);//确保3.3V供电

 

这里就算是改为gpio_direction_output(pdata->uart1_vcc,0);也可输出调试信息,这里可能是其他地方有电过来。

 

(8)msm8909-qrd-skue-cb03.dtsi,比较重要

 

?
1
2
3
4
5
/ {
        aliases{
               serial1= &blsp1_uart2; // should be no serial1, 0 for console
        };
};

 

这里确保为采用的串口,下面给出相关介绍

\kernel\Documentation\devicetree\bindings\tty\serial\msm_serial.txt

 

?
1
2
3
4
5
6
Aliases:
An alias may optionally be used to bind theserial device to a tty device
(ttyHSLx) with a given line number. Aliasesare of the form serial where
is an integer representing the line numberto use. On systems with multiple
serial devices present it is recommendedthat an alias be defined for each such
device.

 

(9)msm8909-pinctrl-cb03.dtsi和msm8909-pinctrl.dtsi

 

?
1
2
3
4
5
6
7
8
9
10
pmx-uartconsole {
                      qcom,pins= <&gp 4 >, <&gp 5 >;
                      qcom,num-grp-pins= < 2 >;
                      qcom,pin-func= < 2 >;
                      label= "uart-console" ;
                      uart_console_sleep:uart-console {
                             drive-strength= < 2 >;
                             bias-pull-down;
                      };
               };

 

把这两个文件下的qcom,pins =<&gp 4>, <&gp 5>;改为qcom,pins = <&gp 20>, <&gp 21>;

 

(10) \device\qcom\msm8909\ BoardConfig.mk

BOARD_KERNEL_CMDLINE :=console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcomuser_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk

上面的ttyHSL0统一改为ttyHSL1,同时去掉最后面的earlyprintk,否则启动失败信息如下:

 

?
1
2
3
4
5
Android Bootloader - UART_DM Initialized!!!
[ 70 ] Not able to search the panel:
[ 80 ] Logo config doesn't match with fbconfig. Fall back default logo
[ 520 ] Channel alloc freed
Uncompressing Linux... done, booting thekernel.

 

一开机可能就卡在这里,或是多次自动反复重启后停止这里,输出的都是这些信息。只要加上earlyprintk,就有这问题。

 

(11) kernel\arch\arm\boot\dts\qcom\msm8909-cb03.dtsi

 

4.V1.0主板和V1.1主板可显示调试信息的差异

 

V1.0主板可以输出更早启动阶段的调试信息,应该是由UART1改为UART2后,还有一些地方没有改好,如下:

 

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Format: Log Type - Time(microsec) - Message- Optional Info
Log Type: B - Since Boot(Power OnReset),  D - Delta,  S - Statistic
S -QC_IMAGE_VERSION_STRING=BOOT.BF. 3.1 . 2 .C2- 00014
S - IMAGE_VARIANT_STRING=DAASANAZA
S - OEM_IMAGE_VERSION_STRING=BU3-gongyong5
S - Boot Config, 0x000000e1
B -     1566 - PBL, Start
B -     4542 - bootable_media_detect_entry, Start
B -    74039 - bootable_media_detect_success, Start
B -    74043 - elf_loader_entry, Start
B -    75610 - auth_hash_seg_entry, Start
B -    75871 - auth_hash_seg_exit, Start
B -    90062 - elf_segs_hash_verify_entry, Start
B -   148922 - PBL, End
B -   170342 - SBL1, Start
B -   231739 - boot_flash_init, Start
D -       30 - boot_flash_init, Delta
B -   238662 - boot_config_data_table_init, Start
D -     5642 - boot_config_data_table_init, Delta - ( 0 Bytes)
B -   249276 - CDT version: 3 ,Platform ID: 11 ,Major ID: 1 ,Minor ID: 0 ,Subtype: 12
B -   257054 - pm_device_init, Start
B -   260378 - pm_device_init, TEST - MSM8909 detected
B -   266051 - pm_device_init, INFO - PM8909 is selected
B -   280783 - PM_SET_VAL:Skip
D -    22112 - pm_device_init, Delta
B -   282186 - sbl1_ddr_set_params, Start
B -   284565 - cpr_init, Start
D -        0 - cpr_init, Delta
B -   290207 - Pre_DDR_clock_init, Start
D -      183 - Pre_DDR_clock_init, Delta
D -        0 - sbl1_ddr_set_params, Delta
B -   303139 - pm_driver_init, Start
B -   309941 - --> Charge init
B -     3939 - battery voltage
B -   313448 - boot up
B -       10 - Current status
D -    10614 - pm_driver_init, Delta
B -   325557 - clock_init, Start
D -      152 - clock_init, Delta
B -   325923 - Image Load, Start
D -    22814 - QSEE Image Loaded, Delta - ( 460120 Bytes)
B -   348767 - Image Load, Start
D -      549 - SEC Image Loaded, Delta - ( 2048 Bytes)
B -   357063 - sbl1_efs_handle_cookies, Start
D -      762 - sbl1_efs_handle_cookies, Delta
B -   363773 - Image Load, Start
D -    14731 - RPM Image Loaded, Delta - ( 154076 Bytes)
B -   378535 - Image Load, Start
D -    19551 - APPSBL Image Loaded, Delta - ( 466512 Bytes)
B -   398147 - QSEE Execution, Start
D -      335 - QSEE Execution, Delta
B -   403881 - SBL1, End
D -   235826 - SBL1, Delta
S - Throughput, 33000 KB/s  ( 1082756 Bytes,  32538 us)
S - DDR Frequency, 400 MHz

你可能感兴趣的:(msm8909+android5.1.1--打开调试(debug)串口)