1. 09 Jun, 2023 39 commits
    • Maxime Ripard's avatar
      clk: versatile: sp810: Add a determine_rate hook · d5a5a6e4
      Maxime Ripard authored
      The Versatile sp810 "timerclken" clock implements a mux with a
      set_parent hook, but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      This mismatch is probably due to the fact that the driver introduction
      predates the determine_rate introduction, and it was never revised since
      then.
      
      The default, implicit, behaviour that has been in use so far has thus
      been to simply keep using the current parent in all cases. This is also
      the behaviour of the new clk_hw_determine_rate_no_reparent() helper, so
      we can simply use it to make our expectation explicit.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-39-971d5077e7d2@cerno.techAcked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Acked-by: default avatarPawel Moll <pawel.moll@arm.com>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      d5a5a6e4
    • Maxime Ripard's avatar
      clk: ux500: sysctrl: Add a determine_rate hook · b7f0dee2
      Maxime Ripard authored
      The UX500 sysctrl "set_parent" clocks implement a mux with a set_parent
      hook, but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-38-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      b7f0dee2
    • Maxime Ripard's avatar
      clk: ux500: prcmu: Add a determine_rate hook · 97eb8f8a
      Maxime Ripard authored
      The UX500 PRCMU "clkout" clock implements a mux with a set_parent hook,
      but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The PRCMU binding also allows to specify the default clock parent
      through a device tree cell. This will be enforced at prepare time by the
      driver.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      The result is that the driver relies on prepare to set the default
      parent, and thus the set_parent hook is effectively unused by design.
      
      We can make that decision explicit by setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent() that will keep the
      same behaviour. Indeed, if no determine_rate implementation is provided,
      clk_round_rate() (through clk_core_round_rate_nolock()) will call itself
      on the parent if CLK_SET_RATE_PARENT is set, and will not change the
      clock rate otherwise.
      
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-37-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      97eb8f8a
    • Maxime Ripard's avatar
      clk: tegra: periph: Add a determine_rate hook · b11fcfa8
      Maxime Ripard authored
      The Tegra periph nodiv clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: linux-tegra@vger.kernel.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-36-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      b11fcfa8
    • Maxime Ripard's avatar
      clk: tegra: super: Add a determine_rate hook · 78b435c8
      Maxime Ripard authored
      The Tegra super mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: linux-tegra@vger.kernel.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-35-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      78b435c8
    • Maxime Ripard's avatar
      clk: tegra: bpmp: Add a determine_rate hook · 4552a852
      Maxime Ripard authored
      The Tegra BPMP mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: linux-tegra@vger.kernel.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-34-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      4552a852
    • Maxime Ripard's avatar
      clk: stm32: core: Add a determine_rate hook · d052f067
      Maxime Ripard authored
      The STM32 mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidate to
      trigger that parent change is a call to clk_set_rate(), with
      determine_rate() figuring out which parent is the best suited for a
      given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the flag
      CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
      to __clk_mux_determine_rate(). Indeed, if no determine_rate
      implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
      unlikely.
      
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-33-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      d052f067
    • Maxime Ripard's avatar
      clk: socfpga: gate: Add a determine_rate hook · 9607beb9
      Maxime Ripard authored
      The SoCFGPA gate clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Dinh Nguyen <dinguyen@kernel.org>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-32-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      9607beb9
    • Maxime Ripard's avatar
      clk: renesas: r9a06g032: Add a determine_rate hook · 03b56aa9
      Maxime Ripard authored
      The Renesas r9a06g032 bitselect clock implements a mux with a set_parent
      hook, but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: linux-renesas-soc@vger.kernel.org
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-31-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      03b56aa9
    • Maxime Ripard's avatar
      clk: pxa: Add a determine_rate hook · e9b6ea4e
      Maxime Ripard authored
      The PXA "CKEN" clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-30-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      e9b6ea4e
    • Maxime Ripard's avatar
      clk: mediatek: cpumux: Add a determine_rate hook · 90fe6ebf
      Maxime Ripard authored
      The Mediatek cpumux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mediatek@lists.infradead.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-29-971d5077e7d2@cerno.techReviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      90fe6ebf
    • Maxime Ripard's avatar
      clk: imx: scu: Add a determine_rate hook · 1c2c20db
      Maxime Ripard authored
      The iMX SCU mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Abel Vesa <abelvesa@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-28-971d5077e7d2@cerno.tech
      | Reported-by: kernel test robot <lkp@intel.com>:
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      1c2c20db
    • Maxime Ripard's avatar
      clk: imx: fixup-mux: Add a determine_rate hook · b2252ca6
      Maxime Ripard authored
      The iMX fixup mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Abel Vesa <abelvesa@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-27-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      b2252ca6
    • Maxime Ripard's avatar
      clk: imx: busy: Add a determine_rate hook · 79ef35a9
      Maxime Ripard authored
      The iMX busy clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Abel Vesa <abelvesa@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-26-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      79ef35a9
    • Maxime Ripard's avatar
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook · 4d8aa2a3
      Maxime Ripard authored
      The Davinci DA8xxx cfgchip "clk48" clock implements a mux with a
      set_parent hook, but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: David Lechner <david@lechnology.com>
      Cc: Sekhar Nori <nsekhar@ti.com>
      Acked-by: default avatarDavid Lechner <david@lechnology.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-25-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      4d8aa2a3
    • Maxime Ripard's avatar
      clk: davinci: da8xx-cfgchip: Add a determine_rate hook · de9271f2
      Maxime Ripard authored
      The Davinci DA8xxx cfgchip mux clock implements a mux with a set_parent
      hook, but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: David Lechner <david@lechnology.com>
      Cc: Sekhar Nori <nsekhar@ti.com>
      Acked-by: default avatarDavid Lechner <david@lechnology.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-24-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      de9271f2
    • Maxime Ripard's avatar
      clk: wm831x: clkout: Add a determine_rate hook · fa2a1931
      Maxime Ripard authored
      The WM381x "clkout" clock implements a mux with a set_parent hook,
      but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: patches@opensource.cirrus.com
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-23-971d5077e7d2@cerno.tech
      | Reported-by: kernel test robot <lkp@intel.com>:
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      fa2a1931
    • Maxime Ripard's avatar
      clk: vc5: clkout: Add a determine_rate hook · 538e864f
      Maxime Ripard authored
      The Versaclock5 "clkout" clock implements a mux with a set_parent hook,
      but doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-22-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      538e864f
    • Maxime Ripard's avatar
      clk: vc5: mux: Add a determine_rate hook · dcba8da5
      Maxime Ripard authored
      The Versaclock5 mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-21-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      dcba8da5
    • Maxime Ripard's avatar
      clk: stm32f4: mux: Add a determine_rate hook · 5ce89dcc
      Maxime Ripard authored
      The STM32F4 mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      However, the upstream device trees seem to use assigned-clock-parents on
      that clock to force the parent at boot time, so it's likely that the
      author intent was to force the parent through the device tree and
      prevent any reparenting but through an explicit call to
      clk_set_parent().
      
      This case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-20-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      5ce89dcc
    • Maxime Ripard's avatar
      clk: si5341: Add a determine_rate hook · 67110f5a
      Maxime Ripard authored
      The SI5341 clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-19-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      67110f5a
    • Maxime Ripard's avatar
      clk: qoriq: Add a determine_rate hook · 4cbe6428
      Maxime Ripard authored
      The Qoriq mux clocks implement a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-18-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      4cbe6428
    • Maxime Ripard's avatar
      clk: lochnagar: Add a determine_rate hook · 4e382f19
      Maxime Ripard authored
      The lochnagar clocks implement a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Since there's no upstream device tree using that driver, it's a bit hard
      to tell if it uses the assigned-clock properties. The binding and its
      example uses them though, so it's likely that the author intent was to
      force the parent through the device tree and prevent any reparenting but
      through an explicit call to clk_set_parent().
      
      This case is equivalent to setting the determine_rate implementation to
      clk_hw_determine_rate_no_reparent(). Indeed, if no determine_rate
      implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
      Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
      Cc: patches@opensource.cirrus.com
      Tested-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-17-971d5077e7d2@cerno.tech
      | Reported-by: kernel test robot <lkp@intel.com>:
      | Reported-by: kernel test robot <lkp@intel.com>:
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      4e382f19
    • Maxime Ripard's avatar
      clk: lmk04832: clkout: Add a determine_rate hook · 38bdfb21
      Maxime Ripard authored
      The LKM04832 "CLKOUT" clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidate to
      trigger that parent change is a call to clk_set_rate(), with
      determine_rate() figuring out which parent is the best suited for a
      given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the flag
      CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook
      to __clk_mux_determine_rate(). Indeed, if no determine_rate
      implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Since the CLK_SET_RATE_NO_REPARENT flag was already set though, it seems
      unlikely.
      Reviewed-by: default avatarLiam Beguin <liambeguin@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-16-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      38bdfb21
    • Maxime Ripard's avatar
      clk: k210: mux: Add a determine_rate hook · f6a01564
      Maxime Ripard authored
      The K210 mux clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-15-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      f6a01564
    • Maxime Ripard's avatar
      clk: k210: aclk: Add a determine_rate hook · d0f775d0
      Maxime Ripard authored
      The K210 ACLK clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-14-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      d0f775d0
    • Maxime Ripard's avatar
      clk: k210: pll: Add a determine_rate hook · 8e3f1560
      Maxime Ripard authored
      The K210 PLL clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-13-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      8e3f1560
    • Maxime Ripard's avatar
      clk: cdce706: Add a determine_rate hook · 43e8f067
      Maxime Ripard authored
      The cdce706 "clkin" clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-12-971d5077e7d2@cerno.tech
      | Reported-by: kernel test robot <lkp@intel.com>:
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      43e8f067
    • Maxime Ripard's avatar
      clk: berlin: div: Add a determine_rate hook · 321437f3
      Maxime Ripard authored
      The Berlin2 divider clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-11-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      321437f3
    • Maxime Ripard's avatar
      clk: at91: sckc: Add a determine_rate hook · d2e88be3
      Maxime Ripard authored
      The SAM9x5 slow clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-10-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      d2e88be3
    • Maxime Ripard's avatar
      clk: at91: main: Add a determine_rate hook · 63ec5653
      Maxime Ripard authored
      The SAM9x5 main clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties on that clock.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-9-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      63ec5653
    • Maxime Ripard's avatar
      clk: actions: composite: Add a determine_rate hook for pass clk · 3876e2d7
      Maxime Ripard authored
      The Actions "Pass" clock implements a mux with a set_parent hook, but
      doesn't provide a determine_rate implementation.
      
      This is a bit odd, since set_parent() is there to, as its name implies,
      change the parent of a clock. However, the most likely candidates to
      trigger that parent change are either the assigned-clock-parents device
      tree property or a call to clk_set_rate(), with determine_rate()
      figuring out which parent is the best suited for a given rate.
      
      The other trigger would be a call to clk_set_parent(), but it's far less
      used, and it doesn't look like there's any obvious user for that clock.
      
      Similarly, it doesn't look like the device tree using that clock driver
      uses any of the assigned-clock properties.
      
      So, the set_parent hook is effectively unused, possibly because of an
      oversight. However, it could also be an explicit decision by the
      original author to avoid any reparenting but through an explicit call to
      clk_set_parent().
      
      The latter case would be equivalent to setting the determine_rate
      implementation to clk_hw_determine_rate_no_reparent(). Indeed, if no
      determine_rate implementation is provided, clk_round_rate() (through
      clk_core_round_rate_nolock()) will call itself on the parent if
      CLK_SET_RATE_PARENT is set, and will not change the clock rate
      otherwise.
      
      And if it was an oversight, then we are at least explicit about our
      behavior now and it can be further refined down the line.
      
      Cc: "Andreas Färber" <afaerber@suse.de>
      Cc: Manivannan Sadhasivam <mani@kernel.org>
      Cc: linux-actions@lists.infradead.org
      Cc: linux-arm-kernel@lists.infradead.org
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-8-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      3876e2d7
    • Maxime Ripard's avatar
      clk: test: Add a determine_rate hook · aebddfe2
      Maxime Ripard authored
      The single parent clock in our kunit tests implements a mux with a
      set_parent hook, but doesn't provide a determine_rate implementation.
      
      This is not entirely unexpected, since its whole purpose it to have a
      single parent. When determine_rate is missing, and since
      CLK_SET_RATE_PARENT is set for all its instances, the default behaviour
      of the framework will be to forward it to the current parent.
      
      This is totally fine as far as the tests are concerned, but we'll start
      to mandate a determine_rate implementation when set_parent is set, so
      let's fill it with __clk_mux_determine_rate() which will have the same
      behavior.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-7-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      aebddfe2
    • Maxime Ripard's avatar
      clk: nodrv: Add a determine_rate hook · 9e3943af
      Maxime Ripard authored
      The nodrv clock implements a mux with a set_parent hook, but doesn't
      provide a determine_rate implementation.
      
      Even though it's a mock clock and the missing function is harmless,
      we'll start to require a determine_rate implementation when set_parent
      is set, so let's fill it.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-6-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      9e3943af
    • Maxime Ripard's avatar
      clk: lan966x: Remove unused round_rate hook · e2533dad
      Maxime Ripard authored
      The lan966x driver registers a gck clock with both a determine_rate and
      a round_rate implementation. Both are equivalent, and are only called by
      clk_core_determine_round_nolock() which favors determine_rate.
      
      Thus, lan966x_gck_round_rate() is never called, so we can just remove
      it.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-5-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      e2533dad
    • Stephen Boyd's avatar
      clk: Introduce clk_hw_determine_rate_no_reparent() · 33b70fbc
      Stephen Boyd authored
      Some clock drivers do not want to allow any reparenting on a given
      clock, but usually do so by not providing any determine_rate
      implementation.
      
      Whenever we call clk_round_rate() or clk_set_rate(), this leads to
      clk_core_can_round() returning false and thus the rest of the function
      either forwarding the rate request to its current parent if
      CLK_SET_RATE_PARENT is set, or just returning the current clock rate.
      
      This behaviour happens implicitly, and as we move forward to making a
      determine_rate implementation required for muxes, we need some way to
      explicitly opt-in for that behaviour.
      
      Fortunately, this is exactly what the clk_core_determine_rate_no_reparent()
      function is doing, so we can simply make it available to drivers.
      
      Cc: Abel Vesa <abelvesa@kernel.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: "Andreas Färber" <afaerber@suse.de>
      Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
      Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Chen-Yu Tsai <wenst@chromium.org>
      Cc: Chunyan Zhang <zhang.lyra@gmail.com>
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: David Airlie <airlied@gmail.com>
      Cc: David Lechner <david@lechnology.com>
      Cc: Dinh Nguyen <dinguyen@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Kishon Vijay Abraham I <kishon@kernel.org>
      Cc: Liam Girdwood <lgirdwood@gmail.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
      Cc: Manivannan Sadhasivam <mani@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Markus Schneider-Pargmann <msp@baylibre.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Mikko Perttunen <mperttunen@nvidia.com>
      Cc: Miles Chen <miles.chen@mediatek.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Orson Zhai <orsonzhai@gmail.com>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
      Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
      Cc: Samuel Holland <samuel@sholland.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Sekhar Nori <nsekhar@ti.com>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Takashi Iwai <tiwai@suse.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Vinod Koul <vkoul@kernel.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: linux-actions@lists.infradead.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-phy@lists.infradead.org
      Cc: linux-renesas-soc@vger.kernel.org
      Cc: linux-rtc@vger.kernel.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Cc: linux-sunxi@lists.linux.dev
      Cc: linux-tegra@vger.kernel.org
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: patches@opensource.cirrus.com
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-4-971d5077e7d2@cerno.tech
      | Reported-by: kernel test robot <lkp@intel.com>:
      33b70fbc
    • Stephen Boyd's avatar
      clk: Move no reparent case into a separate function · 1b4e99fd
      Stephen Boyd authored
      We'll need to turn the code in clk_mux_determine_rate_flags() to deal
      with CLK_SET_RATE_NO_REPARENT into a helper clock drivers will be able
      to use if they don't want to allow reparenting.
      
      Cc: Abel Vesa <abelvesa@kernel.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
      Cc: "Andreas Färber" <afaerber@suse.de>
      Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
      Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: Chen-Yu Tsai <wenst@chromium.org>
      Cc: Chunyan Zhang <zhang.lyra@gmail.com>
      Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: David Airlie <airlied@gmail.com>
      Cc: David Lechner <david@lechnology.com>
      Cc: Dinh Nguyen <dinguyen@kernel.org>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Kishon Vijay Abraham I <kishon@kernel.org>
      Cc: Liam Girdwood <lgirdwood@gmail.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Luca Ceresoli <luca.ceresoli@bootlin.com>
      Cc: Manivannan Sadhasivam <mani@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Markus Schneider-Pargmann <msp@baylibre.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Mikko Perttunen <mperttunen@nvidia.com>
      Cc: Miles Chen <miles.chen@mediatek.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Orson Zhai <orsonzhai@gmail.com>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: Peng Fan <peng.fan@nxp.com>
      Cc: Peter De Schrijver <pdeschrijver@nvidia.com>
      Cc: Prashant Gaikwad <pgaikwad@nvidia.com>
      Cc: Richard Fitzgerald <rf@opensource.cirrus.com>
      Cc: Samuel Holland <samuel@sholland.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Sekhar Nori <nsekhar@ti.com>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Takashi Iwai <tiwai@suse.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Vinod Koul <vkoul@kernel.org>
      Cc: dri-devel@lists.freedesktop.org
      Cc: linux-actions@lists.infradead.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@vger.kernel.org
      Cc: linux-phy@lists.infradead.org
      Cc: linux-renesas-soc@vger.kernel.org
      Cc: linux-rtc@vger.kernel.org
      Cc: linux-stm32@st-md-mailman.stormreply.com
      Cc: linux-sunxi@lists.linux.dev
      Cc: linux-tegra@vger.kernel.org
      Cc: NXP Linux Team <linux-imx@nxp.com>
      Cc: patches@opensource.cirrus.com
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-3-971d5077e7d2@cerno.tech
      1b4e99fd
    • Maxime Ripard's avatar
      clk: test: Fix type sign of rounded rate variables · 9633b4c1
      Maxime Ripard authored
      clk_round_rate() may return a negative error code, but most of the
      variables we defined to store its returned value are unsigned.
      
      This obviously leads to issues on error.
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-2-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      9633b4c1
    • Maxime Ripard's avatar
      clk: Export clk_hw_forward_rate_request() · ed046ac7
      Maxime Ripard authored
      Commit 262ca38f ("clk: Stop forwarding clk_rate_requests to the
      parent") introduced the public clk_hw_forward_rate_request() function,
      but didn't export the symbol. Make sure it's the case.
      
      Fixes: 262ca38f ("clk: Stop forwarding clk_rate_requests to the parent")
      Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20221018-clk-range-checks-fixes-v4-1-971d5077e7d2@cerno.techSigned-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      ed046ac7
  2. 07 May, 2023 1 commit