From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from relay5-d.mail.gandi.net ([217.70.183.197]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ioWIP-0000HS-Am for barebox@lists.infradead.org; Mon, 06 Jan 2020 17:36:13 +0000 From: Ahmad Fatoum Date: Mon, 6 Jan 2020 18:35:38 +0100 Message-Id: <20200106173540.20367-4-ahmad@a3f.at> In-Reply-To: <20200106173540.20367-1-ahmad@a3f.at> References: <20200106173540.20367-1-ahmad@a3f.at> 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: [RFC PATCH 3/5] mci: add first-stage at91-sdhci driver To: barebox@lists.infradead.org Cc: lst@pengutronix.de VGhpcyBjb21taXQgaW1wb3J0cyB0aGUgYXQ5MWJvb3RzdHJhcCB2My45LjEtcmMxIHN0YXRlIG9m IHRoZQpBdG1lbCBTREhDSSB2YXJpYW50IGRyaXZlci4KClNlY29uZCBzdGFnZSB1c2UgaXMgbm90 IGltcGxlbWVudGVkIGFuZCBmaXJzdCBzdGFnZSB1c2UgaW4gZ2VuZXJhbCBpcwpub3QgcG9zc2li bGUsIGJlY2F1c2UgU0RSQU0gc2V0IHVwIGlzIG5vdCB5ZXQgaW1wbGVtZW50ZWQuCkhvd2V2ZXIs IGl0IGNhbiBhbHJlYWR5IGJlIHVzZWQgdG8gc2hvdyBjYXNlIHRoZSB1c2Ugb2YgRkFUIGZyb20g dGhlCmJhcmVib3ggUEJMIHVzZWQgaW4gYSBmb2xsb3cgdXAgY29tbWl0LgoKU2lnbmVkLW9mZi1i eTogQWhtYWQgRmF0b3VtIDxhaG1hZEBhM2YuYXQ+Ci0tLQogZHJpdmVycy9tY2kvS2NvbmZpZyAg ICAgICAgICAgICAgfCAgIDQgKwogZH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mllczsg aSsrKSB7CisJCXJldCA9IG1tY19jbWRfc2VuZF9vcF9jb25kKHByaXYsICZvY3IpOworCQlpZiAo cmV0KQorCQkJcmV0dXJuIHJldDsKKworCQlpZiAob2NyICAmICgweDAxVSA8PCAzMSkpCisJCQli cmVhazsKKworCQllYXJseV91ZGVsYXkoMTAwMCk7CisJfTsKKworCWlmIChpID09IHJldHJpZXMp CisJCXJldHVybiAtRUlPOworCisJcHJfZGVidWcoIm1tY192ZXJpZnlfb3BlcmF0aW5nX2NvbmRp dGlvbiBzdWNjZXNzIE9DUiA9ICV4XG4iLCBvY3IpOworCXJldHVybiAwOworfQorCisvKgorICog UmVmZXIgdG8gUGh5c2ljYWwgTGF5ZXIgU3BlY2lmaWNhdGlvbiBWZXJzaW9uIDMuMQorICogRmln dXJlIDQtMTogU0QgTWVtb3J5IENhcmQgU3RhdGUgRGlhZ3JhbSAoY2FyZCBpZGVudGlmaWNhdGlv biBtb2RlKQorICogRmlndXJlIDQtMjogQ2FyZCBJbml0aWFsaXphdGlvbiBhbmQgSW5kZW50aWZp Y2F0aW9uIEZsb3cgKFNEIG1vZGUpCisgKi8KK3N0YXRpYyBpbnQgc2RjYXJkX2lkZW50aWZpY2F0 aW9uKHN0cnVjdCBhdDkxX3NkaGNpX3ByaXYgKnByaXYpCit7CisJaW50IHJldDsKKworCWVhcmx5 X3VkZWxheSgzMDAwKTsKKworCXJldCA9IHNkX2NtZF9nb19pZGxlX3N0YXRlKHByaXYpOworCWlm IChyZXQpCisJCXJldHVybiByZXQ7CisKKwllYXJseV91ZGVsYXkoMjAwMCk7CisKKwlyZXQgPSBt bWNfdmVyaWZ5X29wZXJhdGluZ19jb25kaXRpb24ocHJpdik7CisJaWYgKHJldCA9PSAwKSB7CisJ CXByaXYtPm5vX3NkID0gdHJ1ZTsKKwl9IGVsc2UgaWYgKHJldCA9PSAtRVRJTUVET1VUKSB7CisJ CXJldCA9IHNkX2NtZF9zZW5kX2lmX2NvbmQocHJpdik7CisJCWl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