Devicetree
 help / color / mirror / Atom feed
* [PATCH 1/7] soc: mediatek: Add USB wakeup driver
From: Chunfeng Yun @ 2017-12-09  8:45 UTC (permalink / raw)
  To: Rob Herring, Felipe Balbi, Matthias Brugger, Mathias Nyman
  Cc: Mark Rutland, Greg Kroah-Hartman, Catalin Marinas, Will Deacon,
	Chunfeng Yun, Jean Delvare, Sean Wang,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <1512809136-2779-1-git-send-email-chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>

This driver is used to support usb wakeup which is controlled by
the glue layer between SSUSB and SPM. Usually the glue layer is put
into a system controller, such as pericfg module, which is
represented by a syscon node in DTS.
Due to the glue layer may vary on different SoCs, it's useful to
extract a separated driver to simplify usb controller drivers.

Signed-off-by: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
 drivers/soc/mediatek/Kconfig                  |   8 +
 drivers/soc/mediatek/Makefile                 |   1 +
 drivers/soc/mediatek/mtk-usb-wakeup.c         | 519 ++++++++++++++++++++++++++
 include/dt-bindings/soc/mediatek,usb-wakeup.h |  15 +
 include/linux/soc/mediatek/usb-wakeup.h       |  88 +++++
 5 files changed, 631 insertions(+)
 create mode 100644 drivers/soc/mediatek/mtk-usb-wakeup.c
 create mode 100644 include/dt-bindings/soc/mediatek,usb-wakeup.h
 create mode 100644 include/linux/soc/mediatek/usb-wakeup.h

diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index a7d0667..30cd226 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -31,4 +31,12 @@ config MTK_SCPSYS
 	  Say yes here to add support for the MediaTek SCPSYS power domain
 	  driver.
 
+config MTK_UWK
+	bool "MediaTek USB Wakeup Support"
+	select REGMAP
+	help
+	  Say yes here to add support for the MediaTek SSUSB-SPM glue layer
+	  which supports some different type of USB wakeup, such as IP-SLEEP,
+	  LINESTATE, IDDIG etc, and it can support multi SSUSB controllers.
+
 endmenu
diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
index 12998b0..66fbb54f 100644
--- a/drivers/soc/mediatek/Makefile
+++ b/drivers/soc/mediatek/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
 obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
 obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
+obj-$(CONFIG_MTK_UWK) += mtk-usb-wakeup.o
diff --git a/drivers/soc/mediatek/mtk-usb-wakeup.c b/drivers/soc/mediatek/mtk-usb-wakeup.c
new file mode 100644
index 0000000..16539a6
--- /dev/null
+++ b/drivers/soc/mediatek/mtk-usb-wakeup.c
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ */
+
+#include <dt-bindings/soc/mediatek,usb-wakeup.h>
+#include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+#include <linux/soc/mediatek/usb-wakeup.h>
+
+/* mt8173, mt8176 etc */
+#define PERI_WK_CTRL1	0x4
+#define WC1_IS_C(x)	(((x) & 0xf) << 26) /* cycle debounce */
+#define WC1_IS_EN	BIT(25)
+#define WC1_IS_P	BIT(6)  /* polarity for ip sleep */
+
+/* mt2712 etc */
+#define PERI_SSUSB_SPM_CTRL	0x0
+#define SSC_LINE_STATE_CHG	GENMASK(11, 8)
+#define SSC_LINE_STATE_EN	GENMASK(6, 5)
+#define SSC_IP_SLEEP_EN	BIT(4)
+#define SSC_SPM_INT_EN		BIT(1)
+
+enum mtk_uwk_vers {
+	MTK_UWK_V1 = 1,
+	MTK_UWK_V2,
+};
+
+struct mtk_uwk_pdata {
+	enum mtk_uwk_vers vers;
+};
+
+/**
+ * @reg_base: register offset within a syscon @wkc (e.g. pericfg module)
+ * @type: the types of wakeup, such as IP-SLEEP, LINE-STATE etc
+ */
+struct mtk_uwk_instance {
+	struct mtu_wakeup uwk;
+	u32 reg_base;
+	u32 reg_len;
+	u32 type;
+};
+
+struct mtk_uwk {
+	struct device *dev;
+	struct regmap *wkc;
+	const struct mtk_uwk_pdata *data;
+	struct mtk_uwk_instance **inst;
+	int num_inst;
+};
+
+static LIST_HEAD(of_uwk_providers);
+static DEFINE_MUTEX(of_uwk_mutex);
+
+static struct mtu_wakeup_provider *of_uwk_provider_add(struct device *dev,
+		struct mtu_wakeup *(*of_xlate)(struct device *dev,
+		struct of_phandle_args *args))
+{
+	struct mtu_wakeup_provider *provider;
+
+	provider = kzalloc(sizeof(*provider), GFP_KERNEL);
+	if (!provider)
+		return ERR_PTR(-ENOMEM);
+
+	provider->dev = dev;
+	provider->of_node = of_node_get(dev->of_node);
+	provider->of_xlate = of_xlate;
+
+	mutex_lock(&of_uwk_mutex);
+	list_add_tail(&provider->list, &of_uwk_providers);
+	mutex_unlock(&of_uwk_mutex);
+
+	return provider;
+}
+
+static void of_uwk_provider_del(struct device_node *np)
+{
+	struct mtu_wakeup_provider *provider;
+
+	mutex_lock(&of_uwk_mutex);
+	list_for_each_entry(provider, &of_uwk_providers, list) {
+		if (provider->of_node == np) {
+			list_del(&provider->list);
+			of_node_put(provider->of_node);
+			kfree(provider);
+			break;
+		}
+	}
+	mutex_unlock(&of_uwk_mutex);
+}
+
+static struct mtu_wakeup *of_uwk_get_from_provider(
+		struct of_phandle_args *args)
+{
+	struct mtu_wakeup_provider *provider;
+	struct device_node *child_np;
+	struct mtu_wakeup *uwk;
+
+	mutex_lock(&of_uwk_mutex);
+	list_for_each_entry(provider, &of_uwk_providers, list) {
+		for_each_child_of_node(provider->of_node, child_np) {
+			if (child_np == args->np) {
+				uwk = provider->of_xlate(provider->dev, args);
+				mutex_unlock(&of_uwk_mutex);
+				return uwk;
+			}
+		}
+	}
+	mutex_unlock(&of_uwk_mutex);
+
+	return ERR_PTR(-EPROBE_DEFER);
+}
+
+static struct mtu_wakeup *of_uwk_get(struct device_node *np, int index)
+{
+	struct mtu_wakeup *uwk = NULL;
+	struct of_phandle_args args;
+	int ret;
+
+	ret = of_parse_phandle_with_args(np, "mediatek,uwks",
+				"#mediatek,uwk-cells", index, &args);
+	if (ret)
+		return ERR_PTR(-ENODEV);
+
+	if (!of_device_is_available(args.np)) {
+		dev_warn(uwk->parent, "Requested uwk is disabled\n");
+		uwk = ERR_PTR(-ENODEV);
+		goto put_node;
+	}
+
+	uwk = of_uwk_get_from_provider(&args);
+
+put_node:
+	of_node_put(args.np);
+	return uwk;
+}
+
+static void devm_uwk_release(struct device *dev, void *res)
+{
+	struct mtu_wakeup *uwk = *(struct mtu_wakeup **)res;
+
+	if (IS_ERR_OR_NULL(uwk))
+		return;
+
+	module_put(uwk->ops->owner);
+	put_device(uwk->parent);
+}
+
+struct mtu_wakeup *devm_of_uwk_get_by_index(
+		struct device *dev, struct device_node *np, int index)
+{
+	struct mtu_wakeup **ptr, *uwk;
+
+	ptr = devres_alloc(devm_uwk_release, sizeof(*ptr), GFP_KERNEL);
+	if (!ptr)
+		return ERR_PTR(-ENOMEM);
+
+	uwk = of_uwk_get(np, index);
+	if (IS_ERR(uwk)) {
+		devres_free(ptr);
+		return uwk;
+	}
+
+	if (!try_module_get(uwk->ops->owner)) {
+		devres_free(ptr);
+		return ERR_PTR(-EPROBE_DEFER);
+	}
+
+	get_device(uwk->parent);
+
+	*ptr = uwk;
+	devres_add(dev, ptr);
+
+	return uwk;
+}
+EXPORT_SYMBOL_GPL(devm_of_uwk_get_by_index);
+
+int mtu_wakeup_enable(struct mtu_wakeup *uwk)
+{
+	int ret = 0;
+
+	if (!uwk)
+		return 0;
+
+	mutex_lock(&uwk->mutex);
+	if (uwk->count == 0 && uwk->ops->enable) {
+		ret = uwk->ops->enable(uwk);
+		if (ret) {
+			dev_err(uwk->parent, "uwk enable failed(%d)\n", ret);
+			goto out;
+		}
+	}
+	++uwk->count;
+
+out:
+	mutex_unlock(&uwk->mutex);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(mtu_wakeup_enable);
+
+int mtu_wakeup_disable(struct mtu_wakeup *uwk)
+{
+	int ret = 0;
+
+	if (!uwk)
+		return 0;
+
+	mutex_lock(&uwk->mutex);
+	if (uwk->count == 1 && uwk->ops->disable) {
+		ret =  uwk->ops->disable(uwk);
+		if (ret) {
+			dev_err(uwk->parent, "uwk disable failed(%d)\n", ret);
+			goto out;
+		}
+	}
+	--uwk->count;
+
+out:
+	mutex_unlock(&uwk->mutex);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(mtu_wakeup_disable);
+
+static struct mtk_uwk_instance *to_mwk_inst(struct mtu_wakeup *uwk)
+{
+	return uwk ? container_of(uwk, struct mtk_uwk_instance, uwk) : NULL;
+}
+
+static int mwk_v1_enable(struct mtk_uwk *mwk, struct mtk_uwk_instance *inst)
+{
+	struct regmap *wkc = mwk->wkc;
+	u32 val;
+
+	/* Only IP-SLEEP is supported */
+	if (inst->type != MTU_WK_IP_SLEEP)
+		return 0;
+
+	regmap_read(wkc, PERI_WK_CTRL1, &val);
+	val &= ~(WC1_IS_P | WC1_IS_C(0xf));
+	val |= WC1_IS_EN | WC1_IS_C(0x8);
+	regmap_write(wkc, PERI_WK_CTRL1, val);
+	regmap_read(wkc, PERI_WK_CTRL1, &val);
+	dev_dbg(mwk->dev, "%s: WK_CTRL1=%#x, type=%d\n",
+		__func__, val, inst->type);
+
+	return 0;
+}
+
+static int mwk_v1_disable(struct mtk_uwk *mwk, struct mtk_uwk_instance *inst)
+{
+	if (inst->type == MTU_WK_IP_SLEEP)
+		regmap_update_bits(mwk->wkc, PERI_WK_CTRL1, WC1_IS_EN, 0);
+
+	return 0;
+}
+
+static int mwk_v2_enable(struct mtk_uwk *mwk, struct mtk_uwk_instance *inst)
+{
+	struct regmap *wkc = mwk->wkc;
+	u32 rbase = inst->reg_base;
+	u32 val;
+
+	regmap_read(wkc, rbase + PERI_SSUSB_SPM_CTRL, &val);
+	switch (inst->type) {
+	case MTU_WK_IP_SLEEP:
+		val |= SSC_IP_SLEEP_EN;
+		break;
+	case MTU_WK_LINE_STATE:
+		val |= SSC_LINE_STATE_EN | SSC_LINE_STATE_CHG;
+		break;
+	default:
+		/* checked by xlate, ignore the error */
+		break;
+	}
+	val |= SSC_SPM_INT_EN;
+	regmap_write(wkc, rbase + PERI_SSUSB_SPM_CTRL, val);
+	regmap_read(wkc, rbase + PERI_SSUSB_SPM_CTRL, &val);
+	dev_dbg(mwk->dev, "%s: CTRL=%#x, type=%d\n",
+		__func__, val, inst->type);
+
+	return 0;
+}
+
+static int mwk_v2_disable(struct mtk_uwk *mwk, struct mtk_uwk_instance *inst)
+{
+	struct regmap *wkc = mwk->wkc;
+	u32 rbase = inst->reg_base;
+	u32 val;
+
+	regmap_read(wkc, rbase + PERI_SSUSB_SPM_CTRL, &val);
+	switch (inst->type) {
+	case MTU_WK_IP_SLEEP:
+		val &= ~SSC_IP_SLEEP_EN;
+		break;
+	case MTU_WK_LINE_STATE:
+		val &= ~(SSC_LINE_STATE_EN | SSC_LINE_STATE_CHG);
+		break;
+	default:
+		break;
+	}
+	val &= ~SSC_SPM_INT_EN;
+	regmap_write(wkc, rbase + PERI_SSUSB_SPM_CTRL, val);
+	dev_dbg(mwk->dev, "%s: type=%d\n", __func__, inst->type);
+
+	return 0;
+}
+
+static int mwk_enable(struct mtu_wakeup *uwk)
+{
+	struct mtk_uwk_instance *inst = to_mwk_inst(uwk);
+	struct mtk_uwk *mwk = dev_get_drvdata(uwk->parent);
+	int ret = 0;
+
+	switch (mwk->data->vers) {
+	case MTK_UWK_V1:
+		ret = mwk_v1_enable(mwk, inst);
+		break;
+	case MTK_UWK_V2:
+		ret = mwk_v2_enable(mwk, inst);
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
+static int mwk_disable(struct mtu_wakeup *uwk)
+{
+	struct mtk_uwk_instance *inst = to_mwk_inst(uwk);
+	struct mtk_uwk *mwk = dev_get_drvdata(uwk->parent);
+	int ret = 0;
+
+	switch (mwk->data->vers) {
+	case MTK_UWK_V1:
+		ret = mwk_v1_disable(mwk, inst);
+		break;
+	case MTK_UWK_V2:
+		ret = mwk_v2_disable(mwk, inst);
+		break;
+	default:
+		break;
+	}
+	return ret;
+}
+
+static struct mtk_uwk_instance *mwk_inst_create(struct device *dev,
+		struct device_node *np,
+		const struct mtu_wakeup_ops *ops)
+{
+	struct mtk_uwk_instance *inst;
+	struct mtu_wakeup *uwk;
+	u32 buf[2];
+	int ret;
+
+	inst = devm_kzalloc(dev, sizeof(*inst), GFP_KERNEL);
+	if (!inst)
+		return ERR_PTR(-ENOMEM);
+
+	ret = of_property_read_u32_array(np, "reg", buf, ARRAY_SIZE(buf));
+	if (ret) {
+		dev_err(dev, "fail to read reg\n");
+		return ERR_PTR(ret);
+	}
+
+	inst->reg_base = buf[0];
+	inst->reg_len = buf[1];
+	uwk = &inst->uwk;
+	uwk->node = np;
+	uwk->ops = ops;
+	uwk->parent = dev;
+	mutex_init(&uwk->mutex);
+	dev_dbg(dev, "reg: %#x/%#x\n", inst->reg_base, inst->reg_len);
+
+	return inst;
+}
+
+static struct mtu_wakeup *mwk_xlate(struct device *dev,
+		struct of_phandle_args *args)
+{
+	struct mtk_uwk *mwk = dev_get_drvdata(dev);
+	struct mtk_uwk_instance *inst = NULL;
+	struct device_node *uwk_np = args->np;
+	int index;
+
+	if (args->args_count != 1) {
+		dev_err(dev, "invalid number of cells in uwk property\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	for (index = 0; index < mwk->num_inst; index++)
+		if (uwk_np == mwk->inst[index]->uwk.node) {
+			inst = mwk->inst[index];
+			break;
+		}
+
+	if (!inst) {
+		dev_err(dev, "failed to find appropriate uwk\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	inst->type = args->args[0];
+	if (!(inst->type == MTU_WK_IP_SLEEP ||
+	      inst->type == MTU_WK_LINE_STATE)) {
+		dev_err(dev, "unsupported uwk type=%d\n", inst->type);
+		return ERR_PTR(-EINVAL);
+	}
+
+	return &inst->uwk;
+}
+
+static const struct mtu_wakeup_ops mwk_ops = {
+	.enable = mwk_enable,
+	.disable = mwk_disable,
+	.owner = THIS_MODULE,
+};
+
+static const struct mtk_uwk_pdata mwk_v1_pdata = {
+	.vers = MTK_UWK_V1,
+};
+
+static const struct mtk_uwk_pdata mwk_v2_pdata = {
+	.vers = MTK_UWK_V2,
+};
+
+static const struct of_device_id mwk_id_table[] = {
+	{ .compatible = "mediatek,usb-wk-v1", .data = &mwk_v1_pdata },
+	{ .compatible = "mediatek,usb-wk-v2", .data = &mwk_v2_pdata },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, mwk_id_table);
+
+static int mtk_uwk_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct device_node *child_np;
+	struct mtu_wakeup_provider *provider;
+	struct mtk_uwk *mwk;
+	int index;
+	int ret;
+
+	mwk = devm_kzalloc(dev, sizeof(*mwk), GFP_KERNEL);
+	if (!mwk)
+		return -ENOMEM;
+
+	mwk->data = of_device_get_match_data(dev);
+	if (!mwk->data)
+		return -EINVAL;
+
+	mwk->num_inst = of_get_child_count(np);
+	mwk->inst = devm_kcalloc(dev, mwk->num_inst,
+				  sizeof(*mwk->inst), GFP_KERNEL);
+	if (!mwk->inst)
+		return -ENOMEM;
+
+	mwk->dev = dev;
+	platform_set_drvdata(pdev, mwk);
+
+	mwk->wkc = syscon_regmap_lookup_by_phandle(np, "mediatek,wkc");
+	if (IS_ERR(mwk->wkc)) {
+		dev_err(dev, "fail to get mediatek,wkc syscon\n");
+		return PTR_ERR(mwk->wkc);
+	}
+
+	index = 0;
+	for_each_child_of_node(np, child_np) {
+		struct mtk_uwk_instance *inst;
+
+		inst = mwk_inst_create(dev, child_np, &mwk_ops);
+		if (IS_ERR(inst)) {
+			dev_err(dev, "failed to create mwk instance\n");
+			ret = PTR_ERR(inst);
+			goto put_child;
+		}
+
+		mwk->inst[index] = inst;
+		index++;
+	}
+
+	provider = of_uwk_provider_add(dev, mwk_xlate);
+
+	return PTR_ERR_OR_ZERO(provider);
+
+put_child:
+	of_node_put(child_np);
+	return ret;
+}
+
+static int mtk_uwk_remove(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+
+	of_uwk_provider_del(np);
+	return 0;
+}
+
+static struct platform_driver mtk_uwk_drv = {
+	.probe = mtk_uwk_probe,
+	.remove = mtk_uwk_remove,
+	.driver = {
+		.name = "mtk_uwk",
+		.owner = THIS_MODULE,
+		.of_match_table = mwk_id_table,
+	},
+};
+
+module_platform_driver(mtk_uwk_drv);
+MODULE_AUTHOR("Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>");
+MODULE_DESCRIPTION("MediaTek USB Wakeup driver");
+MODULE_LICENSE("GPL v2");
diff --git a/include/dt-bindings/soc/mediatek,usb-wakeup.h b/include/dt-bindings/soc/mediatek,usb-wakeup.h
new file mode 100644
index 0000000..2461795
--- /dev/null
+++ b/include/dt-bindings/soc/mediatek,usb-wakeup.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ */
+
+#ifndef __DT_BINDINGS_MTK_USB_WK_H__
+#define __DT_BINDINGS_MTK_USB_WK_H__
+
+#define MTU_WK_IP_SLEEP	1
+#define MTU_WK_LINE_STATE	2
+
+#endif
diff --git a/include/linux/soc/mediatek/usb-wakeup.h b/include/linux/soc/mediatek/usb-wakeup.h
new file mode 100644
index 0000000..5697367
--- /dev/null
+++ b/include/linux/soc/mediatek/usb-wakeup.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2017 MediaTek Inc.
+ * Author: Chunfeng Yun <chunfeng.yun-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ *
+ */
+
+#ifndef __MTK_USB_WAKEUP_H__
+#define __MTK_USB_WAKEUP_H__
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+
+struct mtu_wakeup;
+
+/**
+ * struct mtu_wakeup_ops - set of function pointers for performing
+ *    mtu_wakeup operations
+ * @enable: enable a type of usb wakeup when system suspend
+ * @disable: disable a type of usb wakeup when system resume
+ * @owner: the module owner using the ops
+ */
+struct mtu_wakeup_ops {
+	int	(*enable)(struct mtu_wakeup *uwk);
+	int	(*disable)(struct mtu_wakeup *uwk);
+	struct module *owner;
+};
+
+/**
+ * struct mtu_wakeup - represents the MediaTek USB wakeup device
+ * @parent: the parent device of the mtu_wakeup
+ * @node: associated device tree node
+ * @ops: function pointers for performing mtu_wakeup operations
+ * @mutex: mutex to protect @ops
+ * @count: used to protect when the mtu_wakeup is used by multiple consumers
+ */
+struct mtu_wakeup {
+	struct device *parent;
+	struct device_node *node;
+	const struct mtu_wakeup_ops *ops;
+	struct mutex mutex;
+	int count;
+};
+
+/**
+ * struct mtu_wakeup_provider - represents the mtu_wakeup provider
+ * @dev: the parent device of the mtu_wakeup
+ * @list: to maintain a linked list of mtu_wakeup providers
+ * @of_node: associated device tree node
+ * @of_xlate: function pointer to obtain mtu_wakeup instance from
+ *	its tree node
+ */
+struct mtu_wakeup_provider {
+	struct device *dev;
+	struct list_head list;
+	struct device_node *of_node;
+	struct mtu_wakeup *(*of_xlate)(struct device *dev,
+		struct of_phandle_args *args);
+};
+
+#if IS_ENABLED(CONFIG_MTK_UWK)
+struct mtu_wakeup *devm_of_uwk_get_by_index(
+	struct device *dev, struct device_node *np, int index);
+int mtu_wakeup_enable(struct mtu_wakeup *uwk);
+int mtu_wakeup_disable(struct mtu_wakeup *uwk);
+
+#else
+struct mtu_wakeup *devm_of_uwk_get_by_index(
+	struct device *dev, struct device_node *np, int index)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+int mtu_wakeup_enable(struct mtu_wakeup *uwk)
+{
+	return uwk ? -ENODEV : 0;
+}
+
+int mtu_wakeup_disable(struct mtu_wakeup *uwk)
+{
+	return uwk ? -ENODEV : 0;
+}
+#endif
+
+#endif	/* __MTK_USB_WAKEUP_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 0/7] Add USB remote wakeup driver
From: Chunfeng Yun @ 2017-12-09  8:45 UTC (permalink / raw)
  To: Rob Herring, Felipe Balbi, Matthias Brugger, Mathias Nyman
  Cc: Mark Rutland, Greg Kroah-Hartman, Catalin Marinas, Will Deacon,
	Chunfeng Yun, Jean Delvare, Sean Wang,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

    These patches introduce the SSUSB and SPM glue layer driver which is
used to support usb remote wakeup. Usually the glue layer is put into
a system controller, such as PERICFG module.
    The old way to support usb wakeup is put into SSUSB controller drivers,
including xhci-mtk driver and mtu3 driver, but there are some problems:
    1. can't disdinguish the relation between glue layer and SSUSB IP
       when SoCs supports multi SSUSB IPs;
    2. duplicated code for wakeup are put into both xhci-mtk and mtu3
       drivers;
    3. the glue layer may vary on different SoCs with SSUSB IP, and will
       make SSUSB controller drivers complicated;
    In order to resolve these problems, it's useful to make the glue layer
transparent by extracting a seperated driver, meanwhile to reduce the
duplicated code and simplify SSUSB controller drivers.

Changes from v1:
 * Introduce USB remote wakeup driver
 * Use the new way to support remote wakeup for SSUSB controller drivers
 * Add binding document for USB remote wakeup driver
 * Update binding documents of SSUSB controller drivers
 * Update DTS of MT8173 platform

Chunfeng Yun (7):
  soc: mediatek: Add USB wakeup driver
  dt-bindings: soc: mediatek: add bindings document for USB wakeup
  usb: xhci-mtk: use APIs of mtu_wakeup to support remote wakeup
  usb: mtu3: use APIs of mtu_wakeup to support remote wakeup
  dt-bindings: usb: mtk-xhci: add USB wakeup properties
  dt-bindings: usb: mtu3: add USB wakeup properties
  arm64: dts: mt8173: add uwk node and remove unused usb property

 .../bindings/soc/mediatek/usb-wakeup.txt           |  77 +++
 .../devicetree/bindings/usb/mediatek,mtk-xhci.txt  |  15 +-
 .../devicetree/bindings/usb/mediatek,mtu3.txt      |  14 +-
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts        |  28 +-
 arch/arm64/boot/dts/mediatek/mt8173.dtsi           |  16 +-
 drivers/soc/mediatek/Kconfig                       |   8 +
 drivers/soc/mediatek/Makefile                      |   1 +
 drivers/soc/mediatek/mtk-usb-wakeup.c              | 519 +++++++++++++++++++++
 drivers/usb/host/xhci-mtk.c                        |  39 +-
 drivers/usb/host/xhci-mtk.h                        |   2 +
 drivers/usb/mtu3/mtu3.h                            |   2 +
 drivers/usb/mtu3/mtu3_host.c                       |  39 +-
 include/dt-bindings/soc/mediatek,usb-wakeup.h      |  15 +
 include/linux/soc/mediatek/usb-wakeup.h            |  88 ++++
 14 files changed, 803 insertions(+), 60 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/soc/mediatek/usb-wakeup.txt
 create mode 100644 drivers/soc/mediatek/mtk-usb-wakeup.c
 create mode 100644 include/dt-bindings/soc/mediatek,usb-wakeup.h
 create mode 100644 include/linux/soc/mediatek/usb-wakeup.h

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 0/2] of: overlay: Crash fix and improvement
From: Frank Rowand @ 2017-12-09  6:01 UTC (permalink / raw)
  To: Geert Uytterhoeven, Pantelis Antoniou, Rob Herring
  Cc: devicetree, linux-renesas-soc, linux-kernel
In-Reply-To: <1512738783-17452-1-git-send-email-geert+renesas@glider.be>

On 12/08/17 05:13, Geert Uytterhoeven wrote:
> 	Hi Pantelis, Rob, Frank,
> 
> This patch series fixes memory corruption when applying overlays.
> 
> I first noticed this when using OF configfs.  After lots of failed
> debugging attempts, I bisected it to "of: overlay: add per overlay sysfs
> attributes", which is not upstream.  But that was a red herring: that
> commit enlarged struct fragment to exactly 64-bytes, which just made it
> more likely to cause random corruption when writing beyond the end of an
> array of fragment structures.  With the smaller structure size before,
> such writes usually ended up in the unused holes between allocated
> blocks, causing no harm.
> 
> The first patch is the real fix, and applies to both v4.15-rc2 and Rob's
> for-next branch.
> The second patch is a small improvement, and applies to Rob's for-next
> branch only.

Overlay FDT files should not have invalid contents.  But they inevitably
will, so the code has to handle those cases.  Thanks for finding this
problem and making the code better!

For the full series:

Reviewed-by: Frank Rowand <frank.rowand@sony.com>


> I've updated my topic/overlays and topic/renesas-overlays branches at
> git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git
> accordingly.
> 
> Thanks!
> 
> Geert Uytterhoeven (2):
>   of: overlay: Fix out-of-bounds write in init_overlay_changeset()
>   of: overlay: Make node skipping in init_overlay_changeset() clearer
> 
>  drivers/of/overlay.c | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
> 

^ permalink raw reply

* Re: [PATCH 4/5] Input: edt-ft5x06 - Add support for regulator
From: Dmitry Torokhov @ 2017-12-09  1:24 UTC (permalink / raw)
  To: Mylène Josserand
  Cc: robh+dt, mark.rutland, linux, maxime.ripard, wens, linux-input,
	simon.budig, linux-kernel, devicetree, linux-arm-kernel,
	thomas.petazzoni
In-Reply-To: <20171209011629.4nkcjxj2l2j7zyph@dtor-ws>

On Fri, Dec 08, 2017 at 05:16:29PM -0800, Dmitry Torokhov wrote:
> Hi Mylène,
> 
> On Fri, Dec 08, 2017 at 10:54:18PM +0100, Mylène Josserand wrote:
> > Add the support of regulator to use them as VCC source.
> > 
> > Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
> > ---
> >  drivers/input/touchscreen/edt-ft5x06.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> > index c53a3d7239e7..44b0e04a8f35 100644
> > --- a/drivers/input/touchscreen/edt-ft5x06.c
> > +++ b/drivers/input/touchscreen/edt-ft5x06.c
> > @@ -39,6 +39,7 @@
> >  #include <linux/input/mt.h>
> >  #include <linux/input/touchscreen.h>
> >  #include <linux/of_device.h>
> > +#include <linux/regulator/consumer.h>
> >  
> >  #define WORK_REGISTER_THRESHOLD		0x00
> >  #define WORK_REGISTER_REPORT_RATE	0x08
> > @@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data {
> >  	struct touchscreen_properties prop;
> >  	u16 num_x;
> >  	u16 num_y;
> > +	struct regulator *supply;
> >  
> >  	struct gpio_desc *reset_gpio;
> >  	struct gpio_desc *wake_gpio;
> > @@ -993,6 +995,23 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
> >  
> >  	tsdata->max_support_points = chip_data->max_support_points;
> >  
> > +	tsdata->supply = devm_regulator_get_optional(&client->dev, "power");
> 
> I'd prefer if we used devm_regulator_get() instead. On a
> fully-constrained systems a missing regulator will be substituted with a
> dummy one that you can then use in regulator_enable() and
> regulator_disable(). The _optional regulator API is reserved for cases
> where some of chip functionality is optional and you can engage it by
> powering up parts of the chip. The reset is not such case: it is always
> present, but may not be exposed to the OS to control.
> 
> I think the preference is to call the supply by the name is a datasheet,
> something like "vcc" or "vdd", etc.

Looking at this some more, you need to make sure your new regulator
support plays well with reset/wake GPIOs. I.e. you probably want to
properly bring the chip out of reset in edt_ft5x06_ts_resume() and maybe
driver the reset line low in suspend to make sure you do not leak into
the unpowered chip?

Also, please update
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.txt with
the additional binding data and cc device tree folks and Rob Herring.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH 4/5] Input: edt-ft5x06 - Add support for regulator
From: Dmitry Torokhov @ 2017-12-09  1:16 UTC (permalink / raw)
  To: Mylène Josserand
  Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	simon.budig-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
In-Reply-To: <20171208215419.30396-5-mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Hi Mylène,

On Fri, Dec 08, 2017 at 10:54:18PM +0100, Mylène Josserand wrote:
> Add the support of regulator to use them as VCC source.
> 
> Signed-off-by: Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  drivers/input/touchscreen/edt-ft5x06.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
> index c53a3d7239e7..44b0e04a8f35 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -39,6 +39,7 @@
>  #include <linux/input/mt.h>
>  #include <linux/input/touchscreen.h>
>  #include <linux/of_device.h>
> +#include <linux/regulator/consumer.h>
>  
>  #define WORK_REGISTER_THRESHOLD		0x00
>  #define WORK_REGISTER_REPORT_RATE	0x08
> @@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data {
>  	struct touchscreen_properties prop;
>  	u16 num_x;
>  	u16 num_y;
> +	struct regulator *supply;
>  
>  	struct gpio_desc *reset_gpio;
>  	struct gpio_desc *wake_gpio;
> @@ -993,6 +995,23 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
>  
>  	tsdata->max_support_points = chip_data->max_support_points;
>  
> +	tsdata->supply = devm_regulator_get_optional(&client->dev, "power");

I'd prefer if we used devm_regulator_get() instead. On a
fully-constrained systems a missing regulator will be substituted with a
dummy one that you can then use in regulator_enable() and
regulator_disable(). The _optional regulator API is reserved for cases
where some of chip functionality is optional and you can engage it by
powering up parts of the chip. The reset is not such case: it is always
present, but may not be exposed to the OS to control.

I think the preference is to call the supply by the name is a datasheet,
something like "vcc" or "vdd", etc.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 3/3] arm64: dts: rockchip: enable gpu on rk3328-rock64
From: Heiko Stuebner @ 2017-12-09  0:07 UTC (permalink / raw)
  To: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner
In-Reply-To: <20171209000738.32187-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

Enable the Mali450MP2 on the Rock64 board.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
index d4f80786e7c2..4351fdd1f101 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts
@@ -144,6 +144,10 @@
 	status = "okay";
 };
 
+&gpu {
+	status = "okay";
+};
+
 &i2c1 {
 	status = "okay";
 
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 2/3] arm64: dts: rockchip: add rk3328 mali gpu node
From: Heiko Stuebner @ 2017-12-09  0:07 UTC (permalink / raw)
  To: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner
In-Reply-To: <20171209000738.32187-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

Add the core gpu node for the rk3328, a Mali450MP2.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
index 41d61840fb99..4bff6422f4da 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
@@ -543,6 +543,29 @@
 		status = "disabled";
 	};
 
+	gpu: gpu@ff300000 {
+		compatible = "rockchip,rk3328-mali", "arm,mali-450";
+		reg = <0x0 0xff300000 0x0 0x40000>;
+		interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 93 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 92 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "gp",
+				  "gpmmu",
+				  "pp",
+				  "pp0",
+				  "ppmmu0",
+				  "pp1",
+				  "ppmmu1";
+		clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
+		clock-names = "bus", "core";
+		resets = <&cru SRST_GPU_A>;
+		status = "disabled";
+	};
+
 	h265e_mmu: iommu@ff330200 {
 		compatible = "rockchip,iommu";
 		reg = <0x0 0xff330200 0 0x100>;
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 1/3] dt-bindings: gpu: mali-utgard: add rockchip,rk3328-mali compatible
From: Heiko Stuebner @ 2017-12-09  0:07 UTC (permalink / raw)
  To: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner
In-Reply-To: <20171209000738.32187-1-heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

The rk3328 quad-core Cortex A53 uses a Mali-450MP2 with 2 PPs, so
add a compatible for it.

Signed-off-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
---
 Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
index c6814d7cc2b2..ad876548ab5d 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
@@ -17,6 +17,7 @@ Required properties:
       + rockchip,rk3066-mali
       + rockchip,rk3188-mali
       + rockchip,rk3228-mali
+      + rockchip,rk3328-mali
       + stericsson,db8500-mali
 
   - reg: Physical base address and length of the GPU registers
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 0/3] arm64: dts: Support Mali450 on rk3328
From: Heiko Stuebner @ 2017-12-09  0:07 UTC (permalink / raw)
  To: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Heiko Stuebner

Pretty standard setup. Tested with the kmscube demo running
using the lima kernel and gallium driver.


Heiko Stuebner (3):
  dt-bindings: gpu: mali-utgard: add rockchip,rk3328-mali compatible
  arm64: dts: rockchip: add rk3328 mali gpu node
  arm64: dts: rockchip: enable gpu on rk3328-rock64

 .../devicetree/bindings/gpu/arm,mali-utgard.txt    |  1 +
 arch/arm64/boot/dts/rockchip/rk3328-rock64.dts     |  4 ++++
 arch/arm64/boot/dts/rockchip/rk3328.dtsi           | 23 ++++++++++++++++++++++
 3 files changed, 28 insertions(+)

-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v3 1/8] SOC: brcmstb: add memory API
From: Florian Fainelli @ 2017-12-08 23:28 UTC (permalink / raw)
  To: Bjorn Helgaas, Jim Quinlan
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Bjorn Helgaas,
	Catalin Marinas, Will Deacon, Rob Herring, Brian Norris,
	Russell King, Robin Murphy, Christoph Hellwig, Florian Fainelli,
	Jonas Gorski, Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA, Kevin Cernekee, Ralf Baechle,
	bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w, Gregory Fong,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <20171205205926.GJ23510-1RhO1Y9PlrlHTL0Zs8A6p5iNqAH0jzoTYJqu5kTmcBRl57MIdRCFDg@public.gmane.org>



On 12/05/2017 12:59 PM, Bjorn Helgaas wrote:
> On Tue, Nov 14, 2017 at 05:12:05PM -0500, Jim Quinlan wrote:
>> From: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>
>> This commit adds a memory API suitable for ascertaining the sizes of
>> each of the N memory controllers in a Broadcom STB chip.  Its first
>> user will be the Broadcom STB PCIe root complex driver, which needs
>> to know these sizes to properly set up DMA mappings for inbound
>> regions.
>>
>> We cannot use memblock here or anything like what Linux provides
>> because it collapses adjacent regions within a larger block, and here
>> we actually need per-memory controller addresses and sizes, which is
>> why we resort to manual DT parsing.
>>
>> Signed-off-by: Jim Quinlan <jim2101024-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>>  drivers/soc/bcm/brcmstb/Makefile |   2 +-
>>  drivers/soc/bcm/brcmstb/memory.c | 172 +++++++++++++++++++++++++++++++++++++++
>>  include/soc/brcmstb/memory_api.h |  25 ++++++
>>  3 files changed, 198 insertions(+), 1 deletion(-)
>>  create mode 100644 drivers/soc/bcm/brcmstb/memory.c
>>  create mode 100644 include/soc/brcmstb/memory_api.h
>>
>> diff --git a/drivers/soc/bcm/brcmstb/Makefile b/drivers/soc/bcm/brcmstb/Makefile
>> index 9120b27..4cea7b6 100644
>> --- a/drivers/soc/bcm/brcmstb/Makefile
>> +++ b/drivers/soc/bcm/brcmstb/Makefile
>> @@ -1 +1 @@
>> -obj-y				+= common.o biuctrl.o
>> +obj-y				+= common.o biuctrl.o memory.o
>> diff --git a/drivers/soc/bcm/brcmstb/memory.c b/drivers/soc/bcm/brcmstb/memory.c
>> new file mode 100644
>> index 0000000..eb647ad9
>> --- /dev/null
>> +++ b/drivers/soc/bcm/brcmstb/memory.c
> 
> I sort of assume based on [1] that every new file should have an SPDX
> identifier ("The Linux kernel requires the precise SPDX identifier in
> all source files") and that the actual text of the GPL can be omitted.
> 
> Only a few files in drivers/pci currently have an SPDX identifier.  I
> don't know if that's oversight or work-in-progress or what.
> 
> [1] https://lkml.kernel.org/r/20171204212120.484179273-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org

This was submitted before SPDX was consistently enforced tree wide, so
yes we should fix this.

Any other comment besides that?
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 0/5] sun8i-a83t: Add touchscreen support on TBS A711
From: Mylene JOSSERAND @ 2017-12-08 22:01 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: simon.budig-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
In-Reply-To: <20171208215419.30396-1-mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

Hi,

Le Fri,  8 Dec 2017 22:54:14 +0100,
Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> a écrit :

> Hello everyone,
> 
> This patch series adds touchscreen support (FocalTech EDT-FT5x06
> Polytouch) for TBS A711 (Allwinner sun8i-a83t SoC).
> This touchscreen is using i2c so this series adds support of this bus
> on A83T.
> 
> Series information:
>    - Based on last linux-next (next-20171208)
>    - Had dependencies on AXP209 Quentin Schultz's series:
>    https://www.spinics.net/lists/linux-gpio/msg26913.htmlx

I forgot to mention a dependency on Maxime Ripard's patch that
reinstate AXP813 PMIC:
https://patchwork.kernel.org/patch/10077037/

Thanks,

Mylène

> 
> Patch 01: Add i2c0 node on a83t device tree.
> Patch 02: Add i2c0 pin group.
> Patch 03: Enable i2c0 on TBS A711.
> Patch 04: Add support for regulator in the FocalTech touchscreen
> driver because A711 tablet is using a regulator to power-up the
> touchscreen. Patch 05: Add the touchscreen node in A711 TBS tablet.
> 
> Thank you in advance for any review.
> Best regards,
> Mylène
> 
> Mylène Josserand (5):
>   arm: dts: sun8i: a83t: Add I2C0 node
>   arm: dts: sun8i: a83t: Add I2C0 pins group
>   arm: dts: sun8i: a83t: a711: Enable I2C0
>   Input: edt-ft5x06 - Add support for regulator
>   arm: dts: sun8i: a83t: a711: Add touchscreen node
> 
>  arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 18 +++++++++++++++++
>  arch/arm/boot/dts/sun8i-a83t.dtsi         | 16 +++++++++++++++
>  drivers/input/touchscreen/edt-ft5x06.c    | 33
> +++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+)
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 5/5] arm: dts: sun8i: a83t: a711: Add touchscreen node
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt, mark.rutland, linux, maxime.ripard, wens,
	dmitry.torokhov, linux-input
  Cc: simon.budig, linux-kernel, devicetree, linux-arm-kernel,
	mylene.josserand, thomas.petazzoni
In-Reply-To: <20171208215419.30396-1-mylene.josserand@free-electrons.com>

Tha A711 tablet has a FocalTech EDT-FT5x06 Polytouch touchscreen.
It is connected via I2C0 so add his node in i2c0's node.

The reset line is PD5, the interrupt line is PL7 and the power
supply is the ldo_io0 regulator.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index 84cca1a48cea..738359917a34 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -110,6 +110,17 @@
 	pinctrl-0 = <&i2c0_pins>;
 	clock-frequency = <400000>;
 	status = "okay";
+
+	polytouch: edt-ft5x06@38 {
+		compatible = "edt,edt-ft5x06";
+		reg = <0x38>;
+		interrupt-parent = <&r_pio>;
+		interrupts = <0 7 IRQ_TYPE_EDGE_FALLING>;
+		reset-gpios = <&pio 3 5 GPIO_ACTIVE_LOW>;
+		power-supply = <&reg_ldo_io0>;
+		touchscreen-size-x = <1024>;
+		touchscreen-size-y = <600>;
+	};
 };
 
 &mmc0 {
-- 
2.11.0


^ permalink raw reply related

* [PATCH 4/5] Input: edt-ft5x06 - Add support for regulator
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt, mark.rutland, linux, maxime.ripard, wens,
	dmitry.torokhov, linux-input
  Cc: simon.budig, linux-kernel, devicetree, linux-arm-kernel,
	mylene.josserand, thomas.petazzoni
In-Reply-To: <20171208215419.30396-1-mylene.josserand@free-electrons.com>

Add the support of regulator to use them as VCC source.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index c53a3d7239e7..44b0e04a8f35 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -39,6 +39,7 @@
 #include <linux/input/mt.h>
 #include <linux/input/touchscreen.h>
 #include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
 
 #define WORK_REGISTER_THRESHOLD		0x00
 #define WORK_REGISTER_REPORT_RATE	0x08
@@ -91,6 +92,7 @@ struct edt_ft5x06_ts_data {
 	struct touchscreen_properties prop;
 	u16 num_x;
 	u16 num_y;
+	struct regulator *supply;
 
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *wake_gpio;
@@ -993,6 +995,23 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 
 	tsdata->max_support_points = chip_data->max_support_points;
 
+	tsdata->supply = devm_regulator_get_optional(&client->dev, "power");
+	if (IS_ERR(tsdata->supply)) {
+		error = PTR_ERR(tsdata->supply);
+		dev_err(&client->dev, "failed to request regulator: %d\n",
+			error);
+		return error;
+	};
+
+	if (tsdata->supply) {
+		error = regulator_enable(tsdata->supply);
+		if (error < 0) {
+			dev_err(&client->dev, "failed to enable supply: %d\n",
+				error);
+			return error;
+		}
+	}
+
 	tsdata->reset_gpio = devm_gpiod_get_optional(&client->dev,
 						     "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(tsdata->reset_gpio)) {
@@ -1122,20 +1141,34 @@ static int edt_ft5x06_ts_remove(struct i2c_client *client)
 static int __maybe_unused edt_ft5x06_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
 
 	if (device_may_wakeup(dev))
 		enable_irq_wake(client->irq);
 
+	if (tsdata->supply)
+		regulator_disable(tsdata->supply);
+
 	return 0;
 }
 
 static int __maybe_unused edt_ft5x06_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
+	struct edt_ft5x06_ts_data *tsdata = i2c_get_clientdata(client);
+	int ret;
 
 	if (device_may_wakeup(dev))
 		disable_irq_wake(client->irq);
 
+	if (tsdata->supply) {
+		ret = regulator_enable(tsdata->supply);
+		if (ret < 0) {
+			dev_err(dev, "failed to enable supply: %d\n", ret);
+			return ret;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.11.0


^ permalink raw reply related

* [PATCH 3/5] arm: dts: sun8i: a83t: a711: Enable I2C0
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: simon.budig-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
In-Reply-To: <20171208215419.30396-1-mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

The A711 has a touchscreen connected by I2C0.
Enable only I2C0 node for the moment.

Signed-off-by: Mylène Josserand <mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
---
 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
index a021ee6da396..84cca1a48cea 100644
--- a/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
+++ b/arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts
@@ -105,6 +105,13 @@
 	status = "okay";
 };
 
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+	clock-frequency = <400000>;
+	status = "okay";
+};
+
 &mmc0 {
 	vmmc-supply = <&reg_dcdc1>;
 	pinctrl-names = "default";
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH 2/5] arm: dts: sun8i: a83t: Add I2C0 pins group
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt, mark.rutland, linux, maxime.ripard, wens,
	dmitry.torokhov, linux-input
  Cc: simon.budig, linux-kernel, devicetree, linux-arm-kernel,
	mylene.josserand, thomas.petazzoni
In-Reply-To: <20171208215419.30396-1-mylene.josserand@free-electrons.com>

Add pins group to configure it as I2C0.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi
index 848cf3f19962..3bce6bd3dc79 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -347,6 +347,11 @@
 			#interrupt-cells = <3>;
 			#gpio-cells = <3>;
 
+			i2c0_pins: i2c0-pins {
+				pins = "PH0", "PH1";
+				function = "i2c0";
+			};
+
 			mmc0_pins: mmc0-pins {
 				pins = "PF0", "PF1", "PF2",
 				       "PF3", "PF4", "PF5";
-- 
2.11.0


^ permalink raw reply related

* [PATCH 1/5] arm: dts: sun8i: a83t: Add I2C0 node
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt, mark.rutland, linux, maxime.ripard, wens,
	dmitry.torokhov, linux-input
  Cc: simon.budig, linux-kernel, devicetree, linux-arm-kernel,
	mylene.josserand, thomas.petazzoni
In-Reply-To: <20171208215419.30396-1-mylene.josserand@free-electrons.com>

Add I2C0 node for A83T.

Signed-off-by: Mylène Josserand <mylene.josserand@free-electrons.com>
---
 arch/arm/boot/dts/sun8i-a83t.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi
index 19acae1b4089..848cf3f19962 100644
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
@@ -177,6 +177,17 @@
 			#dma-cells = <1>;
 		};
 
+		i2c0: i2c@01c2ac00 {
+			compatible = "allwinner,sun6i-a31-i2c";
+			reg = <0x01c2ac00 0x400>;
+			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_I2C0>;
+			resets = <&ccu RST_BUS_I2C0>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		mmc0: mmc@1c0f000 {
 			compatible = "allwinner,sun8i-a83t-mmc",
 				     "allwinner,sun7i-a20-mmc";
-- 
2.11.0

^ permalink raw reply related

* [PATCH 0/5] sun8i-a83t: Add touchscreen support on TBS A711
From: Mylène Josserand @ 2017-12-08 21:54 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw,
	maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: simon.budig-t93Ne7XHvje5bSeCtf/tX7NAH6kLmebB,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8

Hello everyone,

This patch series adds touchscreen support (FocalTech EDT-FT5x06
Polytouch) for TBS A711 (Allwinner sun8i-a83t SoC).
This touchscreen is using i2c so this series adds support of this bus
on A83T.

Series information:
   - Based on last linux-next (next-20171208)
   - Had dependencies on AXP209 Quentin Schultz's series:
   https://www.spinics.net/lists/linux-gpio/msg26913.htmlx

Patch 01: Add i2c0 node on a83t device tree.
Patch 02: Add i2c0 pin group.
Patch 03: Enable i2c0 on TBS A711.
Patch 04: Add support for regulator in the FocalTech touchscreen driver
because A711 tablet is using a regulator to power-up the touchscreen.
Patch 05: Add the touchscreen node in A711 TBS tablet.

Thank you in advance for any review.
Best regards,
Mylène

Mylène Josserand (5):
  arm: dts: sun8i: a83t: Add I2C0 node
  arm: dts: sun8i: a83t: Add I2C0 pins group
  arm: dts: sun8i: a83t: a711: Enable I2C0
  Input: edt-ft5x06 - Add support for regulator
  arm: dts: sun8i: a83t: a711: Add touchscreen node

 arch/arm/boot/dts/sun8i-a83t-tbs-a711.dts | 18 +++++++++++++++++
 arch/arm/boot/dts/sun8i-a83t.dtsi         | 16 +++++++++++++++
 drivers/input/touchscreen/edt-ft5x06.c    | 33 +++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v1 1/2] dt-bindings: Add binding for Sitronix ST7735R display panels
From: Noralf Trønnes @ 2017-12-08 21:41 UTC (permalink / raw)
  To: David Lechner, dri-devel, devicetree
  Cc: limor, Rob Herring, Mark Rutland, linux-kernel
In-Reply-To: <1511924469-11448-2-git-send-email-david@lechnology.com>


Den 29.11.2017 04.01, skrev David Lechner:
> This adds a new device tree binding for Sitronix ST7735R display panels,
> such as the Adafruit 1.8" TFT.
>
> Signed-off-by: David Lechner <david@lechnology.com>
> ---
>   .../bindings/display/sitronix,st7735r.txt          | 35 ++++++++++++++++++++++
>   1 file changed, 35 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.txt
>
> diff --git a/Documentation/devicetree/bindings/display/sitronix,st7735r.txt b/Documentation/devicetree/bindings/display/sitronix,st7735r.txt
> new file mode 100644
> index 0000000..bbb8ba6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/sitronix,st7735r.txt
> @@ -0,0 +1,35 @@
> +Sitronix ST7735R display panels
> +
> +This binding is for display panels using a Sitronix ST7735R controller in SPI
> +mode.
> +
> +Required properties:
> +- compatible:	"sitronix,st7735r-jd-t18003-t01"
> +- dc-gpios:	Display data/command selection (D/CX)
> +- reset-gpios:	Reset signal (RSTX)

I'm wondering if this should be optional.

Even though the display needs the reset line to be driven, it doesn't
have to be so by a gpio, I believe you can even get away with just
using a resistor as a reset circuit.

Not terribly important, it's up to you.

Noralf.


> +
> +The node for this driver must be a child node of a SPI controller, hence
> +all mandatory properties described in ../spi/spi-bus.txt must be specified.
> +
> +Optional properties:
> +- rotation:	panel rotation in degrees counter clockwise (0,90,180,270)
> +- backlight:	phandle of the backlight device attached to the panel
> +
> +Example:
> +
> +	backlight: backlight {
> +		compatible = "gpio-backlight";
> +		gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
> +	}
> +
> +	...
> +
> +	display@0{
> +		compatible = "sitronix,st7735r-jd-t18003-t01";
> +		reg = <0>;
> +		spi-max-frequency = <32000000>;
> +		dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
> +		reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
> +		rotation = <270>;
> +		backlight = &backlight;
> +	};

^ permalink raw reply

* Re: [PATCH v1 2/2] drm/tinydrm: add driver for ST7735R panels
From: David Lechner @ 2017-12-08 21:25 UTC (permalink / raw)
  To: Noralf Trønnes, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: limor-6aDhHjTmHzzR7s880joybQ, Rob Herring, Mark Rutland,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <455f5c7a-9f3c-c019-9418-94f0c2015afd-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>

On 12/06/2017 12:27 PM, Noralf Trønnes wrote:
> 
> Den 29.11.2017 04.01, skrev David Lechner:
>> This adds a new driver for Sitronix ST7735R display panels.
>>
>> This has been tested using an Adafruit 1.8" TFT.
>>
>> Signed-off-by: David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
>> ---
>>   MAINTAINERS                       |   6 +
>>   drivers/gpu/drm/tinydrm/Kconfig   |  10 ++
>>   drivers/gpu/drm/tinydrm/Makefile  |   1 +
>>   drivers/gpu/drm/tinydrm/st7735r.c | 237 
>> ++++++++++++++++++++++++++++++++++++++
>>   4 files changed, 254 insertions(+)
>>   create mode 100644 drivers/gpu/drm/tinydrm/st7735r.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index a174632..9c7707e 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -4462,6 +4462,12 @@ S:    Maintained
>>   F:    drivers/gpu/drm/tinydrm/st7586.c
>>   F:    Documentation/devicetree/bindings/display/st7586.txt
>> +DRM DRIVER FOR SITRONIX ST7735R PANELS
>> +M:    David Lechner <david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>
> 
> I know we haven't done this in the other tinydrm drivers, but I think
> we should start adding which tree the development is happening in:
> 
> T:    git git://anongit.freedesktop.org/drm/drm-misc

This is inherited, just like L:, so get_maintainers.pl --scm returns git 
git://anongit.freedesktop.org/drm/drm-misc already. So there doesn't 
seem to be a need to add this line.

> 
>> +S:    Maintained
>> +F:    drivers/gpu/drm/tinydrm/st7735r.c
>> +F:    Documentation/devicetree/bindings/display/st7735r.txt

<snip>

>> +}
>> +
>> +static void st7735r_pipe_disable(struct drm_simple_display_pipe *pipe)
>> +{
>> +    struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
>> +    struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
>> +
> 
> Please use mipi_dbi_pipe_disable() here.
> 
>> +    DRM_DEBUG_KMS("\n");
>> +
>> +    if (!mipi->enabled)
>> +        return;
>> +
>> +    tinydrm_disable_backlight(mipi->backlight);
>> +
>> +    mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_OFF);
> 
> You turn off the panel, have you checked what it looks like if you don't
> turn off backlight (which is optional in this driver)?
> 
> On the displays I have tried this on, all pixels turn white when they're
> not driven, letting backlight through, giving an all white display.
> That's why I have that blanking code in mipi_dbi_pipe_disable() when we
> don't have backlight control and the reason I don't turn off the panel.
> The power savings of not driving the panel is negligible AFAICR.
> 
> If you don't need DISPLAY_OFF, you can just use mipi_dbi_pipe_disable()
> directly as the callback.
> 

I tested this and you are right, it causes the panel to go white when a 
backlight is not specified, so I will just use mipi_dbi_pipe_disable().
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH v2 2/2] eeprom: at24: remove temporary fix for at24mac402 size.
From: Sven Van Asbroeck @ 2017-12-08 21:25 UTC (permalink / raw)
  To: svendev-fuHqz3Nb1YI, wsa-z923LK4zBo2bacvFa/9K2g, brgl-ARrdPY/1zhM,
	nsekhar-l0cyMroinI0, sakari.ailus-VuQAYsv1563Yd54FQh9/CA,
	javier-0uQlZySMnqxg9hUCZPvPmw,
	divagar.mohandass-ral2JQCrhuEAvxtiuMwx3w
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1512768306-14816-1-git-send-email-svendev-fuHqz3Nb1YI@public.gmane.org>

The chip size passed via devicetree, i2c, or acpi device ids is
now no longer limited to a power of two. So the temporary
fix can be removed.

Signed-off-by: Sven Van Asbroeck <svendev-fuHqz3Nb1YI@public.gmane.org>
---
 drivers/misc/eeprom/at24.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index c3759cb..e522350 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -569,16 +569,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		dev_warn(&client->dev,
 			"page_size looks suspicious (no power of 2)!\n");
 
-	/*
-	 * REVISIT: the size of the EUI-48 byte array is 6 in at24mac402, while
-	 * the call to ilog2() in AT24_DEVICE_MAGIC() rounds it down to 4.
-	 *
-	 * Eventually we'll get rid of the magic values altoghether in favor of
-	 * real structs, but for now just manually set the right size.
-	 */
-	if (chip.flags & AT24_FLAG_MAC && chip.byte_len == 4)
-		chip.byte_len = 6;
-
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C) &&
 	    !i2c_check_functionality(client->adapter,
 				     I2C_FUNC_SMBUS_WRITE_I2C_BLOCK))
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* [PATCH v2 1/2] eeprom: at24: convert magic numbers to structs.
From: Sven Van Asbroeck @ 2017-12-08 21:25 UTC (permalink / raw)
  To: svendev, wsa, brgl, nsekhar, sakari.ailus, javier,
	divagar.mohandass
  Cc: devicetree, linux-kernel, linux-i2c
In-Reply-To: <1512768306-14816-1-git-send-email-svendev@arcx.com>

Fundamental properties such as capacity and page size differ
among at24-type chips. But these chips do not have an id register,
so this can't be discovered at runtime.

Traditionally, at24-type eeprom properties were determined in two ways:
- by passing a 'struct at24_platform_data' via platform_data, or
- by naming the chip type in the devicetree, which passes a
	'magic number' to probe(), which is then converted to
	a 'struct at24_platform_data'.

Recently a bug was discovered because the magic number rounds down
all chip sizes to the lowest power of two. This was addressed by
a work-around, with the wish that magic numbers should over time
be converted to structs.

This patch replaces the magic numbers with 'struct at24_chip_data'.

Signed-off-by: Sven Van Asbroeck <svendev@arcx.com>
---
 drivers/misc/eeprom/at24.c | 230 ++++++++++++++++++++++-----------------------
 1 file changed, 110 insertions(+), 120 deletions(-)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 06ffa11..c3759cb 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -105,16 +105,6 @@ struct at24_data {
 module_param(write_timeout, uint, 0);
 MODULE_PARM_DESC(write_timeout, "Time (in ms) to try writes (default 25)");
 
-#define AT24_SIZE_BYTELEN 5
-#define AT24_SIZE_FLAGS 8
-
-#define AT24_BITMASK(x) (BIT(x) - 1)
-
-/* create non-zero magic value for given eeprom parameters */
-#define AT24_DEVICE_MAGIC(_len, _flags) 		\
-	((1 << AT24_SIZE_FLAGS | (_flags)) 		\
-	    << AT24_SIZE_BYTELEN | ilog2(_len))
-
 /*
  * Both reads and writes fail if the previous write didn't complete yet. This
  * macro loops a few times waiting at least long enough for one entire page
@@ -131,113 +121,119 @@ struct at24_data {
 	     op_time ? time_before(op_time, tout) : true;		\
 	     usleep_range(1000, 1500), op_time = jiffies)
 
+struct at24_chip_data {
+	/*
+	 * these fields mirror their equivalents in
+	 * struct at24_platform_data
+	 */
+	u32 byte_len;
+	u8 flags;
+};
+
+#define AT24_CHIP_DATA(_name, _len, _flags) \
+	static const struct at24_chip_data at24_data_##_name = { \
+		.byte_len = _len, .flags = _flags, \
+	}
+
+#define AT24_I2C_DEVICE_ID(_name) \
+	{ #_name, (kernel_ulong_t)&at24_data_##_name }
+
+#define AT24_ACPI_DEVICE_ID(_name) \
+	{ #_name, (kernel_ulong_t)&at24_data_##_name }
+
+#define AT24_OF_DEVICE_ID(_of_compat, _name) \
+	{ .compatible = _of_compat, .data = &at24_data_##_name }
+
+/* needs 8 addresses as A0-A2 are ignored */
+AT24_CHIP_DATA(24c00, 128 / 8, AT24_FLAG_TAKE8ADDR);
+/* old variants can't be handled with this generic entry! */
+AT24_CHIP_DATA(24c01, 1024 / 8, 0);
+AT24_CHIP_DATA(24cs01, 16, AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24c02, 2048 / 8,	0);
+AT24_CHIP_DATA(24cs02, 16, AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24mac402, 48 / 8,
+	AT24_FLAG_MAC | AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24mac602, 64 / 8,
+	AT24_FLAG_MAC | AT24_FLAG_READONLY);
+/* spd is a 24c02 in memory DIMMs */
+AT24_CHIP_DATA(spd, 2048 / 8,
+	AT24_FLAG_READONLY | AT24_FLAG_IRUGO);
+AT24_CHIP_DATA(24c04, 4096 / 8,	0);
+AT24_CHIP_DATA(24cs04, 16,
+	AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
+/* 24rf08 quirk is handled at i2c-core */
+AT24_CHIP_DATA(24c08, 8192 / 8,	0);
+AT24_CHIP_DATA(24cs08, 16,
+	AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24c16, 16384 / 8, 0);
+AT24_CHIP_DATA(24cs16, 16,
+	AT24_FLAG_SERIAL | AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24c32, 32768 / 8,	AT24_FLAG_ADDR16);
+AT24_CHIP_DATA(24cs32, 16,
+	AT24_FLAG_ADDR16 |
+	AT24_FLAG_SERIAL |
+	AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24c64, 65536 / 8,	AT24_FLAG_ADDR16);
+AT24_CHIP_DATA(24cs64, 16,
+	AT24_FLAG_ADDR16 |
+	AT24_FLAG_SERIAL |
+	AT24_FLAG_READONLY);
+AT24_CHIP_DATA(24c128, 131072 / 8,	AT24_FLAG_ADDR16);
+AT24_CHIP_DATA(24c256, 262144 / 8,	AT24_FLAG_ADDR16);
+AT24_CHIP_DATA(24c512, 524288 / 8,	AT24_FLAG_ADDR16);
+AT24_CHIP_DATA(24c1024, 1048576 / 8,	AT24_FLAG_ADDR16);
+/* identical to 24c08 ? */
+AT24_CHIP_DATA(INT3499, 8192 / 8, 0);
+
 static const struct i2c_device_id at24_ids[] = {
-	/* needs 8 addresses as A0-A2 are ignored */
-	{ "24c00",	AT24_DEVICE_MAGIC(128 / 8,	AT24_FLAG_TAKE8ADDR) },
-	/* old variants can't be handled with this generic entry! */
-	{ "24c01",	AT24_DEVICE_MAGIC(1024 / 8,	0) },
-	{ "24cs01",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
-	{ "24c02",	AT24_DEVICE_MAGIC(2048 / 8,	0) },
-	{ "24cs02",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
-	{ "24mac402",	AT24_DEVICE_MAGIC(48 / 8,
-				AT24_FLAG_MAC | AT24_FLAG_READONLY) },
-	{ "24mac602",	AT24_DEVICE_MAGIC(64 / 8,
-				AT24_FLAG_MAC | AT24_FLAG_READONLY) },
-	/* spd is a 24c02 in memory DIMMs */
-	{ "spd",	AT24_DEVICE_MAGIC(2048 / 8,
-				AT24_FLAG_READONLY | AT24_FLAG_IRUGO) },
-	{ "24c04",	AT24_DEVICE_MAGIC(4096 / 8,	0) },
-	{ "24cs04",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
-	/* 24rf08 quirk is handled at i2c-core */
-	{ "24c08",	AT24_DEVICE_MAGIC(8192 / 8,	0) },
-	{ "24cs08",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
-	{ "24c16",	AT24_DEVICE_MAGIC(16384 / 8,	0) },
-	{ "24cs16",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_SERIAL | AT24_FLAG_READONLY) },
-	{ "24c32",	AT24_DEVICE_MAGIC(32768 / 8,	AT24_FLAG_ADDR16) },
-	{ "24cs32",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_ADDR16 |
-				AT24_FLAG_SERIAL |
-				AT24_FLAG_READONLY) },
-	{ "24c64",	AT24_DEVICE_MAGIC(65536 / 8,	AT24_FLAG_ADDR16) },
-	{ "24cs64",	AT24_DEVICE_MAGIC(16,
-				AT24_FLAG_ADDR16 |
-				AT24_FLAG_SERIAL |
-				AT24_FLAG_READONLY) },
-	{ "24c128",	AT24_DEVICE_MAGIC(131072 / 8,	AT24_FLAG_ADDR16) },
-	{ "24c256",	AT24_DEVICE_MAGIC(262144 / 8,	AT24_FLAG_ADDR16) },
-	{ "24c512",	AT24_DEVICE_MAGIC(524288 / 8,	AT24_FLAG_ADDR16) },
-	{ "24c1024",	AT24_DEVICE_MAGIC(1048576 / 8,	AT24_FLAG_ADDR16) },
+	AT24_I2C_DEVICE_ID(24c00),
+	AT24_I2C_DEVICE_ID(24c01),
+	AT24_I2C_DEVICE_ID(24cs01),
+	AT24_I2C_DEVICE_ID(24c02),
+	AT24_I2C_DEVICE_ID(24cs02),
+	AT24_I2C_DEVICE_ID(24mac402),
+	AT24_I2C_DEVICE_ID(24mac602),
+	AT24_I2C_DEVICE_ID(spd),
+	AT24_I2C_DEVICE_ID(24c04),
+	AT24_I2C_DEVICE_ID(24cs04),
+	AT24_I2C_DEVICE_ID(24c08),
+	AT24_I2C_DEVICE_ID(24cs08),
+	AT24_I2C_DEVICE_ID(24c16),
+	AT24_I2C_DEVICE_ID(24cs16),
+	AT24_I2C_DEVICE_ID(24c32),
+	AT24_I2C_DEVICE_ID(24cs32),
+	AT24_I2C_DEVICE_ID(24c64),
+	AT24_I2C_DEVICE_ID(24cs64),
+	AT24_I2C_DEVICE_ID(24c128),
+	AT24_I2C_DEVICE_ID(24c256),
+	AT24_I2C_DEVICE_ID(24c512),
+	AT24_I2C_DEVICE_ID(24c1024),
 	{ "at24", 0 },
 	{ /* END OF LIST */ }
 };
 MODULE_DEVICE_TABLE(i2c, at24_ids);
 
 static const struct of_device_id at24_of_match[] = {
-	{
-		.compatible = "atmel,24c00",
-		.data = (void *)AT24_DEVICE_MAGIC(128 / 8, AT24_FLAG_TAKE8ADDR)
-	},
-	{
-		.compatible = "atmel,24c01",
-		.data = (void *)AT24_DEVICE_MAGIC(1024 / 8, 0)
-	},
-	{
-		.compatible = "atmel,24c02",
-		.data = (void *)AT24_DEVICE_MAGIC(2048 / 8, 0)
-	},
-	{
-		.compatible = "atmel,spd",
-		.data = (void *)AT24_DEVICE_MAGIC(2048 / 8,
-				AT24_FLAG_READONLY | AT24_FLAG_IRUGO)
-	},
-	{
-		.compatible = "atmel,24c04",
-		.data = (void *)AT24_DEVICE_MAGIC(4096 / 8, 0)
-	},
-	{
-		.compatible = "atmel,24c08",
-		.data = (void *)AT24_DEVICE_MAGIC(8192 / 8, 0)
-	},
-	{
-		.compatible = "atmel,24c16",
-		.data = (void *)AT24_DEVICE_MAGIC(16384 / 8, 0)
-	},
-	{
-		.compatible = "atmel,24c32",
-		.data = (void *)AT24_DEVICE_MAGIC(32768 / 8, AT24_FLAG_ADDR16)
-	},
-	{
-		.compatible = "atmel,24c64",
-		.data = (void *)AT24_DEVICE_MAGIC(65536 / 8, AT24_FLAG_ADDR16)
-	},
-	{
-		.compatible = "atmel,24c128",
-		.data = (void *)AT24_DEVICE_MAGIC(131072 / 8, AT24_FLAG_ADDR16)
-	},
-	{
-		.compatible = "atmel,24c256",
-		.data = (void *)AT24_DEVICE_MAGIC(262144 / 8, AT24_FLAG_ADDR16)
-	},
-	{
-		.compatible = "atmel,24c512",
-		.data = (void *)AT24_DEVICE_MAGIC(524288 / 8, AT24_FLAG_ADDR16)
-	},
-	{
-		.compatible = "atmel,24c1024",
-		.data = (void *)AT24_DEVICE_MAGIC(1048576 / 8, AT24_FLAG_ADDR16)
-	},
-	{ },
+	AT24_OF_DEVICE_ID("atmel,24c00", 24c00),
+	AT24_OF_DEVICE_ID("atmel,24c01", 24c01),
+	AT24_OF_DEVICE_ID("atmel,24c02", 24c02),
+	AT24_OF_DEVICE_ID("atmel,spd", spd),
+	AT24_OF_DEVICE_ID("atmel,24c04", 24c04),
+	AT24_OF_DEVICE_ID("atmel,24c08", 24c08),
+	AT24_OF_DEVICE_ID("atmel,24c16", 24c16),
+	AT24_OF_DEVICE_ID("atmel,24c32", 24c32),
+	AT24_OF_DEVICE_ID("atmel,24c64", 24c64),
+	AT24_OF_DEVICE_ID("atmel,24c128", 24c128),
+	AT24_OF_DEVICE_ID("atmel,24c256", 24c256),
+	AT24_OF_DEVICE_ID("atmel,24c512", 24c512),
+	AT24_OF_DEVICE_ID("atmel,24c1024", 24c1024),
+	{ /* END OF LIST */ },
 };
 MODULE_DEVICE_TABLE(of, at24_of_match);
 
 static const struct acpi_device_id at24_acpi_ids[] = {
-	{ "INT3499", AT24_DEVICE_MAGIC(8192 / 8, 0) },
-	{ }
+	AT24_ACPI_DEVICE_ID(INT3499),
+	{ /* END OF LIST */ }
 };
 MODULE_DEVICE_TABLE(acpi, at24_acpi_ids);
 
@@ -525,8 +521,8 @@ static unsigned int at24_get_offset_adj(u8 flags, unsigned int byte_len)
 
 static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 {
-	struct at24_platform_data chip;
-	kernel_ulong_t magic = 0;
+	struct at24_platform_data chip = { 0 };
+	const struct at24_chip_data *cd = NULL;
 	bool writable;
 	struct at24_data *at24;
 	int err;
@@ -544,28 +540,22 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
 		 */
 		if (client->dev.of_node &&
 		    of_match_device(at24_of_match, &client->dev)) {
-			magic = (kernel_ulong_t)
-				of_device_get_match_data(&client->dev);
+			cd = of_device_get_match_data(&client->dev);
 		} else if (id) {
-			magic = id->driver_data;
+			cd = (void *)id->driver_data;
 		} else {
 			const struct acpi_device_id *aid;
 
 			aid = acpi_match_device(at24_acpi_ids, &client->dev);
 			if (aid)
-				magic = aid->driver_data;
+				cd = (void *)aid->driver_data;
 		}
-		if (!magic)
+		if (!cd)
 			return -ENODEV;
 
-		chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN));
-		magic >>= AT24_SIZE_BYTELEN;
-		chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS);
-
+		chip.byte_len = cd->byte_len;
+		chip.flags = cd->flags;
 		at24_get_pdata(&client->dev, &chip);
-
-		chip.setup = NULL;
-		chip.context = NULL;
 	}
 
 	if (!is_power_of_2(chip.byte_len))
-- 
1.9.1

^ permalink raw reply related

* [PATCH v2 0/2] eeprom: at24: convert magic numbers to structs.
From: Sven Van Asbroeck @ 2017-12-08 21:25 UTC (permalink / raw)
  To: svendev-fuHqz3Nb1YI, wsa-z923LK4zBo2bacvFa/9K2g, brgl-ARrdPY/1zhM,
	nsekhar-l0cyMroinI0, sakari.ailus-VuQAYsv1563Yd54FQh9/CA,
	javier-0uQlZySMnqxg9hUCZPvPmw,
	divagar.mohandass-ral2JQCrhuEAvxtiuMwx3w
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA

v2:
	use struct at24_chip_data instead of struct at24_platform_data
		(which decreases code size)
	explicitly write out of compatible nodes, e.g. "atmel,24c04"
		(which allows grepping for of compatible nodes)

v1:
	first shot

Sven Van Asbroeck (2):
  eeprom: at24: convert magic numbers to structs.
  eeprom: at24: remove temporary fix for at24mac402 size.

 drivers/misc/eeprom/at24.c | 240 +++++++++++++++++++++------------------------
 1 file changed, 110 insertions(+), 130 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 01/12] dt-bindings: mtd: add Marvell NAND controller documentation
From: Boris Brezillon @ 2017-12-08 20:56 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Richard Weinberger,
	Cyrille Pitchen, Rob Herring, Mark Rutland, Jason Cooper,
	Andrew Lunn, Gregory Clement, Sebastian Hesselbarth, Russell King,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Eric Miao,
	Catalin Marinas, Will Deacon,
	Ezequiel Garcia <ezequiel.garcia>
In-Reply-To: <20171207201814.30411-2-miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On Thu,  7 Dec 2017 21:18:03 +0100
Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> Document the legacy and the new bindings for Marvell NAND controller.
> 
> The pxa3xx_nand.c driver does only support legacy bindings, which are
> incomplete and inaccurate. A rework of this controller (called
> marvell_nand.c) does support both.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> ---
>  .../devicetree/bindings/mtd/marvell-nand.txt       | 84 ++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mtd/marvell-nand.txt
> 
> diff --git a/Documentation/devicetree/bindings/mtd/marvell-nand.txt b/Documentation/devicetree/bindings/mtd/marvell-nand.txt
> new file mode 100644
> index 000000000000..0b3d5e0bab83
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/marvell-nand.txt
> @@ -0,0 +1,84 @@
> +Marvell NAND Flash Controller (NFC)
> +
> +Required properties:
> +- compatible: can be one of the following:
> +    * "marvell,armada-8k-nand-controller"
> +    * "marvell,armada370-nand-controller"
> +    * "marvell,pxa3xx-nand-controller"
> +    * "marvell,armada-8k-nand" (deprecated)
> +    * "marvell,armada370-nand" (deprecated)
> +    * "marvell,pxa3xx-nand" (deprecated)
> +- reg: NAND flash controller memory area.
> +- #address-cells: shall be set to 1. Encode the NAND CS.
> +- #size-cells: shall be set to 0.
> +- interrupts: shall define the NAND controller interrupt.
> +- clocks: shall reference the NAND controller clock.
> +- marvell,system-controller: Set to retrieve the syscon node that handles
> +  NAND controller related registers (only required with the
> +  "marvell,armada-8k-nand[-controller]" compatibles).
> +
> +Optional properties:
> +- label: see partition.txt. New platforms shall omit this property.
> +- dmas: shall reference DMA channel associated to the NAND controller.
> +- dma-names: shall be "rxtx".
> +
> +Optional children nodes:
> +Children nodes represent the available NAND chips.
> +
> +Required properties:
> +- reg: shall contain the native Chip Select ids (0-3)
> +- marvell,rb: shall contain the native Ready/Busy ids (0-1)
> +
> +Optional properties:
> +- marvell,nand-keep-config: orders the driver not to take the timings
> +  from the core and leaving them completely untouched. Bootloader
> +  timings will then be used.
> +- nand-on-flash-bbt: see nand.txt.
> +- nand-ecc-mode: see nand.txt. Will use hardware ECC if not specified.
> +- nand-ecc-algo: see nand.txt. This property may be added when using
> +  hardware ECC for clarification but will be ignored by the driver
> +  because ECC mode is chosen depending on the page size and the strength
> +  required by the NAND chip. This value may be overwritten with
> +  nand-ecc-strength property.
> +- nand-ecc-strength: see nand.txt.
> +- nand-ecc-step-size: see nand.txt. This has no effect and will be
> +  ignored by the driver when using hardware ECC because Marvell's NAND
> +  flash controller does use fixed strength (1-bit for Hamming, 16-bit
> +  for BCH), so the step size will shrink or grow in order to fit the
> +  required strength. Step sizes are not completely random for all and
> +  follow certain patterns described in AN-379, "Marvell SoC NFC ECC".
> +
> +See Documentation/devicetree/bindings/mtd/nand.txt for more details on
> +generic bindings.
> +
> +
> +Example:
> +nand_controller: nand-controller@d0000 {
> +	compatible = "marvell,armada370-nand-controller";
> +	reg = <0xd0000 0x54>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
> +	clocks = <&coredivclk 0>;
> +
> +	nand@0 {
> +		reg = <0>;
> +		marvell,rb = <0>;
> +		nand-ecc-mode = "hw";
> +		marvell,nand-keep-config;
> +		nand-on-flash-bbt;
> +		nand-ecc-strength = <4>;
> +		nand-ecc-step-size = <512>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "Rootfs";
> +				reg = <0x00000000 0x40000000>;
> +			};
> +		};
> +	};
> +};

Maybe you should also give an example for the old bindings.
BTW, given your properties description, it's not clear which properties
are deprecated. Maybe you should split the doc in 2 sections: one
describing the new bindings, and the other one describing the deprecated
bindings.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [GIT PULL] DeviceTree fixes for 4.15, part 2
From: Rob Herring @ 2017-12-08 20:04 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Frank Rowand,
	Mark Rutland
In-Reply-To: <CAL_JsqLOd7sr3=FMd2yoW2fc7DF6k9_XMYRSWM_obYs9AnS4Ww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, Dec 8, 2017 at 9:07 AM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Fri, Dec 8, 2017 at 8:10 AM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> Hi Linus,
>>
>> Please pull another set of DT fixes.
>
> Disregard this one. I've just gotten another overlay fix, so I'm going
> to add that in.

Here's an updated pull request.

Rob

The following changes since commit 4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323:

  Linux 4.15-rc1 (2017-11-26 16:01:47 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
tags/devicetree-fixes-for-4.15-part2

for you to fetch changes up to 589b754df3f37ca0a1f96fccde7f91c59266f38a:

  of: overlay: Make node skipping in init_overlay_changeset() clearer
(2017-12-08 09:32:18 -0600)

----------------------------------------------------------------
DeviceTree fixes for v4.15 (part2):

- Fixes from overlay code rework. A trifecta of fixes to the locking,
  an out of bounds access, and a memory leak in of_overlay_apply().

- Clean-up at25 eeprom binding document

- Remove leading '0x' in unit-addresses from binding docs

----------------------------------------------------------------
Geert Uytterhoeven (9):
      of: unittest: Remove bogus overlay mutex release from overlay_data_add()
      of: Spelling s/changset/changeset/
      of: overlay: Remove else after goto
      dt-bindings: eeprom: at25: Grammar s/are can/can/
      dt-bindings: eeprom: at25: Document device-specific compatible values
      of: overlay: Fix memory leak in of_overlay_apply() error path
      of: overlay: Fix (un)locking in of_overlay_apply()
      of: overlay: Fix out-of-bounds write in init_overlay_changeset()
      of: overlay: Make node skipping in init_overlay_changeset() clearer

Mathieu Malaterre (1):
      dt-bindings: Remove leading 0x from bindings notation

 Documentation/devicetree/bindings/arm/ccn.txt      |  2 +-
 .../devicetree/bindings/arm/omap/crossbar.txt      |  2 +-
 .../bindings/arm/tegra/nvidia,tegra20-mc.txt       |  2 +-
 .../devicetree/bindings/clock/axi-clkgen.txt       |  2 +-
 .../bindings/clock/brcm,bcm2835-aux-clock.txt      |  2 +-
 .../devicetree/bindings/clock/exynos4-clock.txt    |  2 +-
 .../devicetree/bindings/clock/exynos5250-clock.txt |  2 +-
 .../devicetree/bindings/clock/exynos5410-clock.txt |  2 +-
 .../devicetree/bindings/clock/exynos5420-clock.txt |  2 +-
 .../devicetree/bindings/clock/exynos5440-clock.txt |  2 +-
 .../bindings/clock/ti-keystone-pllctrl.txt         |  2 +-
 .../devicetree/bindings/clock/zx296702-clk.txt     |  4 +-
 .../devicetree/bindings/crypto/fsl-sec4.txt        |  4 +-
 .../bindings/devfreq/event/rockchip-dfi.txt        |  2 +-
 .../devicetree/bindings/display/atmel,lcdc.txt     |  4 +-
 .../devicetree/bindings/dma/qcom_hidma_mgmt.txt    |  4 +-
 Documentation/devicetree/bindings/dma/zxdma.txt    |  2 +-
 Documentation/devicetree/bindings/eeprom/at25.txt  | 13 ++--
 .../devicetree/bindings/gpio/gpio-altera.txt       |  2 +-
 .../devicetree/bindings/i2c/i2c-jz4780.txt         |  2 +-
 .../devicetree/bindings/iio/pressure/hp03.txt      |  2 +-
 .../bindings/input/touchscreen/bu21013.txt         |  2 +-
 .../bindings/interrupt-controller/arm,gic.txt      |  4 +-
 .../interrupt-controller/img,meta-intc.txt         |  2 +-
 .../bindings/interrupt-controller/img,pdc-intc.txt |  2 +-
 .../interrupt-controller/st,spear3xx-shirq.txt     |  2 +-
 .../devicetree/bindings/mailbox/altera-mailbox.txt |  6 +-
 .../bindings/mailbox/brcm,iproc-pdc-mbox.txt       |  2 +-
 .../devicetree/bindings/media/exynos5-gsc.txt      |  2 +-
 .../devicetree/bindings/media/mediatek-vcodec.txt  |  2 +-
 .../devicetree/bindings/media/rcar_vin.txt         |  2 +-
 .../devicetree/bindings/media/samsung-fimc.txt     |  2 +-
 .../devicetree/bindings/media/sh_mobile_ceu.txt    |  2 +-
 .../devicetree/bindings/media/video-interfaces.txt | 10 +--
 .../bindings/memory-controllers/ti/emif.txt        |  2 +-
 .../bindings/mfd/ti-keystone-devctrl.txt           |  2 +-
 .../devicetree/bindings/misc/brcm,kona-smc.txt     |  2 +-
 .../devicetree/bindings/mmc/brcm,kona-sdhci.txt    |  2 +-
 .../devicetree/bindings/mmc/brcm,sdhci-iproc.txt   |  2 +-
 .../devicetree/bindings/mmc/ti-omap-hsmmc.txt      |  4 +-
 Documentation/devicetree/bindings/mtd/gpmc-nor.txt |  6 +-
 Documentation/devicetree/bindings/mtd/mtk-nand.txt |  2 +-
 .../devicetree/bindings/net/altera_tse.txt         |  4 +-
 Documentation/devicetree/bindings/net/mdio.txt     |  2 +-
 .../devicetree/bindings/net/socfpga-dwmac.txt      |  2 +-
 Documentation/devicetree/bindings/nios2/nios2.txt  |  2 +-
 .../devicetree/bindings/pci/altera-pcie.txt        |  2 +-
 .../devicetree/bindings/pci/fsl,imx6q-pcie.txt     |  2 +-
 .../devicetree/bindings/pci/hisilicon-pcie.txt     |  2 +-
 .../devicetree/bindings/phy/sun4i-usb-phy.txt      |  2 +-
 .../bindings/pinctrl/brcm,cygnus-pinmux.txt        |  2 +-
 .../devicetree/bindings/pinctrl/pinctrl-atlas7.txt |  4 +-
 .../devicetree/bindings/pinctrl/pinctrl-sirf.txt   |  2 +-
 .../bindings/pinctrl/rockchip,pinctrl.txt          |  4 +-
 .../devicetree/bindings/regulator/regulator.txt    |  2 +-
 .../devicetree/bindings/serial/efm32-uart.txt      |  2 +-
 .../bindings/serio/allwinner,sun4i-ps2.txt         |  2 +-
 .../bindings/soc/ti/keystone-navigator-qmss.txt    |  2 +-
 .../devicetree/bindings/sound/adi,axi-i2s.txt      |  2 +-
 .../devicetree/bindings/sound/adi,axi-spdif-tx.txt |  2 +-
 Documentation/devicetree/bindings/sound/ak4613.txt |  2 +-
 Documentation/devicetree/bindings/sound/ak4642.txt |  2 +-
 .../devicetree/bindings/sound/max98371.txt         |  2 +-
 .../devicetree/bindings/sound/max9867.txt          |  2 +-
 .../devicetree/bindings/sound/renesas,fsi.txt      |  2 +-
 .../devicetree/bindings/sound/rockchip-spdif.txt   |  2 +-
 .../devicetree/bindings/sound/st,sti-asoc-card.txt |  8 +--
 .../devicetree/bindings/spi/efm32-spi.txt          |  2 +-
 .../devicetree/bindings/thermal/thermal.txt        | 12 ++--
 Documentation/devicetree/bindings/ufs/ufs-qcom.txt |  4 +-
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt      |  2 +-
 Documentation/devicetree/bindings/usb/ehci-st.txt  |  2 +-
 Documentation/devicetree/bindings/usb/ohci-st.txt  |  2 +-
 .../bindings/watchdog/ingenic,jz4740-wdt.txt       |  2 +-
 drivers/of/dynamic.c                               |  4 +-
 drivers/of/overlay.c                               | 84 ++++++++++------------
 drivers/of/unittest.c                              |  1 -
 77 files changed, 149 insertions(+), 151 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v6 net-next,mips 6/7] netdev: octeon-ethernet: Add Cavium Octeon III support.
From: David Miller @ 2017-12-08 19:29 UTC (permalink / raw)
  To: david.daney-YGCgFSpz5w/QT0dZR+AlfA
  Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA, ralf-6z/3iImG2C8G8FEW9MqTrA,
	james.hogan-8NJIiSa5LzA, netdev-u79uwXL29TY76Z2rM5mHXA,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	steven.hill-YGCgFSpz5w/QT0dZR+AlfA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, andrew-g2DYL2Zd6BY,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, pombredanne-od1rfyK75/E,
	cmunoz-YGCgFSpz5w/QT0dZR+AlfA
In-Reply-To: <20171208000934.6554-7-david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>

From: David Daney <david.daney-YGCgFSpz5w/QT0dZR+AlfA@public.gmane.org>
Date: Thu,  7 Dec 2017 16:09:33 -0800

> +static void bgx_port_check_state(struct work_struct *work)
> +{
 ...
> +	mutex_lock(&priv->lock);
> +	if (priv->work_queued)
> +		queue_delayed_work(check_state_wq, &priv->dwork, HZ);
> +	mutex_unlock(&priv->lock);
> +}
 ...
> +int bgx_port_disable(struct net_device *netdev)
> +{
 ...
> +	mutex_lock(&priv->lock);
> +	if (priv->work_queued) {
> +		cancel_delayed_work_sync(&priv->dwork);
> +		priv->work_queued = false;

This can deadlock.

When you do a sync work cancel, it waits until all running work
instances finish.  You have the priv->lock, so if
bgx_port_check_status() need to still take priv->lock to complete
then no further progress will be made.

I think it is pointless to use this weird work_queued boolean state.

Just unconditionally, and without locking, cancel the delayed work,
ragardless of whether it was actually used ever or not.

Thank you.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox