From patchwork Thu Nov 30 17:41:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 120261 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp89889qgn; Thu, 30 Nov 2017 09:46:07 -0800 (PST) X-Google-Smtp-Source: AGs4zMYD9dFlUUQo1ewI0xILuKcBp079OHy/01+jfNAWNZtOm2Fehj+8w6PMWGgPDQuiCCyLALCL X-Received: by 10.98.9.79 with SMTP id e76mr7455410pfd.70.1512063967809; Thu, 30 Nov 2017 09:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512063967; cv=none; d=google.com; s=arc-20160816; b=TUxo9IPzfy9BbcdnVRy32JSWxjSpUl/2w8VVXOCCRaj81TRsR7EDFuDmjRgZPhdfdy V2iK6xLdFnDTEqhjvNBRfzeISczjMBAGmtnFd0MpMT6Q9WvdsLV/9Sv0y+Kl+zn6QJXU vZlBqT/6Epgov27mvjMPxv4Kmt47zyLSVcsGcDf8FWrOgq0d8fEtZR1k+0CQiFTZFfyU LfYWyTGDMPdwqLH4CP2/k5aSMCVl8YucmI+7Nwh0754SVWqtp4a27n3/BT8QrRgLA54Y q+TPclchc0BkQxvKlbZDzK9+CDCCZ4+5FR8u+hOtYi7aUlLXl1YKXDznVAuNHdvEj8Fq yyPw== 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=D5RS1pCFHfcsAIAtzLWF96ELHAGl35GLoww5jp7azmk=; b=qQWjsf5nKE/AqK/EokkTGfzbzvu/tJz2hMzJE/WAPI90+MLnjobYV1kSdnkSPWl0PY beMNn9+BXeKVMTVPgOGWkmlRqoqZhCOdIAzQBXMB2L+tKZ/zwiFEOfmC3JDSLwxrujre gLvoXUQvFsAmfjd/2AcnYP16yAVZZI7EKCv/kGJ7litaVveTenVkyKWPm6qzHEP7gmuQ 885tMJGZCagOpqXAnFY1NyWBIAbZsM1zheagJ+meQMdFfmDwLjUk9fL1ePBEiRqslnnn IHcr2jXSEsOHL1uEhdp34ElOtl1US/uvWqKtx+cA0vutV5gDkEBoulKjZVNuGGdh1arS cWcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=L0ortLTu; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 x10si3577916pfk.208.2017.11.30.09.46.07; Thu, 30 Nov 2017 09:46:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=L0ortLTu; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1753941AbdK3RqE (ORCPT + 10 others); Thu, 30 Nov 2017 12:46:04 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:44847 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753934AbdK3RqC (ORCPT ); Thu, 30 Nov 2017 12:46:02 -0500 Received: by mail-wr0-f193.google.com with SMTP id l22so7446911wrc.11 for ; Thu, 30 Nov 2017 09:46:01 -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=RYZkYlyya4ZD2MALaqdGFaSKYvHiBIqzgU2e1qveQQ4=; b=L0ortLTucfFOHdMMZkhd63roAOuyNjxI+7ZLuRHyvZ93Z03d6tO7jWHYIUG3WsVceu Ry3wJYljwp2+j1kwKc+SrSCKKe5PGnid3tu4A3S460qAGlogyhsoWLplp5pr7bVJxzgz nhuznQzTHOJoYunAfyZiydycMtWhQFq6feEfk= 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=RYZkYlyya4ZD2MALaqdGFaSKYvHiBIqzgU2e1qveQQ4=; b=YFF+mI2IXGz1A0QUChaKPZ0YI26af60Rb0itDysaSIf3F4iEd4wAtrpXdr3aGg9K1a xugQMMuXr3EZnvRgIu8rCmqoTr+ewrn/9cj0CbpvzgvSbkT5FINxQjryLrIswOdFKeW2 LEbpFaiTeYXGKaHXJfpCYbpvWxuFil596vwMh8jepdqKneiFwawYNT916S7vhnDsrCVM ItePms84N6Y70iaX9GKKVIfgtJ/iCO06W3nDoB5ZFbn4BjVUThWv8QRyGmDpSp4PHj6N KzdxCsibH3A5cxnYuxvEzEKLpFbzXPTy7nPOnwZAmbinvexnov00m1BnfhKy5+fiqS0K Fw5w== X-Gm-Message-State: AJaThX4/0fbOpwZkUDp5R5aYdY1piBsie1RgKhXtNc0xXwlw9h8Tngs0 hk0K+wO2jbxrqnchL95KwbI5bA== X-Received: by 10.223.144.41 with SMTP id h38mr2842408wrh.228.1512063960845; Thu, 30 Nov 2017 09:46:00 -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 189sm2412189wmu.3.2017.11.30.09.45.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Nov 2017 09:46:00 -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@linaro.org Subject: [PATCH v8 08/13] regmap: add SLIMbus support Date: Thu, 30 Nov 2017 17:41:55 +0000 Message-Id: <20171130174200.6684-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> References: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Srinivas Kandagatla This patch adds support to read/write SLIMbus value elements. Currently it only supports byte read/write. Adding this support in regmap would give codec drivers more flexibility when there are more than 2 control interfaces like SLIMbus, i2c. Without this patch each codec driver has to directly call SLIMbus value element apis, and this could would get messy once we want to add i2c interface to it. Signed-off-by: Srinivas Kandagatla --- drivers/base/regmap/Kconfig | 4 ++ drivers/base/regmap/Makefile | 1 + drivers/base/regmap/regmap-slimbus.c | 89 ++++++++++++++++++++++++++++++++++++ include/linux/regmap.h | 18 ++++++++ 4 files changed, 112 insertions(+) create mode 100644 drivers/base/regmap/regmap-slimbus.c -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/base/regmap/Kconfig b/drivers/base/regmap/Kconfig index 3a1535d812d8..cc162b48c6d7 100644 --- a/drivers/base/regmap/Kconfig +++ b/drivers/base/regmap/Kconfig @@ -21,6 +21,10 @@ config REGMAP_I2C tristate depends on I2C +config REGMAP_SLIMBUS + tristate + depends on SLIMBUS + config REGMAP_SPI tristate depends on SPI diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile index 0d298c446108..63dec9222892 100644 --- a/drivers/base/regmap/Makefile +++ b/drivers/base/regmap/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o +obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o obj-$(CONFIG_REGMAP_SPMI) += regmap-spmi.o obj-$(CONFIG_REGMAP_MMIO) += regmap-mmio.o diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c new file mode 100644 index 000000000000..d0dab1c5b663 --- /dev/null +++ b/drivers/base/regmap/regmap-slimbus.c @@ -0,0 +1,89 @@ +/* + * Register map access API - SLIMbus support + * + * Copyright 2017 Linaro Inc + * + * Author: Srinivas Kandagatla + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include + +#include "internal.h" + +static int regmap_slimbus_byte_reg_read(void *context, unsigned int reg, + unsigned int *val) +{ + struct slim_device *sdev = context; + int v; + + v = slim_readb(sdev, reg); + + if (v < 0) + return v; + + *val = v; + + return 0; +} + +static int regmap_slimbus_byte_reg_write(void *context, unsigned int reg, + unsigned int val) +{ + struct slim_device *sdev = context; + + return slim_writeb(sdev, reg, val); +} + +static struct regmap_bus regmap_slimbus_bus = { + .reg_write = regmap_slimbus_byte_reg_write, + .reg_read = regmap_slimbus_byte_reg_read, + .reg_format_endian_default = REGMAP_ENDIAN_LITTLE, + .val_format_endian_default = REGMAP_ENDIAN_LITTLE, +}; + +static const struct regmap_bus *regmap_get_slimbus(struct slim_device *slim, + const struct regmap_config *config) +{ + if (config->val_bits == 8 && config->reg_bits == 8) + return ®map_slimbus_bus; + + return ERR_PTR(-ENOTSUPP); +} + +struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, + const struct regmap_config *config, + struct lock_class_key *lock_key, + const char *lock_name) +{ + const struct regmap_bus *bus = regmap_get_slimbus(slimbus, config); + + if (IS_ERR(bus)) + return ERR_CAST(bus); + + return __regmap_init(&slimbus->dev, bus, &slimbus->dev, config, + lock_key, lock_name); +} +EXPORT_SYMBOL_GPL(__regmap_init_slimbus); + +struct regmap *__devm_regmap_init_slimbus(struct slim_device *slimbus, + const struct regmap_config *config, + struct lock_class_key *lock_key, + const char *lock_name) +{ + const struct regmap_bus *bus = regmap_get_slimbus(slimbus, config); + + if (IS_ERR(bus)) + return ERR_CAST(bus); + + return __devm_regmap_init(&slimbus->dev, bus, &slimbus, config, + lock_key, lock_name); +} +EXPORT_SYMBOL_GPL(__devm_regmap_init_slimbus); + +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 15eddc1353ba..b2207737a159 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -24,6 +24,7 @@ struct module; struct device; struct i2c_client; struct irq_domain; +struct slim_device; struct spi_device; struct spmi_device; struct regmap; @@ -499,6 +500,10 @@ struct regmap *__regmap_init_i2c(struct i2c_client *i2c, const struct regmap_config *config, struct lock_class_key *lock_key, const char *lock_name); +struct regmap *__regmap_init_slimbus(struct slim_device *slimbus, + const struct regmap_config *config, + struct lock_class_key *lock_key, + const char *lock_name); struct regmap *__regmap_init_spi(struct spi_device *dev, const struct regmap_config *config, struct lock_class_key *lock_key, @@ -615,6 +620,19 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, __regmap_lockdep_wrapper(__regmap_init_i2c, #config, \ i2c, config) +/** + * regmap_init_slimbus() - Initialise register map + * + * @slimbus: Device that will be interacted with + * @config: Configuration for register map + * + * The return value will be an ERR_PTR() on error or a valid pointer to + * a struct regmap. + */ +#define regmap_init_slimbus(slimbus, config) \ + __regmap_lockdep_wrapper(__regmap_init_slimbus, #config, \ + slimbus, config) + /** * regmap_init_spi() - Initialise register map * From patchwork Thu Nov 30 17:41:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 120269 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp91143qgn; Thu, 30 Nov 2017 09:47:17 -0800 (PST) X-Google-Smtp-Source: AGs4zMY8hxEHah1090qVlziMZqMRmCcCpSVDlx532SUNHRjGR5eFMoyyWMAtj7o7+LV9Iu5i5iNQ X-Received: by 10.101.67.71 with SMTP id k7mr3059529pgq.20.1512064037693; Thu, 30 Nov 2017 09:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512064037; cv=none; d=google.com; s=arc-20160816; b=Br0qVePAzkLJXOFo++Hu1ir6ZoSPSE9CiBzsYTxJN/q9U08Ggt9TRLjfTrYePk6/Lf 5pU+Ql8A4asRJJyZRaQcNaXHgaWMXdzESXAGCWzOKd5h5Voqhve/Sf1hClxUcBJq95TB wdUwHj5tLioY/pU1K1DQp61RFGuuuHhxGLZuYosY4xvPZW3+IV5uTmZmOndvYNF0qT8I AycS1lmmjuaEK4iTmWVVHd0/68ravhAq84hWYs6DgS/p+Yqzqp2P9WEMgjs7A9B5AkXA mUs5mSKmKcn6ZoMHCSfUFh9MVI8XjWbFxKLK8OSPjns0ZJvsAnz+C3Uyw+ildHGUWpBL W5AA== 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=o9oNm3P3o5yBklWy3JUwOVK4WBrdO6+7TZRT1O8jq0c=; b=QH0XKXgOo9duHSTKY6IYHSI69QCKkmbYVAo0Ra1uwFPspA3zzTgr4gfYhlyHYGWWkw r/SeGYbqZ0DyuqTh/dHUbwPp68T+eAvyKgnGLQgvKTsscr2AooTdfhc10N1UXkxAqcFK 7sxoiZZe+07C6amx2DOrSTsOFyPDTMIfwqZZvc+IQ2rcVyjG5TVjnx1hmDyyh24roffi 2f+r3jO2buBLkTgzkqzRsBvz1WhqcW+XDS7aSIUdP9kJ3eno2GYFeDFnlwGOnJhT1UOI MHsXSBaQfl5frxzaD6191S36gncKxraNpYFXaLMSrnPC2MY4TW3RxHBHZRKtj/h1km6w snBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eW3GW7RH; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 i81si3587894pfj.329.2017.11.30.09.47.17; Thu, 30 Nov 2017 09:47:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=eW3GW7RH; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1753971AbdK3RqH (ORCPT + 10 others); Thu, 30 Nov 2017 12:46:07 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:38953 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753940AbdK3RqD (ORCPT ); Thu, 30 Nov 2017 12:46:03 -0500 Received: by mail-wm0-f67.google.com with SMTP id i11so13903329wmf.4 for ; Thu, 30 Nov 2017 09:46:03 -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=FnTdtJB5+keQn9t5XzLsh0o6l64d0Ikm14LV7p59dlc=; b=eW3GW7RHP6BvXAB71paApfS7ycD3dxcyZ/ZLlcWpnP8DVFrQKKtWlnQc60Fcj12kvT UxBK6HAdj1FYrPD0neYR/5jz80SAhtXstfNG+XGzTBxxiFB5iwHXSf6dmrg1ASrpbgW8 yHTU8T9uCrPkUXq9DKIiGSyR7CX1Ks2iXxo9A= 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=FnTdtJB5+keQn9t5XzLsh0o6l64d0Ikm14LV7p59dlc=; b=m12+LXmFpNCSAb1kD/jbEavhNEIsHQlnjh+2YAS3kDElSiTE2P6oLiPv03+m8mokfi EB2l0FU7JxPQdhkNuUUroldcmoVd2Nhzd57u4OGwKQPYN7hAL40CacdMknx8nkO/lFh2 NFpEMMZ152d2VixjkLRQAcd6zVd0RxAVi3aFBS1V7ka3T2dgB17c0SOWiXuNDNHNB0wL mGSvxtG7V/AIP7PCbdGdOx1UfjeNjShm66RsP9eWxen/EaGFrZqZHv1VXqmo1s6bffLl lPq5g0sM7Vt/dgIV/vGYsvLxMmlIVQ+mrneyL1KWgK12bn5RcqgnS0qz/xbLNzyZUmK0 sR4g== X-Gm-Message-State: AJaThX4QDJIvK0nJUSDBp4UNPvSZnUCkR+H6yJC2qgfgerWByEiLiVii 4ZMV7J3URPr7NHzIxV4xba9JPw== X-Received: by 10.28.216.212 with SMTP id p203mr1308087wmg.50.1512063962399; Thu, 30 Nov 2017 09:46:02 -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 189sm2412189wmu.3.2017.11.30.09.46.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Nov 2017 09:46:01 -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@linaro.org Subject: [PATCH v8 09/13] slimbus: core: add common defines required for controllers Date: Thu, 30 Nov 2017 17:41:56 +0000 Message-Id: <20171130174200.6684-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> References: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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 e0ae7bb1ba47..d278c951ddbf 100644 --- a/drivers/slimbus/slimbus.h +++ b/drivers/slimbus/slimbus.h @@ -18,9 +18,38 @@ #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 + /* Clock pause Reconfiguration messages */ #define SLIM_MSG_MC_BEGIN_RECONFIGURATION 0x40 #define SLIM_MSG_MC_NEXT_PAUSE_CLOCK 0x4A @@ -101,6 +130,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 Thu Nov 30 17:41:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 120270 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp91230qgn; Thu, 30 Nov 2017 09:47:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMYy1+wRgVKietRRh7e41hQm3mktR8lYYXCEXalinG/Ri1H/Kl50AYXvkvwLgJ+54+KBhYYH X-Received: by 10.99.166.18 with SMTP id t18mr3129718pge.252.1512064041878; Thu, 30 Nov 2017 09:47:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512064041; cv=none; d=google.com; s=arc-20160816; b=v6I8owCsdUoCztKN4Cmucifb6DYWba7VH8G04yGu4PuqWxfdWJvmY5lgfWSymzJdOg WZnDZxAAKl6Wlcx7lUwX5BeRJQbh5hMd8TvjAz4tAO436H3Wv36NKcnasvN/Jn85DAwP q6KGBWAfglDb3hej+UP36q2FMwotiFw/y8j/UXxaAGoadkgtc0oy13U8CDZukw2nAoiL zvklk2b9bbd/nnS5zlkuwrWfS7QfMNRO+9c0sK4ZiMBjed6SyQ7pgCgMmt6btx8Qurg0 9/nwcXaCAdU4Z22Gvtriv+sQMJHPxxIYFPerynHTpPPCtzkxOavWS/qdILph+2uYp2RV WmGw== 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=qqzPLG2/fUSKiLGIkb/u3pSiL87iwAAT1+6t3963pYo=; b=N6WgeVHw238KYzdIZWZTiH5LBa6ajLsIvBzinBtWkGfyb9618RjlPa8hk/IJhlY/AX 0X4XrxCIzHoACo6uRs/fWD1b1mAjF4aj15sn8BW7/SDD1nJyYm7Z2jEHQunUf4zCUESC spYCsz4BDmRuNNkOg245PCpOhoKE45FpP1oYoIMbn0Ju7DWwAYmj4F8tL5iUosJOc4mh PsRf1nQ0nzaqqvPPHIf35HQGkLyEVsCM2qZsMuHGbw65kvsN6kZx9xbH7jt7dNZaCoed KTBs18vJCTaKKlvZDS1wEnseYWojlgghIhlDqH9MDucsiXAxuZOykp5qIbdOzYWWiGqz ODPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HRRawUX3; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 i81si3587894pfj.329.2017.11.30.09.47.21; Thu, 30 Nov 2017 09:47:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=HRRawUX3; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1752275AbdK3RrT (ORCPT + 10 others); Thu, 30 Nov 2017 12:47:19 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38004 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753946AbdK3RqF (ORCPT ); Thu, 30 Nov 2017 12:46:05 -0500 Received: by mail-wr0-f194.google.com with SMTP id o2so7447705wro.5 for ; Thu, 30 Nov 2017 09:46:04 -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=wFm2PTXiDikvf7+6i7NoW+lefuZ4ADFLowqMzTJyCTU=; b=HRRawUX3aqzFaQTIS8jiQc/U7BvZ3BEuLK8UtcbKwCJ3UKxvuxRDqDWuR5kOzh2DsI 0+Y+eODOOd3fdiJUN/F+yvXbRCud44pnAxzgY76JrrIWY+pqozUytKG3/F9be5QYxEuP dwBJ4X1YJNx8HI2/4gh/tBsgYHIbg0srSFMRE= 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=wFm2PTXiDikvf7+6i7NoW+lefuZ4ADFLowqMzTJyCTU=; b=FhpC9EsEdlh7nqCp+GWy4cdsnV/xDMUySJjb5ZLoLCdJKEM3xbt3jLbL2ObGIDrzKd cTdWUePTL08c32G/CwODSVSgDUDwmqJS+K3wbDHjGggvAaJh90o1k7sM0X7Xk/FkdoiL zlzn7lnGS589Wg56K1DN0jzhCJQxjAeYJhsdR7nTBLdSpC1HexIfVJ6lnZdPcQlPfy21 O7EvBBImt6td40ve57XdJb+7Bzf78nw74+RhIkDwl74AaR6hI4HnMRYGelWrUonrPtnB l4xkejB+Tbc+NJ1/OEk5YyPbNppw7Iazmht2EHN0m2xtEAsi26tEeTSqjPOs0fIwT60L PChg== X-Gm-Message-State: AJaThX6Odt75j7woKgkY1+z2bQe2xT9lmKJo4kzwwC/nx/pTW4BgVl6x ZgMXUHIZzGK91xMU+aiovZpXYA== X-Received: by 10.223.169.68 with SMTP id u62mr2739046wrc.30.1512063963995; Thu, 30 Nov 2017 09:46:03 -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 189sm2412189wmu.3.2017.11.30.09.46.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 30 Nov 2017 09:46:03 -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@linaro.org Subject: [PATCH v8 10/13] dt-bindings: Add qcom slimbus controller bindings Date: Thu, 30 Nov 2017 17:41:57 +0000 Message-Id: <20171130174200.6684-11-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> References: <20171130174200.6684-1-srinivas.kandagatla@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Sagar Dharia This patch add device tree bindings for Qualcomm slimbus controller. Signed-off-by: Sagar Dharia Signed-off-by: Srinivas Kandagatla --- .../devicetree/bindings/slimbus/slim-qcom-ctrl.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/slimbus/slim-qcom-ctrl.txt -- 2.15.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/devicetree/bindings/slimbus/slim-qcom-ctrl.txt b/Documentation/devicetree/bindings/slimbus/slim-qcom-ctrl.txt new file mode 100644 index 000000000000..93a6fdaf09b3 --- /dev/null +++ b/Documentation/devicetree/bindings/slimbus/slim-qcom-ctrl.txt @@ -0,0 +1,39 @@ +Qualcomm SLIMbus controller +This controller is used if applications processor driver controls SLIMbus +master component. + +Required properties: + + - #address-cells - refer to Documentation/devicetree/bindings/slimbus/bus.txt + - #size-cells - refer to Documentation/devicetree/bindings/slimbus/bus.txt + + - reg : Offset and length of the register region(s) for the device + - reg-names : Register region name(s) referenced in reg above + Required register resource entries are: + "ctrl": Physical address of controller register blocks + "slew": required for "qcom,apq8064-slim" SOC. + - compatible : should be "qcom,-slim" for SOC specific compatible + followed by "qcom,slim" for fallback. + - interrupts : Interrupt number used by this controller + - clocks : Interface and core clocks used by this SLIMbus controller + - clock-names : Required clock-name entries are: + "iface_clk" : Interface clock for this controller + "core_clk" : Interrupt for controller core's BAM + +Example: + + slim@28080000 { + compatible = "qcom,apq8064-slim", "qcom,slim"; + reg = <0x28080000 0x2000>, <0x80207C 4>; + reg-names = "ctrl", "slew"; + interrupts = <0 33 0>; + clocks = <&lcc SLIMBUS_SRC>, <&lcc AUDIO_SLIMBUS_CLK>; + clock-names = "iface", "core"; + #address-cells = <2>; + #size-cell = <0>; + + wcd9310: audio-codec@1,0{ + compatible = "slim217,60"; + reg = <1 0>; + }; + };