Skip to contentSkip to conversation

SDHCI: Change AMD SDHCI quirk application scope

PATCH In review Wan ZongShun 3 participants 6 messages Jun 4, 2015 – Jun 5, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SDHCI: Change AMD SDHCI quirk application scope

From: Vincent Wan <[email protected]>

Change this quirk to apply to AMD Carrizo platform.

---
 drivers/mmc/host/sdhci-pci.c | 25 ++++++++++++++++++++++++-
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci.c +24 -1
index f208f20..94f54d2 100644
@@ -724,14 +724,37 @@ static const struct sdhci_pci_fixes sdhci_rtsx = {
 	.probe_slot	= rtsx_probe_slot,
 };
 
+/*AMD chipset generation*/
+enum amd_chipset_gen {
+	AMD_CHIPSET_BEFORE_ML,
+	AMD_CHIPSET_CZ,
+	AMD_CHIPSET_NL,
+	AMD_CHIPSET_UNKNOWN,
+};
+
 static int amd_probe(struct sdhci_pci_chip *chip)
 {
 	struct pci_dev	*smbus_dev;
+	enum amd_chipset_gen gen;
 
 	smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
 			PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
+	if (smbus_dev) {
+		gen = AMD_CHIPSET_BEFORE_ML;
+	} else {
+		smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
+				PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
+		if (smbus_dev) {
+			if (smbus_dev->revision < 0x51)
+				gen = AMD_CHIPSET_CZ;
+			else
+				gen = AMD_CHIPSET_NL;
+		} else {
+			gen = AMD_CHIPSET_UNKNOWN;
+		}
+	}
 
-	if (smbus_dev && (smbus_dev->revision < 0x51)) {
+	if ((gen == AMD_CHIPSET_BEFORE_ML) || (gen == AMD_CHIPSET_CZ)) {
 		chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
 		chip->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
 	}
include/linux/pci_ids.h +1 -0
index 2f7b9a4..cb63a7b 100644
@@ -579,6 +579,7 @@
 #define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE	0x7800
 #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS		0x780b
 #define PCI_DEVICE_ID_AMD_HUDSON2_IDE		0x780c
+#define PCI_DEVICE_ID_AMD_KERNCZ_SMBUS  0x790b
 
 #define PCI_VENDOR_ID_TRIDENT		0x1023
 #define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX	0x2000
Signature · 1 line
1.9.1
#1 lore raw
Quoted 63 lines · Wan ZongShun

From: Vincent Wan <[email protected]>

Change this quirk to apply to AMD Carrizo platform.

---
 drivers/mmc/host/sdhci-pci.c | 25 ++++++++++++++++++++++++-
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci.c +24 -1
index f208f20..94f54d2 100644
@@ -724,14 +724,37 @@ static const struct sdhci_pci_fixes sdhci_rtsx = {
 	.probe_slot	= rtsx_probe_slot,
 };
 
+/*AMD chipset generation*/
+enum amd_chipset_gen {
+	AMD_CHIPSET_BEFORE_ML,
+	AMD_CHIPSET_CZ,
+	AMD_CHIPSET_NL,
+	AMD_CHIPSET_UNKNOWN,
+};
+
 static int amd_probe(struct sdhci_pci_chip *chip)
 {
 	struct pci_dev	*smbus_dev;
+	enum amd_chipset_gen gen;
 
 	smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
 			PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
+	if (smbus_dev) {
+		gen = AMD_CHIPSET_BEFORE_ML;
+	} else {
+		smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
+				PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
+		if (smbus_dev) {
+			if (smbus_dev->revision < 0x51)
+				gen = AMD_CHIPSET_CZ;
+			else
+				gen = AMD_CHIPSET_NL;
+		} else {
+			gen = AMD_CHIPSET_UNKNOWN;
+		}
+	}
 
-	if (smbus_dev && (smbus_dev->revision < 0x51)) {
+	if ((gen == AMD_CHIPSET_BEFORE_ML) || (gen == AMD_CHIPSET_CZ)) {
 		chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
 		chip->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
 	}
include/linux/pci_ids.h +0 -0
index 2f7b9a4..cb63a7b 100644

include/linux/pci_ids.h line 582

Quoted 4 lines
include/linux/pci_ids.h +1 -0
@@ -579,6 +579,7 @@
 #define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE	0x7800
 #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS		0x780b
 #define PCI_DEVICE_ID_AMD_HUDSON2_IDE		0x780c
+#define PCI_DEVICE_ID_AMD_KERNCZ_SMBUS  0x790b

KERNCZ?

Also, that device id is used only in sdhci-pci.c so it should be defined there. Only when multiple drivers/compilation units need it, then it should go to pci_ids.h.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#2 lore raw

2015-06-04 23:32 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 71 lines · Wan ZongShun
Quoted 63 lines

From: Vincent Wan <[email protected]>

Change this quirk to apply to AMD Carrizo platform.

---
 drivers/mmc/host/sdhci-pci.c | 25 ++++++++++++++++++++++++-
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci.c +24 -1
index f208f20..94f54d2 100644
@@ -724,14 +724,37 @@ static const struct sdhci_pci_fixes sdhci_rtsx = {
      .probe_slot     = rtsx_probe_slot,
 };
 
+/*AMD chipset generation*/
+enum amd_chipset_gen {
+     AMD_CHIPSET_BEFORE_ML,
+     AMD_CHIPSET_CZ,
+     AMD_CHIPSET_NL,
+     AMD_CHIPSET_UNKNOWN,
+};
+
 static int amd_probe(struct sdhci_pci_chip *chip)
 {
      struct pci_dev  *smbus_dev;
+     enum amd_chipset_gen gen;
 
      smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
                      PCI_DEVICE_ID_AMD_HUDSON2_SMBUS, NULL);
+     if (smbus_dev) {
+             gen = AMD_CHIPSET_BEFORE_ML;
+     } else {
+             smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
+                             PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
+             if (smbus_dev) {
+                     if (smbus_dev->revision < 0x51)
+                             gen = AMD_CHIPSET_CZ;
+                     else
+                             gen = AMD_CHIPSET_NL;
+             } else {
+                     gen = AMD_CHIPSET_UNKNOWN;
+             }
+     }
 
-     if (smbus_dev && (smbus_dev->revision < 0x51)) {
+     if ((gen == AMD_CHIPSET_BEFORE_ML) || (gen == AMD_CHIPSET_CZ)) {
              chip->quirks2 |= SDHCI_QUIRK2_CLEAR_TRANSFERMODE_REG_BEFORE_CMD;
              chip->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
      }
include/linux/pci_ids.h +0 -0
index 2f7b9a4..cb63a7b 100644

include/linux/pci_ids.h line 582

Quoted 4 lines
include/linux/pci_ids.h +1 -0
@@ -579,6 +579,7 @@
 #define PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE   0x7800
 #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS              0x780b
 #define PCI_DEVICE_ID_AMD_HUDSON2_IDE                0x780c
+#define PCI_DEVICE_ID_AMD_KERNCZ_SMBUS  0x790b

KERNCZ?

Quoted 3 lines

Also, that device id is used only in sdhci-pci.c so it should be defined there. Only when multiple drivers/compilation units need it, then it should go to pci_ids.h.

Boris, I means I put this KERCZ Mircro in pci_ids.h, and I also will send the other patch to instead the following '0x790b' of codes. I think it is reasonable, right?

    /* Determine the address of the SMBus areas */
    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))
Quoted 7 lines

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--

Signature · 2 lines
Wan ZongShun.
www.mcuos.com
#3 lore raw
Quoted 3 lines · Wan ZongShun

Boris, I means I put this KERCZ Mircro in pci_ids.h, and I also will send the other patch to instead the following '0x790b' of codes. I think it is reasonable, right?

No, it means two things:

* why does it contain KERNCZ? What does that mean?

* #define PCI_DEVICE_ID_AMD_<better_name>_SMBUS 0x790b should be in drivers/mmc/host/sdhci-pci.c as it is used only there.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#4 lore raw

2015-06-05 17:20 GMT+08:00 Borislav Petkov <[email protected]>:

Quoted 8 lines · Wan ZongShun
Quoted 3 lines

Boris, I means I put this KERCZ Mircro in pci_ids.h, and I also will send the other patch to instead the following '0x790b' of codes. I think it is reasonable, right?

No, it means two things:

* why does it contain KERNCZ? What does that mean?

The KERNCZ is new AMD SB/FCH generation name, like HUDSON2 is old FCH generation.
We will adopt 0x790b as device ID since from this KERNCZ gereration.

Quoted 3 lines

* #define PCI_DEVICE_ID_AMD_<better_name>_SMBUS 0x790b should be in drivers/mmc/host/sdhci-pci.c as it is used only there.

The i2cpiix4.c driver and eMMC driver both will use this device ID macro, Do you think I should submit two patches synchronously? like
patch1: change i2cpiix4 driver to use PCI_DEVICE_ID_AMD_KERNCZ_SMBUS,
patch2: for eMMC quirk in sdhci-pci.c?

And then the PCI_DEVICE_ID_AMD_KERNCZ_SMBUS can be go into pci ids.h?

Quoted 9 lines

Thanks.

--
Regards/Gruss,
Boris.

ECO tip #101: Trim your mails when you reply.
--

Signature · 2 lines
Wan ZongShun.
www.mcuos.com
#5 lore raw
Quoted 3 lines · Wan ZongShun

The KERNCZ is new AMD SB/FCH generation name, like HUDSON2 is old FCH generation.
We will adopt 0x790b as device ID since from this KERNCZ gereration.

True story. Strange name that.

Quoted 6 lines

The i2cpiix4.c driver and eMMC driver both will use this device ID macro, Do you think I should submit two patches synchronously? like
patch1: change i2cpiix4 driver to use PCI_DEVICE_ID_AMD_KERNCZ_SMBUS,
patch2: for eMMC quirk in sdhci-pci.c?

And then the PCI_DEVICE_ID_AMD_KERNCZ_SMBUS can be go into pci ids.h?

If you have all those patches ready, you could do a first patch adding the PCI ID to pci_ids.h only.

Then follow with the different driver changes, i.e. sdhci-pci.c, i2cpiix4, and so on and make it clear in the 0/n message that they all depend on the first one.

Or something along those lines.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--