From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VgF0i-0007ez-Pr for barebox@lists.infradead.org; Tue, 12 Nov 2013 14:32:16 +0000 From: Sascha Hauer Date: Tue, 12 Nov 2013 15:31:39 +0100 Message-Id: <1384266701-12608-3-git-send-email-s.hauer@pengutronix.de> In-Reply-To: <1384266701-12608-1-git-send-email-s.hauer@pengutronix.de> References: <1384266701-12608-1-git-send-email-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 2/4] Firmware: provide a handler to program Altera FPGAs To: barebox@lists.infradead.org Cc: Juergen Beisert RnJvbTogSnVlcmdlbiBCZWlzZXJ0IDxqYmVAcGVuZ3V0cm9uaXguZGU+CgpUaGlzIGhhbmRsZXIg dXNlcyBhIHJlZ3VsYXIgU1BJIG1hc3RlciBhbmQgYSBmZXcgR1BJT3MgdG8gcHJvZ3JhbSBhbgpB bHRlcmEgRlBHQSBpbiBzZXJpYWwgbW9kZS4KClNpZ25lZC1vZmYtYnk6IEp1ZXJnZW4gQmVpc2Vy dCA8amJlQHBlbmd1dHJvbml4LmRlPgpTaWduZWQtb2ZmLWJ5OiBTYXNjaGEgSGF1ZXIgPHMuaGF1 ZXJAcGVuZ3V0cm9uaXguZGU+Ci0tLQogZHJpdmVycy9LY29uZmlnICAgICAgICAgICAgICAgICAg fCAgIDEgKwogZHJpdmVycy9NYWtlZmlsZSAgICAgICAgICAgICAgICAgfCAgIDEgKwogZHJpdmVy cy9maXJtd2FyZS9LY29uZmlnICAgICAgICAgfCAgMTEgKysKIGRyaXZlcnMvZmlybXdhcmU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