Skip to content

Commit 207b08b

Browse files
committed
Merge tag 'fixes-for-v4.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus
Felipe writes: usb: fixes for v4.5-rc2 DWC3 got a fix for OTG Certification, DWC2 has two fixes for regressions on RasPI, MUSB has a NULL pointer dereference fix for ux500 platforms and two PHYs (MSM and MXS) got some minor fixes. While at that, I'm also adding a fix to my email address which has changed recently.
2 parents 5c82171 + 6a4290c commit 207b08b

File tree

7 files changed

+43
-36
lines changed

7 files changed

+43
-36
lines changed

MAINTAINERS

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3445,7 +3445,7 @@ S: Maintained
34453445
F: drivers/usb/dwc2/
34463446

34473447
DESIGNWARE USB3 DRD IP DRIVER
3448-
M: Felipe Balbi <balbi@ti.com>
3448+
M: Felipe Balbi <balbi@kernel.org>
34493449
34503450
34513451
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -7370,7 +7370,7 @@ F: drivers/tty/isicom.c
73707370
F: include/linux/isicom.h
73717371

73727372
MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
7373-
M: Felipe Balbi <balbi@ti.com>
7373+
M: Felipe Balbi <balbi@kernel.org>
73747374
73757375
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
73767376
S: Maintained
@@ -7939,7 +7939,7 @@ F: drivers/media/platform/omap3isp/
79397939
F: drivers/staging/media/omap4iss/
79407940

79417941
OMAP USB SUPPORT
7942-
M: Felipe Balbi <balbi@ti.com>
7942+
M: Felipe Balbi <balbi@kernel.org>
79437943
79447944
79457945
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -11318,7 +11318,7 @@ F: Documentation/usb/ehci.txt
1131811318
F: drivers/usb/host/ehci*
1131911319

1132011320
USB GADGET/PERIPHERAL SUBSYSTEM
11321-
M: Felipe Balbi <balbi@ti.com>
11321+
M: Felipe Balbi <balbi@kernel.org>
1132211322
1132311323
W: http://www.linux-usb.org/gadget
1132411324
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
@@ -11394,7 +11394,7 @@ S: Maintained
1139411394
F: drivers/net/usb/pegasus.*
1139511395

1139611396
USB PHY LAYER
11397-
M: Felipe Balbi <balbi@ti.com>
11397+
M: Felipe Balbi <balbi@kernel.org>
1139811398
1139911399
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
1140011400
S: Maintained

drivers/usb/dwc2/core.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -572,12 +572,6 @@ static bool dwc2_force_mode(struct dwc2_hsotg *hsotg, bool host)
572572
set = host ? GUSBCFG_FORCEHOSTMODE : GUSBCFG_FORCEDEVMODE;
573573
clear = host ? GUSBCFG_FORCEDEVMODE : GUSBCFG_FORCEHOSTMODE;
574574

575-
/*
576-
* If the force mode bit is already set, don't set it.
577-
*/
578-
if ((gusbcfg & set) && !(gusbcfg & clear))
579-
return false;
580-
581575
gusbcfg &= ~clear;
582576
gusbcfg |= set;
583577
dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
@@ -3278,17 +3272,13 @@ static void dwc2_get_dev_hwparams(struct dwc2_hsotg *hsotg)
32783272
/**
32793273
* During device initialization, read various hardware configuration
32803274
* registers and interpret the contents.
3281-
*
3282-
* This should be called during driver probe. It will perform a core
3283-
* soft reset in order to get the reset values of the parameters.
32843275
*/
32853276
int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
32863277
{
32873278
struct dwc2_hw_params *hw = &hsotg->hw_params;
32883279
unsigned width;
32893280
u32 hwcfg1, hwcfg2, hwcfg3, hwcfg4;
32903281
u32 grxfsiz;
3291-
int retval;
32923282

32933283
/*
32943284
* Attempt to ensure this device is really a DWC_otg Controller.
@@ -3308,10 +3298,6 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
33083298
hw->snpsid >> 12 & 0xf, hw->snpsid >> 8 & 0xf,
33093299
hw->snpsid >> 4 & 0xf, hw->snpsid & 0xf, hw->snpsid);
33103300

3311-
retval = dwc2_core_reset(hsotg);
3312-
if (retval)
3313-
return retval;
3314-
33153301
hwcfg1 = dwc2_readl(hsotg->regs + GHWCFG1);
33163302
hwcfg2 = dwc2_readl(hsotg->regs + GHWCFG2);
33173303
hwcfg3 = dwc2_readl(hsotg->regs + GHWCFG3);

drivers/usb/dwc2/platform.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,13 @@ static int dwc2_driver_probe(struct platform_device *dev)
530530
if (retval)
531531
return retval;
532532

533-
/* Reset the controller and detect hardware config values */
533+
/*
534+
* Reset before dwc2_get_hwparams() then it could get power-on real
535+
* reset value form registers.
536+
*/
537+
dwc2_core_reset_and_force_dr_mode(hsotg);
538+
539+
/* Detect config values from hardware */
534540
retval = dwc2_get_hwparams(hsotg);
535541
if (retval)
536542
goto error;

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,6 +2789,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
27892789
dwc->gadget.speed = USB_SPEED_UNKNOWN;
27902790
dwc->gadget.sg_supported = true;
27912791
dwc->gadget.name = "dwc3-gadget";
2792+
dwc->gadget.is_otg = dwc->dr_mode == USB_DR_MODE_OTG;
27922793

27932794
/*
27942795
* FIXME We might be setting max_speed to <SUPER, however versions

drivers/usb/musb/ux500.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ static int ux500_suspend(struct device *dev)
348348
struct ux500_glue *glue = dev_get_drvdata(dev);
349349
struct musb *musb = glue_to_musb(glue);
350350

351-
usb_phy_set_suspend(musb->xceiv, 1);
351+
if (musb)
352+
usb_phy_set_suspend(musb->xceiv, 1);
353+
352354
clk_disable_unprepare(glue->clk);
353355

354356
return 0;
@@ -366,7 +368,8 @@ static int ux500_resume(struct device *dev)
366368
return ret;
367369
}
368370

369-
usb_phy_set_suspend(musb->xceiv, 0);
371+
if (musb)
372+
usb_phy_set_suspend(musb->xceiv, 0);
370373

371374
return 0;
372375
}

drivers/usb/phy/phy-msm-usb.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,6 +1599,8 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg)
15991599
&motg->id.nb);
16001600
if (ret < 0) {
16011601
dev_err(&pdev->dev, "register ID notifier failed\n");
1602+
extcon_unregister_notifier(motg->vbus.extcon,
1603+
EXTCON_USB, &motg->vbus.nb);
16021604
return ret;
16031605
}
16041606

@@ -1660,15 +1662,6 @@ static int msm_otg_probe(struct platform_device *pdev)
16601662
if (!motg)
16611663
return -ENOMEM;
16621664

1663-
pdata = dev_get_platdata(&pdev->dev);
1664-
if (!pdata) {
1665-
if (!np)
1666-
return -ENXIO;
1667-
ret = msm_otg_read_dt(pdev, motg);
1668-
if (ret)
1669-
return ret;
1670-
}
1671-
16721665
motg->phy.otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
16731666
GFP_KERNEL);
16741667
if (!motg->phy.otg)
@@ -1710,15 +1703,26 @@ static int msm_otg_probe(struct platform_device *pdev)
17101703
if (!motg->regs)
17111704
return -ENOMEM;
17121705

1706+
pdata = dev_get_platdata(&pdev->dev);
1707+
if (!pdata) {
1708+
if (!np)
1709+
return -ENXIO;
1710+
ret = msm_otg_read_dt(pdev, motg);
1711+
if (ret)
1712+
return ret;
1713+
}
1714+
17131715
/*
17141716
* NOTE: The PHYs can be multiplexed between the chipidea controller
17151717
* and the dwc3 controller, using a single bit. It is important that
17161718
* the dwc3 driver does not set this bit in an incompatible way.
17171719
*/
17181720
if (motg->phy_number) {
17191721
phy_select = devm_ioremap_nocache(&pdev->dev, USB2_PHY_SEL, 4);
1720-
if (!phy_select)
1721-
return -ENOMEM;
1722+
if (!phy_select) {
1723+
ret = -ENOMEM;
1724+
goto unregister_extcon;
1725+
}
17221726
/* Enable second PHY with the OTG port */
17231727
writel(0x1, phy_select);
17241728
}
@@ -1728,7 +1732,8 @@ static int msm_otg_probe(struct platform_device *pdev)
17281732
motg->irq = platform_get_irq(pdev, 0);
17291733
if (motg->irq < 0) {
17301734
dev_err(&pdev->dev, "platform_get_irq failed\n");
1731-
return motg->irq;
1735+
ret = motg->irq;
1736+
goto unregister_extcon;
17321737
}
17331738

17341739
regs[0].supply = "vddcx";
@@ -1737,7 +1742,7 @@ static int msm_otg_probe(struct platform_device *pdev)
17371742

17381743
ret = devm_regulator_bulk_get(motg->phy.dev, ARRAY_SIZE(regs), regs);
17391744
if (ret)
1740-
return ret;
1745+
goto unregister_extcon;
17411746

17421747
motg->vddcx = regs[0].consumer;
17431748
motg->v3p3 = regs[1].consumer;
@@ -1834,6 +1839,12 @@ static int msm_otg_probe(struct platform_device *pdev)
18341839
clk_disable_unprepare(motg->clk);
18351840
if (!IS_ERR(motg->core_clk))
18361841
clk_disable_unprepare(motg->core_clk);
1842+
unregister_extcon:
1843+
extcon_unregister_notifier(motg->id.extcon,
1844+
EXTCON_USB_HOST, &motg->id.nb);
1845+
extcon_unregister_notifier(motg->vbus.extcon,
1846+
EXTCON_USB, &motg->vbus.nb);
1847+
18371848
return ret;
18381849
}
18391850

drivers/usb/phy/phy-mxs-usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
220220
/* Return true if the vbus is there */
221221
static bool mxs_phy_get_vbus_status(struct mxs_phy *mxs_phy)
222222
{
223-
unsigned int vbus_value;
223+
unsigned int vbus_value = 0;
224224

225225
if (!mxs_phy->regmap_anatop)
226226
return false;

0 commit comments

Comments
 (0)