15AH, San Francisco

California, United States.

Send Your Mail At:

tianyingkejishe@sina.cn

Working Hours

Mon-Sat: 9.30am To 7.00pm

分类标题

Autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et dolore feugait.

分类归档 NXP-LX2160/LS1046

【lx2160】How to dynamically adjust MC log level using restool

Prerequisites: The board should be running Linux and connected to terminal console.

Note: For log level debug support, the restool version should be LSDK-2003-RC1 or above and MC version should be 10.20.0 or above.

To check restool version:

$ root@localhost:~# restool -v
restool LSDK-20.04

To check MC version:

root@localhost:~# restool -m
MC firmware version: 10.24.0

For debugging, use the ls-debug script available in the LSDK rootfs. There is no need to create the debug object.

ls-debug -h 
-h, –helpls-debug help information
-ts, –timestamp=XEnable/Disable timestamp printing, X is ON or OFF
-c, –console=XEnable/Disable printing in UART console, X is ON or OFF
-l, –log=XEnable/Disable printing in DDR log, X is ON or OF
-u, –uart=XSet UART ID of the console, X = [0 – 4], 0 = OFF
-ll, –level=XSet logging level, X = [0 – 5]0: Global1: Debug2: Info3: Warning4: Error5: Critical
-m, mem, –memoryDump information about memory modules available
dpxy.zDump information about MC respective object

For example, to enable logging in console with log level INFO:

$ ls-debug --log=on --console=on --level=2              
dpdbg.0 created
DDR log printing ON
UART console printing ON
Log level set to 2
$ root@localhost:~# ls-debug --memory
Memory dumped information available in MC log/console
$ root@localhost:~# cat `find /dev/ -name "*mc_console"`
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_get_obj for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dpdbg_open on DPDBG
[I, RESMAN]  Handling command: dpdbg_dump on DPDBG
[I, DPNI]  Memory info:
[I, DPNI]  MC DDR #1 cacheable memory
[I, DPNI]        Total: 134217728 bytes
[I, DPNI]        Used: 14802708 bytes
[I, DPNI]        Free: 119415020 bytes
[I, DPNI]  MC DDR #1 non-cacheable memory
[I, DPNI]        Total: 50331648 bytes
[I, DPNI]        Used: 27680 bytes
[I, DPNI]        Free: 50303968 bytes
[I, DPNI]  DMEM1 memory
[I, DPNI]        Total: 81920 bytes
[I, DPNI]        Used: 27168 bytes
[I, DPNI]        Free: 54752 bytes
[I, DPNI]  DMEM2 memory
[I, DPNI]        Total: 81920 bytes
[I, DPNI]        Used: 27168 bytes
[I, DPNI]        Free: 54752 bytes
[I, DPNI]  DDR #1 memory
[I, DPNI]        Total: 1610612736 bytes
[I, DPNI]        Used: 143163392 bytes
[I, DPNI]        Free: 1467449344 bytes
[I, DPNI]  PEB memory
[I, DPNI]        Total: 2097152 bytes
[I, DPNI]        Used: 524288 bytes
[I, DPNI]        Free: 1572864 bytes
[I, DPNI]  DP-DDR memory
[I, DPNI]        Total: 4294967296 bytes
[I, DPNI]        Used: 0 bytes
[I, DPNI]        Free: 4294967296 bytes
[I, RESMAN]  Handling command: dpdbg_close on DPDBG
[I, RESMAN]  Handling command: dprc_close for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_set_irq_mask for DPRC 1 on portal id 0
[I, RESMAN]  Handling command: dprc_set_irq_enable for DPRC 1 on portal id 0
root@localhost:~#

【LX2160】增加SGMII新网口支持

一、Uboot支持网卡

1、修改设备树

vim components/firmware/uboot/arch/arm/dts/fsl-lx2160a-rdb.dts

&dpmac11 {
        status = "okay";
        phy-handle = <&sgmii_phy1>;
        phy-connection-type = "sgmii";
};

sgmii_phy1: ethernet-phy@3 {
                // RTL8211F PHY
                compatible = "ethernet-phy-id001c.c916", "ethernet-phy-id004d.d072";
                reg = <0x3>;
        };

2、修改驱动

vim components/firmware/uboot/board/freescale/lx2160a/eth_lx2160ardb.c

/*Begin:add by zhaobaoxing for sgmii*/
        srds_s2 = in_le32(&gur->rcwsr[28]) &
                  FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_MASK;
        srds_s2 >>= FSL_CHASSIS3_RCWSR28_SRDS2_PRTCL_SHIFT;
        /*End:add by zhaobaoxing for sgmii*/

/*Begin:add by zhaobaoxing for sgmii*/
        if (get_board_rev() == 'C') {
                setup_eth_rev_c(srds_s2);
                goto next;
        }
        /*End:add by zhaobaoxing for sgmii*/

/*Begin:add by zhaobaoxing for sgmii*/
        switch (srds_s2){
        case 10:
                wriop_set_phy_address(WRIOP1_DPMAC11, 0,
                                      SGMII_PHY_ADDR1);
                printf("warning: zhaobaoxing for serdes2\r\n");
                break;
        default:
                printf("SerDes2 protocol 0x%x is not supported on LX2160ARDB\n",
                               srds_s2);
                //goto next;
                break;
        }
        /*End:add by zhaobaoxing for sgmii*/

3、修改功能宏定义

vim components/firmware/uboot/configs/lx2160ardb_tfa_defconfig

#CONFIG_DM_ETH=y

二、Linux支持网卡

1、修改设备树

&dpmac11 {
          phy-handle = <&sgmii_phy1>;
          phy-connection-type = "sgmii";
};

sgmii_phy1: ethernet-phy@3 {
     // RTL8211F PHY
     compatible = "ethernet-phy-id001c.c916", "ethernet-phy-id004d.d072";
     reg = <0x3>;
};

三、板卡配置

1、修改rcw文件

vim components/firmware/rcw/lx2160ardb_rev2/XGGFF_PP_HHHH_RR_19_5_2/rcw_2200_750_3200_19_5_2.rcw

SRDS_PRTCL_S1=3 #10G 8  #25G 17 CPRI-10G=3
SRDS_PRTCL_S2=10 #10 #CPRI 5 #-5GC #3#-BBU #5
SRDS_PRTCL_S3=3 #2

2、修改DPC文件

vim components/firmware/mc_utils/config/lx2160a/LX2160A-RDB/dpc-usxgmii.dts

 ports {
                        mac@3 {
                                /*Begin:changed by zhaobaoxing for 10G sfp+*/
                                /*link_type = "MAC_LINK_TYPE_PHY";
                                enet_if = "USXGMII";
                                */
                                /*End:changed by zhaobaoxing for 10G sfp+*/
                                link_type = "MAC_LINK_TYPE_FIXED";
                                enet_if = "XFI";
                        };

                        mac@4 {
                                /*Begin:changed by zhaobaoxing for 10G sfp+*/
                                /*link_type = "MAC_LINK_TYPE_PHY";
                                enet_if = "USXGMII";
                                */
                                /*End:changed by zhaobaoxing for 10G sfp+*/
                                link_type = "MAC_LINK_TYPE_FIXED";
                                enet_if = "XFI";
                        };

                        mac@11 {
                                link_type = "MAC_LINK_TYPE_PHY";
                        };

                        mac@17 {
                                link_type = "MAC_LINK_TYPE_PHY";
                        };
                        mac@18 {
                                link_type = "MAC_LINK_TYPE_PHY";
                        };
                };

3、修改dpl文件

vim components/firmware/mc_utils/config/lx2160a/LX2160A-RDB/dpl-eth.19.dts

connections {

                connection@1{
                        endpoint1 = "dpni@0";
                        endpoint2 = "dpmac@3";
                };

                connection@2{
                        endpoint1 = "dpni@1";
                        endpoint2 = "dpmac@4";
                };

                connection@3{
                        endpoint1 = "dpni@2";
                        endpoint2 = "dpmac@5";
                };

                connection@4{
                        endpoint1 = "dpni@3";
                        endpoint2 = "dpmac@6";
                };

                connection@5{
                        endpoint1 = "dpni@4";
                        endpoint2 = "dpmac@7";
                };

                connection@6{
                        endpoint1 = "dpni@5";
                        endpoint2 = "dpmac@8";
                };

                connection@7{
                        endpoint1 = "dpni@6";
                        endpoint2 = "dpmac@9";
                };

                connection@8{
                        endpoint1 = "dpni@7";
                        endpoint2 = "dpmac@10";
                };

                connection@9{
                        endpoint1 = "dpni@8";
                        endpoint2 = "dpmac@11";
                };

                connection@10{
                        endpoint1 = "dpni@9";
                        endpoint2 = "dpmac@12";
                };

                connection@11{
                        endpoint1 = "dpni@10";
                        endpoint2 = "dpmac@17";
                };

                connection@12{
                        endpoint1 = "dpni@11";
                        endpoint2 = "dpmac@18";
                };
        };

【lx2160】外围驱动修改

一、DDR调试


1、备份ddr_init.c platform.mk文件
2、修改ddir_init.c udimm参数,由codewarrior生成
3、在platform.mk增加CONFIG_DDR_NODIMM := 1

二、外设调试


1、IIC3调试
修改文件:rcw_2200_750_3200_19_5_2.rcw
修改内容:IIC3_PMUX=2改为0
2、增加OLED驱动
修改文件:fsl-lx2160a-rdb.dts
修改内容:增加
&i2c2 {
clock-frequency = <400000>;
pinctrl-names = “default”;
status = “okay”;
ssd1306: oled@3c {
compatible = “solomon,ssd1306fb-i2c”;
reg = <0x3c>;
//pwms = <&pwm 4 3000>;
//reset-gpios = <&gpio2 7>;
solomon,width = <128>;
solomon,height = <64>;
solomon,page-offset = <0>;
//solomon,com-lrremap;
solomon,com-invdir;
//solomon,com-offset = <0>;
//solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>;
};
};

3、增加5386驱动
注意事项:5386寄存器存在页的概念,需要先选择页,在读写寄存器值,
手册写着寄存器16位,其中前8位是页号,后8位是寄存器地址,数据手册存在误导。
修改文件:fsl-lx2160a-rdb.dts
修改内容:增加
si5386a: sync-clk@68 {
compatible = “newu,si5386a”;
reg = <0x68>;

    };

三、PCI调试


1、pic802
原理图电容型号搞错

四、以太网
1、10G光口调试
restool dpmac info dpmac.6
修改文件:dpc-usxgmii.dts
修改内容:改变
mac@3 {
/Begin:changed by zhaobaoxing for 10G sfp+/
/*link_type = “MAC_LINK_TYPE_PHY”;
enet_if = “USXGMII”;
*/
/End:changed by zhaobaoxing for 10G sfp+/
link_type = “MAC_LINK_TYPE_FIXED”;
enet_if = “XFI”;
};

2、千兆网卡调试
修改文件:fsl-lx2160a-rdb.dts
修改内容:增加
rgmii_phy1: ethernet-phy@1 {
/* AR8035 PHY */
compatible = “ethernet-phy-id001c.c916”, “ethernet-phy-id004d.d072”;
reg = <0x1>;
eee-broken-1000t;
};

五、RTC调试


修改文件:fsl-lx2160a-rdb.dts
修改内容:增加
rtc: rtc@51 {
compatible = “nxp,pcf8563”;
reg = <0x51>;
#clock-cells = <0>;
};

【Lx2160】双系统启动设计

一、启动分析

uboot启动后会通过检测lx2160ardb_boot.scr配置文件,实现默认启动引导。此系列芯片引导方式一样。

打开./configs/board/lx2160ardb_rev2/manifest文件分析

vim ./configs/board/lx2160ardb_rev2/manifest
distroboot=\
'env exists dtb || setenv dtb fsl-lx2160a-rdb.dtb;'\
'env exists kernel_image || setenv kernel_image Image;'\
'env exists devpart_boot || setenv devpart_boot 2;'\
'env exists devpart_root || setenv devpart_root 4;'\
'part uuid $devtype $devnum:$devpart_root partuuidr;'\
'setenv bootargs console=ttyAMA0,115200 earlycon=pl011,mmio32,0x21c0000 root=PARTUUID=$partuuidr rw rootwait pci=pcie_bus_perf $othbootargs;'\
'load $devtype $devnum:$devpart_boot $kernel_addr_r $kernel_image;'\
'load $devtype $devnum:$devpart_boot $fdt_addr_r $dtb;'\
'env exists secureboot && echo validating secureboot && run secureboot_validate;'\
'booti $kernel_addr_r - $fdt_addr_r'


distroboot_ima=\
'env exists dtb || setenv dtb fsl-lx2160a-rdb.dtb;'\
'env exists kernel_image || setenv kernel_image Image;'\
'env exists devpart_boot || setenv devpart_boot 2;'\
'env exists devpart_root || setenv devpart_root 4;'\
'part uuid $devtype $devnum:$devpart_root partuuidr;'\
'load $devtype $devnum:$devpart_boot $kernel_addr_r $kernel_image;'\
'load $devtype $devnum:$devpart_boot $fdt_addr_r $dtb;'\
'setenv initramfs_addr_r 0xb0000000; setenv initramfsheader_addr_r 0x80300000;'\
'load $devtype $devnum:$devpart_boot $initramfs_addr_r initramfs.img;'\
'env exists secureboot && echo validating secureboot && run secureboot_validate;'\
'setenv bootargs console=ttyAMA0,115200 earlycon=pl011,mmio32,0x21c0000 root=PARTUUID=$partuuidr rw rootwait pci=pcie_bus_perf $othbootargs;'\
'booti $kernel_addr_r $initramfs_addr_r $fdt_addr_r'

通过分析配置文件,发现Linux和rootfs的引导取决于devpart_boot和devpart_root两个变量,所以通过修改这两个变量值,便可动态实现,分区引导切换。

二、手动引导切换

进入uboot命令行

setenv devpart_boot  2
setenv devpart_root  4
saveenv

2和4代表分区号

三、动态引导切换

如实现动态引导切换需要通过fw_env工具实现。请参照《fw-env开启文件系统设置uboot环境变量》http://www.recologypower.com:9080/?p=1247

四、分区处理

flex-installer -i pf -p 6P=200M:1536M:128M:13G:1536M:-1 -d /dev/sdx

五、烧录程序

【lx2160】fw-env开启文件系统设置uboot环境变量

1、进入uboot修改源码

vim include/configs/lx2160a_common.h

最后增加

/*Begin:add by zhaobaoxing for env*/
#define CONFIG_SYS_MMC_ENV_DEV          0
#define CONFIG_ENV_SIZE                 0x2000          /* 8KB */
#define CONFIG_ENV_SECT_SIZE            0x20000
#define CONFIG_ENV_OFFSET               0x500000
#define CONFIG_ENV_ADDR                 (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
/*End:add by zhaobaoxing for env*/

2、修改fw_env.config文件

# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
# Futhermore, if the Flash sector size is omitted, this value is assumed to
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
# Device offset must be prefixed with 0x to be parsed as a hexadecimal value.

# NOR example
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
#/dev/mtd1              0x0000          0x4000          0x4000
#/dev/mtd2              0x0000          0x4000          0x4000

# MTD SPI-dataflash example
# MTD device name       Device offset   Env. size       Flash sector size       Number of sectors
#/dev/mtd5              0x4200          0x4200
#/dev/mtd6              0x4200          0x4200

# NAND example
#/dev/mtd0              0x4000          0x4000          0x20000                 2

# On a block device a negative offset is treated as a backwards offset from the
# end of the device/partition, rather than a forwards offset from the start.

# Block device example
/dev/mmcblk0            0x500000                0x2000
#/dev/mmcblk0           -0x20000        0x20000

# VFAT example
#/boot/uboot.env        0x0000          0x4000

# UBI volume
#/dev/ubi0_0            0x0             0x1f000         0x1f000
#/dev/ubi0_1            0x0             0x1f000         0x1f000

# UBI volume by name
#/dev/ubi0:env          0x0             0x1f000         0x1f000
#/dev/ubi0:env-redund   0x0             0x1f000         0x1f000
~

【LX2160】加密引擎开启

由于NXP为LX2160增加了硬件加密引擎与openssl接口,我们可以直接编译使用openssl API接口。

1、编译:

$ cd flexbuild
$ source setup.env
Build cryptodev-linux:
$ flex-builder -c cryptodev_linux -a arm64 # automatically setup cross-toolchain and fetch 
cryptodev-linux repository to build
Build OpenSSL:
$ flex-builder -c openssl -a arm64
Merge OpenSSL and cryptodev-linux components into target rootfs:
$ flex-builder -i merge-component -a arm64
Generate bootpartition tarball:
$ flex-builder -i mkbootpartition -a arm64
   flex-builder -i mkbootpartition -a arm64 -m lx2160ardb_rev2 -b sd

2、配置:

cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
修改为:
#include /etc/ld.so.conf.d/*.conf
# libc default configuration
/usr/local/lib
# Multiarch support
/usr/local/lib/aarch64-linux-gnu
/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu
/usr/lib/aarch64-linux-gnu/libfakeroot

3、加载模块

user@localhost:~$ sudo modprobe cryptodev
[sudo] password for user:

user@localhost:~$ ls /dev/crypto
/dev/crypto

user@localhost:~$ openssl engine
(devcrypto) /dev/crypto engine
(dynamic) Dynamic engine loading support

4、Verify the CAAM offloading

Hardware operations can be monitored with the interrupt counters for CAAM JR and QI (DPAA1 and DPAA2) interfaces.

user@localhost:~$ cat /proc/interrupts | grep jr
78: 20 0 0 0 GICv2 103 Level 1710000.jr
79: 0 0 0 0 GICv2 104 Level 1720000.jr
80: 0 0 0 0 GICv2 105 Level fsl-jr0

user@localhost:~$ openssl enc -aes-256-cfb -k secret -P -md sha1
*** WARNING : deprecated key derivation used.
Using -iter or -pbkdf2 would be better.
salt=233157F098D1B0E8
key=D2B0C0C088AA7DAA6CF37CC856E283E3B0C3DD2BE155688DE18593EB3F997776
iv =A4E2C86E0DBA1211B5A4B02EBEFF6DC4

user@localhost:~$ cat /proc/interrupts | grep jr
78: 54 0 0 0 GICv2 103 Level 1710000.jr
79: 69 0 0 0 GICv2 104 Level 1720000.jr
80: 0 0 0 0 GICv2 105 Level fsl-jr0

5、DPDK加解密接口测试

【NXP】codeWarrior DDR参数说明


/* DDR model number: MT40A1G16KNR-062E:E */
#ifdef CONFIG_SYS_DDR_RAW_TIMING
dimm_params_t ddr_raw_timing = {
     .n_ranks = 1, /* Number of ranks/ chip selects of DDR */
     .rank_density = 8589934592u, /* this is size in one rank, here 8GB */
     .capacity = 8589934592u, /* this is the total size, here 8GB */
     .primary_sdram_width = 64, /* this is the data bus width */
     .ec_sdram_width = 8, /* this is the ECC data width */
     .die_density = 0x5, /* this is each DRAM die density, here twin 8Gbit die density. 0x44Gbit, 0x58Gbit, 0x616Gbit*/
     .registered_dimm = 0, /* if register chip is used similar to an RDIMM = 1, otherwise = 0 */
     .mirrored_dimm = 0, /* =1 if C/A bus mirroring is used, all UDIMMs with two ranks are mirrored */
     .n_row_addr = 16, /* number of rows from dram datasheet */
     .n_col_addr = 10, /* number of columns from dram datasheet */
     .bank_addr_bits = 0, /* for DDR4 this is always = 0 defining two bits bank address in DRAM */
     .bank_group_bits = 2, /* for x16 dram = 1, 1-bit BG, for x8 dram = 2, 2-bits for BG */
     .edc_config = 2, /* leave as is, does not change. 0no ECC, 2 ECC*/
     .burst_lengths_bitmask = 0x0c, /* leave as is, this is needed for uboot masking, does not change */
     .tckmin_x_ps = 625, /* tck min = 625ps from DRAM datasheet */
     .tckmax_ps = 1500, /* tck max = 1500ps from DRAM datasheet */
     .caslat_x = 0x00FFFA00, /* leave as is, this is needed for uboot masking, does not change */
     .taa_ps = 13750, /* tAA from DRAM datasheet (ps)*/
     .trcd_ps = 13750, /* tRCD from DRAM datasheet (ps) */
     .trp_ps = 13750, /* tRP from DRAM datasheet (ps)*/
     .tras_ps = 32000, /* tRAS from DRAM datasheet (ps) */
     .trc_ps = 45750, /* tRC = tRP+tRCD or from DRAM datasheet (ps)*/
     .trfc1_ps = 350000, /* tRFC1 from DRAM datasheet (ps)*/
     .trfc2_ps = 260000, /* tRFC2 from DRAM datasheet (ps)*/
     .trfc4_ps = 160000, /* tRFC4 from DRAM datasheet (ps)*/
     .tfaw_ps = 21000, /* tFAW from DRAM datasheet (ps)*/
     .trrds_ps = 2500, /* tRRD_S from DRAM datasheet (ps)*/
     .trrdl_ps = 4900, /* tRRD_L from DRAM datasheet (ps)*/
     .tccdl_ps = 5000, /* tCCD_L from DRAM datasheet (ps)*/
     .refresh_rate_ps = 7800000, /* tREFI from DRAM datasheet (ps)*/

};