]> www.infradead.org Git - users/hch/misc.git/log
users/hch/misc.git
10 months agoMerge branches 'clk-amlogic', 'clk-microchip' and 'clk-imx' into clk-next
Stephen Boyd [Sat, 21 Sep 2024 21:10:59 +0000 (14:10 -0700)]
Merge branches 'clk-amlogic', 'clk-microchip' and 'clk-imx' into clk-next

* clk-amlogic:
  clk: meson: introduce symbol namespace for amlogic clocks
  clk: meson: axg-audio: add sm1 earcrx clocks
  clk: meson: axg-audio: setup regmap max_register based on the SoC
  dt-bindings: clock: axg-audio: add earcrx clock ids
  clk: meson: s4: pll: Constify struct regmap_config
  clk: meson: s4: peripherals: Constify struct regmap_config
  clk: meson: c3: pll: Constify struct regmap_config
  clk: meson: c3: peripherals: Constify struct regmap_config
  clk: meson: a1: pll: Constify struct regmap_config
  clk: meson: a1: peripherals: Constify struct regmap_config

* clk-microchip:
  clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
  clk: at91: sam9x7: add sam9x7 pmc driver
  dt-bindings: clock: at91: Allow PLLs to be exported and referenced in DT
  clk: at91: sama7g5: move mux table macros to header file
  clk: at91: sam9x7: add support for HW PLL freq dividers
  clk: at91: clk-sam9x60-pll: re-factor to support individual core freq outputs
  dt-bindings: clocks: atmel,at91rm9200-pmc: add sam9x7 clock controller
  dt-bindings: clocks: atmel,at91sam9x5-sckc: add sam9x7

* clk-imx: (27 commits)
  clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL
  clk: imx95: enable the clock of NETCMIX block control
  dt-bindings: clock: add RMII clock selection
  dt-bindings: clock: add i.MX95 NETCMIX block control
  clk: imx: imx8: Use clk_hw pointer for self registered clock in clk_parent_data
  clk: imx: composite-7ulp: Use NULL instead of 0
  clk: imx: add missing MODULE_DESCRIPTION() macros
  clk: imx: clk-imx8mp: Allow media_disp pixel clock reconfigure parent rate
  clk: imx: fracn-gppll: update rate table
  clk: imx: imx8qxp: Parent should be initialized earlier than the clock
  clk: imx: imx8qxp: Register dc0_bypass0_clk before disp clk
  clk: imx: imx8qxp: Add clock muxes for MIPI and PHY ref clocks
  clk: imx: imx8qxp: Add LVDS bypass clocks
  clk: imx: imx8mm: Change the 'nand_usdhc_bus' clock to non-critical one
  clk: imx: imx8mn: add sai7_ipg_clk clock settings
  clk: imx: add CLK_SET_RATE_PARENT for lcdif_pixel_src for i.MX7D
  clk: imx: Remove CLK_SET_PARENT_GATE for DRAM mux for i.MX7D
  clk: imx: imx8mp: fix clock tree update of TF-A managed clocks
  clk: imx: fracn-gppll: fix fractional part of PLL getting lost
  clk: imx: composite-7ulp: Check the PCC present bit
  ...

10 months agoMerge branches 'clk-assigned-rates', 'clk-renesas' and 'clk-scmi' into clk-next
Stephen Boyd [Sat, 21 Sep 2024 21:10:53 +0000 (14:10 -0700)]
Merge branches 'clk-assigned-rates', 'clk-renesas' and 'clk-scmi' into clk-next

* clk-assigned-rates:
  clk: clk-conf: support assigned-clock-rates-u64

* clk-renesas: (34 commits)
  clk: renesas: r9a09g057: Add clock and reset entries for GTM/RIIC/SDHI/WDT
  clk: renesas: rzv2h: Add support for dynamic switching divider clocks
  clk: renesas: r9a08g045: Add clocks, resets and power domains for USB
  dt-bindings: clock: renesas,cpg-clocks: Add top-level constraints
  clk: renesas: r8a779h0: Add CANFD clock
  clk: renesas: Add RZ/V2H(P) CPG driver
  clk: renesas: Add family-specific clock driver for RZ/V2H(P)
  dt-bindings: clock: renesas: Document RZ/V2H(P) SoC CPG
  clk: renesas: r8a779h0: Add PWM clock
  dt-bindings: clock: renesas,cpg-mssr: Document RZ/G2M v3.0 (r8a774a3) clock
  clk: renesas: rcar-gen4: Remove unused default PLL2/3/4/6 configs
  clk: renesas: rcar-gen4: Remove unused fixed PLL clock types
  clk: renesas: rcar-gen4: Remove unused variable PLL2 clock type
  clk: renesas: r8a779h0: Model PLL1/2/3/4/6 as fractional PLLs
  clk: renesas: r8a779g0: Model PLL1/3/4/6 as fractional PLLs
  clk: renesas: r8a779f0: Model PLL1/2/3/6 as fractional PLLs
  clk: renesas: r8a779a0: Use defines for PLL control registers
  clk: renesas: rcar-gen4: Add support for fractional 9.24 PLLs
  clk: renesas: rcar-gen4: Add support for fixed variable PLLs
  clk: renesas: rcar-gen4: Add support for variable fractional PLLs
  ...

* clk-scmi:
  clk: scmi: add is_prepared hook

10 months agoMerge branches 'clk-kunit', 'clk-mediatek', 'clk-cleanup' and 'clk-bindings' into...
Stephen Boyd [Sat, 21 Sep 2024 21:10:42 +0000 (14:10 -0700)]
Merge branches 'clk-kunit', 'clk-mediatek', 'clk-cleanup' and 'clk-bindings' into clk-next

 - KUnit tests for clk registration and fixed rate basic clk type

* clk-kunit:
  clk: Add KUnit tests for clks registered with struct clk_parent_data
  clk: Add KUnit tests for clk fixed rate basic type
  clk: Add test managed clk provider/consumer APIs
  platform: Add test managed platform_device/driver APIs
  of: Add a KUnit test for overlays and test managed APIs
  dt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends
  of: Add test managed wrappers for of_overlay_apply()/of_node_put()
  of/platform: Allow overlays to create platform devices from the root node

* clk-mediatek:
  dt-bindings: clock: mediatek: Convert MediaTek clock syscons to schema
  dt-bindings: Move Mediatek clock controllers to "clock" directory
  dt-bindings: clock: mediatek,apmixedsys: Fix "mediatek,mt6779-apmixed" compatible
  clk: mediatek: reset: Remove unused mtk_register_reset_controller()
  clk: mediatek: reset: Return regmap's error code

* clk-cleanup:
  clk: starfive: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
  clk: ti: dra7-atl: Fix leak of of_nodes
  clk:davinci: make use of dev_err_cast_probe()
  clk: bcm: bcm53573: fix OF node leak in init
  clk: lmk04832: Use devm_clk_get_enabled() helpers
  clk: visconti: Switch to use kmemdup_array()
  clk: mmp: Switch to use kmemdup_array()
  clk: hisilicon: Remove unnecessary local variable
  clk: use clk_core_unlink_consumer() helper
  clk: Use of_property_present()
  clk: at91: Use of_property_count_u32_elems() to get property length
  da8xx-cfgchip.c: replace of_node_put with __free improves cleanup

* clk-bindings:
  dt-bindings: clock: st,stm32mp1-rcc: add top-level constraints
  dt-bindings: clock: cirrus,lochnagar: add top-level constraints
  dt-bindings: clock: baikal,bt1-ccu-div: add top-level constraints
  dt-bindings: clock: nxp,lpc3220-usb-clk: Convert bindings to dtschema
  dt-bindings: clock: nxp,lpc3220-clk: Convert bindings to DT schema

10 months agoMerge branch 'clk-imx-old' into clk-imx
Stephen Boyd [Thu, 5 Sep 2024 18:30:59 +0000 (11:30 -0700)]
Merge branch 'clk-imx-old' into clk-imx

* clk-imx: (22 commits)
  clk: imx: composite-7ulp: Use NULL instead of 0
  clk: imx: add missing MODULE_DESCRIPTION() macros
  clk: imx: clk-imx8mp: Allow media_disp pixel clock reconfigure parent rate
  clk: imx: fracn-gppll: update rate table
  clk: imx: imx8qxp: Parent should be initialized earlier than the clock
  clk: imx: imx8qxp: Register dc0_bypass0_clk before disp clk
  clk: imx: imx8qxp: Add clock muxes for MIPI and PHY ref clocks
  clk: imx: imx8qxp: Add LVDS bypass clocks
  clk: imx: imx8mm: Change the 'nand_usdhc_bus' clock to non-critical one
  clk: imx: imx8mn: add sai7_ipg_clk clock settings
  clk: imx: add CLK_SET_RATE_PARENT for lcdif_pixel_src for i.MX7D
  clk: imx: Remove CLK_SET_PARENT_GATE for DRAM mux for i.MX7D
  clk: imx: imx8mp: fix clock tree update of TF-A managed clocks
  clk: imx: fracn-gppll: fix fractional part of PLL getting lost
  clk: imx: composite-7ulp: Check the PCC present bit
  clk: imx: composite-93: keep root clock on when mcore enabled
  clk: imx: composite-8m: Enable gate clk with mcore_booted
  clk: imx: imx6ul: fix default parent for enet*_ref_sel
  clk: imx: clk-audiomix: Correct parent clock for earc_phy and audpll
  clk: imx: clk-audiomix: Add CLK_SET_RATE_PARENT flags for clocks
  ...

10 months agoMerge tag 'clk-imx-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa...
Stephen Boyd [Thu, 5 Sep 2024 18:18:55 +0000 (11:18 -0700)]
Merge tag 'clk-imx-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx2

Pull i.MX clk driver updates from Abel Vesa:

 - Use clk_hw pointer instead of fw_name for acm_aud_clk[0-1]_sel clocks
   on i.MX8Q as parents in ACM provider
 - Add i.MX95 NETCMIX support to the block control provider
 - Fix parents for ENETx_REF_SEL clocks on i.MX6UL

* tag 'clk-imx-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux:
  clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL
  clk: imx95: enable the clock of NETCMIX block control
  dt-bindings: clock: add RMII clock selection
  dt-bindings: clock: add i.MX95 NETCMIX block control
  clk: imx: imx8: Use clk_hw pointer for self registered clock in clk_parent_data

10 months agoclk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL
Michel Alex [Mon, 2 Sep 2024 09:05:53 +0000 (09:05 +0000)]
clk: imx6ul: fix clock parent for IMX6UL_CLK_ENETx_REF_SEL

Commit 4e197ee880c24ecb63f7fe17449b3653bc64b03c ("clk: imx6ul: add
ethernet refclock mux support") sets the internal clock as default
ethernet clock.

Since IMX6UL_CLK_ENET_REF cannot be parent for IMX6UL_CLK_ENET1_REF_SEL,
the call to clk_set_parent() fails. IMX6UL_CLK_ENET1_REF_125M is the correct
parent and shall be used instead.
Same applies for IMX6UL_CLK_ENET2_REF_SEL, for which IMX6UL_CLK_ENET2_REF_125M
is the correct parent.

Cc: stable@vger.kernel.org
Signed-off-by: Alex Michel <alex.michel@wiedemann-group.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/AS1P250MB0608F9CE4009DCE65C61EEDEA9922@AS1P250MB0608.EURP250.PROD.OUTLOOK.COM
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
10 months agoMerge tag 'renesas-clk-for-v6.12-tag2' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Tue, 3 Sep 2024 21:00:29 +0000 (14:00 -0700)]
Merge tag 'renesas-clk-for-v6.12-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-renesas

Pull more Renesas clk driver updates from Geert Uytterhoeven:

 - Add USB clocks, resets and power domains on RZ/G3S
 - Add Generic Timer (GTM), I2C Bus Interface (RIIC), SD/MMC Host
   Interface (SDHI) and Watchdog Timer (WDT) clocks and resets on
   RZ/V2H
 - Miscellaneous fixes and improvements

* tag 'renesas-clk-for-v6.12-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers:
  clk: renesas: r9a09g057: Add clock and reset entries for GTM/RIIC/SDHI/WDT
  clk: renesas: rzv2h: Add support for dynamic switching divider clocks
  clk: renesas: r9a08g045: Add clocks, resets and power domains for USB
  dt-bindings: clock: renesas,cpg-clocks: Add top-level constraints

10 months agoMerge tag 'clk-microchip-6.12' of https://git.kernel.org/pub/scm/linux/kernel/git...
Stephen Boyd [Tue, 3 Sep 2024 20:03:10 +0000 (13:03 -0700)]
Merge tag 'clk-microchip-6.12' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into clk-microchip

Pull Microchip clk driver updates from Claudiu Beznea:

 - support for the Microchip SAM9X7 SoC as follows:
 - updates on the PLL drivers
 - a new clock driver was added for SAM9X7
 - dt-binding documentation updates (for the new clock driver and for
   the slow clock controller that SAM9X7 is using)
 - a fix for the Microchip SAMA7G5 clock driver to avoid allocating mode
   than necessary memory

* tag 'clk-microchip-6.12' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux:
  clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
  clk: at91: sam9x7: add sam9x7 pmc driver
  dt-bindings: clock: at91: Allow PLLs to be exported and referenced in DT
  clk: at91: sama7g5: move mux table macros to header file
  clk: at91: sam9x7: add support for HW PLL freq dividers
  clk: at91: clk-sam9x60-pll: re-factor to support individual core freq outputs
  dt-bindings: clocks: atmel,at91rm9200-pmc: add sam9x7 clock controller
  dt-bindings: clocks: atmel,at91sam9x5-sckc: add sam9x7

10 months agoclk: renesas: r9a09g057: Add clock and reset entries for GTM/RIIC/SDHI/WDT
Lad Prabhakar [Wed, 28 Aug 2024 09:38:22 +0000 (10:38 +0100)]
clk: renesas: r9a09g057: Add clock and reset entries for GTM/RIIC/SDHI/WDT

Add clock and reset entries for Generic Timer (GTM), I2C Bus Interface
(RIIC), SD/MMC Host Interface (SDHI) and Watchdog Timer (WDT) IP blocks.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240828093822.162855-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
10 months agoclk: renesas: rzv2h: Add support for dynamic switching divider clocks
Lad Prabhakar [Wed, 28 Aug 2024 09:38:21 +0000 (10:38 +0100)]
clk: renesas: rzv2h: Add support for dynamic switching divider clocks

Add support for dynamic switching divider clocks.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240828093822.162855-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
10 months agoclk: renesas: r9a08g045: Add clocks, resets and power domains for USB
Claudiu Beznea [Thu, 22 Aug 2024 15:27:46 +0000 (18:27 +0300)]
clk: renesas: r9a08g045: Add clocks, resets and power domains for USB

Add clocks, resets and power domains for USB modules available on the
Renesas RZ/G3S SoC.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240822152801.602318-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agoMerge tag 'clk-meson-v6.12-1' of https://github.com/BayLibre/clk-meson into clk-amlogic
Stephen Boyd [Fri, 30 Aug 2024 19:51:45 +0000 (12:51 -0700)]
Merge tag 'clk-meson-v6.12-1' of https://github.com/BayLibre/clk-meson into clk-amlogic

Pull Amlogic clk driver changes from Jerome Brunet:

 - Constify some Amlogic structs clean-up
 - Add SM1 eARC clocks for Amlogic
 - Introduce a symbol namespace for Amlogic clock specific symbols

* tag 'clk-meson-v6.12-1' of https://github.com/BayLibre/clk-meson:
  clk: meson: introduce symbol namespace for amlogic clocks
  clk: meson: axg-audio: add sm1 earcrx clocks
  clk: meson: axg-audio: setup regmap max_register based on the SoC
  dt-bindings: clock: axg-audio: add earcrx clock ids
  clk: meson: s4: pll: Constify struct regmap_config
  clk: meson: s4: peripherals: Constify struct regmap_config
  clk: meson: c3: pll: Constify struct regmap_config
  clk: meson: c3: peripherals: Constify struct regmap_config
  clk: meson: a1: pll: Constify struct regmap_config
  clk: meson: a1: peripherals: Constify struct regmap_config

11 months agoclk: imx95: enable the clock of NETCMIX block control
Wei Fang [Thu, 29 Aug 2024 01:18:48 +0000 (09:18 +0800)]
clk: imx95: enable the clock of NETCMIX block control

The NETCMIX block control consists of registers for configuration of
peripherals in the NETC domain, so enable the clock of NETCMIX to
support the configuration.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20240829011849.364987-4-wei.fang@nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
11 months agodt-bindings: clock: add RMII clock selection
Wei Fang [Thu, 29 Aug 2024 01:18:47 +0000 (09:18 +0800)]
dt-bindings: clock: add RMII clock selection

Add RMII clock selection for ENETC0 and ENETC1.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240829011849.364987-3-wei.fang@nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
11 months agodt-bindings: clock: add i.MX95 NETCMIX block control
Wei Fang [Thu, 29 Aug 2024 01:18:46 +0000 (09:18 +0800)]
dt-bindings: clock: add i.MX95 NETCMIX block control

Add 'nxp,imx95-netcmix-blk-ctrl' compatible string for i.MX95 platform.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240829011849.364987-2-wei.fang@nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
11 months agoclk: imx: imx8: Use clk_hw pointer for self registered clock in clk_parent_data
Shengjiu Wang [Wed, 10 Jul 2024 08:41:00 +0000 (16:41 +0800)]
clk: imx: imx8: Use clk_hw pointer for self registered clock in clk_parent_data

"acm_aud_clk0_sel" and "acm_aud_clk1_sel" are registered by this ACM
driver, but they are the parent clocks for other clocks, in order to
use assigned-clock-parents in device tree, the ".fw_name" can't be used,
need to assign the clk_hw pointer for the imx8qm_mclk_sels[],
imx8qxp_mclk_sels[], imx8dxl_mclk_sels[].

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/1720600860-18866-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
11 months agoclk: starfive: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
Yuntao Liu [Thu, 15 Aug 2024 09:38:53 +0000 (09:38 +0000)]
clk: starfive: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage

We need to call pm_runtime_put_noidle() when pm_runtime_get_sync()
fails, so use pm_runtime_resume_and_get() instead. this function
will handle this.

Fixes: dae5448a327ed ("clk: starfive: Add StarFive JH7110 Video-Output clock driver")
Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com>
Link: https://lore.kernel.org/r/20240815093853.757487-1-liuyuntao12@huawei.com
Reviewed-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: ti: dra7-atl: Fix leak of of_nodes
David Lechner [Mon, 26 Aug 2024 15:35:29 +0000 (10:35 -0500)]
clk: ti: dra7-atl: Fix leak of of_nodes

This fix leaking the of_node references in of_dra7_atl_clk_probe().

The docs for of_parse_phandle_with_args() say that the caller must call
of_node_put() on the returned node. This adds the missing of_node_put()
to fix the leak.

Fixes: 9ac33b0ce81f ("CLK: TI: Driver for DRA7 ATL (Audio Tracking Logic)")
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240826-clk-fix-leak-v1-1-f55418a13aa6@baylibre.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk:davinci: make use of dev_err_cast_probe()
Yuesong Li [Wed, 28 Aug 2024 07:35:15 +0000 (15:35 +0800)]
clk:davinci: make use of dev_err_cast_probe()

Using dev_err_cast_probe() to simplify the code.

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
Link: https://lore.kernel.org/r/20240828073515.950677-1-liyuesong@vivo.com
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: bcm: bcm53573: fix OF node leak in init
Krzysztof Kozlowski [Mon, 26 Aug 2024 06:58:01 +0000 (08:58 +0200)]
clk: bcm: bcm53573: fix OF node leak in init

Driver code is leaking OF node reference from of_get_parent() in
bcm53573_ilp_init().  Usage of of_get_parent() is not needed in the
first place, because the parent node will not be freed while we are
processing given node (triggered by CLK_OF_DECLARE()).  Thus fix the
leak by accessing parent directly, instead of of_get_parent().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240826065801.17081-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: st,stm32mp1-rcc: add top-level constraints
Krzysztof Kozlowski [Sun, 18 Aug 2024 17:30:14 +0000 (19:30 +0200)]
dt-bindings: clock: st,stm32mp1-rcc: add top-level constraints

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks and clock-names.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240818173014.122073-5-krzysztof.kozlowski@linaro.org
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: cirrus,lochnagar: add top-level constraints
Krzysztof Kozlowski [Sun, 18 Aug 2024 17:30:11 +0000 (19:30 +0200)]
dt-bindings: clock: cirrus,lochnagar: add top-level constraints

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks.  Drop also redundant assigned-clocks properties, because
core dtschema allows them if clocks are provided.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240818173014.122073-2-krzysztof.kozlowski@linaro.org
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: baikal,bt1-ccu-div: add top-level constraints
Krzysztof Kozlowski [Sun, 18 Aug 2024 17:30:10 +0000 (19:30 +0200)]
dt-bindings: clock: baikal,bt1-ccu-div: add top-level constraints

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks and clock-names.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240818173014.122073-1-krzysztof.kozlowski@linaro.org
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: lmk04832: Use devm_clk_get_enabled() helpers
Huan Yang [Tue, 20 Aug 2024 10:21:19 +0000 (18:21 +0800)]
clk: lmk04832: Use devm_clk_get_enabled() helpers

The devm_clk_get_enabled() helpers:
    - call devm_clk_get()
    - call clk_prepare_enable() and register what is needed in order to
     call clk_disable_unprepare() when needed, as a managed resource.

This simplifies the code and avoids the calls to clk_disable_unprepare().

Signed-off-by: Huan Yang <link@vivo.com>
Link: https://lore.kernel.org/r/20240820102119.130298-1-link@vivo.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: scmi: add is_prepared hook
Peng Fan [Tue, 6 Aug 2024 14:56:01 +0000 (22:56 +0800)]
clk: scmi: add is_prepared hook

Some clocks maybe default enabled by hardware. For clocks that don't
have users, that will be left in hardware default state, because prepare
count and enable count is zero,if there is no is_prepared hook to get
the hardware state. So add is_prepared hook to detect the hardware
state. Then when disabling the unused clocks, they can be simply
turned OFF to save power during kernel boot.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20240806145601.1184337-1-peng.fan@oss.nxp.com
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoMerge tag 'renesas-clk-for-v6.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel...
Stephen Boyd [Tue, 27 Aug 2024 17:20:46 +0000 (10:20 -0700)]
Merge tag 'renesas-clk-for-v6.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-renesas

Pull Renesas clk driver updates from Geert Uytterhoeven

 - Add PCIe, PWM, and CAN-FD clocks on R-Car V4M
 - Add LCD controller clocks and resets on RZ/G2UL
 - Add DMA clocks and resets on RZ/G3S
 - Add fractional multiplication PLL support on R-Car Gen4
 - Document support for the Renesas RZ/G2M v3.0 (r8a774a3) SoC
 - Add support for the RZ/V2H(P) (R9A09G057) SoC
 - Miscellaneous fixes and improvements

* tag 'renesas-clk-for-v6.12-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers: (30 commits)
  clk: renesas: r8a779h0: Add CANFD clock
  clk: renesas: Add RZ/V2H(P) CPG driver
  clk: renesas: Add family-specific clock driver for RZ/V2H(P)
  dt-bindings: clock: renesas: Document RZ/V2H(P) SoC CPG
  clk: renesas: r8a779h0: Add PWM clock
  dt-bindings: clock: renesas,cpg-mssr: Document RZ/G2M v3.0 (r8a774a3) clock
  clk: renesas: rcar-gen4: Remove unused default PLL2/3/4/6 configs
  clk: renesas: rcar-gen4: Remove unused fixed PLL clock types
  clk: renesas: rcar-gen4: Remove unused variable PLL2 clock type
  clk: renesas: r8a779h0: Model PLL1/2/3/4/6 as fractional PLLs
  clk: renesas: r8a779g0: Model PLL1/3/4/6 as fractional PLLs
  clk: renesas: r8a779f0: Model PLL1/2/3/6 as fractional PLLs
  clk: renesas: r8a779a0: Use defines for PLL control registers
  clk: renesas: rcar-gen4: Add support for fractional 9.24 PLLs
  clk: renesas: rcar-gen4: Add support for fixed variable PLLs
  clk: renesas: rcar-gen4: Add support for variable fractional PLLs
  clk: renesas: rcar-gen4: Add support for fractional multiplication
  clk: renesas: rcar-gen4: Use defines for common CPG registers
  clk: renesas: rcar-gen4: Use FIELD_GET()
  clk: renesas: rcar-gen4: Clarify custom PLL clock support
  ...

11 months agoclk: at91: sama7g5: Allocate only the needed amount of memory for PLLs
Claudiu Beznea [Sun, 14 Jul 2024 14:13:15 +0000 (17:13 +0300)]
clk: at91: sama7g5: Allocate only the needed amount of memory for PLLs

The maximum number of PLL components on SAMA7G5 is 3 (one fractional
part and 2 dividers). Allocate the needed amount of memory for
sama7g5_plls 2d array. Previous code used to allocate 7 array entries for
each PLL. While at it, replace 3 with PLL_COMPID_MAX in the loop which
parses the sama7g5_plls 2d array.

Fixes: cb783bbbcf54 ("clk: at91: sama7g5: add clock support for sama7g5")
Acked-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240714141315.19480-1-claudiu.beznea@tuxon.dev
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agodt-bindings: clock: renesas,cpg-clocks: Add top-level constraints
Krzysztof Kozlowski [Sun, 18 Aug 2024 17:30:12 +0000 (19:30 +0200)]
dt-bindings: clock: renesas,cpg-clocks: Add top-level constraints

Properties with variable number of items per each device are expected to
have widest constraints in top-level "properties:" block and further
customized (narrowed) in "if:then:".  Add missing top-level constraints
for clocks and clock-output-names.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240818173014.122073-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agoclk: renesas: r8a779h0: Add CANFD clock
Cong Dang [Thu, 1 Aug 2024 13:39:19 +0000 (15:39 +0200)]
clk: renesas: r8a779h0: Add CANFD clock

Add the CANFD module clock on the Renesas R-Car V4M (R8A779H0) SoC.

Signed-off-by: Cong Dang <cong.dang.xn@renesas.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/9bf71bfda338ee5411751174b03b9e870cc818e3.1722519424.git.geert+renesas@glider.be
11 months agoclk: renesas: Add RZ/V2H(P) CPG driver
Lad Prabhakar [Mon, 29 Jul 2024 20:26:45 +0000 (21:26 +0100)]
clk: renesas: Add RZ/V2H(P) CPG driver

Add RZ/V2H(P) CPG driver.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240729202645.263525-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agoclk: clk-conf: support assigned-clock-rates-u64
Peng Fan [Sun, 4 Aug 2024 12:32:56 +0000 (20:32 +0800)]
clk: clk-conf: support assigned-clock-rates-u64

i.MX95 System Management Control Firmware(SCMI) manages the clock
function, it exposes PLL VCO which could support up to 5GHz rate that
exceeds UINT32_MAX. So add assigned-clock-rates-u64 support
to set rate that exceeds UINT32_MAX.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20240804-clk-u64-v4-2-8e55569f39a4@nxp.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: visconti: Switch to use kmemdup_array()
Andy Shevchenko [Wed, 14 Aug 2024 12:54:08 +0000 (15:54 +0300)]
clk: visconti: Switch to use kmemdup_array()

Let the kmemdup_array() take care about multiplication and possible
overflows.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240814125513.2637955-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: mmp: Switch to use kmemdup_array()
Andy Shevchenko [Wed, 14 Aug 2024 12:54:07 +0000 (15:54 +0300)]
clk: mmp: Switch to use kmemdup_array()

Let the kmemdup_array() take care about multiplication and possible
overflows.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240814125513.2637955-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: mediatek: Convert MediaTek clock syscons to schema
Rob Herring (Arm) [Wed, 7 Aug 2024 16:58:55 +0000 (10:58 -0600)]
dt-bindings: clock: mediatek: Convert MediaTek clock syscons to schema

Convert the various MediaTek syscon bindings which are a clock provider
into DT schema format. As they are all the same other than compatible
string, combine them into a single schema file.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240807-dt-mediatek-clk-v1-3-e8d568abfd48@kernel.org
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: Move Mediatek clock controllers to "clock" directory
Rob Herring (Arm) [Wed, 7 Aug 2024 16:58:54 +0000 (10:58 -0600)]
dt-bindings: Move Mediatek clock controllers to "clock" directory

The "arm" binding directory is for architecture specific and top-level
board bindings. Move all the MediaTek bindings implementing clock
providers from "arm/mediatek/" to "clock/" binding directories.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240807-dt-mediatek-clk-v1-2-e8d568abfd48@kernel.org
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: mediatek,apmixedsys: Fix "mediatek,mt6779-apmixed" compatible
Rob Herring (Arm) [Wed, 7 Aug 2024 16:58:53 +0000 (10:58 -0600)]
dt-bindings: clock: mediatek,apmixedsys: Fix "mediatek,mt6779-apmixed" compatible

"mediatek,mt6779-apmixed" is the compatible string in use already, not
"mediatek,mt6779-apmixedsys".

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240807-dt-mediatek-clk-v1-1-e8d568abfd48@kernel.org
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: hisilicon: Remove unnecessary local variable
Thorsten Blum [Thu, 1 Aug 2024 10:36:16 +0000 (12:36 +0200)]
clk: hisilicon: Remove unnecessary local variable

The local u64 variable refdiv_val has the same value as the local u32
variable val and can be removed. Remove it and use val directly as the
divisor to also remove the following Coccinelle/coccicheck warning
reported by do_div.cocci:

  WARNING: do_div() does a 64-by-32 division, please consider using div64_u64 instead

Use the preferred div_u64() function instead of the do_div() macro.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Link: https://lore.kernel.org/r/20240801103616.20430-1-thorsten.blum@toblux.com
Acked-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: at91: sam9x7: add sam9x7 pmc driver
Varshini Rajendran [Mon, 29 Jul 2024 07:08:11 +0000 (12:38 +0530)]
clk: at91: sam9x7: add sam9x7 pmc driver

Add a driver for the PMC clocks of sam9x7 Soc family.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Link: https://lore.kernel.org/r/20240729070811.1990964-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agodt-bindings: clock: at91: Allow PLLs to be exported and referenced in DT
Varshini Rajendran [Mon, 29 Jul 2024 07:08:03 +0000 (12:38 +0530)]
dt-bindings: clock: at91: Allow PLLs to be exported and referenced in DT

Allow PLLADIV2 and LVDSPLL to be referenced as a PMC_TYPE_CORE
clock from phandle in DT for sam9x7 SoC family.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070803.1990916-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agoclk: at91: sama7g5: move mux table macros to header file
Varshini Rajendran [Mon, 29 Jul 2024 07:07:53 +0000 (12:37 +0530)]
clk: at91: sama7g5: move mux table macros to header file

Move the mux table init and fill macro function definitions from the
sama7g5 pmc driver to the pmc.h header file since they will be used
by other SoC's pmc drivers as well like sam9x7.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070753.1990866-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agoclk: at91: sam9x7: add support for HW PLL freq dividers
Varshini Rajendran [Mon, 29 Jul 2024 07:07:46 +0000 (12:37 +0530)]
clk: at91: sam9x7: add support for HW PLL freq dividers

Add support for hardware dividers for PLL IDs in sam9x7 SoC. The system
PLL - PLLA and the system PLL divided by 2 - PLLADIV2 with PLL ID 0 and
4 respectively, both have a hardware divider /2. This has to be taken into
account in the software to obtain the right frequencies. Support for the
same is added in the PLL driver.

fcorepllack -----> HW Div = 2 -+--> fpllack
                               |
                               +--> HW Div = 2 ---> fplladiv2ck

In this case the corepll freq is 1600 MHz. So, the plla freq is 800 MHz
after the hardware divider and the plladiv2 freq is 400 MHz after the
hardware divider (given that the DIVPMC is 0).

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070746.1990805-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agoclk: at91: clk-sam9x60-pll: re-factor to support individual core freq outputs
Varshini Rajendran [Mon, 29 Jul 2024 07:07:37 +0000 (12:37 +0530)]
clk: at91: clk-sam9x60-pll: re-factor to support individual core freq outputs

SAM9X7 SoC family supports different core output frequencies for
different PLL IDs. To handle the same in the PLL driver, a separate
parameter core_output is added. The sam9x60 and sama7g5 SoC PMC drivers
are aligned to the PLL driver by adding the core output freq range in
the PLL characteristics configurations.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070737.1990756-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agodt-bindings: clocks: atmel,at91rm9200-pmc: add sam9x7 clock controller
Varshini Rajendran [Mon, 29 Jul 2024 07:07:26 +0000 (12:37 +0530)]
dt-bindings: clocks: atmel,at91rm9200-pmc: add sam9x7 clock controller

Add bindings for SAM9X7's pmc.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070726.1990705-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agodt-bindings: clocks: atmel,at91sam9x5-sckc: add sam9x7
Varshini Rajendran [Mon, 29 Jul 2024 07:07:17 +0000 (12:37 +0530)]
dt-bindings: clocks: atmel,at91sam9x5-sckc: add sam9x7

Add bindings for SAM9X7's slow clock controller.

Signed-off-by: Varshini Rajendran <varshini.rajendran@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20240729070717.1990654-1-varshini.rajendran@microchip.com
Signed-off-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
11 months agoclk: use clk_core_unlink_consumer() helper
Nuno Sá [Wed, 10 Jul 2024 08:40:36 +0000 (10:40 +0200)]
clk: use clk_core_unlink_consumer() helper

There is an helper to remove a consumer from the clk provider list.
Hence, let's use it when releasing a consumer.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240710-dev-clk-misc-v1-2-cd9d960099a2@analog.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: Use of_property_present()
Rob Herring (Arm) [Wed, 31 Jul 2024 19:12:42 +0000 (13:12 -0600)]
clk: Use of_property_present()

Use of_property_present() to test for property presence rather than
of_(find|get)_property(). This is part of a larger effort to remove
callers of of_find_property() and similar functions.
of_(find|get)_property() leak the DT struct property and data pointers
which is a problem for dynamically allocated nodes which may be freed.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240731191312.1710417-4-robh@kernel.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> # clk-mstp.c
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: at91: Use of_property_count_u32_elems() to get property length
Rob Herring (Arm) [Wed, 31 Jul 2024 20:14:02 +0000 (14:14 -0600)]
clk: at91: Use of_property_count_u32_elems() to get property length

Replace of_get_property() with the type specific
of_property_count_u32_elems() to get the property length.

This is part of a larger effort to remove callers of of_get_property()
and similar functions. of_get_property() leaks the DT property data
pointer which is a problem for dynamically allocated nodes which may
be freed.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240731201407.1838385-7-robh@kernel.org
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agoclk: renesas: Add family-specific clock driver for RZ/V2H(P)
Lad Prabhakar [Mon, 29 Jul 2024 20:26:44 +0000 (21:26 +0100)]
clk: renesas: Add family-specific clock driver for RZ/V2H(P)

Add family-specific clock driver for RZ/V2H(P) SoCs.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240729202645.263525-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agodt-bindings: clock: renesas: Document RZ/V2H(P) SoC CPG
Lad Prabhakar [Mon, 29 Jul 2024 20:26:43 +0000 (21:26 +0100)]
dt-bindings: clock: renesas: Document RZ/V2H(P) SoC CPG

Document the device tree bindings for the Renesas RZ/V2H(P) SoC
Clock Pulse Generator (CPG).

CPG block handles the below operations:
- Generation and control of clock signals for the IP modules
- Generation and control of resets
- Control over booting
- Low power consumption and power supply domains

Also define constants for the core clocks of the RZ/V2H(P) SoC. Note the
core clocks are a subset of the ones which are listed as part of section
4.4.2 of HW manual Rev.1.01 which cannot be controlled by CLKON register.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240729202645.263525-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agoclk: renesas: r8a779h0: Add PWM clock
Cong Dang [Thu, 25 Jul 2024 19:49:08 +0000 (21:49 +0200)]
clk: renesas: r8a779h0: Add PWM clock

Add the module clock used by the PWM timers on the Renesas R-Car V4M
(R8A779H0) SoC.

Signed-off-by: Cong Dang <cong.dang.xn@renesas.com>
[wsa: rebased]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240725194906.14644-9-wsa+renesas@sang-engineering.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agodt-bindings: clock: renesas,cpg-mssr: Document RZ/G2M v3.0 (r8a774a3) clock
Oliver Rhodes [Thu, 25 Jul 2024 10:05:31 +0000 (11:05 +0100)]
dt-bindings: clock: renesas,cpg-mssr: Document RZ/G2M v3.0 (r8a774a3) clock

Add binding documentation for Renesas RZ/G2M v3.0 (a.k.a r8a774a3) Clock
Pulse Generator driver. The r8a774a3 cpg is similar to the r8a774a1 cpg
however, it lacks some modules such as the FCPCI.

Signed-off-by: Oliver Rhodes <oliver.rhodes.aj@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/20240725100534.5374-4-oliver.rhodes.aj@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
11 months agodt-bindings: clock: nxp,lpc3220-usb-clk: Convert bindings to dtschema
Animesh Agarwal [Tue, 30 Jul 2024 14:13:34 +0000 (19:43 +0530)]
dt-bindings: clock: nxp,lpc3220-usb-clk: Convert bindings to dtschema

Convert the NXP LPC32xx USB Clock Controller bindings to yaml format.

Cc: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Link: https://lore.kernel.org/r/20240730141338.46234-1-animeshagarwal28@gmail.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
11 months agodt-bindings: clock: nxp,lpc3220-clk: Convert bindings to DT schema
Animesh Agarwal [Wed, 31 Jul 2024 06:51:33 +0000 (12:21 +0530)]
dt-bindings: clock: nxp,lpc3220-clk: Convert bindings to DT schema

Convert the NXP LPC32xx Clock Controller bindings to yaml format.

Cc: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Link: https://lore.kernel.org/r/20240731065137.156935-1-animeshagarwal28@gmail.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
12 months agoclk: renesas: rcar-gen4: Remove unused default PLL2/3/4/6 configs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:35 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Remove unused default PLL2/3/4/6 configs

The default PLL2/3/4/6 multiplier and divider configurations are no
longer used after the conversion to fixed or variable fractional PLL
clock types.

Note that the default configurations are still documented in the
comments above the individual rcar_gen4_cpg_pll_config instances.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/d13526a86066992d6afdf9bee7c1a18da72f914f.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Remove unused fixed PLL clock types
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:34 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Remove unused fixed PLL clock types

All users of the fixed default PLL2/3/4/6 clock types have been
converted to fixed or variable fractional PLL clock types.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/c0229eb3518444f61173c6fb83bdcedb058dd079.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Remove unused variable PLL2 clock type
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:33 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Remove unused variable PLL2 clock type

The variable PLL2 clock type was superseded by the more generic
variable fractional 8.25 PLL clock type, and its sole user was converted.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/8e5564958002351f29435f63de1304fb3b51a725.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779h0: Model PLL1/2/3/4/6 as fractional PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:32 +0000 (13:50 +0200)]
clk: renesas: r8a779h0: Model PLL1/2/3/4/6 as fractional PLLs

Currently, all PLLs are modelled as fixed divider clocks, based on the
state of the mode pins.  However, the boot loader stack may have changed
the actual PLL configuration from the default, leading to incorrect
clock frequencies.

Describe PLL1 as a fixed fractional PLL instead, and PLL2, PLL3, PLL4,
and PLL6 as variable fractional PLLs.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/3beac7c44534ed153ce7cea5c31f4b0bb7b16ab0.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779g0: Model PLL1/3/4/6 as fractional PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:31 +0000 (13:50 +0200)]
clk: renesas: r8a779g0: Model PLL1/3/4/6 as fractional PLLs

Currently, all PLLs but PLL2 are modelled as fixed divider clocks, based
on the state of the mode pins.  However, the boot loader stack may have
changed the actual PLL configuration from the default, leading to
incorrect clock frequencies.

Describe PLL1 as a fixed fractional PLL instead, and PLL2, PLL3, PLL4,
and PLL6 as variable fractional PLLs.

Reformat nearby lines to retain a consistent layout.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/b98523ed08de7386944c5ae860eae107dc28be3e.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779f0: Model PLL1/2/3/6 as fractional PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:30 +0000 (13:50 +0200)]
clk: renesas: r8a779f0: Model PLL1/2/3/6 as fractional PLLs

Currently, all PLLs are modelled as fixed divider clocks, based on the
state of the mode pins.  However, the boot loader stack may have changed
the actual PLL configuration from the default, leading to incorrect
clock frequencies.

Describe PLL1 as a fixed fractional PLL instead, and PLL2, PLL3, and
PLL6 as variable fractional PLLs.  Note that the R-Car Gen4 clock driver
does not support variable 9.24 PLLs yet, so the driver will downgrade
them to fixed fractional PLLs, too.

Reformat nearby lines to retain a consistent layout.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/8544571f507e00ed6fc61617d27c9e19de5e9d11.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779a0: Use defines for PLL control registers
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:29 +0000 (13:50 +0200)]
clk: renesas: r8a779a0: Use defines for PLL control registers

Add symbolic definitions for the various PLL control registers.
Replace hardcoded register offsets by the new definitions.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/8cac464c7dfb15ecd299b8ab4ba88a16135f8123.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Add support for fractional 9.24 PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:28 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Add support for fractional 9.24 PLLs

The custom clock driver that models the PLL clocks on R-Car Gen4
supports only fractional 8.25 PLLs, as used on R-Car V4H/V4M.
R-Car S4-8 uses integer and fractional multiplication fields that are
one bit larger resp. smaller, and a slightly different formula.

Extend the existing support to fractional 9.24 PLL, and introduce new
clock types and helper macros to describe these PLLs.

Note that there is no use case for variable fractional 9.24 PLLs yet, as
the Cortex-A55 cores on R-Car S4-8 do not support High Performance mode.
Hence the PLL is always modeled as a fixed PLL, regardless of the
description,

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/5684eda1260435c8eceabc274e0b18cb280a6341.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Add support for fixed variable PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:27 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Add support for fixed variable PLLs

The custom clock driver that models PLL clocks on R-Car Gen4 supports
variable clocks, while PLL1 uses a similar control register layout, but
is read-only.

Extend the existing support to fixed clocks and PLL1, and introduce a
new clock type and helper macro to describe a fixed PLL.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/841fbb63d472c357b3ce291a5991db3b847f96d8.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Add support for variable fractional PLLs
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:26 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Add support for variable fractional PLLs

The custom clock driver that models PLL clocks on R-Car Gen4 supports
PLL2 on R-Car V4H/V4M only, while PLL3, PLL4, and PLL6 use the same
control register layout.

Extend the existing support to PLL3, PLL4, and PLL6, and introduce a new
clock type and helper macro to describe these PLLs.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/84ead759782560ec5643711e6bdd787a751053ce.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Add support for fractional multiplication
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:25 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Add support for fractional multiplication

R-Car Gen4 PLLs support fractional multiplication, which can improve
accuracy when configuring a specific frequency.

Add support for fractional multiplication to the custom clock driver
for PLLs, which is currently used only for PLL2 on R-Car V4H.
While at it, add the missing blank line after the function.

Note that Fractional Multiplication is not enabled by the driver,
but used only if the boot loaded enabled it before.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/1a58ebef6f54460f49fb81ba9bbf288164de2646.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Use defines for common CPG registers
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:24 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Use defines for common CPG registers

Add symbolic definitions for common CPG registers.
Replace hardcoded register offsets by the new definitions.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/8ae48a5dac59cb5723fbca3842b93a9e51ffe1ca.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Use FIELD_GET()
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:23 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Use FIELD_GET()

Improve readability by using the FIELD_GET() helper instead of
open-coding the same operation, and by adding field definitions to get
rid of hardcoded values.

While at it, move register definitions that are only used inside the
rcar-gen4-cpg.c source file out of the rcar-gen4-cpg.h header file.
Add a "CPG_" prefix to SD0CKCR1.  Add comments where appropriate.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/fb19ad829738f02effa340fa04c178a162d41202.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Clarify custom PLL clock support
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:22 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Clarify custom PLL clock support

The custom clock driver that models the PLL clocks on R-Car Gen4 assumes
the integer and fractional[*] multiplication field sizes as used on
R-Car V4H and V4M, representing a fractional 8.25 number.

Rename the related definitions, functions, and structures to clarify
this, and to prepare for the advent of support for the different field
sizes on R-Car S4-8.

[*] The fractional part is not yet supported.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/2ce9f9c75bfb6312129d416672f9691bbd11c0e7.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rcar-gen4: Removed unused SSMODE_* definitions
Geert Uytterhoeven [Mon, 22 Jul 2024 11:50:21 +0000 (13:50 +0200)]
clk: renesas: rcar-gen4: Removed unused SSMODE_* definitions

All SSMODE operations are done using CPG_PLLxCR0_SSMODE*.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/19f84bfec94eab5f301a9c33563c285ab59b9b2a.1721648548.git.geert+renesas@glider.be
12 months agoclk: renesas: rzg2l-cpg: Refactor to use priv for clks and base in clock register...
Lad Prabhakar [Mon, 15 Jul 2024 10:35:55 +0000 (11:35 +0100)]
clk: renesas: rzg2l-cpg: Refactor to use priv for clks and base in clock register functions

Simplify the `rzg2l-cpg` driver by removing explicit passing of `clks` and
`base` parameters in various clock registration functions. These values
are now accessed directly from the `priv` structure.

While at it, drop masking of parent clocks with 0xffff as nothing is ever
stored in the high bits.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240715103555.507767-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
12 months agoclk: renesas: rzg2l-cpg: Use devres API to register clocks
Lad Prabhakar [Mon, 15 Jul 2024 10:35:54 +0000 (11:35 +0100)]
clk: renesas: rzg2l-cpg: Use devres API to register clocks

We are using devres APIs for divider, mux and pll5 clocks so for
consistency use the devres APIs for module, fixed factor and PLL clocks.

While at it switched to clk_hw_register() instead of clk_register()
as this has been marked as deprecated interface.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240715103555.507767-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
12 months agoclk: renesas: r8a779h0: Initial clock descriptions should be __initconst
Geert Uytterhoeven [Fri, 12 Jul 2024 14:26:46 +0000 (16:26 +0200)]
clk: renesas: r8a779h0: Initial clock descriptions should be __initconst

r8a779h0_core_clks[], r8a779h0_mod_clks[], and cpg_pll_configs[] are
only used during initialization.  Hence make them __initconst, so they
will be freed later.

Fixes: f077cab34df3010d ("clk: renesas: cpg-mssr: Add support for R-Car V4M")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/35bbcfb914ddb377fa77e3425e4e7e232c7c2cf9.1720794214.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779g0: cpg_pll_configs should be __initconst
Geert Uytterhoeven [Fri, 12 Jul 2024 14:26:45 +0000 (16:26 +0200)]
clk: renesas: r8a779g0: cpg_pll_configs should be __initconst

cpg_pll_configs[] is only used during initialization.  Hence make it
__initconst, so it will be freed later.

Fixes: 0ab55cf1834177a2 ("clk: renesas: cpg-mssr: Add support for R-Car V4H")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/ea806a096d47382f4f560b20f1038f03b4e44e0e.1720794214.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779f0: cpg_pll_configs should be __initconst
Geert Uytterhoeven [Fri, 12 Jul 2024 14:26:44 +0000 (16:26 +0200)]
clk: renesas: r8a779f0: cpg_pll_configs should be __initconst

cpg_pll_configs[] is only used during initialization.  Hence make it
__initconst, so it will be freed later.

Fixes: 24aaff6a6ce4c4de ("clk: renesas: cpg-mssr: Add support for R-Car S4-8")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/2261fc8291099445e1b319812dfd4f79c90296d2.1720794214.git.geert+renesas@glider.be
12 months agoclk: renesas: r8a779a0: cpg_pll_configs should be __initconst
Geert Uytterhoeven [Fri, 12 Jul 2024 14:26:43 +0000 (16:26 +0200)]
clk: renesas: r8a779a0: cpg_pll_configs should be __initconst

cpg_pll_configs[] is only used during initialization.  Hence make it
__initconst, so it will be freed later.

Fixes: 17bcc8035d2d19fc ("clk: renesas: cpg-mssr: Add support for R-Car V3U")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Link: https://lore.kernel.org/a9819625329b188c298481402e1c55ac46093518.1720794214.git.geert+renesas@glider.be
12 months agoclk: renesas: r9a08g045: Add DMA clocks and resets
Claudiu Beznea [Thu, 11 Jul 2024 12:34:03 +0000 (15:34 +0300)]
clk: renesas: r9a08g045: Add DMA clocks and resets

Add the missing DMA clock and resets.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240711123405.2966302-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
12 months agoclk: renesas: r9a07g043: Add LCDC clock and reset entries
Biju Das [Tue, 9 Jul 2024 13:51:42 +0000 (14:51 +0100)]
clk: renesas: r9a07g043: Add LCDC clock and reset entries

Add LCDC clock and reset entries to CPG driver.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240709135152.185042-5-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
12 months agoclk: renesas: r8a779h0: Add PCIe clock
Yoshihiro Shimoda [Thu, 4 Jul 2024 06:17:20 +0000 (15:17 +0900)]
clk: renesas: r8a779h0: Add PCIe clock

Add the PCIe module clock, which is used by the PCIe module on the
Renesas R-Car V4M (R8A779H0) SoC.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240704061720.1444755-1-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
12 months agoda8xx-cfgchip.c: replace of_node_put with __free improves cleanup
David Hunter [Sat, 20 Jul 2024 15:24:47 +0000 (11:24 -0400)]
da8xx-cfgchip.c: replace of_node_put with __free improves cleanup

The use of the __free function allows the cleanup to be based on scope
instead of on another function called later. This makes the cleanup
automatic and less susceptible to errors later.

This code was compiled without errors or warnings.

Signed-off-by: David Hunter <david.hunter.linux@gmail.com>
Link: https://lore.kernel.org/r/20240720152447.311442-1-david.hunter.linux@gmail.com
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
12 months agoclk: mediatek: reset: Remove unused mtk_register_reset_controller()
AngeloGioacchino Del Regno [Thu, 18 Jul 2024 08:25:28 +0000 (10:25 +0200)]
clk: mediatek: reset: Remove unused mtk_register_reset_controller()

Now that all clock controllers have been migrated to the new
mtk_register_reset_controller_with_dev() function, the one taking
struct device node is now unused: remove it.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240718082528.220750-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
12 months agoclk: mediatek: reset: Return regmap's error code
Fei Shao [Wed, 17 Jul 2024 11:58:52 +0000 (19:58 +0800)]
clk: mediatek: reset: Return regmap's error code

device_node_to_regmap() can return different errors, and it's better
practice to pass them to callers.

Clean up the hardcoded -EINVAL and use PTR_ERR(regmap) instead.

Signed-off-by: Fei Shao <fshao@chromium.org>
Link: https://lore.kernel.org/r/20240717115919.975474-1-fshao@chromium.org
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
12 months agoclk: Add KUnit tests for clks registered with struct clk_parent_data
Stephen Boyd [Thu, 18 Jul 2024 21:05:07 +0000 (14:05 -0700)]
clk: Add KUnit tests for clks registered with struct clk_parent_data

Test that clks registered with 'struct clk_parent_data' work as
intended and can find their parents.

Cc: Christian Marangi <ansuelsmth@gmail.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-9-sboyd@kernel.org
12 months agoclk: Add KUnit tests for clk fixed rate basic type
Stephen Boyd [Thu, 18 Jul 2024 21:05:06 +0000 (14:05 -0700)]
clk: Add KUnit tests for clk fixed rate basic type

Test that the fixed rate basic type clk works as intended.

Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-8-sboyd@kernel.org
12 months agoclk: Add test managed clk provider/consumer APIs
Stephen Boyd [Thu, 18 Jul 2024 21:05:05 +0000 (14:05 -0700)]
clk: Add test managed clk provider/consumer APIs

Unit tests are more ergonomic and simpler to understand if they don't
have to hoist a bunch of code into the test harness init and exit
functions. Add some test managed wrappers for the clk APIs so that clk
unit tests can write more code in the actual test and less code in the
harness.

Only add APIs that are used for now. More wrappers can be added in the
future as necessary.

Cc: Brendan Higgins <brendan.higgins@linux.dev>
Cc: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-7-sboyd@kernel.org
12 months agoplatform: Add test managed platform_device/driver APIs
Stephen Boyd [Thu, 18 Jul 2024 21:05:04 +0000 (14:05 -0700)]
platform: Add test managed platform_device/driver APIs

Introduce KUnit resource wrappers around platform_driver_register(),
platform_device_alloc(), and platform_device_add() so that test authors
can register platform drivers/devices from their tests and have the
drivers/devices automatically be unregistered when the test is done.

This makes test setup code simpler when a platform driver or platform
device is needed. Add a few test cases at the same time to make sure the
APIs work as intended.

Cc: Brendan Higgins <brendan.higgins@linux.dev>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-6-sboyd@kernel.org
12 months agoof: Add a KUnit test for overlays and test managed APIs
Stephen Boyd [Thu, 18 Jul 2024 21:05:03 +0000 (14:05 -0700)]
of: Add a KUnit test for overlays and test managed APIs

Test the KUnit test managed overlay APIs. Confirm that platform devices
are created and destroyed properly. This provides us confidence that the
test managed APIs work correctly and can be relied upon to provide tests
with fake platform devices and device nodes via overlays compiled into
the kernel image.

Cc: Rob Herring <robh@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>
Cc: Daniel Latypov <dlatypov@google.com>
Cc: Brendan Higgins <brendan.higgins@linux.dev>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Rae Moar <rmoar@google.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-5-sboyd@kernel.org
12 months agodt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends
Stephen Boyd [Thu, 18 Jul 2024 21:05:02 +0000 (14:05 -0700)]
dt-bindings: vendor-prefixes: Add "test" vendor for KUnit and friends

Add the vendor prefix "test" to reserve a vendor prefix for bindings
that are purely for testing device tree code. This allows test code to
write bindings that can be checked by the schema validator.

Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: David Gow <davidgow@google.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-4-sboyd@kernel.org
12 months agoof: Add test managed wrappers for of_overlay_apply()/of_node_put()
Stephen Boyd [Thu, 18 Jul 2024 21:05:01 +0000 (14:05 -0700)]
of: Add test managed wrappers for of_overlay_apply()/of_node_put()

Add test managed wrappers for of_overlay_apply() that automatically
removes the overlay when the test is finished. This API is intended for
use by KUnit tests that test code which relies on 'struct device_node's
and of_*() APIs.

KUnit tests will call of_overlay_apply_kunit() to load an overlay that's
been built into the kernel image. When the test is complete, the overlay
will be removed.

This has a few benefits:

 1) It keeps the tests hermetic because the overlay is removed when the
    test is complete. Tests won't even be aware that an overlay was
    loaded in another test.

 2) The overlay code can live right next to the unit test that loads it.
    The overlay and the unit test can be compiled into one kernel module
    if desired.

 3) We can test different device tree configurations by loading
    different overlays. The overlays can be written for a specific test,
    and there can be many of them loaded per-test without needing to jam
    all possible combinations into one DTB.

 4) It also allows KUnit to test device tree dependent code on any
    architecture, not just UML. This allows KUnit tests to test
    architecture specific device tree code.

There are some potential pitfalls though. Test authors need to be
careful to not overwrite properties in the live tree. The easiest way to
do this is to add and remove nodes with a 'kunit-' prefix, almost
guaranteeing that the same node won't be present in the tree loaded at
boot.

Suggested-by: Rob Herring <robh@kernel.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-3-sboyd@kernel.org
12 months agoof/platform: Allow overlays to create platform devices from the root node
Stephen Boyd [Thu, 18 Jul 2024 21:05:00 +0000 (14:05 -0700)]
of/platform: Allow overlays to create platform devices from the root node

We'd like to apply overlays to the root node in KUnit so we can test
platform devices created as children of the root node.

On some architectures (powerpc), the root node isn't marked with
OF_POPULATED_BUS. If an overlay tries to modify the root node on these
platforms it will fail, while on other platforms, such as ARM, it will
succeed. This is because the root node is marked with OF_POPULATED_BUS
by of_platform_default_populate_init() calling
of_platform_default_populate() with NULL as the first argument.

Loosen the requirement here so that platform devices can be created for
nodes created as children of the root node via DT overlays even if the
platform bus wasn't populated for the root node.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[sboyd@kernel.org: Folded in condition fix]
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20240718210513.3801024-2-sboyd@kernel.org
12 months agoclk: meson: introduce symbol namespace for amlogic clocks
Jerome Brunet [Fri, 19 Jul 2024 09:42:26 +0000 (11:42 +0200)]
clk: meson: introduce symbol namespace for amlogic clocks

Symbols exported by the Amlogic clock modules are only meant to be used by
Amlogic clock controller drivers. Using a dedicated symbols namespace make
that clear and help clean the global namespace of symbols other modules do
no need.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240719094228.3985595-1-jbrunet@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
12 months agoclk: meson: axg-audio: add sm1 earcrx clocks
Jerome Brunet [Fri, 19 Jul 2024 09:39:32 +0000 (11:39 +0200)]
clk: meson: axg-audio: add sm1 earcrx clocks

Add CMDC, DMAC and peripheral clocks for the eARC RX device found on the
sm1 SoC family

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240719093934.3985139-4-jbrunet@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
12 months agoclk: meson: axg-audio: setup regmap max_register based on the SoC
Jerome Brunet [Fri, 19 Jul 2024 09:39:31 +0000 (11:39 +0200)]
clk: meson: axg-audio: setup regmap max_register based on the SoC

The register region of axg-audio tends to grow with the addition of
new supported SoC. Mapping slightly more has not been causing problem
so far but it is not viable to continue like this long term.

Setup the max register based on what is necessary on the related SoC.

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20240719093934.3985139-3-jbrunet@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
12 months agoMerge branch 'v6.12/bindings' into clk-meson-next
Jerome Brunet [Mon, 29 Jul 2024 14:46:26 +0000 (16:46 +0200)]
Merge branch 'v6.12/bindings' into clk-meson-next

* v6.12/bindings:
  dt-bindings: clock: axg-audio: add earcrx clock ids

12 months agodt-bindings: clock: axg-audio: add earcrx clock ids
Jerome Brunet [Fri, 19 Jul 2024 09:39:30 +0000 (11:39 +0200)]
dt-bindings: clock: axg-audio: add earcrx clock ids

Add clock IDs for the eARC Rx device found on sm1 SoCs

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20240719093934.3985139-2-jbrunet@baylibre.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
12 months agoMerge tag 'v6.11-rc1' into clk-meson-next
Jerome Brunet [Mon, 29 Jul 2024 14:32:02 +0000 (16:32 +0200)]
Merge tag 'v6.11-rc1' into clk-meson-next

Linux 6.11-rc1

12 months agoLinux 6.11-rc1 v6.11-rc1
Linus Torvalds [Sun, 28 Jul 2024 21:19:55 +0000 (14:19 -0700)]
Linux 6.11-rc1

12 months agoMerge tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masah...
Linus Torvalds [Sun, 28 Jul 2024 21:02:48 +0000 (14:02 -0700)]
Merge tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Fix RPM package build error caused by an incorrect locale setup

 - Mark modules.weakdep as ghost in RPM package

 - Fix the odd combination of -S and -c in stack protector scripts,
   which is an error with the latest Clang

* tag 'kbuild-fixes-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: Fix '-S -c' in x86 stack protector scripts
  kbuild: rpm-pkg: ghost modules.weakdep file
  kbuild: rpm-pkg: Fix C locale setup

12 months agominmax: simplify and clarify min_t()/max_t() implementation
Linus Torvalds [Sun, 28 Jul 2024 20:50:01 +0000 (13:50 -0700)]
minmax: simplify and clarify min_t()/max_t() implementation

This simplifies the min_t() and max_t() macros by no longer making them
work in the context of a C constant expression.

That means that you can no longer use them for static initializers or
for array sizes in type definitions, but there were only a couple of
such uses, and all of them were converted (famous last words) to use
MIN_T/MAX_T instead.

Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 months agominmax: add a few more MIN_T/MAX_T users
Linus Torvalds [Sun, 28 Jul 2024 20:03:48 +0000 (13:03 -0700)]
minmax: add a few more MIN_T/MAX_T users

Commit 3a7e02c040b1 ("minmax: avoid overly complicated constant
expressions in VM code") added the simpler MIN_T/MAX_T macros in order
to avoid some excessive expansion from the rather complicated regular
min/max macros.

The complexity of those macros stems from two issues:

 (a) trying to use them in situations that require a C constant
     expression (in static initializers and for array sizes)

 (b) the type sanity checking

and MIN_T/MAX_T avoids both of these issues.

Now, in the whole (long) discussion about all this, it was pointed out
that the whole type sanity checking is entirely unnecessary for
min_t/max_t which get a fixed type that the comparison is done in.

But that still leaves min_t/max_t unnecessarily complicated due to
worries about the C constant expression case.

However, it turns out that there really aren't very many cases that use
min_t/max_t for this, and we can just force-convert those.

This does exactly that.

Which in turn will then allow for much simpler implementations of
min_t()/max_t().  All the usual "macros in all upper case will evaluate
the arguments multiple times" rules apply.

We should do all the same things for the regular min/max() vs MIN/MAX()
cases, but that has the added complexity of various drivers defining
their own local versions of MIN/MAX, so that needs another level of
fixes first.

Link: https://lore.kernel.org/all/b47fad1d0cf8449886ad148f8c013dae@AcuMS.aculab.com/
Cc: David Laight <David.Laight@aculab.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 months agoMerge tag 'ubifs-for-linus-6.11-rc1-take2' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sun, 28 Jul 2024 18:51:51 +0000 (11:51 -0700)]
Merge tag 'ubifs-for-linus-6.11-rc1-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs

Pull UBI and UBIFS updates from Richard Weinberger:

 - Many fixes for power-cut issues by Zhihao Cheng

 - Another ubiblock error path fix

 - ubiblock section mismatch fix

 - Misc fixes all over the place

* tag 'ubifs-for-linus-6.11-rc1-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
  ubi: Fix ubi_init() ubiblock_exit() section mismatch
  ubifs: add check for crypto_shash_tfm_digest
  ubifs: Fix inconsistent inode size when powercut happens during appendant writing
  ubi: block: fix null-pointer-dereference in ubiblock_create()
  ubifs: fix kernel-doc warnings
  ubifs: correct UBIFS_DFS_DIR_LEN macro definition and improve code clarity
  mtd: ubi: Restore missing cleanup on ubi_init() failure path
  ubifs: dbg_orphan_check: Fix missed key type checking
  ubifs: Fix unattached inode when powercut happens in creating
  ubifs: Fix space leak when powercut happens in linking tmpfile
  ubifs: Move ui->data initialization after initializing security
  ubifs: Fix adding orphan entry twice for the same inode
  ubifs: Remove insert_dead_orphan from replaying orphan process
  Revert "ubifs: ubifs_symlink: Fix memleak of inode->i_link in error path"
  ubifs: Don't add xattr inode into orphan area
  ubifs: Fix unattached xattr inode if powercut happens after deleting
  mtd: ubi: avoid expensive do_div() on 32-bit machines
  mtd: ubi: make ubi_class constant
  ubi: eba: properly rollback inside self_check_eba

12 months agokbuild: Fix '-S -c' in x86 stack protector scripts
Nathan Chancellor [Fri, 26 Jul 2024 18:05:00 +0000 (11:05 -0700)]
kbuild: Fix '-S -c' in x86 stack protector scripts

After a recent change in clang to stop consuming all instances of '-S'
and '-c' [1], the stack protector scripts break due to the kernel's use
of -Werror=unused-command-line-argument to catch cases where flags are
not being properly consumed by the compiler driver:

  $ echo | clang -o - -x c - -S -c -Werror=unused-command-line-argument
  clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]

This results in CONFIG_STACKPROTECTOR getting disabled because
CONFIG_CC_HAS_SANE_STACKPROTECTOR is no longer set.

'-c' and '-S' both instruct the compiler to stop at different stages of
the pipeline ('-S' after compiling, '-c' after assembling), so having
them present together in the same command makes little sense. In this
case, the test wants to stop before assembling because it is looking at
the textual assembly output of the compiler for either '%fs' or '%gs',
so remove '-c' from the list of arguments to resolve the error.

All versions of GCC continue to work after this change, along with
versions of clang that do or do not contain the change mentioned above.

Cc: stable@vger.kernel.org
Fixes: 4f7fd4d7a791 ("[PATCH] Add the -fstack-protector option to the CFLAGS")
Fixes: 60a5317ff0f4 ("x86: implement x86_32 stack protector")
Link: https://github.com/llvm/llvm-project/commit/6461e537815f7fa68cef06842505353cf5600e9c
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>