Received: by 10.223.164.202 with SMTP id h10csp2047608wrb; Fri, 24 Nov 2017 05:11:32 -0800 (PST) X-Google-Smtp-Source: AGs4zMZVY0yoSpsbe9lMizUYG/shCBUNz/ORjFXYoMc62AugS0kOGJTPmQ3FhSGkazfwfwz1WSSd X-Received: by 10.98.104.194 with SMTP id d185mr5136459pfc.155.1511529092740; Fri, 24 Nov 2017 05:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511529092; cv=none; d=google.com; s=arc-20160816; b=VqW1aPr52sLTwX5RzxSFcyd7OQTBMxiREprn/s+YlT/7S+0djW0K+89Iy78k68xfms y7T04x7qKrK3nz6V3N2H0Cfqq+5OctcNtIm4nSj5Ao8OUT2VHEMzrWbshCGqO9Y/iRVX mc+O65WcgyiwBsLSIccYjHPtfZ3D19JBLj/9I99vc85YB8xLhqGG80nC064TFOwlLwRi x6FmWhVIpTmU+4miK+nO/2TwwhAL4zzFd4Owlhcs9jfhYc9erj47FLgkZEVSlgfEQx1+ bYwdq8FR+vRBqBWc1qWDEOs0JQ4Pu5vvnEWuuiGUTDlhKAztDJioAQIzhOTHRBKdRaIJ G5hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=lZ4QvyRbsv7SKMe2vufzFJJIC0cjUk1euvYQZLNXHA8=; b=N0XGsdrLoi6tDfGUBBrzny8GhZ4t9M0Up3Wwrf8EiMCQDOEBDlXwPNPjC7Rfex8EPH hf97O5jYhvMxN5TfyD2Qi0Rn5UNQxj0vAbX0de7XtFPzSSyx4Gu94u2eNHWG0XHEasOy w0cZcZbryEakXhwG2keXdsqFydAeAxJ4X3XbcIcJUsa2Qf8yqeLJtnFT0mKG75BTQzHa ITFWFxUiLFiPky6FTjtVyBYmyyZ40vyaq48BtXzjlueTsD60ykSVvbzpZyXwRa2t6G9o tRnIpRXiNFYGj9hcXgEJZV38YTxK2KwmacbokE61e+EIrsVFIEoHF1O1sYKYkMZURT1Q wjvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=hlPn5NXz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 71si5912294plf.612.2017.11.24.05.11.21; Fri, 24 Nov 2017 05:11:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=hlPn5NXz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752681AbdKXNKl (ORCPT + 76 others); Fri, 24 Nov 2017 08:10:41 -0500 Received: from mail-sn1nam02on0088.outbound.protection.outlook.com ([104.47.36.88]:29216 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750825AbdKXNKj (ORCPT ); Fri, 24 Nov 2017 08:10:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lZ4QvyRbsv7SKMe2vufzFJJIC0cjUk1euvYQZLNXHA8=; b=hlPn5NXzdA7Rt9msumLF3nuzE44VQTOOuxpS74HCURUJBU4TAHVVh/EK1RdzRSzAYgUsef7WmeS/uGcdg62vQSAtEoP5wmLtXCf1sm27vcY1eOAh39cM4yA3TSZYLB1nkHLSEsDBMT83pcJJlKVaZYFm4AL1TK1f8mq/959jgAA= Received: from hc (64.2.3.196) by CY1PR07MB2586.namprd07.prod.outlook.com (10.167.16.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Fri, 24 Nov 2017 13:10:34 +0000 Date: Fri, 24 Nov 2017 14:10:26 +0100 From: Jan Glauber To: "Zhang, Sean C. (NSB - CN/Hangzhou)" Cc: "david.daney@cavium.com" , "wsa@the-dreams.de" , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [Bug fix] octeon-i2c driver updates Message-ID: <20171124131026.GA30811@hc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [64.2.3.196] X-ClientProxiedBy: YQXPR0101CA0071.CANPRD01.PROD.OUTLOOK.COM (52.132.74.48) To CY1PR07MB2586.namprd07.prod.outlook.com (10.167.16.136) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603258);SRVR:CY1PR07MB2586; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2586;3:lEkAW+HuiuVzxODmrpUoLYz0PH+cKyk+DAmG9pmcFj0uBOsrkLGDudJ/B+zijVAzIlcGiqOxHm7ZETMiFfE054+7PEau7M1EK98E+VPrnBHGJv/fj/UiezWx4xnVnkDwJS5LcSK4yKq7Wr07S+STakA3bdJgk6dBaAmEN1dKgn4FBc9KzojvEciUnGFPRjN7cwPfXWSHjqW5xn/EOys5J7hQcSpz7SB7b05vjW8GwXZ4zM1kjin8ZeWB+g6B+Ss9;25:V8BSKu4n09lQEymVfkIXe4hhOWPL9nvaez+LxG3SQfi86PAvepaCr2o5VZtKH18b100GfpAtVcymbvufFpc5V7sMBO0np39FBxpX71X4Sm13aP93LAMaHwqlQ7L+ctScNqp6D/6/uEs9jF86pLKrRalUDL5vnkZV4OM72Sa1S6Fqw43im88E2+HdHy9XKf93Gn6ixPWquNdkfuY3UnmNRjcBz6YfiU5+mNadLCA2gZ9ZpftKIT4KqwRBV7L34TMjg6Ef/uoOhdHMxwPpmMDpoNJxQlGVQeV2dwX7nL35IWdmBJpX4dl6E85MYV0m4XsnW7ptNVqBulcgbi80iV4spg==;31:7nN7vnEANwQo0ieEe3FI8XYdBN9A2HhMyWCWgb349MxAWZjrD5Q+Wxb0aGNPSXGPhOGH+Q7FlLejilWEV9lnKm/Wp8AY0GKIvfJ1dJ4Hj0JKxSIqC7HGcajHYjdCxmcsvDaUEGNDRUiye+fUGPo872XFoyVdZe0toYsNL5us76lyL0/dbquZv8WpSrJWdk9fQ8eeMoE9XmE2onYuNeI0phb7ab38biNC5PY+bLMUkKQ= X-MS-TrafficTypeDiagnostic: CY1PR07MB2586: X-MS-Office365-Filtering-Correlation-Id: 384f7dc8-5b84-429d-a487-08d5333cc0dd X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2586;20:OK+K9M3ah8zTS2gz4uQ1fa9b1EKMYegnHJtpR8cYJ4zhGivcZbhvsrYYviIfv5XPgkGStBtg5+nnpYBk292wnlFdCEkFe6VAvDSSp9Nd+AJjKUqmMqg2Tjok4BPTDcNt0GCBUo/ScZOhLn1taMYz8V058fkFQliGtAHFUE91fGq5y/w3WUovlq8Z9THOioaA2prQFEYLs9dyvgW5dePmHAEGcPCHdCt8sPhZ1UQ+xiEhII554NwHBSL/5MOKmtJe0/moC35B0U8D+RN7qwHnmlWY5fAgbiVcMXiv9r0ZZFgZSuqaP/iBuhvxttzpOoox7aRa30DhFe0FfTOA79q7zo6rVdEodByc2Z6vaCvVAK96qjcV/Un8Uf+4Yyoag3t1u1yoxjIvCs6qMC3b3PlMgclueeJxWQ+22bUf4LoAFSaZNScUeqL+EVfo6m7auBa8y63lT86DRstqSQl2XcZyaNirvqg9gg1+hP6Ci7mX1ETMLwtbKmn6agNTj9NC2/MHquC7jmfa4zvYcx/pVKkA5G3GpbarQSkkd5wypFa0jiCThMQijgOGl5zfDWdeTvxVxRpg6Eu69q2ch4VF7YxIQOR75H1+GNhAT2In8BeLTto=;4:0/hd/2qtyr85gpTW9/SA3JrsSgggxZVq+fmK3yvhKmWfB5Ie0ILJJR5RiuHcgBkFv+IPdC+rgcOjMy8q9ALTArmfBU1hpVP8TP8CUNzXnVQt4O5HcBJDAVQ0XyuE1KPzrm3YAdPAspn04EW0vBFI4lofRU1x4rMWekId7mRJgrFIWLnRdtZ8ZrSiGVl5d0wYwx/GXJkyw3bvAGm33RSUj8M63dKonvhR+Ck90b1sFCItVc0Qu49PBlKSdJfOXPqGuZ/TGFbg5QbPoGnYEy+rRJfzebuIBxUf7n+6T/RCVFUFMQle7xFFm4d/cFmutixu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(82608151540597); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(3231022)(3002001)(10201501046)(6041248)(20161123555025)(20161123558100)(20161123564025)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:CY1PR07MB2586;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY1PR07MB2586; X-Forefront-PRVS: 05015EB482 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(376002)(346002)(366004)(189002)(24454002)(199003)(51874003)(106356001)(305945005)(33656002)(413944005)(101416001)(316002)(3846002)(6116002)(23726003)(105586002)(189998001)(81156014)(9686003)(53936002)(4326008)(6246003)(8936002)(7736002)(478600001)(68736007)(72206003)(81166006)(8676002)(1076002)(6496006)(47776003)(66066001)(76176999)(5660300001)(33716001)(55016002)(575784001)(54906003)(97736004)(2906002)(25786009)(83506002)(2950100002)(16526018)(15650500001)(58126008)(53546010)(54356999)(52116002)(229853002)(6666003)(50986999)(5890100001)(6916009)(42882006)(16586007)(50466002)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2586;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2586;23:CbxxaFzIESgn138QRAbdh+UjBDay+YfpEPAJ/dxdN?= =?us-ascii?Q?NNFmhEM3lQc5p0opJ5OOm8HopJ3lDQSnqWgh+CNhWtdQxsQ1kxZio7Yszxwj?= =?us-ascii?Q?6foI01bO/HTxR+etE1faDtV0+p8oLfJEVl+740XR2fo6/lrdHWS/sLQiByu8?= =?us-ascii?Q?+K6mnYP2c35Fz2D6UW48aM/TZcBJITa/dT2wJJiTC8BYILp3X4/0C1P2iAi6?= =?us-ascii?Q?SRAfvU0Y328wbZzFjH5AcQrwfl7f01GVe/DVuCVW5kVHocwSjHZRIvwiLUkg?= =?us-ascii?Q?4BBy/wcjxj8AB9HREtaCr5wVIm0ahx50WOKPTZcEuq5QUgX0K3xT09kjIuY1?= =?us-ascii?Q?oehgYDzLaFr2IePmw6PL/bIoNwffdpkYc40quduA2RfMzECmZWyfYfSJ6fsa?= =?us-ascii?Q?FOaWey0V53e5mHdUtEO36gWtoq+EHCyvpB0y3FEY92Ce/EbvQO+0DjCFWNuk?= =?us-ascii?Q?8uxwXEaj6bd6yxfMqraGVx2aqvj5xFXwXmY/PXBDctPgGGqary2EC90Z72t2?= =?us-ascii?Q?OEr5eZw1+RoPJoB5Jz1mjpLV0hMfA9UOVPUkV69+xr+OJG3EbwF/skNbXgsl?= =?us-ascii?Q?tfiJg/7L6N6GN3wgjna7i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H7t92DqIjMMd7iQkF2olgOUtFINQr8tM6ftqXAZ153BJbVJcM+dK8B3Wbycw3MbVirhJ2FIrsALvo1cT4DTnppPCO/eGcXAU3fPXTAbicDvCkXTZQIfpSYDCewWazWvgW+NrHCQHGMCRVIyiFCrxq5onr1DWgV8zdRAgV8rlPmjxlauExfnfyyidCU6Sc5R9RgjDudZRluyZUDkjymNBTgrqFB6z5EK5TaJ9uptn+FOMaQD/+Z0fOCl2NIQNwPoUxzaB+Sgmm9PLDmVrGkAECWoetuyyj/3o2EFYWDx6ShKWEqxg+4fXfhKJKmiE=;5:ZOIg1K/vQUgY52WRBv0TL/Nr8bD6hfpOCKdst/IQ+OEzdKiakrm53MFwPZNl4kxk+e7643vcZo9Ci8LkniRYfDcLkUQ9+nGyioV7iMAwMdTJISAI6yH6AAqFE2v2+iiMotDYnD5UUCzU58Tmn8c3pPtv0xInVqSxGvHFymPpnF8=;24:oSTOwIUgX0nFv1ULJBdkHZV3HKwXdqayrOdHI1QrFhGHuNZ5z0FhzkpeSv4C+pg1pq6EonOh30Ru0oW0mF5ezewZj7BBIJadICHdOZDVZjE=;7:qRsLclB2jYLgRv4swE12MuWMH/dP6by+B5DLiEatpBlX/gHbP1OBdmtcvPLgFL1lAfnki5b1MX2DqIxd3c9A05KHLaLHxHpUpbgqX9OpTzBXxUoq5mGMFiiMeG0nTJFhfZRJ0nnxDHYj2PwUHLVjh8JaQsJ+M5iIztI62WobDm2OPxa+M8rGYEjl9/Yf92c9uWVE+FAjocan3Ls+nVurqGt8gJv8pmVm5oaEPj+IFx2DW6iuwr1+K0cW1abAGqWo SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2017 13:10:34.3656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 384f7dc8-5b84-429d-a487-08d5333cc0dd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2586 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 23, 2017 at 11:42:36AM +0000, Zhang, Sean C. (NSB - CN/Hangzhou) wrote: > Dear Maintainer, > > For octeon TWSI controller, I found below two cases, maybe can be improved. Hi Sean, form the description below this looks like you're fixing a bug. Can you elaborate on when the I2C bus dead lock occurs. Is it always happening? What I don't like about the patch is that you're removing octeon_i2c_init_lowlevel() from the probe and replacing it by _always_ going through a full recovery. Why is this neccessary? Regards, Jan > > >From 09d9f0ce658d7f6a50d1af352dde619c29bc8bcf Mon Sep 17 00:00:00 2001 > From: hgt463 > Date: Thu, 23 Nov 2017 18:46:09 +0800 > Subject: [PATCH] Driver updates: > - In the case of I2C bus dead lock occurred during driver probing, > it is better try to recovery it. so added bus recovery step in > octeon_i2c_probe(); > - The purpose of function octeon_i2c_start() is to send START, so after > bus recovery, also need try to send START again. > > Signed-off-by: hgt463 > --- > drivers/i2c/busses/i2c-octeon-core.c | 31 ++++++++++++++++++++++++++++++- > drivers/i2c/busses/i2c-octeon-platdrv.c | 15 +++++++++------ > 2 files changed, 39 insertions(+), 7 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-octeon-core.c b/drivers/i2c/busses/i2c-octeon-core.c > index 1d87757..3ae1e03 100644 > --- a/drivers/i2c/busses/i2c-octeon-core.c > +++ b/drivers/i2c/busses/i2c-octeon-core.c > @@ -255,6 +255,35 @@ static int octeon_i2c_recovery(struct octeon_i2c *i2c) > return ret; > } > > +/* > + * octeon_i2c_start_retry - send START to the bus after bus recovery. > + * @i2c: The struct octeon_i2c > + * > + * Returns 0 on success, otherwise a negative errno. > + */ > +static int octeon_i2c_start_retry(struct octeon_i2c *i2c) > +{ > + int ret; > + u8 stat; > + > + ret = octeon_i2c_recovery(i2c); > + if (ret) > + goto error; > + > + octeon_i2c_ctl_write(i2c, TWSI_CTL_ENAB | TWSI_CTL_STA); > + ret = octeon_i2c_wait(i2c); > + if (ret) > + goto error; > + > + stat = octeon_i2c_stat_read(i2c); > + if (stat == STAT_START || stat == STAT_REP_START) > + /* START successful, bail out */ > + return 0; > + > +error: > + return (ret) ? ret : -EAGAIN; > +} > + > /** > * octeon_i2c_start - send START to the bus > * @i2c: The struct octeon_i2c > @@ -280,7 +309,7 @@ static int octeon_i2c_start(struct octeon_i2c *i2c) > > error: > /* START failed, try to recover */ > - ret = octeon_i2c_recovery(i2c); > + ret = octeon_i2c_start_retry(i2c); > return (ret) ? ret : -EAGAIN; > } > > diff --git a/drivers/i2c/busses/i2c-octeon-platdrv.c b/drivers/i2c/busses/i2c-octeon-platdrv.c > index 64bda83..98063af 100644 > --- a/drivers/i2c/busses/i2c-octeon-platdrv.c > +++ b/drivers/i2c/busses/i2c-octeon-platdrv.c > @@ -228,12 +228,6 @@ static int octeon_i2c_probe(struct platform_device *pdev) > if (OCTEON_IS_MODEL(OCTEON_CN38XX)) > i2c->broken_irq_check = true; > > - result = octeon_i2c_init_lowlevel(i2c); > - if (result) { > - dev_err(i2c->dev, "init low level failed\n"); > - goto out; > - } > - > octeon_i2c_set_clock(i2c); > > i2c->adap = octeon_i2c_ops; > @@ -245,6 +239,15 @@ static int octeon_i2c_probe(struct platform_device *pdev) > i2c_set_adapdata(&i2c->adap, i2c); > platform_set_drvdata(pdev, i2c); > > + stat = octeon_i2c_stat_read(i2c); > + if (stat != STAT_IDLE) { > + result = octeon_i2c_recovery(i2c); > + if (result) { > + dev_err(i2c->dev, "octeon i2c recovery failed\n"); > + goto out; > + } > + } > + > result = i2c_add_adapter(&i2c->adap); > if (result < 0) > goto out; > > > Attached patch for you review. Thanks in advance. > > BR, > Sean Zhang From 1584856996251214870@xxx Thu Nov 23 11:43:32 +0000 2017 X-GM-THRID: 1584856996251214870 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread