All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc
@ 2015-10-14  7:16 Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 2/6] genalloc:support allocating specific region Zhao Qiang
                   ` (4 more replies)
  0 siblings, 5 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

Bytes alignment is required to manage some special RAM,
so add gen_pool_first_fit_align to genalloc,
meanwhile add gen_pool_alloc_data to pass data to
gen_pool_first_fit_align(modify gen_pool_alloc as a wrapper)

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v6:
	- patches set v6 include a new patch because of using 
	- genalloc to manage QE MURAM, patch 0001 is the new 
	- patch, adding bytes alignment for allocation for use.
Changes for v7:
	- cpm muram also need to use genalloc to manage, it has 
	  a function to reserve a specific region of muram,
	  add offset to genpool_data for start addr to be allocated.
Changes for v8:
	- remove supporting reserving a specific region from this patch
	  add a new patch to support it.
Changes for v9:
	- Nil 
Changes for v10:
	- Nil
Changes for v11:
	- Nil
Changes for v12:
	- Nil

 include/linux/genalloc.h | 24 ++++++++++++++++----
 lib/genalloc.c           | 58 +++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 1ccaab4..aaf3dc2 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -30,10 +30,12 @@
 #ifndef __GENALLOC_H__
 #define __GENALLOC_H__
 
+#include <linux/types.h>
 #include <linux/spinlock_types.h>
 
 struct device;
 struct device_node;
+struct gen_pool;
 
 /**
  * Allocation callback function type definition
@@ -47,7 +49,7 @@ typedef unsigned long (*genpool_algo_t)(unsigned long *map,
 			unsigned long size,
 			unsigned long start,
 			unsigned int nr,
-			void *data);
+			void *data, struct gen_pool *pool);
 
 /*
  *  General purpose special memory pool descriptor.
@@ -73,6 +75,13 @@ struct gen_pool_chunk {
 	unsigned long bits[0];		/* bitmap for allocating memory chunk */
 };
 
+/*
+ *  gen_pool data descriptor for gen_pool_first_fit_align.
+ */
+struct genpool_data_align {
+	int align;		/* alignment by bytes for starting address */
+};
+
 extern struct gen_pool *gen_pool_create(int, int);
 extern phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long);
 extern int gen_pool_add_virt(struct gen_pool *, unsigned long, phys_addr_t,
@@ -96,6 +105,7 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
 }
 extern void gen_pool_destroy(struct gen_pool *);
 extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
+extern unsigned long gen_pool_alloc_data(struct gen_pool *, size_t, void *data);
 extern void *gen_pool_dma_alloc(struct gen_pool *pool, size_t size,
 		dma_addr_t *dma);
 extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
@@ -108,14 +118,20 @@ extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
 		void *data);
 
 extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
-		unsigned long start, unsigned int nr, void *data);
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool);
+
+extern unsigned long gen_pool_first_fit_align(unsigned long *map,
+		unsigned long size, unsigned long start, unsigned int nr,
+		void *data, struct gen_pool *pool);
 
 extern unsigned long gen_pool_first_fit_order_align(unsigned long *map,
 		unsigned long size, unsigned long start, unsigned int nr,
-		void *data);
+		void *data, struct gen_pool *pool);
 
 extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
-		unsigned long start, unsigned int nr, void *data);
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool);
 
 extern struct gen_pool *devm_gen_pool_create(struct device *dev,
 		int min_alloc_order, int nid);
diff --git a/lib/genalloc.c b/lib/genalloc.c
index d214866..b8762b1 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -269,6 +269,24 @@ EXPORT_SYMBOL(gen_pool_destroy);
  */
 unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
 {
+	return gen_pool_alloc_data(pool, size, pool->data);
+}
+EXPORT_SYMBOL(gen_pool_alloc);
+
+/**
+ * gen_pool_alloc_data - allocate special memory from the pool
+ * @pool: pool to allocate from
+ * @size: number of bytes to allocate from the pool
+ * @data: data passed to algorithm
+ *
+ * Allocate the requested number of bytes from the specified pool.
+ * Uses the pool allocation function (with first-fit algorithm by default).
+ * Can not be used in NMI handler on architectures without
+ * NMI-safe cmpxchg implementation.
+ */
+unsigned long gen_pool_alloc_data(struct gen_pool *pool, size_t size,
+		void *data)
+{
 	struct gen_pool_chunk *chunk;
 	unsigned long addr = 0;
 	int order = pool->min_alloc_order;
@@ -290,7 +308,7 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
 		end_bit = chunk_size(chunk) >> order;
 retry:
 		start_bit = pool->algo(chunk->bits, end_bit, start_bit, nbits,
-				pool->data);
+				data, pool);
 		if (start_bit >= end_bit)
 			continue;
 		remain = bitmap_set_ll(chunk->bits, start_bit, nbits);
@@ -309,7 +327,7 @@ retry:
 	rcu_read_unlock();
 	return addr;
 }
-EXPORT_SYMBOL(gen_pool_alloc);
+EXPORT_SYMBOL(gen_pool_alloc_data);
 
 /**
  * gen_pool_dma_alloc - allocate special memory from the pool for DMA usage
@@ -500,15 +518,42 @@ EXPORT_SYMBOL(gen_pool_set_algo);
  * @start: The bitnumber to start searching at
  * @nr: The number of zeroed bits we're looking for
  * @data: additional data - unused
+ * @pool: pool to find the fit region memory from
  */
 unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
-		unsigned long start, unsigned int nr, void *data)
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool)
 {
 	return bitmap_find_next_zero_area(map, size, start, nr, 0);
 }
 EXPORT_SYMBOL(gen_pool_first_fit);
 
 /**
+ * gen_pool_first_fit_align - find the first available region
+ * of memory matching the size requirement (alignment constraint)
+ * @map: The address to base the search on
+ * @size: The bitmap size in bits
+ * @start: The bitnumber to start searching at
+ * @nr: The number of zeroed bits we're looking for
+ * @data: data for alignment
+ * @pool: pool to get order from
+ */
+unsigned long gen_pool_first_fit_align(unsigned long *map, unsigned long size,
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool)
+{
+	struct genpool_data_align *alignment;
+	unsigned long align_mask;
+	int order;
+
+	alignment = data;
+	order = pool->min_alloc_order;
+	align_mask = ((alignment->align + (1UL << order) - 1) >> order) - 1;
+	return bitmap_find_next_zero_area(map, size, start, nr, align_mask);
+}
+EXPORT_SYMBOL(gen_pool_first_fit_align);
+
+/**
  * gen_pool_first_fit_order_align - find the first available region
  * of memory matching the size requirement. The region will be aligned
  * to the order of the size specified.
@@ -517,10 +562,11 @@ EXPORT_SYMBOL(gen_pool_first_fit);
  * @start: The bitnumber to start searching at
  * @nr: The number of zeroed bits we're looking for
  * @data: additional data - unused
+ * @pool: pool to find the fit region memory from
  */
 unsigned long gen_pool_first_fit_order_align(unsigned long *map,
 		unsigned long size, unsigned long start,
-		unsigned int nr, void *data)
+		unsigned int nr, void *data, struct gen_pool *pool)
 {
 	unsigned long align_mask = roundup_pow_of_two(nr) - 1;
 
@@ -536,12 +582,14 @@ EXPORT_SYMBOL(gen_pool_first_fit_order_align);
  * @start: The bitnumber to start searching at
  * @nr: The number of zeroed bits we're looking for
  * @data: additional data - unused
+ * @pool: pool to find the fit region memory from
  *
  * Iterate over the bitmap to find the smallest free region
  * which we can allocate the memory.
  */
 unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
-		unsigned long start, unsigned int nr, void *data)
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool)
 {
 	unsigned long start_bit = size;
 	unsigned long len = size + 1;
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v12 2/6] genalloc:support allocating specific region
  2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
@ 2015-10-14  7:16 ` Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram Zhao Qiang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

Add new algo for genalloc, it reserve a specific region of
memory matching the size requirement (no alignment constraint)

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v9:
	- reserve a specific region, if the return region
	- is not during the specific region, return fail.
Changes for v10:
	- rename gen_pool_fixed_fit to gen_pool_fixed_alloc
Changes for v11:
	- rename gen_pool_fixed_fit to gen_pool_fixed_alloc
Changes for v12:
	- Nil

 include/linux/genalloc.h | 11 +++++++++++
 lib/genalloc.c           | 30 ++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index aaf3dc2..56d5d96 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -82,6 +82,13 @@ struct genpool_data_align {
 	int align;		/* alignment by bytes for starting address */
 };
 
+/*
+ *  gen_pool data descriptor for gen_pool_fixed_alloc.
+ */
+struct genpool_data_fixed {
+	unsigned long offset;		/* The offset of the specific region */
+};
+
 extern struct gen_pool *gen_pool_create(int, int);
 extern phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long);
 extern int gen_pool_add_virt(struct gen_pool *, unsigned long, phys_addr_t,
@@ -121,6 +128,10 @@ extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
 		unsigned long start, unsigned int nr, void *data,
 		struct gen_pool *pool);
 
+extern unsigned long gen_pool_fixed_alloc(unsigned long *map,
+		unsigned long size, unsigned long start, unsigned int nr,
+		void *data, struct gen_pool *pool);
+
 extern unsigned long gen_pool_first_fit_align(unsigned long *map,
 		unsigned long size, unsigned long start, unsigned int nr,
 		void *data, struct gen_pool *pool);
diff --git a/lib/genalloc.c b/lib/genalloc.c
index b8762b1..1e6fde8 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -554,6 +554,36 @@ unsigned long gen_pool_first_fit_align(unsigned long *map, unsigned long size,
 EXPORT_SYMBOL(gen_pool_first_fit_align);
 
 /**
+ * gen_pool_fixed_alloc - reserve a specific region of
+ * matching the size requirement (no alignment constraint)
+ * @map: The address to base the search on
+ * @size: The bitmap size in bits
+ * @start: The bitnumber to start searching at
+ * @nr: The number of zeroed bits we're looking for
+ * @data: data for alignment
+ * @pool: pool to get order from
+ */
+unsigned long gen_pool_fixed_alloc(unsigned long *map, unsigned long size,
+		unsigned long start, unsigned int nr, void *data,
+		struct gen_pool *pool)
+{
+	struct genpool_data_fixed *fixed_data;
+	int order;
+	unsigned long offset_bit;
+	unsigned long start_bit;
+
+	fixed_data = data;
+	order = pool->min_alloc_order;
+	offset_bit = fixed_data->offset >> order;
+	start_bit = bitmap_find_next_zero_area(map, size,
+			start + offset_bit, nr, 0);
+	if (start_bit != offset_bit)
+		start_bit = size;
+	return start_bit;
+}
+EXPORT_SYMBOL(gen_pool_fixed_alloc);
+
+/**
  * gen_pool_first_fit_order_align - find the first available region
  * of memory matching the size requirement. The region will be aligned
  * to the order of the size specified.
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 2/6] genalloc:support allocating specific region Zhao Qiang
@ 2015-10-14  7:16 ` Zhao Qiang
  2015-10-23  2:59   ` Scott Wood
  2015-10-14  7:16 ` [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common Zhao Qiang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

Use genalloc to manage CPM/QE muram instead of rheap.

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v9:
	- splitted from patch 3/5, modify cpm muram management functions.
Changes for v10:
	- modify cpm muram first, then move to qe_common
	- modify commit.
Changes for v11:
	- factor out the common alloc code
	- modify min_alloc_order to zero for cpm_muram_alloc_fixed.
Changes for v12:
	- Nil 

 arch/powerpc/include/asm/cpm.h   |   1 +
 arch/powerpc/platforms/Kconfig   |   2 +-
 arch/powerpc/sysdev/cpm_common.c | 129 +++++++++++++++++++++++++++------------
 3 files changed, 93 insertions(+), 39 deletions(-)

diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
index 4398a6c..0e1ac3f 100644
--- a/arch/powerpc/include/asm/cpm.h
+++ b/arch/powerpc/include/asm/cpm.h
@@ -161,6 +161,7 @@ int cpm_muram_init(void);
 unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
 int cpm_muram_free(unsigned long offset);
 unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
+unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
 void __iomem *cpm_muram_addr(unsigned long offset);
 unsigned long cpm_muram_offset(void __iomem *addr);
 dma_addr_t cpm_muram_dma(void __iomem *addr);
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index b7f9c40..01626be7 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -275,7 +275,7 @@ config TAU_AVERAGE
 config QUICC_ENGINE
 	bool "Freescale QUICC Engine (QE) Support"
 	depends on FSL_SOC && PPC32
-	select PPC_LIB_RHEAP
+	select GENERIC_ALLOCATOR
 	select CRC32
 	help
 	  The QUICC Engine (QE) is a new generation of communications
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 4f78695..ff47072 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -17,6 +17,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/genalloc.h>
 #include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/spinlock.h>
@@ -27,7 +28,6 @@
 
 #include <asm/udbg.h>
 #include <asm/io.h>
-#include <asm/rheap.h>
 #include <asm/cpm.h>
 
 #include <mm/mmu_decl.h>
@@ -65,14 +65,22 @@ void __init udbg_init_cpm(void)
 }
 #endif
 
+static struct gen_pool *muram_pool;
 static spinlock_t cpm_muram_lock;
-static rh_block_t cpm_boot_muram_rh_block[16];
-static rh_info_t cpm_muram_info;
 static u8 __iomem *muram_vbase;
 static phys_addr_t muram_pbase;
 
-/* Max address size we deal with */
+struct muram_block {
+	struct list_head head;
+	unsigned long start;
+	int size;
+};
+
+static LIST_HEAD(muram_block_list);
+
+/* max address size we deal with */
 #define OF_MAX_ADDR_CELLS	4
+#define GENPOOL_OFFSET		(4096 * 8)
 
 int cpm_muram_init(void)
 {
@@ -87,50 +95,52 @@ int cpm_muram_init(void)
 		return 0;
 
 	spin_lock_init(&cpm_muram_lock);
-	/* initialize the info header */
-	rh_init(&cpm_muram_info, 1,
-	        sizeof(cpm_boot_muram_rh_block) /
-	        sizeof(cpm_boot_muram_rh_block[0]),
-	        cpm_boot_muram_rh_block);
-
 	np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
 	if (!np) {
 		/* try legacy bindings */
 		np = of_find_node_by_name(NULL, "data-only");
 		if (!np) {
-			printk(KERN_ERR "Cannot find CPM muram data node");
+			pr_err("Cannot find CPM muram data node");
 			ret = -ENODEV;
-			goto out;
+			goto out_muram;
 		}
 	}
 
+	muram_pool = gen_pool_create(0, -1);
 	muram_pbase = of_translate_address(np, zero);
 	if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) {
-		printk(KERN_ERR "Cannot translate zero through CPM muram node");
+		pr_err("Cannot translate zero through CPM muram node");
 		ret = -ENODEV;
-		goto out;
+		goto out_pool;
 	}
 
 	while (of_address_to_resource(np, i++, &r) == 0) {
 		if (r.end > max)
 			max = r.end;
+		ret = gen_pool_add(muram_pool, r.start - muram_pbase +
+				   GENPOOL_OFFSET, resource_size(&r), -1);
+		if (ret) {
+				pr_err("QE: couldn't add muram to pool!\n");
+				goto out_pool;
+			}
 
-		rh_attach_region(&cpm_muram_info, r.start - muram_pbase,
-				 resource_size(&r));
 	}
 
 	muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1);
 	if (!muram_vbase) {
-		printk(KERN_ERR "Cannot map CPM muram");
+		pr_err("Cannot map QE muram");
 		ret = -ENOMEM;
+		goto out_pool;
 	}
-
-out:
+	goto out_muram;
+out_pool:
+	gen_pool_destroy(muram_pool);
+out_muram:
 	of_node_put(np);
 	return ret;
 }
 
-/**
+/*
  * cpm_muram_alloc - allocate the requested size worth of multi-user ram
  * @size: number of bytes to allocate
  * @align: requested alignment, in bytes
@@ -141,59 +151,102 @@ out:
  */
 unsigned long cpm_muram_alloc(unsigned long size, unsigned long align)
 {
-	unsigned long start;
 	unsigned long flags;
-
+	unsigned long start;
+	static struct genpool_data_align muram_pool_data;
 	spin_lock_irqsave(&cpm_muram_lock, flags);
-	cpm_muram_info.alignment = align;
-	start = rh_alloc(&cpm_muram_info, size, "commproc");
-	memset(cpm_muram_addr(start), 0, size);
+	muram_pool_data.align = align;
+	gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
+			  &muram_pool_data);
+	start = cpm_muram_alloc_common(size, &muram_pool_data);
 	spin_unlock_irqrestore(&cpm_muram_lock, flags);
-
 	return start;
 }
 EXPORT_SYMBOL(cpm_muram_alloc);
 
+
 /**
  * cpm_muram_free - free a chunk of multi-user ram
  * @offset: The beginning of the chunk as returned by cpm_muram_alloc().
  */
 int cpm_muram_free(unsigned long offset)
 {
-	int ret;
 	unsigned long flags;
+	int size;
+	struct muram_block *tmp;
 
+	size = 0;
 	spin_lock_irqsave(&cpm_muram_lock, flags);
-	ret = rh_free(&cpm_muram_info, offset);
+	list_for_each_entry(tmp, &muram_block_list, head) {
+		if (tmp->start == offset) {
+			size = tmp->size;
+			list_del(&tmp->head);
+			kfree(tmp);
+			break;
+		}
+	}
+	gen_pool_free(muram_pool, offset + GENPOOL_OFFSET, size);
 	spin_unlock_irqrestore(&cpm_muram_lock, flags);
 
-	return ret;
+	return size;
 }
 EXPORT_SYMBOL(cpm_muram_free);
 
-/**
+/*
  * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram
- * @offset: the offset into the muram area to reserve
- * @size: the number of bytes to reserve
+ * @size: number of bytes to allocate
+ * @offset: offset of allocation start address
  *
- * This function returns "start" on success, -ENOMEM on failure.
- * Use cpm_dpram_addr() to get the virtual address of the area.
- * Use cpm_muram_free() to free the allocation.
+ * This function returns an offset into the muram area.
  */
 unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size)
 {
+
 	unsigned long start;
 	unsigned long flags;
+	static struct genpool_data_fixed muram_pool_data_fixed;
 
 	spin_lock_irqsave(&cpm_muram_lock, flags);
-	cpm_muram_info.alignment = 1;
-	start = rh_alloc_fixed(&cpm_muram_info, offset, size, "commproc");
+	muram_pool_data_fixed.offset = offset + GENPOOL_OFFSET;
+	gen_pool_set_algo(muram_pool, gen_pool_fixed_alloc,
+			  &muram_pool_data_fixed);
+	start = cpm_muram_alloc_common(size, &muram_pool_data_fixed);
 	spin_unlock_irqrestore(&cpm_muram_lock, flags);
-
 	return start;
 }
 EXPORT_SYMBOL(cpm_muram_alloc_fixed);
 
+/*
+ * cpm_muram_alloc_common - cpm_muram_alloc common code
+ * @size: number of bytes to allocate
+ * @data: data for genalloc's algorithm.
+ *
+ * This function returns an offset into the muram area.
+ */
+unsigned long cpm_muram_alloc_common(unsigned long size, void *data)
+{
+	struct muram_block *entry;
+	unsigned long start;
+
+	start = gen_pool_alloc_data(muram_pool, size, data);
+	if (!start)
+		goto out2;
+	start = start - GENPOOL_OFFSET;
+	memset(cpm_muram_addr(start), 0, size);
+	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+	if (!entry)
+		goto out1;
+	entry->start = start;
+	entry->size = size;
+	list_add(&entry->head, &muram_block_list);
+
+	return start;
+out1:
+	gen_pool_free(muram_pool, start, size);
+out2:
+	return (unsigned long) -ENOMEM;
+}
+
 /**
  * cpm_muram_addr - turn a muram offset into a virtual address
  * @offset: muram offset to convert
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 2/6] genalloc:support allocating specific region Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram Zhao Qiang
@ 2015-10-14  7:16 ` Zhao Qiang
  2015-10-23  3:09   ` Scott Wood
  2015-10-14  7:16 ` [PATCH v12 5/6] QE: use subsys_initcall to init qe Zhao Qiang
  2015-10-14  7:16 ` [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc Zhao Qiang
  4 siblings, 1 reply; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

QE and CPM have the same muram, they use the same management
functions. Now QE support both ARM and PowerPC, it is necessary
to move QE to "driver/soc", so move the muram management functions
from cpm_common to qe_common for preparing to move QE code to "driver/soc"

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v2:
	- no changes
Changes for v3:
	- no changes
Changes for v4:
	- no changes
Changes for v5:
	- no changes
Changes for v6:
	- using genalloc instead rheap to manage QE MURAM
	- remove qe_reset from platform file, using 
	- subsys_initcall to call qe_init function.
Changes for v7:
	- move this patch from 3/3 to 2/3
	- convert cpm with genalloc
	- check for gen_pool allocation failure
Changes for v8:
	- rebase
	- move BD_SC_* macro instead of copy
Changes for v9:
	- doesn't modify CPM, add a new patch to modify.
	- rebase
Changes for v10:
	- rebase
Changes for v11:
	- remove renaming
	- delete removing qe_reset and delete adding qe_init.
Changes for v12:
	- SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it. 

 arch/powerpc/include/asm/cpm.h                     |  44 -----
 arch/powerpc/include/asm/qe.h                      |  16 ++
 arch/powerpc/sysdev/cpm_common.c                   | 210 +--------------------
 arch/powerpc/sysdev/qe_lib/Makefile                |   2 +-
 .../sysdev/{cpm_common.c => qe_lib/qe_common.c}    | 188 +-----------------
 drivers/spi/Kconfig                                |   1 +
 6 files changed, 28 insertions(+), 433 deletions(-)
 copy arch/powerpc/sysdev/{cpm_common.c => qe_lib/qe_common.c} (54%)

diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
index 0e1ac3f..05a1c15 100644
--- a/arch/powerpc/include/asm/cpm.h
+++ b/arch/powerpc/include/asm/cpm.h
@@ -155,50 +155,6 @@ typedef struct cpm_buf_desc {
  */
 #define BD_I2C_START		(0x0400)
 
-int cpm_muram_init(void);
-
-#if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE)
-unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
-int cpm_muram_free(unsigned long offset);
-unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
-unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
-void __iomem *cpm_muram_addr(unsigned long offset);
-unsigned long cpm_muram_offset(void __iomem *addr);
-dma_addr_t cpm_muram_dma(void __iomem *addr);
-#else
-static inline unsigned long cpm_muram_alloc(unsigned long size,
-					    unsigned long align)
-{
-	return -ENOSYS;
-}
-
-static inline int cpm_muram_free(unsigned long offset)
-{
-	return -ENOSYS;
-}
-
-static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset,
-						  unsigned long size)
-{
-	return -ENOSYS;
-}
-
-static inline void __iomem *cpm_muram_addr(unsigned long offset)
-{
-	return NULL;
-}
-
-static inline unsigned long cpm_muram_offset(void __iomem *addr)
-{
-	return -ENOSYS;
-}
-
-static inline dma_addr_t cpm_muram_dma(void __iomem *addr)
-{
-	return 0;
-}
-#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
-
 #ifdef CONFIG_CPM
 int cpm_command(u32 command, u8 opcode);
 #else
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 32b9bfa..c2dd8e6 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -16,11 +16,15 @@
 #define _ASM_POWERPC_QE_H
 #ifdef __KERNEL__
 
+#include <linux/compiler.h>
 #include <linux/spinlock.h>
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <asm/cpm.h>
 #include <asm/immap_qe.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/types.h>
 
 #define QE_NUM_OF_SNUM	256	/* There are 256 serial number in QE */
 #define QE_NUM_OF_BRGS	16
@@ -92,6 +96,18 @@ extern void qe_reset(void);
 static inline void qe_reset(void) {}
 #endif
 
+int cpm_muram_init(void);
+
+#if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE)
+unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
+int cpm_muram_free(unsigned long offset);
+unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
+unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
+void __iomem *cpm_muram_addr(unsigned long offset);
+unsigned long cpm_muram_offset(void __iomem *addr);
+dma_addr_t cpm_muram_dma(void __iomem *addr);
+#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
+
 /* QE PIO */
 #define QE_PIO_PINS 32
 
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index ff47072..6993aa8 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -17,7 +17,6 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/genalloc.h>
 #include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/spinlock.h>
@@ -29,6 +28,7 @@
 #include <asm/udbg.h>
 #include <asm/io.h>
 #include <asm/cpm.h>
+#include <asm/qe.h>
 
 #include <mm/mmu_decl.h>
 
@@ -65,214 +65,6 @@ void __init udbg_init_cpm(void)
 }
 #endif
 
-static struct gen_pool *muram_pool;
-static spinlock_t cpm_muram_lock;
-static u8 __iomem *muram_vbase;
-static phys_addr_t muram_pbase;
-
-struct muram_block {
-	struct list_head head;
-	unsigned long start;
-	int size;
-};
-
-static LIST_HEAD(muram_block_list);
-
-/* max address size we deal with */
-#define OF_MAX_ADDR_CELLS	4
-#define GENPOOL_OFFSET		(4096 * 8)
-
-int cpm_muram_init(void)
-{
-	struct device_node *np;
-	struct resource r;
-	u32 zero[OF_MAX_ADDR_CELLS] = {};
-	resource_size_t max = 0;
-	int i = 0;
-	int ret = 0;
-
-	if (muram_pbase)
-		return 0;
-
-	spin_lock_init(&cpm_muram_lock);
-	np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
-	if (!np) {
-		/* try legacy bindings */
-		np = of_find_node_by_name(NULL, "data-only");
-		if (!np) {
-			pr_err("Cannot find CPM muram data node");
-			ret = -ENODEV;
-			goto out_muram;
-		}
-	}
-
-	muram_pool = gen_pool_create(0, -1);
-	muram_pbase = of_translate_address(np, zero);
-	if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) {
-		pr_err("Cannot translate zero through CPM muram node");
-		ret = -ENODEV;
-		goto out_pool;
-	}
-
-	while (of_address_to_resource(np, i++, &r) == 0) {
-		if (r.end > max)
-			max = r.end;
-		ret = gen_pool_add(muram_pool, r.start - muram_pbase +
-				   GENPOOL_OFFSET, resource_size(&r), -1);
-		if (ret) {
-				pr_err("QE: couldn't add muram to pool!\n");
-				goto out_pool;
-			}
-
-	}
-
-	muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1);
-	if (!muram_vbase) {
-		pr_err("Cannot map QE muram");
-		ret = -ENOMEM;
-		goto out_pool;
-	}
-	goto out_muram;
-out_pool:
-	gen_pool_destroy(muram_pool);
-out_muram:
-	of_node_put(np);
-	return ret;
-}
-
-/*
- * cpm_muram_alloc - allocate the requested size worth of multi-user ram
- * @size: number of bytes to allocate
- * @align: requested alignment, in bytes
- *
- * This function returns an offset into the muram area.
- * Use cpm_dpram_addr() to get the virtual address of the area.
- * Use cpm_muram_free() to free the allocation.
- */
-unsigned long cpm_muram_alloc(unsigned long size, unsigned long align)
-{
-	unsigned long flags;
-	unsigned long start;
-	static struct genpool_data_align muram_pool_data;
-	spin_lock_irqsave(&cpm_muram_lock, flags);
-	muram_pool_data.align = align;
-	gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
-			  &muram_pool_data);
-	start = cpm_muram_alloc_common(size, &muram_pool_data);
-	spin_unlock_irqrestore(&cpm_muram_lock, flags);
-	return start;
-}
-EXPORT_SYMBOL(cpm_muram_alloc);
-
-
-/**
- * cpm_muram_free - free a chunk of multi-user ram
- * @offset: The beginning of the chunk as returned by cpm_muram_alloc().
- */
-int cpm_muram_free(unsigned long offset)
-{
-	unsigned long flags;
-	int size;
-	struct muram_block *tmp;
-
-	size = 0;
-	spin_lock_irqsave(&cpm_muram_lock, flags);
-	list_for_each_entry(tmp, &muram_block_list, head) {
-		if (tmp->start == offset) {
-			size = tmp->size;
-			list_del(&tmp->head);
-			kfree(tmp);
-			break;
-		}
-	}
-	gen_pool_free(muram_pool, offset + GENPOOL_OFFSET, size);
-	spin_unlock_irqrestore(&cpm_muram_lock, flags);
-
-	return size;
-}
-EXPORT_SYMBOL(cpm_muram_free);
-
-/*
- * cpm_muram_alloc_fixed - reserve a specific region of multi-user ram
- * @size: number of bytes to allocate
- * @offset: offset of allocation start address
- *
- * This function returns an offset into the muram area.
- */
-unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size)
-{
-
-	unsigned long start;
-	unsigned long flags;
-	static struct genpool_data_fixed muram_pool_data_fixed;
-
-	spin_lock_irqsave(&cpm_muram_lock, flags);
-	muram_pool_data_fixed.offset = offset + GENPOOL_OFFSET;
-	gen_pool_set_algo(muram_pool, gen_pool_fixed_alloc,
-			  &muram_pool_data_fixed);
-	start = cpm_muram_alloc_common(size, &muram_pool_data_fixed);
-	spin_unlock_irqrestore(&cpm_muram_lock, flags);
-	return start;
-}
-EXPORT_SYMBOL(cpm_muram_alloc_fixed);
-
-/*
- * cpm_muram_alloc_common - cpm_muram_alloc common code
- * @size: number of bytes to allocate
- * @data: data for genalloc's algorithm.
- *
- * This function returns an offset into the muram area.
- */
-unsigned long cpm_muram_alloc_common(unsigned long size, void *data)
-{
-	struct muram_block *entry;
-	unsigned long start;
-
-	start = gen_pool_alloc_data(muram_pool, size, data);
-	if (!start)
-		goto out2;
-	start = start - GENPOOL_OFFSET;
-	memset(cpm_muram_addr(start), 0, size);
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry)
-		goto out1;
-	entry->start = start;
-	entry->size = size;
-	list_add(&entry->head, &muram_block_list);
-
-	return start;
-out1:
-	gen_pool_free(muram_pool, start, size);
-out2:
-	return (unsigned long) -ENOMEM;
-}
-
-/**
- * cpm_muram_addr - turn a muram offset into a virtual address
- * @offset: muram offset to convert
- */
-void __iomem *cpm_muram_addr(unsigned long offset)
-{
-	return muram_vbase + offset;
-}
-EXPORT_SYMBOL(cpm_muram_addr);
-
-unsigned long cpm_muram_offset(void __iomem *addr)
-{
-	return addr - (void __iomem *)muram_vbase;
-}
-EXPORT_SYMBOL(cpm_muram_offset);
-
-/**
- * cpm_muram_dma - turn a muram virtual address into a DMA address
- * @offset: virtual address from cpm_muram_addr() to convert
- */
-dma_addr_t cpm_muram_dma(void __iomem *addr)
-{
-	return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
-}
-EXPORT_SYMBOL(cpm_muram_dma);
-
 #if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
 
 struct cpm2_ioports {
diff --git a/arch/powerpc/sysdev/qe_lib/Makefile b/arch/powerpc/sysdev/qe_lib/Makefile
index f1855c1..9507a27 100644
--- a/arch/powerpc/sysdev/qe_lib/Makefile
+++ b/arch/powerpc/sysdev/qe_lib/Makefile
@@ -1,7 +1,7 @@
 #
 # Makefile for the linux ppc-specific parts of QE
 #
-obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_ic.o qe_io.o
+obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_ic.o qe_io.o
 
 obj-$(CONFIG_UCC)	+= ucc.o
 obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/qe_lib/qe_common.c
similarity index 54%
copy from arch/powerpc/sysdev/cpm_common.c
copy to arch/powerpc/sysdev/qe_lib/qe_common.c
index ff47072..0aa74ca 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_common.c
@@ -1,23 +1,18 @@
 /*
- * Common CPM code
+ * Freescale QE common code
  *
- * Author: Scott Wood <scottwood@freescale.com>
+ * Author: Zhao Qiang  <qiang.zhao@freescale.com>
  *
- * Copyright 2007-2008,2010 Freescale Semiconductor, Inc.
- *
- * Some parts derived from commproc.c/cpm2_common.c, which is:
- * Copyright (c) 1997 Dan error_act (dmalek@jlc.net)
- * Copyright (c) 1999-2001 Dan Malek <dan@embeddedalley.com>
- * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
- * 2006 (c) MontaVista Software, Inc.
- * Vitaly Bordug <vbordug@ru.mvista.com>
+ * Copyright 2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
+ * 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 option) any later version.
  */
 
 #include <linux/genalloc.h>
+#include <linux/list.h>
 #include <linux/init.h>
 #include <linux/of_device.h>
 #include <linux/spinlock.h>
@@ -26,44 +21,8 @@
 #include <linux/of_address.h>
 #include <linux/slab.h>
 
-#include <asm/udbg.h>
-#include <asm/io.h>
-#include <asm/cpm.h>
-
-#include <mm/mmu_decl.h>
-
-#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
-#include <linux/of_gpio.h>
-#endif
-
-#ifdef CONFIG_PPC_EARLY_DEBUG_CPM
-static u32 __iomem *cpm_udbg_txdesc =
-	(u32 __iomem __force *)CONFIG_PPC_EARLY_DEBUG_CPM_ADDR;
-
-static void udbg_putc_cpm(char c)
-{
-	u8 __iomem *txbuf = (u8 __iomem __force *)in_be32(&cpm_udbg_txdesc[1]);
-
-	if (c == '\n')
-		udbg_putc_cpm('\r');
-
-	while (in_be32(&cpm_udbg_txdesc[0]) & 0x80000000)
-		;
-
-	out_8(txbuf, c);
-	out_be32(&cpm_udbg_txdesc[0], 0xa0000001);
-}
-
-void __init udbg_init_cpm(void)
-{
-	if (cpm_udbg_txdesc) {
-#ifdef CONFIG_CPM2
-		setbat(1, 0xf0000000, 0xf0000000, 1024*1024, PAGE_KERNEL_NCG);
-#endif
-		udbg_putc = udbg_putc_cpm;
-	}
-}
-#endif
+#include <linux/io.h>
+#include <asm/qe.h>
 
 static struct gen_pool *muram_pool;
 static spinlock_t cpm_muram_lock;
@@ -272,132 +231,3 @@ dma_addr_t cpm_muram_dma(void __iomem *addr)
 	return muram_pbase + ((u8 __iomem *)addr - muram_vbase);
 }
 EXPORT_SYMBOL(cpm_muram_dma);
-
-#if defined(CONFIG_CPM2) || defined(CONFIG_8xx_GPIO)
-
-struct cpm2_ioports {
-	u32 dir, par, sor, odr, dat;
-	u32 res[3];
-};
-
-struct cpm2_gpio32_chip {
-	struct of_mm_gpio_chip mm_gc;
-	spinlock_t lock;
-
-	/* shadowed data register to clear/set bits safely */
-	u32 cpdata;
-};
-
-static inline struct cpm2_gpio32_chip *
-to_cpm2_gpio32_chip(struct of_mm_gpio_chip *mm_gc)
-{
-	return container_of(mm_gc, struct cpm2_gpio32_chip, mm_gc);
-}
-
-static void cpm2_gpio32_save_regs(struct of_mm_gpio_chip *mm_gc)
-{
-	struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
-	struct cpm2_ioports __iomem *iop = mm_gc->regs;
-
-	cpm2_gc->cpdata = in_be32(&iop->dat);
-}
-
-static int cpm2_gpio32_get(struct gpio_chip *gc, unsigned int gpio)
-{
-	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
-	struct cpm2_ioports __iomem *iop = mm_gc->regs;
-	u32 pin_mask;
-
-	pin_mask = 1 << (31 - gpio);
-
-	return !!(in_be32(&iop->dat) & pin_mask);
-}
-
-static void __cpm2_gpio32_set(struct of_mm_gpio_chip *mm_gc, u32 pin_mask,
-	int value)
-{
-	struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
-	struct cpm2_ioports __iomem *iop = mm_gc->regs;
-
-	if (value)
-		cpm2_gc->cpdata |= pin_mask;
-	else
-		cpm2_gc->cpdata &= ~pin_mask;
-
-	out_be32(&iop->dat, cpm2_gc->cpdata);
-}
-
-static void cpm2_gpio32_set(struct gpio_chip *gc, unsigned int gpio, int value)
-{
-	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
-	struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
-	unsigned long flags;
-	u32 pin_mask = 1 << (31 - gpio);
-
-	spin_lock_irqsave(&cpm2_gc->lock, flags);
-
-	__cpm2_gpio32_set(mm_gc, pin_mask, value);
-
-	spin_unlock_irqrestore(&cpm2_gc->lock, flags);
-}
-
-static int cpm2_gpio32_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
-{
-	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
-	struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
-	struct cpm2_ioports __iomem *iop = mm_gc->regs;
-	unsigned long flags;
-	u32 pin_mask = 1 << (31 - gpio);
-
-	spin_lock_irqsave(&cpm2_gc->lock, flags);
-
-	setbits32(&iop->dir, pin_mask);
-	__cpm2_gpio32_set(mm_gc, pin_mask, val);
-
-	spin_unlock_irqrestore(&cpm2_gc->lock, flags);
-
-	return 0;
-}
-
-static int cpm2_gpio32_dir_in(struct gpio_chip *gc, unsigned int gpio)
-{
-	struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
-	struct cpm2_gpio32_chip *cpm2_gc = to_cpm2_gpio32_chip(mm_gc);
-	struct cpm2_ioports __iomem *iop = mm_gc->regs;
-	unsigned long flags;
-	u32 pin_mask = 1 << (31 - gpio);
-
-	spin_lock_irqsave(&cpm2_gc->lock, flags);
-
-	clrbits32(&iop->dir, pin_mask);
-
-	spin_unlock_irqrestore(&cpm2_gc->lock, flags);
-
-	return 0;
-}
-
-int cpm2_gpiochip_add32(struct device_node *np)
-{
-	struct cpm2_gpio32_chip *cpm2_gc;
-	struct of_mm_gpio_chip *mm_gc;
-	struct gpio_chip *gc;
-
-	cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL);
-	if (!cpm2_gc)
-		return -ENOMEM;
-
-	spin_lock_init(&cpm2_gc->lock);
-
-	mm_gc = &cpm2_gc->mm_gc;
-	gc = &mm_gc->gc;
-
-	mm_gc->save_regs = cpm2_gpio32_save_regs;
-	gc->ngpio = 32;
-	gc->direction_input = cpm2_gpio32_dir_in;
-	gc->direction_output = cpm2_gpio32_dir_out;
-	gc->get = cpm2_gpio32_get;
-	gc->set = cpm2_gpio32_set;
-
-	return of_mm_gpiochip_add(np, mm_gc);
-}
-#endif /* CONFIG_CPM2 || CONFIG_8xx_GPIO */
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 198f96b..406ece4 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -286,6 +286,7 @@ config SPI_FSL_LIB
 config SPI_FSL_CPM
 	tristate
 	depends on FSL_SOC
+	select QUICC_ENGINE
 
 config SPI_FSL_SPI
 	tristate "Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller"
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v12 5/6] QE: use subsys_initcall to init qe
  2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
                   ` (2 preceding siblings ...)
  2015-10-14  7:16 ` [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common Zhao Qiang
@ 2015-10-14  7:16 ` Zhao Qiang
  2015-10-23  3:11   ` Scott Wood
  2015-10-14  7:16 ` [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc Zhao Qiang
  4 siblings, 1 reply; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

Use subsys_initcall to init qe to adapt ARM architecture.
Remove qe_reset from PowerPC platform file.

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v12:
	- Nil

 arch/powerpc/platforms/83xx/km83xx.c      |  2 --
 arch/powerpc/platforms/83xx/mpc832x_mds.c |  2 --
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |  2 --
 arch/powerpc/platforms/83xx/mpc836x_mds.c |  2 --
 arch/powerpc/platforms/83xx/mpc836x_rdk.c |  3 ---
 arch/powerpc/platforms/85xx/common.c      |  1 -
 arch/powerpc/sysdev/qe_lib/qe.c           | 15 +++++++++++++++
 7 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index bf4c447..ae111581 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -136,8 +136,6 @@ static void __init mpc83xx_km_setup_arch(void)
 	mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
-	qe_reset();
-
 	np = of_find_node_by_name(NULL, "par_io");
 	if (np != NULL) {
 		par_io_init(np);
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index 8d76220..aacc43f 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -74,8 +74,6 @@ static void __init mpc832x_sys_setup_arch(void)
 	mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
-	qe_reset();
-
 	if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
 		par_io_init(np);
 		of_node_put(np);
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index eff5baa..0c7a43e 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -203,8 +203,6 @@ static void __init mpc832x_rdb_setup_arch(void)
 	mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
-	qe_reset();
-
 	if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
 		par_io_init(np);
 		of_node_put(np);
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 1a26d2f..eb24abd 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -82,8 +82,6 @@ static void __init mpc836x_mds_setup_arch(void)
 	mpc83xx_setup_pci();
 
 #ifdef CONFIG_QUICC_ENGINE
-	qe_reset();
-
 	if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
 		par_io_init(np);
 		of_node_put(np);
diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
index b63b42d..823e370 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
@@ -35,9 +35,6 @@ static void __init mpc836x_rdk_setup_arch(void)
 		ppc_md.progress("mpc836x_rdk_setup_arch()", 0);
 
 	mpc83xx_setup_pci();
-#ifdef CONFIG_QUICC_ENGINE
-	qe_reset();
-#endif
 }
 
 /*
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 7bfb9b1..0f91edc 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -105,7 +105,6 @@ void __init mpc85xx_qe_init(void)
 		return;
 	}
 
-	qe_reset();
 	of_node_put(np);
 
 }
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index c2518cd..3f9f596 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -671,6 +671,21 @@ unsigned int qe_get_num_of_snums(void)
 }
 EXPORT_SYMBOL(qe_get_num_of_snums);
 
+static int __init qe_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe");
+	if (!np) {
+		pr_err("%s: Could not find Quicc Engine node\n", __func__);
+		return -ENODEV;
+	}
+	qe_reset();
+	of_node_put(np);
+	return 0;
+}
+subsys_initcall(qe_init);
+
 #if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
 static int qe_resume(struct platform_device *ofdev)
 {
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
  2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
                   ` (3 preceding siblings ...)
  2015-10-14  7:16 ` [PATCH v12 5/6] QE: use subsys_initcall to init qe Zhao Qiang
@ 2015-10-14  7:16 ` Zhao Qiang
  2015-10-23  3:19   ` Scott Wood
  4 siblings, 1 reply; 32+ messages in thread
From: Zhao Qiang @ 2015-10-14  7:16 UTC (permalink / raw)
  To: scottwood
  Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus,
	Zhao Qiang

ls1 has qe and ls1 has arm cpu.
move qe from arch/powerpc to drivers/soc/fsl
to adapt to powerpc and arm

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
---
Changes for v2:
	- move code to driver/soc
Changes for v3:
	- change drivers/soc/qe to drivers/soc/fsl-qe
Changes for v4:
	- move drivers/soc/fsl-qe to drivers/soc/fsl/qe
	- move head files for qe from include/linux/fsl to include/soc/fsl
	- move qe_ic.c to drivers/irqchip/
Changes for v5:
	- update MAINTAINERS
Changes for v6:
	- rebase
Changes for v7:
	- move this patch from 2/3 to 3/3
Changes for v8:
	- Nil 
Changes for v9:
	- Nil 
Changes for v10:
	- Nil 
Changes for v11:
	- rebase
Changes for v12:
	- Nil

 MAINTAINERS                                        |  5 +++--
 arch/powerpc/platforms/83xx/km83xx.c               |  4 ++--
 arch/powerpc/platforms/83xx/misc.c                 |  2 +-
 arch/powerpc/platforms/83xx/mpc832x_mds.c          |  4 ++--
 arch/powerpc/platforms/83xx/mpc832x_rdb.c          |  4 ++--
 arch/powerpc/platforms/83xx/mpc836x_mds.c          |  4 ++--
 arch/powerpc/platforms/83xx/mpc836x_rdk.c          |  4 ++--
 arch/powerpc/platforms/85xx/common.c               |  2 +-
 arch/powerpc/platforms/85xx/corenet_generic.c      |  2 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c          |  4 ++--
 arch/powerpc/platforms/85xx/mpc85xx_rdb.c          |  4 ++--
 arch/powerpc/platforms/85xx/twr_p102x.c            |  4 ++--
 arch/powerpc/platforms/Kconfig                     | 19 -------------------
 arch/powerpc/sysdev/cpm_common.c                   |  2 +-
 arch/powerpc/sysdev/qe_lib/Kconfig                 | 22 ++++++----------------
 arch/powerpc/sysdev/qe_lib/Makefile                |  6 +-----
 arch/powerpc/sysdev/qe_lib/gpio.c                  |  2 +-
 arch/powerpc/sysdev/qe_lib/qe_io.c                 |  2 +-
 arch/powerpc/sysdev/qe_lib/usb.c                   |  4 ++--
 drivers/irqchip/Makefile                           |  1 +
 .../sysdev/qe_lib => drivers/irqchip}/qe_ic.c      |  2 +-
 .../sysdev/qe_lib => drivers/irqchip}/qe_ic.h      |  4 ++--
 drivers/net/ethernet/freescale/fsl_pq_mdio.c       |  2 +-
 drivers/net/ethernet/freescale/ucc_geth.c          |  8 ++++----
 drivers/net/ethernet/freescale/ucc_geth.h          |  8 ++++----
 drivers/soc/Kconfig                                |  1 +
 drivers/soc/Makefile                               |  1 +
 drivers/soc/fsl/Makefile                           |  5 +++++
 .../sysdev/qe_lib => drivers/soc/fsl/qe}/Kconfig   | 17 +++++++++++------
 drivers/soc/fsl/qe/Makefile                        |  9 +++++++++
 .../sysdev/qe_lib => drivers/soc/fsl/qe}/qe.c      |  4 ++--
 .../qe_lib => drivers/soc/fsl/qe}/qe_common.c      |  2 +-
 .../sysdev/qe_lib => drivers/soc/fsl/qe}/ucc.c     |  6 +++---
 .../qe_lib => drivers/soc/fsl/qe}/ucc_fast.c       |  8 ++++----
 .../qe_lib => drivers/soc/fsl/qe}/ucc_slow.c       |  8 ++++----
 drivers/spi/spi-fsl-cpm.c                          |  2 +-
 drivers/tty/serial/ucc_uart.c                      |  2 +-
 drivers/usb/gadget/udc/fsl_qe_udc.c                |  2 +-
 drivers/usb/host/fhci-hcd.c                        |  2 +-
 drivers/usb/host/fhci-hub.c                        |  2 +-
 drivers/usb/host/fhci-sched.c                      |  2 +-
 drivers/usb/host/fhci.h                            |  4 ++--
 .../include/asm => include/linux/fsl/qe}/qe_ic.h   |  0
 .../include/asm => include/soc/fsl/qe}/immap_qe.h  |  0
 .../include/asm => include/soc/fsl/qe}/qe.h        |  2 +-
 .../include/asm => include/soc/fsl/qe}/ucc.h       |  4 ++--
 .../include/asm => include/soc/fsl/qe}/ucc_fast.h  |  6 +++---
 .../include/asm => include/soc/fsl/qe}/ucc_slow.h  |  6 +++---
 48 files changed, 105 insertions(+), 115 deletions(-)
 rename {arch/powerpc/sysdev/qe_lib => drivers/irqchip}/qe_ic.c (99%)
 rename {arch/powerpc/sysdev/qe_lib => drivers/irqchip}/qe_ic.h (97%)
 create mode 100644 drivers/soc/fsl/Makefile
 copy {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/Kconfig (50%)
 create mode 100644 drivers/soc/fsl/qe/Makefile
 rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/qe.c (99%)
 rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/qe_common.c (99%)
 rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/ucc.c (98%)
 rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/ucc_fast.c (98%)
 rename {arch/powerpc/sysdev/qe_lib => drivers/soc/fsl/qe}/ucc_slow.c (98%)
 rename {arch/powerpc/include/asm => include/linux/fsl/qe}/qe_ic.h (100%)
 rename {arch/powerpc/include/asm => include/soc/fsl/qe}/immap_qe.h (100%)
 rename {arch/powerpc/include/asm => include/soc/fsl/qe}/qe.h (99%)
 rename {arch/powerpc/include/asm => include/soc/fsl/qe}/ucc.h (96%)
 rename {arch/powerpc/include/asm => include/soc/fsl/qe}/ucc_fast.h (98%)
 rename {arch/powerpc/include/asm => include/soc/fsl/qe}/ucc_slow.h (99%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 562ae4e..c688e61 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4155,8 +4155,9 @@ F:	include/linux/fs_enet_pd.h
 FREESCALE QUICC ENGINE LIBRARY
 L:	linuxppc-dev@lists.ozlabs.org
 S:	Orphan
-F:	arch/powerpc/sysdev/qe_lib/
-F:	arch/powerpc/include/asm/*qe.h
+F:	drivers/soc/fsl/qe/
+F:	include/soc/fsl/*qe*.h
+F:	include/soc/fsl/*ucc*.h
 
 FREESCALE USB PERIPHERAL DRIVERS
 M:	Li Yang <leoli@freescale.com>
diff --git a/arch/powerpc/platforms/83xx/km83xx.c b/arch/powerpc/platforms/83xx/km83xx.c
index ae111581..7ecd758 100644
--- a/arch/powerpc/platforms/83xx/km83xx.c
+++ b/arch/powerpc/platforms/83xx/km83xx.c
@@ -37,8 +37,8 @@
 #include <asm/udbg.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #include "mpc83xx.h"
 
diff --git a/arch/powerpc/platforms/83xx/misc.c b/arch/powerpc/platforms/83xx/misc.c
index ef9d01a..eacf34b 100644
--- a/arch/powerpc/platforms/83xx/misc.c
+++ b/arch/powerpc/platforms/83xx/misc.c
@@ -17,7 +17,7 @@
 #include <asm/io.h>
 #include <asm/hw_irq.h>
 #include <asm/ipic.h>
-#include <asm/qe_ic.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index aacc43f..20dce79 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -36,8 +36,8 @@
 #include <asm/udbg.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #include "mpc83xx.h"
 
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index 0c7a43e..2e6a6a4 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -25,8 +25,8 @@
 #include <asm/time.h>
 #include <asm/ipic.h>
 #include <asm/udbg.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index eb24abd..b1b8ab8 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -44,8 +44,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 #include <sysdev/simple_gpio.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #include "mpc83xx.h"
 
diff --git a/arch/powerpc/platforms/83xx/mpc836x_rdk.c b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
index 823e370..9a5a00d 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_rdk.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_rdk.c
@@ -20,8 +20,8 @@
 #include <asm/time.h>
 #include <asm/ipic.h>
 #include <asm/udbg.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 0f91edc..d81ea0c 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -9,7 +9,7 @@
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
 
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <sysdev/cpm2_pic.h>
 
 #include "mpc85xx.h"
diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c b/arch/powerpc/platforms/85xx/corenet_generic.c
index bd839dc..1ecbf7f 100644
--- a/arch/powerpc/platforms/85xx/corenet_generic.c
+++ b/arch/powerpc/platforms/85xx/corenet_generic.c
@@ -27,7 +27,7 @@
 #include <asm/udbg.h>
 #include <asm/mpic.h>
 #include <asm/ehv_pic.h>
-#include <asm/qe_ic.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #include <linux/of_platform.h>
 #include <sysdev/fsl_soc.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index a392e94..ea4d4f3 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -47,8 +47,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 #include <sysdev/simple_gpio.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <asm/mpic.h>
 #include <asm/swiotlb.h>
 #include <asm/fsl_guts.h>
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index e358bed..0c5e313 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -25,8 +25,8 @@
 #include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <asm/fsl_guts.h>
 
 #include <sysdev/fsl_soc.h>
diff --git a/arch/powerpc/platforms/85xx/twr_p102x.c b/arch/powerpc/platforms/85xx/twr_p102x.c
index 30e002f..a47654e 100644
--- a/arch/powerpc/platforms/85xx/twr_p102x.c
+++ b/arch/powerpc/platforms/85xx/twr_p102x.c
@@ -21,8 +21,8 @@
 #include <asm/pci-bridge.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
+#include <soc/fsl/qe/qe.h>
+#include <linux/fsl/qe/qe_ic.h>
 #include <asm/fsl_guts.h>
 
 #include <sysdev/fsl_soc.h>
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 01626be7..c9541a5 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -272,25 +272,6 @@ config TAU_AVERAGE
 
 	  If in doubt, say N here.
 
-config QUICC_ENGINE
-	bool "Freescale QUICC Engine (QE) Support"
-	depends on FSL_SOC && PPC32
-	select GENERIC_ALLOCATOR
-	select CRC32
-	help
-	  The QUICC Engine (QE) is a new generation of communications
-	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
-	  Selecting this option means that you wish to build a kernel
-	  for a machine with a QE coprocessor.
-
-config QE_GPIO
-	bool "QE GPIO support"
-	depends on QUICC_ENGINE
-	select ARCH_REQUIRE_GPIOLIB
-	help
-	  Say Y here if you're going to use hardware that connects to the
-	  QE GPIOs.
-
 config CPM2
 	bool "Enable support for the CPM2 (Communications Processor Module)"
 	depends on (FSL_SOC_BOOKE && PPC32) || 8260
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 6993aa8..9d32465 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -28,7 +28,7 @@
 #include <asm/udbg.h>
 #include <asm/io.h>
 #include <asm/cpm.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 
 #include <mm/mmu_decl.h>
 
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/arch/powerpc/sysdev/qe_lib/Kconfig
index 3c25199..2f80075 100644
--- a/arch/powerpc/sysdev/qe_lib/Kconfig
+++ b/arch/powerpc/sysdev/qe_lib/Kconfig
@@ -1,24 +1,14 @@
 #
 # QE Communication options
 #
-
-config UCC_SLOW
-	bool
-	default y if SERIAL_QE
-	help
-	  This option provides qe_lib support to UCC slow
-	  protocols: UART, BISYNC, QMC
-
-config UCC_FAST
-	bool
-	default y if UCC_GETH
+config QE_GPIO
+	bool "QE GPIO support"
+	depends on QUICC_ENGINE
+	select ARCH_REQUIRE_GPIOLIB
 	help
-	  This option provides qe_lib support to UCC fast
-	  protocols: HDLC, Ethernet, ATM, transparent
+	  Say Y here if you're going to use hardware that connects to the
+	  QE GPIOs.
 
-config UCC
-	bool
-	default y if UCC_FAST || UCC_SLOW
 
 config QE_USB
 	bool
diff --git a/arch/powerpc/sysdev/qe_lib/Makefile b/arch/powerpc/sysdev/qe_lib/Makefile
index 9507a27..1b123df 100644
--- a/arch/powerpc/sysdev/qe_lib/Makefile
+++ b/arch/powerpc/sysdev/qe_lib/Makefile
@@ -1,10 +1,6 @@
 #
 # Makefile for the linux ppc-specific parts of QE
 #
-obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o qe_ic.o qe_io.o
-
-obj-$(CONFIG_UCC)	+= ucc.o
-obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
-obj-$(CONFIG_UCC_FAST)	+= ucc_fast.o
+obj-$(CONFIG_QUICC_ENGINE)+= qe_io.o
 obj-$(CONFIG_QE_USB)	+= usb.o
 obj-$(CONFIG_QE_GPIO)	+= gpio.o
diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c
index 521e67a..aa5c11ac 100644
--- a/arch/powerpc/sysdev/qe_lib/gpio.c
+++ b/arch/powerpc/sysdev/qe_lib/gpio.c
@@ -21,7 +21,7 @@
 #include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/export.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 
 struct qe_gpio_chip {
 	struct of_mm_gpio_chip mm_gc;
diff --git a/arch/powerpc/sysdev/qe_lib/qe_io.c b/arch/powerpc/sysdev/qe_lib/qe_io.c
index 7ea0174..7ae59ab 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_io.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_io.c
@@ -21,7 +21,7 @@
 #include <linux/ioport.h>
 
 #include <asm/io.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <asm/prom.h>
 #include <sysdev/fsl_soc.h>
 
diff --git a/arch/powerpc/sysdev/qe_lib/usb.c b/arch/powerpc/sysdev/qe_lib/usb.c
index 27f23bd..111f7ab 100644
--- a/arch/powerpc/sysdev/qe_lib/usb.c
+++ b/arch/powerpc/sysdev/qe_lib/usb.c
@@ -17,8 +17,8 @@
 #include <linux/errno.h>
 #include <linux/export.h>
 #include <linux/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
 int qe_usb_clock_set(enum qe_clock clk, int rate)
 {
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index dda4927..9ff5932 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -47,3 +47,4 @@ obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
 obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
+obj-$(CONFIG_QUICC_ENGINE)		+= qe_ic.o
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/drivers/irqchip/qe_ic.c
similarity index 99%
rename from arch/powerpc/sysdev/qe_lib/qe_ic.c
rename to drivers/irqchip/qe_ic.c
index 6512cd8..e31d95b 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/drivers/irqchip/qe_ic.c
@@ -27,7 +27,7 @@
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/prom.h>
-#include <asm/qe_ic.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #include "qe_ic.h"
 
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.h b/drivers/irqchip/qe_ic.h
similarity index 97%
rename from arch/powerpc/sysdev/qe_lib/qe_ic.h
rename to drivers/irqchip/qe_ic.h
index efef7ab..9f15cc4 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.h
+++ b/drivers/irqchip/qe_ic.h
@@ -1,5 +1,5 @@
 /*
- * arch/powerpc/sysdev/qe_lib/qe_ic.h
+ * drivers/irqchip/qe_ic.h
  *
  * QUICC ENGINE Interrupt Controller Header
  *
@@ -16,7 +16,7 @@
 #ifndef _POWERPC_SYSDEV_QE_IC_H
 #define _POWERPC_SYSDEV_QE_IC_H
 
-#include <asm/qe_ic.h>
+#include <linux/fsl/qe/qe_ic.h>
 
 #define NR_QE_IC_INTS		64
 
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
index 3c40f6b..21bdf55 100644
--- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c
+++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c
@@ -29,7 +29,7 @@
 
 #include <asm/io.h>
 #if IS_ENABLED(CONFIG_UCC_GETH)
-#include <asm/ucc.h>	/* for ucc_set_qe_mux_mii_mng() */
+#include <soc/fsl/qe/ucc.h>
 #endif
 
 #include "gianfar.h"
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 4dd40e0..7d24664 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -40,10 +40,10 @@
 #include <asm/uaccess.h>
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
-#include <asm/ucc.h>
-#include <asm/ucc_fast.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
+#include <soc/fsl/qe/ucc.h>
+#include <soc/fsl/qe/ucc_fast.h>
 #include <asm/machdep.h>
 
 #include "ucc_geth.h"
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h
index 75f3371..5da19b4 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.h
+++ b/drivers/net/ethernet/freescale/ucc_geth.h
@@ -22,11 +22,11 @@
 #include <linux/list.h>
 #include <linux/if_ether.h>
 
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
-#include <asm/ucc.h>
-#include <asm/ucc_fast.h>
+#include <soc/fsl/qe/ucc.h>
+#include <soc/fsl/qe/ucc_fast.h>
 
 #define DRV_DESC "QE UCC Gigabit Ethernet Controller"
 #define DRV_NAME "ucc_geth"
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index d8bde82..676737a 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,5 +1,6 @@
 menu "SOC (System On Chip) specific Drivers"
 
+source "drivers/soc/fsl/qe/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/ti/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 70042b2..0259e23 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -2,6 +2,7 @@
 # Makefile for the Linux Kernel SOC specific device drivers.
 #
 
+obj-y				+= fsl/
 obj-$(CONFIG_ARCH_MEDIATEK)	+= mediatek/
 obj-$(CONFIG_ARCH_QCOM)		+= qcom/
 obj-$(CONFIG_ARCH_TEGRA)	+= tegra/
diff --git a/drivers/soc/fsl/Makefile b/drivers/soc/fsl/Makefile
new file mode 100644
index 0000000..7c7d045
--- /dev/null
+++ b/drivers/soc/fsl/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the Linux Kernel SOC fsl specific device drivers
+#
+
+obj-$(CONFIG_QUICC_ENGINE)		+= qe/
diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/drivers/soc/fsl/qe/Kconfig
similarity index 50%
copy from arch/powerpc/sysdev/qe_lib/Kconfig
copy to drivers/soc/fsl/qe/Kconfig
index 3c25199..283fe0d 100644
--- a/arch/powerpc/sysdev/qe_lib/Kconfig
+++ b/drivers/soc/fsl/qe/Kconfig
@@ -2,6 +2,17 @@
 # QE Communication options
 #
 
+config QUICC_ENGINE
+	bool "Freescale QUICC Engine (QE) Support"
+	depends on FSL_SOC && PPC32
+	select GENERIC_ALLOCATOR
+	select CRC32
+	help
+	  The QUICC Engine (QE) is a new generation of communications
+	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
+	  Selecting this option means that you wish to build a kernel
+	  for a machine with a QE coprocessor.
+
 config UCC_SLOW
 	bool
 	default y if SERIAL_QE
@@ -19,9 +30,3 @@ config UCC_FAST
 config UCC
 	bool
 	default y if UCC_FAST || UCC_SLOW
-
-config QE_USB
-	bool
-	default y if USB_FSL_QE
-	help
-	  QE USB Controller support
diff --git a/drivers/soc/fsl/qe/Makefile b/drivers/soc/fsl/qe/Makefile
new file mode 100644
index 0000000..51c9dce
--- /dev/null
+++ b/drivers/soc/fsl/qe/Makefile
@@ -0,0 +1,9 @@
+#
+#Makefile for the Linux fsl parts of QE
+#
+
+
+obj-$(CONFIG_QUICC_ENGINE)+= qe.o qe_common.o
+obj-$(CONFIG_UCC)	+= ucc.o
+obj-$(CONFIG_UCC_SLOW)	+= ucc_slow.o
+obj-$(CONFIG_UCC_FAST)	+= ucc_fast.o
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/drivers/soc/fsl/qe/qe.c
similarity index 99%
rename from arch/powerpc/sysdev/qe_lib/qe.c
rename to drivers/soc/fsl/qe/qe.c
index 3f9f596..d8fd4cd 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/drivers/soc/fsl/qe/qe.c
@@ -31,8 +31,8 @@
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <asm/prom.h>
 #include <asm/rheap.h>
 
diff --git a/arch/powerpc/sysdev/qe_lib/qe_common.c b/drivers/soc/fsl/qe/qe_common.c
similarity index 99%
rename from arch/powerpc/sysdev/qe_lib/qe_common.c
rename to drivers/soc/fsl/qe/qe_common.c
index 0aa74ca..2541a5f 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_common.c
+++ b/drivers/soc/fsl/qe/qe_common.c
@@ -22,7 +22,7 @@
 #include <linux/slab.h>
 
 #include <linux/io.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 
 static struct gen_pool *muram_pool;
 static spinlock_t cpm_muram_lock;
diff --git a/arch/powerpc/sysdev/qe_lib/ucc.c b/drivers/soc/fsl/qe/ucc.c
similarity index 98%
rename from arch/powerpc/sysdev/qe_lib/ucc.c
rename to drivers/soc/fsl/qe/ucc.c
index 621575b..b59d335 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc.c
+++ b/drivers/soc/fsl/qe/ucc.c
@@ -21,9 +21,9 @@
 
 #include <asm/irq.h>
 #include <asm/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
-#include <asm/ucc.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
+#include <soc/fsl/qe/ucc.h>
 
 int ucc_set_qe_mux_mii_mng(unsigned int ucc_num)
 {
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_fast.c b/drivers/soc/fsl/qe/ucc_fast.c
similarity index 98%
rename from arch/powerpc/sysdev/qe_lib/ucc_fast.c
rename to drivers/soc/fsl/qe/ucc_fast.c
index 65aaf15..a768931 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_fast.c
+++ b/drivers/soc/fsl/qe/ucc_fast.c
@@ -21,11 +21,11 @@
 #include <linux/export.h>
 
 #include <asm/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
-#include <asm/ucc.h>
-#include <asm/ucc_fast.h>
+#include <soc/fsl/qe/ucc.h>
+#include <soc/fsl/qe/ucc_fast.h>
 
 void ucc_fast_dump_regs(struct ucc_fast_private * uccf)
 {
diff --git a/arch/powerpc/sysdev/qe_lib/ucc_slow.c b/drivers/soc/fsl/qe/ucc_slow.c
similarity index 98%
rename from arch/powerpc/sysdev/qe_lib/ucc_slow.c
rename to drivers/soc/fsl/qe/ucc_slow.c
index 5f91628..9334bdb 100644
--- a/arch/powerpc/sysdev/qe_lib/ucc_slow.c
+++ b/drivers/soc/fsl/qe/ucc_slow.c
@@ -21,11 +21,11 @@
 #include <linux/export.h>
 
 #include <asm/io.h>
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
-#include <asm/ucc.h>
-#include <asm/ucc_slow.h>
+#include <soc/fsl/qe/ucc.h>
+#include <soc/fsl/qe/ucc_slow.h>
 
 u32 ucc_slow_get_qe_cr_subblock(int uccs_num)
 {
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 9c46a30..bcb26bb 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -16,7 +16,7 @@
  * option) any later version.
  */
 #include <asm/cpm.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <linux/dma-mapping.h>
 #include <linux/fsl_devices.h>
 #include <linux/kernel.h>
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 7d2532b..0b2cccd 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -31,7 +31,7 @@
 #include <linux/dma-mapping.h>
 
 #include <linux/fs_uart_pd.h>
-#include <asm/ucc_slow.h>
+#include <soc/fsl/qe/ucc_slow.h>
 
 #include <linux/firmware.h>
 #include <asm/reg.h>
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index e0822f1..f44659e 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -38,7 +38,7 @@
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/otg.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <asm/cpm.h>
 #include <asm/dma.h>
 #include <asm/reg.h>
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index c6cebb9..0960f41 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -31,7 +31,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 #include <linux/slab.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <asm/fsl_gtm.h>
 #include "fhci.h"
 
diff --git a/drivers/usb/host/fhci-hub.c b/drivers/usb/host/fhci-hub.c
index 3bacdd7..60d55eb 100644
--- a/drivers/usb/host/fhci-hub.c
+++ b/drivers/usb/host/fhci-hub.c
@@ -24,7 +24,7 @@
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include <linux/gpio.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include "fhci.h"
 
 /* virtual root hub specific descriptor */
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c
index 95ca598..a9609a3 100644
--- a/drivers/usb/host/fhci-sched.c
+++ b/drivers/usb/host/fhci-sched.c
@@ -25,7 +25,7 @@
 #include <linux/io.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/qe.h>
 #include <asm/fsl_gtm.h>
 #include "fhci.h"
 
diff --git a/drivers/usb/host/fhci.h b/drivers/usb/host/fhci.h
index 154e6a0..3fc82c1 100644
--- a/drivers/usb/host/fhci.h
+++ b/drivers/usb/host/fhci.h
@@ -27,8 +27,8 @@
 #include <linux/io.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
-#include <asm/qe.h>
-#include <asm/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
 
 #define USB_CLOCK	48000000
 
diff --git a/arch/powerpc/include/asm/qe_ic.h b/include/linux/fsl/qe/qe_ic.h
similarity index 100%
rename from arch/powerpc/include/asm/qe_ic.h
rename to include/linux/fsl/qe/qe_ic.h
diff --git a/arch/powerpc/include/asm/immap_qe.h b/include/soc/fsl/qe/immap_qe.h
similarity index 100%
rename from arch/powerpc/include/asm/immap_qe.h
rename to include/soc/fsl/qe/immap_qe.h
diff --git a/arch/powerpc/include/asm/qe.h b/include/soc/fsl/qe/qe.h
similarity index 99%
rename from arch/powerpc/include/asm/qe.h
rename to include/soc/fsl/qe/qe.h
index c2dd8e6..d0694e0 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/include/soc/fsl/qe/qe.h
@@ -21,7 +21,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <asm/cpm.h>
-#include <asm/immap_qe.h>
+#include <soc/fsl/qe/immap_qe.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/types.h>
diff --git a/arch/powerpc/include/asm/ucc.h b/include/soc/fsl/qe/ucc.h
similarity index 96%
rename from arch/powerpc/include/asm/ucc.h
rename to include/soc/fsl/qe/ucc.h
index 6927ac2..894f14c 100644
--- a/arch/powerpc/include/asm/ucc.h
+++ b/include/soc/fsl/qe/ucc.h
@@ -15,8 +15,8 @@
 #ifndef __UCC_H__
 #define __UCC_H__
 
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
 #define STATISTICS
 
diff --git a/arch/powerpc/include/asm/ucc_fast.h b/include/soc/fsl/qe/ucc_fast.h
similarity index 98%
rename from arch/powerpc/include/asm/ucc_fast.h
rename to include/soc/fsl/qe/ucc_fast.h
index 72ea9ba..df8ea79 100644
--- a/arch/powerpc/include/asm/ucc_fast.h
+++ b/include/soc/fsl/qe/ucc_fast.h
@@ -16,10 +16,10 @@
 
 #include <linux/kernel.h>
 
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
-#include <asm/ucc.h>
+#include <soc/fsl/qe/ucc.h>
 
 /* Receive BD's status */
 #define R_E	0x80000000	/* buffer empty */
diff --git a/arch/powerpc/include/asm/ucc_slow.h b/include/soc/fsl/qe/ucc_slow.h
similarity index 99%
rename from arch/powerpc/include/asm/ucc_slow.h
rename to include/soc/fsl/qe/ucc_slow.h
index 233ef5f..6c0573a 100644
--- a/arch/powerpc/include/asm/ucc_slow.h
+++ b/include/soc/fsl/qe/ucc_slow.h
@@ -17,10 +17,10 @@
 
 #include <linux/kernel.h>
 
-#include <asm/immap_qe.h>
-#include <asm/qe.h>
+#include <soc/fsl/qe/immap_qe.h>
+#include <soc/fsl/qe/qe.h>
 
-#include <asm/ucc.h>
+#include <soc/fsl/qe/ucc.h>
 
 /* transmit BD's status */
 #define T_R	0x80000000	/* ready bit */
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-14  7:16 ` [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram Zhao Qiang
@ 2015-10-23  2:59   ` Scott Wood
  2015-10-23  7:06     ` Zhao Qiang
  0 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23  2:59 UTC (permalink / raw)
  To: Zhao Qiang; +Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus

On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> Use genalloc to manage CPM/QE muram instead of rheap.
> 
> Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> ---
> Changes for v9:
>       - splitted from patch 3/5, modify cpm muram management functions.
> Changes for v10:
>       - modify cpm muram first, then move to qe_common
>       - modify commit.
> Changes for v11:
>       - factor out the common alloc code
>       - modify min_alloc_order to zero for cpm_muram_alloc_fixed.
> Changes for v12:
>       - Nil 
> 
>  arch/powerpc/include/asm/cpm.h   |   1 +
>  arch/powerpc/platforms/Kconfig   |   2 +-
>  arch/powerpc/sysdev/cpm_common.c | 129 +++++++++++++++++++++++++++---------
> ---
>  3 files changed, 93 insertions(+), 39 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
> index 4398a6c..0e1ac3f 100644
> --- a/arch/powerpc/include/asm/cpm.h
> +++ b/arch/powerpc/include/asm/cpm.h
> @@ -161,6 +161,7 @@ int cpm_muram_init(void);
>  unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
>  int cpm_muram_free(unsigned long offset);
>  unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long 
> size);
> +unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
>  void __iomem *cpm_muram_addr(unsigned long offset);
>  unsigned long cpm_muram_offset(void __iomem *addr);
>  dma_addr_t cpm_muram_dma(void __iomem *addr);
> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> index b7f9c40..01626be7 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -275,7 +275,7 @@ config TAU_AVERAGE
>  config QUICC_ENGINE
>       bool "Freescale QUICC Engine (QE) Support"
>       depends on FSL_SOC && PPC32
> -     select PPC_LIB_RHEAP
> +     select GENERIC_ALLOCATOR
>       select CRC32
>       help
>         The QUICC Engine (QE) is a new generation of communications
> diff --git a/arch/powerpc/sysdev/cpm_common.c 
> b/arch/powerpc/sysdev/cpm_common.c
> index 4f78695..ff47072 100644
> --- a/arch/powerpc/sysdev/cpm_common.c
> +++ b/arch/powerpc/sysdev/cpm_common.c
> @@ -17,6 +17,7 @@
>   * published by the Free Software Foundation.
>   */
>  
> +#include <linux/genalloc.h>
>  #include <linux/init.h>
>  #include <linux/of_device.h>
>  #include <linux/spinlock.h>
> @@ -27,7 +28,6 @@
>  
>  #include <asm/udbg.h>
>  #include <asm/io.h>
> -#include <asm/rheap.h>
>  #include <asm/cpm.h>
>  
>  #include <mm/mmu_decl.h>
> @@ -65,14 +65,22 @@ void __init udbg_init_cpm(void)
>  }
>  #endif
>  
> +static struct gen_pool *muram_pool;
>  static spinlock_t cpm_muram_lock;
> -static rh_block_t cpm_boot_muram_rh_block[16];
> -static rh_info_t cpm_muram_info;
>  static u8 __iomem *muram_vbase;
>  static phys_addr_t muram_pbase;
>  
> -/* Max address size we deal with */
> +struct muram_block {
> +     struct list_head head;
> +     unsigned long start;
> +     int size;
> +};
> +
> +static LIST_HEAD(muram_block_list);
> +
> +/* max address size we deal with */
>  #define OF_MAX_ADDR_CELLS    4
> +#define GENPOOL_OFFSET               (4096 * 8)
>  
>  int cpm_muram_init(void)
>  {
> @@ -87,50 +95,52 @@ int cpm_muram_init(void)
>               return 0;
>  
>       spin_lock_init(&cpm_muram_lock);
> -     /* initialize the info header */
> -     rh_init(&cpm_muram_info, 1,
> -             sizeof(cpm_boot_muram_rh_block) /
> -             sizeof(cpm_boot_muram_rh_block[0]),
> -             cpm_boot_muram_rh_block);
> -
>       np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");
>       if (!np) {
>               /* try legacy bindings */
>               np = of_find_node_by_name(NULL, "data-only");
>               if (!np) {
> -                     printk(KERN_ERR "Cannot find CPM muram data node");
> +                     pr_err("Cannot find CPM muram data node");
>                       ret = -ENODEV;
> -                     goto out;
> +                     goto out_muram;
>               }
>       }
>  
> +     muram_pool = gen_pool_create(0, -1);
>       muram_pbase = of_translate_address(np, zero);
>       if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) {
> -             printk(KERN_ERR "Cannot translate zero through CPM muram node");
> +             pr_err("Cannot translate zero through CPM muram node");
>               ret = -ENODEV;
> -             goto out;
> +             goto out_pool;
>       }
>  
>       while (of_address_to_resource(np, i++, &r) == 0) {
>               if (r.end > max)
>                       max = r.end;
> +             ret = gen_pool_add(muram_pool, r.start - muram_pbase +
> +                                GENPOOL_OFFSET, resource_size(&r), -1);
> +             if (ret) {
> +                             pr_err("QE: couldn't add muram to pool!\n");
> +                             goto out_pool;
> +                     }
>  

Whitespace

> -             rh_attach_region(&cpm_muram_info, r.start - muram_pbase,
> -                              resource_size(&r));
>       }
>  
>       muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1);
>       if (!muram_vbase) {
> -             printk(KERN_ERR "Cannot map CPM muram");
> +             pr_err("Cannot map QE muram");
>               ret = -ENOMEM;
> +             goto out_pool;
>       }
> -
> -out:
> +     goto out_muram;
> +out_pool:
> +     gen_pool_destroy(muram_pool);
> +out_muram:
>       of_node_put(np);
>       return ret;
>  }
>  
> -/**
> +/*
>   * cpm_muram_alloc - allocate the requested size worth of multi-user ram
>   * @size: number of bytes to allocate
>   * @align: requested alignment, in bytes
> @@ -141,59 +151,102 @@ out:
>   */
>  unsigned long cpm_muram_alloc(unsigned long size, unsigned long align)
>  {
> -     unsigned long start;
>       unsigned long flags;
> -
> +     unsigned long start;
> +     static struct genpool_data_align muram_pool_data;
>       spin_lock_irqsave(&cpm_muram_lock, flags);
> -     cpm_muram_info.alignment = align;
> -     start = rh_alloc(&cpm_muram_info, size, "commproc");
> -     memset(cpm_muram_addr(start), 0, size);
> +     muram_pool_data.align = align;
> +     gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
> +                       &muram_pool_data);
> +     start = cpm_muram_alloc_common(size, &muram_pool_data);
>       spin_unlock_irqrestore(&cpm_muram_lock, flags);
> -
>       return start;
>  }
>  EXPORT_SYMBOL(cpm_muram_alloc);

Why is muram_pool_data static?  Why is it being passed to 
gen_pool_set_algo()?  The whole reason we're adding gen_pool_alloc_data() is 
to avoid that.  Do we need gen_pool_alloc_algo() too?

Also, please maintain a blank line between variable declarations and code.

> +     return (unsigned long) -ENOMEM;

No space after casts.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-14  7:16 ` [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common Zhao Qiang
@ 2015-10-23  3:09   ` Scott Wood
  2015-10-23  7:45       ` Zhao Qiang
  0 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23  3:09 UTC (permalink / raw)
  To: Zhao Qiang; +Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus

On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> QE and CPM have the same muram, they use the same management
> functions. Now QE support both ARM and PowerPC, it is necessary
> to move QE to "driver/soc", so move the muram management functions
> from cpm_common to qe_common for preparing to move QE code to "driver/soc"
> 
> Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> ---
> Changes for v2:
>       - no changes
> Changes for v3:
>       - no changes
> Changes for v4:
>       - no changes
> Changes for v5:
>       - no changes
> Changes for v6:
>       - using genalloc instead rheap to manage QE MURAM
>       - remove qe_reset from platform file, using 
>       - subsys_initcall to call qe_init function.
> Changes for v7:
>       - move this patch from 3/3 to 2/3
>       - convert cpm with genalloc
>       - check for gen_pool allocation failure
> Changes for v8:
>       - rebase
>       - move BD_SC_* macro instead of copy
> Changes for v9:
>       - doesn't modify CPM, add a new patch to modify.
>       - rebase
> Changes for v10:
>       - rebase
> Changes for v11:
>       - remove renaming
>       - delete removing qe_reset and delete adding qe_init.
> Changes for v12:
>       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it. 

Why is the SPI change part of this patch?  Why is it even part of this 
patchset, rather than an independent patch sent to the SPI list and 
maintainer?  If it's tied to other changes you're making, explain that.  As 
is, there is zero mention of the SPI change in the part of the e-mail that 
will become the git changelog.

> 
>  arch/powerpc/include/asm/cpm.h                     |  44 -----
>  arch/powerpc/include/asm/qe.h                      |  16 ++
>  arch/powerpc/sysdev/cpm_common.c                   | 210 +-----------------
> ---
>  arch/powerpc/sysdev/qe_lib/Makefile                |   2 +-
>  .../sysdev/{cpm_common.c => qe_lib/qe_common.c}    | 188 +-----------------
>  drivers/spi/Kconfig                                |   1 +
>  6 files changed, 28 insertions(+), 433 deletions(-)
>  copy arch/powerpc/sysdev/{cpm_common.c => qe_lib/qe_common.c} (54%)
> 
> diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
> index 0e1ac3f..05a1c15 100644
> --- a/arch/powerpc/include/asm/cpm.h
> +++ b/arch/powerpc/include/asm/cpm.h
> @@ -155,50 +155,6 @@ typedef struct cpm_buf_desc {
>   */
>  #define BD_I2C_START         (0x0400)
>  
> -int cpm_muram_init(void);
> -
> -#if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE)
> -unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
> -int cpm_muram_free(unsigned long offset);
> -unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long 
> size);
> -unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
> -void __iomem *cpm_muram_addr(unsigned long offset);
> -unsigned long cpm_muram_offset(void __iomem *addr);
> -dma_addr_t cpm_muram_dma(void __iomem *addr);
> -#else
> -static inline unsigned long cpm_muram_alloc(unsigned long size,
> -                                         unsigned long align)
> -{
> -     return -ENOSYS;
> -}
> -
> -static inline int cpm_muram_free(unsigned long offset)
> -{
> -     return -ENOSYS;
> -}
> -
> -static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset,
> -                                               unsigned long size)
> -{
> -     return -ENOSYS;
> -}
> -
> -static inline void __iomem *cpm_muram_addr(unsigned long offset)
> -{
> -     return NULL;
> -}
> -
> -static inline unsigned long cpm_muram_offset(void __iomem *addr)
> -{
> -     return -ENOSYS;
> -}
> -
> -static inline dma_addr_t cpm_muram_dma(void __iomem *addr)
> -{
> -     return 0;
> -}
> -#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
> -
>  #ifdef CONFIG_CPM
>  int cpm_command(u32 command, u8 opcode);
>  #else
> diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
> index 32b9bfa..c2dd8e6 100644
> --- a/arch/powerpc/include/asm/qe.h
> +++ b/arch/powerpc/include/asm/qe.h
> @@ -16,11 +16,15 @@
>  #define _ASM_POWERPC_QE_H
>  #ifdef __KERNEL__
>  
> +#include <linux/compiler.h>
>  #include <linux/spinlock.h>
>  #include <linux/errno.h>
>  #include <linux/err.h>
>  #include <asm/cpm.h>
>  #include <asm/immap_qe.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/types.h>
>  
>  #define QE_NUM_OF_SNUM       256     /* There are 256 serial number in QE */
>  #define QE_NUM_OF_BRGS       16
> @@ -92,6 +96,18 @@ extern void qe_reset(void);
>  static inline void qe_reset(void) {}
>  #endif
>  
> +int cpm_muram_init(void);
> +
> +#if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE)
> +unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
> +int cpm_muram_free(unsigned long offset);
> +unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long 
> size);
> +unsigned long cpm_muram_alloc_common(unsigned long size, void *data);
> +void __iomem *cpm_muram_addr(unsigned long offset);
> +unsigned long cpm_muram_offset(void __iomem *addr);
> +dma_addr_t cpm_muram_dma(void __iomem *addr);
> +#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */

Why did you eliminate the stubs for when CPM/QUICC_ENGINE aren't selected?


> diff --git a/arch/powerpc/sysdev/cpm_common.c 
> b/arch/powerpc/sysdev/qe_lib/qe_common.c
> similarity index 54%
> copy from arch/powerpc/sysdev/cpm_common.c
> copy to arch/powerpc/sysdev/qe_lib/qe_common.c
> index ff47072..0aa74ca 100644
> --- a/arch/powerpc/sysdev/cpm_common.c
> +++ b/arch/powerpc/sysdev/qe_lib/qe_common.c
> @@ -1,23 +1,18 @@
>  /*
> - * Common CPM code
> + * Freescale QE common code
>   *
> - * Author: Scott Wood <scottwood@freescale.com>
> + * Author: Zhao Qiang  <qiang.zhao@freescale.com>
>   *
> - * Copyright 2007-2008,2010 Freescale Semiconductor, Inc.
> - *
> - * Some parts derived from commproc.c/cpm2_common.c, which is:
> - * Copyright (c) 1997 Dan error_act (dmalek@jlc.net)
> - * Copyright (c) 1999-2001 Dan Malek <dan@embeddedalley.com>
> - * Copyright (c) 2000 MontaVista Software, Inc (source@mvista.com)
> - * 2006 (c) MontaVista Software, Inc.
> - * Vitaly Bordug <vbordug@ru.mvista.com>
> + * Copyright 2015 Freescale Semiconductor, Inc.

Please keep copyright notices intact when creating a new file derived from an 
existing file, unless you can show via git history that none of the lines 
copied are relevant.

Certainly not all of this code was first published in 2015.

>   *
>   * This program is free software; you can redistribute it and/or modify
> - * it under the terms of version 2 of the GNU General Public License as
> - * published by the Free Software Foundation.
> + * 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 option) any later version.

You don't get to add that "any later version" option to existing code 
copyrighted by others.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 5/6] QE: use subsys_initcall to init qe
  2015-10-14  7:16 ` [PATCH v12 5/6] QE: use subsys_initcall to init qe Zhao Qiang
@ 2015-10-23  3:11   ` Scott Wood
  0 siblings, 0 replies; 32+ messages in thread
From: Scott Wood @ 2015-10-23  3:11 UTC (permalink / raw)
  To: Zhao Qiang; +Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus

On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> diff --git a/arch/powerpc/sysdev/qe_lib/qe.c > b/arch/powerpc/sysdev/qe_lib/qe.c
> index c2518cd..3f9f596 100644
> --- a/arch/powerpc/sysdev/qe_lib/qe.c
> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> @@ -671,6 +671,21 @@ unsigned int qe_get_num_of_snums(void)
>  }
>  EXPORT_SYMBOL(qe_get_num_of_snums);
>  
> +static int __init qe_init(void)
> +{
> +     struct device_node *np;
> +
> +     np = of_find_compatible_node(NULL, NULL, "fsl,qe");
> +     if (!np) {
> +             pr_err("%s: Could not find Quicc Engine node\n", __func__);
> +             return -ENODEV;
> +     }
> +     qe_reset();
> +     of_node_put(np);
> +     return 0;
> +}
> +subsys_initcall(qe_init);

Do not print an error, just because QE is not present.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
  2015-10-14  7:16 ` [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc Zhao Qiang
@ 2015-10-23  3:19   ` Scott Wood
  2015-10-23  7:49       ` Zhao Qiang
  0 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23  3:19 UTC (permalink / raw)
  To: Zhao Qiang; +Cc: linux-kernel, linuxppc-dev, lauraa, X.xie, benh, leoli, paulus

On Wed, Oct 14, 2015 at 03:16:08PM +0800, Zhao Qiang wrote:
> diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> index 01626be7..c9541a5 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -272,25 +272,6 @@ config TAU_AVERAGE
>  
>  	  If in doubt, say N here.
>  
> -config QUICC_ENGINE
> -	bool "Freescale QUICC Engine (QE) Support"
> -	depends on FSL_SOC && PPC32
> -	select GENERIC_ALLOCATOR
> -	select CRC32
> -	help
> -	  The QUICC Engine (QE) is a new generation of communications
> -	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
> -	  Selecting this option means that you wish to build a kernel
> -	  for a machine with a QE coprocessor.
> -
> -config QE_GPIO
> -	bool "QE GPIO support"
> -	depends on QUICC_ENGINE
> -	select ARCH_REQUIRE_GPIOLIB
> -	help
> -	  Say Y here if you're going to use hardware that connects to the
> -	  QE GPIOs.

Why was QE_GPIO moved as part of this patch?


> diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig b/drivers/soc/fsl/qe/Kconfig
> similarity index 50%
> copy from arch/powerpc/sysdev/qe_lib/Kconfig
> copy to drivers/soc/fsl/qe/Kconfig
> index 3c25199..283fe0d 100644
> --- a/arch/powerpc/sysdev/qe_lib/Kconfig
> +++ b/drivers/soc/fsl/qe/Kconfig
> @@ -2,6 +2,17 @@
>  # QE Communication options
>  #
>  
> +config QUICC_ENGINE
> +	bool "Freescale QUICC Engine (QE) Support"
> +	depends on FSL_SOC && PPC32
> +	select GENERIC_ALLOCATOR
> +	select CRC32
> +	help
> +	  The QUICC Engine (QE) is a new generation of communications
> +	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
> +	  Selecting this option means that you wish to build a kernel
> +	  for a machine with a QE coprocessor.
> +
>  config UCC_SLOW
>  	bool
>  	default y if SERIAL_QE
> @@ -19,9 +30,3 @@ config UCC_FAST
>  config UCC
>  	bool
>  	default y if UCC_FAST || UCC_SLOW
> -
> -config QE_USB
> -	bool
> -	default y if USB_FSL_QE
> -	help
> -	  QE USB Controller support

Why did some config symbols get moved and others not?

> diff --git a/drivers/soc/fsl/qe/Makefile b/drivers/soc/fsl/qe/Makefile
> new file mode 100644
> index 0000000..51c9dce
> --- /dev/null
> +++ b/drivers/soc/fsl/qe/Makefile
> @@ -0,0 +1,9 @@
> +#
> +#Makefile for the Linux fsl parts of QE
> +#

"fsl parts of QE"?  Are there non-fsl parts of QE?

-Scott

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-23  2:59   ` Scott Wood
@ 2015-10-23  7:06     ` Zhao Qiang
  2015-10-23 20:59       ` Scott Wood
  0 siblings, 1 reply; 32+ messages in thread
From: Zhao Qiang @ 2015-10-23  7:06 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

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

On Fri, 2015-10-23 at 11:00 AM, Wood Scott-B07421 <scottwood@freescale.com> wrote:

> -----Original Message-----

> From: Wood Scott-B07421

> Sent: Friday, October 23, 2015 11:00 AM

> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>

> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;

> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;

> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;

> paulus@samba.org

> Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram

>

> On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:

> > Use genalloc to manage CPM/QE muram instead of rheap.

> >

> > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com<mailto:qiang.zhao@freescale.com>>

> > ---

> > Changes for v9:

> >       - splitted from patch 3/5, modify cpm muram management functions.

> > Changes for v10:

> >       - modify cpm muram first, then move to qe_common

> >       - modify commit.

> > Changes for v11:

> >       - factor out the common alloc code

> >       - modify min_alloc_order to zero for cpm_muram_alloc_fixed.

> > Changes for v12:

> >       - Nil

> >

> >  arch/powerpc/include/asm/cpm.h   |   1 +

> >  arch/powerpc/platforms/Kconfig   |   2 +-

> >  arch/powerpc/sysdev/cpm_common.c | 129

> > +++++++++++++++++++++++++++---------

> > ---

> >  3 files changed, 93 insertions(+), 39 deletions(-)

> >

> > diff --git a/arch/powerpc/include/asm/cpm.h

> > b/arch/powerpc/include/asm/cpm.h index 4398a6c..0e1ac3f 100644

> > --- a/arch/powerpc/include/asm/cpm.h

> > +++ b/arch/powerpc/include/asm/cpm.h

> > @@ -161,6 +161,7 @@ int cpm_muram_init(void);  unsigned long

> > cpm_muram_alloc(unsigned long size, unsigned long align);  int

> > cpm_muram_free(unsigned long offset);  unsigned long

> > cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);

> > +unsigned long cpm_muram_alloc_common(unsigned long size, void *data);

> >  void __iomem *cpm_muram_addr(unsigned long offset);  unsigned long

> > cpm_muram_offset(void __iomem *addr);  dma_addr_t

> cpm_muram_dma(void

> > __iomem *addr); diff --git a/arch/powerpc/platforms/Kconfig

> > b/arch/powerpc/platforms/Kconfig index b7f9c40..01626be7 100644

> > --- a/arch/powerpc/platforms/Kconfig

> > +++ b/arch/powerpc/platforms/Kconfig

> > @@ -275,7 +275,7 @@ config TAU_AVERAGE  config QUICC_ENGINE

> >       bool "Freescale QUICC Engine (QE) Support"

> >       depends on FSL_SOC && PPC32

> > -     select PPC_LIB_RHEAP

> > +     select GENERIC_ALLOCATOR

> >       select CRC32

> >       help

> >         The QUICC Engine (QE) is a new generation of communications

> > diff --git a/arch/powerpc/sysdev/cpm_common.c

> > b/arch/powerpc/sysdev/cpm_common.c

> > index 4f78695..ff47072 100644

> > --- a/arch/powerpc/sysdev/cpm_common.c

> > +++ b/arch/powerpc/sysdev/cpm_common.c

> > @@ -17,6 +17,7 @@

> >   * published by the Free Software Foundation.

> >   */

> >

> > +#include <linux/genalloc.h>

> >  #include <linux/init.h>

> >  #include <linux/of_device.h>

> >  #include <linux/spinlock.h>

> > @@ -27,7 +28,6 @@

> >

> >  #include <asm/udbg.h>

> >  #include <asm/io.h>

> > -#include <asm/rheap.h>

> >  #include <asm/cpm.h>

> >

> >  #include <mm/mmu_decl.h>

> > @@ -65,14 +65,22 @@ void __init udbg_init_cpm(void)  }  #endif

> >

> > +static struct gen_pool *muram_pool;

> >  static spinlock_t cpm_muram_lock;

> > -static rh_block_t cpm_boot_muram_rh_block[16]; -static rh_info_t

> > cpm_muram_info;  static u8 __iomem *muram_vbase;  static phys_addr_t

> > muram_pbase;

> >

> > -/* Max address size we deal with */

> > +struct muram_block {

> > +     struct list_head head;

> > +     unsigned long start;

> > +     int size;

> > +};

> > +

> > +static LIST_HEAD(muram_block_list);

> > +

> > +/* max address size we deal with */

> >  #define OF_MAX_ADDR_CELLS    4

> > +#define GENPOOL_OFFSET               (4096 * 8)

> >

> >  int cpm_muram_init(void)

> >  {

> > @@ -87,50 +95,52 @@ int cpm_muram_init(void)

> >               return 0;

> >

> >       spin_lock_init(&cpm_muram_lock);

> > -     /* initialize the info header */

> > -     rh_init(&cpm_muram_info, 1,

> > -             sizeof(cpm_boot_muram_rh_block) /

> > -             sizeof(cpm_boot_muram_rh_block[0]),

> > -             cpm_boot_muram_rh_block);

> > -

> >       np = of_find_compatible_node(NULL, NULL, "fsl,cpm-muram-data");

> >       if (!np) {

> >               /* try legacy bindings */

> >               np = of_find_node_by_name(NULL, "data-only");

> >               if (!np) {

> > -                     printk(KERN_ERR "Cannot find CPM muram data node");

> > +                     pr_err("Cannot find CPM muram data node");

> >                       ret = -ENODEV;

> > -                     goto out;

> > +                     goto out_muram;

> >               }

> >       }

> >

> > +     muram_pool = gen_pool_create(0, -1);

> >       muram_pbase = of_translate_address(np, zero);

> >       if (muram_pbase == (phys_addr_t)OF_BAD_ADDR) {

> > -             printk(KERN_ERR "Cannot translate zero through CPM muram node");

> > +             pr_err("Cannot translate zero through CPM muram node");

> >               ret = -ENODEV;

> > -             goto out;

> > +             goto out_pool;

> >       }

> >

> >       while (of_address_to_resource(np, i++, &r) == 0) {

> >               if (r.end > max)

> >                       max = r.end;

> > +             ret = gen_pool_add(muram_pool, r.start - muram_pbase +

> > +                                GENPOOL_OFFSET, resource_size(&r), -1);

> > +             if (ret) {

> > +                             pr_err("QE: couldn't add muram to pool!\n");

> > +                             goto out_pool;

> > +                     }

> >

>

> Whitespace

>

> > -             rh_attach_region(&cpm_muram_info, r.start - muram_pbase,

> > -                              resource_size(&r));

> >       }

> >

> >       muram_vbase = ioremap(muram_pbase, max - muram_pbase + 1);

> >       if (!muram_vbase) {

> > -             printk(KERN_ERR "Cannot map CPM muram");

> > +             pr_err("Cannot map QE muram");

> >               ret = -ENOMEM;

> > +             goto out_pool;

> >       }

> > -

> > -out:

> > +     goto out_muram;

> > +out_pool:

> > +     gen_pool_destroy(muram_pool);

> > +out_muram:

> >       of_node_put(np);

> >       return ret;

> >  }

> >

> > -/**

> > +/*

> >   * cpm_muram_alloc - allocate the requested size worth of multi-user ram

> >   * @size: number of bytes to allocate

> >   * @align: requested alignment, in bytes @@ -141,59 +151,102 @@ out:

> >   */

> >  unsigned long cpm_muram_alloc(unsigned long size, unsigned long

> > align)  {

> > -     unsigned long start;

> >       unsigned long flags;

> > -

> > +     unsigned long start;

> > +     static struct genpool_data_align muram_pool_data;

> >       spin_lock_irqsave(&cpm_muram_lock, flags);

> > -     cpm_muram_info.alignment = align;

> > -     start = rh_alloc(&cpm_muram_info, size, "commproc");

> > -     memset(cpm_muram_addr(start), 0, size);

> > +     muram_pool_data.align = align;

> > +     gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,

> > +                       &muram_pool_data);

> > +     start = cpm_muram_alloc_common(size, &muram_pool_data);

> >       spin_unlock_irqrestore(&cpm_muram_lock, flags);

> > -

> >       return start;

> >  }

> >  EXPORT_SYMBOL(cpm_muram_alloc);

>

> Why is muram_pool_data static?  Why is it being passed to

> gen_pool_set_algo()?

Cpm_muram use both align algo and fixed algo, so we need to set corresponding algo and

Algo data.



>The whole reason we're adding gen_pool_alloc_data()

> is to avoid that.  Do we need gen_pool_alloc_algo() too?



We add gen_pool_alloc_data() to pass data to algo, because align algo and fixed algo,

Because align and fixed algos need specific data.



>

> Also, please maintain a blank line between variable declarations and code.

>

> > +     return (unsigned long) -ENOMEM;

>

> No space after casts.

>

> -Scott



[-- Attachment #2: Type: text/html, Size: 22757 bytes --]

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-23  3:09   ` Scott Wood
@ 2015-10-23  7:45       ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-23  7:45 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2434 bytes --]

On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421 <scottwood@freescale.com> wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, October 23, 2015 11:10 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> qe_common
> 
> On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > QE and CPM have the same muram, they use the same management
> > functions. Now QE support both ARM and PowerPC, it is necessary to
> > move QE to "driver/soc", so move the muram management functions from
> > cpm_common to qe_common for preparing to move QE code to "driver/soc"
> >
> > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > ---
> > Changes for v2:
> >       - no changes
> > Changes for v3:
> >       - no changes
> > Changes for v4:
> >       - no changes
> > Changes for v5:
> >       - no changes
> > Changes for v6:
> >       - using genalloc instead rheap to manage QE MURAM
> >       - remove qe_reset from platform file, using
> >       - subsys_initcall to call qe_init function.
> > Changes for v7:
> >       - move this patch from 3/3 to 2/3
> >       - convert cpm with genalloc
> >       - check for gen_pool allocation failure Changes for v8:
> >       - rebase
> >       - move BD_SC_* macro instead of copy Changes for v9:
> >       - doesn't modify CPM, add a new patch to modify.
> >       - rebase
> > Changes for v10:
> >       - rebase
> > Changes for v11:
> >       - remove renaming
> >       - delete removing qe_reset and delete adding qe_init.
> > Changes for v12:
> >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it.
> 
> Why is the SPI change part of this patch?  Why is it even part of this patchset,
> rather than an independent patch sent to the SPI list and maintainer?  If it's tied
> to other changes you're making, explain that.  As is, there is zero mention of
> the SPI change in the part of the e-mail that will become the git changelog.
> 
This SPI_FSL_CPM is cpm-spi, it is part of CPM.

-Zhao
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
@ 2015-10-23  7:45       ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-23  7:45 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

T24gRnJpLCAyMDE1LTEwLTIzIGF0IDExOjEwIEFNLCBXb29kIFNjb3R0LUIwNzQyMSA8c2NvdHR3
b29kQGZyZWVzY2FsZS5jb20+IHdyb3RlOg0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0K
PiBGcm9tOiBXb29kIFNjb3R0LUIwNzQyMQ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oNCj4gPiAgICAgICAt
IHJlYmFzZQ0KPiA+IENoYW5nZXMgZm9yIHYxMToNCj4gPiAgICAgICAtIHJlbW92ZSByZW5hbWlu
Zw0KPiA+ICAgICAgIC0gZGVsZXRlIHJlbW92aW5nIHFlX3Jlc2V0IGFuZCBkZWxldGUgYWRkaW5n
IHFlX2luaXQuDQo+ID4gQ2hhbmdlcyBmb3IgdjEyOg0KPiA+ICAgICAgIC0gU1BJX0ZTTF9DUE0g
ZGVwZW5kcyBvbiBRRS1NVVJBTSwgc2VsZWN0IFFVSUNDX0VOR0lORSBmb3IgaXQuDQo+IA0KPiBX
aHkgaXMgdGhlIFNQSSBjaGFuZ2UgcGFydCBvZiB0aGlzIHBhdGNoPyAgV2h5IGlzIGl0IGV2ZW4g
cGFydCBvZiB0aGlzIHBhdGNoc2V0LA0KPiByYXRoZXIgdGhhbiBhbiBpbmRlcGVuZGVudCBwYXRj
aCBzZW50IHRvIHRoZSBTUEkgbGlzdCBhbmQgbWFpbnRhaW5lcj8gIElmIGl0J3MgdGllZA0KPiB0
byBvdGhlciBjaGFuZ2VzIHlvdSdyZSBtYWtpbmcsIGV4cGxhaW4gdGhhdC4gIEFzIGlzLCB0aGVy
ZSBpcyB6ZXJvIG1lbnRpb24gb2YNCj4gdGhlIFNQSSBjaGFuZ2UgaW4gdGhlIHBhcnQgb2YgdGhl
IGUtbWFpbCB0aGF0IHdpbGwgYmVjb21lIHRoZSBnaXQgY2hhbmdlbG9nLg0KPiANClRoaXMgU1BJ
X0ZTTF9DUE0gaXMgY3BtLXNwaSwgaXQgaXMgcGFydCBvZiBDUE0uDQoNCi1aaGFvDQo=

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
  2015-10-23  3:19   ` Scott Wood
@ 2015-10-23  7:49       ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-23  7:49 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

On Fri, Oct 23, 2015 at 11:20 AM, Wood Scott-B07421 <scottwood@freescale.com> wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, October 23, 2015 11:20 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
> 
> On Wed, Oct 14, 2015 at 03:16:08PM +0800, Zhao Qiang wrote:
> 
> 
> > diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig
> > b/drivers/soc/fsl/qe/Kconfig similarity index 50% copy from
> > arch/powerpc/sysdev/qe_lib/Kconfig
> > copy to drivers/soc/fsl/qe/Kconfig
> > index 3c25199..283fe0d 100644
> > --- a/arch/powerpc/sysdev/qe_lib/Kconfig
> > +++ b/drivers/soc/fsl/qe/Kconfig
> > @@ -2,6 +2,17 @@
> >  # QE Communication options
> >  #
> >
> > +config QUICC_ENGINE
> > +	bool "Freescale QUICC Engine (QE) Support"
> > +	depends on FSL_SOC && PPC32
> > +	select GENERIC_ALLOCATOR
> > +	select CRC32
> > +	help
> > +	  The QUICC Engine (QE) is a new generation of communications
> > +	  coprocessors on Freescale embedded CPUs (akin to CPM in older
> chips).
> > +	  Selecting this option means that you wish to build a kernel
> > +	  for a machine with a QE coprocessor.
> > +
> >  config UCC_SLOW
> >  	bool
> >  	default y if SERIAL_QE
> > @@ -19,9 +30,3 @@ config UCC_FAST
> >  config UCC
> >  	bool
> >  	default y if UCC_FAST || UCC_SLOW
> > -
> > -config QE_USB
> > -	bool
> > -	default y if USB_FSL_QE
> > -	help
> > -	  QE USB Controller support
> 
> Why did some config symbols get moved and others not?

Because QE_USB should be putted under drivers/usb,
It is independent of this patchset.

-Zhao

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
@ 2015-10-23  7:49       ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-23  7:49 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

On Fri, Oct 23, 2015 at 11:20 AM, Wood Scott-B07421 <scottwood@freescale.co=
m> wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, October 23, 2015 11:20 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
>=20
> On Wed, Oct 14, 2015 at 03:16:08PM +0800, Zhao Qiang wrote:
>=20
>=20
> > diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig
> > b/drivers/soc/fsl/qe/Kconfig similarity index 50% copy from
> > arch/powerpc/sysdev/qe_lib/Kconfig
> > copy to drivers/soc/fsl/qe/Kconfig
> > index 3c25199..283fe0d 100644
> > --- a/arch/powerpc/sysdev/qe_lib/Kconfig
> > +++ b/drivers/soc/fsl/qe/Kconfig
> > @@ -2,6 +2,17 @@
> >  # QE Communication options
> >  #
> >
> > +config QUICC_ENGINE
> > +	bool "Freescale QUICC Engine (QE) Support"
> > +	depends on FSL_SOC && PPC32
> > +	select GENERIC_ALLOCATOR
> > +	select CRC32
> > +	help
> > +	  The QUICC Engine (QE) is a new generation of communications
> > +	  coprocessors on Freescale embedded CPUs (akin to CPM in older
> chips).
> > +	  Selecting this option means that you wish to build a kernel
> > +	  for a machine with a QE coprocessor.
> > +
> >  config UCC_SLOW
> >  	bool
> >  	default y if SERIAL_QE
> > @@ -19,9 +30,3 @@ config UCC_FAST
> >  config UCC
> >  	bool
> >  	default y if UCC_FAST || UCC_SLOW
> > -
> > -config QE_USB
> > -	bool
> > -	default y if USB_FSL_QE
> > -	help
> > -	  QE USB Controller support
>=20
> Why did some config symbols get moved and others not?

Because QE_USB should be putted under drivers/usb,
It is independent of this patchset.

-Zhao

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
  2015-10-23  7:49       ` Zhao Qiang
  (?)
@ 2015-10-23 20:55       ` Scott Wood
  2015-10-26  2:33           ` Zhao Qiang
  -1 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23 20:55 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Fri, 2015-10-23 at 02:49 -0500, Zhao Qiang-B45475 wrote:
> On Fri, Oct 23, 2015 at 11:20 AM, Wood Scott-B07421 <scottwood@freescale.com
> > wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Friday, October 23, 2015 11:20 AM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
> > 
> > On Wed, Oct 14, 2015 at 03:16:08PM +0800, Zhao Qiang wrote:
> > 
> > 
> > > diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig
> > > b/drivers/soc/fsl/qe/Kconfig similarity index 50% copy from
> > > arch/powerpc/sysdev/qe_lib/Kconfig
> > > copy to drivers/soc/fsl/qe/Kconfig
> > > index 3c25199..283fe0d 100644
> > > --- a/arch/powerpc/sysdev/qe_lib/Kconfig
> > > +++ b/drivers/soc/fsl/qe/Kconfig
> > > @@ -2,6 +2,17 @@
> > >  # QE Communication options
> > >  #
> > > 
> > > +config QUICC_ENGINE
> > > + bool "Freescale QUICC Engine (QE) Support"
> > > + depends on FSL_SOC && PPC32
> > > + select GENERIC_ALLOCATOR
> > > + select CRC32
> > > + help
> > > +   The QUICC Engine (QE) is a new generation of communications
> > > +   coprocessors on Freescale embedded CPUs (akin to CPM in older
> > chips).
> > > +   Selecting this option means that you wish to build a kernel
> > > +   for a machine with a QE coprocessor.
> > > +
> > >  config UCC_SLOW
> > >   bool
> > >   default y if SERIAL_QE
> > > @@ -19,9 +30,3 @@ config UCC_FAST
> > >  config UCC
> > >   bool
> > >   default y if UCC_FAST || UCC_SLOW
> > > -
> > > -config QE_USB
> > > - bool
> > > - default y if USB_FSL_QE
> > > - help
> > > -   QE USB Controller support
> > 
> > Why did some config symbols get moved and others not?
> 
> Because QE_USB should be putted under drivers/usb,
> It is independent of this patchset.

If it's independent of this patchset then don't put it in this patchset.  
Move all the QE stuff to drivers/soc and then later if something belongs 
somewhere else, have a separate patch move it there.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-23  7:45       ` Zhao Qiang
  (?)
@ 2015-10-23 20:56       ` Scott Wood
  2015-10-26  2:42           ` Zhao Qiang
  -1 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23 20:56 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421 <scottwood@freescale.com> 
> wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Friday, October 23, 2015 11:10 AM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> > qe_common
> > 
> > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > QE and CPM have the same muram, they use the same management
> > > functions. Now QE support both ARM and PowerPC, it is necessary to
> > > move QE to "driver/soc", so move the muram management functions from
> > > cpm_common to qe_common for preparing to move QE code to "driver/soc"
> > > 
> > > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > > ---
> > > Changes for v2:
> > >       - no changes
> > > Changes for v3:
> > >       - no changes
> > > Changes for v4:
> > >       - no changes
> > > Changes for v5:
> > >       - no changes
> > > Changes for v6:
> > >       - using genalloc instead rheap to manage QE MURAM
> > >       - remove qe_reset from platform file, using
> > >       - subsys_initcall to call qe_init function.
> > > Changes for v7:
> > >       - move this patch from 3/3 to 2/3
> > >       - convert cpm with genalloc
> > >       - check for gen_pool allocation failure Changes for v8:
> > >       - rebase
> > >       - move BD_SC_* macro instead of copy Changes for v9:
> > >       - doesn't modify CPM, add a new patch to modify.
> > >       - rebase
> > > Changes for v10:
> > >       - rebase
> > > Changes for v11:
> > >       - remove renaming
> > >       - delete removing qe_reset and delete adding qe_init.
> > > Changes for v12:
> > >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it.
> > 
> > Why is the SPI change part of this patch?  Why is it even part of this 
> > patchset,
> > rather than an independent patch sent to the SPI list and maintainer?  If 
> > it's tied
> > to other changes you're making, explain that.  As is, there is zero 
> > mention of
> > the SPI change in the part of the e-mail that will become the git 
> > changelog.
> > 
> This SPI_FSL_CPM is cpm-spi, it is part of CPM.

So then why are you selecting QUICC_ENGINE?  And again, what does it have to 
do with this patch?

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-23  7:06     ` Zhao Qiang
@ 2015-10-23 20:59       ` Scott Wood
  2015-10-26  3:15           ` Zhao Qiang
  0 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-23 20:59 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

Don't send HTML e-mail.

On Fri, 2015-10-23 at 02:06 -0500, Zhao Qiang-B45475 wrote:
> On Fri, 2015-10-23 at 11:00 AM, Wood Scott-B07421 <scottwood@freescale.com> 
> wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Friday, October 23, 2015 11:00 AM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
> >
> > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > -/**
> > > +/*
> > >   * cpm_muram_alloc - allocate the requested size worth of multi-user 
> ram
> > >   * @size: number of bytes to allocate
> > >   * @align: requested alignment, in bytes @@ -141,59 +151,102 @@ out:
> > >   */
> > >  unsigned long cpm_muram_alloc(unsigned long size, unsigned long
> > > align)  {
> > > -     unsigned long start;
> > >       unsigned long flags;
> > > -
> > > +     unsigned long start;
> > > +     static struct genpool_data_align muram_pool_data;
> > >       spin_lock_irqsave(&cpm_muram_lock, flags);
> > > -     cpm_muram_info.alignment = align;
> > > -     start = rh_alloc(&cpm_muram_info, size, "commproc");
> > > -     memset(cpm_muram_addr(start), 0, size);
> > > +     muram_pool_data.align = align;
> > > +     gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
> > > +                       &muram_pool_data);
> > > +     start = cpm_muram_alloc_common(size, &muram_pool_data);
> > >       spin_unlock_irqrestore(&cpm_muram_lock, flags);
> > > -
> > >       return start;
> > >  }
> > >  EXPORT_SYMBOL(cpm_muram_alloc);
> >
> > Why is muram_pool_data static?  Why is it being passed to
> > gen_pool_set_algo()? 
> Cpm_muram use both align algo and fixed algo, so we need to set 
> corresponding algo and
> Algo data.

The data gets passed in via gen_pool_alloc_data().  The point was to allow it 
to be on the caller's stack, not a long-lived data structure shared by all 
callers and needing synchronization.

> >The whole reason we're adding gen_pool_alloc_data()
> > is to avoid that.  Do we need gen_pool_alloc_algo() too?
>  
> We add gen_pool_alloc_data() to pass data to algo, because align algo and 
> fixed algo,
> Because align and fixed algos need specific data.

And my point is that because of that, it seems like we need a version that 
accepts an algorithm as well.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
  2015-10-23 20:55       ` Scott Wood
@ 2015-10-26  2:33           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  2:33 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3009 bytes --]

On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Saturday, October 24, 2015 4:56 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
> 
> On Fri, 2015-10-23 at 02:49 -0500, Zhao Qiang-B45475 wrote:
> > On Fri, Oct 23, 2015 at 11:20 AM, Wood Scott-B07421
> > <scottwood@freescale.com
> > > wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Friday, October 23, 2015 11:20 AM
> > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > paulus@samba.org
> > > Subject: Re: [PATCH v12 6/6] QE: Move QE from arch/powerpc to
> > > drivers/soc
> > >
> > > On Wed, Oct 14, 2015 at 03:16:08PM +0800, Zhao Qiang wrote:
> > >
> > >
> > > > diff --git a/arch/powerpc/sysdev/qe_lib/Kconfig
> > > > b/drivers/soc/fsl/qe/Kconfig similarity index 50% copy from
> > > > arch/powerpc/sysdev/qe_lib/Kconfig
> > > > copy to drivers/soc/fsl/qe/Kconfig index 3c25199..283fe0d 100644
> > > > --- a/arch/powerpc/sysdev/qe_lib/Kconfig
> > > > +++ b/drivers/soc/fsl/qe/Kconfig
> > > > @@ -2,6 +2,17 @@
> > > >  # QE Communication options
> > > >  #
> > > >
> > > > +config QUICC_ENGINE
> > > > + bool "Freescale QUICC Engine (QE) Support"
> > > > + depends on FSL_SOC && PPC32
> > > > + select GENERIC_ALLOCATOR
> > > > + select CRC32
> > > > + help
> > > > +   The QUICC Engine (QE) is a new generation of communications
> > > > +   coprocessors on Freescale embedded CPUs (akin to CPM in older
> > > chips).
> > > > +   Selecting this option means that you wish to build a kernel
> > > > +   for a machine with a QE coprocessor.
> > > > +
> > > >  config UCC_SLOW
> > > >   bool
> > > >   default y if SERIAL_QE
> > > > @@ -19,9 +30,3 @@ config UCC_FAST
> > > >  config UCC
> > > >   bool
> > > >   default y if UCC_FAST || UCC_SLOW
> > > > -
> > > > -config QE_USB
> > > > - bool
> > > > - default y if USB_FSL_QE
> > > > - help
> > > > -   QE USB Controller support
> > >
> > > Why did some config symbols get moved and others not?
> >
> > Because QE_USB should be putted under drivers/usb, It is independent
> > of this patchset.
> 
> If it's independent of this patchset then don't put it in this patchset.
> Move all the QE stuff to drivers/soc and then later if something belongs
> somewhere else, have a separate patch move it there.

Ok 

-Zhao
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc
@ 2015-10-26  2:33           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  2:33 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

T24gU2F0LCBPY3QgMjQsIDIwMTUgYXQgMDQ6NTYgQU0sIFdvb2QgU2NvdHQtQjA3NDIxIHdyb3Rl
Og0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBXb29kIFNjb3R0LUIwNzQy
MQ0KPiBTZW50OiBTYXR1cmRheSwgT2N0b2JlciAyNCwgMjAxNSA0OjU2IE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PiA+IC0gICBRRSBVU0Ig
Q29udHJvbGxlciBzdXBwb3J0DQo+ID4gPg0KPiA+ID4gV2h5IGRpZCBzb21lIGNvbmZpZyBzeW1i
b2xzIGdldCBtb3ZlZCBhbmQgb3RoZXJzIG5vdD8NCj4gPg0KPiA+IEJlY2F1c2UgUUVfVVNCIHNo
b3VsZCBiZSBwdXR0ZWQgdW5kZXIgZHJpdmVycy91c2IsIEl0IGlzIGluZGVwZW5kZW50DQo+ID4g
b2YgdGhpcyBwYXRjaHNldC4NCj4gDQo+IElmIGl0J3MgaW5kZXBlbmRlbnQgb2YgdGhpcyBwYXRj
aHNldCB0aGVuIGRvbid0IHB1dCBpdCBpbiB0aGlzIHBhdGNoc2V0Lg0KPiBNb3ZlIGFsbCB0aGUg
UUUgc3R1ZmYgdG8gZHJpdmVycy9zb2MgYW5kIHRoZW4gbGF0ZXIgaWYgc29tZXRoaW5nIGJlbG9u
Z3MNCj4gc29tZXdoZXJlIGVsc2UsIGhhdmUgYSBzZXBhcmF0ZSBwYXRjaCBtb3ZlIGl0IHRoZXJl
Lg0KDQpPayANCg0KLVpoYW8NCg==

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-23 20:56       ` Scott Wood
@ 2015-10-26  2:42           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  2:42 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3434 bytes --]

On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Saturday, October 24, 2015 4:56 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> qe_common
> 
> On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > <scottwood@freescale.com>
> > wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Friday, October 23, 2015 11:10 AM
> > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > paulus@samba.org
> > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> functions
> > > to qe_common
> > >
> > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > QE and CPM have the same muram, they use the same management
> > > > functions. Now QE support both ARM and PowerPC, it is necessary to
> > > > move QE to "driver/soc", so move the muram management functions
> > > > from cpm_common to qe_common for preparing to move QE code to
> "driver/soc"
> > > >
> > > > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > > > ---
> > > > Changes for v2:
> > > >       - no changes
> > > > Changes for v3:
> > > >       - no changes
> > > > Changes for v4:
> > > >       - no changes
> > > > Changes for v5:
> > > >       - no changes
> > > > Changes for v6:
> > > >       - using genalloc instead rheap to manage QE MURAM
> > > >       - remove qe_reset from platform file, using
> > > >       - subsys_initcall to call qe_init function.
> > > > Changes for v7:
> > > >       - move this patch from 3/3 to 2/3
> > > >       - convert cpm with genalloc
> > > >       - check for gen_pool allocation failure Changes for v8:
> > > >       - rebase
> > > >       - move BD_SC_* macro instead of copy Changes for v9:
> > > >       - doesn't modify CPM, add a new patch to modify.
> > > >       - rebase
> > > > Changes for v10:
> > > >       - rebase
> > > > Changes for v11:
> > > >       - remove renaming
> > > >       - delete removing qe_reset and delete adding qe_init.
> > > > Changes for v12:
> > > >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it.
> > >
> > > Why is the SPI change part of this patch?  Why is it even part of
> > > this patchset, rather than an independent patch sent to the SPI list
> > > and maintainer?  If it's tied to other changes you're making,
> > > explain that.  As is, there is zero mention of the SPI change in the
> > > part of the e-mail that will become the git changelog.
> > >
> > This SPI_FSL_CPM is cpm-spi, it is part of CPM.
> 
> So then why are you selecting QUICC_ENGINE?  And again, what does it have
> to do with this patch?

Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will failed to build.

-Zhao

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
@ 2015-10-26  2:42           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  2:42 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

T24gU2F0LCBPY3QgMjQsIDIwMTUgYXQgMDQ6NTYgQU0sIFdvb2QgU2NvdHQtQjA3NDIxIHdyb3Rl
Og0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBXb29kIFNjb3R0LUIwNzQy
MQ0KPiBTZW50Oi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8gd2l0aCB0aGlz
IHBhdGNoPw0KDQpDcG0tc3BpIGlzIGRlcGVuZGVudCBvbiBxZV9tdXJhbSwgaWYgbm90IHNlbGVj
dCBpdCwgQ3BtLXNwaSB3aWxsIGZhaWxlZCB0byBidWlsZC4NCg0KLVpoYW8NCg0K

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-23 20:59       ` Scott Wood
@ 2015-10-26  3:15           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  3:15 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3664 bytes --]

On Sat, 2015-10-24 at 04:59 AM, Wood Scott-B07421 <scottwood@freescale.com> wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Saturday, October 24, 2015 4:59 AM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
> 
> Don't send HTML e-mail.
> 
> On Fri, 2015-10-23 at 02:06 -0500, Zhao Qiang-B45475 wrote:
> > On Fri, 2015-10-23 at 11:00 AM, Wood Scott-B07421
> > <scottwood@freescale.com>
> > wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Friday, October 23, 2015 11:00 AM
> > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > paulus@samba.org
> > > Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE
> > > muram
> > >
> > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > -/**
> > > > +/*
> > > >   * cpm_muram_alloc - allocate the requested size worth of
> > > > multi-user
> > ram
> > > >   * @size: number of bytes to allocate
> > > >   * @align: requested alignment, in bytes @@ -141,59 +151,102 @@ out:
> > > >   */
> > > >  unsigned long cpm_muram_alloc(unsigned long size, unsigned long
> > > > align)  {
> > > > -     unsigned long start;
> > > >       unsigned long flags;
> > > > -
> > > > +     unsigned long start;
> > > > +     static struct genpool_data_align muram_pool_data;
> > > >       spin_lock_irqsave(&cpm_muram_lock, flags);
> > > > -     cpm_muram_info.alignment = align;
> > > > -     start = rh_alloc(&cpm_muram_info, size, "commproc");
> > > > -     memset(cpm_muram_addr(start), 0, size);
> > > > +     muram_pool_data.align = align;
> > > > +     gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
> > > > +                       &muram_pool_data);
> > > > +     start = cpm_muram_alloc_common(size, &muram_pool_data);
> > > >       spin_unlock_irqrestore(&cpm_muram_lock, flags);
> > > > -
> > > >       return start;
> > > >  }
> > > >  EXPORT_SYMBOL(cpm_muram_alloc);
> > >
> > > Why is muram_pool_data static?  Why is it being passed to
> > > gen_pool_set_algo()?
> > Cpm_muram use both align algo and fixed algo, so we need to set
> > corresponding algo and Algo data.
> 
> The data gets passed in via gen_pool_alloc_data().  The point was to allow it to
> be on the caller's stack, not a long-lived data structure shared by all callers and
> needing synchronization.

You mean it is not necessary to point pool->data to data, just passing the data to gen_pool_alloc_data()?
However, the algo it needed to be set.

> 
> > >The whole reason we're adding gen_pool_alloc_data()  is to avoid
> > >that.  Do we need gen_pool_alloc_algo() too?
> >
> > We add gen_pool_alloc_data() to pass data to algo, because align algo
> > and fixed algo, Because align and fixed algos need specific data.
> 
> And my point is that because of that, it seems like we need a version that
> accepts an algorithm as well.

It the user just use only one algo, it doesn’t need to set algo, 
However, qe_muram use two algos with alloc_align function
And alloc_fixed function.

-Zhao

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
@ 2015-10-26  3:15           ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-26  3:15 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

T24gU2F0LCAyMDE1LTEwLTI0IGF0IDA0OjU5IEFNLCBXb29kIFNjb3R0LUIwNzQyMSA8c2NvdHR3
b29kQGZyZWVzY2FsZS5jb20+IHdyb3RlOg0KPiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0K
PiBGcm9tOiBXb29kIFNjb3R0LUIwNzQyMQ0KPiBTZW50OiBTYXR1cmRheSwgT2N0b2JlciAyNCwg
MjAxNSA0OjU5IEFNDQo+IFRvOiBaaGFvIFFpYW5nLUI0NTQ3NSA8cWlhbmcuemhhb0BmcmVlc2Nh
bGUuY29tPg0KPiBDYzogbGludXgta2VybmVsQHZnZXIua2VybmVsLm9yZzsgbGludXhwcGMtZGV2
QGxpc3RzLm96bGFicy5vcmc7DQo+IGxhdXJhYUBjb2RlYXVyb3JhLm9yZzsgWGllIFhpYW9iby1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28sIGl0IGRvZXNu4oCZdCBuZWVk
IHRvIHNldCBhbGdvLCANCkhvd2V2ZXIsIHFlX211cmFtIHVzZSB0d28gYWxnb3Mgd2l0aCBhbGxv
Y19hbGlnbiBmdW5jdGlvbg0KQW5kIGFsbG9jX2ZpeGVkIGZ1bmN0aW9uLg0KDQotWmhhbw0KDQo=

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-26  2:42           ` Zhao Qiang
  (?)
@ 2015-10-27  4:48           ` Scott Wood
  2015-10-27  6:24               ` Zhao Qiang
  -1 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-27  4:48 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Sun, 2015-10-25 at 21:42 -0500, Zhao Qiang-B45475 wrote:
> On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Saturday, October 24, 2015 4:56 AM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> > qe_common
> > 
> > On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > > <scottwood@freescale.com>
> > > wrote:
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Friday, October 23, 2015 11:10 AM
> > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > > paulus@samba.org
> > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > functions
> > > > to qe_common
> > > > 
> > > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > > QE and CPM have the same muram, they use the same management
> > > > > functions. Now QE support both ARM and PowerPC, it is necessary to
> > > > > move QE to "driver/soc", so move the muram management functions
> > > > > from cpm_common to qe_common for preparing to move QE code to
> > "driver/soc"
> > > > > 
> > > > > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > > > > ---
> > > > > Changes for v2:
> > > > >       - no changes
> > > > > Changes for v3:
> > > > >       - no changes
> > > > > Changes for v4:
> > > > >       - no changes
> > > > > Changes for v5:
> > > > >       - no changes
> > > > > Changes for v6:
> > > > >       - using genalloc instead rheap to manage QE MURAM
> > > > >       - remove qe_reset from platform file, using
> > > > >       - subsys_initcall to call qe_init function.
> > > > > Changes for v7:
> > > > >       - move this patch from 3/3 to 2/3
> > > > >       - convert cpm with genalloc
> > > > >       - check for gen_pool allocation failure Changes for v8:
> > > > >       - rebase
> > > > >       - move BD_SC_* macro instead of copy Changes for v9:
> > > > >       - doesn't modify CPM, add a new patch to modify.
> > > > >       - rebase
> > > > > Changes for v10:
> > > > >       - rebase
> > > > > Changes for v11:
> > > > >       - remove renaming
> > > > >       - delete removing qe_reset and delete adding qe_init.
> > > > > Changes for v12:
> > > > >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for it.
> > > > 
> > > > Why is the SPI change part of this patch?  Why is it even part of
> > > > this patchset, rather than an independent patch sent to the SPI list
> > > > and maintainer?  If it's tied to other changes you're making,
> > > > explain that.  As is, there is zero mention of the SPI change in the
> > > > part of the e-mail that will become the git changelog.
> > > > 
> > > This SPI_FSL_CPM is cpm-spi, it is part of CPM.
> > 
> > So then why are you selecting QUICC_ENGINE?  And again, what does it have
> > to do with this patch?
> 
> Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will failed to 
> build.

Why QUICC_ENGINE and not CPM?

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
  2015-10-26  3:15           ` Zhao Qiang
  (?)
@ 2015-10-27  4:50           ` Scott Wood
  -1 siblings, 0 replies; 32+ messages in thread
From: Scott Wood @ 2015-10-27  4:50 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Sun, 2015-10-25 at 22:15 -0500, Zhao Qiang-B45475 wrote:
> On Sat, 2015-10-24 at 04:59 AM, Wood Scott-B07421 <scottwood@freescale.com> 
> wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Saturday, October 24, 2015 4:59 AM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram
> > 
> > Don't send HTML e-mail.
> > 
> > On Fri, 2015-10-23 at 02:06 -0500, Zhao Qiang-B45475 wrote:
> > > On Fri, 2015-10-23 at 11:00 AM, Wood Scott-B07421
> > > <scottwood@freescale.com>
> > > wrote:
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Friday, October 23, 2015 11:00 AM
> > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > > paulus@samba.org
> > > > Subject: Re: [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE
> > > > muram
> > > > 
> > > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > > -/**
> > > > > +/*
> > > > >   * cpm_muram_alloc - allocate the requested size worth of
> > > > > multi-user
> > > ram
> > > > >   * @size: number of bytes to allocate
> > > > >   * @align: requested alignment, in bytes @@ -141,59 +151,102 @@ 
> > > > > out:
> > > > >   */
> > > > >  unsigned long cpm_muram_alloc(unsigned long size, unsigned long
> > > > > align)  {
> > > > > -     unsigned long start;
> > > > >       unsigned long flags;
> > > > > -
> > > > > +     unsigned long start;
> > > > > +     static struct genpool_data_align muram_pool_data;
> > > > >       spin_lock_irqsave(&cpm_muram_lock, flags);
> > > > > -     cpm_muram_info.alignment = align;
> > > > > -     start = rh_alloc(&cpm_muram_info, size, "commproc");
> > > > > -     memset(cpm_muram_addr(start), 0, size);
> > > > > +     muram_pool_data.align = align;
> > > > > +     gen_pool_set_algo(muram_pool, gen_pool_first_fit_align,
> > > > > +                       &muram_pool_data);
> > > > > +     start = cpm_muram_alloc_common(size, &muram_pool_data);
> > > > >       spin_unlock_irqrestore(&cpm_muram_lock, flags);
> > > > > -
> > > > >       return start;
> > > > >  }
> > > > >  EXPORT_SYMBOL(cpm_muram_alloc);
> > > > 
> > > > Why is muram_pool_data static?  Why is it being passed to
> > > > gen_pool_set_algo()?
> > > Cpm_muram use both align algo and fixed algo, so we need to set
> > > corresponding algo and Algo data.
> > 
> > The data gets passed in via gen_pool_alloc_data().  The point was to 
> > allow it to
> > be on the caller's stack, not a long-lived data structure shared by all 
> > callers and
> > needing synchronization.
> 
> You mean it is not necessary to point pool->data to data, just passing the 
> data to gen_pool_alloc_data()?
> However, the algo it needed to be set.
> 
> > 
> > > > The whole reason we're adding gen_pool_alloc_data()  is to avoid
> > > > that.  Do we need gen_pool_alloc_algo() too?
> > > 
> > > We add gen_pool_alloc_data() to pass data to algo, because align algo
> > > and fixed algo, Because align and fixed algos need specific data.
> > 
> > And my point is that because of that, it seems like we need a version that
> > accepts an algorithm as well.
> 
> It the user just use only one algo, it doesn’t need to set algo, 
> However, qe_muram use two algos with alloc_align function
> And alloc_fixed function.

Yes.  That is why gen_pool_alloc_data() does not accomplish what we want.  
When we were discussing gen_pool_alloc_data(), you had not yet mentioned the 
need for fixed allocations.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-27  4:48           ` Scott Wood
@ 2015-10-27  6:24               ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-27  6:24 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4463 bytes --]

On Tue, Oct 27, 2015 at 12:48 PM, Wood Scott-B07421 wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, October 27, 2015 12:48 PM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> qe_common
> 
> On Sun, 2015-10-25 at 21:42 -0500, Zhao Qiang-B45475 wrote:
> > On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Saturday, October 24, 2015 4:56 AM
> > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > paulus@samba.org
> > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> functions
> > > to qe_common
> > >
> > > On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > > > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > > > <scottwood@freescale.com>
> > > > wrote:
> > > > > -----Original Message-----
> > > > > From: Wood Scott-B07421
> > > > > Sent: Friday, October 23, 2015 11:10 AM
> > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > functions
> > > > > to qe_common
> > > > >
> > > > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > > > QE and CPM have the same muram, they use the same management
> > > > > > functions. Now QE support both ARM and PowerPC, it is
> > > > > > necessary to move QE to "driver/soc", so move the muram
> > > > > > management functions from cpm_common to qe_common for
> > > > > > preparing to move QE code to
> > > "driver/soc"
> > > > > >
> > > > > > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > > > > > ---
> > > > > > Changes for v2:
> > > > > >       - no changes
> > > > > > Changes for v3:
> > > > > >       - no changes
> > > > > > Changes for v4:
> > > > > >       - no changes
> > > > > > Changes for v5:
> > > > > >       - no changes
> > > > > > Changes for v6:
> > > > > >       - using genalloc instead rheap to manage QE MURAM
> > > > > >       - remove qe_reset from platform file, using
> > > > > >       - subsys_initcall to call qe_init function.
> > > > > > Changes for v7:
> > > > > >       - move this patch from 3/3 to 2/3
> > > > > >       - convert cpm with genalloc
> > > > > >       - check for gen_pool allocation failure Changes for v8:
> > > > > >       - rebase
> > > > > >       - move BD_SC_* macro instead of copy Changes for v9:
> > > > > >       - doesn't modify CPM, add a new patch to modify.
> > > > > >       - rebase
> > > > > > Changes for v10:
> > > > > >       - rebase
> > > > > > Changes for v11:
> > > > > >       - remove renaming
> > > > > >       - delete removing qe_reset and delete adding qe_init.
> > > > > > Changes for v12:
> > > > > >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for
> it.
> > > > >
> > > > > Why is the SPI change part of this patch?  Why is it even part
> > > > > of this patchset, rather than an independent patch sent to the
> > > > > SPI list and maintainer?  If it's tied to other changes you're
> > > > > making, explain that.  As is, there is zero mention of the SPI
> > > > > change in the part of the e-mail that will become the git changelog.
> > > > >
> > > > This SPI_FSL_CPM is cpm-spi, it is part of CPM.
> > >
> > > So then why are you selecting QUICC_ENGINE?  And again, what does it
> > > have to do with this patch?
> >
> > Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will
> > failed to build.
> 
> Why QUICC_ENGINE and not CPM?

QE and CPM use the same muram, and it has been moved to qe_muram from cpm_muram.

> 
> -Scott

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
@ 2015-10-27  6:24               ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages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ICBJZiBpdCdzIHRpZWQgdG8gb3RoZXIgY2hhbmdl
cyB5b3UncmUNCj4gPiA+ID4gPiBtYWtpbmcsIGV4cGxhaW4gdGhhdC4gIEFzIGlzLCB0aGVyZSBp
cyB6ZXJvIG1lbnRpb24gb2YgdGhlIFNQSQ0KPiA+ID4gPiA+IGNoYW5nZSBpbiB0aGUgcGFydCBv
ZiB0aGUgZS1tYWlsIHRoYXQgd2lsbCBiZWNvbWUgdGhlIGdpdCBjaGFuZ2Vsb2cuDQo+ID4gPiA+
ID4NCj4gPiA+ID4gVGhpcyBTUElfRlNMX0NQTSBpcyBjcG0tc3BpLCBpdCBpcyBwYXJ0IG9mIENQ
TS4NCj4gPiA+DQo+ID4gPiBTbyB0aGVuIHdoeSBhcmUgeW91IHNlbGVjdGluZyBRVUlDQ19FTkdJ
TkU/ICBBbmQgYWdhaW4sIHdoYXQgZG9lcyBpdA0KPiA+ID4gaGF2ZSB0byBkbyB3aXRoIHRoaXMg
cGF0Y2g/DQo+ID4NCj4gPiBDcG0tc3BpIGlzIGRlcGVuZGVudCBvbiBxZV9tdXJhbSwgaWYgbm90
IHNlbGVjdCBpdCwgQ3BtLXNwaSB3aWxsDQo+ID4gZmFpbGVkIHRvIGJ1aWxkLg0KPiANCj4gV2h5
IFFVSUNDX0VOR0lORSBhbmQgbm90IENQTT8NCg0KUUUgYW5kIENQTSB1c2UgdGhlIHNhbWUgbXVy
YW0sIGFuZCBpdCBoYXMgYmVlbiBtb3ZlZCB0byBxZV9tdXJhbSBmcm9tIGNwbV9tdXJhbS4NCg0K
PiANCj4gLVNjb3R0DQoNCg==

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-27  6:24               ` Zhao Qiang
  (?)
@ 2015-10-27  6:50               ` Scott Wood
  2015-10-27  7:34                   ` Zhao Qiang
  -1 siblings, 1 reply; 32+ messages in thread
From: Scott Wood @ 2015-10-27  6:50 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Tue, 2015-10-27 at 01:24 -0500, Zhao Qiang-B45475 wrote:
> On Tue, Oct 27, 2015 at 12:48 PM, Wood Scott-B07421 wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Tuesday, October 27, 2015 12:48 PM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> > qe_common
> > 
> > On Sun, 2015-10-25 at 21:42 -0500, Zhao Qiang-B45475 wrote:
> > > On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Saturday, October 24, 2015 4:56 AM
> > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > > paulus@samba.org
> > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > functions
> > > > to qe_common
> > > > 
> > > > On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > > > > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > > > > <scottwood@freescale.com>
> > > > > wrote:
> > > > > > -----Original Message-----
> > > > > > From: Wood Scott-B07421
> > > > > > Sent: Friday, October 23, 2015 11:10 AM
> > > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > > functions
> > > > > > to qe_common
> > > > > > 
> > > > > > On Wed, 2015-10-14 at 15:16 +0800, Zhao Qiang wrote:
> > > > > > > QE and CPM have the same muram, they use the same management
> > > > > > > functions. Now QE support both ARM and PowerPC, it is
> > > > > > > necessary to move QE to "driver/soc", so move the muram
> > > > > > > management functions from cpm_common to qe_common for
> > > > > > > preparing to move QE code to
> > > > "driver/soc"
> > > > > > > 
> > > > > > > Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
> > > > > > > ---
> > > > > > > Changes for v2:
> > > > > > >       - no changes
> > > > > > > Changes for v3:
> > > > > > >       - no changes
> > > > > > > Changes for v4:
> > > > > > >       - no changes
> > > > > > > Changes for v5:
> > > > > > >       - no changes
> > > > > > > Changes for v6:
> > > > > > >       - using genalloc instead rheap to manage QE MURAM
> > > > > > >       - remove qe_reset from platform file, using
> > > > > > >       - subsys_initcall to call qe_init function.
> > > > > > > Changes for v7:
> > > > > > >       - move this patch from 3/3 to 2/3
> > > > > > >       - convert cpm with genalloc
> > > > > > >       - check for gen_pool allocation failure Changes for v8:
> > > > > > >       - rebase
> > > > > > >       - move BD_SC_* macro instead of copy Changes for v9:
> > > > > > >       - doesn't modify CPM, add a new patch to modify.
> > > > > > >       - rebase
> > > > > > > Changes for v10:
> > > > > > >       - rebase
> > > > > > > Changes for v11:
> > > > > > >       - remove renaming
> > > > > > >       - delete removing qe_reset and delete adding qe_init.
> > > > > > > Changes for v12:
> > > > > > >       - SPI_FSL_CPM depends on QE-MURAM, select QUICC_ENGINE for
> > it.
> > > > > > 
> > > > > > Why is the SPI change part of this patch?  Why is it even part
> > > > > > of this patchset, rather than an independent patch sent to the
> > > > > > SPI list and maintainer?  If it's tied to other changes you're
> > > > > > making, explain that.  As is, there is zero mention of the SPI
> > > > > > change in the part of the e-mail that will become the git 
> > > > > > changelog.
> > > > > > 
> > > > > This SPI_FSL_CPM is cpm-spi, it is part of CPM.
> > > > 
> > > > So then why are you selecting QUICC_ENGINE?  And again, what does it
> > > > have to do with this patch?
> > > 
> > > Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will
> > > failed to build.
> > 
> > Why QUICC_ENGINE and not CPM?
> 
> QE and CPM use the same muram, and it has been moved to qe_muram from 
> cpm_muram.

Fix the makefiles so that the muram code continues to be built for both 
QUICC_ENGINE and CPM.  It's not acceptable to have to bring in the entire QE 
code just for the muram.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-27  6:50               ` Scott Wood
@ 2015-10-27  7:34                   ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-27  7:34 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3411 bytes --]

On Tue, Oct 27, 2015 at 2:50 PM, Wood Scott-B07421 wrote:
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, October 27, 2015 2:50 PM
> To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> paulus@samba.org
> Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> qe_common
> 
> On Tue, 2015-10-27 at 01:24 -0500, Zhao Qiang-B45475 wrote:
> > On Tue, Oct 27, 2015 at 12:48 PM, Wood Scott-B07421 wrote:
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Tuesday, October 27, 2015 12:48 PM
> > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > paulus@samba.org
> > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> functions
> > > to qe_common
> > >
> > > On Sun, 2015-10-25 at 21:42 -0500, Zhao Qiang-B45475 wrote:
> > > > On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> > > > > -----Original Message-----
> > > > > From: Wood Scott-B07421
> > > > > Sent: Saturday, October 24, 2015 4:56 AM
> > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > functions
> > > > > to qe_common
> > > > >
> > > > > On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > > > > > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > > > > > <scottwood@freescale.com>
> > > > > > wrote:
> > > > > > > -----Original Message-----
> > > > > > > From: Wood Scott-B07421
> > > > > > > Sent: Friday, October 23, 2015 11:10 AM
> > > > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > > > Cc: linux-kernel@vger.kernel.org;
> > > > > > > linuxppc-dev@lists.ozlabs.org; lauraa@codeaurora.org; Xie
> > > > > > > Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > > > functions
> > > > > > > to qe_common
> > > > > > >
> > > > > So then why are you selecting QUICC_ENGINE?  And again, what
> > > > > does it have to do with this patch?
> > > >
> > > > Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will
> > > > failed to build.
> > >
> > > Why QUICC_ENGINE and not CPM?
> >
> > QE and CPM use the same muram, and it has been moved to qe_muram
> from
> > cpm_muram.
> 
> Fix the makefiles so that the muram code continues to be built for both
> QUICC_ENGINE and CPM.  It's not acceptable to have to bring in the entire QE
> code just for the muram.
> 
How about to define and CONFIG_QE_MURAM in Kconfig for muram?

-Zhao
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 32+ messages in thread

* RE: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
@ 2015-10-27  7:34                   ` Zhao Qiang
  0 siblings, 0 replies; 32+ messages in thread
From: Zhao Qiang @ 2015-10-27  7:34 UTC (permalink / raw)
  To: Scott Wood
  Cc: linux-kernel, linuxppc-dev, lauraa, Xiaobo Xie, benh, Li Leo, paulus

T24gVHVlLCBPY3QgMjcsIDIwMTUgYXQgMjo1MCBQTSwgV29vZCBTY290dC1CMDc0MjEgd3JvdGU6
DQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZy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YWNjZXB0YWJsZSB0byBo
YXZlIHRvIGJyaW5nIGluIHRoZSBlbnRpcmUgUUUNCj4gY29kZSBqdXN0IGZvciB0aGUgbXVyYW0u
DQo+IA0KSG93IGFib3V0IHRvIGRlZmluZSBhbmQgQ09ORklHX1FFX01VUkFNIGluIEtjb25maWcg
Zm9yIG11cmFtPw0KDQotWmhhbw0K

^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common
  2015-10-27  7:34                   ` Zhao Qiang
  (?)
@ 2015-10-27  7:36                   ` Scott Wood
  -1 siblings, 0 replies; 32+ messages in thread
From: Scott Wood @ 2015-10-27  7:36 UTC (permalink / raw)
  To: Zhao Qiang-B45475
  Cc: linux-kernel, linuxppc-dev, lauraa, Xie Xiaobo-R63061, benh,
	Li Yang-Leo-R58472, paulus

On Tue, 2015-10-27 at 02:34 -0500, Zhao Qiang-B45475 wrote:
> On Tue, Oct 27, 2015 at 2:50 PM, Wood Scott-B07421 wrote:
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Tuesday, October 27, 2015 2:50 PM
> > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > paulus@samba.org
> > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management functions to
> > qe_common
> > 
> > On Tue, 2015-10-27 at 01:24 -0500, Zhao Qiang-B45475 wrote:
> > > On Tue, Oct 27, 2015 at 12:48 PM, Wood Scott-B07421 wrote:
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Tuesday, October 27, 2015 12:48 PM
> > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > benh@kernel.crashing.org; Li Yang-Leo-R58472 <LeoLi@freescale.com>;
> > > > paulus@samba.org
> > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > functions
> > > > to qe_common
> > > > 
> > > > On Sun, 2015-10-25 at 21:42 -0500, Zhao Qiang-B45475 wrote:
> > > > > On Sat, Oct 24, 2015 at 04:56 AM, Wood Scott-B07421 wrote:
> > > > > > -----Original Message-----
> > > > > > From: Wood Scott-B07421
> > > > > > Sent: Saturday, October 24, 2015 4:56 AM
> > > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org;
> > > > > > lauraa@codeaurora.org; Xie Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > > functions
> > > > > > to qe_common
> > > > > > 
> > > > > > On Fri, 2015-10-23 at 02:45 -0500, Zhao Qiang-B45475 wrote:
> > > > > > > On Fri, 2015-10-23 at 11:10 AM, Wood Scott-B07421
> > > > > > > <scottwood@freescale.com>
> > > > > > > wrote:
> > > > > > > > -----Original Message-----
> > > > > > > > From: Wood Scott-B07421
> > > > > > > > Sent: Friday, October 23, 2015 11:10 AM
> > > > > > > > To: Zhao Qiang-B45475 <qiang.zhao@freescale.com>
> > > > > > > > Cc: linux-kernel@vger.kernel.org;
> > > > > > > > linuxppc-dev@lists.ozlabs.org; lauraa@codeaurora.org; Xie
> > > > > > > > Xiaobo-R63061 <X.Xie@freescale.com>;
> > > > > > > > benh@kernel.crashing.org; Li Yang-Leo-R58472
> > > > > > > > <LeoLi@freescale.com>; paulus@samba.org
> > > > > > > > Subject: Re: [PATCH v12 4/6] QE/CPM: move muram management
> > > > > > functions
> > > > > > > > to qe_common
> > > > > > > > 
> > > > > > So then why are you selecting QUICC_ENGINE?  And again, what
> > > > > > does it have to do with this patch?
> > > > > 
> > > > > Cpm-spi is dependent on qe_muram, if not select it, Cpm-spi will
> > > > > failed to build.
> > > > 
> > > > Why QUICC_ENGINE and not CPM?
> > > 
> > > QE and CPM use the same muram, and it has been moved to qe_muram
> > from
> > > cpm_muram.
> > 
> > Fix the makefiles so that the muram code continues to be built for both
> > QUICC_ENGINE and CPM.  It's not acceptable to have to bring in the entire 
> > QE
> > code just for the muram.
> > 
> How about to define and CONFIG_QE_MURAM in Kconfig for muram?

That's fine.

-Scott


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2015-10-27  7:36 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-14  7:16 [PATCH v12 1/6] genalloc:support memory-allocation with bytes-alignment to genalloc Zhao Qiang
2015-10-14  7:16 ` [PATCH v12 2/6] genalloc:support allocating specific region Zhao Qiang
2015-10-14  7:16 ` [PATCH v12 3/6] CPM/QE: use genalloc to manage CPM/QE muram Zhao Qiang
2015-10-23  2:59   ` Scott Wood
2015-10-23  7:06     ` Zhao Qiang
2015-10-23 20:59       ` Scott Wood
2015-10-26  3:15         ` Zhao Qiang
2015-10-26  3:15           ` Zhao Qiang
2015-10-27  4:50           ` Scott Wood
2015-10-14  7:16 ` [PATCH v12 4/6] QE/CPM: move muram management functions to qe_common Zhao Qiang
2015-10-23  3:09   ` Scott Wood
2015-10-23  7:45     ` Zhao Qiang
2015-10-23  7:45       ` Zhao Qiang
2015-10-23 20:56       ` Scott Wood
2015-10-26  2:42         ` Zhao Qiang
2015-10-26  2:42           ` Zhao Qiang
2015-10-27  4:48           ` Scott Wood
2015-10-27  6:24             ` Zhao Qiang
2015-10-27  6:24               ` Zhao Qiang
2015-10-27  6:50               ` Scott Wood
2015-10-27  7:34                 ` Zhao Qiang
2015-10-27  7:34                   ` Zhao Qiang
2015-10-27  7:36                   ` Scott Wood
2015-10-14  7:16 ` [PATCH v12 5/6] QE: use subsys_initcall to init qe Zhao Qiang
2015-10-23  3:11   ` Scott Wood
2015-10-14  7:16 ` [PATCH v12 6/6] QE: Move QE from arch/powerpc to drivers/soc Zhao Qiang
2015-10-23  3:19   ` Scott Wood
2015-10-23  7:49     ` Zhao Qiang
2015-10-23  7:49       ` Zhao Qiang
2015-10-23 20:55       ` Scott Wood
2015-10-26  2:33         ` Zhao Qiang
2015-10-26  2:33           ` Zhao Qiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.