Lines Matching +full:static +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved.
23 * reprogramming the FPGA and re-enabled after the FPGA has been programmed.
26 #include <linux/fpga/fpga-bridge.h>
56 static int alt_fpga2sdram_enable_show(struct fpga_bridge *bridge) in alt_fpga2sdram_enable_show()
58 struct alt_fpga2sdram_data *priv = bridge->priv; in alt_fpga2sdram_enable_show()
61 regmap_read(priv->sdrctl, ALT_SDR_CTL_FPGAPORTRST_OFST, &value); in alt_fpga2sdram_enable_show()
63 return (value & priv->mask) == priv->mask; in alt_fpga2sdram_enable_show()
66 static inline int _alt_fpga2sdram_enable_set(struct alt_fpga2sdram_data *priv, in _alt_fpga2sdram_enable_set()
67 bool enable) in _alt_fpga2sdram_enable_set() argument
69 return regmap_update_bits(priv->sdrctl, ALT_SDR_CTL_FPGAPORTRST_OFST, in _alt_fpga2sdram_enable_set()
70 priv->mask, enable ? priv->mask : 0); in _alt_fpga2sdram_enable_set()
73 static int alt_fpga2sdram_enable_set(struct fpga_bridge *bridge, bool enable) in alt_fpga2sdram_enable_set() argument
75 return _alt_fpga2sdram_enable_set(bridge->priv, enable); in alt_fpga2sdram_enable_set()
84 static const struct fpga_bridge_ops altera_fpga2sdram_br_ops = {
89 static const struct of_device_id altera_fpga_of_match[] = {
90 { .compatible = "altr,socfpga-fpga2sdram-bridge" },
94 static int alt_fpga_bridge_probe(struct platform_device *pdev) in alt_fpga_bridge_probe()
96 struct device *dev = &pdev->dev; in alt_fpga_bridge_probe()
99 u32 enable; in alt_fpga_bridge_probe() local
105 return -ENOMEM; in alt_fpga_bridge_probe()
107 priv->dev = dev; in alt_fpga_bridge_probe()
109 priv->sdrctl = syscon_regmap_lookup_by_compatible("altr,sdr-ctl"); in alt_fpga_bridge_probe()
110 if (IS_ERR(priv->sdrctl)) { in alt_fpga_bridge_probe()
111 dev_err(dev, "regmap for altr,sdr-ctl lookup failed.\n"); in alt_fpga_bridge_probe()
112 return PTR_ERR(priv->sdrctl); in alt_fpga_bridge_probe()
115 sysmgr = syscon_regmap_lookup_by_compatible("altr,sys-mgr"); in alt_fpga_bridge_probe()
117 dev_err(dev, "regmap for altr,sys-mgr lookup failed.\n"); in alt_fpga_bridge_probe()
122 regmap_read(sysmgr, SYSMGR_ISWGRP_HANDOFF3, &priv->mask); in alt_fpga_bridge_probe()
127 return -ENOMEM; in alt_fpga_bridge_probe()
135 dev_info(dev, "driver initialized with handoff %08x\n", priv->mask); in alt_fpga_bridge_probe()
137 if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) { in alt_fpga_bridge_probe()
138 if (enable > 1) { in alt_fpga_bridge_probe()
139 dev_warn(dev, "invalid bridge-enable %u > 1\n", enable); in alt_fpga_bridge_probe()
142 (enable ? "enabling" : "disabling")); in alt_fpga_bridge_probe()
143 ret = _alt_fpga2sdram_enable_set(priv, enable); in alt_fpga_bridge_probe()
154 static int alt_fpga_bridge_remove(struct platform_device *pdev) in alt_fpga_bridge_remove()
165 static struct platform_driver altera_fpga_driver = {