From patchwork Tue Jul 12 19:36:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Tull X-Patchwork-Id: 9226109 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 5B64C60868 for ; Tue, 12 Jul 2016 19:44:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 464F31FF0B for ; Tue, 12 Jul 2016 19:44:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37B4A27D85; Tue, 12 Jul 2016 19:44:11 +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 414261FF0B for ; Tue, 12 Jul 2016 19:44:10 +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 1bN3Zr-0005kD-Gl; Tue, 12 Jul 2016 19:42:43 +0000 Received: from mail-sn1nam02on0078.outbound.protection.outlook.com ([104.47.36.78] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bN3ZA-00057F-NS for linux-arm-kernel@lists.infradead.org; Tue, 12 Jul 2016 19:42:05 +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=csz+5pyj6HsyHqzzPL7smlzUgCLokPsHt8Xi9cE8XhA=; b=ToY8iw3AXynm6BwmceBIstnjhEWmdKFjk1hQZh0+wrJdHrbHBvIj6XZb8f/9Ht7nVRB/MJ/ARW2vfuNKmLnuquMM+qnaHGdgk53jdvcdyyf++h2bU5aOl9PrlPCFuaDF6khxOtaQHAfA5hREacRxTUjjKsL5CvinkF2xYhL1BVA= Received: from BY2PR03CA079.namprd03.prod.outlook.com (10.141.249.52) by DM2PR0301MB0912.namprd03.prod.outlook.com (10.160.217.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16; Tue, 12 Jul 2016 19:41:39 +0000 Received: from BL2FFO11FD059.protection.gbl (2a01:111:f400:7c09::146) by BY2PR03CA079.outlook.office365.com (2a01:111:e400:2c5d::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.528.16 via Frontend Transport; Tue, 12 Jul 2016 19:41:38 +0000 Authentication-Results: spf=fail (sender IP is 66.35.236.227) smtp.mailfrom=opensource.altera.com; lists.infradead.org; dkim=pass (signature was verified) header.d=altera.onmicrosoft.com; lists.infradead.org; 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.227 as permitted sender) receiver=protection.outlook.com; client-ip=66.35.236.227; helo=sj-itexedge03.altera.priv.altera.com; Received: from sj-itexedge03.altera.priv.altera.com (66.35.236.227) by BL2FFO11FD059.mail.protection.outlook.com (10.173.161.155) with Microsoft SMTP Server (TLS) id 15.1.523.9 via Frontend Transport; Tue, 12 Jul 2016 19:41:38 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (216.32.180.16) by webmail.altera.com (66.35.236.227) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 12 Jul 2016 12:40:40 -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=csz+5pyj6HsyHqzzPL7smlzUgCLokPsHt8Xi9cE8XhA=; b=ToY8iw3AXynm6BwmceBIstnjhEWmdKFjk1hQZh0+wrJdHrbHBvIj6XZb8f/9Ht7nVRB/MJ/ARW2vfuNKmLnuquMM+qnaHGdgk53jdvcdyyf++h2bU5aOl9PrlPCFuaDF6khxOtaQHAfA5hREacRxTUjjKsL5CvinkF2xYhL1BVA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=atull@opensource.altera.com; Received: from linuxheads99.altera.com (64.129.157.38) by BN3PR03MB1509.namprd03.prod.outlook.com (10.163.35.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.534.14; Tue, 12 Jul 2016 19:41:23 +0000 From: Alan Tull To: Rob Herring Subject: [PATCH v18 6/6] ARM: socfpga: fpga bridge driver support Date: Tue, 12 Jul 2016 14:36:45 -0500 Message-ID: <20160712193645.9098-7-atull@opensource.altera.com> X-Mailer: git-send-email 2.9.1 In-Reply-To: <20160712193645.9098-1-atull@opensource.altera.com> References: <20160712193645.9098-1-atull@opensource.altera.com> MIME-Version: 1.0 X-Originating-IP: [64.129.157.38] X-ClientProxiedBy: BY2PR11CA0004.namprd11.prod.outlook.com (10.163.150.14) To BN3PR03MB1509.namprd03.prod.outlook.com (10.163.35.148) X-MS-Office365-Filtering-Correlation-Id: a731878b-c184-4eaa-9552-08d3aa8c8a88 X-Microsoft-Exchange-Diagnostics-untrusted: 1; BN3PR03MB1509; 2:YbOkZZmrFOtlbiBmL6cQ42Detoeb7X0PO7a8a+lvZCbu84w1x2ButZAc1kfw0Uo/tKXyzFpBaZN0wheqSLAOlBdJzdm5L6B5pQ6jzba32WKTz3bOS+mZrnSThH5LCrHHSVsiebzo+4oEJIL6a/bCsO/Ls+U4tP9stjGe93ouxozrKw6er2ZKm0lXLTQmmFAC; 3:QlcV9FwtGAAl0Pisz1rZCEKbBBUYV/27nXgZq8KU+Vv4+yq6DkN2cwgAwZvmd7EhgSF+NSq9fdETe5FvROPBAmrBunRFpKFxbLChsWerWMjtnkqHVZipaXgJrXpqiuXq X-Microsoft-Antispam-Untrusted: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1509; X-Microsoft-Exchange-Diagnostics-untrusted: 1; BN3PR03MB1509; 25:hLQ+CFAEAkVoVb/3+N7Wr6kUiDj0+BrWmtayzr/f7hU4HH9C5UG4QRx58zoGMzQdltKtRb2IzXqtteIrgt9Gl3sfQoYkzud4ILLJoCyGs8u69LLQzRMWs1AcV3fopt4QjPwrTdY1bTLBdLaKcX9lCW675mPSvxVS4Dl4fENjuCfmbOKRwtJWxGKJllxwmfAVg93A4PKtvQTw0b/PRt/It3ov78jNlK/yWgRljkFMeTfK1C72/NenSc+jo+MKrW5xxIa4j0l9F7eY3qobqasDE0rvHNoqJzjedySj/HH4z/36Mqor05ub8yT7pff5zbTJ6MRavChHA/pxqee5sth0LvG9QZweHRVr7vUEO1sZcBcemIP0jZc/BuE05XKpaZzEvn8x7htwE5s7+TCGWg5IQea1aBeFdYYiiX6DnSRM7x8c7qi6uGlqUvS1/dj+AkUiQp2C5M0ZV+HW70W/wdlXmbFzleb4/Ec1Xxi3uFAcoq3fR3Lrm/A1nflNLwnfwE819gDCOZy8qZELHppzzOtwinHsZ0MQoKnHfIG26Ymt2eL2Iq80EKX0pvRYZNzeLPYrSFE8hvx8wPs4BlDQmxFw5RKrJtLFb/LVxTEnLT5HrtRm4w6tzw3zElftURrZOEe72FopTuAAcody4q6sUJmU364dTJYLmJ6qjBdkMzlFIlOJb2uPmmHmj2V/Tij4lgjwgLiP4wlIA6p9d9IVGASryZXIbErmWG+aDYfb+7+ieAXBRkA27RuHQRB0Ktt4hY9k0gp8vA2CtVidEkV3v+7jyFyvegKjLCCH3COJDsBnldpZX988wi4cjpuX8hzMHV/2 X-LD-Processed: fbd72e03-d4a5-4110-adce-614d51f2077a,ExtAddr X-Microsoft-Exchange-Diagnostics-untrusted: 1; BN3PR03MB1509; 31:ctmBAK5IZSCZ9MqB4YoVdLwZ+6Rx//Zjw2kodmE5dJXITkU4T1bS0W0fq01RNoiq7WGPTWYbrxqUYcYasvDoruM6YBt/nZFWqANSsMf6rUA/mcstQZrlzTHva1/cZenAXIG8deoebvHoQClqF+pt3T1idwHvoW3dTaYRbuhZ1LImNOKeyHgQBVnYXJoJq4SsTvsHcjFfcitGdbR+Nrb1UA==; 20:Hi1PVVWKq/Lzuy8PT681H4JlnZR60RIetgaA5p46nTPqs8XZAUcLqhzvlrANwRL7855aMIzRFhxH4aoRZ+E/qZrNNcSFy4L5lys3HBpIx1G5hUOmThsQ+1bmU3W+9IcAIAfJcFTG17ZpGopwwM8Ron/J+WxD1BlkpZIqazV2iJw=; 4:QdlC/OvKe0FoWo1B6NI2E8MwPbAo5gqi58waeF3PIIEAYrl/GcYCroY/1dpBkK30yMLzylFNA2EAk2gVFm9YEzLgORSESl9CrJL4XQHtqloQCZkrpAfjI84nN96NDnFP0Xri41uMjYgnNxmTO08eQnS22tWbgpE0PMEYX4q70GGscA9TXia59WtTI19FlPRgcq06ju/7vsZpq2NktTx2azdCRcsGRH7cSoN8rXU79lkwSQ2u2CA/vcYYEHOcWeM4GRAB9As05ISeUu4clWh7sGzRmXOi0zzFszHlOeY78x8dUX3pWl5yW20EqvCkbjyqLNEf6JEcYjCSls8zsV5MSPYm+et/VGOoZPz3qO+XG/MFDkDrCxaFKDpZMcu5I3EwXUWphx1xaA4qSS68Qg4Vgw2CZ0vroM0xXG13rVD6gspbuLtfBUTZkbfkejepI+bnUGvge9ekhGxkMnXxGh54+tC4P0bhxUTmeFYjQuN98Ka19weznXwrON6FpsSSJH4A 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:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:BN3PR03MB1509; BCL:0; PCL:0; RULEID:; SRVR:BN3PR03MB1509; BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13017025)(5005006)(8121501046)(13015025)(13018025)(13024025)(10201501046)(3002001)(6055026); SRVR:DM2PR0301MB0912; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0301MB0912; X-Forefront-PRVS: 0001227049 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(42186005)(53416004)(47776003)(86362001)(4001430100002)(106356001)(50226002)(76176999)(50986999)(66066001)(68736007)(92566002)(97736004)(5003940100001)(48376002)(4326007)(69596002)(229853001)(107886002)(110136002)(19580395003)(50466002)(19580405001)(2950100001)(2906002)(8676002)(7736002)(15975445007)(189998001)(105586002)(33646002)(77096005)(81156014)(81166006)(7846002)(6116002)(305945005)(1076002)(586003)(101416001)(3846002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB1509; H:linuxheads99.altera.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:0; 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; BN3PR03MB1509; 23:xF4v4WlSlNijD6a4QiiybzZvP0Xju3fYn5QLCVgBq?= =?us-ascii?Q?VL/0aXgZxSMUWnp9Jx4VIJNqUsRLeTyBBkeXPT/GkdMuI4CExz9XE7D3LUyZ?= =?us-ascii?Q?ORD9ux6QerYvSDLomMt0a4oYZ0herMHThkoUfy2BjvAX5ZGSzSmti5G224ZV?= =?us-ascii?Q?OyOJeuHIcQJ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ata: NSPM X-Microsoft-Exchange-Diagnostics-untrusted: 1; BN3PR03MB1509; 20:MWgp26PgS78CpK/JEcuF+6As/nW7/+I0tNivmwYUK2VROo97RiHTbaKlEIjQTtE7WvWZ7C0aG10UpzbybYrgyyJ0xXGf5hRueTcBWW3af63UtTTdXiJGXZy36h7TQvPcz7rcP96kyGvhnLqmtH1RjjlLoEJE2T8NjJn85VpOvzs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB1509 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: BL2FFO11FD059.protection.gbl X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:66.35.236.227; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(3720700001)(6806005)(5003940100001)(16796002)(8676002)(68736007)(2906002)(81166006)(4326007)(81156014)(956001)(19580395003)(66066001)(7736002)(76176999)(50986999)(1076002)(305945005)(50226002)(586003)(19580405001)(47776003)(85426001)(6116002)(7846002)(3846002)(106466001)(53416004)(50466002)(229853001)(86362001)(8936002)(189998001)(105606002)(92566002)(6070500001)(107886002)(356003)(110136002)(33646002)(48376002)(77096005)(87936001)(97736004)(11100500001)(4001430100002)(15975445007)(2950100001)(7099028)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0912; H:sj-itexedge03.altera.priv.altera.com; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:0; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD059; 1:K8b+RVsbyNCXyB/zIebb+Tx34tEfmqTtFQWm/eqUc42+2YagBlEVQP9ByCm4KcLBBGiwN4bnhVow8INBEU5IVGD1pTMwziKJVzvldO5jGXGc1zYjS/38fnTsBvNBIA2egusafQ4F0fxmLbXeErb0tfCHQDOEBoqKVGZ0DdBEu8ZgF+K2+9pUdH3Gg2B6bqneW0kMBbMdOQP29/PVXA3LsjB2X91aJ9l2nfNtmmLGGSRyU7dmCa81cosyRonWpDiI5Loeo204rFnFvegxRGo26jV5hdY3ydkXOkm7GpIGwatEIcR80SdI7bxhy03jzXrSB73Q/13q95tGUDX4rRkjC9N7d9xKQK5uzild0NJHE4ki9FcYGdmGW9gOtvpxWC7x20fW3o3tWuxeOvBY0YB/ohbAE+QfN1lcOnp8kutu11hdjx1vvM6zpeZT1oDUDH1+ZrGJvg4tkqUFNuqdzZFhdNmYlivAYz/ic80j9tmZtWJ7NrROmEadJlQUyIGsjOGlxWldOZgfsJY5A5ZcBNOTorSumFD26E5EN2MrNoHeFBGI4Dsf+/vZaSLd1zAmTm8qOEp/DzGKsfVGkC1b1q0hLHFAIfjw0FgUOaUZbHlZOJs= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 2:q+Ca9fumSgJztqcpq93DOZrZk6wR7pYCpstJClLuWX/znk6ekvns6EIR7Ih3o+tj5mcPlBRMNjSGyQsgIxtlJN3Wrf+TD2d/vOqQoFHPIeVXkbM7mGWAHVKVxww2+otwUEjWlgd/rr/xWdNo/PsZUuA4nIAiWRfpV0ess6j8POJcw5TC1FLQnQksVn0Bd2Rm; 3:StQmMBWBjZK4opg/DWYPz3GVa5zeMnNj4+CAFrrbxHYjyf2zFmROSAs72sWBNLJ8yjDoqiZL/fI2mTNP3lRkDJwtGHoVO49IEnr6dulVS4Jxd8LnXhDD6A0j4uD9Ng4FMGkn3KPgrUCKpPq9yegn13Yz8MulTAo6CWJ5Ij0vjToG+bgkrY5pmvYgMy7gPo1ZR19csaJPxMjV6nuYVWRIJd8U570eepY9uAX0XGHPbsPVouiNVUmkJjnMSVKD2rBE X-DkimResult-Test: Passed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(3001016); SRVR:DM2PR0301MB0912; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 25:+LH38ArikZbHxVL2ftXiZDSTo0tR3uHWoAQ19j4oLj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ECmikaQSwxh8TCz6Jehm6gWuoiuDm9HKGdulfkDNHRwE4Ywp+idil5N+s2E+y7hyNRIDlM6DQNM4puFlVvsHHOfdMN5+eS/bv2sz4CZddm5p2+qpxmaUy3psUEyX2KF9ERaN0HQYuq1e8+oZIB/GtHqutpo3y8aNjXap20jxczE= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 4:2iJ87tbu8tB7Q0ONvkUXmo3Udxdzsw5Qzd1MEFKE7JfV2a2eMPoHXZ0b6kE+qS8uylOfCs2CCI//b8y+AvuJDAeqNLgtZUXbvuEm/82szP55UPkn7DFt8HmNE0HzpcOy6wRUa5foeT80WCZNBQVhQVpv1l9R2sh7boGFVkvit1RY9Tnr3Zbap+MrlzqGpwqloRtYFBpWFQNs4SRLihKR3suqT8+YtlKJVKvdgni6NjF20YPmIYIdbJsAD4+O8u/2Augkvc7lsUlArf7ue4FEsgDC/yjz6MpsnACZIXFpHHQOui/apY9da5wha+IxuE1VxrD8kdQk/D/Cqe+j7OvOLTylYwGjA+d52eIvPmGAfq+z8ZfHTsrS23IVWxQTwfdeA1s9TfDjPwRWJfIa/CGhx8dW75eWWPEWupe9D5LNH+jz7qOnV6gYmU+y5+z1HS7lgenffOzlke38GHIB01pvS9VYb0nF2D65y4nscJMohsrO2RbZz4KOxLYMmquMXMDXKcNRrLBFw4vSsqvPTS8CFMM6ZKXfURC1KzJEKd0YVXiUCr8qhf05anlMacpMZe9u6TuEhcEdCkn1KJZlwVEoeg== X-Forefront-PRVS: 0001227049 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0912; 23:fhFJo4JmvCBaJ43JeNH4OJUtreSjCeZ3LRLfD2U?= =?us-ascii?Q?T9wGwaxnaXnO54/dPqd53eY873uZK+GxkgeWPC3c1t9zSGQjLFApAUvxkBRk?= =?us-ascii?Q?FfHfbfnHphbsz1FKy3eDJoL4eGusIzvjfQWLu7ePLezV4hVy+VaBLeZtyiYW?= =?us-ascii?Q?En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; 7:yH5IT8nvbWw0e3zt8jgVApws3YzSwdXVSB4uTeotTOPj5OMRasvpc/tJgRfSRu1CC2LNYq7vEEWo3m11EOjoOjzMvooo3lUIG3m2+qzDA/cB1BgnIougIKzD0Fdpw7DlLy1s4B42rzw00+g/IHAcGWLfwiKPaeB6yrdoGgEuX5k4Caz8g4IpZBr4Y6QJo919+Ot04fhKtLIQ24QWZVMaPQ== X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0912; 20:wCS1exNz/DBmWqFbt4CgW6vJAubh/MJVh0OUsYaDP33bzh+DqzQTeOX/b92dDCxSyJxSU9F9qDz/JEE+aYq5j28hP7jBQqLqvmcYGDK0qy3M+TTLdAUMUJmQWp+X/YnAtlpfUDKQcs8CCS2S1860GPQksyaUefgTCsBFiNMM4lc= X-OriginatorOrg: opensource.altera.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2016 19:41:38.0886 (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.227]; Helo=[sj-itexedge03.altera.priv.altera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0912 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160712_124201_145798_511434A6 X-CRM114-Status: UNSURE ( 5.68 ) 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 , devicetree@vger.kernel.org, Moritz Fischer , Ian Campbell , Alan Tull , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Matthew Gerlach , Dinh Nguyen , delicious.quinoa@gmail.com, 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 --- drivers/fpga/Kconfig | 7 ++ drivers/fpga/Makefile | 1 + drivers/fpga/altera-fpga2sdram.c | 174 ++++++++++++++++++++++++++++++++ drivers/fpga/altera-hps2fpga.c | 213 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 395 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 ec81e21..b346166 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 + bool "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..91f4a40 --- /dev/null +++ b/drivers/fpga/altera-fpga2sdram.c @@ -0,0 +1,174 @@ +/* + * FPGA to SDRAM Bridge Driver for Altera SoCFPGA Devices + * + * Copyright (C) 2013-2015 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 + +#define SYSMGR_ISWGRP_HANDOFF3 (0x8C) +#define ISWGRP_HANDOFF_FPGA2SDR SYSMGR_ISWGRP_HANDOFF3 + +#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..4466022 --- /dev/null +++ b/drivers/fpga/altera-hps2fpga.c @@ -0,0 +1,213 @@ +/* + * FPGA to/from HPS Bridge Driver for Altera SoCFPGA Devices + * + * Copyright (C) 2013-2015 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 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 + +#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; + /* The L3 REMAP register is write only, so keep a cached value. */ + unsigned int l3_remap_value; + 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); +} + +static int _alt_hps2fpga_enable_set(struct altera_hps2fpga_data *priv, + bool enable) +{ + 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) { + priv->l3_remap_value |= ALT_L3_REMAP_MPUZERO_MSK; + + if (enable) + priv->l3_remap_value |= priv->remap_mask; + else + priv->l3_remap_value &= ~priv->remap_mask; + + ret = regmap_write(priv->l3reg, ALT_L3_REMAP_OFST, + priv->l3_remap_value); + } + + 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 = of_clk_get(dev->of_node, 0); + 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; + } + + ret = fpga_bridge_register(dev, priv->name, &altera_hps2fpga_br_ops, + priv); + if (ret) + return ret; + + 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 ret; +} + +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");