devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Harkin <ryan.harkin@linaro.org>
To: ryan.harkin@linaro.org, arnd.bergmann@linaro.org,
	shiraz.hashim@st.com, stigge@antcom.de, pawel.moll@arm.com,
	tixy@linaro.org, liviu.dudau@arm.com, spear-devel@list.st.com,
	viresh.linux@gmail.com, linux-arm-kernel@lists.infradead.org,
	linux-fbdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Subject: [RFC PATCH 2/3] ARM: vexpress: Add device tree support for CLCD driver
Date: Wed, 19 Sep 2012 17:04:25 +0100	[thread overview]
Message-ID: <1348070666-9153-3-git-send-email-ryan.harkin@linaro.org> (raw)
In-Reply-To: <1348070666-9153-1-git-send-email-ryan.harkin@linaro.org>

Add support for device tree in the amba-clcd PL111 video driver.

Special case support is added for the A9 CoreTile which uses the "legacy"
address map and has a PL111 device on-board.  The default case is to configure
the device on the motherboard.

Oscillator support is added for the A9 CoreTile's CLCD driver.

Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
---
 arch/arm/mach-vexpress/v2m.c |   58 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 37608f2..799e00e 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -3,6 +3,7 @@
  */
 #include <linux/device.h>
 #include <linux/amba/bus.h>
+#include <linux/amba/clcd.h>
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
 #include <linux/init.h>
@@ -37,6 +38,7 @@
 #include <mach/ct-ca9x4.h>
 #include <mach/motherboard.h>
 
+#include <plat/clcd.h>
 #include <plat/sched_clock.h>
 
 #include "core.h"
@@ -541,6 +543,54 @@ MACHINE_END
 
 #if defined(CONFIG_ARCH_VEXPRESS_DT)
 
+static struct v2m_osc v2m_dt_clcd_osc = {
+	.rate_min = 10000000,
+	.rate_max = 165000000,
+	.rate_default = 23750000,
+};
+
+static int v2m_dt_clcd_init(void)
+{
+	struct device_node *node;
+	u32 osc;
+	u32 clcd_site;
+	u32 dvimode;
+	const __be32 *prop;
+	int len, na, ns;
+	phys_addr_t reg_base;
+
+	node = of_find_compatible_node(NULL, NULL, "arm,pl111");
+	if (!node)
+		return -ENODEV;
+
+	na = of_n_addr_cells(node);
+	ns = of_n_size_cells(node);
+
+	prop = of_get_property(node, "reg", &len);
+	if (WARN_ON(!prop || len < (na + ns) * sizeof(*prop)))
+		return -EINVAL;
+	reg_base = of_read_number(prop, na);
+
+	switch (reg_base) {
+	case CT_CA9X4_CLCDC:
+		clcd_site = v2m_get_master_site();
+		dvimode = 2;
+		break;
+	default:
+		clcd_site = SYS_CFG_SITE_MB;
+		dvimode = 0;
+		break;
+	}
+
+	if (of_property_read_u32(node, "arm,vexpress-osc", &osc) != 0)
+		return -EINVAL;
+	v2m_dt_clcd_osc.site = clcd_site;
+	v2m_dt_clcd_osc.osc = osc;
+	v2m_cfg_write(SYS_CFG_MUXFPGA | clcd_site, clcd_site);
+	v2m_cfg_write(SYS_CFG_DVIMODE | clcd_site, dvimode);
+	return 0;
+}
+
 static struct map_desc v2m_rs1_io_desc __initdata = {
 	.virtual	= V2M_PERIPH,
 	.pfn		= __phys_to_pfn(0x1c000000),
@@ -598,6 +648,8 @@ void __init v2m_dt_init_early(void)
 			pr_warning("vexpress: DT HBI (%x) is not matching "
 					"hardware (%x)!\n", dt_hbi, hbi);
 	}
+
+	v2m_dt_clcd_init();
 }
 
 static  struct of_device_id vexpress_irq_match[] __initdata = {
@@ -631,6 +683,12 @@ static void __init v2m_dt_timer_init(void)
 
 	if (arch_timer_sched_clock_init() != 0)
 		versatile_sched_clock_init(v2m_sysreg_base + V2M_SYS_24MHZ, 24000000);
+
+	if (v2m_dt_clcd_osc.site) {
+		/* core tile clcd controller for A9 */
+		clk = v2m_osc_register("10020000.clcd", &v2m_dt_clcd_osc);
+		clk_register_clkdev(clk, NULL, "10020000.clcd");
+	}
 }
 
 static struct sys_timer v2m_dt_timer = {
-- 
1.7.9.5

  parent reply	other threads:[~2012-09-19 16:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 16:04 [RFC PATCH 0/3] amba-clcd: add device tree support Ryan Harkin
2012-09-19 16:04 ` [RFC PATCH 1/3] amba-clcd: Add Device Tree support to amba-clcd driver Ryan Harkin
2012-09-20 10:24   ` Liviu Dudau
     [not found]     ` <20120920102453.GG32603-CibnQJhq84/ZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2012-09-21 10:35       ` Ryan Harkin
2012-09-21 10:44         ` Pawel Moll
     [not found]   ` <1348070666-9153-2-git-send-email-ryan.harkin-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-09-21 11:02     ` Russell King - ARM Linux
2012-09-21 11:43     ` Sascha Hauer
     [not found]       ` <20120921114345.GE24458-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-09-21 12:19         ` Russell King - ARM Linux
     [not found]           ` <20120921121903.GE15609-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2012-09-24  7:07             ` Ryan Harkin
2012-10-10 10:13   ` Jon Medhurst (Tixy)
2012-09-19 16:04 ` Ryan Harkin [this message]
2012-09-19 16:11   ` [RFC PATCH 2/3] ARM: vexpress: Add device tree support for CLCD driver Pawel Moll
2012-09-19 16:04 ` [RFC PATCH 3/3] ARM: vexpress: configure CLCD driver device tree support for A9 CoreTile Ryan Harkin
2012-09-20 10:29   ` Liviu Dudau

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=1348070666-9153-3-git-send-email-ryan.harkin@linaro.org \
    --to=ryan.harkin@linaro.org \
    --cc=arnd.bergmann@linaro.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=shiraz.hashim@st.com \
    --cc=spear-devel@list.st.com \
    --cc=stigge@antcom.de \
    --cc=tixy@linaro.org \
    --cc=viresh.linux@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).