clk: keystone: syscon-clk: Fix audio refclk
Subsystems (2)
PATCH 1/1 clk: keystone: syscon-clk: Fix audio refclk
From: Francesco Dolcini <[email protected]>
Audio REFCLK's are not working correctly, trying to use them lead to the following errors:
[ 6.575277] of_clk_hw_onecell_get: invalid index 4294934528 [ 6.581515] wm8904 1-001a: Failed to get MCLK [ 6.586290] wm8904: probe of 1-001a failed with error -2
The issue is that Audio REFCLK has #clock-cells = 0 [1], while the driver is registering those clocks assuming they have one cells. Fix this by registering the clock with of_clk_hw_simple_get() when there is only one instance, e.g. "audio_refclk".
[1] Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yaml
--- drivers/clk/keystone/syscon-clk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/clk/keystone/syscon-clk.c +6 -2
@@ -151,8 +151,12 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) data[i].name); } -return devm_of_clk_add_hw_provider (dev, of_clk_hw_onecell_get, - hw_data); +if (num_clks ==1 ) +return devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, + hw_data->hws[0 ]); +else +return devm_of_clk_add_hw_provider (dev, of_clk_hw_onecell_get, + hw_data); }#define TI_SYSCON_CLK_GATE (_name, _offset, _bit_idx) \
Signature · 1 line
2.25.1
Hi Francesco,
Quoted 5 lines · Francesco Dolcini
From: Francesco Dolcini <[email protected]>
Audio REFCLK's are not working correctly, trying to use them lead to the following errors:
Quoted 8 lines
[ 6.575277] of_clk_hw_onecell_get: invalid index 4294934528 [ 6.581515] wm8904 1-001a: Failed to get MCLK [ 6.586290] wm8904: probe of 1-001a failed with error -2The issue is that Audio REFCLK has #clock-cells = 0 [1], while the driver is registering those clocks assuming they have one cells. Fix this by registering the clock with
of_clk_hw_simple_get()when there is only one instance, e.g. "audio_refclk".
Good catch, I didn't encounter the dmesg error during my tests - probably because of zero-initialized structs so idx = 0.
Quoted 5 lines
[1]
Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yamlFixes 6acab96ee337 ("clk: keystone: syscon-clk: Add support for audio refclk")Signed-off-by Francesco Dolcini <[email protected]>
Quoted 23 lines
--- drivers/clk/keystone/syscon-clk.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/clk/keystone/syscon-clk.c +6
-2@@ -151,8 +151,12 @@ static int ti_syscon_gate_clk_probe(struct platform_device *pdev) data[i].name); } -return devm_of_clk_add_hw_provider (dev, of_clk_hw_onecell_get, - hw_data); +if (num_clks ==1 ) +return devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, + hw_data->hws[0 ]); +else +return devm_of_clk_add_hw_provider (dev, of_clk_hw_onecell_get, + hw_data); }#define TI_SYSCON_CLK_GATE (_name, _offset, _bit_idx) \
Signature · 4 lines
Thanks, Jai GPG Fingerprint: 4DE0 D818 E5D5 75E8 D45A AFC5 43DE 91F9 249A 7145
Quoting Francesco Dolcini (2023-07-28 15:26:39)
Quoted 14 lines
From: Francesco Dolcini <[email protected]>
Audio REFCLK's are not working correctly, trying to use them lead to the following errors:
[ 6.575277] of_clk_hw_onecell_get: invalid index 4294934528 [ 6.581515] wm8904 1-001a: Failed to get MCLK [ 6.586290] wm8904: probe of 1-001a failed with error -2The issue is that Audio REFCLK has #clock-cells = 0 [1], while the driver is registering those clocks assuming they have one cells. Fix this by registering the clock with
of_clk_hw_simple_get()when there is only one instance, e.g. "audio_refclk".
Quoted 5 lines
[1]
Documentation/devicetree/bindings/clock/ti,am62-audio-refclk.yamlFixes 6acab96ee337 ("clk: keystone: syscon-clk: Add support for audio refclk")Signed-off-by Francesco Dolcini <[email protected]>---
Applied to clk-fixes