Re: [RFC] ARM: OMAP3: Add device tree and pdata hooks to enable SGX on OMAP3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Adam,

On 09/02/2016 02:25 PM, aford173@xxxxxxxxx wrote:
> From: Adam Ford <aford173@xxxxxxxxx>
> 
> 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 {

You are missing one zero

> +			compatible = "ti,sgx";

This is way too generic compatible. I suggest you take a look at the TI
tree once and binding.

> +			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,
> +	},
> +	{ }
> +};

OMAP3 should be DT-boot only now, so you can remove the legacy-style
addr_space

> +
> +/* 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 <linux/platform_data/iommu-omap.h>
>  #include <linux/platform_data/wkup_m3.h>
>  #include <linux/platform_data/pwm_omap_dmtimer.h>
> +#include <linux/platform_data/sgx-omap.h>
>  #include <plat/dmtimer.h>
>  
>  #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,

you would need the .assert_reset hook as well. Otherwise, the driver is
not doing a clean job of balancing the resets when you install and
remove the module.

> +};
> +
>  #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),

looks like spaces (guessing manual copy-paste), please make sure you run
checkpatch.

>  #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 <detheridge@xxxxxx>
> + *
> + * 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 <linux/platform_device.h>
> +
> +struct gfx_sgx_platform_data {
> +	const char *reset_name;
> +
> +	int (*deassert_reset)(struct platform_device *pdev, const char *name);

missing assert_reset ops.

regards
Suman

> +};
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux