From patchwork Mon Mar 12 13:14:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Abhishek Sahu X-Patchwork-Id: 884506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="OoN8zk0D"; dkim=pass (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="OoN8zk0D"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 400JTj2rz5z9sMQ for ; Tue, 13 Mar 2018 00:18:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751229AbeCLNPP (ORCPT ); Mon, 12 Mar 2018 09:15:15 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41392 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751180AbeCLNPO (ORCPT ); Mon, 12 Mar 2018 09:15:14 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id DB1AC6070A; Mon, 12 Mar 2018 13:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520860513; bh=YxDr1/ecdXc61+xM9MNRJIhD1Y5VeNA7q9iS6A+Z6r0=; h=From:To:Cc:Subject:Date:From; b=OoN8zk0DnkdGB+GtkabQm23AlUW1jFM4XutUj0HmAb69VJThcdj4kuDc/k6cERywp 0dZzPgRmL6eq9MN2YKOmO/jeB4PRtqBCUj1PVRnj5a+/OSu2VeSlRdMLV951pw9ra3 tkwW2Z7/fpD+GznzjwbjbS5imrJNFotbrcE0idf4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from absahu-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: absahu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8F68A603AF; Mon, 12 Mar 2018 13:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520860513; bh=YxDr1/ecdXc61+xM9MNRJIhD1Y5VeNA7q9iS6A+Z6r0=; h=From:To:Cc:Subject:Date:From; b=OoN8zk0DnkdGB+GtkabQm23AlUW1jFM4XutUj0HmAb69VJThcdj4kuDc/k6cERywp 0dZzPgRmL6eq9MN2YKOmO/jeB4PRtqBCUj1PVRnj5a+/OSu2VeSlRdMLV951pw9ra3 tkwW2Z7/fpD+GznzjwbjbS5imrJNFotbrcE0idf4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8F68A603AF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=absahu@codeaurora.org From: Abhishek Sahu To: Andy Gross , Wolfram Sang Cc: David Brown , Sricharan R , Austin Christ , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Abhishek Sahu Subject: [PATCH v2 00/13] Major code reorganization to make all i2c transfers working Date: Mon, 12 Mar 2018 18:44:49 +0530 Message-Id: <1520860502-14886-1-git-send-email-absahu@codeaurora.org> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org * v2: 1. Address review comments in v1 2. Changed the license to SPDX 3. Changed commit messages for some of the patch having more detail 4. Removed event-based completion and changed transfer completion detection logic in interrupt handler 5. Removed dma_threshold and blk_mode_threshold from global structure 6. Improved determine mode logic for QUP v2 transfers 7. Fixed function comments 8. Fixed auto build test WARNING ‘idx' may be used uninitialized in this function 9. Renamed tx/rx_buf to tx/rx_cnt * v1: The current driver is failing in following test case 1. Handling of failure cases is not working in long run for BAM mode. It generates error message “bam-dma-engine 7884000.dma: Cannot free busy channel” sometimes. 2. Following I2C transfers are failing a. Single transfer with multiple read messages b. Single transfer with multiple read/write message with maximum allowed length per message (65K) in BAM mode c. Single transfer with write greater than 32 bytes in QUP v1 and write greater than 64 bytes in QUP v2 for non-DMA mode. 3. No handling is present for Block/FIFO interrupts. Any non-error interrupts are being treated as the transfer completion and then polling is being done for available/free bytes in FIFO. To fix all these issues, major code changes are required. This patch series fixes all the above issues and makes the driver interrupt based instead of polling based. After these changes, all the mentioned test cases are working properly. The code changes have been tested for QUP v1 (IPQ8064) and QUP v2 (IPQ8074) with sample application written over i2c-dev. Abhishek Sahu (13): i2c: qup: fix copyrights and update to SPDX identifier i2c: qup: fixed releasing dma without flush operation completion i2c: qup: minor code reorganization for use_dma i2c: qup: remove redundant variables for BAM SG count i2c: qup: schedule EOT and FLUSH tags at the end of transfer i2c: qup: fix the transfer length for BAM RX EOT FLUSH tags i2c: qup: proper error handling for i2c error in BAM mode i2c: qup: use the complete transfer length to choose DMA mode i2c: qup: change completion timeout according to transfer length i2c: qup: fix buffer overflow for multiple msg of maximum xfer len i2c: qup: send NACK for last read sub transfers i2c: qup: reorganization of driver code to remove polling for qup v1 i2c: qup: reorganization of driver code to remove polling for qup v2 drivers/i2c/busses/i2c-qup.c | 1507 ++++++++++++++++++++++++------------------ 1 file changed, 880 insertions(+), 627 deletions(-) Reviewed-by: Austin Christ Acked-by: Austin Christ