1. 29 7月, 2019 2 次提交
  2. 11 6月, 2019 3 次提交
  3. 20 5月, 2019 1 次提交
  4. 01 4月, 2019 4 次提交
  5. 13 2月, 2019 1 次提交
  6. 03 2月, 2019 1 次提交
    • J
      clk: meson: rework and clean drivers dependencies · 889c2b7e
      Jerome Brunet 提交于
      Initially, the meson clock directory only hosted 2 controllers drivers,
      for meson8 and gxbb. At the time, both used the same set of clock drivers
      so managing the dependencies was not a big concern.
      
      Since this ancient time, entropy did its job, controllers with different
      requirement and specific clock drivers have been added. Unfortunately, we
      did not do a great job at managing the dependencies between the
      controllers and the different clock drivers. Some drivers, such as
      clk-phase or vid-pll-div, are compiled even if they are useless on the
      target (meson8). As we are adding new controllers, we need to be able to
      pick a driver w/o pulling the whole thing.
      
      The patch aims to clean things up by:
      * providing a dedicated CONFIG_ for each clock drivers
      * allowing clock drivers to be compiled as a modules, if possible
      * stating explicitly which drivers are required by each controller.
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lkml.kernel.org/r/20190201125841.26785-5-jbrunet@baylibre.com
      889c2b7e
  7. 07 1月, 2019 2 次提交
  8. 03 12月, 2018 3 次提交
    • M
      clk: meson: meson8b: add the read-only video clock trees · 6cb57c67
      Martin Blumenstingl 提交于
      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: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lkml.kernel.org/r/20181202214220.7715-4-martin.blumenstingl@googlemail.com
      6cb57c67
    • M
      clk: meson: meson8b: add the fractional divider for vid_pll_dco · 007f3da7
      Martin Blumenstingl 提交于
      This "vid_pll_dco" (which should be named HDMI_PLL or - as the datasheet
      calls it - HPLL) has a 12-bit wide fractional parameter at
      HHI_VID_PLL_CNTL2[11:0]. Add this so we correctly calculate the rate of
      this PLL when u-boot is configured for a video mode which uses this
      fractional parameter.
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lkml.kernel.org/r/20181202214220.7715-3-martin.blumenstingl@googlemail.com
      007f3da7
    • M
      clk: meson: meson8b: fix the offset of vid_pll_dco's N value · 376d8c45
      Martin Blumenstingl 提交于
      Unlike the other PLLs on Meson8b the N value "vid_pll_dco" (a better
      name would be hdmi_pll_dco or - as the datasheet calls it - HPLL) is
      located at HHI_VID_PLL_CNTL[14:10] instead of [13:9].
      This results in an incorrect calculation of the rate of this PLL because
      the value seen by the kernel is double the actual N (divider) value.
      Update the offset of the N value to fix the calculation of the PLL rate.
      
      Fixes: 28b9fcd0 ("clk: meson8b: Add support for Meson8b clocks")
      Reported-by: NJianxin Pan <jianxin.pan@amlogic.com>
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      Link: https://lkml.kernel.org/r/20181202214220.7715-2-martin.blumenstingl@googlemail.com
      376d8c45
  9. 23 11月, 2018 10 次提交
  10. 26 9月, 2018 6 次提交
  11. 21 5月, 2018 1 次提交
    • M
      clk: meson: meson8b: mark fclk_div2 gate clocks as CLK_IS_CRITICAL · 72e1f230
      Martin Blumenstingl 提交于
      Until commit 05f81440 ("clk: meson: add fdiv clock gates") we
      relied on the bootloader to enable the fclk_div clock gates. It turns
      out that our clock tree is incomplete at least on Meson8b (tested with
      an Odroid-C1, which uses an RGMII PHY) because after the mentioned
      commit Ethernet is not working anymore (no RX/TX activity can be seen).
      At the same time Ethernet was still working on Meson8m2 with a RMII PHY.
      
      Testing has shown that as soon as "fclk_div2" is disabled Ethernet stops
      working on Odroid-C1. Unfortunately it's currently not clear what the
      Ethernet controller IP block uses the fclk_div2 clock for. Mark the
      clock as CLK_IS_CRITICAL to keep it enabled (as it's already enabled by
      most bootloaders by default, which is why we didn't notice it before).
      
      Fixes: 05f81440 ("clk: meson: add fdiv clock gates")
      Cc: stable@vger.kernel.org
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Tested-by: NKevin Hilman <khilman@baylibre.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      72e1f230
  12. 18 5月, 2018 1 次提交
  13. 15 5月, 2018 1 次提交
    • M
      clk: meson: meson8b: add support for the NAND clocks · b8c1ddad
      Martin Blumenstingl 提交于
      This adds the NAND clocks (from the HHI_NAND_CLK_CNTL register) to the
      Meson8b clock driver. There are three NAND clocks: a gate which enables
      or disables the NAND clock, a mux and a divider (which divides the mux
      output).
      Unfortunately the public S805 datasheet does not document the mux
      parents. However, the vendor kernel has a few hints for us which allows
      us to make an educated guess about the clock parents. To do this we need
      to have a look at set_nand_core_clk() from the vendor's NAND driver (see
      [0]):
      - XTAL = (4<<9) | (1<<8) | 0
      - 160MHz = (0<<9) | (1<<8) | 3)
      - 182MHz = (3<<9) | (1<<8) | 1)
      - 212MHz = (1<<9) | (1<<8) | 3)
      - 255MHz = (2<<9) | (1<<8) | 1)
      
      While there is a comment for the XTAL parent (which indicates that it
      should only be used for debugging) we have to do a bit of math for the
      other parents: target_freq * divider = rate of parent clock
      Bit 8 above is the enable bit, so we can ignore it here. Bits 11:9 are
      the mux index and bits 6:0 are the 0-based divider (so we need to add
      1). This gives us:
      - mux 0 (160MHz * 4) = fclk_div4 (actual rate = 637.5MHz, off by 2.5MHz)
      - mux 1 (212MHz * 4) = fclk_div3 (actual rate = 850MHz, off by 2MHz)
      - mux 2 (255MHz * 2) = fclk_div5 (matches exactly 510MHz)
      - mux 3 (182MHz * 2) = fclk_div7 (actual rate = 346.3MHz, off by 0.3MHz)
      
      [0] https://github.com/khadas/linux/blob/9587681285cb/drivers/amlogic/amlnf/dev/amlnf_ctrl.c#L314Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      b8c1ddad
  14. 25 4月, 2018 2 次提交
    • M
      clk: meson: meson8b: fix meson8b_cpu_clk parent clock name · 5b33139b
      Martin Blumenstingl 提交于
      meson8b_cpu_clk has two parent clocks:
      - meson8b_xtal
      - meson8b_cpu_scale_out_sel
      
      The name of the "xtal" clock parent is specified correctly. However,
      there is a typo in the name of the second parent clock. The
      meson8b_cpu_scale_out_sel definition uses the name "cpu_scale_out_sel"
      (which matches the name from the datasheet). However, the mux parent
      definition uses the name "cpu_out_sel" which does not match any existing
      clock.
      
      Fixes: 251b6fd3 ("clk: meson: rework meson8b cpu clock")
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      5b33139b
    • M
      clk: meson: meson8b: fix meson8b_fclk_div3_div clock name · b251e4c8
      Martin Blumenstingl 提交于
      The names of all fclk divider gate clocks follow the naming schema
      "fclk_divN" and the name of all fclk fixed dividers follow the naming
      schema "fclk_divN_div".
      There's one exception to this rule: meson8b_fclk_div3_div's name is
      "fclk_div_div3". It's child clock meson8b_fclk_div3 however references
      it as "fclk_div3_div" (following the naming schema explained above).
      
      Fix the naming of the meson8b_fclk_div3_div clock to follow the naming
      schema. This also fixes serial console on my Meson8m2 board because
      "clk81" uses fclk_div3 as parent. However, since the hierarchy stops at
      meson8b_fclk_div3 there's no known parent clock and the rate of "clk81"
      and all of it's children (UART clock, SDIO MMC controller clock, ...)
      are all 0.
      
      Fixes: 05f81440 ("clk: meson: add fdiv clock gates")
      Signed-off-by: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      b251e4c8
  15. 15 3月, 2018 1 次提交
    • S
      clk: meson: Drop unused local variable and add static · 5d1c04dd
      Stephen Boyd 提交于
      Fixes the following warnings:
      
      drivers/clk/meson/meson8b.c:512:19: warning: symbol 'meson8b_mpeg_clk_div' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c:526:19: warning: symbol 'meson8b_clk81' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c:540:19: warning: symbol 'meson8b_cpu_in_sel' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c:591:19: warning: symbol 'meson8b_cpu_scale_div' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c:608:19: warning: symbol 'meson8b_cpu_scale_out_sel' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c:626:19: warning: symbol 'meson8b_cpu_clk' was not declared. Should it be static?
      drivers/clk/meson/gxbb.c:392:27: warning: symbol 'gxbb_gp0_init_regs' was not declared. Should it be static?
      drivers/clk/meson/gxbb.c:439:27: warning: symbol 'gxl_gp0_init_regs' was not declared. Should it be static?
      drivers/clk/meson/axg.c:195:27: warning: symbol 'axg_gp0_init_regs' was not declared. Should it be static?
      drivers/clk/meson/axg.c:248:27: warning: symbol 'axg_hifi_init_regs' was not declared. Should it be static?
      drivers/clk/meson/meson8b.c: In function 'meson8b_clkc_probe':
      drivers/clk/meson/meson8b.c:1052:14: warning: unused variable 'clk' [-Wunused-variable]
      Signed-off-by: NStephen Boyd <sboyd@kernel.org>
      5d1c04dd
  16. 13 3月, 2018 1 次提交
    • J
      clk: meson: clean-up clk81 clocks · 5b13ef64
      Jerome Brunet 提交于
      clk81 is a composite clock which parents all the peripheral clocks of the
      platform. It is a critical clock which is used as provided by the
      bootloader. We don't want to change its rate or reparent it, ever.
      
      Remove the CLK_IGNORE_UNUSED on the mux and divider. These clock can't
      gate so the flag is useless, and the gate is already critical, so the
      clock won't ever be unused.
      
      Remove CLK_SET_RATE_NO_REPARENT from mux, it is useless since the mux is
      read-only.
      
      Remove CLK_SET_RATE_PARENT from the gate and divider and use ro_ops for
      the divider. A peripheral clock should not try to change the rate of
      clk81. Stopping the rate propagation is good way to make sure such request
      would be ignored.
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Signed-off-by: NNeil Armstrong <narmstrong@baylibre.com>
      5b13ef64