From patchwork Thu Jul 9 07:33:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Courbot X-Patchwork-Id: 493288 X-Patchwork-Delegate: twarren@nvidia.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2264B1402B1 for ; Thu, 9 Jul 2015 17:38:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4B3164B65F; Thu, 9 Jul 2015 09:38:42 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oc102_tuwnpn; Thu, 9 Jul 2015 09:38:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4BAE4B61D; Thu, 9 Jul 2015 09:38:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 00D684A03A for ; Thu, 9 Jul 2015 09:38:40 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BnyK0PX95Yxu for ; Thu, 9 Jul 2015 09:38:39 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from hqemgate16.nvidia.com (hqemgate16.nvidia.com [216.228.121.65]) by theia.denx.de (Postfix) with ESMTPS id 19F1B4B65F for ; Thu, 9 Jul 2015 09:38:34 +0200 (CEST) Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Thu, 09 Jul 2015 00:33:45 -0700 Received: from hqemhub02.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Thu, 09 Jul 2015 00:33:18 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Thu, 09 Jul 2015 00:33:18 -0700 Received: from percival.nvidia.com (172.20.144.16) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server (TLS) id 8.3.342.0; Thu, 9 Jul 2015 00:33:18 -0700 From: Alexandre Courbot To: Stephen Warren , Tom Warren , u-boot@lists.denx.de Date: Thu, 9 Jul 2015 16:33:01 +0900 Message-ID: <1436427181-23904-3-git-send-email-acourbot@nvidia.com> X-Mailer: git-send-email 2.4.4 In-Reply-To: <1436427181-23904-1-git-send-email-acourbot@nvidia.com> References: <1436427181-23904-1-git-send-email-acourbot@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Cc: linux-tegra@vger.kernel.org, gnurou@gmail.com Subject: [U-Boot] [PATCH 2/2] ARM: tegra: enable GPU DT node when appropriate X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" T124 requires some specific configuration (VPR setup) to be performed by the bootloader before the GPU can be used. For this reason, the GPU node in the device tree is disabled by default. This patch enables the node if U-boot has performed VPR configuration. Boards enabled by this patch are T124's Jetson TK1 and Venice 2. Signed-off-by: Alexandre Courbot Cc: Stephen Warren Cc: Tom Warren --- arch/arm/include/asm/arch-tegra/gpu.h | 16 ++++++++++++++++ arch/arm/mach-tegra/gpu.c | 19 +++++++++++++++++++ board/nvidia/jetson-tk1/jetson-tk1.c | 8 ++++++++ board/nvidia/venice2/venice2.c | 8 ++++++++ include/configs/jetson-tk1.h | 2 ++ include/configs/venice2.h | 2 ++ 6 files changed, 55 insertions(+) diff --git a/arch/arm/include/asm/arch-tegra/gpu.h b/arch/arm/include/asm/arch-tegra/gpu.h index b347a21835f5..eac73ed5fddf 100644 --- a/arch/arm/include/asm/arch-tegra/gpu.h +++ b/arch/arm/include/asm/arch-tegra/gpu.h @@ -25,3 +25,19 @@ static inline bool gpu_configured(void) } #endif /* CONFIG_TEGRA_GPU */ + + +#if defined(CONFIG_OF_LIBFDT) + +int gpu_enable_node(void *blob, const char *gpupath); + +#else /* CONFIG_OF_LIBFDT */ + +static inline int gpu_enable_node(void *blob, const char *gpupath) +{ + return 0; +} + +#endif /* CONFIG_OF_LIBFDT */ + +#endif diff --git a/arch/arm/mach-tegra/gpu.c b/arch/arm/mach-tegra/gpu.c index b2fa50b5400e..4ea046d3e5b6 100644 --- a/arch/arm/mach-tegra/gpu.c +++ b/arch/arm/mach-tegra/gpu.c @@ -45,3 +45,22 @@ bool vpr_configured(void) { return _configured; } + +#if defined(CONFIG_OF_LIBFDT) + +int gpu_enable_node(void *blob, const char *gpupath) +{ + int offset; + + if (vpr_configured()) { + offset = fdt_path_offset(blob, gpupath); + if (offset > 0) { + fdt_status_okay(blob, offset); + debug("enabled GPU node %s\n", gpupath); + } + } + + return 0; +} + +#endif diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c b/board/nvidia/jetson-tk1/jetson-tk1.c index 52425a8f6dea..3c21767ce4da 100644 --- a/board/nvidia/jetson-tk1/jetson-tk1.c +++ b/board/nvidia/jetson-tk1/jetson-tk1.c @@ -11,6 +11,7 @@ #include #include +#include #include "pinmux-config-jetson-tk1.h" @@ -79,3 +80,10 @@ int board_eth_init(bd_t *bis) return pci_eth_init(bis); } #endif /* PCI */ + +int ft_board_setup(void *blob, bd_t *bd) +{ + gpu_enable_node(blob, "/gpu@0,57000000"); + + return 0; +} diff --git a/board/nvidia/venice2/venice2.c b/board/nvidia/venice2/venice2.c index c56ef129d6c7..3e2b9a7745e9 100644 --- a/board/nvidia/venice2/venice2.c +++ b/board/nvidia/venice2/venice2.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "pinmux-config-venice2.h" /* @@ -27,3 +28,10 @@ void pinmux_init(void) pinmux_config_drvgrp_table(venice2_drvgrps, ARRAY_SIZE(venice2_drvgrps)); } + +int ft_board_setup(void *blob, bd_t *bd) +{ + gpu_enable_node(blob, "/gpu@0,57000000"); + + return 0; +} diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h index 3bbff282df27..b3e649664508 100644 --- a/include/configs/jetson-tk1.h +++ b/include/configs/jetson-tk1.h @@ -82,4 +82,6 @@ #define CONFIG_ARMV7_SECURE_BASE 0xfff00000 #define CONFIG_ARMV7_SECURE_RESERVE_SIZE 0x00100000 +#define CONFIG_OF_BOARD_SETUP + #endif /* __CONFIG_H */ diff --git a/include/configs/venice2.h b/include/configs/venice2.h index 1d9d053b3566..bc5080aa27f0 100644 --- a/include/configs/venice2.h +++ b/include/configs/venice2.h @@ -64,4 +64,6 @@ #include "tegra-common-usb-gadget.h" #include "tegra-common-post.h" +#define CONFIG_OF_BOARD_SETUP + #endif /* __CONFIG_H */