Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: musb: jz4740: obtain USB PHY from devicetree

Fall back to devm_usb_get_phy() if devicetree is not available.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Paul Cercueil and committed by
Greg Kroah-Hartman
afbdbd37 82257c73

+7 -10
+7 -10
drivers/usb/musb/jz4740.c
··· 74 74 75 75 static int jz4740_musb_init(struct musb *musb) 76 76 { 77 - musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); 77 + struct device *dev = musb->controller->parent; 78 + 79 + if (dev->of_node) 80 + musb->xceiv = devm_usb_get_phy_by_phandle(dev, "phys", 0); 81 + else 82 + musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); 78 83 if (IS_ERR(musb->xceiv)) { 79 - pr_err("HS UDC: no transceiver configured\n"); 84 + dev_err(dev, "No transceiver configured\n"); 80 85 return PTR_ERR(musb->xceiv); 81 86 } 82 87 ··· 95 90 return 0; 96 91 } 97 92 98 - static int jz4740_musb_exit(struct musb *musb) 99 - { 100 - usb_put_phy(musb->xceiv); 101 - 102 - return 0; 103 - } 104 - 105 93 /* 106 94 * DMA has not been confirmed to work with CONFIG_USB_INVENTRA_DMA, 107 95 * so let's not set up the dma function pointers yet. ··· 103 105 .quirks = MUSB_DMA_INVENTRA | MUSB_INDEXED_EP, 104 106 .fifo_mode = 2, 105 107 .init = jz4740_musb_init, 106 - .exit = jz4740_musb_exit, 107 108 }; 108 109 109 110 static int jz4740_probe(struct platform_device *pdev)