diff mbox series

[RESEND,6/6] platform/x86/amd/pmc: Modify SMU message port for latest AMD platform

Message ID 20231227063749.1780900-7-Shyam-sundar.S-k@amd.com (mailing list archive)
State Changes Requested, archived
Headers show
Series platform/x86/amd/pmc: Updates to amd-pmc driver | expand

Commit Message

Shyam Sundar S K Dec. 27, 2023, 6:37 a.m. UTC
The latest platforms use a different SMU message port(0x938) from the one
currently being used (0x538). Make code changes to adapt to this new
information.

Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/platform/x86/amd/pmc/pmc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Ilpo Järvinen Dec. 27, 2023, 5:46 p.m. UTC | #1
On Wed, 27 Dec 2023, Shyam Sundar S K wrote:

> The latest platforms use a different SMU message port(0x938) from the one
> currently being used (0x538). Make code changes to adapt to this new
> information.
> 
> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>  drivers/platform/x86/amd/pmc/pmc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index c8d86dd392ce..acac2a4194d4 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -31,7 +31,6 @@
>  #include "pmc.h"
>  
>  /* SMU communication registers */
> -#define AMD_PMC_REGISTER_MESSAGE	0x538
>  #define AMD_PMC_REGISTER_RESPONSE	0x980
>  #define AMD_PMC_REGISTER_ARGUMENT	0x9BC
>  
> @@ -362,14 +361,17 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev)
>  	case AMD_CPU_ID_CB:
>  		dev->num_ips = 12;
>  		dev->s2d_msg_id = 0xBE;
> +		dev->smu_msg = 0x538;
>  		break;
>  	case AMD_CPU_ID_PS:
>  		dev->num_ips = 21;
>  		dev->s2d_msg_id = 0x85;
> +		dev->smu_msg = 0x538;
>  		break;
>  	case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT:
>  		dev->num_ips = 22;
>  		dev->s2d_msg_id = 0xDE;
> +		dev->smu_msg = 0x938;
>  		break;
>  	}
>  }
> @@ -673,7 +675,7 @@ static void amd_pmc_dump_registers(struct amd_pmc_dev *dev)
>  		argument = AMD_S2D_REGISTER_ARGUMENT;
>  		response = AMD_S2D_REGISTER_RESPONSE;
>  	} else {
> -		message = AMD_PMC_REGISTER_MESSAGE;
> +		message = dev->smu_msg;
>  		argument = AMD_PMC_REGISTER_ARGUMENT;
>  		response = AMD_PMC_REGISTER_RESPONSE;
>  	}
> @@ -700,7 +702,7 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
>  		argument = AMD_S2D_REGISTER_ARGUMENT;
>  		response = AMD_S2D_REGISTER_RESPONSE;
>  	} else {
> -		message = AMD_PMC_REGISTER_MESSAGE;
> +		message = dev->smu_msg;
>  		argument = AMD_PMC_REGISTER_ARGUMENT;
>  		response = AMD_PMC_REGISTER_RESPONSE;
>  	}
> 

You forgot to git add the field into the struct?
Shyam Sundar S K Dec. 28, 2023, 6:06 a.m. UTC | #2
Hi Ilpo,

On 12/27/2023 11:16 PM, Ilpo Järvinen wrote:
> On Wed, 27 Dec 2023, Shyam Sundar S K wrote:
> 
>> The latest platforms use a different SMU message port(0x938) from the one
>> currently being used (0x538). Make code changes to adapt to this new
>> information.
>>
>> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>> ---
>>  drivers/platform/x86/amd/pmc/pmc.c | 8 +++++---
>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
>> index c8d86dd392ce..acac2a4194d4 100644
>> --- a/drivers/platform/x86/amd/pmc/pmc.c
>> +++ b/drivers/platform/x86/amd/pmc/pmc.c
>> @@ -31,7 +31,6 @@
>>  #include "pmc.h"
>>  
>>  /* SMU communication registers */
>> -#define AMD_PMC_REGISTER_MESSAGE	0x538
>>  #define AMD_PMC_REGISTER_RESPONSE	0x980
>>  #define AMD_PMC_REGISTER_ARGUMENT	0x9BC
>>  
>> @@ -362,14 +361,17 @@ static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev)
>>  	case AMD_CPU_ID_CB:
>>  		dev->num_ips = 12;
>>  		dev->s2d_msg_id = 0xBE;
>> +		dev->smu_msg = 0x538;
>>  		break;
>>  	case AMD_CPU_ID_PS:
>>  		dev->num_ips = 21;
>>  		dev->s2d_msg_id = 0x85;
>> +		dev->smu_msg = 0x538;
>>  		break;
>>  	case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT:
>>  		dev->num_ips = 22;
>>  		dev->s2d_msg_id = 0xDE;
>> +		dev->smu_msg = 0x938;
>>  		break;
>>  	}
>>  }
>> @@ -673,7 +675,7 @@ static void amd_pmc_dump_registers(struct amd_pmc_dev *dev)
>>  		argument = AMD_S2D_REGISTER_ARGUMENT;
>>  		response = AMD_S2D_REGISTER_RESPONSE;
>>  	} else {
>> -		message = AMD_PMC_REGISTER_MESSAGE;
>> +		message = dev->smu_msg;
>>  		argument = AMD_PMC_REGISTER_ARGUMENT;
>>  		response = AMD_PMC_REGISTER_RESPONSE;
>>  	}
>> @@ -700,7 +702,7 @@ static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
>>  		argument = AMD_S2D_REGISTER_ARGUMENT;
>>  		response = AMD_S2D_REGISTER_RESPONSE;
>>  	} else {
>> -		message = AMD_PMC_REGISTER_MESSAGE;
>> +		message = dev->smu_msg;
>>  		argument = AMD_PMC_REGISTER_ARGUMENT;
>>  		response = AMD_PMC_REGISTER_RESPONSE;
>>  	}
>>
> 
> You forgot to git add the field into the struct?

ah! my bad :-( Will adjust this in v2.

Thanks,
Shyam
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index c8d86dd392ce..acac2a4194d4 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -31,7 +31,6 @@ 
 #include "pmc.h"
 
 /* SMU communication registers */
-#define AMD_PMC_REGISTER_MESSAGE	0x538
 #define AMD_PMC_REGISTER_RESPONSE	0x980
 #define AMD_PMC_REGISTER_ARGUMENT	0x9BC
 
@@ -362,14 +361,17 @@  static void amd_pmc_get_ip_info(struct amd_pmc_dev *dev)
 	case AMD_CPU_ID_CB:
 		dev->num_ips = 12;
 		dev->s2d_msg_id = 0xBE;
+		dev->smu_msg = 0x538;
 		break;
 	case AMD_CPU_ID_PS:
 		dev->num_ips = 21;
 		dev->s2d_msg_id = 0x85;
+		dev->smu_msg = 0x538;
 		break;
 	case PCI_DEVICE_ID_AMD_1AH_M20H_ROOT:
 		dev->num_ips = 22;
 		dev->s2d_msg_id = 0xDE;
+		dev->smu_msg = 0x938;
 		break;
 	}
 }
@@ -673,7 +675,7 @@  static void amd_pmc_dump_registers(struct amd_pmc_dev *dev)
 		argument = AMD_S2D_REGISTER_ARGUMENT;
 		response = AMD_S2D_REGISTER_RESPONSE;
 	} else {
-		message = AMD_PMC_REGISTER_MESSAGE;
+		message = dev->smu_msg;
 		argument = AMD_PMC_REGISTER_ARGUMENT;
 		response = AMD_PMC_REGISTER_RESPONSE;
 	}
@@ -700,7 +702,7 @@  static int amd_pmc_send_cmd(struct amd_pmc_dev *dev, u32 arg, u32 *data, u8 msg,
 		argument = AMD_S2D_REGISTER_ARGUMENT;
 		response = AMD_S2D_REGISTER_RESPONSE;
 	} else {
-		message = AMD_PMC_REGISTER_MESSAGE;
+		message = dev->smu_msg;
 		argument = AMD_PMC_REGISTER_ARGUMENT;
 		response = AMD_PMC_REGISTER_RESPONSE;
 	}