2014-02-19 14:20:10

by Ivan T. Ivanov

[permalink] [raw]
Subject: [PATCH] clk: qcom: Add missing clock at index GCC_XO_CLK for MSM8974

From: "Ivan T. Ivanov" <[email protected]>

Accessing GCC on MSM8974 trough <&gcc GCC_XO_CLK> lead to NULL
pointer dereference. Fix this.

Signed-off-by: Ivan T. Ivanov <[email protected]>
---
drivers/clk/qcom/gcc-msm8974.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/clk/qcom/gcc-msm8974.c b/drivers/clk/qcom/gcc-msm8974.c
index 51d457e..98be7ea 100644
--- a/drivers/clk/qcom/gcc-msm8974.c
+++ b/drivers/clk/qcom/gcc-msm8974.c
@@ -2625,6 +2625,8 @@ static int gcc_msm8974_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return PTR_ERR(clk);

+ clks[GCC_XO_CLK] = clk;
+
/* Should move to DT node? */
clk = clk_register_fixed_rate(dev, "sleep_clk_src", NULL,
CLK_IS_ROOT, 32768);
--
1.7.9.5


2014-02-19 20:17:08

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH] clk: qcom: Add missing clock at index GCC_XO_CLK for MSM8974

On 02/19, Ivan T. Ivanov wrote:
> From: "Ivan T. Ivanov" <[email protected]>
>
> Accessing GCC on MSM8974 trough <&gcc GCC_XO_CLK> lead to NULL

s/trough/through/

> pointer dereference. Fix this.
>

I think you want to get the XO clock from the not yet upstreamed
RPM clock driver. This #define is for a gate that is internal to
the SoC sitting between the pin for XO and all downstream users
of the XO clock within the SoC. Futhermore, linux is not allowed
to control this gate because it's essential to the entire system.

This patch will work for now but we'll need to change the DTS in
the future to get the clock from the RPM node and then revert
this patch.

It may be better to just move the XO and sleep_clk_src clocks to
DT and make them fixed-rate clocks that get added by
of_clk_init(). Then when the RPM node is added we can remove the
XO node and update the usb node at the same time.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

2014-02-20 07:45:26

by Ivan T. Ivanov

[permalink] [raw]
Subject: Re: [PATCH] clk: qcom: Add missing clock at index GCC_XO_CLK for MSM8974

On Wed, 2014-02-19 at 12:17 -0800, Stephen Boyd wrote:
> On 02/19, Ivan T. Ivanov wrote:
> > From: "Ivan T. Ivanov" <[email protected]>
> >
> > Accessing GCC on MSM8974 trough <&gcc GCC_XO_CLK> lead to NULL
>
> s/trough/through/
>
> > pointer dereference. Fix this.
> >
>
> I think you want to get the XO clock from the not yet upstreamed
> RPM clock driver. This #define is for a gate that is internal to
> the SoC sitting between the pin for XO and all downstream users
> of the XO clock within the SoC. Futhermore, linux is not allowed
> to control this gate because it's essential to the entire system.
>
> This patch will work for now but we'll need to change the DTS in
> the future to get the clock from the RPM node and then revert
> this patch.
>
> It may be better to just move the XO and sleep_clk_src clocks to
> DT and make them fixed-rate clocks that get added by
> of_clk_init(). Then when the RPM node is added we can remove the
> XO node and update the usb node at the same time.


I see. I'll leave you to decide what is the right solution here,

Regards,
Ivan