aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Kennedy <ryan5544@gmail.com>2019-07-04 11:35:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-25 04:40:02 -0400
commitf3dccdaade4118070a3a47bef6b18321431f9ac6 (patch)
treedea10f1f2f7586e6f43a96407ec245bb790d9ebe
parent5f9e832c137075045d15cd6899ab0505cfb2ca4b (diff)
usb: pci-quirks: Correct AMD PLL quirk detection
The AMD PLL USB quirk is incorrectly enabled on newer Ryzen chipsets. The logic in usb_amd_find_chipset_info currently checks for unaffected chipsets rather than affected ones. This broke once a new chipset was added in e788787ef. It makes more sense to reverse the logic so it won't need to be updated as new chipsets are added. Note that the core of the workaround in usb_amd_quirk_pll does correctly check the chipset. Signed-off-by: Ryan Kennedy <ryan5544@gmail.com> Fixes: e788787ef4f9 ("usb:xhci:Add quirk for Certain failing HP keyboard on reset after resume") Cc: stable <stable@vger.kernel.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Link: https://lore.kernel.org/r/20190704153529.9429-2-ryan5544@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/pci-quirks.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 3ce71cbfbb58..ad05c27b3a7b 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -205,7 +205,7 @@ int usb_amd_find_chipset_info(void)
205{ 205{
206 unsigned long flags; 206 unsigned long flags;
207 struct amd_chipset_info info; 207 struct amd_chipset_info info;
208 int ret; 208 int need_pll_quirk = 0;
209 209
210 spin_lock_irqsave(&amd_lock, flags); 210 spin_lock_irqsave(&amd_lock, flags);
211 211
@@ -219,21 +219,28 @@ int usb_amd_find_chipset_info(void)
219 spin_unlock_irqrestore(&amd_lock, flags); 219 spin_unlock_irqrestore(&amd_lock, flags);
220 220
221 if (!amd_chipset_sb_type_init(&info)) { 221 if (!amd_chipset_sb_type_init(&info)) {
222 ret = 0;
223 goto commit; 222 goto commit;
224 } 223 }
225 224
226 /* Below chipset generations needn't enable AMD PLL quirk */ 225 switch (info.sb_type.gen) {
227 if (info.sb_type.gen == AMD_CHIPSET_UNKNOWN || 226 case AMD_CHIPSET_SB700:
228 info.sb_type.gen == AMD_CHIPSET_SB600 || 227 need_pll_quirk = info.sb_type.rev <= 0x3B;
229 info.sb_type.gen == AMD_CHIPSET_YANGTZE || 228 break;
230 (info.sb_type.gen == AMD_CHIPSET_SB700 && 229 case AMD_CHIPSET_SB800:
231 info.sb_type.rev > 0x3b)) { 230 case AMD_CHIPSET_HUDSON2:
231 case AMD_CHIPSET_BOLTON:
232 need_pll_quirk = 1;
233 break;
234 default:
235 need_pll_quirk = 0;
236 break;
237 }
238
239 if (!need_pll_quirk) {
232 if (info.smbus_dev) { 240 if (info.smbus_dev) {
233 pci_dev_put(info.smbus_dev); 241 pci_dev_put(info.smbus_dev);
234 info.smbus_dev = NULL; 242 info.smbus_dev = NULL;
235 } 243 }
236 ret = 0;
237 goto commit; 244 goto commit;
238 } 245 }
239 246
@@ -252,7 +259,7 @@ int usb_amd_find_chipset_info(void)
252 } 259 }
253 } 260 }
254 261
255 ret = info.probe_result = 1; 262 need_pll_quirk = info.probe_result = 1;
256 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n"); 263 printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n");
257 264
258commit: 265commit:
@@ -263,7 +270,7 @@ commit:
263 270
264 /* Mark that we where here */ 271 /* Mark that we where here */
265 amd_chipset.probe_count++; 272 amd_chipset.probe_count++;
266 ret = amd_chipset.probe_result; 273 need_pll_quirk = amd_chipset.probe_result;
267 274
268 spin_unlock_irqrestore(&amd_lock, flags); 275 spin_unlock_irqrestore(&amd_lock, flags);
269 276
@@ -277,7 +284,7 @@ commit:
277 spin_unlock_irqrestore(&amd_lock, flags); 284 spin_unlock_irqrestore(&amd_lock, flags);
278 } 285 }
279 286
280 return ret; 287 return need_pll_quirk;
281} 288}
282EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info); 289EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);
283 290