From 77c55836aac0e89822dee57c184aba811c399be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20R=C3=B6ssler?= Date: Fri, 1 Nov 2013 15:35:26 +0100 Subject: [PATCH 5/5] Changes according to TI for SGX support Signed-off-by: Robert Nelson --- arch/arm/mach-omap2/Makefile | 2 - arch/arm/mach-omap2/board-generic.c | 3 ++ arch/arm/mach-omap2/common.h | 1 arch/arm/mach-omap2/gpu.c | 47 ++++++++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 arch/arm/mach-omap2/gpu.c Index: linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/Makefile =================================================================== --- linux-3.12.24-rt38-r8s8.orig/arch/arm/mach-omap2/Makefile +++ linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/Makefile @@ -8,7 +8,7 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := # Common support obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \ common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ - omap_device.o sram.o + omap_device.o sram.o gpu.o omap-2-3-common = irq.o hwmod-common = omap_hwmod.o omap_hwmod_reset.o \ Index: linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/board-generic.c =================================================================== --- linux-3.12.24-rt38-r8s8.orig/arch/arm/mach-omap2/board-generic.c +++ linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/board-generic.c @@ -57,6 +57,9 @@ static void __init omap_generic_init(voi of_platform_populate(NULL, omap_dt_match_table, NULL, NULL); + if (omap3_has_sgx()) + omap_sgx_init_of(); + /* * HACK: call display setup code for selected boards to enable omapdss. * This will be removed when omapdss supports DT. Index: linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/common.h =================================================================== --- linux-3.12.24-rt38-r8s8.orig/arch/arm/mach-omap2/common.h +++ linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/common.h @@ -301,6 +301,7 @@ extern void omap_reserve(void); struct omap_hwmod; extern int omap_dss_reset(struct omap_hwmod *); +void __init omap_sgx_init_of(void); /* SoC specific clock initializer */ extern int (*omap_clk_init)(void); Index: linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/gpu.c =================================================================== --- /dev/null +++ linux-3.12.24-rt38-r8s8/arch/arm/mach-omap2/gpu.c @@ -0,0 +1,47 @@ +/* + * Deassert reset for AM33xx graphics device(SGX) hwmod + * + * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ + * Prathap MS + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include "omap_device.h" + +void __init omap_sgx_init_of(void) +{ + struct device_node *node; + struct platform_device *pdev; + int ret = 0; + node = of_find_compatible_node(NULL, NULL, "ti,sgx"); + if (!node) + return; + pdev = of_find_device_by_node(node); + if (!pdev) { + pr_warn("of_find_device_by_node() failed for sgx\n"); + return; + } + ret = omap_device_deassert_hardreset(pdev, "gfx"); + if (ret != 0) + pr_warn("omap_device_deassert_hardreset() failed for sgx(gfx hwmod)\n"); + + node = of_find_compatible_node(NULL, NULL, "ti,am335x-timer"); + if (!node) + return; + pdev = of_find_device_by_node(node); + if (!pdev) { + pr_warn("of_find_device_by_node() failed for sgx\n"); + return; + } + ret = omap_device_deassert_hardreset(pdev, "timer7"); + if (ret != 0) + pr_warn("omap_device_deassert_hardreset() failed for sgx(gfx hwmod)\n"); +}