Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2659573pxj; Mon, 14 Jun 2021 04:15:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqEIWmpwkik+8a2xQN0pziMq73VGuwcohzAcf/bRQPV+bKyQnO8+cm8ag+GbTL4e3X6e/f X-Received: by 2002:a05:6402:14d8:: with SMTP id f24mr16588860edx.79.1623669351899; Mon, 14 Jun 2021 04:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623669351; cv=none; d=google.com; s=arc-20160816; b=Tu0zw5Rp/mXWXNL1XiZdncRnCwglcBeQ7vrzEecMyYhqXmsvK7Ea6CPvqMqwzdGKOV uRNexglEMK+5SmVlj1wN4yzCjiVs76+BpVe4Snt3OENqobD/bC2g7Z98ffiNtKWbVkb/ GBbCezEhrj/JCA1m0WHKNPZSRaLRyXuTIH9Ade/F/DBlxRElTBTQ71LI34H808Odjdag mg7bdUBoOba2xbVIQFInD1VXBkb6eRYx9aH0Ib91HwbtZqNm6qEKnbSLw/Dt5jt7NV1p ufWGP3u+3ebZ+TtiMsUO6WNGH29wx/oh3x2z82o4I0P1XxMPZ+C1/c+o+H495gmU6PT4 J3aw== 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=8xKrK4w8Z1E4U2s5Jfkc0piYFbA2LO6HoJJ0TO0xpIU=; b=lNItvIFLdOQrFto/HHIDwmiNR79OZtVHY6S7YnVrInvUSYhy1N91jwk6/XRhYAUZW2 ZIgmbJ1QQtuqIaEtqgrVQp1EMuBiCAUhf58DwDYepyU/2rghL0IREtTT/kUyUb1jKVCH ggmH7SFNYg3+mw5KuYmQnLKLwVcp4lIg+cojhtHXhnHVLfSHlx1z1xHupN9c9SiQOe47 0If8VhRHjDlF8xBe9ix7Zvz+N2K1ayketPTiHTxk5R4abnwgUI1qtU8cCGtulpCbKNqw QR9F7aWJtrJJG0FBCSHzbzIZdzwwvpr2FYclszeVqTf84ymNX6B+Tz/dzru5MfpLy4qM n6hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="2Zr6V/3S"; 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 i16si11683158ejo.417.2021.06.14.04.15.28; Mon, 14 Jun 2021 04:15:51 -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="2Zr6V/3S"; 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 S235584AbhFNLO3 (ORCPT + 99 others); Mon, 14 Jun 2021 07:14:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:36658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234652AbhFNLCk (ORCPT ); Mon, 14 Jun 2021 07:02:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 89AB261879; Mon, 14 Jun 2021 10:43:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1623667436; bh=tudlBHqZenoctlRrfSERZSkHBViNR5fCAbzX/OHuqOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Zr6V/3SG1tkzTMvN9BsaMk26lr9sbYQ/C8kr3pC3PscOKmWc3939NfJje6VFiUob 0oI32pARwyQzCb7GeplVMSpMnB+ygYERDQtJAINwpCQI5VzfhnYrxsRR0oLPOT6uFk TWefsUEnK7bRxKTLEmiPqO6v4KbIYNFjxCT2G7r0= 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 5.10 043/131] i2c: mpc: Make use of i2c_recover_bus() Date: Mon, 14 Jun 2021 12:26:44 +0200 Message-Id: <20210614102654.477438986@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614102652.964395392@linuxfoundation.org> References: <20210614102652.964395392@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 d94f05c8b8b7..6a0d55e9e8e3 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -586,7 +586,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; } @@ -622,7 +622,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; } @@ -637,6 +637,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, @@ -648,6 +657,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) { @@ -740,6 +753,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