瀏覽代碼

1.修复uboot usb不能写的问题;2.修复uboot lcd时钟过低时配置不成功问题

huangliang 9 月之前
父節點
當前提交
4c80e8436f
共有 2 個文件被更改,包括 13 次插入2 次删除
  1. 2 1
      u-boot/drivers/usb/musb-new/musb_host.c
  2. 11 1
      u-boot/drivers/video/arkmicro/ark1668e_lcd.c

+ 2 - 1
u-boot/drivers/usb/musb-new/musb_host.c

@@ -1336,8 +1336,9 @@ void musb_host_tx(struct musb *musb, u8 epnum)
 	qh->segsize = length;
 
 	musb_ep_select(mbase, epnum);
+	tx_csr = musb_readw(epio, MUSB_TXCSR);
 	musb_writew(epio, MUSB_TXCSR,
-			MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
+			tx_csr | MUSB_TXCSR_H_WZC_BITS | MUSB_TXCSR_TXPKTRDY);
 }
 
 

+ 11 - 1
u-boot/drivers/video/arkmicro/ark1668e_lcd.c

@@ -111,11 +111,21 @@ static int ark_lcdc_set_clk(struct udevice *dev)
 	unsigned int srcclk = ark_get_lcdpll_clock(); 
 	unsigned int val;
 	int div;
+	int prediv = 1;
 
 	val = lcdc_readl_sys(priv, SYS_LCD_CLK_CFG);
 	/* select lcdpll src */
 	val &= ~(0x7f << 4) | (0xf << 19);
-	div = DIV_ROUND_UP(srcclk, priv->timing.pixelclock.typ) & 0xf;
+	div = DIV_ROUND_UP(srcclk, priv->timing.pixelclock.typ);
+	while (div > 0xf) {
+		prediv++;
+		div = DIV_ROUND_UP(srcclk / prediv, priv->timing.pixelclock.typ);
+	}
+	if (prediv > 7) {
+		printf("lcd clk %dHz is too low!\n", priv->timing.pixelclock.typ);
+		return -1;
+	}
+	val |= prediv << 4;
 	val |= div << 19;
 	lcdc_writel_sys(priv, SYS_LCD_CLK_CFG, val);