From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctf69-00077c-Rp for barebox@lists.infradead.org; Thu, 30 Mar 2017 18:47:08 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 30 Mar 2017 20:46:36 +0200 Message-Id: <20170330184636.22846-3-u.kleine-koenig@pengutronix.de> In-Reply-To: <20170330184636.22846-1-u.kleine-koenig@pengutronix.de> References: <20170330184636.22846-1-u.kleine-koenig@pengutronix.de> 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 2/2] watchdog: new driver for Armada XP To: barebox@lists.infradead.org VGhpcyBTb0MgdXNlcyBhIHZhcmlhbnQgb2YgdGhlIElQIHRoYXQgaXMgYWxzbyB1c2VkIG9uIG1v c3Qgb3RoZXIKTWFydmVsbCBTb0NzLiBGb3Igbm93IGl0IG9ubHkgc3VwcG9ydHMgQXJtYWRhIFhQ IGJ1dCB0aGUgbmFtaW5nIGlzCmFscmVhZHkgY2hvc2VuIHN1Y2ggdGhhdCBhZGRpbmcgc3VwcG9y dCBmb3IgZnVydGhlciBTb0NzIGRvZXNuJ3QgcmVzdWx0CmluIG11Y2ggcmVuYW1pbmcuCgpTaWdu ZWQtb2ZmLWJ5OiBVd2UgS2xlaW5lLUvDtm5pZyA8dS5rbGVpbmUta29lbmlnQHBlbmd1dHJvbml4 LmRlPgotLS0KIGRyaXZlcnMvd2F0Y2hkb2cvS2NvbmZpZyAgICAgfCAgIDYgKysrCiBkcml2ZXJz L3dhdGNoZG9nL01ha2VmaWxlICAgIHwgICAxICsKIGRyaXZlcnMvd2F0Y2hk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