This code claims the display engine clocks used by the simplefb support
in u-boot. Without this code, the relevant blocks in the display engine
get disabled.

Signed-off-by: Luc Verhaegen <[email protected]>
---
 drivers/clk/sunxi/clk-sunxi.c |   54 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index e43ed6a..012e752 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -1173,6 +1173,56 @@ static void __init of_sunxi_table_clock_setup(const 
struct of_device_id *clk_mat
        }
 }
 
+#ifdef CONFIG_FB_SIMPLE
+/*
+ * In this code, we claim the clocks needed by the simple framebuffer as
+ * set up by u-boot. It would've been preferrable to claim the clocks in
+ * the device tree, at boot time by u-boot, but this sort of dt alteration
+ * turns out to be a nightmare.
+ */
+static void __init
+sunxi_init_fb_simple_clocks(void)
+{
+       struct device_node *node;
+       struct clk *clk;
+       int ret;
+
+       node = of_find_compatible_node(NULL, NULL, "simple-framebuffer");
+       if (!node)
+               return;
+
+       ret = of_property_match_string(node, "status", "disabled");
+       if (ret >= 0)
+               return;
+
+       /*
+        * Due to a diversion in naming in the dtsi, we cannot simply provide
+        * a list.
+        */
+       clk = clk_get(NULL, "ahb_de_be0");
+       if (!IS_ERR(clk))
+               clk_prepare_enable(clk);
+       else
+               pr_warn("%s: claiming de_be0 failed\n", __func__);
+
+       clk = clk_get(NULL, "ahb_lcd0");
+       if (!IS_ERR(clk))
+               clk_prepare_enable(clk);
+       else
+               pr_warn("%s: claiming de_lcd0 failed\n", __func__);
+
+       clk = clk_get(NULL, "ahb_hdmi");
+       if (IS_ERR(clk))
+               clk = clk_get(NULL, "ahb_hdmi0");
+       if (!IS_ERR(clk))
+               clk_prepare_enable(clk);
+       else
+               pr_warn("%s: claiming de_hdmi failed\n", __func__);
+
+       of_node_put(node);
+}
+#endif /* CONFIG_FB_SIMPLE */
+
 static void __init sunxi_init_clocks(const char *clocks[], int nclocks)
 {
        unsigned int i;
@@ -1199,6 +1249,10 @@ static void __init sunxi_init_clocks(const char 
*clocks[], int nclocks)
                if (!IS_ERR(clk))
                        clk_prepare_enable(clk);
        }
+
+#ifdef CONFIG_FB_SIMPLE
+       sunxi_init_fb_simple_clocks();
+#endif
 }
 
 static const char *sun4i_a10_critical_clocks[] __initdata = {
-- 
1.7.7

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to