aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJernej Skrabec <jernej.skrabec@siol.net>2018-11-04 13:26:52 -0500
committerMaxime Ripard <maxime.ripard@bootlin.com>2018-11-05 05:49:03 -0500
commitcd54074e82e08054eb9905a8d11ee9b0a281076c (patch)
treeb1ab115191a841b6dc0f2240a331fce6bbf52950 /drivers/gpu
parentc8c78ac261e76713fa94de4cb249ebb34eaf84c3 (diff)
drm/sun4i: Not all DW HDMI controllers has scrambled addresses
Currently supported Allwinner SoCs with DW HDMI controller have scrambled addresses and read lock. However, that is not true in general. For example, A80 and H6 have normal addresses and normal read access. Move code for unscrambling addresses and unlocking read access to it's own function and call it from init function. Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181104182705.18047-16-jernej.skrabec@siol.net
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
index 471993097ced..365cb5a9fb77 100644
--- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
+++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
@@ -279,8 +279,21 @@ static const struct dw_hdmi_phy_ops sun8i_hdmi_phy_ops = {
279 .setup_hpd = &dw_hdmi_phy_setup_hpd, 279 .setup_hpd = &dw_hdmi_phy_setup_hpd,
280}; 280};
281 281
282static void sun8i_hdmi_phy_unlock(struct sun8i_hdmi_phy *phy)
283{
284 /* enable read access to HDMI controller */
285 regmap_write(phy->regs, SUN8I_HDMI_PHY_READ_EN_REG,
286 SUN8I_HDMI_PHY_READ_EN_MAGIC);
287
288 /* unscramble register offsets */
289 regmap_write(phy->regs, SUN8I_HDMI_PHY_UNSCRAMBLE_REG,
290 SUN8I_HDMI_PHY_UNSCRAMBLE_MAGIC);
291}
292
282static void sun8i_hdmi_phy_init_a83t(struct sun8i_hdmi_phy *phy) 293static void sun8i_hdmi_phy_init_a83t(struct sun8i_hdmi_phy *phy)
283{ 294{
295 sun8i_hdmi_phy_unlock(phy);
296
284 regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG, 297 regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_DBG_CTRL_REG,
285 SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK, 298 SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK,
286 SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK); 299 SUN8I_HDMI_PHY_DBG_CTRL_PX_LOCK);
@@ -298,6 +311,8 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy)
298{ 311{
299 unsigned int val; 312 unsigned int val;
300 313
314 sun8i_hdmi_phy_unlock(phy);
315
301 regmap_write(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, 0); 316 regmap_write(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, 0);
302 regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG, 317 regmap_update_bits(phy->regs, SUN8I_HDMI_PHY_ANA_CFG1_REG,
303 SUN8I_HDMI_PHY_ANA_CFG1_ENBI, 318 SUN8I_HDMI_PHY_ANA_CFG1_ENBI,
@@ -372,14 +387,6 @@ static void sun8i_hdmi_phy_init_h3(struct sun8i_hdmi_phy *phy)
372 387
373void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy) 388void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy)
374{ 389{
375 /* enable read access to HDMI controller */
376 regmap_write(phy->regs, SUN8I_HDMI_PHY_READ_EN_REG,
377 SUN8I_HDMI_PHY_READ_EN_MAGIC);
378
379 /* unscramble register offsets */
380 regmap_write(phy->regs, SUN8I_HDMI_PHY_UNSCRAMBLE_REG,
381 SUN8I_HDMI_PHY_UNSCRAMBLE_MAGIC);
382
383 phy->variant->phy_init(phy); 390 phy->variant->phy_init(phy);
384} 391}
385 392