Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755240AbcCaKYx (ORCPT ); Thu, 31 Mar 2016 06:24:53 -0400 Received: from mail-bn1on0070.outbound.protection.outlook.com ([157.56.110.70]:23257 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751654AbcCaKYv (ORCPT ); Thu, 31 Mar 2016 06:24:51 -0400 X-Greylist: delayed 674 seconds by postgrey-1.27 at vger.kernel.org; Thu, 31 Mar 2016 06:24:51 EDT 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, 31 Mar 2016 12:24:33 +0200 From: Jan Glauber To: Wolfram Sang CC: , , David Daney , David Daney Subject: Re: [PATCH v4 05/14] i2c-octeon: Enable high-level controller and improve on bus contention Message-ID: <20160331102433.GB31112@hardcore> References: <27b7d9015f8165da0371e4d26c9acc72772ae3a0.1458289385.git.jglauber@cavium.com> <20160323203215.GF19849@katana> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160323203215.GF19849@katana> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.66.101.161] X-ClientProxiedBy: DB5PR02CA0033.eurprd02.prod.outlook.com (25.161.237.43) To SN2PR0701MB765.namprd07.prod.outlook.com (25.160.15.143) X-MS-Office365-Filtering-Correlation-Id: b2edd2f8-f3e2-43e4-3425-08d3594eafe9 X-Microsoft-Exchange-Diagnostics: 1;SN2PR0701MB765;2:yQM/qbxx2XSP4r5rNwKCjgfvAlJ3pITM/Wl9sXeZ6MzJHNzADKN7+ecgPBGZXwSRnsnJzyQdSRtu4EHrgHnHnyFha3vcMXueT46Mz6uEpcov5BffWPsp+XUeaiSTirfCbR47qojH1DmGHHdy29RR+av8vr1LjVMewZCpuHYZuDBNxBBH5oj2HUX8XuJC/MNA;3:o3iTwDTQtE3YRQ4V23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vznp0UbMrdGXYSCtmYJejpi7eGJEY8rUTgwCfy0iVR8Uh0+hoFXeMR1KPDIK45r7OX8A0lFYENx6GAUcgMssmhSB9xFbaNciIW3wIoS2BBdPr1LqAP9QB73CO/dCgaxTHgIjtwU5o4T5qZUMs6whGp4O+9yWOK9PP61zx7Zx9DZNff/abXCnEmQJxwZQlF5xRuMSfKZIqkdG2VfzYo8gUje4enLpGgIVuH+yrvYhRt68d6Ko8Q3r2Yqcv5XPv1TKCvWOjiSSAU6uPo82cubR+Aj+mysI9JH7+Jz1HAc36nh9RYIbugExoawJ8OAWhP0f5f/s+pu6+WsXsAULM+yMqdcoP2QRlpRNqqrq1rxvZvo7m2g5+mZVUbJ5WNAdE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:SN2PR0701MB765;BCL:0;PCL:0;RULEID:;SRVR:SN2PR0701MB765; X-Microsoft-Exchange-Diagnostics: 1;SN2PR0701MB765;4:bkD0iz/Xls/88GNHnW3PDLnjGXaKOlrAXaxjXU/Y0g9n/u6yVJ+/wwpv/zdfzA/+sRSzgh0aNXu5I3YoWHczpFBXs8Iqe6jQzD6nfVGSfwv2gVs5DMAXyk5ZoABaWllMhNAFT+kvJGHIq1ujJzEYVx743o00UsPPh0wlKf86StBiOwuJ/qf9AAaPcafaax1ZhC/NU6tlT4V9G/x2P4mN6P6kFmcxStuuaNu7SbAPNceqKHjerOnJ0APsyhpVuIOmD2h4e1eOmt0g+EgHUeSWSSjV+BNCl+ET/pfip/nV0bwKnAIz8ar3daHo6syUE01IxUjL0WU7Y0cg+JC83TI0/Q01mt1jByOY2Jicop+/PQIJVajkR8IKKC52s/bspGX7 X-Forefront-PRVS: 0898A6E028 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(164054003)(46406003)(561944003)(4326007)(33656002)(42186005)(2906002)(5004730100002)(50466002)(97756001)(66066001)(92566002)(3846002)(6116002)(33716001)(23726003)(83506001)(81166005)(47776003)(189998001)(4001430100002)(50986999)(2950100001)(77096005)(107886002)(19580395003)(1076002)(19580405001)(110136002)(4001350100001)(586003)(5008740100001)(54356999)(76176999)(1096002)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR0701MB765;H:hardcore;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR0701MB765;23:4LkPPvnh5WrHIKKMEi3ZvqhNcRUOSOf/4TVSWtLS?= =?us-ascii?Q?5I+gAjvsAiI7KzuxbBSLpc6rCh8/QNiGwpY+bPr1ycljvAtW6ylTWTrAZCv6?= =?us-ascii?Q?80duooVoHY6+/wouM+FVCszzh3Q3vXn9Pi8ZMk9ws0EBwcq8MDGgMmbBUJri?= =?us-ascii?Q?7w+JI8+o73QK9n0DYQokyAcCJMCbYQpX4XzuQYHWoBHAi/k3Laaca7Y3R3GZ?= =?us-ascii?Q?BHyoYAWiblqgsWaqrEoKbWC0V4h9gXeMo3u5s88mn0rNtqzzQoXAOMJsK9+2?= =?us-ascii?Q?+G/y3f5rd2BMnUacPUUNOfyrrSvhEc1nXKGVh8vXZ6SlgtoM8DRsD6vnlLMt?= =?us-ascii?Q?za9HAJl1m7EgS3DWB23BoAvGNMW0ezaVsY3UEyTeVo2Gkte20PpfuWUs1mv7?= =?us-ascii?Q?uzLr2u/kl7ljQmV2QJbyBHhCdTBoOeXG3uRnEAfSCQ6GBZ0paQiLQrM08zLq?= =?us-ascii?Q?2Z6MjQWn5EWodn5S+J1bgDO8CmL8EDMcAWclcr9F+sfeqWC2DCDl8plEyjph?= =?us-ascii?Q?6VF0dplc8JQgTdsodPYGUsR4ceU5qdVXhKwMZN0k9Bu3xOIRaeLdDslsLw/p?= =?us-ascii?Q?dMKKClqr2rBcUnmYkTYYCme33AX900lRzTev1brpslyfPA3325bQ45ZOSLtA?= =?us-ascii?Q?n+6Kn/94jAMwjhShQ789dLn1psJFutJuU7zcZcWNTdLwQvrFmZrhkfqgc1tW?= =?us-ascii?Q?bIgEAVvCXydaU4i0GPjpxXUuk9yFkRcRO0dlPq6N+CbAdmM/uCG+KeAiODbg?= =?us-ascii?Q?mWvtJGI33bl+npCn4uBA+t9EK4+XzinTkty251oZUVRAYBa6Gj3yr12Wn6tD?= =?us-ascii?Q?4t5uXHFdIUZeo2+pYwUOPHRsKNwmW9LgFnutubhBJHjQs9unXvhZJK5dL2st?= =?us-ascii?Q?cr/PsCtgxUxPfmpvrCBL8fyNMjv96m3nwSAJVtXo8akTGcrLO89b7QaUn3M2?= =?us-ascii?Q?hC0lvDepjZM+BDTjADNgS+J7kTo8OpMi2IO1wcrYZzCoAa44grIQyrwO6Y5u?= =?us-ascii?Q?PbN5Yn9PgAZws+oBg/zaudtp9KaiPykLfmDeA5yjz1XvoeOYNiTFY1YG0cPo?= =?us-ascii?Q?RAHndr4=3D?= X-Microsoft-Exchange-Diagnostics: 1;SN2PR0701MB765;5:/dbZwCAzthdwgVhdJQ5WIMPeG7v0XgHzLSH6EmLcxlcmpHTfgqhiG20rkRcbjkmnZ096mkYQ0vKDnlkZkQ18iMXD2ZtP38B6mT52+Iy1hW5XueEDC2l6xzb3ogliVJRrrL3Mh5Z/d/QZRfnggW7EoQ==;24:6zljqHw/AK1mHhPvdcJ3oUKlPQpOM57xAGLhUgBUr3uSdWuQtlPa8N2jU6DqpujV6hNvNoNntFKAfBIccFYxG6yOJMwpxe4wSLA/DaFtelw= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2016 10:24:46.8926 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR0701MB765 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2877 Lines: 71 On Wed, Mar 23, 2016 at 09:32:15PM +0100, Wolfram Sang wrote: > On Fri, Mar 18, 2016 at 09:46:30AM +0100, Jan Glauber wrote: > > From: David Daney > > > > Use High Level Controller when possible. > > Can you give me a one line description what this Controller is? I'd > assume it can do simple write-then-read messages with less setup? Of course, I'll add this to the patch description too. 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. > > i2c-octeon was reacting badly to bus contention: when in > > direct-access mode (for transfers > 8 bytes, which cannot use the > > high-level controller) some !ACK or arbitration-loss states were > > not causing the current transfer to be aborted, and the bus released. > > So, what does this patch do? Enable HLC for transfers < 8 byte? And for > all other transfers we still suffer from the same problem? I think the patch description was misleading, which is my fault because I merged several incremental patches into one. The HLC is used when possible (up to 8 bytes). For bigger transfers the handling is improved and special treatment is done for the first and last part of a transfer. > Such information should be here, too. It helps reviewing when I already > have the big picture. > > > There's one place in i2c protocol that !ACK is an acceptable > > response: in the final byte of a read cycle. In this case the > > destination is not saying that the transfer failed, just that it > > doesn't want more data. > > Ehrm, no? For reads, the MASTER is saying it doesn't need any more data. > And an I2C eeprom can legally NACK a write, e.g. when it is still > processing the previous write. Also, NACK is a valid response after the > address phase, meaning there is no device listening. > > Does the implementation cover the above cases? > > > This enables correct behavior of ACK on final byte of non-final read > > msgs too. > > The patch is huge and very hard to review. Maybe it needs to be split > up. Brainstorming example: a) move functions like octeon_i2c_set_clock() > upwards, b) change them if needed, c) implement HLC functions, d) add > switching logic to use HLC or non-HLC functions... I was reluctant to split the patch because of the high risk of breaking the bi-sectability, but your proposal makes sense. I've seperated the error handling changes from the HLC feature now (plus seperate patches for the moved functions). Thanks, Jan > But first we need to be clear on the big picture view. > > Thanks, > > Wolfram >