Skip to content

Commit bdb9789

Browse files
Michael Rieschvinodkoul
authored andcommitted
phy: rockchip: phy-rockchip-inno-csidphy: add support for rk3588 variant
The Rockchip RK3588 MIPI CSI-2 DPHY can be supported using the existing phy-rockchip-inno-csidphy driver, the notable differences being - the control bits in the GRF - the additional reset line Add support for this variant. Signed-off-by: Michael Riesch <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 2604351 commit bdb9789

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drivers/phy/rockchip/phy-rockchip-inno-csidphy.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#define RK3568_GRF_VI_CON0 0x0340
3131
#define RK3568_GRF_VI_CON1 0x0344
3232

33+
#define RK3588_CSIDPHY_GRF_CON0 0x0000
34+
3335
/* PHY */
3436
#define CSIDPHY_CTRL_LANE_ENABLE 0x00
3537
#define CSIDPHY_CTRL_LANE_ENABLE_CK BIT(6)
@@ -117,6 +119,12 @@ static const struct dphy_reg rk3568_grf_dphy_regs[] = {
117119
[GRF_DPHY_CSIPHY_CLKLANE_EN] = PHY_REG(RK3568_GRF_VI_CON0, 1, 8),
118120
};
119121

122+
static const struct dphy_reg rk3588_grf_dphy_regs[] = {
123+
[GRF_DPHY_CSIPHY_FORCERXMODE] = PHY_REG(RK3588_CSIDPHY_GRF_CON0, 4, 0),
124+
[GRF_DPHY_CSIPHY_DATALANE_EN] = PHY_REG(RK3588_CSIDPHY_GRF_CON0, 4, 4),
125+
[GRF_DPHY_CSIPHY_CLKLANE_EN] = PHY_REG(RK3588_CSIDPHY_GRF_CON0, 1, 8),
126+
};
127+
120128
struct hsfreq_range {
121129
u32 range_h;
122130
u8 cfg_bit;
@@ -183,6 +191,11 @@ static const char *const rk3368_reset_names[] = {
183191
"apb"
184192
};
185193

194+
static const char *const rk3588_reset_names[] = {
195+
"apb",
196+
"phy"
197+
};
198+
186199
static void rockchip_inno_csidphy_ths_settle(struct rockchip_inno_csidphy *priv,
187200
int hsfreq, int offset)
188201
{
@@ -390,6 +403,17 @@ static const struct dphy_drv_data rk3568_mipidphy_drv_data = {
390403
.resets_num = ARRAY_SIZE(rk3368_reset_names),
391404
};
392405

406+
static const struct dphy_drv_data rk3588_mipidphy_drv_data = {
407+
.pwrctl_offset = -1,
408+
.ths_settle_offset = RK3568_CSIDPHY_CLK_WR_THS_SETTLE,
409+
.calib_offset = RK3568_CSIDPHY_CLK_CALIB_EN,
410+
.hsfreq_ranges = rk1808_mipidphy_hsfreq_ranges,
411+
.num_hsfreq_ranges = ARRAY_SIZE(rk1808_mipidphy_hsfreq_ranges),
412+
.grf_regs = rk3588_grf_dphy_regs,
413+
.resets = rk3588_reset_names,
414+
.resets_num = ARRAY_SIZE(rk3588_reset_names),
415+
};
416+
393417
static const struct of_device_id rockchip_inno_csidphy_match_id[] = {
394418
{
395419
.compatible = "rockchip,px30-csi-dphy",
@@ -411,6 +435,10 @@ static const struct of_device_id rockchip_inno_csidphy_match_id[] = {
411435
.compatible = "rockchip,rk3568-csi-dphy",
412436
.data = &rk3568_mipidphy_drv_data,
413437
},
438+
{
439+
.compatible = "rockchip,rk3588-csi-dphy",
440+
.data = &rk3588_mipidphy_drv_data,
441+
},
414442
{}
415443
};
416444
MODULE_DEVICE_TABLE(of, rockchip_inno_csidphy_match_id);

0 commit comments

Comments
 (0)