* [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support
@ 2019-04-22 13:10 Pu Wen
2019-04-26 9:37 ` Jean Delvare
0 siblings, 1 reply; 5+ messages in thread
From: Pu Wen @ 2019-04-22 13:10 UTC (permalink / raw)
To: jdelvare, bp; +Cc: linux-i2c, linux-kernel, stable, Pu Wen
The Hygon Dhyana CPU has the SMBus device with PCI device ID 0x790b,
which is the same as AMD CZ SMBus device. So add Hygon Dhyana support
to the i2c-piix4 driver by using the code path of AMD.
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Pu Wen <puwen@hygon.cn>
---
drivers/i2c/busses/i2c-piix4.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 90946a8..9db9d9d 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -289,6 +289,9 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
PIIX4_dev->revision >= 0x41) ||
(PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
+ PIIX4_dev->revision >= 0x49) ||
+ (PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON &&
+ PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
PIIX4_dev->revision >= 0x49))
smb_en = 0x00;
else
@@ -361,7 +364,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
piix4_smba, i2ccfg >> 4);
/* Find which register is used for port selection */
- if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) {
+ if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD ||
+ PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) {
switch (PIIX4_dev->device) {
case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
@@ -794,6 +798,7 @@ static const struct pci_device_id piix4_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) },
+ { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) },
{ PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
PCI_DEVICE_ID_SERVERWORKS_OSB4) },
{ PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
@@ -904,11 +909,13 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
if ((dev->vendor == PCI_VENDOR_ID_ATI &&
dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
dev->revision >= 0x40) ||
- dev->vendor == PCI_VENDOR_ID_AMD) {
+ dev->vendor == PCI_VENDOR_ID_AMD ||
+ dev->vendor == PCI_VENDOR_ID_HYGON) {
bool notify_imc = false;
is_sb800 = true;
- if (dev->vendor == PCI_VENDOR_ID_AMD &&
+ if ((dev->vendor == PCI_VENDOR_ID_AMD ||
+ dev->vendor == PCI_VENDOR_ID_HYGON) &&
dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) {
u8 imc;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support
2019-04-22 13:10 [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support Pu Wen
@ 2019-04-26 9:37 ` Jean Delvare
2019-04-26 14:23 ` Pu Wen
0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2019-04-26 9:37 UTC (permalink / raw)
To: Pu Wen; +Cc: bp, linux-i2c, linux-kernel, stable
Hi Pu,
On Mon, 22 Apr 2019 21:10:07 +0800, Pu Wen wrote:
> The Hygon Dhyana CPU has the SMBus device with PCI device ID 0x790b,
> which is the same as AMD CZ SMBus device. So add Hygon Dhyana support
> to the i2c-piix4 driver by using the code path of AMD.
Sorry for the late answer.
> Cc: <stable@vger.kernel.org> # v5.0+
I object to adding this to stable. It's not fixing any bug, and it's
far from being a one-liner. I'd rather let distributions backport it as
they see fit.
> Signed-off-by: Pu Wen <puwen@hygon.cn>
> ---
> drivers/i2c/busses/i2c-piix4.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
> index 90946a8..9db9d9d 100644
> --- a/drivers/i2c/busses/i2c-piix4.c
> +++ b/drivers/i2c/busses/i2c-piix4.c
> @@ -289,6 +289,9 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
> PIIX4_dev->revision >= 0x41) ||
> (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD &&
> PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
> + PIIX4_dev->revision >= 0x49) ||
> + (PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON &&
> + PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
> PIIX4_dev->revision >= 0x49))
> smb_en = 0x00;
Does the compatibility with the original AMD chipset include the
revision number?
> else
> @@ -361,7 +364,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev,
> piix4_smba, i2ccfg >> 4);
>
> /* Find which register is used for port selection */
> - if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD) {
> + if (PIIX4_dev->vendor == PCI_VENDOR_ID_AMD ||
> + PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON) {
> switch (PIIX4_dev->device) {
> case PCI_DEVICE_ID_AMD_KERNCZ_SMBUS:
> piix4_port_sel_sb800 = SB800_PIIX4_PORT_IDX_KERNCZ;
> @@ -794,6 +798,7 @@ static const struct pci_device_id piix4_ids[] = {
> { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS) },
> { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) },
> { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) },
> + { PCI_DEVICE(PCI_VENDOR_ID_HYGON, PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) },
> { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
> PCI_DEVICE_ID_SERVERWORKS_OSB4) },
> { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS,
> @@ -904,11 +909,13 @@ static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)
> if ((dev->vendor == PCI_VENDOR_ID_ATI &&
> dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
> dev->revision >= 0x40) ||
> - dev->vendor == PCI_VENDOR_ID_AMD) {
> + dev->vendor == PCI_VENDOR_ID_AMD ||
> + dev->vendor == PCI_VENDOR_ID_HYGON) {
> bool notify_imc = false;
> is_sb800 = true;
>
> - if (dev->vendor == PCI_VENDOR_ID_AMD &&
> + if ((dev->vendor == PCI_VENDOR_ID_AMD ||
> + dev->vendor == PCI_VENDOR_ID_HYGON) &&
> dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) {
> u8 imc;
>
Patch looks good. I assume you have tested it on real hardware?
I would like you to also document the new supported chipset in
drivers/i2c/busses/Kconfig and Documentation/i2c/busses/i2c-piix4 as
well as in the header comment of i2c-piix4.c itself. I know it seems
redundant but it helps the user know which driver they need.
Thanks,
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support
2019-04-26 9:37 ` Jean Delvare
@ 2019-04-26 14:23 ` Pu Wen
2019-04-26 16:48 ` Jean Delvare
0 siblings, 1 reply; 5+ messages in thread
From: Pu Wen @ 2019-04-26 14:23 UTC (permalink / raw)
To: Jean Delvare
Cc: bp@alien8.de, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
On 2019/4/26 17:38, Jean Delvare wrote:
> Sorry for the late answer.
Thanks for the reply!
>> Cc: <stable@vger.kernel.org> # v5.0+
>
> I object to adding this to stable. It's not fixing any bug, and it's
> far from being a one-liner. I'd rather let distributions backport it as
> they see fit.
Okay, will not add this patch to stable.
>> + PIIX4_dev->revision >= 0x49) ||
>> + (PIIX4_dev->vendor == PCI_VENDOR_ID_HYGON &&
>> + PIIX4_dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS &&
>> PIIX4_dev->revision >= 0x49))
>> smb_en = 0x00;
>
> Does the compatibility with the original AMD chipset include the
> revision number?
The revision number may not be needed here, although it indeed larger
than 0x49 on Hygon platform.
>> - if (dev->vendor == PCI_VENDOR_ID_AMD &&
>> + if ((dev->vendor == PCI_VENDOR_ID_AMD ||
>> + dev->vendor == PCI_VENDOR_ID_HYGON) &&
>> dev->device == PCI_DEVICE_ID_AMD_KERNCZ_SMBUS) {
>> u8 imc;
>>
>
> Patch looks good. I assume you have tested it on real hardware?
Yes, I have tested it on Hygon hardware. It works well.
> I would like you to also document the new supported chipset in
> drivers/i2c/busses/Kconfig and Documentation/i2c/busses/i2c-piix4 as
> well as in the header comment of i2c-piix4.c itself. I know it seems
> redundant but it helps the user know which driver they need.
Because Hygon uses the same PCI device ID of AMD's, so is it appropriate
to document with the name "Hygon CZ" or just "Hygon"?
--
Regards,
Pu Wen
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support
2019-04-26 14:23 ` Pu Wen
@ 2019-04-26 16:48 ` Jean Delvare
2019-04-27 2:37 ` Pu Wen
0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2019-04-26 16:48 UTC (permalink / raw)
To: Pu Wen; +Cc: bp, linux-i2c, linux-kernel, stable
On Fri, 2019-04-26 at 22:23 +0800, Pu Wen wrote:
> On 2019/4/26 17:38, Jean Delvare wrote:
> > I would like you to also document the new supported chipset in
> > drivers/i2c/busses/Kconfig and Documentation/i2c/busses/i2c-piix4 as
> > well as in the header comment of i2c-piix4.c itself. I know it seems
> > redundant but it helps the user know which driver they need.
>
> Because Hygon uses the same PCI device ID of AMD's, so is it appropriate
> to document with the name "Hygon CZ" or just "Hygon"?
"Hygon CZ" please, as Hygon is the vendor not the device, and I can
imagine you may create more devices in the future.
Thanks,
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support
2019-04-26 16:48 ` Jean Delvare
@ 2019-04-27 2:37 ` Pu Wen
0 siblings, 0 replies; 5+ messages in thread
From: Pu Wen @ 2019-04-27 2:37 UTC (permalink / raw)
To: Jean Delvare
Cc: bp@alien8.de, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, stable
On 2019/4/27 0:48, Jean Delvare wrote:
> On Fri, 2019-04-26 at 22:23 +0800, Pu Wen wrote:
>> On 2019/4/26 17:38, Jean Delvare wrote:
>>> I would like you to also document the new supported chipset in
>>> drivers/i2c/busses/Kconfig and Documentation/i2c/busses/i2c-piix4 as
>>> well as in the header comment of i2c-piix4.c itself. I know it seems
>>> redundant but it helps the user know which driver they need.
>>
>> Because Hygon uses the same PCI device ID of AMD's, so is it appropriate
>> to document with the name "Hygon CZ" or just "Hygon"?
>
> "Hygon CZ" please, as Hygon is the vendor not the device, and I can
Okay.
> imagine you may create more devices in the future.
Surely.
--
Regards,
Pu Wen
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-27 2:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22 13:10 [RFC PATCH RESEND] i2c-piix4: Add Hygon Dhyana SMBus support Pu Wen
2019-04-26 9:37 ` Jean Delvare
2019-04-26 14:23 ` Pu Wen
2019-04-26 16:48 ` Jean Delvare
2019-04-27 2:37 ` Pu Wen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox