All of lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
@ 2021-01-05 14:13 Hans-Frieder Vogt
  0 siblings, 0 replies; 7+ messages in thread
From: Hans-Frieder Vogt @ 2021-01-05 14:13 UTC (permalink / raw)
  To: david; +Cc: linux-kernel

Hi David,

since you introduced a configuration parameter which was implicitly true before, the config parameter now needs to be explicitly set to true for all SoCs which have cfg registers (specifically AM33XX and AM57XX), see below.

On Mon, Jan 4, 2021, David Lechner wrote:
> This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
> doesn't have a CFG register, so that is made optional as selected by
> the device tree compatible string.
>
> ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
> on that platform.
>
> Signed-off-by: David Lechner <david@lechnology.com>

... shortened ...

> @@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev)
>  }
>
>  /* instance-specific driver private data */
> +static const struct pruss_private_data am18xx_pruss_data = {
> +	.has_no_sharedram = true,
> +};
> +
>  static const struct pruss_private_data am437x_pruss1_data = {
>  	.has_no_sharedram = false,
> +	.has_cfg = true,
>  };
>
>  static const struct pruss_private_data am437x_pruss0_data = {
>  	.has_no_sharedram = true,
> +	.has_cfg = true,
>  };
>
>  static const struct pruss_private_data am65x_j721e_pruss_data = {
>  	.has_core_mux_clock = true,
> +	.has_cfg = true,
>  };
>
>  static const struct of_device_id pruss_of_match[] = {
> +	{ .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, },
>  	{ .compatible = "ti,am3356-pruss" },

needs something like:
 	{ .compatible = "ti,am3356-pruss", .data = &am33xx_am57xx_pruss_data, },
 	{ .compatible = "ti,am5728-pruss", .data = &am33xx_am57xx_pruss_data, },
with
 static const struct pruss_private_data am33xx_am57xx_pruss_data = {
	.has_cfg = true,
 };

>  	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
>  	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },

---
Best regards,
Hans-Frieder

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
  2021-01-16  0:52     ` Suman Anna
@ 2021-01-16 20:15       ` David Lechner
  -1 siblings, 0 replies; 7+ messages in thread
From: David Lechner @ 2021-01-16 20:15 UTC (permalink / raw)
  To: Suman Anna, linux-arm-kernel
  Cc: Rob Herring, Santosh Shilimkar, Grzegorz Jaszczyk, Sekhar Nori,
	Bartosz Golaszewski, devicetree, linux-kernel

On 1/15/21 6:52 PM, Suman Anna wrote:
> Hi David,
> 
> On 1/4/21 12:30 PM, David Lechner wrote:
>> This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
>> doesn't have a CFG register, so that is made optional as selected by
>> the device tree compatible string.
>>
>> ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
>> on that platform.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>   drivers/soc/ti/Kconfig |  2 +-
>>   drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
>>   2 files changed, 45 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
>> index 7e2fb1c16af1..7a692a21480a 100644
>> --- a/drivers/soc/ti/Kconfig
>> +++ b/drivers/soc/ti/Kconfig
>> @@ -85,7 +85,7 @@ config TI_K3_SOCINFO
>>   
>>   config TI_PRUSS
>>   	tristate "TI PRU-ICSS Subsystem Platform drivers"
>> -	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>> +	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>>   	select MFD_SYSCON
>>   	help
>>   	  TI PRU-ICSS Subsystem platform specific support.
>> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
>> index 5d6e7132a5c4..bfaf3ff74b01 100644
>> --- a/drivers/soc/ti/pruss.c
>> +++ b/drivers/soc/ti/pruss.c
>> @@ -24,10 +24,12 @@
>>    * struct pruss_private_data - PRUSS driver private data
>>    * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
>>    * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
>> + * @has_cfg: flag to indicate the presence of PRUSS CFG registers
> 
> I recommend to change this to a negative flag as the Davinci platforms are the
> only ones that don't have CFG (being the very first SoCs with a PRUSS IP)
> sub-module.

Negative flags hurt my brain. :-)

I was actually thinking about submitting a patch to convert
has_no_sharedram to a positive flag as well. But I understand
the sentiment of only setting the flag true for the odd case
rather than the usual case.

> 
>>    */
>>   struct pruss_private_data {
>>   	bool has_no_sharedram;
>>   	bool has_core_mux_clock;
>> +	bool has_cfg;
>>   };
>>   
>>   static void pruss_of_free_clk_provider(void *data)
>> @@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
>>   		goto rpm_disable;
>>   	}
>>   
> 
> And use it here to skip all the cfg code parsing. All the below delta is just
> for the additional indentation for the flag. If you don't like goto's in
> non-error paths, then we can refactor the CFG parse code into a separate function.
> 

Refactoring to a separate function sounds good to me.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
@ 2021-01-16 20:15       ` David Lechner
  0 siblings, 0 replies; 7+ messages in thread
From: David Lechner @ 2021-01-16 20:15 UTC (permalink / raw)
  To: Suman Anna, linux-arm-kernel
  Cc: devicetree, Grzegorz Jaszczyk, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Rob Herring, Santosh Shilimkar

On 1/15/21 6:52 PM, Suman Anna wrote:
> Hi David,
> 
> On 1/4/21 12:30 PM, David Lechner wrote:
>> This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
>> doesn't have a CFG register, so that is made optional as selected by
>> the device tree compatible string.
>>
>> ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
>> on that platform.
>>
>> Signed-off-by: David Lechner <david@lechnology.com>
>> ---
>>   drivers/soc/ti/Kconfig |  2 +-
>>   drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
>>   2 files changed, 45 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
>> index 7e2fb1c16af1..7a692a21480a 100644
>> --- a/drivers/soc/ti/Kconfig
>> +++ b/drivers/soc/ti/Kconfig
>> @@ -85,7 +85,7 @@ config TI_K3_SOCINFO
>>   
>>   config TI_PRUSS
>>   	tristate "TI PRU-ICSS Subsystem Platform drivers"
>> -	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>> +	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>>   	select MFD_SYSCON
>>   	help
>>   	  TI PRU-ICSS Subsystem platform specific support.
>> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
>> index 5d6e7132a5c4..bfaf3ff74b01 100644
>> --- a/drivers/soc/ti/pruss.c
>> +++ b/drivers/soc/ti/pruss.c
>> @@ -24,10 +24,12 @@
>>    * struct pruss_private_data - PRUSS driver private data
>>    * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
>>    * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
>> + * @has_cfg: flag to indicate the presence of PRUSS CFG registers
> 
> I recommend to change this to a negative flag as the Davinci platforms are the
> only ones that don't have CFG (being the very first SoCs with a PRUSS IP)
> sub-module.

Negative flags hurt my brain. :-)

I was actually thinking about submitting a patch to convert
has_no_sharedram to a positive flag as well. But I understand
the sentiment of only setting the flag true for the odd case
rather than the usual case.

> 
>>    */
>>   struct pruss_private_data {
>>   	bool has_no_sharedram;
>>   	bool has_core_mux_clock;
>> +	bool has_cfg;
>>   };
>>   
>>   static void pruss_of_free_clk_provider(void *data)
>> @@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
>>   		goto rpm_disable;
>>   	}
>>   
> 
> And use it here to skip all the cfg code parsing. All the below delta is just
> for the additional indentation for the flag. If you don't like goto's in
> non-error paths, then we can refactor the CFG parse code into a separate function.
> 

Refactoring to a separate function sounds good to me.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
  2021-01-04 18:30   ` David Lechner
@ 2021-01-16  0:52     ` Suman Anna
  -1 siblings, 0 replies; 7+ messages in thread
From: Suman Anna @ 2021-01-16  0:52 UTC (permalink / raw)
  To: David Lechner, linux-arm-kernel
  Cc: Rob Herring, Santosh Shilimkar, Grzegorz Jaszczyk, Sekhar Nori,
	Bartosz Golaszewski, devicetree, linux-kernel

Hi David,

On 1/4/21 12:30 PM, David Lechner wrote:
> This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
> doesn't have a CFG register, so that is made optional as selected by
> the device tree compatible string.
> 
> ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
> on that platform.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>  drivers/soc/ti/Kconfig |  2 +-
>  drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
>  2 files changed, 45 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
> index 7e2fb1c16af1..7a692a21480a 100644
> --- a/drivers/soc/ti/Kconfig
> +++ b/drivers/soc/ti/Kconfig
> @@ -85,7 +85,7 @@ config TI_K3_SOCINFO
>  
>  config TI_PRUSS
>  	tristate "TI PRU-ICSS Subsystem Platform drivers"
> -	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
> +	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>  	select MFD_SYSCON
>  	help
>  	  TI PRU-ICSS Subsystem platform specific support.
> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
> index 5d6e7132a5c4..bfaf3ff74b01 100644
> --- a/drivers/soc/ti/pruss.c
> +++ b/drivers/soc/ti/pruss.c
> @@ -24,10 +24,12 @@
>   * struct pruss_private_data - PRUSS driver private data
>   * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
>   * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
> + * @has_cfg: flag to indicate the presence of PRUSS CFG registers

I recommend to change this to a negative flag as the Davinci platforms are the
only ones that don't have CFG (being the very first SoCs with a PRUSS IP)
sub-module.

>   */
>  struct pruss_private_data {
>  	bool has_no_sharedram;
>  	bool has_core_mux_clock;
> +	bool has_cfg;
>  };
>  
>  static void pruss_of_free_clk_provider(void *data)
> @@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
>  		goto rpm_disable;
>  	}
>  

And use it here to skip all the cfg code parsing. All the below delta is just
for the additional indentation for the flag. If you don't like goto's in
non-error paths, then we can refactor the CFG parse code into a separate function.

regards
Suman

> -	child = of_get_child_by_name(np, "cfg");
> -	if (!child) {
> -		dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
> -		ret = -ENODEV;
> -		goto rpm_put;
> -	}
> +	if (data->has_cfg) {
> +		child = of_get_child_by_name(np, "cfg");
> +		if (!child) {
> +			dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
> +			ret = -ENODEV;
> +			goto rpm_put;
> +		}
>  
> -	if (of_address_to_resource(child, 0, &res)) {
> -		ret = -ENOMEM;
> -		goto node_put;
> -	}
> +		if (of_address_to_resource(child, 0, &res)) {
> +			ret = -ENOMEM;
> +			goto node_put;
> +		}
>  
> -	pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
> -	if (!pruss->cfg_base) {
> -		ret = -ENOMEM;
> -		goto node_put;
> -	}
> +		pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
> +		if (!pruss->cfg_base) {
> +			ret = -ENOMEM;
> +			goto node_put;
> +		}
>  
> -	regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
> -				     (u64)res.start);
> -	regmap_conf.max_register = resource_size(&res) - 4;
> -
> -	pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
> -						  &regmap_conf);
> -	kfree(regmap_conf.name);
> -	if (IS_ERR(pruss->cfg_regmap)) {
> -		dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
> -			PTR_ERR(pruss->cfg_regmap));
> -		ret = PTR_ERR(pruss->cfg_regmap);
> -		goto node_put;
> -	}
> +		regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
> +					     (u64)res.start);
> +		regmap_conf.max_register = resource_size(&res) - 4;
> +
> +		pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
> +							  &regmap_conf);
> +		kfree(regmap_conf.name);
> +		if (IS_ERR(pruss->cfg_regmap)) {
> +			dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
> +				PTR_ERR(pruss->cfg_regmap));
> +			ret = PTR_ERR(pruss->cfg_regmap);
> +			goto node_put;
> +		}
>  
> -	ret = pruss_clk_init(pruss, child);
> -	if (ret) {
> -		dev_err(dev, "failed to setup coreclk-mux\n");
> -		goto node_put;
> +		ret = pruss_clk_init(pruss, child);
> +		if (ret) {
> +			dev_err(dev, "failed to setup coreclk-mux\n");
> +			goto node_put;
> +		}
>  	}
>  
>  	ret = devm_of_platform_populate(dev);
> @@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev)
>  }
>  
>  /* instance-specific driver private data */
> +static const struct pruss_private_data am18xx_pruss_data = {
> +	.has_no_sharedram = true,
> +};
> +
>  static const struct pruss_private_data am437x_pruss1_data = {
>  	.has_no_sharedram = false,
> +	.has_cfg = true,
>  };
>  
>  static const struct pruss_private_data am437x_pruss0_data = {
>  	.has_no_sharedram = true,
> +	.has_cfg = true,
>  };
>  
>  static const struct pruss_private_data am65x_j721e_pruss_data = {
>  	.has_core_mux_clock = true,
> +	.has_cfg = true,
>  };
>  
>  static const struct of_device_id pruss_of_match[] = {
> +	{ .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, },
>  	{ .compatible = "ti,am3356-pruss" },
>  	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
>  	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
@ 2021-01-16  0:52     ` Suman Anna
  0 siblings, 0 replies; 7+ messages in thread
From: Suman Anna @ 2021-01-16  0:52 UTC (permalink / raw)
  To: David Lechner, linux-arm-kernel
  Cc: devicetree, Grzegorz Jaszczyk, Sekhar Nori, linux-kernel,
	Bartosz Golaszewski, Rob Herring, Santosh Shilimkar

Hi David,

On 1/4/21 12:30 PM, David Lechner wrote:
> This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
> doesn't have a CFG register, so that is made optional as selected by
> the device tree compatible string.
> 
> ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
> on that platform.
> 
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>  drivers/soc/ti/Kconfig |  2 +-
>  drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
>  2 files changed, 45 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
> index 7e2fb1c16af1..7a692a21480a 100644
> --- a/drivers/soc/ti/Kconfig
> +++ b/drivers/soc/ti/Kconfig
> @@ -85,7 +85,7 @@ config TI_K3_SOCINFO
>  
>  config TI_PRUSS
>  	tristate "TI PRU-ICSS Subsystem Platform drivers"
> -	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
> +	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
>  	select MFD_SYSCON
>  	help
>  	  TI PRU-ICSS Subsystem platform specific support.
> diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
> index 5d6e7132a5c4..bfaf3ff74b01 100644
> --- a/drivers/soc/ti/pruss.c
> +++ b/drivers/soc/ti/pruss.c
> @@ -24,10 +24,12 @@
>   * struct pruss_private_data - PRUSS driver private data
>   * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
>   * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
> + * @has_cfg: flag to indicate the presence of PRUSS CFG registers

I recommend to change this to a negative flag as the Davinci platforms are the
only ones that don't have CFG (being the very first SoCs with a PRUSS IP)
sub-module.

>   */
>  struct pruss_private_data {
>  	bool has_no_sharedram;
>  	bool has_core_mux_clock;
> +	bool has_cfg;
>  };
>  
>  static void pruss_of_free_clk_provider(void *data)
> @@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
>  		goto rpm_disable;
>  	}
>  

And use it here to skip all the cfg code parsing. All the below delta is just
for the additional indentation for the flag. If you don't like goto's in
non-error paths, then we can refactor the CFG parse code into a separate function.

regards
Suman

> -	child = of_get_child_by_name(np, "cfg");
> -	if (!child) {
> -		dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
> -		ret = -ENODEV;
> -		goto rpm_put;
> -	}
> +	if (data->has_cfg) {
> +		child = of_get_child_by_name(np, "cfg");
> +		if (!child) {
> +			dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
> +			ret = -ENODEV;
> +			goto rpm_put;
> +		}
>  
> -	if (of_address_to_resource(child, 0, &res)) {
> -		ret = -ENOMEM;
> -		goto node_put;
> -	}
> +		if (of_address_to_resource(child, 0, &res)) {
> +			ret = -ENOMEM;
> +			goto node_put;
> +		}
>  
> -	pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
> -	if (!pruss->cfg_base) {
> -		ret = -ENOMEM;
> -		goto node_put;
> -	}
> +		pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
> +		if (!pruss->cfg_base) {
> +			ret = -ENOMEM;
> +			goto node_put;
> +		}
>  
> -	regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
> -				     (u64)res.start);
> -	regmap_conf.max_register = resource_size(&res) - 4;
> -
> -	pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
> -						  &regmap_conf);
> -	kfree(regmap_conf.name);
> -	if (IS_ERR(pruss->cfg_regmap)) {
> -		dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
> -			PTR_ERR(pruss->cfg_regmap));
> -		ret = PTR_ERR(pruss->cfg_regmap);
> -		goto node_put;
> -	}
> +		regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
> +					     (u64)res.start);
> +		regmap_conf.max_register = resource_size(&res) - 4;
> +
> +		pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
> +							  &regmap_conf);
> +		kfree(regmap_conf.name);
> +		if (IS_ERR(pruss->cfg_regmap)) {
> +			dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
> +				PTR_ERR(pruss->cfg_regmap));
> +			ret = PTR_ERR(pruss->cfg_regmap);
> +			goto node_put;
> +		}
>  
> -	ret = pruss_clk_init(pruss, child);
> -	if (ret) {
> -		dev_err(dev, "failed to setup coreclk-mux\n");
> -		goto node_put;
> +		ret = pruss_clk_init(pruss, child);
> +		if (ret) {
> +			dev_err(dev, "failed to setup coreclk-mux\n");
> +			goto node_put;
> +		}
>  	}
>  
>  	ret = devm_of_platform_populate(dev);
> @@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev)
>  }
>  
>  /* instance-specific driver private data */
> +static const struct pruss_private_data am18xx_pruss_data = {
> +	.has_no_sharedram = true,
> +};
> +
>  static const struct pruss_private_data am437x_pruss1_data = {
>  	.has_no_sharedram = false,
> +	.has_cfg = true,
>  };
>  
>  static const struct pruss_private_data am437x_pruss0_data = {
>  	.has_no_sharedram = true,
> +	.has_cfg = true,
>  };
>  
>  static const struct pruss_private_data am65x_j721e_pruss_data = {
>  	.has_core_mux_clock = true,
> +	.has_cfg = true,
>  };
>  
>  static const struct of_device_id pruss_of_match[] = {
> +	{ .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, },
>  	{ .compatible = "ti,am3356-pruss" },
>  	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
>  	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
  2021-01-04 18:30 [PATCH 0/2] Add support for TI " David Lechner
@ 2021-01-04 18:30   ` David Lechner
  0 siblings, 0 replies; 7+ messages in thread
From: David Lechner @ 2021-01-04 18:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: David Lechner, Rob Herring, Santosh Shilimkar, Suman Anna,
	Grzegorz Jaszczyk, Sekhar Nori, Bartosz Golaszewski, devicetree,
	linux-kernel

This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
doesn't have a CFG register, so that is made optional as selected by
the device tree compatible string.

ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
on that platform.

Signed-off-by: David Lechner <david@lechnology.com>
---
 drivers/soc/ti/Kconfig |  2 +-
 drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
 2 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 7e2fb1c16af1..7a692a21480a 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -85,7 +85,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
+	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 5d6e7132a5c4..bfaf3ff74b01 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -24,10 +24,12 @@
  * struct pruss_private_data - PRUSS driver private data
  * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
  * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
+ * @has_cfg: flag to indicate the presence of PRUSS CFG registers
  */
 struct pruss_private_data {
 	bool has_no_sharedram;
 	bool has_core_mux_clock;
+	bool has_cfg;
 };
 
 static void pruss_of_free_clk_provider(void *data)
@@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
 		goto rpm_disable;
 	}
 
-	child = of_get_child_by_name(np, "cfg");
-	if (!child) {
-		dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
-		ret = -ENODEV;
-		goto rpm_put;
-	}
+	if (data->has_cfg) {
+		child = of_get_child_by_name(np, "cfg");
+		if (!child) {
+			dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
+			ret = -ENODEV;
+			goto rpm_put;
+		}
 
-	if (of_address_to_resource(child, 0, &res)) {
-		ret = -ENOMEM;
-		goto node_put;
-	}
+		if (of_address_to_resource(child, 0, &res)) {
+			ret = -ENOMEM;
+			goto node_put;
+		}
 
-	pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
-	if (!pruss->cfg_base) {
-		ret = -ENOMEM;
-		goto node_put;
-	}
+		pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
+		if (!pruss->cfg_base) {
+			ret = -ENOMEM;
+			goto node_put;
+		}
 
-	regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
-				     (u64)res.start);
-	regmap_conf.max_register = resource_size(&res) - 4;
-
-	pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
-						  &regmap_conf);
-	kfree(regmap_conf.name);
-	if (IS_ERR(pruss->cfg_regmap)) {
-		dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
-			PTR_ERR(pruss->cfg_regmap));
-		ret = PTR_ERR(pruss->cfg_regmap);
-		goto node_put;
-	}
+		regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
+					     (u64)res.start);
+		regmap_conf.max_register = resource_size(&res) - 4;
+
+		pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
+							  &regmap_conf);
+		kfree(regmap_conf.name);
+		if (IS_ERR(pruss->cfg_regmap)) {
+			dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
+				PTR_ERR(pruss->cfg_regmap));
+			ret = PTR_ERR(pruss->cfg_regmap);
+			goto node_put;
+		}
 
-	ret = pruss_clk_init(pruss, child);
-	if (ret) {
-		dev_err(dev, "failed to setup coreclk-mux\n");
-		goto node_put;
+		ret = pruss_clk_init(pruss, child);
+		if (ret) {
+			dev_err(dev, "failed to setup coreclk-mux\n");
+			goto node_put;
+		}
 	}
 
 	ret = devm_of_platform_populate(dev);
@@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev)
 }
 
 /* instance-specific driver private data */
+static const struct pruss_private_data am18xx_pruss_data = {
+	.has_no_sharedram = true,
+};
+
 static const struct pruss_private_data am437x_pruss1_data = {
 	.has_no_sharedram = false,
+	.has_cfg = true,
 };
 
 static const struct pruss_private_data am437x_pruss0_data = {
 	.has_no_sharedram = true,
+	.has_cfg = true,
 };
 
 static const struct pruss_private_data am65x_j721e_pruss_data = {
 	.has_core_mux_clock = true,
+	.has_cfg = true,
 };
 
 static const struct of_device_id pruss_of_match[] = {
+	{ .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, },
 	{ .compatible = "ti,am3356-pruss" },
 	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS
@ 2021-01-04 18:30   ` David Lechner
  0 siblings, 0 replies; 7+ messages in thread
From: David Lechner @ 2021-01-04 18:30 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: devicetree, Grzegorz Jaszczyk, David Lechner, Sekhar Nori,
	linux-kernel, Bartosz Golaszewski, Rob Herring,
	Santosh Shilimkar

This adds support for the PRUSS found in AM18XX/OMAP-L138. This PRUSS
doesn't have a CFG register, so that is made optional as selected by
the device tree compatible string.

ARCH_DAVINCI is added in the Kconfig so that the driver can be selected
on that platform.

Signed-off-by: David Lechner <david@lechnology.com>
---
 drivers/soc/ti/Kconfig |  2 +-
 drivers/soc/ti/pruss.c | 76 ++++++++++++++++++++++++------------------
 2 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 7e2fb1c16af1..7a692a21480a 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -85,7 +85,7 @@ config TI_K3_SOCINFO
 
 config TI_PRUSS
 	tristate "TI PRU-ICSS Subsystem Platform drivers"
-	depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
+	depends on ARCH_DAVINCI || SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3
 	select MFD_SYSCON
 	help
 	  TI PRU-ICSS Subsystem platform specific support.
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index 5d6e7132a5c4..bfaf3ff74b01 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -24,10 +24,12 @@
  * struct pruss_private_data - PRUSS driver private data
  * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM
  * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock
+ * @has_cfg: flag to indicate the presence of PRUSS CFG registers
  */
 struct pruss_private_data {
 	bool has_no_sharedram;
 	bool has_core_mux_clock;
+	bool has_cfg;
 };
 
 static void pruss_of_free_clk_provider(void *data)
@@ -239,42 +241,44 @@ static int pruss_probe(struct platform_device *pdev)
 		goto rpm_disable;
 	}
 
-	child = of_get_child_by_name(np, "cfg");
-	if (!child) {
-		dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
-		ret = -ENODEV;
-		goto rpm_put;
-	}
+	if (data->has_cfg) {
+		child = of_get_child_by_name(np, "cfg");
+		if (!child) {
+			dev_err(dev, "%pOF is missing its 'cfg' node\n", child);
+			ret = -ENODEV;
+			goto rpm_put;
+		}
 
-	if (of_address_to_resource(child, 0, &res)) {
-		ret = -ENOMEM;
-		goto node_put;
-	}
+		if (of_address_to_resource(child, 0, &res)) {
+			ret = -ENOMEM;
+			goto node_put;
+		}
 
-	pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
-	if (!pruss->cfg_base) {
-		ret = -ENOMEM;
-		goto node_put;
-	}
+		pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res));
+		if (!pruss->cfg_base) {
+			ret = -ENOMEM;
+			goto node_put;
+		}
 
-	regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
-				     (u64)res.start);
-	regmap_conf.max_register = resource_size(&res) - 4;
-
-	pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
-						  &regmap_conf);
-	kfree(regmap_conf.name);
-	if (IS_ERR(pruss->cfg_regmap)) {
-		dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
-			PTR_ERR(pruss->cfg_regmap));
-		ret = PTR_ERR(pruss->cfg_regmap);
-		goto node_put;
-	}
+		regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child,
+					     (u64)res.start);
+		regmap_conf.max_register = resource_size(&res) - 4;
+
+		pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base,
+							  &regmap_conf);
+		kfree(regmap_conf.name);
+		if (IS_ERR(pruss->cfg_regmap)) {
+			dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n",
+				PTR_ERR(pruss->cfg_regmap));
+			ret = PTR_ERR(pruss->cfg_regmap);
+			goto node_put;
+		}
 
-	ret = pruss_clk_init(pruss, child);
-	if (ret) {
-		dev_err(dev, "failed to setup coreclk-mux\n");
-		goto node_put;
+		ret = pruss_clk_init(pruss, child);
+		if (ret) {
+			dev_err(dev, "failed to setup coreclk-mux\n");
+			goto node_put;
+		}
 	}
 
 	ret = devm_of_platform_populate(dev);
@@ -309,19 +313,27 @@ static int pruss_remove(struct platform_device *pdev)
 }
 
 /* instance-specific driver private data */
+static const struct pruss_private_data am18xx_pruss_data = {
+	.has_no_sharedram = true,
+};
+
 static const struct pruss_private_data am437x_pruss1_data = {
 	.has_no_sharedram = false,
+	.has_cfg = true,
 };
 
 static const struct pruss_private_data am437x_pruss0_data = {
 	.has_no_sharedram = true,
+	.has_cfg = true,
 };
 
 static const struct pruss_private_data am65x_j721e_pruss_data = {
 	.has_core_mux_clock = true,
+	.has_cfg = true,
 };
 
 static const struct of_device_id pruss_of_match[] = {
+	{ .compatible = "ti,am1806-pruss", .data = &am18xx_pruss_data, },
 	{ .compatible = "ti,am3356-pruss" },
 	{ .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, },
 	{ .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, },
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-01-16 20:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 14:13 [PATCH 2/2] soc: ti: pruss: add support for AM18XX/OMAP-L138 PRUSS Hans-Frieder Vogt
  -- strict thread matches above, loose matches on Subject: below --
2021-01-04 18:30 [PATCH 0/2] Add support for TI " David Lechner
2021-01-04 18:30 ` [PATCH 2/2] soc: ti: pruss: add support for " David Lechner
2021-01-04 18:30   ` David Lechner
2021-01-16  0:52   ` Suman Anna
2021-01-16  0:52     ` Suman Anna
2021-01-16 20:15     ` David Lechner
2021-01-16 20:15       ` David Lechner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.