usb眼图测试

Question:How to change QUSB(HS USB) PHY tune registers dynamically?
Answer:
For platforms using QUSB(HS USB) PHY, we have USB tune register setting in platform dtsi
like below.
//arch/arm/boot/dts/qcom/**.dtsi
qusb_phy0: qusb@7411000 {
compatible = "qcom,qusb2phy";
......
qcom,qusb-phy-init-seq = <0xF8 0x80
0xB3 0x84
0x83 0x88
0xC0 0x8C
0x30 0x08
0x79 0x0C
0x21 0x10
0x14 0x9C
0x9F 0x1C
0x00 0x18>;
But when we tuning device eye diagram, we hope to have oppertunities to change USB tune
register settings with out reset phone or reflash images.
By default the setting the setting can override tune2 is in:
/sys/module/phy_msm_qusb/parameters/tune2
We can add below change in phy-msm-qusb.c to add tune1/tune3/tune4/tune5 override setting.
#define QUSB2PHY_PORT_TUNE1 0x80
#define QUSB2PHY_PORT_TUNE2 0x84
#define QUSB2PHY_PORT_TUNE3 0x88
#define QUSB2PHY_PORT_TUNE4 0x8C
+#define QUSB2PHY_PORT_TUNE5 0x90
......
unsigned int tune2;
+unsigned int tune1;
+unsigned int tune3;
+unsigned int tune4;
+unsigned int tune5;
module_param(tune2, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(tune2, "QUSB PHY TUNE2");
+module_param(tune1, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(tune1, "QUSB PHY TUNE1");
+module_param(tune3, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(tune3, "QUSB PHY TUNE3");+module_param(tune4, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(tune4, "QUSB PHY TUNE4");
+module_param(tune5, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(tune5, "QUSB PHY TUNE5");
......
/* If tune2 modparam set, override tune2 value */
if (tune2) {
pr_debug("%s(): (modparam) TUNE2 val:0x%02x\n",
__func__, tune2);
writel_relaxed(tune2,
qphy->base + QUSB2PHY_PORT_TUNE2);
}
+ /* If tune1 modparam set, override tune1 value */
+ if (tune1) {
+ pr_debug("%s(): (modparam) TUNE1 val:0x%02x\n",
+ __func__, tune1);
+ writel_relaxed(tune1,
+ qphy->base + QUSB2PHY_PORT_TUNE1);
+ }
+ /* If tune3 modparam set, override tune3 value */
+ if (tune3) {
+ pr_debug("%s(): (modparam) TUNE3 val:0x%02x\n",
+ __func__, tune3);
+ writel_relaxed(tune3,
+ qphy->base + QUSB2PHY_PORT_TUNE3);
+ }
+ /* If tune2 modparam set, override tune2 value */
+ if (tune4) {
+ pr_debug("%s(): (modparam) TUNE4 val:0x%02x\n",
+ __func__, tune4);
+ writel_relaxed(tune4,
+ qphy->base + QUSB2PHY_PORT_TUNE4);
+ }
+ /* If tune2 modparam set, override tune2 value */
+ if (tune5) {
+ pr_debug("%s(): (modparam) TUNE5 val:0x%02x\n",
+ __func__, tune5);
+ writel_relaxed(tune5,
+ qphy->base + QUSB2PHY_PORT_TUNE5);
+ }
+ pr_err("tune1 0x%x, 2 0x%x, 3 0x%x, 4 0x%x, 5 0x%x",readl_relaxed(qphy->base +
QUSB2PHY_PORT_TUNE1),+ readl_relaxed(qphy->base + QUSB2PHY_PORT_TUNE2),
+ readl_relaxed(qphy->base + QUSB2PHY_PORT_TUNE3),
+ readl_relaxed(qphy->base + QUSB2PHY_PORT_TUNE4),
+ readl_relaxed(qphy->base + QUSB2PHY_PORT_TUNE5));
Sample operation to change tune parameters by adb shell:
adb shell
su
cd /sys/module/phy_msm_qusb/parameters
echo 0x84 > tune2
cat tune2
132
Please note it will no take effect anymore if phone reset, the change will not save only if we change
platform dtsi.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值