From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from inx.pm.waw.pl ([195.116.170.130]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PVCxW-00044L-Tt for barebox@lists.infradead.org; Wed, 22 Dec 2010 00:53:40 +0000 From: Krzysztof Halasa In-Reply-To: (Krzysztof Halasa's message of "Mon, 20 Dec 2010 23:30:03 +0100") References: Date: Wed, 22 Dec 2010 01:53:29 +0100 Message-ID: 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-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 6a] ARM: support big/little endian switching in "bootz". To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogS3J6eXN6dG9mIEhhxYJhc2EgPGtoY0BwbS53YXcucGw+CgpkaWZmIC0t Z2l0IGEvYXJjaC9hcm0vY3B1L0tjb25maWcgYi9hcmNoL2FybS9jcHUvS2NvbmZpZwppbmRleCAz NTcyYTFmLi43M2VlMTE1IDEwMDY0NAotLS0gYS9hcmNoL2FybS9jcHUvS2NvbmZpZworKysgYi9h cmNoL2FybS9jcHUvS2NvbmZpZwpAQCAtNzMsNiArNzMsMTUgQEAgY29uZmlnIENQVV9CSUdfRU5E SUFOCiAJICBwb3J0IG11c3QgcHJvcGVybHkgZW5hYmxlIGFueSBiaWctZW5kaWFuIHJlbGF0ZWQg ZmVhdHVyZXMKIAkgIG9mIHlvdXIgY2hpcHNldC9ib2FyZC9wcm9jZXNzb3IuCiAKK2NvbmZpZyBC T09UWl9FTkRJQU5ORVNTX1NXSVRDSAorCWJvb2wgIlN1cHBvcnQgc3dpdGNoaW5nIG9mIExpbnV4 IGtlcm5lbCBlbmRpYW5uZXNzIgorCWhlbHAKKwkgIFNheSBZIGhlcmUgaWYgeW91IG5lZWQgdG8g c3dpdG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