public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
Subject: [PATCH v2 2/2] clk: rockchip: Make uartpll a child of the gpll on rk3036
Date: Tue, 28 Feb 2017 19:12:14 +0100	[thread overview]
Message-ID: <20170228181214.6413-3-heiko@sntech.de> (raw)
In-Reply-To: <20170228181214.6413-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

The shared uart-pll is on boot a child of the apll that can get changed
by cpu frequency scaling. So move it away to the more stable gpll to
make sure the uart doesn't break on cpu frequency changes.

This turned up during the 4.11 merge-window when commit
6a171b299379 ("serial: 8250_dw: Allow hardware flow control to be used")
added general termios enablement making the uart on rk3036 change
frequency and thus making it susceptible for the frequency scaling issue.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 drivers/clk/rockchip/clk-rk3036.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/rockchip/clk-rk3036.c b/drivers/clk/rockchip/clk-rk3036.c
index dcde70f4c105..8b8d2c90c884 100644
--- a/drivers/clk/rockchip/clk-rk3036.c
+++ b/drivers/clk/rockchip/clk-rk3036.c
@@ -16,6 +16,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -442,7 +443,7 @@ static void __init rk3036_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
 	void __iomem *reg_base;
-	struct clk *clk;
+	struct clk *clk, *clk2;
 
 	reg_base = of_iomap(np, 0);
 	if (!reg_base) {
@@ -480,6 +481,19 @@ static void __init rk3036_clk_init(struct device_node *np)
 
 	rockchip_register_restart_notifier(ctx, RK2928_GLB_SRST_FST, NULL);
 
+	clk = __clk_lookup("uart_pll_clk");
+	clk2 = __clk_lookup("gpll");
+	if (clk && clk2) {
+		int ret = clk_set_parent(clk, clk2);
+
+		if (ret < 0)
+			pr_warn("%s: could not reparent uart_pll_clk to gpll\n",
+				__func__);
+	} else {
+		pr_warn("%s: missing clocks to reparent uart_pll_clk to gpll\n",
+			__func__);
+	}
+
 	rockchip_clk_of_add_provider(np, ctx);
 }
 CLK_OF_DECLARE(rk3036_cru, "rockchip,rk3036-cru", rk3036_clk_init);
-- 
2.11.0

  parent reply	other threads:[~2017-02-28 18:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28 18:12 [PATCH v2 0/2] rockchip: fix serial output on rk3036 Heiko Stuebner
     [not found] ` <20170228181214.6413-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2017-02-28 18:12   ` [PATCH v2 1/2] clk: rockchip: add ", " to mux_pll_src_apll_dpll_gpll_usb480m_p " Heiko Stuebner
2017-02-28 18:12   ` Heiko Stuebner [this message]
     [not found]     ` <20170228181214.6413-3-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2017-03-01 19:08       ` [PATCH v2 2/2] clk: rockchip: Make uartpll a child of the gpll " Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170228181214.6413-3-heiko@sntech.de \
    --to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
    --cc=linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox