Skip to content

Commit 29af915

Browse files
committed
Merge tag 'usb-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are some small fixes for 5.3-rc2. All of these resolve some reported issues, some more than others :) Included in here is: - xhci fix for an annoying issue with odd devices - reversion of some usb251xb patches that should not have been merged - usb pci quirk additions and fixups - usb storage fix - usb host controller error test fix All of these have been in linux-next with no reported issues" * tag 'usb-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: xhci: Fix crash if scatter gather is used with Immediate Data Transfer (IDT). usb: usb251xb: Reallow swap-dx-lanes to apply to the upstream port Revert "usb: usb251xb: Add US port lanes inversion property" Revert "usb: usb251xb: Add US lanes inversion dts-bindings" usb: wusbcore: fix unbalanced get/put cluster_id usb/hcd: Fix a NULL vs IS_ERR() bug in usb_hcd_setup_local_mem() usb-storage: Add a limitation for blk_queue_max_hw_sectors() usb: pci-quirks: Minor cleanup for AMD PLL quirk usb: pci-quirks: Correct AMD PLL quirk detection
2 parents 5bb575b + d39b5ba commit 29af915

File tree

11 files changed

+57
-39
lines changed

11 files changed

+57
-39
lines changed

Documentation/devicetree/bindings/usb/usb251xb.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,8 @@ Optional properties :
6464
- power-on-time-ms : Specifies the time it takes from the time the host
6565
initiates the power-on sequence to a port until the port has adequate
6666
power. The value is given in ms in a 0 - 510 range (default is 100ms).
67-
- swap-dx-lanes : Specifies the downstream ports which will swap the
68-
differential-pair (D+/D-), default is not-swapped.
69-
- swap-us-lanes : Selects the upstream port differential-pair (D+/D-)
70-
swapping (boolean, default is not-swapped)
67+
- swap-dx-lanes : Specifies the ports which will swap the differential-pair
68+
(D+/D-), default is not-swapped.
7169

7270
Examples:
7371
usb2512b@2c {

drivers/usb/core/hcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,8 +3052,8 @@ int usb_hcd_setup_local_mem(struct usb_hcd *hcd, phys_addr_t phys_addr,
30523052

30533053
local_mem = devm_memremap(hcd->self.sysdev, phys_addr,
30543054
size, MEMREMAP_WC);
3055-
if (!local_mem)
3056-
return -ENOMEM;
3055+
if (IS_ERR(local_mem))
3056+
return PTR_ERR(local_mem);
30573057

30583058
/*
30593059
* Here we pass a dma_addr_t but the arg type is a phys_addr_t.

drivers/usb/host/ehci-pci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
149149
break;
150150
case PCI_VENDOR_ID_AMD:
151151
/* AMD PLL quirk */
152-
if (usb_amd_find_chipset_info())
152+
if (usb_amd_quirk_pll_check())
153153
ehci->amd_pll_fix = 1;
154154
/* AMD8111 EHCI doesn't work, according to AMD errata */
155155
if (pdev->device == 0x7463) {
@@ -186,7 +186,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
186186
break;
187187
case PCI_VENDOR_ID_ATI:
188188
/* AMD PLL quirk */
189-
if (usb_amd_find_chipset_info())
189+
if (usb_amd_quirk_pll_check())
190190
ehci->amd_pll_fix = 1;
191191

192192
/*

drivers/usb/host/hwa-hc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static int hwahc_op_start(struct usb_hcd *usb_hcd)
159159
return result;
160160

161161
error_set_cluster_id:
162-
wusb_cluster_id_put(wusbhc->cluster_id);
162+
wusb_cluster_id_put(addr);
163163
error_cluster_id_get:
164164
goto out;
165165

drivers/usb/host/ohci-pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd)
152152
{
153153
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
154154

155-
if (usb_amd_find_chipset_info())
155+
if (usb_amd_quirk_pll_check())
156156
ohci->flags |= OHCI_QUIRK_AMD_PLL;
157157

158158
/* SB800 needs pre-fetch fix */

drivers/usb/host/pci-quirks.c

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static struct amd_chipset_info {
132132
struct amd_chipset_type sb_type;
133133
int isoc_reqs;
134134
int probe_count;
135-
int probe_result;
135+
bool need_pll_quirk;
136136
} amd_chipset;
137137

138138
static DEFINE_SPINLOCK(amd_lock);
@@ -201,39 +201,46 @@ void sb800_prefetch(struct device *dev, int on)
201201
}
202202
EXPORT_SYMBOL_GPL(sb800_prefetch);
203203

204-
int usb_amd_find_chipset_info(void)
204+
static void usb_amd_find_chipset_info(void)
205205
{
206206
unsigned long flags;
207207
struct amd_chipset_info info;
208-
int ret;
208+
info.need_pll_quirk = 0;
209209

210210
spin_lock_irqsave(&amd_lock, flags);
211211

212212
/* probe only once */
213213
if (amd_chipset.probe_count > 0) {
214214
amd_chipset.probe_count++;
215215
spin_unlock_irqrestore(&amd_lock, flags);
216-
return amd_chipset.probe_result;
216+
return;
217217
}
218218
memset(&info, 0, sizeof(info));
219219
spin_unlock_irqrestore(&amd_lock, flags);
220220

221221
if (!amd_chipset_sb_type_init(&info)) {
222-
ret = 0;
223222
goto commit;
224223
}
225224

226-
/* Below chipset generations needn't enable AMD PLL quirk */
227-
if (info.sb_type.gen == AMD_CHIPSET_UNKNOWN ||
228-
info.sb_type.gen == AMD_CHIPSET_SB600 ||
229-
info.sb_type.gen == AMD_CHIPSET_YANGTZE ||
230-
(info.sb_type.gen == AMD_CHIPSET_SB700 &&
231-
info.sb_type.rev > 0x3b)) {
225+
switch (info.sb_type.gen) {
226+
case AMD_CHIPSET_SB700:
227+
info.need_pll_quirk = info.sb_type.rev <= 0x3B;
228+
break;
229+
case AMD_CHIPSET_SB800:
230+
case AMD_CHIPSET_HUDSON2:
231+
case AMD_CHIPSET_BOLTON:
232+
info.need_pll_quirk = 1;
233+
break;
234+
default:
235+
info.need_pll_quirk = 0;
236+
break;
237+
}
238+
239+
if (!info.need_pll_quirk) {
232240
if (info.smbus_dev) {
233241
pci_dev_put(info.smbus_dev);
234242
info.smbus_dev = NULL;
235243
}
236-
ret = 0;
237244
goto commit;
238245
}
239246

@@ -252,7 +259,6 @@ int usb_amd_find_chipset_info(void)
252259
}
253260
}
254261

255-
ret = info.probe_result = 1;
256262
printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n");
257263

258264
commit:
@@ -263,7 +269,6 @@ int usb_amd_find_chipset_info(void)
263269

264270
/* Mark that we where here */
265271
amd_chipset.probe_count++;
266-
ret = amd_chipset.probe_result;
267272

268273
spin_unlock_irqrestore(&amd_lock, flags);
269274

@@ -276,10 +281,7 @@ int usb_amd_find_chipset_info(void)
276281
amd_chipset = info;
277282
spin_unlock_irqrestore(&amd_lock, flags);
278283
}
279-
280-
return ret;
281284
}
282-
EXPORT_SYMBOL_GPL(usb_amd_find_chipset_info);
283285

284286
int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev)
285287
{
@@ -315,6 +317,13 @@ bool usb_amd_prefetch_quirk(void)
315317
}
316318
EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk);
317319

320+
bool usb_amd_quirk_pll_check(void)
321+
{
322+
usb_amd_find_chipset_info();
323+
return amd_chipset.need_pll_quirk;
324+
}
325+
EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_check);
326+
318327
/*
319328
* The hardware normally enables the A-link power management feature, which
320329
* lets the system lower the power consumption in idle states.
@@ -520,7 +529,7 @@ void usb_amd_dev_put(void)
520529
amd_chipset.nb_type = 0;
521530
memset(&amd_chipset.sb_type, 0, sizeof(amd_chipset.sb_type));
522531
amd_chipset.isoc_reqs = 0;
523-
amd_chipset.probe_result = 0;
532+
amd_chipset.need_pll_quirk = 0;
524533

525534
spin_unlock_irqrestore(&amd_lock, flags);
526535

drivers/usb/host/pci-quirks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#ifdef CONFIG_USB_PCI
66
void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
77
int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
8-
int usb_amd_find_chipset_info(void);
98
int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev);
109
bool usb_amd_hang_symptom_quirk(void);
1110
bool usb_amd_prefetch_quirk(void);
1211
void usb_amd_dev_put(void);
12+
bool usb_amd_quirk_pll_check(void);
1313
void usb_amd_quirk_pll_disable(void);
1414
void usb_amd_quirk_pll_enable(void);
1515
void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);

drivers/usb/host/xhci-pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
130130
xhci->quirks |= XHCI_AMD_0x96_HOST;
131131

132132
/* AMD PLL quirk */
133-
if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_find_chipset_info())
133+
if (pdev->vendor == PCI_VENDOR_ID_AMD && usb_amd_quirk_pll_check())
134134
xhci->quirks |= XHCI_AMD_PLL_FIX;
135135

136136
if (pdev->vendor == PCI_VENDOR_ID_AMD &&

drivers/usb/host/xhci.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,8 @@ static inline bool xhci_urb_suitable_for_idt(struct urb *urb)
21752175
if (!usb_endpoint_xfer_isoc(&urb->ep->desc) && usb_urb_dir_out(urb) &&
21762176
usb_endpoint_maxp(&urb->ep->desc) >= TRB_IDT_MAX_SIZE &&
21772177
urb->transfer_buffer_length <= TRB_IDT_MAX_SIZE &&
2178-
!(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP))
2178+
!(urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) &&
2179+
!urb->num_sgs)
21792180
return true;
21802181

21812182
return false;

drivers/usb/misc/usb251xb.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,16 @@ static int usb251xb_connect(struct usb251xb *hub)
375375

376376
#ifdef CONFIG_OF
377377
static void usb251xb_get_ports_field(struct usb251xb *hub,
378-
const char *prop_name, u8 port_cnt, u8 *fld)
378+
const char *prop_name, u8 port_cnt,
379+
bool ds_only, u8 *fld)
379380
{
380381
struct device *dev = hub->dev;
381382
struct property *prop;
382383
const __be32 *p;
383384
u32 port;
384385

385386
of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) {
386-
if ((port >= 1) && (port <= port_cnt))
387+
if ((port >= ds_only ? 1 : 0) && (port <= port_cnt))
387388
*fld |= BIT(port);
388389
else
389390
dev_warn(dev, "port %u doesn't exist\n", port);
@@ -501,15 +502,15 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
501502

502503
hub->non_rem_dev = USB251XB_DEF_NON_REMOVABLE_DEVICES;
503504
usb251xb_get_ports_field(hub, "non-removable-ports", data->port_cnt,
504-
&hub->non_rem_dev);
505+
true, &hub->non_rem_dev);
505506

506507
hub->port_disable_sp = USB251XB_DEF_PORT_DISABLE_SELF;
507508
usb251xb_get_ports_field(hub, "sp-disabled-ports", data->port_cnt,
508-
&hub->port_disable_sp);
509+
true, &hub->port_disable_sp);
509510

510511
hub->port_disable_bp = USB251XB_DEF_PORT_DISABLE_BUS;
511512
usb251xb_get_ports_field(hub, "bp-disabled-ports", data->port_cnt,
512-
&hub->port_disable_bp);
513+
true, &hub->port_disable_bp);
513514

514515
hub->max_power_sp = USB251XB_DEF_MAX_POWER_SELF;
515516
if (!of_property_read_u32(np, "sp-max-total-current-microamp",
@@ -573,9 +574,7 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
573574
*/
574575
hub->port_swap = USB251XB_DEF_PORT_SWAP;
575576
usb251xb_get_ports_field(hub, "swap-dx-lanes", data->port_cnt,
576-
&hub->port_swap);
577-
if (of_get_property(np, "swap-us-lanes", NULL))
578-
hub->port_swap |= BIT(0);
577+
false, &hub->port_swap);
579578

580579
/* The following parameters are currently not exposed to devicetree, but
581580
* may be as soon as needed.

0 commit comments

Comments
 (0)