[v5,08/10] reset: starfive: jh7110: Add StarFive STG/ISP/VOUT resets support

Message ID 20230424135409.6648-9-xingyu.wu@starfivetech.com
State New
Headers
Series Add STG/ISP/VOUT clock and reset drivers for StarFive JH7110 |

Commit Message

Xingyu Wu April 24, 2023, 1:54 p.m. UTC
  Add new struct members and auxiliary_device_id of resets to support
System-Top-Group, Image-Signal-Process and Video-Output on the StarFive
JH7110 SoC.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
---
 .../reset/starfive/reset-starfive-jh7110.c    | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
  

Comments

Andreas Schwab May 17, 2023, 1:19 p.m. UTC | #1
On Apr 24 2023, Xingyu Wu wrote:

> @@ -58,6 +76,18 @@ static const struct auxiliary_device_id jh7110_reset_ids[] = {
>  		.name = "clk_starfive_jh7110_sys.rst-aon",
>  		.driver_data = (kernel_ulong_t)&jh7110_aon_info,
>  	},
> +	{
> +		.name = "clk_starfive_jh7110_sys.rst-stg",
> +		.driver_data = (kernel_ulong_t)&jh7110_stg_info,
> +	},
> +	{
> +		.name = "clk_starfive_jh7110_sys.rst-isp",
> +		.driver_data = (kernel_ulong_t)&jh7110_isp_info,
> +	},
> +	{
> +		.name = "clk_starfive_jh7110_sys.rst-vout",

"clk_starfive_jh7110_sys.rst-vout" is exactly AUXILIARY_NAME_SIZE long,
thus lacks a null termination.
  
Xingyu Wu May 18, 2023, 1:22 a.m. UTC | #2
On 2023/5/17 21:19, Andreas Schwab wrote:
> On Apr 24 2023, Xingyu Wu wrote:
> 
>> @@ -58,6 +76,18 @@ static const struct auxiliary_device_id jh7110_reset_ids[] = {
>>  		.name = "clk_starfive_jh7110_sys.rst-aon",
>>  		.driver_data = (kernel_ulong_t)&jh7110_aon_info,
>>  	},
>> +	{
>> +		.name = "clk_starfive_jh7110_sys.rst-stg",
>> +		.driver_data = (kernel_ulong_t)&jh7110_stg_info,
>> +	},
>> +	{
>> +		.name = "clk_starfive_jh7110_sys.rst-isp",
>> +		.driver_data = (kernel_ulong_t)&jh7110_isp_info,
>> +	},
>> +	{
>> +		.name = "clk_starfive_jh7110_sys.rst-vout",
> 
> "clk_starfive_jh7110_sys.rst-vout" is exactly AUXILIARY_NAME_SIZE long,
> thus lacks a null termination.
> 

Yeah, it should be modified to "clk_starfive_jh7110_sys.rst-vo" in this and
use "rst-vo" instead of "rst-vout" in the probe of vout clock driver.
Then it will work.

Best regards,
Xingyu Wu
  

Patch

diff --git a/drivers/reset/starfive/reset-starfive-jh7110.c b/drivers/reset/starfive/reset-starfive-jh7110.c
index 2d26ae95c8cc..1e44fe7551f5 100644
--- a/drivers/reset/starfive/reset-starfive-jh7110.c
+++ b/drivers/reset/starfive/reset-starfive-jh7110.c
@@ -31,6 +31,24 @@  static const struct jh7110_reset_info jh7110_aon_info = {
 	.status_offset = 0x3C,
 };
 
+static const struct jh7110_reset_info jh7110_stg_info = {
+	.nr_resets = JH7110_STGRST_END,
+	.assert_offset = 0x74,
+	.status_offset = 0x78,
+};
+
+static const struct jh7110_reset_info jh7110_isp_info = {
+	.nr_resets = JH7110_ISPRST_END,
+	.assert_offset = 0x38,
+	.status_offset = 0x3C,
+};
+
+static const struct jh7110_reset_info jh7110_vout_info = {
+	.nr_resets = JH7110_VOUTRST_END,
+	.assert_offset = 0x48,
+	.status_offset = 0x4C,
+};
+
 static int jh7110_reset_probe(struct auxiliary_device *adev,
 			      const struct auxiliary_device_id *id)
 {
@@ -58,6 +76,18 @@  static const struct auxiliary_device_id jh7110_reset_ids[] = {
 		.name = "clk_starfive_jh7110_sys.rst-aon",
 		.driver_data = (kernel_ulong_t)&jh7110_aon_info,
 	},
+	{
+		.name = "clk_starfive_jh7110_sys.rst-stg",
+		.driver_data = (kernel_ulong_t)&jh7110_stg_info,
+	},
+	{
+		.name = "clk_starfive_jh7110_sys.rst-isp",
+		.driver_data = (kernel_ulong_t)&jh7110_isp_info,
+	},
+	{
+		.name = "clk_starfive_jh7110_sys.rst-vout",
+		.driver_data = (kernel_ulong_t)&jh7110_vout_info,
+	},
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(auxiliary, jh7110_reset_ids);