From: Pavel Kubelun Date: Sun, 6 Nov 2016 13:22:22 +0000 (+0300) Subject: ipq806x: add support for RPM message RAM X-Git-Tag: v17.01.0-rc1~837 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=77b6bfc2f59e85f16880e61b75a3b0cdfa35e2d7;p=oweals%2Fopenwrt.git ipq806x: add support for RPM message RAM Signed-off-by: Pavel Kubelun --- diff --git a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065.dtsi b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065.dtsi index f2d310eeaa..0d5430370f 100644 --- a/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065.dtsi +++ b/target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065.dtsi @@ -224,6 +224,9 @@ #address-cells = <1>; #size-cells = <0>; + clocks = <&gcc RPM_MSG_RAM_H_CLK>; + clock-names = "ram"; + rpmcc: clock-controller { compatible = "qcom,rpmcc-ipq806x", "qcom,rpmcc"; #clock-cells = <1>; diff --git a/target/linux/ipq806x/patches-4.4/005-mfd-qcom_rpm-Add-missing-of_node_put-after-calling-of_parse_phandle.patch b/target/linux/ipq806x/patches-4.4/005-mfd-qcom_rpm-Add-missing-of_node_put-after-calling-of_parse_phandle.patch new file mode 100644 index 0000000000..c80bbd5a01 --- /dev/null +++ b/target/linux/ipq806x/patches-4.4/005-mfd-qcom_rpm-Add-missing-of_node_put-after-calling-of_parse_phandle.patch @@ -0,0 +1,29 @@ +From 349290fc9e761aaef6d6882721189f668ec5ff49 Mon Sep 17 00:00:00 2001 +From: Peter Chen +Date: Fri, 15 Jul 2016 17:38:46 +0800 +Subject: mfd: qcom_rpm: Add missing of_node_put after calling of_parse_phandle + +of_node_put needs to be called when the device node which is got +from of_parse_phandle has finished using. + +Signed-off-by: Peter Chen +Reviewed-by: Bjorn Andersson +Signed-off-by: Lee Jones +--- + drivers/mfd/qcom_rpm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c +index a74210d..d330071 100644 +--- a/drivers/mfd/qcom_rpm.c ++++ b/drivers/mfd/qcom_rpm.c +@@ -589,6 +589,7 @@ static int qcom_rpm_probe(struct platform_device *pdev) + } + + rpm->ipc_regmap = syscon_node_to_regmap(syscon_np); ++ of_node_put(syscon_np); + if (IS_ERR(rpm->ipc_regmap)) + return PTR_ERR(rpm->ipc_regmap); + +-- +cgit v0.12 diff --git a/target/linux/ipq806x/patches-4.4/006-mfd-qcom_rpm-Handle-message-RAM-clock.patch b/target/linux/ipq806x/patches-4.4/006-mfd-qcom_rpm-Handle-message-RAM-clock.patch new file mode 100644 index 0000000000..01168bbb12 --- /dev/null +++ b/target/linux/ipq806x/patches-4.4/006-mfd-qcom_rpm-Handle-message-RAM-clock.patch @@ -0,0 +1,94 @@ +From 3526403353c2a1b94c3181f900582626d23c339b Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Thu, 18 Aug 2016 20:40:45 +0200 +Subject: mfd: qcom_rpm: Handle message RAM clock +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The MSM8660, APQ8060, IPQ806x and MSM8960 have a GCC clock +to the message RAM used by the RPM. This needs to be enabled +for messages to pass through. This is a crude solution that +simply prepare/enable at probe() and disable/unprepare +at remove(). More elaborate PM is probably possible to +add later. + +The construction uses IS_ERR() to gracefully handle the +platforms that do not provide a message RAM clock. It will +bail out of probe only if the clock is hitting a probe +deferral situation. + +Of course this requires the proper device tree set-up: + +rpm: rpm@104000 { + compatible = "qcom,rpm-msm8660"; + clocks = <&gcc RPM_MSG_RAM_H_CLK>; + clock-names = "ram"; + ... +}; + +I have provided this in the MSM8660 device tree, and will +provide patches for the other targets. + +Cc: Björn Andersson +Signed-off-by: Linus Walleij +Signed-off-by: Lee Jones +--- + drivers/mfd/qcom_rpm.c | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/drivers/mfd/qcom_rpm.c b/drivers/mfd/qcom_rpm.c +index d330071..52fafea 100644 +--- a/drivers/mfd/qcom_rpm.c ++++ b/drivers/mfd/qcom_rpm.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + + #include + +@@ -48,6 +49,7 @@ struct qcom_rpm { + struct regmap *ipc_regmap; + unsigned ipc_offset; + unsigned ipc_bit; ++ struct clk *ramclk; + + struct completion ack; + struct mutex lock; +@@ -552,6 +554,20 @@ static int qcom_rpm_probe(struct platform_device *pdev) + mutex_init(&rpm->lock); + init_completion(&rpm->ack); + ++ /* Enable message RAM clock */ ++ rpm->ramclk = devm_clk_get(&pdev->dev, "ram"); ++ if (IS_ERR(rpm->ramclk)) { ++ ret = PTR_ERR(rpm->ramclk); ++ if (ret == -EPROBE_DEFER) ++ return ret; ++ /* ++ * Fall through in all other cases, as the clock is ++ * optional. (Does not exist on all platforms.) ++ */ ++ rpm->ramclk = NULL; ++ } ++ clk_prepare_enable(rpm->ramclk); /* Accepts NULL */ ++ + irq_ack = platform_get_irq_byname(pdev, "ack"); + if (irq_ack < 0) { + dev_err(&pdev->dev, "required ack interrupt missing\n"); +@@ -672,7 +688,11 @@ static int qcom_rpm_probe(struct platform_device *pdev) + + static int qcom_rpm_remove(struct platform_device *pdev) + { ++ struct qcom_rpm *rpm = dev_get_drvdata(&pdev->dev); ++ + of_platform_depopulate(&pdev->dev); ++ clk_disable_unprepare(rpm->ramclk); ++ + return 0; + } + +-- +cgit v0.12 diff --git a/target/linux/ipq806x/patches-4.4/306-add-RPM-msg-RAM-into-DT.patch b/target/linux/ipq806x/patches-4.4/306-add-RPM-msg-RAM-into-DT.patch new file mode 100644 index 0000000000..60cfac974c --- /dev/null +++ b/target/linux/ipq806x/patches-4.4/306-add-RPM-msg-RAM-into-DT.patch @@ -0,0 +1,24 @@ +From 9bf6b333d6a4d3a3ef0d3fc7ca0becd008c81820 Mon Sep 17 00:00:00 2001 +From: Pavel Kubelun +Date: Sun, 6 Nov 2016 19:12:46 +0300 +Subject: [PATCH] ipq806x: add RPM msg RAM into DT + +Signed-off-by: Pavel Kubelun +--- + arch/arm/boot/dts/qcom-ipq8064.dtsi | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi +index 6b06118..d1ff9d0 100644 +--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi ++++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi +@@ -184,6 +184,9 @@ + "err", + "wakeup"; + ++ clocks = <&gcc RPM_MSG_RAM_H_CLK>; ++ clock-names = "ram"; ++ + #address-cells = <1>; + #size-cells = <0>; +