<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: i.MX6Q: Using an external reference for PCIe in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262489#M26599</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm currently trying to use the sabrelite board to act as a PCIe EndPoint. The thing is that the sabrelite has on its PCIe connector (j23) only pin TX+/TX- and RX+/RX- (as well as gnd/3.3v) but no CLK pair. If I understand correctly, by default, the PCIe core is calibrated at 125Mhz and therefor, without any CLK pair comming from the PCIe RC, I would have to get it to work on a 100Mhz so change the PLL.&lt;/P&gt;&lt;P&gt;I was wondering if this code you posted here could help for this purpose as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at this place: &lt;A href="https://community.nxp.com/docs/DOC-95014"&gt;i.MX6Q PCIe EP/RC Validation System&lt;/A&gt; They use 2 boards that are the same and therefor, both are calibrated at 125Mhz. I wanted to use it with a real PCIe bus coming from a PC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When looking at the patch "&lt;SPAN style="color: #3778c7; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #fdfdfd;"&gt;0001-ENGR00268112-pcie-emaluate-the-pcie-ep-as-ram-device.patch.zip&lt;/SPAN&gt;" of the same page, I see:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;-------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; * configure the class_rev(emaluate one memory ram ep device),&lt;/P&gt;&lt;P&gt; * bar0 and bar1 of ep&lt;/P&gt;&lt;P&gt; */&lt;/P&gt;&lt;P&gt; writel(0xdeadbeaf, dbi_base + PCI_VENDOR_ID);&lt;/P&gt;&lt;P&gt; writel( readl(dbi_base + PCI_CLASS_REVISION)&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; |&amp;nbsp; (PCI_CLASS_MEMORY_RAM &amp;lt;&amp;lt; 16), &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; dbi_base + PCI_CLASS_REVISION);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;and when I run it with the patch, and do a memtool:&lt;/P&gt;&lt;P&gt;$ ./memtool -32 0x01FFC000 4&lt;/P&gt;&lt;P&gt;ABCD16C3&lt;/P&gt;&lt;P&gt;Knowing that 0x01FFC000 is the address of the PCIe PID/VID in EP mode and ABCD16C3 is the default PID/VID according to 48.8.1 of the documentation.&lt;/P&gt;&lt;P&gt;So I'm a little bit lost out there, and would like any kind of opinion about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 23 Nov 2013 22:47:54 GMT</pubDate>
    <dc:creator>keytwo</dc:creator>
    <dc:date>2013-11-23T22:47:54Z</dc:date>
    <item>
      <title>i.MX6Q: Using an external reference for PCIe</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262488#M26598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm working on a design in which the i.MX6Q communicates with a single PCIe endpoint.&amp;nbsp; Unlike the SABRE reference designs the reference clock from the endpoint comes from an on-board oscillator, not the i.MX6.&amp;nbsp; We recently got the i.MX6Q to use this external clock as a reference for PCIe.&amp;nbsp; I wanted to share our experiences -- and hopefully compare/contrast to other solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We were able to bring the PCIe link up initially using the PCIe "internal" reference.&amp;nbsp; The PCIe was driven by the ENET PLL.&amp;nbsp; This PLL provides clocks for Ethernet, PCIe, and SATA.&amp;nbsp; This wasn't a ideal setup, however, as the endpoint was on an asynchronous reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our solution to using an external reference for PCIe has three parts:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Configure the CLK pins to accept a clock as input.&lt;/P&gt;&lt;P&gt;2. Bypass the ENET PLL, using the CLK pins as the alternate source.&lt;/P&gt;&lt;P&gt;3. Configure the PCIe PHY to accept a clock other than 125 MHz.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To configure CLK pins as input you must adjust the PMU_MISC1n register (reference section 50.7.6 in Rev. O of the reference manual).&amp;nbsp; Clear the appropriate OBEN bit and set the IBEN bit.&amp;nbsp; The clock source bits are don't-care; they're only used as an output.&amp;nbsp; In my case, I modified the _clk_pcie_enable() and _clk_pcie_disable() routines in the Freescale BSP @ linux/arch/arm/mach-mx6/clock.c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The ENET PLL is bypassed by adjusting the CCM_ANALOG_PLL_ENETn register (section 18.7.15 in the Rev. O RM).&amp;nbsp; Set the BYPASS_CLK_SRC (bits [15:14]) to the source clock and set the BYPASS bit (bit 16).&amp;nbsp; I updated the _clk_pll_enable() routine in clock.c to make these adjustments.&amp;nbsp; See below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;static int _clk_pll_enable(struct clk *clk)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int reg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void __iomem *pllbase;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pllbase = _get_pll_base(clk);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg = __raw_read(pll_base);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Bypass the ENET PLL; use CLK1 as the source */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (clk == &amp;amp;pll8_enet_main_clk) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~ANADIG_PLL_BYPASS_CLK_SRC_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |= (0x1 &amp;lt;&amp;lt; ANADIG_PLL_BYPASS_CLK_SRC_OFFSET);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* power-up the PLL */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~ANADIG_PLL_POWER_DOWN;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* ...snip... */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Enable the PLL output now */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg = __raw_readl(pllbase);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (clk != &amp;amp;pll8_enet_main_clk)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~ANADIG_PLL_BYPASS;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |= ANADIG_PLL_ENABLE;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; __raw_writel(reg, pllbase);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, the PCIe PHY needs to be adjusted to accept a clock at the provided frequency.&amp;nbsp; In our case, the reference clock is 100MHz.&amp;nbsp; By default the PCIe PHY wants a 125MHz reference.&amp;nbsp; To accept another rate adjust the MPLL according to table 49-1 in the reference manual.&amp;nbsp; Use the ATEOVRD (49.5.8) and MPLL_OVRD_IN_LO&amp;nbsp; (49.5.9) registers.&amp;nbsp; NOTE:&amp;nbsp; The ATEOVRD shows bit 0 as reserved.&amp;nbsp; I determined through experimentation that this isn't the case.&amp;nbsp; Bit 0 is ref_clkdiv2, bit 1 is ref_usb2_en, and bit 2 is ateovrd_en.&amp;nbsp; See code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#define PCIE_PHY_ATEOVRD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (0x10)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;#define PCIE_PHY_MPLL_OVRD_IN_LO&amp;nbsp; (0x11)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;static int imx_pcie_override_phy_mpll(u32 mpll_multiplier, u32 ref_clkdiv2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; u32 ref_usb2_en;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; u32 reg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int ret;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pr_info("overriding PCIe PHY MPLL config: multiplier = %d, clkdiv2 = %d\n",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mpll_multiplier, ref_clkdiv2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set the MPLL override value to 'disabled' */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_read(PCIE_PHY_MPLL_OVRD_IN_LO, &amp;amp;reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~(0x1 &amp;lt;&amp;lt; 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_MPLL_OVRD_IN_LO, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* enable MPLL override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |= (0x1 &amp;lt;&amp;lt; 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_MPLL_OVRD_IN_LO, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set the new MPLL multiplier */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~(0x7F &amp;lt;&amp;lt; 2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |=&amp;nbsp; (mpll_multiplier &amp;lt;&amp;lt; 2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_MPLL_OVRD_IN_LO, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* enable multiplier override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |= (0x1 &amp;lt;&amp;lt; 9);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_MPLL_OVRD_IN_LO, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * set the ref_clkdiv2.&amp;nbsp; when this override is enabled it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * overrides both ref_clkdiv2 and ref_usb2_en.&amp;nbsp; make sure&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * the overriden ref_usb2_en reflects the original value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_read(PCIE_PHY_ATEOVRD, &amp;amp;reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ref_usb2_en = (reg &amp;gt;&amp;gt; 3) &amp;amp; 0x1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set the current value of ref_usb2_en as the override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~(0x1 &amp;lt;&amp;lt; 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |=&amp;nbsp; (ref_usb2_en &amp;lt;&amp;lt; 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set the ref_clkdiv2 override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~(0x1 &amp;lt;&amp;lt; 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |=&amp;nbsp; (ref_clkdiv2 &amp;lt;&amp;lt; 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_ATEOVRD, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* enable the ref_clkdiv2 override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |= (0x1 &amp;lt;&amp;lt; 2);&amp;nbsp; /* ateovrd_en */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_ATEOVRD, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* disable the MPLL override */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_read(PCIE_PHY_MPLL_OVRD_IN_LO, &amp;amp;reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg &amp;amp;= ~(0x1 &amp;lt;&amp;lt; 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; reg |=&amp;nbsp; (0x1 &amp;lt;&amp;lt; 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pcie_phy_cr_write(PCIE_PHY_MPLL_OVRD_IN_LO, reg);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I call this routine from the imx_pcie_pltfm_probe() routine in linux/arch/arm/mach-mx6/pcie.c just before enabling the LTSSM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's it.&amp;nbsp; This seems to work for me.&amp;nbsp; If anyone has other experiences I'd love to hear about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Charlie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 00:29:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262488#M26598</guid>
      <dc:creator>kitz36</dc:creator>
      <dc:date>2013-02-19T00:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6Q: Using an external reference for PCIe</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262489#M26599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm currently trying to use the sabrelite board to act as a PCIe EndPoint. The thing is that the sabrelite has on its PCIe connector (j23) only pin TX+/TX- and RX+/RX- (as well as gnd/3.3v) but no CLK pair. If I understand correctly, by default, the PCIe core is calibrated at 125Mhz and therefor, without any CLK pair comming from the PCIe RC, I would have to get it to work on a 100Mhz so change the PLL.&lt;/P&gt;&lt;P&gt;I was wondering if this code you posted here could help for this purpose as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at this place: &lt;A href="https://community.nxp.com/docs/DOC-95014"&gt;i.MX6Q PCIe EP/RC Validation System&lt;/A&gt; They use 2 boards that are the same and therefor, both are calibrated at 125Mhz. I wanted to use it with a real PCIe bus coming from a PC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When looking at the patch "&lt;SPAN style="color: #3778c7; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12px; background-color: #fdfdfd;"&gt;0001-ENGR00268112-pcie-emaluate-the-pcie-ep-as-ram-device.patch.zip&lt;/SPAN&gt;" of the same page, I see:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;-------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; * configure the class_rev(emaluate one memory ram ep device),&lt;/P&gt;&lt;P&gt; * bar0 and bar1 of ep&lt;/P&gt;&lt;P&gt; */&lt;/P&gt;&lt;P&gt; writel(0xdeadbeaf, dbi_base + PCI_VENDOR_ID);&lt;/P&gt;&lt;P&gt; writel( readl(dbi_base + PCI_CLASS_REVISION)&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp; |&amp;nbsp; (PCI_CLASS_MEMORY_RAM &amp;lt;&amp;lt; 16), &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; dbi_base + PCI_CLASS_REVISION);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;and when I run it with the patch, and do a memtool:&lt;/P&gt;&lt;P&gt;$ ./memtool -32 0x01FFC000 4&lt;/P&gt;&lt;P&gt;ABCD16C3&lt;/P&gt;&lt;P&gt;Knowing that 0x01FFC000 is the address of the PCIe PID/VID in EP mode and ABCD16C3 is the default PID/VID according to 48.8.1 of the documentation.&lt;/P&gt;&lt;P&gt;So I'm a little bit lost out there, and would like any kind of opinion about it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Nov 2013 22:47:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262489#M26599</guid>
      <dc:creator>keytwo</dc:creator>
      <dc:date>2013-11-23T22:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6Q: Using an external reference for PCIe</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262490#M26600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry to resurrect this - although it's still a good reference for most people! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the newer kernel, 3.10, which uses device trees for setup. The clock code is very different to what it used to be and I can't seem to figure out how to apply your patches. I'm guessing that they may already be applied and I just need to set up a different clock in the dtb...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could someone please shed some light on using an external clock for PCIe with the newer kernels (3.10 perhaps)? There is basically no documentation :smileysad:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 06:18:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262490#M26600</guid>
      <dc:creator>mitchellcox</dc:creator>
      <dc:date>2014-12-10T06:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6Q: Using an external reference for PCIe</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262491#M26601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;/P&gt;&lt;P&gt;I am using I.mx6 ARM processor, I want to configure &lt;STRONG&gt;PCIe clock frequency to 100MHZ.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.I need to write standalone program to set PCIe clock frequency,and I need to generate binary file of this program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.I have decided to use above mentioned functions,If so what are the header file I need to be include and please suggest me how generate binary file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Apr 2016 08:02:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6Q-Using-an-external-reference-for-PCIe/m-p/262491#M26601</guid>
      <dc:creator>karthikas</dc:creator>
      <dc:date>2016-04-29T08:02:41Z</dc:date>
    </item>
  </channel>
</rss>

