Lines Matching +full:syscon +full:- +full:clkset
1 // SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/mfd/syscon.h>
25 struct regmap *clkset; member
35 struct device *dev = usb2->dev; in bcm_ns_usb2_phy_init()
39 err = clk_prepare_enable(usb2->ref_clk); in bcm_ns_usb2_phy_init()
45 ref_clk_rate = clk_get_rate(usb2->ref_clk); in bcm_ns_usb2_phy_init()
48 err = -EINVAL; in bcm_ns_usb2_phy_init()
52 if (usb2->base) in bcm_ns_usb2_phy_init()
53 usb2ctl = readl(usb2->base); in bcm_ns_usb2_phy_init()
55 usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); in bcm_ns_usb2_phy_init()
69 if (usb2->clkset) in bcm_ns_usb2_phy_init()
70 regmap_write(usb2->clkset, 0, 0x0000ea68); in bcm_ns_usb2_phy_init()
72 writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); in bcm_ns_usb2_phy_init()
77 if (usb2->base) in bcm_ns_usb2_phy_init()
78 writel(usb2ctl, usb2->base); in bcm_ns_usb2_phy_init()
80 writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL); in bcm_ns_usb2_phy_init()
83 if (usb2->clkset) in bcm_ns_usb2_phy_init()
84 regmap_write(usb2->clkset, 0, 0x00000000); in bcm_ns_usb2_phy_init()
86 writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY); in bcm_ns_usb2_phy_init()
89 clk_disable_unprepare(usb2->ref_clk); in bcm_ns_usb2_phy_init()
101 struct device *dev = &pdev->dev; in bcm_ns_usb2_probe()
105 usb2 = devm_kzalloc(&pdev->dev, sizeof(*usb2), GFP_KERNEL); in bcm_ns_usb2_probe()
107 return -ENOMEM; in bcm_ns_usb2_probe()
108 usb2->dev = dev; in bcm_ns_usb2_probe()
110 if (of_property_present(dev->of_node, "brcm,syscon-clkset")) { in bcm_ns_usb2_probe()
111 usb2->base = devm_platform_ioremap_resource(pdev, 0); in bcm_ns_usb2_probe()
112 if (IS_ERR(usb2->base)) { in bcm_ns_usb2_probe()
114 return PTR_ERR(usb2->base); in bcm_ns_usb2_probe()
117 usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node, in bcm_ns_usb2_probe()
118 "brcm,syscon-clkset"); in bcm_ns_usb2_probe()
119 if (IS_ERR(usb2->clkset)) { in bcm_ns_usb2_probe()
120 dev_err(dev, "Failed to lookup clkset regmap\n"); in bcm_ns_usb2_probe()
121 return PTR_ERR(usb2->clkset); in bcm_ns_usb2_probe()
124 usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu"); in bcm_ns_usb2_probe()
125 if (IS_ERR(usb2->dmu)) { in bcm_ns_usb2_probe()
127 return PTR_ERR(usb2->dmu); in bcm_ns_usb2_probe()
133 usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk"); in bcm_ns_usb2_probe()
134 if (IS_ERR(usb2->ref_clk)) { in bcm_ns_usb2_probe()
135 dev_err_probe(dev, PTR_ERR(usb2->ref_clk), "failed to get ref clk\n"); in bcm_ns_usb2_probe()
136 return PTR_ERR(usb2->ref_clk); in bcm_ns_usb2_probe()
139 usb2->phy = devm_phy_create(dev, NULL, &ops); in bcm_ns_usb2_probe()
140 if (IS_ERR(usb2->phy)) in bcm_ns_usb2_probe()
141 return PTR_ERR(usb2->phy); in bcm_ns_usb2_probe()
143 phy_set_drvdata(usb2->phy, usb2); in bcm_ns_usb2_probe()
151 { .compatible = "brcm,ns-usb2-phy", },