From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from inx.pm.waw.pl ([195.116.170.130]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UOvjf-00089a-5M for barebox@lists.infradead.org; Sun, 07 Apr 2013 19:58:45 +0000 From: Krzysztof Halasa References: <20130402065241.GB1906@pengutronix.de> Date: Sun, 07 Apr 2013 21:58:41 +0200 In-Reply-To: (Krzysztof Halasa's message of "Sun, 07 Apr 2013 13:42:21 +0200") Message-ID: 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] ARM: Support for IXP4xx built-in Ethernet interfaces. To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogS3J6eXN6dG9mIEhhxYJhc2EgPGtoY0BwbS53YXcucGw+CgpkaWZmIC0t Z2l0IGEvYXJjaC9hcm0vbWFjaC1peHA0eHgvaW5jbHVkZS9tYWNoL3BsYXRmb3JtLmggYi9hcmNo L2FybS9tYWNoLWl4cDR4eC9pbmNsdWRlL21hY2gvcGxhdGZvcm0uaApuZXcgZmlsZSBtb2RlIDEw MDY0NAppbmRleCAwMDAwMDAwLi4xZGY0YWE0Ci0tLSAvZGV2L251bGwKKysrIGIvYXJjaC9hcm0v bWFjaC1peHA0eHgvaW5jbHVkZS9tYWNoL3BsYXRmb3JtLmgKQEAgLTAsMCArMSwxNSBAQAorI2lu Y2x1ZGUgPGFzbS90eXBlcy5oPgorCisjZGVmaW5lIElYUDRYWF9FVEhfTlBFQSAweDAwCisjZGVm aW5lIElYUDRYWF9FVEhfTlBFQiAweDEwCisjZGVmaW5lIElYUDRYWF9FVEhfTlBFQyAweDIwCisK Ky8qIEluZm9ybWF0aW9uIGFib3V0IGJ1aWx0LWluIEV0aGVybmV0IE1BQyBpbnRlcmZ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