|
|
@@ -1,6 +1,6 @@
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
/*
|
|
|
- * Cadence MHDP DisplayPort SD0801 PHY driver.
|
|
|
+ * Cadence Torrent SD0801 PHY driver.
|
|
|
*
|
|
|
* Copyright 2018 Cadence Design Systems, Inc.
|
|
|
*
|
|
|
@@ -161,7 +161,7 @@
|
|
|
#define RX_REE_GCSM2_CTRL(j) (0x8000 + 0x0220 + (j) * 0x400)
|
|
|
#define RX_REE_PERGCSM_CTRL(j) (0x8000 + 0x0230 + (j) * 0x400)
|
|
|
|
|
|
-struct cdns_dp_phy {
|
|
|
+struct cdns_torrent_phy {
|
|
|
void __iomem *base; /* DPTX registers base */
|
|
|
void __iomem *sd_base; /* SD0801 registers base */
|
|
|
u32 num_lanes; /* Number of lanes to use */
|
|
|
@@ -179,39 +179,39 @@ enum phy_powerstate {
|
|
|
POWERSTATE_A3 = 3,
|
|
|
};
|
|
|
|
|
|
-static int cdns_dp_phy_init(struct phy *phy);
|
|
|
-static int cdns_dp_phy_exit(struct phy *phy);
|
|
|
-static int cdns_dp_phy_run(struct cdns_dp_phy *cdns_phy);
|
|
|
-static int cdns_dp_phy_wait_pma_cmn_ready(struct cdns_dp_phy *cdns_phy);
|
|
|
-static void cdns_dp_phy_pma_cfg(struct cdns_dp_phy *cdns_phy);
|
|
|
-static void cdns_dp_phy_pma_cmn_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy);
|
|
|
-static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy, u32 rate, bool ssc);
|
|
|
-static void cdns_dp_phy_pma_cmn_cfg_25mhz(struct cdns_dp_phy *cdns_phy);
|
|
|
-static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy, u32 rate, bool ssc);
|
|
|
-static void cdns_dp_phy_pma_lane_cfg(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_init(struct phy *phy);
|
|
|
+static int cdns_torrent_dp_exit(struct phy *phy);
|
|
|
+static int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy);
|
|
|
+static int cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy);
|
|
|
+static void cdns_torrent_dp_pma_cfg(struct cdns_torrent_phy *cdns_phy);
|
|
|
+static void cdns_torrent_dp_pma_cmn_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy);
|
|
|
+static void cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy, u32 rate, bool ssc);
|
|
|
+static void cdns_torrent_dp_pma_cmn_cfg_25mhz(struct cdns_torrent_phy *cdns_phy);
|
|
|
+static void cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy, u32 rate, bool ssc);
|
|
|
+static void cdns_torrent_dp_pma_lane_cfg(struct cdns_torrent_phy *cdns_phy,
|
|
|
unsigned int lane);
|
|
|
-static void cdns_dp_phy_pma_cmn_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 rate, u32 lanes);
|
|
|
-static void cdns_dp_phy_write_field(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_dp_phy_write_field(struct cdns_torrent_phy *cdns_phy,
|
|
|
unsigned int offset,
|
|
|
unsigned char start_bit,
|
|
|
unsigned char num_bits,
|
|
|
unsigned int val);
|
|
|
-static int cdns_dp_phy_configure(struct phy *phy, union phy_configure_opts *opts);
|
|
|
-static void cdns_dp_phy_set_a0_pll(struct cdns_dp_phy *cdns_phy, u32 num_lanes);
|
|
|
-static int cdns_dp_phy_set_power_state(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_configure(struct phy *phy, union phy_configure_opts *opts);
|
|
|
+static void cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy *cdns_phy, u32 num_lanes);
|
|
|
+static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 num_lanes,
|
|
|
enum phy_powerstate powerstate);
|
|
|
|
|
|
-static int cdns_dp_phy_on(struct phy *gphy);
|
|
|
-static int cdns_dp_phy_off(struct phy *gphy);
|
|
|
+static int cdns_torrent_phy_on(struct phy *gphy);
|
|
|
+static int cdns_torrent_phy_off(struct phy *gphy);
|
|
|
|
|
|
-static const struct phy_ops cdns_dp_phy_ops = {
|
|
|
- .init = cdns_dp_phy_init,
|
|
|
- .exit = cdns_dp_phy_exit,
|
|
|
- .configure = cdns_dp_phy_configure,
|
|
|
- .power_on = cdns_dp_phy_on,
|
|
|
- .power_off = cdns_dp_phy_off,
|
|
|
+static const struct phy_ops cdns_torrent_phy_ops = {
|
|
|
+ .init = cdns_torrent_dp_init,
|
|
|
+ .exit = cdns_torrent_dp_exit,
|
|
|
+ .configure = cdns_torrent_dp_configure,
|
|
|
+ .power_on = cdns_torrent_phy_on,
|
|
|
+ .power_off = cdns_torrent_phy_off,
|
|
|
.owner = THIS_MODULE,
|
|
|
};
|
|
|
|
|
|
@@ -228,18 +228,18 @@ static const struct phy_ops cdns_dp_phy_ops = {
|
|
|
_cdns_dp_phy_write_phy(cdns_phy, offset, val); \
|
|
|
})
|
|
|
|
|
|
-static void _cdns_dp_phy_write_phy(struct cdns_dp_phy *cdns_phy, u32 offset, u16 val)
|
|
|
+static void _cdns_dp_phy_write_phy(struct cdns_torrent_phy *cdns_phy, u32 offset, u16 val)
|
|
|
{
|
|
|
writew(val, cdns_phy->sd_base + offset);
|
|
|
}
|
|
|
#else
|
|
|
-static void cdns_dp_phy_write_phy(struct cdns_dp_phy *cdns_phy, u32 offset, u16 val)
|
|
|
+static void cdns_dp_phy_write_phy(struct cdns_torrent_phy *cdns_phy, u32 offset, u16 val)
|
|
|
{
|
|
|
writew(val, cdns_phy->sd_base + offset);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static u16 cdns_dp_phy_read_phy(struct cdns_dp_phy *cdns_phy, u32 offset)
|
|
|
+static u16 cdns_dp_phy_read_phy(struct cdns_torrent_phy *cdns_phy, u32 offset)
|
|
|
{
|
|
|
return readw(cdns_phy->sd_base + offset);
|
|
|
}
|
|
|
@@ -257,18 +257,18 @@ static u16 cdns_dp_phy_read_phy(struct cdns_dp_phy *cdns_phy, u32 offset)
|
|
|
_cdns_dp_phy_write_dp(cdns_phy, offset, val); \
|
|
|
})
|
|
|
|
|
|
-static void _cdns_dp_phy_write_dp(struct cdns_dp_phy *cdns_phy, u32 offset, u16 val)
|
|
|
+static void _cdns_dp_phy_write_dp(struct cdns_torrent_phy *cdns_phy, u32 offset, u16 val)
|
|
|
{
|
|
|
writel(val, cdns_phy->base + offset);
|
|
|
}
|
|
|
#else
|
|
|
-static void cdns_dp_phy_write_dp(struct cdns_dp_phy *cdns_phy, u32 offset, u16 val)
|
|
|
+static void cdns_dp_phy_write_dp(struct cdns_torrent_phy *cdns_phy, u32 offset, u16 val)
|
|
|
{
|
|
|
writel(val, cdns_phy->base + offset);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
-static u32 cdns_dp_phy_read_dp(struct cdns_dp_phy *cdns_phy, u32 offset)
|
|
|
+static u32 cdns_dp_phy_read_dp(struct cdns_torrent_phy *cdns_phy, u32 offset)
|
|
|
{
|
|
|
return readl(cdns_phy->base + offset);
|
|
|
}
|
|
|
@@ -325,12 +325,12 @@ static const struct coefficients voltage_coeffs[4][4] = {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-static int cdns_dp_phy_init(struct phy *phy)
|
|
|
+static int cdns_torrent_dp_init(struct phy *phy)
|
|
|
{
|
|
|
unsigned char lane_bits;
|
|
|
int r;
|
|
|
|
|
|
- struct cdns_dp_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
+ struct cdns_torrent_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
|
|
|
r = clk_prepare_enable(cdns_phy->clk);
|
|
|
if (r) {
|
|
|
@@ -358,13 +358,13 @@ static int cdns_dp_phy_init(struct phy *phy)
|
|
|
cdns_dp_phy_write_dp(cdns_phy, PHY_AUX_CTRL, 0x0003); /* enable AUX */
|
|
|
|
|
|
/* PHY PMA registers configuration function */
|
|
|
- cdns_dp_phy_pma_cfg(cdns_phy);
|
|
|
+ cdns_torrent_dp_pma_cfg(cdns_phy);
|
|
|
|
|
|
/*
|
|
|
* Set lines power state to A0
|
|
|
* Set lines pll clk enable to 0
|
|
|
*/
|
|
|
- cdns_dp_phy_set_a0_pll(cdns_phy, cdns_phy->num_lanes);
|
|
|
+ cdns_torrent_dp_set_a0_pll(cdns_phy, cdns_phy->num_lanes);
|
|
|
|
|
|
/*
|
|
|
* release phy_l0*_reset_n and pma_tx_elec_idle_ln_* based on
|
|
|
@@ -379,32 +379,32 @@ static int cdns_dp_phy_init(struct phy *phy)
|
|
|
/* PHY PMA registers configuration functions */
|
|
|
/* Initialize PHY with max supported link rate, without SSC. */
|
|
|
if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz)
|
|
|
- cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(cdns_phy, cdns_phy->max_bit_rate, false);
|
|
|
+ cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, cdns_phy->max_bit_rate, false);
|
|
|
else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz)
|
|
|
- cdns_dp_phy_pma_cmn_vco_cfg_25mhz(cdns_phy, cdns_phy->max_bit_rate, false);
|
|
|
- cdns_dp_phy_pma_cmn_rate(cdns_phy, cdns_phy->max_bit_rate, cdns_phy->num_lanes);
|
|
|
+ cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, cdns_phy->max_bit_rate, false);
|
|
|
+ cdns_torrent_dp_pma_cmn_rate(cdns_phy, cdns_phy->max_bit_rate, cdns_phy->num_lanes);
|
|
|
|
|
|
/* take out of reset */
|
|
|
cdns_dp_phy_write_field(cdns_phy, PHY_RESET, 8, 1, 1);
|
|
|
- cdns_dp_phy_on(phy);
|
|
|
- r = cdns_dp_phy_wait_pma_cmn_ready(cdns_phy);
|
|
|
+ cdns_torrent_phy_on(phy);
|
|
|
+ r = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy);
|
|
|
if (r)
|
|
|
return r;
|
|
|
|
|
|
- r = cdns_dp_phy_run(cdns_phy);
|
|
|
+ r = cdns_torrent_dp_run(cdns_phy);
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_exit(struct phy *phy)
|
|
|
+static int cdns_torrent_dp_exit(struct phy *phy)
|
|
|
{
|
|
|
- struct cdns_dp_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
+ struct cdns_torrent_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
|
|
|
clk_disable_unprepare(cdns_phy->clk);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_wait_pma_cmn_ready(struct cdns_dp_phy *cdns_phy)
|
|
|
+static int cdns_torrent_dp_wait_pma_cmn_ready(struct cdns_torrent_phy *cdns_phy)
|
|
|
{
|
|
|
unsigned int reg;
|
|
|
int ret;
|
|
|
@@ -420,23 +420,23 @@ static int cdns_dp_phy_wait_pma_cmn_ready(struct cdns_dp_phy *cdns_phy)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cfg(struct cdns_dp_phy *cdns_phy)
|
|
|
+static void cdns_torrent_dp_pma_cfg(struct cdns_torrent_phy *cdns_phy)
|
|
|
{
|
|
|
unsigned int i;
|
|
|
|
|
|
if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz)
|
|
|
/* PMA common configuration 19.2MHz */
|
|
|
- cdns_dp_phy_pma_cmn_cfg_19_2mhz(cdns_phy);
|
|
|
+ cdns_torrent_dp_pma_cmn_cfg_19_2mhz(cdns_phy);
|
|
|
else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz)
|
|
|
/* PMA common configuration 25MHz */
|
|
|
- cdns_dp_phy_pma_cmn_cfg_25mhz(cdns_phy);
|
|
|
+ cdns_torrent_dp_pma_cmn_cfg_25mhz(cdns_phy);
|
|
|
|
|
|
/* PMA lane configuration to deal with multi-link operation */
|
|
|
for (i = 0; i < cdns_phy->num_lanes; i++)
|
|
|
- cdns_dp_phy_pma_lane_cfg(cdns_phy, i);
|
|
|
+ cdns_torrent_dp_pma_lane_cfg(cdns_phy, i);
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cmn_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy)
|
|
|
+static void cdns_torrent_dp_pma_cmn_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy)
|
|
|
{
|
|
|
/* refclock registers - assumes 19.2 MHz refclock */
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_SSM_BIAS_TMR, 0x0014);
|
|
|
@@ -481,7 +481,7 @@ static void cdns_dp_phy_pma_cmn_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy)
|
|
|
* Set registers responsible for enabling and configuring SSC, with second and
|
|
|
* third register values provided by parameters.
|
|
|
*/
|
|
|
-static void cdns_dp_phy_enable_ssc_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_enable_ssc_19_2mhz(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 ctrl2_val, u32 ctrl3_val)
|
|
|
{
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL0_SS_CTRL1_M0, 0x0001);
|
|
|
@@ -494,7 +494,7 @@ static void cdns_dp_phy_enable_ssc_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_SS_CTRL4_M0, 0x0003);
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 rate, bool ssc)
|
|
|
{
|
|
|
|
|
|
@@ -514,7 +514,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x00BC);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PDIAG_PLL1_CTRL_M0, 0x0012);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_19_2mhz(cdns_phy, 0x033A, 0x006A);
|
|
|
+ cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x033A, 0x006A);
|
|
|
break;
|
|
|
/* Setting VCO for 9.72GHz */
|
|
|
case 1620:
|
|
|
@@ -531,7 +531,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x0152);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_19_2mhz(cdns_phy, 0x05DD, 0x0069);
|
|
|
+ cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x05DD, 0x0069);
|
|
|
break;
|
|
|
/* Setting VCO for 8.64GHz */
|
|
|
case 2160:
|
|
|
@@ -547,7 +547,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x012C);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_19_2mhz(cdns_phy, 0x0536, 0x0069);
|
|
|
+ cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x0536, 0x0069);
|
|
|
break;
|
|
|
/* Setting VCO for 8.1GHz */
|
|
|
case 8100:
|
|
|
@@ -562,7 +562,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x011A);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PDIAG_PLL1_CTRL_M0, 0x0002);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_19_2mhz(cdns_phy, 0x04D7, 0x006A);
|
|
|
+ cdns_torrent_dp_enable_ssc_19_2mhz(cdns_phy, 0x04D7, 0x006A);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -594,7 +594,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cmn_cfg_25mhz(struct cdns_dp_phy *cdns_phy)
|
|
|
+static void cdns_torrent_dp_pma_cmn_cfg_25mhz(struct cdns_torrent_phy *cdns_phy)
|
|
|
{
|
|
|
/* refclock registers - assumes 25 MHz refclock */
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_SSM_BIAS_TMR, 0x0019);
|
|
|
@@ -638,7 +638,7 @@ static void cdns_dp_phy_pma_cmn_cfg_25mhz(struct cdns_dp_phy *cdns_phy)
|
|
|
* Set registers responsible for enabling and configuring SSC, with second
|
|
|
* register value provided by a parameter.
|
|
|
*/
|
|
|
-static void cdns_dp_phy_enable_ssc_25mhz(struct cdns_dp_phy *cdns_phy, u32 ctrl2_val)
|
|
|
+static void cdns_torrent_dp_enable_ssc_25mhz(struct cdns_torrent_phy *cdns_phy, u32 ctrl2_val)
|
|
|
{
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL0_SS_CTRL1_M0, 0x0001);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL0_SS_CTRL1_M0, ctrl2_val);
|
|
|
@@ -650,7 +650,7 @@ static void cdns_dp_phy_enable_ssc_25mhz(struct cdns_dp_phy *cdns_phy, u32 ctrl2
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_SS_CTRL4_M0, 0x0003);
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 rate, bool ssc)
|
|
|
{
|
|
|
/* Assumes 25 MHz refclock */
|
|
|
@@ -667,7 +667,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_FRACDIVH_M0, 0x0002);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x0120);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_25mhz(cdns_phy, 0x0423);
|
|
|
+ cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x0423);
|
|
|
break;
|
|
|
/* Setting VCO for 9.72GHz */
|
|
|
case 1620:
|
|
|
@@ -682,7 +682,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_FRACDIVH_M0, 0x0002);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x0104);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_25mhz(cdns_phy, 0x03B9);
|
|
|
+ cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x03B9);
|
|
|
break;
|
|
|
/* Setting VCO for 8.64GHz */
|
|
|
case 2160:
|
|
|
@@ -696,7 +696,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_FRACDIVH_M0, 0x0002);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x00E7);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_25mhz(cdns_phy, 0x034F);
|
|
|
+ cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x034F);
|
|
|
break;
|
|
|
/* Setting VCO for 8.1GHz */
|
|
|
case 8100:
|
|
|
@@ -709,7 +709,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_FRACDIVH_M0, 0x0002);
|
|
|
cdns_dp_phy_write_phy(cdns_phy, CMN_PLL1_HIGH_THR_M0, 0x00D8);
|
|
|
if (ssc)
|
|
|
- cdns_dp_phy_enable_ssc_25mhz(cdns_phy, 0x031A);
|
|
|
+ cdns_torrent_dp_enable_ssc_25mhz(cdns_phy, 0x031A);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
@@ -744,7 +744,7 @@ static void cdns_dp_phy_pma_cmn_vco_cfg_25mhz(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void cdns_dp_phy_pma_cmn_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_pma_cmn_rate(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 rate, u32 lanes)
|
|
|
{
|
|
|
unsigned int clk_sel_val = 0;
|
|
|
@@ -789,7 +789,7 @@ static void cdns_dp_phy_pma_cmn_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
hsclk_div_val);
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_pma_lane_cfg(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_pma_lane_cfg(struct cdns_torrent_phy *cdns_phy,
|
|
|
unsigned int lane)
|
|
|
{
|
|
|
/* Per lane, refclock-dependent receiver detection setting */
|
|
|
@@ -817,7 +817,7 @@ static void cdns_dp_phy_pma_lane_cfg(struct cdns_dp_phy *cdns_phy,
|
|
|
cdns_dp_phy_write_phy(cdns_phy, XCVR_DIAG_HSCLK_SEL(lane), 0x0000);
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_run(struct cdns_dp_phy *cdns_phy)
|
|
|
+static int cdns_torrent_dp_run(struct cdns_torrent_phy *cdns_phy)
|
|
|
{
|
|
|
unsigned int read_val;
|
|
|
int ret;
|
|
|
@@ -836,16 +836,16 @@ static int cdns_dp_phy_run(struct cdns_dp_phy *cdns_phy)
|
|
|
|
|
|
ndelay(100);
|
|
|
|
|
|
- ret = cdns_dp_phy_set_power_state(cdns_phy, cdns_phy->num_lanes, POWERSTATE_A2);
|
|
|
+ ret = cdns_torrent_dp_set_power_state(cdns_phy, cdns_phy->num_lanes, POWERSTATE_A2);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
- ret = cdns_dp_phy_set_power_state(cdns_phy, cdns_phy->num_lanes, POWERSTATE_A0);
|
|
|
+ ret = cdns_torrent_dp_set_power_state(cdns_phy, cdns_phy->num_lanes, POWERSTATE_A0);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static void cdns_dp_phy_write_field(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_dp_phy_write_field(struct cdns_torrent_phy *cdns_phy,
|
|
|
unsigned int offset,
|
|
|
unsigned char start_bit,
|
|
|
unsigned char num_bits,
|
|
|
@@ -859,25 +859,25 @@ static void cdns_dp_phy_write_field(struct cdns_dp_phy *cdns_phy,
|
|
|
start_bit))));
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_on(struct phy *phy)
|
|
|
+static int cdns_torrent_phy_on(struct phy *phy)
|
|
|
{
|
|
|
- struct cdns_dp_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
+ struct cdns_torrent_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
|
|
|
/* Take the PHY lane group out of reset */
|
|
|
return reset_control_deassert(cdns_phy->phy_rst);
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_off(struct phy *phy)
|
|
|
+static int cdns_torrent_phy_off(struct phy *phy)
|
|
|
{
|
|
|
- struct cdns_dp_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
+ struct cdns_torrent_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
|
|
|
return reset_control_assert(cdns_phy->phy_rst);
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_probe(struct platform_device *pdev)
|
|
|
+static int cdns_torrent_phy_probe(struct platform_device *pdev)
|
|
|
{
|
|
|
struct resource *regs;
|
|
|
- struct cdns_dp_phy *cdns_phy;
|
|
|
+ struct cdns_torrent_phy *cdns_phy;
|
|
|
struct device *dev = &pdev->dev;
|
|
|
struct phy_provider *phy_provider;
|
|
|
struct phy *phy;
|
|
|
@@ -889,9 +889,9 @@ static int cdns_dp_phy_probe(struct platform_device *pdev)
|
|
|
|
|
|
cdns_phy->dev = &pdev->dev;
|
|
|
|
|
|
- phy = devm_phy_create(dev, NULL, &cdns_dp_phy_ops);
|
|
|
+ phy = devm_phy_create(dev, NULL, &cdns_torrent_phy_ops);
|
|
|
if (IS_ERR(phy)) {
|
|
|
- dev_err(dev, "failed to create DisplayPort PHY\n");
|
|
|
+ dev_err(dev, "failed to create Torrent PHY\n");
|
|
|
return PTR_ERR(phy);
|
|
|
}
|
|
|
|
|
|
@@ -964,7 +964,7 @@ static int cdns_dp_phy_probe(struct platform_device *pdev)
|
|
|
return PTR_ERR_OR_ZERO(phy_provider);
|
|
|
}
|
|
|
|
|
|
-static int cdns_dp_phy_set_power_state(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_set_power_state(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 num_lanes,
|
|
|
enum phy_powerstate powerstate)
|
|
|
{
|
|
|
@@ -1026,7 +1026,7 @@ static int cdns_dp_phy_set_power_state(struct cdns_dp_phy *cdns_phy,
|
|
|
/*
|
|
|
* Enable or disable PLL for selected lanes.
|
|
|
*/
|
|
|
-static int cdns_dp_phy_set_pll_en(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_set_pll_en(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp,
|
|
|
bool enable)
|
|
|
{
|
|
|
@@ -1078,7 +1078,7 @@ static int cdns_dp_phy_set_pll_en(struct cdns_dp_phy *cdns_phy,
|
|
|
* Perform register operations related to setting link rate, once powerstate is
|
|
|
* set and PLL disable request was processed.
|
|
|
*/
|
|
|
-static int cdns_dp_phy_configure_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_configure_rate(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp)
|
|
|
{
|
|
|
u32 ret;
|
|
|
@@ -1100,14 +1100,14 @@ static int cdns_dp_phy_configure_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
/* DP Rate Change - VCO Output settings. */
|
|
|
if (cdns_phy->ref_clk_rate == REF_CLK_19_2MHz) {
|
|
|
/* PMA common configuration 19.2MHz */
|
|
|
- cdns_dp_phy_pma_cmn_vco_cfg_19_2mhz(cdns_phy, dp->link_rate, dp->ssc);
|
|
|
- cdns_dp_phy_pma_cmn_cfg_19_2mhz(cdns_phy);
|
|
|
+ cdns_torrent_dp_pma_cmn_vco_cfg_19_2mhz(cdns_phy, dp->link_rate, dp->ssc);
|
|
|
+ cdns_torrent_dp_pma_cmn_cfg_19_2mhz(cdns_phy);
|
|
|
} else if (cdns_phy->ref_clk_rate == REF_CLK_25MHz) {
|
|
|
/* PMA common configuration 25MHz */
|
|
|
- cdns_dp_phy_pma_cmn_vco_cfg_25mhz(cdns_phy, dp->link_rate, dp->ssc);
|
|
|
- cdns_dp_phy_pma_cmn_cfg_25mhz(cdns_phy);
|
|
|
+ cdns_torrent_dp_pma_cmn_vco_cfg_25mhz(cdns_phy, dp->link_rate, dp->ssc);
|
|
|
+ cdns_torrent_dp_pma_cmn_cfg_25mhz(cdns_phy);
|
|
|
}
|
|
|
- cdns_dp_phy_pma_cmn_rate(cdns_phy, dp->link_rate, dp->lanes);
|
|
|
+ cdns_torrent_dp_pma_cmn_rate(cdns_phy, dp->link_rate, dp->lanes);
|
|
|
|
|
|
/* Enable the cmn_pll0_en. */
|
|
|
cdns_dp_phy_write_phy(cdns_phy, PHY_PMA_PLL_RAW_CTRL, 0x3);
|
|
|
@@ -1124,7 +1124,7 @@ static int cdns_dp_phy_configure_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
/*
|
|
|
* Verify, that parameters to configure PHY with are correct.
|
|
|
*/
|
|
|
-static int cdns_dp_phy_verify_config(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_verify_config(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp)
|
|
|
{
|
|
|
u8 i;
|
|
|
@@ -1182,7 +1182,7 @@ static int cdns_dp_phy_verify_config(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
|
|
|
/* Set power state A0 and PLL clock enable to 0 on enabled lanes. */
|
|
|
-static void cdns_dp_phy_set_a0_pll(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_set_a0_pll(struct cdns_torrent_phy *cdns_phy,
|
|
|
u32 num_lanes)
|
|
|
{
|
|
|
u32 pwr_state = cdns_dp_phy_read_dp(cdns_phy, PHY_PMA_XCVR_POWER_STATE_REQ);
|
|
|
@@ -1211,7 +1211,7 @@ static void cdns_dp_phy_set_a0_pll(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
|
|
|
/* Configure lane count as required. */
|
|
|
-static int cdns_dp_phy_set_lanes(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_set_lanes(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp)
|
|
|
{
|
|
|
u32 value;
|
|
|
@@ -1235,14 +1235,14 @@ static int cdns_dp_phy_set_lanes(struct cdns_dp_phy *cdns_phy,
|
|
|
value = (value & 0x0000FFF0) | (0x0000000E & lane_mask);
|
|
|
cdns_dp_phy_write_dp(cdns_phy, PHY_RESET, value);
|
|
|
|
|
|
- cdns_dp_phy_set_a0_pll(cdns_phy, dp->lanes);
|
|
|
+ cdns_torrent_dp_set_a0_pll(cdns_phy, dp->lanes);
|
|
|
|
|
|
/* release phy_l0*_reset_n based on used laneCount */
|
|
|
value = (value & 0x0000FFF0) | (0x0000000F & lane_mask);
|
|
|
cdns_dp_phy_write_dp(cdns_phy, PHY_RESET, value);
|
|
|
|
|
|
/* Wait, until PHY gets ready after releasing PHY reset signal. */
|
|
|
- ret = cdns_dp_phy_wait_pma_cmn_ready(cdns_phy);
|
|
|
+ ret = cdns_torrent_dp_wait_pma_cmn_ready(cdns_phy);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
@@ -1251,37 +1251,37 @@ static int cdns_dp_phy_set_lanes(struct cdns_dp_phy *cdns_phy,
|
|
|
/* release pma_xcvr_pllclk_en_ln_*, only for the master lane */
|
|
|
cdns_dp_phy_write_dp(cdns_phy, PHY_PMA_XCVR_PLLCLK_EN, 0x0001);
|
|
|
|
|
|
- ret = cdns_dp_phy_run(cdns_phy);
|
|
|
+ ret = cdns_torrent_dp_run(cdns_phy);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
/* Configure link rate as required. */
|
|
|
-static int cdns_dp_phy_set_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
+static int cdns_torrent_dp_set_rate(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp)
|
|
|
{
|
|
|
u32 ret;
|
|
|
|
|
|
- ret = cdns_dp_phy_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A3);
|
|
|
+ ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A3);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
- ret = cdns_dp_phy_set_pll_en(cdns_phy, dp, false);
|
|
|
+ ret = cdns_torrent_dp_set_pll_en(cdns_phy, dp, false);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
ndelay(200);
|
|
|
|
|
|
- ret = cdns_dp_phy_configure_rate(cdns_phy, dp);
|
|
|
+ ret = cdns_torrent_dp_configure_rate(cdns_phy, dp);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
ndelay(200);
|
|
|
|
|
|
- ret = cdns_dp_phy_set_pll_en(cdns_phy, dp, true);
|
|
|
+ ret = cdns_torrent_dp_set_pll_en(cdns_phy, dp, true);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
- ret = cdns_dp_phy_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A2);
|
|
|
+ ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A2);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
- ret = cdns_dp_phy_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A0);
|
|
|
+ ret = cdns_torrent_dp_set_power_state(cdns_phy, dp->lanes, POWERSTATE_A0);
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
ndelay(900);
|
|
|
@@ -1290,7 +1290,7 @@ static int cdns_dp_phy_set_rate(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
|
|
|
/* Configure voltage swing and pre-emphasis for all enabled lanes. */
|
|
|
-static void cdns_dp_phy_set_voltages(struct cdns_dp_phy *cdns_phy,
|
|
|
+static void cdns_torrent_dp_set_voltages(struct cdns_torrent_phy *cdns_phy,
|
|
|
struct phy_configure_opts_dp *dp)
|
|
|
{
|
|
|
u8 lane;
|
|
|
@@ -1323,9 +1323,9 @@ static void cdns_dp_phy_set_voltages(struct cdns_dp_phy *cdns_phy,
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-static int cdns_dp_phy_configure(struct phy *phy, union phy_configure_opts *opts)
|
|
|
+static int cdns_torrent_dp_configure(struct phy *phy, union phy_configure_opts *opts)
|
|
|
{
|
|
|
- struct cdns_dp_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
+ struct cdns_torrent_phy *cdns_phy = phy_get_drvdata(phy);
|
|
|
int ret;
|
|
|
|
|
|
dev_dbg(&phy->dev,
|
|
|
@@ -1342,51 +1342,51 @@ static int cdns_dp_phy_configure(struct phy *phy, union phy_configure_opts *opts
|
|
|
(opts->dp.set_voltages && opts->dp.lanes > 3) ? opts->dp.pre[3] : -1,
|
|
|
opts->dp.ssc);
|
|
|
|
|
|
- ret = cdns_dp_phy_verify_config(cdns_phy, &opts->dp);
|
|
|
+ ret = cdns_torrent_dp_verify_config(cdns_phy, &opts->dp);
|
|
|
if (ret) {
|
|
|
dev_err(&phy->dev, "invalid params for phy configure\n");
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
if (opts->dp.set_lanes) {
|
|
|
- ret = cdns_dp_phy_set_lanes(cdns_phy, &opts->dp);
|
|
|
+ ret = cdns_torrent_dp_set_lanes(cdns_phy, &opts->dp);
|
|
|
if (ret) {
|
|
|
- dev_err(&phy->dev, "cdns_dp_phy_set_lanes failed\n");
|
|
|
+ dev_err(&phy->dev, "cdns_torrent_dp_set_lanes failed\n");
|
|
|
return ret;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (opts->dp.set_rate) {
|
|
|
- ret = cdns_dp_phy_set_rate(cdns_phy, &opts->dp);
|
|
|
+ ret = cdns_torrent_dp_set_rate(cdns_phy, &opts->dp);
|
|
|
if (ret) {
|
|
|
- dev_err(&phy->dev, "cdns_dp_phy_set_rate failed\n");
|
|
|
+ dev_err(&phy->dev, "cdns_torrent_dp_set_rate failed\n");
|
|
|
return ret;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (opts->dp.set_voltages)
|
|
|
- cdns_dp_phy_set_voltages(cdns_phy, &opts->dp);
|
|
|
+ cdns_torrent_dp_set_voltages(cdns_phy, &opts->dp);
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-static const struct of_device_id cdns_dp_phy_of_match[] = {
|
|
|
+static const struct of_device_id cdns_torrent_phy_of_match[] = {
|
|
|
{
|
|
|
- .compatible = "cdns,dp-phy"
|
|
|
+ .compatible = "cdns,torrent-phy"
|
|
|
},
|
|
|
{}
|
|
|
};
|
|
|
-MODULE_DEVICE_TABLE(of, cdns_dp_phy_of_match);
|
|
|
+MODULE_DEVICE_TABLE(of, cdns_torrent_phy_of_match);
|
|
|
|
|
|
-static struct platform_driver cdns_dp_phy_driver = {
|
|
|
- .probe = cdns_dp_phy_probe,
|
|
|
+static struct platform_driver cdns_torrent_phy_driver = {
|
|
|
+ .probe = cdns_torrent_phy_probe,
|
|
|
.driver = {
|
|
|
- .name = "cdns-dp-phy",
|
|
|
- .of_match_table = cdns_dp_phy_of_match,
|
|
|
+ .name = "cdns-torrent-phy",
|
|
|
+ .of_match_table = cdns_torrent_phy_of_match,
|
|
|
}
|
|
|
};
|
|
|
-module_platform_driver(cdns_dp_phy_driver);
|
|
|
+module_platform_driver(cdns_torrent_phy_driver);
|
|
|
|
|
|
MODULE_AUTHOR("Cadence Design Systems, Inc.");
|
|
|
-MODULE_DESCRIPTION("Cadence MHDP PHY driver");
|
|
|
+MODULE_DESCRIPTION("Cadence Torrent PHY driver");
|
|
|
MODULE_LICENSE("GPL v2");
|