From patchwork Tue Jul 12 08:24:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12914625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFCDDCCA480 for ; Tue, 12 Jul 2022 08:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=mkCeSt0o2YxHrI+gkRxcFfQmbG5vJI2LCHNSzmE0dLw=; b=1IF87wqpj+0NTl Oa6etGH28QDuYHf+Wr7wgdQpVUY8sTUIA7wRXzraNTCgjvGtMJxno9vyyO7TtjqJlAADjsBzxQheS 3QOvZo3XC76QYr/E1FZfomTbcL0m259drvY0ArXvFy+IKjljUSo6/iHZ59UyYM7YRyMjm2vDRUtUU sm6ZNBrCGcTGzEjNyAd4nzGier/RQswJ6DsrMW9zj9DRgzmcMdXHuLPOuqGiAwjNGWumS2/q4CNWQ fxzogLENaYAYmC/WUgqo0frRUGnBJljpUXI5A2oHr3foK/akXYlsUsLnqN8y90ltmkzy+FSwuHsd9 tbpRGt9IlusIQaIgOVrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBBCr-008h9Q-2j; Tue, 12 Jul 2022 08:25:22 +0000 Received: from de-smtp-delivery-113.mimecast.com ([194.104.111.113]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBBCH-008gge-95 for linux-arm-kernel@lists.infradead.org; Tue, 12 Jul 2022 08:24:47 +0000 Received: from CHE01-GV0-obe.outbound.protection.outlook.com (mail-gv0che01lp2043.outbound.protection.outlook.com [104.47.22.43]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-2-gDOZxx4wNyuizk0boo1RaA-2; Tue, 12 Jul 2022 10:24:37 +0200 X-MC-Unique: gDOZxx4wNyuizk0boo1RaA-2 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) by ZR0P278MB0330.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:36::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.17; Tue, 12 Jul 2022 08:24:36 +0000 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::3d:ca30:8c24:1a95]) by ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::3d:ca30:8c24:1a95%7]) with mapi id 15.20.5417.026; Tue, 12 Jul 2022 08:24:36 +0000 From: Francesco Dolcini To: Oleksij Rempel , Pengutronix Kernel Team , Shawn Guo , Sascha Hauer , Fabio Estevam , NXP Linux Team CC: Oleksandr Suvorov , linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Francesco Dolcini Subject: [PATCH v1] i2c: imx: Retry transfer on transient failure Date: Tue, 12 Jul 2022 10:24:15 +0200 Message-ID: <20220712082415.319738-1-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: MR1P264CA0056.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3e::20) To ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05267eb9-f123-4bdb-3d55-08da63dff4a5 X-MS-TrafficTypeDiagnostic: ZR0P278MB0330:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: aphjOBfc1rByGyJ+ni1zQvRI5HDq+uYXjCCXIaSfYGC+78r5a4HoajEabKi1pVZdFKt/bqj/ZplVJQb6a/4AjORYN6fLF+dGEdwL8ec/iMPE6cEQaV9Hn8rbji/bAS/EjbUs2lqGgrFY3K526P0wKUWUQ6vt4Xhmo3l+LMMSsBytk08hElsW5ii6bD1q1zpk62VfDHCjCaE+XAyuG/A6tBWG49IGfxA+9hMoTCDCrXTkY+cRkoCW/PKKe6byjOhn89U2o+ZDVEGftGUU7oLnJTlkjmy5GmvNWISyuwnrS8pwNdmEcnMvWBERYDxOqH1LdCDLZ2iHiwWkWbM/z4YwzqLBO16nwherU6/izq0A2mSjk0IdDWMAJ5loPJK4OgLOi/Y8nDl6CM53D349nKPZbKeW5X7pbK0M1KUlog8TW7OmHwXrmz9FqmkeivB8t2TFJ3uCn27jKrLoGGaiIS5vS76vydTrdu4cS4yCpczhQiy/O1lvy0G+yXxRzylLtlGaumYG/uZX7M6wGJs5SN/9Do7gNHGhoQdiWWZ4I6E01l1pkguErGVp6L1lGOXYadU9pIB86SZGu1K00BWS+7E7bjMA9DrNV/2QwtmhO+UbSQPx9Msuke1rEWuQMd8pw003GM35mnB0YVYSnrVDY5HeoV1jhazf6r8f/zeXTeI0mKXetfSHYQYcbtufh0eKQ/yccjk10SCS0KjEVafcNV52NWappueLYHrsasVgYuzcvjK9bMbdeR4/eQRNxGQfE+fsvMQ4Gi5GRfU3Fl9nAOxWxxlcAgaUzN/IYVUS0kZZ56HltkXE0Uf7ZZ050lHes6SO X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(4636009)(136003)(366004)(39840400004)(376002)(346002)(396003)(8936002)(5660300002)(107886003)(6506007)(41300700001)(44832011)(83380400001)(2906002)(2616005)(36756003)(478600001)(110136005)(54906003)(6486002)(6512007)(66946007)(4326008)(66556008)(8676002)(1076003)(38350700002)(52116002)(186003)(26005)(86362001)(66476007)(316002)(6666004)(38100700002);DIR:OUT;SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oDegMirg9zMJtbIYhbED23gpS9rocF8Vg50saxKxN1JzdCrE6388MTNjPQiXs0otNKrfOMsq6Y8rv9m4TioJnJNUJhQ282fIMVJW0e22W/AhV+9yve1SxzxoxW7jB9ohxaZcQw1n5qx++tRGAWDvxN8Nt1qAgdR5H9q0SgsBMKiJ0Dx65p4o1yTSIH5uD/+l2zLReT3KblwpPEAhBKZYbUn7uNyrWj0DRgB4q6iN+WwHi48yZ39w4ReJLPdJyfx7fNRL1w80ay8X62nFcNkUH0JzwLvWAU/LiLR/rb6jgrZtesp3dY0rvcz6CSk8NvlGkr+d61Z3aOX1LuDBkXT0SJzGen5jmG7+Q4EyoIdoMf2UhhUQ1iKO7bSvpt/uDT6typtU60v822GTJqhiipWvFCP2N0x0DBL3B2auaRAMynU6GniniEiC6lX5ch1/idPOR+hQDtlgDRr7fktZ6DSSphDa4DqaVUUxh4pFZwTj3+nnRzYJCjCUl1sI8UnMCn8lQ0YavEkovhAA+qh469Z97mlcVMmD+yUMrujqBJRQNeKXUsVNBShQUXB3nBGL9O1MHgJfPhnBareRpUJpA2zogUESxLVfCa8buA1QBaV9rROgsBJhL6c9AUiR3ONm5Mg0cbENvnyi95oHigVvlzMiz+l505ULeYfhE9PPXc1+sRlzsW4B/Es+8mx4nNKrYVujaT0/8pJxVhRxfc0/B4Jc7emiP7DLqaKcnhDrePdqXa54fXTaG+dAr8lhXLb8jHou22dkafvDEgMFfN0+qF/vrp3m2To8nELkF32VNMUz9gT2t0b08Lo3KtTarUwZ5v/xHeveo8ks1aHmWOBEa9IP/3cNHwPAfa7ijUtgrEH2bIKHWlhBorCR0dmgYdZH8ID9nkFCWnmZRuWay6LKuhspVmYnIP0tdV7EI3/YP/yEY26BTqD9U3/Fi4IfIaYdmk1MPW5NuSEQouXUufQp4+Eb70igpehaU77Nw1TYw5zX0ImmpOyUn0LLvM8G8xvVB0JCAGEclMYybrKlRjGtCBKOXwjBK3/s/LiSM79hNOvFnMc+vxEZ8B+PpeukpwWJCAQ/VOMrgmZLYJiOVjXl0rN6kxn8rt3Ad+qq7/b51Vb5GTyEQgZhZ/jKsXr23/eihbGFmq62jsuYUtSWI74Bq54BzAV9PtuX7FKpV+du4MO8JRcyY243PqFJoD5j8RTb07TA4ZnIR9I9qT2mhyx709VOJhbMgMZwFUjCPO+IFT6Pe3hz8eOFJy3u5NnZpQ/fdv2tg0LE4memglqLqd5BBFFSRpMF9YsakzXHySejJBmKWismeIn5KgNdIK2WNW/ugD9jLkKDRTFzEMwkNry+X4kEfrJ3fljlzbl3fg2BYFmuo7Nv8NlqgY5xPT/XJPIkvcWvXcWW+Bl/w6alw4Y9OdJfTAynUkRh6roLog6Z6GRyZnMpaYQMPdaKLSEjJ36YATTsmyLCIHPvEFRGP1LoXXnxW4cHSsHc3E2hItI/C8YkJZrYVGzxOn2duTz/Thu7vdB8vpCgjBLXu/S54wZ2z9fY7KkzCug3pD+RaX251vEIOEmQsSGaAvHb0BndCVjQzNMsDrlMo3Pf/V0mGalC8Ii9hA== X-OriginatorOrg: toradex.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05267eb9-f123-4bdb-3d55-08da63dff4a5 X-MS-Exchange-CrossTenant-AuthSource: ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2022 08:24:36.0454 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FUc5lER+PmpgbEXyuVHdOqpP3atu9M3VUwINy9qQN1NXY0EjshyVxumpyy+6iQJpf9ZA0olZratNYT7X5IgM/9JDQCNWfpbxiUDDWjSjGrI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR0P278MB0330 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CDE13A77 smtp.mailfrom=francesco.dolcini@toradex.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: toradex.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220712_012445_657847_B08D4699 X-CRM114-Status: UNSURE ( 9.66 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Oleksandr Suvorov Set the i2c_adapter retries field to a sensible value. This allows the i2c core to retry master_xfer()/master_xfer_atomic() when it returns -EAGAIN. Currently the i2c-imx driver returns -EAGAIN only on Tx arbitration failure (I2SR_IAL). Signed-off-by: Oleksandr Suvorov Signed-off-by: Francesco Dolcini --- drivers/i2c/busses/i2c-imx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index e9e2db68b9fb..26738e713c94 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -54,6 +54,7 @@ #define DRIVER_NAME "imx-i2c" #define I2C_IMX_CHECK_DELAY 30000 /* Time to check for bus idle, in NS */ +#define I2C_IMX_MAX_RETRIES 3 /* Retries on arbitration loss */ /* * Enable DMA if transfer byte size is bigger than this threshold. @@ -1477,6 +1478,7 @@ static int i2c_imx_probe(struct platform_device *pdev) i2c_imx->adapter.dev.parent = &pdev->dev; i2c_imx->adapter.nr = pdev->id; i2c_imx->adapter.dev.of_node = pdev->dev.of_node; + i2c_imx->adapter.retries = I2C_IMX_MAX_RETRIES; i2c_imx->base = base; ACPI_COMPANION_SET(&i2c_imx->adapter.dev, ACPI_COMPANION(&pdev->dev));