From patchwork Mon Jun 4 19:00:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eddie James X-Patchwork-Id: 925201 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=linux.vnet.ibm.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41048126fFz9rvt for ; Tue, 5 Jun 2018 05:02:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751042AbeFDTBA (ORCPT ); Mon, 4 Jun 2018 15:01:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59328 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751091AbeFDTA7 (ORCPT ); Mon, 4 Jun 2018 15:00:59 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w54Iwl6k065189 for ; Mon, 4 Jun 2018 15:00:59 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jd9c7ck6a-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Jun 2018 15:00:58 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 4 Jun 2018 15:00:57 -0400 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 4 Jun 2018 15:00:54 -0400 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w54J0ri915139314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Jun 2018 19:00:53 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B658B124052; Mon, 4 Jun 2018 16:02:21 -0400 (EDT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CBCBB124060; Mon, 4 Jun 2018 16:02:20 -0400 (EDT) Received: from talon7.ibm.com (unknown [9.41.241.240]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 4 Jun 2018 16:02:20 -0400 (EDT) From: Eddie James To: linux-i2c@vger.kernel.org Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, wsa@the-dreams.de, robh+dt@kernel.org, benh@kernel.crashing.org, joel@jms.id.au, mark.rutland@arm.com, gregkh@linuxfoundation.org, rdunlap@infradead.org, andy.shevchenko@gmail.com, Eddie James Subject: [PATCH v9 0/7] i2c: Add FSI-attached I2C master algorithm Date: Mon, 4 Jun 2018 14:00:43 -0500 X-Mailer: git-send-email 1.8.3.1 X-TM-AS-GCONF: 00 x-cbid: 18060419-0060-0000-0000-00000278165A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009129; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000265; SDB=6.01042302; UDB=6.00533707; IPR=6.00821432; MB=3.00021461; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-04 19:00:57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060419-0061-0000-0000-000045567075 Message-Id: <1528138850-18259-1-git-send-email-eajames@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-04_13:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=560 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806040219 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This series adds an algorithm for an I2C master physically located on an FSI slave device. The I2C master has multiple ports, each of which may be connected to an I2C slave. Access to the I2C master registers is achieved over FSI bus. Due to the multi-port nature of the I2C master, the driver instantiates a new I2C adapter for each port connected to a slave. The connected ports should be defined in the device tree under the I2C master device. Changes since v8 - Drop unecessary else statements - Use i++ instead of ++i - Use kzalloc/kfree instead of devm_kzalloc/devm_kfree for port structure - Drop the list_empty check in remove Changes since v7 - Fix grammer in Kconfig (a -> an) - Change I2C registers to use BIT and GENMASK - Remove custom macros and use FIELD_PREP and FIELD_GET - Fix a few unecessary initializations and "return rc" that are always zero - Clean up the read/write fifo functions a bit - Few other clean-up items Changes since v6 - Remove spinlock for reset functionality; it's unecessary and doesn't work with the latest FSI core. - Use a mutex instead of a semaphore, and don't wait for timeout to get the lock. - Use usleeps instead of schedule_timeout; it's not worth the overhead when the wait should be very short in between sending the command and receiving the response. Changes since v5 - Fix reset functionality and do a reset after every transfer failure Eddie James (7): dt-bindings: i2c: Add FSI-attached I2C master dt binding documentation i2c: Add FSI-attached I2C master algorithm i2c: fsi: Add port structures i2c: fsi: Add abort and hardware reset procedures i2c: fsi: Add transfer implementation i2c: fsi: Add I2C master locking i2c: fsi: Add bus recovery Documentation/devicetree/bindings/i2c/i2c-fsi.txt | 40 ++ drivers/i2c/busses/Kconfig | 11 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-fsi.c | 721 ++++++++++++++++++++++ 4 files changed, 773 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-fsi.txt create mode 100644 drivers/i2c/busses/i2c-fsi.c Reviewed-by: Andy Shevchenko