Skip to content
  • Martin Blumenstingl's avatar
    clk: meson: meson8b: add the read-only video clock trees · 6cb57c67
    Martin Blumenstingl authored and Neil Armstrong's avatar Neil Armstrong committed
    
    
    Add all clocks to give us the final video clocks within the Meson8,
    Meson8b and Meson8m2 SoCs. The final video clocks are:
    - cts_enct
    - cts_encl
    - cts_encp
    - cts_enci
    - cts_vdac0
    - hdmi_tx_pixel
    - hdmi_sys
    
    Add multiple clocks in between which are needed to implement these
    clocks:
    - Opposed to GXBB there is no pre-multiplier for the PLL input. The
      assumption here is that the multiplier is required to achieve the HDMI
      2.0 clock rates (which are up to twice the rate of the HDMI 1.4
      rates).
    - The main PLL is called "HDMI PLL" or "HPLL" in the datasheet. Rename
      our existing "vid_pll_dco" to "hdmi_pll_dco". The actual VID_PLL clock
      also exists further down the tree.
    - Rename the existing "vid_pll" clock (which is the OD divider at
      HHI_VID_PLL_CNTL[17:16]) to "hdmi_pll_lvds_out" to match the naming
      from the datasheet.
    - Add the second OD divider called "hdmi_pll_hdmi_out" at
      HHI_VID_PLL_CNTL[19:18].
    - Add the "vid_pll_in_sel" which can choose between "hdmi_pll_dco" and
      another parent. However, the second parent is not use on Amlogic's
      3.10 kernel for HDMI or CVBS output so just leave a TODO in the code.
    - Add the "vid_pll_in_en" which is located after "vid_pll_in_sel"
      according to the datasheet.
    - Add "vid_pll_pre_div" which is used for divide-by-5 and divide-by-6 in
      Amlogic's 3.10 kernel sources.
    - Add "vid_pll_post_div" which divides the output of "vid_pll_pre_div"
      further down. The Amlogic 3.10 kernel configures this as divide-by-2
      with "vid_pll_pre_div" being configured as divide-by-5 to achieve a
      total divider of 10.
    - Add the real "vid_pll" clock which selects between "vid_pll_pre_div",
      "vid_pll_post_div" and a third "vid_pll_pre_div_mult7_div2" (which is
      "vid_pll_pre_div" divided by 3.5). The latter is not supported yet
      because it's not used in Amlogic's 3.10 kernel. The "vid_pll" clock
      rate can also be measured by clkmsr to check whether this
      implementation is correct.
    - Add "vid_pll_final_div" which is a post-divider for "vid_pll" and it's
      used as input for "vclk" and "vclk2"
    - Add the two symmetric "vclk" and "vclk" clock trees, each with a
      divide-by-1, divide-by-2, divide-by-4, divide-by-6 and divide-by-12
      clock and a divider for each clock.
    - Add the "cts_enct", "cts_encp" and "hdmi_tx_pixel" clocks which each
      have their own gate and can select between any of the five "vclk"
      dividers.
    - Add the "cts_encl" and "cts_vdac0" clocks which each have their own
      gate and can select between any of the five "vclk2" dividers.
    
    The "hdmi_sys" clock is a different than these video clocks. It takes
    "xtal" as input (there are three more but unknown parents). Add this
    clock as well as it's used by the HDMI controller. Amlogic's 3.10 kernel
    always configures this as "xtal divided by 1", so we can ignore the
    other parents for now.
    
    This was tested on Meson8b and Meson8m2 boards by comparing the common
    clock framework output with the clock measurer output. The following
    video modes were first set in u-boot (by running "video dev open $mode")
    before booting Linux:
    4K2K30HZ (only supported by Meson8m2, not tested on Meson8b):
    - vid_pll: 297000000Hz
    - cts_encp: 297000000Hz
    - hdmi_tx_pixel: 297000000Hz
    1080P:
    - vid_pll: 148500000Hz
    - cts_encp: 148500000Hz
    - hdmi_tx_pixel: 148500000Hz
    720P:
    - vid_pll: 148500000Hz
    - cts_encp: 148500000Hz
    - hdmi_tx_pixel: 74250000Hz
    480P:
    - vid_pll: 216000000Hz
    - cts_encp: 54000000Hz
    - hdmi_tx_pixel: 27000000Hz
    
    Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
    Link: https://lkml.kernel.org/r/20181202214220.7715-4-martin.blumenstingl@googlemail.com
    6cb57c67