diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-02-25 17:57:31 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-03-02 09:11:59 +0100 |
commit | f3fd93c1c6cc4d9ab5c6e9f4d7475f75e1b659b8 (patch) | |
tree | 39d0893a5d1307204de68a1f7dfcbd6550756081 /drivers/usb/musb/musb_dsps.c | |
parent | adf29dfec0d5d60103b89a7144aefa776205996d (diff) | |
download | barebox-f3fd93c1c6cc4d9ab5c6e9f4d7475f75e1b659b8.tar.gz barebox-f3fd93c1c6cc4d9ab5c6e9f4d7475f75e1b659b8.tar.xz |
USB: MUSB: defer driver probes where necessary
Kernel commit 0782e8572c ("ARM: dts: Probe am335x musb with ti-sysc")
which we pulled in during the v2020.02.0 dts/ sync moved the USB nodes
to be under a ti-sysc bus instead of ti,am33xx-usb.
This new probe order broke am335x USB under barebox, because the MUSB
drivers couldn't cope with the now different device probe order.
Pepper some -EPROBE_DEFER around to make USB work again.
Fixes: 574eed3f6f ("dts: update to v5.5-rc1")
Reported-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/usb/musb/musb_dsps.c')
-rw-r--r-- | drivers/usb/musb/musb_dsps.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index f306729148..d54a663e9d 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -314,7 +314,7 @@ static int dsps_set_mode(void *ctx, enum usb_dr_mode mode) static int dsps_probe(struct device_d *dev) { - struct resource *iores; + struct resource *iores[2]; struct musb_hdrc_platform_data *pdata; struct musb_hdrc_config *config; struct device_node *dn = dev->device_node; @@ -354,15 +354,19 @@ static int dsps_probe(struct device_d *dev) pdata = &glue->pdata; - iores = dev_request_mem_resource(dev, 0); - if (IS_ERR(iores)) - return PTR_ERR(iores); - glue->musb.mregs = IOMEM(iores->start); + iores[0] = dev_request_mem_resource(dev, 0); + if (IS_ERR(iores[0])) { + ret = PTR_ERR(iores[0]); + goto free_glue; + } + glue->musb.mregs = IOMEM(iores[0]->start); - iores = dev_request_mem_resource(dev, 1); - if (IS_ERR(iores)) - return PTR_ERR(iores); - glue->musb.ctrl_base = IOMEM(iores->start); + iores[1] = dev_request_mem_resource(dev, 1); + if (IS_ERR(iores[1])) { + ret = PTR_ERR(iores[1]); + goto release_iores0; + } + glue->musb.ctrl_base = IOMEM(iores[1]->start); glue->musb.controller = dev; glue->musb.xceiv = phy_dev->priv; @@ -383,11 +387,24 @@ static int dsps_probe(struct device_d *dev) if (pdata->mode == MUSB_PORT_MODE_DUAL_ROLE) { ret = usb_register_otg_device(dev, dsps_set_mode, glue); if (ret) - return ret; + goto release_iores1; return 0; } - return musb_init_controller(&glue->musb, pdata); + ret = musb_init_controller(&glue->musb, pdata); + if (ret) + goto release_iores1; + + return 0; + +release_iores1: + release_region(iores[1]); +release_iores0: + release_region(iores[0]); +free_glue: + free(glue); + + return ret; } static const struct dsps_musb_wrapper am33xx_driver_data = { |