i2c-piix4: Add support for AMD ML and CZ SMBus changes
Subsystems (3)
PATCH 1/2 i2c-piix4: Add support for AMD ML and CZ SMBus changes
The locations of SMBus register base address and enablement bit are changed from AMD ML, which need this patch to be supported.
--- Documentation/i2c/busses/i2c-piix4 | 2 +- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-piix4.c | 28 +++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-)
Documentation/i2c/busses/i2c-piix4 +1 -1
@@ -13,7 +13,7 @@ Supported adapters: * AMD SP5100 (SB700 derivative found on some server mainboards) Datasheet: Publicly available at the AMD website http://support.amd.com/us/Embedded_TechDocs/44413.pdf - * AMD Hudson-2, CZ + * AMD Hudson-2, ML, CZ Datasheet: Not publicly available * Standard Microsystems (SMSC) SLC90E66 (Victory66) southbridge Datasheet: Publicly available at the SMSC website http://www.smsc.com
drivers/i2c/busses/Kconfig +1 -0
@@ -152,6 +152,7 @@ config I2C_PIIX4 ATI SB700/SP5100 ATI SB800 AMD Hudson-2 + AMD ML AMD CZ Serverworks OSB4 Serverworks CSB5
drivers/i2c/busses/i2c-piix4.c +23 -5
@@ -22,7 +22,7 @@ Intel PIIX4, 440MX Serverworks OSB4, CSB5, CSB6, HT-1000, HT-1100 ATI IXP200, IXP300, IXP400, SB600, SB700/SP5100, SB800 - AMD Hudson-2, CZ + AMD Hudson-2, ML, CZ SMSC Victory66 Note: we assume there can only be one device, with one or more
@@ -235,7 +235,8 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, {unsigned short piix4_smba;unsigned short smba_idx =0xcd6 ; -u8 smba_en_lo, smba_en_hi, i2ccfg, i2ccfg_offset =0x10 , smb_en; +u8 smba_en_lo, smba_en_hi, smb_en, smb_en_status; +u8 i2ccfg, i2ccfg_offset =0x10 ;/* SB800 and later SMBus does not support forcing address */ if (force || force_addr) {
@@ -245,7 +246,15 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, }/* Determine the address of the SMBus areas */ - smb_en = (aux) ?0x28 :0x2c ; +if ((PIIX4_dev->vendor ==PCI_VENDOR_ID_AMD && + PIIX4_dev->device ==PCI_DEVICE_ID_AMD_HUDSON2_SMBUS && + PIIX4_dev->revision >=0x41 ) || + (PIIX4_dev->vendor ==PCI_VENDOR_ID_AMD && + PIIX4_dev->device ==0x790b && + PIIX4_dev->revision >=0x49 )) + smb_en =0x00 ; +else + smb_en = (aux) ?0x28 :0x2c ;if (!request_region (smba_idx,2 ,"smba_idx" )) { dev_err(&PIIX4_dev->dev, "SMBus base address index region "
@@ -258,13 +267,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, smba_en_hi =inb_p (smba_idx +1 );release_region (smba_idx,2 ); -if ((smba_en_lo &1 ) ==0 ) { +if (!smb_en) { + smb_en_status = smba_en_lo &0x10 ; + piix4_smba = smba_en_hi <<8 ; +if (aux) + piix4_smba |=0x20 ; + }else { + smb_en_status = smba_en_lo &0x01 ; + piix4_smba = ((smba_en_hi <<8 ) | smba_en_lo) &0xffe0 ; + } + +if (!smb_en_status) {dev_err (&PIIX4_dev->dev,"Host SMBus controller not enabled!\n" );return -ENODEV ; } - piix4_smba = ((smba_en_hi <<8 ) | smba_en_lo) &0xffe0 ;if (acpi_check_region (piix4_smba,SMBIOSIZE , piix4_driver.name))return -ENODEV ;
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 1390428346-2235-1-git-send-email-shane.huang-5C7GfCeVMHo@public.gmane.org
Jean Delvare
Reviewed-byHi Shane, hi Wolfram,
Quoted 9 lines · Shane Huang
The locations of SMBus register base address and enablement bit are changed from AMD ML, which need this patch to be supported.
Signed-off-by Shane Huang <[email protected]>--- Documentation/i2c/busses/i2c-piix4 | 2 +- drivers/i2c/busses/Kconfig | 1 + drivers/i2c/busses/i2c-piix4.c | 28 +++++++++++++++++++++++----- 3 files changed, 25 insertions(+), 6 deletions(-)
Overall it looks good.
Wolfram, I think this is a candidate for stable kernel branches. It should apply fine down to 3.12.
Shane, I still have one additional question:
drivers/i2c/busses/i2c-piix4.c static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, · line 275
Quoted 12 lines
(...)
drivers/i2c/busses/i2c-piix4.c +6
-1@@ -258,13 +267,22 @@ static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, smba_en_hi =inb_p (smba_idx +1 );release_region (smba_idx,2 ); -if ((smba_en_lo &1 ) ==0 ) { +if (!smb_en) { + smb_en_status = smba_en_lo &0x10 ; + piix4_smba = smba_en_hi <<8 ; +if (aux) + piix4_smba |=0x20 ; + } (...)
As the mask used for smb_en_status doesn't depend on the value of "aux", this implies that on the Hudson-2, a single bit controls if both SMBus controllers are enabled. It's not possible to enable one and disable the other. Is it correct, or is it an overlook?
BTW it would be really great if we could have access to the documentation for these new AMD chipsets. I looked for both Hudson and FCH at http://developer.amd.com/ but these searches returned nothing. I could help better if I had access to the documentation / datasheets.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Jean,
Quoted 4 lines
As the mask used for
smb_en_statusdoesn't depend on the value of "aux", this implies that on the Hudson-2, a single bit controls if both SMBus controllers are enabled. It's not possible to enable one and disable the other. Is it correct, or is it an overlook?
Good question. This is the current design, not an overlook.
Quoted 4 lines
BTW it would be really great if we could have access to the documentation for these new AMD chipsets. I looked for both Hudson and FCH at http://developer.amd.com/ but these searches returned nothing. I could help better if I had access to the documentation / datasheets.
I don't know who is the website maintainer but forwarded your question to our FCH datasheet maintainer, and he will follow up. I hope that it will be improved in near future. :-)
BTW, will this patch appear from kernel 3.14-rc1 ?
Thanks,
Shane
A message that is not in the archive (sent off-list or not yet received): 43EB3AB3EEFE8D43B525F4D2EAF507E1090ADBB0-7mPiUsE5EJ+PLz/[email protected]
Hi Shane,
Quoted 6 lines · Shane
Quoted 4 lines
As the mask used for
smb_en_statusdoesn't depend on the value of "aux", this implies that on the Hudson-2, a single bit controls if both SMBus controllers are enabled. It's not possible to enable one and disable the other. Is it correct, or is it an overlook?Good question. This is the current design, not an overlook.
OK.
Quoted 8 lines
Quoted 4 lines
BTW it would be really great if we could have access to the documentation for these new AMD chipsets. I looked for both Hudson and FCH at http://developer.amd.com/ but these searches returned nothing. I could help better if I had access to the documentation / datasheets.
I don't know who is the website maintainer but forwarded your question to our FCH datasheet maintainer, and he will follow up. I hope that it will be improved in near future. :-)
Thanks!
Quoted 1 line
BTW, will this patch appear from kernel 3.14-rc1 ?
This is Wolfram's call, not mine. I sure would like to see this patch in 3.14-rc1, and if that is not possible, in 3.14-rc2. This is a bug fix, so it should be applied ASAP.
Signature · 1 line
Jean Delvare
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Jean,
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
BTW it would be really great if we could have access to the documentation for these new AMD chipsets. I looked for both Hudson and FCH at http://developer.amd.com/ but these searches returned nothing. I could help better if I had access to the documentation / datasheets.
I don't know who is the website maintainer but forwarded your question to our FCH datasheet maintainer, and he will follow up. I hope that it will be improved in near future. :-)
Thanks!
AMD Kabini integrated FCH data sheet can be found in the BKDG (page 611), which is almost same as Hudson-2. The data sheet of ML is not released.
http://developer.amd.com/wordpress/media/2012/10/48751_BKDG_Fam_16h_Mod_00h-0Fh.pdf
Thanks,
Shane
A message that is not in the archive (sent off-list or not yet received): 43EB3AB3EEFE8D43B525F4D2EAF507E1090B0F04-7mPiUsE5EJ+PLz/[email protected]
Quoted 11 lines · Shane
Hi Jean,
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
BTW it would be really great if we could have access to the documentation for these new AMD chipsets. I looked for both Hudson and FCH at http://developer.amd.com/ but these searches returned nothing. I could help better if I had access to the documentation / datasheets.
I don't know who is the website maintainer but forwarded your question to our FCH datasheet maintainer, and he will follow up. I hope that it will be improved in near future. :-)
Quoted 6 lines
Quoted 1 line
Thanks!
AMD Kabini integrated FCH data sheet can be found in the BKDG (page 611), which is almost same as Hudson-2. The data sheet of ML is not released.
http://developer.amd.com/wordpress/media/2012/10/48751_BKDG_Fam_16h_Mod_00h-0Fh.pdf
Thanks Shane, this is very useful. I had not realized that the SMBus controller was now part of the CPU itself.
Signature · 1 line
Jean Delvare
Wolfram Sang
AppliedQuoted 4 lines · Shane Huang
The locations of SMBus register base address and enablement bit are changed from AMD ML, which need this patch to be supported.
Signed-off-by Shane Huang <[email protected]>
Applied to for-current, thanks! stable added.