Lines Matching +full:timeout +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0
13 #include <linux/fpga/fpga-bridge.h>
35 bool enable; member
39 * Poll status until status bit is set or we have a timeout.
42 u32 timeout, u32 req_ack) in altera_freeze_br_req_ack() argument
44 struct device *dev = priv->dev; in altera_freeze_br_req_ack()
45 void __iomem *csr_illegal_req_addr = priv->base_addr + in altera_freeze_br_req_ack()
48 int ret = -ETIMEDOUT; in altera_freeze_br_req_ack()
62 ret = -EINVAL; in altera_freeze_br_req_ack()
66 status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET); in altera_freeze_br_req_ack()
70 ctrl = readl(priv->base_addr + FREEZE_CSR_CTRL_OFFSET); in altera_freeze_br_req_ack()
78 } while (timeout--); in altera_freeze_br_req_ack()
80 if (ret == -ETIMEDOUT) in altera_freeze_br_req_ack()
81 dev_err(dev, "%s timeout waiting for 0x%x\n", in altera_freeze_br_req_ack()
88 u32 timeout) in altera_freeze_br_do_freeze() argument
90 struct device *dev = priv->dev; in altera_freeze_br_do_freeze()
91 void __iomem *csr_ctrl_addr = priv->base_addr + in altera_freeze_br_do_freeze()
96 status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET); in altera_freeze_br_do_freeze()
106 return -EINVAL; in altera_freeze_br_do_freeze()
111 ret = altera_freeze_br_req_ack(priv, timeout, in altera_freeze_br_do_freeze()
123 u32 timeout) in altera_freeze_br_do_unfreeze() argument
125 struct device *dev = priv->dev; in altera_freeze_br_do_unfreeze()
126 void __iomem *csr_ctrl_addr = priv->base_addr + in altera_freeze_br_do_unfreeze()
133 status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET); in altera_freeze_br_do_unfreeze()
143 return -EINVAL; in altera_freeze_br_do_unfreeze()
148 ret = altera_freeze_br_req_ack(priv, timeout, in altera_freeze_br_do_unfreeze()
151 status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET); in altera_freeze_br_do_unfreeze()
161 * enable = 1 : allow traffic through the bridge
162 * enable = 0 : disable traffic through the bridge
165 bool enable) in altera_freeze_br_enable_set() argument
167 struct altera_freeze_br_data *priv = bridge->priv; in altera_freeze_br_enable_set()
168 struct fpga_image_info *info = bridge->info; in altera_freeze_br_enable_set()
169 u32 timeout = 0; in altera_freeze_br_enable_set() local
172 if (enable) { in altera_freeze_br_enable_set()
174 timeout = info->enable_timeout_us; in altera_freeze_br_enable_set()
176 ret = altera_freeze_br_do_unfreeze(bridge->priv, timeout); in altera_freeze_br_enable_set()
179 timeout = info->disable_timeout_us; in altera_freeze_br_enable_set()
181 ret = altera_freeze_br_do_freeze(bridge->priv, timeout); in altera_freeze_br_enable_set()
185 priv->enable = enable; in altera_freeze_br_enable_set()
192 struct altera_freeze_br_data *priv = bridge->priv; in altera_freeze_br_enable_show()
194 return priv->enable; in altera_freeze_br_enable_show()
203 { .compatible = "altr,freeze-bridge-controller", },
210 struct device *dev = &pdev->dev; in altera_freeze_br_probe()
211 struct device_node *np = pdev->dev.of_node; in altera_freeze_br_probe()
218 return -ENODEV; in altera_freeze_br_probe()
231 return -EINVAL; in altera_freeze_br_probe()
236 return -ENOMEM; in altera_freeze_br_probe()
238 priv->dev = dev; in altera_freeze_br_probe()
242 priv->enable = 1; in altera_freeze_br_probe()
244 priv->base_addr = base_addr; in altera_freeze_br_probe()