From 60884ca5ec70d8f03d342c69e5f807a76a2a4f47 Mon Sep 17 00:00:00 2001 From: Hal Feng Date: Wed, 16 Aug 2023 21:30:56 +0800 Subject: video: starfive: Add StarFive VisionFive 2 board support Make the code be compatible with the StarFive VisionFive 2 board. The code is ported from tag JH7110_VF2_515_v3.9.3 of VF2 repo. Signed-off-by: Keith Zhao Signed-off-by: Hal Feng --- drivers/video/starfive/sf_mipi.c | 9 +++++++++ drivers/video/starfive/sf_vop.c | 5 ++++- drivers/video/video-uclass.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/video/starfive/sf_mipi.c b/drivers/video/starfive/sf_mipi.c index 4521f7c869..ee5fbe7359 100644 --- a/drivers/video/starfive/sf_mipi.c +++ b/drivers/video/starfive/sf_mipi.c @@ -159,12 +159,21 @@ static void dsi_phy_post_set_mode(void *priv_data, unsigned long mode_flags) CFG_L0_SWAP_SEL_SHIFT, CFG_L0_SWAP_SEL_MASK);//Lane setting sf_dphy_set_reg(priv->phy_reg, 0x1, CFG_L1_SWAP_SEL_SHIFT, CFG_L1_SWAP_SEL_MASK); +#if CONFIG_IS_ENABLED(TARGET_STARFIVE_EVB) sf_dphy_set_reg(priv->phy_reg, 0x4, CFG_L2_SWAP_SEL_SHIFT, CFG_L2_SWAP_SEL_MASK); sf_dphy_set_reg(priv->phy_reg, 0x2, CFG_L3_SWAP_SEL_SHIFT, CFG_L3_SWAP_SEL_MASK); sf_dphy_set_reg(priv->phy_reg, 0x3, CFG_L4_SWAP_SEL_SHIFT, CFG_L4_SWAP_SEL_MASK); +#else + sf_dphy_set_reg(priv->phy_reg, 0x2, + CFG_L2_SWAP_SEL_SHIFT, CFG_L2_SWAP_SEL_MASK); + sf_dphy_set_reg(priv->phy_reg, 0x3, + CFG_L3_SWAP_SEL_SHIFT, CFG_L3_SWAP_SEL_MASK); + sf_dphy_set_reg(priv->phy_reg, 0x4, + CFG_L4_SWAP_SEL_SHIFT, CFG_L4_SWAP_SEL_MASK); +#endif //PLL setting sf_dphy_set_reg(priv->phy_reg + 0x1c, 0x0, RG_CDTX_PLL_SSC_EN_SHIFT, RG_CDTX_PLL_SSC_EN_MASK); diff --git a/drivers/video/starfive/sf_vop.c b/drivers/video/starfive/sf_vop.c index e786032429..5f91ed7bde 100644 --- a/drivers/video/starfive/sf_vop.c +++ b/drivers/video/starfive/sf_vop.c @@ -43,7 +43,6 @@ static void iotrace_writel(ulong value, void *ptr) static int sf_vop_power_off(struct udevice *dev) { struct udevice *dev_power; - struct udevice *dev_pmic; struct power_domain_ops *ops; struct power_domain power_domain; int ret; @@ -76,7 +75,9 @@ static int sf_vop_power_off(struct udevice *dev) static int sf_vop_power(struct udevice *dev) { struct udevice *dev_power; +#if CONFIG_IS_ENABLED(TARGET_STARFIVE_EVB) struct udevice *dev_pmic; +#endif struct power_domain_ops *ops; struct power_domain power_domain; int ret; @@ -108,6 +109,7 @@ static int sf_vop_power(struct udevice *dev) return ret; } +#if CONFIG_IS_ENABLED(TARGET_STARFIVE_EVB) ret = uclass_get_device_by_driver(UCLASS_PMIC, DM_DRIVER_GET(pmic_starfive), &dev_pmic); if (ret) { @@ -120,6 +122,7 @@ static int sf_vop_power(struct udevice *dev) pr_err("failed to update SD control register: %d", ret); return ret; } +#endif return 0; } diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 52a1d94743..f1fdabdfae 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -265,7 +265,7 @@ int video_sync_copy(struct udevice *dev, void *from, void *to) * frame buffer */ if (offset < -priv->fb_size || offset > 2 * priv->fb_size) { -#if DEBUG +#ifdef DEBUG char str[80]; snprintf(str, sizeof(str), -- cgit v1.2.3