From patchwork Wed Sep 28 18:21:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Tull X-Patchwork-Id: 9354709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E5FD060757 for ; Wed, 28 Sep 2016 18:36:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5D3C295E7 for ; Wed, 28 Sep 2016 18:36:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9CBD2964D; Wed, 28 Sep 2016 18:36:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 97841295E7 for ; Wed, 28 Sep 2016 18:36:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpJhK-0002du-9m; Wed, 28 Sep 2016 18:35:14 +0000 Received: from mail-bl2nam02on0075.outbound.protection.outlook.com ([104.47.38.75] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpJWC-0001SV-2V for linux-arm-kernel@lists.infradead.org; Wed, 28 Sep 2016 18:24:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-opensource-altera-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=eY+YgQnFWM1QYAx5uswWQ1Yx2cWEG4qoRALYNrjKg4w=; b=GChRjKaPVqKoCwMIwCTl7uFrVa+o+ZbqM+Cnm3OM6iobDW2NdUdFWLCKm35UYYas1PRUgxOJFx4AOo8JzakS6PmFzQyzsMzbWtuKRonge+y5drt0zGMXv+53FGqUr/t6l+riilett1gHImFtJMhg2VaNh21QmIDDO9VBCI6ubD0= Received: from BLUPR0301CA0031.namprd03.prod.outlook.com (10.162.113.169) by DM2PR03MB495.namprd03.prod.outlook.com (10.141.85.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 18:22:48 +0000 Received: from BY2FFO11FD040.protection.gbl (2a01:111:f400:7c0c::154) by BLUPR0301CA0031.outlook.office365.com (2a01:111:e400:5259::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5 via Frontend Transport; Wed, 28 Sep 2016 18:22:47 +0000 Authentication-Results: spf=fail (sender IP is 66.35.236.236) smtp.mailfrom=opensource.altera.com; ni.com; dkim=pass (signature was verified) header.d=altera.onmicrosoft.com; ni.com; dmarc=none action=none header.from=opensource.altera.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.altera.com does not designate 66.35.236.236 as permitted sender) receiver=protection.outlook.com; client-ip=66.35.236.236; helo=sj-itexedge04.altera.priv.altera.com; Received: from sj-itexedge04.altera.priv.altera.com (66.35.236.236) by BY2FFO11FD040.mail.protection.outlook.com (10.1.14.225) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.629.5 via Frontend Transport; Wed, 28 Sep 2016 18:22:41 +0000 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (207.46.163.88) by webmail.altera.com (66.35.236.236) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 28 Sep 2016 11:21:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=altera.onmicrosoft.com; s=selector1-opensource-altera-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=eY+YgQnFWM1QYAx5uswWQ1Yx2cWEG4qoRALYNrjKg4w=; b=GChRjKaPVqKoCwMIwCTl7uFrVa+o+ZbqM+Cnm3OM6iobDW2NdUdFWLCKm35UYYas1PRUgxOJFx4AOo8JzakS6PmFzQyzsMzbWtuKRonge+y5drt0zGMXv+53FGqUr/t6l+riilett1gHImFtJMhg2VaNh21QmIDDO9VBCI6ubD0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=atull@opensource.altera.com; Received: from linuxheads99.altera.com (64.129.157.38) by BLUPR03MB1508.namprd03.prod.outlook.com (10.163.81.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.639.5; Wed, 28 Sep 2016 18:22:02 +0000 From: Alan Tull To: Rob Herring Subject: [PATCH v19 10/12] ARM: socfpga: fpga bridge driver support Date: Wed, 28 Sep 2016 13:21:58 -0500 Message-ID: <20160928182200.15800-11-atull@opensource.altera.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160928182200.15800-1-atull@opensource.altera.com> References: <20160928182200.15800-1-atull@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: BY2PR1001CA0078.namprd10.prod.outlook.com (10.164.163.46) To BLUPR03MB1508.namprd03.prod.outlook.com (10.163.81.26) X-MS-Office365-Filtering-Correlation-Id: 6550c64b-57fa-45eb-eeb3-08d3e7cc7261 X-Microsoft-Exchange-Diagnostics-untrusted: 1; BLUPR03MB1508; 2:/sp2nFfoTUX6lKA0w2Vrlq4OmVCAqUFaonUnkT77a3rPQdbxowmoSAx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37FLwQ+2aqzkyjPMh2KUo22PDdzjCW+yU+RhfJHqOAhemoalbGnDeRMhB747Z6YGDF3oTRcdfD8uVyg1M/XVu5TUIrlIsh3DEHbXgtrGKG6bbN9oSlssMpE63Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(22074186197030)(80048183373757); UriScan:(250305191791016)(22074186197030)(80048183373757); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BLUPR03MB1508; BCL:0; PCL:0; RULEID:; SRVR:BLUPR03MB1508; BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(13018025)(13023025)(13024025)(13017025)(13015025)(3002001)(10201501046)(6055026); SRVR:DM2PR03MB495; BCL:0; PCL:0; RULEID:; SRVR:DM2PR03MB495; X-Forefront-PRVS: 0079056367 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(53416004)(97736004)(189998001)(107886002)(19580405001)(575784001)(86362001)(33646002)(19580395003)(5660300001)(7416002)(2950100002)(42882006)(76176999)(110136003)(15975445007)(101416001)(77096005)(5003940100001)(4326007)(106356001)(92566002)(50986999)(66066001)(2906002)(42186005)(48376002)(1076002)(105586002)(50466002)(47776003)(586003)(6116002)(3846002)(50226002)(229853001)(69596002)(4001430100002)(81156014)(81166006)(7736002)(7846002)(305945005)(8676002)(8666005)(68736007)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR03MB1508; H:linuxheads99.altera.com; FPR:; SPF:None; PTR:InfoNoRecords; A:0; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: opensource.altera.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics-untrusted: =?us-ascii?Q?1; BLUPR03MB1508; 23:N+GA/INhIWX5T7GSZQu05C1l2BvPHLjFPVyLx1Q5r?= =?us-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Np4ueNSE/0mDM0LmQgWGOlmIY808=; 7:zbnH6+TeksqJXfCaRZPVQaG2aJK3XWR7tkDvcph0ABGi60ckUa/HMskG6S3O2FX2dn6YNufD3EjjbV+V6yNYIhJpCcj7XOzAaOxI+74ZOC8F29fFdeW1onPsAP7D2z7VPI+OCTtxtNNCCQGdjvYzjOIFvRXcH1ORrzpMEIISPnVUgbgo9mu7AE0AfyFrFgje6jawP6OYcjItgpV4VW8pyFGuUoY44ptu1aax7Q7RsRhrfe5BcjgQ15Dwa1u9V5BzRz9YbrtQ3NZpy+11v/8cfGgp7aT9Ge5GkuumCmBWCqrF1E+5yZp86QOBJOWkfjDO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR03MB1508 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.35.236.236; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(5003940100001)(33646002)(105606002)(4326007)(8676002)(2906002)(50226002)(6116002)(68736007)(1076002)(229853001)(586003)(53416004)(3846002)(76176999)(50986999)(7416002)(2950100002)(626004)(42882006)(106466001)(85426001)(336002)(77096005)(47776003)(6070500001)(8936002)(356003)(4001430100002)(16796002)(3720700001)(87936001)(8666005)(66066001)(107886002)(50466002)(956001)(189998001)(86362001)(575784001)(92566002)(5660300001)(15975445007)(81156014)(81166006)(305945005)(7846002)(48376002)(7736002)(19580395003)(110136003)(19580405001)(97736004)(7099028)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR03MB495; H:sj-itexedge04.altera.priv.altera.com; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:0; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD040; 1:7z7EvOqYvGHs/OsH9Yd8xOiOPVtyQ26mAvvknkDRc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WtDzWpbpqsEu6lIlWw+5fve67FE4qdUds+oaZkp3ZIioQ; 25:dmfGU/HC0a1OfR7IyZHFigQ/xhgNyPB+Evc5lNd763KOkvOpJNnPnu9T7cdsKZADbn8OlxbOxWj2CAGU4fqTWQm94yLLsyhjWmIXYGNn+x67OGWkB2JIJ9k29im+80F6wNuO3RInn8/Tmz/s1UHDXFYBlPxQO//rehF0T07PxzM6JVhqTInNiQ6oHGFavEuofLyHjdIK1cFNkHjb28n9wE8cnos0PtceHPhAvAcMRP4swgoPXhCgZdzb/I6OWL3vZgJVKGmdNs9echRJ4ACXZm4wurw4tQeqamvaPgQxpeEv5sJdfB0G3QreSEj14Tv+BYglNbqdt10nXeH1rkgRpXoTpxlj0hXzvwc7Gw4Ts99OwoeM6YyA1q7PrTsgB15DRT1aQVPNzCYb5Iskz76lLx9NGesHMR47Znhn1fKvhKk= X-DkimResult-Test: Passed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(3001016); SRVR:DM2PR03MB495; X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 31:CPYMKWsOZq6f4jDg5Erxs/HAY/+sLj2v+CBrfOL14D5Qzik7voOx9ju0FsZ/HCh+UptHEUBJdF2aAmzFzbDpzVeD3vhSy0vrvrXT7ps7U/CQDaQd+Kn9kSNPD2cUZrldWHNsjwJO92DkpXch8FTsWTMDQP3I30MqDrqJ71ejLJMWEug6hrNMEF40JXApgTae52Vd1mXYqLmVBAdfqCzs0bv6iFC5zqmS9UClYob/zJ0=; 20:K3Mb+BJ9Eyq/E3kBFiIIRGFkt0JC8m+9ZvFnBy5GtZBOKK8cgQnoGduIeFfAF0hmJ5cMQtI5qjR0/8bGETckTFLs3jRzlYCgJzxQ5gjn4Ah0vg+8PC7UijtLqy2EFUYzFxqhUqTTxE+icNmMplM7oKB9QFOHAp7j5O9dlBMDlBw= X-Microsoft-Exchange-Diagnostics: 1; DM2PR03MB495; 4:px6I8951X3l4WyIH3CibzVbeIiWV0lp/A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WQt4OPVIiapLpXMfTj95jAiqQJlCyiIcYbX423+iv4xVTkfHepXUkcDo5PmJSjLF1PURRr+15Jd0bYG+hYgP1in4omg+9N3Vn17TeJuRnrXAPIVH2ANbht8rLj/K+RmAQg5OB9bo+gN5F+APs6fRgwxicN+oZzYLtXOgNF+19pb3b4trVerGgvvgsknhBBA== X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2016 18:22:41.2667 (UTC) X-MS-Exchange-CrossTenant-Id: fbd72e03-d4a5-4110-adce-614d51f2077a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fbd72e03-d4a5-4110-adce-614d51f2077a; Ip=[66.35.236.236]; Helo=[sj-itexedge04.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB495 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160928_112345_208476_213859C9 X-CRM114-Status: UNSURE ( 5.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Moritz Fischer , delicious.quinoa@gmail.com, Ian Campbell , Alan Tull , Greg Kroah-Hartman , Josh Cartwright , Michal Simek , linux-kernel@vger.kernel.org, Cyril Chemparathy , Matthew Gerlach , devicetree@vger.kernel.org, Dinh Nguyen , Jon Masters , Matthew Gerlach , Frank Rowand , Walter Goossens , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Supports Altera SOCFPGA bridges: * fpga2sdram * fpga2hps * hps2fpga * lwhps2fpga Allows enabling/disabling the bridges through the FPGA Bridge Framework API functions. The fpga2sdram driver only supports enabling and disabling of the ports that been configured early on. This is due to a hardware limitation where the read, write, and command ports on the fpga2sdram bridge can only be reconfigured while there are no transactions to the sdram, i.e. when running out of OCRAM before the kernel boots. Device tree property 'init-val' configures the driver to enable or disable the bridge during probe. If the property does not exist, the driver will leave the bridge in its current state. Signed-off-by: Alan Tull Signed-off-by: Matthew Gerlach Signed-off-by: Dinh Nguyen --- v2: Use resets instead of directly writing reset registers v12: Bump version to align with simple-fpga-bus version Get rid of the sysfs interface fpga2sdram: get configuration stored in handoff register v13: Remove unneeded WARN_ON Change property from init-val to bridge-enable Checkpatch cleanup Fix email address v14: use module_platform_driver remove unused struct field and some #defines don't really need exclamation points on error msgs *const* struct fpga_bridge_ops v15: No change in this patch for v15 of this patch set v16: No change in this patch for v16 of this patch set v17: No change to this patch for v17 of this patch set v18: Eliminate need to specify reset names since only one reset v19: Set bridge state before registering driver with framework Include fix for drivers sharing the l3_remap_value reg use devm_clk_get make tristate in Kconfig documentation of handoff registers --- drivers/fpga/Kconfig | 7 ++ drivers/fpga/Makefile | 1 + drivers/fpga/altera-fpga2sdram.c | 180 +++++++++++++++++++++++++++++++ drivers/fpga/altera-hps2fpga.c | 221 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 409 insertions(+) create mode 100644 drivers/fpga/altera-fpga2sdram.c create mode 100644 drivers/fpga/altera-hps2fpga.c diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index 1a3a38a..55d97d2 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -39,6 +39,13 @@ config FPGA_BRIDGE Say Y here if you want to support bridges connected between host processors and FPGAs or between FPGAs. +config SOCFPGA_FPGA_BRIDGE + tristate "Altera SoCFPGA FPGA Bridges" + depends on ARCH_SOCFPGA && FPGA_BRIDGE + help + Say Y to enable drivers for FPGA bridges for Altera SOCFPGA + devices. + endif # FPGA endmenu diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index 8d746c3..e658436 100644 --- a/drivers/fpga/Makefile +++ b/drivers/fpga/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o # FPGA Bridge Drivers obj-$(CONFIG_FPGA_BRIDGE) += fpga-bridge.o +obj-$(CONFIG_SOCFPGA_FPGA_BRIDGE) += altera-hps2fpga.o altera-fpga2sdram.o # High Level Interfaces obj-$(CONFIG_FPGA_REGION) += fpga-region.o diff --git a/drivers/fpga/altera-fpga2sdram.c b/drivers/fpga/altera-fpga2sdram.c new file mode 100644 index 0000000..7ab358e --- /dev/null +++ b/drivers/fpga/altera-fpga2sdram.c @@ -0,0 +1,180 @@ +/* + * 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 . + */ + +/* + * This driver manages a bridge between an FPGA and the SDRAM used by the ARM + * host processor system (HPS). + * + * The bridge contains 4 read ports, 4 write ports, and 6 command ports. + * Reconfiguring these ports requires that no SDRAM transactions occur during + * reconfiguration. The code reconfiguring the ports cannot run out of SDRAM + * nor can the FPGA access the SDRAM during reconfiguration. This driver does + * not support reconfiguring the ports. The ports are configured by code + * running out of on chip ram before Linux is started and the configuration + * is passed in a handoff register in the system manager. + * + * This driver supports enabling and disabling of the configured ports, which + * allows for safe reprogramming of the FPGA, assuming that the new FPGA image + * uses the same port configuration. Bridges must be disabled before + * reprogramming the FPGA and re-enabled after the FPGA has been programmed. + */ + +#include +#include +#include +#include +#include +#include + +#define ALT_SDR_CTL_FPGAPORTRST_OFST 0x80 +#define ALT_SDR_CTL_FPGAPORTRST_PORTRSTN_MSK 0x00003fff +#define ALT_SDR_CTL_FPGAPORTRST_RD_SHIFT 0 +#define ALT_SDR_CTL_FPGAPORTRST_WR_SHIFT 4 +#define ALT_SDR_CTL_FPGAPORTRST_CTRL_SHIFT 8 + +/* + * From the Cyclone V HPS Memory Map document: + * These registers are used to store handoff information between the + * preloader and the OS. These 8 registers can be used to store any + * information. The contents of these registers have no impact on + * the state of the HPS hardware. + */ +#define SYSMGR_ISWGRP_HANDOFF3 (0x8C) + +#define F2S_BRIDGE_NAME "fpga2sdram" + +struct alt_fpga2sdram_data { + struct device *dev; + struct regmap *sdrctl; + int mask; +}; + +static int alt_fpga2sdram_enable_show(struct fpga_bridge *bridge) +{ + struct alt_fpga2sdram_data *priv = bridge->priv; + int value; + + regmap_read(priv->sdrctl, ALT_SDR_CTL_FPGAPORTRST_OFST, &value); + + return (value & priv->mask) == priv->mask; +} + +static inline int _alt_fpga2sdram_enable_set(struct alt_fpga2sdram_data *priv, + bool enable) +{ + return regmap_update_bits(priv->sdrctl, ALT_SDR_CTL_FPGAPORTRST_OFST, + priv->mask, enable ? priv->mask : 0); +} + +static int alt_fpga2sdram_enable_set(struct fpga_bridge *bridge, bool enable) +{ + return _alt_fpga2sdram_enable_set(bridge->priv, enable); +} + +struct prop_map { + char *prop_name; + u32 *prop_value; + u32 prop_max; +}; + +static const struct fpga_bridge_ops altera_fpga2sdram_br_ops = { + .enable_set = alt_fpga2sdram_enable_set, + .enable_show = alt_fpga2sdram_enable_show, +}; + +static const struct of_device_id altera_fpga_of_match[] = { + { .compatible = "altr,socfpga-fpga2sdram-bridge" }, + {}, +}; + +static int alt_fpga_bridge_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct alt_fpga2sdram_data *priv; + u32 enable; + struct regmap *sysmgr; + int ret = 0; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->dev = dev; + + priv->sdrctl = syscon_regmap_lookup_by_compatible("altr,sdr-ctl"); + if (IS_ERR(priv->sdrctl)) { + dev_err(dev, "regmap for altr,sdr-ctl lookup failed.\n"); + return PTR_ERR(priv->sdrctl); + } + + sysmgr = syscon_regmap_lookup_by_compatible("altr,sys-mgr"); + if (IS_ERR(priv->sdrctl)) { + dev_err(dev, "regmap for altr,sys-mgr lookup failed.\n"); + return PTR_ERR(sysmgr); + } + + /* Get f2s bridge configuration saved in handoff register */ + regmap_read(sysmgr, SYSMGR_ISWGRP_HANDOFF3, &priv->mask); + + ret = fpga_bridge_register(dev, F2S_BRIDGE_NAME, + &altera_fpga2sdram_br_ops, priv); + if (ret) + return ret; + + dev_info(dev, "driver initialized with handoff %08x\n", priv->mask); + + 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 { + dev_info(dev, "%s bridge\n", + (enable ? "enabling" : "disabling")); + ret = _alt_fpga2sdram_enable_set(priv, enable); + if (ret) { + fpga_bridge_unregister(&pdev->dev); + return ret; + } + } + } + + return ret; +} + +static int alt_fpga_bridge_remove(struct platform_device *pdev) +{ + fpga_bridge_unregister(&pdev->dev); + + return 0; +} + +MODULE_DEVICE_TABLE(of, altera_fpga_of_match); + +static struct platform_driver altera_fpga_driver = { + .probe = alt_fpga_bridge_probe, + .remove = alt_fpga_bridge_remove, + .driver = { + .name = "altera_fpga2sdram_bridge", + .of_match_table = of_match_ptr(altera_fpga_of_match), + }, +}; + +module_platform_driver(altera_fpga_driver); + +MODULE_DESCRIPTION("Altera SoCFPGA FPGA to SDRAM Bridge"); +MODULE_AUTHOR("Alan Tull "); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c new file mode 100644 index 0000000..63ff0e3 --- /dev/null +++ b/drivers/fpga/altera-hps2fpga.c @@ -0,0 +1,221 @@ +/* + * FPGA to/from HPS Bridge Driver for Altera SoCFPGA Devices + * + * Copyright (C) 2013-2016 Altera Corporation, All Rights Reserved. + * + * Includes this patch from the mailing list: + * fpga: altera-hps2fpga: fix HPS2FPGA bridge visibility to L3 masters + * Signed-off-by: Anatolij Gustschin + * + * 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 . + */ + +/* + * This driver manages bridges on a Altera SOCFPGA between the ARM host + * processor system (HPS) and the embedded FPGA. + * + * This driver supports enabling and disabling of the configured ports, which + * allows for safe reprogramming of the FPGA, assuming that the new FPGA image + * uses the same port configuration. Bridges must be disabled before + * reprogramming the FPGA and re-enabled after the FPGA has been programmed. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define ALT_L3_REMAP_OFST 0x0 +#define ALT_L3_REMAP_MPUZERO_MSK 0x00000001 +#define ALT_L3_REMAP_H2F_MSK 0x00000008 +#define ALT_L3_REMAP_LWH2F_MSK 0x00000010 + +#define HPS2FPGA_BRIDGE_NAME "hps2fpga" +#define LWHPS2FPGA_BRIDGE_NAME "lwhps2fpga" +#define FPGA2HPS_BRIDGE_NAME "fpga2hps" + +struct altera_hps2fpga_data { + const char *name; + struct reset_control *bridge_reset; + struct regmap *l3reg; + unsigned int remap_mask; + struct clk *clk; +}; + +static int alt_hps2fpga_enable_show(struct fpga_bridge *bridge) +{ + struct altera_hps2fpga_data *priv = bridge->priv; + + return reset_control_status(priv->bridge_reset); +} + +/* The L3 REMAP register is write only, so keep a cached value. */ +static unsigned int l3_remap_shadow; +static spinlock_t l3_remap_lock; + +static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv, + bool enable) +{ + unsigned long flags; + int ret; + + /* bring bridge out of reset */ + if (enable) + ret = reset_control_deassert(priv->bridge_reset); + else + ret = reset_control_assert(priv->bridge_reset); + if (ret) + return ret; + + /* Allow bridge to be visible to L3 masters or not */ + if (priv->remap_mask) { + spin_lock_irqsave(&l3_remap_lock, flags); + l3_remap_shadow |= ALT_L3_REMAP_MPUZERO_MSK; + + if (enable) + l3_remap_shadow |= priv->remap_mask; + else + l3_remap_shadow &= ~priv->remap_mask; + + ret = regmap_write(priv->l3reg, ALT_L3_REMAP_OFST, + l3_remap_shadow); + spin_unlock_irqrestore(&l3_remap_lock, flags); + } + + return ret; +} + +static int alt_hps2fpga_enable_set(struct fpga_bridge *bridge, bool enable) +{ + return _alt_hps2fpga_enable_set(bridge->priv, enable); +} + +static const struct fpga_bridge_ops altera_hps2fpga_br_ops = { + .enable_set = alt_hps2fpga_enable_set, + .enable_show = alt_hps2fpga_enable_show, +}; + +static struct altera_hps2fpga_data hps2fpga_data = { + .name = HPS2FPGA_BRIDGE_NAME, + .remap_mask = ALT_L3_REMAP_H2F_MSK, +}; + +static struct altera_hps2fpga_data lwhps2fpga_data = { + .name = LWHPS2FPGA_BRIDGE_NAME, + .remap_mask = ALT_L3_REMAP_LWH2F_MSK, +}; + +static struct altera_hps2fpga_data fpga2hps_data = { + .name = FPGA2HPS_BRIDGE_NAME, +}; + +static const struct of_device_id altera_fpga_of_match[] = { + { .compatible = "altr,socfpga-hps2fpga-bridge", + .data = &hps2fpga_data }, + { .compatible = "altr,socfpga-lwhps2fpga-bridge", + .data = &lwhps2fpga_data }, + { .compatible = "altr,socfpga-fpga2hps-bridge", + .data = &fpga2hps_data }, + {}, +}; + +static int alt_fpga_bridge_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct altera_hps2fpga_data *priv; + const struct of_device_id *of_id; + u32 enable; + int ret; + + 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_by_index(dev->of_node, 0); + if (IS_ERR(priv->bridge_reset)) { + dev_err(dev, "Could not get %s reset control\n", priv->name); + return PTR_ERR(priv->bridge_reset); + } + + priv->l3reg = syscon_regmap_lookup_by_compatible("altr,l3regs"); + if (IS_ERR(priv->l3reg)) { + dev_err(dev, "regmap for altr,l3regs lookup failed\n"); + return PTR_ERR(priv->l3reg); + } + + priv->clk = devm_clk_get(dev, NULL); + if (IS_ERR(priv->clk)) { + dev_err(dev, "no clock specified\n"); + return PTR_ERR(priv->clk); + } + + ret = clk_prepare_enable(priv->clk); + if (ret) { + dev_err(dev, "could not enable clock\n"); + return -EBUSY; + } + + spin_lock_init(&l3_remap_lock); + + 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 { + dev_info(dev, "%s bridge\n", + (enable ? "enabling" : "disabling")); + + ret = _alt_hps2fpga_enable_set(priv, enable); + if (ret) { + fpga_bridge_unregister(&pdev->dev); + return ret; + } + } + } + + return fpga_bridge_register(dev, priv->name, &altera_hps2fpga_br_ops, + priv); +} + +static int alt_fpga_bridge_remove(struct platform_device *pdev) +{ + struct fpga_bridge *bridge = platform_get_drvdata(pdev); + struct altera_hps2fpga_data *priv = bridge->priv; + + fpga_bridge_unregister(&pdev->dev); + + clk_disable_unprepare(priv->clk); + clk_put(priv->clk); + + return 0; +} + +MODULE_DEVICE_TABLE(of, altera_fpga_of_match); + +static struct platform_driver alt_fpga_bridge_driver = { + .probe = alt_fpga_bridge_probe, + .remove = alt_fpga_bridge_remove, + .driver = { + .name = "altera_hps2fpga_bridge", + .of_match_table = of_match_ptr(altera_fpga_of_match), + }, +}; + +module_platform_driver(alt_fpga_bridge_driver); + +MODULE_DESCRIPTION("Altera SoCFPGA HPS to FPGA Bridge"); +MODULE_AUTHOR("Alan Tull "); +MODULE_LICENSE("GPL v2");