AMD-Xilinx MPSoC的SATA的psgtr的配置
问题
在启动基于K26设计的扩展板时,遇到下列错误。
[ 5.858755] ata1: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x100 irq 46
[ 5.866665] ata2: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x180 irq 46
[ 6.187547] ata1: SATA link down (SStatus 0 SControl 330)
[ 8.085543] ata2: SATA link down (SStatus 1 SControl 330)
Devicetree 设置
检查硬件设计,SATA使用Lane 3,ref_clk2。时钟是固定时钟。
首先定义参考时钟。其中的psgtr_ref_clk_2 ,是SATA使用的125MHz的参考时钟。
/ {
psgtr_ref_clk_0_dp: psgtr_ref_clk_0 {
u-boot,dm-pre-reloc;
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <27000000>;
};
psgtr_ref_clk_1_usb3: psgtr_ref_clk_1 {
u-boot,dm-pre-reloc;
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <100000000>;
};
psgtr_ref_clk_2_sata: psgtr_ref_clk_2 {
u-boot,dm-pre-reloc;
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <125000000>;
};
psgtr_ref_clk_3_unused: psgtr_ref_clk_3 {
u-boot,dm-pre-reloc;
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <19200000>;
};
};
其次通过psgtr的属性clocks定义每个GTR Lan使用的参考时钟。
/*
k26_Exp ref_clk2 gt-lane 3, ref_clk2
*/
&psgtr {
/* nc, sata, usb3, dp */
clocks = <&psgtr_ref_clk_0_dp>, <&psgtr_ref_clk_1_usb3>, <&psgtr_ref_clk_2_sata>, <&psgtr_ref_clk_3_unused>;
clock-names = "ref0", "ref1", "ref2", "ref3";
};
最后定义SATA使用的Phy的属性phys。根据参考文档,phys有四个属性。第1个是GTR lane,因此设置为3。第2个是PHY type,设置为PHY_TYPE_SATA。第3个是PHY instance,设置为1 (for DP, SATA or USB)。第4个是reference clock number,设置为2。
&sata {
/* SATA OOB timing settings */
ceva,p0-cominit-params = /bits/ 8 <0x18 0x40 0x18 0x28>;
ceva,p0-comwake-params = /bits/ 8 <0x06 0x14 0x08 0x0E>;
ceva,p0-burst-params = /bits/ 8 <0x13 0x08 0x4A 0x06>;
ceva,p0-retry-params = /bits/ 16 <0x96A4 0x3FFC>;
ceva,p1-cominit-params = /bits/ 8 <0x18 0x40 0x18 0x28>;
ceva,p1-comwake-params = /bits/ 8 <0x06 0x14 0x08 0x0E>;
ceva,p1-burst-params = /bits/ 8 <0x13 0x08 0x4A 0x06>;
ceva,p1-retry-params = /bits/ 16 <0x96A4 0x3FFC>;
phy-names = "sata-phy";
phys = <&psgtr 3 PHY_TYPE_SATA 1 2>;
};
正常日志
使用上述设置后,SATA启动正常。Linux的启动信息如下。
U-Boot的启动信息如下。
SATA link 0 timeout.
Target spinup took 0 ms.
AHCI 0001.0301 32 slots 2 ports 6 Gbps 0x3 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst
Device 0: (1:0) Vendor: ATA Prod.: Thinkplus ST600 Rev: V092
Type: Hard Disk
Capacity: 953869.7 MB = 931.5 GB (1953525168 x 512)
Hit any key to stop autoboot: 0
Linux的启动信息如下。
[ 2.278328] zynqmp-display fd4a0000.display: ZynqMP DisplayPort Subsystem driver probed
[ 2.286627] ahci-ceva fd0c0000.ahci: supply ahci not found, using dummy regulator
[ 2.294183] ahci-ceva fd0c0000.ahci: supply phy not found, using dummy regulator
[ 2.301650] ahci-ceva fd0c0000.ahci: supply target not found, using dummy regulator
[ 2.309511] ahci-ceva fd0c0000.ahci: AHCI 0001.0301 32 slots 2 ports 6 Gbps 0x3 impl platform mode
[ 2.318469] ahci-ceva fd0c0000.ahci: flags: 64bit ncq sntf pm clo only pmp fbs pio slum part ccc sds apst
[ 2.328892] scsi host0: ahci-ceva
[ 2.332498] scsi host1: ahci-ceva
[ 2.335920] ata1: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x100 irq 47
[ 2.343838] ata2: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x180 irq 47p2
[ 2.664566] ata1: SATA link down (SStatus 0 SControl 330)
[ 2.834331] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
[ 2.841882] ata2.00: ATA-10: Thinkplus ST600 M.2 1TB, V0923A0, max UDMA/133
[ 2.848840] ata2.00: 1953525168 sectors, multi 1: LBA48 NCQ (depth 32)
[ 2.857553] ata2.00: configured for UDMA/133
[ 2.862020] scsi 1:0:0:0: Direct-Access ATA Thinkplus ST600 3A0 PQ: 0 ANSI: 5
Linux下的块设备信息如下:
/dev/sda1 455G 4.0G 451G 1% /run/media/sda1
/dev/sda2 469G 7.6G 437G 2% /run/media/sda2
参考文档
Zynq Ultrascale MPSOC Linux SIOU driver
Documentation/devicetree/bindings/phy/xlnx,zynqmp-psgtr.yaml
测试单板
K26
2022.1
付汉杰 hankf@amd.com