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 1PUosU-00059Z-8z for barebox@lists.infradead.org; Mon, 20 Dec 2010 23:10:52 +0000 From: Krzysztof Halasa In-Reply-To: (Krzysztof Halasa's message of "Mon, 20 Dec 2010 23:30:03 +0100") Date: Tue, 21 Dec 2010 00:10:41 +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 12] Fix NOR CFI flash driver to work on big endian systems. To: barebox@lists.infradead.org Rml4IE5PUiBDRkkgZmxhc2ggZHJpdmVyIHRvIHdvcmsgb24gYmlnIGVuZGlhbiBzeXN0ZW1zLgpC YXNpY2FsbHkgdGhpcyB0cmFuc2Zvcm1zIHRoZSB1OC91MTYvdTMyL3U2NCB1bmlvbiBpbnRvCmEg c2luZ2xlIHU2NCB2YWx1ZS4KCk5vdCB0ZXN0ZWQgb24gTEUgcGxhdGZvcm0uIEFwcGx5IHdpdGgg Y2F1dGlvbi4KClNpZ25lZC1vZmYtYnk6IEtyenlzenRvZiBIYcWCYXNhIDxraGNAcG0ud2F3LnBs PgoKZGlmZiAtLWdpdCBhL2RyaXZlcnMvbm9yL2NmaV9mbGFzaC5jIGIvZHJpdmVycy9ub3IvY2Zp X2ZsYXNoLmMKaW5kZXggOTAzMDdkMi4uMzQwMzFiMCAxMDA2NDQKLS0tIGEvZHJpdmVycy9ub3Iv Y2ZpX2ZsYXNoLmMKKysrIGIvZHJpdmVycy9ub3IvY2ZpX2ZsYXNoLmMKQEAgLTc3LDU5ICs3Nyw0 MCBAQCBzdGF0aWMgdWludCBmbGFzaF9vZmZzZXRfY2ZpWzJdPXtGT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