From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pa0-f47.google.com ([209.85.220.47]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YNwfd-0005BU-8t for barebox@lists.infradead.org; Wed, 18 Feb 2015 04:55:33 +0000 Received: by padfb1 with SMTP id fb1so11748864pad.8 for ; Tue, 17 Feb 2015 20:55:11 -0800 (PST) From: Andrey Smirnov Date: Tue, 17 Feb 2015 20:54:40 -0800 Message-Id: <1424235280-3776-1-git-send-email-andrew.smirnov@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: [RESEND][PATCH] firmware: altera: Make nSTAT GPIO optional To: barebox@lists.infradead.org Cc: Andrey Smirnov , kernel@pengutronix.de QnkgdGFraW5nIHBhcnRzIG9mIHRoZSBwcm9ncmFtbWluZyBoYW5kc2hha2luZyBwcm90b2NvbCBv biBmYWl0aCBpdCBpcwpwb3NzaWJsZSB0byBtYWtlIGR1ZSB3aXRoIG9ubHkgdHdvIEdQSU8gZm9y IHByb2dyYW1taW5nIEFsdGVyYQpGUEdBcy4gVGhpcyBpcyBub3QgYSB2ZXJ5IGFkdmlzYWJsZSBw cmFjdGljZSwgYnV0IHNvbWV0aW1lIHVuYXZvaWRhYmxlCmluIEdQSU8gY29uc3RyYWluZWQgZGVz aWducy4KClNpZ25lZC1vZmYtYnk6IEFuZHJleSBTbWlybm92IDxhbmRyZXcuc21pcm5vdkBnbWFp bC5jb20+Ci0tLQogZHJpdmVycy9maXJtd2FyZS9hbHRlcmFfc2VyaWFsLmMgfCA1OSArKysrKysr KysrKysrKysrKysrKysrKysrKysrKystLS0tLS0tLS0tCiAxIGZpbGUgY2hhbmdlZCwgNDQgaW5z ZXJ0aW9ucygrKSwgMTUgZGVsZ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