Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2633226pxj; Mon, 14 Jun 2021 03:35:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwljUAB5u4BN8TbMuXV2QangsXYCOzLjbeudkvrfAShgD2Ongsg5gfUeXr2DLD3Td1wW8fg X-Received: by 2002:aa7:c594:: with SMTP id g20mr15771046edq.193.1623666925349; Mon, 14 Jun 2021 03:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623666925; cv=none; d=google.com; s=arc-20160816; b=dVrDb51xICRQLPbSuAOZei4hWjA/xgdjwKT2wB2xCitVOy9a2tWsXgraDW9vSNooeG hGo/Oei0V7IvIvQC+XBFNYwoHI2N8nym39Rr5iLN/vQ4HTnhvI9JcbjWgHQ/NMPd8ap/ Ojmj8eIuQgeDwkCoG9uE1md3lL1gDsgx8++wGha8WIEi2jpSN1v/7TgY+aSjPxm61Epn LLxDOVRI90wwX0BHkD8wMELcNAHzXm/AmuVAjSVON2Othgh3+Ox6Ern1mvinc7lnngk+ 0paXK/44/QuJaV/wL8Ah/P6C5eXIGC30GwIhex1r+4WD+wKAd52y85m7aCI58EDDe1pX F0ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hmw7J+pWIClP/EnHDgi7XZ2Bw3a4Cxy2I3lhI1QJhrs=; b=P+K6v2wyo77MrqKKkhN56AasbDJt4k82QO4fw+v7tnJqy80eo1T63g+RB+fjczNod6 68I9l/6TMxHiF5m35N8HMPqIbGyK+W15yn4CCau2HE0ZPag9vKrpQok8DArgwk8j9Yul VfJWmEAcF7Rb9JRlxLeerppIfINE3WC2n0uMhKTDiwtThxxf+TbPNqB1247LDl+5scuV 2DUrb2l6hSzLYBPOxapT2XejnQk4mFqK/PCodOIOHNotga6SP5r6cxd4CzzwX/DFDETC Hu5Cm3HiHwRtaIo+1KUgYNWl5utJexREVh8w5CKKOwLL9wlcBAlRoaXQBCUIEClHmZz0 jOWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aeor/dWW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si11272800ejv.206.2021.06.14.03.35.02; Mon, 14 Jun 2021 03:35:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="aeor/dWW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233255AbhFNKdW (ORCPT + 99 others); Mon, 14 Jun 2021 06:33:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:38594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232767AbhFNKcC (ORCPT ); Mon, 14 Jun 2021 06:32:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A64B761004; Mon, 14 Jun 2021 10:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623666599; bh=87a2MqCndiLjymkkJx6RR9s/AWFCk35sTiTTK2jp5Hg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aeor/dWWzuBXxHsL/C/BGuKcxiFqvKM5Zcmdm7eh8uuJ8ZDp3oXV2Hdn+ciSsV4Cz 7UfRLXKyHGr8RllDmAyWVgzfzLmoRwwZwYZiK5AdNIp7ASjusTOaQBqfA/qQP+CcD8 XRbblVIgKXec+DOvge975JPh4Sm6e1pDJIt/EWxE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Packham , Wolfram Sang , Sasha Levin Subject: [PATCH 4.4 17/34] i2c: mpc: Make use of i2c_recover_bus() Date: Mon, 14 Jun 2021 12:27:08 +0200 Message-Id: <20210614102642.146372200@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102641.582612289@linuxfoundation.org> References: <20210614102641.582612289@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Packham [ Upstream commit 65171b2df15eb7545431d75c2729b5062da89b43 ] Move the existing calls of mpc_i2c_fixup() to a recovery function registered via bus_recovery_info. This makes it more obvious that recovery is supported and allows for a future where recovery is triggered by the i2c core. Signed-off-by: Chris Packham Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-mpc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 48ecffecc0ed..f2e8b9a159a7 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -581,7 +581,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { writeb(status & ~CSR_MAL, i2c->base + MPC_I2C_SR); - mpc_i2c_fixup(i2c); + i2c_recover_bus(&i2c->adap); } return -EIO; } @@ -617,7 +617,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) if ((status & (CSR_MCF | CSR_MBB | CSR_RXAK)) != 0) { writeb(status & ~CSR_MAL, i2c->base + MPC_I2C_SR); - mpc_i2c_fixup(i2c); + i2c_recover_bus(&i2c->adap); } return -EIO; } @@ -632,6 +632,15 @@ static u32 mpc_functionality(struct i2c_adapter *adap) | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL; } +static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) +{ + struct mpc_i2c *i2c = i2c_get_adapdata(adap); + + mpc_i2c_fixup(i2c); + + return 0; +} + static const struct i2c_algorithm mpc_algo = { .master_xfer = mpc_xfer, .functionality = mpc_functionality, @@ -643,6 +652,10 @@ static struct i2c_adapter mpc_ops = { .timeout = HZ, }; +static struct i2c_bus_recovery_info fsl_i2c_recovery_info = { + .recover_bus = fsl_i2c_bus_recovery, +}; + static const struct of_device_id mpc_i2c_of_match[]; static int fsl_i2c_probe(struct platform_device *op) { @@ -735,6 +748,7 @@ static int fsl_i2c_probe(struct platform_device *op) i2c_set_adapdata(&i2c->adap, i2c); i2c->adap.dev.parent = &op->dev; i2c->adap.dev.of_node = of_node_get(op->dev.of_node); + i2c->adap.bus_recovery_info = &fsl_i2c_recovery_info; result = i2c_add_adapter(&i2c->adap); if (result < 0) { -- 2.30.2