From patchwork Tue Jul 1 13:04:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 4458591 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E25E39F39B for ; Tue, 1 Jul 2014 13:07:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F1DF220353 for ; Tue, 1 Jul 2014 13:07:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03E21203E5 for ; Tue, 1 Jul 2014 13:07:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1xkx-0003rG-Sq; Tue, 01 Jul 2014 13:05:55 +0000 Received: from mail-wi0-x235.google.com ([2a00:1450:400c:c05::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1xkE-0002SM-EZ for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 13:05:13 +0000 Received: by mail-wi0-f181.google.com with SMTP id n3so7754800wiv.14 for ; Tue, 01 Jul 2014 06:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oHp5mPZ9Aqg5lWJBxTemRz5qWIqaFi3n8cXp+NJKADo=; b=BslYu3/a6w7E1VfomMUZdTD2kbMCTNi1cb8lgyyYHL3gt9+Z1CB0ZK5vn/vS9ujZuE kN7q06UdEqu9C0H4ByJ/krb1CclEy/qWZrCpjvbcsKh5a9q1gWZSSbQzD0raTqflvbH/ ynyPjVH+eEIWz5d6x7u1s2QqjODdx29CTLhBqA2sKOKXUNd3LQVPcm06bySbxTQ2cEqn bPPEnsqolzn6NOZ9HeZHs+eK9h9CIFt9onZMdY1Nvwcx1vrDp5RLszUvLSJ+nFxsWnS+ TizDYiTF7GwfzrZ6wax0N5vcT/jDpBHGkR9TaKMs6KK6GWizW2Kh1+A4FtTdPFcJ0+yC z4EQ== X-Received: by 10.180.21.200 with SMTP id x8mr36390260wie.70.1404219886821; Tue, 01 Jul 2014 06:04:46 -0700 (PDT) Received: from topkick.lan (f048229077.adsl.alicedsl.de. [78.48.229.77]) by mx.google.com with ESMTPSA id ey16sm43153956wid.14.2014.07.01.06.04.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jul 2014 06:04:46 -0700 (PDT) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH 4/4] ARM: mvebu: add armada drm init to Dove board setup Date: Tue, 1 Jul 2014 15:04:31 +0200 Message-Id: <1404219871-18419-5-git-send-email-sebastian.hesselbarth@gmail.com> In-Reply-To: <1404219871-18419-1-git-send-email-sebastian.hesselbarth@gmail.com> References: <1404219871-18419-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_060510_683004_5742BD11 X-CRM114-Status: GOOD ( 17.42 ) X-Spam-Score: -0.8 (/) Cc: Andrew Lunn , Jason Cooper , linux-kernel@vger.kernel.org, Gregory Clement , Russell King , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King 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 Signed-off-by: Sebastian Hesselbarth --- Cc: Russell King Cc: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement 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 #include #include +#include #include #include #include +#include #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