Pārlūkot izejas kodu

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 <keith.zhao@starfivetech.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
Hal Feng 9 mēneši atpakaļ
vecāks
revīzija
60884ca5ec

+ 9 - 0
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);

+ 4 - 1
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;
 }

+ 1 - 1
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),