Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbcDUOKy (ORCPT ); Thu, 21 Apr 2016 10:10:54 -0400 Received: from mail-by2on0076.outbound.protection.outlook.com ([207.46.100.76]:7648 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751584AbcDUOKw (ORCPT ); Thu, 21 Apr 2016 10:10:52 -0400 Authentication-Results: the-dreams.de; dkim=none (message not signed) header.d=none;the-dreams.de; dmarc=none action=none header.from=caviumnetworks.com; Date: Thu, 21 Apr 2016 16:10:34 +0200 From: Jan Glauber To: Wolfram Sang CC: , , David Daney Subject: Re: [PATCH v6 08/19] i2c: octeon: Enable High-Level Controller Message-ID: <20160421141034.GC2623@hardcore> References: <34aac0bb7c0ae1c0ef7ca43d087059d04d9d8b09.1460387640.git.jglauber@cavium.com> <20160420214354.GD1546@katana> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160420214354.GD1546@katana> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.66.108.80] X-ClientProxiedBy: VI1PR07CA0121.eurprd07.prod.outlook.com (10.165.229.175) To BN3PR07MB2580.namprd07.prod.outlook.com (10.167.5.8) X-MS-Office365-Filtering-Correlation-Id: a93034c7-9785-429c-836a-08d369eebdb0 X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2580;2:SlsWGtvMwiD52AjPXzCoWBMLo0prG6YfK0Enu2kAf2Oc/shlXu3y290ukeuYZUd3hqGzrFiqHulpJ4fcLrjml8v/g1Cx2Ao4W4qgsKPDsIVvFXFy6VEFOeTJJjeabJuvRc2xfc7G1K3OyN5Gce2rNblGEN18mLhkFPYiEg7xNm6Pbs9dk97DbffIv7js6IHc;3:OMxJW6VqKhFUC3THo3SeRudfx2VqKRUzlA6YRNiZyry7AQE4j/EImQpfnFIDLpkxiASwufMsVJf7vq9a7NGu0NXyB53Bvfsu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z8y6FSFHVywZwwZKbA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046);SRVR:BN3PR07MB2580;BCL:0;PCL:0;RULEID:;SRVR:BN3PR07MB2580; X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2580;4:m+PVfTwQxWKUEFn1fl1MqrgA7l/74YUyvijgz/98wmLQGklJQMhVUNu/r585XNR0f25K8/zWvIE+vsSDyJSigT9LGUfcraZmzYBdvvzut/QdS8gqfl/k14fGzkTtVj5wf1HhRtiQ7f+s2XIWJfi8pfBYTdEjoP9yWWGiLm/pN/VOYDjHEs1/+qY5LWEq6VpE6er+LkM/De4H4yb4DTbpSQXdK10xjYPMwFTjTzlFrBmsoGyY2xm4P7DewDcRCH5pNqEh3CTBs7gwMsWELO50+CwzbVZ89tgs5jn41bK8p69caoVLk/3c0YmRR0wbrdNTWqH3D0i1IxJo3pUGPMcBVdqyHeVSUZSi6AzP8VKekYRVhSjfZ1M5Inb5IV7h0n9758B0stahXI1TroEkE6q2Dw== X-Forefront-PRVS: 091949432C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(33656002)(54356999)(86362001)(46406003)(50986999)(76176999)(33716001)(81166005)(5004730100002)(2950100001)(42186005)(2906002)(586003)(83506001)(4001430100002)(66066001)(4001350100001)(6116002)(19580405001)(92566002)(23726003)(189998001)(3846002)(19580395003)(4326007)(47776003)(5008740100001)(9686002)(97756001)(107886002)(1076002)(110136002)(50466002)(1096002)(77096005);DIR:OUT;SFP:1101;SCL:1;SRVR:BN3PR07MB2580;H:hardcore;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN3PR07MB2580;23:FNhXyCL9Q295ddx2hM/uAQCbHykV9s5ZjoTWxV6ML?= =?us-ascii?Q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qgeW6OH?= =?us-ascii?Q?ujKV3aZRaTQFbwO3g8QBVXvP+OsgXSmhWFp/qFy1ckFI6hpR9RhLbm/jIKeb?= =?us-ascii?Q?DMnsv8M91mLMBN1u351hz9X2iWKUiMmIcn57m5Vo92kWw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;BN3PR07MB2580;5:LDfDZxEkbUOIZVmw6lDqFq3Oxa25rwVsiw13GCEZUnjc/XQaIX0adJhy36JSMRtlOCUyilxeY609BvBcusc4qsblO7peQx8/6WMrVTKQNQflRbyxHvutJDpg7GLWIaexRtVcflsFgju91DhyQPV7oWiAslGSsH/1feIZSEX9TGYxVcVdoRP6uW9qA/6rocYc;24:dHRgVEfDEAMw7Y4cvj4AyPz5uHscJ64UCiNgbPKBjywwfvPVQT9bbiSnaNqV5pntY+13KXYC3aNhYwLgcgIrnSDX8QZoKVALjmpA8/8ep6Q=;7:lvdJWaNaDkFAxgMBrGdyaduQhhnd6QV2JwBbrEP58J9ONLnewrtjg67Qti196gRoVn9chI80dewMVohUuoBGVJcD/jSWGhuBaA39vwgrZYIiZzXsm8kZ2cqyzhskdRkF7IauTU7KqbkmlvUK+vEI98LL5ylWkm/+J+MsqeVxWGNkBoCOKha6RScpV5BLdyCRaHl/Aw2jkT2R/UgHBKjxbnx7LpRvqZs6BOgzFRQQ3js= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Apr 2016 14:10:48.4810 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2580 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1297 Lines: 36 On Wed, Apr 20, 2016 at 11:43:54PM +0200, Wolfram Sang wrote: > On Mon, Apr 11, 2016 at 05:28:39PM +0200, Jan Glauber wrote: > > From: David Daney > > > > Use High-Level Controller (HLC) when possible. The HLC can read/write > > up to 8 bytes and is completely optional. The most important difference > > of the HLC is that it only requires one interrupt for a transfer > > (up to 8 bytes) where the low-level read/write requires 2 interrupts > > plus one interrupt per transferred byte. Since the interrupts are costly > > using the HLC improves the performance. Also, the HLC provides improved error > > handling. > > Much better description, thanks! > > > + while (1) { > > + val = octeon_i2c_ctl_read(i2c); > > + if (!(val & (TWSI_CTL_STA | TWSI_CTL_STP))); > > + break; > > + > > + /* clear IFLG event */ > > + if (val & TWSI_CTL_IFLG) > > + octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB); > > + > > + if (try++ > 100) { > > + pr_err("%s: giving up\n", __func__); > > + break; > > + } > > + > > + /* spin until any start/stop has finished */ > > + udelay(10); > > + } > > Maybe you can use one of the readx_poll_timeout() functions? Nice, but I don't think we can use readx_poll_timeout() here because of the octeon_i2c_ctl_write inside the loop...