From patchwork Wed Nov 15 14:10:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118956 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4365157qgn; Wed, 15 Nov 2017 06:13:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMb2Am9C8vfPGOEM2fJcmSLnOQhsay1VaJn0D6SFBwOnfWCNYcW0EvfE/TXiT6ZFjywuIBiT X-Received: by 10.101.75.78 with SMTP id k14mr15604828pgt.272.1510755222558; Wed, 15 Nov 2017 06:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755222; cv=none; d=google.com; s=arc-20160816; b=qeEcGcjDkcYY7VO8NL3ZL/lzMqOIYMy1OcQTI+WO7gt4xE2vVLb1qwDlrfYHMer6RP 1qFB0rBJxfMjOHM1FF+q5vuYmBkpD3t/ibcecSrlA9OotF9EJgaGcjhFPT/ViMFLifdm zTSY3Nml5sBmHpQg/VeIeVkfhNfvUjGTYmya7phvNhQUIhVIAquRo5hmPqazSwIXPidY PalECvgi4gTO4ZfNDDpr9liTzxGoZJik+lmsz4i1q3MrtFpfSCuQvKHwFNcyAupEL5Rn LYD66rbb4o6Sodf+fdSYd9io2hXU5ekiiu1XLv74YGFSPTQqmzdW1dhvs6+2ZKlAv7IC Z2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=VfukUrF+wqtkxD2tZARF3u3TwoQvFoxXOK5pVzXc9hs=; b=my5vWElG7EhIM7e3biEFG8ZvCT2Xtb93QcqOWXtYfeD1ZvWwEsGx+3aLvNd3rsNmoH jRxH0c6At3fvoqq95NcSO4yavRmQgyWMEgIC54lYECHCes3hq0M5Ku7W/Vs08QZMWqZF dsldpsV3xDR1L03Gq/EGKD9DHtaOa47ThJzaq6HBiIp54DMpNG31qFhKFr7lfHWqQItT SdB1AMSSAHRFGgwZ+sxCMnDDm9c2mwkO+RrhzsQZo+JfqHNtFXfJd5lFWKR8Nv46v2C+ LNTmfKUTaat/HNIVLk9Ogq4paighrqicLDXDcXHUQDUH5GGnCm1X+Ynz7O2T4N2v/2NW vCyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OU/1uCzr; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si18864254pln.619.2017.11.15.06.13.42; Wed, 15 Nov 2017 06:13:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OU/1uCzr; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757977AbdKOONe (ORCPT + 6 others); Wed, 15 Nov 2017 09:13:34 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:50804 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757323AbdKOON0 (ORCPT ); Wed, 15 Nov 2017 09:13:26 -0500 Received: by mail-wr0-f196.google.com with SMTP id p96so20547624wrb.7 for ; Wed, 15 Nov 2017 06:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DrbxEZolSAwkMENSUF4Gz/rU/iFd3p/OJFr+Pff2UgE=; b=OU/1uCzrIDdq1HCAyM8lsyNZzLPUs29RkffO2MZqO3y3oB4R6mKIMZbJpPbuMs9zuR 2ukr0ADr7fbho4F4w97GQSx1awvMYF3DeJ+NkuTyUs28COL9sVjTibcpyp8cVyMQOlnf 1XvlcS6/EbTiDi6eNMBEGQ0awADZQWhZOrcOg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DrbxEZolSAwkMENSUF4Gz/rU/iFd3p/OJFr+Pff2UgE=; b=PLiWTqy2xvxMPea0gi9d6tdT60pM94/5+Fcu1tsac2K8JoInrRo2mmDDXlkyHNGj3l R2jtq81806qPUcVVLLRGCBwQwE+PwdID5Nk91ixTq5NQPMqIsTPpsAlrA0/xrmTISENE YRqLXp2thU1MxFXc+xq0Lsq1GA4ciqFecy8oKet37LG18/jGS0327PVSN08dLIxugk1L DixSVRNnNEkdnaDYpNpxvimuXj3KdAlZ/ofBqoFGsODv1uJ+9jtqzk7x5AgsygTMtf9W p2LCeZGpc7ICc2V2uXGEy84Kohu/69r3ZAux9GRI7vlLCwZKXipurefhGIlSKRU4xZkl DDnw== X-Gm-Message-State: AJaThX6j28wWSZtmyIuO2YjL0ArTQGsXrB0iSWt5dhE0TShcOldEkXw8 DyzechifD6IAfWrQuOrNV2nyKQ== X-Received: by 10.223.164.135 with SMTP id g7mr13342979wrb.211.1510755205200; Wed, 15 Nov 2017 06:13:25 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:24 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 01/13] Documentation: Add SLIMbus summary Date: Wed, 15 Nov 2017 14:10:31 +0000 Message-Id: <20171115141043.29202-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Sagar Dharia SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by MIPI (Mobile Industry Processor Interface) alliance. SLIMbus is a 2-wire implementation, which is used to communicate with peripheral components like audio-codec. The summary of SLIMbus and API is documented in the 'summary' file. Signed-off-by: Sagar Dharia Signed-off-by: Srinivas Kandagatla --- Documentation/driver-api/slimbus/index.rst | 15 ++++ Documentation/driver-api/slimbus/summary.rst | 108 +++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 Documentation/driver-api/slimbus/index.rst create mode 100644 Documentation/driver-api/slimbus/summary.rst -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/driver-api/slimbus/index.rst b/Documentation/driver-api/slimbus/index.rst new file mode 100644 index 000000000000..586f979659e6 --- /dev/null +++ b/Documentation/driver-api/slimbus/index.rst @@ -0,0 +1,15 @@ +===================== +SLIMbus Documentation +===================== + +.. toctree:: + :maxdepth: 1 + + summary + +.. only:: subproject + + Indices + ======= + + * :ref:`genindex` diff --git a/Documentation/driver-api/slimbus/summary.rst b/Documentation/driver-api/slimbus/summary.rst new file mode 100644 index 000000000000..d379d1e6be06 --- /dev/null +++ b/Documentation/driver-api/slimbus/summary.rst @@ -0,0 +1,108 @@ +============================ +Linux kernel SLIMbus support +============================ + +Overview +======== + +What is SLIMbus? +---------------- +SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by +MIPI (Mobile Industry Processor Interface) alliance. The bus uses master/slave +configuration, and is a 2-wire multi-drop implementation (clock, and data). + +Currently, SLIMbus is used to interface between application processors of SoCs +(System-on-Chip) and peripheral components (typically codec).SLIMbus uses +Time-Division-Multiplexing to accommodate multiple data channels, and +a control channel. + +The control channel is used for various control functions such as bus +management, configuration and status updates.These messages can be unicast (e.g. +reading/writing device specific values), or multicast (e.g. data channel +reconfiguration sequence is a broadcast message announced to all devices) + +A data channel is used for data-transfer between 2 Slimbus devices. Data +channel uses dedicated ports on the device. + +Hardware description: +--------------------- +Slimbus specification has different types of device classifications based on +their capabilities. +A manager device is responsible for enumeration, configuration, and dynamic +channel allocation. Every bus has 1 active manager. + +A generic device is a device providing application functionality (e.g. codec). + +Framer device is responsible for clocking the bus, and transmitting frame-sync +and framing information on the bus. + +Each SLIMbus component has an interface device for monitoring physical layer. + +Typically each SoC contains SLIMbus component having 1 manager, 1 framer device, +1 generic device (for data channel support), and 1 interface device. +External peripheral SLIMbus component usually has 1 generic device (for +functionality/data channel support), and an associated interface device. +The generic device's registers are mapped as 'value elements' so that they can +be written/read using Slimbus control channel exchanging control/status type of +information. +In case there are multiple framer devices on the same bus, manager device is +responsible to select the active-framer for clocking the bus. + +Per specification, Slimbus uses "clock gears" to do power management based on +current frequency and bandwidth requirements. There are 10 clock gears and each +gear changes the Slimbus frequency to be twice its previous gear. + +Each device has a 6-byte enumeration-address and the manager assigns every +device with a 1-byte logical address after the devices report presence on the +bus. + +Software description: +--------------------- +There are 2 types of SLIMbus drivers: + +slim_controller represents a 'controller' for SLIMbus. This driver should +implement duties needed by the SoC (manager device, associated +interface device for monitoring the layers and reporting errors, default +framer device). + +slim_device represents the 'generic device/component' for SLIMbus, and a +slim_driver should implement driver for that slim_device. + +Device notifications to the driver: +----------------------------------- +Since SLIMbus devices have mechanisms for reporting their presence, the +framework allows drivers to bind when corresponding devices report their +presence on the bus. +However, it is possible that the driver needs to be probed +first so that it can enable corresponding SLIMbus device (e.g. power it up and/or +take it out of reset). To support that behavior, the framework allows drivers +to probe first as well (e.g. using standard DeviceTree compatbility field). +This creates the necessity for the driver to know when the device is functional +(i.e. reported present). device_up callback is used for that reason when the +device reports present and is assigned a logical address by the controller. + +Similarly, SLIMbus devices 'report absent' when they go down. A 'device_down' +callback notifies the driver when the device reports absent and its logical +address assignment is invalidated by the controller. + +Another notification "boot_device" is used to notify the slim_driver when +controller resets the bus. This notification allows the driver to take necessary +steps to boot the device so that it's functional after the bus has been reset. + +Clock-pause: +------------ +SLIMbus mandates that a reconfiguration sequence (known as clock-pause) be +broadcast to all active devices on the bus before the bus can enter low-power +mode. Controller uses this sequence when it decides to enter low-power mode so +that corresponding clocks and/or power-rails can be turned off to save power. +Clock-pause is exited by waking up framer device (if controller driver initiates +exiting low power mode), or by toggling the data line (if a slave device wants +to initiate it). + +Messaging APIs: +--------------- +The framework supports APIs to exchange control-information with a SLIMbus +device. APIs can be synchronous or asynchronous. +From controller's perspective, multiple buffers can be queued to/from +hardware for sending/receiving data using slim_ctrl_buf circular buffer. +The header file has more documentation about messaging APIs. From patchwork Wed Nov 15 14:10:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118961 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4366005qgn; Wed, 15 Nov 2017 06:14:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMZok2Ft35i+2oqz7A1U1UWpHzkJXjWymhM6h+2SWZPIHeaKGZ5dX2Ql0VPSCBydW8TbLoz/ X-Received: by 10.98.160.193 with SMTP id p62mr18046680pfl.138.1510755264746; Wed, 15 Nov 2017 06:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755264; cv=none; d=google.com; s=arc-20160816; b=h/FmV+Ycs1P9N+cAhuk+7BKE5rGVH92PvgTgTJ0qFKKdM5Ea5n7vNmijR8Go8wsZPd l+Td+cmUCzKSRvNIXY56WvDHSYjd1aqoOy+DzHRBCPXc4aQzv0KyZluUX2tWMzR8aycs zD8KIzi7oQ9csO4LIBwjInmX5PrXds231ag8dBxulCOcdiGBGTi5Unt2VenFa0mlTBJf hXL2t0refc4+Vlhws3Y8bJz6WifUZfPu6J8+JWEGlhclzu4NSg4n4Uqy8sQXieZ6CWuC jNZQ2QEg01Kw4CjZsu9yoO5BKPZ+P+x+BKq+egw3o4nnkFDJi+NF22nl+ykpRleUsWlL EVrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2dbnsLANb4hAtY7rrd1RYMFMdixJ3dqMequwqpG2OCo=; b=LGRXgEEzWFNqUyRrs1lJv3WbG90ApCXM1t0Dq2oefkXhuJOvpUJd6u3gGAYl7XMckD y6yYBpevGmtfnIvjB5AGmp/Rpj6I5VRWTMYEwh3y5J57GNyT3S6ef7KpI3LIPn9071qo Zpvn9VgNFAf1Cjy3bd6G04uQUrsEm1bT1Vuzku1gEHXc3tHU+utuVLXUfxQlZGJgVxab SQwpDWks7zxNVU4QIzsXCVKrFc7wpdNjaDO7IOn1Qb49XeBo8vz5UveyN+sjf1RbtgOn pRHBAwfEdgaDA4mv9VhEFA0ambsBbzwq8qlV8ZB33rMicy5DAni0NzhUsye/WNvOjc8q CHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kmhQVTdJ; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 135si1601027pgh.503.2017.11.15.06.14.24; Wed, 15 Nov 2017 06:14:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kmhQVTdJ; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757597AbdKOOOV (ORCPT + 6 others); Wed, 15 Nov 2017 09:14:21 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:44743 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752972AbdKOON2 (ORCPT ); Wed, 15 Nov 2017 09:13:28 -0500 Received: by mail-wm0-f68.google.com with SMTP id r68so3316657wmr.3 for ; Wed, 15 Nov 2017 06:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=T5HGY/w94Q5XLwNJumw5XuKglthR0K/rzZeUmDG2muo=; b=kmhQVTdJVAdv+rUYNqHm/JyQRfeLLMY9mGRN+BPX1NO3lHbPSeYxOBEgW5HCUeUT0e WX03WeiqCUUSc5M8PH+AfYUZ2cn/zJyb+jRCAPih/0GfuUOfXurjEk/H1iV48n8x2+OD OqzC+qtiWxZBelMng6Ux3Q0xtPGdNVb7AXLSk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=T5HGY/w94Q5XLwNJumw5XuKglthR0K/rzZeUmDG2muo=; b=W80teusbw9bhslGzkpRwKEH13QtvivuKY/HHFS/zqKJba4LixNK3lyEiv4X4RukzJk I3IFhhj1SW8nA4L5XnPgotqMnNq9EVZLXwHL15vbjKnaCq4aqOzocio89d2GkOqhMXV0 BcBuqTLqzJ9cGDpbYIQtJkvZp3oLSt89E6pYt/Bd9FLK7aL9FKpyaCFkCe2dTeocyWZ2 lse5VBOg8kuZ9tBpYrVtIU0W3UZiVVKDcMDIHk7n+NIu0o7VSKWyt50zvlM2WBfP8Ta8 an1v0zJr0gsZOQUEAE8zPaHkbnCVjpdUZ3ZYSfzrh1f6LEGzotr6LG6Q7VnmfTNbSc60 LpRw== X-Gm-Message-State: AJaThX5/LCme71DgDnvqBoyu534caq9wFQM4selwSgnONeKcCh8Dvq63 m90Y4AVDWjUW/i9CtKV5cZsvEg== X-Received: by 10.28.102.6 with SMTP id a6mr11365385wmc.63.1510755206874; Wed, 15 Nov 2017 06:13:26 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:26 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 02/13] dt-bindings: Add SLIMbus bindings Date: Wed, 15 Nov 2017 14:10:32 +0000 Message-Id: <20171115141043.29202-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Sagar Dharia SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by MIPI (Mobile Industry Processor Interface) alliance. SLIMbus is a 2-wire implementation, which is used to communicate with peripheral components like audio-codec. This patch adds device tree bindings for the slimbus. Signed-off-by: Sagar Dharia Signed-off-by: Srinivas Kandagatla --- Documentation/devicetree/bindings/slimbus/bus.txt | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/slimbus/bus.txt -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Rob Herring diff --git a/Documentation/devicetree/bindings/slimbus/bus.txt b/Documentation/devicetree/bindings/slimbus/bus.txt new file mode 100644 index 000000000000..413b5076858e --- /dev/null +++ b/Documentation/devicetree/bindings/slimbus/bus.txt @@ -0,0 +1,50 @@ +SLIM(Serial Low Power Interchip Media Bus) bus + +SLIMbus is a 2-wire bus, and is used to communicate with peripheral +components like audio-codec. + +Required property for SLIMbus controller node: +- compatible - name of SLIMbus controller + +Child nodes: +Every SLIMbus controller node can contain zero or more child nodes +representing slave devices on the bus. Every SLIMbus slave device is +uniquely determined by the enumeration address containing 4 fields: +Manufacturer ID, Product code, Device index, and Instance value for +the device. +If child node is not present and it is instantiated after device +discovery (slave device reporting itself present). + +In some cases it may be necessary to describe non-probeable device +details such as non-standard ways of powering up a device. In +such cases, child nodes for those devices will be present as +slaves of the slimbus-controller, as detailed below. + +Required property for SLIMbus child node if it is present: +- reg - Should be ('Device index', 'Instance ID') from SLIMbus + Enumeration Address. + Device Index Uniquely identifies multiple Devices within + a single Component. + Instance ID Is for the cases where multiple Devices of the + same type or Class are attached to the bus. + +- compatible -"slimMID,PID". The textual representation of Manufacturer ID, + Product Code, shall be in lower case hexadecimal with leading + zeroes suppressed + +SLIMbus example for Qualcomm's slimbus manager component: + + slim@28080000 { + compatible = "qcom,apq8064-slim", "qcom,slim"; + reg = <0x28080000 0x2000>, + interrupts = <0 33 0>; + clocks = <&lcc SLIMBUS_SRC>, <&lcc AUDIO_SLIMBUS_CLK>; + clock-names = "iface", "core"; + #address-cells = <2>; + #size-cell = <0>; + + codec: wcd9310@1,0{ + compatible = "slim217,60"; + reg = <1 0>; + }; + }; From patchwork Wed Nov 15 14:10:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118960 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4365804qgn; Wed, 15 Nov 2017 06:14:14 -0800 (PST) X-Google-Smtp-Source: AGs4zMaEV4N+xa05F5ocXUHAV6TV8e+5qQZM441hPyFB99xvFowX+CG2Bny61/zVAG8o/t/jjElf X-Received: by 10.99.171.77 with SMTP id k13mr15943383pgp.229.1510755254747; Wed, 15 Nov 2017 06:14:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755254; cv=none; d=google.com; s=arc-20160816; b=MdMSMl4Koe0oZtQeC1c12YxoVLCIBzIfvgu8Vw0Bpvx+I5Yp7XVRRSwhQOyhSkLcGv +pbIAl0lP4UYfGBdjaH8p76QQ2jlcq1Yb7GQG3xpfhBNCrbDafg0qdtp6rBRDk5AevNY VCjBQmeUO92TehcAzHpen+fXzJWXFpk2uJii5lj5Kd4ZfPx1dC/gye8RSCsHm/aSAu+o 9Y//RRoYIl3qsBaNgyAcvbhJHxEPa4a3mIA/J+kYCeXeApJXApsRbVnCIYNRKd+JvEWL Kp0ArxX0Xa3IlQd6PixM5pxdQm05A0eVZqZRQcWGkK+996aL95Lf5fI9Jh8f+ITg2zdV hZ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ffrM3XUToj/A8OhovuG/pZLWM6K03PkG2S6aM6mToJM=; b=F9T7tOH0o4HHtb9fa0M8+KlBpRrR4vROHAaQ0s5Owtf3rWl75QSdYdN2e1qiLdbtqR JZ2Isv4VSVeqceTVjjULDprxwJ1uhlUYo9kGKqU3vOSeY5coiHogCLqi81zXengpnXmy wxA2x79LpHTJRb4YBpJtGGMzqFXT8TbfECW0Zad/8xzUE/sWEAydTW76d6crFX929ySd RDBnoQa+C441WKiBxUK4FurIz7ndzrYvNHs3CNwGR8MB5SCHw/sxyDxM9dtnbEMf+4rc BU49nn5T/T0VRgCJ4UOEgU0o1PfXo+yvQZtcA70ksN11usakpkRj3LCr0bDl2acs89IO eADQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e/EGQglO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 135si1601027pgh.503.2017.11.15.06.14.14; Wed, 15 Nov 2017 06:14:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=e/EGQglO; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758267AbdKOOOM (ORCPT + 6 others); Wed, 15 Nov 2017 09:14:12 -0500 Received: from mail-wr0-f169.google.com ([209.85.128.169]:45247 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757776AbdKOONc (ORCPT ); Wed, 15 Nov 2017 09:13:32 -0500 Received: by mail-wr0-f169.google.com with SMTP id w95so1735370wrc.2 for ; Wed, 15 Nov 2017 06:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RkF6mxfTNc4TSAUmj+sLcGTh3oEHKiBI0dclXaGAdcw=; b=e/EGQglOt950YekrK68svUM8AYpxDl56TORCLBYW37iSDVDRk7DcxbGHZZNrk24QGh aDZL1i6IYRPQ5KmHJAWaKfWLWd4vzVeyLnXT5Ir5pkofkn398aBtfqnxkxU1ieAlpexp N2PYSipW0SxYHk4pXvggwgASXM7kE4ryiWgqs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RkF6mxfTNc4TSAUmj+sLcGTh3oEHKiBI0dclXaGAdcw=; b=O8ChUx63j600dv09IVMbY8vyBZn3LwbRtXTolgHuIz+O8UdSjb2wsubzNG60cU7XRr Tqc3CnVGR+lgJ28D1hz+IaoeBQJ+1uNgkPxVW/+A1JxuK9/Vk0l11oK/kn2771/E96hb NuC5C2e/prD0SHRAtWx93tLIC1GOHOTDQlIxDSUtrzXeRvs0R8ISYATvX7mwLGPF6dWZ MQXCrIUdQFAbHPdrzNOvNy8+f/lhlfmiYeDnuZeD9gzp3cEnnTM1ruZ0mIXlg3fe8xmm ho2RutQnNYsT2lntl/LDJbiZCv1a0qQWqBEcwfPcNoEFKO+MPzBi1TljP3ziih2Knsxk WC2A== X-Gm-Message-State: AJaThX6jhZv80zA1TPzzwfqpC5zfoGun7fSIgAhYUURNSm8OeEanCudH o769Q1qfPjN/SjDKmC+g5aPXCA== X-Received: by 10.223.191.13 with SMTP id p13mr14267422wrh.69.1510755210341; Wed, 15 Nov 2017 06:13:30 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:29 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 04/13] slimbus: core: Add slim controllers support Date: Wed, 15 Nov 2017 14:10:34 +0000 Message-Id: <20171115141043.29202-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Sagar Dharia This patch adds support to slim controllers in the slim core, including some utility functions invoked by the controller and slim device drivers. Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/core.c | 312 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/slimbus/slimbus.h | 116 +++++++++++++++++ include/linux/slimbus.h | 7 ++ 3 files changed, 435 insertions(+) create mode 100644 drivers/slimbus/slimbus.h -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index 22edebf1a233..d31a9c4fe7e9 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -14,7 +14,11 @@ #include #include #include +#include #include +#include "slimbus.h" + +static DEFINE_IDA(ctrl_ida); static const struct slim_device_id *slim_match(const struct slim_device_id *id, const struct slim_device *sbdev) @@ -106,6 +110,314 @@ void slim_driver_unregister(struct slim_driver *drv) } EXPORT_SYMBOL_GPL(slim_driver_unregister); +static void slim_dev_release(struct device *dev) +{ + struct slim_device *sbdev = to_slim_device(dev); + + put_device(sbdev->ctrl->dev); + kfree(sbdev); +} + +static int slim_add_device(struct slim_controller *ctrl, + struct slim_device *sbdev, + struct device_node *node) +{ + sbdev->dev.bus = &slimbus_bus; + sbdev->dev.parent = ctrl->dev; + sbdev->dev.release = slim_dev_release; + sbdev->dev.driver = NULL; + sbdev->ctrl = ctrl; + + dev_set_name(&sbdev->dev, "%x:%x:%x:%x", + sbdev->e_addr.manf_id, + sbdev->e_addr.prod_code, + sbdev->e_addr.dev_index, + sbdev->e_addr.instance); + + get_device(ctrl->dev); + + return device_register(&sbdev->dev); +} + +static struct slim_device *slim_alloc_device(struct slim_controller *ctrl, + struct slim_eaddr *eaddr, + struct device_node *node) +{ + struct slim_device *sbdev; + int ret; + + sbdev = kzalloc(sizeof(struct slim_device), GFP_KERNEL); + if (!sbdev) + return NULL; + + sbdev->e_addr = *eaddr; + ret = slim_add_device(ctrl, sbdev, node); + if (ret) { + kfree(sbdev); + return NULL; + } + + return sbdev; +} + +/* + * slim_register_controller() - Controller bring-up and registration. + * + * @ctrl: Controller to be registered. + * + * A controller is registered with the framework using this API. + * If devices on a controller were registered before controller, + * this will make sure that they get probed when controller is up + */ +int slim_register_controller(struct slim_controller *ctrl) +{ + int id; + + id = ida_simple_get(&ctrl_ida, 0, 0, GFP_KERNEL); + if (id < 0) + return id; + + ctrl->id = id; + + if (!ctrl->min_cg) + ctrl->min_cg = SLIM_MIN_CLK_GEAR; + if (!ctrl->max_cg) + ctrl->max_cg = SLIM_MAX_CLK_GEAR; + + ida_init(&ctrl->laddr_ida); + idr_init(&ctrl->tid_idr); + mutex_init(&ctrl->lock); + + dev_dbg(ctrl->dev, "Bus [%s] registered:dev:%p\n", + ctrl->name, ctrl->dev); + + return 0; +} +EXPORT_SYMBOL_GPL(slim_register_controller); + +/* slim_remove_device: Remove the effect of slim_add_device() */ +static void slim_remove_device(struct slim_device *sbdev) +{ + device_unregister(&sbdev->dev); +} + +static int slim_ctrl_remove_device(struct device *dev, void *null) +{ + slim_remove_device(to_slim_device(dev)); + return 0; +} + +/** + * slim_unregister_controller() - Controller tear-down. + * + * @ctrl: Controller to tear-down. + */ +int slim_unregister_controller(struct slim_controller *ctrl) +{ + /* Remove all clients */ + device_for_each_child(ctrl->dev, NULL, slim_ctrl_remove_device); + ida_simple_remove(&ctrl_ida, ctrl->id); + + return 0; +} +EXPORT_SYMBOL_GPL(slim_unregister_controller); + +static void slim_device_update_status(struct slim_device *sbdev, + enum slim_device_status status) +{ + struct slim_driver *sbdrv; + + if (sbdev->status == status) + return; + + sbdev->status = status; + if (!sbdev->dev.driver) + return; + + sbdrv = to_slim_driver(sbdev->dev.driver); + if (sbdrv->device_status) + sbdrv->device_status(sbdev, sbdev->status); +} + +/** + * slim_report_absent() - Controller calls this function when a device + * reports absent, OR when the device cannot be communicated with + * + * @sbdev: Device that cannot be reached, or sent report absent + */ +void slim_report_absent(struct slim_device *sbdev) +{ + struct slim_controller *ctrl = sbdev->ctrl; + + if (!ctrl) + return; + + /* invalidate logical addresses */ + mutex_lock(&ctrl->lock); + sbdev->is_laddr_valid = false; + mutex_unlock(&ctrl->lock); + + ida_simple_remove(&ctrl->laddr_ida, sbdev->laddr); + slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_DOWN); +} +EXPORT_SYMBOL_GPL(slim_report_absent); + +static bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b) +{ + return (a->manf_id == b->manf_id && + a->prod_code == b->prod_code && + a->dev_index == b->dev_index && + a->instance == b->instance); +} + +static int slim_match_dev(struct device *dev, void *data) +{ + struct slim_eaddr *e_addr = data; + struct slim_device *sbdev = to_slim_device(dev); + + return slim_eaddr_equal(&sbdev->e_addr, e_addr); +} + +static struct slim_device *find_slim_device(struct slim_controller *ctrl, + struct slim_eaddr *eaddr) +{ + struct slim_device *sbdev; + struct device *dev; + + dev = device_find_child(ctrl->dev, eaddr, slim_match_dev); + if (dev) { + sbdev = to_slim_device(dev); + return sbdev; + } + + return NULL; +} + +/** + * slim_get_device() - get handle to a device. + * + * @ctrl: Controller on which this device will be added/queried + * @e_addr: Enumeration address of the device to be queried + * + * Return: pointer to a device if it has already reported. Creates a new + * device and returns pointer to it if the device has not yet enumerated. + */ +struct slim_device *slim_get_device(struct slim_controller *ctrl, + struct slim_eaddr *e_addr) +{ + struct slim_device *sbdev; + + sbdev = find_slim_device(ctrl, e_addr); + if (!sbdev) { + sbdev = slim_alloc_device(ctrl, e_addr, NULL); + if (!sbdev) + return ERR_PTR(-ENOMEM); + } + + return sbdev; +} +EXPORT_SYMBOL_GPL(slim_get_device); + +static int slim_device_alloc_laddr(struct slim_device *sbdev, + u8 *laddr, bool report_present) +{ + struct slim_controller *ctrl = sbdev->ctrl; + int ret; + + mutex_lock(&ctrl->lock); + if (ctrl->get_laddr) { + ret = ctrl->get_laddr(ctrl, &sbdev->e_addr, laddr); + if (ret < 0) + goto err; + } else if (report_present) { + ret = ida_simple_get(&ctrl->laddr_ida, + 0, SLIM_LA_MANAGER - 1, GFP_KERNEL); + if (ret < 0) + goto err; + + *laddr = ret; + } else { + ret = -EINVAL; + goto err; + } + + if (ctrl->set_laddr) { + ret = ctrl->set_laddr(ctrl, &sbdev->e_addr, *laddr); + if (ret) { + ret = -EINVAL; + goto err; + } + } + + sbdev->laddr = *laddr; + sbdev->is_laddr_valid = true; + + slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP); + + dev_dbg(ctrl->dev, "setting slimbus l-addr:%x, ea:%x,%x,%x,%x\n", + *laddr, sbdev->e_addr.manf_id, sbdev->e_addr.prod_code, + sbdev->e_addr.dev_index, sbdev->e_addr.instance); + +err: + mutex_unlock(&ctrl->lock); + return ret; + +} + +/** + * slim_device_report_present() - Report enumerated device. + * + * @ctrl: Controller with which device is enumerated. + * @e_addr: Enumeration address of the device. + * @laddr: Return logical address (if valid flag is false) + * + * Called by controller in response to REPORT_PRESENT. Framework will assign + * a logical address to this enumeration address. + * Function returns -EXFULL to indicate that all logical addresses are already + * taken. + */ +int slim_device_report_present(struct slim_controller *ctrl, + struct slim_eaddr *e_addr, u8 *laddr) +{ + struct slim_device *sbdev; + int ret; + + sbdev = slim_get_device(ctrl, e_addr); + if (IS_ERR(sbdev)) + return -ENODEV; + + if (sbdev->is_laddr_valid) { + *laddr = sbdev->laddr; + return 0; + } + + ret = slim_device_alloc_laddr(sbdev, laddr, true); + + return ret; +} +EXPORT_SYMBOL_GPL(slim_device_report_present); + +/** + * slim_get_logical_addr() - Return the logical address of a slimbus device. + * + * @sbdev: client handle requesting the address. + * @laddr: output buffer to store the address + * + * Can sleep, -EINVAL is returned in case of invalid parameters, + * and -ENXIO is returned if the device with this enumeration address + * is not found. + */ +int slim_get_logical_addr(struct slim_device *sbdev, u8 *laddr) +{ + if (sbdev->is_laddr_valid) { + *laddr = sbdev->laddr; + return 0; + } + + return slim_device_alloc_laddr(sbdev, laddr, false); +} +EXPORT_SYMBOL_GPL(slim_get_logical_addr); + static void __exit slimbus_exit(void) { bus_unregister(&slimbus_bus); diff --git a/drivers/slimbus/slimbus.h b/drivers/slimbus/slimbus.h new file mode 100644 index 000000000000..b53319992ad4 --- /dev/null +++ b/drivers/slimbus/slimbus.h @@ -0,0 +1,116 @@ +/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DRIVERS_SLIMBUS_H +#define _DRIVERS_SLIMBUS_H +#include +#include +#include +#include + +/* Standard values per SLIMbus spec needed by controllers and devices */ +#define SLIM_MAX_CLK_GEAR 10 +#define SLIM_MIN_CLK_GEAR 1 + +/* Manager's logical address is set to 0xFF per spec */ +#define SLIM_LA_MANAGER 0xFF + +/** + * struct slim_framer - Represents Slimbus framer. + * Every controller may have multiple framers. There is 1 active framer device + * responsible for clocking the bus. + * Manager is responsible for framer hand-over. + * @dev: Driver model representation of the device. + * @e_addr: Enumeration address of the framer. + * @rootfreq: Root Frequency at which the framer can run. This is maximum + * frequency ('clock gear 10') at which the bus can operate. + * @superfreq: Superframes per root frequency. Every frame is 6144 bits. + */ +struct slim_framer { + struct device dev; + struct slim_eaddr e_addr; + int rootfreq; + int superfreq; +}; + +#define to_slim_framer(d) container_of(d, struct slim_framer, dev) + +/** + * struct slim_controller - Controls every instance of SLIMbus + * (similar to 'master' on SPI) + * @dev: Device interface to this driver + * @id: Board-specific number identifier for this controller/bus + * @name: Name for this controller + * @min_cg: Minimum clock gear supported by this controller (default value: 1) + * @max_cg: Maximum clock gear supported by this controller (default value: 10) + * @clkgear: Current clock gear in which this bus is running + * @laddr_ida: logical address id allocator + * @a_framer: Active framer which is clocking the bus managed by this controller + * @lock: Mutex protecting controller data structures + * @addr: Logical address table + * @devices: Slim device list + * @tid_idr: tid id allocator + * @txn_lock: Lock to protect table of transactions + * @set_laddr: Setup logical address at laddr for the slave with elemental + * address e_addr. Drivers implementing controller will be expected to + * send unicast message to this device with its logical address. + * @get_laddr: It is possible that controller needs to set fixed logical + * address table and get_laddr can be used in that case so that controller + * can do this assignment. Use case is when the master is on the remote + * processor side, who is resposible for allocating laddr. + * + * 'Manager device' is responsible for device management, bandwidth + * allocation, channel setup, and port associations per channel. + * Device management means Logical address assignment/removal based on + * enumeration (report-present, report-absent) of a device. + * Bandwidth allocation is done dynamically by the manager based on active + * channels on the bus, message-bandwidth requests made by slimbus devices. + * Based on current bandwidth usage, manager chooses a frequency to run + * the bus at (in steps of 'clock-gear', 1 through 10, each clock gear + * representing twice the frequency than the previous gear). + * Manager is also responsible for entering (and exiting) low-power-mode + * (known as 'clock pause'). + * Manager can do handover of framer if there are multiple framers on the + * bus and a certain usecase warrants using certain framer to avoid keeping + * previous framer being powered-on. + * + * Controller here performs duties of the manager device, and 'interface + * device'. Interface device is responsible for monitoring the bus and + * reporting information such as loss-of-synchronization, data + * slot-collision. + */ +struct slim_controller { + struct device *dev; + unsigned int id; + char name[SLIMBUS_NAME_SIZE]; + int min_cg; + int max_cg; + int clkgear; + struct ida laddr_ida; + struct slim_framer *a_framer; + struct mutex lock; + struct list_head devices; + struct idr tid_idr; + spinlock_t txn_lock; + int (*set_laddr)(struct slim_controller *ctrl, + struct slim_eaddr *ea, u8 laddr); + int (*get_laddr)(struct slim_controller *ctrl, + struct slim_eaddr *ea, u8 *laddr); +}; + +int slim_device_report_present(struct slim_controller *ctrl, + struct slim_eaddr *e_addr, u8 *laddr); +void slim_report_absent(struct slim_device *sbdev); +int slim_register_controller(struct slim_controller *ctrl); +int slim_unregister_controller(struct slim_controller *ctrl); + +#endif /* _LINUX_SLIMBUS_H */ diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h index 057198216a65..ba3fdf1f5176 100644 --- a/include/linux/slimbus.h +++ b/include/linux/slimbus.h @@ -49,6 +49,8 @@ enum slim_device_status { SLIM_DEVICE_STATUS_RESERVED, }; +struct slim_controller; + /** * struct slim_device - Slim device handle. * @dev: Driver model representation of the device. @@ -65,6 +67,7 @@ struct slim_device { struct device dev; struct slim_eaddr e_addr; struct list_head node; + struct slim_controller *ctrl; enum slim_device_status status; u8 laddr; bool is_laddr_valid; @@ -126,4 +129,8 @@ static inline void slim_set_devicedata(struct slim_device *dev, void *data) { dev_set_drvdata(&dev->dev, data); } + +struct slim_device *slim_get_device(struct slim_controller *ctrl, + struct slim_eaddr *e_addr); +int slim_get_logical_addr(struct slim_device *sbdev, u8 *laddr); #endif /* _LINUX_SLIMBUS_H */ From patchwork Wed Nov 15 14:10:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118968 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4368456qgn; Wed, 15 Nov 2017 06:16:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMamUMwZDh48Phc/sQs2lOXB4RLSxHzmRbBdmP8xCsmQL7LRCRXzoXvf6VpKQ4A/0GgHgBRd X-Received: by 10.101.74.129 with SMTP id b1mr16005240pgu.341.1510755382281; Wed, 15 Nov 2017 06:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755382; cv=none; d=google.com; s=arc-20160816; b=qEE7ifBHosrrugrzBWJMi7TvUypj1hI966kGLrd3k5vldRm15ouKxfVn5TKscYOUnh Sg9nKqlImb9ONzZX23HErSppH//R/mBuu3MpAEYeKe8HTW9NFzh1Zbuqkgvar9aWhshu /TVY2WOdDH3WmaKi0sdXWKkliojdp/AJ5oHj8BQfU/33PGkfk2H6DUCc8KMWe5IuwXLr Kq1k+dCQCO5gQihbSs0kEUKRS5WQJ1Q5rYn/DsehCVeW0ZP66Uvo1xH+RuZLY+XvCQRE AIlw2ABcZHssSPp534dFUxr/WyxTuxOXsBmgJQarPKwji5XFEl2LIsld2CX0WlytZMKN 63Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=mYkiWork453umEflfmF2iE3UK6KxF2c92Fkmm9qJ4mU=; b=nQo2vNqOc1ui0t/cDf/GbavWbtNCc6v2X9osJhbV+GVBcMqrvYWDLJcDVyJlsUv5qx fDw5+qawWUOOY5mnKDEkmE20DoRpCTaEAMX7nc3rIizdqILMQXVHi2FGb89DtsuCRKpZ b6SYr+qZGeAuOfnre+eseURNQ0dbBd1gw/4EHrKV/SqCuuo5Ctvu7apbPDN4nWI0b4d7 6yc9lt/ZUyj3sux/wtxT7NHW1tsycqg/+y7BMDLaLYmDySajEXWwmp2u8wJhaz/liBKW jjmlvq3fc10aEEALNG7vN8VDCnZqhvDD2fnhlXSYBq6Ep+Mvt0vsw3Kf/KA0/G6jhLVV +8Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZI7m8MHz; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 42si6334793plb.653.2017.11.15.06.16.22; Wed, 15 Nov 2017 06:16:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZI7m8MHz; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757661AbdKOOQT (ORCPT + 6 others); Wed, 15 Nov 2017 09:16:19 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:53976 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758128AbdKOONh (ORCPT ); Wed, 15 Nov 2017 09:13:37 -0500 Received: by mail-wr0-f193.google.com with SMTP id u40so20554173wrf.10 for ; Wed, 15 Nov 2017 06:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZvbORCl4VQaLF+exQcfHwlFmTFeADM2lvaP4FWY9M5I=; b=ZI7m8MHzXpE7EzWVN0YvgA0cuUNqhjgpMnq7LbAANzf/I/4tHvBVTO0EDR4KPW2Zsn YpTBTnTvDUKlsZ5EGZ2B1eLllijZc+8oKPyj8Q/LHhPPMZDy+N6h7nNpGbGX21Me+IBb S3EmEaHV79OZYddcmhGnv6JooltCKXdQ+xeyc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZvbORCl4VQaLF+exQcfHwlFmTFeADM2lvaP4FWY9M5I=; b=QJraDWYvQ3J4rC7BKnWPs4dqFcQozoFRuq1wjicWZJriSid3uP2vB8/ZN72IK9JnA7 HvZ3dyWBC9U++nFR3gTow3yAFO3aCsYAfJut3q6+pvOS2kCLcqzlRlxsfSZytSrG1/0T qPVAHbxuqFyXWM1hTMiOsLk3jRP4bukzQQqXr0GsITW8r3iL4Ri+rNmCuYoc9U0Qn5JI b5Ik3iNKBi199ao1U3hJriBi9z+ewQELPTsny/1fLsqhtdKa9Vs2Oqrfsxe5qvydQa5B mIyk7b69viDQyEt92ROzTMDT2tEUMnB6P9HUvLaoNACXpGakne50910P+SlNmRf2UQ7n CKdw== X-Gm-Message-State: AJaThX4KQfARJM2aCQXVclFI9o9pBe+NqKNa2oO36tI+HlUWFGG4dN2s emK3APitQU8vxJxj1chrqh6eDQ== X-Received: by 10.223.167.76 with SMTP id e12mr12138253wrd.259.1510755215697; Wed, 15 Nov 2017 06:13:35 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:34 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 07/13] slimbus: Add support for 'clock-pause' feature Date: Wed, 15 Nov 2017 14:10:37 +0000 Message-Id: <20171115141043.29202-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Sagar Dharia Per slimbus specification, a reconfiguration sequence known as 'clock pause' needs to be broadcast over the bus while entering low- power mode. Clock-pause is initiated by the controller driver. To exit clock-pause, controller typically wakes up the framer device. Since wakeup precedure is controller-specific, framework calls it via controller's function pointer to invoke it. Signed-off-by: Sagar Dharia Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/Makefile | 2 +- drivers/slimbus/core.c | 16 ++++++ drivers/slimbus/messaging.c | 35 +++++++++++- drivers/slimbus/sched.c | 128 ++++++++++++++++++++++++++++++++++++++++++++ drivers/slimbus/slimbus.h | 54 +++++++++++++++++++ 5 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 drivers/slimbus/sched.c -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/slimbus/Makefile b/drivers/slimbus/Makefile index dfa049a382ef..043402eae5be 100644 --- a/drivers/slimbus/Makefile +++ b/drivers/slimbus/Makefile @@ -2,4 +2,4 @@ # Makefile for kernel slimbus framework. # obj-$(CONFIG_SLIMBUS) += slimbus.o -slimbus-y := core.o messaging.o +slimbus-y := core.o messaging.o sched.o diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c index f7b14961c7e3..fa0ae157d6b0 100644 --- a/drivers/slimbus/core.c +++ b/drivers/slimbus/core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "slimbus.h" @@ -235,6 +236,8 @@ int slim_register_controller(struct slim_controller *ctrl) ida_init(&ctrl->laddr_ida); idr_init(&ctrl->tid_idr); mutex_init(&ctrl->lock); + mutex_init(&ctrl->sched.m_reconf); + init_completion(&ctrl->sched.pause_comp); dev_dbg(ctrl->dev, "Bus [%s] registered:dev:%p\n", ctrl->name, ctrl->dev); @@ -266,6 +269,8 @@ int slim_unregister_controller(struct slim_controller *ctrl) { /* Remove all clients */ device_for_each_child(ctrl->dev, NULL, slim_ctrl_remove_device); + /* Enter Clock Pause */ + slim_ctrl_clk_pause(ctrl, false, 0); ida_simple_remove(&ctrl_ida, ctrl->id); return 0; @@ -432,6 +437,14 @@ int slim_device_report_present(struct slim_controller *ctrl, struct slim_device *sbdev; int ret; + ret = pm_runtime_get_sync(ctrl->dev); + + if (ctrl->sched.clk_state != SLIM_CLK_ACTIVE) { + dev_err(ctrl->dev, "slim ctrl not active,state:%d, ret:%d\n", + ctrl->sched.clk_state, ret); + goto slimbus_not_active; + } + sbdev = slim_get_device(ctrl, e_addr); if (IS_ERR(sbdev)) return -ENODEV; @@ -443,6 +456,9 @@ int slim_device_report_present(struct slim_controller *ctrl, ret = slim_device_alloc_laddr(sbdev, laddr, true); +slimbus_not_active: + pm_runtime_mark_last_busy(ctrl->dev); + pm_runtime_put_autosuspend(ctrl->dev); return ret; } EXPORT_SYMBOL_GPL(slim_device_report_present); diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index ba78c1bfe15d..c11534eaf97b 100644 --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c @@ -10,6 +10,7 @@ * GNU General Public License for more details. */ #include +#include #include "slimbus.h" /** @@ -52,6 +53,10 @@ void slim_msg_response(struct slim_controller *ctrl, u8 *reply, u8 tid, u8 len) memcpy(msg->rbuf, reply, len); if (txn->comp) complete(txn->comp); + + /* Remove runtime-pm vote now that response was received for TID txn */ + pm_runtime_mark_last_busy(ctrl->dev); + pm_runtime_put_autosuspend(ctrl->dev); } EXPORT_SYMBOL_GPL(slim_msg_response); @@ -73,10 +78,29 @@ EXPORT_SYMBOL_GPL(slim_msg_response); int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) { DECLARE_COMPLETION_ONSTACK(done); - bool need_tid; + bool need_tid = false, clk_pause_msg = false; unsigned long flags; int ret, tid, timeout; + /* + * do not vote for runtime-PM if the transactions are part of clock + * pause sequence + */ + if (ctrl->sched.clk_state == SLIM_CLK_ENTERING_PAUSE && + (txn->mt == SLIM_MSG_MT_CORE && + txn->mc >= SLIM_MSG_MC_BEGIN_RECONFIGURATION && + txn->mc <= SLIM_MSG_MC_RECONFIGURE_NOW)) + clk_pause_msg = true; + + if (!clk_pause_msg) { + ret = pm_runtime_get_sync(ctrl->dev); + if (ctrl->sched.clk_state != SLIM_CLK_ACTIVE) { + dev_err(ctrl->dev, "ctrl wrong state:%d, ret:%d\n", + ctrl->sched.clk_state, ret); + goto slim_xfer_err; + } + } + need_tid = slim_tid_txn(txn->mt, txn->mc); if (need_tid) { @@ -115,6 +139,15 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) dev_err(ctrl->dev, "Tx:MT:0x%x, MC:0x%x, LA:0x%x failed:%d\n", txn->mt, txn->mc, txn->la, ret); +slim_xfer_err: + if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) { + /* + * remove runtime-pm vote if this was TX only, or + * if there was error during this transaction + */ + pm_runtime_mark_last_busy(ctrl->dev); + pm_runtime_mark_last_busy(ctrl->dev); + } return ret; } diff --git a/drivers/slimbus/sched.c b/drivers/slimbus/sched.c new file mode 100644 index 000000000000..74300f1a6898 --- /dev/null +++ b/drivers/slimbus/sched.c @@ -0,0 +1,128 @@ +/* Copyright (c) 2011-2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include "slimbus.h" + +/** + * slim_ctrl_clk_pause() - Called by slimbus controller to enter/exit + * 'clock pause' + * @ctrl: controller requesting bus to be paused or woken up + * @wakeup: Wakeup this controller from clock pause. + * @restart: Restart time value per spec used for clock pause. This value + * isn't used when controller is to be woken up. + * + * Slimbus specification needs this sequence to turn-off clocks for the bus. + * The sequence involves sending 3 broadcast messages (reconfiguration + * sequence) to inform all devices on the bus. + * To exit clock-pause, controller typically wakes up active framer device. + * This API executes clock pause reconfiguration sequence if wakeup is false. + * If wakeup is true, controller's wakeup is called. + * For entering clock-pause, -EBUSY is returned if a message txn in pending. + */ +int slim_ctrl_clk_pause(struct slim_controller *ctrl, bool wakeup, u8 restart) +{ + int i, ret = 0; + unsigned long flags; + struct slim_sched *sched = &ctrl->sched; + struct slim_val_inf msg = {0, 0, NULL, NULL}; + + DEFINE_SLIM_BCAST_TXN(txn, SLIM_MSG_MC_BEGIN_RECONFIGURATION, + 3, SLIM_LA_MANAGER, &msg); + + if (wakeup == false && restart > SLIM_CLK_UNSPECIFIED) + return -EINVAL; + + mutex_lock(&sched->m_reconf); + if (wakeup) { + if (sched->clk_state == SLIM_CLK_ACTIVE) { + mutex_unlock(&sched->m_reconf); + return 0; + } + + /* + * Fine-tune calculation based on clock gear, + * message-bandwidth after bandwidth management + */ + ret = wait_for_completion_timeout(&sched->pause_comp, + msecs_to_jiffies(100)); + if (!ret) { + mutex_unlock(&sched->m_reconf); + pr_err("Previous clock pause did not finish"); + return -ETIMEDOUT; + } + ret = 0; + + /* + * Slimbus framework will call controller wakeup + * Controller should make sure that it sets active framer + * out of clock pause + */ + if (sched->clk_state == SLIM_CLK_PAUSED && ctrl->wakeup) + ret = ctrl->wakeup(ctrl); + if (!ret) + sched->clk_state = SLIM_CLK_ACTIVE; + mutex_unlock(&sched->m_reconf); + + return ret; + } + + /* already paused */ + if (ctrl->sched.clk_state == SLIM_CLK_PAUSED) { + mutex_unlock(&sched->m_reconf); + return 0; + } + + spin_lock_irqsave(&ctrl->txn_lock, flags); + for (i = 0; i < SLIM_MAX_TIDS; i++) { + /* Pending response for a message */ + if (idr_find(&ctrl->tid_idr, i)) { + spin_unlock_irqrestore(&ctrl->txn_lock, flags); + mutex_unlock(&sched->m_reconf); + return -EBUSY; + } + } + spin_unlock_irqrestore(&ctrl->txn_lock, flags); + + sched->clk_state = SLIM_CLK_ENTERING_PAUSE; + + /* clock pause sequence */ + ret = slim_do_transfer(ctrl, &txn); + if (ret) + goto clk_pause_ret; + + txn.mc = SLIM_MSG_MC_NEXT_PAUSE_CLOCK; + txn.rl = 4; + msg.num_bytes = 1; + msg.wbuf = &restart; + ret = slim_do_transfer(ctrl, &txn); + if (ret) + goto clk_pause_ret; + + txn.mc = SLIM_MSG_MC_RECONFIGURE_NOW; + txn.rl = 3; + msg.num_bytes = 1; + msg.wbuf = NULL; + ret = slim_do_transfer(ctrl, &txn); + +clk_pause_ret: + if (ret) { + sched->clk_state = SLIM_CLK_ACTIVE; + } else { + sched->clk_state = SLIM_CLK_PAUSED; + complete(&sched->pause_comp); + } + mutex_unlock(&sched->m_reconf); + + return ret; +} +EXPORT_SYMBOL_GPL(slim_ctrl_clk_pause); diff --git a/drivers/slimbus/slimbus.h b/drivers/slimbus/slimbus.h index f3ed5d4dbb0a..4fe1892cbd4f 100644 --- a/drivers/slimbus/slimbus.h +++ b/drivers/slimbus/slimbus.h @@ -35,6 +35,16 @@ #define SLIM_MSG_MC_REPLY_VALUE 0x64 #define SLIM_MSG_MC_CHANGE_VALUE 0x68 +/* Clock pause Reconfiguration messages */ +#define SLIM_MSG_MC_BEGIN_RECONFIGURATION 0x40 +#define SLIM_MSG_MC_NEXT_PAUSE_CLOCK 0x4A +#define SLIM_MSG_MC_RECONFIGURE_NOW 0x5F + +/* Clock pause values per slimbus spec */ +#define SLIM_CLK_FAST 0 +#define SLIM_CLK_CONST_PHASE 1 +#define SLIM_CLK_UNSPECIFIED 2 + /* Destination type Values */ #define SLIM_MSG_DEST_LOGICALADDR 0 #define SLIM_MSG_DEST_ENUMADDR 1 @@ -102,6 +112,43 @@ struct slim_msg_txn { #define DEFINE_SLIM_LDEST_TXN(name, mc, rl, la, msg) \ struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_LOGICALADDR, 0,\ 0, la, msg, } + +#define DEFINE_SLIM_BCAST_TXN(name, mc, rl, la, msg) \ + struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_BROADCAST, 0,\ + 0, la, msg, } +/** + * enum slim_clk_state: Slimbus controller's clock state used internally for + * maintaining current clock state. + * @SLIM_CLK_ACTIVE: Slimbus clock is active + * @SLIM_CLK_ENTERING_PAUSE: Slimbus clock pause sequence is being sent on the + * bus. If this succeeds, state changes to SLIM_CLK_PAUSED. If the + * transition fails, state changes back to SLIM_CLK_ACTIVE + * @SLIM_CLK_PAUSED: Slimbus controller clock has paused. + */ +enum slim_clk_state { + SLIM_CLK_ACTIVE, + SLIM_CLK_ENTERING_PAUSE, + SLIM_CLK_PAUSED, +}; + +/** + * struct slim_sched: Framework uses this structure internally for scheduling. + * @clk_state: Controller's clock state from enum slim_clk_state + * @pause_comp: Signals completion of clock pause sequence. This is useful when + * client tries to call slimbus transaction when controller is entering + * clock pause. + * @m_reconf: This mutex is held until current reconfiguration (data channel + * scheduling, message bandwidth reservation) is done. Message APIs can + * use the bus concurrently when this mutex is held since elemental access + * messages can be sent on the bus when reconfiguration is in progress. + */ +struct slim_sched { + int clkgear; + enum slim_clk_state clk_state; + struct completion pause_comp; + struct mutex m_reconf; +}; + /** * struct slim_controller - Controls every instance of SLIMbus * (similar to 'master' on SPI) @@ -118,6 +165,7 @@ struct slim_msg_txn { * @devices: Slim device list * @tid_idr: tid id allocator * @txn_lock: Lock to protect table of transactions + * @sched: scheduler structure used by the controller * @xfer_msg: Transfer a message on this controller (this can be a broadcast * control/status message like data channel setup, or a unicast message * like value element read/write. @@ -128,6 +176,9 @@ struct slim_msg_txn { * address table and get_laddr can be used in that case so that controller * can do this assignment. Use case is when the master is on the remote * processor side, who is resposible for allocating laddr. + * @wakeup: This function pointer implements controller-specific procedure + * to wake it up from clock-pause. Framework will call this to bring + * the controller out of clock pause. * * 'Manager device' is responsible for device management, bandwidth * allocation, channel setup, and port associations per channel. @@ -162,12 +213,14 @@ struct slim_controller { struct list_head devices; struct idr tid_idr; spinlock_t txn_lock; + struct slim_sched sched; int (*xfer_msg)(struct slim_controller *ctrl, struct slim_msg_txn *tx); int (*set_laddr)(struct slim_controller *ctrl, struct slim_eaddr *ea, u8 laddr); int (*get_laddr)(struct slim_controller *ctrl, struct slim_eaddr *ea, u8 *laddr); + int (*wakeup)(struct slim_controller *ctrl); }; int slim_device_report_present(struct slim_controller *ctrl, @@ -177,6 +230,7 @@ int slim_register_controller(struct slim_controller *ctrl); int slim_unregister_controller(struct slim_controller *ctrl); void slim_msg_response(struct slim_controller *ctrl, u8 *reply, u8 tid, u8 l); int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn); +int slim_ctrl_clk_pause(struct slim_controller *ctrl, bool wakeup, u8 restart); static inline bool slim_tid_txn(u8 mt, u8 mc) { From patchwork Wed Nov 15 14:10:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118967 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4368253qgn; Wed, 15 Nov 2017 06:16:13 -0800 (PST) X-Google-Smtp-Source: AGs4zMYIU3ysT3cDVrDXFEsQHuSPIJWEZaWcNy1Esr4nT8InUqDdb8dotLd7mmpxJUQ8WekmTqBf X-Received: by 10.101.91.5 with SMTP id y5mr3948014pgq.445.1510755373515; Wed, 15 Nov 2017 06:16:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755373; cv=none; d=google.com; s=arc-20160816; b=fkuDJh/OhhLi7nMDMeBl2i39lGhBeDFJt3aW40zn76J5nRmoClX41EGKijet4ubRUy KIoSW7zqfoA/faUogfUpVv6DVZ/Yp/dLWm72Y9WMsRQ1ZJv1uc1GdN/XUl0yHMqtwsSW Xy+04gh0u6ECK+2Aq5nkMzCVGjqky8oueRM8XIKiw0ojCd/nie4Pei9DozjiIyGLLKax MsLix47xNwkxX8I6MyIJUOPGbVm3dgYSgKE7M+WHipGQqxB/qh8+B6SQzsVe2gbSIZsP lz7+u5p/vDVjE2MkEU6YqLed4aXXysCgpcU6B69t2G5TkIarppn35gdqwlgmenxso4Kx f9KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=KE/BBrwt9UEwAJ+dvx0m1FH5I7ZKDH1o8IqPp3f93F4=; b=JApyKtgoxAdBH7lUT87tVPJn77q30/b2WeTyLCLr9LZbDJiZlAeAgWtCLTYALJ2lwO l+lWWlMCdmVxOK3pf3L6fqhOH3g2UnXjwOc42+5ZHbIjpTTKgeED53whyF9VzSp3Kk6a AapGltw7tJA5LPdnty9MXDvHZQd5IOLEWrH7MnrTGeZRS3dbzOtR4yukRvXPbC51JX4h J6BIsTUuIPSK/NGXKZQ31BlJTR7DMohc7Z3KVupq5vrgQAh4/XHvYgRUNfgrDgCNkyGu BQUP2QgnDftPpgypknlfKtbiA+AjtrqsI1QHrs7emyPPh86HAdhHF9Tc353qPyyem6tm 9aTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gizd52Mt; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 42si6334793plb.653.2017.11.15.06.16.13; Wed, 15 Nov 2017 06:16:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gizd52Mt; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932436AbdKOOQK (ORCPT + 6 others); Wed, 15 Nov 2017 09:16:10 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45238 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754624AbdKOONl (ORCPT ); Wed, 15 Nov 2017 09:13:41 -0500 Received: by mail-wr0-f193.google.com with SMTP id w95so1735716wrc.2 for ; Wed, 15 Nov 2017 06:13:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tfwldHIEU6uCDtivDFyBxsD7FV7iNaDw80GlvIE8o0Y=; b=gizd52MtxumYYYbFxz96VXwCA8t5pgV3BDIoeym0HAIE4vKGrVCmkBVFyGwt7sUtJj 7p1nStI+mIuUyhPxhl9+IkFl/wf3qipTL76CHCrZFhDG9t/IeDAtxiTy+MDUSurrgBw3 OBsSxP5vO6UgJeJ/+CoYOkwJmUUGw3oHrkVpQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tfwldHIEU6uCDtivDFyBxsD7FV7iNaDw80GlvIE8o0Y=; b=Wfs1A8lqMpu+ga2Ur0ud6Ryd/+ud2vkhkpxUPXhvg3mqEWY+YbzLeUvp9ETo48bXRs uj6j2dMw76Gx+bCo3Fm2rv8z4jlf9GArCa92IVjNY53WI/mQtYdQK6MKwJPGBSoeb2fs 8Amb/d9xCfkjC2q9loSNALhbIr2kVsoMMzDvwi5urwK1oTq2Yq3oNtrC70+U8IdQwEby XS8ANiwFvv/rJkO1Nc8YgWYF6rZJDs2/IAMGjQwHML47BNmda45IVXFk5yPihl4miQlJ SE235QHxb2GclBacZTHLjAwvbOKV2/AzS6yrTSRVTmkSk0tVqt3B2v46WxLddqUV4c1J iUIA== X-Gm-Message-State: AJaThX51B6GjSB8kpyh5xgc+rtpul9Cf9f+mglc4drPGINE+bDodNKYW V1UnqLjF1XP6hSW/iPnnvsdsTQ== X-Received: by 10.223.176.115 with SMTP id g48mr14783176wra.177.1510755219555; Wed, 15 Nov 2017 06:13:39 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:38 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 09/13] slimbus: core: add common defines required for controllers Date: Wed, 15 Nov 2017 14:10:39 +0000 Message-Id: <20171115141043.29202-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla This patch adds some common constant defines which are required for qcom slim controller driver. Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/slimbus.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/slimbus/slimbus.h b/drivers/slimbus/slimbus.h index 4fe1892cbd4f..e1fc6d23f374 100644 --- a/drivers/slimbus/slimbus.h +++ b/drivers/slimbus/slimbus.h @@ -18,9 +18,37 @@ #include #include +/* Standard values per SLIMbus spec needed by controllers and devices */ +#define SLIM_CL_PER_SUPERFRAME 6144 +#define SLIM_CL_PER_SUPERFRAME_DIV8 (SLIM_CL_PER_SUPERFRAME >> 3) + /* SLIMbus message types. Related to interpretation of message code. */ #define SLIM_MSG_MT_CORE 0x0 +/* + * SLIM Broadcast header format + * BYTE 0: MT[7:5] RL[4:0] + * BYTE 1: RSVD[7] MC[6:0] + * BYTE 2: RSVD[7:6] DT[5:4] PI[3:0] + */ +#define SLIM_MSG_MT_MASK GENMASK(2, 0) +#define SLIM_MSG_MT_SHIFT 5 +#define SLIM_MSG_RL_MASK GENMASK(4, 0) +#define SLIM_MSG_RL_SHIFT 0 +#define SLIM_MSG_MC_MASK GENMASK(6, 0) +#define SLIM_MSG_MC_SHIFT 0 +#define SLIM_MSG_DT_MASK GENMASK(1, 0) +#define SLIM_MSG_DT_SHIFT 4 + +#define SLIM_HEADER_GET_MT(b) ((b >> SLIM_MSG_MT_SHIFT) & SLIM_MSG_MT_MASK) +#define SLIM_HEADER_GET_RL(b) ((b >> SLIM_MSG_RL_SHIFT) & SLIM_MSG_RL_MASK) +#define SLIM_HEADER_GET_MC(b) ((b >> SLIM_MSG_MC_SHIFT) & SLIM_MSG_MC_MASK) +#define SLIM_HEADER_GET_DT(b) ((b >> SLIM_MSG_DT_SHIFT) & SLIM_MSG_DT_MASK) + +/* Device management messages used by this framework */ +#define SLIM_MSG_MC_REPORT_PRESENT 0x1 +#define SLIM_MSG_MC_ASSIGN_LOGICAL_ADDRESS 0x2 +#define SLIM_MSG_MC_REPORT_ABSENT 0xF /* Information Element management messages */ #define SLIM_MSG_MC_REQUEST_INFORMATION 0x20 @@ -116,6 +144,10 @@ struct slim_msg_txn { #define DEFINE_SLIM_BCAST_TXN(name, mc, rl, la, msg) \ struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_BROADCAST, 0,\ 0, la, msg, } + +#define DEFINE_SLIM_EDEST_TXN(name, mc, rl, la, msg) \ + struct slim_msg_txn name = { rl, 0, mc, SLIM_MSG_DEST_ENUMADDR, 0,\ + 0, la, msg, } /** * enum slim_clk_state: Slimbus controller's clock state used internally for * maintaining current clock state. From patchwork Wed Nov 15 14:10:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118965 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4368015qgn; Wed, 15 Nov 2017 06:16:02 -0800 (PST) X-Google-Smtp-Source: AGs4zMY4WQg8gLexR4OY0cwLhmjkBkjClN/hSt/DhJnMPote6dXM4Tx6A2YmgRELJs80xExkhRtb X-Received: by 10.98.220.218 with SMTP id c87mr11273728pfl.229.1510755362773; Wed, 15 Nov 2017 06:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755362; cv=none; d=google.com; s=arc-20160816; b=B4unn3zD+Gre4lUtvy86ysw2oRVlVnzPTkpQgL+XJftI3TGTjJaZGO6riIG5FN+ZbX h4X+VrQERiBM9LLxQwddNN9nDG6rE7RSNgzPus3/cspmublOVe7+qytdpz6LMIzodQxL KRVIBr6bZoZtqAKzDfSbCqCZST5X6Q+xqXjXxiRWNbisX3sJ+YholQSSOoUT9reNkm6c N8VUhAI6mVsxTO+vinxrJvwtlXqs/cZNX5cE/mkK/0tVtih4QQlpctHqqyJHKUTRfsSo sTF1lYWZDqadvpWV9JEDYlNwH7PSCTz4MhyLW7rGbCu+7+C3Rn0lLzL3gC88GA61unLb UgKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=B2jLEcr/XIFg6eTPKJ6HuNUKEJjws55vERYh1iqGpf8=; b=EJqP7Re+WAPjw1kdieFcwo9gLhsSfyrE3vNCVert/BOQ3QxEeA5JgNMBAdl5N0gfIs qqlsVVlaeTsb/QLV1mPLkHFqFohkA3TP83CCdMO9LXEfkDLGVRujPSNtidVW2+hcKdkB iXJyISxsL6b/4WVBmcvn82rpuucC3zydmLpWJ/iaC4vCHlzuxU3DwU26u81QC3U745iC 7bcvqAxsl9EGY+FirZiMyIIHbv1smPlRM4MwLIAvhtovf4Pm+gNPGVgLTRDIzbk8F5M4 upLmLWLIXkxC50HjShZcVZbIQ+WLXfJxBE1M34YtPbMr7xyy/x7iOq6FGb58aEzpzUpJ O9VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jdMPhi2d; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 42si6334793plb.653.2017.11.15.06.16.02; Wed, 15 Nov 2017 06:16:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jdMPhi2d; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757993AbdKOOP7 (ORCPT + 6 others); Wed, 15 Nov 2017 09:15:59 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:44951 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757355AbdKOONo (ORCPT ); Wed, 15 Nov 2017 09:13:44 -0500 Received: by mail-wm0-f44.google.com with SMTP id r68so3318544wmr.3 for ; Wed, 15 Nov 2017 06:13:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+tbjRAdGUR1xckXOv1suZfGj24cE7Q6iqdSuSll/JCI=; b=jdMPhi2dQsxTr6w4G32q9WWBxSyAn5yuflnheYgD68rIn7x6+Nrzdi2R6E11V03+TX 3SPq0kTkcDxD7mUg5ms59j8GSAcIAee0J55TsGnGXY7YJG0MbyHsE+HTH3xWlDe4Ytd7 ybayhIvo+ctnH8GWe2faopgUu0+9fVIVAjibQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+tbjRAdGUR1xckXOv1suZfGj24cE7Q6iqdSuSll/JCI=; b=W3JeIvoLPczROGy2zIBACZrTeC/XM0e7HSanrYEcne41/Kte+y9FE3+RspvvckWfmE 7s2vjFCpg+S270SRA4o0nmyb3NLXz+oF3ewH5sy4JNgtFntjpdcIvr9UmrI0fdOsl0FD fA4PgFlBeA/mDHUc70rJiSmPCW1y+R595m5mxtiAcN+E8XPiE/14C+863GHVAXZxNR46 A4HZm+UFIcbeSXnaXXNiSCutAAXdkrKCrY73P4gxug/dh9tzxR/Oo4+1GondKI/1TTUk SaeX7AyQlgPW1Q7zs+Z1u3PZtBGTPBhKvXVUjgCcAxyz40oStivgVDUz0GvV29pK0Urt Sbng== X-Gm-Message-State: AJaThX7XevKcv8GDisaUQ/jFZw+UQIhot8vJxe95Fld/QgNQaggZNVhS RhQ6wU+rWJXzQELclnasRl87sA== X-Received: by 10.28.14.85 with SMTP id 82mr10670119wmo.120.1510755223085; Wed, 15 Nov 2017 06:13:43 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:42 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 11/13] slimbus: qcom: Add Qualcomm Slimbus controller driver Date: Wed, 15 Nov 2017 14:10:41 +0000 Message-Id: <20171115141043.29202-12-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Sagar Dharia This controller driver programs manager, interface, and framer devices for Qualcomm's slimbus HW block. Manager component currently implements logical address setting, and messaging interface. Interface device reports bus synchronization information, and framer device clocks the bus from the time it's woken up, until clock-pause is executed by the manager device. Signed-off-by: Sagar Dharia Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/Kconfig | 6 + drivers/slimbus/Makefile | 4 + drivers/slimbus/qcom-ctrl.c | 684 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 694 insertions(+) create mode 100644 drivers/slimbus/qcom-ctrl.c -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/slimbus/Kconfig b/drivers/slimbus/Kconfig index 9c7d3c61656a..9c8d59290634 100644 --- a/drivers/slimbus/Kconfig +++ b/drivers/slimbus/Kconfig @@ -12,5 +12,11 @@ menuconfig SLIMBUS if SLIMBUS # SlIMbus controllers +config SLIM_QCOM_CTRL + tristate "Qualcomm Slimbus Manager Component" + depends on SLIMBUS + help + Select driver if Qualcomm's Slimbus Manager Component is + programmed using Linux kernel. endif diff --git a/drivers/slimbus/Makefile b/drivers/slimbus/Makefile index 043402eae5be..9a70c7c70aae 100644 --- a/drivers/slimbus/Makefile +++ b/drivers/slimbus/Makefile @@ -3,3 +3,7 @@ # obj-$(CONFIG_SLIMBUS) += slimbus.o slimbus-y := core.o messaging.o sched.o + +#Controllers +obj-$(CONFIG_SLIM_QCOM_CTRL) += slim-qcom-ctrl.o +slim-qcom-ctrl-y := qcom-ctrl.o diff --git a/drivers/slimbus/qcom-ctrl.c b/drivers/slimbus/qcom-ctrl.c new file mode 100644 index 000000000000..25c1974f04ec --- /dev/null +++ b/drivers/slimbus/qcom-ctrl.c @@ -0,0 +1,684 @@ +/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "slimbus.h" + +/* Manager registers */ +#define MGR_CFG 0x200 +#define MGR_STATUS 0x204 +#define MGR_INT_EN 0x210 +#define MGR_INT_STAT 0x214 +#define MGR_INT_CLR 0x218 +#define MGR_TX_MSG 0x230 +#define MGR_RX_MSG 0x270 +#define MGR_IE_STAT 0x2F0 +#define MGR_VE_STAT 0x300 +#define MGR_CFG_ENABLE 1 + +/* Framer registers */ +#define FRM_CFG 0x400 +#define FRM_STAT 0x404 +#define FRM_INT_EN 0x410 +#define FRM_INT_STAT 0x414 +#define FRM_INT_CLR 0x418 +#define FRM_WAKEUP 0x41C +#define FRM_CLKCTL_DONE 0x420 +#define FRM_IE_STAT 0x430 +#define FRM_VE_STAT 0x440 + +/* Interface registers */ +#define INTF_CFG 0x600 +#define INTF_STAT 0x604 +#define INTF_INT_EN 0x610 +#define INTF_INT_STAT 0x614 +#define INTF_INT_CLR 0x618 +#define INTF_IE_STAT 0x630 +#define INTF_VE_STAT 0x640 + +/* Interrupt status bits */ +#define MGR_INT_TX_NACKED_2 BIT(25) +#define MGR_INT_MSG_BUF_CONTE BIT(26) +#define MGR_INT_RX_MSG_RCVD BIT(30) +#define MGR_INT_TX_MSG_SENT BIT(31) + +/* Framer config register settings */ +#define FRM_ACTIVE 1 +#define CLK_GEAR 7 +#define ROOT_FREQ 11 +#define REF_CLK_GEAR 15 +#define INTR_WAKE 19 + +#define SLIM_MSG_ASM_FIRST_WORD(l, mt, mc, dt, ad) \ + ((l) | ((mt) << 5) | ((mc) << 8) | ((dt) << 15) | ((ad) << 16)) + +#define SLIM_ROOT_FREQ 24576000 + +/* MAX message size over control channel */ +#define SLIM_MSGQ_BUF_LEN 40 +#define QCOM_TX_MSGS 2 +#define QCOM_RX_MSGS 8 +#define QCOM_BUF_ALLOC_RETRIES 10 + +#define CFG_PORT(r, v) ((v) ? CFG_PORT_V2(r) : CFG_PORT_V1(r)) + +/* V2 Component registers */ +#define CFG_PORT_V2(r) ((r ## _V2)) +#define COMP_CFG_V2 4 +#define COMP_TRUST_CFG_V2 0x3000 + +/* V1 Component registers */ +#define CFG_PORT_V1(r) ((r ## _V1)) +#define COMP_CFG_V1 0 +#define COMP_TRUST_CFG_V1 0x14 + +/* Resource group info for manager, and non-ported generic device-components */ +#define EE_MGR_RSC_GRP (1 << 10) +#define EE_NGD_2 (2 << 6) +#define EE_NGD_1 0 + +struct slim_ctrl_buf { + void *base; + phys_addr_t phy; + spinlock_t lock; + int head; + int tail; + int sl_sz; + int n; +}; + +struct qcom_slim_ctrl { + struct slim_controller ctrl; + struct slim_framer framer; + struct device *dev; + void __iomem *base; + void __iomem *slew_reg; + + struct slim_ctrl_buf rx; + struct slim_ctrl_buf tx; + + struct completion **wr_comp; + int irq; + struct workqueue_struct *rxwq; + struct work_struct wd; + struct clk *rclk; + struct clk *hclk; +}; + +static void qcom_slim_queue_tx(struct qcom_slim_ctrl *ctrl, void *buf, + u8 len, u32 tx_reg) +{ + int count = (len + 3) >> 2; + + __iowrite32_copy(ctrl->base + tx_reg, buf, count); + + /* Ensure Oder of subsequent writes */ + mb(); +} + +static void *slim_alloc_rxbuf(struct qcom_slim_ctrl *ctrl) +{ + unsigned long flags; + int idx; + + spin_lock_irqsave(&ctrl->rx.lock, flags); + if ((ctrl->rx.tail + 1) % ctrl->rx.n == ctrl->rx.head) { + spin_unlock_irqrestore(&ctrl->rx.lock, flags); + dev_err(ctrl->dev, "RX QUEUE full!"); + return NULL; + } + idx = ctrl->rx.tail; + ctrl->rx.tail = (ctrl->rx.tail + 1) % ctrl->rx.n; + spin_unlock_irqrestore(&ctrl->rx.lock, flags); + + return ctrl->rx.base + (idx * ctrl->rx.sl_sz); +} + +void slim_ack_txn(struct qcom_slim_ctrl *ctrl, int err) +{ + struct completion *comp; + unsigned long flags; + int idx; + + spin_lock_irqsave(&ctrl->tx.lock, flags); + idx = ctrl->tx.head; + ctrl->tx.head = (ctrl->tx.head + 1) % ctrl->tx.n; + spin_unlock_irqrestore(&ctrl->tx.lock, flags); + + comp = ctrl->wr_comp[idx]; + ctrl->wr_comp[idx] = NULL; + + complete(comp); +} + +static irqreturn_t qcom_slim_handle_tx_irq(struct qcom_slim_ctrl *ctrl, + u32 stat) +{ + int err = 0; + + if (stat & MGR_INT_TX_MSG_SENT) + writel_relaxed(MGR_INT_TX_MSG_SENT, + ctrl->base + MGR_INT_CLR); + + if (stat & MGR_INT_TX_NACKED_2) { + u32 mgr_stat = readl_relaxed(ctrl->base + MGR_STATUS); + u32 mgr_ie_stat = readl_relaxed(ctrl->base + MGR_IE_STAT); + u32 frm_stat = readl_relaxed(ctrl->base + FRM_STAT); + u32 frm_cfg = readl_relaxed(ctrl->base + FRM_CFG); + u32 frm_intr_stat = readl_relaxed(ctrl->base + FRM_INT_STAT); + u32 frm_ie_stat = readl_relaxed(ctrl->base + FRM_IE_STAT); + u32 intf_stat = readl_relaxed(ctrl->base + INTF_STAT); + u32 intf_intr_stat = readl_relaxed(ctrl->base + INTF_INT_STAT); + u32 intf_ie_stat = readl_relaxed(ctrl->base + INTF_IE_STAT); + + writel_relaxed(MGR_INT_TX_NACKED_2, ctrl->base + MGR_INT_CLR); + + dev_err(ctrl->dev, "TX Nack MGR:int:0x%x, stat:0x%x\n", + stat, mgr_stat); + dev_err(ctrl->dev, "TX Nack MGR:ie:0x%x\n", mgr_ie_stat); + dev_err(ctrl->dev, "TX Nack FRM:int:0x%x, stat:0x%x\n", + frm_intr_stat, frm_stat); + dev_err(ctrl->dev, "TX Nack FRM:cfg:0x%x, ie:0x%x\n", + frm_cfg, frm_ie_stat); + dev_err(ctrl->dev, "TX Nack INTF:intr:0x%x, stat:0x%x\n", + intf_intr_stat, intf_stat); + dev_err(ctrl->dev, "TX Nack INTF:ie:0x%x\n", + intf_ie_stat); + err = -ENOTCONN; + } + + slim_ack_txn(ctrl, err); + + return IRQ_HANDLED; +} + +static irqreturn_t qcom_slim_handle_rx_irq(struct qcom_slim_ctrl *ctrl, + u32 stat) +{ + u32 *rx_buf, pkt[10]; + bool q_rx = false; + u8 la, *buf, mc, mt, len, *b = (u8 *)&pkt[0]; + u16 ele; + + pkt[0] = readl_relaxed(ctrl->base + MGR_RX_MSG); + mt = SLIM_HEADER_GET_MT(b[0]); + len = SLIM_HEADER_GET_RL(b[0]); + mc = SLIM_HEADER_GET_MC(b[1]); + + /* + * this message cannot be handled by ISR, so + * let work-queue handle it + */ + if (mt == SLIM_MSG_MT_CORE && + mc == SLIM_MSG_MC_REPORT_PRESENT) + rx_buf = (u32 *)slim_alloc_rxbuf(ctrl); + else + rx_buf = pkt; + + if (rx_buf == NULL) { + dev_err(ctrl->dev, "dropping RX:0x%x due to RX full\n", + pkt[0]); + goto rx_ret_irq; + } + + rx_buf[0] = pkt[0]; + __ioread32_copy(rx_buf + 1, ctrl->base + MGR_RX_MSG + 4, + DIV_ROUND_UP(len, 4)); + + switch (mc) { + + case SLIM_MSG_MC_REPORT_PRESENT: + q_rx = true; + break; + case SLIM_MSG_MC_REPLY_INFORMATION: + case SLIM_MSG_MC_REPLY_VALUE: + slim_msg_response(&ctrl->ctrl, (u8 *)(rx_buf + 1), + (u8)(*rx_buf >> 24), (len - 4)); + break; + case SLIM_MSG_MC_REPORT_INFORMATION: + buf = (u8 *)rx_buf; + la = buf[2]; + ele = (u16)buf[4] << 4; + + ele |= ((buf[3] & 0xf0) >> 4); + /* + * report information is most likely loss of + * sync or collision detected in data slots + */ + dev_info(ctrl->dev, "LA:%d report inf ele:0x%x\n", + la, ele); + break; + default: + dev_err(ctrl->dev, "unsupported MC,%x MT:%x\n", + mc, mt); + break; + } +rx_ret_irq: + writel(MGR_INT_RX_MSG_RCVD, ctrl->base + + MGR_INT_CLR); + if (q_rx) + queue_work(ctrl->rxwq, &ctrl->wd); + + return IRQ_HANDLED; +} + +static irqreturn_t qcom_slim_interrupt(int irq, void *d) +{ + struct qcom_slim_ctrl *ctrl = d; + u32 stat = readl_relaxed(ctrl->base + MGR_INT_STAT); + int ret = IRQ_NONE; + + if (stat & MGR_INT_TX_MSG_SENT || stat & MGR_INT_TX_NACKED_2) + ret = qcom_slim_handle_tx_irq(ctrl, stat); + + if (stat & MGR_INT_RX_MSG_RCVD) + ret = qcom_slim_handle_rx_irq(ctrl, stat); + + return ret; +} + +void *slim_alloc_txbuf(struct qcom_slim_ctrl *ctrl, struct slim_msg_txn *txn, + struct completion *done) +{ + unsigned long flags; + int idx; + + spin_lock_irqsave(&ctrl->tx.lock, flags); + if (((ctrl->tx.head + 1) % ctrl->tx.n) == ctrl->tx.tail) { + spin_unlock_irqrestore(&ctrl->tx.lock, flags); + dev_err(ctrl->dev, "controller TX buf unavailable"); + return NULL; + } + idx = ctrl->tx.tail; + ctrl->wr_comp[idx] = done; + ctrl->tx.tail = (ctrl->tx.tail + 1) % ctrl->tx.n; + + spin_unlock_irqrestore(&ctrl->tx.lock, flags); + + return ctrl->tx.base + (idx * ctrl->tx.sl_sz); +} + + +static int qcom_xfer_msg(struct slim_controller *sctrl, + struct slim_msg_txn *txn) +{ + struct qcom_slim_ctrl *ctrl = dev_get_drvdata(sctrl->dev); + DECLARE_COMPLETION_ONSTACK(done); + void *pbuf = slim_alloc_txbuf(ctrl, txn, &done); + unsigned long ms = txn->rl + HZ; + u8 *puc; + int ret = 0, timeout, retries = QCOM_BUF_ALLOC_RETRIES; + u8 la = txn->la; + u32 *head; + /* HW expects length field to be excluded */ + txn->rl--; + + /* spin till buffer is made available */ + if (!pbuf) { + while (retries--) { + usleep_range(10000, 15000); + pbuf = slim_alloc_txbuf(ctrl, txn, &done); + if (pbuf) + break; + } + } + + if (!retries && !pbuf) + return -ENOMEM; + + puc = (u8 *)pbuf; + head = (u32 *)pbuf; + + if (txn->dt == SLIM_MSG_DEST_LOGICALADDR) + *head = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 0, + la); + else + *head = SLIM_MSG_ASM_FIRST_WORD(txn->rl, txn->mt, txn->mc, 1, + la); + + if (txn->dt == SLIM_MSG_DEST_LOGICALADDR) + puc += 3; + else + puc += 2; + + if (txn->mt == SLIM_MSG_MT_CORE && slim_tid_txn(txn->mt, txn->mc)) + *(puc++) = txn->tid; + + if ((txn->mt == SLIM_MSG_MT_CORE) && + ((txn->mc >= SLIM_MSG_MC_REQUEST_INFORMATION && + txn->mc <= SLIM_MSG_MC_REPORT_INFORMATION) || + (txn->mc >= SLIM_MSG_MC_REQUEST_VALUE && + txn->mc <= SLIM_MSG_MC_CHANGE_VALUE))) { + *(puc++) = (txn->ec & 0xFF); + *(puc++) = (txn->ec >> 8) & 0xFF; + } + + if (txn->msg && txn->msg->wbuf) + memcpy(puc, txn->msg->wbuf, txn->msg->num_bytes); + + qcom_slim_queue_tx(ctrl, head, txn->rl, MGR_TX_MSG); + timeout = wait_for_completion_timeout(&done, msecs_to_jiffies(ms)); + + if (!timeout) { + dev_err(ctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc, + txn->mt); + ret = -ETIMEDOUT; + } + + return ret; + +} + +static int qcom_set_laddr(struct slim_controller *sctrl, + struct slim_eaddr *ead, u8 laddr) +{ + struct qcom_slim_ctrl *ctrl = dev_get_drvdata(sctrl->dev); + struct { + __be16 manf_id; + __be16 prod_code; + u8 dev_index; + u8 instance; + u8 laddr; + } __packed p; + struct slim_val_inf msg = {0}; + DEFINE_SLIM_EDEST_TXN(txn, SLIM_MSG_MC_ASSIGN_LOGICAL_ADDRESS, + 10, laddr, &msg); + int ret; + + p.manf_id = cpu_to_be16(ead->manf_id); + p.prod_code = cpu_to_be16(ead->prod_code); + p.dev_index = ead->dev_index; + p.instance = ead->instance; + p.laddr = laddr; + + msg.wbuf = (void *)&p; + msg.num_bytes = 7; + ret = slim_do_transfer(&ctrl->ctrl, &txn); + + if (ret) + dev_err(ctrl->dev, "set LA:0x%x failed:ret:%d\n", + laddr, ret); + return ret; +} + +static int slim_get_current_rxbuf(struct qcom_slim_ctrl *ctrl, void *buf) +{ + unsigned long flags; + + spin_lock_irqsave(&ctrl->rx.lock, flags); + if (ctrl->rx.tail == ctrl->rx.head) { + spin_unlock_irqrestore(&ctrl->rx.lock, flags); + return -ENODATA; + } + memcpy(buf, ctrl->rx.base + (ctrl->rx.head * ctrl->rx.sl_sz), + ctrl->rx.sl_sz); + + ctrl->rx.head = (ctrl->rx.head + 1) % ctrl->rx.n; + spin_unlock_irqrestore(&ctrl->rx.lock, flags); + + return 0; +} + +static void qcom_slim_rxwq(struct work_struct *work) +{ + u8 buf[SLIM_MSGQ_BUF_LEN]; + u8 mc, mt, len; + int i, ret; + struct qcom_slim_ctrl *ctrl = container_of(work, struct qcom_slim_ctrl, + wd); + + while ((slim_get_current_rxbuf(ctrl, buf)) != -ENODATA) { + len = SLIM_HEADER_GET_RL(buf[0]); + mt = SLIM_HEADER_GET_MT(buf[0]); + mc = SLIM_HEADER_GET_MC(buf[1]); + if (mt == SLIM_MSG_MT_CORE && + mc == SLIM_MSG_MC_REPORT_PRESENT) { + u8 laddr; + struct slim_eaddr ea; + u8 e_addr[6]; + + for (i = 0; i < 6; i++) + e_addr[i] = buf[7-i]; + + ea.manf_id = (u16)(e_addr[5] << 8) | e_addr[4]; + ea.prod_code = (u16)(e_addr[3] << 8) | e_addr[2]; + ea.dev_index = e_addr[1]; + ea.instance = e_addr[0]; + ret = slim_device_report_present(&ctrl->ctrl, + &ea, &laddr); + if (ret < 0) + dev_err(ctrl->dev, "assign laddr failed:%d\n", + ret); + } else { + dev_err(ctrl->dev, "unexpected message:mc:%x, mt:%x\n", + mc, mt); + } + } +} + +static void qcom_slim_prg_slew(struct platform_device *pdev, + struct qcom_slim_ctrl *ctrl) +{ + struct resource *slew_mem; + + if (!ctrl->slew_reg) { + /* SLEW RATE register for this slimbus */ + slew_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, + "slew"); + ctrl->slew_reg = devm_ioremap(&pdev->dev, slew_mem->start, + resource_size(slew_mem)); + if (!ctrl->slew_reg) + return; + } + + writel_relaxed(1, ctrl->slew_reg); + /* Make sure slimbus-slew rate enabling goes through */ + wmb(); +} + +static int qcom_slim_probe(struct platform_device *pdev) +{ + struct qcom_slim_ctrl *ctrl; + struct slim_controller *sctrl; + struct resource *slim_mem; + int ret, ver; + + ctrl = devm_kzalloc(&pdev->dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) + return -ENOMEM; + + ctrl->hclk = devm_clk_get(&pdev->dev, "iface"); + if (IS_ERR(ctrl->hclk)) + return PTR_ERR(ctrl->hclk); + + ctrl->rclk = devm_clk_get(&pdev->dev, "core"); + if (IS_ERR(ctrl->rclk)) + return PTR_ERR(ctrl->rclk); + + ret = clk_set_rate(ctrl->rclk, SLIM_ROOT_FREQ); + if (ret) { + dev_err(&pdev->dev, "ref-clock set-rate failed:%d\n", ret); + return ret; + } + + ctrl->irq = platform_get_irq(pdev, 0); + if (!ctrl->irq) { + dev_err(&pdev->dev, "no slimbus IRQ\n"); + return -ENODEV; + } + + sctrl = &ctrl->ctrl; + sctrl->dev = &pdev->dev; + ctrl->dev = &pdev->dev; + platform_set_drvdata(pdev, ctrl); + dev_set_drvdata(ctrl->dev, ctrl); + + slim_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ctrl"); + ctrl->base = devm_ioremap_resource(ctrl->dev, slim_mem); + if (!ctrl->base) { + dev_err(&pdev->dev, "IOremap failed\n"); + return -ENOMEM; + } + + sctrl->set_laddr = qcom_set_laddr; + sctrl->xfer_msg = qcom_xfer_msg; + ctrl->tx.n = QCOM_TX_MSGS; + ctrl->tx.sl_sz = SLIM_MSGQ_BUF_LEN; + ctrl->rx.n = QCOM_RX_MSGS; + ctrl->rx.sl_sz = SLIM_MSGQ_BUF_LEN; + ctrl->wr_comp = kzalloc(sizeof(struct completion *) * QCOM_TX_MSGS, + GFP_KERNEL); + if (!ctrl->wr_comp) + return -ENOMEM; + + spin_lock_init(&ctrl->rx.lock); + spin_lock_init(&ctrl->tx.lock); + INIT_WORK(&ctrl->wd, qcom_slim_rxwq); + ctrl->rxwq = create_singlethread_workqueue("qcom_slim_rx"); + if (!ctrl->rxwq) { + dev_err(ctrl->dev, "Failed to start Rx WQ\n"); + return -ENOMEM; + } + + ctrl->framer.rootfreq = SLIM_ROOT_FREQ / 8; + ctrl->framer.superfreq = + ctrl->framer.rootfreq / SLIM_CL_PER_SUPERFRAME_DIV8; + sctrl->a_framer = &ctrl->framer; + sctrl->clkgear = SLIM_MAX_CLK_GEAR; + + qcom_slim_prg_slew(pdev, ctrl); + + ret = devm_request_irq(&pdev->dev, ctrl->irq, qcom_slim_interrupt, + IRQF_TRIGGER_HIGH, "qcom_slim_irq", ctrl); + if (ret) { + dev_err(&pdev->dev, "request IRQ failed\n"); + goto err_request_irq_failed; + } + + ret = clk_prepare_enable(ctrl->hclk); + if (ret) + goto err_hclk_enable_failed; + + ret = clk_prepare_enable(ctrl->rclk); + if (ret) + goto err_rclk_enable_failed; + + ctrl->tx.base = dmam_alloc_coherent(&pdev->dev, + (ctrl->tx.sl_sz * ctrl->tx.n), + &ctrl->tx.phy, GFP_KERNEL); + if (!ctrl->tx.base) { + ret = -ENOMEM; + goto err; + } + + ctrl->rx.base = dmam_alloc_coherent(&pdev->dev, + (ctrl->rx.sl_sz * ctrl->rx.n), + &ctrl->rx.phy, GFP_KERNEL); + if (!ctrl->rx.base) { + ret = -ENOMEM; + goto err; + } + + /* Register with framework before enabling frame, clock */ + ret = slim_register_controller(&ctrl->ctrl); + if (ret) { + dev_err(ctrl->dev, "error adding controller\n"); + goto err; + } + + ver = readl_relaxed(ctrl->base); + /* Version info in 16 MSbits */ + ver >>= 16; + /* Component register initialization */ + writel(1, ctrl->base + CFG_PORT(COMP_CFG, ver)); + writel((EE_MGR_RSC_GRP | EE_NGD_2 | EE_NGD_1), + ctrl->base + CFG_PORT(COMP_TRUST_CFG, ver)); + + writel((MGR_INT_TX_NACKED_2 | + MGR_INT_MSG_BUF_CONTE | MGR_INT_RX_MSG_RCVD | + MGR_INT_TX_MSG_SENT), ctrl->base + MGR_INT_EN); + writel(1, ctrl->base + MGR_CFG); + /* Framer register initialization */ + writel((1 << INTR_WAKE) | (0xA << REF_CLK_GEAR) | + (0xA << CLK_GEAR) | (1 << ROOT_FREQ) | (1 << FRM_ACTIVE) | 1, + ctrl->base + FRM_CFG); + writel(MGR_CFG_ENABLE, ctrl->base + MGR_CFG); + writel(1, ctrl->base + INTF_CFG); + writel(1, ctrl->base + CFG_PORT(COMP_CFG, ver)); + + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_set_autosuspend_delay(&pdev->dev, QCOM_SLIM_AUTOSUSPEND); + pm_runtime_set_active(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + dev_dbg(ctrl->dev, "QCOM SB controller is up:ver:0x%x!\n", ver); + return 0; + +err: + clk_disable_unprepare(ctrl->rclk); +err_rclk_enable_failed: + clk_disable_unprepare(ctrl->hclk); +err_hclk_enable_failed: +err_request_irq_failed: + destroy_workqueue(ctrl->rxwq); + return ret; +} + +static int qcom_slim_remove(struct platform_device *pdev) +{ + struct qcom_slim_ctrl *ctrl = platform_get_drvdata(pdev); + + disable_irq(ctrl->irq); + clk_disable_unprepare(ctrl->hclk); + clk_disable_unprepare(ctrl->rclk); + slim_unregister_controller(&ctrl->ctrl); + destroy_workqueue(ctrl->rxwq); + return 0; +} + +static const struct dev_pm_ops qcom_slim_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(qcom_slim_suspend, qcom_slim_resume) + SET_RUNTIME_PM_OPS( + qcom_slim_runtime_suspend, + qcom_slim_runtime_resume, + NULL + ) +}; + +static const struct of_device_id qcom_slim_dt_match[] = { + { .compatible = "qcom,slim", }, + { .compatible = "qcom,apq8064-slim", }, + {} +}; + +static struct platform_driver qcom_slim_driver = { + .probe = qcom_slim_probe, + .remove = qcom_slim_remove, + .driver = { + .name = "qcom_slim_ctrl", + .of_match_table = qcom_slim_dt_match, + }, +}; +module_platform_driver(qcom_slim_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Qualcomm SLIMBus Controller"); From patchwork Wed Nov 15 14:10:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 118963 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4367829qgn; Wed, 15 Nov 2017 06:15:54 -0800 (PST) X-Google-Smtp-Source: AGs4zMb5LFadqVGtO+8j1Kgh/XOxyFn1oCmxz7eyy457gTcVkHewyHFifsl8pMLXS1h/yOM+ODjB X-Received: by 10.98.233.21 with SMTP id j21mr17557096pfh.97.1510755354436; Wed, 15 Nov 2017 06:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510755354; cv=none; d=google.com; s=arc-20160816; b=yWJqajIeAS/mkKel/YGIEqlZ3BvIkimoUnqDTFPZW+QhFRTJw/izOh1wsdOMzU//NG GARyIeoQH2vLo1mZ7B/rHKxXUhLv8Mmbr9mF9Jzen2zuvoP12IKXr0NxQdIy/+3tqajd 3ZBbJrabyNbfL2x78dVHzC8CwSl0DRY+ilsEmowpS0MebwdbGysk/PsZHYznGkD2GmxR JQibCg+R4erJaH3gxIIIO3ma3HWQ24WFn1fM6bJTnmZwY5RTgpHUOFwuF3PRM3PHdkpI /7VtiFjqW7gYSgIXjiPf6XnW38K3B9uJJ1Nxp0Ev9Bd5Ppy0lWicHcJpy82r+xOjVsTd h9Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=zaaAo1YgM+AAoafTWWL5DOXGcLGynTAkjjPtT+ouCwA=; b=RuQn6AuJA4CdiDgV7WhlKCfP9owuFGuget9oNVUQVmXjA4/JTZbm9sgPoiYNbBaTpk qeYcdRtEktR7/R2VzBLj9HcCaWos2a48gU9lukIoRVEu6CrtY3w1Frz/MIO4lIGw4grk QK8VpmYdtMW07jxRYS2A3NJKtkj5DCFiTT1ytQrNsBMiaKQ6j0MAo4CXAaFKHYYA4JSt 4oy5oMyfKYE+HHkufLsnuzrnO+hiTOMiUAkQqaLec5l45kKjFSR8XdkHnR6O/okSz400 OCLBrpkHcgQQID2V9eUDRemuD4O5E6lVbhK0LZNm77WdMZeWmRl8ZcjI4nhkPGmR3X48 /6Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Nhq3yTP0; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 42si6334793plb.653.2017.11.15.06.15.54; Wed, 15 Nov 2017 06:15:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Nhq3yTP0; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757880AbdKOOPw (ORCPT + 6 others); Wed, 15 Nov 2017 09:15:52 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:45246 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117AbdKOONr (ORCPT ); Wed, 15 Nov 2017 09:13:47 -0500 Received: by mail-wr0-f193.google.com with SMTP id w95so1735997wrc.2 for ; Wed, 15 Nov 2017 06:13:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s0mBC2pikx3jlblHygf61nbF3So2NrCRqEzdS7bISqM=; b=Nhq3yTP0HCJN5SBkAJmrb9Om4X5YFPUHejIOLHcRzoGD2IhSPkmjaKQ5bp1WylcNUs GKVZHt66XorpyPLsseznOcP13HzOr8/aAbLZ7VihlBqRwA94+eydGNzKlY4NRliFeW2E 8fe7gUlLSd36FVEP8kHxJOYIma/+olwHYKkc4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s0mBC2pikx3jlblHygf61nbF3So2NrCRqEzdS7bISqM=; b=DXFQE7hh/yK7J7sm6POnF4RpUTbou/VbKusCCoKXh+fh9k8qVW+7AomFHpG+32S72E ixdGPn7eT/bTihOZ0m9TWSB+1YNdK1LNRu9wO0BgtZd0XkgZSJCkqgklkxs1OLiqsg3A f6iuIAE/PQiUWYwS1PedbixjKwBN/ActzQw03AQrbpXbCjbQKBEMcpsfYTwEVnt5NRTd q0fyH3sNAMJd/a3MtwC4QwuXBshsU97QdkVfvwV0wwvKa8FxYeba0xUcsDCnc4lWmSWU 4xn8MAI1PWAjyNNiTJRKiclsGfo3+khMaI+1nCMJ+MC2ycPmnYvVm80JfQTIa26WyN93 wW5g== X-Gm-Message-State: AJaThX6Cwy4bTQPMZ0ajnZ/9V3sRNmH0dol8dnH6+AYjuqzdi7KwB+mG ADMBrCX+tw/rUf0x8drYQieCcw== X-Received: by 10.223.177.135 with SMTP id q7mr9959019wra.217.1510755226537; Wed, 15 Nov 2017 06:13:46 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id m11sm56707wrf.56.2017.11.15.06.13.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Nov 2017 06:13:45 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org, broonie@kernel.org, alsa-devel@alsa-project.org Cc: sdharia@codeaurora.org, bp@suse.de, poeschel@lemonage.de, treding@nvidia.com, andreas.noever@gmail.com, alan@linux.intel.com, mathieu.poirier@linaro.org, daniel@ffwll.ch, jkosina@suse.cz, sharon.dvir1@mail.huji.ac.il, joe@perches.com, davem@davemloft.net, james.hogan@imgtec.com, michael.opdenacker@free-electrons.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vinod.koul@intel.com, arnd@arndb.de, Srinivas Kandagatla Subject: [PATCH v7 13/13] MAINTAINERS: Add SLIMbus maintainer Date: Wed, 15 Nov 2017 14:10:43 +0000 Message-Id: <20171115141043.29202-14-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> References: <20171115141043.29202-1-srinivas.kandagatla@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Srinivas Kandagatla Add myself as maintainer for slimbus. Signed-off-by: Srinivas Kandagatla Acked-by: Bjorn Andersson --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/MAINTAINERS b/MAINTAINERS index a7995c737728..d4ff3d1f82f1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12347,6 +12347,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git F: include/linux/srcu.h F: kernel/rcu/srcu.c +SERIAL LOW-POWER INTER-CHIP MEDIA BUS (SLIMbus) +M: Srinivas Kandagatla +L: alsa-devel@alsa-project.org (moderated for non-subscribers) +S: Maintained +F: drivers/slimbus/ +F: Documentation/devicetree/bindings/slimbus/ +F: include/linux/slimbus.h + SMACK SECURITY MODULE M: Casey Schaufler L: linux-security-module@vger.kernel.org