From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TH0XH-0007cf-6O for barebox@lists.infradead.org; Wed, 26 Sep 2012 22:56:56 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 27 Sep 2012 00:56:46 +0200 Message-Id: <1348700206-30581-1-git-send-email-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-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] [RFC] i2c-imx: send a soft bus reset during probe To: barebox@lists.infradead.org Cc: kernel@pengutronix.de SWYgYW4gaTJjIHNsYXZlIHB1bGxzIFNEQSBsb3cgd2hlbiB0aGUgU29DIHdhbnRzIHRvIHN0YXJ0 IGEgdHJhbnNmZXIsIGl0CmNhbm5vdCBnZXQgdGhlIGJ1cy4gVGhpcyBjYW4gaGFwcGVuIGZvciBl eGFtcGxlIGlmIHRoZSBTb0MgaXMgcmVzZXQgd2hlbgppdCBqdXN0IHN1Y2Nlc3NmdWxseSBhZGRy ZXNzZWQgYSBzbGF2ZSBidXQgYmVmb3JlIGl0IHJpc2VzIFNDTCBmb3IgdGhlCnNsYXZlIHRvIGFj ay4gQ3VycmVudGx5IHRoaXMgbWFrZXMgdGhlIGRyaXZlciByZWZ1c2UgdG8gZG8gYW55dGhpbmcu IFlvdQpjYW4gZm9yY2UgdGhpcyBzaXR1YXRpb24gd2l0aCB0aGUgZm9sbG93aW5nIGNvZGUgYXNz dW1pbmcgeW91IGhhdmUgYQpkZXZpY2Ugb24gYWRkcmVzcyAweDUwOgoKCS8qIGdlbmVyYXRlIGEg c3RhcnQgY29uZGl0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