Devicetree
 help / color / mirror / Atom feed
* [PATCH v10 05/13] slimbus: core: add support to device tree helper
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: Mark Rutland, devicetree, Jonathan Corbet, linux-arm-msm,
	linux-doc, j.neuschaefer, linux-kernel, Rob Herring,
	Srinivas Kandagatla, pombredanne, sdharia
In-Reply-To: <20171211234307.14465-1-srinivas.kandagatla@linaro.org>

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

This patch adds support to parse slim devices from device tree.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/slimbus/core.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index ed53ae6bd1cc..1accb20ed5cd 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -8,6 +8,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/idr.h>
+#include <linux/of.h>
 #include <linux/slimbus.h>
 #include "slimbus.h"
 
@@ -113,6 +114,9 @@ static int slim_add_device(struct slim_controller *ctrl,
 	sbdev->dev.driver = NULL;
 	sbdev->ctrl = ctrl;
 
+	if (node)
+		sbdev->dev.of_node = of_node_get(node);
+
 	dev_set_name(&sbdev->dev, "%x:%x:%x:%x",
 				  sbdev->e_addr.manf_id,
 				  sbdev->e_addr.prod_code,
@@ -143,6 +147,50 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
 	return sbdev;
 }
 
+static void of_register_slim_devices(struct slim_controller *ctrl)
+{
+	struct device *dev = ctrl->dev;
+	struct device_node *node;
+
+	if (!ctrl->dev->of_node)
+		return;
+
+	for_each_child_of_node(ctrl->dev->of_node, node) {
+		struct slim_device *sbdev;
+		struct slim_eaddr e_addr;
+		const char *compat = NULL;
+		int reg[2], ret;
+		int manf_id, prod_code;
+
+		compat = of_get_property(node, "compatible", NULL);
+		if (!compat)
+			continue;
+
+		ret = sscanf(compat, "slim%x,%x", &manf_id, &prod_code);
+		if (ret != 2) {
+			dev_err(dev, "Manf ID & Product code not found %s\n",
+				compat);
+			continue;
+		}
+
+		ret = of_property_read_u32_array(node, "reg", reg, 2);
+		if (ret) {
+			dev_err(dev, "Device and Instance id not found:%d\n",
+				ret);
+			continue;
+		}
+
+		e_addr.dev_index = reg[0];
+		e_addr.instance = reg[1];
+		e_addr.manf_id = manf_id;
+		e_addr.prod_code = prod_code;
+
+		sbdev = slim_alloc_device(ctrl, &e_addr, node);
+		if (!sbdev)
+			continue;
+	}
+}
+
 /*
  * slim_register_controller() - Controller bring-up and registration.
  *
@@ -174,6 +222,8 @@ int slim_register_controller(struct slim_controller *ctrl)
 	dev_dbg(ctrl->dev, "Bus [%s] registered:dev:%p\n",
 		ctrl->name, ctrl->dev);
 
+	of_register_slim_devices(ctrl);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(slim_register_controller);
-- 
2.15.0

^ permalink raw reply related

* [PATCH v10 04/13] slimbus: core: Add slim controllers support
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: sdharia, Rob Herring, Mark Rutland, Jonathan Corbet, pombredanne,
	j.neuschaefer, linux-arm-msm, devicetree, linux-kernel, linux-doc,
	Srinivas Kandagatla
In-Reply-To: <20171211234307.14465-1-srinivas.kandagatla@linaro.org>

From: Sagar Dharia <sdharia@codeaurora.org>

This patch adds support to slim controllers in the slim core,
including some utility functions invoked by the controller and
slim device drivers.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/slimbus/core.c    | 306 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/slimbus/slimbus.h | 108 ++++++++++++++++
 include/linux/slimbus.h   |   8 ++
 3 files changed, 422 insertions(+)
 create mode 100644 drivers/slimbus/slimbus.h

diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 02f5075a9309..ed53ae6bd1cc 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -7,7 +7,11 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/idr.h>
 #include <linux/slimbus.h>
+#include "slimbus.h"
+
+static DEFINE_IDA(ctrl_ida);
 
 static const struct slim_device_id *slim_match(const struct slim_device_id *id,
 					       const struct slim_device *sbdev)
@@ -92,6 +96,308 @@ void slim_driver_unregister(struct slim_driver *drv)
 }
 EXPORT_SYMBOL_GPL(slim_driver_unregister);
 
+static void slim_dev_release(struct device *dev)
+{
+	struct slim_device *sbdev = to_slim_device(dev);
+
+	kfree(sbdev);
+}
+
+static int slim_add_device(struct slim_controller *ctrl,
+			   struct slim_device *sbdev,
+			   struct device_node *node)
+{
+	sbdev->dev.bus = &slimbus_bus;
+	sbdev->dev.parent = ctrl->dev;
+	sbdev->dev.release = slim_dev_release;
+	sbdev->dev.driver = NULL;
+	sbdev->ctrl = ctrl;
+
+	dev_set_name(&sbdev->dev, "%x:%x:%x:%x",
+				  sbdev->e_addr.manf_id,
+				  sbdev->e_addr.prod_code,
+				  sbdev->e_addr.dev_index,
+				  sbdev->e_addr.instance);
+
+	return device_register(&sbdev->dev);
+}
+
+static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
+					     struct slim_eaddr *eaddr,
+					     struct device_node *node)
+{
+	struct slim_device *sbdev;
+	int ret;
+
+	sbdev = kzalloc(sizeof(*sbdev), GFP_KERNEL);
+	if (!sbdev)
+		return NULL;
+
+	sbdev->e_addr = *eaddr;
+	ret = slim_add_device(ctrl, sbdev, node);
+	if (ret) {
+		kfree(sbdev);
+		return NULL;
+	}
+
+	return sbdev;
+}
+
+/*
+ * slim_register_controller() - Controller bring-up and registration.
+ *
+ * @ctrl: Controller to be registered.
+ *
+ * A controller is registered with the framework using this API.
+ * If devices on a controller were registered before controller,
+ * this will make sure that they get probed when controller is up
+ */
+int slim_register_controller(struct slim_controller *ctrl)
+{
+	int id;
+
+	id = ida_simple_get(&ctrl_ida, 0, 0, GFP_KERNEL);
+	if (id < 0)
+		return id;
+
+	ctrl->id = id;
+
+	if (!ctrl->min_cg)
+		ctrl->min_cg = SLIM_MIN_CLK_GEAR;
+	if (!ctrl->max_cg)
+		ctrl->max_cg = SLIM_MAX_CLK_GEAR;
+
+	ida_init(&ctrl->laddr_ida);
+	idr_init(&ctrl->tid_idr);
+	mutex_init(&ctrl->lock);
+
+	dev_dbg(ctrl->dev, "Bus [%s] registered:dev:%p\n",
+		ctrl->name, ctrl->dev);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(slim_register_controller);
+
+/* slim_remove_device: Remove the effect of slim_add_device() */
+static void slim_remove_device(struct slim_device *sbdev)
+{
+	device_unregister(&sbdev->dev);
+}
+
+static int slim_ctrl_remove_device(struct device *dev, void *null)
+{
+	slim_remove_device(to_slim_device(dev));
+	return 0;
+}
+
+/**
+ * slim_unregister_controller() - Controller tear-down.
+ *
+ * @ctrl: Controller to tear-down.
+ */
+int slim_unregister_controller(struct slim_controller *ctrl)
+{
+	/* Remove all clients */
+	device_for_each_child(ctrl->dev, NULL, slim_ctrl_remove_device);
+	ida_simple_remove(&ctrl_ida, ctrl->id);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(slim_unregister_controller);
+
+static void slim_device_update_status(struct slim_device *sbdev,
+				      enum slim_device_status status)
+{
+	struct slim_driver *sbdrv;
+
+	if (sbdev->status == status)
+		return;
+
+	sbdev->status = status;
+	if (!sbdev->dev.driver)
+		return;
+
+	sbdrv = to_slim_driver(sbdev->dev.driver);
+	if (sbdrv->device_status)
+		sbdrv->device_status(sbdev, sbdev->status);
+}
+
+/**
+ * slim_report_absent() - Controller calls this function when a device
+ *	reports absent, OR when the device cannot be communicated with
+ *
+ * @sbdev: Device that cannot be reached, or sent report absent
+ */
+void slim_report_absent(struct slim_device *sbdev)
+{
+	struct slim_controller *ctrl = sbdev->ctrl;
+
+	if (!ctrl)
+		return;
+
+	/* invalidate logical addresses */
+	mutex_lock(&ctrl->lock);
+	sbdev->is_laddr_valid = false;
+	mutex_unlock(&ctrl->lock);
+
+	ida_simple_remove(&ctrl->laddr_ida, sbdev->laddr);
+	slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_DOWN);
+}
+EXPORT_SYMBOL_GPL(slim_report_absent);
+
+static bool slim_eaddr_equal(struct slim_eaddr *a, struct slim_eaddr *b)
+{
+	return (a->manf_id == b->manf_id &&
+		a->prod_code == b->prod_code &&
+		a->dev_index == b->dev_index &&
+		a->instance == b->instance);
+}
+
+static int slim_match_dev(struct device *dev, void *data)
+{
+	struct slim_eaddr *e_addr = data;
+	struct slim_device *sbdev = to_slim_device(dev);
+
+	return slim_eaddr_equal(&sbdev->e_addr, e_addr);
+}
+
+static struct slim_device *find_slim_device(struct slim_controller *ctrl,
+					    struct slim_eaddr *eaddr)
+{
+	struct slim_device *sbdev;
+	struct device *dev;
+
+	dev = device_find_child(ctrl->dev, eaddr, slim_match_dev);
+	if (dev) {
+		sbdev = to_slim_device(dev);
+		return sbdev;
+	}
+
+	return NULL;
+}
+
+/**
+ * slim_get_device() - get handle to a device.
+ *
+ * @ctrl: Controller on which this device will be added/queried
+ * @e_addr: Enumeration address of the device to be queried
+ *
+ * Return: pointer to a device if it has already reported. Creates a new
+ * device and returns pointer to it if the device has not yet enumerated.
+ */
+struct slim_device *slim_get_device(struct slim_controller *ctrl,
+				    struct slim_eaddr *e_addr)
+{
+	struct slim_device *sbdev;
+
+	sbdev = find_slim_device(ctrl, e_addr);
+	if (!sbdev) {
+		sbdev = slim_alloc_device(ctrl, e_addr, NULL);
+		if (!sbdev)
+			return ERR_PTR(-ENOMEM);
+	}
+
+	return sbdev;
+}
+EXPORT_SYMBOL_GPL(slim_get_device);
+
+static int slim_device_alloc_laddr(struct slim_device *sbdev,
+				   bool report_present)
+{
+	struct slim_controller *ctrl = sbdev->ctrl;
+	u8 laddr;
+	int ret;
+
+	mutex_lock(&ctrl->lock);
+	if (ctrl->get_laddr) {
+		ret = ctrl->get_laddr(ctrl, &sbdev->e_addr, &laddr);
+		if (ret < 0)
+			goto err;
+	} else if (report_present) {
+		ret = ida_simple_get(&ctrl->laddr_ida,
+				     0, SLIM_LA_MANAGER - 1, GFP_KERNEL);
+		if (ret < 0)
+			goto err;
+
+		laddr = ret;
+	} else {
+		ret = -EINVAL;
+		goto err;
+	}
+
+	if (ctrl->set_laddr) {
+		ret = ctrl->set_laddr(ctrl, &sbdev->e_addr, laddr);
+		if (ret) {
+			ret = -EINVAL;
+			goto err;
+		}
+	}
+
+	sbdev->laddr = laddr;
+	sbdev->is_laddr_valid = true;
+
+	slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_UP);
+
+	dev_dbg(ctrl->dev, "setting slimbus l-addr:%x, ea:%x,%x,%x,%x\n",
+		laddr, sbdev->e_addr.manf_id, sbdev->e_addr.prod_code,
+		sbdev->e_addr.dev_index, sbdev->e_addr.instance);
+
+err:
+	mutex_unlock(&ctrl->lock);
+	return ret;
+
+}
+
+/**
+ * slim_device_report_present() - Report enumerated device.
+ *
+ * @ctrl: Controller with which device is enumerated.
+ * @e_addr: Enumeration address of the device.
+ * @laddr: Return logical address (if valid flag is false)
+ *
+ * Called by controller in response to REPORT_PRESENT. Framework will assign
+ * a logical address to this enumeration address.
+ * Function returns -EXFULL to indicate that all logical addresses are already
+ * taken.
+ */
+int slim_device_report_present(struct slim_controller *ctrl,
+			       struct slim_eaddr *e_addr, u8 *laddr)
+{
+	struct slim_device *sbdev;
+	int ret;
+
+	sbdev = slim_get_device(ctrl, e_addr);
+	if (IS_ERR(sbdev))
+		return -ENODEV;
+
+	if (sbdev->is_laddr_valid) {
+		*laddr = sbdev->laddr;
+		return 0;
+	}
+
+	ret = slim_device_alloc_laddr(sbdev, true);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(slim_device_report_present);
+
+/**
+ * slim_get_logical_addr() - get/allocate logical address of a SLIMbus device.
+ *
+ * @sbdev: client handle requesting the address.
+ *
+ * Return: zero if a logical address is valid or a new logical address
+ * has been assigned. error code in case of error.
+ */
+int slim_get_logical_addr(struct slim_device *sbdev)
+{
+	if (!sbdev->is_laddr_valid)
+		return slim_device_alloc_laddr(sbdev, false);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(slim_get_logical_addr);
+
 static void __exit slimbus_exit(void)
 {
 	bus_unregister(&slimbus_bus);
diff --git a/drivers/slimbus/slimbus.h b/drivers/slimbus/slimbus.h
new file mode 100644
index 000000000000..66657722f50f
--- /dev/null
+++ b/drivers/slimbus/slimbus.h
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2011-2017, The Linux Foundation
+ */
+
+#ifndef _DRIVERS_SLIMBUS_H
+#define _DRIVERS_SLIMBUS_H
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/mutex.h>
+#include <linux/slimbus.h>
+
+/* Standard values per SLIMbus spec needed by controllers and devices */
+#define SLIM_MAX_CLK_GEAR		10
+#define SLIM_MIN_CLK_GEAR		1
+
+/* Manager's logical address is set to 0xFF per spec */
+#define SLIM_LA_MANAGER 0xFF
+
+/**
+ * struct slim_framer - Represents SLIMbus framer.
+ * Every controller may have multiple framers. There is 1 active framer device
+ * responsible for clocking the bus.
+ * Manager is responsible for framer hand-over.
+ * @dev: Driver model representation of the device.
+ * @e_addr: Enumeration address of the framer.
+ * @rootfreq: Root Frequency at which the framer can run. This is maximum
+ *	frequency ('clock gear 10') at which the bus can operate.
+ * @superfreq: Superframes per root frequency. Every frame is 6144 bits.
+ */
+struct slim_framer {
+	struct device		dev;
+	struct slim_eaddr	e_addr;
+	int			rootfreq;
+	int			superfreq;
+};
+
+#define to_slim_framer(d) container_of(d, struct slim_framer, dev)
+
+/**
+ * struct slim_controller  - Controls every instance of SLIMbus
+ *				(similar to 'master' on SPI)
+ * @dev: Device interface to this driver
+ * @id: Board-specific number identifier for this controller/bus
+ * @name: Name for this controller
+ * @min_cg: Minimum clock gear supported by this controller (default value: 1)
+ * @max_cg: Maximum clock gear supported by this controller (default value: 10)
+ * @clkgear: Current clock gear in which this bus is running
+ * @laddr_ida: logical address id allocator
+ * @a_framer: Active framer which is clocking the bus managed by this controller
+ * @lock: Mutex protecting controller data structures
+ * @devices: Slim device list
+ * @tid_idr: tid id allocator
+ * @txn_lock: Lock to protect table of transactions
+ * @set_laddr: Setup logical address at laddr for the slave with elemental
+ *	address e_addr. Drivers implementing controller will be expected to
+ *	send unicast message to this device with its logical address.
+ * @get_laddr: It is possible that controller needs to set fixed logical
+ *	address table and get_laddr can be used in that case so that controller
+ *	can do this assignment. Use case is when the master is on the remote
+ *	processor side, who is resposible for allocating laddr.
+ *
+ *	'Manager device' is responsible for  device management, bandwidth
+ *	allocation, channel setup, and port associations per channel.
+ *	Device management means Logical address assignment/removal based on
+ *	enumeration (report-present, report-absent) of a device.
+ *	Bandwidth allocation is done dynamically by the manager based on active
+ *	channels on the bus, message-bandwidth requests made by SLIMbus devices.
+ *	Based on current bandwidth usage, manager chooses a frequency to run
+ *	the bus at (in steps of 'clock-gear', 1 through 10, each clock gear
+ *	representing twice the frequency than the previous gear).
+ *	Manager is also responsible for entering (and exiting) low-power-mode
+ *	(known as 'clock pause').
+ *	Manager can do handover of framer if there are multiple framers on the
+ *	bus and a certain usecase warrants using certain framer to avoid keeping
+ *	previous framer being powered-on.
+ *
+ *	Controller here performs duties of the manager device, and 'interface
+ *	device'. Interface device is responsible for monitoring the bus and
+ *	reporting information such as loss-of-synchronization, data
+ *	slot-collision.
+ */
+struct slim_controller {
+	struct device		*dev;
+	unsigned int		id;
+	char			name[SLIMBUS_NAME_SIZE];
+	int			min_cg;
+	int			max_cg;
+	int			clkgear;
+	struct ida		laddr_ida;
+	struct slim_framer	*a_framer;
+	struct mutex		lock;
+	struct list_head	devices;
+	struct idr		tid_idr;
+	spinlock_t		txn_lock;
+	int			(*set_laddr)(struct slim_controller *ctrl,
+					     struct slim_eaddr *ea, u8 laddr);
+	int			(*get_laddr)(struct slim_controller *ctrl,
+					     struct slim_eaddr *ea, u8 *laddr);
+};
+
+int slim_device_report_present(struct slim_controller *ctrl,
+			       struct slim_eaddr *e_addr, u8 *laddr);
+void slim_report_absent(struct slim_device *sbdev);
+int slim_register_controller(struct slim_controller *ctrl);
+int slim_unregister_controller(struct slim_controller *ctrl);
+
+#endif /* _LINUX_SLIMBUS_H */
diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
index 6b4ed290fbb0..aeed98a683be 100644
--- a/include/linux/slimbus.h
+++ b/include/linux/slimbus.h
@@ -37,11 +37,14 @@ enum slim_device_status {
 	SLIM_DEVICE_STATUS_RESERVED,
 };
 
+struct slim_controller;
+
 /**
  * struct slim_device - Slim device handle.
  * @dev: Driver model representation of the device.
  * @e_addr: Enumeration address of this device.
  * @status: slim device status
+ * @ctrl: slim controller instance.
  * @laddr: 1-byte Logical address of this device.
  * @is_laddr_valid: indicates if the laddr is valid or not
  *
@@ -52,6 +55,7 @@ enum slim_device_status {
 struct slim_device {
 	struct device		dev;
 	struct slim_eaddr	e_addr;
+	struct slim_controller	*ctrl;
 	enum slim_device_status	status;
 	u8			laddr;
 	bool			is_laddr_valid;
@@ -113,4 +117,8 @@ static inline void slim_set_devicedata(struct slim_device *dev, void *data)
 {
 	dev_set_drvdata(&dev->dev, data);
 }
+
+struct slim_device *slim_get_device(struct slim_controller *ctrl,
+				    struct slim_eaddr *e_addr);
+int slim_get_logical_addr(struct slim_device *sbdev);
 #endif /* _LINUX_SLIMBUS_H */
-- 
2.15.0

^ permalink raw reply related

* [PATCH v10 03/13] slimbus: Add SLIMbus bus type
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: sdharia, Rob Herring, Mark Rutland, Jonathan Corbet, pombredanne,
	j.neuschaefer, linux-arm-msm, devicetree, linux-kernel, linux-doc,
	Srinivas Kandagatla
In-Reply-To: <20171211234307.14465-1-srinivas.kandagatla@linaro.org>

From: Sagar Dharia <sdharia@codeaurora.org>

SLIMbus (Serial Low Power Interchip Media Bus) is a specification
developed by MIPI (Mobile Industry Processor Interface) alliance.
SLIMbus is a 2-wire implementation, which is used to communicate with
peripheral components like audio-codec.
SLIMbus uses Time-Division-Multiplexing to accommodate multiple data
channels, and control channel. Control channel has messages to do
device-enumeration, messages to send/receive control-data to/from
SLIMbus devices, messages for port/channel management, and messages to
do bandwidth allocation.
The framework supports multiple instances of the bus (1 controller per
bus), and multiple slave devices per controller.

This patch adds support to basic silmbus core which includes support to
SLIMbus type, slimbus device registeration and some basic data structures.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/Kconfig                 |   2 +
 drivers/Makefile                |   1 +
 drivers/slimbus/Kconfig         |  17 ++++++
 drivers/slimbus/Makefile        |   6 +++
 drivers/slimbus/core.c          | 108 +++++++++++++++++++++++++++++++++++++
 include/linux/mod_devicetable.h |  13 +++++
 include/linux/slimbus.h         | 116 ++++++++++++++++++++++++++++++++++++++++
 7 files changed, 263 insertions(+)
 create mode 100644 drivers/slimbus/Kconfig
 create mode 100644 drivers/slimbus/Makefile
 create mode 100644 drivers/slimbus/core.c
 create mode 100644 include/linux/slimbus.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 152744c5ef0f..c8e1d1c3f426 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -211,4 +211,6 @@ source "drivers/mux/Kconfig"
 
 source "drivers/opp/Kconfig"
 
+source "drivers/slimbus/Kconfig"
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 1d034b680431..d233a95b3b24 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -87,6 +87,7 @@ obj-$(CONFIG_MTD)		+= mtd/
 obj-$(CONFIG_SPI)		+= spi/
 obj-$(CONFIG_SPMI)		+= spmi/
 obj-$(CONFIG_HSI)		+= hsi/
+obj-$(CONFIG_SLIMBUS)		+= slimbus/
 obj-y				+= net/
 obj-$(CONFIG_ATM)		+= atm/
 obj-$(CONFIG_FUSION)		+= message/
diff --git a/drivers/slimbus/Kconfig b/drivers/slimbus/Kconfig
new file mode 100644
index 000000000000..9b6bb84d66ed
--- /dev/null
+++ b/drivers/slimbus/Kconfig
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# SLIMbus driver configuration
+#
+menuconfig SLIMBUS
+	tristate "SLIMbus support"
+	help
+	  SLIMbus is standard interface between System-on-Chip and audio codec,
+	  and other peripheral components in typical embedded systems.
+
+	  If unsure, choose N.
+
+if SLIMBUS
+
+# SLIMbus controllers
+
+endif
diff --git a/drivers/slimbus/Makefile b/drivers/slimbus/Makefile
new file mode 100644
index 000000000000..506ff17d6346
--- /dev/null
+++ b/drivers/slimbus/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for kernel SLIMbus framework.
+#
+obj-$(CONFIG_SLIMBUS)			+= slimbus.o
+slimbus-y				:= core.o
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
new file mode 100644
index 000000000000..02f5075a9309
--- /dev/null
+++ b/drivers/slimbus/core.c
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2011-2017, The Linux Foundation
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/slimbus.h>
+
+static const struct slim_device_id *slim_match(const struct slim_device_id *id,
+					       const struct slim_device *sbdev)
+{
+	while (id->manf_id != 0 || id->prod_code != 0) {
+		if (id->manf_id == sbdev->e_addr.manf_id &&
+		    id->prod_code == sbdev->e_addr.prod_code)
+			return id;
+		id++;
+	}
+	return NULL;
+}
+
+static int slim_device_match(struct device *dev, struct device_driver *drv)
+{
+	struct slim_device *sbdev = to_slim_device(dev);
+	struct slim_driver *sbdrv = to_slim_driver(drv);
+
+	return !!slim_match(sbdrv->id_table, sbdev);
+}
+
+static int slim_device_probe(struct device *dev)
+{
+	struct slim_device	*sbdev = to_slim_device(dev);
+	struct slim_driver	*sbdrv = to_slim_driver(dev->driver);
+
+	return sbdrv->probe(sbdev);
+}
+
+static int slim_device_remove(struct device *dev)
+{
+	struct slim_device *sbdev = to_slim_device(dev);
+	struct slim_driver *sbdrv;
+
+	if (dev->driver) {
+		sbdrv = to_slim_driver(dev->driver);
+		if (sbdrv->remove)
+			sbdrv->remove(sbdev);
+	}
+
+	return 0;
+}
+
+struct bus_type slimbus_bus = {
+	.name		= "slimbus",
+	.match		= slim_device_match,
+	.probe		= slim_device_probe,
+	.remove		= slim_device_remove,
+};
+EXPORT_SYMBOL_GPL(slimbus_bus);
+
+/*
+ * __slim_driver_register() - Client driver registration with SLIMbus
+ *
+ * @drv:Client driver to be associated with client-device.
+ * @owner: owning module/driver
+ *
+ * This API will register the client driver with the SLIMbus
+ * It is called from the driver's module-init function.
+ */
+int __slim_driver_register(struct slim_driver *drv, struct module *owner)
+{
+	/* ID table and probe are mandatory */
+	if (!drv->id_table || !drv->probe)
+		return -EINVAL;
+
+	drv->driver.bus = &slimbus_bus;
+	drv->driver.owner = owner;
+
+	return driver_register(&drv->driver);
+}
+EXPORT_SYMBOL_GPL(__slim_driver_register);
+
+/*
+ * slim_driver_unregister() - Undo effect of slim_driver_register
+ *
+ * @drv: Client driver to be unregistered
+ */
+void slim_driver_unregister(struct slim_driver *drv)
+{
+	driver_unregister(&drv->driver);
+}
+EXPORT_SYMBOL_GPL(slim_driver_unregister);
+
+static void __exit slimbus_exit(void)
+{
+	bus_unregister(&slimbus_bus);
+}
+module_exit(slimbus_exit);
+
+static int __init slimbus_init(void)
+{
+	return bus_register(&slimbus_bus);
+}
+postcore_initcall(slimbus_init);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("SLIMbus core");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index abb6dc2ebbf8..48e188327c02 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -452,6 +452,19 @@ struct spi_device_id {
 	kernel_ulong_t driver_data;	/* Data private to the driver */
 };
 
+/* SLIMbus */
+
+#define SLIMBUS_NAME_SIZE	32
+#define SLIMBUS_MODULE_PREFIX	"slim:"
+
+struct slim_device_id {
+	__u16 manf_id, prod_code;
+	__u16 dev_index, instance;
+
+	/* Data private to the driver */
+	kernel_ulong_t driver_data;
+};
+
 #define SPMI_NAME_SIZE	32
 #define SPMI_MODULE_PREFIX "spmi:"
 
diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
new file mode 100644
index 000000000000..6b4ed290fbb0
--- /dev/null
+++ b/include/linux/slimbus.h
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2011-2017, The Linux Foundation
+ */
+
+#ifndef _LINUX_SLIMBUS_H
+#define _LINUX_SLIMBUS_H
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/mod_devicetable.h>
+
+extern struct bus_type slimbus_bus;
+
+/**
+ * struct slim_eaddr - Enumeration address for a SLIMbus device
+ * @manf_id: Manufacturer Id for the device
+ * @prod_code: Product code
+ * @dev_index: Device index
+ * @instance: Instance value
+ */
+struct slim_eaddr {
+	u16 manf_id;
+	u16 prod_code;
+	u8 dev_index;
+	u8 instance;
+} __packed;
+
+/**
+ * enum slim_device_status - slim device status
+ * @SLIM_DEVICE_STATUS_DOWN: Slim device is absent or not reported yet.
+ * @SLIM_DEVICE_STATUS_UP: Slim device is announced on the bus.
+ * @SLIM_DEVICE_STATUS_RESERVED: Reserved for future use.
+ */
+enum slim_device_status {
+	SLIM_DEVICE_STATUS_DOWN = 0,
+	SLIM_DEVICE_STATUS_UP,
+	SLIM_DEVICE_STATUS_RESERVED,
+};
+
+/**
+ * struct slim_device - Slim device handle.
+ * @dev: Driver model representation of the device.
+ * @e_addr: Enumeration address of this device.
+ * @status: slim device status
+ * @laddr: 1-byte Logical address of this device.
+ * @is_laddr_valid: indicates if the laddr is valid or not
+ *
+ * This is the client/device handle returned when a SLIMbus
+ * device is registered with a controller.
+ * Pointer to this structure is used by client-driver as a handle.
+ */
+struct slim_device {
+	struct device		dev;
+	struct slim_eaddr	e_addr;
+	enum slim_device_status	status;
+	u8			laddr;
+	bool			is_laddr_valid;
+};
+
+#define to_slim_device(d) container_of(d, struct slim_device, dev)
+
+/**
+ * struct slim_driver - SLIMbus 'generic device' (slave) device driver
+ *				(similar to 'spi_device' on SPI)
+ * @probe: Binds this driver to a SLIMbus device.
+ * @remove: Unbinds this driver from the SLIMbus device.
+ * @shutdown: Standard shutdown callback used during powerdown/halt.
+ * @device_status: This callback is called when
+ *	- The device reports present and gets a laddr assigned
+ *	- The device reports absent, or the bus goes down.
+ * @driver: SLIMbus device drivers should initialize name and owner field of
+ *	    this structure
+ * @id_table: List of SLIMbus devices supported by this driver
+ */
+
+struct slim_driver {
+	int	(*probe)(struct slim_device *sl);
+	void	(*remove)(struct slim_device *sl);
+	void	(*shutdown)(struct slim_device *sl);
+	int	(*device_status)(struct slim_device *sl,
+				 enum slim_device_status s);
+	struct device_driver		driver;
+	const struct slim_device_id	*id_table;
+};
+#define to_slim_driver(d) container_of(d, struct slim_driver, driver)
+
+/*
+ * use a macro to avoid include chaining to get THIS_MODULE
+ */
+#define slim_driver_register(drv) \
+	__slim_driver_register(drv, THIS_MODULE)
+int __slim_driver_register(struct slim_driver *drv, struct module *owner);
+void slim_driver_unregister(struct slim_driver *drv);
+
+/**
+ * module_slim_driver() - Helper macro for registering a SLIMbus driver
+ * @__slim_driver: slimbus_driver struct
+ *
+ * Helper macro for SLIMbus drivers which do not do anything special in module
+ * init/exit. This eliminates a lot of boilerplate. Each module may only
+ * use this macro once, and calling it replaces module_init() and module_exit()
+ */
+#define module_slim_driver(__slim_driver) \
+	module_driver(__slim_driver, slim_driver_register, \
+			slim_driver_unregister)
+
+static inline void *slim_get_devicedata(const struct slim_device *dev)
+{
+	return dev_get_drvdata(&dev->dev);
+}
+
+static inline void slim_set_devicedata(struct slim_device *dev, void *data)
+{
+	dev_set_drvdata(&dev->dev, data);
+}
+#endif /* _LINUX_SLIMBUS_H */
-- 
2.15.0

^ permalink raw reply related

* [PATCH v10 02/13] dt-bindings: Add SLIMbus bindings
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: Mark Rutland, devicetree, Jonathan Corbet, linux-arm-msm,
	linux-doc, j.neuschaefer, linux-kernel, Rob Herring,
	Srinivas Kandagatla, pombredanne, sdharia
In-Reply-To: <20171211234307.14465-1-srinivas.kandagatla@linaro.org>

From: Sagar Dharia <sdharia@codeaurora.org>

SLIMbus (Serial Low Power Interchip Media Bus) is a specification
developed by MIPI (Mobile Industry Processor Interface) alliance.
SLIMbus is a 2-wire implementation, which is used to communicate with
peripheral components like audio-codec.

This patch adds device tree bindings for the slimbus.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/slimbus/bus.txt | 50 +++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/slimbus/bus.txt

diff --git a/Documentation/devicetree/bindings/slimbus/bus.txt b/Documentation/devicetree/bindings/slimbus/bus.txt
new file mode 100644
index 000000000000..52fa6426388c
--- /dev/null
+++ b/Documentation/devicetree/bindings/slimbus/bus.txt
@@ -0,0 +1,50 @@
+SLIM(Serial Low Power Interchip Media Bus) bus
+
+SLIMbus is a 2-wire bus, and is used to communicate with peripheral
+components like audio-codec.
+
+Required property for SLIMbus controller node:
+- compatible	- name of SLIMbus controller
+
+Child nodes:
+Every SLIMbus controller node can contain zero or more child nodes
+representing slave devices on the bus. Every SLIMbus slave device is
+uniquely determined by the enumeration address containing 4 fields:
+Manufacturer ID, Product code, Device index, and Instance value for
+the device.
+If child node is not present and it is instantiated after device
+discovery (slave device reporting itself present).
+
+In some cases it may be necessary to describe non-probeable device
+details such as non-standard ways of powering up a device. In
+such cases, child nodes for those devices will be present as
+slaves of the SLIMbus controller, as detailed below.
+
+Required property for SLIMbus child node if it is present:
+- reg		- Should be ('Device index', 'Instance ID') from SLIMbus
+		  Enumeration  Address.
+		  Device Index Uniquely identifies multiple Devices within
+		  a single Component.
+		  Instance ID Is for the cases where multiple Devices of the
+		  same type or Class are attached to the bus.
+
+- compatible	-"slimMID,PID". The textual representation of Manufacturer ID,
+	 	  Product Code, shall be in lower case hexadecimal with leading
+		  zeroes suppressed
+
+SLIMbus example for Qualcomm's slimbus manager component:
+
+	slim@28080000 {
+		compatible = "qcom,apq8064-slim", "qcom,slim";
+		reg = <0x28080000 0x2000>,
+		interrupts = <0 33 0>;
+		clocks = <&lcc SLIMBUS_SRC>, <&lcc AUDIO_SLIMBUS_CLK>;
+		clock-names = "iface", "core";
+		#address-cells = <2>;
+		#size-cell = <0>;
+
+		codec: wcd9310@1,0{
+			compatible = "slim217,60";
+			reg = <1 0>;
+		};
+	};
-- 
2.15.0

^ permalink raw reply related

* [PATCH v10 01/13] Documentation: Add SLIMbus summary
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: Mark Rutland, devicetree, Jonathan Corbet, linux-arm-msm,
	linux-doc, j.neuschaefer, linux-kernel, Rob Herring,
	Srinivas Kandagatla, pombredanne, sdharia
In-Reply-To: <20171211234307.14465-1-srinivas.kandagatla@linaro.org>

From: Sagar Dharia <sdharia@codeaurora.org>

SLIMbus (Serial Low Power Interchip Media Bus) is a specification
developed by MIPI (Mobile Industry Processor Interface) alliance.
SLIMbus is a 2-wire implementation, which is used to communicate with
peripheral components like audio-codec.

The summary of SLIMbus and API is documented in the 'summary' file.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 Documentation/driver-api/index.rst   |   1 +
 Documentation/driver-api/slimbus.rst | 127 +++++++++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 Documentation/driver-api/slimbus.rst

diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
index d17a9876b473..ef7c9e0b179c 100644
--- a/Documentation/driver-api/index.rst
+++ b/Documentation/driver-api/index.rst
@@ -47,6 +47,7 @@ available subsections can be seen below.
    gpio
    misc_devices
    dmaengine/index
+   slimbus
 
 .. only::  subproject and html
 
diff --git a/Documentation/driver-api/slimbus.rst b/Documentation/driver-api/slimbus.rst
new file mode 100644
index 000000000000..7555ecd538de
--- /dev/null
+++ b/Documentation/driver-api/slimbus.rst
@@ -0,0 +1,127 @@
+============================
+Linux kernel SLIMbus support
+============================
+
+Overview
+========
+
+What is SLIMbus?
+----------------
+SLIMbus (Serial Low Power Interchip Media Bus) is a specification developed by
+MIPI (Mobile Industry Processor Interface) alliance. The bus uses master/slave
+configuration, and is a 2-wire multi-drop implementation (clock, and data).
+
+Currently, SLIMbus is used to interface between application processors of SoCs
+(System-on-Chip) and peripheral components (typically codec). SLIMbus uses
+Time-Division-Multiplexing to accommodate multiple data channels, and
+a control channel.
+
+The control channel is used for various control functions such as bus
+management, configuration and status updates. These messages can be unicast (e.g.
+reading/writing device specific values), or multicast (e.g. data channel
+reconfiguration sequence is a broadcast message announced to all devices)
+
+A data channel is used for data-transfer between 2 SLIMbus devices. Data
+channel uses dedicated ports on the device.
+
+Hardware description:
+---------------------
+SLIMbus specification has different types of device classifications based on
+their capabilities.
+A manager device is responsible for enumeration, configuration, and dynamic
+channel allocation. Every bus has 1 active manager.
+
+A generic device is a device providing application functionality (e.g. codec).
+
+Framer device is responsible for clocking the bus, and transmitting frame-sync
+and framing information on the bus.
+
+Each SLIMbus component has an interface device for monitoring physical layer.
+
+Typically each SoC contains SLIMbus component having 1 manager, 1 framer device,
+1 generic device (for data channel support), and 1 interface device.
+External peripheral SLIMbus component usually has 1 generic device (for
+functionality/data channel support), and an associated interface device.
+The generic device's registers are mapped as 'value elements' so that they can
+be written/read using SLIMbus control channel exchanging control/status type of
+information.
+In case there are multiple framer devices on the same bus, manager device is
+responsible to select the active-framer for clocking the bus.
+
+Per specification, SLIMbus uses "clock gears" to do power management based on
+current frequency and bandwidth requirements. There are 10 clock gears and each
+gear changes the SLIMbus frequency to be twice its previous gear.
+
+Each device has a 6-byte enumeration-address and the manager assigns every
+device with a 1-byte logical address after the devices report presence on the
+bus.
+
+Software description:
+---------------------
+There are 2 types of SLIMbus drivers:
+
+slim_controller represents a 'controller' for SLIMbus. This driver should
+implement duties needed by the SoC (manager device, associated
+interface device for monitoring the layers and reporting errors, default
+framer device).
+
+slim_device represents the 'generic device/component' for SLIMbus, and a
+slim_driver should implement driver for that slim_device.
+
+Device notifications to the driver:
+-----------------------------------
+Since SLIMbus devices have mechanisms for reporting their presence, the
+framework allows drivers to bind when corresponding devices report their
+presence on the bus.
+However, it is possible that the driver needs to be probed
+first so that it can enable corresponding SLIMbus device (e.g. power it up and/or
+take it out of reset). To support that behavior, the framework allows drivers
+to probe first as well  (e.g. using standard DeviceTree compatibility field).
+This creates the necessity for the driver to know when the device is functional
+(i.e. reported present). device_up callback is used for that reason when the
+device reports present and is assigned a logical address by the controller.
+
+Similarly, SLIMbus devices 'report absent' when they go down. A 'device_down'
+callback notifies the driver when the device reports absent and its logical
+address assignment is invalidated by the controller.
+
+Another notification "boot_device" is used to notify the slim_driver when
+controller resets the bus. This notification allows the driver to take necessary
+steps to boot the device so that it's functional after the bus has been reset.
+
+Driver and Controller APIs:
+--------------------------
+.. kernel-doc:: include/linux/slimbus.h
+   :internal:
+
+.. kernel-doc:: drivers/slimbus/slimbus.h
+   :internal:
+
+.. kernel-doc:: drivers/slimbus/core.c
+   :export:
+
+Clock-pause:
+------------
+SLIMbus mandates that a reconfiguration sequence (known as clock-pause) be
+broadcast to all active devices on the bus before the bus can enter low-power
+mode. Controller uses this sequence when it decides to enter low-power mode so
+that corresponding clocks and/or power-rails can be turned off to save power.
+Clock-pause is exited by waking up framer device (if controller driver initiates
+exiting low power mode), or by toggling the data line (if a slave device wants
+to initiate it).
+
+Clock-pause APIs:
+~~~~~~~~~~~~~~~~~
+.. kernel-doc:: drivers/slimbus/sched.c
+   :export:
+
+Messaging:
+----------
+The framework supports regmap and read/write apis to exchange control-information
+with a SLIMbus device. APIs can be synchronous or asynchronous.
+The header file <linux/slimbus.h> has more documentation about messaging APIs.
+
+Messaging APIs:
+~~~~~~~~~~~~~~~
+.. kernel-doc:: drivers/slimbus/messaging.c
+   :export:
-- 
2.15.0

^ permalink raw reply related

* [PATCH v10 00/13] Introduce framework for SLIMbus device driver
From: srinivas.kandagatla @ 2017-12-11 23:42 UTC (permalink / raw)
  To: Mark Brown, Greg Kroah-Hartman, alsa-devel
  Cc: sdharia, Rob Herring, Mark Rutland, Jonathan Corbet, pombredanne,
	j.neuschaefer, linux-arm-msm, devicetree, linux-kernel, linux-doc,
	Srinivas Kandagatla

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

SLIMbus (Serial Low Power Interchip Media Bus) is a specification
developed by MIPI (Mobile Industry Processor Interface) alliance.
SLIMbus is a 2-wire implementation, which is used to communicate with
peripheral components like audio-codec.
SLIMbus uses Time-Division-Multiplexing to accommodate multiple data
channels, and control channel. Control channel has messages to do
device-enumeration, messages to send/receive control-data to/from
SLIMbus devices, messages for port/channel management, and messages to
do bandwidth allocation.
Framework is introduced to support  multiple instances of the bus
(1 controller per bus), and multiple slave devices per controller.
SPI and I2C frameworks, and comments from last time when I submitted
the patches were referred-to while working on this framework.

These patchsets introduce device-management, OF helpers, and messaging
APIs, controller driver for Qualcomm's SLIMbus controller, and
clock-pause feature for entering/exiting low-power mode for SLIMbus.
Framework patches to do channel, port and bandwidth
management are work-in-progress and will be sent out once these
initial patches are accepted.

These patchsets were tested on IFC6410 board with Qualcomm APQ8064
processor using the controller driver, and a WCD9310 codec.

v9: https://lkml.org/lkml/2017/12/7/289

Changes from v9 to v10:
* Added kernel-doc reference into slimbus driver api doc suggested by
 Jonathan Corbet

Sagar Dharia (9):
  Documentation: Add SLIMbus summary
  dt-bindings: Add SLIMbus bindings
  slimbus: Add SLIMbus bus type
  slimbus: core: Add slim controllers support
  slimbus: Add messaging APIs to slimbus framework
  slimbus: Add support for 'clock-pause' feature
  dt-bindings: Add qcom slimbus controller bindings
  slimbus: qcom: Add Qualcomm Slimbus controller driver
  slimbus: qcom: Add runtime-pm support using clock-pause

Srinivas Kandagatla (4):
  slimbus: core: add support to device tree helper
  regmap: add SLIMbus support
  slimbus: core: add common defines required for controllers
  MAINTAINERS: Add SLIMbus maintainer

 Documentation/devicetree/bindings/slimbus/bus.txt  |  50 ++
 .../devicetree/bindings/slimbus/slim-qcom-ctrl.txt |  39 ++
 Documentation/driver-api/index.rst                 |   1 +
 Documentation/driver-api/slimbus.rst               | 127 ++++
 MAINTAINERS                                        |   8 +
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   1 +
 drivers/base/regmap/Kconfig                        |   4 +
 drivers/base/regmap/Makefile                       |   1 +
 drivers/base/regmap/regmap-slimbus.c               |  80 +++
 drivers/slimbus/Kconfig                            |  23 +
 drivers/slimbus/Makefile                           |  10 +
 drivers/slimbus/core.c                             | 480 +++++++++++++
 drivers/slimbus/messaging.c                        | 330 +++++++++
 drivers/slimbus/qcom-ctrl.c                        | 750 +++++++++++++++++++++
 drivers/slimbus/sched.c                            | 121 ++++
 drivers/slimbus/slimbus.h                          | 261 +++++++
 include/linux/mod_devicetable.h                    |  13 +
 include/linux/regmap.h                             |  18 +
 include/linux/slimbus.h                            | 164 +++++
 20 files changed, 2483 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/slimbus/bus.txt
 create mode 100644 Documentation/devicetree/bindings/slimbus/slim-qcom-ctrl.txt
 create mode 100644 Documentation/driver-api/slimbus.rst
 create mode 100644 drivers/base/regmap/regmap-slimbus.c
 create mode 100644 drivers/slimbus/Kconfig
 create mode 100644 drivers/slimbus/Makefile
 create mode 100644 drivers/slimbus/core.c
 create mode 100644 drivers/slimbus/messaging.c
 create mode 100644 drivers/slimbus/qcom-ctrl.c
 create mode 100644 drivers/slimbus/sched.c
 create mode 100644 drivers/slimbus/slimbus.h
 create mode 100644 include/linux/slimbus.h

-- 
2.15.0

^ permalink raw reply

* Re: [PATCH v9 01/13] Documentation: Add SLIMbus summary
From: Jonathan Corbet @ 2017-12-11 23:34 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Mark Brown, Greg Kroah-Hartman, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	sdharia-sgV2jX0FEOL9JmXXK+q4OQ, Rob Herring, Mark Rutland,
	pombredanne-od1rfyK75/E, j.neuschaefer-hi6Y0CQ0nG0,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <138216ca-4351-f895-fae2-0289cf2a3872-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On Thu, 7 Dec 2017 23:22:51 +0000
Srinivas Kandagatla <srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:

> > It seems you have kerneldoc comments for your data structures and at least
> > some of your exported symbols.  If you really want to document this stuff
> > well, I'd suggest finishing out those comments, then pulling them into the
> > documentation in the appropriate places.  
> Am sure all the exported symbols have kernel doc, I will pull them into 
> relevant sub sections.
> 
> Do you think something like this http://paste.ubuntu.com/26135862/ makes 
> sense?

At a first glance it looks good to me.

Thanks,

jon
--
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 v2 1/5] dt-bindings: rtc: add bindings for i.MX53 SRTC
From: Fabio Estevam @ 2017-12-11 23:08 UTC (permalink / raw)
  To: Patrick Brünn
  Cc: Rob Herring, linux-kernel-dev, Shawn Guo, Sascha Hauer,
	Alessandro Zummo, Alexandre Belloni, Patrick Bruenn, Mark Rutland,
	open list:REAL TIME CLOCK (RTC) SUBSYSTEM,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, Fabio Estevam, Juergen Borleis, Noel Vellemans,
	Russell King, ARM/FREESCALE 
In-Reply-To: <3BB206AB2B1BD448954845CE6FF69A8E01CB53233C-vUij6NSodOcSOXk/eDA+lhuDmiLEvxRJ@public.gmane.org>

Hi Patrick,

On Mon, Dec 11, 2017 at 5:08 AM, Patrick Brünn <P.Bruenn-QonKdJ6Bx35Wk0Htik3J/w@public.gmane.org> wrote:

>>rtc@...
>>
> The rtc for which this series adds support is embedded within a function block called
> "Secure Real Time Clock". This driver doesn't utilize all of the hardware features by
> now. But maybe someone else wants to extend the functionalities, later.
> For that possibility I wanted to name the node "srtc". Should I still change this?
>
> I believe you have a much better understanding of what should be done here. I don't
> want to argue with you, just thought you might not had that information. So if I am
> wrong just tell me and I will change it without further "complaining".

>From the Devicetree Specification document:

"Generic Names Recommendation

The name of a node should be somewhat generic, reflecting the function
of the device and not its precise program-
ming model. If appropriate, the name should be one of the following choices:
...
rtc
"

So better use 'rtc' as suggested by Rob.
--
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

* [RFT PATCH] ARM: dts: exynos: Enable Mixer node for Exynos5800 Peach Pi machine
From: Javier Martinez Canillas @ 2017-12-11 22:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Marek Szyprowski, Guillaume Tucker, Daniel Vetter, Shuah Khan,
	Javier Martinez Canillas, devicetree, Kukjin Kim, Russell King,
	linux-samsung-soc, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	linux-arm-kernel

Commit 1cb686c08d12 ("ARM: dts: exynos: Add status property to Exynos 542x
Mixer nodes") disabled the Mixer node by default in the DTSI and enabled
for each Exynos 542x DTS. But unfortunately it missed to enable it for the
Exynos5800 Peach Pi machine, since the 5800 is also an 542x SoC variant.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

---

I believe this may cause the boot issues reported on Exynos5800 Peach Pi
from v4.15-rc3, the mentioned commit made to v4.15-rc1 but it seems that
didn't cause any harm until commit ("510353a63796 drm/bridge: analogix
dp: Fix runtime PM state in get_modes() callback") fixed the runtime PM
management in the DP driver.

I can't test right now, but I'm posting anyways as a RFT in case others
that have access to a Peach Pi can test it.

Best regards,
Javier

 arch/arm/boot/dts/exynos5800-peach-pi.dts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5800-peach-pi.dts b/arch/arm/boot/dts/exynos5800-peach-pi.dts
index b2b95ff205e8..0029ec27819c 100644
--- a/arch/arm/boot/dts/exynos5800-peach-pi.dts
+++ b/arch/arm/boot/dts/exynos5800-peach-pi.dts
@@ -664,6 +664,10 @@
 	status = "okay";
 };
 
+&mixer {
+	status = "okay";
+};
+
 /* eMMC flash */
 &mmc_0 {
 	status = "okay";
-- 
2.14.3

^ permalink raw reply related

* Re: [PATCH 0/2] of: overlay: Crash fix and improvement
From: Frank Rowand @ 2017-12-11 22:33 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Geert Uytterhoeven, Pantelis Antoniou, Rob Herring,
	devicetree@vger.kernel.org, Linux-Renesas,
	linux-kernel@vger.kernel.org
In-Reply-To: <CAMuHMdXGg9hF+AS8TtW2LSxVDaSkDit+7=QO2=p3_BZ-8TROWA@mail.gmail.com>

On 12/09/17 01:04, Geert Uytterhoeven wrote:
> Hi Frank,
> 
> On Sat, Dec 9, 2017 at 7:01 AM, Frank Rowand <frowand.list@gmail.com> wrote:
>> On 12/08/17 05:13, Geert Uytterhoeven wrote:
>>> 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!
> 
> Sure, people can throw anything at it ;-)
> 
> In my case, I'm wondering if the dtbo was actually invalid?
> Simplification of the decompiled dtbo:
> 
> /dts-v1/;
> 
> / {
> 
>         fragment-name {
>                 target-path = [2f 00];
> 
>                 __overlay__ {
> 
>                         node-name {
>                                 compatible = "foo,bar";
>                                 gpios = <0xffffffff 0x0 0x0>;
>                         };
>                 };
>         };
> 
>         __fixups__ {
>                 bank0 = "/fragment-name/__overlay__/node-name:gpios:0";
>         };
> };
> 
> So it has __fixup__, but no __symbols__, which looks totally valid to me.

Yes, that is correct.  The bug would also be exposed if there was a __local_fixups__
node without a __symbols__ node.  Which is also a valid overlay.

My comment was triggered by another possible case, where a non-overlay node
occurs in an overlay, without a __symbols__ node.  I'm not positive, but I
don't think that dtc would find an error in that case. 


>> For the full series:
>>
>> Reviewed-by: Frank Rowand <frank.rowand@sony.com>
> 
> Thanks!
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 

^ permalink raw reply

* Re: [v7, 3/3] ARM: dts: imx6qdl.dtsi/imx6ul.dtsi: add "fsl, imx6q-snvs-lpgpr" node
From: Maciej S. Szmigiero @ 2017-12-11 22:31 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mark Rutland, Maxime Ripard,
	Rob Herring, Shawn Guo, Srinivas Kandagatla, Guy Shapiro,
	Stefan Wahren
In-Reply-To: <20170620070932.10353-4-o.rempel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On 20.06.2017 09:09, Oleksij Rempel wrote:
> This node is for Low Power General Purpose Register which can
> be used as Non-Volatile Storage.
> 
> Signed-off-by: Oleksij Rempel <o.rempel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> ---
>  arch/arm/boot/dts/imx6qdl.dtsi | 4 ++++
>  arch/arm/boot/dts/imx6ul.dtsi  | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
> index e426faa9c243..94e992558238 100644
(..)

FYI: It looks to me that while the driver itself from this series was
picked up and eventually reached Linus' tree this DT change was 
forgotten, since I can't find in any tree (or am I not looking at the
right place?).

Maciej
--
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 v2 3/6] ARM: sun4i: Convert to CCU
From: Kevin Hilman @ 2017-12-11 22:22 UTC (permalink / raw)
  To: plaes-q/aMd4JkU83YtjvyW6yDsg, Chen-Yu Tsai, Maxime Ripard
  Cc: lkml, linux-arm-kernel, devicetree,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Icenowy Zheng, Russell King,
	Mark Rutland, Rob Herring, Stephen Boyd, Michael Turquette,
	Philipp Zabel, Olof Johansson
In-Reply-To: <4357a69da97f46a324eec4c766f4bc9d9e7733ff.1490545262.git-series.plaes-q/aMd4JkU83YtjvyW6yDsg@public.gmane.org>

On Sun, Mar 26, 2017 at 10:20 AM, Priit Laes <plaes-q/aMd4JkU83YtjvyW6yDsg@public.gmane.org> wrote:
> Convert sun4i-a10.dtsi to new CCU driver.
>
> Signed-off-by: Priit Laes <plaes-q/aMd4JkU83YtjvyW6yDsg@public.gmane.org>

I finally got around to bisecting a mainline boot failure on
sun4i-a10-cubieboard that's been happening for quite a while.  Based
on on kernelci.org, it showed up sometime during the v4.15 merge
window[1].  It bisected down to this commit (in mainline as commit
41193869f2bdb585ce09bfdd16d9482aadd560ad).

When it fails, there is no output on the serial console, so I don't
know exactly how it's failing, just that it no longer boots.

Kevin

[1] https://kernelci.org/boot/id/5a2e10cd59b51430a9afa173/

> ---
>  arch/arm/boot/dts/sun4i-a10.dtsi | 636 ++++----------------------------
>  1 file changed, 82 insertions(+), 554 deletions(-)
>
> diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi
> index ba20b48..0d8320a 100644
> --- a/arch/arm/boot/dts/sun4i-a10.dtsi
> +++ b/arch/arm/boot/dts/sun4i-a10.dtsi
> @@ -45,7 +45,8 @@
>
>  #include <dt-bindings/thermal/thermal.h>
>
> -#include <dt-bindings/clock/sun4i-a10-pll2.h>
> +#include <dt-bindings/clock/sunxi-a10-a20-ccu.h>
> +#include <dt-bindings/reset/sunxi-a10-a20-ccu.h>
>  #include <dt-bindings/dma/sun4i-a10.h>
>  #include <dt-bindings/pinctrl/sun4i-a10.h>
>
> @@ -65,9 +66,9 @@
>                         compatible = "allwinner,simple-framebuffer",
>                                      "simple-framebuffer";
>                         allwinner,pipeline = "de_be0-lcd0-hdmi";
> -                       clocks = <&ahb_gates 36>, <&ahb_gates 43>,
> -                                <&ahb_gates 44>, <&de_be0_clk>,
> -                                <&tcon0_ch1_clk>, <&dram_gates 26>;
> +                       clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_HDMI1>,
> +                                <&ccu CLK_AHB_DE_BE0>, <&ccu CLK_DE_BE0>,
> +                                <&ccu CLK_TCON0_CH1>, <&ccu CLK_DRAM_DE_BE0>;
>                         status = "disabled";
>                 };
>
> @@ -75,10 +76,11 @@
>                         compatible = "allwinner,simple-framebuffer",
>                                      "simple-framebuffer";
>                         allwinner,pipeline = "de_fe0-de_be0-lcd0-hdmi";
> -                       clocks = <&ahb_gates 36>, <&ahb_gates 43>,
> -                                <&ahb_gates 44>, <&ahb_gates 46>,
> -                                <&de_be0_clk>, <&de_fe0_clk>, <&tcon0_ch1_clk>,
> -                                <&dram_gates 25>, <&dram_gates 26>;
> +                       clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_HDMI1>,
> +                                <&ccu CLK_AHB_DE_BE0>, <&ccu CLK_AHB_DE_FE0>,
> +                                <&ccu CLK_DE_BE0>, <&ccu CLK_DE_FE0>,
> +                                <&ccu CLK_TCON0_CH1>,
> +                                <&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
>                         status = "disabled";
>                 };
>
> @@ -86,9 +88,10 @@
>                         compatible = "allwinner,simple-framebuffer",
>                                      "simple-framebuffer";
>                         allwinner,pipeline = "de_fe0-de_be0-lcd0";
> -                       clocks = <&ahb_gates 36>, <&ahb_gates 44>, <&ahb_gates 46>,
> -                                <&de_be0_clk>, <&de_fe0_clk>, <&tcon0_ch0_clk>,
> -                                <&dram_gates 25>, <&dram_gates 26>;
> +                       clocks = <&ccu CLK_AHB_LCD0>, <&ccu CLK_AHB_DE_BE0>,
> +                                <&ccu CLK_AHB_DE_FE0>, <&ccu CLK_DE_BE0>,
> +                                <&ccu CLK_DE_FE0>, <&ccu CLK_TCON0_CH1>,
> +                                <&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
>                         status = "disabled";
>                 };
>
> @@ -96,11 +99,11 @@
>                         compatible = "allwinner,simple-framebuffer",
>                                      "simple-framebuffer";
>                         allwinner,pipeline = "de_fe0-de_be0-lcd0-tve0";
> -                       clocks = <&ahb_gates 34>, <&ahb_gates 36>,
> -                                <&ahb_gates 44>, <&ahb_gates 46>,
> -                                <&de_be0_clk>, <&de_fe0_clk>,
> -                                <&tcon0_ch1_clk>, <&dram_gates 5>,
> -                                <&dram_gates 25>, <&dram_gates 26>;
> +                       clocks = <&ccu CLK_AHB_TVE0>, <&ccu CLK_AHB_LCD0>,
> +                                <&ccu CLK_AHB_DE_BE0>, <&ccu CLK_AHB_DE_FE0>,
> +                                <&ccu CLK_DE_BE0>, <&ccu CLK_DE_FE0>,
> +                                <&ccu CLK_TCON0_CH1>, <&ccu CLK_DRAM_TVE0>,
> +                                <&ccu CLK_DRAM_DE_FE0>, <&ccu CLK_DRAM_DE_BE0>;
>                         status = "disabled";
>                 };
>         };
> @@ -112,7 +115,7 @@
>                         device_type = "cpu";
>                         compatible = "arm,cortex-a8";
>                         reg = <0x0>;
> -                       clocks = <&cpu>;
> +                       clocks = <&ccu CLK_CPU>;
>                         clock-latency = <244144>; /* 8 32k periods */
>                         operating-points = <
>                                 /* kHz    uV */
> @@ -168,18 +171,6 @@
>                 #size-cells = <1>;
>                 ranges;
>
> -               /*
> -                * This is a dummy clock, to be used as placeholder on
> -                * other mux clocks when a specific parent clock is not
> -                * yet implemented. It should be dropped when the driver
> -                * is complete.
> -                */
> -               dummy: dummy {
> -                       #clock-cells = <0>;
> -                       compatible = "fixed-clock";
> -                       clock-frequency = <0>;
> -               };
> -
>                 osc24M: clk@01c20050 {
>                         #clock-cells = <0>;
>                         compatible = "allwinner,sun4i-a10-osc-clk";
> @@ -188,487 +179,12 @@
>                         clock-output-names = "osc24M";
>                 };
>
> -               osc3M: osc3M_clk {
> -                       compatible = "fixed-factor-clock";
> -                       #clock-cells = <0>;
> -                       clock-div = <8>;
> -                       clock-mult = <1>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "osc3M";
> -               };
> -
>                 osc32k: clk@0 {
>                         #clock-cells = <0>;
>                         compatible = "fixed-clock";
>                         clock-frequency = <32768>;
>                         clock-output-names = "osc32k";
>                 };
> -
> -               pll1: clk@01c20000 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-pll1-clk";
> -                       reg = <0x01c20000 0x4>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "pll1";
> -               };
> -
> -               pll2: clk@01c20008 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-pll2-clk";
> -                       reg = <0x01c20008 0x8>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "pll2-1x", "pll2-2x",
> -                                            "pll2-4x", "pll2-8x";
> -               };
> -
> -               pll3: clk@01c20010 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-pll3-clk";
> -                       reg = <0x01c20010 0x4>;
> -                       clocks = <&osc3M>;
> -                       clock-output-names = "pll3";
> -               };
> -
> -               pll3x2: pll3x2_clk {
> -                       compatible = "fixed-factor-clock";
> -                       #clock-cells = <0>;
> -                       clock-div = <1>;
> -                       clock-mult = <2>;
> -                       clocks = <&pll3>;
> -                       clock-output-names = "pll3-2x";
> -               };
> -
> -               pll4: clk@01c20018 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-pll1-clk";
> -                       reg = <0x01c20018 0x4>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "pll4";
> -               };
> -
> -               pll5: clk@01c20020 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-pll5-clk";
> -                       reg = <0x01c20020 0x4>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "pll5_ddr", "pll5_other";
> -               };
> -
> -               pll6: clk@01c20028 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-pll6-clk";
> -                       reg = <0x01c20028 0x4>;
> -                       clocks = <&osc24M>;
> -                       clock-output-names = "pll6_sata", "pll6_other", "pll6";
> -               };
> -
> -               pll7: clk@01c20030 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-pll3-clk";
> -                       reg = <0x01c20030 0x4>;
> -                       clocks = <&osc3M>;
> -                       clock-output-names = "pll7";
> -               };
> -
> -               pll7x2: pll7x2_clk {
> -                       compatible = "fixed-factor-clock";
> -                       #clock-cells = <0>;
> -                       clock-div = <1>;
> -                       clock-mult = <2>;
> -                       clocks = <&pll7>;
> -                       clock-output-names = "pll7-2x";
> -               };
> -
> -               /* dummy is 200M */
> -               cpu: cpu@01c20054 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-cpu-clk";
> -                       reg = <0x01c20054 0x4>;
> -                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&dummy>;
> -                       clock-output-names = "cpu";
> -               };
> -
> -               axi: axi@01c20054 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-axi-clk";
> -                       reg = <0x01c20054 0x4>;
> -                       clocks = <&cpu>;
> -                       clock-output-names = "axi";
> -               };
> -
> -               axi_gates: clk@01c2005c {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-axi-gates-clk";
> -                       reg = <0x01c2005c 0x4>;
> -                       clocks = <&axi>;
> -                       clock-indices = <0>;
> -                       clock-output-names = "axi_dram";
> -               };
> -
> -               ahb: ahb@01c20054 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-ahb-clk";
> -                       reg = <0x01c20054 0x4>;
> -                       clocks = <&axi>;
> -                       clock-output-names = "ahb";
> -               };
> -
> -               ahb_gates: clk@01c20060 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-ahb-gates-clk";
> -                       reg = <0x01c20060 0x8>;
> -                       clocks = <&ahb>;
> -                       clock-indices = <0>, <1>,
> -                                       <2>, <3>,
> -                                       <4>, <5>, <6>,
> -                                       <7>, <8>, <9>,
> -                                       <10>, <11>, <12>,
> -                                       <13>, <14>, <16>,
> -                                       <17>, <18>, <20>,
> -                                       <21>, <22>, <23>,
> -                                       <24>, <25>, <26>,
> -                                       <32>, <33>, <34>,
> -                                       <35>, <36>, <37>,
> -                                       <40>, <41>, <43>,
> -                                       <44>, <45>,
> -                                       <46>, <47>,
> -                                       <50>, <52>;
> -                       clock-output-names = "ahb_usb0", "ahb_ehci0",
> -                                            "ahb_ohci0", "ahb_ehci1",
> -                                            "ahb_ohci1", "ahb_ss", "ahb_dma",
> -                                            "ahb_bist", "ahb_mmc0", "ahb_mmc1",
> -                                            "ahb_mmc2", "ahb_mmc3", "ahb_ms",
> -                                            "ahb_nand", "ahb_sdram", "ahb_ace",
> -                                            "ahb_emac", "ahb_ts", "ahb_spi0",
> -                                            "ahb_spi1", "ahb_spi2", "ahb_spi3",
> -                                            "ahb_pata", "ahb_sata", "ahb_gps",
> -                                            "ahb_ve", "ahb_tvd", "ahb_tve0",
> -                                            "ahb_tve1", "ahb_lcd0", "ahb_lcd1",
> -                                            "ahb_csi0", "ahb_csi1", "ahb_hdmi",
> -                                            "ahb_de_be0", "ahb_de_be1",
> -                                            "ahb_de_fe0", "ahb_de_fe1",
> -                                            "ahb_mp", "ahb_mali400";
> -               };
> -
> -               apb0: apb0@01c20054 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-apb0-clk";
> -                       reg = <0x01c20054 0x4>;
> -                       clocks = <&ahb>;
> -                       clock-output-names = "apb0";
> -               };
> -
> -               apb0_gates: clk@01c20068 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-apb0-gates-clk";
> -                       reg = <0x01c20068 0x4>;
> -                       clocks = <&apb0>;
> -                       clock-indices = <0>, <1>,
> -                                       <2>, <3>,
> -                                       <5>, <6>,
> -                                       <7>, <10>;
> -                       clock-output-names = "apb0_codec", "apb0_spdif",
> -                                            "apb0_ac97", "apb0_iis",
> -                                            "apb0_pio", "apb0_ir0",
> -                                            "apb0_ir1", "apb0_keypad";
> -               };
> -
> -               apb1: clk@01c20058 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-apb1-clk";
> -                       reg = <0x01c20058 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&osc32k>;
> -                       clock-output-names = "apb1";
> -               };
> -
> -               apb1_gates: clk@01c2006c {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-apb1-gates-clk";
> -                       reg = <0x01c2006c 0x4>;
> -                       clocks = <&apb1>;
> -                       clock-indices = <0>, <1>,
> -                                       <2>, <4>,
> -                                       <5>, <6>,
> -                                       <7>, <16>,
> -                                       <17>, <18>,
> -                                       <19>, <20>,
> -                                       <21>, <22>,
> -                                       <23>;
> -                       clock-output-names = "apb1_i2c0", "apb1_i2c1",
> -                                            "apb1_i2c2", "apb1_can",
> -                                            "apb1_scr", "apb1_ps20",
> -                                            "apb1_ps21", "apb1_uart0",
> -                                            "apb1_uart1", "apb1_uart2",
> -                                            "apb1_uart3", "apb1_uart4",
> -                                            "apb1_uart5", "apb1_uart6",
> -                                            "apb1_uart7";
> -               };
> -
> -               nand_clk: clk@01c20080 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c20080 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "nand";
> -               };
> -
> -               ms_clk: clk@01c20084 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c20084 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "ms";
> -               };
> -
> -               mmc0_clk: clk@01c20088 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-mmc-clk";
> -                       reg = <0x01c20088 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "mmc0",
> -                                            "mmc0_output",
> -                                            "mmc0_sample";
> -               };
> -
> -               mmc1_clk: clk@01c2008c {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-mmc-clk";
> -                       reg = <0x01c2008c 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "mmc1",
> -                                            "mmc1_output",
> -                                            "mmc1_sample";
> -               };
> -
> -               mmc2_clk: clk@01c20090 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-mmc-clk";
> -                       reg = <0x01c20090 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "mmc2",
> -                                            "mmc2_output",
> -                                            "mmc2_sample";
> -               };
> -
> -               mmc3_clk: clk@01c20094 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-mmc-clk";
> -                       reg = <0x01c20094 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "mmc3",
> -                                            "mmc3_output",
> -                                            "mmc3_sample";
> -               };
> -
> -               ts_clk: clk@01c20098 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c20098 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "ts";
> -               };
> -
> -               ss_clk: clk@01c2009c {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c2009c 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "ss";
> -               };
> -
> -               spi0_clk: clk@01c200a0 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200a0 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "spi0";
> -               };
> -
> -               spi1_clk: clk@01c200a4 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200a4 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "spi1";
> -               };
> -
> -               spi2_clk: clk@01c200a8 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200a8 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "spi2";
> -               };
> -
> -               pata_clk: clk@01c200ac {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200ac 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "pata";
> -               };
> -
> -               ir0_clk: clk@01c200b0 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200b0 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "ir0";
> -               };
> -
> -               ir1_clk: clk@01c200b4 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200b4 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "ir1";
> -               };
> -
> -               spdif_clk: clk@01c200c0 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod1-clk";
> -                       reg = <0x01c200c0 0x4>;
> -                       clocks = <&pll2 SUN4I_A10_PLL2_8X>,
> -                                <&pll2 SUN4I_A10_PLL2_4X>,
> -                                <&pll2 SUN4I_A10_PLL2_2X>,
> -                                <&pll2 SUN4I_A10_PLL2_1X>;
> -                       clock-output-names = "spdif";
> -               };
> -
> -               usb_clk: clk@01c200cc {
> -                       #clock-cells = <1>;
> -                       #reset-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-usb-clk";
> -                       reg = <0x01c200cc 0x4>;
> -                       clocks = <&pll6 1>;
> -                       clock-output-names = "usb_ohci0", "usb_ohci1",
> -                                            "usb_phy";
> -               };
> -
> -               spi3_clk: clk@01c200d4 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-mod0-clk";
> -                       reg = <0x01c200d4 0x4>;
> -                       clocks = <&osc24M>, <&pll6 1>, <&pll5 1>;
> -                       clock-output-names = "spi3";
> -               };
> -
> -               dram_gates: clk@01c20100 {
> -                       #clock-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-dram-gates-clk";
> -                       reg = <0x01c20100 0x4>;
> -                       clocks = <&pll5 0>;
> -                       clock-indices = <0>,
> -                                       <1>, <2>,
> -                                       <3>,
> -                                       <4>,
> -                                       <5>, <6>,
> -                                       <15>,
> -                                       <24>, <25>,
> -                                       <26>, <27>,
> -                                       <28>, <29>;
> -                       clock-output-names = "dram_ve",
> -                                            "dram_csi0", "dram_csi1",
> -                                            "dram_ts",
> -                                            "dram_tvd",
> -                                            "dram_tve0", "dram_tve1",
> -                                            "dram_output",
> -                                            "dram_de_fe1", "dram_de_fe0",
> -                                            "dram_de_be0", "dram_de_be1",
> -                                            "dram_de_mp", "dram_ace";
> -               };
> -
> -               de_be0_clk: clk@01c20104 {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-display-clk";
> -                       reg = <0x01c20104 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll5 1>;
> -                       clock-output-names = "de-be0";
> -               };
> -
> -               de_be1_clk: clk@01c20108 {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-display-clk";
> -                       reg = <0x01c20108 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll5 1>;
> -                       clock-output-names = "de-be1";
> -               };
> -
> -               de_fe0_clk: clk@01c2010c {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-display-clk";
> -                       reg = <0x01c2010c 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll5 1>;
> -                       clock-output-names = "de-fe0";
> -               };
> -
> -               de_fe1_clk: clk@01c20110 {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-display-clk";
> -                       reg = <0x01c20110 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll5 1>;
> -                       clock-output-names = "de-fe1";
> -               };
> -
> -
> -               tcon0_ch0_clk: clk@01c20118 {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-tcon-ch0-clk";
> -                       reg = <0x01c20118 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
> -                       clock-output-names = "tcon0-ch0-sclk";
> -
> -               };
> -
> -               tcon1_ch0_clk: clk@01c2011c {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <1>;
> -                       compatible = "allwinner,sun4i-a10-tcon-ch1-clk";
> -                       reg = <0x01c2011c 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
> -                       clock-output-names = "tcon1-ch0-sclk";
> -
> -               };
> -
> -               tcon0_ch1_clk: clk@01c2012c {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-tcon-ch0-clk";
> -                       reg = <0x01c2012c 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
> -                       clock-output-names = "tcon0-ch1-sclk";
> -
> -               };
> -
> -               tcon1_ch1_clk: clk@01c20130 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-tcon-ch1-clk";
> -                       reg = <0x01c20130 0x4>;
> -                       clocks = <&pll3>, <&pll7>, <&pll3x2>, <&pll7x2>;
> -                       clock-output-names = "tcon1-ch1-sclk";
> -
> -               };
> -
> -               ve_clk: clk@01c2013c {
> -                       #clock-cells = <0>;
> -                       #reset-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-ve-clk";
> -                       reg = <0x01c2013c 0x4>;
> -                       clocks = <&pll4>;
> -                       clock-output-names = "ve";
> -               };
> -
> -               codec_clk: clk@01c20140 {
> -                       #clock-cells = <0>;
> -                       compatible = "allwinner,sun4i-a10-codec-clk";
> -                       reg = <0x01c20140 0x4>;
> -                       clocks = <&pll2 SUN4I_A10_PLL2_1X>;
> -                       clock-output-names = "codec";
> -               };
>         };
>
>         soc@01c00000 {
> @@ -717,7 +233,7 @@
>                         compatible = "allwinner,sun4i-a10-dma";
>                         reg = <0x01c02000 0x1000>;
>                         interrupts = <27>;
> -                       clocks = <&ahb_gates 6>;
> +                       clocks = <&ccu CLK_AHB_DMA>;
>                         #dma-cells = <2>;
>                 };
>
> @@ -725,7 +241,7 @@
>                         compatible = "allwinner,sun4i-a10-nand";
>                         reg = <0x01c03000 0x1000>;
>                         interrupts = <37>;
> -                       clocks = <&ahb_gates 13>, <&nand_clk>;
> +                       clocks = <&ccu CLK_AHB_NAND>, <&ccu CLK_NAND>;
>                         clock-names = "ahb", "mod";
>                         dmas = <&dma SUN4I_DMA_DEDICATED 3>;
>                         dma-names = "rxtx";
> @@ -738,7 +254,7 @@
>                         compatible = "allwinner,sun4i-a10-spi";
>                         reg = <0x01c05000 0x1000>;
>                         interrupts = <10>;
> -                       clocks = <&ahb_gates 20>, <&spi0_clk>;
> +                       clocks = <&ccu CLK_AHB_SPI0>, <&ccu CLK_SPI0>;
>                         clock-names = "ahb", "mod";
>                         dmas = <&dma SUN4I_DMA_DEDICATED 27>,
>                                <&dma SUN4I_DMA_DEDICATED 26>;
> @@ -752,7 +268,7 @@
>                         compatible = "allwinner,sun4i-a10-spi";
>                         reg = <0x01c06000 0x1000>;
>                         interrupts = <11>;
> -                       clocks = <&ahb_gates 21>, <&spi1_clk>;
> +                       clocks = <&ccu CLK_AHB_SPI1>, <&ccu CLK_SPI1>;
>                         clock-names = "ahb", "mod";
>                         dmas = <&dma SUN4I_DMA_DEDICATED 9>,
>                                <&dma SUN4I_DMA_DEDICATED 8>;
> @@ -766,7 +282,7 @@
>                         compatible = "allwinner,sun4i-a10-emac";
>                         reg = <0x01c0b000 0x1000>;
>                         interrupts = <55>;
> -                       clocks = <&ahb_gates 17>;
> +                       clocks = <&ccu CLK_AHB_EMAC>;
>                         allwinner,sram = <&emac_sram 1>;
>                         status = "disabled";
>                 };
> @@ -782,10 +298,10 @@
>                 mmc0: mmc@01c0f000 {
>                         compatible = "allwinner,sun4i-a10-mmc";
>                         reg = <0x01c0f000 0x1000>;
> -                       clocks = <&ahb_gates 8>,
> -                                <&mmc0_clk 0>,
> -                                <&mmc0_clk 1>,
> -                                <&mmc0_clk 2>;
> +                       clocks = <&ccu CLK_AHB_MMC0>,
> +                                <&ccu CLK_MMC0>,
> +                                <&ccu CLK_MMC0_OUTPUT>,
> +                                <&ccu CLK_MMC0_SAMPLE>;
>                         clock-names = "ahb",
>                                       "mmc",
>                                       "output",
> @@ -799,10 +315,10 @@
>                 mmc1: mmc@01c10000 {
>                         compatible = "allwinner,sun4i-a10-mmc";
>                         reg = <0x01c10000 0x1000>;
> -                       clocks = <&ahb_gates 9>,
> -                                <&mmc1_clk 0>,
> -                                <&mmc1_clk 1>,
> -                                <&mmc1_clk 2>;
> +                       clocks = <&ccu CLK_AHB_MMC1>,
> +                                <&ccu CLK_MMC1>,
> +                                <&ccu CLK_MMC1_OUTPUT>,
> +                                <&ccu CLK_MMC1_SAMPLE>;
>                         clock-names = "ahb",
>                                       "mmc",
>                                       "output",
> @@ -816,10 +332,10 @@
>                 mmc2: mmc@01c11000 {
>                         compatible = "allwinner,sun4i-a10-mmc";
>                         reg = <0x01c11000 0x1000>;
> -                       clocks = <&ahb_gates 10>,
> -                                <&mmc2_clk 0>,
> -                                <&mmc2_clk 1>,
> -                                <&mmc2_clk 2>;
> +                       clocks = <&ccu CLK_AHB_MMC2>,
> +                                <&ccu CLK_MMC2>,
> +                                <&ccu CLK_MMC2_OUTPUT>,
> +                                <&ccu CLK_MMC2_SAMPLE>;
>                         clock-names = "ahb",
>                                       "mmc",
>                                       "output",
> @@ -833,10 +349,10 @@
>                 mmc3: mmc@01c12000 {
>                         compatible = "allwinner,sun4i-a10-mmc";
>                         reg = <0x01c12000 0x1000>;
> -                       clocks = <&ahb_gates 11>,
> -                                <&mmc3_clk 0>,
> -                                <&mmc3_clk 1>,
> -                                <&mmc3_clk 2>;
> +                       clocks = <&ccu CLK_AHB_MMC3>,
> +                                <&ccu CLK_MMC3>,
> +                                <&ccu CLK_MMC3_OUTPUT>,
> +                                <&ccu CLK_MMC3_SAMPLE>;
>                         clock-names = "ahb",
>                                       "mmc",
>                                       "output",
> @@ -850,7 +366,7 @@
>                 usb_otg: usb@01c13000 {
>                         compatible = "allwinner,sun4i-a10-musb";
>                         reg = <0x01c13000 0x0400>;
> -                       clocks = <&ahb_gates 0>;
> +                       clocks = <&ccu CLK_AHB_OTG>;
>                         interrupts = <38>;
>                         interrupt-names = "mc";
>                         phys = <&usbphy 0>;
> @@ -865,9 +381,11 @@
>                         compatible = "allwinner,sun4i-a10-usb-phy";
>                         reg = <0x01c13400 0x10 0x01c14800 0x4 0x01c1c800 0x4>;
>                         reg-names = "phy_ctrl", "pmu1", "pmu2";
> -                       clocks = <&usb_clk 8>;
> +                       clocks = <&ccu CLK_USB_PHY>;
>                         clock-names = "usb_phy";
> -                       resets = <&usb_clk 0>, <&usb_clk 1>, <&usb_clk 2>;
> +                       resets = <&ccu RST_USB_PHY0>,
> +                                <&ccu RST_USB_PHY1>,
> +                                <&ccu RST_USB_PHY2>;
>                         reset-names = "usb0_reset", "usb1_reset", "usb2_reset";
>                         status = "disabled";
>                 };
> @@ -876,7 +394,7 @@
>                         compatible = "allwinner,sun4i-a10-ehci", "generic-ehci";
>                         reg = <0x01c14000 0x100>;
>                         interrupts = <39>;
> -                       clocks = <&ahb_gates 1>;
> +                       clocks = <&ccu CLK_AHB_EHCI0>;
>                         phys = <&usbphy 1>;
>                         phy-names = "usb";
>                         status = "disabled";
> @@ -886,7 +404,7 @@
>                         compatible = "allwinner,sun4i-a10-ohci", "generic-ohci";
>                         reg = <0x01c14400 0x100>;
>                         interrupts = <64>;
> -                       clocks = <&usb_clk 6>, <&ahb_gates 2>;
> +                       clocks = <&ccu CLK_USB_OHCI0>, <&ccu CLK_AHB_OHCI0>;
>                         phys = <&usbphy 1>;
>                         phy-names = "usb";
>                         status = "disabled";
> @@ -896,7 +414,7 @@
>                         compatible = "allwinner,sun4i-a10-crypto";
>                         reg = <0x01c15000 0x1000>;
>                         interrupts = <86>;
> -                       clocks = <&ahb_gates 5>, <&ss_clk>;
> +                       clocks = <&ccu CLK_AHB_SS>, <&ccu CLK_SS>;
>                         clock-names = "ahb", "mod";
>                 };
>
> @@ -904,7 +422,7 @@
>                         compatible = "allwinner,sun4i-a10-spi";
>                         reg = <0x01c17000 0x1000>;
>                         interrupts = <12>;
> -                       clocks = <&ahb_gates 22>, <&spi2_clk>;
> +                       clocks = <&ccu CLK_AHB_SPI2>, <&ccu CLK_SPI2>;
>                         clock-names = "ahb", "mod";
>                         dmas = <&dma SUN4I_DMA_DEDICATED 29>,
>                                <&dma SUN4I_DMA_DEDICATED 28>;
> @@ -918,7 +436,8 @@
>                         compatible = "allwinner,sun4i-a10-ahci";
>                         reg = <0x01c18000 0x1000>;
>                         interrupts = <56>;
> -                       clocks = <&pll6 0>, <&ahb_gates 25>;
> +                       clocks = <&ccu CLK_PLL_PERIPH_SATA>,
> +                                <&ccu CLK_AHB_SATA>;
>                         status = "disabled";
>                 };
>
> @@ -926,7 +445,7 @@
>                         compatible = "allwinner,sun4i-a10-ehci", "generic-ehci";
>                         reg = <0x01c1c000 0x100>;
>                         interrupts = <40>;
> -                       clocks = <&ahb_gates 3>;
> +                       clocks = <&ccu CLK_AHB_EHCI1>;
>                         phys = <&usbphy 2>;
>                         phy-names = "usb";
>                         status = "disabled";
> @@ -936,7 +455,7 @@
>                         compatible = "allwinner,sun4i-a10-ohci", "generic-ohci";
>                         reg = <0x01c1c400 0x100>;
>                         interrupts = <65>;
> -                       clocks = <&usb_clk 7>, <&ahb_gates 4>;
> +                       clocks = <&ccu CLK_USB_OHCI1>, <&ccu CLK_AHB_OHCI1>;
>                         phys = <&usbphy 2>;
>                         phy-names = "usb";
>                         status = "disabled";
> @@ -946,7 +465,7 @@
>                         compatible = "allwinner,sun4i-a10-spi";
>                         reg = <0x01c1f000 0x1000>;
>                         interrupts = <50>;
> -                       clocks = <&ahb_gates 23>, <&spi3_clk>;
> +                       clocks = <&ccu CLK_AHB_SPI3>, <&ccu CLK_SPI3>;
>                         clock-names = "ahb", "mod";
>                         dmas = <&dma SUN4I_DMA_DEDICATED 31>,
>                                <&dma SUN4I_DMA_DEDICATED 30>;
> @@ -956,6 +475,15 @@
>                         #size-cells = <0>;
>                 };
>
> +               ccu: clock@01c20000 {
> +                       compatible = "allwinner,sun4i-a10-ccu";
> +                       reg = <0x01c20000 0x400>;
> +                       clocks = <&osc24M>, <&osc32k>;
> +                       clock-names = "hosc", "losc";
> +                       #clock-cells = <1>;
> +                       #reset-cells = <1>;
> +               };
> +
>                 intc: interrupt-controller@01c20400 {
>                         compatible = "allwinner,sun4i-a10-ic";
>                         reg = <0x01c20400 0x400>;
> @@ -967,7 +495,7 @@
>                         compatible = "allwinner,sun4i-a10-pinctrl";
>                         reg = <0x01c20800 0x400>;
>                         interrupts = <28>;
> -                       clocks = <&apb0_gates 5>, <&osc24M>, <&osc32k>;
> +                       clocks = <&ccu CLK_APB0_PIO>, <&osc24M>, <&osc32k>;
>                         clock-names = "apb", "hosc", "losc";
>                         gpio-controller;
>                         interrupt-controller;
> @@ -1145,7 +673,7 @@
>                         compatible = "allwinner,sun4i-a10-spdif";
>                         reg = <0x01c21000 0x400>;
>                         interrupts = <13>;
> -                       clocks = <&apb0_gates 1>, <&spdif_clk>;
> +                       clocks = <&ccu CLK_APB0_SPDIF>, <&ccu CLK_SPDIF>;
>                         clock-names = "apb", "spdif";
>                         dmas = <&dma SUN4I_DMA_NORMAL 2>,
>                                <&dma SUN4I_DMA_NORMAL 2>;
> @@ -1155,7 +683,7 @@
>
>                 ir0: ir@01c21800 {
>                         compatible = "allwinner,sun4i-a10-ir";
> -                       clocks = <&apb0_gates 6>, <&ir0_clk>;
> +                       clocks = <&ccu CLK_APB0_IR0>, <&ccu CLK_IR0>;
>                         clock-names = "apb", "ir";
>                         interrupts = <5>;
>                         reg = <0x01c21800 0x40>;
> @@ -1164,7 +692,7 @@
>
>                 ir1: ir@01c21c00 {
>                         compatible = "allwinner,sun4i-a10-ir";
> -                       clocks = <&apb0_gates 7>, <&ir1_clk>;
> +                       clocks = <&ccu CLK_APB0_IR1>, <&ccu CLK_IR1>;
>                         clock-names = "apb", "ir";
>                         interrupts = <6>;
>                         reg = <0x01c21c00 0x40>;
> @@ -1183,7 +711,7 @@
>                         compatible = "allwinner,sun4i-a10-codec";
>                         reg = <0x01c22c00 0x40>;
>                         interrupts = <30>;
> -                       clocks = <&apb0_gates 0>, <&codec_clk>;
> +                       clocks = <&ccu CLK_APB0_CODEC>, <&ccu CLK_CODEC>;
>                         clock-names = "apb", "codec";
>                         dmas = <&dma SUN4I_DMA_NORMAL 19>,
>                                <&dma SUN4I_DMA_NORMAL 19>;
> @@ -1209,7 +737,7 @@
>                         interrupts = <1>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 16>;
> +                       clocks = <&ccu CLK_APB1_UART0>;
>                         status = "disabled";
>                 };
>
> @@ -1219,7 +747,7 @@
>                         interrupts = <2>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 17>;
> +                       clocks = <&ccu CLK_APB1_UART1>;
>                         status = "disabled";
>                 };
>
> @@ -1229,7 +757,7 @@
>                         interrupts = <3>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 18>;
> +                       clocks = <&ccu CLK_APB1_UART2>;
>                         status = "disabled";
>                 };
>
> @@ -1239,7 +767,7 @@
>                         interrupts = <4>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 19>;
> +                       clocks = <&ccu CLK_APB1_UART3>;
>                         status = "disabled";
>                 };
>
> @@ -1249,7 +777,7 @@
>                         interrupts = <17>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 20>;
> +                       clocks = <&ccu CLK_APB1_UART4>;
>                         status = "disabled";
>                 };
>
> @@ -1259,7 +787,7 @@
>                         interrupts = <18>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 21>;
> +                       clocks = <&ccu CLK_APB1_UART5>;
>                         status = "disabled";
>                 };
>
> @@ -1269,7 +797,7 @@
>                         interrupts = <19>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 22>;
> +                       clocks = <&ccu CLK_APB1_UART6>;
>                         status = "disabled";
>                 };
>
> @@ -1279,7 +807,7 @@
>                         interrupts = <20>;
>                         reg-shift = <2>;
>                         reg-io-width = <4>;
> -                       clocks = <&apb1_gates 23>;
> +                       clocks = <&ccu CLK_APB1_UART7>;
>                         status = "disabled";
>                 };
>
> @@ -1287,7 +815,7 @@
>                         compatible = "allwinner,sun4i-a10-i2c";
>                         reg = <0x01c2ac00 0x400>;
>                         interrupts = <7>;
> -                       clocks = <&apb1_gates 0>;
> +                       clocks = <&ccu CLK_APB1_I2C0>;
>                         status = "disabled";
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> @@ -1297,7 +825,7 @@
>                         compatible = "allwinner,sun4i-a10-i2c";
>                         reg = <0x01c2b000 0x400>;
>                         interrupts = <8>;
> -                       clocks = <&apb1_gates 1>;
> +                       clocks = <&ccu CLK_APB1_I2C1>;
>                         status = "disabled";
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> @@ -1307,7 +835,7 @@
>                         compatible = "allwinner,sun4i-a10-i2c";
>                         reg = <0x01c2b400 0x400>;
>                         interrupts = <9>;
> -                       clocks = <&apb1_gates 2>;
> +                       clocks = <&ccu CLK_APB1_I2C2>;
>                         status = "disabled";
>                         #address-cells = <1>;
>                         #size-cells = <0>;
> @@ -1317,7 +845,7 @@
>                         compatible = "allwinner,sun4i-a10-ps2";
>                         reg = <0x01c2a000 0x400>;
>                         interrupts = <62>;
> -                       clocks = <&apb1_gates 6>;
> +                       clocks = <&ccu CLK_APB1_PS20>;
>                         status = "disabled";
>                 };
>
> @@ -1325,7 +853,7 @@
>                         compatible = "allwinner,sun4i-a10-ps2";
>                         reg = <0x01c2a400 0x400>;
>                         interrupts = <63>;
> -                       clocks = <&apb1_gates 7>;
> +                       clocks = <&ccu CLK_APB1_PS21>;
>                         status = "disabled";
>                 };
>         };
> --
> git-series 0.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/d/optout.

^ permalink raw reply

* Re: [PATCH v9 1/2] dt: bindings: lm3692x: Add bindings for lm3692x LED driver
From: Jacek Anaszewski @ 2017-12-11 21:41 UTC (permalink / raw)
  To: Dan Murphy, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8, rpurdie-Fm38FmjxZ/leoWH0uzbU5w,
	pavel-+ZI9xUNit7I
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-leds-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171211182659.21533-1-dmurphy-l0cyMroinI0@public.gmane.org>

Dan,

On 12/11/2017 07:26 PM, Dan Murphy wrote:
> This adds the devicetree bindings for the LM3692x
> I2C LED string driver.
> 
> Acked-by: Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>
> Signed-off-by: Dan Murphy <dmurphy-l0cyMroinI0@public.gmane.org>
> ---
> 
> v9 - Moved 2 nodes to Optional Child and renamed node names to device type
> https://patchwork.kernel.org/patch/10093757/
> 
> v8 - Added address-cells and size-cells as well as child node reg - https://patchwork.kernel.org/patch/10091259/
> v7 - No changes - https://patchwork.kernel.org/patch/10087475/
> v6 - No changes -https://patchwork.kernel.org/patch/10085567/
> v5 - No Changes - https://patchwork.kernel.org/patch/10081071/
> v4 - Fix example node, added trigger entry, removed ambiguous x for compatible and
> added common.txt pointer for label - https://patchwork.kernel.org/patch/10060107
> v3 - No changes
> v2 - No changes - https://patchwork.kernel.org/patch/10056677/
> 
>  .../devicetree/bindings/leds/leds-lm3692x.txt      | 49 ++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/leds-lm3692x.txt
> 
> diff --git a/Documentation/devicetree/bindings/leds/leds-lm3692x.txt b/Documentation/devicetree/bindings/leds/leds-lm3692x.txt
> new file mode 100644
> index 000000000000..a93e19edfb42
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/leds-lm3692x.txt
> @@ -0,0 +1,49 @@
> +* Texas Instruments - LM3692x Highly Efficient White LED Driver
> +
> +The LM3692x is an ultra-compact, highly efficient,
> +white-LED driver designed for LCD display backlighting.
> +
> +The main difference between the LM36922 and LM36923 is the number of
> +LED strings it supports.  The LM36922 supports two strings while the LM36923
> +supports three strings.
> +
> +Required properties:
> +	- compatible:
> +		"ti,lm36922"
> +		"ti,lm36923"
> +	- reg :  I2C slave address
> +	- #address-cells : 1
> +	- #size-cells : 0
> +
> +Optional properties:
> +	- enable-gpios : gpio pin to enable/disable the device.
> +	- vled-supply : LED supply
> +
> +Required child properties:
> +	- reg : 0
> +
> +Optional child properties:
> +	- label : see Documentation/devicetree/bindings/leds/common.txt
> +	- linux,default-trigger :
> +	   see Documentation/devicetree/bindings/leds/common.txt
> +
> +Example:
> +
> +led-controller@36 {
> +	compatible = "ti,lm3692x";
> +	reg = <0x36>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
> +	vled-supply = <&vbatt>;
> +
> +	led@0 {
> +		reg = <0>;
> +		label = "backlight_cluster";

We need to consequently adhere to LED class device naming
convention, so:

label = "white:backlight_cluster";

> +		linux,default-trigger = "backlight";
> +	};
> +}
> +
> +For more product information please see the link below:
> +http://www.ti.com/lit/ds/snvsa29/snvsa29.pdf
> 

-- 
Best regards,
Jacek Anaszewski
--
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 v2 2/2] drm/tinydrm: add driver for ST7735R panels
From: Noralf Trønnes @ 2017-12-11 21:18 UTC (permalink / raw)
  To: David Lechner, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: limor-6aDhHjTmHzzR7s880joybQ, Linus Walleij, Rob Herring,
	Mark Rutland, linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1512943833-31352-3-git-send-email-david-nq/r/kbU++upp/zk7JDF2g@public.gmane.org>


Den 10.12.2017 23.10, 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>
> ---

> +static void st7735r_pipe_enable(struct drm_simple_display_pipe *pipe,
> +				struct drm_crtc_state *crtc_state)
> +{
> +	struct tinydrm_device *tdev = pipe_to_tinydrm(pipe);
> +	struct mipi_dbi *mipi = mipi_dbi_from_tinydrm(tdev);
> +	struct device *dev = tdev->drm->dev;
> +	int ret;
> +	u8 addr_mode;
> +
> +	DRM_DEBUG_KMS("\n");
> +
> +	mipi_dbi_hw_reset(mipi);
> +
> +	ret = mipi_dbi_command(mipi, MIPI_DCS_SOFT_RESET);
> +	if (ret) {
> +		DRM_DEV_ERROR(dev, "Error sending command %d\n", ret);
> +		return;
> +	}
> +
> +	msleep(150);
> +
> +	mipi_dbi_command(mipi, MIPI_DCS_EXIT_SLEEP_MODE);
> +	msleep(500);
> +
> +	mipi_dbi_command(mipi, ST7735R_FRMCTR1, 0x01, 0x2c, 0x2d);
> +	mipi_dbi_command(mipi, ST7735R_FRMCTR2, 0x01, 0x2c, 0x2d);
> +	mipi_dbi_command(mipi, ST7735R_FRMCTR3, 0x01, 0x2c, 0x2d, 0x01, 0x2c,
> +			 0x2d);
> +	mipi_dbi_command(mipi, ST7735R_INVCTR, 0x07);
> +	mipi_dbi_command(mipi, ST7735R_PWCTR1, 0xa2, 0x02, 0x84);
> +	mipi_dbi_command(mipi, ST7735R_PWCTR2, 0xc5);
> +	mipi_dbi_command(mipi, ST7735R_PWCTR3, 0x0a, 0x00);
> +	mipi_dbi_command(mipi, ST7735R_PWCTR4, 0x8a, 0x2a);
> +	mipi_dbi_command(mipi, ST7735R_PWCTR5, 0x8a, 0xee);
> +	mipi_dbi_command(mipi, ST7735R_VMCTR1, 0x0e);
> +	mipi_dbi_command(mipi, MIPI_DCS_EXIT_INVERT_MODE);
> +	switch (mipi->rotation) {
> +	default:
> +		addr_mode = ST7735R_MX | ST7735R_MY;
> +		break;
> +	case 90:
> +		addr_mode = ST7735R_MX | ST7735R_MV;
> +		break;
> +	case 180:
> +		addr_mode = 0;
> +		break;
> +	case 270:
> +		addr_mode = ST7735R_MY | ST7735R_MV;
> +		break;
> +	}
> +	mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
> +	mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT,
> +			 MIPI_DCS_PIXEL_FMT_16BIT);
> +	mipi_dbi_command(mipi, ST7735R_GAMCTRP1, 0x0f, 0x1a, 0x0f, 0x18, 0x2f,
> +			 0x28, 0x20, 0x22, 0x1f, 0x1b, 0x23, 0x37, 0x00, 0x07,
> +			 0x02, 0x10);
> +	mipi_dbi_command(mipi, ST7735R_GAMCTRN1, 0x0f, 0x1b, 0x0f, 0x17, 0x33,
> +			 0x2c, 0x29, 0x2e, 0x30, 0x30, 0x39, 0x3f, 0x00, 0x07,
> +			 0x03, 0x10);
> +	mipi_dbi_command(mipi, MIPI_DCS_SET_DISPLAY_ON);
> +
> +	msleep(100);
> +
> +	mipi_dbi_command(mipi, MIPI_DCS_ENTER_NORMAL_MODE);
> +
> +	msleep(20);
> +
> +	mipi_dbi_pipe_enable(pipe, crtc_state);
> +}
> +
> +static const struct drm_simple_display_pipe_funcs st7735r_pipe_funcs = {
> +	.enable		= st7735r_pipe_enable,
> +	.disable	= mipi_dbi_pipe_disable,
> +	.update		= tinydrm_display_pipe_update,
> +	.prepare_fb	= tinydrm_display_pipe_prepare_fb,
> +};
> +
> +static const struct drm_display_mode st7735r_mode = {
> +	TINYDRM_MODE(128, 160, 28, 35),
> +};

This naming talk has made me realise that these should be named after
the panel since they're not generic controller functions.
Maybe the mode can be generic, not sure if the physical size can/will
differ, the resolution is very likely to be the same for all.

What's your view on my descision to split the MIPI DBI compatible
controllers into per controller drivers instead of having one driver
that supports them all?
I've been afraid that it will be a very big file with macro definitions
per controller and enable functions per panel.

This driver has 15 macros and ~80 panel specific lines.
With one panel supported, half the driver is boilerplate.
The mi0283qt panel (MIPI DBI compatible) is in the same ballpark.

Adding helpers for panel reset/exit_sleep, for MIPI_DCS_SET_ADDRESS_MODE
and for display_on/enter_normal/flush could cut it down some more if we
made one driver to rule them all. Maybe the enable function per panel
could be cut in half that way.

I'm starting to wonder if one driver isn't such a bad solution after all...

Noralf.

--
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 02/12] mtd: nand: add reworked Marvell NAND controller driver
From: Miquel RAYNAL @ 2017-12-11 21:02 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Ezequiel Garcia, 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 <will.>
In-Reply-To: <20171211180511.1d734b37@bbrezillon>

On Mon, 11 Dec 2017 18:05:11 +0100
Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:

> On Mon, 11 Dec 2017 17:55:06 +0100
> Miquel RAYNAL <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> 
> > On Mon, 11 Dec 2017 13:27:30 -0300
> > Ezequiel Garcia <ezequiel-30ULvvUtt6G51wMPkGsGjgyUoB5FGQPZ@public.gmane.org> wrote:
> >   
> > > On 7 December 2017 at 17:18, Miquel Raynal
> > > <miquel.raynal-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:    
> > > > Add marvell_nand driver which aims at replacing the existing
> > > > pxa3xx_nand driver.
> > > >
> > > > The new driver intends to be easier to understand and follows
> > > > the brand new NAND framework rules by implementing hooks for
> > > > every pattern the controller might support and referencing them
> > > > inside a parser object that will be given to the core at each
> > > > ->exec_op() call.
> > > >
> > > > Raw accessors are implemented, useful to test/debug
> > > > memory/filesystem corruptions. Userspace binaries contained in
> > > > the mtd-utils package may now be used and their output trusted.
> > > >
> > > > Timings may not be kept from the bootloader anymore, the timings
> > > > used for instance in U-Boot were not optimal and it supposed to
> > > > have NAND support (and initialized) in the bootloader.
> > > >
> > > > Thanks to the improved timings, implementation of ONFI mode 5
> > > > support (with EDO managed by adding a delay on data sampling),
> > > > merging the commands together and optimizing writes in the
> > > > command registers, the new driver may achieve faster
> > > > throughputs in both directions. Measurements show an
> > > > improvement of about +23% read throughput and +24% write
> > > > throughput. These measurements have been done with an
> > > > Armada-385-DB-AP (4kiB NAND pages forced in 4-bit strength BCH
> > > > ECC correction) using the userspace tool 'flash_speed' from the
> > > > MTD test suite.
> > > >
> > > > Besides these important topics, the new driver addresses several
> > > > unsolved known issues in the old driver which:
> > > > - did not work with ECC soft neither with ECC none ;
> > > > - relied on naked read/write (which is unchanged) while the
> > > > NFCv1 embedded in the pxa3xx platforms do not implement it, so
> > > > several NAND commands did not actually ever work without any
> > > > notice (like reading the ONFI PARAM_PAGE or SET/GET_FEATURES) ;
> > > > - wrote the OOB data correctly, but was not able to read it
> > > > correctly past the first OOB data chunk ;
> > > > - did not displayed ECC bytes ;
> > > > - used device tree bindings that did not allow more than one
> > > > NAND chip, and did not allow to choose the correct chip select
> > > > if not incrementing from 0. Plus, the Ready/Busy line used had
> > > > to be 0.
> > > >
> > > > Old device tree bindings are still supported but deprecated. A
> > > > more hierarchical view has to be used to keep the controller
> > > > and the NAND chip structures clearly separated both inside the
> > > > device tree and also in the driver code.
> > > >      
> > > 
> > > So, is this driver fully compatible with the current pxa3xx-nand
> > > driver?    
> > 
> > It should be!
> >   
> > > 
> > > Have you tested with U-Boot's driver (based on the pxa3xx-nand)?
> > > 
> > > I recally some subtle issues with the fact that U-Boot and Linux
> > > had to agree about the BBT format.    
> > 
> > I kept the pxa3xx_nand driver BBT format.
> > 
> > This is something I mistakenly omitted from the commit message:
> > 
> > There are 5 supported layouts in the driver (the same as withing the
> > pxa3xx_nand driver):
> >     1/ Page: 512B, strength 1b/512B (hamming)
> >     2/ Page: 2kiB, strength 4b/2kiB (hamming)
> >     3/ page: 2kiB, strength 16b/2kiB (BCH)
> >     4/ page: 4kiB, strength 16b/2kiB (BCH)
> >     5/ page: 4kiB, strength 32b/2kiB (BCH)  
> 
> Are you sure of #5? I thought the engine was only capable of modifying
> the ECC block size, not the strength. If this is the case, then mode
> #5 is actually 16b/1024kiB.

You are right, #5 you actually be:

    5/ page: 4kiB, strength 16b/1kiB (BCH)  

Thanks for pointing it,
Miquèl

> 
> > 
> > Layout 2 has been tested with CM_X300 compulab module (PXA SoC) with
> > and without DMA.
> > Layout 4 has been tested with an Armada 385 db, an Armada 7040 DB
> > and an Armada 8040 DB.
> > Layout 5 has been tested with an Armada 398 db.
> > 
> > Layout 1 has been tested with the Armada 385 db with some hacks.
> > Layout 3 has been tested with the Armada 385 db with some other
> > hacks, that is why I am concerned about the other thread on the MTD
> > mailing list "wait timeout when scanning for BB" where a 2kiB page
> > with 16b/2048B strength is in use.
> > 
> > Regards,
> > Miquèl  
> 



-- 
Miquel Raynal, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
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] ARM: dts: bcm283x: Define polarity of per-cpu interrupts
From: Stefan Wahren @ 2017-12-11 20:39 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Eric Anholt,
	Florian Fainelli, Scott Branden, Rob Herring, Mark Rutland
  Cc: Russell King, phil-FnsA7b+Nu9XbIbC87yuRow,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Stefan Wahren
In-Reply-To: <1513024752-11246-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>

This patch define the polarity of the per-cpu interrupts on BCM2836
and BCM2837 in order to avoid the warnings from ARM arch timer code:

    arch_timer: WARNING: Invalid trigger for IRQ19, assuming level low
    arch_timer: WARNING: Please fix your firmware
    arch_timer: cp15 timer(s) running at 19.20MHz (virt).

Signed-off-by: Stefan Wahren <stefan.wahren-eS4NqCHxEME@public.gmane.org>
---
 arch/arm/boot/dts/bcm2836.dtsi | 14 +++++++-------
 arch/arm/boot/dts/bcm2837.dtsi | 12 ++++++------
 arch/arm/boot/dts/bcm283x.dtsi |  1 +
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2836.dtsi b/arch/arm/boot/dts/bcm2836.dtsi
index 61e1580..1dfd764 100644
--- a/arch/arm/boot/dts/bcm2836.dtsi
+++ b/arch/arm/boot/dts/bcm2836.dtsi
@@ -13,24 +13,24 @@
 			compatible = "brcm,bcm2836-l1-intc";
 			reg = <0x40000000 0x100>;
 			interrupt-controller;
-			#interrupt-cells = <1>;
+			#interrupt-cells = <2>;
 			interrupt-parent = <&local_intc>;
 		};
 
 		arm-pmu {
 			compatible = "arm,cortex-a7-pmu";
 			interrupt-parent = <&local_intc>;
-			interrupts = <9>;
+			interrupts = <9 IRQ_TYPE_LEVEL_HIGH>;
 		};
 	};
 
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupt-parent = <&local_intc>;
-		interrupts = <0>, // PHYS_SECURE_PPI
-			     <1>, // PHYS_NONSECURE_PPI
-			     <3>, // VIRT_PPI
-			     <2>; // HYP_PPI
+		interrupts = <0 IRQ_TYPE_LEVEL_HIGH>, // PHYS_SECURE_PPI
+			     <1 IRQ_TYPE_LEVEL_HIGH>, // PHYS_NONSECURE_PPI
+			     <3 IRQ_TYPE_LEVEL_HIGH>, // VIRT_PPI
+			     <2 IRQ_TYPE_LEVEL_HIGH>; // HYP_PPI
 		always-on;
 	};
 
@@ -76,7 +76,7 @@
 	compatible = "brcm,bcm2836-armctrl-ic";
 	reg = <0x7e00b200 0x200>;
 	interrupt-parent = <&local_intc>;
-	interrupts = <8>;
+	interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
 };
 
 &cpu_thermal {
diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi
index bc1cca5..efa7d33 100644
--- a/arch/arm/boot/dts/bcm2837.dtsi
+++ b/arch/arm/boot/dts/bcm2837.dtsi
@@ -12,7 +12,7 @@
 			compatible = "brcm,bcm2836-l1-intc";
 			reg = <0x40000000 0x100>;
 			interrupt-controller;
-			#interrupt-cells = <1>;
+			#interrupt-cells = <2>;
 			interrupt-parent = <&local_intc>;
 		};
 	};
@@ -20,10 +20,10 @@
 	timer {
 		compatible = "arm,armv7-timer";
 		interrupt-parent = <&local_intc>;
-		interrupts = <0>, // PHYS_SECURE_PPI
-			     <1>, // PHYS_NONSECURE_PPI
-			     <3>, // VIRT_PPI
-			     <2>; // HYP_PPI
+		interrupts = <0 IRQ_TYPE_LEVEL_HIGH>, // PHYS_SECURE_PPI
+			     <1 IRQ_TYPE_LEVEL_HIGH>, // PHYS_NONSECURE_PPI
+			     <3 IRQ_TYPE_LEVEL_HIGH>, // VIRT_PPI
+			     <2 IRQ_TYPE_LEVEL_HIGH>; // HYP_PPI
 		always-on;
 	};
 
@@ -73,7 +73,7 @@
 	compatible = "brcm,bcm2836-armctrl-ic";
 	reg = <0x7e00b200 0x200>;
 	interrupt-parent = <&local_intc>;
-	interrupts = <8>;
+	interrupts = <8 IRQ_TYPE_LEVEL_HIGH>;
 };
 
 &cpu_thermal {
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index e08203c..0d43bd4 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -2,6 +2,7 @@
 #include <dt-bindings/clock/bcm2835.h>
 #include <dt-bindings/clock/bcm2835-aux.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 /* firmware-provided startup stubs live here, where the secondary CPUs are
  * spinning.
-- 
2.7.4

--
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] irqchip: irq-bcm2836: add support for DT interrupt polarity
From: Stefan Wahren @ 2017-12-11 20:39 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Eric Anholt,
	Florian Fainelli, Scott Branden, Rob Herring, Mark Rutland
  Cc: Russell King, phil-FnsA7b+Nu9XbIbC87yuRow,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Stefan Wahren
In-Reply-To: <1513024752-11246-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>

In order to properly define the polarity of the per-cpu interrupts,
we need to support for a second property cell. But this must be
optional to keep backward compatibility with old DT blobs.

Suggested-by: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>
Signed-off-by: Stefan Wahren <stefan.wahren-eS4NqCHxEME@public.gmane.org>
---
 drivers/irqchip/irq-bcm2836.c | 46 ++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c
index 667b9e1..dfe4a46 100644
--- a/drivers/irqchip/irq-bcm2836.c
+++ b/drivers/irqchip/irq-bcm2836.c
@@ -98,13 +98,35 @@ static struct irq_chip bcm2836_arm_irqchip_gpu = {
 	.irq_unmask	= bcm2836_arm_irqchip_unmask_gpu_irq,
 };
 
-static void bcm2836_arm_irqchip_register_irq(int hwirq, struct irq_chip *chip)
-{
-	int irq = irq_create_mapping(intc.domain, hwirq);
+static int bcm2836_map(struct irq_domain *d, unsigned int irq,
+		       irq_hw_number_t hw)
+{
+	struct irq_chip *chip;
+
+	switch (hw) {
+	case LOCAL_IRQ_CNTPSIRQ:
+	case LOCAL_IRQ_CNTPNSIRQ:
+	case LOCAL_IRQ_CNTHPIRQ:
+	case LOCAL_IRQ_CNTVIRQ:
+		chip = &bcm2836_arm_irqchip_timer;
+		break;
+	case LOCAL_IRQ_GPU_FAST:
+		chip = &bcm2836_arm_irqchip_gpu;
+		break;
+	case LOCAL_IRQ_PMU_FAST:
+		chip = &bcm2836_arm_irqchip_pmu;
+		break;
+	default:
+		pr_warn_once("Unexpected hw irq: %lu\n", hw);
+		return -EINVAL;
+	}
 
 	irq_set_percpu_devid(irq);
-	irq_set_chip_and_handler(irq, chip, handle_percpu_devid_irq);
+	irq_domain_set_info(d, irq, hw, chip, d->host_data,
+			    handle_percpu_devid_irq, NULL, NULL);
 	irq_set_status_flags(irq, IRQ_NOAUTOEN);
+
+	return 0;
 }
 
 static void
@@ -165,7 +187,8 @@ static int bcm2836_cpu_dying(unsigned int cpu)
 #endif
 
 static const struct irq_domain_ops bcm2836_arm_irqchip_intc_ops = {
-	.xlate = irq_domain_xlate_onecell
+	.xlate = irq_domain_xlate_onetwocell,
+	.map = bcm2836_map,
 };
 
 static void
@@ -218,19 +241,6 @@ static int __init bcm2836_arm_irqchip_l1_intc_of_init(struct device_node *node,
 	if (!intc.domain)
 		panic("%pOF: unable to create IRQ domain\n", node);
 
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTPSIRQ,
-					 &bcm2836_arm_irqchip_timer);
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTPNSIRQ,
-					 &bcm2836_arm_irqchip_timer);
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTHPIRQ,
-					 &bcm2836_arm_irqchip_timer);
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_CNTVIRQ,
-					 &bcm2836_arm_irqchip_timer);
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_GPU_FAST,
-					 &bcm2836_arm_irqchip_gpu);
-	bcm2836_arm_irqchip_register_irq(LOCAL_IRQ_PMU_FAST,
-					 &bcm2836_arm_irqchip_pmu);
-
 	bcm2836_arm_irqchip_smp_init();
 
 	set_handle_irq(bcm2836_arm_irqchip_handle_irq);
-- 
2.7.4

--
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: bcm2836-l1-intc: add interrupt polarity support
From: Stefan Wahren @ 2017-12-11 20:39 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Eric Anholt,
	Florian Fainelli, Scott Branden, Rob Herring, Mark Rutland
  Cc: Russell King, phil-FnsA7b+Nu9XbIbC87yuRow,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Stefan Wahren
In-Reply-To: <1513024752-11246-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>

This increases the interrupt cells for the 1st level interrupt controller
binding in order to describe the polarity like on the other ARM platforms.

Signed-off-by: Stefan Wahren <stefan.wahren-eS4NqCHxEME@public.gmane.org>
---
 .../devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt
index f320dcd..8ced169 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2836-l1-intc.txt
@@ -12,7 +12,7 @@ Required properties:
 			  registers
 - interrupt-controller:	Identifies the node as an interrupt controller
 - #interrupt-cells:	Specifies the number of cells needed to encode an
-			  interrupt source. The value shall be 1
+			  interrupt source. The value shall be 2
 
 Please refer to interrupts.txt in this directory for details of the common
 Interrupt Controllers bindings used by client devices.
@@ -32,6 +32,6 @@ local_intc: local_intc {
 	compatible = "brcm,bcm2836-l1-intc";
 	reg = <0x40000000 0x100>;
 	interrupt-controller;
-	#interrupt-cells = <1>;
+	#interrupt-cells = <2>;
 	interrupt-parent = <&local_intc>;
 };
-- 
2.7.4

--
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] irqchip: irq-bcm2836: add support for DT interrupt polarity
From: Stefan Wahren @ 2017-12-11 20:39 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Eric Anholt,
	Florian Fainelli, Scott Branden, Rob Herring, Mark Rutland
  Cc: Russell King, phil-FnsA7b+Nu9XbIbC87yuRow,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Stefan Wahren

This patch series implements DT polarity support for the 1st level interrupt
controller.

Stefan Wahren (3):
  dt-bindings: bcm2836-l1-intc: add interrupt polarity support
  irqchip: irq-bcm2836: add support for DT interrupt polarity
  ARM: dts: bcm283x: Define polarity of per-cpu interrupts

 .../interrupt-controller/brcm,bcm2836-l1-intc.txt  |  4 +-
 arch/arm/boot/dts/bcm2836.dtsi                     | 14 +++----
 arch/arm/boot/dts/bcm2837.dtsi                     | 12 +++---
 arch/arm/boot/dts/bcm283x.dtsi                     |  1 +
 drivers/irqchip/irq-bcm2836.c                      | 46 +++++++++++++---------
 5 files changed, 44 insertions(+), 33 deletions(-)

-- 
2.7.4

--
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/4] Sunxi: Add SMP support on A83T
From: Corentin Labbe @ 2017-12-11 19:35 UTC (permalink / raw)
  To: Mylène Josserand
  Cc: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8, wens-jdAy2FN1RRM,
	linux-I+IVW8TIWO2tmTQ+vhA3Yw, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8,
	thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <20171211075001.6100-1-mylene.josserand-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On Mon, Dec 11, 2017 at 08:49:57AM +0100, Mylène Josserand wrote:
> Hello everyone,
> 
> This series adds SMP support for Allwinner Sun8i-a83t
> with MCPM (Multi-Cluster Power Management).
> Series information:
> 	- Based on last linux-next (next-20171211)
> 	- Had dependencies on Chen Yu's patch that add MCPM
> 	support:
> 	https://patchwork.kernel.org/patch/6402801/
> 
> Patch 01: Convert the mcpm driver (initially for A80) to be able
> to use it for A83T. This SoC has a bit flip that needs to be handled.
> Patch 02: Add registers nodes (prcm, cpucfg and r_cpucfg) needed
> for MCPM.
> Patch 03: Add CCI-400 node for a83t.
> Patch 04: Fix the use of virtual timers that hangs the kernel in
> case of SMP support.
> 
> If you have any remarks/questions, let me know.
> Thank you in advance,
> Mylène
> 

Hello

As we discussed in private, Chen Yu's patch should be added in your series.

Furthermore, MCPM is not automaticaly selected via imply.

With all patchs I hit a bug:
[    0.898668] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:238
[    0.911162] in_atomic(): 1, irqs_disabled(): 0, pid: 1, name: swapper/0
[    0.917776] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.15.0-rc2-next-20171211+ #73
[    0.925418] Hardware name: Allwinner sun8i Family
[    0.930118] Backtrace: 
[    0.932596] [<c010cc50>] (dump_backtrace) from [<c010cf0c>] (show_stack+0x18/0x1c)
[    0.940158]  r7:c0b261e4 r6:60000013 r5:00000000 r4:c0b51958
[    0.945820] [<c010cef4>] (show_stack) from [<c06baccc>] (dump_stack+0x8c/0xa0)
[    0.953045] [<c06bac40>] (dump_stack) from [<c0149d40>] (___might_sleep+0x150/0x170)
[    0.960779]  r7:c0b261e4 r6:00000000 r5:000000ee r4:ee844000
[    0.966437] [<c0149bf0>] (___might_sleep) from [<c0149dc8>] (__might_sleep+0x68/0xa0)
[    0.974253]  r4:c0861690
[    0.976796] [<c0149d60>] (__might_sleep) from [<c06d2918>] (mutex_lock+0x24/0x68)
[    0.984269]  r6:c0892f6c r5:ffffffff r4:c0b1bb24
[    0.988891] [<c06d28f4>] (mutex_lock) from [<c01ccb6c>] (perf_pmu_register+0x24/0x3e4)
[    0.996795]  r5:ffffffff r4:ee98b014
[    1.000375] [<c01ccb48>] (perf_pmu_register) from [<c03efabc>] (cci_pmu_probe+0x340/0x484)
[    1.008631]  r10:c0892f6c r9:c0bfd5f0 r8:eea19010 r7:c0b261e4 r6:c0b26240 r5:eea19000
[    1.016447]  r4:ee98b010
[    1.018989] [<c03ef77c>] (cci_pmu_probe) from [<c045e21c>] (platform_drv_probe+0x58/0xb8)
[    1.027158]  r10:00000000 r9:c0b2610c r8:00000000 r7:fffffdfb r6:c0b2610c r5:ffffffed
[    1.034974]  r4:eea19010
[    1.037511] [<c045e1c4>] (platform_drv_probe) from [<c045c984>] (driver_probe_device+0x254/0x330)
[    1.046371]  r7:00000000 r6:c0bff498 r5:c0bff494 r4:eea19010
[    1.052026] [<c045c730>] (driver_probe_device) from [<c045cbc4>] (__device_attach_driver+0xa0/0xd4)
[    1.061062]  r10:00000000 r9:c0bff470 r8:00000000 r7:00000001 r6:eea19010 r5:ee845ac0
[    1.068879]  r4:c0b2610c r3:00000000
[    1.072454] [<c045cb24>] (__device_attach_driver) from [<c045ad68>] (bus_for_each_drv+0x68/0x9c)
[    1.081228]  r7:00000001 r6:c045cb24 r5:ee845ac0 r4:00000000
[    1.086883] [<c045ad00>] (bus_for_each_drv) from [<c045c60c>] (__device_attach+0xb8/0x11c)
[    1.095135]  r6:c0b3e848 r5:eea19044 r4:eea19010
[    1.099750] [<c045c554>] (__device_attach) from [<c045cc44>] (device_initial_probe+0x14/0x18)
[    1.108263]  r7:c0b0a4c8 r6:c0b3e848 r5:eea19010 r4:eea19018
[    1.113919] [<c045cc30>] (device_initial_probe) from [<c045bb58>] (bus_probe_device+0x8c/0x94)
[    1.122523] [<c045bacc>] (bus_probe_device) from [<c0459db8>] (device_add+0x40c/0x5a0)
[    1.130429]  r7:c0b0a4c8 r6:eea19010 r5:eea18a10 r4:eea19018
[    1.136089] [<c04599ac>] (device_add) from [<c0582a58>] (of_device_add+0x3c/0x44)
[    1.143564]  r10:00000000 r9:00000000 r8:00000000 r7:eedf21a4 r6:eea18a10 r5:00000000
[    1.151380]  r4:eea19000
[    1.153915] [<c0582a1c>] (of_device_add) from [<c0582f80>] (of_platform_device_create_pdata+0x7c/0xac)
[    1.163210] [<c0582f04>] (of_platform_device_create_pdata) from [<c0583100>] (of_platform_bus_create+0xf4/0x1f0)
[    1.173372]  r9:00000000 r8:00000000 r7:00000001 r6:00000000 r5:eedf2154 r4:00000000
[    1.181107] [<c058300c>] (of_platform_bus_create) from [<c0583374>] (of_platform_populate+0x74/0xd4)
[    1.190229]  r10:00000001 r9:eea18a10 r8:00000000 r7:00000000 r6:00000000 r5:eedf1d04
[    1.198045]  r4:eedf2154
[    1.200580] [<c0583300>] (of_platform_populate) from [<c03ef2a8>] (cci_platform_probe+0x3c/0x54)
[    1.209356]  r10:00000000 r9:c0b26168 r8:00000000 r7:fffffdfb r6:c0b26168 r5:ffffffed
[    1.217172]  r4:eea18a00
[    1.219708] [<c03ef26c>] (cci_platform_probe) from [<c045e21c>] (platform_drv_probe+0x58/0xb8)
[    1.228306]  r5:ffffffed r4:eea18a10
[    1.231881] [<c045e1c4>] (platform_drv_probe) from [<c045c984>] (driver_probe_device+0x254/0x330)
[    1.240742]  r7:00000000 r6:c0bff498 r5:c0bff494 r4:eea18a10
[    1.246397] [<c045c730>] (driver_probe_device) from [<c045cbc4>] (__device_attach_driver+0xa0/0xd4)
[    1.255433]  r10:00000000 r9:c0bff470 r8:00000000 r7:00000001 r6:eea18a10 r5:ee845ce8
[    1.263250]  r4:c0b26168 r3:00000000
[    1.266825] [<c045cb24>] (__device_attach_driver) from [<c045ad68>] (bus_for_each_drv+0x68/0x9c)
[    1.275598]  r7:00000001 r6:c045cb24 r5:ee845ce8 r4:00000000
[    1.281253] [<c045ad00>] (bus_for_each_drv) from [<c045c60c>] (__device_attach+0xb8/0x11c)
[    1.289506]  r6:c0b3e848 r5:eea18a44 r4:eea18a10
[    1.294120] [<c045c554>] (__device_attach) from [<c045cc44>] (device_initial_probe+0x14/0x18)
[    1.302633]  r7:c0b0a4c8 r6:c0b3e848 r5:eea18a10 r4:eea18a18
[    1.308288] [<c045cc30>] (device_initial_probe) from [<c045bb58>] (bus_probe_device+0x8c/0x94)
[    1.316890] [<c045bacc>] (bus_probe_device) from [<c0459db8>] (device_add+0x40c/0x5a0)
[    1.324796]  r7:c0b0a4c8 r6:eea18a10 r5:ee993810 r4:eea18a18
[    1.330450] [<c04599ac>] (device_add) from [<c0582a58>] (of_device_add+0x3c/0x44)
[    1.337926]  r10:00000000 r9:c07759d8 r8:00000000 r7:eedf1d54 r6:ee993810 r5:00000000
[    1.345743]  r4:eea18a00
[    1.348277] [<c0582a1c>] (of_device_add) from [<c0582f80>] (of_platform_device_create_pdata+0x7c/0xac)
[    1.357572] [<c0582f04>] (of_platform_device_create_pdata) from [<c0583100>] (of_platform_bus_create+0xf4/0x1f0)
[    1.367734]  r9:c07759d8 r8:00000000 r7:00000001 r6:00000000 r5:eedf1d04 r4:00000000
[    1.375469] [<c058300c>] (of_platform_bus_create) from [<c058315c>] (of_platform_bus_create+0x150/0x1f0)
[    1.384938]  r10:ee993810 r9:c07759d8 r8:00000000 r7:00000001 r6:00000000 r5:eedefe1c
[    1.392754]  r4:eedf1d04
[    1.395289] [<c058300c>] (of_platform_bus_create) from [<c0583374>] (of_platform_populate+0x74/0xd4)
[    1.404411]  r10:00000001 r9:00000000 r8:00000000 r7:c07759d8 r6:00000000 r5:eedee844
[    1.412228]  r4:eedefe1c
[    1.414769] [<c0583300>] (of_platform_populate) from [<c0a25ee8>] (of_platform_default_populate_init+0x80/0x94)
[    1.424844]  r10:c0a37848 r9:00000000 r8:c0b59680 r7:c0a37834 r6:ffffe000 r5:c0775ce8
[    1.432661]  r4:00000000
[    1.435200] [<c0a25e68>] (of_platform_default_populate_init) from [<c0102794>] (do_one_initcall+0x5c/0x194)
[    1.444925]  r5:c0a25e68 r4:c0b0a4c8
[    1.448506] [<c0102738>] (do_one_initcall) from [<c0a00f88>] (kernel_init_freeable+0x1d4/0x268)
[    1.457195]  r9:00000004 r8:c0b59680 r7:c0a37834 r6:c0b59680 r5:c0a47308 r4:c090cfb8
[    1.464932] [<c0a00db4>] (kernel_init_freeable) from [<c06cf3b0>] (kernel_init+0x10/0x118)
[    1.473187]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c06cf3a0
[    1.481004]  r4:00000000
[    1.483540] [<c06cf3a0>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[    1.491098] Exception stack(0xee845fb0 to 0xee845ff8)
[    1.496146] 5fa0:                                     00000000 00000000 00000000 00000000
[    1.504313] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    1.512480] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    1.519084]  r5:c06cf3a0 r4:00000000
[    1.522737] ARM CCI_400_r1 PMU driver probed

And only CPU 0 show up.

Regards
--
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 16/20] ARM: dts: aspeed: Add Witherspoon BMC machine
From: Brandon Wyman @ 2017-12-11 19:27 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Rob Herring, Mark Rutland, Arnd Bergmann, Andrew Jeffery,
	Patrick Venture, Xo Wang, Lei YU, Cédric Le Goater,
	Benjamin Herrenschmidt, Jeremy Kerr,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-aspeed-uLR06cmDAlY/bJ5BZ2RsiQ, Matt Spinler, Brad Bishop,
	Edward A . James
In-Reply-To: <20171211050704.20621-17-joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>

On Sun, Dec 10, 2017 at 11:07 PM, Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org> wrote:
> The Witherspoon BMC is an ASPEED ast2500 based BMC that is part of an
> OpenPower Power9 server.
>
> This adds the device tree description for most upstream components. It
> is a squashed commit from the OpenBMC kernel tree.
>
> Signed-off-by: Brandon Wyman <bjwyman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Matt Spinler <spinler-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Brad Bishop <bradleyb-r5pk2Da7Bxt8sGd51Jp2sdBPR1lH4CV8@public.gmane.org>
> Signed-off-by: Edward A. James <eajames-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Cédric Le Goater <clg-Bxea+6Xhats@public.gmane.org>
> Signed-off-by: Andrew Jeffery <andrew-zrmu5oMJ5Fs@public.gmane.org>
> Signed-off-by: Joel Stanley <joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org>
> ---
>  arch/arm/boot/dts/Makefile                       |   4 +-
>  arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 547 +++++++++++++++++++++++
>  2 files changed, 550 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
>
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 5d1e9d37bf3a..15a9207319c1 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -1104,5 +1104,7 @@ dtb-$(CONFIG_ARCH_ZX) += zx296702-ad1.dtb
>  dtb-$(CONFIG_ARCH_ASPEED) += \
>         aspeed-ast2500-evb.dtb \
>         aspeed-bmc-opp-palmetto.dtb \
> -       aspeed-bmc-opp-romulus.dtb
> +       aspeed-bmc-opp-romulus.dtb \
> +       aspeed-bmc-opp-witherspoon.dtb
> +
>  endif
> diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> new file mode 100644
> index 000000000000..9a0937512e5b
> --- /dev/null
> +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts
> @@ -0,0 +1,547 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/dts-v1/;
> +#include "aspeed-g5.dtsi"
> +#include <dt-bindings/leds/leds-pca955x.h>
> +
> +/ {
> +       model = "Witherspoon BMC";
> +       compatible = "ibm,witherspoon-bmc", "aspeed,ast2500";
> +
> +       chosen {
> +               stdout-path = &uart5;
> +               bootargs = "console=ttyS4,115200 earlyprintk";
> +       };
> +
> +       memory {
> +               reg = <0x80000000 0x20000000>;
> +       };
> +
> +       reserved-memory {
> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               ranges;
> +
> +               flash_memory: region@98000000 {
> +                       no-map;
> +                       reg = <0x98000000 0x04000000>; /* 64M */
> +               };
> +       };
> +
> +       gpio-keys-polled {
> +               compatible = "gpio-keys-polled";
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               poll-interval = <1000>;
> +
> +               fan0-presence {
> +                       label = "fan0-presence";
> +                       gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
> +                       linux,code = <4>;
> +               };
> +
> +               fan1-presence {
> +                       label = "fan1-presence";
> +                       gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
> +                       linux,code = <5>;
> +               };
> +
> +               fan2-presence {
> +                       label = "fan2-presence";
> +                       gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
> +                       linux,code = <6>;
> +               };
> +
> +               fan3-presence {
> +                       label = "fan3-presence";
> +                       gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
> +                       linux,code = <7>;
> +               };
> +       };
> +
> +       leds {
> +               compatible = "gpio-leds";
> +
> +               fan0 {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 0 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               fan1 {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 1 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               fan2 {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 2 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               fan3 {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 3 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               front-fault {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 13 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               front-power {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 14 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               front-id {
> +                       retain-state-shutdown;
> +                       default-state = "keep";
> +                       gpios = <&pca0 15 GPIO_ACTIVE_LOW>;
> +               };
> +
> +               rear-fault {
> +                       gpios = <&gpio ASPEED_GPIO(N, 2) GPIO_ACTIVE_LOW>;
> +               };
> +
> +               rear-id {
> +                       gpios = <&gpio ASPEED_GPIO(N, 4) GPIO_ACTIVE_LOW>;
> +               };
> +
> +               rear-power {
> +                       gpios = <&gpio ASPEED_GPIO(N, 3) GPIO_ACTIVE_LOW>;
> +               };
> +
> +               power-button {
> +                       gpios = <&gpio ASPEED_GPIO(R, 5) GPIO_ACTIVE_LOW>;
> +               };
> +       };
> +
> +       fsi: gpio-fsi {
> +               compatible = "fsi-master-gpio", "fsi-master";
> +               #address-cells = <2>;
> +               #size-cells = <0>;
> +
> +               clock-gpios = <&gpio ASPEED_GPIO(AA, 0) GPIO_ACTIVE_HIGH>;
> +               data-gpios = <&gpio ASPEED_GPIO(E, 0) GPIO_ACTIVE_HIGH>;
> +               mux-gpios = <&gpio ASPEED_GPIO(A, 6) GPIO_ACTIVE_HIGH>;
> +               enable-gpios = <&gpio ASPEED_GPIO(D, 0) GPIO_ACTIVE_HIGH>;
> +               trans-gpios = <&gpio ASPEED_GPIO(R, 2) GPIO_ACTIVE_HIGH>;
> +       };
> +
> +       iio-hwmon-dps310 {
> +               compatible = "iio-hwmon";
> +               io-channels = <&dps 0>;
> +       };
> +
> +       iio-hwmon-bmp280 {
> +               compatible = "iio-hwmon";
> +               io-channels = <&bmp 1>;
> +       };
> +
> +};
> +
> +&fmc {
> +       status = "okay";
> +
> +       flash@0 {
> +               status = "okay";
> +               label = "bmc";
> +               m25p,fast-read;
> +#include "openbmc-flash-layout.dtsi"
> +       };
> +
> +       flash@1 {
> +               status = "okay";
> +               label = "alt";
> +               m25p,fast-read;
> +       };
> +};
> +
> +&spi1 {
> +       status = "okay";
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_spi1_default>;
> +
> +       flash@0 {
> +               status = "okay";
> +               label = "pnor";
> +               m25p,fast-read;
> +       };
> +};
> +
> +&uart1 {
> +       /* Rear RS-232 connector */
> +       status = "okay";
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_txd1_default
> +                       &pinctrl_rxd1_default
> +                       &pinctrl_nrts1_default
> +                       &pinctrl_ndtr1_default
> +                       &pinctrl_ndsr1_default
> +                       &pinctrl_ncts1_default
> +                       &pinctrl_ndcd1_default
> +                       &pinctrl_nri1_default>;
> +};
> +
> +&uart2 {
> +       /* APSS */
> +       status = "okay";
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_txd2_default &pinctrl_rxd2_default>;
> +};
> +
> +&uart5 {
> +       status = "okay";
> +};
> +
> +&lpc_ctrl {
> +       status = "okay";
> +       memory-region = <&flash_memory>;
> +       flash = <&spi1>;
> +};
> +
> +&mac0 {
> +       status = "okay";
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_rmii1_default>;
> +       use-ncsi;
> +};
> +
> +&i2c2 {
> +       status = "okay";
> +
> +       /* MUX ->
> +        *    Samtec 1
> +        *    Samtec 2
> +        */
> +};
> +
> +&i2c3 {
> +       status = "okay";
> +
> +       bmp: bmp280@77 {
> +               compatible = "bosch,bmp280";
> +               reg = <0x77>;
> +               #io-channel-cells = <1>;
> +       };
> +
> +       max31785@52 {
> +               compatible = "maxim,max31785a";
> +               reg = <0x52>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +       };
> +
> +       dps: dps310@76 {
> +               compatible = "infineon,dps310";
> +               reg = <0x76>;
> +               #io-channel-cells = <0>;
> +       };
> +
> +       pca0: pca9552@60 {
> +               compatible = "nxp,pca9552";
> +               reg = <0x60>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@8 {
> +                       reg = <8>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@9 {
> +                       reg = <9>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@10 {
> +                       reg = <10>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@11 {
> +                       reg = <11>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@12 {
> +                       reg = <12>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@13 {
> +                       reg = <13>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@14 {
> +                       reg = <14>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@15 {
> +                       reg = <15>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
> +
> +       power-supply@68 {
> +               compatible = "ibm,cffps1";
> +               reg = <0x68>;
> +       };
> +
> +       power-supply@69 {
> +               compatible = "ibm,cffps1";
> +               reg = <0x69>;
> +       };
> +};
> +
> +&i2c4 {
> +       status = "okay";
> +
> +       tmp423a@4c {
> +               compatible = "ti,tmp423";
> +               reg = <0x4c>;
> +       };
> +
> +       ir35221@70 {
> +               compatible = "infineon,ir35221";
> +               reg = <0x70>;
> +       };
> +
> +       ir35221@71 {
> +               compatible = "infineon,ir35221";
> +               reg = <0x71>;
> +       };
> +};
> +
> +
> +&i2c5 {
> +       status = "okay";
> +
> +       tmp423a@4c {
> +               compatible = "ti,tmp423";
> +               reg = <0x4c>;
> +       };
> +
> +       ir35221@70 {
> +               compatible = "infineon,ir35221";
> +               reg = <0x70>;
> +       };
> +
> +       ir35221@71 {
> +               compatible = "infineon,ir35221";
> +               reg = <0x71>;
> +       };
> +};
> +
> +&i2c9 {
> +       status = "okay";
> +
> +       tmp275@4a {
> +               compatible = "ti,tmp275";
> +               reg = <0x4a>;
> +       };
> +};
> +
> +&i2c10 {
> +       /* MUX
> +        *   -> PCIe Slot 3
> +        *   -> PCIe Slot 4
> +        */
> +       status = "okay";
> +};
> +
> +&i2c11 {
> +       status = "okay";
> +
> +       pca9552: pca9552@60 {
> +               compatible = "nxp,pca9552";
> +               reg = <0x60>;
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               gpio-controller;
> +               #gpio-cells = <2>;
> +
> +               gpio-line-names = "PS_SMBUS_RESET_N", "APSS_RESET_N",
> +                       "GPU0_TH_OVERT_N_BUFF", "GPU1_TH_OVERT_N_BUFF",
> +                       "GPU2_TH_OVERT_N_BUFF", "GPU3_TH_OVERT_N_BUFF",
> +                       "GPU4_TH_OVERT_N_BUFF", "GPU5_TH_OVERT_N_BUFF",
> +                       "GPU0_PWR_GOOD_BUFF", "GPU1_PWR_GOOD_BUFF",
> +                       "GPU2_PWR_GOOD_BUFF", "GPU3_PWR_GOOD_BUFF",
> +                       "GPU4_PWR_GOOD_BUFF", "GPU5_PWR_GOOD_BUFF",
> +                       "12V_BREAKER_FLT_N", "THROTTLE_UNLATCHED_N";
> +
> +               gpio@0 {
> +                       reg = <0>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@1 {
> +                       reg = <1>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@2 {
> +                       reg = <2>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@3 {
> +                       reg = <3>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@4 {
> +                       reg = <4>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@5 {
> +                       reg = <5>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@6 {
> +                       reg = <6>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@7 {
> +                       reg = <7>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@8 {
> +                       reg = <8>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@9 {
> +                       reg = <9>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@10 {
> +                       reg = <10>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@11 {
> +                       reg = <11>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@12 {
> +                       reg = <12>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@13 {
> +                       reg = <13>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@14 {
> +                       reg = <14>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +
> +               gpio@15 {
> +                       reg = <15>;
> +                       type = <PCA955X_TYPE_GPIO>;
> +               };
> +       };
> +
> +       rtc@32 {
> +               compatible = "epson,rx8900";
> +               reg = <0x32>;
> +       };
> +
> +       eeprom@51 {
> +               compatible = "atmel,24c64";
> +               reg = <0x51>;
> +       };
> +
> +       ucd90160@64 {
> +               compatible = "ti,ucd90160";
> +               reg = <0x64>;
> +       };
> +};
> +
> +&i2c12 {
> +       status = "okay";
> +};
> +
> +&i2c13 {
> +       status = "okay";
> +};
> +
> +&vuart {
> +       status = "okay";
> +};
> +
> +&gfx {
> +       status = "okay";
> +};
> +
> +&pinctrl {
> +       aspeed,external-nodes = <&gfx &lhc>;
> +};
> +
> +&wdt1 {
> +       aspeed,reset-type = "none";
> +       aspeed,external-signal;
> +       aspeed,ext-push-pull;
> +       aspeed,ext-active-high;
> +
> +       pinctrl-names = "default";
> +       pinctrl-0 = <&pinctrl_wdtrst1_default>;
> +};
> --
> 2.14.1
>
Reviewed-by: Brandon Wyman <bjwyman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
--
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 4/4] ASoC: codecs: tas5720: add TAS5722 TDM slot width setting support
From: Andrew F. Davis @ 2017-12-11 19:01 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew F . Davis
In-Reply-To: <20171211190157.12371-1-afd-l0cyMroinI0@public.gmane.org>

From: Andreas Dannenberg <dannenberg-l0cyMroinI0@public.gmane.org>

Unlike the TAS5720, the TAS5722 can be configured to utilize 16-bit wide
slots in TDM mode. This can help easing audio clocking/frequency
requirements.

Signed-off-by: Andreas Dannenberg <dannenberg-l0cyMroinI0@public.gmane.org>
Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
---
 sound/soc/codecs/tas5720.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index 042068964afb..08e0bfc9390c 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -152,6 +152,7 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai,
 				    int slots, int slot_width)
 {
 	struct snd_soc_codec *codec = dai->codec;
+	struct tas5720_data *tas5720 = snd_soc_codec_get_drvdata(codec);
 	unsigned int first_slot;
 	int ret;
 
@@ -185,6 +186,16 @@ static int tas5720_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	if (ret < 0)
 		goto error_snd_soc_update_bits;
 
+	/* Configure TDM slot width. This is only applicable to TAS5722. */
+	if (tas5720->devtype == TAS5722) {
+		ret = snd_soc_update_bits(codec, TAS5722_DIGITAL_CTRL2_REG,
+					  TAS5722_TDM_SLOT_16B,
+					  slot_width == 16 ?
+					  TAS5722_TDM_SLOT_16B : 0);
+		if (ret < 0)
+			goto error_snd_soc_update_bits;
+	}
+
 	return 0;
 
 error_snd_soc_update_bits:
-- 
2.15.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 3/4] ASoC: codecs: tas5720: add TAS5722 specific volume control
From: Andrew F. Davis @ 2017-12-11 19:01 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis
In-Reply-To: <20171211190157.12371-1-afd@ti.com>

From: Andreas Dannenberg <dannenberg@ti.com>

The TAS5722 supports modifying volume in 0.25dB steps (as opposed to 0.5dB
steps on the TAS5720). Introduce a custom mixer control that allows taking
advantage of this finer output volume granularity.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 sound/soc/codecs/tas5720.c | 88 +++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 83 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index f3006f301fe8..042068964afb 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -491,11 +491,59 @@ static const DECLARE_TLV_DB_RANGE(dac_analog_tlv,
  * setting the gain below -100 dB (register value <0x7) is effectively a MUTE
  * as per device datasheet.
  */
-static DECLARE_TLV_DB_SCALE(dac_tlv, -10350, 50, 0);
+static DECLARE_TLV_DB_SCALE(tas5720_dac_tlv, -10350, 50, 0);
+
 
 static const struct snd_kcontrol_new tas5720_snd_controls[] = {
 	SOC_SINGLE_TLV("Speaker Driver Playback Volume",
-		       TAS5720_VOLUME_CTRL_REG, 0, 0xff, 0, dac_tlv),
+		       TAS5720_VOLUME_CTRL_REG, 0, 0xff, 0, tas5720_dac_tlv),
+	SOC_SINGLE_TLV("Speaker Driver Analog Gain", TAS5720_ANALOG_CTRL_REG,
+		       TAS5720_ANALOG_GAIN_SHIFT, 3, 0, dac_analog_tlv),
+};
+
+/*
+ * DAC digital volumes. From -103.5 to 24 dB in 0.25 dB steps. Note that
+ * setting the gain below -100 dB (register value <0x8)  is effectively a MUTE
+ * as per device datasheet.
+ *
+ * Note that for the TAS5722 the digital volume controls are actually split
+ * over two registers, so we need custom getters/setters for access.
+ */
+static DECLARE_TLV_DB_SCALE(tas5722_dac_tlv, -10350, 25, 0);
+
+static int tas5722_volume_get(struct snd_kcontrol *kcontrol,
+			      struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+	unsigned int val;
+
+	val = snd_soc_read(codec, TAS5720_VOLUME_CTRL_REG);
+	ucontrol->value.integer.value[0] = val << 1;
+
+	val = snd_soc_read(codec, TAS5722_DIGITAL_CTRL2_REG);
+	ucontrol->value.integer.value[0] |= val & TAS5722_VOL_CONTROL_LSB;
+
+	return 0;
+}
+
+static int tas5722_volume_set(struct snd_kcontrol *kcontrol,
+			      struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
+	unsigned int sel = ucontrol->value.integer.value[0];
+
+	snd_soc_write(codec, TAS5720_VOLUME_CTRL_REG, sel >> 1);
+	snd_soc_update_bits(codec, TAS5722_DIGITAL_CTRL2_REG,
+			    TAS5722_VOL_CONTROL_LSB, sel);
+
+	return 0;
+}
+
+static const struct snd_kcontrol_new tas5722_snd_controls[] = {
+	SOC_SINGLE_EXT_TLV("Speaker Driver Playback Volume",
+			   0, 0, 511, 0,
+			   tas5722_volume_get, tas5722_volume_set,
+			   tas5722_dac_tlv),
 	SOC_SINGLE_TLV("Speaker Driver Analog Gain", TAS5720_ANALOG_CTRL_REG,
 		       TAS5720_ANALOG_GAIN_SHIFT, 3, 0, dac_analog_tlv),
 };
@@ -528,6 +576,22 @@ static const struct snd_soc_codec_driver soc_codec_dev_tas5720 = {
 	},
 };
 
+static struct snd_soc_codec_driver soc_codec_dev_tas5722 = {
+	.probe = tas5720_codec_probe,
+	.remove = tas5720_codec_remove,
+	.suspend = tas5720_suspend,
+	.resume = tas5720_resume,
+
+	.component_driver = {
+		.controls = tas5722_snd_controls,
+		.num_controls = ARRAY_SIZE(tas5722_snd_controls),
+		.dapm_widgets = tas5720_dapm_widgets,
+		.num_dapm_widgets = ARRAY_SIZE(tas5720_dapm_widgets),
+		.dapm_routes = tas5720_audio_map,
+		.num_dapm_routes = ARRAY_SIZE(tas5720_audio_map),
+	}
+};
+
 /* PCM rates supported by the TAS5720 driver */
 #define TAS5720_RATES	(SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
 			 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
@@ -614,9 +678,23 @@ static int tas5720_probe(struct i2c_client *client,
 
 	dev_set_drvdata(dev, data);
 
-	ret = snd_soc_register_codec(&client->dev,
-				     &soc_codec_dev_tas5720,
-				     tas5720_dai, ARRAY_SIZE(tas5720_dai));
+	switch (id->driver_data) {
+	case TAS5720:
+		ret = snd_soc_register_codec(&client->dev,
+					     &soc_codec_dev_tas5720,
+					     tas5720_dai,
+					     ARRAY_SIZE(tas5720_dai));
+		break;
+	case TAS5722:
+		ret = snd_soc_register_codec(&client->dev,
+					     &soc_codec_dev_tas5722,
+					     tas5720_dai,
+					     ARRAY_SIZE(tas5720_dai));
+		break;
+	default:
+		dev_err(dev, "unexpected private driver data\n");
+		return -EINVAL;
+	}
 	if (ret < 0) {
 		dev_err(dev, "failed to register codec: %d\n", ret);
 		return ret;
-- 
2.15.0

^ permalink raw reply related

* [PATCH 2/4] ASoC: codecs: tas5720: add TAS5722 register support
From: Andrew F. Davis @ 2017-12-11 19:01 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Andrew F . Davis
In-Reply-To: <20171211190157.12371-1-afd-l0cyMroinI0@public.gmane.org>

From: Andreas Dannenberg <dannenberg-l0cyMroinI0@public.gmane.org>

Introduce a custom super-set register map and associated bit definitions
to allow driver access to all TAS5722 device functionality.

Signed-off-by: Andreas Dannenberg <dannenberg-l0cyMroinI0@public.gmane.org>
Signed-off-by: Andrew F. Davis <afd-l0cyMroinI0@public.gmane.org>
---
 sound/soc/codecs/tas5720.c | 23 ++++++++++++++++++++++-
 sound/soc/codecs/tas5720.h | 30 ++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index 5def54d1336d..f3006f301fe8 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -466,6 +466,15 @@ static const struct regmap_config tas5720_regmap_config = {
 	.volatile_reg = tas5720_is_volatile_reg,
 };
 
+static const struct regmap_config tas5722_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+
+	.max_register = TAS5722_MAX_REG,
+	.cache_type = REGCACHE_RBTREE,
+	.volatile_reg = tas5720_is_volatile_reg,
+};
+
 /*
  * DAC analog gain. There are four discrete values to select from, ranging
  * from 19.2 dB to 26.3dB.
@@ -564,6 +573,7 @@ static int tas5720_probe(struct i2c_client *client,
 {
 	struct device *dev = &client->dev;
 	struct tas5720_data *data;
+	const struct regmap_config *regmap_config;
 	int ret;
 	int i;
 
@@ -574,7 +584,18 @@ static int tas5720_probe(struct i2c_client *client,
 	data->tas5720_client = client;
 	data->devtype = id->driver_data;
 
-	data->regmap = devm_regmap_init_i2c(client, &tas5720_regmap_config);
+	switch (id->driver_data) {
+	case TAS5720:
+		regmap_config = &tas5720_regmap_config;
+		break;
+	case TAS5722:
+		regmap_config = &tas5722_regmap_config;
+		break;
+	default:
+		dev_err(dev, "unexpected private driver data\n");
+		return -EINVAL;
+	}
+	data->regmap = devm_regmap_init_i2c(client, regmap_config);
 	if (IS_ERR(data->regmap)) {
 		ret = PTR_ERR(data->regmap);
 		dev_err(dev, "failed to allocate register map: %d\n", ret);
diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h
index bef802afcc69..1dda3095961d 100644
--- a/sound/soc/codecs/tas5720.h
+++ b/sound/soc/codecs/tas5720.h
@@ -30,6 +30,11 @@
 #define TAS5720_DIGITAL_CLIP1_REG	0x11
 #define TAS5720_MAX_REG			TAS5720_DIGITAL_CLIP1_REG
 
+/* Additional TAS5722-specific Registers */
+#define TAS5722_DIGITAL_CTRL2_REG	0x13
+#define TAS5722_ANALOG_CTRL2_REG	0x14
+#define TAS5722_MAX_REG			TAS5722_ANALOG_CTRL2_REG
+
 /* TAS5720_DEVICE_ID_REG */
 #define TAS5720_DEVICE_ID		0x01
 #define TAS5722_DEVICE_ID		0x12
@@ -52,6 +57,7 @@
 #define TAS5720_SAIF_FORMAT_MASK	GENMASK(2, 0)
 
 /* TAS5720_DIGITAL_CTRL2_REG */
+#define TAS5722_VOL_RAMP_RATE		BIT(6)
 #define TAS5720_MUTE			BIT(4)
 #define TAS5720_TDM_SLOT_SEL_MASK	GENMASK(2, 0)
 
@@ -88,4 +94,28 @@
 #define TAS5720_CLIP1_MASK		GENMASK(7, 2)
 #define TAS5720_CLIP1_SHIFT		(0x2)
 
+/* TAS5722_DIGITAL_CTRL2_REG */
+#define TAS5722_HPF_3_7HZ		(0x0 << 5)
+#define TAS5722_HPF_7_4HZ		(0x1 << 5)
+#define TAS5722_HPF_14_9HZ		(0x2 << 5)
+#define TAS5722_HPF_29_7HZ		(0x3 << 5)
+#define TAS5722_HPF_59_4HZ		(0x4 << 5)
+#define TAS5722_HPF_118_4HZ		(0x5 << 5)
+#define TAS5722_HPF_235_0HZ		(0x6 << 5)
+#define TAS5722_HPF_463_2HZ		(0x7 << 5)
+#define TAS5722_HPF_MASK		GENMASK(7, 5)
+#define TAS5722_AUTO_SLEEP_OFF		(0x0 << 3)
+#define TAS5722_AUTO_SLEEP_1024LR	(0x1 << 3)
+#define TAS5722_AUTO_SLEEP_65536LR	(0x2 << 3)
+#define TAS5722_AUTO_SLEEP_262144LR	(0x3 << 3)
+#define TAS5722_AUTO_SLEEP_MASK		GENMASK(4, 3)
+#define TAS5722_TDM_SLOT_16B		BIT(2)
+#define TAS5722_MCLK_PIN_CFG		BIT(1)
+#define TAS5722_VOL_CONTROL_LSB		BIT(0)
+
+/* TAS5722_ANALOG_CTRL2_REG */
+#define TAS5722_FAULTZ_PU		BIT(3)
+#define TAS5722_VREG_LVL		BIT(2)
+#define TAS5722_PWR_TUNE		BIT(0)
+
 #endif /* __TAS5720_H__ */
-- 
2.15.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 1/4] ASoC: codecs: tas5720: add basic support for TAS5722 devices
From: Andrew F. Davis @ 2017-12-11 19:01 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Mark Rutland
  Cc: alsa-devel, devicetree, linux-kernel, Andrew F . Davis

From: Andreas Dannenberg <dannenberg@ti.com>

The TI TAS5722 digital amplifier is very similar to the TAS5720 from an
overall and register map perspective. Therefore the existing driver can be
extended easily to support this additional device. This commit allows
TAS5722 devices to be used in a "subset" type of fashion, without exposing
any of the additional features they offer.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 .../devicetree/bindings/sound/tas5720.txt          |  4 ++-
 sound/soc/codecs/tas5720.c                         | 38 ++++++++++++++++++----
 sound/soc/codecs/tas5720.h                         |  1 +
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/tas5720.txt b/Documentation/devicetree/bindings/sound/tas5720.txt
index 40d94f82beb3..7481653fe8e3 100644
--- a/Documentation/devicetree/bindings/sound/tas5720.txt
+++ b/Documentation/devicetree/bindings/sound/tas5720.txt
@@ -6,10 +6,12 @@ audio playback. For more product information please see the links below:
 
 http://www.ti.com/product/TAS5720L
 http://www.ti.com/product/TAS5720M
+http://www.ti.com/product/TAS5722L
 
 Required properties:
 
-- compatible : "ti,tas5720"
+- compatible : "ti,tas5720",
+               "ti,tas5722"
 - reg : I2C slave address
 - dvdd-supply : phandle to a 3.3-V supply for the digital circuitry
 - pvdd-supply : phandle to a supply used for the Class-D amp and the analog
diff --git a/sound/soc/codecs/tas5720.c b/sound/soc/codecs/tas5720.c
index a736a2a6976c..5def54d1336d 100644
--- a/sound/soc/codecs/tas5720.c
+++ b/sound/soc/codecs/tas5720.c
@@ -36,6 +36,11 @@
 /* Define how often to check (and clear) the fault status register (in ms) */
 #define TAS5720_FAULT_CHECK_INTERVAL		200
 
+enum tas572x_type {
+	TAS5720,
+	TAS5722,
+};
+
 static const char * const tas5720_supply_names[] = {
 	"dvdd",		/* Digital power supply. Connect to 3.3-V supply. */
 	"pvdd",		/* Class-D amp and analog power supply (connected). */
@@ -47,6 +52,7 @@ struct tas5720_data {
 	struct snd_soc_codec *codec;
 	struct regmap *regmap;
 	struct i2c_client *tas5720_client;
+	enum tas572x_type devtype;
 	struct regulator_bulk_data supplies[TAS5720_NUM_SUPPLIES];
 	struct delayed_work fault_check_work;
 	unsigned int last_fault;
@@ -264,7 +270,7 @@ static void tas5720_fault_check_work(struct work_struct *work)
 static int tas5720_codec_probe(struct snd_soc_codec *codec)
 {
 	struct tas5720_data *tas5720 = snd_soc_codec_get_drvdata(codec);
-	unsigned int device_id;
+	unsigned int device_id, expected_device_id;
 	int ret;
 
 	tas5720->codec = codec;
@@ -276,6 +282,11 @@ static int tas5720_codec_probe(struct snd_soc_codec *codec)
 		return ret;
 	}
 
+	/*
+	 * Take a liberal approach to checking the device ID to allow the
+	 * driver to be used even if the device ID does not match, however
+	 * issue a warning if there is a mismatch.
+	 */
 	ret = regmap_read(tas5720->regmap, TAS5720_DEVICE_ID_REG, &device_id);
 	if (ret < 0) {
 		dev_err(codec->dev, "failed to read device ID register: %d\n",
@@ -283,13 +294,22 @@ static int tas5720_codec_probe(struct snd_soc_codec *codec)
 		goto probe_fail;
 	}
 
-	if (device_id != TAS5720_DEVICE_ID) {
-		dev_err(codec->dev, "wrong device ID. expected: %u read: %u\n",
-			TAS5720_DEVICE_ID, device_id);
-		ret = -ENODEV;
-		goto probe_fail;
+	switch (tas5720->devtype) {
+	case TAS5720:
+		expected_device_id = TAS5720_DEVICE_ID;
+		break;
+	case TAS5722:
+		expected_device_id = TAS5722_DEVICE_ID;
+		break;
+	default:
+		dev_err(codec->dev, "unexpected private driver data\n");
+		return -EINVAL;
 	}
 
+	if (device_id != expected_device_id)
+		dev_warn(codec->dev, "wrong device ID. expected: %u read: %u\n",
+			 expected_device_id, device_id);
+
 	/* Set device to mute */
 	ret = snd_soc_update_bits(codec, TAS5720_DIGITAL_CTRL2_REG,
 				  TAS5720_MUTE, TAS5720_MUTE);
@@ -552,6 +572,8 @@ static int tas5720_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	data->tas5720_client = client;
+	data->devtype = id->driver_data;
+
 	data->regmap = devm_regmap_init_i2c(client, &tas5720_regmap_config);
 	if (IS_ERR(data->regmap)) {
 		ret = PTR_ERR(data->regmap);
@@ -592,7 +614,8 @@ static int tas5720_remove(struct i2c_client *client)
 }
 
 static const struct i2c_device_id tas5720_id[] = {
-	{ "tas5720", 0 },
+	{ "tas5720", TAS5720 },
+	{ "tas5722", TAS5722 },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, tas5720_id);
@@ -600,6 +623,7 @@ MODULE_DEVICE_TABLE(i2c, tas5720_id);
 #if IS_ENABLED(CONFIG_OF)
 static const struct of_device_id tas5720_of_match[] = {
 	{ .compatible = "ti,tas5720", },
+	{ .compatible = "ti,tas5722", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, tas5720_of_match);
diff --git a/sound/soc/codecs/tas5720.h b/sound/soc/codecs/tas5720.h
index 3d077c779b12..bef802afcc69 100644
--- a/sound/soc/codecs/tas5720.h
+++ b/sound/soc/codecs/tas5720.h
@@ -32,6 +32,7 @@
 
 /* TAS5720_DEVICE_ID_REG */
 #define TAS5720_DEVICE_ID		0x01
+#define TAS5722_DEVICE_ID		0x12
 
 /* TAS5720_POWER_CTRL_REG */
 #define TAS5720_DIG_CLIP_MASK		GENMASK(7, 2)
-- 
2.15.0

^ permalink raw reply related


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