Skip to contentSkip to conversation

usb: musb: un-break davinci glue layer

PATCH New Alejandro Mery 2 participants 4 messages Dec 8, 2017 – Dec 19, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 usb: musb: un-break davinci glue layer

MUSB's davinci glue was made to depend on BROKEN by Felipe Balbi back in 2013 because of lack of active development. needed changes were actually trivial

Fixes 787f5627bec8 (usb: musb: make davinci and da8xx glues depend on BROKEN)
---
 drivers/usb/musb/Kconfig   |  1 -
 drivers/usb/musb/davinci.c | 20 ++++++++++----------
 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/usb/musb/Kconfig +0 -1
index 5506a9c03c1f..e13320eebbbf 100644
@@ -76,7 +76,6 @@ config USB_MUSB_DAVINCI
 	tristate "DaVinci"
 	depends on ARCH_DAVINCI_DMx
 	depends on NOP_USB_XCEIV
-	depends on BROKEN
 
 config USB_MUSB_DA8XX
 	tristate "DA8xx/OMAP-L1x"
drivers/usb/musb/davinci.c +10 -10
index 2ad39dcd2f4c..6571f9e59f8f 100644
@@ -39,6 +39,7 @@
 struct davinci_glue {
 	struct device		*dev;
 	struct platform_device	*musb;
+	struct platform_device	*phy;
 	struct clk		*clk;
 };
 
@@ -363,10 +364,8 @@ static int davinci_musb_init(struct musb *musb)
 	int 		ret = -ENODEV;
 
 	musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
-	if (IS_ERR_OR_NULL(musb->xceiv)) {
-		ret = -EPROBE_DEFER;
-		goto unregister;
-	}
+	if (IS_ERR_OR_NULL(musb->xceiv))
+		return -EPROBE_DEFER;
 
 	musb->mregs += DAVINCI_BASE_OFFSET;
 
@@ -418,8 +417,6 @@ static int davinci_musb_init(struct musb *musb)
 
 fail:
 	usb_put_phy(musb->xceiv);
-unregister:
-	usb_phy_generic_unregister();
 	return ret;
 }
 
@@ -527,7 +524,9 @@ static int davinci_probe(struct platform_device *pdev)
 
 	pdata->platform_ops		= &davinci_ops;
 
-	usb_phy_generic_register();
+	glue->phy = usb_phy_generic_register();
+	if (IS_ERR(glue->phy))
+		goto err1;
 	platform_set_drvdata(pdev, glue);
 
 	memset(musb_resources, 0x00, sizeof(*musb_resources) *
@@ -563,14 +562,15 @@ static int davinci_probe(struct platform_device *pdev)
 	if (IS_ERR(musb)) {
 		ret = PTR_ERR(musb);
 		dev_err(&pdev->dev, "failed to register musb device: %d\n", ret);
-		goto err1;
+		goto err2;
 	}
 
 	return 0;
 
+err2:
+	usb_phy_generic_unregister(glue->phy);
 err1:
 	clk_disable(clk);
-
 err0:
 	return ret;
 }
@@ -580,7 +580,7 @@ static int davinci_remove(struct platform_device *pdev)
 	struct davinci_glue		*glue = platform_get_drvdata(pdev);
 
 	platform_device_unregister(glue->musb);
-	usb_phy_generic_unregister();
+	usb_phy_generic_unregister(glue->phy);
 	clk_disable(glue->clk);
 
 	return 0;
Signature · 1 line
2.15.0
#1 lore raw

PATCH 2/2 usb: musb: davinci: Pass file_mode in platform data

as it was done for glues to allow setting the correct fifo_mode when multiple MUSB glue layers are built-in

Fixes 8a77f05aa39b ("usb: musb: Pass fifo_mode in platform data")
---
 drivers/usb/musb/davinci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/musb/davinci.c +1 -0
index 6571f9e59f8f..2632efd3d598 100644
@@ -472,6 +472,7 @@ static const struct musb_platform_ops davinci_ops = {
 	.quirks		= MUSB_DMA_CPPI,
 	.init		= davinci_musb_init,
 	.exit		= davinci_musb_exit,
+	.fifo_mode	= 2,
 
 #ifdef CONFIG_USB_TI_CPPI_DMA
 	.dma_init	= cppi_dma_controller_create,
Signature · 1 line
2.15.0
maintainer
#2 lore raw

PATCH 1/2 usb: musb: un-break davinci glue layer

In reply to Alejandro Mery

Hi Alejandro,

Quoted 5 lines · Alejandro Mery

MUSB's davinci glue was made to depend on BROKEN by Felipe Balbi back in 2013 because of lack of active development. needed changes were actually trivial

Fixes 787f5627bec8 (usb: musb: make davinci and da8xx glues depend on BROKEN)

Thanks for the effort to re-enable this driver. But due to lack of development, other than the phy and fifo mode which you try to fix with these two patches, the driver still doesn't fit in the current driver framework, for example,

- the driver depends on mach/ header for CPU and board type;
- clk control is not separated;
- gpio control vbus should use extcon driver;

So I feel it is not ready to un-broken it yet, unless others have different opinion.

But I could take these two patches if not remove BROKEN from Kconfig.

Regards,
-Bin.

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#4 lore raw

PATCH 1/2 usb: musb: un-break davinci glue layer

Quoted 16 lines · Alejandro Mery

Hi Bin,

Quoted 13 lines · Bin Liu

Hi Alejandro,

Quoted 5 lines · Alejandro Mery

MUSB's davinci glue was made to depend on BROKEN by Felipe Balbi back in 2013 because of lack of active development. needed changes were actually trivial

Fixes 787f5627bec8 (usb: musb: make davinci and da8xx glues depend on BROKEN)

Thanks for the effort to re-enable this driver. But due to lack of development, other than the phy and fifo mode which you try to fix with these two patches, the driver still doesn't fit in the current driver framework, for example,

Quoted 5 lines
Quoted 3 lines

- the driver depends on mach/ header for CPU and board type;
- clk control is not separated;
- gpio control vbus should use extcon driver;

I'll try to fix these issues but it will take a while. I'm still struggling to get USB working at all on the DM365 EVM

Thanks for the effort.

Quoted 8 lines
Quoted 6 lines

So I feel it is not ready to un-broken it yet, unless others have different opinion.

But I could take these two patches if not remove BROKEN from Kconfig.

do you want a v2 for that?

That will be great!

Thanks,
-Bin.