From patchwork Fri Sep 2 19:25:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 9311537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90D1C607D2 for ; Fri, 2 Sep 2016 19:25:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E897297CC for ; Fri, 2 Sep 2016 19:25:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F3AE2981D; Fri, 2 Sep 2016 19:25:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39FD4297CC for ; Fri, 2 Sep 2016 19:25:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754223AbcIBTZO (ORCPT ); Fri, 2 Sep 2016 15:25:14 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:33151 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753308AbcIBTZN (ORCPT ); Fri, 2 Sep 2016 15:25:13 -0400 Received: by mail-it0-f66.google.com with SMTP id g185so2870952ith.0 for ; Fri, 02 Sep 2016 12:25:13 -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; bh=Afw+0acCyiXYcuO2BDglhTu9xH0xgbbD1QdUYfav9n8=; b=gAdvs/UdwKKTqS84O2XmI71PmKTc1RWcYFaqt/kbAmUlZaNLHKemU8GDgk7EIgL3G4 g7vLLD0b9/S1/zAo9GE6YAuoAgDrqRAebq3TYR1VSXtu2tTFrnRO03+wPZzaUW9ov9S+ ZggQpisGNL8x8RAYeaEGUf0T/5/DNPgb38t+xKiTs9tWGa6RkSYYmV8XX+5VNo4BTefo GSiDn60SUOlDUEtrx2/BADRzfMh0u8dJXBHeWS0bxbrH24qELD5j+9smXw+ExZscyZzF ZYS8AiF5tOb9suzWzM48aPEVRpOqv4oe/QApxDFk9f96U6MD47MuNDwMk8W2ND5CQ5cT 74Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Afw+0acCyiXYcuO2BDglhTu9xH0xgbbD1QdUYfav9n8=; b=klOXvohJli7wM2lNZSb9zMRNLFUvBsIdYbVuE5+QFjXIBPy6aGHUmssm5AQEjNpB2H MpwQr2S1xoDcKbsA6Ya5KZK+2kbDuc1+a9MhGRO7tPrO3hkRpf/FW/2rnb5s5COkcj8K jcQCFtGxLlYQCjdIFhihvnBLgyKjljyd3OTTPtZLMsK/0gcPVZ51GExyG6tAC5R0Je7Z pTVYpa4DMRpAjxc7LlR+ZhRlYC/z+dnLxAoP9GB931Fx6IxREcOSM1dK7/lQozKaLquD a1nmx3d/0uefJub7ucGK62mayCGQ2BTCnu2GkjIQV93WUQEQNhKmpPkdcVPG6O0C2okH j9SA== X-Gm-Message-State: AE9vXwPVaBs9KBkSMHTTo89F5ZCOHP876XURyVZNcxNHa+jTkGzIVxn4yhH3pZCu6PRCqg== X-Received: by 10.107.171.135 with SMTP id u129mr975649ioe.30.1472844312891; Fri, 02 Sep 2016 12:25:12 -0700 (PDT) Received: from logic-VirtualBox.logicpd.com (66-162-60-14.static.twtelecom.net. [66.162.60.14]) by smtp.gmail.com with ESMTPSA id o188sm3096018itg.11.2016.09.02.12.25.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Sep 2016 12:25:12 -0700 (PDT) From: aford173@gmail.com To: linux-omap@vger.kernel.org Cc: t-kristo@ti.com, msprathap@ti.com, tony@atomide.com, s-anna@ti.com, Adam Ford Subject: [RFC] ARM: OMAP3: Add device tree and pdata hooks to enable SGX on OMAP3 Date: Fri, 2 Sep 2016 14:25:08 -0500 Message-Id: <1472844308-10331-1-git-send-email-aford173@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Adam Ford Sorry about the wordy email. The reset controller stuff needs an overhaul, but this is an attempt to allow the last revision of the SGX driver to work with a modern kernel. Unfortunately, I get an error when I build the SGX driver: pvrsrvkm pvrsrvkm: SGX Platform data missing deassert_reset! So it's obviously missing something. If someone can point me in the righ direction. I need to deassert that by writing to a register but I am not sure exactly how to go about that. On the DM3730 I am using it appears to be RM_RSTST_SGX but this is is inconsistent with the SGX notes in section 8.2.1.2 of the DM3730 TRM. I want to make sure the SGX_FCLK is properly set to which I beleive shoudld 192MHz, but I am not sure which macros are the proper ones. diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 8a2b253..3f69d90 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi @@ -564,6 +564,14 @@ status = "disabled"; }; + sgx: sgx@5000000 { + compatible = "ti,sgx"; + ti,hwmods = "gfx"; + reg = <0x50000000 0x1000000>; + interrupts = <21>; + /* resets = <&prcm 0>; */ + }; + sham: sham@480c3000 { compatible = "ti,omap3-sham"; ti,hwmods = "sham"; diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index aff78d5..ca2fbb3 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c @@ -3654,6 +3654,52 @@ static struct omap_hwmod_ocp_if omap34xx_l4_core__ssi = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; + +/* gfx */ +/* Pseudo hwmod for reset control purpose only */ + + +static struct omap_hwmod_class omap3xxx_gfx_hwmod_class = { + .name = "sgx", +}; + +static struct omap_hwmod_rst_info omap3xxx_gfx_resets[] = { + { .name = "sgx", .rst_shift = 0, .st_shift = 0}, +}; + +struct omap_hwmod omap3xx_gfx_hwmod = { + .name = "sgx", + .class = &omap3xxx_gfx_hwmod_class, + .clkdm_name = "sgx_clkdm", + .main_clk = "sgx_fck", + .prcm = { + .omap2 = { + .module_offs = OMAP3430ES2_SGX_MOD, + .prcm_reg_id = 1, + .module_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT, + } + }, + .rst_lines = omap3xxx_gfx_resets, + .rst_lines_cnt = ARRAY_SIZE(omap3xxx_gfx_resets), +}; + +static struct omap_hwmod_addr_space omap3xxx_sgx_addrs[] = { + { + .pa_start = 0x50000000, + .pa_end = 0x5000ff0c, + .flags = ADDR_TYPE_RT, + }, + { } +}; + +/* l3_main -> sgx */ +static struct omap_hwmod_ocp_if omap3xxx_l3_main__sgx = { + .master = &omap3xxx_l3_main_hwmod, + .slave = &omap3xx_gfx_hwmod, + .addr = omap3xxx_sgx_addrs, + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { &omap3xxx_l3_main__l4_core, &omap3xxx_l3_main__l4_per, @@ -3701,6 +3747,7 @@ static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { &omap34xx_l4_core__mcspi4, &omap3xxx_l4_wkup__counter_32k, &omap3xxx_l3_main__gpmc, + &omap3xxx_l3_main__sgx, NULL, }; diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 339b859..b700f26 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "common.h" @@ -382,6 +383,12 @@ static void __init omap3_pandora_legacy_init(void) omap_hsmmc_late_init(pandora_mmc3); pandora_wl1251_init(); } + +static struct gfx_sgx_platform_data gfx_pdata = { + .reset_name = "sgx", + .deassert_reset = omap_device_deassert_hardreset, +}; + #endif /* CONFIG_ARCH_OMAP3 */ #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) @@ -479,6 +486,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0", &am35xx_emac_pdata), + OF_DEV_AUXDATA("ti,sgx", 0x50000000, "50000000.sgx", + &gfx_pdata), #endif #ifdef CONFIG_SOC_AM33XX OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3", diff --git a/include/linux/platform_data/sgx-omap.h b/include/linux/platform_data/sgx-omap.h new file mode 100644 index 0000000..aa59b2c --- /dev/null +++ b/include/linux/platform_data/sgx-omap.h @@ -0,0 +1,22 @@ +/* + * SGX Graphics Driver Platform Data + * + * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ + * Darren Etheridge + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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 + +struct gfx_sgx_platform_data { + const char *reset_name; + + int (*deassert_reset)(struct platform_device *pdev, const char *name); +};