From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XA1uw-0007Iq-Qn for barebox@lists.infradead.org; Wed, 23 Jul 2014 19:09:36 +0000 Received: by mail-wi0-f173.google.com with SMTP id f8so8299987wiw.0 for ; Wed, 23 Jul 2014 12:09:11 -0700 (PDT) From: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= Date: Wed, 23 Jul 2014 12:09:04 -0700 Message-Id: <1406142544-10516-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] i2c: add Atmel AT91 driver To: barebox@lists.infradead.org Cc: =?UTF-8?q?Rapha=C3=ABl=20Poggi?= U2lnbmVkLW9mZi1ieTogUmFwaGHDq2wgUG9nZ2kgPHBvZ2dpLnJhcGhAZ21haWwuY29tPgotLS0K IGRyaXZlcnMvaTJjL2J1c3Nlcy9LY29uZmlnICAgIHwgICA0ICsKIGRyaXZlcnMvaTJjL2J1c3Nl cy9NYWtlZmlsZSAgIHwgICAxICsKIGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMtYXQ5MS5jIHwgNDM4 ICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKwogMyBmaWxlcyBjaGFu Z2VkLCA0NDMgaW5zZXJ0aW9ucygrKQogY3JlYXRlIG1vZGUgMTAwNjQ0IGRyaXZlcnMvaTJjL2J1 c3Nlcy9pMmMtYXQ5MS5jCgpkaWZmIC0tZ2l0IGEvZHJpdmVycy9pMmMvYnVzc2VzL0tjb25maWcg Yi9kcml2ZXJzL2kyYy9idXNzZXMvS2NvbmZpZwppbmRleCAzN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