From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-we0-x236.google.com ([2a00:1450:400c:c03::236]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XOQiD-0006sz-NV for barebox@lists.infradead.org; Mon, 01 Sep 2014 12:27:58 +0000 Received: by mail-we0-f182.google.com with SMTP id w62so5414410wes.27 for ; Mon, 01 Sep 2014 05:27:35 -0700 (PDT) From: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= Date: Mon, 1 Sep 2014 14:27:35 +0200 Message-Id: <1409574455-15746-4-git-send-email-poggi.raph@gmail.com> In-Reply-To: <1409574455-15746-1-git-send-email-poggi.raph@gmail.com> References: <1409574455-15746-1-git-send-email-poggi.raph@gmail.com> 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 v3 3/3] mtd: atmel_nand: add support for device tree To: barebox@lists.infradead.org Cc: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= U2lnbmVkLW9mZi1ieTogUmFwaGHDq2wgUG9nZ2kgPHBvZ2dpLnJhcGhAZ21haWwuY29tPgotLS0K IGRyaXZlcnMvbXRkL25hbmQvYXRtZWxfbmFuZC5jIHwgIDExMSArKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrLQogMSBmaWxlIGNoYW5nZWQsIDExMCBpbnNlcnRpb25zKCsp LCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9tdGQvbmFuZC9hdG1lbF9uYW5k LmMgYi9kcml2ZXJzL210ZC9uYW5kL2F0bWVsX25hbmQuYwppbmRleCAyMjQ2NjAyLi45MTBlY2Mz IDEwMDY0NAotLS0gYS9kcml2ZXJzL210ZC9uYW5kL2F0bWVsX25hbmQuYworKysgYi9k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