From patchwork Wed Jun 13 14:37:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jonas Mark (BT-FIR/ENG1-Grb)" X-Patchwork-Id: 928907 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=de.bosch.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=de.bosch.com header.i=@de.bosch.com header.b="AzdU/DOX"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 415Ttf1gq1z9s19 for ; Thu, 14 Jun 2018 00:40:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935762AbeFMOiN (ORCPT ); Wed, 13 Jun 2018 10:38:13 -0400 Received: from de-out1.bosch-org.com ([139.15.230.186]:33682 "EHLO de-out1.bosch-org.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935691AbeFMOiL (ORCPT ); Wed, 13 Jun 2018 10:38:11 -0400 Received: from fe0vm1650.rbesz01.com (unknown [139.15.230.188]) by si0vms0217.rbdmz01.com (Postfix) with ESMTPS id 415TrK3Qczz4f3lwt; Wed, 13 Jun 2018 16:38:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1528900689; bh=yzKooamTiNN6TaJo1x9nGgi9v7llwNHi4SKug+vKDNw=; l=10; h=From:From:Reply-To:Sender; b=AzdU/DOX2qZK5CwN32V19IThhJmsm8jDVjYyTai9JkrjPR1Hu42pHwgfcMgdDZiox bRn0ySUnT+NeGsYry3Cbi+f2ruZnQHZ1KFG2n2C/lsEwzZR/Qyi5tACLxfrUV1E5SO abpQrLVFgIRK5r7MH02AWnBfBuc62T7d5rCUXPJA= Received: from fe0vm7918.rbesz01.com (unknown [10.58.172.176]) by fe0vm1650.rbesz01.com (Postfix) with ESMTPS id 415TrK2qWwz1Cf; Wed, 13 Jun 2018 16:38:09 +0200 (CEST) X-AuditID: 0a3aad10-427ff70000000ee7-b8-5b212c5e95c1 Received: from fe0vm1652.rbesz01.com ( [10.58.173.29]) (using TLS with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by fe0vm7918.rbesz01.com (SMG Outbound) with SMTP id 7B.6E.03815.E5C212B5; Wed, 13 Jun 2018 16:38:22 +0200 (CEST) Received: from SI-HUB1000.de.bosch.com (si-hub1000.de.bosch.com [10.4.103.106]) by fe0vm1652.rbesz01.com (Postfix) with ESMTPS id 415TrK1NXPzBpBZ; Wed, 13 Jun 2018 16:38:09 +0200 (CEST) Received: from luchador.grb-fir.grb.de.bosch.com (10.19.187.97) by SI-HUB1000.de.bosch.com (10.4.103.106) with Microsoft SMTP Server id 14.3.319.2; Wed, 13 Jun 2018 16:38:08 +0200 From: Mark Jonas To: Wolfgang Grandegger , Marc Kleine-Budde CC: , , , , , , , , , , Mark Jonas Subject: [PATCH v2 0/5] can: enable multi-queue for SocketCAN devices Date: Wed, 13 Jun 2018 16:37:16 +0200 Message-ID: <1528900641-18677-1-git-send-email-mark.jonas@de.bosch.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528224240-30786-1-git-send-email-mark.jonas@de.bosch.com> References: <1528224240-30786-1-git-send-email-mark.jonas@de.bosch.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA22Sb0wbZRzHeXpHe21629OjwI8i27hsiWEyQCGcf4Lbi8UmJlNfLAM65w57 0EZa8K7gmMZ0lZExiAMmUQph6DaNJJsOO+1AVin/jekS0IRtwiayrMM/ERixZipeW1j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OkpKF z8siRIn/D/+NY+dZBAAA Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Changes in v2: - use GPIO descriptor API - make error handling pattern consistent - use more kernel helper macros and functions - fix coding style issues - remove superfluous subsystem name from filename --- Upon request by Marc Kleine-Budde this patch series does not only contain our patch to enable enable multi-queue for SocketCAN devices but also a driver (Companion driver suite) which makes active use of this feature. The driver suite implements - two CAN interfaces - one generic command interfaces and offers a SocketCAN as well as a char device interface. The SocketCAN interface supports multi-queue. The functionality bases on an external peripheral chip named Companion. It offers two CAN interfaces, each has 8 prioritized transmit FIFOs as well as one receive FIFO. Besides CAN, undisclosed additional functions can be accessed through the char device. A standard SPI interface with two additional lines for flow control is used. The Companion chip is the SPI slave. The driver suite consists of three separate drivers. The following diagram illustrates the dependencies in layers. /dev/companion SocketCAN User Space ------------------------------------------------------------------- +----------------+ +---------------+ | companion-char | | companion-can | +----------------+ +---------------+ +----------------------------------+ | companion-spi | +----------------------------------+ +----------------------------------+ | standard SPI subsystem | +----------------------------------+ Linux Kernel ------------------------------------------------------------------- | | | | | | Hardware CS-+ | | | | +-BUSY CLK--+ | | +---REQUEST MOSI---+ | MISO-----+ companion-spi core.c: handles SPI, sysfs entry and interface to upper layer protocol-manager.c: handles protocol with the SPI HW queue-manager.c: handles buffering and packets scheduling companion-can makes use of multi-queue support and allows to use tc to configure the queuing discipline (e.g. mqprio). Together with the SO_PRIORITY socket option this allows to specify the FIFO a CAN frame shall be sent to. companion-char handles messages to other undisclosed functionality beyond CAN. Zhu Yi (5): can: enable multi-queue for SocketCAN devices spi: implement companion-spi driver char: implement companion-char driver can: implement companion-can driver spi,can,char: add companion DT binding documentation .../devicetree/bindings/spi/bosch,companion.txt | 82 ++ drivers/char/Kconfig | 7 + drivers/char/Makefile | 3 + drivers/char/companion.c | 360 ++++++ drivers/net/can/Kconfig | 8 + drivers/net/can/Makefile | 2 + drivers/net/can/companion.c | 693 ++++++++++++ drivers/net/can/dev.c | 8 +- drivers/spi/Kconfig | 2 + drivers/spi/Makefile | 2 + drivers/spi/companion/Kconfig | 5 + drivers/spi/companion/Makefile | 2 + drivers/spi/companion/core.c | 1185 ++++++++++++++++++++ drivers/spi/companion/protocol-manager.c | 1032 +++++++++++++++++ drivers/spi/companion/protocol-manager.h | 341 ++++++ drivers/spi/companion/protocol.h | 273 +++++ drivers/spi/companion/queue-manager.c | 144 +++ drivers/spi/companion/queue-manager.h | 245 ++++ include/linux/can/dev.h | 7 +- include/linux/companion.h | 259 +++++ 20 files changed, 4656 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/bosch,companion.txt create mode 100644 drivers/char/companion.c create mode 100644 drivers/net/can/companion.c create mode 100644 drivers/spi/companion/Kconfig create mode 100644 drivers/spi/companion/Makefile create mode 100644 drivers/spi/companion/core.c create mode 100644 drivers/spi/companion/protocol-manager.c create mode 100644 drivers/spi/companion/protocol-manager.h create mode 100644 drivers/spi/companion/protocol.h create mode 100644 drivers/spi/companion/queue-manager.c create mode 100644 drivers/spi/companion/queue-manager.h create mode 100644 include/linux/companion.h