static int pinctrl_tegra_xusb_probe(struct device_d *dev) { struct resource *iores; struct tegra_xusb_padctl *padctl; struct phy *phy; int err; padctl = xzalloc(sizeof(*padctl)); dev->priv = padctl; padctl->dev = dev; dev_get_drvdata(dev, (const void **)&padctl->soc); iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) { dev_err(dev, "Could not get iomem region\n"); return PTR_ERR(iores); } padctl->regs = IOMEM(iores->start); padctl->rst = reset_control_get(dev, NULL); if (IS_ERR(padctl->rst)) return PTR_ERR(padctl->rst); err = reset_control_deassert(padctl->rst); if (err < 0) return err; padctl->pinctrl.dev = dev; padctl->pinctrl.ops = &pinctrl_tegra_xusb_ops; err = pinctrl_register(&padctl->pinctrl); if (err) { dev_err(dev, "failed to register pincontrol\n"); err = -ENODEV; goto reset; } phy = phy_create(dev, NULL, &pcie_phy_ops, NULL); if (IS_ERR(phy)) { err = PTR_ERR(phy); goto unregister; } padctl->phys[TEGRA_XUSB_PADCTL_PCIE] = phy; phy_set_drvdata(phy, padctl); phy = phy_create(dev, NULL, &sata_phy_ops, NULL); if (IS_ERR(phy)) { err = PTR_ERR(phy); goto unregister; } padctl->phys[TEGRA_XUSB_PADCTL_SATA] = phy; phy_set_drvdata(phy, padctl); padctl->provider = of_phy_provider_register(dev, tegra_xusb_padctl_xlate); if (IS_ERR(padctl->provider)) { err = PTR_ERR(padctl->provider); dev_err(dev, "failed to register PHYs: %d\n", err); goto unregister; } return 0; unregister: pinctrl_unregister(&padctl->pinctrl); reset: reset_control_assert(padctl->rst); return err; }
static int ath10k_ahb_rst_ctrl_init(struct ath10k *ar) { struct ath10k_ahb *ar_ahb = ath10k_ahb_priv(ar); struct device *dev; int ret; dev = &ar_ahb->pdev->dev; ar_ahb->core_cold_rst = reset_control_get(dev, "wifi_core_cold"); if (IS_ERR_OR_NULL(ar_ahb->core_cold_rst)) { ath10k_err(ar, "failed to get core cold rst ctrl: %ld\n", PTR_ERR(ar_ahb->core_cold_rst)); ret = ar_ahb->core_cold_rst ? PTR_ERR(ar_ahb->core_cold_rst) : -ENODEV; goto out; } ar_ahb->radio_cold_rst = reset_control_get(dev, "wifi_radio_cold"); if (IS_ERR_OR_NULL(ar_ahb->radio_cold_rst)) { ath10k_err(ar, "failed to get radio cold rst ctrl: %ld\n", PTR_ERR(ar_ahb->radio_cold_rst)); ret = ar_ahb->radio_cold_rst ? PTR_ERR(ar_ahb->radio_cold_rst) : -ENODEV; goto err_core_cold_rst_put; } ar_ahb->radio_warm_rst = reset_control_get(dev, "wifi_radio_warm"); if (IS_ERR_OR_NULL(ar_ahb->radio_warm_rst)) { ath10k_err(ar, "failed to get radio warm rst ctrl: %ld\n", PTR_ERR(ar_ahb->radio_warm_rst)); ret = ar_ahb->radio_warm_rst ? PTR_ERR(ar_ahb->radio_warm_rst) : -ENODEV; goto err_radio_cold_rst_put; } ar_ahb->radio_srif_rst = reset_control_get(dev, "wifi_radio_srif"); if (IS_ERR_OR_NULL(ar_ahb->radio_srif_rst)) { ath10k_err(ar, "failed to get radio srif rst ctrl: %ld\n", PTR_ERR(ar_ahb->radio_srif_rst)); ret = ar_ahb->radio_srif_rst ? PTR_ERR(ar_ahb->radio_srif_rst) : -ENODEV; goto err_radio_warm_rst_put; } ar_ahb->cpu_init_rst = reset_control_get(dev, "wifi_cpu_init"); if (IS_ERR_OR_NULL(ar_ahb->cpu_init_rst)) { ath10k_err(ar, "failed to get cpu init rst ctrl: %ld\n", PTR_ERR(ar_ahb->cpu_init_rst)); ret = ar_ahb->cpu_init_rst ? PTR_ERR(ar_ahb->cpu_init_rst) : -ENODEV; goto err_radio_srif_rst_put; } return 0; err_radio_srif_rst_put: reset_control_put(ar_ahb->radio_srif_rst); err_radio_warm_rst_put: reset_control_put(ar_ahb->radio_warm_rst); err_radio_cold_rst_put: reset_control_put(ar_ahb->radio_cold_rst); err_core_cold_rst_put: reset_control_put(ar_ahb->core_cold_rst); out: return ret; }