From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XDCnX-0004Wa-QM for barebox@lists.infradead.org; Fri, 01 Aug 2014 13:23:04 +0000 Received: by mail-we0-f169.google.com with SMTP id u56so4300813wes.0 for ; Fri, 01 Aug 2014 06:22:28 -0700 (PDT) From: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= Date: Fri, 1 Aug 2014 15:23:20 +0200 Message-Id: <1406899404-29094-2-git-send-email-poggi.raph@gmail.com> In-Reply-To: <1406899404-29094-1-git-send-email-poggi.raph@gmail.com> References: <1406899404-29094-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 1/5] mtd: atmel_nand: add support for device tree To: barebox@lists.infradead.org Cc: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= U2lnbmVkLW9mZi1ieTogUmFwaGHDq2wgUG9nZ2kgPHBvZ2dpLnJhcGhAZ21haWwuY29tPgotLS0K IGRyaXZlcnMvbXRkL25hbmQvYXRtZWxfbmFuZC5jIHwgIDEwOCArKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrLQogMSBmaWxlIGNoYW5nZWQsIDEwNyBpbnNlcnRpb25zKCsp LCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9tdGQvbmFuZC9hdG1lbF9uYW5k LmMgYi9kcml2ZXJzL210ZC9uYW5kL2F0bWVsX25hbmQuYwppbmRleCAzMzdlMjI1Li5iN2IwZTNh IDEwMDY0NAotLS0gYS9kcml2ZXJzL210ZC9uYW5kL2F0bWVsX25hbmQuYworKysgYi9k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