diff options
Diffstat (limited to 'drivers/fpga')
-rw-r--r-- | drivers/fpga/Kconfig | 1 | ||||
-rw-r--r-- | drivers/fpga/Makefile | 1 | ||||
-rw-r--r-- | drivers/fpga/fpga-bridge.c | 22 | ||||
-rw-r--r-- | drivers/fpga/socfpga-fpga2sdram-bridge.c | 33 | ||||
-rw-r--r-- | drivers/fpga/socfpga-hps2fpga-bridge.c | 24 |
5 files changed, 28 insertions, 53 deletions
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index 64ce9f91b6..d0ba7719bf 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only # # FPGA framework configuration # diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index 86178fe7c0..493548ae72 100644 --- a/drivers/fpga/Makefile +++ b/drivers/fpga/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only # # Makefile for the fpga framework and fpga manager drivers. # diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index 6f9e943de9..5db24cb5bd 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -1,20 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * FPGA Bridge Framework Driver * * Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see <http://www.gnu.org/licenses/>. */ + #include <common.h> #include <fpga-bridge.h> @@ -66,7 +56,7 @@ EXPORT_SYMBOL_GPL(fpga_bridge_disable); struct fpga_bridge *of_fpga_bridge_get(struct device_node *np) { - struct device_d *dev; + struct device *dev; struct fpga_bridge *bridge; int ret = -EPROBE_DEFER; @@ -189,7 +179,7 @@ static int set_enable(struct param_d *p, void *priv) * * Return: 0 for success, error code otherwise. */ -int fpga_bridge_register(struct device_d *dev, const char *name, +int fpga_bridge_register(struct device *dev, const char *name, const struct fpga_bridge_ops *br_ops, void *priv) { struct fpga_bridge *bridge; @@ -211,7 +201,7 @@ int fpga_bridge_register(struct device_d *dev, const char *name, bridge->priv = priv; bridge->dev.parent = dev; - bridge->dev.device_node = dev->device_node; + bridge->dev.of_node = dev->of_node; bridge->dev.id = DEVICE_ID_DYNAMIC; bridge->dev.name = xstrdup(name); @@ -228,7 +218,7 @@ int fpga_bridge_register(struct device_d *dev, const char *name, if (IS_ERR(p)) return PTR_ERR(p); - of_platform_populate(dev->device_node, NULL, dev); + of_platform_populate(dev->of_node, NULL, dev); dev_info(bridge->dev.parent, "fpga bridge [%s] registered\n", bridge->dev.name); diff --git a/drivers/fpga/socfpga-fpga2sdram-bridge.c b/drivers/fpga/socfpga-fpga2sdram-bridge.c index a9760597dd..7f72bd8a65 100644 --- a/drivers/fpga/socfpga-fpga2sdram-bridge.c +++ b/drivers/fpga/socfpga-fpga2sdram-bridge.c @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * FPGA to SDRAM Bridge Driver for Altera SoCFPGA Devices * * Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -63,7 +52,7 @@ #define F2S_BRIDGE_NAME "fpga2sdram" struct alt_fpga2sdram_data { - struct device_d *dev; + struct device *dev; int mask; }; @@ -79,9 +68,6 @@ static inline int _alt_fpga2sdram_enable_set(struct alt_fpga2sdram_data *priv, else val = 0; - /* The kernel driver expects this value in this register :-( */ - writel(priv->mask, SOCFPGA_SYSMGR_ADDR + SYSMGR_ISWGRP_HANDOFF3); - dev_dbg(priv->dev, "setting fpgaportrst to 0x%08x\n", val); return writel(val, SOCFPGA_SDRCTL_ADDR + ALT_SDR_CTL_FPGAPORTRST_OFST); @@ -106,8 +92,9 @@ static struct of_device_id altera_fpga_of_match[] = { { .compatible = "altr,socfpga-fpga2sdram-bridge" }, {}, }; +MODULE_DEVICE_TABLE(of, altera_fpga_of_match); -static int alt_fpga_bridge_probe(struct device_d *dev) +static int alt_fpga_bridge_probe(struct device *dev) { struct alt_fpga2sdram_data *priv; int ret = 0; @@ -116,8 +103,14 @@ static int alt_fpga_bridge_probe(struct device_d *dev) if (!priv) return -ENOMEM; - /* enable all ports for now */ - priv->mask = ALT_SDR_CTL_FPGAPORTRST_PORTRSTN_MSK; + priv->mask = readl(SOCFPGA_SYSMGR_ADDR + SYSMGR_ISWGRP_HANDOFF3); + if (!priv->mask) { + /* enable all ports if we don't know better */ + priv->mask = ALT_SDR_CTL_FPGAPORTRST_PORTRSTN_MSK; + /* The kernel driver expects this value in this register :-( */ + writel(priv->mask, SOCFPGA_SYSMGR_ADDR + SYSMGR_ISWGRP_HANDOFF3); + + } priv->dev = dev; @@ -131,7 +124,7 @@ static int alt_fpga_bridge_probe(struct device_d *dev) return ret; } -static struct driver_d altera_fpga_driver = { +static struct driver altera_fpga_driver = { .probe = alt_fpga_bridge_probe, .name = "altera-fpga2sdram-bridge", .of_compatible = DRV_OF_COMPAT(altera_fpga_of_match), diff --git a/drivers/fpga/socfpga-hps2fpga-bridge.c b/drivers/fpga/socfpga-hps2fpga-bridge.c index ecb33ea0b3..4855dbcf4d 100644 --- a/drivers/fpga/socfpga-hps2fpga-bridge.c +++ b/drivers/fpga/socfpga-hps2fpga-bridge.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * FPGA to/from HPS Bridge Driver for Altera SoCFPGA Devices * @@ -6,18 +7,6 @@ * Includes this patch from the mailing list: * fpga: altera-hps2fpga: fix HPS2FPGA bridge visibility to L3 masters * Signed-off-by: Anatolij Gustschin <agust@denx.de> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see <http://www.gnu.org/licenses/>. */ /* @@ -50,7 +39,7 @@ #define FPGA2HPS_BRIDGE_NAME "fpga2hps" struct altera_hps2fpga_data { - struct device_d *dev; + struct device *dev; const char *name; struct reset_control *bridge_reset; unsigned int remap_mask; @@ -123,8 +112,9 @@ static struct of_device_id altera_fpga_of_match[] = { .data = &fpga2hps_data }, { /* sentinel */ }, }; +MODULE_DEVICE_TABLE(of, altera_fpga_of_match); -static int alt_fpga_bridge_probe(struct device_d *dev) +static int alt_fpga_bridge_probe(struct device *dev) { struct altera_hps2fpga_data *priv; const struct of_device_id *of_id; @@ -134,7 +124,7 @@ static int alt_fpga_bridge_probe(struct device_d *dev) of_id = of_match_device(altera_fpga_of_match, dev); priv = (struct altera_hps2fpga_data *)of_id->data; - priv->bridge_reset = of_reset_control_get(dev->device_node, NULL); + priv->bridge_reset = of_reset_control_get(dev->of_node, NULL); if (IS_ERR(priv->bridge_reset)) { dev_err(dev, "Could not get %s reset control\n", priv->name); return PTR_ERR(priv->bridge_reset); @@ -154,7 +144,7 @@ static int alt_fpga_bridge_probe(struct device_d *dev) priv->dev = dev; - if (!of_property_read_u32(dev->device_node, "bridge-enable", &enable)) { + if (!of_property_read_u32(dev->of_node, "bridge-enable", &enable)) { if (enable > 1) { dev_warn(dev, "invalid bridge-enable %u > 1\n", enable); } else { @@ -171,7 +161,7 @@ static int alt_fpga_bridge_probe(struct device_d *dev) priv); } -static struct driver_d alt_fpga_bridge_driver = { +static struct driver alt_fpga_bridge_driver = { .probe = alt_fpga_bridge_probe, .name = "altera-hps2fpga-bridge", .of_compatible = DRV_OF_COMPAT(altera_fpga_of_match), |