* has one slot under it, so at most there are 8 functions.
         */
        struct aspm_latency acceptable[8];
-
-       /* L1 PM Substate info */
-       struct {
-               u32 ctl1;               /* value to be programmed in ctl1 */
-               u32 ctl2;               /* value to be programmed in ctl2 */
-       } l1ss;
 };
 
 static int aspm_disabled, aspm_force;
        struct pci_dev *child = link->downstream, *parent = link->pdev;
        u32 val1, val2, scale1, scale2;
        u32 t_common_mode, t_power_on, l1_2_threshold, scale, value;
-
-       link->l1ss.ctl1 = link->l1ss.ctl2 = 0;
+       u32 ctl1 = 0, ctl2 = 0;
+       u32 pctl1, pctl2, cctl1, cctl2;
+       u32 pl1_2_enables, cl1_2_enables;
 
        if (!(link->aspm_support & ASPM_STATE_L1_2_MASK))
                return;
 
        if (calc_l1ss_pwron(parent, scale1, val1) >
            calc_l1ss_pwron(child, scale2, val2)) {
-               link->l1ss.ctl2 |= scale1 | (val1 << 3);
+               ctl2 |= scale1 | (val1 << 3);
                t_power_on = calc_l1ss_pwron(parent, scale1, val1);
        } else {
-               link->l1ss.ctl2 |= scale2 | (val2 << 3);
+               ctl2 |= scale2 | (val2 << 3);
                t_power_on = calc_l1ss_pwron(child, scale2, val2);
        }
 
         */
        l1_2_threshold = 2 + 4 + t_common_mode + t_power_on;
        encode_l12_threshold(l1_2_threshold, &scale, &value);
-       link->l1ss.ctl1 |= t_common_mode << 8 | scale << 29 | value << 16;
+       ctl1 |= t_common_mode << 8 | scale << 29 | value << 16;
+
+       pci_read_config_dword(parent, parent->l1ss + PCI_L1SS_CTL1, &pctl1);
+       pci_read_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2, &pctl2);
+       pci_read_config_dword(child, child->l1ss + PCI_L1SS_CTL1, &cctl1);
+       pci_read_config_dword(child, child->l1ss + PCI_L1SS_CTL2, &cctl2);
+
+       if (ctl1 == pctl1 && ctl1 == cctl1 &&
+           ctl2 == pctl2 && ctl2 == cctl2)
+               return;
+
+       /* Disable L1.2 while updating.  See PCIe r5.0, sec 5.5.4, 7.8.3.3 */
+       pl1_2_enables = pctl1 & PCI_L1SS_CTL1_L1_2_MASK;
+       cl1_2_enables = cctl1 & PCI_L1SS_CTL1_L1_2_MASK;
+
+       if (pl1_2_enables || cl1_2_enables) {
+               pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
+                                       PCI_L1SS_CTL1_L1_2_MASK, 0);
+               pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
+                                       PCI_L1SS_CTL1_L1_2_MASK, 0);
+       }
+
+       /* Program T_POWER_ON times in both ports */
+       pci_write_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2, ctl2);
+       pci_write_config_dword(child, child->l1ss + PCI_L1SS_CTL2, ctl2);
+
+       /* Program Common_Mode_Restore_Time in upstream device */
+       pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
+                               PCI_L1SS_CTL1_CM_RESTORE_TIME, ctl1);
+
+       /* Program LTR_L1.2_THRESHOLD time in both ports */
+       pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
+                               PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+                               PCI_L1SS_CTL1_LTR_L12_TH_SCALE, ctl1);
+       pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
+                               PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
+                               PCI_L1SS_CTL1_LTR_L12_TH_SCALE, ctl1);
+
+       if (pl1_2_enables || cl1_2_enables) {
+               pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1, 0,
+                                       pl1_2_enables);
+               pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1, 0,
+                                       cl1_2_enables);
+       }
 }
 
 static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
                                                   PCI_EXP_LNKCTL_ASPM_L1, 0);
        }
 
-       if (enable_req & ASPM_STATE_L1_2_MASK) {
-
-               /* Program T_POWER_ON times in both ports */
-               pci_write_config_dword(parent, parent->l1ss + PCI_L1SS_CTL2,
-                                      link->l1ss.ctl2);
-               pci_write_config_dword(child, child->l1ss + PCI_L1SS_CTL2,
-                                      link->l1ss.ctl2);
-
-               /* Program Common_Mode_Restore_Time in upstream device */
-               pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
-                                       PCI_L1SS_CTL1_CM_RESTORE_TIME,
-                                       link->l1ss.ctl1);
-
-               /* Program LTR_L1.2_THRESHOLD time in both ports */
-               pci_clear_and_set_dword(parent, parent->l1ss + PCI_L1SS_CTL1,
-                                       PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
-                                       PCI_L1SS_CTL1_LTR_L12_TH_SCALE,
-                                       link->l1ss.ctl1);
-               pci_clear_and_set_dword(child, child->l1ss + PCI_L1SS_CTL1,
-                                       PCI_L1SS_CTL1_LTR_L12_TH_VALUE |
-                                       PCI_L1SS_CTL1_LTR_L12_TH_SCALE,
-                                       link->l1ss.ctl1);
-       }
-
        val = 0;
        if (state & ASPM_STATE_L1_1)
                val |= PCI_L1SS_CTL1_ASPM_L1_1;