Lines Matching +full:freeze +full:- +full:bridge +full:- +full:controller
1 // SPDX-License-Identifier: GPL-2.0
3 * FPGA Freeze Bridge Controller
13 #include <linux/fpga/fpga-bridge.h>
30 #define FREEZE_BRIDGE_NAME "freeze"
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()
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()
101 dev_dbg(dev, "%s bridge already disabled %d\n", in altera_freeze_br_do_freeze()
105 dev_err(dev, "%s bridge not enabled %d\n", __func__, status); in altera_freeze_br_do_freeze()
106 return -EINVAL; in altera_freeze_br_do_freeze()
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()
138 dev_dbg(dev, "%s bridge already enabled %d\n", in altera_freeze_br_do_unfreeze()
142 dev_err(dev, "%s bridge not frozen %d\n", __func__, status); in altera_freeze_br_do_unfreeze()
143 return -EINVAL; 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
164 static int altera_freeze_br_enable_set(struct fpga_bridge *bridge, 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()
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()
190 static int altera_freeze_br_enable_show(struct fpga_bridge *bridge) in altera_freeze_br_enable_show() argument
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()
274 MODULE_DESCRIPTION("Altera Freeze Bridge");