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 1e6YvK-0004mf-6E for barebox@lists.infradead.org; Mon, 23 Oct 2017 09:21:34 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 23 Oct 2017 11:21:02 +0200 Message-Id: <20171023092103.10023-3-uwe@kleine-koenig.org> In-Reply-To: <20171023092103.10023-1-uwe@kleine-koenig.org> References: <20171023092103.10023-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 v2 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 L21hY2gtaW14L2lteC1iYnUtaW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m5hbF9iYnVfaGFuZGxlciwgaGFuZGxl cik7CisJaW50IHJldDsKKwl1aW50MzJfdCAqYmFya2VyOworCWNoYXIgKmJvb3RwYXJ0dmFyOwor CWNvbnN0IGNoYXIgKmJvb3RwYXJ0OworCWNoYXIgKmRldmljZWZpbGU7CisKKwliYXJrZXIgPSBk YXRhLT5pbWFnZSArIGlteF9oYW5kbGVyLT5mbGFzaF9oZWFkZXJfb2Zmc2V0OworCisJaWYgKCpi YXJrZXIgIT0gSVZUX0JBUktFUikgeworCQlwcmludGYoIkJvYXJkIGRvZXMgbm90IHByb3ZpZGUg RENEIGRhdGEgYW5kIHRoaXMgaW1hZ2UgaXMgbm8gaW14aW1hZ2VcbiIpOworCQlyZXR1cm4gLUVJ TlZBTDsKKwl9CisKKwlyZXQgPSBhc3ByaW50ZigmYm9vdHBhcnR2YXIsICIlcy5ib290IiwgZGF0 YS0+ZGV2aWNlZmlsZSk7CisJaWYgKHJldCA8IDApCisJCXJldHVybiByZXQ7CisKKwlib290cGFy dCA9IGdldGVudihib290cGFydHZhcik7CisKKwlpZiAoIXN0cmNtcChib290cGFydCwgImJvb3Qw IikpIHsKKwkJYm9vdHBhcnQgPSAiYm9vdDEiOworCX0gZWxzZSB7CisJCWJvb3RwYXJ0ID0gImJv b3QwIjsKKwl9CisKKwlyZXQgPSBhc3ByaW50ZigmZGV2aWNlZmlsZSwgIi9kZXYvJXMuJXMiLCBk YXRhLT5kZXZpY2VmaWxlLCBib290cGFydCk7CisJaWYgKHJldCA8IDApCisJCWdvdG8gZnJlZV9i b290cGFydHZhcjsKKworCXJldCA9IGlteF9iYnVfY2hlY2tfcHJlcmVxKGRldmljZWZpbGUsIGRh dGEpOworCWlmIChyZXQpCisJCWdvdG8gZnJlZV9kZXZpY2VmaWxlOworCisJcmV0ID0gaW14X2Ji dV93cml0ZV9kZXZpY2UoaW14X2hhbmRsZXIsIGRldmljZWZpbGUsIGRhdGEsIGRhdGEtPmltYWdl LCBkYXRhLT5sZW4pO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