From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>,
Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
Gregory Clement <gregory.clement@free-electrons.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/4] ARM: mvebu: add armada drm init to Dove board setup
Date: Tue, 1 Jul 2014 15:04:31 +0200 [thread overview]
Message-ID: <1404219871-18419-5-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1404219871-18419-1-git-send-email-sebastian.hesselbarth@gmail.com>
From: Russell King <rmk+kernel@arm.linux.org.uk>
Adding both, driver and proper DT representation, especially when
subsystem DT bindings are not settled, is almost impossible right
now. To get some more code testing coverage on Armada DRM driver,
we add plain old platform_device registration now and get rid of
it incrementally as we did often in the past.
This adds DRM platform_device and required quirks to get it up
and running (framebuffer CMA, lcd resources, clks) which allows
us to remove it step-by-step again when bindings have settled.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
arch/arm/mach-mvebu/dove.c | 70 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
index b50464e..c8c2284 100644
--- a/arch/arm/mach-mvebu/dove.c
+++ b/arch/arm/mach-mvebu/dove.c
@@ -11,11 +11,75 @@
#include <linux/init.h>
#include <linux/mbus.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <asm/hardware/cache-tauros2.h>
#include <asm/mach/arch.h>
+#include <asm/memblock.h>
#include "common.h"
+/*
+ * Armada DRM framebuffer
+ */
+static struct resource armada_drm_resources[3] = {
+ DEFINE_RES_MEM(0, 0),
+};
+
+static const char *armada_drm_devices[4];
+
+static const struct platform_device_info armada_drm_dev_info __initconst = {
+ .name = "armada-510-drm",
+ .id = -1,
+ .res = armada_drm_resources,
+ .num_res = ARRAY_SIZE(armada_drm_resources),
+ .data = armada_drm_devices,
+ .size_data = sizeof(armada_drm_devices),
+};
+
+static void __init armada_drm_reserve(void)
+{
+ phys_addr_t phys;
+
+ /* Steal 32MB for the drm framebuffers */
+ phys = arm_memblock_steal(SZ_32M, SZ_2M);
+ armada_drm_resources[0].start = phys;
+ armada_drm_resources[0].end = phys + SZ_32M - 1;
+}
+
+static void __init armada_drm_init(void)
+{
+ struct device_node *np, *clknp = NULL;
+ struct platform_device *pdev;
+ int i = 0;
+
+ for_each_compatible_node(np, NULL, "marvell,dove-lcd") {
+ if (!of_device_is_available(np))
+ continue;
+
+ /* add lcd controller mmio resources */
+ if (of_address_to_resource(np, 0, &armada_drm_resources[i+1]))
+ continue;
+
+ /* get device name for component framework */
+ pdev = of_find_device_by_node(np);
+ if (pdev)
+ armada_drm_devices[i] = dev_name(&pdev->dev);
+ clknp = np;
+ i++;
+ }
+ armada_drm_devices[i++] = NULL;
+
+ pdev = platform_device_register_full(&armada_drm_dev_info);
+ /* assign last found lcd node to drm device for clk lookup */
+ pdev->dev.of_node = clknp;
+}
+
+static void __init dove_reserve(void)
+{
+ if (IS_ENABLED(CONFIG_DRM_ARMADA))
+ armada_drm_reserve();
+}
+
static void __init dove_init(void)
{
pr_info("Dove 88AP510 SoC\n");
@@ -25,6 +89,9 @@ static void __init dove_init(void)
#endif
BUG_ON(mvebu_mbus_dt_init(false));
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+ if (IS_ENABLED(CONFIG_DRM_ARMADA))
+ armada_drm_init();
}
static const char * const dove_dt_compat[] = {
@@ -33,7 +100,8 @@ static const char * const dove_dt_compat[] = {
};
DT_MACHINE_START(DOVE_DT, "Marvell Dove")
+ .dt_compat = dove_dt_compat,
.init_machine = dove_init,
+ .reserve = dove_reserve,
.restart = mvebu_restart,
- .dt_compat = dove_dt_compat,
MACHINE_END
--
1.7.2.5
next prev parent reply other threads:[~2014-07-01 13:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-01 13:04 [PATCH 0/4] Marvell Dove DRM for DT Sebastian Hesselbarth
2014-07-01 13:04 ` [PATCH 1/4] dt-bindings: add Marvell Dove LCD controller documentation Sebastian Hesselbarth
2014-07-01 13:04 ` [PATCH 2/4] ARM: dts: dove: add DT LCD controllers Sebastian Hesselbarth
2014-07-01 13:04 ` [PATCH 3/4] ARM: dts: dove: enable lcd0 on SolidRun CuBox Sebastian Hesselbarth
2014-07-01 13:18 ` Mark Rutland
2014-07-01 15:40 ` Jean-Francois Moine
2014-07-01 13:04 ` Sebastian Hesselbarth [this message]
2014-07-01 13:10 ` [PATCH 4/4] ARM: mvebu: add armada drm init to Dove board setup Russell King - ARM Linux
2014-07-01 13:21 ` Sebastian Hesselbarth
2014-07-01 13:36 ` Russell King - ARM Linux
2014-07-01 13:40 ` Sebastian Hesselbarth
2014-07-01 13:42 ` Russell King - ARM Linux
2014-07-01 16:04 ` Jean-Francois Moine
2014-07-01 16:45 ` Russell King - ARM Linux
2014-07-01 17:49 ` Jean-Francois Moine
2014-07-01 22:00 ` Russell King - ARM Linux
2014-07-01 16:53 ` Jason Cooper
2014-07-01 17:06 ` Russell King - ARM Linux
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=1404219871-18419-5-git-send-email-sebastian.hesselbarth@gmail.com \
--to=sebastian.hesselbarth@gmail.com \
--cc=andrew@lunn.ch \
--cc=gregory.clement@free-electrons.com \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
/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
all inboxes | Powered by JetHome®