在uboot中添加logo,lvds接口的lcd显示不正常,出现波动。网上说是lvds时钟频率的问题。

使用示波器测量之后,发现频率是60M,而lcd最大频率才46.8M。

因此就需要更改uboot中lvds的时钟,本文介绍lvds的时钟配置。

参考链接:

  https://community.nxp.com/docs/DOC-172312

  https://community.nxp.com/docs/DOC-93617

  https://community.nxp.com/thread/306801

  https://community.nxp.com/thread/355690

  https://community.nxp.com/thread/378887

  https://community.nxp.com/thread/305115

  https://community.nxp.com/thread/395103

原理分析

datasheet: IMX6SDLRM

imx6 使用了2个晶振:

  外部低频时钟: 32kHz or 32.768kHz

  外部高频时钟: 24MHz

LVDS的时钟就是图中LDB_DI0_IPU和LDB_DI0_IPU

18.5.1.3 PLL reference clock

There are several PLLs in this chip.
PLL1 - ARM PLL (typical functional frequency 800 MHz)
PLL2 - System PLL (functional frequency 528 MHz)
PLL3 - USB1 PLL (functional frequency 480 MHz)
PLL4 - Audio PLL
PLL5 - Video PLL
PLL6 - ENET PLL
PLL7 - USB2 PLL (functional frequency 480 MHz)
PLL8 - MLB PLL

18.5.1.3.1 ARM PLL

This PLL synthesizes a low jitter clock from a 24 MHz reference clock. The clock output
frequency for this PLL ranges from 650 MHz to 1.3 GHz. The output frequency is
selected by a 7-bit register field CCM_ANALOG_PLL_ARM[DIV_SELECT].
PLL output frequency = Fref * DIV_SEL/2

CCM_ANALOG_PLL_ARM寄存器

根据寄存器计算:pll0输出范围

  24M * 54 / 2 = 648M

  24M * 108 / 2 = 1296M

18.5.1.3.3 System PLL

This PLL synthesizes a low jitter clock from the 24 MHz reference clock. The PLL has
one output clock, plus 3 PFD outputs. The System PLL supports spread spectrum
modulation for use in applications to minimize radiated emissions. The spread spectrum
PLL output clock is frequency modulated so that the energy is spread over a wider
bandwidth, thereby reducing peak radiated emissions. Due to this feature support, the
associated lock time of this PLL is longer than other PLLs in the SoC that do not support
spread spectrum modulation.
......
Although this PLL does have a DIV_SELECT register field, it is intended that this PLL
will only be run at the default frequency of 528 MHz.

Analog System PLL Control Register

  24M * 20 = 480M

  24M * 22 = 528M

18.5.1.4 Phase Fractional Dividers (PFD)

There are several PFD outputs from the System PLL and USB1 PLL.
Each PFD output generates a fractional multiplication of the associated PLL’s VCO
frequency. Where the output frequency is equal to Fvco*18/N, N can range from 12-35.
The PFDs allow for clock frequency changes without forcing the relock of the root PLL.
This feature is useful in support of dynamic voltage and frequency scaling (DVFS). See
CCM Analog Memory Map/Register Definition.

频率最小值:

  480M * 18 / 35 = 246M

  246M / 7 = 35M

代码更改

board/freescale/mx6q_sabresd/mx6q_sabresd.c

void lcd_enable(void)
{
......
#elif defined CONFIG_MX6DL /* CONFIG_MX6Q */
/*
* IPU1 HSP clock tree:
* osc_clk(24M)->pll3_usb_otg_main_clk(480M)->
* pll3_pfd_540M(540M)->ipu1_clk(270M)
*/
/* pll3_usb_otg_main_clk */
/* divider */
writel(0x3, ANATOP_BASE_ADDR + 0x18); /* pll3_pfd_540M */
/* divider */
writel(0x3F << 8, ANATOP_BASE_ADDR + 0xF8);
writel(0x10 << 8, ANATOP_BASE_ADDR + 0xF4);
/* enable */
writel(0x1 << 15, ANATOP_BASE_ADDR + 0xF8); /* ipu1_clk */
reg = readl(CCM_BASE_ADDR + CLKCTL_CSCDR3);
/* source */
reg |= (0x3 << 9);
/* divider */
reg &= ~(0x7 << 11);
reg |= (0x1 << 11);
writel(reg, CCM_BASE_ADDR + CLKCTL_CSCDR3); /*
* ipu1_pixel_clk_x clock tree:
* osc_clk(24M)->pll2_528_bus_main_clk(528M)->
* pll2_pfd_352M(452.57M)->ldb_dix_clk(64.65M)->
* ipu1_di_clk_x(64.65M)->ipu1_pixel_clk_x(64.65M)
*/
/* pll2_528_bus_main_clk */
/* divider */
//Tony
//1. ---------- 将pll2由528M更改为480M ------------------
reg = readl(ANATOP_BASE_ADDR + 0x34);
reg &= ~(1 << 0); // 24M * 20 = 480M
writel(reg, ANATOP_BASE_ADDR + 0x34);
////////////
//writel(0x1, ANATOP_BASE_ADDR + 0x34); // 24M * 22 = 528M /* pll2_pfd_352M */
/* disable */
writel(0x1 << 7, ANATOP_BASE_ADDR + 0x104);
/* divider */
//2. ---------更改分频参数为35. 480 * 18 / 35 = 246M ----------
writel(0x3F, ANATOP_BASE_ADDR + 0x108);
writel(0x23, ANATOP_BASE_ADDR + 0x104);
//原来设置 528M * 18 / 21 = 452.57M
// writel(0x3F, ANATOP_BASE_ADDR + 0x108);
// writel(0x15, ANATOP_BASE_ADDR + 0x104); /* ldb_dix_clk */
/* source */
//3. --------- 选择时钟源, pll2_pfd0 -----------
//ldb_di1_clk_sel Selector for ldb_di1 clock multiplexer
//NOTE: Multiplexor should be updated when both input and output clocks are gated.
//000 pll5 clock
//001 derive clock from PLL2 PFD0
//010 derive clock from PLL2 PFD2
//011 derive clock from mmdc_ch1 clock
//100 derive clock from pll3_sw_clk
//101-111 Reserve
reg = readl(CCM_BASE_ADDR + CLKCTL_CS2CDR);
reg |= (0x9 << 9); writel(reg, CCM_BASE_ADDR + CLKCTL_CS2CDR);
/* divider */
reg = readl(CCM_BASE_ADDR + CLKCTL_CSCMR2);
reg |= (0x3 << 10);
writel(reg, CCM_BASE_ADDR + CLKCTL_CSCMR2); /* pll2_pfd_352M */
/* enable after ldb_dix_clk source is set */
writel(0x1 << 7, ANATOP_BASE_ADDR + 0x108);
//ipu1 di1 root clock multiplexer : derive clock from ldb_di1_clk
//ipu1 di0 root clock multiplexer : derive clock from ldb_di0_clk
reg = readl(CCM_BASE_ADDR + CLKCTL_CHSCCDR);
reg &= ~0xE07;
reg |= 0x803;
//ipu1 di1 root clock multiplexer : derive clock from ldb_di1_clk
//ipu1 di0 root clock multiplexer : derive clock from ldb_di0_clk
writel(reg, CCM_BASE_ADDR + CLKCTL_CHSCCDR);
#endif /* CONFIG_MX6DL */
......

Author

Tony Liu

2016-8-23, Shenzhen

imx6 uboot lvds clock的更多相关文章

  1. imx6 uboot lcd

    本文记录imx6 uboot中关于lcd初始化的过程. uboot中相关的文件: cpu/arm_cortexa8/start.S lib_arm/board.c board/freescale/mx ...

  2. I.MX6 U-boot lvds display hacking

    /*********************************************************************************** * I.MX6 U-boot ...

  3. imx6 uboot splash image

    跟踪uboot代码,了解imx6 splash image的生成过程. 涉及文件: ./cpu/arm_cortexa8/start.S ./board/freescale/mx6q_sabresd/ ...

  4. imx6 uboot启动流程分析

    参考http://blog.csdn.net/skyflying2012/article/details/25804209 这里以imx6平台为例,分析uboot启动流程对于任何程序,入口函数是在链接 ...

  5. imx6 uboot saveenv fail

    uboot设置环境变量之后,不能保存在EMMC中,出现错误. MX6SDL SABRESD U-Boot > saveenv Saving Environment to SPI Flash... ...

  6. imx6 u-boot.bin 和 u-boot.imx

    有些MFG TOOL烧录工具使用了u-boot.imx,而不是原来的u-boot.bin文件进行烧录. 这两个镜像的区别是,u-boot.bin文件编译后,会在u-boot.bin的开头添加一个大小为 ...

  7. imx6 uboot logo 更改

    最近需要更改im6 uboot的开机logo,使用10.1inch, 1024x600,18bit的LCD,期间遇到了很多的问题,记录于此. 参考链接 https://community.nxp.co ...

  8. uboot的readme

    ## (C) Copyright 2000 - 2008# Wolfgang Denk, DENX Software Engineering, wd@denx.de.## See file CREDI ...

  9. JETSON TK1 ~ 控制GPIO

    首先建立个存放gpio代码的文件夹,CD到该文件夹. git clone git://github.com/derekmolloy/boneDeviceTree/ 解压后会出现几个文件 GPIO文件夹 ...

随机推荐

  1. 【wikioi】1049 棋盘染色(迭代深搜)

    http://www.wikioi.com/problem/1049/ 这题我之前写没想到迭代加深,看了题解,然后学习了这种搜索(之前我写的某题也用过,,但是不懂专业名词 囧.) 迭代加深搜索就是限制 ...

  2. 全面解析Linux数字文件权限

    全面解析Linux数字文件权限 来源:   时间:2013-09-04 20:35:13   阅读数:11433 分享到:0 [导读] 在刚开始接触Linux时对于文件权限的理解并不是很透彻,这里详细 ...

  3. 关于HTML条件注释你可能不知道的一些事儿

    最近经常看到类似这样的HTML代码片段,很多前端开发人员应该都熟悉: 1 <!--[if lt IE 7]>      <html class="ie6"> ...

  4. The Stable Marriage Problem

    经典稳定婚姻问题 “稳定婚姻问题(The Stable Marriage Problem)”大致说的就是100个GG和100个MM按照自己的喜欢程度给所有异性打分排序.每个帅哥都凭自己好恶给每个MM打 ...

  5. YII2.0 secruity

    保存密码不能用明文保存,用MD5或者sha1哈希化是安全,但是随着硬件的发展,可能会暴力破解,目前能够对抗暴力破解的哈希算法是 bcrypt,Yii提供了两个帮助函数使用crypt进行安全的哈希加密 ...

  6. [办公自动化]Wlan无法启动,无法连接无线网wifi,所有无线网都搜索不到

    转帖: http://support1.lenovo.com.cn/lenovo/wsi/htmls/detail_20121023172943554.html 故障现象: 启动wlan autoco ...

  7. 深入说明HDR

    http://wenku.baidu.com/link?url=xBdq0VRVi2t0x9uis3XfU_0mKf2eK0e6y_1hiSo7IWSWyUE8yAwaTJ60ZlxTzQf91VPf ...

  8. Apache Spark源码走读之15 -- Standalone部署模式下的容错性分析

    欢迎转载,转载请注明出处,徽沪一郎. 概要 本文就standalone部署方式下的容错性问题做比较细致的分析,主要回答standalone部署方式下的包含哪些主要节点,当某一类节点出现问题时,系统是如 ...

  9. PHP 设计模式 笔记与总结(6)基础设计模式:工厂模式、单例模式和注册树模式

    三种基础设计模式(所有面向对象设计模式中最常见的三种): ① 工厂模式:使用工厂方法或者类生成对象,而不是在代码中直接new 在 Common 目录下新建 Factory.php: <?php ...

  10. 从StackOverflow来的值得回味的编程观点

    从StackOverflow来的值得回味的编程观点 很多有意思的话语 在 2012年06月08日 那天写的     已经有 4148 次阅读了 感谢 参考或原文 www.csdn.net   服务器君 ...