Lines Matching +full:salvo +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0+
3 * Salvo PHY is a 28nm PHY, it is a legacy PHY, and only
6 * Copyright (c) 2019-2020 NXP
13 #include <linux/phy/phy.h>
21 /* USB3 PHY register definition */
93 /* USB2 PHY register definition */
135 struct phy *phy; member
147 return salvo_phy->data == &cdns_nxp_salvo_data; in cdns_is_nxp_phy()
152 return (u16)readl(salvo_phy->base + offset + in cdns_salvo_read()
153 reg * (1 << salvo_phy->data->reg_offset_shift)); in cdns_salvo_read()
159 writel(val, salvo_phy->base + offset + in cdns_salvo_write()
160 reg * (1 << salvo_phy->data->reg_offset_shift)); in cdns_salvo_write()
164 * Below bringup sequence pair are from Cadence PHY's User Guide
246 static int cdns_salvo_phy_init(struct phy *phy) in cdns_salvo_phy_init() argument
248 struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); in cdns_salvo_phy_init()
249 struct cdns_salvo_data *data = salvo_phy->data; in cdns_salvo_phy_init()
253 ret = clk_prepare_enable(salvo_phy->clk); in cdns_salvo_phy_init()
257 for (i = 0; i < data->init_sequence_length; i++) { in cdns_salvo_phy_init()
258 const struct cdns_reg_pairs *reg_pair = data->init_sequence_val + i; in cdns_salvo_phy_init()
260 cdns_salvo_write(salvo_phy, USB3_PHY_OFFSET, reg_pair->off, reg_pair->val); in cdns_salvo_phy_init()
278 value = FIELD_PREP(RX_USB2_DISCONN_MASK, salvo_phy->usb2_disconn); in cdns_salvo_phy_init()
283 clk_disable_unprepare(salvo_phy->clk); in cdns_salvo_phy_init()
288 static int cdns_salvo_phy_power_on(struct phy *phy) in cdns_salvo_phy_power_on() argument
290 struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); in cdns_salvo_phy_power_on()
292 return clk_prepare_enable(salvo_phy->clk); in cdns_salvo_phy_power_on()
295 static int cdns_salvo_phy_power_off(struct phy *phy) in cdns_salvo_phy_power_off() argument
297 struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); in cdns_salvo_phy_power_off()
299 clk_disable_unprepare(salvo_phy->clk); in cdns_salvo_phy_power_off()
304 static int cdns_salvo_set_mode(struct phy *phy, enum phy_mode mode, int submode) in cdns_salvo_set_mode() argument
306 struct cdns_salvo_phy *salvo_phy = phy_get_drvdata(phy); in cdns_salvo_set_mode()
332 struct device *dev = &pdev->dev; in cdns_salvo_phy_probe()
340 return -ENOMEM; in cdns_salvo_phy_probe()
342 salvo_phy->data = data; in cdns_salvo_phy_probe()
343 salvo_phy->clk = devm_clk_get_optional(dev, "salvo_phy_clk"); in cdns_salvo_phy_probe()
344 if (IS_ERR(salvo_phy->clk)) in cdns_salvo_phy_probe()
345 return PTR_ERR(salvo_phy->clk); in cdns_salvo_phy_probe()
347 if (of_property_read_u32(dev->of_node, "cdns,usb2-disconnect-threshold-microvolt", &val)) in cdns_salvo_phy_probe()
351 salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_575; in cdns_salvo_phy_probe()
353 salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_610; in cdns_salvo_phy_probe()
355 salvo_phy->usb2_disconn = USB2_DISCONN_THRESHOLD_645; in cdns_salvo_phy_probe()
357 salvo_phy->base = devm_platform_ioremap_resource(pdev, 0); in cdns_salvo_phy_probe()
358 if (IS_ERR(salvo_phy->base)) in cdns_salvo_phy_probe()
359 return PTR_ERR(salvo_phy->base); in cdns_salvo_phy_probe()
361 salvo_phy->phy = devm_phy_create(dev, NULL, &cdns_salvo_phy_ops); in cdns_salvo_phy_probe()
362 if (IS_ERR(salvo_phy->phy)) in cdns_salvo_phy_probe()
363 return PTR_ERR(salvo_phy->phy); in cdns_salvo_phy_probe()
365 phy_set_drvdata(salvo_phy->phy, salvo_phy); in cdns_salvo_phy_probe()
379 .compatible = "nxp,salvo-phy",
389 .name = "cdns-salvo-phy",
397 MODULE_DESCRIPTION("Cadence SALVO PHY Driver");