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 1UOvgO-00085V-05 for barebox@lists.infradead.org; Sun, 07 Apr 2013 19:55:21 +0000 From: Krzysztof Halasa References: <20130402065241.GB1906@pengutronix.de> Date: Sun, 07 Apr 2013 21:55:18 +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 hardware Queue Manager. To: barebox@lists.infradead.org U2lnbmVkLW9mZi1ieTogS3J6eXN6dG9mIEhhxYJhc2EgPGtoY0BwbS53YXcucGw+CgpkaWZmIC0t Z2l0IGEvYXJjaC9hcm0vbWFjaC1peHA0eHgvS2NvbmZpZyBiL2FyY2gvYXJtL21hY2gtaXhwNHh4 L0tjb25maWcKaW5kZXggZTY5ZGUyOS4uOTI0NGJlOSAxMDA2NDQKLS0tIGEvYXJjaC9hcm0vbWFj aC1peHA0eHgvS2NvbmZpZworKysgYi9hcmNoL2FybS9tYWNoLWl4cDR4eC9LY29uZmlnCkBAIC0w LDAgKzEsOSBAQAoraWYgQVJDSF9JWFA0WFgKKworY29uZmlnIElYUDRYWF9RTUdSCisJdHJpc3Rh dGUgIklYUDR4eCBRdWV1ZSBNYW5hZ2VyIHN1cHBvcnQiCisJaGVscAorCSAgVGhpcyBkcml2ZXIg c3VwcG9ydHMgSVhQNHh4IGJ1aWx0LWluIGhhcmR3YXJlIHF1ZXVlIG1hbmFnZXIKKwkgIGFuZCBp cyByZXF1aXJlZCBieSB0aGUgRXRoZXJuZXQgZHJpdmVyLgorCitlbmRpZgpkaWZmI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1ZGUg PG1hY2gvaXhwNHh4LXJlZ3MuaD4KKyNpbmNsdWRlIDxhc20vaW8uaD4KKworI2RlZmluZSBERUJV R19RTUdSICAgICAgIDAKKworI2RlZmluZSBIQUxGX1FVRVVFUyAgICAgMzIKKyNkZWZpbmUgUVVF VUVTICAgICAgICAgIDY0CisjZGVmaW5lIE1BWF9RVUVVRV9MRU5HVEggNCAvKiBpbiBkd29yZHMg Ki8KKworI2RlZmluZSBRVUVVRV9TVEFUMV9FTVBUWSAgICAgICAgICAgICAgIDEgLyogcXVldWUg c3RhdHVzIGJpdHMgKi8KKyNkZWZpbmUgUVVFVUVfU1RBVDFfTkVBUkxZX0VNUFRZICAgICAgICAy CisjZGVmaW5lIFFVRVVFX1NUQVQxX05FQVJMWV9GVUxMICAgICAgICAgNAorI2RlZmluZSBRVUVV RV9TVEFUMV9GVUxMICAgICAgICAgICAgICAgIDgKKyNkZWZpbmUgUVVFVUVfU1RBVDJfVU5ERVJG TE9XICAgICAgICAgICAxCisjZGVmaW5lIFFVRVVFX1NUQVQyX09WRVJGTE9XICAgICAgICAgICAg MgorCisjZGVmaW5lIFFVRVVFX1dBVEVSTUFSS18wX0VOVFJJRVMgICAgICAgMAorI2RlZmluZSBR VUVVRV9XQVRFUk1BUktfMV9FTlRSWSAgICAgICAgIDEKKyNkZWZpbmUgUVVFVUVfV0FURVJNQVJL XzJfRU5UUklFUyAgICAgICAyCisjZGVmaW5lIFFVRVVFX1dBVEVSTUFSS180X0VOVFJJRVMgICAg ICAgMworI2RlZmluZSBRVUVVRV9XQVRFUk1BUktfOF9FTlRSSUVTICAgICAgIDQKKyNkZWZpbmUg UVVFVUVfV0FURVJNQVJLXzE2X0VOVFJJRVMgICAgICA1CisjZGVmaW5lIFFVRVVFX1dBVEVSTUFS S18zMl9FTlRSSUVTICAgICAgNgorI2RlZmluZSBRVUVVRV9XQVRFUk1BUktfNjRfRU5UUklFUyAg ICAgIDcKKworLyogcXVldWUgaW50ZXJydXB0IHJlcXVl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