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.85_2 #1 (Red Hat Linux)) id 1bLQAq-0007We-Jx for barebox@lists.infradead.org; Fri, 08 Jul 2016 07:26:09 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 8 Jul 2016 09:25:43 +0200 Message-Id: <1467962743-15587-1-git-send-email-u.kleine-koenig@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 v2] mtd: nand: imx-bbm: use raw reading when checking for factory BBM To: barebox@lists.infradead.org VGhpcyBpcyBuZWNlc3NhcnkgdG8gcHJldmVudCB0aGUgaW14X25hbmRfYmJtIGNvbW1hbmQgdG8g YmFpbCBvdXQKb24gRUNDIGVycm9ycyB3aGljaCBsZWF2ZXMgdGhlIGRldmljZSB3aXRob3V0IEJC VC4KCkFsc28gc2ltcGxpZnkgYnVmZmVyIG1hbmFnZW1lbnQ6IFVzZSBvbi1zdGFjayBidWZmZXIg aW5zdGVhZCBvZiBtYWxsb2MuCgpTaWduZWQtb2ZmLWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dS5r bGVpbmUta29lbmlnQHBlbmd1dHJvbml4LmRlPgotLS0KQ2hhbmdlcyBzaW5jZSAoaW1wbGljaXQp IHYxIHNlbnQgd2l0aCBNZXNzYWdlLUlkOiAxNDY3ODg0OTIzLTI0MDYwLTEtZ2l0LXNlbmQtZW1h aWwtdS5rbGVpbmUta29lbmlnQHBlbmd1dHJvbml4LmRlOgoKIC0gZHJvcCB0d28gbm93IHVudXNl ZCB2YXJpYWJsZXMgZml4aW5nIHR3byBjb21waWxlciB3YXJuaW5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