Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751465AbdFFVJM (ORCPT ); Tue, 6 Jun 2017 17:09:12 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:40546 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751247AbdFFVJK (ORCPT ); Tue, 6 Jun 2017 17:09:10 -0400 From: Christopher Bostic To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, rostedt@goodmis.org, mingo@redhat.com, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Christopher Bostic , joel@jms.id.au, linux-kernel@vger.kernel.org, andrew@aj.id.au, alistair@popple.id.au, benh@kernel.crashing.org Subject: [PATCH v8 00/24] FSI device driver implementation Date: Tue, 6 Jun 2017 16:08:35 -0500 X-Mailer: git-send-email 2.10.1 (Apple Git-78) X-TM-AS-GCONF: 00 x-cbid: 17060621-0044-0000-0000-00000347669E X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007185; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00871106; UDB=6.00433227; IPR=6.00651099; BA=6.00005403; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015723; XFM=3.00000015; UTC=2017-06-06 21:09:07 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060621-0045-0000-0000-0000077567F4 Message-Id: <20170606210859.80431-1-cbostic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-06_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706060367 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9321 Lines: 206 Implementation of the IBM 'Flexible Support Interface' (FSI) bus device driver. FSI is a high fan out serial bus consisting of a clock and a serial data line capable of running at speeds up to 166 MHz. This set provides the basic framework to add FSI extensions to the Linux bus and device models. Master specific implementations are defined to utilize the core FSI function. In Linux, we have a core FSI "bus type", along with drivers for FSI masters and engines. The FSI master drivers expose a read/write interface to the bus address space. The master drivers are under drivers/fsi/fsi-master-*.c. The core handles probing and discovery of slaves and slave engines, using those read/write interfaces. It is responsible for creating the endpoint Linux devices corresponding to the discovered engines on each slave. Slave engines are identified by an 'engine' type, and an optional version. Engine, a.k.a. client, drivers are matched and bound to these engines during discovery. This patch set does not include extended FSI function such as: * Cascaded master support * Application layer hot plug notification * Application layer FSI bus status interface Common FSI terminology: * Master Controller of the FSI bus. Only the master is allowed to control the clock line and is the initiator of all transactions on a bus. * Slave The receiver or target of a master initiated transaction. The slave cannot initiate communications on a bus and must respond to any master requests for data. * CFAM Stands for Common Field replaceable unit Access Macro. A CFAM is an ASIC residing in any device requiring FSI communications. CFAMs consist of an array of hardware 'engines' used for various purposes. I2C masters, UARTs, General Purpose IO hardware are common types of these engines. * Configuration Space / Table A table contained at the beginning of each CFAM address space. This table lists information such as the CFAM's ID, which engine types and versions it has available, as well as its addressing range. * FSI Engine driver A device driver that registers with the FSI core so that it can access devices it owns on an FSI bus. * Hub An FSI master that connects to an upstream 'primary' master allowing high fanout of target devices. ---- Changes in v8: - Export symbols fsi_slave_read, fsi_slave_write, fsi_slave_claim_range, fsi_release_range so that hub and gpio modules can use - Type cast to (int) to clean up build warnings in include/trace/events/fsi.h - Add MODULE_LICENSE() to fsi-core.c Changes in v7: - Use GENMASK for bitmask definitions - Move instances of dev_info to dev_dbg - Add missing return code checks - Add API details for fsi_device_read/write/peek() - GPIO master: Unscan when unregistering master - Document ABI sysfs files raw, term, break, rescan - GPIO master: move global spinlock into struct fsi_master_gpio - GPIO master: remove redundant checks for valid pin descriptors Changes in v6: - Remove redundant 'depends on' specifiers in Kconfig for SCOM GPIO master and Hub masters. Changes in v5: - Remove explicit kfree of struct fsi_master in fsi_master_gpio. - Remove Palmetto and Romulus dts device tree file udates for FSI gpio master Changes in v4: - endianness: the _read() and _write() APIs are now all *bus endian*, so will be the same on all platforms (the previous fsi patches exposed as (BMC/FSP) CPU endian, which is variable). - device tree: Remove the "ibm," prefix for the fsi core and GPIO master compatibility strings, as they're not describing IBM-specific - device model: Create separate struct devices for each FSI master, which fits better with the Linux device model, and allows addition of sysfs attributes that are implemented by the fsi core - sysfs: there are now sysfs facilities for break and term. Raw file supports reads and writes of arbitrary sizes. - GPIO master: split the xfer() logic out a little, so that the response handling & DPOLL retry mechanism is more obvious - GPIO master: simplifications for message construction - GPIO master: fixes for some CRC calculations - GPIO master: issue TERM in response to DPOLL busy-loops - Error handling: rather than handle errors on (potentially) an entire cascaded read or write, the error handling is now down on a per-slave basis, where we try to reestablish communication in a more "gradual" manner, rather than sending a break immediately. May need to add a hook to percolate error recovery up to a slave's master but no need seen for that at present. - Hub master: this is now implemented as a fsi engine driver, as the fsi_slave_{read,write}() functions are exported (and the port count is available in the hMFSI configuration register) This means we need fewer special-cases in the fsi core. - Tracepoints: Add tracepoints for FSI core read & write, and another set for low-level GPIO in/out operations. Changes in v3: - Patch set contained an invalid 18/18 test patch not meant for community review, corrected. Changes in v2: - Change from atomic global for master number to ida simple interface. - Add valid pointer checks on register and unregister utils. - Move CRC calculation utilities out of driver to lib path. - Clean up white space issues. - Remove added list management of master devices and use instead the device_for_each_child method available in the bus. - Add new patch to document FSI bus functionality. - Add new patch documenting FSI gpio master. - Rearrage patch set to have documentation earlier than code implementing it. - Document all compatible strings used in device tree bindings. - Elaborate documentation definition of FSI GPIO master. - Describe in more detail what each GPIO FSI master pin is for. - Re-order compatible strings in example binding so that most specific device comes first. - Indicate proper activation order of all FSI GPIO master pins. - Fix an unmatched '>' bracket in the example for binding. - Bracket each element of the example bindings individually. - Add new patch documenting sysfs-bus-fsi attributes. - Merge FSI GPIO master init into probe function. - Set pin initial values at time of pin request. - Assign value of master->master.dev at probe time. - Use get_optional interface for all optional GPIO pins. Christopher Bostic (10): drivers/fsi: Set up links for slave communication drivers/fsi: Set slave SMODE to init communication drivers/fsi: Add master unscan drivers/fsi: Add documentation for GPIO bindings drivers/fsi: Add client driver register utilities drivers/fsi: Document FSI master sysfs files in ABI drivers/fsi: Add GPIO based FSI master drivers/fsi: Add SCOM FSI client device driver drivers/fsi: Add hub master support drivers/fsi: Add module license to core driver Jeremy Kerr (14): drivers/fsi: Add fsi master definition drivers/fsi: Add slave definition drivers/fsi: Add empty master scan lib: Add crc4 module drivers/fsi: Add slave & master read/write APIs drivers/fsi: Implement slave initialisation drivers/fsi: scan slaves & register devices drivers/fsi: Add device read/write/peek API drivers/fsi: Add sysfs files for FSI master & slave accesses drivers/fsi: expose direct-access slave API drivers/fsi: Add tracepoints for low-level operations drivers/fsi: Add error handling for slave drivers/fsi/gpio: Add tracepoints for GPIO master drivers/fsi: Use asynchronous slave mode Documentation/ABI/testing/sysfs-bus-fsi | 38 + .../devicetree/bindings/fsi/fsi-master-gpio.txt | 24 + drivers/fsi/Kconfig | 26 + drivers/fsi/Makefile | 3 + drivers/fsi/fsi-core.c | 841 +++++++++++++++++++++ drivers/fsi/fsi-master-gpio.c | 604 +++++++++++++++ drivers/fsi/fsi-master-hub.c | 327 ++++++++ drivers/fsi/fsi-master.h | 43 ++ drivers/fsi/fsi-scom.c | 263 +++++++ include/linux/crc4.h | 8 + include/linux/fsi.h | 35 +- include/trace/events/fsi.h | 127 ++++ include/trace/events/fsi_master_gpio.h | 68 ++ lib/Kconfig | 8 + lib/Makefile | 1 + lib/crc4.c | 46 ++ 16 files changed, 2461 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-bus-fsi create mode 100644 Documentation/devicetree/bindings/fsi/fsi-master-gpio.txt create mode 100644 drivers/fsi/fsi-master-gpio.c create mode 100644 drivers/fsi/fsi-master-hub.c create mode 100644 drivers/fsi/fsi-master.h create mode 100644 drivers/fsi/fsi-scom.c create mode 100644 include/linux/crc4.h create mode 100644 include/trace/events/fsi.h create mode 100644 include/trace/events/fsi_master_gpio.h create mode 100644 lib/crc4.c -- 1.8.2.2