Devicetree
 help / color / mirror / Atom feed
* [PATCH v4 3/7] drivers: dma-contiguous: add initialization from device tree
From: Marek Szyprowski @ 2014-02-20 10:52 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linaro-mm-sig, devicetree,
	linux-doc
  Cc: Marek Szyprowski, Benjamin Herrenschmidt, Arnd Bergmann,
	Michal Nazarewicz, Grant Likely, Tomasz Figa, Sascha Hauer,
	Laura Abbott, Rob Herring, Olof Johansson, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, Tomasz Figa,
	Kumar Gala, Nishanth Peethambaran, Marc, Josh Cartwright,
	Catalin Marinas, Will Deacon, Paul Mackerras
In-Reply-To: <1392893567-31623-1-git-send-email-m.szyprowski@samsung.com>

Refactor internal dma_contiguous_init_reserved_mem() function, which
creates CMA area from previously reserved memory region and add support
for handling 'shared-dma-pool' reserved-memory device tree nodes.

Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/base/dma-contiguous.c |  130 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 108 insertions(+), 22 deletions(-)

diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
index 165c2c299e57..5dfcc3743d9b 100644
--- a/drivers/base/dma-contiguous.c
+++ b/drivers/base/dma-contiguous.c
@@ -182,6 +182,49 @@ static int __init cma_init_reserved_areas(void)
 core_initcall(cma_init_reserved_areas);
 
 /**
+ * dma_contiguous_init_reserved_mem() - reserve custom contiguous area
+ * @size: Size of the reserved area (in bytes),
+ * @base: Base address of the reserved area optional, use 0 for any
+ * @limit: End address of the reserved memory (optional, 0 for any).
+ * @res_cma: Pointer to store the created cma region.
+ *
+ * This function reserves memory from early allocator. It should be
+ * called by arch specific code once the early allocator (memblock or bootmem)
+ * has been activated and all other subsystems have already allocated/reserved
+ * memory. This function allows to create custom reserved areas for specific
+ * devices.
+ */
+static int __init dma_contiguous_init_reserved_mem(phys_addr_t size,
+					phys_addr_t base, struct cma **res_cma)
+{
+	struct cma *cma = &cma_areas[cma_area_count];
+	phys_addr_t alignment;
+
+	/* Sanity checks */
+	if (cma_area_count == ARRAY_SIZE(cma_areas)) {
+		pr_err("Not enough slots for CMA reserved regions!\n");
+		return -ENOSPC;
+	}
+
+	if (!size || !memblock_is_region_reserved(base, size))
+		return -EINVAL;
+
+	/* Sanitise input arguments */
+	alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
+	if (ALIGN(base, alignment) != base || ALIGN(size, alignment) != size)
+		return -EINVAL;
+
+	cma->base_pfn = PFN_DOWN(base);
+	cma->count = size >> PAGE_SHIFT;
+	*res_cma = cma;
+	cma_area_count++;
+
+	/* Architecture specific contiguous memory fixup. */
+	dma_contiguous_early_fixup(base, size);
+	return 0;
+}
+
+/**
  * dma_contiguous_reserve_area() - reserve custom contiguous area
  * @size: Size of the reserved area (in bytes),
  * @base: Base address of the reserved area optional, use 0 for any
@@ -197,7 +240,6 @@ core_initcall(cma_init_reserved_areas);
 int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
 				       phys_addr_t limit, struct cma **res_cma)
 {
-	struct cma *cma = &cma_areas[cma_area_count];
 	phys_addr_t alignment;
 	int ret = 0;
 
@@ -205,12 +247,6 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
 		 (unsigned long)size, (unsigned long)base,
 		 (unsigned long)limit);
 
-	/* Sanity checks */
-	if (cma_area_count == ARRAY_SIZE(cma_areas)) {
-		pr_err("Not enough slots for CMA reserved regions!\n");
-		return -ENOSPC;
-	}
-
 	if (!size)
 		return -EINVAL;
 
@@ -241,21 +277,12 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
 		}
 	}
 
-	/*
-	 * Each reserved area must be initialised later, when more kernel
-	 * subsystems (like slab allocator) are available.
-	 */
-	cma->base_pfn = PFN_DOWN(base);
-	cma->count = size >> PAGE_SHIFT;
-	*res_cma = cma;
-	cma_area_count++;
-
-	pr_info("CMA: reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M,
-		(unsigned long)base);
-
-	/* Architecture specific contiguous memory fixup. */
-	dma_contiguous_early_fixup(base, size);
-	return 0;
+	ret = dma_contiguous_init_reserved_mem(size, base, res_cma);
+	if (ret == 0) {
+		pr_info("CMA: reserved %ld MiB at %08lx\n",
+			(unsigned long)size / SZ_1M, (unsigned long)base);
+		return 0;
+	}
 err:
 	pr_err("CMA: failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
 	return ret;
@@ -357,3 +384,62 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages,
 
 	return true;
 }
+
+/*
+ * Support for reserved memory regions defined in device tree
+ */
+#ifdef CONFIG_OF_RESERVED_MEM
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>
+
+#undef pr_fmt
+#define pr_fmt(fmt) fmt
+
+static void rmem_cma_device_init(struct reserved_mem *rmem,
+			 struct device *dev, struct of_phandle_args *args)
+{
+	struct cma *cma = rmem->priv;
+	dev_set_cma_area(dev, cma);
+}
+
+static const struct reserved_mem_ops rmem_cma_ops = {
+	.device_init	= rmem_cma_device_init,
+};
+
+static int __init rmem_cma_setup(struct reserved_mem *rmem,
+				 unsigned long node,
+				 const char *uname)
+{
+	phys_addr_t align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
+	phys_addr_t mask = align - 1;
+	struct cma *cma;
+	int err;
+
+	if (!of_get_flat_dt_prop(node, "reusable", NULL))
+		return -EINVAL;
+
+	if ((rmem->base & mask) || (rmem->size & mask)) {
+		pr_err("Reserved memory: incorrect alignment of CMA region\n");
+		return -EINVAL;
+	}
+
+	err = dma_contiguous_init_reserved_mem(rmem->size, rmem->base, &cma);
+	if (err) {
+		pr_err("Reserved memory: unable to setup CMA region\n");
+		return err;
+	}
+
+	if (of_get_flat_dt_prop(node, "linux,cma-default", NULL))
+		dma_contiguous_set_default(cma);
+
+	rmem->ops = &rmem_cma_ops;
+	rmem->priv = cma;
+
+	pr_info("Reserved memory: created CMA memory pool at %pa, size %ld MiB\n",
+		&rmem->base, (unsigned long)rmem->size / SZ_1M);
+
+	return 0;
+}
+RESERVEDMEM_OF_DECLARE(cma, "shared-dma-pool", rmem_cma_setup);
+#endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v4 2/7] drivers: dma-coherent: add initialization from device tree
From: Marek Szyprowski @ 2014-02-20 10:52 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linaro-mm-sig, devicetree,
	linux-doc
  Cc: Marek Szyprowski, Benjamin Herrenschmidt, Arnd Bergmann,
	Michal Nazarewicz, Grant Likely, Tomasz Figa, Sascha Hauer,
	Laura Abbott, Rob Herring, Olof Johansson, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, Tomasz Figa,
	Kumar Gala, Nishanth Peethambaran, Marc, Josh Cartwright,
	Catalin Marinas, Will Deacon, Paul Mackerras
In-Reply-To: <1392893567-31623-1-git-send-email-m.szyprowski@samsung.com>

Add support for handling 'shared-dma-pool' reserved-memory device tree
nodes.

Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/base/dma-coherent.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c
index bc256b641027..2343ba5d6d43 100644
--- a/drivers/base/dma-coherent.c
+++ b/drivers/base/dma-coherent.c
@@ -218,3 +218,44 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma,
 	return 0;
 }
 EXPORT_SYMBOL(dma_mmap_from_coherent);
+
+/*
+ * Support for reserved memory regions defined in device tree
+ */
+#ifdef CONFIG_OF_RESERVED_MEM
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>
+
+static void rmem_dma_device_init(struct reserved_mem *rmem,
+			struct device *dev, struct of_phandle_args *args)
+{
+	dma_declare_coherent_memory(dev, rmem->base, rmem->base,
+		rmem->size, DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
+}
+
+static void rmem_dma_device_release(struct reserved_mem *rmem,
+				    struct device *dev)
+{
+	dma_release_declared_memory(dev);
+}
+
+static const struct reserved_mem_ops rmem_dma_ops = {
+	.device_init	= rmem_dma_device_init,
+	.device_release	= rmem_dma_device_release,
+};
+
+static int __init rmem_dma_setup(struct reserved_mem *rmem,
+				 unsigned long node,
+				 const char *uname)
+{
+	if (of_get_flat_dt_prop(node, "reusable", NULL))
+		return -EINVAL;
+
+	rmem->ops = &rmem_dma_ops;
+	pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n",
+		&rmem->base, (unsigned long)rmem->size / SZ_1M);
+	return 0;
+}
+RESERVEDMEM_OF_DECLARE(dma, "shared-dma-pool", rmem_dma_setup);
+#endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v4 1/7] drivers: of: add initialization code for reserved memory
From: Marek Szyprowski @ 2014-02-20 10:52 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linaro-mm-sig, devicetree,
	linux-doc
  Cc: Mark Rutland, Benjamin Herrenschmidt, Tomasz Figa, Will Deacon,
	Tomasz Figa, Paul Mackerras, Marek Szyprowski, Arnd Bergmann,
	Josh Cartwright, Catalin Marinas, Grant Likely, Laura Abbott,
	Ian Campbell, Pawel Moll, Stephen Warren, Sascha Hauer,
	Michal Nazarewicz, Marc, Nishanth Peethambaran, Rob Herring,
	Kumar Gala, Olof Johansson
In-Reply-To: <1392893567-31623-1-git-send-email-m.szyprowski@samsung.com>

This patch adds device tree support for contiguous and reserved memory
regions defined in device tree.

Large memory blocks can be reliably reserved only during early boot.
This must happen before the whole memory management subsystem is
initialized, because we need to ensure that the given contiguous blocks
are not yet allocated by kernel. Also it must happen before kernel
mappings for the whole low memory are created, to ensure that there will
be no mappings (for reserved blocks) or mapping with special properties
can be created (for CMA blocks). This all happens before device tree
structures are unflattened, so we need to get reserved memory layout
directly from fdt.

Later, those reserved memory regions are assigned to devices on each
device structure initialization.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
[joshc: rework to implement new DT binding, provide mechanism for
 plugging in new reserved-memory node handlers via
 RESERVEDMEM_OF_DECLARE]
Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
[mszyprow: added generic memory reservation code, refactored code to
 put it directly into fdt.c]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/of/Kconfig                |    6 +
 drivers/of/Makefile               |    1 +
 drivers/of/fdt.c                  |  145 ++++++++++++++++++
 drivers/of/of_reserved_mem.c      |  296 +++++++++++++++++++++++++++++++++++++
 drivers/of/platform.c             |    7 +
 include/asm-generic/vmlinux.lds.h |   11 ++
 include/linux/of_reserved_mem.h   |   65 ++++++++
 7 files changed, 531 insertions(+)
 create mode 100644 drivers/of/of_reserved_mem.c
 create mode 100644 include/linux/of_reserved_mem.h

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index c6973f101a3e..30a7d87a8077 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -75,4 +75,10 @@ config OF_MTD
 	depends on MTD
 	def_bool y
 
+config OF_RESERVED_MEM
+	depends on OF_EARLY_FLATTREE
+	bool
+	help
+	  Helpers to allow for reservation of memory regions
+
 endmenu # OF
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index efd05102c405..ed9660adad77 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_OF_MDIO)	+= of_mdio.o
 obj-$(CONFIG_OF_PCI)	+= of_pci.o
 obj-$(CONFIG_OF_PCI_IRQ)  += of_pci_irq.o
 obj-$(CONFIG_OF_MTD)	+= of_mtd.o
+obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 758b4f8b30b7..04efe2ba736f 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
@@ -438,6 +439,150 @@ int __initdata dt_root_size_cells;
 struct boot_param_header *initial_boot_params;
 
 #ifdef CONFIG_OF_EARLY_FLATTREE
+#if defined(CONFIG_HAVE_MEMBLOCK)
+int __init __weak
+early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
+				  bool nomap)
+{
+	if (memblock_is_region_reserved(base, size))
+		return -EBUSY;
+	if (nomap)
+		return memblock_remove(base, size);
+	return memblock_reserve(base, size);
+}
+#else
+int __init __weak
+early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
+				  bool nomap)
+{
+	pr_error("Reserved memory not supported, ignoring range 0x%llx - 0x%llx%s\n",
+		  base, size, nomap ? " (nomap)" : "");
+	return -ENOSYS;
+}
+#endif
+
+/**
+ * res_mem_reserve_reg() - reserve all memory described in 'reg' property
+ */
+static int __init
+__reserved_mem_reserve_reg(unsigned long node, const char *uname,
+		    phys_addr_t *res_base, phys_addr_t *res_size)
+{
+	int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
+	phys_addr_t base, size;
+	unsigned long len;
+	__be32 *prop;
+	int nomap;
+
+	prop = of_get_flat_dt_prop(node, "reg", &len);
+	if (!prop)
+		return -ENOENT;
+
+	if (len && len % t_len != 0) {
+		pr_err("Reserved memory: invalid reg property in '%s', skipping node.\n",
+		       uname);
+		return -EINVAL;
+	}
+
+	nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
+
+	/* store base and size values from the first reg tuple */
+	*res_base = 0;
+	while (len > 0) {
+		base = dt_mem_next_cell(dt_root_addr_cells, &prop);
+		size = dt_mem_next_cell(dt_root_size_cells, &prop);
+
+		if (base && size &&
+		    early_init_dt_reserve_memory_arch(base, size, nomap) == 0)
+			pr_debug("Reserved memory: reserved region for node '%s': base %pa, size %ld MiB\n",
+				uname, &base, (unsigned long)size / SZ_1M);
+		else
+			pr_info("Reserved memory: failed to reserve memory for node '%s': base %pa, size %ld MiB\n",
+				uname, &base, (unsigned long)size / SZ_1M);
+
+		len -= t_len;
+
+		if (!(*res_base)) {
+			*res_base = base;
+			*res_size = size;
+		}
+	}
+	return 0;
+}
+
+static int __reserved_mem_check_root(unsigned long node)
+{
+	__be32 *prop;
+
+	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	if (prop && be32_to_cpup(prop) != dt_root_size_cells)
+		return -EINVAL;
+
+	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	if (prop && be32_to_cpup(prop) != dt_root_addr_cells)
+		return -EINVAL;
+
+	prop = of_get_flat_dt_prop(node, "ranges", NULL);
+	if (!prop)
+		return -EINVAL;
+	return 0;
+}
+
+/**
+ * fdt_scan_reserved_mem() - scan a single FDT node for reserved memory
+ */
+static int __init
+__fdt_scan_reserved_mem(unsigned long node, const char *uname, int depth,
+		      void *data)
+{
+	phys_addr_t base = 0, size = 0;
+	static int found;
+	const char *status;
+	int err;
+
+	if (!found && depth == 1 && strcmp(uname, "reserved-memory") == 0) {
+		if (__reserved_mem_check_root(node) != 0) {
+			pr_err("Reserved memory: unsupported node format, ignoring\n");
+			/* break scan */
+			return 1;
+		}
+		found = 1;
+		/* scan next node */
+		return 0;
+	} else if (!found) {
+		/* scan next node */
+		return 0;
+	} else if (found && depth < 2) {
+		/* scanning of /reserved-memory has been finished */
+		return 1;
+	}
+
+	status = of_get_flat_dt_prop(node, "status", NULL);
+	if (status && strcmp(status, "okay") != 0 && strcmp(status, "ok") != 0)
+		return 0;
+
+	err = __reserved_mem_reserve_reg(node, uname, &base, &size);
+	if (err == -ENOENT && of_get_flat_dt_prop(node, "size", NULL) == NULL)
+		goto end;
+
+	fdt_reserved_mem_save_node(node, uname, base, size);
+end:
+	/* scan next node */
+	return 0;
+}
+
+/**
+ * early_init_fdt_scan_reserved_mem() - create reserved memory regions
+ *
+ * This function grabs memory from early allocator for device exclusive use
+ * defined in device tree structures. It should be called by arch specific code
+ * once the early allocator (i.e. memblock) has been fully activated.
+ */
+void __init early_init_fdt_scan_reserved_mem(void)
+{
+	of_scan_flat_dt(__fdt_scan_reserved_mem, NULL);
+	fdt_init_reserved_mem();
+}
 
 /**
  * of_scan_flat_dt - scan flattened tree blob and call callback on each.
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
new file mode 100644
index 000000000000..cacf04810b87
--- /dev/null
+++ b/drivers/of/of_reserved_mem.c
@@ -0,0 +1,296 @@
+/*
+ * Device tree based initialization code for reserved memory.
+ *
+ * Copyright (c) 2013, The Linux Foundation. All Rights Reserved.
+ * Copyright (c) 2013,2014 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ * Author: Marek Szyprowski <m.szyprowski@samsung.com>
+ * Author: Josh Cartwright <joshc@codeaurora.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License or (at your optional) any later version of the license.
+ */
+
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
+#include <linux/mm.h>
+#include <linux/sizes.h>
+#include <linux/of_reserved_mem.h>
+
+#define MAX_RESERVED_REGIONS	16
+static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS];
+static int reserved_mem_count;
+
+#if defined(CONFIG_HAVE_MEMBLOCK)
+#include <linux/memblock.h>
+int __init __weak
+early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align,
+					 phys_addr_t start, phys_addr_t end,
+					 bool nomap, phys_addr_t *res_base)
+{
+	/*
+	 * We use __memblock_alloc_base() since memblock_alloc_base() panic()s.
+	 */
+	phys_addr_t base = __memblock_alloc_base(size, align, end);
+	if (!base)
+		return -ENOMEM;
+
+	if (base < start) {
+		memblock_free(base, size);
+		return -ENOMEM;
+	}
+
+	*res_base = base;
+	if (nomap)
+		return memblock_remove(base, size);
+	return 0;
+}
+#else
+int __init __weak
+early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align,
+					 phys_addr_t start, phys_addr_t end,
+					 bool nomap, phys_addr_t *res_base)
+{
+	pr_error("Reserved memory not supported, ignoring region 0x%llx%s\n",
+		  size, nomap ? " (nomap)" : "");
+	return -ENOSYS;
+}
+#endif
+
+/**
+ * res_mem_save_node() - save fdt node for second pass initialization
+ */
+int __init fdt_reserved_mem_save_node(unsigned long node, const char *uname,
+				      phys_addr_t base, phys_addr_t size)
+{
+	struct reserved_mem *rmem = &reserved_mem[reserved_mem_count];
+
+	if (reserved_mem_count == ARRAY_SIZE(reserved_mem)) {
+		pr_err("Reserved memory: not enough space all defined regions.\n");
+		return -ENOSPC;
+	}
+
+	rmem->fdt_node = node;
+	rmem->name = uname;
+	rmem->base = base;
+	rmem->size = size;
+
+	reserved_mem_count++;
+	return 0;
+}
+
+/**
+ * res_mem_alloc_size() - allocate reserved memory described by 'size', 'align'
+ *			  and 'alloc-ranges' properties
+ */
+static int __init
+__reserved_mem_alloc_size(unsigned long node, const char *uname,
+			  phys_addr_t *res_base, phys_addr_t *res_size)
+{
+	int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
+	phys_addr_t start = 0, end = 0;
+	phys_addr_t base = 0, align = 0, size;
+	unsigned long len;
+	__be32 *prop;
+	int nomap;
+	int ret;
+
+	prop = of_get_flat_dt_prop(node, "size", &len);
+	if (!prop)
+		return -EINVAL;
+
+	if (len != dt_root_size_cells * sizeof(__be32)) {
+		pr_err("Reserved memory: invalid size property in '%s' node.\n",
+				uname);
+		return -EINVAL;
+	}
+	size = dt_mem_next_cell(dt_root_size_cells, &prop);
+
+	nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
+
+	prop = of_get_flat_dt_prop(node, "align", &len);
+	if (prop) {
+		if (len != dt_root_addr_cells * sizeof(__be32)) {
+			pr_err("Reserved memory: invalid align property in '%s' node.\n",
+				uname);
+			return -EINVAL;
+		}
+		align = dt_mem_next_cell(dt_root_addr_cells, &prop);
+	}
+
+	prop = of_get_flat_dt_prop(node, "alloc-ranges", &len);
+	if (prop) {
+
+		if (len % t_len != 0) {
+			pr_err("Reserved memory: invalid alloc-ranges property in '%s', skipping node.\n",
+			       uname);
+			return -EINVAL;
+		}
+
+		base = 0;
+
+		while (len > 0) {
+			start = dt_mem_next_cell(dt_root_addr_cells, &prop);
+			end = start + dt_mem_next_cell(dt_root_size_cells,
+						       &prop);
+
+			ret = early_init_dt_alloc_reserved_memory_arch(size,
+					align, start, end, nomap, &base);
+			if (ret == 0) {
+				pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n",
+					uname, &base,
+					(unsigned long)size / SZ_1M);
+				break;
+			}
+			len -= t_len;
+		}
+
+	} else {
+		ret = early_init_dt_alloc_reserved_memory_arch(size, align,
+							0, 0, nomap, &base);
+		if (ret == 0)
+			pr_debug("Reserved memory: allocated memory for '%s' node: base %pa, size %ld MiB\n",
+				uname, &base, (unsigned long)size / SZ_1M);
+	}
+
+	if (base == 0) {
+		pr_info("Reserved memory: failed to allocate memory for node '%s'\n",
+			uname);
+		return -ENOMEM;
+	}
+
+	*res_base = base;
+	*res_size = size;
+
+	return 0;
+}
+
+static const struct of_device_id __rmem_of_table_sentinel
+	__used __section(__reservedmem_of_table_end);
+
+/**
+ * res_mem_init_node() - call region specific reserved memory init code
+ */
+static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
+{
+	extern const struct of_device_id __reservedmem_of_table[];
+	const struct of_device_id *i;
+
+	for (i = __reservedmem_of_table; i < &__rmem_of_table_sentinel; i++) {
+		reservedmem_of_init_fn initfn = i->data;
+		const char *compat = i->compatible;
+
+		if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
+			continue;
+
+		if (initfn(rmem, rmem->fdt_node, rmem->name) == 0) {
+			pr_info("Reserved memory: initialized node %s, compatible id %s\n",
+				rmem->name, compat);
+			return 0;
+		}
+	}
+	return -ENOENT;
+}
+
+/**
+ * fdt_init_reserved_mem - allocate and init all saved reserved memory regions
+ */
+void __init fdt_init_reserved_mem(void)
+{
+	int i;
+	for (i = 0; i < reserved_mem_count; i++) {
+		struct reserved_mem *rmem = &reserved_mem[i];
+		unsigned long node = rmem->fdt_node;
+		unsigned long len;
+		__be32 *prop;
+		int err = 0;
+
+		prop = of_get_flat_dt_prop(node, "phandle", &len);
+		if (!prop)
+			prop = of_get_flat_dt_prop(node, "linux,phandle", &len);
+		if (prop)
+			rmem->phandle = of_read_number(prop, len/4);
+
+		if (rmem->size == 0)
+			err = __reserved_mem_alloc_size(node, rmem->name,
+						 &rmem->base, &rmem->size);
+		if (err == 0)
+			__reserved_mem_init_node(rmem);
+	}
+}
+
+static inline struct reserved_mem *__find_rmem(struct device_node *node)
+{
+	unsigned int len, phandle_val;
+	const __be32 *prop;
+	unsigned int i;
+
+	prop = of_get_property(node, "phandle", &len);
+	if (!prop)
+		prop = of_get_property(node, "linux,phandle", &len);
+	if (!prop || len < sizeof(__be32))
+		return NULL;
+
+	phandle_val = be32_to_cpup(prop);
+	for (i = 0; i < reserved_mem_count; i++)
+		if (reserved_mem[i].phandle == phandle_val)
+			return &reserved_mem[i];
+	return NULL;
+}
+
+/**
+ * of_reserved_mem_device_init() - assign reserved memory region to given device
+ *
+ * This function assign memory region pointed by "memory-region" device tree
+ * property to the given device.
+ */
+void of_reserved_mem_device_init(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct reserved_mem *rmem;
+	struct of_phandle_args s;
+	unsigned int i;
+
+	for (i = 0; of_parse_phandle_with_args(np, "memory-region",
+				"#memory-region-cells", i, &s) == 0; i++) {
+
+		rmem = __find_rmem(s.np);
+		if (!rmem || !rmem->ops || !rmem->ops->device_init) {
+			of_node_put(s.np);
+			continue;
+		}
+
+		rmem->ops->device_init(rmem, dev, &s);
+		dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
+		of_node_put(s.np);
+		break;
+	}
+}
+
+/**
+ * of_reserved_mem_device_release() - release reserved memory device structures
+ *
+ * This function releases structures allocated for memory region handling for
+ * the given device.
+ */
+void of_reserved_mem_device_release(struct device *dev)
+{
+	struct device_node *np = dev->of_node;
+	struct reserved_mem *rmem;
+	struct of_phandle_args s;
+	unsigned int i;
+
+	for (i = 0; of_parse_phandle_with_args(np, "memory-region",
+				"#memory-region-cells", i, &s) == 0; i++) {
+
+		rmem = __find_rmem(s.np);
+		if (rmem && rmem->ops && rmem->ops->device_release)
+			rmem->ops->device_release(rmem, dev);
+
+		of_node_put(s.np);
+	}
+}
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 404d1daebefa..3df0b1826e8b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -21,6 +21,7 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
 
 const struct of_device_id of_default_bus_match_table[] = {
@@ -220,6 +221,8 @@ static struct platform_device *of_platform_device_create_pdata(
 	dev->dev.bus = &platform_bus_type;
 	dev->dev.platform_data = platform_data;
 
+	of_reserved_mem_device_init(&dev->dev);
+
 	/* We do not fill the DMA ops for platform devices by default.
 	 * This is currently the responsibility of the platform code
 	 * to do such, possibly using a device notifier
@@ -227,6 +230,7 @@ static struct platform_device *of_platform_device_create_pdata(
 
 	if (of_device_add(dev) != 0) {
 		platform_device_put(dev);
+		of_reserved_mem_device_release(&dev->dev);
 		return NULL;
 	}
 
@@ -282,6 +286,8 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 	else
 		of_device_make_bus_id(&dev->dev);
 
+	of_reserved_mem_device_init(&dev->dev);
+
 	/* Allow the HW Peripheral ID to be overridden */
 	prop = of_get_property(node, "arm,primecell-periphid", NULL);
 	if (prop)
@@ -308,6 +314,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 	return dev;
 
 err_free:
+	of_reserved_mem_device_release(&dev->dev);
 	amba_device_put(dev);
 	return NULL;
 }
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bc2121fa9132..f10f64fcc815 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -167,6 +167,16 @@
 #define CLK_OF_TABLES()
 #endif
 
+#ifdef CONFIG_OF_RESERVED_MEM
+#define RESERVEDMEM_OF_TABLES()				\
+	. = ALIGN(8);					\
+	VMLINUX_SYMBOL(__reservedmem_of_table) = .;	\
+	*(__reservedmem_of_table)			\
+	*(__reservedmem_of_table_end)
+#else
+#define RESERVEDMEM_OF_TABLES()
+#endif
+
 #define KERNEL_DTB()							\
 	STRUCT_ALIGN();							\
 	VMLINUX_SYMBOL(__dtb_start) = .;				\
@@ -490,6 +500,7 @@
 	TRACE_SYSCALLS()						\
 	MEM_DISCARD(init.rodata)					\
 	CLK_OF_TABLES()							\
+	RESERVEDMEM_OF_TABLES()						\
 	CLKSRC_OF_TABLES()						\
 	KERNEL_DTB()							\
 	IRQCHIP_OF_MATCH_TABLE()
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
new file mode 100644
index 000000000000..0bbec4bf23ce
--- /dev/null
+++ b/include/linux/of_reserved_mem.h
@@ -0,0 +1,65 @@
+#ifndef __OF_RESERVED_MEM_H
+#define __OF_RESERVED_MEM_H
+
+struct cma;
+struct device;
+struct of_phandle_args;
+struct reserved_mem_ops;
+
+struct reserved_mem {
+	const char			*name;
+	unsigned long			fdt_node;
+	unsigned long			phandle;
+	const struct reserved_mem_ops	*ops;
+	phys_addr_t			base;
+	phys_addr_t			size;
+	void				*priv;
+};
+
+struct reserved_mem_ops {
+	void	(*device_init)(struct reserved_mem *rmem,
+			       struct device *dev,
+			       struct of_phandle_args *args);
+	void	(*device_release)(struct reserved_mem *rmem,
+				  struct device *dev);
+};
+
+typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
+				      unsigned long node, const char *uname);
+
+#ifdef CONFIG_OF_RESERVED_MEM
+void of_reserved_mem_device_init(struct device *dev);
+void of_reserved_mem_device_release(struct device *dev);
+
+void fdt_init_reserved_mem(void);
+void early_init_fdt_scan_reserved_mem(void);
+int fdt_reserved_mem_save_node(unsigned long node, const char *uname,
+			       phys_addr_t base, phys_addr_t size);
+
+#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
+	static const struct of_device_id __reservedmem_of_table_##name	\
+		__used __section(__reservedmem_of_table)		\
+		 = { .compatible = compat,				\
+		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
+				init : init }
+
+#else
+static inline void of_reserved_mem_device_init(struct device *dev) { }
+static inline void of_reserved_mem_device_release(struct device *pdev) { }
+
+static inline void fdt_init_reserved_mem(void) { }
+static inline void early_init_fdt_scan_reserved_mem(void) { }
+static inline int
+fdt_reserved_mem_save_node(unsigned long node, const char *uname,
+			       phys_addr_t base, phys_addr_t size) { }
+
+#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
+	static const struct of_device_id __reservedmem_of_table_##name	\
+		__attribute__((unused))					\
+		 = { .compatible = compat,				\
+		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
+				init : init }
+
+#endif
+
+#endif /* __OF_RESERVED_MEM_H */
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v4 0/7] reserved-memory regions/CMA in devicetree, again
From: Marek Szyprowski @ 2014-02-20 10:52 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, linaro-mm-sig, devicetree,
	linux-doc
  Cc: Marek Szyprowski, Benjamin Herrenschmidt, Arnd Bergmann,
	Michal Nazarewicz, Grant Likely, Tomasz Figa, Sascha Hauer,
	Laura Abbott, Rob Herring, Olof Johansson, Pawel Moll,
	Mark Rutland, Stephen Warren, Ian Campbell, Tomasz Figa,
	Kumar Gala, Nishanth Peethambaran, Marc, Josh Cartwright,
	Catalin Marinas, Will Deacon, Paul Mackerras

Hi all!

This is another quick update of the patches which add basic support for
dynamic allocation of memory reserved regions defined in device tree.

This time I hope I've really managed to address all the issues reported
by Grant Likely, see the change log for more details. As a bonus, I've
added support for ARM64 and PowerPC, as those architectures had quite
well defined place where early memory reservation can be done.

The initial code for this feature were posted here [1], merged as commit
9d8eab7af79cb4ce2de5de39f82c455b1f796963 ("drivers: of: add
initialization code for dma reserved memory") and later reverted by
commit 1931ee143b0ab72924944bc06e363d837ba05063. For more information,
see [2]. Finally a new bindings has been proposed [3] and Josh
Cartwright a few days ago prepared some code which implements those
bindings [4]. This finally pushed me again to find some time to finish
this task and review the code. Josh agreed to give me the ownership of
this series to continue preparing them for mainline inclusion.

For more information please refer to the changlelog below.

[1]: http://lkml.kernel.org/g/1377527959-5080-1-git-send-email-m.szyprowski@samsung.com
[2]: http://lkml.kernel.org/g/1381476448-14548-1-git-send-email-m.szyprowski@samsung.com
[3]: http://lkml.kernel.org/g/20131030134702.19B57C402A0@trevor.secretlab.ca
[4]: http://thread.gmane.org/gmane.linux.documentation/19579

Changelog:

v4:
- dynamic allocations are processed after all static reservations has been
  done
- moved code for handling static reservations to drivers/of/fdt.c
- removed node matching by string comparison, now phandle values are used
  directly
- moved code for DMA and CMA handling directly to
  drivers/base/dma-{coherent,contiguous}.c
- added checks for proper #size-cells, #address-cells, ranges properties
  in /reserved-memory node
- even more code cleanup
- added init code for ARM64 and PowerPC

v3: http://article.gmane.org/gmane.linux.documentation/20169/
- refactored memory reservation code, created common code to parse reg, size,
  align, alloc-ranges properties
- added support for multiple tuples in 'reg' property
- memory is reserved regardless of presence of the driver for its compatible
- prepared arch specific hooks for memory reservation (defaults use memblock
  calls)
- removed node matching by string during device initialization
- CMA init code: added checks for required region alignment
- more code cleanup here and there

v2: http://thread.gmane.org/gmane.linux.documentation/19870/
- removed copying of the node name
- split shared-dma-pool handling into separate files (one for CMA and one
  for dma_declare_coherent based implementations) for making the code easier
  to understand
- added support for AMBA devices, changed prototypes to use struct decice
  instead of struct platform_device
- renamed some functions to better match other names used in drivers/of/
- restructured the rest of the code a bit for better readability
- added 'reusable' property to exmaple linux,cma node in documentation
- exclusive dma (dma_coherent) is used for only handling 'shared-dma-pool'
  regions without 'reusable' property and CMA is used only for handling
  'shared-dma-pool' regions with 'reusable' property.

v1: http://thread.gmane.org/gmane.linux.documentation/19579
- initial version prepared by Josh Cartwright

Summary:

Grant Likely (1):
  of: document bindings for reserved-memory nodes

Marek Szyprowski (6):
  drivers: of: add initialization code for reserved memory
  drivers: dma-coherent: add initialization from device tree
  drivers: dma-contiguous: add initialization from device tree
  arm: add support for reserved memory defined by device tree
  arm64: add support for reserved memory defined by device tree
  powerpc: add support for reserved memory defined by device tree

 .../bindings/reserved-memory/reserved-memory.txt   |  138 +++++++++
 arch/arm/Kconfig                                   |    1 +
 arch/arm/mm/init.c                                 |    3 +
 arch/arm64/Kconfig                                 |    1 +
 arch/arm64/mm/init.c                               |    2 +
 arch/powerpc/Kconfig                               |    1 +
 arch/powerpc/kernel/prom.c                         |    3 +
 drivers/base/dma-coherent.c                        |   41 +++
 drivers/base/dma-contiguous.c                      |  130 +++++++--
 drivers/of/Kconfig                                 |    6 +
 drivers/of/Makefile                                |    1 +
 drivers/of/fdt.c                                   |  145 ++++++++++
 drivers/of/of_reserved_mem.c                       |  296 ++++++++++++++++++++
 drivers/of/platform.c                              |    7 +
 include/asm-generic/vmlinux.lds.h                  |   11 +
 include/linux/of_reserved_mem.h                    |   65 +++++
 16 files changed, 829 insertions(+), 22 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
 create mode 100644 drivers/of/of_reserved_mem.c
 create mode 100644 include/linux/of_reserved_mem.h

-- 
1.7.9.5


^ permalink raw reply

* Re: [PATCH v4 0/4] Bugfix for of_match_node ordering
From: Sachin Kamat @ 2014-02-20 10:27 UTC (permalink / raw)
  To: Kevin Hao
  Cc: Grant Likely, devicetree@vger.kernel.org, LKML, Rob Herring,
	Sebastian Hesselbarth, linux-samsung-soc
In-Reply-To: <20140220101240.GA3745@pek-khao-d1.corp.ad.wrs.com>

Hi Kevin,

On 20 February 2014 15:42, Kevin Hao <haokexin@gmail.com> wrote:
> On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
>> Hi Grant,
>>
>> I observe the following boot failure with today's (next-20140220) linux-next
>> tree on Exynos based boards with the default exynos_defconfig.
>
> Does this help?

The below patch works for me. Thanks for the fix.

>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 8a27fc907ab6..9cc893530b9a 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -381,12 +381,16 @@ static int __of_device_is_compatible(const struct device_node *device,
>
>         /* Compatible match has highest priority */
>         if (compat && compat[0]) {
> -               of_property_for_each_string(device, "compatible", prop, cp) {
> +               prop = __of_find_property(device, "compatible", NULL);
> +               if (!prop)
> +                       return 0;
> +
> +               for (cp = of_prop_next_string(prop, NULL); cp;
> +                               cp = of_prop_next_string(prop, cp), index++) {
>                         if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {
>                                 score = INT_MAX/2 - (index << 2);
>                                 break;
>                         }
> -                       index++;
>                 }
>                 if (!score)
>                         return 0;
>
>
> Thanks,
> Kevin



-- 
With warm regards,
Sachin

^ permalink raw reply

* Re: [PATCH v4 0/4] Bugfix for of_match_node ordering
From: Kevin Hao @ 2014-02-20 10:12 UTC (permalink / raw)
  To: Sachin Kamat
  Cc: Grant Likely, devicetree@vger.kernel.org, LKML, Rob Herring,
	Sebastian Hesselbarth, linux-samsung-soc
In-Reply-To: <CAK9yfHwwmZkFMRvxsxjBAfUbVXU3V+iPFDZO=DwQsFvJ3NQyKA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1016 bytes --]

On Thu, Feb 20, 2014 at 02:09:08PM +0530, Sachin Kamat wrote:
> Hi Grant,
> 
> I observe the following boot failure with today's (next-20140220) linux-next
> tree on Exynos based boards with the default exynos_defconfig.

Does this help?

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 8a27fc907ab6..9cc893530b9a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -381,12 +381,16 @@ static int __of_device_is_compatible(const struct device_node *device,
 
 	/* Compatible match has highest priority */
 	if (compat && compat[0]) {
-		of_property_for_each_string(device, "compatible", prop, cp) {
+		prop = __of_find_property(device, "compatible", NULL);
+		if (!prop)
+			return 0;
+
+		for (cp = of_prop_next_string(prop, NULL); cp;
+				cp = of_prop_next_string(prop, cp), index++) {
 			if (of_compat_cmp(cp, compat, strlen(compat)) == 0) {
 				score = INT_MAX/2 - (index << 2);
 				break;
 			}
-			index++;
 		}
 		if (!score)
 			return 0;


Thanks,
Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply related

* [PATCH RESEND v2 1/3] usb: chipidea: msm: Add device tree binding information
From: Ivan T. Ivanov @ 2014-02-20  9:53 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Rob Landley
  Cc: Ivan T. Ivanov, Greg Kroah-Hartman, David Brown, devicetree,
	linux-doc, linux-kernel, linux-arm-msm, linux-usb
In-Reply-To: <530512F1.3060304@cogentembedded.com>

From: "Ivan T. Ivanov" <iivanov@mm-sol.com>

Document device tree binding information as required by
the Qualcomm USB controller.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
---
 .../devicetree/bindings/usb/msm-hsusb.txt          |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/msm-hsusb.txt b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
index 5ea26c6..d4e7e41 100644
--- a/Documentation/devicetree/bindings/usb/msm-hsusb.txt
+++ b/Documentation/devicetree/bindings/usb/msm-hsusb.txt
@@ -15,3 +15,20 @@ Example EHCI controller device node:
 		usb-phy = <&usb_otg>;
 	};
 
+CI13xxx (Chipidea) USB controllers
+
+Required properties:
+- compatible:   should contain "qcom,ci-hdrc"
+- reg:          offset and length of the register set in the memory map
+- interrupts:   interrupt-specifier for the controller interrupt.
+- usb-phy:      phandle for the PHY device
+- dr_mode:      Sould be "peripheral"
+
+	gadget@f9a55000 {
+		compatible = "qcom,ci-hdrc";
+		reg = <0xf9a55000 0x400>;
+		dr_mode = "peripheral";
+		interrupts = <0 134 0>;
+		usb-phy = <&usb_otg>;
+	};
+
-- 
1.7.9.5


^ permalink raw reply related

* Re: [PATCH v3 1/3] dma: Support multiple interleaved frames with non-contiguous memory
From: Jassi Brar @ 2014-02-20  9:53 UTC (permalink / raw)
  To: Srikanth Thokala
  Cc: Williams, Dan J, Koul, Vinod, Michal Simek, Grant Likely,
	Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA, Levente Kurusa,
	Lars-Peter Clausen, lkml, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	Andy Shevchenko,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <CA+mB=1LK+aVbvh741+PMnpj_mwZRvJZzR5Fh=hf72UWQvxUiVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 20 February 2014 14:54, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> On Wed, Feb 19, 2014 at 12:33 AM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> On 18 February 2014 23:16, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>>> On Tue, Feb 18, 2014 at 10:20 PM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>>> On 18 February 2014 16:58, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>>>>> On Mon, Feb 17, 2014 at 3:27 PM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>>>>> On 15 February 2014 17:30, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>>>>>>> The current implementation of interleaved DMA API support multiple
>>>>>>> frames only when the memory is contiguous by incrementing src_start/
>>>>>>> dst_start members of interleaved template.
>>>>>>>
>>>>>>> But, when the memory is non-contiguous it will restrict slave device
>>>>>>> to not submit multiple frames in a batch.  This patch handles this
>>>>>>> issue by allowing the slave device to send array of interleaved dma
>>>>>>> templates each having a different memory location.
>>>>>>>
>>>>>> How fragmented could be memory in your case? Is it inefficient to
>>>>>> submit separate transfers for each segment/frame?
>>>>>> It will help if you could give a typical example (chunk size and gap
>>>>>> in bytes) of what you worry about.
>>>>>
>>>>> With scatter-gather engine feature in the hardware, submitting separate
>>>>> transfers for each frame look inefficient. As an example, our DMA engine
>>>>> supports up to 16 video frames, with each frame (a typical video frame
>>>>> size) being contiguous in memory but frames are scattered into different
>>>>> locations. We could not definitely submit frame by frame as it would be
>>>>> software overhead (HW interrupting for each frame) resulting in video lags.
>>>>>
>>>> IIUIC, it is 30fps and one dma interrupt per frame ... it doesn't seem
>>>> inefficient at all. Even poor-latency audio would generate a higher
>>>> interrupt-rate. So the "inefficiency concern" doesn't seem valid to
>>>> me.
>>>>
>>>> Not to mean we shouldn't strive to reduce the interrupt-rate further.
>>>> Another option is to emulate the ring-buffer scheme of ALSA.... which
>>>> should be possible since for a session of video playback the frame
>>>> buffers' locations wouldn't change.
>>>>
>>>> Yet another option is to use the full potential of the
>>>> interleaved-xfer api as such. It seems you confuse a 'video frame'
>>>> with the interleaved-xfer api's 'frame'. They are different.
>>>>
>>>> Assuming your one video frame is F bytes long and Gk is the gap in
>>>> bytes between end of frame [k] and start of frame [k+1] and  Gi != Gj
>>>> for i!=j
>>>> In the context of interleaved-xfer api, you have just 1 Frame of 16
>>>> chunks. Each chunk is Fbytes and the inter-chunk-gap(ICG) is Gk  where
>>>> 0<=k<15
>>>> So for your use-case .....
>>>>   dma_interleaved_template.numf = 1   /* just 1 frame */
>>>>   dma_interleaved_template.frame_size = 16  /* containing 16 chunks */
>>>>    ...... //other parameters
>>>>
>>>> You have 3 options to choose from and all should work just as fine.
>>>> Otherwise please state your problem in real numbers (video-frames'
>>>> size, count & gap in bytes).
>>>
>>> Initially I interpreted interleaved template the same.  But, Lars corrected me
>>> in the subsequent discussion and let me put it here briefly,
>>>
>>> In the interleaved template, each frame represents a line of size denoted by
>>> chunk.size and the stride by icg.  'numf' represent number of frames i.e.
>>> number of lines.
>>>
>>> In video frame context,
>>> chunk.size -> hsize
>>> chunk.icg -> stride
>>> numf -> vsize
>>> and frame_size is always 1 as it will have only one chunk in a line.
>>>
>> But you said in your last post
>>   "with each frame (a typical video frame size) being contiguous in memory"
>>  ... which is not true from what you write above. Anyways, my first 2
>> suggestions still hold.
>
> Yes, each video frame is contiguous and they can be scattered.
>
I assume by contiguous frame you mean as in framebuffer?  Which is an
array of bytes.
If yes, then you should do as I suggest first,  frame_size=16  and numf=1.

If no, then it seems you are already doing the right thing.... the
ring-buffer scheme. Please share some stats how the current api is
causing you overhead because that is a very common case (many
controllers support LLI) and you have 467ms (@30fps with 16-frames
ring-buffer) to queue in before you see any frame drop.

Regards,
Jassi
--
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: devicetree repository separation/migration
From: Ian Campbell @ 2014-02-20  9:50 UTC (permalink / raw)
  To: Warner Losh
  Cc: Jason Cooper, Olof Johansson, Sascha Hauer, Grant Likely,
	Rob Herring, Pawel Moll, Mark Rutland, Kumar Gala, Rob Landley,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <FC8FF4FE-E9F5-4C17-BF3A-01ADAA1584D7-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>

On Wed, 2014-02-19 at 13:23 -0700, Warner Losh wrote:
> On Feb 19, 2014, at 11:32 AM, Jason Cooper wrote:
> 
> > On Tue, Feb 18, 2014 at 11:47:56AM -0800, Olof Johansson wrote:
> >> On Tue, Feb 18, 2014 at 10:18 AM, Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org> wrote:
> >> I think we have two options:
> >> 
> >> 1. Bring out everything in the current kernel repo to a separate one,
> >> but do it my mirroring over. Changes go into the kernel repo first and
> >> then comes over to this one, but other projects can mirror the
> >> standalone repo without downloading a whole kernel tree.
> > 
> > I prefer this one.  Assuming that a separate repo is mostly agreed upon,
> > this allows us to provide the tree in an easily digestible way without
> > impacting the current workflow.
> > 
> > Also, if it works for the other projects, no one says we have to move
> > beyond this step.
> 
> I just joined this list...  What's the scope of what would move into the new
> repo? The dts files with the binding docs, or also the code to implement
> those bindings?

Just the dts(i) and Bindings docs, not the code.

e.g. something like
http://xenbits.xen.org/gitweb/?p=people/ianc/device-tree-rebasing.git
would be the ultimate goal.

Ian.

--
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: devicetree repository separation/migration
From: Ian Campbell @ 2014-02-20  9:49 UTC (permalink / raw)
  To: frowand.list-Re5JQEeQqe8AvxtiuMwx3w
  Cc: Jason Cooper, Sascha Hauer, Grant Likely, Rob Herring,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, rob-VoJi6FS/r0vR7s880joybQ,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <5305119F.2070405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Wed, 2014-02-19 at 12:18 -0800, Frank Rowand wrote:
> I am predicting increased pain for little gain if the dts files move out
> of the linux kernel repository.

That's only the case if you take a very Linux centric point of view and
as others have pointed out there are numerous other projects which would
like to both consume and contribute to the set of DTS files, forcing all
those people to take part in Linux development in order to do so is a
barrier which has been shown to be too high in many cases, which is
already leading to fragmentation.

If DTB is to be taken seriously as a generic standard for describing
hardware then IMHO it cannot afford to remain so closely tied to a
single consumer.

Ian.

--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" 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 4/4] Documentation: devicetree: add bindings documentation for bcm63xx-uart
From: Mark Rutland @ 2014-02-20  9:45 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org,
	mbizon@freebox.fr, jogo@openwrt.org, gregkh@linuxfoundation.org
In-Reply-To: <1392852167-26243-5-git-send-email-f.fainelli@gmail.com>

On Wed, Feb 19, 2014 at 11:22:47PM +0000, Florian Fainelli wrote:
> Add the Device Tree binding documentation for the non-standard BCM63xx
> UART hardware block found in the BCM63xx DSL SoCs.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  .../devicetree/bindings/serial/bcm63xx-uart.txt    | 24 ++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
> 
> diff --git a/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt b/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
> new file mode 100644
> index 0000000..829441d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
> @@ -0,0 +1,24 @@
> +Broadcom BCM63xx UART: Non standard UART used in the Broadcom BCM63xx DSL SoCs
> +
> +Required properties:
> +- compatible: must be "brcm,bcm63xx-uart"
> +- reg: offset and length of the register set for the device
> +- interrupts: device interrupt
> +- clocks: a phandle to the functional clock node
> +- clock-names: must be "periph"

Minor issues: clocks aren't just phandles, and as the clock is expected
to be named it would be nice to define clocks in terms of clock-names:

- clocks: a list of phandles + clock-specifiers, one for each entry in
  clock-names
- clock-names: should contain "periph" for the functional clock

Thanks,
Mark.

> +
> +Note: each UART port must have an alias correctly numbered in the "aliases"
> +node, e.g:
> +
> +serial0: uart@600 {
> +	compatible = "brcm,bcm63xx-uart";
> +	reg = <0x600 0x1b>;
> +	interrupts = <GIC_SPI 32 0>;
> +	clocks = <&periph_clk>;
> +	clock-names = "periph";
> +};
> +
> +aliases {
> +	uart0 = &serial0;
> +	uart1 = &serial1;
> +};
> -- 
> 1.8.3.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: devicetree repository separation/migration
From: Ian Campbell @ 2014-02-20  9:40 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Rob Herring, Tim Bird, Jason Cooper, Sascha Hauer, Grant Likely,
	Pawel Moll, Mark Rutland, Kumar Gala, Rob Landley,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CAOesGMiHOwSYTCUaptacN=_pbXnObU5gqpxQHQ+kRTaW-ow3rA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, 2014-02-19 at 13:20 -0800, Olof Johansson wrote:
> On Wed, Feb 19, 2014 at 1:12 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > One way to minimize the inconvenience is keep versioning and dev
> > cycles in sync with the kernel. We could also start doing things to
> > align the kernel workflow with how things will work when we do have a
> > separate repository.
> 
> I don't think aligning development cycles is what we want most here it
> might be useful for us in Linux but it'll make things difficult for
> other projects since they're not aware of our release cycles. The
> device tree bindings and DT contents in that repo should be "always
> stable", i.e. no merge window / rc concept. As soon as something goes
> in it's live, and from then out only fixes to the DTS files (or
> appending the binding).

I agree, but I also think it would be useful to draw the occasional line
in the sand and do e.g. monthly or quarterly tagged releases e.g. for
distros who want a tarball package to work off.

There's no reason for that to be tied to any other projects dev cycle
though.

Ian.

--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" 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: devicetree repository separation/migration
From: Ian Campbell @ 2014-02-20  9:38 UTC (permalink / raw)
  To: Grant Likely
  Cc: Frank Rowand, Sascha Hauer, Tim Bird, Olof Johansson,
	Jason Cooper, Rob Herring, Pawel Moll, Mark Rutland, Kumar Gala,
	Rob Landley, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CACxGe6ugF2_kzDPLdv-Z1LUnkX4DHq9R45o64kJHVBSQjWFiNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, 2014-02-20 at 08:14 +0000, Grant Likely wrote:
> >> The other argument is shared source between
> >> BSD/U-Boot/Barebox/Linux/etc. Until we have a separate .dts repo there

                            ^/Xen ;-)

> >> is no good way to share the database of hardware descriptions.
> >
> > We could provide an easy export (see below).  What do you think?
> 
> Ian Campbell is already maintaining an export tree as a staging area
> for an eventual split. He's had it up and running for almost a year
> now:
> 
> http://xenbits.xen.org/gitweb/?p=people/ianc/device-tree-rebasing.git

NB, per the name it is potentially rebasing, effectively until if/when
it becomes the primary. In practice it hasn't been rebased since the
early days while I was sorting out the translations.

I've got an open action to move it somewhere other than xenbits,
probably git.kernel.org unless someone can supply a more neutral place.

WRT people wanting a more staged transition rather than a flag day: I
think I could tweaking things to rewrite each arch onto its own branch,
which could all be merged up into a single master branch. Then as $ARCH
moves over to using device.tree.git rather than linux.git as their
primary location for DTS we can simply drop the conversion for that
branch and start accepting patches onto master. I think doing anything
more fine-grained than per-arch would be tricky, at least to do
automagically.

Ian.



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

^ permalink raw reply

* Re: [PATCH v3 1/3] dma: Support multiple interleaved frames with non-contiguous memory
From: Srikanth Thokala @ 2014-02-20  9:24 UTC (permalink / raw)
  To: Jassi Brar
  Cc: Srikanth Thokala, Williams, Dan J, Koul, Vinod, Michal Simek,
	Grant Likely, Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Levente Kurusa, Lars-Peter Clausen, lkml,
	dmaengine-u79uwXL29TY76Z2rM5mHXA, Andy Shevchenko,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <CAJe_ZhfedP7Paf3Zq9chL0WUeLJrsy_DJL05sSbfqnfTtji=HQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, Feb 19, 2014 at 12:33 AM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 18 February 2014 23:16, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>> On Tue, Feb 18, 2014 at 10:20 PM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>> On 18 February 2014 16:58, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>>>> On Mon, Feb 17, 2014 at 3:27 PM, Jassi Brar <jaswinder.singh-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>>>> On 15 February 2014 17:30, Srikanth Thokala <sthokal-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>>>>>> The current implementation of interleaved DMA API support multiple
>>>>>> frames only when the memory is contiguous by incrementing src_start/
>>>>>> dst_start members of interleaved template.
>>>>>>
>>>>>> But, when the memory is non-contiguous it will restrict slave device
>>>>>> to not submit multiple frames in a batch.  This patch handles this
>>>>>> issue by allowing the slave device to send array of interleaved dma
>>>>>> templates each having a different memory location.
>>>>>>
>>>>> How fragmented could be memory in your case? Is it inefficient to
>>>>> submit separate transfers for each segment/frame?
>>>>> It will help if you could give a typical example (chunk size and gap
>>>>> in bytes) of what you worry about.
>>>>
>>>> With scatter-gather engine feature in the hardware, submitting separate
>>>> transfers for each frame look inefficient. As an example, our DMA engine
>>>> supports up to 16 video frames, with each frame (a typical video frame
>>>> size) being contiguous in memory but frames are scattered into different
>>>> locations. We could not definitely submit frame by frame as it would be
>>>> software overhead (HW interrupting for each frame) resulting in video lags.
>>>>
>>> IIUIC, it is 30fps and one dma interrupt per frame ... it doesn't seem
>>> inefficient at all. Even poor-latency audio would generate a higher
>>> interrupt-rate. So the "inefficiency concern" doesn't seem valid to
>>> me.
>>>
>>> Not to mean we shouldn't strive to reduce the interrupt-rate further.
>>> Another option is to emulate the ring-buffer scheme of ALSA.... which
>>> should be possible since for a session of video playback the frame
>>> buffers' locations wouldn't change.
>>>
>>> Yet another option is to use the full potential of the
>>> interleaved-xfer api as such. It seems you confuse a 'video frame'
>>> with the interleaved-xfer api's 'frame'. They are different.
>>>
>>> Assuming your one video frame is F bytes long and Gk is the gap in
>>> bytes between end of frame [k] and start of frame [k+1] and  Gi != Gj
>>> for i!=j
>>> In the context of interleaved-xfer api, you have just 1 Frame of 16
>>> chunks. Each chunk is Fbytes and the inter-chunk-gap(ICG) is Gk  where
>>> 0<=k<15
>>> So for your use-case .....
>>>   dma_interleaved_template.numf = 1   /* just 1 frame */
>>>   dma_interleaved_template.frame_size = 16  /* containing 16 chunks */
>>>    ...... //other parameters
>>>
>>> You have 3 options to choose from and all should work just as fine.
>>> Otherwise please state your problem in real numbers (video-frames'
>>> size, count & gap in bytes).
>>
>> Initially I interpreted interleaved template the same.  But, Lars corrected me
>> in the subsequent discussion and let me put it here briefly,
>>
>> In the interleaved template, each frame represents a line of size denoted by
>> chunk.size and the stride by icg.  'numf' represent number of frames i.e.
>> number of lines.
>>
>> In video frame context,
>> chunk.size -> hsize
>> chunk.icg -> stride
>> numf -> vsize
>> and frame_size is always 1 as it will have only one chunk in a line.
>>
> But you said in your last post
>   "with each frame (a typical video frame size) being contiguous in memory"
>  ... which is not true from what you write above. Anyways, my first 2
> suggestions still hold.

Yes, each video frame is contiguous and they can be scattered.

>
>> So, the API would not allow to pass multiple frames and we came up with a
>> resolution to pass an array of interleaved template structs to handle this.
>>
> Yeah the API doesn't allow such xfers that don't fall into any
> 'regular expression' of a transfer and also because no controller
> natively supports such xfers -- your controller will break your
> request up into 16 transfers and program them individually, right?

No, it will not program individually.  It has a scatter-gather engine where we
could update the current pointer to the first frame and tail pointer to the last
frame and hardware does the transfer and raise an interrupt when all the frames
are completed (ie. when current reaches tail).

>    BTW if you insist you could still express the 16 video frames as 1
> interleaved-xfer frame with frame_size = (vsize + 1) * 16   ;)
>
> Again, I would suggest you implement ring-buffer type scheme. Say
> prepare 16 interleaved xfer templates and queue them. Upon each
> xfer-done callback (i.e frame rendered), update the data and queue it
> back. It might be much simpler for your actual case. At 30fps, 33ms to
> queue a dma request should _not_ result in any frame-drop.

The driver has similar implementation, where each desc (handling 16 frames)
is pushed to pending queue and then to done queue.  Slave device still can
add desc's to the pending queue and whenever the transfer of 16 frames is
completed we move each desc to done list.

Srikanth

>
> -Jassi
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
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 v7 0/4] DT support for kirkwood based Synology NAS boxes
From: Andrew Lunn @ 2014-02-20  9:18 UTC (permalink / raw)
  To: klightspeed-aslSrjg9ejhWX4hkXwHRhw
  Cc: Andrew Lunn, Jason Cooper, Ian Campbell,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
	Mark Rutland, Kumar Gala
In-Reply-To: <1392840157-31072-1-git-send-email-klightspeed-aslSrjg9ejhWX4hkXwHRhw@public.gmane.org>

On Thu, Feb 20, 2014 at 06:02:33AM +1000, klightspeed-aslSrjg9ejhWX4hkXwHRhw@public.gmane.org wrote:
> This patchset adds support for around 30 kirkwood bases Synology NAS
> boxes. Patch #1 documents vendor prefixes. Patch #2 generalizes the qnap
> power off driver so that it can also be used for Synology devices.
> Patch #3 adds sii,s35390a to i2c trivial devices. Patch #4 adds the 
> synology DT files.

Hi Ben

Thanks for finishing this.

Whole series:

Acked-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>

	  Andrew
--
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 v7 4/4] ARM: Kirkwood: Add support for many Synology NAS devices
From: Andrew Lunn @ 2014-02-20  9:11 UTC (permalink / raw)
  To: klightspeed
  Cc: Mark Rutland, Andrew Lunn, Jason Cooper, Pawel Moll, devicetree,
	Ian Campbell, Rob Herring, Kumar Gala, linux-arm-kernel
In-Reply-To: <1392840157-31072-5-git-send-email-klightspeed@killerwolves.net>

On Thu, Feb 20, 2014 at 06:02:37AM +1000, klightspeed@killerwolves.net wrote:
> From: "Ben Peddell" <klightspeed@killerwolves.net>
> 
> Add device tree fragments and files to support many of the kirkwood
> based Synology NAS devices. This is a modification of
> Andrew Lunn's <andrew@lunn.ch> translation of the board setup file
> maintained by Ben Peddell <klightspeed@killerwolves.net>
> 
> The Ricoh RS5C372 RTC was used in all 2009 units and some 2010 units.
> All other Synology Kirkwood-based DiskStations and RackStations use
> the Seiko S35390A RTC.
> 
> Most of the 1-bay and 2-bay units use the GPIOs that are multiplexed
> with the built-in SATA interface activity/presence pins on mpp 20-23,
> while the 4-bay units use ge01 and a PCIe SATA controller, and put the
> software controlled HDD leds on mpp 36-43.
> 
> Most of the 6281 units with HDD power controls use mpp 29 and 31, while
> most of the 6282 units with HDD power controls use mpp 30, 34, 44 and 45
> and provide a model ID on mpp 28, 29, 46 and 47.  Pre-2012 units and
> most 4-bay units didn't have a separate power control for HDD1.  These
> power controls are presumably to limit startup current from the 12V
> brick power supply.
> 
> Instead of using separate dtsi files in a synology directory, this
> patch uses a single dtsi file containing all of the modules for
> these boards, with all of the modules not common to all boards
> disabled.  The board dts files then enable the appropriate modules for
> their boards.
> 
> Signed-off-by: Ben Peddell <klightspeed@killerwolves.net>
> Tested-by: Ben Peddell <klightspeed@killerwolves.net> (ds211j)

Since it is based on my code:

Signed-off-by: Andrew Lunn <andrew@lunn.ch>

       Andrew

> ---
> v2:
> Fix gpio's which should be gpo.
> Rebase onto v3-14-rc1
> Update RTC nodes with vendor name.
> Update SPI flash node with vendor name.
> Add a description of the lego
> Use ricoy, i.e. the stock ticker
> 
> v3:
> Merge Synology dtsi files into single dtsi file
> 
> v4:
> Various minor fixes to synology dtsi file
> 
> v7:
> Revert ricoh vendor prefix change from v2
> ---
>  arch/arm/boot/dts/Makefile               |  15 +
>  arch/arm/boot/dts/kirkwood-ds109.dts     |  41 ++
>  arch/arm/boot/dts/kirkwood-ds110jv10.dts |  41 ++
>  arch/arm/boot/dts/kirkwood-ds111.dts     |  44 ++
>  arch/arm/boot/dts/kirkwood-ds112.dts     |  48 ++
>  arch/arm/boot/dts/kirkwood-ds209.dts     |  44 ++
>  arch/arm/boot/dts/kirkwood-ds210.dts     |  46 ++
>  arch/arm/boot/dts/kirkwood-ds212.dts     |  47 ++
>  arch/arm/boot/dts/kirkwood-ds212j.dts    |  41 ++
>  arch/arm/boot/dts/kirkwood-ds409.dts     |  48 ++
>  arch/arm/boot/dts/kirkwood-ds409slim.dts |  40 ++
>  arch/arm/boot/dts/kirkwood-ds411.dts     |  52 ++
>  arch/arm/boot/dts/kirkwood-ds411j.dts    |  48 ++
>  arch/arm/boot/dts/kirkwood-ds411slim.dts |  48 ++
>  arch/arm/boot/dts/kirkwood-rs212.dts     |  48 ++
>  arch/arm/boot/dts/kirkwood-rs409.dts     |  44 ++
>  arch/arm/boot/dts/kirkwood-rs411.dts     |  44 ++
>  arch/arm/boot/dts/kirkwood-synology.dtsi | 871 +++++++++++++++++++++++++++++++
>  18 files changed, 1610 insertions(+)
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds109.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds110jv10.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds111.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds112.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds209.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds210.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds212.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds212j.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds409.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds409slim.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds411.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds411j.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-ds411slim.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-rs212.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-rs409.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-rs411.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-synology.dtsi
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index 6d1e43d..e286abc 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -90,6 +90,18 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
>  	kirkwood-dns325.dtb \
>  	kirkwood-dockstar.dtb \
>  	kirkwood-dreamplug.dtb \
> +	kirkwood-ds109.dtb \
> +	kirkwood-ds110jv10.dtb \
> +	kirkwood-ds111.dtb \
> +	kirkwood-ds209.dtb \
> +	kirkwood-ds210.dtb \
> +	kirkwood-ds212.dtb \
> +	kirkwood-ds212j.dtb \
> +	kirkwood-ds409.dtb \
> +	kirkwood-ds409slim.dtb \
> +	kirkwood-ds411.dtb \
> +	kirkwood-ds411j.dtb \
> +	kirkwood-ds411slim.dtb \
>  	kirkwood-goflexnet.dtb \
>  	kirkwood-guruplug-server-plus.dtb \
>  	kirkwood-ib62x0.dtb \
> @@ -112,6 +124,9 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-cloudbox.dtb \
>  	kirkwood-nsa310a.dtb \
>  	kirkwood-openblocks_a6.dtb \
>  	kirkwood-openblocks_a7.dtb \
> +	kirkwood-rs212.dtb \
> +	kirkwood-rs409.dtb \
> +	kirkwood-rs411.dtb \
>  	kirkwood-sheevaplug.dtb \
>  	kirkwood-sheevaplug-esata.dtb \
>  	kirkwood-topkick.dtb \
> diff --git a/arch/arm/boot/dts/kirkwood-ds109.dts b/arch/arm/boot/dts/kirkwood-ds109.dts
> new file mode 100644
> index 0000000..772092c
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds109.dts
> @@ -0,0 +1,41 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS109, DS110, DS110jv20";
> +	compatible = "synology,ds109", "synology,ds110jv20",
> +		     "synology,ds110", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-1 {
> +		status = "okay";
> +	};
> +};
> +
> +&rs5c372 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds110jv10.dts b/arch/arm/boot/dts/kirkwood-ds110jv10.dts
> new file mode 100644
> index 0000000..aabafbe
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds110jv10.dts
> @@ -0,0 +1,41 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS110j v10 and v30";
> +	compatible = "synology,ds110jv10", "synology,ds110jv30",
> +		     "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-1 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds111.dts b/arch/arm/boot/dts/kirkwood-ds111.dts
> new file mode 100644
> index 0000000..16ec7fb
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds111.dts
> @@ -0,0 +1,44 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS111";
> +	compatible = "synology,ds111", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-1 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds112.dts b/arch/arm/boot/dts/kirkwood-ds112.dts
> new file mode 100644
> index 0000000..cff1b23
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds112.dts
> @@ -0,0 +1,48 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS111";
> +	compatible = "synology,ds111", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-21-2 {
> +		status = "okay";
> +	};
> +
> +	regulators-hdd-30 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds209.dts b/arch/arm/boot/dts/kirkwood-ds209.dts
> new file mode 100644
> index 0000000..3304119
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds209.dts
> @@ -0,0 +1,44 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS209";
> +	compatible = "synology,ds209", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-2 {
> +		status = "okay";
> +	};
> +
> +	regulators-hdd-31 {
> +		status = "okay";
> +	};
> +};
> +
> +&rs5c372 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds210.dts b/arch/arm/boot/dts/kirkwood-ds210.dts
> new file mode 100644
> index 0000000..6052eaa
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds210.dts
> @@ -0,0 +1,46 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS210 v10, v20, v30, DS211j";
> +	compatible = "synology,ds210jv10", "synology,ds210jv20",
> +		     "synology,ds210jv30", "synology,ds211j",
> +		     "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-2 {
> +		status = "okay";
> +	};
> +
> +	regulators-hdd-31 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds212.dts b/arch/arm/boot/dts/kirkwood-ds212.dts
> new file mode 100644
> index 0000000..7f76cd3
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds212.dts
> @@ -0,0 +1,47 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS212, DS212p v10, v20, DS213air v10, DS213 v10";
> +	compatible = "synology,ds212", "synology,ds212pv10",
> +		     "synology,ds212pv10", "synology,ds212pv20",
> +		     "synology,ds213airv10", "synology,ds213v10",
> +		     "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-2 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds212j.dts b/arch/arm/boot/dts/kirkwood-ds212j.dts
> new file mode 100644
> index 0000000..1f83a00
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds212j.dts
> @@ -0,0 +1,41 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS212j v10, v20";
> +	compatible = "synology,ds212jv10", "synology,ds212jv20",
> +		     "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-21-2 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds409.dts b/arch/arm/boot/dts/kirkwood-ds409.dts
> new file mode 100644
> index 0000000..0a573ad
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds409.dts
> @@ -0,0 +1,48 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS409, DS410j";
> +	compatible = "synology,ds409", "synology,ds410j", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-15-18 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-alarm-12 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&rs5c372 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds409slim.dts b/arch/arm/boot/dts/kirkwood-ds409slim.dts
> new file mode 100644
> index 0000000..1848a62
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds409slim.dts
> @@ -0,0 +1,40 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology 409slim";
> +	compatible = "synology,ds409slim", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-20 {
> +		status = "okay";
> +	};
> +};
> +
> +&rs5c372 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds411.dts b/arch/arm/boot/dts/kirkwood-ds411.dts
> new file mode 100644
> index 0000000..a1737b4
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds411.dts
> @@ -0,0 +1,52 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS411, DS413jv10";
> +	compatible = "synology,ds411", "synology,ds413jv10", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +
> +	regulators-hdd-34 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds411j.dts b/arch/arm/boot/dts/kirkwood-ds411j.dts
> new file mode 100644
> index 0000000..0cde914
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds411j.dts
> @@ -0,0 +1,48 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS411j";
> +	compatible = "synology,ds411j", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-15-18 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-alarm-12 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-ds411slim.dts b/arch/arm/boot/dts/kirkwood-ds411slim.dts
> new file mode 100644
> index 0000000..aef0cad
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-ds411slim.dts
> @@ -0,0 +1,48 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology DS411slim";
> +	compatible = "synology,ds411slim", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-rs212.dts b/arch/arm/boot/dts/kirkwood-rs212.dts
> new file mode 100644
> index 0000000..93ec3d0
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-rs212.dts
> @@ -0,0 +1,48 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology RS212";
> +	compatible = "synology,rs212", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-3 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-38 {
> +		status = "okay";
> +	};
> +
> +	regulators-hdd-30-2 {
> +		status = "okay";
> +	};
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> +
> +&pcie2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-rs409.dts b/arch/arm/boot/dts/kirkwood-rs409.dts
> new file mode 100644
> index 0000000..311df4e
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-rs409.dts
> @@ -0,0 +1,44 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6281.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology RS409";
> +	compatible = "synology,rs409", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-150-15-18 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&rs5c372 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-rs411.dts b/arch/arm/boot/dts/kirkwood-rs411.dts
> new file mode 100644
> index 0000000..f90da85
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-rs411.dts
> @@ -0,0 +1,44 @@
> +/*
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/dts-v1/;
> +
> +#include "kirkwood.dtsi"
> +#include "kirkwood-6282.dtsi"
> +#include "kirkwood-synology.dtsi"
> +
> +/ {
> +	model = "Synology RS411 RS812";
> +	compatible = "synology,rs411", "synology,rs812", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8";
> +	};
> +
> +	gpio-fan-100-15-35-3 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "okay";
> +	};
> +};
> +
> +&eth1 {
> +	status = "okay";
> +};
> +
> +&s35390a {
> +	status = "okay";
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-synology.dtsi b/arch/arm/boot/dts/kirkwood-synology.dtsi
> new file mode 100644
> index 0000000..92b3177
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-synology.dtsi
> @@ -0,0 +1,871 @@
> +/*
> + * Nodes for Marvell 628x Synology devices
> + *
> + * Andrew Lunn <andrew@lunn.ch>
> + * Ben Peddell <klightspeed@killerwolves.net>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +/ {
> +	mbus {
> +		pcie-controller {
> +			status = "okay";
> +
> +			pcie@1,0 {
> +				status = "okay";
> +			};
> +
> +			pcie2: pcie@2,0 {
> +				status = "disabled";
> +			};
> +		};
> +	};
> +
> +	ocp@f1000000 {
> +		pinctrl: pinctrl@10000 {
> +			pmx_alarmled_12: pmx-alarmled-12 {
> +				marvell,pins = "mpp12";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanctrl_15: pmx-fanctrl-15 {
> +				marvell,pins = "mpp15";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanctrl_16: pmx-fanctrl-16 {
> +				marvell,pins = "mpp16";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanctrl_17: pmx-fanctrl-17 {
> +				marvell,pins = "mpp17";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanalarm_18: pmx-fanalarm-18 {
> +				marvell,pins = "mpp18";
> +				marvell,function = "gpo";
> +			};
> +
> +			pmx_hddled_20: pmx-hddled-20 {
> +				marvell,pins = "mpp20";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_21: pmx-hddled-21 {
> +				marvell,pins = "mpp21";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_22: pmx-hddled-22 {
> +				marvell,pins = "mpp22";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_23: pmx-hddled-23 {
> +				marvell,pins = "mpp23";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_24: pmx-hddled-24 {
> +				marvell,pins = "mpp24";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_25: pmx-hddled-25 {
> +				marvell,pins = "mpp25";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_26: pmx-hddled-26 {
> +				marvell,pins = "mpp26";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_27: pmx-hddled-27 {
> +				marvell,pins = "mpp27";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_28: pmx-hddled-28 {
> +				marvell,pins = "mpp28";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd1_pwr_29: pmx-hdd1-pwr-29 {
> +				marvell,pins = "mpp29";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd1_pwr_30: pmx-hdd-pwr-30 {
> +				marvell,pins = "mpp30";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd2_pwr_31: pmx-hdd2-pwr-31 {
> +				marvell,pins = "mpp31";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanctrl_32: pmx-fanctrl-32 {
> +				marvell,pins = "mpp32";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanctrl_33: pmx-fanctrl-33 {
> +				marvell,pins = "mpp33";
> +				marvell,function = "gpo";
> +			};
> +
> +			pmx_fanctrl_34: pmx-fanctrl-34 {
> +				marvell,pins = "mpp34";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd2_pwr_34: pmx-hdd2-pwr-34 {
> +				marvell,pins = "mpp34";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanalarm_35: pmx-fanalarm-35 {
> +				marvell,pins = "mpp35";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_36: pmx-hddled-36 {
> +				marvell,pins = "mpp36";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_37: pmx-hddled-37 {
> +				marvell,pins = "mpp37";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_38: pmx-hddled-38 {
> +				marvell,pins = "mpp38";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_39: pmx-hddled-39 {
> +				marvell,pins = "mpp39";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_40: pmx-hddled-40 {
> +				marvell,pins = "mpp40";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_41: pmx-hddled-41 {
> +				marvell,pins = "mpp41";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_42: pmx-hddled-42 {
> +				marvell,pins = "mpp42";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_43: pmx-hddled-43 {
> +				marvell,pins = "mpp43";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_44: pmx-hddled-44 {
> +				marvell,pins = "mpp44";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hddled_45: pmx-hddled-45 {
> +				marvell,pins = "mpp45";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd3_pwr_44: pmx-hdd3-pwr-44 {
> +				marvell,pins = "mpp44";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_hdd4_pwr_45: pmx-hdd4-pwr-45 {
> +				marvell,pins = "mpp45";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanalarm_44: pmx-fanalarm-44 {
> +				marvell,pins = "mpp44";
> +				marvell,function = "gpio";
> +			};
> +
> +			pmx_fanalarm_45: pmx-fanalarm-45 {
> +				marvell,pins = "mpp45";
> +				marvell,function = "gpio";
> +			};
> +		};
> +
> +		rtc@10300 {
> +			status = "disabled";
> +		};
> +
> +		spi@10600 {
> +			status = "okay";
> +			pinctrl-0 = <&pmx_spi>;
> +			pinctrl-names = "default";
> +
> +			m25p80@0 {
> +				#address-cells = <1>;
> +				#size-cells = <1>;
> +				compatible = "st,m25p80";
> +				reg = <0>;
> +				spi-max-frequency = <20000000>;
> +				mode = <0>;
> +
> +				partition@00000000 {
> +					reg = <0x00000000 0x00080000>;
> +					label = "RedBoot";
> +				};
> +
> +				partition@00080000 {
> +					reg = <0x00080000 0x00200000>;
> +					label = "zImage";
> +				};
> +
> +				partition@00280000 {
> +					reg = <0x00280000 0x00140000>;
> +					label = "rd.gz";
> +				};
> +
> +				partition@003c0000 {
> +					reg = <0x003c0000 0x00010000>;
> +					label = "vendor";
> +				};
> +
> +				partition@003d0000 {
> +					reg = <0x003d0000 0x00020000>;
> +					label = "RedBoot config";
> +				};
> +
> +				partition@003f0000 {
> +					reg = <0x003f0000 0x00010000>;
> +					label = "FIS directory";
> +				};
> +			};
> +		};
> +
> +		i2c@11000 {
> +			status = "okay";
> +			clock-frequency = <400000>;
> +			pinctrl-0 = <&pmx_twsi0>;
> +			pinctrl-names = "default";
> +
> +			rs5c372: rs5c372@32 {
> +				status = "disabled";
> +				compatible = "ricoh,rs5c372";
> +				reg = <0x32>;
> +			};
> +
> +			s35390a: s35390a@30 {
> +				status = "disabled";
> +				compatible = "ssi,s35390a";
> +				reg = <0x30>;
> +			};
> +		};
> +
> +		serial@12000 {
> +			status = "okay";
> +			pinctrl-0 = <&pmx_uart0>;
> +			pinctrl-names = "default";
> +		};
> +
> +		serial@12100 {
> +			status = "okay";
> +			pinctrl-0 = <&pmx_uart1>;
> +			pinctrl-names = "default";
> +		};
> +
> +		poweroff@12100 {
> +			compatible = "synology,power-off";
> +			reg = <0x12100 0x100>;
> +			clocks = <&gate_clk 7>;
> +		};
> +
> +		sata@80000 {
> +			pinctrl-0 = <&pmx_sata0 &pmx_sata1>;
> +			pinctrl-names = "default";
> +			status = "okay";
> +			nr-ports = <2>;
> +		};
> +	};
> +
> +	gpio-fan-150-32-35 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_32 &pmx_fanctrl_33 &pmx_fanctrl_34
> +		             &pmx_fanalarm_35>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio1 0 GPIO_ACTIVE_HIGH
> +			 &gpio1 1 GPIO_ACTIVE_HIGH
> +			 &gpio1 2 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2200 1
> +				       2500 2
> +				       3000 4
> +				       3300 3
> +				       3700 5
> +				       3800 6
> +				       4200 7 >;
> +	};
> +
> +	gpio-fan-150-15-18 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
> +		             &pmx_fanalarm_18>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
> +			 &gpio0 16 GPIO_ACTIVE_HIGH
> +			 &gpio0 17 GPIO_ACTIVE_HIGH>;
> +		alarm-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2200 1
> +				       2500 2
> +				       3000 4
> +				       3300 3
> +				       3700 5
> +				       3800 6
> +				       4200 7 >;
> +	};
> +
> +	gpio-fan-100-32-35 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_32 &pmx_fanctrl_33 &pmx_fanctrl_34
> +		             &pmx_fanalarm_35>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio1 0 GPIO_ACTIVE_HIGH
> +			 &gpio1 1 GPIO_ACTIVE_HIGH
> +			 &gpio1 2 GPIO_ACTIVE_HIGH>;
> +		alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2500 1
> +				       3100 2
> +				       3800 3
> +				       4600 4
> +				       4800 5
> +				       4900 6
> +				       5000 7 >;
> +	};
> +
> +	gpio-fan-100-15-18 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
> +		             &pmx_fanalarm_18>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
> +			 &gpio0 16 GPIO_ACTIVE_HIGH
> +			 &gpio0 17 GPIO_ACTIVE_HIGH>;
> +		alarm-gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2500 1
> +				       3100 2
> +				       3800 3
> +				       4600 4
> +				       4800 5
> +				       4900 6
> +				       5000 7 >;
> +	};
> +
> +	gpio-fan-100-15-35-1 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
> +		             &pmx_fanalarm_35>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
> +			 &gpio0 16 GPIO_ACTIVE_HIGH
> +			 &gpio0 17 GPIO_ACTIVE_HIGH>;
> +		alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2500 1
> +				       3100 2
> +				       3800 3
> +				       4600 4
> +				       4800 5
> +				       4900 6
> +				       5000 7 >;
> +	};
> +
> +	gpio-fan-100-15-35-3 {
> +		status = "disabled";
> +		compatible = "gpio-fan";
> +		pinctrl-0 = <&pmx_fanctrl_15 &pmx_fanctrl_16 &pmx_fanctrl_17
> +		             &pmx_fanalarm_35 &pmx_fanalarm_44 &pmx_fanalarm_45>;
> +		pinctrl-names = "default";
> +		gpios = <&gpio0 15 GPIO_ACTIVE_HIGH
> +			 &gpio0 16 GPIO_ACTIVE_HIGH
> +			 &gpio0 17 GPIO_ACTIVE_HIGH>;
> +		alarm-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH
> +			       &gpio1 12 GPIO_ACTIVE_HIGH
> +			       &gpio1 13 GPIO_ACTIVE_HIGH>;
> +		gpio-fan,speed-map = <    0 0
> +				       2500 1
> +				       3100 2
> +				       3800 3
> +				       4600 4
> +				       4800 5
> +				       4900 6
> +				       5000 7 >;
> +	};
> +
> +	gpio-leds-alarm-12 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_alarmled_12>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:alarm";
> +			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-leds-hdd-20 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_hddled_20 &pmx_hddled_21 &pmx_hddled_22
> +			     &pmx_hddled_23 &pmx_hddled_24 &pmx_hddled_25
> +			     &pmx_hddled_26 &pmx_hddled_27>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:green:hdd1";
> +			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd1-amber {
> +			label = "synology:amber:hdd1";
> +			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-green {
> +			label = "synology:green:hdd2";
> +			gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-amber {
> +			label = "synology:amber:hdd2";
> +			gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd3-green {
> +			label = "synology:green:hdd3";
> +			gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd3-amber {
> +			label = "synology:amber:hdd3";
> +			gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd4-green {
> +			label = "synology:green:hdd4";
> +			gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd4-amber {
> +			label = "synology:amber:hdd4";
> +			gpios = <&gpio0 27 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-leds-hdd-21-1 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_hddled_21 &pmx_hddled_23>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:green:hdd1";
> +			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd1-amber {
> +			label = "synology:amber:hdd1";
> +			gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-leds-hdd-21-2 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_hddled_21 &pmx_hddled_23 &pmx_hddled_20 &pmx_hddled_22>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:green:hdd1";
> +			gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd1-amber {
> +			label = "synology:amber:hdd1";
> +			gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-green {
> +			label = "synology:green:hdd2";
> +			gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-amber {
> +			label = "synology:amber:hdd2";
> +			gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-leds-hdd-36 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_hddled_36 &pmx_hddled_37 &pmx_hddled_38
> +			     &pmx_hddled_39 &pmx_hddled_40 &pmx_hddled_41
> +			     &pmx_hddled_42 &pmx_hddled_43 &pmx_hddled_44
> +			     &pmx_hddled_45>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:green:hdd1";
> +			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd1-amber {
> +			label = "synology:amber:hdd1";
> +			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-green {
> +			label = "synology:green:hdd2";
> +			gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-amber {
> +			label = "synology:amber:hdd2";
> +			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd3-green {
> +			label = "synology:green:hdd3";
> +			gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd3-amber {
> +			label = "synology:amber:hdd3";
> +			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd4-green {
> +			label = "synology:green:hdd4";
> +			gpios = <&gpio1 10 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd4-amber {
> +			label = "synology:amber:hdd4";
> +			gpios = <&gpio1 11 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd5-green {
> +			label = "synology:green:hdd5";
> +			gpios = <&gpio1 12 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd5-amber {
> +			label = "synology:amber:hdd5";
> +			gpios = <&gpio1 13 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-leds-hdd-38 {
> +		status = "disabled";
> +		compatible = "gpio-leds";
> +		pinctrl-0 = <&pmx_hddled_38 &pmx_hddled_39 &pmx_hddled_36 &pmx_hddled_37>;
> +		pinctrl-names = "default";
> +
> +		hdd1-green {
> +			label = "synology:green:hdd1";
> +			gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd1-amber {
> +			label = "synology:amber:hdd1";
> +			gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-green {
> +			label = "synology:green:hdd2";
> +			gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		hdd2-amber {
> +			label = "synology:amber:hdd2";
> +			gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	regulators-hdd-29 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd1_pwr_29 &pmx_hdd2_pwr_31>;
> +		pinctrl-names = "default";
> +
> +		regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "hdd1power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 29 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@2 {
> +			compatible = "regulator-fixed";
> +			reg = <2>;
> +			regulator-name = "hdd2power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	regulators-hdd-30-1 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd1_pwr_30>;
> +		pinctrl-names = "default";
> +
> +		regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "hdd1power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	regulators-hdd-30-2 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd1_pwr_30 &pmx_hdd2_pwr_34>;
> +		pinctrl-names = "default";
> +
> +		regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "hdd1power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@2 {
> +			compatible = "regulator-fixed";
> +			reg = <2>;
> +			regulator-name = "hdd2power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	regulators-hdd-30-4 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd1_pwr_30 &pmx_hdd2_pwr_34
> +			     &pmx_hdd3_pwr_44 &pmx_hdd4_pwr_45>;
> +		pinctrl-names = "default";
> +
> +		regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "hdd1power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@2 {
> +			compatible = "regulator-fixed";
> +			reg = <2>;
> +			regulator-name = "hdd2power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@3 {
> +			compatible = "regulator-fixed";
> +			reg = <3>;
> +			regulator-name = "hdd3power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@4 {
> +			compatible = "regulator-fixed";
> +			reg = <4>;
> +			regulator-name = "hdd4power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	regulators-hdd-31 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd2_pwr_31>;
> +		pinctrl-names = "default";
> +
> +		regulator@1 {
> +			compatible = "regulator-fixed";
> +			reg = <1>;
> +			regulator-name = "hdd2power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio0 31 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +
> +	regulators-hdd-34 {
> +		status = "disabled";
> +		compatible = "simple-bus";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		pinctrl-0 = <&pmx_hdd2_pwr_34 &pmx_hdd3_pwr_44
> +			     &pmx_hdd4_pwr_45>;
> +		pinctrl-names = "default";
> +
> +		regulator@2 {
> +			compatible = "regulator-fixed";
> +			reg = <2>;
> +			regulator-name = "hdd2power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@3 {
> +			compatible = "regulator-fixed";
> +			reg = <3>;
> +			regulator-name = "hdd3power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 12 GPIO_ACTIVE_HIGH>;
> +		};
> +
> +		regulator@4 {
> +			compatible = "regulator-fixed";
> +			reg = <4>;
> +			regulator-name = "hdd4power";
> +			regulator-min-microvolt = <5000000>;
> +			regulator-max-microvolt = <5000000>;
> +			enable-active-high;
> +			regulator-always-on;
> +			regulator-boot-on;
> +			startup-delay-us = <5000000>;
> +			gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +&mdio {
> +	status = "okay";
> +
> +	ethphy0: ethernet-phy@0 {
> +		device_type = "ethernet-phy";
> +		reg = <8>;
> +	};
> +
> +	ethphy1: ethernet-phy@1 {
> +		device_type = "ethernet-phy";
> +		reg = <9>;
> +	};
> +};
> +
> +&eth0 {
> +	status = "okay";
> +
> +	ethernet0-port@0 {
> +		phy-handle = <&ethphy0>;
> +	};
> +};
> +
> +&eth1 {
> +	status = "disabled";
> +
> +	ethernet1-port@0 {
> +		phy-handle = <&ethphy1>;
> +	};
> +};
> -- 
> 1.8.3.2
> 

^ permalink raw reply

* Re: [PATCH v4 0/4] Bugfix for of_match_node ordering
From: Sachin Kamat @ 2014-02-20  8:39 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, LKML,
	Kevin Hao, Rob Herring, Sebastian Hesselbarth, linux-samsung-soc
In-Reply-To: <1392819290-1044-1-git-send-email-grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Hi Grant,

I observe the following boot failure with today's (next-20140220) linux-next
tree on Exynos based boards with the default exynos_defconfig.

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0x900
[    0.000000] Linux version 3.14.0-rc3-next-20140220 (sachin@linaro)
(gcc version 4.8.2 20130805 (prerelease) (crosstool-NG linaro-1.
13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #1132 SMP PREEMPT Thu Feb 20
13:49:27 IST 2014
[    0.000000] CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
instruction cache
[    0.000000] Machine model: Insignal Origen evaluation board based
on Exynos4210
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] CPU EXYNOS4210 (id 0x43210011)
[    0.000000] On node 0 totalpages: 258048
[    0.000000]   Normal zone: 1520 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 190464 pages, LIFO batch:31
[    0.000000]   HighMem zone: 528 pages used for memmap
[    0.000000]   HighMem zone: 67584 pages, LIFO batch:15
[    0.000000] BUG: spinlock recursion on CPU#0, swapper/0
[    0.000000]  lock: devtree_lock+0x0/0x10, .magic: dead4ead, .owner:
swapper/0, .owner_cpu: 0
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted
3.14.0-rc3-next-20140220 #1132
[    0.000000] [<c0013e9c>] (unwind_backtrace) from [<c0011250>]
(show_stack+0x10/0x14)
[    0.000000] [<c0011250>] (show_stack) from [<c0386740>]
(dump_stack+0x7c/0xbc)
[    0.000000] [<c0386740>] (dump_stack) from [<c005501c>]
(do_raw_spin_lock+0x188/0x18c)
[    0.000000] [<c005501c>] (do_raw_spin_lock) from [<c038b614>]
(_raw_spin_lock_irqsave+0x20/0x28)
[    0.000000] [<c038b614>] (_raw_spin_lock_irqsave) from [<c02de37c>]
(of_find_property+0x20/0x4c)
[    0.000000] [<c02de37c>] (of_find_property) from [<c02df110>]
(__of_device_is_compatible+0xb4/0x110)
[    0.000000] [<c02df110>] (__of_device_is_compatible) from
[<c02df22c>] (of_find_compatible_node+0x4c/0x7c)
[    0.000000] [<c02df22c>] (of_find_compatible_node) from
[<c04cedf4>] (exynos_firmware_init+0x18/0x7c)
[    0.000000] [<c04cedf4>] (exynos_firmware_init) from [<c04caef0>]
(setup_arch+0x860/0x898)
[    0.000000] [<c04caef0>] (setup_arch) from [<c04c7820>]
(start_kernel+0x80/0x3dc)
[    0.000000] [<c04c7820>] (start_kernel) from [<40008074>] (0x40008074)
[    0.000000] BUG: spinlock lockup suspected on CPU#0, swapper/0
[    0.000000]  lock: devtree_lock+0x0/0x10, .magic: dead4ead, .owner:
swapper/0, .owner_cpu: 0
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted
3.14.0-rc3-next-20140220 #1132
[    0.000000] [<c0013e9c>] (unwind_backtrace) from [<c0011250>]
(show_stack+0x10/0x14)
[    0.000000] [<c0011250>] (show_stack) from [<c0386740>]
(dump_stack+0x7c/0xbc)
[    0.000000] [<c0386740>] (dump_stack) from [<c0054fac>]
(do_raw_spin_lock+0x118/0x18c)
[    0.000000] [<c0054fac>] (do_raw_spin_lock) from [<c038b614>]
(_raw_spin_lock_irqsave+0x20/0x28)
[    0.000000] [<c038b614>] (_raw_spin_lock_irqsave) from [<c02de37c>]
(of_find_property+0x20/0x4c)
[    0.000000] [<c02de37c>] (of_find_property) from [<c02df110>]
(__of_device_is_compatible+0xb4/0x110)
[    0.000000] [<c02df110>] (__of_device_is_compatible) from
[<c02df22c>] (of_find_compatible_node+0x4c/0x7c)
[    0.000000] [<c02df22c>] (of_find_compatible_node) from
[<c04cedf4>] (exynos_firmware_init+0x18/0x7c)
[    0.000000] [<c04cedf4>] (exynos_firmware_init) from [<c04caef0>]
(setup_arch+0x860/0x898)
[    0.000000] [<c04caef0>] (setup_arch) from [<c04c7820>]
(start_kernel+0x80/0x3dc)
[    0.000000] [<c04c7820>] (start_kernel) from [<40008074>] (0x40008074)

Regards,
Sachin



On 19 February 2014 19:44, Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> Hi all,
>
> I've taken Kevin's latest rework and done even more rework on it. :-) I
> didn't quite like how it was looking so I rolled his scoring code
> directly into __of_device_is_compatible() so that the function always
> returns a score in a way that is still compatible with the existing
> users (ie. non-zero == successful match). This eliminates the need for a
> separate pscore argument and it also let me roll the type and name
> checks into the same function. I'm a lot happier with it overall and it
> makes for a slightly smaller number of lines of code changed. Please
> take a look and give it a spin. This is basically a bug fix so I'll need
> to push it out to Linus in the near future.
>
> Acks and Tested-bys would be particularly appreciated.
>
> Thanks,
> g.
>
> Kevin Hao (2):
>         Revert "of: search the best compatible match first in __of_match_node()"
>         of: reimplement the matching method for __of_match_node()
>
> Grant Likely (2):
>         of: Move testcase FDT data into drivers/of
>         of: Add self test for of_match_node()
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
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: devicetree repository separation/migration
From: Grant Likely @ 2014-02-20  8:14 UTC (permalink / raw)
  To: Frank Rowand
  Cc: Sascha Hauer, Tim Bird, Olof Johansson, Jason Cooper, Rob Herring,
	Ian Campbell, Pawel Moll, Mark Rutland, Kumar Gala, Rob Landley,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-spec-u79uwXL29TY76Z2rM5mHXA,
	devicetree-compiler-u79uwXL29TY76Z2rM5mHXA, Ian Campbell
In-Reply-To: <53058B69.4040502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Thu, Feb 20, 2014 at 4:58 AM, Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On 2/19/2014 1:15 PM, Grant Likely wrote:
>> On Wed, Feb 19, 2014 at 8:16 PM, Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>> On 2/19/2014 1:08 AM, Sascha Hauer wrote:
>>>> On Tue, Feb 18, 2014 at 02:44:15PM -0800, Tim Bird wrote:
>>>>> I'm not in favor of separating the device tree information from the kernel.
>>>>>
>>>>> If we switch, then whatever synchronization issues other projects
>>>>> are having now with synching with the device tree info from the kernel will
>>>>> just then become the problem of the kernel developers, who will then
>>>>> have to sync with the device tree info from another repository.  If the
>>>>> sync issues can't be solved now for them, why or how would it be solved
>>>>> post-separation for us?  (It sounds like a zero-sum game of pain transfer
>>>>> to me.)
>>>>>
>>>>> I'm relatively unfamiliar with the arguments.  Can someone provide
>>>>> a brief list of reasons this is needed, and how the inconvenience to Linux
>>>>> kernel developers will be minimized, should it proceed?
>>>>
>>>
>>>
>>>> One of the reasons for doing devicetrees is to separate the hardware
>>>> description from the code so that:
>>>> - Other OSes (and bootloaders) can use the same description to start on
>>>>   a given hardware
>>>> - A generic Kernel can be started on any hardware
>>>> - A hardware describes itself, makes itself more introspecitve so we can
>>>>   go away from very specialized kernels
>>>
>>> Tim knows this ^^^^.  He was asking for the arguments for moving dts files
>>> out of the linux kernel source tree.
>>
>> We've made the decision that devicetree bindings need to be treated as
>> ABI, but as long as the .dts files live in the kernel there will
>> always be the temptation to just tweak things in lock-step and nobody
>> will notice. Splitting the files out gives that extra push to think
>> about whether changes to a binding will backwards compatible with a
>> tree that doesn't have those changes because the chances are a lot
>> higher that someone will hit that combination.
>>
>> The other argument is shared source between
>> BSD/U-Boot/Barebox/Linux/etc. Until we have a separate .dts repo there
>> is no good way to share the database of hardware descriptions.
>
> We could provide an easy export (see below).  What do you think?

Ian Campbell is already maintaining an export tree as a staging area
for an eventual split. He's had it up and running for almost a year
now:

http://xenbits.xen.org/gitweb/?p=people/ianc/device-tree-rebasing.git

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

^ permalink raw reply

* [PATCH V2] i2c: rcar: add compatible entry for r8a7791
From: Wolfram Sang @ 2014-02-20  8:03 UTC (permalink / raw)
  To: linux-i2c; +Cc: devicetree, linux-sh, Magnus Damm, Simon Horman, Wolfram Sang

From: Wolfram Sang <wsa@sang-engineering.com>

While we are here, also brush up the devicetree binding documentation.
The example was an inappropriate copy from the sh_mobile driver.

Signed-off-by: Wolfram Sang <wsa@sang-engineering.com>
---
 Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 14 ++++++++++----
 drivers/i2c/busses/i2c-rcar.c                      |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
index 897cfcd5..dd8b2dd 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
+++ b/Documentation/devicetree/bindings/i2c/i2c-rcar.txt
@@ -6,6 +6,7 @@ Required properties:
 	"renesas,i2c-r8a7778"
 	"renesas,i2c-r8a7779"
 	"renesas,i2c-r8a7790"
+	"renesas,i2c-r8a7791"
 - reg: physical base address of the controller and length of memory mapped
   region.
 - interrupts: interrupt specifier.
@@ -13,11 +14,16 @@ Required properties:
 Optional properties:
 - clock-frequency: desired I2C bus clock frequency in Hz. The absence of this
   propoerty indicates the default frequency 100 kHz.
+- clocks: clock specifier.
 
 Examples :
 
-i2c0: i2c@e6500000 {
-	compatible = "renesas,i2c-rcar-h2";
-	reg = <0 0xe6500000 0 0x428>;
-	interrupts = <0 174 0x4>;
+i2c0: i2c@e6508000 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	compatible = "renesas,i2c-r8a7791";
+	reg = <0 0xe6508000 0 0x40>;
+	interrupts = <0 287 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&mstp9_clks R8A7791_CLK_I2C0>;
+	clock-frequency = <400000>;
 };
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 0282d4d..cc60bc6 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -638,6 +638,7 @@ static const struct of_device_id rcar_i2c_dt_ids[] = {
 	{ .compatible = "renesas,i2c-r8a7778", .data = (void *)I2C_RCAR_GEN1 },
 	{ .compatible = "renesas,i2c-r8a7779", .data = (void *)I2C_RCAR_GEN1 },
 	{ .compatible = "renesas,i2c-r8a7790", .data = (void *)I2C_RCAR_GEN2 },
+	{ .compatible = "renesas,i2c-r8a7791", .data = (void *)I2C_RCAR_GEN2 },
 	{},
 };
 MODULE_DEVICE_TABLE(of, rcar_i2c_dt_ids);
-- 
1.8.5.1


^ permalink raw reply related

* [PATCH 1/1] ARM: EXYNOS: Map SYSRAM address through DT
From: Sachin Kamat @ 2014-02-20  6:05 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: linux-arm-kernel, devicetree, kgene.kim, t.figa, arnd,
	sachin.kamat

Instead of hardcoding the SYSRAM details for each SoC,
pass this information through device tree (DT) and make
the code SoC agnostic.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Based on top of my earlier patch
"ARM: EXYNOS: Consolidate CPU init code" at
http://comments.gmane.org/gmane.linux.kernel.samsung-soc/26560
---
 .../devicetree/bindings/arm/samsung-boards.txt     |   11 +++
 arch/arm/boot/dts/exynos4210-universal_c210.dts    |    5 +
 arch/arm/boot/dts/exynos4210.dtsi                  |   10 ++
 arch/arm/boot/dts/exynos4x12.dtsi                  |   10 ++
 arch/arm/boot/dts/exynos5.dtsi                     |    5 +
 arch/arm/boot/dts/exynos5250.dtsi                  |    5 +
 arch/arm/mach-exynos/common.c                      |  104 ++++++++------------
 arch/arm/mach-exynos/include/mach/map.h            |    7 --
 8 files changed, 86 insertions(+), 71 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/samsung-boards.txt b/Documentation/devicetree/bindings/arm/samsung-boards.txt
index 2168ed31e1b0..f79710eb7e79 100644
--- a/Documentation/devicetree/bindings/arm/samsung-boards.txt
+++ b/Documentation/devicetree/bindings/arm/samsung-boards.txt
@@ -7,6 +7,17 @@ Required root node properties:
         (a) "samsung,smdkv310" - for Samsung's SMDKV310 eval board.
         (b) "samsung,exynos4210"  - for boards based on Exynos4210 SoC.
 
+    - sysram node, specifying the type (secure or non-secure) of SYSRAM
+	- compatible: following types are supported
+		"samsung,exynos4210-sysram" : Secure SYSRAM
+		"samsung,exynos4210-sysram-ns" : Non-secure SYSRAM
+	- reg: address of SYSRAM bank
+
+	sysram@02020000 {
+		compatible = "samsung,exynos4210-sysram";
+		reg = <0x02020000 0x1000>;
+	};
+
 Optional:
     - firmware node, specifying presence and type of secure firmware:
         - compatible: only "samsung,secure-firmware" is currently supported
diff --git a/arch/arm/boot/dts/exynos4210-universal_c210.dts b/arch/arm/boot/dts/exynos4210-universal_c210.dts
index d2e3f5f5916d..3ca3fb6aa5f4 100644
--- a/arch/arm/boot/dts/exynos4210-universal_c210.dts
+++ b/arch/arm/boot/dts/exynos4210-universal_c210.dts
@@ -28,6 +28,11 @@
 		bootargs = "console=ttySAC2,115200N8 root=/dev/mmcblk0p5 rw rootwait earlyprintk panic=5 maxcpus=1";
 	};
 
+	sysram@02020000 {
+		compatible = "samsung,exynos4210-sysram";
+		reg = <0x02025000 0x1000>;
+	};
+
 	mct@10050000 {
 		compatible = "none";
 	};
diff --git a/arch/arm/boot/dts/exynos4210.dtsi b/arch/arm/boot/dts/exynos4210.dtsi
index 48ecd7a755ab..7f02c029ba68 100644
--- a/arch/arm/boot/dts/exynos4210.dtsi
+++ b/arch/arm/boot/dts/exynos4210.dtsi
@@ -31,6 +31,16 @@
 		pinctrl2 = &pinctrl_2;
 	};
 
+	sysram@02020000 {
+		compatible = "samsung,exynos4210-sysram";
+		reg = <0x02020000 0x1000>;
+	};
+
+	sysram-ns@0203F000 {
+		compatible = "samsung,exynos4210-sysram-ns";
+		reg = <0x0203F000 0x1000>;
+	};
+
 	pd_lcd1: lcd1-power-domain@10023CA0 {
 		compatible = "samsung,exynos4210-pd";
 		reg = <0x10023CA0 0x20>;
diff --git a/arch/arm/boot/dts/exynos4x12.dtsi b/arch/arm/boot/dts/exynos4x12.dtsi
index 5c412aa14738..05006cab698b 100644
--- a/arch/arm/boot/dts/exynos4x12.dtsi
+++ b/arch/arm/boot/dts/exynos4x12.dtsi
@@ -31,6 +31,16 @@
 		mshc0 = &mshc_0;
 	};
 
+	sysram@02020000 {
+		compatible = "samsung,exynos4210-sysram";
+		reg = <0x02020000 0x1000>;
+	};
+
+	sysram-ns@0204F000 {
+		compatible = "samsung,exynos4210-sysram-ns";
+		reg = <0x0204F000 0x1000>;
+	};
+
 	pd_isp: isp-power-domain@10023CA0 {
 		compatible = "samsung,exynos4210-pd";
 		reg = <0x10023CA0 0x20>;
diff --git a/arch/arm/boot/dts/exynos5.dtsi b/arch/arm/boot/dts/exynos5.dtsi
index 258dca441f36..b70a54ec7157 100644
--- a/arch/arm/boot/dts/exynos5.dtsi
+++ b/arch/arm/boot/dts/exynos5.dtsi
@@ -18,6 +18,11 @@
 / {
 	interrupt-parent = <&gic>;
 
+	sysram@02020000 {
+		compatible = "samsung,exynos4210-sysram";
+		reg = <0x02020000 0x1000>;
+	};
+
 	chipid@10000000 {
 		compatible = "samsung,exynos4210-chipid";
 		reg = <0x10000000 0x100>;
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
index b7dec41e32af..3ecdbd8e2b19 100644
--- a/arch/arm/boot/dts/exynos5250.dtsi
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -70,6 +70,11 @@
 		};
 	};
 
+	sysram-ns@0204F000 {
+		compatible = "samsung,exynos4210-sysram-ns";
+		reg = <0x0204F000 0x1000>;
+	};
+
 	pd_gsc: gsc-power-domain@10044000 {
 		compatible = "samsung,exynos4210-pd";
 		reg = <0x10044000 0x20>;
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 02d0aaa7af59..6a16f4659ec7 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -131,51 +131,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
 	},
 };
 
-static struct map_desc exynos4_iodesc0[] __initdata = {
-	{
-		.virtual	= (unsigned long)S5P_VA_SYSRAM,
-		.pfn		= __phys_to_pfn(EXYNOS4_PA_SYSRAM0),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	},
-};
-
-static struct map_desc exynos4_iodesc1[] __initdata = {
-	{
-		.virtual	= (unsigned long)S5P_VA_SYSRAM,
-		.pfn		= __phys_to_pfn(EXYNOS4_PA_SYSRAM1),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	},
-};
-
-static struct map_desc exynos4210_iodesc[] __initdata = {
-	{
-		.virtual	= (unsigned long)S5P_VA_SYSRAM_NS,
-		.pfn		= __phys_to_pfn(EXYNOS4210_PA_SYSRAM_NS),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	},
-};
-
-static struct map_desc exynos4x12_iodesc[] __initdata = {
-	{
-		.virtual	= (unsigned long)S5P_VA_SYSRAM_NS,
-		.pfn		= __phys_to_pfn(EXYNOS4x12_PA_SYSRAM_NS),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	},
-};
-
-static struct map_desc exynos5250_iodesc[] __initdata = {
-	{
-		.virtual	= (unsigned long)S5P_VA_SYSRAM_NS,
-		.pfn		= __phys_to_pfn(EXYNOS5250_PA_SYSRAM_NS),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	},
-};
-
 static struct map_desc exynos5_iodesc[] __initdata = {
 	{
 		.virtual	= (unsigned long)S3C_VA_SYS,
@@ -198,11 +153,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
 		.length		= SZ_4K,
 		.type		= MT_DEVICE,
 	}, {
-		.virtual	= (unsigned long)S5P_VA_SYSRAM,
-		.pfn		= __phys_to_pfn(EXYNOS5_PA_SYSRAM),
-		.length		= SZ_4K,
-		.type		= MT_DEVICE,
-	}, {
 		.virtual	= (unsigned long)S5P_VA_CMU,
 		.pfn		= __phys_to_pfn(EXYNOS5_PA_CMU),
 		.length		= 144 * SZ_1K,
@@ -292,6 +242,44 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
 	return 1;
 }
 
+struct __sysram_desc {
+	char name[32];
+	unsigned long addr;
+};
+
+static struct __sysram_desc sysram_desc[] __initdata = {
+	{
+		.name = "samsung,exynos4210-sysram",
+		.addr = (unsigned long)S5P_VA_SYSRAM,
+	}, {
+		.name = "samsung,exynos4210-sysram-ns",
+		.addr = (unsigned long)S5P_VA_SYSRAM_NS,
+	},
+};
+
+static int __init exynos_fdt_map_sysram(unsigned long node, const char *uname,
+					int depth, void *data)
+{
+	struct map_desc iodesc;
+	__be32 *reg;
+	unsigned long len;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(sysram_desc); i++) {
+		if (of_flat_dt_is_compatible(node, sysram_desc[i].name)) {
+			reg = of_get_flat_dt_prop(node, "reg", &len);
+			if (!reg || len != (sizeof(unsigned long) * 2))
+				return -ENODEV;
+			iodesc.virtual = sysram_desc[i].addr;
+			iodesc.pfn = __phys_to_pfn(be32_to_cpu(reg[0]));
+			iodesc.length = be32_to_cpu(reg[1]);
+			iodesc.type = MT_DEVICE;
+			iotable_init(&iodesc, 1);
+		}
+	}
+	return 0;
+}
+
 /*
  * exynos_map_io
  *
@@ -308,6 +296,8 @@ void __init exynos_init_io(void)
 	s5p_init_cpu(S5P_VA_CHIPID);
 
 	exynos_map_io();
+
+	of_scan_flat_dt(exynos_fdt_map_sysram, NULL);
 }
 
 static void __init exynos_map_io(void)
@@ -317,20 +307,6 @@ static void __init exynos_map_io(void)
 
 	if (soc_is_exynos5250() || soc_is_exynos5420())
 		iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-
-	if (soc_is_exynos4210()) {
-		if (samsung_rev() == EXYNOS4210_REV_0)
-			iotable_init(exynos4_iodesc0,
-						ARRAY_SIZE(exynos4_iodesc0));
-		else
-			iotable_init(exynos4_iodesc1,
-						ARRAY_SIZE(exynos4_iodesc1));
-		iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
-	}
-	if (soc_is_exynos4212() || soc_is_exynos4412())
-		iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
-	if (soc_is_exynos5250())
-		iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
 struct bus_type exynos_subsys = {
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 7b046b59d9ec..548269a60634 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -23,13 +23,6 @@
 
 #include <plat/map-s5p.h>
 
-#define EXYNOS4_PA_SYSRAM0		0x02025000
-#define EXYNOS4_PA_SYSRAM1		0x02020000
-#define EXYNOS5_PA_SYSRAM		0x02020000
-#define EXYNOS4210_PA_SYSRAM_NS		0x0203F000
-#define EXYNOS4x12_PA_SYSRAM_NS		0x0204F000
-#define EXYNOS5250_PA_SYSRAM_NS		0x0204F000
-
 #define EXYNOS_PA_CHIPID		0x10000000
 
 #define EXYNOS4_PA_SYSCON		0x10010000
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v3 4/4] ARM: dts: imx6q-phytec: Added SATA Support
From: Ashutosh singh @ 2014-02-20  5:50 UTC (permalink / raw)
  To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	c.hemp-guT5V/WYfQezQB+pC5nmwQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, festevam-Re5JQEeQqe8AvxtiuMwx3w,
	Ashutosh singh
In-Reply-To: <1392875418-9034-1-git-send-email-ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>

This patch adds support for SATA on Phytec phyFLEX-i.MX6 Quad module.

Signed-off-by: Ashutosh singh <ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>
---
 arch/arm/boot/dts/imx6q-phytec-pbab01.dts |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
index 21c8b37..5607c33 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
+++ b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
@@ -25,6 +25,10 @@
 	status = "okay";
 };
 
+&sata {
+	status = "okay";
+};
+
 &uart4 {
 	status = "okay";
 };
-- 
1.7.9.5

--
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 v3 3/4] ARM: dts: imx6q-phytec: Added GPMI-NAND Support
From: Ashutosh singh @ 2014-02-20  5:50 UTC (permalink / raw)
  To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	c.hemp-guT5V/WYfQezQB+pC5nmwQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, festevam-Re5JQEeQqe8AvxtiuMwx3w,
	Ashutosh singh
In-Reply-To: <1392875418-9034-1-git-send-email-ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>

This patch adds support for GPMI-NAND on Phytec phyFLEX-i.MX6 Quad module.

Signed-off-by: Ashutosh singh <ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>
---
 arch/arm/boot/dts/imx6q-phytec-pbab01.dts  |    4 ++++
 arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi |   29 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
index 91aecba..21c8b37 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
+++ b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
@@ -21,6 +21,10 @@
 	status = "okay";
 };
 
+&gpmi {
+	status = "okay";
+};
+
 &uart4 {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
index b1a78a0..324f155 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
@@ -190,6 +190,28 @@
 			>;
 		};
 
+		pinctrl_gpmi_nand: gpminandgrp {
+			fsl,pins = <
+				MX6QDL_PAD_NANDF_CLE__NAND_CLE		0xb0b1
+				MX6QDL_PAD_NANDF_ALE__NAND_ALE		0xb0b1
+				MX6QDL_PAD_NANDF_WP_B__NAND_WP_B	0xb0b1
+				MX6QDL_PAD_NANDF_RB0__NAND_READY_B	0xb000
+				MX6QDL_PAD_NANDF_CS0__NAND_CE0_B	0xb0b1
+				MX6QDL_PAD_NANDF_CS1__NAND_CE1_B	0xb0b1
+				MX6QDL_PAD_SD4_CMD__NAND_RE_B		0xb0b1
+				MX6QDL_PAD_SD4_CLK__NAND_WE_B		0xb0b1
+				MX6QDL_PAD_NANDF_D0__NAND_DATA00	0xb0b1
+				MX6QDL_PAD_NANDF_D1__NAND_DATA01	0xb0b1
+				MX6QDL_PAD_NANDF_D2__NAND_DATA02	0xb0b1
+				MX6QDL_PAD_NANDF_D3__NAND_DATA03	0xb0b1
+				MX6QDL_PAD_NANDF_D4__NAND_DATA04	0xb0b1
+				MX6QDL_PAD_NANDF_D5__NAND_DATA05	0xb0b1
+				MX6QDL_PAD_NANDF_D6__NAND_DATA06	0xb0b1
+				MX6QDL_PAD_NANDF_D7__NAND_DATA07	0xb0b1
+				MX6QDL_PAD_SD4_DAT0__NAND_DQS		0x00b1
+			>;
+		};
+
 		pinctrl_i2c1: i2c1grp {
 			fsl,pins = <
 				MX6QDL_PAD_EIM_D21__I2C1_SCL		0x4001b8b1
@@ -257,6 +279,13 @@
 	status = "disabled";
 };
 
+&gpmi {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_gpmi_nand>;
+	nand-on-flash-bbt;
+	status = "disabled";
+};
+
 &uart4 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_uart4>;
-- 
1.7.9.5

--
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 v3 2/4] ARM: dts: imx6q-phytec: Added USB_HOST Support
From: Ashutosh singh @ 2014-02-20  5:50 UTC (permalink / raw)
  To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	c.hemp-guT5V/WYfQezQB+pC5nmwQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, festevam-Re5JQEeQqe8AvxtiuMwx3w,
	Ashutosh singh
In-Reply-To: <1392875418-9034-1-git-send-email-ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>

This patch adds support for USB_HOST on Phytec phyFLEX-i.MX6 Quad module.

Signed-off-by: Ashutosh singh <ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>
---
 arch/arm/boot/dts/imx6q-phytec-pbab01.dts  |    4 ++++
 arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi |   22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
index 87c3702..91aecba 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
+++ b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
@@ -25,6 +25,10 @@
 	status = "okay";
 };
 
+&usbh1 {
+	status = "okay";
+};
+
 &usbotg {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
index ee07896..b1a78a0 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
@@ -32,6 +32,15 @@
 			regulator-max-microvolt = <5000000>;
 			gpio = <&gpio4 15 0>;
 		};
+
+		reg_usb_h1_vbus: regulator@1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "usb_h1_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio1 0 0>;
+		};
 	};
 };
 
@@ -195,6 +204,12 @@
 			>;
 		};
 
+		pinctrl_usbh1: usbh1grp {
+			fsl,pins = <
+				MX6QDL_PAD_GPIO_0__USB_H1_PWR		0x80000000
+			>;
+		};
+
 		pinctrl_usbotg: usbotggrp {
 			fsl,pins = <
 				MX6QDL_PAD_GPIO_1__USB_OTG_ID		0x17059
@@ -248,6 +263,13 @@
 	status = "disabled";
 };
 
+&usbh1 {
+	vbus-supply = <&reg_usb_h1_vbus>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbh1>;
+	status = "disabled";
+};
+
 &usbotg {
 	vbus-supply = <&reg_usb_otg_vbus>;
 	pinctrl-names = "default";
-- 
1.7.9.5

--
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 v4 1/4] ARM: dts: imx6q-phytec: Added USB_OTG Support
From: Ashutosh singh @ 2014-02-20  5:50 UTC (permalink / raw)
  To: shawn.guo-QSEj5FYQhm4dnm+yROfE0A
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, kernel-bIcnvbaLZ9MEGnE8C9+IrQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	c.hemp-guT5V/WYfQezQB+pC5nmwQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, festevam-Re5JQEeQqe8AvxtiuMwx3w,
	Ashutosh singh

This patch adds support for USB_OTG on Phytec phyFLEX-i.MX6 Quad module.

Signed-off-by: Ashutosh singh <ashutosh.s-mS2nBM426Az/PtFMR13I2A@public.gmane.org>
---
 arch/arm/boot/dts/imx6q-phytec-pbab01.dts  |    4 ++++
 arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi |   31 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
index 7d37ec6..87c3702 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
+++ b/arch/arm/boot/dts/imx6q-phytec-pbab01.dts
@@ -25,6 +25,10 @@
 	status = "okay";
 };
 
+&usbotg {
+	status = "okay";
+};
+
 &usdhc2 {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
index 0dd5d3b..ee07896 100644
--- a/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
+++ b/arch/arm/boot/dts/imx6q-phytec-pfla02.dtsi
@@ -18,6 +18,21 @@
 	memory {
 		reg = <0x10000000 0x80000000>;
 	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		reg_usb_otg_vbus: regulator@0 {
+			compatible = "regulator-fixed";
+			reg = <0>;
+			regulator-name = "usb_otg_vbus";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			gpio = <&gpio4 15 0>;
+		};
+	};
 };
 
 &ecspi3 {
@@ -180,6 +195,14 @@
 			>;
 		};
 
+		pinctrl_usbotg: usbotggrp {
+			fsl,pins = <
+				MX6QDL_PAD_GPIO_1__USB_OTG_ID		0x17059
+				MX6QDL_PAD_KEY_COL4__USB_OTG_OC		0x1b0b0
+				MX6QDL_PAD_KEY_ROW4__GPIO4_IO15		0x80000000
+			>;
+		};
+
 		pinctrl_usdhc2: usdhc2grp {
 			fsl,pins = <
 				MX6QDL_PAD_SD2_CMD__SD2_CMD		0x17059
@@ -225,6 +248,14 @@
 	status = "disabled";
 };
 
+&usbotg {
+	vbus-supply = <&reg_usb_otg_vbus>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbotg>;
+	disable-over-current;
+	status = "disabled";
+};
+
 &usdhc2 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pinctrl_usdhc2>;
-- 
1.7.9.5

--
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 v10 15/15] ARM: dts: imx6: add mxs phy controller id
From: Peter Chen @ 2014-02-20  5:14 UTC (permalink / raw)
  To: balbi-l0cyMroinI0, shawn.guo-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	mark.rutland-5wv7dgnIgG8
  Cc: alexander.shishkin-VuQAYsv1563Yd54FQh9/CA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	festevam-Re5JQEeQqe8AvxtiuMwx3w, marex-ynQEQJNshbs,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ, m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ,
	frank.li-KZfg59tc24xl57MIdRCFDg,
	peter.chen-KZfg59tc24xl57MIdRCFDg,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-doc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1392873284-9386-1-git-send-email-peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>

We need to use controller id to access different register regions
for mxs phy.

Signed-off-by: Peter Chen <peter.chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/boot/dts/imx6qdl.dtsi |    2 ++
 arch/arm/boot/dts/imx6sl.dtsi  |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index 047b147..581c4c9 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -33,6 +33,8 @@
 		spi1 = &ecspi2;
 		spi2 = &ecspi3;
 		spi3 = &ecspi4;
+		usbphy0 = &usbphy1;
+		usbphy1 = &usbphy2;
 	};
 
 	intc: interrupt-controller@00a01000 {
diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi
index 30322b5..a06d939 100644
--- a/arch/arm/boot/dts/imx6sl.dtsi
+++ b/arch/arm/boot/dts/imx6sl.dtsi
@@ -27,6 +27,8 @@
 		spi1 = &ecspi2;
 		spi2 = &ecspi3;
 		spi3 = &ecspi4;
+		usbphy0 = &usbphy1;
+		usbphy1 = &usbphy2;
 	};
 
 	cpus {
-- 
1.7.8


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

^ permalink raw reply related


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