From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4obc-0001Je-DF for barebox@lists.infradead.org; Wed, 18 Oct 2017 13:41:59 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Wed, 18 Oct 2017 15:41:16 +0200 Message-Id: <20171018134117.20289-2-uwe@kleine-koenig.org> In-Reply-To: <20171018134117.20289-1-uwe@kleine-koenig.org> References: <20171018134117.20289-1-uwe@kleine-koenig.org> 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/3] ARM: i.MX: bbu-internal: new handler to make use of mmc boot partitions To: barebox@lists.infradead.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= RnJvbTogVXdlIEtsZWluZS1Lw7ZuaWcgPHUua2xlaW5lLWtvZW5pZ0BwZW5ndXRyb25peC5kZT4K ClRoaXMgaGFuZGxlciB1cGRhdGVzIHRoZSBub24tYWN0aXZlIE1NQyBib290IHBhcnRpdGlvbiBh bmQgYWZ0ZXIgYQpzdWNjZXNzZnVsIHVwZGF0ZSBtYWtlcyB0aGUgdXBkYXRlZCBwYXJ0aXRpb24g dGhlIGFjdGl2ZSBvbmUuIFRoaXMgd2F5CnRoZSBtYWNoaW5lIHNob3VsZCBjb250aW51ZSB0byBi ZSBib290YWJsZSB3aGVuIHRoZSB1cGRhdGUgZmFpbHMuCgpTaWduZWQtb2ZmLWJ5OiBVd2UgS2xl aW5lLUvDtm5pZyA8dS5rbGVpbmUta29lbmlnQHBlbmd1dHJvbml4LmRlPgotLS0KIGFyY2gvYXJt L21hY2gtaW14L2lteC1iYnUtaW50Z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