summaryrefslogtreecommitdiffstats
path: root/drivers/fpga/socfpga-fpga2sdram-bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fpga/socfpga-fpga2sdram-bridge.c')
-rw-r--r--drivers/fpga/socfpga-fpga2sdram-bridge.c33
1 files changed, 13 insertions, 20 deletions
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),