diff options
author | Sam Protsenko <semen.protsenko@linaro.org> | 2019-05-20 17:20:53 +0300 |
---|---|---|
committer | Sam Protsenko <semen.protsenko@linaro.org> | 2019-05-25 01:40:28 +0300 |
commit | 8161359590f689d43a62d72cc9dbae404f5cdaa8 (patch) | |
tree | 5130fa02eb9d33d59641451fc05468a8c5d7129d | |
parent | 7244da2f2bbc98071f525bd823c1ef6e3229c8b2 (diff) |
arch: arm: Enable SGX in device tree
Port next patches from TI Android kernel v4.19 in order to enable
SGX kernel module in device tree:
1. ARM: dts: DRA7xx: add device tree entry for SGX
2. ARM: dts: AM57x: enable SGX node
3. dt-bindings: gpu: add binding for TI SGX driver
4. ARM: DRA7: Add gpu hwmod data
5. ARM: OMAP2+: Use pdata-quirks for sgx deassert hardreset
Those patches were ported from "graphics-ti-linux-4.19.y" integration
branch.
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/gpu/ti-sgx.txt | 45 | ||||
-rw-r--r-- | arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/am57xx-idk-common.dtsi | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/dra7.dtsi | 12 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_7xx_data.c | 43 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pdata-quirks.c | 13 | ||||
-rw-r--r-- | include/linux/platform_data/sgx-omap.h | 22 |
7 files changed, 143 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/gpu/ti-sgx.txt b/Documentation/devicetree/bindings/gpu/ti-sgx.txt new file mode 100644 index 000000000000..53350d61008b --- /dev/null +++ b/Documentation/devicetree/bindings/gpu/ti-sgx.txt @@ -0,0 +1,45 @@ +Texas Instruments SGX 3D Graphics Processing Unit + +SGX is a 3D Graphics Processing Unit from Imagination Technologies. SGX is +codename for 5th generation / Series 5 of PowerVR chipset family. This binding +describes PowerVR SGX GPU integrated in Texas Instrument SoCs. + +Required properties: + - compatible : value should take the following format: + "ti,<soc>-<gpuversion>", "img,<gpuversion>" + + accepted values: + (a) "ti,am3352-sgx530", "img,sgx530" for TI AM33x + (b) "ti,am4376-sgx530", "img,sgx530" for TI AM43x + (c) "ti,dra7-sgx544", "img,sgx544" for TI DRA7xx / AM57x + (d) "ti,am654-sgx544", "img,sgx544" for TI AM654 + - reg: base address and length of the SGX registers + - interrupts : SGX interrupt number + - ti,hwmods: Name of the hwmod associated with the SGX for non-AM654 devices + - power-domains: Power domain parameters of the SGX for AM654 devices + - clocks : from SoC clock binding + +Optional properties: + - reg-names : names of registers listed in reg property in same order + - clock-names : names of clocks listed in clocks property in the same order + +Examples: + sgx@56000000 { + compatible = "ti,dra7-sgx544", "img,sgx544"; + reg = <0x56000000 0x10000>; + reg-names = "gpu_ocp_base"; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + ti,hwmods = "gpu"; + clocks = <&l3_iclk_div>, <&gpu_core_gclk_mux>, + <&gpu_hyd_gclk_mux>; + clock-names = "iclk", "fclk1", "fclk2"; + }; + + gpu@7000000 { + compatible = "ti,am654-sgx544", "img,sgx544"; + reg = <0x0 0x7000000 0x0 0x10000>; + interrupts = <GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&k3_pds 65>; + clocks = <&k3_clks 65 0>, <&k3_clks 65 1>, <&k3_clks 65 2>, <&k3_clks 65 3>; + clock-names = "mem_clk", "hyd_clk", "sgx_clk", "sys_clk"; + }; diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi index 5dabcab5c30b..be76dab04d24 100644 --- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi @@ -528,6 +528,10 @@ }; }; +&gpu { + status = "ok"; +}; + &dss { status = "ok"; diff --git a/arch/arm/boot/dts/am57xx-idk-common.dtsi b/arch/arm/boot/dts/am57xx-idk-common.dtsi index f7bd26458915..665b7b8f53f1 100644 --- a/arch/arm/boot/dts/am57xx-idk-common.dtsi +++ b/arch/arm/boot/dts/am57xx-idk-common.dtsi @@ -492,3 +492,7 @@ &cpu0 { vdd-supply = <&smps12_reg>; }; + +&gpu { + status = "ok"; +}; diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi index 2bc9add8b7a5..02f7a87cf288 100644 --- a/arch/arm/boot/dts/dra7.dtsi +++ b/arch/arm/boot/dts/dra7.dtsi @@ -611,6 +611,18 @@ ti,irqs-safe-map = <0>; }; + gpu: gpu@56000000 { + compatible = "ti,dra7-sgx544", "img,sgx544"; + reg = <0x56000000 0x10000>; + reg-names = "gpu_ocp_base"; + interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>; + ti,hwmods = "gpu"; + clocks = <&l3_iclk_div>, <&gpu_core_gclk_mux>, + <&gpu_hyd_gclk_mux>; + clock-names = "iclk", "fclk1", "fclk2"; + status = "disabled"; + }; + dss: dss@58000000 { compatible = "ti,dra7-dss"; /* 'reg' defined in dra72x.dtsi and dra74x.dtsi */ diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c index e6c7061a8e73..f5603a0b6181 100644 --- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c @@ -1029,6 +1029,40 @@ static struct omap_hwmod dra7xx_gpmc_hwmod = { }; /* + * 'gpu' class + * 3d graphics accelerator + */ + +static struct omap_hwmod_class_sysconfig dra7xx_gpu_sysc = { + .rev_offs = 0xfe00, + .sysc_offs = 0xfe10, + .sysc_flags = (SYSC_HAS_MIDLEMODE | SYSC_HAS_SIDLEMODE), + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART | + SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO | + MSTANDBY_SMART | MSTANDBY_SMART_WKUP), + .sysc_fields = &omap_hwmod_sysc_type2, +}; + +static struct omap_hwmod_class dra7xx_gpu_hwmod_class = { + .name = "gpu", + .sysc = &dra7xx_gpu_sysc, +}; + +static struct omap_hwmod dra7xx_gpu_hwmod = { + .name = "gpu", + .class = &dra7xx_gpu_hwmod_class, + .clkdm_name = "gpu_clkdm", + .main_clk = "gpu_core_gclk_mux", + .prcm = { + .omap4 = { + .clkctrl_offs = DRA7XX_CM_GPU_GPU_CLKCTRL_OFFSET, + .context_offs = DRA7XX_RM_GPU_GPU_CONTEXT_OFFSET, + .modulemode = MODULEMODE_SWCTRL, + }, + }, +}; + +/* * 'hdq1w' class * */ @@ -3185,6 +3219,14 @@ static struct omap_hwmod_ocp_if dra7xx_l3_main_1__gpmc = { .user = OCP_USER_MPU | OCP_USER_SDMA, }; +/* l3_main_1 -> gpu */ +static struct omap_hwmod_ocp_if dra7xx_l3_main_1__gpu = { + .master = &dra7xx_l3_main_1_hwmod, + .slave = &dra7xx_gpu_hwmod, + .clk = "l3_iclk_div", + .user = OCP_USER_MPU | OCP_USER_SDMA, +}; + /* l4_per1 -> hdq1w */ static struct omap_hwmod_ocp_if dra7xx_l4_per1__hdq1w = { .master = &dra7xx_l4_per1_hwmod, @@ -3875,6 +3917,7 @@ static struct omap_hwmod_ocp_if *dra7xx_hwmod_ocp_ifs[] __initdata = { &dra7xx_l4_per1__gpio7, &dra7xx_l4_per1__gpio8, &dra7xx_l3_main_1__gpmc, + &dra7xx_l3_main_1__gpu, &dra7xx_l4_per1__hdq1w, &dra7xx_l4_per1__i2c1, &dra7xx_l4_per1__i2c2, diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index a2ecc5e69abb..624aa0db03b1 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -28,6 +28,7 @@ #include <linux/platform_data/ti-sysc.h> #include <linux/platform_data/wkup_m3.h> #include <linux/platform_data/asoc-ti-mcbsp.h> +#include <linux/platform_data/sgx-omap.h> #include "common.h" #include "common-board-devices.h" @@ -47,6 +48,14 @@ struct pdata_init { static struct of_dev_auxdata omap_auxdata_lookup[]; static struct twl4030_gpio_platform_data twl_gpio_auxdata; +#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX) +static struct gfx_sgx_platform_data sgx_pdata = { + .reset_name = "gfx", + .assert_reset = omap_device_assert_hardreset, + .deassert_reset = omap_device_deassert_hardreset, +}; +#endif + #ifdef CONFIG_MACH_NOKIA_N8X0 static void __init omap2420_n8x0_legacy_init(void) { @@ -579,10 +588,14 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = { #ifdef CONFIG_SOC_AM33XX OF_DEV_AUXDATA("ti,am3352-wkup-m3", 0x44d00000, "44d00000.wkup_m3", &wkup_m3_data), + OF_DEV_AUXDATA("ti,am3352-sgx530", 0x56000000, "56000000.sgx", + &sgx_pdata), #endif #ifdef CONFIG_SOC_AM43XX OF_DEV_AUXDATA("ti,am4372-wkup-m3", 0x44d00000, "44d00000.wkup_m3", &wkup_m3_data), + OF_DEV_AUXDATA("ti,am4376-sgx530", 0x56000000, "56000000.sgx", + &sgx_pdata), #endif #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu", diff --git a/include/linux/platform_data/sgx-omap.h b/include/linux/platform_data/sgx-omap.h new file mode 100644 index 000000000000..e40c4e5e820d --- /dev/null +++ b/include/linux/platform_data/sgx-omap.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * SGX Graphics Driver Platform Data + * + * Copyright (C) 2014-2019 Texas Instruments Incorporated - http://www.ti.com/ + * Darren Etheridge <detheridge@ti.com> + * + */ + +#ifndef __SGX_OMAP_H__ +#define __SGX_OMAP_H__ + +#include <linux/platform_device.h> + +struct gfx_sgx_platform_data { + const char *reset_name; + + int (*assert_reset)(struct platform_device *pdev, const char *name); + int (*deassert_reset)(struct platform_device *pdev, const char *name); +}; + +#endif |