xref: /openbmc/linux/drivers/phy/broadcom/phy-bcm-sr-usb.c (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
14dcddbb3SSrinath Mannam // SPDX-License-Identifier: GPL-2.0
24dcddbb3SSrinath Mannam /*
34dcddbb3SSrinath Mannam  * Copyright (C) 2016-2018 Broadcom
44dcddbb3SSrinath Mannam  */
54dcddbb3SSrinath Mannam 
64dcddbb3SSrinath Mannam #include <linux/delay.h>
74dcddbb3SSrinath Mannam #include <linux/io.h>
86f2a7218SChunfeng Yun #include <linux/iopoll.h>
94dcddbb3SSrinath Mannam #include <linux/module.h>
104dcddbb3SSrinath Mannam #include <linux/of.h>
114dcddbb3SSrinath Mannam #include <linux/phy/phy.h>
124dcddbb3SSrinath Mannam #include <linux/platform_device.h>
134dcddbb3SSrinath Mannam 
144dcddbb3SSrinath Mannam enum bcm_usb_phy_version {
154dcddbb3SSrinath Mannam 	BCM_SR_USB_COMBO_PHY,
164dcddbb3SSrinath Mannam 	BCM_SR_USB_HS_PHY,
174dcddbb3SSrinath Mannam };
184dcddbb3SSrinath Mannam 
194dcddbb3SSrinath Mannam enum bcm_usb_phy_reg {
204dcddbb3SSrinath Mannam 	PLL_CTRL,
214dcddbb3SSrinath Mannam 	PHY_CTRL,
224dcddbb3SSrinath Mannam 	PHY_PLL_CTRL,
234dcddbb3SSrinath Mannam };
244dcddbb3SSrinath Mannam 
254dcddbb3SSrinath Mannam /* USB PHY registers */
264dcddbb3SSrinath Mannam 
274dcddbb3SSrinath Mannam static const u8 bcm_usb_combo_phy_ss[] = {
284dcddbb3SSrinath Mannam 	[PLL_CTRL]		= 0x18,
294dcddbb3SSrinath Mannam 	[PHY_CTRL]		= 0x14,
304dcddbb3SSrinath Mannam };
314dcddbb3SSrinath Mannam 
324dcddbb3SSrinath Mannam static const u8 bcm_usb_combo_phy_hs[] = {
334dcddbb3SSrinath Mannam 	[PLL_CTRL]	= 0x0c,
344dcddbb3SSrinath Mannam 	[PHY_CTRL]	= 0x10,
354dcddbb3SSrinath Mannam };
364dcddbb3SSrinath Mannam 
374dcddbb3SSrinath Mannam static const u8 bcm_usb_hs_phy[] = {
384dcddbb3SSrinath Mannam 	[PLL_CTRL]	= 0x8,
394dcddbb3SSrinath Mannam 	[PHY_CTRL]	= 0xc,
404dcddbb3SSrinath Mannam };
414dcddbb3SSrinath Mannam 
424dcddbb3SSrinath Mannam enum pll_ctrl_bits {
434dcddbb3SSrinath Mannam 	PLL_RESETB,
444dcddbb3SSrinath Mannam 	SSPLL_SUSPEND_EN,
454dcddbb3SSrinath Mannam 	PLL_SEQ_START,
464dcddbb3SSrinath Mannam 	PLL_LOCK,
474dcddbb3SSrinath Mannam };
484dcddbb3SSrinath Mannam 
494dcddbb3SSrinath Mannam static const u8 u3pll_ctrl[] = {
504dcddbb3SSrinath Mannam 	[PLL_RESETB]		= 0,
514dcddbb3SSrinath Mannam 	[SSPLL_SUSPEND_EN]	= 1,
524dcddbb3SSrinath Mannam 	[PLL_SEQ_START]		= 2,
534dcddbb3SSrinath Mannam 	[PLL_LOCK]		= 3,
544dcddbb3SSrinath Mannam };
554dcddbb3SSrinath Mannam 
564dcddbb3SSrinath Mannam #define HSPLL_PDIV_MASK		0xF
574dcddbb3SSrinath Mannam #define HSPLL_PDIV_VAL		0x1
584dcddbb3SSrinath Mannam 
594dcddbb3SSrinath Mannam static const u8 u2pll_ctrl[] = {
604dcddbb3SSrinath Mannam 	[PLL_RESETB]	= 5,
614dcddbb3SSrinath Mannam 	[PLL_LOCK]	= 6,
624dcddbb3SSrinath Mannam };
634dcddbb3SSrinath Mannam 
644dcddbb3SSrinath Mannam enum bcm_usb_phy_ctrl_bits {
654dcddbb3SSrinath Mannam 	CORERDY,
664dcddbb3SSrinath Mannam 	PHY_RESETB,
674dcddbb3SSrinath Mannam 	PHY_PCTL,
684dcddbb3SSrinath Mannam };
694dcddbb3SSrinath Mannam 
704dcddbb3SSrinath Mannam #define PHY_PCTL_MASK	0xffff
714dcddbb3SSrinath Mannam #define SSPHY_PCTL_VAL	0x0006
724dcddbb3SSrinath Mannam 
734dcddbb3SSrinath Mannam static const u8 u3phy_ctrl[] = {
744dcddbb3SSrinath Mannam 	[PHY_RESETB]	= 1,
754dcddbb3SSrinath Mannam 	[PHY_PCTL]	= 2,
764dcddbb3SSrinath Mannam };
774dcddbb3SSrinath Mannam 
784dcddbb3SSrinath Mannam static const u8 u2phy_ctrl[] = {
794dcddbb3SSrinath Mannam 	[CORERDY]		= 0,
804dcddbb3SSrinath Mannam 	[PHY_RESETB]		= 5,
814dcddbb3SSrinath Mannam 	[PHY_PCTL]		= 6,
824dcddbb3SSrinath Mannam };
834dcddbb3SSrinath Mannam 
844dcddbb3SSrinath Mannam struct bcm_usb_phy_cfg {
854dcddbb3SSrinath Mannam 	uint32_t type;
864dcddbb3SSrinath Mannam 	uint32_t version;
874dcddbb3SSrinath Mannam 	void __iomem *regs;
884dcddbb3SSrinath Mannam 	struct phy *phy;
894dcddbb3SSrinath Mannam 	const u8 *offset;
904dcddbb3SSrinath Mannam };
914dcddbb3SSrinath Mannam 
924dcddbb3SSrinath Mannam #define PLL_LOCK_RETRY_COUNT	1000
934dcddbb3SSrinath Mannam 
944dcddbb3SSrinath Mannam enum bcm_usb_phy_type {
954dcddbb3SSrinath Mannam 	USB_HS_PHY,
964dcddbb3SSrinath Mannam 	USB_SS_PHY,
974dcddbb3SSrinath Mannam };
984dcddbb3SSrinath Mannam 
994dcddbb3SSrinath Mannam #define NUM_BCM_SR_USB_COMBO_PHYS	2
1004dcddbb3SSrinath Mannam 
bcm_usb_reg32_clrbits(void __iomem * addr,uint32_t clear)1014dcddbb3SSrinath Mannam static inline void bcm_usb_reg32_clrbits(void __iomem *addr, uint32_t clear)
1024dcddbb3SSrinath Mannam {
1034dcddbb3SSrinath Mannam 	writel(readl(addr) & ~clear, addr);
1044dcddbb3SSrinath Mannam }
1054dcddbb3SSrinath Mannam 
bcm_usb_reg32_setbits(void __iomem * addr,uint32_t set)1064dcddbb3SSrinath Mannam static inline void bcm_usb_reg32_setbits(void __iomem *addr, uint32_t set)
1074dcddbb3SSrinath Mannam {
1084dcddbb3SSrinath Mannam 	writel(readl(addr) | set, addr);
1094dcddbb3SSrinath Mannam }
1104dcddbb3SSrinath Mannam 
bcm_usb_pll_lock_check(void __iomem * addr,u32 bit)1114dcddbb3SSrinath Mannam static int bcm_usb_pll_lock_check(void __iomem *addr, u32 bit)
1124dcddbb3SSrinath Mannam {
1136f2a7218SChunfeng Yun 	u32 data;
1146f2a7218SChunfeng Yun 	int ret;
1154dcddbb3SSrinath Mannam 
1166f2a7218SChunfeng Yun 	ret = readl_poll_timeout_atomic(addr, data, (data & bit), 1,
1176f2a7218SChunfeng Yun 					PLL_LOCK_RETRY_COUNT);
1186f2a7218SChunfeng Yun 	if (ret)
1194dcddbb3SSrinath Mannam 		pr_err("%s: FAIL\n", __func__);
1206f2a7218SChunfeng Yun 
1216f2a7218SChunfeng Yun 	return ret;
1224dcddbb3SSrinath Mannam }
1234dcddbb3SSrinath Mannam 
bcm_usb_ss_phy_init(struct bcm_usb_phy_cfg * phy_cfg)1244dcddbb3SSrinath Mannam static int bcm_usb_ss_phy_init(struct bcm_usb_phy_cfg *phy_cfg)
1254dcddbb3SSrinath Mannam {
1264dcddbb3SSrinath Mannam 	int ret = 0;
1274dcddbb3SSrinath Mannam 	void __iomem *regs = phy_cfg->regs;
1284dcddbb3SSrinath Mannam 	const u8 *offset;
1294dcddbb3SSrinath Mannam 	u32 rd_data;
1304dcddbb3SSrinath Mannam 
1314dcddbb3SSrinath Mannam 	offset = phy_cfg->offset;
1324dcddbb3SSrinath Mannam 
1334dcddbb3SSrinath Mannam 	/* Set pctl with mode and soft reset */
1344dcddbb3SSrinath Mannam 	rd_data = readl(regs + offset[PHY_CTRL]);
1354dcddbb3SSrinath Mannam 	rd_data &= ~(PHY_PCTL_MASK << u3phy_ctrl[PHY_PCTL]);
1364dcddbb3SSrinath Mannam 	rd_data |= (SSPHY_PCTL_VAL << u3phy_ctrl[PHY_PCTL]);
1374dcddbb3SSrinath Mannam 	writel(rd_data, regs + offset[PHY_CTRL]);
1384dcddbb3SSrinath Mannam 
1394dcddbb3SSrinath Mannam 	bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL],
1404dcddbb3SSrinath Mannam 			      BIT(u3pll_ctrl[SSPLL_SUSPEND_EN]));
1414dcddbb3SSrinath Mannam 	bcm_usb_reg32_setbits(regs + offset[PLL_CTRL],
1424dcddbb3SSrinath Mannam 			      BIT(u3pll_ctrl[PLL_SEQ_START]));
1434dcddbb3SSrinath Mannam 	bcm_usb_reg32_setbits(regs + offset[PLL_CTRL],
1444dcddbb3SSrinath Mannam 			      BIT(u3pll_ctrl[PLL_RESETB]));
1454dcddbb3SSrinath Mannam 
1464dcddbb3SSrinath Mannam 	/* Maximum timeout for PLL reset done */
1474dcddbb3SSrinath Mannam 	msleep(30);
1484dcddbb3SSrinath Mannam 
1494dcddbb3SSrinath Mannam 	ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL],
1504dcddbb3SSrinath Mannam 				     BIT(u3pll_ctrl[PLL_LOCK]));
1514dcddbb3SSrinath Mannam 
1524dcddbb3SSrinath Mannam 	return ret;
1534dcddbb3SSrinath Mannam }
1544dcddbb3SSrinath Mannam 
bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg * phy_cfg)1554dcddbb3SSrinath Mannam static int bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg *phy_cfg)
1564dcddbb3SSrinath Mannam {
1574dcddbb3SSrinath Mannam 	int ret = 0;
1584dcddbb3SSrinath Mannam 	void __iomem *regs = phy_cfg->regs;
1594dcddbb3SSrinath Mannam 	const u8 *offset;
1604dcddbb3SSrinath Mannam 
1614dcddbb3SSrinath Mannam 	offset = phy_cfg->offset;
1624dcddbb3SSrinath Mannam 
1636f0577d1SBharat Gooty 	bcm_usb_reg32_clrbits(regs + offset[PLL_CTRL],
1646f0577d1SBharat Gooty 			      BIT(u2pll_ctrl[PLL_RESETB]));
1654dcddbb3SSrinath Mannam 	bcm_usb_reg32_setbits(regs + offset[PLL_CTRL],
1664dcddbb3SSrinath Mannam 			      BIT(u2pll_ctrl[PLL_RESETB]));
1674dcddbb3SSrinath Mannam 
1684dcddbb3SSrinath Mannam 	ret = bcm_usb_pll_lock_check(regs + offset[PLL_CTRL],
1694dcddbb3SSrinath Mannam 				     BIT(u2pll_ctrl[PLL_LOCK]));
1704dcddbb3SSrinath Mannam 
1714dcddbb3SSrinath Mannam 	return ret;
1724dcddbb3SSrinath Mannam }
1734dcddbb3SSrinath Mannam 
bcm_usb_phy_reset(struct phy * phy)1744dcddbb3SSrinath Mannam static int bcm_usb_phy_reset(struct phy *phy)
1754dcddbb3SSrinath Mannam {
1764dcddbb3SSrinath Mannam 	struct bcm_usb_phy_cfg *phy_cfg = phy_get_drvdata(phy);
1774dcddbb3SSrinath Mannam 	void __iomem *regs = phy_cfg->regs;
1784dcddbb3SSrinath Mannam 	const u8 *offset;
1794dcddbb3SSrinath Mannam 
1804dcddbb3SSrinath Mannam 	offset = phy_cfg->offset;
1814dcddbb3SSrinath Mannam 
1824dcddbb3SSrinath Mannam 	if (phy_cfg->type == USB_HS_PHY) {
1834dcddbb3SSrinath Mannam 		bcm_usb_reg32_clrbits(regs + offset[PHY_CTRL],
1844dcddbb3SSrinath Mannam 				      BIT(u2phy_ctrl[CORERDY]));
1854dcddbb3SSrinath Mannam 		bcm_usb_reg32_setbits(regs + offset[PHY_CTRL],
1864dcddbb3SSrinath Mannam 				      BIT(u2phy_ctrl[CORERDY]));
1874dcddbb3SSrinath Mannam 	}
1884dcddbb3SSrinath Mannam 
1894dcddbb3SSrinath Mannam 	return 0;
1904dcddbb3SSrinath Mannam }
1914dcddbb3SSrinath Mannam 
bcm_usb_phy_init(struct phy * phy)1924dcddbb3SSrinath Mannam static int bcm_usb_phy_init(struct phy *phy)
1934dcddbb3SSrinath Mannam {
1944dcddbb3SSrinath Mannam 	struct bcm_usb_phy_cfg *phy_cfg = phy_get_drvdata(phy);
1954dcddbb3SSrinath Mannam 	int ret = -EINVAL;
1964dcddbb3SSrinath Mannam 
1974dcddbb3SSrinath Mannam 	if (phy_cfg->type == USB_SS_PHY)
1984dcddbb3SSrinath Mannam 		ret = bcm_usb_ss_phy_init(phy_cfg);
1994dcddbb3SSrinath Mannam 	else if (phy_cfg->type == USB_HS_PHY)
2004dcddbb3SSrinath Mannam 		ret = bcm_usb_hs_phy_init(phy_cfg);
2014dcddbb3SSrinath Mannam 
2024dcddbb3SSrinath Mannam 	return ret;
2034dcddbb3SSrinath Mannam }
2044dcddbb3SSrinath Mannam 
205cbe72af1SRikard Falkeborn static const struct phy_ops sr_phy_ops = {
2064dcddbb3SSrinath Mannam 	.init		= bcm_usb_phy_init,
2074dcddbb3SSrinath Mannam 	.reset		= bcm_usb_phy_reset,
2084dcddbb3SSrinath Mannam 	.owner		= THIS_MODULE,
2094dcddbb3SSrinath Mannam };
2104dcddbb3SSrinath Mannam 
bcm_usb_phy_xlate(struct device * dev,struct of_phandle_args * args)2114dcddbb3SSrinath Mannam static struct phy *bcm_usb_phy_xlate(struct device *dev,
2124dcddbb3SSrinath Mannam 				     struct of_phandle_args *args)
2134dcddbb3SSrinath Mannam {
2144dcddbb3SSrinath Mannam 	struct bcm_usb_phy_cfg *phy_cfg;
2154dcddbb3SSrinath Mannam 	int phy_idx;
2164dcddbb3SSrinath Mannam 
2174dcddbb3SSrinath Mannam 	phy_cfg = dev_get_drvdata(dev);
2184dcddbb3SSrinath Mannam 	if (!phy_cfg)
2194dcddbb3SSrinath Mannam 		return ERR_PTR(-EINVAL);
2204dcddbb3SSrinath Mannam 
2214dcddbb3SSrinath Mannam 	if (phy_cfg->version == BCM_SR_USB_COMBO_PHY) {
2224dcddbb3SSrinath Mannam 		phy_idx = args->args[0];
2234dcddbb3SSrinath Mannam 
2244dcddbb3SSrinath Mannam 		if (WARN_ON(phy_idx > 1))
2254dcddbb3SSrinath Mannam 			return ERR_PTR(-ENODEV);
2264dcddbb3SSrinath Mannam 
2274dcddbb3SSrinath Mannam 		return phy_cfg[phy_idx].phy;
2284dcddbb3SSrinath Mannam 	} else
2294dcddbb3SSrinath Mannam 		return phy_cfg->phy;
2304dcddbb3SSrinath Mannam }
2314dcddbb3SSrinath Mannam 
bcm_usb_phy_create(struct device * dev,struct device_node * node,void __iomem * regs,uint32_t version)2324dcddbb3SSrinath Mannam static int bcm_usb_phy_create(struct device *dev, struct device_node *node,
2334dcddbb3SSrinath Mannam 			      void __iomem *regs, uint32_t version)
2344dcddbb3SSrinath Mannam {
2354dcddbb3SSrinath Mannam 	struct bcm_usb_phy_cfg *phy_cfg;
2364dcddbb3SSrinath Mannam 	int idx;
2374dcddbb3SSrinath Mannam 
2384dcddbb3SSrinath Mannam 	if (version == BCM_SR_USB_COMBO_PHY) {
2394dcddbb3SSrinath Mannam 		phy_cfg = devm_kzalloc(dev, NUM_BCM_SR_USB_COMBO_PHYS *
2404dcddbb3SSrinath Mannam 				       sizeof(struct bcm_usb_phy_cfg),
2414dcddbb3SSrinath Mannam 				       GFP_KERNEL);
2424dcddbb3SSrinath Mannam 		if (!phy_cfg)
2434dcddbb3SSrinath Mannam 			return -ENOMEM;
2444dcddbb3SSrinath Mannam 
2454dcddbb3SSrinath Mannam 		for (idx = 0; idx < NUM_BCM_SR_USB_COMBO_PHYS; idx++) {
2464dcddbb3SSrinath Mannam 			phy_cfg[idx].regs = regs;
2474dcddbb3SSrinath Mannam 			phy_cfg[idx].version = version;
2484dcddbb3SSrinath Mannam 			if (idx == 0) {
2494dcddbb3SSrinath Mannam 				phy_cfg[idx].offset = bcm_usb_combo_phy_hs;
2504dcddbb3SSrinath Mannam 				phy_cfg[idx].type = USB_HS_PHY;
2514dcddbb3SSrinath Mannam 			} else {
2524dcddbb3SSrinath Mannam 				phy_cfg[idx].offset = bcm_usb_combo_phy_ss;
2534dcddbb3SSrinath Mannam 				phy_cfg[idx].type = USB_SS_PHY;
2544dcddbb3SSrinath Mannam 			}
2554dcddbb3SSrinath Mannam 			phy_cfg[idx].phy = devm_phy_create(dev, node,
2564dcddbb3SSrinath Mannam 							   &sr_phy_ops);
2574dcddbb3SSrinath Mannam 			if (IS_ERR(phy_cfg[idx].phy))
2584dcddbb3SSrinath Mannam 				return PTR_ERR(phy_cfg[idx].phy);
2594dcddbb3SSrinath Mannam 
2604dcddbb3SSrinath Mannam 			phy_set_drvdata(phy_cfg[idx].phy, &phy_cfg[idx]);
2614dcddbb3SSrinath Mannam 		}
2624dcddbb3SSrinath Mannam 	} else if (version == BCM_SR_USB_HS_PHY) {
2634dcddbb3SSrinath Mannam 		phy_cfg = devm_kzalloc(dev, sizeof(struct bcm_usb_phy_cfg),
2644dcddbb3SSrinath Mannam 				       GFP_KERNEL);
2654dcddbb3SSrinath Mannam 		if (!phy_cfg)
2664dcddbb3SSrinath Mannam 			return -ENOMEM;
2674dcddbb3SSrinath Mannam 
2684dcddbb3SSrinath Mannam 		phy_cfg->regs = regs;
2694dcddbb3SSrinath Mannam 		phy_cfg->version = version;
2704dcddbb3SSrinath Mannam 		phy_cfg->offset = bcm_usb_hs_phy;
2714dcddbb3SSrinath Mannam 		phy_cfg->type = USB_HS_PHY;
2724dcddbb3SSrinath Mannam 		phy_cfg->phy = devm_phy_create(dev, node, &sr_phy_ops);
2734dcddbb3SSrinath Mannam 		if (IS_ERR(phy_cfg->phy))
2744dcddbb3SSrinath Mannam 			return PTR_ERR(phy_cfg->phy);
2754dcddbb3SSrinath Mannam 
2764dcddbb3SSrinath Mannam 		phy_set_drvdata(phy_cfg->phy, phy_cfg);
2774dcddbb3SSrinath Mannam 	} else
2784dcddbb3SSrinath Mannam 		return -ENODEV;
2794dcddbb3SSrinath Mannam 
2804dcddbb3SSrinath Mannam 	dev_set_drvdata(dev, phy_cfg);
2814dcddbb3SSrinath Mannam 
2824dcddbb3SSrinath Mannam 	return 0;
2834dcddbb3SSrinath Mannam }
2844dcddbb3SSrinath Mannam 
2854dcddbb3SSrinath Mannam static const struct of_device_id bcm_usb_phy_of_match[] = {
2864dcddbb3SSrinath Mannam 	{
2874dcddbb3SSrinath Mannam 		.compatible = "brcm,sr-usb-combo-phy",
2884dcddbb3SSrinath Mannam 		.data = (void *)BCM_SR_USB_COMBO_PHY,
2894dcddbb3SSrinath Mannam 	},
2904dcddbb3SSrinath Mannam 	{
2914dcddbb3SSrinath Mannam 		.compatible = "brcm,sr-usb-hs-phy",
2924dcddbb3SSrinath Mannam 		.data = (void *)BCM_SR_USB_HS_PHY,
2934dcddbb3SSrinath Mannam 	},
2944dcddbb3SSrinath Mannam 	{ /* sentinel */ },
2954dcddbb3SSrinath Mannam };
2964dcddbb3SSrinath Mannam MODULE_DEVICE_TABLE(of, bcm_usb_phy_of_match);
2974dcddbb3SSrinath Mannam 
bcm_usb_phy_probe(struct platform_device * pdev)2984dcddbb3SSrinath Mannam static int bcm_usb_phy_probe(struct platform_device *pdev)
2994dcddbb3SSrinath Mannam {
3004dcddbb3SSrinath Mannam 	struct device *dev = &pdev->dev;
3014dcddbb3SSrinath Mannam 	struct device_node *dn = dev->of_node;
3024dcddbb3SSrinath Mannam 	const struct of_device_id *of_id;
3034dcddbb3SSrinath Mannam 	void __iomem *regs;
3044dcddbb3SSrinath Mannam 	int ret;
3054dcddbb3SSrinath Mannam 	enum bcm_usb_phy_version version;
3064dcddbb3SSrinath Mannam 	struct phy_provider *phy_provider;
3074dcddbb3SSrinath Mannam 
308f669bc8bSChunfeng Yun 	regs = devm_platform_ioremap_resource(pdev, 0);
3094dcddbb3SSrinath Mannam 	if (IS_ERR(regs))
3104dcddbb3SSrinath Mannam 		return PTR_ERR(regs);
3114dcddbb3SSrinath Mannam 
3124dcddbb3SSrinath Mannam 	of_id = of_match_node(bcm_usb_phy_of_match, dn);
3134dcddbb3SSrinath Mannam 	if (of_id)
314*2bc00b9bSKrzysztof Kozlowski 		version = (uintptr_t)of_id->data;
3154dcddbb3SSrinath Mannam 	else
3164dcddbb3SSrinath Mannam 		return -ENODEV;
3174dcddbb3SSrinath Mannam 
3184dcddbb3SSrinath Mannam 	ret = bcm_usb_phy_create(dev, dn, regs, version);
3194dcddbb3SSrinath Mannam 	if (ret)
3204dcddbb3SSrinath Mannam 		return ret;
3214dcddbb3SSrinath Mannam 
3224dcddbb3SSrinath Mannam 	phy_provider = devm_of_phy_provider_register(dev, bcm_usb_phy_xlate);
3234dcddbb3SSrinath Mannam 
3244dcddbb3SSrinath Mannam 	return PTR_ERR_OR_ZERO(phy_provider);
3254dcddbb3SSrinath Mannam }
3264dcddbb3SSrinath Mannam 
3274dcddbb3SSrinath Mannam static struct platform_driver bcm_usb_phy_driver = {
3284dcddbb3SSrinath Mannam 	.driver = {
3294dcddbb3SSrinath Mannam 		.name = "phy-bcm-sr-usb",
3304dcddbb3SSrinath Mannam 		.of_match_table = bcm_usb_phy_of_match,
3314dcddbb3SSrinath Mannam 	},
3324dcddbb3SSrinath Mannam 	.probe = bcm_usb_phy_probe,
3334dcddbb3SSrinath Mannam };
3344dcddbb3SSrinath Mannam module_platform_driver(bcm_usb_phy_driver);
3354dcddbb3SSrinath Mannam 
3364dcddbb3SSrinath Mannam MODULE_AUTHOR("Broadcom");
3374dcddbb3SSrinath Mannam MODULE_DESCRIPTION("Broadcom stingray USB Phy driver");
3384dcddbb3SSrinath Mannam MODULE_LICENSE("GPL v2");
339