1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
15 bool msm_edp_phy_ready(struct edp_phy
*phy
)
21 status
= edp_read(phy
->base
+
22 REG_EDP_PHY_GLB_PHY_STATUS
);
25 usleep_range(500, 1000);
29 pr_err("%s: PHY NOT ready\n", __func__
);
36 void msm_edp_phy_ctrl(struct edp_phy
*phy
, int enable
)
38 DBG("enable=%d", enable
);
41 edp_write(phy
->base
+ REG_EDP_PHY_CTRL
,
42 EDP_PHY_CTRL_SW_RESET
| EDP_PHY_CTRL_SW_RESET_PLL
);
43 /* Make sure fully reset */
45 usleep_range(500, 1000);
46 edp_write(phy
->base
+ REG_EDP_PHY_CTRL
, 0x000);
47 edp_write(phy
->base
+ REG_EDP_PHY_GLB_PD_CTL
, 0x3f);
48 edp_write(phy
->base
+ REG_EDP_PHY_GLB_CFG
, 0x1);
50 edp_write(phy
->base
+ REG_EDP_PHY_GLB_PD_CTL
, 0xc0);
54 /* voltage mode and pre emphasis cfg */
55 void msm_edp_phy_vm_pe_init(struct edp_phy
*phy
)
57 edp_write(phy
->base
+ REG_EDP_PHY_GLB_VM_CFG0
, 0x3);
58 edp_write(phy
->base
+ REG_EDP_PHY_GLB_VM_CFG1
, 0x64);
59 edp_write(phy
->base
+ REG_EDP_PHY_GLB_MISC9
, 0x6c);
62 void msm_edp_phy_vm_pe_cfg(struct edp_phy
*phy
, u32 v0
, u32 v1
)
64 edp_write(phy
->base
+ REG_EDP_PHY_GLB_VM_CFG0
, v0
);
65 edp_write(phy
->base
+ REG_EDP_PHY_GLB_VM_CFG1
, v1
);
68 void msm_edp_phy_lane_power_ctrl(struct edp_phy
*phy
, bool up
, u32 max_lane
)
74 data
= 0; /* power up */
76 data
= 0x7; /* power down */
78 for (i
= 0; i
< max_lane
; i
++)
79 edp_write(phy
->base
+ REG_EDP_PHY_LN_PD_CTL(i
) , data
);
81 /* power down unused lane */
82 data
= 0x7; /* power down */
83 for (i
= max_lane
; i
< EDP_MAX_LANE
; i
++)
84 edp_write(phy
->base
+ REG_EDP_PHY_LN_PD_CTL(i
) , data
);
87 void *msm_edp_phy_init(struct device
*dev
, void __iomem
*regbase
)
89 struct edp_phy
*phy
= NULL
;
91 phy
= devm_kzalloc(dev
, sizeof(*phy
), GFP_KERNEL
);