All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/9] drivers/of: Make device tree code work on any arch.
       [not found] ` <1279918663-29960-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57   ` Stephen Neuendorffer
       [not found]     ` <7e773827-71eb-47a5-826c-cd255b4ce02c-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>
  2010-07-23 21:39   ` [PATCH 0/9] Xilinx PCI endpoint driver Stephen Neuendorffer
  1 sibling, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

---

I'm not sure what the right way to abstract these functions is.
of_node_to_nid seems specific to those platforms which have a root
device tree.  pci_address_to_pio seems to probably have a useful
implementation, but I'm not sure what it's trying to do.  Perhaps
someone can shed some light?
---
 drivers/of/address.c |    5 +++++
 drivers/of/device.c  |    7 ++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index fcadb72..61e652b 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -539,7 +539,12 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
 	memset(r, 0, sizeof(struct resource));
 	if (flags & IORESOURCE_IO) {
 		unsigned long port;
+		// FIXME: utter hack...
+#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC)
 		port = pci_address_to_pio(taddr);
+#else
+		port = -1;
+#endif
 		if (port == (unsigned long)-1)
 			return -EINVAL;
 		r->start = port;
diff --git a/drivers/of/device.c b/drivers/of/device.c
index 5282a20..27a65fc 100644
--- a/drivers/of/device.c
+++ b/drivers/of/device.c
@@ -107,8 +107,13 @@ int of_device_register(struct of_device *ofdev)
 	/* device_add will assume that this device is on the same node as
 	 * the parent. If there is no parent defined, set the node
 	 * explicitly */
-	if (!ofdev->dev.parent)
+	if (!ofdev->dev.parent) {
+#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC) 
 		set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node));
+#else
+		set_dev_node(&ofdev->dev, -1);
+#endif
+	}
 
 	return device_add(&ofdev->dev);
 }
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree
       [not found]   ` <1279918663-29960-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57     ` Stephen Neuendorffer
       [not found]       ` <39f3d9ca-1943-43b8-a1f6-eba8fb2aeeec-RaUQJvECHiuXHCJdrdq+zrjjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

This code allows a user to parse a partial device tree blob, which is
structurally independent of any toplevel blob.
Previously, this code assumed that the blob comes from initial_boot_params.
Now, unflatten_partial_device_tree can take a blob from an arbitrary position,
and the location of the blob gets passed around to the various support functions.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
 drivers/of/fdt.c       |  169 +++++++++++++++++++++++++++++++++--------------
 include/linux/of_fdt.h |   11 ++-
 2 files changed, 126 insertions(+), 54 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d61fda8..89fb1f3 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -11,10 +11,12 @@
 
 #include <linux/kernel.h>
 #include <linux/initrd.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/string.h>
 #include <linux/errno.h>
+#include <linux/slab.h>
 
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
@@ -22,15 +24,19 @@
 
 #include <asm/page.h>
 
-int __initdata dt_root_addr_cells;
-int __initdata dt_root_size_cells;
+int dt_root_addr_cells;
+int dt_root_size_cells;
 
 struct boot_param_header *initial_boot_params;
 
-char *find_flat_dt_string(u32 offset)
+void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
+			     unsigned long (*dt_alloc)(u64 size, u64 align));
+
+char *find_flat_dt_string(u32 offset,
+			  struct boot_param_header *blob)
 {
-	return ((char *)initial_boot_params) +
-		be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
+	return ((char *)blob) +
+		be32_to_cpu(blob->off_dt_strings) + offset;
 }
 
 /**
@@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void)
  * This function can be used within scan_flattened_dt callback to get
  * access to properties
  */
-void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
-				 unsigned long *size)
+void * __init of_get_flat_dt_prop(unsigned long node, const char *name,
+				 unsigned long *size,
+				 struct boot_param_header *blob)
 {
 	unsigned long p = node;
 
@@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
 		if (be32_to_cpu(initial_boot_params->version) < 0x10)
 			p = ALIGN(p, sz >= 8 ? 8 : 4);
 
-		nstr = find_flat_dt_string(noff);
+		nstr = find_flat_dt_string(noff, blob);
 		if (nstr == NULL) {
 			pr_warning("Can't find property index name !\n");
 			return NULL;
@@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
  * @node: node to test
  * @compat: compatible string to compare with compatible list.
  */
-int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
+int  of_flat_dt_is_compatible(unsigned long node, const char *compat,
+				 struct boot_param_header *blob)
 {
 	const char *cp;
 	unsigned long cplen, l;
 
-	cp = of_get_flat_dt_prop(node, "compatible", &cplen);
+	cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob);
 	if (cp == NULL)
 		return 0;
 	while (cplen > 0) {
@@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
 	return 0;
 }
 
-static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
 				       unsigned long align)
 {
 	void *res;
@@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
  * @allnextpp: pointer to ->allnext from last allocated device_node
  * @fpsize: Size of the node path up at the current depth.
  */
-unsigned long __init unflatten_dt_node(unsigned long mem,
-					unsigned long *p,
-					struct device_node *dad,
-					struct device_node ***allnextpp,
-					unsigned long fpsize)
+unsigned long unflatten_dt_node(unsigned long mem,
+				unsigned long *p,
+				struct device_node *dad,
+				struct device_node ***allnextpp,
+				unsigned long fpsize,
+				struct boot_param_header *blob)
 {
 	struct device_node *np;
 	struct property *pp, **prev_pp = NULL;
@@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 		sz = be32_to_cpup((__be32 *)(*p));
 		noff = be32_to_cpup((__be32 *)((*p) + 4));
 		*p += 8;
-		if (be32_to_cpu(initial_boot_params->version) < 0x10)
+		if (be32_to_cpu(blob->version) < 0x10)
 			*p = ALIGN(*p, sz >= 8 ? 8 : 4);
 
-		pname = find_flat_dt_string(noff);
+		pname = find_flat_dt_string(noff, blob);
 		if (pname == NULL) {
 			pr_info("Can't find property name in list !\n");
 			break;
@@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 		if (tag == OF_DT_NOP)
 			*p += 4;
 		else
-			mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
+			mem = unflatten_dt_node(mem, p, np, allnextpp,
+						fpsize, blob);
 		tag = be32_to_cpup((__be32 *)(*p));
 	}
 	if (tag != OF_DT_END_NODE) {
@@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
 	return mem;
 }
 
+#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC)
+
 #ifdef CONFIG_BLK_DEV_INITRD
 /**
  * early_init_dt_check_for_initrd - Decode initrd location from flat tree
@@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node)
 
 	pr_debug("Looking for initrd properties... ");
 
-	prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
+	prop = of_get_flat_dt_prop(node, "linux,initrd-start",
+				   &len, initial_boot_params);
 	if (!prop)
 		return;
 	start = of_read_ulong(prop, len/4);
 
-	prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
+	prop = of_get_flat_dt_prop(node, "linux,initrd-end",
+				   &len, initial_boot_params);
 	if (!prop)
 		return;
 	end = of_read_ulong(prop, len/4);
@@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
 	dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
 
-	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
+	prop = of_get_flat_dt_prop(node, "#size-cells",
+				   NULL, initial_boot_params);
 	if (prop)
 		dt_root_size_cells = be32_to_cpup(prop);
 	pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
 
-	prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
+	prop = of_get_flat_dt_prop(node, "#address-cells",
+				   NULL, initial_boot_params);
 	if (prop)
 		dt_root_addr_cells = be32_to_cpup(prop);
 	pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
@@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	return 1;
 }
 
-u64 __init dt_mem_next_cell(int s, __be32 **cellp)
+u64  dt_mem_next_cell(int s, __be32 **cellp)
 {
 	__be32 *p = *cellp;
 
@@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)
 int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	char *type = of_get_flat_dt_prop(node, "device_type",
+					 NULL, initial_boot_params);
 	__be32 *reg, *endp;
 	unsigned long l;
 
@@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 	} else if (strcmp(type, "memory") != 0)
 		return 0;
 
-	reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
+	reg = of_get_flat_dt_prop(node, "linux,usable-memory",
+				  &l, initial_boot_params);
 	if (reg == NULL)
-		reg = of_get_flat_dt_prop(node, "reg", &l);
+		reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params);
 	if (reg == NULL)
 		return 0;
 
@@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 
 	early_init_dt_check_for_initrd(node);
 
+#ifdef CONFIG_CMDLINE
 	/* Retreive command line */
-	p = of_get_flat_dt_prop(node, "bootargs", &l);
+	p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params);
 	if (p != NULL && l > 0)
 		strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
 
-#ifdef CONFIG_CMDLINE
 #ifndef CONFIG_CMDLINE_FORCE
 	if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
 #endif
@@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 
 	early_init_dt_scan_chosen_arch(node);
 
+#ifdef CONFIG_CMDLINE
 	pr_debug("Command line is: %s\n", cmd_line);
+#endif /* CONFIG_CMDLINE */
 
 	/* break now */
 	return 1;
 }
 
+
+static unsigned long early_device_tree_alloc(u64 size, u64 align)
+{
+	unsigned long mem = early_init_dt_alloc_memory_arch(size, align);
+	return (unsigned long) __va(mem);
+}
+
 /**
  * unflatten_device_tree - create tree of device_nodes from flat blob
  *
@@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
  */
 void __init unflatten_device_tree(void)
 {
+	__unflatten_device_tree(initial_boot_params, &allnodes,
+				early_device_tree_alloc);
+
+	/* Get pointer to OF "/chosen" node for use everywhere */
+	of_chosen = of_find_node_by_path("/chosen");
+	if (of_chosen == NULL)
+		of_chosen = of_find_node_by_path("/chosen@0");
+}
+
+#endif
+
+static unsigned long kernel_tree_alloc(u64 size, u64 align)
+{
+	return (unsigned long) kzalloc(size, GFP_KERNEL);
+}
+
+/**
+ * unflatten_partial_device_tree - create tree of device_nodes from flat blob
+ *
+ * unflattens the device-tree passed by the firmware, creating the
+ * tree of struct device_node. It also fills the "name" and "type"
+ * pointers of the nodes so the normal device-tree walking functions
+ * can be used.
+ */
+void unflatten_partial_device_tree(unsigned long *blob,
+				   struct device_node **mynodes)
+{
+	__unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
+}
+EXPORT_SYMBOL(unflatten_partial_device_tree);
+
+/**
+ * __unflatten_device_tree - create tree of device_nodes from flat blob
+ *
+ * unflattens the device-tree passed by the firmware, creating the
+ * tree of struct device_node. It also fills the "name" and "type"
+ * pointers of the nodes so the normal device-tree walking functions
+ * can be used.  Memory is allocated using the given function.
+ */
+void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
+			     unsigned long (*dt_alloc)(u64 size, u64 align))
+{
+	struct boot_param_header *device_tree =
+		(struct boot_param_header *)blob;
 	unsigned long start, mem, size;
-	struct device_node **allnextp = &allnodes;
+	struct device_node **allnextp = mynodes;
 
 	pr_debug(" -> unflatten_device_tree()\n");
 
-	if (!initial_boot_params) {
+	if (!device_tree) {
 		pr_debug("No device tree pointer\n");
 		return;
 	}
 
 	pr_debug("Unflattening device tree:\n");
-	pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic));
-	pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize));
-	pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version));
+	pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic));
+	pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize));
+	pr_debug("version: %08x\n", be32_to_cpu(device_tree->version));
 
-	if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
-		pr_err("Invalid device tree blob header\n");
+	if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) {
+		pr_err("Invalid device tree blob header %x\n",
+		       be32_to_cpu(device_tree->magic));
 		return;
 	}
 
 	/* First pass, scan for size */
-	start = ((unsigned long)initial_boot_params) +
-		be32_to_cpu(initial_boot_params->off_dt_struct);
-	size = unflatten_dt_node(0, &start, NULL, NULL, 0);
+	start = ((unsigned long)device_tree) +
+		be32_to_cpu(device_tree->off_dt_struct);
+	size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree);
 	size = (size | 3) + 1;
 
 	pr_debug("  size is %lx, allocating...\n", size);
 
 	/* Allocate memory for the expanded device tree */
-	mem = early_init_dt_alloc_memory_arch(size + 4,
-			__alignof__(struct device_node));
-	mem = (unsigned long) __va(mem);
+	mem = (unsigned long) dt_alloc(size + 4,
+		      __alignof__(struct device_node));
 
 	((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
 
 	pr_debug("  unflattening %lx...\n", mem);
 
 	/* Second pass, do actual unflattening */
-	start = ((unsigned long)initial_boot_params) +
-		be32_to_cpu(initial_boot_params->off_dt_struct);
-	unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
+	start = ((unsigned long)device_tree) +
+		be32_to_cpu(device_tree->off_dt_struct);
+	unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree);
 	if (be32_to_cpup((__be32 *)start) != OF_DT_END)
-		pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
+		pr_warning("Weird tag at end of tree: %08x\n",
+			   *((u32 *)start));
 	if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
 		pr_warning("End of tree marker overwritten: %08x\n",
 			   be32_to_cpu(((__be32 *)mem)[size / 4]));
 	*allnextp = NULL;
 
-	/* Get pointer to OF "/chosen" node for use everywhere */
-	of_chosen = of_find_node_by_path("/chosen");
-	if (of_chosen == NULL)
-		of_chosen = of_find_node_by_path("/chosen@0");
-
 	pr_debug(" <- unflatten_device_tree()\n");
 }
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 71e1a91..2bc0754 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
 /* For scanning the flat device-tree at boot time */
-extern char *find_flat_dt_string(u32 offset);
+extern char *find_flat_dt_string(u32 offset,
+			  struct boot_param_header *blob);
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
 				     int depth, void *data),
 			   void *data);
 extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
-				 unsigned long *size);
-extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
+				 unsigned long *size,
+			  struct boot_param_header *blob);
+extern int of_flat_dt_is_compatible(unsigned long node, const char *name,
+			  struct boot_param_header *blob);
 extern unsigned long of_get_flat_dt_root(void);
 extern void early_init_dt_scan_chosen_arch(unsigned long node);
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
@@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
 
 /* Other Prototypes */
 extern void unflatten_device_tree(void);
+extern void unflatten_partial_device_tree(unsigned long *blob,
+					  struct device_node **mynodes);
 extern void early_init_devtree(void *);
 #else /* CONFIG_OF_FLATTREE */
 static inline void unflatten_device_tree(void) {}
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 3/9] of/base.c: export property access/modification functions
       [not found]     ` <1279918663-29960-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57       ` Stephen Neuendorffer
       [not found]         ` <ceba5315-090d-4776-9315-0cbca209b5af-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

These functions can be usefully used by device drivers.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
 drivers/of/base.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index e3f7af8..9ee27f6 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -763,6 +763,7 @@ int prom_add_property(struct device_node *np, struct property *prop)
 
 	return 0;
 }
+EXPORT_SYMBOL(prom_add_property);
 
 /**
  * prom_remove_property - Remove a property from a node.
@@ -804,6 +805,7 @@ int prom_remove_property(struct device_node *np, struct property *prop)
 
 	return 0;
 }
+EXPORT_SYMBOL(prom_remove_property);
 
 /*
  * prom_update_property - Update a property in a node.
@@ -848,6 +850,7 @@ int prom_update_property(struct device_node *np,
 
 	return 0;
 }
+EXPORT_SYMBOL(prom_update_property);
 
 #if defined(CONFIG_OF_DYNAMIC)
 /*
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 4/9] drivers/of: Allow IRQ code to work properly on architectures without NO_IRQ
       [not found]       ` <1279918663-29960-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57         ` Stephen Neuendorffer
  0 siblings, 0 replies; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Sane architectures don't rely on NO_IRQ.  The device tree code shouldn't
require it either.
---
 drivers/of/irq.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 6cfb307..e85883e 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -24,6 +24,12 @@
 #include <linux/of_irq.h>
 #include <linux/string.h>
 
+#ifdef NO_IRQ
+#define OF_NO_IRQ NO_IRQ
+#else
+#define OF_NO_IRQ 0
+#endif
+
 /**
  * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
  * @device: Device node of the device whose interrupt is to be mapped
@@ -37,7 +43,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
 	struct of_irq oirq;
 
 	if (of_irq_map_one(dev, index, &oirq))
-		return NO_IRQ;
+		return OF_NO_IRQ;
 
 	return irq_create_of_mapping(oirq.controller, oirq.specifier,
 				     oirq.size);
@@ -337,7 +343,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 
 	/* Only dereference the resource if both the
 	 * resource and the irq are valid. */
-	if (r && irq != NO_IRQ) {
+	if (r && irq != OF_NO_IRQ) {
 		r->start = r->end = irq;
 		r->flags = IORESOURCE_IRQ;
 		r->name = dev->full_name;
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 5/9] arch/x86: Add support for device tree code.
       [not found]         ` <1279918663-29960-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57           ` Stephen Neuendorffer
       [not found]             ` <a85fdc9c-4a93-4381-b01e-5b9bc7666863-RaUQJvECHitCYczPSvLbDrjjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

A few support device-tree related support functions that x86 didn't
have before.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

----

 I have no idea if continuing to add these functions to every arch is
a good thing or whether they should (for instance) be weak symbols
with a generic definition.
---
 arch/x86/include/asm/device.h |    3 ++
 arch/x86/include/asm/irq.h    |    4 ++
 arch/x86/kernel/Makefile      |    1 +
 arch/x86/kernel/device_tree.c |   63 +++++++++++++++++++++++++++++++++++++++++
 drivers/of/platform.c         |    2 +
 include/linux/of_irq.h        |    1 +
 6 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/kernel/device_tree.c

diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 029f230..0bf0a17 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -16,4 +16,7 @@ struct dma_map_ops *dma_ops;
 struct pdev_archdata {
 };
 
+/* Don't override the default bus id behaviour */
+#define of_device_make_bus_id __of_device_make_bus_id
+
 #endif /* _ASM_X86_DEVICE_H */
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index 5458380..6c61992 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -10,6 +10,10 @@
 #include <asm/apicdef.h>
 #include <asm/irq_vectors.h>
 
+#define NO_IRQ (-1)
+
+#define irq_dispose_mapping(...)
+
 static inline int irq_canonicalize(int irq)
 {
 	return ((irq == 2) ? 9 : irq);
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index e77b220..a5c20e8 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -105,6 +105,7 @@ scx200-y			+= scx200_32.o
 
 obj-$(CONFIG_OLPC)		+= olpc.o
 obj-$(CONFIG_X86_MRST)		+= mrst.o
+obj-$(CONFIG_OF)		+= device_tree.o
 
 microcode-y				:= microcode_core.o
 microcode-$(CONFIG_MICROCODE_INTEL)	+= microcode_intel.o
diff --git a/arch/x86/kernel/device_tree.c b/arch/x86/kernel/device_tree.c
new file mode 100644
index 0000000..543884c
--- /dev/null
+++ b/arch/x86/kernel/device_tree.c
@@ -0,0 +1,63 @@
+#undef DEBUG
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/pci_regs.h>
+#include <linux/module.h>
+#include <linux/ioport.h>
+#include <linux/etherdevice.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+struct bus_type of_platform_bus_type = {
+       .uevent	= of_device_uevent,
+};
+EXPORT_SYMBOL(of_platform_bus_type);
+
+static int __init of_bus_driver_init(void)
+{
+	return of_bus_type_init(&of_platform_bus_type, "of_platform");
+}
+postcore_initcall(of_bus_driver_init);
+
+/*
+ * The list of OF IDs below is used for matching bus types in the
+ * system whose devices are to be exposed as of_platform_devices.
+ *
+ * This is the default list valid for most platforms. This file provides
+ * functions who can take an explicit list if necessary though
+ *
+ * The search is always performed recursively looking for children of
+ * the provided device_node and recursively if such a children matches
+ * a bus type in the list
+ */
+
+const struct of_device_id of_default_bus_ids[] = {
+	{ .type = "soc", },
+	{ .compatible = "soc", },
+	{ .compatible = "simple-bus", },
+	{ .type = "plb5", },
+	{ .type = "plb4", },
+	{ .type = "opb", },
+	{ .type = "simple", },
+	{},
+};
+
+/*
+ * Interrupt remapper
+ */
+
+struct device_node *of_irq_find_parent_by_phandle(phandle p)
+{
+	return of_find_node_by_phandle(p);
+}
+
+unsigned int irq_create_of_mapping(struct device_node *controller,
+				   const u32 *intspec, unsigned int intsize)
+{
+	return intspec[0] + 1;
+}
+EXPORT_SYMBOL_GPL(irq_create_of_mapping);
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9d3d932..0221125 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -20,6 +20,8 @@
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 
 #if defined(CONFIG_PPC_DCR)
 #include <asm/dcr.h>
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 5929781..25fc90d 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -7,6 +7,7 @@ struct of_irq;
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/of.h>
+#include <linux/irq.h>
 
 /*
  * irq_of_parse_and_map() is used ba all OF enabled platforms; but SPARC
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 6/9] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver.
       [not found]           ` <1279918663-29960-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57             ` Stephen Neuendorffer
       [not found]               ` <fad5faaa-1fab-4d9f-b41e-236b874e9c08-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

This device has an internal bus which contains multiple devices, which
are described in a device tree.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

----

This is probably still preliminary, although it actually works now.
1) It should probably correctly deallocate and free all the contained
devices.
2) It should probably handle different device trees for multiple boards
in the same system.  How to do this?
---
 drivers/pci/Kconfig        |    8 ++
 drivers/pci/Makefile       |    2 +
 drivers/pci/xilinx_pcipr.c |  197 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 207 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pci/xilinx_pcipr.c

diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 34ef70d..69616b6 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -65,3 +65,11 @@ config PCI_IOAPIC
 	depends on ACPI
 	depends on HOTPLUG
 	default y
+
+config XILINX_PCIPR
+	tristate "Xilinx OF-based PCI endpoint"
+	depends on PCI
+	select OF
+	select OF_FLATTREE
+	help
+	  Enable support for Xilinx PCIPR endpoint
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
index 0b51857..ec44c21 100644
--- a/drivers/pci/Makefile
+++ b/drivers/pci/Makefile
@@ -62,6 +62,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o
 
 obj-$(CONFIG_PCI_STUB) += pci-stub.o
 
+obj-$(CONFIG_XILINX_PCIPR) += xilinx_pcipr.o
+
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
diff --git a/drivers/pci/xilinx_pcipr.c b/drivers/pci/xilinx_pcipr.c
new file mode 100644
index 0000000..80f8f1a
--- /dev/null
+++ b/drivers/pci/xilinx_pcipr.c
@@ -0,0 +1,197 @@
+/*
+ *  Copyright 2010 Xilinx, Inc.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+#include <linux/dmi.h>
+#include <linux/firmware.h>
+
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/of_platform.h>
+
+#include <linux/io.h>
+
+#define DRV_NAME "xilinx_pcipr"
+
+struct xilinx_pcipr_drvdata {
+	struct device_node *child_nodes;
+	struct firmware *fw_entry;
+};
+
+/**
+ *	xilinx_pcipr_probe - Setup the endpoint
+ *	@dev: PCI device to set up
+ */
+static int __devinit xilinx_pcipr_probe(struct pci_dev *pdev,
+					const struct pci_device_id *id)
+{
+	int ret;
+	struct xilinx_pcipr_drvdata *drvdata;
+	resource_size_t start, len;
+	struct property *ranges_prop;
+	unsigned long *value;
+	struct device_node *bus_node;
+
+	dev_dbg(&pdev->dev, "xilinx_pcipr_probe\n");
+
+	drvdata = kzalloc(sizeof(struct xilinx_pcipr_drvdata), GFP_KERNEL);
+	if (!drvdata) {
+		dev_err(&pdev->dev,
+			"Couldn't allocate device private record\n");
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	dev_set_drvdata(&pdev->dev, (void *)drvdata);
+
+	/*
+	 * Do some basic sanity checking..
+	 */
+	if (pci_enable_device(pdev)) {
+		ret = -EBUSY;
+		goto free;
+	}
+
+	/* Enable the board to bus master. */
+	pci_set_master(pdev);
+
+	if (request_firmware(&drvdata->fw_entry,
+			    "xilinx_pcipr.dtb", &pdev->dev)) {
+		dev_err(&pdev->dev, "Couldn't get dtb\n");
+		ret = -ENODEV;
+		goto disable;
+	}
+
+
+	ret = pci_request_regions(pdev, "xilinx_pcipr");
+	if (ret)
+		goto release_dtb;
+
+	if (!pci_resource_start(pdev, 0)) {
+		dev_printk(KERN_ERR, &pdev->dev, "No cardbus resource!\n");
+		ret = -ENODEV;
+		goto release;
+	}
+
+
+	/*
+	 * report the subsystem vendor and device for help debugging
+	 * the irq stuff...
+	 */
+	dev_printk(KERN_INFO, &pdev->dev,
+		   "Xilinx PCIPR bridge found [%04x:%04x]\n",
+		   pdev->subsystem_vendor, pdev->subsystem_device);
+
+	/* Stuff the ranges property into the toplevel bus of the device
+	   tree, according to how the BARs are programmed */
+	start = pci_resource_start(pdev, 0);
+	len = pci_resource_len(pdev, 0);
+
+	dev_printk(KERN_INFO, &pdev->dev,
+		   "Xilinx PCIPR bridge range %llx %llx",
+		   (unsigned long long) start, (unsigned long long) len);
+
+	ranges_prop = kzalloc(sizeof(struct property), GFP_KERNEL);
+	ranges_prop->value = kzalloc(sizeof(unsigned long) * 3, GFP_KERNEL);
+	ranges_prop->name = "ranges";
+	ranges_prop->length = sizeof(unsigned long) * 3;
+	value = (unsigned long *)ranges_prop->value;
+	/* FIXME: gotta get this from the bridge */
+	value[0] = cpu_to_be32(0x80000000);
+	value[1] = cpu_to_be32(start);
+	value[2] = cpu_to_be32(len);
+
+	unflatten_partial_device_tree((unsigned long *)drvdata->fw_entry->data,
+				      &drvdata->child_nodes);
+	of_node_get(drvdata->child_nodes);
+	bus_node = of_find_node_by_name(drvdata->child_nodes, "plb");
+	prom_add_property(bus_node, ranges_prop);
+
+	/* Generate child devices from the device tree */
+	of_platform_bus_probe(drvdata->child_nodes, NULL, &pdev->dev);
+
+	pci_release_regions(pdev);
+
+	goto out; /* Success */
+
+ release:
+	pci_release_regions(pdev);
+
+ release_dtb:
+	release_firmware(drvdata->fw_entry);
+
+ disable:
+	pci_disable_device(pdev);
+ free:
+	kfree(drvdata);
+	dev_set_drvdata(&pdev->dev, NULL);
+ out:
+	return ret;
+}
+
+static int __devexit xilinx_pcipr_remove(struct pci_dev *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct xilinx_pcipr_drvdata *drvdata = dev_get_drvdata(dev);
+
+	/* FIXME: Release the contained devices. There should probably
+be a device-tree method to free a whole tree of devices, essentially
+the inverse of of_platform_bus_probe
+	*/
+
+	release_firmware(drvdata->fw_entry);
+	pci_disable_device(pdev);
+	kfree(drvdata);
+	dev_set_drvdata(dev, NULL);
+	return 0;
+}
+
+
+static const struct pci_device_id xilinx_pcipr_ids[] = {
+	{ PCI_VDEVICE(XILINX, 0x0505), 0 },
+	{ 0, },
+};
+MODULE_DEVICE_TABLE(pci, xilinx_pcipr_ids);
+
+pci_ers_result_t *xilinx_pcipr_error_detected(struct pci_dev *pdev,
+					      enum pci_channel_state error) {
+	dev_printk(KERN_INFO, &pdev->dev, "Error detected!\n");
+	return PCI_ERS_RESULT_NEED_RESET;
+}
+
+static struct pci_error_handlers xilinx_pcipr_error_handlers = {
+	/* PCI bus error detected on this device */
+	.error_detected = xilinx_pcipr_error_detected,
+};
+
+static struct pci_driver  xilinx_pcipr_driver = {
+	.name		= "XILINX_PCIPR",
+	.id_table	= xilinx_pcipr_ids,
+	.probe		= xilinx_pcipr_probe,
+	.remove		= __devexit_p(xilinx_pcipr_remove),
+	.err_handler    = &xilinx_pcipr_error_handlers,
+};
+
+static int __init xilinx_pcipr_init(void)
+{
+	return ide_pci_register_driver(&xilinx_pcipr_driver);
+}
+
+static void __exit xilinx_pcipr_exit(void)
+{
+	pci_unregister_driver(&xilinx_pcipr_driver);
+}
+
+module_init(xilinx_pcipr_init);
+module_exit(xilinx_pcipr_exit);
+
+MODULE_AUTHOR("Xilinx Research Labs");
+MODULE_DESCRIPTION("PCI driver for PCI reconfigurable endpoint");
+MODULE_LICENSE("GPL");
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 7/9] [Xilinx] xilinx_hwicap: use linux/io.h instead of asm/io.h
       [not found]             ` <1279918663-29960-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57               ` Stephen Neuendorffer
       [not found]                 ` <bd5961af-2af1-4f6d-a220-a03fdbb19453-+Ck8Kgl/v0+44QFJ4H5SYbjjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Better style, and it gives access to the asm-generic/iomap.h
accessors in all architectures.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
 drivers/char/xilinx_hwicap/buffer_icap.h   |    3 +--
 drivers/char/xilinx_hwicap/fifo_icap.h     |    3 +--
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |    3 +--
 drivers/char/xilinx_hwicap/xilinx_hwicap.h |    3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h
index d4f419e..aa859b0 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.h
+++ b/drivers/char/xilinx_hwicap/buffer_icap.h
@@ -36,8 +36,7 @@
 #include <linux/types.h>
 #include <linux/cdev.h>
 #include <linux/platform_device.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 #include "xilinx_hwicap.h"
 
 /* Loads a partial bitstream from system memory. */
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h
index 4c9dd9a..b266c40 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.h
+++ b/drivers/char/xilinx_hwicap/fifo_icap.h
@@ -36,8 +36,7 @@
 #include <linux/types.h>
 #include <linux/cdev.h>
 #include <linux/platform_device.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 #include "xilinx_hwicap.h"
 
 /* Reads integers from the device into the storage buffer. */
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index ed8a9ce..6172689 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -87,8 +87,7 @@
 #include <linux/cdev.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
index 8cca119..e0a6857 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
@@ -36,8 +36,7 @@
 #include <linux/types.h>
 #include <linux/cdev.h>
 #include <linux/platform_device.h>
-
-#include <asm/io.h>
+#include <linux/io.h>
 
 struct hwicap_drvdata {
 	u32 write_buffer_in_use;  /* Always in [0,3] */
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 8/9] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors
       [not found]               ` <1279918663-29960-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57                 ` Stephen Neuendorffer
       [not found]                   ` <e8b3593c-3be3-4b4e-aabd-e3baeb4e792a-+Ck8Kgl/v0/VOT3FKhN2rLjjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

out_be32 and in_be32 are mainly powerpc-isms.  Switch
to using ioread32be and iowrite32be instead.  This allows
the code to be used on x86 or ARM, for instance.

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
 drivers/char/xilinx_hwicap/buffer_icap.c   |   16 +++++-----
 drivers/char/xilinx_hwicap/fifo_icap.c     |   39 +++++++++++++--------------
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |    1 +
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c
index 05d8977..bc361fc 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.c
+++ b/drivers/char/xilinx_hwicap/buffer_icap.c
@@ -87,7 +87,7 @@
  **/
 u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
 {
-	return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
+	return ioread32be(drvdata->base_address + XHI_STATUS_REG_OFFSET);
 }
 
 /**
@@ -101,7 +101,7 @@ u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
 static inline u32 buffer_icap_get_bram(void __iomem *base_address,
 		u32 offset)
 {
-	return in_be32(base_address + (offset << 2));
+	return ioread32be(base_address + (offset << 2));
 }
 
 /**
@@ -114,7 +114,7 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address,
  **/
 static inline bool buffer_icap_busy(void __iomem *base_address)
 {
-	u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET);
+	u32 status = ioread32be(base_address + XHI_STATUS_REG_OFFSET);
 	return (status & 1) == XHI_NOT_FINISHED;
 }
 
@@ -129,7 +129,7 @@ static inline bool buffer_icap_busy(void __iomem *base_address)
 static inline void buffer_icap_set_size(void __iomem *base_address,
 		u32 data)
 {
-	out_be32(base_address + XHI_SIZE_REG_OFFSET, data);
+	iowrite32be(data, base_address + XHI_SIZE_REG_OFFSET);
 }
 
 /**
@@ -143,7 +143,7 @@ static inline void buffer_icap_set_size(void __iomem *base_address,
 static inline void buffer_icap_set_offset(void __iomem *base_address,
 		u32 data)
 {
-	out_be32(base_address + XHI_BRAM_OFFSET_REG_OFFSET, data);
+	iowrite32be(data, base_address + XHI_BRAM_OFFSET_REG_OFFSET);
 }
 
 /**
@@ -159,7 +159,7 @@ static inline void buffer_icap_set_offset(void __iomem *base_address,
 static inline void buffer_icap_set_rnc(void __iomem *base_address,
 		u32 data)
 {
-	out_be32(base_address + XHI_RNC_REG_OFFSET, data);
+	iowrite32be(data, base_address + XHI_RNC_REG_OFFSET);
 }
 
 /**
@@ -174,7 +174,7 @@ static inline void buffer_icap_set_rnc(void __iomem *base_address,
 static inline void buffer_icap_set_bram(void __iomem *base_address,
 		u32 offset, u32 data)
 {
-	out_be32(base_address + (offset << 2), data);
+	iowrite32be(data, base_address + (offset << 2));
 }
 
 /**
@@ -255,7 +255,7 @@ static int buffer_icap_device_write(struct hwicap_drvdata *drvdata,
  **/
 void buffer_icap_reset(struct hwicap_drvdata *drvdata)
 {
-    out_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET, 0xFEFE);
+	iowrite32be(0xFEFE, drvdata->base_address + XHI_STATUS_REG_OFFSET);
 }
 
 /**
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c
index 02225eb..062df1d 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.c
+++ b/drivers/char/xilinx_hwicap/fifo_icap.c
@@ -94,7 +94,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
 		u32 data)
 {
 	dev_dbg(drvdata->dev, "fifo_write: %x\n", data);
-	out_be32(drvdata->base_address + XHI_WF_OFFSET, data);
+	iowrite32be(data, drvdata->base_address + XHI_WF_OFFSET);
 }
 
 /**
@@ -105,7 +105,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
  **/
 static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
 {
-	u32 data = in_be32(drvdata->base_address + XHI_RF_OFFSET);
+	u32 data = ioread32be(drvdata->base_address + XHI_RF_OFFSET);
 	dev_dbg(drvdata->dev, "fifo_read: %x\n", data);
 	return data;
 }
@@ -118,7 +118,7 @@ static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
 static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
 		u32 data)
 {
-	out_be32(drvdata->base_address + XHI_SZ_OFFSET, data);
+	iowrite32be(data, drvdata->base_address + XHI_SZ_OFFSET);
 }
 
 /**
@@ -127,7 +127,7 @@ static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
  **/
 static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
 {
-	out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_WRITE_MASK);
+	iowrite32be(XHI_CR_WRITE_MASK, drvdata->base_address + XHI_CR_OFFSET);
 	dev_dbg(drvdata->dev, "configuration started\n");
 }
 
@@ -137,7 +137,7 @@ static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
  **/
 static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
 {
-	out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_READ_MASK);
+	iowrite32be(XHI_CR_READ_MASK, drvdata->base_address + XHI_CR_OFFSET);
 	dev_dbg(drvdata->dev, "readback started\n");
 }
 
@@ -159,7 +159,7 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
  **/
 u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
 {
-	u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
+	u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
 	dev_dbg(drvdata->dev, "Getting status = %x\n", status);
 	return status;
 }
@@ -170,7 +170,7 @@ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
  **/
 static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
 {
-	u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
+	u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
 	return (status & XHI_SR_DONE_MASK) ? 0 : 1;
 }
 
@@ -183,7 +183,7 @@ static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
 static inline u32 fifo_icap_write_fifo_vacancy(
 		struct hwicap_drvdata *drvdata)
 {
-	return in_be32(drvdata->base_address + XHI_WFV_OFFSET);
+	return ioread32be(drvdata->base_address + XHI_WFV_OFFSET);
 }
 
 /**
@@ -195,7 +195,7 @@ static inline u32 fifo_icap_write_fifo_vacancy(
 static inline u32 fifo_icap_read_fifo_occupancy(
 		struct hwicap_drvdata *drvdata)
 {
-	return in_be32(drvdata->base_address + XHI_RFO_OFFSET);
+	return ioread32be(drvdata->base_address + XHI_RFO_OFFSET);
 }
 
 /**
@@ -361,13 +361,12 @@ void fifo_icap_reset(struct hwicap_drvdata *drvdata)
 	 * Reset the device by setting/clearing the RESET bit in the
 	 * Control Register.
 	 */
-	reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
+	reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
 
-	out_be32(drvdata->base_address + XHI_CR_OFFSET,
-				reg_data | XHI_CR_SW_RESET_MASK);
-
-	out_be32(drvdata->base_address + XHI_CR_OFFSET,
-				reg_data & (~XHI_CR_SW_RESET_MASK));
+	iowrite32be(reg_data | XHI_CR_SW_RESET_MASK,
+		    drvdata->base_address + XHI_CR_OFFSET);
+	iowrite32be(reg_data & (~XHI_CR_SW_RESET_MASK),
+		    drvdata->base_address + XHI_CR_OFFSET);
 
 }
 
@@ -382,12 +381,12 @@ void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata)
 	 * Flush the FIFO by setting/clearing the FIFO Clear bit in the
 	 * Control Register.
 	 */
-	reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
+	reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
 
-	out_be32(drvdata->base_address + XHI_CR_OFFSET,
-				reg_data | XHI_CR_FIFO_CLR_MASK);
+	iowrite32be(reg_data | XHI_CR_FIFO_CLR_MASK,
+		    drvdata->base_address + XHI_CR_OFFSET);
 
-	out_be32(drvdata->base_address + XHI_CR_OFFSET,
-				reg_data & (~XHI_CR_FIFO_CLR_MASK));
+	iowrite32be(reg_data & (~XHI_CR_FIFO_CLR_MASK),
+		    drvdata->base_address + XHI_CR_OFFSET);
 }
 
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 6172689..7d0f0fb 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -95,6 +95,7 @@
 /* For open firmware. */
 #include <linux/of_device.h>
 #include <linux/of_platform.h>
+#include <linux/of_address.h>
 #endif
 
 #include "xilinx_hwicap.h"
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
       [not found]                 ` <1279918663-29960-9-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
@ 2010-07-23 20:57                   ` Stephen Neuendorffer
       [not found]                     ` <d3cc257d-ca6f-40cd-82d4-5941e5fbc1d0-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 20:57 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
 drivers/char/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index 7cfcc62..f445f2f 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -909,7 +909,7 @@ config DTLK
 
 config XILINX_HWICAP
 	tristate "Xilinx HWICAP Support"
-	depends on XILINX_VIRTEX || MICROBLAZE
+	depends on OF
 	help
 	  This option enables support for Xilinx Internal Configuration
 	  Access Port (ICAP) driver.  The ICAP is used on Xilinx Virtex
-- 
1.5.6.6



This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* RE: [PATCH 0/9] Xilinx PCI endpoint driver
       [not found] ` <1279918663-29960-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
  2010-07-23 20:57   ` [PATCH 1/9] drivers/of: Make device tree code work on any arch Stephen Neuendorffer
@ 2010-07-23 21:39   ` Stephen Neuendorffer
       [not found]     ` <0f773b9c-7bf4-4795-93e1-64b1f81dd286-+Ck8Kgl/v08NTaRkHJHP0bjjLBE8jN/0@public.gmane.org>
  1 sibling, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-07-23 21:39 UTC (permalink / raw)
  To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

Sorry, I just realized that the NO_IRQ patch is incomplete 'cuz I hadn't
fixed the
x86 part...  But can you try putting the hwicap fix in the test tree?

Steve

> -----Original Message-----
> From: Stephen Neuendorffer [mailto:stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org]
> Sent: Friday, July 23, 2010 1:58 PM
> To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org; devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> Cc: Stephen Neuendorffer
> Subject: [PATCH 0/9] Xilinx PCI endpoint driver
> 
> The bulk of this code is still preliminary.  This update contains a
fix
> 	for the hwicap core, which should work on all arches this time.
There's
> also an IRQ-related fix that removes the dependency of drivers/of on a
> architecture-specific definition of NO_IRQ.
> 
> Stephen Neuendorffer (9):
>   drivers/of: Make device tree code work on any arch.
>   of/fdt: Add unflatten_partial_device_tree
>   of/base.c: export property access/modification functions
>   drivers/of: Allow IRQ code to work properly on architectures without
>     NO_IRQ
>   arch/x86: Add support for device tree code.
>   [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint
>     driver.
>   [Xilinx] xilinx_hwicap: use linux/io.h instead of asm/io.h
>   [Xilinx] xilinx_hwicap: Update driver to use generic io accessors
>   [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are
>     available.
> 
>  arch/x86/include/asm/device.h              |    3 +
>  arch/x86/include/asm/irq.h                 |    4 +
>  arch/x86/kernel/Makefile                   |    1 +
>  arch/x86/kernel/device_tree.c              |   63 +++++++++
>  drivers/char/Kconfig                       |    2 +-
>  drivers/char/xilinx_hwicap/buffer_icap.c   |   16 +-
>  drivers/char/xilinx_hwicap/buffer_icap.h   |    3 +-
>  drivers/char/xilinx_hwicap/fifo_icap.c     |   39 +++---
>  drivers/char/xilinx_hwicap/fifo_icap.h     |    3 +-
>  drivers/char/xilinx_hwicap/xilinx_hwicap.c |    4 +-
>  drivers/char/xilinx_hwicap/xilinx_hwicap.h |    3 +-
>  drivers/of/address.c                       |    5 +
>  drivers/of/base.c                          |    3 +
>  drivers/of/device.c                        |    7 +-
>  drivers/of/fdt.c                           |  169
+++++++++++++++++-------
>  drivers/of/irq.c                           |   10 +-
>  drivers/of/platform.c                      |    2 +
>  drivers/pci/Kconfig                        |    8 +
>  drivers/pci/Makefile                       |    2 +
>  drivers/pci/xilinx_pcipr.c                 |  197
++++++++++++++++++++++++++++
>  include/linux/of_fdt.h                     |   11 +-
>  include/linux/of_irq.h                     |    1 +
>  22 files changed, 462 insertions(+), 94 deletions(-)
>  create mode 100644 arch/x86/kernel/device_tree.c
>  create mode 100644 drivers/pci/xilinx_pcipr.c
> 


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* Re: [PATCH 0/9] Xilinx PCI endpoint driver
       [not found]     ` <0f773b9c-7bf4-4795-93e1-64b1f81dd286-+Ck8Kgl/v08NTaRkHJHP0bjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 17:15       ` Grant Likely
       [not found]         ` <AANLkTim81JjUYzRaiz_X3sh1evKSEfUia39_Lzjr7H-o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Grant Likely @ 2010-08-10 17:15 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 3:39 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> Sorry, I just realized that the NO_IRQ patch is incomplete 'cuz I hadn't
> fixed the
> x86 part...  But can you try putting the hwicap fix in the test tree?

Hi Stephen,  I didn't get a chance to look at these before the merge
window opened, and then of course everything else fell to the wayside.
 I'll take a quick look now, but a bunch of devicetree changes went in
that will affect some of your patches, so you'll want to rebase on top
of Linus' current tree sometime soon.

g.

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

* Re: [PATCH 1/9] drivers/of: Make device tree code work on any arch.
       [not found]     ` <7e773827-71eb-47a5-826c-cd255b4ce02c-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>
@ 2010-08-10 17:22       ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 17:22 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

You should be able to drop this patch now.  A generic version is part
of the common include.

g.

>
> ---
>
> I'm not sure what the right way to abstract these functions is.
> of_node_to_nid seems specific to those platforms which have a root
> device tree.  pci_address_to_pio seems to probably have a useful
> implementation, but I'm not sure what it's trying to do.  Perhaps
> someone can shed some light?
> ---
>  drivers/of/address.c |    5 +++++
>  drivers/of/device.c  |    7 ++++++-
>  2 files changed, 11 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index fcadb72..61e652b 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -539,7 +539,12 @@ static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
>        memset(r, 0, sizeof(struct resource));
>        if (flags & IORESOURCE_IO) {
>                unsigned long port;
> +               // FIXME: utter hack...
> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC)
>                port = pci_address_to_pio(taddr);
> +#else
> +               port = -1;
> +#endif
>                if (port == (unsigned long)-1)
>                        return -EINVAL;
>                r->start = port;
> diff --git a/drivers/of/device.c b/drivers/of/device.c
> index 5282a20..27a65fc 100644
> --- a/drivers/of/device.c
> +++ b/drivers/of/device.c
> @@ -107,8 +107,13 @@ int of_device_register(struct of_device *ofdev)
>        /* device_add will assume that this device is on the same node as
>         * the parent. If there is no parent defined, set the node
>         * explicitly */
> -       if (!ofdev->dev.parent)
> +       if (!ofdev->dev.parent) {
> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC)
>                set_dev_node(&ofdev->dev, of_node_to_nid(ofdev->dev.of_node));
> +#else
> +               set_dev_node(&ofdev->dev, -1);
> +#endif
> +       }
>
>        return device_add(&ofdev->dev);
>  }
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* RE: [PATCH 0/9] Xilinx PCI endpoint driver
       [not found]         ` <AANLkTim81JjUYzRaiz_X3sh1evKSEfUia39_Lzjr7H-o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-10 17:27           ` Stephen Neuendorffer
  0 siblings, 0 replies; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-08-10 17:27 UTC (permalink / raw)
  To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ


> -----Original Message-----
> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely
> Sent: Tuesday, August 10, 2010 10:15 AM
> To: Stephen Neuendorffer
> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> Subject: Re: [PATCH 0/9] Xilinx PCI endpoint driver
> 
> On Fri, Jul 23, 2010 at 3:39 PM, Stephen Neuendorffer
> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> > Sorry, I just realized that the NO_IRQ patch is incomplete 'cuz I hadn't
> > fixed the
> > x86 part...  But can you try putting the hwicap fix in the test tree?
> 
> Hi Stephen,  I didn't get a chance to look at these before the merge
> window opened, and then of course everything else fell to the wayside.
>  I'll take a quick look now, but a bunch of devicetree changes went in
> that will affect some of your patches, so you'll want to rebase on top
> of Linus' current tree sometime soon.
> 
> g.

No worries about the hwicap stuff...

As for the other device tree things:
I've also been stuck on other things and haven't had much chance to drive anything.
I see the main barrier being the code that has to get added to x86 to make it work,
and all the recent updates you've made are moving in exactly the right direction, so
I've been waiting a bit for that to settle down.

Steve

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* Re: [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree
       [not found]       ` <39f3d9ca-1943-43b8-a1f6-eba8fb2aeeec-RaUQJvECHiuXHCJdrdq+zrjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 17:46         ` Grant Likely
       [not found]           ` <AANLkTimPsDWcW_3z46mMFCxkui+3v6q64F2EMLBr6mNK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Grant Likely @ 2010-08-10 17:46 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> This code allows a user to parse a partial device tree blob, which is
> structurally independent of any toplevel blob.
> Previously, this code assumed that the blob comes from initial_boot_params.
> Now, unflatten_partial_device_tree can take a blob from an arbitrary position,
> and the location of the blob gets passed around to the various support functions.

For ease of review, please split this patch into two pieces; one to
pass around the boot_param_header pointer, and one to add the partial
parsing function.

>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/of/fdt.c       |  169 +++++++++++++++++++++++++++++++++--------------
>  include/linux/of_fdt.h |   11 ++-
>  2 files changed, 126 insertions(+), 54 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d61fda8..89fb1f3 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -11,10 +11,12 @@
>
>  #include <linux/kernel.h>
>  #include <linux/initrd.h>
> +#include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
>  #include <linux/string.h>
>  #include <linux/errno.h>
> +#include <linux/slab.h>
>
>  #ifdef CONFIG_PPC
>  #include <asm/machdep.h>
> @@ -22,15 +24,19 @@
>
>  #include <asm/page.h>
>
> -int __initdata dt_root_addr_cells;
> -int __initdata dt_root_size_cells;
> +int dt_root_addr_cells;
> +int dt_root_size_cells;

With this new use case, these globals really need to be removed and
handled safely.  You wouldn't want two partial trees getting parsed
expecting different values in these properties!  The solution is
possibly by putting them into a context structure that is passed
around the fdt parsing functions.  Another solution might be to hold a
mutex for the entirety of parsing the flat tree.

However, maybe this doesn't matter, and they can remain as __initdata.
 The only user of these values seems to be early_init_dt_scan_memory()
which I don't think you need for your PCI add in device use-case.  Am
I correct?

>  struct boot_param_header *initial_boot_params;
>
> -char *find_flat_dt_string(u32 offset)
> +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
> +                            unsigned long (*dt_alloc)(u64 size, u64 align));

If you order you functions correctly, this forward declaration can be removed.

> +
> +char *find_flat_dt_string(u32 offset,
> +                         struct boot_param_header *blob)
>  {
> -       return ((char *)initial_boot_params) +
> -               be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
> +       return ((char *)blob) +
> +               be32_to_cpu(blob->off_dt_strings) + offset;
>  }
>
>  /**
> @@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void)
>  * This function can be used within scan_flattened_dt callback to get
>  * access to properties
>  */
> -void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> -                                unsigned long *size)
> +void * __init of_get_flat_dt_prop(unsigned long node, const char *name,

Unrelated whitespace change.

> +                                unsigned long *size,
> +                                struct boot_param_header *blob)
>  {
>        unsigned long p = node;
>
> @@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
>                if (be32_to_cpu(initial_boot_params->version) < 0x10)
>                        p = ALIGN(p, sz >= 8 ? 8 : 4);
>
> -               nstr = find_flat_dt_string(noff);
> +               nstr = find_flat_dt_string(noff, blob);
>                if (nstr == NULL) {
>                        pr_warning("Can't find property index name !\n");
>                        return NULL;
> @@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
>  * @node: node to test
>  * @compat: compatible string to compare with compatible list.
>  */
> -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> +int  of_flat_dt_is_compatible(unsigned long node, const char *compat,
> +                                struct boot_param_header *blob)
>  {
>        const char *cp;
>        unsigned long cplen, l;
>
> -       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
> +       cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob);
>        if (cp == NULL)
>                return 0;
>        while (cplen > 0) {
> @@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
>        return 0;
>  }
>
> -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
>                                       unsigned long align)
>  {
>        void *res;
> @@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
>  * @allnextpp: pointer to ->allnext from last allocated device_node
>  * @fpsize: Size of the node path up at the current depth.
>  */
> -unsigned long __init unflatten_dt_node(unsigned long mem,
> -                                       unsigned long *p,
> -                                       struct device_node *dad,
> -                                       struct device_node ***allnextpp,
> -                                       unsigned long fpsize)
> +unsigned long unflatten_dt_node(unsigned long mem,
> +                               unsigned long *p,
> +                               struct device_node *dad,
> +                               struct device_node ***allnextpp,
> +                               unsigned long fpsize,
> +                               struct boot_param_header *blob)
>  {
>        struct device_node *np;
>        struct property *pp, **prev_pp = NULL;
> @@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
>                sz = be32_to_cpup((__be32 *)(*p));
>                noff = be32_to_cpup((__be32 *)((*p) + 4));
>                *p += 8;
> -               if (be32_to_cpu(initial_boot_params->version) < 0x10)
> +               if (be32_to_cpu(blob->version) < 0x10)
>                        *p = ALIGN(*p, sz >= 8 ? 8 : 4);
>
> -               pname = find_flat_dt_string(noff);
> +               pname = find_flat_dt_string(noff, blob);
>                if (pname == NULL) {
>                        pr_info("Can't find property name in list !\n");
>                        break;
> @@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
>                if (tag == OF_DT_NOP)
>                        *p += 4;
>                else
> -                       mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
> +                       mem = unflatten_dt_node(mem, p, np, allnextpp,
> +                                               fpsize, blob);
>                tag = be32_to_cpup((__be32 *)(*p));
>        }
>        if (tag != OF_DT_END_NODE) {
> @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
>        return mem;
>  }
>
> +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC)
> +

Nack.  arm, mips, and even some x86 platforms will use this code.  Not
sure what the best way to solve this is; need to think about it for a
bit.

>  #ifdef CONFIG_BLK_DEV_INITRD
>  /**
>  * early_init_dt_check_for_initrd - Decode initrd location from flat tree
> @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node)
>
>        pr_debug("Looking for initrd properties... ");
>
> -       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
> +       prop = of_get_flat_dt_prop(node, "linux,initrd-start",
> +                                  &len, initial_boot_params);
>        if (!prop)
>                return;
>        start = of_read_ulong(prop, len/4);
>
> -       prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
> +       prop = of_get_flat_dt_prop(node, "linux,initrd-end",
> +                                  &len, initial_boot_params);
>        if (!prop)
>                return;
>        end = of_read_ulong(prop, len/4);
> @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>        dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
>        dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
>
> -       prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> +       prop = of_get_flat_dt_prop(node, "#size-cells",
> +                                  NULL, initial_boot_params);
>        if (prop)
>                dt_root_size_cells = be32_to_cpup(prop);
>        pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
>
> -       prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> +       prop = of_get_flat_dt_prop(node, "#address-cells",
> +                                  NULL, initial_boot_params);
>        if (prop)
>                dt_root_addr_cells = be32_to_cpup(prop);
>        pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
>        return 1;
>  }
>
> -u64 __init dt_mem_next_cell(int s, __be32 **cellp)
> +u64  dt_mem_next_cell(int s, __be32 **cellp)

nit: single space between u64 and dt_mem_next_cell

>  {
>        __be32 *p = *cellp;
>
> @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)
>  int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
>                                     int depth, void *data)
>  {
> -       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> +       char *type = of_get_flat_dt_prop(node, "device_type",
> +                                        NULL, initial_boot_params);
>        __be32 *reg, *endp;
>        unsigned long l;
>
> @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
>        } else if (strcmp(type, "memory") != 0)
>                return 0;
>
> -       reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> +       reg = of_get_flat_dt_prop(node, "linux,usable-memory",
> +                                 &l, initial_boot_params);
>        if (reg == NULL)
> -               reg = of_get_flat_dt_prop(node, "reg", &l);
> +               reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params);
>        if (reg == NULL)
>                return 0;
>
> @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>
>        early_init_dt_check_for_initrd(node);
>
> +#ifdef CONFIG_CMDLINE
>        /* Retreive command line */
> -       p = of_get_flat_dt_prop(node, "bootargs", &l);
> +       p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params);
>        if (p != NULL && l > 0)
>                strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
>
> -#ifdef CONFIG_CMDLINE
>  #ifndef CONFIG_CMDLINE_FORCE
>        if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
>  #endif
> @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>
>        early_init_dt_scan_chosen_arch(node);
>
> +#ifdef CONFIG_CMDLINE
>        pr_debug("Command line is: %s\n", cmd_line);
> +#endif /* CONFIG_CMDLINE */
>
>        /* break now */
>        return 1;
>  }
>
> +
> +static unsigned long early_device_tree_alloc(u64 size, u64 align)
> +{
> +       unsigned long mem = early_init_dt_alloc_memory_arch(size, align);
> +       return (unsigned long) __va(mem);
> +}
> +
>  /**
>  * unflatten_device_tree - create tree of device_nodes from flat blob
>  *
> @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
>  */
>  void __init unflatten_device_tree(void)
>  {
> +       __unflatten_device_tree(initial_boot_params, &allnodes,
> +                               early_device_tree_alloc);
> +
> +       /* Get pointer to OF "/chosen" node for use everywhere */
> +       of_chosen = of_find_node_by_path("/chosen");
> +       if (of_chosen == NULL)
> +               of_chosen = of_find_node_by_path("/chosen@0");
> +}
> +
> +#endif

It is customary and helpful to put /* CONFIG_<blah> */ on an #endif line.

> +
> +static unsigned long kernel_tree_alloc(u64 size, u64 align)
> +{
> +       return (unsigned long) kzalloc(size, GFP_KERNEL);
> +}
> +
> +/**
> + * unflatten_partial_device_tree - create tree of device_nodes from flat blob
> + *
> + * unflattens the device-tree passed by the firmware, creating the
> + * tree of struct device_node. It also fills the "name" and "type"
> + * pointers of the nodes so the normal device-tree walking functions
> + * can be used.
> + */
> +void unflatten_partial_device_tree(unsigned long *blob,
> +                                  struct device_node **mynodes)
> +{
> +       __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
> +}
> +EXPORT_SYMBOL(unflatten_partial_device_tree);

Move the two unflatten functions below __unflatten_device_tree to
eliminate the forward declaration at the top of the file.

> +
> +/**
> + * __unflatten_device_tree - create tree of device_nodes from flat blob
> + *
> + * unflattens the device-tree passed by the firmware, creating the
> + * tree of struct device_node. It also fills the "name" and "type"
> + * pointers of the nodes so the normal device-tree walking functions
> + * can be used.  Memory is allocated using the given function.
> + */
> +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
> +                            unsigned long (*dt_alloc)(u64 size, u64 align))
> +{
> +       struct boot_param_header *device_tree =
> +               (struct boot_param_header *)blob;
>        unsigned long start, mem, size;
> -       struct device_node **allnextp = &allnodes;
> +       struct device_node **allnextp = mynodes;
>
>        pr_debug(" -> unflatten_device_tree()\n");
>
> -       if (!initial_boot_params) {
> +       if (!device_tree) {
>                pr_debug("No device tree pointer\n");
>                return;
>        }
>
>        pr_debug("Unflattening device tree:\n");
> -       pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic));
> -       pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize));
> -       pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version));
> +       pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic));
> +       pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize));
> +       pr_debug("version: %08x\n", be32_to_cpu(device_tree->version));
>
> -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> -               pr_err("Invalid device tree blob header\n");
> +       if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) {
> +               pr_err("Invalid device tree blob header %x\n",
> +                      be32_to_cpu(device_tree->magic));
>                return;
>        }
>
>        /* First pass, scan for size */
> -       start = ((unsigned long)initial_boot_params) +
> -               be32_to_cpu(initial_boot_params->off_dt_struct);
> -       size = unflatten_dt_node(0, &start, NULL, NULL, 0);
> +       start = ((unsigned long)device_tree) +
> +               be32_to_cpu(device_tree->off_dt_struct);
> +       size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree);
>        size = (size | 3) + 1;
>
>        pr_debug("  size is %lx, allocating...\n", size);
>
>        /* Allocate memory for the expanded device tree */
> -       mem = early_init_dt_alloc_memory_arch(size + 4,
> -                       __alignof__(struct device_node));
> -       mem = (unsigned long) __va(mem);
> +       mem = (unsigned long) dt_alloc(size + 4,
> +                     __alignof__(struct device_node));
>
>        ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
>
>        pr_debug("  unflattening %lx...\n", mem);
>
>        /* Second pass, do actual unflattening */
> -       start = ((unsigned long)initial_boot_params) +
> -               be32_to_cpu(initial_boot_params->off_dt_struct);
> -       unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
> +       start = ((unsigned long)device_tree) +
> +               be32_to_cpu(device_tree->off_dt_struct);
> +       unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree);
>        if (be32_to_cpup((__be32 *)start) != OF_DT_END)
> -               pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
> +               pr_warning("Weird tag at end of tree: %08x\n",
> +                          *((u32 *)start));
>        if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
>                pr_warning("End of tree marker overwritten: %08x\n",
>                           be32_to_cpu(((__be32 *)mem)[size / 4]));
>        *allnextp = NULL;
>
> -       /* Get pointer to OF "/chosen" node for use everywhere */
> -       of_chosen = of_find_node_by_path("/chosen");
> -       if (of_chosen == NULL)
> -               of_chosen = of_find_node_by_path("/chosen@0");
> -
>        pr_debug(" <- unflatten_device_tree()\n");
>  }
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 71e1a91..2bc0754 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells;
>  extern struct boot_param_header *initial_boot_params;
>
>  /* For scanning the flat device-tree at boot time */
> -extern char *find_flat_dt_string(u32 offset);
> +extern char *find_flat_dt_string(u32 offset,
> +                         struct boot_param_header *blob);
>  extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
>                                     int depth, void *data),
>                           void *data);
>  extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
> -                                unsigned long *size);
> -extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
> +                                unsigned long *size,
> +                         struct boot_param_header *blob);
> +extern int of_flat_dt_is_compatible(unsigned long node, const char *name,
> +                         struct boot_param_header *blob);
>  extern unsigned long of_get_flat_dt_root(void);
>  extern void early_init_dt_scan_chosen_arch(unsigned long node);
>  extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
> @@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
>
>  /* Other Prototypes */
>  extern void unflatten_device_tree(void);
> +extern void unflatten_partial_device_tree(unsigned long *blob,
> +                                         struct device_node **mynodes);
>  extern void early_init_devtree(void *);
>  #else /* CONFIG_OF_FLATTREE */
>  static inline void unflatten_device_tree(void) {}
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* RE: [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree
       [not found]           ` <AANLkTimPsDWcW_3z46mMFCxkui+3v6q64F2EMLBr6mNK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-10 17:54             ` Stephen Neuendorffer
  0 siblings, 0 replies; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-08-10 17:54 UTC (permalink / raw)
  To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ



> -----Original Message-----
> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely
> Sent: Tuesday, August 10, 2010 10:47 AM
> To: Stephen Neuendorffer
> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> Subject: Re: [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree
> 
> On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> > This code allows a user to parse a partial device tree blob, which is
> > structurally independent of any toplevel blob.
> > Previously, this code assumed that the blob comes from initial_boot_params.
> > Now, unflatten_partial_device_tree can take a blob from an arbitrary position,
> > and the location of the blob gets passed around to the various support functions.
> 
> For ease of review, please split this patch into two pieces; one to
> pass around the boot_param_header pointer, and one to add the partial
> parsing function.
> 
> >
> > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> > ---
> >  drivers/of/fdt.c       |  169 +++++++++++++++++++++++++++++++++--------------
> >  include/linux/of_fdt.h |   11 ++-
> >  2 files changed, 126 insertions(+), 54 deletions(-)
> >
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index d61fda8..89fb1f3 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -11,10 +11,12 @@
> >
> >  #include <linux/kernel.h>
> >  #include <linux/initrd.h>
> > +#include <linux/module.h>
> >  #include <linux/of.h>
> >  #include <linux/of_fdt.h>
> >  #include <linux/string.h>
> >  #include <linux/errno.h>
> > +#include <linux/slab.h>
> >
> >  #ifdef CONFIG_PPC
> >  #include <asm/machdep.h>
> > @@ -22,15 +24,19 @@
> >
> >  #include <asm/page.h>
> >
> > -int __initdata dt_root_addr_cells;
> > -int __initdata dt_root_size_cells;
> > +int dt_root_addr_cells;
> > +int dt_root_size_cells;
> 
> With this new use case, these globals really need to be removed and
> handled safely.  You wouldn't want two partial trees getting parsed
> expecting different values in these properties!  The solution is
> possibly by putting them into a context structure that is passed
> around the fdt parsing functions.  Another solution might be to hold a
> mutex for the entirety of parsing the flat tree.
>
> However, maybe this doesn't matter, and they can remain as __initdata.
>  The only user of these values seems to be early_init_dt_scan_memory()
> which I don't think you need for your PCI add in device use-case.  Am
> I correct?

This is a bogon... they should still be __initdata.
I think it would be useful to factor out the __init stuff into a separate file for
those arches that want it.

> >  struct boot_param_header *initial_boot_params;
> >
> > -char *find_flat_dt_string(u32 offset)
> > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
> > +                            unsigned long (*dt_alloc)(u64 size, u64 align));
> 
> If you order you functions correctly, this forward declaration can be removed.

Yeah, I did it that way because I didn't want to make the nasty #ifdef below nastier.
If we come up with a solution for that, then this goes away.

> > +
> > +char *find_flat_dt_string(u32 offset,
> > +                         struct boot_param_header *blob)
> >  {
> > -       return ((char *)initial_boot_params) +
> > -               be32_to_cpu(initial_boot_params->off_dt_strings) + offset;
> > +       return ((char *)blob) +
> > +               be32_to_cpu(blob->off_dt_strings) + offset;
> >  }
> >
> >  /**
> > @@ -118,8 +124,9 @@ unsigned long __init of_get_flat_dt_root(void)
> >  * This function can be used within scan_flattened_dt callback to get
> >  * access to properties
> >  */
> > -void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> > -                                unsigned long *size)
> > +void * __init of_get_flat_dt_prop(unsigned long node, const char *name,
> 
> Unrelated whitespace change.
> 
> > +                                unsigned long *size,
> > +                                struct boot_param_header *blob)
> >  {
> >        unsigned long p = node;
> >
> > @@ -140,7 +147,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> >                if (be32_to_cpu(initial_boot_params->version) < 0x10)
> >                        p = ALIGN(p, sz >= 8 ? 8 : 4);
> >
> > -               nstr = find_flat_dt_string(noff);
> > +               nstr = find_flat_dt_string(noff, blob);
> >                if (nstr == NULL) {
> >                        pr_warning("Can't find property index name !\n");
> >                        return NULL;
> > @@ -160,12 +167,13 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> >  * @node: node to test
> >  * @compat: compatible string to compare with compatible list.
> >  */
> > -int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> > +int  of_flat_dt_is_compatible(unsigned long node, const char *compat,
> > +                                struct boot_param_header *blob)
> >  {
> >        const char *cp;
> >        unsigned long cplen, l;
> >
> > -       cp = of_get_flat_dt_prop(node, "compatible", &cplen);
> > +       cp = of_get_flat_dt_prop(node, "compatible", &cplen, blob);
> >        if (cp == NULL)
> >                return 0;
> >        while (cplen > 0) {
> > @@ -179,7 +187,7 @@ int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
> >        return 0;
> >  }
> >
> > -static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> > +static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> >                                       unsigned long align)
> >  {
> >        void *res;
> > @@ -198,11 +206,12 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> >  * @allnextpp: pointer to ->allnext from last allocated device_node
> >  * @fpsize: Size of the node path up at the current depth.
> >  */
> > -unsigned long __init unflatten_dt_node(unsigned long mem,
> > -                                       unsigned long *p,
> > -                                       struct device_node *dad,
> > -                                       struct device_node ***allnextpp,
> > -                                       unsigned long fpsize)
> > +unsigned long unflatten_dt_node(unsigned long mem,
> > +                               unsigned long *p,
> > +                               struct device_node *dad,
> > +                               struct device_node ***allnextpp,
> > +                               unsigned long fpsize,
> > +                               struct boot_param_header *blob)
> >  {
> >        struct device_node *np;
> >        struct property *pp, **prev_pp = NULL;
> > @@ -298,10 +307,10 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> >                sz = be32_to_cpup((__be32 *)(*p));
> >                noff = be32_to_cpup((__be32 *)((*p) + 4));
> >                *p += 8;
> > -               if (be32_to_cpu(initial_boot_params->version) < 0x10)
> > +               if (be32_to_cpu(blob->version) < 0x10)
> >                        *p = ALIGN(*p, sz >= 8 ? 8 : 4);
> >
> > -               pname = find_flat_dt_string(noff);
> > +               pname = find_flat_dt_string(noff, blob);
> >                if (pname == NULL) {
> >                        pr_info("Can't find property name in list !\n");
> >                        break;
> > @@ -380,7 +389,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> >                if (tag == OF_DT_NOP)
> >                        *p += 4;
> >                else
> > -                       mem = unflatten_dt_node(mem, p, np, allnextpp, fpsize);
> > +                       mem = unflatten_dt_node(mem, p, np, allnextpp,
> > +                                               fpsize, blob);
> >                tag = be32_to_cpup((__be32 *)(*p));
> >        }
> >        if (tag != OF_DT_END_NODE) {
> > @@ -391,6 +401,8 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> >        return mem;
> >  }
> >
> > +#if defined(CONFIG_MICROBLAZE) || defined(CONFIG_POWERPC) || defined(CONFIG_SPARC)
> > +
> 
> Nack.  arm, mips, and even some x86 platforms will use this code.  Not
> sure what the best way to solve this is; need to think about it for a
> bit.

I'm open to suggestions... :)

> >  #ifdef CONFIG_BLK_DEV_INITRD
> >  /**
> >  * early_init_dt_check_for_initrd - Decode initrd location from flat tree
> > @@ -403,12 +415,14 @@ void __init early_init_dt_check_for_initrd(unsigned long node)
> >
> >        pr_debug("Looking for initrd properties... ");
> >
> > -       prop = of_get_flat_dt_prop(node, "linux,initrd-start", &len);
> > +       prop = of_get_flat_dt_prop(node, "linux,initrd-start",
> > +                                  &len, initial_boot_params);
> >        if (!prop)
> >                return;
> >        start = of_read_ulong(prop, len/4);
> >
> > -       prop = of_get_flat_dt_prop(node, "linux,initrd-end", &len);
> > +       prop = of_get_flat_dt_prop(node, "linux,initrd-end",
> > +                                  &len, initial_boot_params);
> >        if (!prop)
> >                return;
> >        end = of_read_ulong(prop, len/4);
> > @@ -436,12 +450,14 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> >        dt_root_size_cells = OF_ROOT_NODE_SIZE_CELLS_DEFAULT;
> >        dt_root_addr_cells = OF_ROOT_NODE_ADDR_CELLS_DEFAULT;
> >
> > -       prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
> > +       prop = of_get_flat_dt_prop(node, "#size-cells",
> > +                                  NULL, initial_boot_params);
> >        if (prop)
> >                dt_root_size_cells = be32_to_cpup(prop);
> >        pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells);
> >
> > -       prop = of_get_flat_dt_prop(node, "#address-cells", NULL);
> > +       prop = of_get_flat_dt_prop(node, "#address-cells",
> > +                                  NULL, initial_boot_params);
> >        if (prop)
> >                dt_root_addr_cells = be32_to_cpup(prop);
> >        pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells);
> > @@ -450,7 +466,7 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
> >        return 1;
> >  }
> >
> > -u64 __init dt_mem_next_cell(int s, __be32 **cellp)
> > +u64  dt_mem_next_cell(int s, __be32 **cellp)
> 
> nit: single space between u64 and dt_mem_next_cell
> 
> >  {
> >        __be32 *p = *cellp;
> >
> > @@ -464,7 +480,8 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)
> >  int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> >                                     int depth, void *data)
> >  {
> > -       char *type = of_get_flat_dt_prop(node, "device_type", NULL);
> > +       char *type = of_get_flat_dt_prop(node, "device_type",
> > +                                        NULL, initial_boot_params);
> >        __be32 *reg, *endp;
> >        unsigned long l;
> >
> > @@ -479,9 +496,10 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
> >        } else if (strcmp(type, "memory") != 0)
> >                return 0;
> >
> > -       reg = of_get_flat_dt_prop(node, "linux,usable-memory", &l);
> > +       reg = of_get_flat_dt_prop(node, "linux,usable-memory",
> > +                                 &l, initial_boot_params);
> >        if (reg == NULL)
> > -               reg = of_get_flat_dt_prop(node, "reg", &l);
> > +               reg = of_get_flat_dt_prop(node, "reg", &l, initial_boot_params);
> >        if (reg == NULL)
> >                return 0;
> >
> > @@ -521,12 +539,12 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> >
> >        early_init_dt_check_for_initrd(node);
> >
> > +#ifdef CONFIG_CMDLINE
> >        /* Retreive command line */
> > -       p = of_get_flat_dt_prop(node, "bootargs", &l);
> > +       p = of_get_flat_dt_prop(node, "bootargs", &l, initial_boot_params);
> >        if (p != NULL && l > 0)
> >                strlcpy(cmd_line, p, min((int)l, COMMAND_LINE_SIZE));
> >
> > -#ifdef CONFIG_CMDLINE
> >  #ifndef CONFIG_CMDLINE_FORCE
> >        if (p == NULL || l == 0 || (l == 1 && (*p) == 0))
> >  #endif
> > @@ -535,12 +553,21 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> >
> >        early_init_dt_scan_chosen_arch(node);
> >
> > +#ifdef CONFIG_CMDLINE
> >        pr_debug("Command line is: %s\n", cmd_line);
> > +#endif /* CONFIG_CMDLINE */
> >
> >        /* break now */
> >        return 1;
> >  }
> >
> > +
> > +static unsigned long early_device_tree_alloc(u64 size, u64 align)
> > +{
> > +       unsigned long mem = early_init_dt_alloc_memory_arch(size, align);
> > +       return (unsigned long) __va(mem);
> > +}
> > +
> >  /**
> >  * unflatten_device_tree - create tree of device_nodes from flat blob
> >  *
> > @@ -551,58 +578,98 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
> >  */
> >  void __init unflatten_device_tree(void)
> >  {
> > +       __unflatten_device_tree(initial_boot_params, &allnodes,
> > +                               early_device_tree_alloc);
> > +
> > +       /* Get pointer to OF "/chosen" node for use everywhere */
> > +       of_chosen = of_find_node_by_path("/chosen");
> > +       if (of_chosen == NULL)
> > +               of_chosen = of_find_node_by_path("/chosen@0");
> > +}
> > +
> > +#endif
> 
> It is customary and helpful to put /* CONFIG_<blah> */ on an #endif line.
> 
> > +
> > +static unsigned long kernel_tree_alloc(u64 size, u64 align)
> > +{
> > +       return (unsigned long) kzalloc(size, GFP_KERNEL);
> > +}
> > +
> > +/**
> > + * unflatten_partial_device_tree - create tree of device_nodes from flat blob
> > + *
> > + * unflattens the device-tree passed by the firmware, creating the
> > + * tree of struct device_node. It also fills the "name" and "type"
> > + * pointers of the nodes so the normal device-tree walking functions
> > + * can be used.
> > + */
> > +void unflatten_partial_device_tree(unsigned long *blob,
> > +                                  struct device_node **mynodes)
> > +{
> > +       __unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
> > +}
> > +EXPORT_SYMBOL(unflatten_partial_device_tree);
> 
> Move the two unflatten functions below __unflatten_device_tree to
> eliminate the forward declaration at the top of the file.
> 
> > +
> > +/**
> > + * __unflatten_device_tree - create tree of device_nodes from flat blob
> > + *
> > + * unflattens the device-tree passed by the firmware, creating the
> > + * tree of struct device_node. It also fills the "name" and "type"
> > + * pointers of the nodes so the normal device-tree walking functions
> > + * can be used.  Memory is allocated using the given function.
> > + */
> > +void __unflatten_device_tree(unsigned long *blob, struct device_node **mynodes,
> > +                            unsigned long (*dt_alloc)(u64 size, u64 align))
> > +{
> > +       struct boot_param_header *device_tree =
> > +               (struct boot_param_header *)blob;
> >        unsigned long start, mem, size;
> > -       struct device_node **allnextp = &allnodes;
> > +       struct device_node **allnextp = mynodes;
> >
> >        pr_debug(" -> unflatten_device_tree()\n");
> >
> > -       if (!initial_boot_params) {
> > +       if (!device_tree) {
> >                pr_debug("No device tree pointer\n");
> >                return;
> >        }
> >
> >        pr_debug("Unflattening device tree:\n");
> > -       pr_debug("magic: %08x\n", be32_to_cpu(initial_boot_params->magic));
> > -       pr_debug("size: %08x\n", be32_to_cpu(initial_boot_params->totalsize));
> > -       pr_debug("version: %08x\n", be32_to_cpu(initial_boot_params->version));
> > +       pr_debug("magic: %08x\n", be32_to_cpu(device_tree->magic));
> > +       pr_debug("size: %08x\n", be32_to_cpu(device_tree->totalsize));
> > +       pr_debug("version: %08x\n", be32_to_cpu(device_tree->version));
> >
> > -       if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
> > -               pr_err("Invalid device tree blob header\n");
> > +       if (be32_to_cpu(device_tree->magic) != OF_DT_HEADER) {
> > +               pr_err("Invalid device tree blob header %x\n",
> > +                      be32_to_cpu(device_tree->magic));
> >                return;
> >        }
> >
> >        /* First pass, scan for size */
> > -       start = ((unsigned long)initial_boot_params) +
> > -               be32_to_cpu(initial_boot_params->off_dt_struct);
> > -       size = unflatten_dt_node(0, &start, NULL, NULL, 0);
> > +       start = ((unsigned long)device_tree) +
> > +               be32_to_cpu(device_tree->off_dt_struct);
> > +       size = unflatten_dt_node(0, &start, NULL, NULL, 0, device_tree);
> >        size = (size | 3) + 1;
> >
> >        pr_debug("  size is %lx, allocating...\n", size);
> >
> >        /* Allocate memory for the expanded device tree */
> > -       mem = early_init_dt_alloc_memory_arch(size + 4,
> > -                       __alignof__(struct device_node));
> > -       mem = (unsigned long) __va(mem);
> > +       mem = (unsigned long) dt_alloc(size + 4,
> > +                     __alignof__(struct device_node));
> >
> >        ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef);
> >
> >        pr_debug("  unflattening %lx...\n", mem);
> >
> >        /* Second pass, do actual unflattening */
> > -       start = ((unsigned long)initial_boot_params) +
> > -               be32_to_cpu(initial_boot_params->off_dt_struct);
> > -       unflatten_dt_node(mem, &start, NULL, &allnextp, 0);
> > +       start = ((unsigned long)device_tree) +
> > +               be32_to_cpu(device_tree->off_dt_struct);
> > +       unflatten_dt_node(mem, &start, NULL, &allnextp, 0, device_tree);
> >        if (be32_to_cpup((__be32 *)start) != OF_DT_END)
> > -               pr_warning("Weird tag at end of tree: %08x\n", *((u32 *)start));
> > +               pr_warning("Weird tag at end of tree: %08x\n",
> > +                          *((u32 *)start));
> >        if (be32_to_cpu(((__be32 *)mem)[size / 4]) != 0xdeadbeef)
> >                pr_warning("End of tree marker overwritten: %08x\n",
> >                           be32_to_cpu(((__be32 *)mem)[size / 4]));
> >        *allnextp = NULL;
> >
> > -       /* Get pointer to OF "/chosen" node for use everywhere */
> > -       of_chosen = of_find_node_by_path("/chosen");
> > -       if (of_chosen == NULL)
> > -               of_chosen = of_find_node_by_path("/chosen@0");
> > -
> >        pr_debug(" <- unflatten_device_tree()\n");
> >  }
> > diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> > index 71e1a91..2bc0754 100644
> > --- a/include/linux/of_fdt.h
> > +++ b/include/linux/of_fdt.h
> > @@ -64,13 +64,16 @@ extern int __initdata dt_root_size_cells;
> >  extern struct boot_param_header *initial_boot_params;
> >
> >  /* For scanning the flat device-tree at boot time */
> > -extern char *find_flat_dt_string(u32 offset);
> > +extern char *find_flat_dt_string(u32 offset,
> > +                         struct boot_param_header *blob);
> >  extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
> >                                     int depth, void *data),
> >                           void *data);
> >  extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
> > -                                unsigned long *size);
> > -extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
> > +                                unsigned long *size,
> > +                         struct boot_param_header *blob);
> > +extern int of_flat_dt_is_compatible(unsigned long node, const char *name,
> > +                         struct boot_param_header *blob);
> >  extern unsigned long of_get_flat_dt_root(void);
> >  extern void early_init_dt_scan_chosen_arch(unsigned long node);
> >  extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
> > @@ -98,6 +101,8 @@ extern int early_init_dt_scan_root(unsigned long node, const char *uname,
> >
> >  /* Other Prototypes */
> >  extern void unflatten_device_tree(void);
> > +extern void unflatten_partial_device_tree(unsigned long *blob,
> > +                                         struct device_node **mynodes);
> >  extern void early_init_devtree(void *);
> >  #else /* CONFIG_OF_FLATTREE */
> >  static inline void unflatten_device_tree(void) {}
> > --
> > 1.5.6.6
> >
> >
> >
> > This email and any attachments are intended for the sole use of the named recipient(s) and
> contain(s) confidential information that may be proprietary, privileged or copyrighted under
> applicable law. If you are not the intended recipient, do not read, copy, or forward this email
> message or any attachments. Delete this email message and any attachments immediately.
> >
> >
> >
> 
> 
> 
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* Re: [PATCH 5/9] arch/x86: Add support for device tree code.
       [not found]             ` <a85fdc9c-4a93-4381-b01e-5b9bc7666863-RaUQJvECHitCYczPSvLbDrjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:00               ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:00 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> A few support device-tree related support functions that x86 didn't
> have before.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
>
> ----
>
>  I have no idea if continuing to add these functions to every arch is
> a good thing or whether they should (for instance) be weak symbols
> with a generic definition.
> ---
>  arch/x86/include/asm/device.h |    3 ++
>  arch/x86/include/asm/irq.h    |    4 ++
>  arch/x86/kernel/Makefile      |    1 +
>  arch/x86/kernel/device_tree.c |   63 +++++++++++++++++++++++++++++++++++++++++
>  drivers/of/platform.c         |    2 +
>  include/linux/of_irq.h        |    1 +
>  6 files changed, 74 insertions(+), 0 deletions(-)
>  create mode 100644 arch/x86/kernel/device_tree.c
>
> diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
> index 029f230..0bf0a17 100644
> --- a/arch/x86/include/asm/device.h
> +++ b/arch/x86/include/asm/device.h
> @@ -16,4 +16,7 @@ struct dma_map_ops *dma_ops;
>  struct pdev_archdata {
>  };
>
> +/* Don't override the default bus id behaviour */
> +#define of_device_make_bus_id __of_device_make_bus_id

This should be unnecessary now.

>  #endif /* _ASM_X86_DEVICE_H */
> diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
> index 5458380..6c61992 100644
> --- a/arch/x86/include/asm/irq.h
> +++ b/arch/x86/include/asm/irq.h
> @@ -10,6 +10,10 @@
>  #include <asm/apicdef.h>
>  #include <asm/irq_vectors.h>
>
> +#define NO_IRQ (-1)
> +

Remove

> +#define irq_dispose_mapping(...)

I need to create a default implementation for this.

>
>  static inline int irq_canonicalize(int irq)
>  {
>        return ((irq == 2) ? 9 : irq);
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index e77b220..a5c20e8 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -105,6 +105,7 @@ scx200-y                    += scx200_32.o
>
>  obj-$(CONFIG_OLPC)             += olpc.o
>  obj-$(CONFIG_X86_MRST)         += mrst.o
> +obj-$(CONFIG_OF)               += device_tree.o
>
>  microcode-y                            := microcode_core.o
>  microcode-$(CONFIG_MICROCODE_INTEL)    += microcode_intel.o
> diff --git a/arch/x86/kernel/device_tree.c b/arch/x86/kernel/device_tree.c
> new file mode 100644
> index 0000000..543884c
> --- /dev/null
> +++ b/arch/x86/kernel/device_tree.c
> @@ -0,0 +1,63 @@
> +#undef DEBUG
> +
> +#include <linux/kernel.h>
> +#include <linux/string.h>
> +#include <linux/pci_regs.h>
> +#include <linux/module.h>
> +#include <linux/ioport.h>
> +#include <linux/etherdevice.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_platform.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +
> +struct bus_type of_platform_bus_type = {
> +       .uevent = of_device_uevent,
> +};
> +EXPORT_SYMBOL(of_platform_bus_type);

Remove

> +
> +static int __init of_bus_driver_init(void)
> +{
> +       return of_bus_type_init(&of_platform_bus_type, "of_platform");
> +}
> +postcore_initcall(of_bus_driver_init);

remove

> +
> +/*
> + * The list of OF IDs below is used for matching bus types in the
> + * system whose devices are to be exposed as of_platform_devices.
> + *
> + * This is the default list valid for most platforms. This file provides
> + * functions who can take an explicit list if necessary though
> + *
> + * The search is always performed recursively looking for children of
> + * the provided device_node and recursively if such a children matches
> + * a bus type in the list
> + */
> +
> +const struct of_device_id of_default_bus_ids[] = {
> +       { .type = "soc", },
> +       { .compatible = "soc", },
> +       { .compatible = "simple-bus", },
> +       { .type = "plb5", },
> +       { .type = "plb4", },
> +       { .type = "opb", },
> +       { .type = "simple", },
> +       {},
> +};

I believe this can also be removed.

> +
> +/*
> + * Interrupt remapper
> + */
> +
> +struct device_node *of_irq_find_parent_by_phandle(phandle p)
> +{
> +       return of_find_node_by_phandle(p);
> +}
> +

remove

> +unsigned int irq_create_of_mapping(struct device_node *controller,
> +                                  const u32 *intspec, unsigned int intsize)
> +{
> +       return intspec[0] + 1;
> +}

Hmmm.  I need to bring up more of the OF irq infrastructure so that
this is handled correctly.

> +EXPORT_SYMBOL_GPL(irq_create_of_mapping);
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 9d3d932..0221125 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -20,6 +20,8 @@
>  #include <linux/of_device.h>
>  #include <linux/of_irq.h>
>  #include <linux/of_platform.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>

fixed in mainline.

>
>  #if defined(CONFIG_PPC_DCR)
>  #include <asm/dcr.h>
> diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
> index 5929781..25fc90d 100644
> --- a/include/linux/of_irq.h
> +++ b/include/linux/of_irq.h
> @@ -7,6 +7,7 @@ struct of_irq;
>  #include <linux/errno.h>
>  #include <linux/ioport.h>
>  #include <linux/of.h>
> +#include <linux/irq.h>

irq.h shouldn't actually be needed by this header.

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

* Re: [PATCH 6/9] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver.
       [not found]               ` <fad5faaa-1fab-4d9f-b41e-236b874e9c08-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:14                 ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:14 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> This device has an internal bus which contains multiple devices, which
> are described in a device tree.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

You need to cc: the pci mailing list on the next submission.

>
> ----
>
> This is probably still preliminary, although it actually works now.
> 1) It should probably correctly deallocate and free all the contained
> devices.
> 2) It should probably handle different device trees for multiple boards
> in the same system.  How to do this?
> ---
>  drivers/pci/Kconfig        |    8 ++
>  drivers/pci/Makefile       |    2 +
>  drivers/pci/xilinx_pcipr.c |  197 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 207 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/pci/xilinx_pcipr.c
>
> diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
> index 34ef70d..69616b6 100644
> --- a/drivers/pci/Kconfig
> +++ b/drivers/pci/Kconfig
> @@ -65,3 +65,11 @@ config PCI_IOAPIC
>        depends on ACPI
>        depends on HOTPLUG
>        default y
> +
> +config XILINX_PCIPR
> +       tristate "Xilinx OF-based PCI endpoint"
> +       depends on PCI
> +       select OF
> +       select OF_FLATTREE
> +       help
> +         Enable support for Xilinx PCIPR endpoint
> diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile
> index 0b51857..ec44c21 100644
> --- a/drivers/pci/Makefile
> +++ b/drivers/pci/Makefile
> @@ -62,6 +62,8 @@ obj-$(CONFIG_PCI_SYSCALL) += syscall.o
>
>  obj-$(CONFIG_PCI_STUB) += pci-stub.o
>
> +obj-$(CONFIG_XILINX_PCIPR) += xilinx_pcipr.o
> +
>  ifeq ($(CONFIG_PCI_DEBUG),y)
>  EXTRA_CFLAGS += -DDEBUG
>  endif
> diff --git a/drivers/pci/xilinx_pcipr.c b/drivers/pci/xilinx_pcipr.c
> new file mode 100644
> index 0000000..80f8f1a
> --- /dev/null
> +++ b/drivers/pci/xilinx_pcipr.c
> @@ -0,0 +1,197 @@
> +/*

Always good practice to include a one line description of what this
file is for in the header block.

> + *  Copyright 2010 Xilinx, Inc.
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/types.h>
> +#include <linux/kernel.h>
> +#include <linux/pci.h>
> +#include <linux/ide.h>
> +#include <linux/init.h>
> +#include <linux/dmi.h>
> +#include <linux/firmware.h>
> +
> +#include <linux/of.h>
> +#include <linux/of_fdt.h>
> +#include <linux/of_platform.h>
> +
> +#include <linux/io.h>
> +
> +#define DRV_NAME "xilinx_pcipr"

unused

> +
> +struct xilinx_pcipr_drvdata {
> +       struct device_node *child_nodes;
> +       struct firmware *fw_entry;
> +};
> +
> +/**
> + *     xilinx_pcipr_probe - Setup the endpoint
> + *     @dev: PCI device to set up
> + */
> +static int __devinit xilinx_pcipr_probe(struct pci_dev *pdev,
> +                                       const struct pci_device_id *id)
> +{
> +       int ret;
> +       struct xilinx_pcipr_drvdata *drvdata;
> +       resource_size_t start, len;
> +       struct property *ranges_prop;
> +       unsigned long *value;
> +       struct device_node *bus_node;
> +
> +       dev_dbg(&pdev->dev, "xilinx_pcipr_probe\n");
> +
> +       drvdata = kzalloc(sizeof(struct xilinx_pcipr_drvdata), GFP_KERNEL);
> +       if (!drvdata) {
> +               dev_err(&pdev->dev,
> +                       "Couldn't allocate device private record\n");
> +               ret = -ENOMEM;
> +               goto out;
> +       }
> +
> +       dev_set_drvdata(&pdev->dev, (void *)drvdata);
> +
> +       /*
> +        * Do some basic sanity checking..
> +        */
> +       if (pci_enable_device(pdev)) {
> +               ret = -EBUSY;
> +               goto free;
> +       }
> +
> +       /* Enable the board to bus master. */
> +       pci_set_master(pdev);
> +
> +       if (request_firmware(&drvdata->fw_entry,
> +                           "xilinx_pcipr.dtb", &pdev->dev)) {
> +               dev_err(&pdev->dev, "Couldn't get dtb\n");
> +               ret = -ENODEV;
> +               goto disable;
> +       }
> +
> +
> +       ret = pci_request_regions(pdev, "xilinx_pcipr");
> +       if (ret)
> +               goto release_dtb;
> +
> +       if (!pci_resource_start(pdev, 0)) {
> +               dev_printk(KERN_ERR, &pdev->dev, "No cardbus resource!\n");
> +               ret = -ENODEV;
> +               goto release;
> +       }
> +
> +
> +       /*
> +        * report the subsystem vendor and device for help debugging
> +        * the irq stuff...
> +        */
> +       dev_printk(KERN_INFO, &pdev->dev,
> +                  "Xilinx PCIPR bridge found [%04x:%04x]\n",
> +                  pdev->subsystem_vendor, pdev->subsystem_device);
> +
> +       /* Stuff the ranges property into the toplevel bus of the device
> +          tree, according to how the BARs are programmed */
> +       start = pci_resource_start(pdev, 0);
> +       len = pci_resource_len(pdev, 0);
> +
> +       dev_printk(KERN_INFO, &pdev->dev,
> +                  "Xilinx PCIPR bridge range %llx %llx",
> +                  (unsigned long long) start, (unsigned long long) len);

dev_info()

> +
> +       ranges_prop = kzalloc(sizeof(struct property), GFP_KERNEL);

if (!ranges_prop) ...

> +       ranges_prop->value = kzalloc(sizeof(unsigned long) * 3, GFP_KERNEL);

if (!ranges_prop->value) ...

> +       ranges_prop->name = "ranges";
> +       ranges_prop->length = sizeof(unsigned long) * 3;
> +       value = (unsigned long *)ranges_prop->value;
> +       /* FIXME: gotta get this from the bridge */
> +       value[0] = cpu_to_be32(0x80000000);
> +       value[1] = cpu_to_be32(start);
> +       value[2] = cpu_to_be32(len);

This won't work if the PCI BARs gets mapped above 4GiB.  It will need
to handle the case where #address-cells and #size-cells on the root
are 2.

> +
> +       unflatten_partial_device_tree((unsigned long *)drvdata->fw_entry->data,
> +                                     &drvdata->child_nodes);
> +       of_node_get(drvdata->child_nodes);
> +       bus_node = of_find_node_by_name(drvdata->child_nodes, "plb");
> +       prom_add_property(bus_node, ranges_prop);

Heh; clever hack.  Not exactly pretty, but it eliminates the need to
have a translation hook and it doesn't look actively dangerous so I'm
okay with it for the time being.  It would be nice to have something
cleaner though.

> +
> +       /* Generate child devices from the device tree */
> +       of_platform_bus_probe(drvdata->child_nodes, NULL, &pdev->dev);
> +
> +       pci_release_regions(pdev);
> +
> +       goto out; /* Success */
> +
> + release:
> +       pci_release_regions(pdev);
> +
> + release_dtb:
> +       release_firmware(drvdata->fw_entry);
> +
> + disable:
> +       pci_disable_device(pdev);
> + free:
> +       kfree(drvdata);
> +       dev_set_drvdata(&pdev->dev, NULL);

set the drvdata to NULL before freeing the pointer.  (probably will
never cause a problem, but it doesn't hurt to be strict).

> + out:
> +       return ret;
> +}
> +
> +static int __devexit xilinx_pcipr_remove(struct pci_dev *pdev)
> +{
> +       struct device *dev = &pdev->dev;
> +       struct xilinx_pcipr_drvdata *drvdata = dev_get_drvdata(dev);
> +
> +       /* FIXME: Release the contained devices. There should probably
> +be a device-tree method to free a whole tree of devices, essentially
> +the inverse of of_platform_bus_probe
> +       */

The driver model tracks this for you.  It isn't even device tree
specific.  The solution to this is to walk the children of
pci_dev->dev.  (Actually, not entirely true; as you still need to call
of_put on the device_node before freeing the child device.

> +
> +       release_firmware(drvdata->fw_entry);
> +       pci_disable_device(pdev);
> +       kfree(drvdata);
> +       dev_set_drvdata(dev, NULL);
> +       return 0;
> +}
> +
> +
> +static const struct pci_device_id xilinx_pcipr_ids[] = {
> +       { PCI_VDEVICE(XILINX, 0x0505), 0 },
> +       { 0, },
> +};
> +MODULE_DEVICE_TABLE(pci, xilinx_pcipr_ids);
> +
> +pci_ers_result_t *xilinx_pcipr_error_detected(struct pci_dev *pdev,
> +                                             enum pci_channel_state error) {
> +       dev_printk(KERN_INFO, &pdev->dev, "Error detected!\n");
> +       return PCI_ERS_RESULT_NEED_RESET;
> +}
> +
> +static struct pci_error_handlers xilinx_pcipr_error_handlers = {
> +       /* PCI bus error detected on this device */
> +       .error_detected = xilinx_pcipr_error_detected,
> +};
> +
> +static struct pci_driver  xilinx_pcipr_driver = {
> +       .name           = "XILINX_PCIPR",
> +       .id_table       = xilinx_pcipr_ids,
> +       .probe          = xilinx_pcipr_probe,
> +       .remove         = __devexit_p(xilinx_pcipr_remove),
> +       .err_handler    = &xilinx_pcipr_error_handlers,
> +};
> +
> +static int __init xilinx_pcipr_init(void)
> +{
> +       return ide_pci_register_driver(&xilinx_pcipr_driver);
> +}
> +
> +static void __exit xilinx_pcipr_exit(void)
> +{
> +       pci_unregister_driver(&xilinx_pcipr_driver);
> +}
> +
> +module_init(xilinx_pcipr_init);

module_init should appear immediately after xilinx_pcipr_init()

> +module_exit(xilinx_pcipr_exit);
> +
> +MODULE_AUTHOR("Xilinx Research Labs");
> +MODULE_DESCRIPTION("PCI driver for PCI reconfigurable endpoint");
> +MODULE_LICENSE("GPL");
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 3/9] of/base.c: export property access/modification functions
       [not found]         ` <ceba5315-090d-4776-9315-0cbca209b5af-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:14           ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:14 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> These functions can be usefully used by device drivers.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/of/base.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)

Looks good.  Use EXPORT_SYMBOL_GPL instead though please.

g.

>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index e3f7af8..9ee27f6 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -763,6 +763,7 @@ int prom_add_property(struct device_node *np, struct property *prop)
>
>        return 0;
>  }
> +EXPORT_SYMBOL(prom_add_property);
>
>  /**
>  * prom_remove_property - Remove a property from a node.
> @@ -804,6 +805,7 @@ int prom_remove_property(struct device_node *np, struct property *prop)
>
>        return 0;
>  }
> +EXPORT_SYMBOL(prom_remove_property);
>
>  /*
>  * prom_update_property - Update a property in a node.
> @@ -848,6 +850,7 @@ int prom_update_property(struct device_node *np,
>
>        return 0;
>  }
> +EXPORT_SYMBOL(prom_update_property);
>
>  #if defined(CONFIG_OF_DYNAMIC)
>  /*
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 7/9] [Xilinx] xilinx_hwicap: use linux/io.h instead of asm/io.h
       [not found]                 ` <bd5961af-2af1-4f6d-a220-a03fdbb19453-+Ck8Kgl/v0+44QFJ4H5SYbjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:16                   ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:16 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> Better style, and it gives access to the asm-generic/iomap.h
> accessors in all architectures.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

Looks good, but isn't a device-tree specific thing.  Should at least
go to linux-kernel before I pick it up to avoid troding on toes.

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

g.

> ---
>  drivers/char/xilinx_hwicap/buffer_icap.h   |    3 +--
>  drivers/char/xilinx_hwicap/fifo_icap.h     |    3 +--
>  drivers/char/xilinx_hwicap/xilinx_hwicap.c |    3 +--
>  drivers/char/xilinx_hwicap/xilinx_hwicap.h |    3 +--
>  4 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/buffer_icap.h b/drivers/char/xilinx_hwicap/buffer_icap.h
> index d4f419e..aa859b0 100644
> --- a/drivers/char/xilinx_hwicap/buffer_icap.h
> +++ b/drivers/char/xilinx_hwicap/buffer_icap.h
> @@ -36,8 +36,7 @@
>  #include <linux/types.h>
>  #include <linux/cdev.h>
>  #include <linux/platform_device.h>
> -
> -#include <asm/io.h>
> +#include <linux/io.h>
>  #include "xilinx_hwicap.h"
>
>  /* Loads a partial bitstream from system memory. */
> diff --git a/drivers/char/xilinx_hwicap/fifo_icap.h b/drivers/char/xilinx_hwicap/fifo_icap.h
> index 4c9dd9a..b266c40 100644
> --- a/drivers/char/xilinx_hwicap/fifo_icap.h
> +++ b/drivers/char/xilinx_hwicap/fifo_icap.h
> @@ -36,8 +36,7 @@
>  #include <linux/types.h>
>  #include <linux/cdev.h>
>  #include <linux/platform_device.h>
> -
> -#include <asm/io.h>
> +#include <linux/io.h>
>  #include "xilinx_hwicap.h"
>
>  /* Reads integers from the device into the storage buffer. */
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index ed8a9ce..6172689 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -87,8 +87,7 @@
>  #include <linux/cdev.h>
>  #include <linux/platform_device.h>
>  #include <linux/slab.h>
> -
> -#include <asm/io.h>
> +#include <linux/io.h>
>  #include <asm/uaccess.h>
>  #include <asm/system.h>
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
> index 8cca119..e0a6857 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
> @@ -36,8 +36,7 @@
>  #include <linux/types.h>
>  #include <linux/cdev.h>
>  #include <linux/platform_device.h>
> -
> -#include <asm/io.h>
> +#include <linux/io.h>
>
>  struct hwicap_drvdata {
>        u32 write_buffer_in_use;  /* Always in [0,3] */
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 8/9] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors
       [not found]                   ` <e8b3593c-3be3-4b4e-aabd-e3baeb4e792a-+Ck8Kgl/v0/VOT3FKhN2rLjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:17                     ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:17 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> out_be32 and in_be32 are mainly powerpc-isms.  Switch
> to using ioread32be and iowrite32be instead.  This allows
> the code to be used on x86 or ARM, for instance.
>
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

Ditto here; but please repost to linux-kernel

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  drivers/char/xilinx_hwicap/buffer_icap.c   |   16 +++++-----
>  drivers/char/xilinx_hwicap/fifo_icap.c     |   39 +++++++++++++--------------
>  drivers/char/xilinx_hwicap/xilinx_hwicap.c |    1 +
>  3 files changed, 28 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c
> index 05d8977..bc361fc 100644
> --- a/drivers/char/xilinx_hwicap/buffer_icap.c
> +++ b/drivers/char/xilinx_hwicap/buffer_icap.c
> @@ -87,7 +87,7 @@
>  **/
>  u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
>  {
> -       return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
> +       return ioread32be(drvdata->base_address + XHI_STATUS_REG_OFFSET);
>  }
>
>  /**
> @@ -101,7 +101,7 @@ u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
>  static inline u32 buffer_icap_get_bram(void __iomem *base_address,
>                u32 offset)
>  {
> -       return in_be32(base_address + (offset << 2));
> +       return ioread32be(base_address + (offset << 2));
>  }
>
>  /**
> @@ -114,7 +114,7 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address,
>  **/
>  static inline bool buffer_icap_busy(void __iomem *base_address)
>  {
> -       u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET);
> +       u32 status = ioread32be(base_address + XHI_STATUS_REG_OFFSET);
>        return (status & 1) == XHI_NOT_FINISHED;
>  }
>
> @@ -129,7 +129,7 @@ static inline bool buffer_icap_busy(void __iomem *base_address)
>  static inline void buffer_icap_set_size(void __iomem *base_address,
>                u32 data)
>  {
> -       out_be32(base_address + XHI_SIZE_REG_OFFSET, data);
> +       iowrite32be(data, base_address + XHI_SIZE_REG_OFFSET);
>  }
>
>  /**
> @@ -143,7 +143,7 @@ static inline void buffer_icap_set_size(void __iomem *base_address,
>  static inline void buffer_icap_set_offset(void __iomem *base_address,
>                u32 data)
>  {
> -       out_be32(base_address + XHI_BRAM_OFFSET_REG_OFFSET, data);
> +       iowrite32be(data, base_address + XHI_BRAM_OFFSET_REG_OFFSET);
>  }
>
>  /**
> @@ -159,7 +159,7 @@ static inline void buffer_icap_set_offset(void __iomem *base_address,
>  static inline void buffer_icap_set_rnc(void __iomem *base_address,
>                u32 data)
>  {
> -       out_be32(base_address + XHI_RNC_REG_OFFSET, data);
> +       iowrite32be(data, base_address + XHI_RNC_REG_OFFSET);
>  }
>
>  /**
> @@ -174,7 +174,7 @@ static inline void buffer_icap_set_rnc(void __iomem *base_address,
>  static inline void buffer_icap_set_bram(void __iomem *base_address,
>                u32 offset, u32 data)
>  {
> -       out_be32(base_address + (offset << 2), data);
> +       iowrite32be(data, base_address + (offset << 2));
>  }
>
>  /**
> @@ -255,7 +255,7 @@ static int buffer_icap_device_write(struct hwicap_drvdata *drvdata,
>  **/
>  void buffer_icap_reset(struct hwicap_drvdata *drvdata)
>  {
> -    out_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET, 0xFEFE);
> +       iowrite32be(0xFEFE, drvdata->base_address + XHI_STATUS_REG_OFFSET);
>  }
>
>  /**
> diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c
> index 02225eb..062df1d 100644
> --- a/drivers/char/xilinx_hwicap/fifo_icap.c
> +++ b/drivers/char/xilinx_hwicap/fifo_icap.c
> @@ -94,7 +94,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
>                u32 data)
>  {
>        dev_dbg(drvdata->dev, "fifo_write: %x\n", data);
> -       out_be32(drvdata->base_address + XHI_WF_OFFSET, data);
> +       iowrite32be(data, drvdata->base_address + XHI_WF_OFFSET);
>  }
>
>  /**
> @@ -105,7 +105,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
>  **/
>  static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
>  {
> -       u32 data = in_be32(drvdata->base_address + XHI_RF_OFFSET);
> +       u32 data = ioread32be(drvdata->base_address + XHI_RF_OFFSET);
>        dev_dbg(drvdata->dev, "fifo_read: %x\n", data);
>        return data;
>  }
> @@ -118,7 +118,7 @@ static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
>  static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
>                u32 data)
>  {
> -       out_be32(drvdata->base_address + XHI_SZ_OFFSET, data);
> +       iowrite32be(data, drvdata->base_address + XHI_SZ_OFFSET);
>  }
>
>  /**
> @@ -127,7 +127,7 @@ static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
>  **/
>  static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
>  {
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_WRITE_MASK);
> +       iowrite32be(XHI_CR_WRITE_MASK, drvdata->base_address + XHI_CR_OFFSET);
>        dev_dbg(drvdata->dev, "configuration started\n");
>  }
>
> @@ -137,7 +137,7 @@ static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
>  **/
>  static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
>  {
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_READ_MASK);
> +       iowrite32be(XHI_CR_READ_MASK, drvdata->base_address + XHI_CR_OFFSET);
>        dev_dbg(drvdata->dev, "readback started\n");
>  }
>
> @@ -159,7 +159,7 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
>  **/
>  u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
>  {
> -       u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
> +       u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
>        dev_dbg(drvdata->dev, "Getting status = %x\n", status);
>        return status;
>  }
> @@ -170,7 +170,7 @@ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
>  **/
>  static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
>  {
> -       u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
> +       u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
>        return (status & XHI_SR_DONE_MASK) ? 0 : 1;
>  }
>
> @@ -183,7 +183,7 @@ static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
>  static inline u32 fifo_icap_write_fifo_vacancy(
>                struct hwicap_drvdata *drvdata)
>  {
> -       return in_be32(drvdata->base_address + XHI_WFV_OFFSET);
> +       return ioread32be(drvdata->base_address + XHI_WFV_OFFSET);
>  }
>
>  /**
> @@ -195,7 +195,7 @@ static inline u32 fifo_icap_write_fifo_vacancy(
>  static inline u32 fifo_icap_read_fifo_occupancy(
>                struct hwicap_drvdata *drvdata)
>  {
> -       return in_be32(drvdata->base_address + XHI_RFO_OFFSET);
> +       return ioread32be(drvdata->base_address + XHI_RFO_OFFSET);
>  }
>
>  /**
> @@ -361,13 +361,12 @@ void fifo_icap_reset(struct hwicap_drvdata *drvdata)
>         * Reset the device by setting/clearing the RESET bit in the
>         * Control Register.
>         */
> -       reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
> +       reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
>
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET,
> -                               reg_data | XHI_CR_SW_RESET_MASK);
> -
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET,
> -                               reg_data & (~XHI_CR_SW_RESET_MASK));
> +       iowrite32be(reg_data | XHI_CR_SW_RESET_MASK,
> +                   drvdata->base_address + XHI_CR_OFFSET);
> +       iowrite32be(reg_data & (~XHI_CR_SW_RESET_MASK),
> +                   drvdata->base_address + XHI_CR_OFFSET);
>
>  }
>
> @@ -382,12 +381,12 @@ void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata)
>         * Flush the FIFO by setting/clearing the FIFO Clear bit in the
>         * Control Register.
>         */
> -       reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
> +       reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
>
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET,
> -                               reg_data | XHI_CR_FIFO_CLR_MASK);
> +       iowrite32be(reg_data | XHI_CR_FIFO_CLR_MASK,
> +                   drvdata->base_address + XHI_CR_OFFSET);
>
> -       out_be32(drvdata->base_address + XHI_CR_OFFSET,
> -                               reg_data & (~XHI_CR_FIFO_CLR_MASK));
> +       iowrite32be(reg_data & (~XHI_CR_FIFO_CLR_MASK),
> +                   drvdata->base_address + XHI_CR_OFFSET);
>  }
>
> diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> index 6172689..7d0f0fb 100644
> --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
> @@ -95,6 +95,7 @@
>  /* For open firmware. */
>  #include <linux/of_device.h>
>  #include <linux/of_platform.h>
> +#include <linux/of_address.h>
>  #endif
>
>  #include "xilinx_hwicap.h"
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* Re: [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
       [not found]                     ` <d3cc257d-ca6f-40cd-82d4-5941e5fbc1d0-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
@ 2010-08-10 18:18                       ` Grant Likely
       [not found]                         ` <AANLkTimxkhWtnwViKj=3rEXcwZ7rPNezTe39Ef3Q5-WO-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Grant Likely @ 2010-08-10 18:18 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>

Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  drivers/char/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> index 7cfcc62..f445f2f 100644
> --- a/drivers/char/Kconfig
> +++ b/drivers/char/Kconfig
> @@ -909,7 +909,7 @@ config DTLK
>
>  config XILINX_HWICAP
>        tristate "Xilinx HWICAP Support"
> -       depends on XILINX_VIRTEX || MICROBLAZE
> +       depends on OF
>        help
>          This option enables support for Xilinx Internal Configuration
>          Access Port (ICAP) driver.  The ICAP is used on Xilinx Virtex
> --
> 1.5.6.6
>
>
>
> This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
>
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

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

* RE: [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
       [not found]                         ` <AANLkTimxkhWtnwViKj=3rEXcwZ7rPNezTe39Ef3Q5-WO-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-10 19:01                           ` Stephen Neuendorffer
       [not found]                             ` <5817abce-3f51-4e8e-a8ba-f95ea13a3536-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
  0 siblings, 1 reply; 23+ messages in thread
From: Stephen Neuendorffer @ 2010-08-10 19:01 UTC (permalink / raw)
  To: Grant Likely; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ


> -----Original Message-----
> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely
> Sent: Tuesday, August 10, 2010 11:18 AM
> To: Stephen Neuendorffer
> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
> Subject: Re: [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
> 
> On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
> > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
> 
> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> 
> > ---
> >  drivers/char/Kconfig |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
> > index 7cfcc62..f445f2f 100644
> > --- a/drivers/char/Kconfig
> > +++ b/drivers/char/Kconfig
> > @@ -909,7 +909,7 @@ config DTLK
> >
> >  config XILINX_HWICAP
> >        tristate "Xilinx HWICAP Support"
> > -       depends on XILINX_VIRTEX || MICROBLAZE
> > +       depends on OF
> >        help
> >          This option enables support for Xilinx Internal Configuration
> >          Access Port (ICAP) driver.  The ICAP is used on Xilinx Virtex
> > --
> > 1.5.6.6

Did you pull the fixed version into your next tree to build test on PowerPC?

Steve

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

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

* Re: [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
       [not found]                             ` <5817abce-3f51-4e8e-a8ba-f95ea13a3536-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
@ 2010-08-10 19:19                               ` Grant Likely
  0 siblings, 0 replies; 23+ messages in thread
From: Grant Likely @ 2010-08-10 19:19 UTC (permalink / raw)
  To: Stephen Neuendorffer; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Tue, Aug 10, 2010 at 1:01 PM, Stephen Neuendorffer
<stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>
>> -----Original Message-----
>> From: glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org [mailto:glikely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org] On Behalf Of Grant Likely
>> Sent: Tuesday, August 10, 2010 11:18 AM
>> To: Stephen Neuendorffer
>> Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
>> Subject: Re: [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available.
>>
>> On Fri, Jul 23, 2010 at 2:57 PM, Stephen Neuendorffer
>> <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> wrote:
>> > Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
>>
>> Acked-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>>
>> > ---
>> >  drivers/char/Kconfig |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
>> > index 7cfcc62..f445f2f 100644
>> > --- a/drivers/char/Kconfig
>> > +++ b/drivers/char/Kconfig
>> > @@ -909,7 +909,7 @@ config DTLK
>> >
>> >  config XILINX_HWICAP
>> >        tristate "Xilinx HWICAP Support"
>> > -       depends on XILINX_VIRTEX || MICROBLAZE
>> > +       depends on OF
>> >        help
>> >          This option enables support for Xilinx Internal Configuration
>> >          Access Port (ICAP) driver.  The ICAP is used on Xilinx Virtex
>> > --
>> > 1.5.6.6
>
> Did you pull the fixed version into your next tree to build test on PowerPC?

I pulled the 3 into my tree now, but I haven't pushed it out for
cross-architecture build testing.  I'll do so after the merge window.

g.

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

end of thread, other threads:[~2010-08-10 19:19 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1279918663-29960-1-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found] ` <1279918663-29960-2-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]   ` <1279918663-29960-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57     ` [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree Stephen Neuendorffer
     [not found]       ` <39f3d9ca-1943-43b8-a1f6-eba8fb2aeeec-RaUQJvECHiuXHCJdrdq+zrjjLBE8jN/0@public.gmane.org>
2010-08-10 17:46         ` Grant Likely
     [not found]           ` <AANLkTimPsDWcW_3z46mMFCxkui+3v6q64F2EMLBr6mNK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 17:54             ` Stephen Neuendorffer
     [not found]   ` <1279918663-29960-3-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]     ` <1279918663-29960-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57       ` [PATCH 3/9] of/base.c: export property access/modification functions Stephen Neuendorffer
     [not found]         ` <ceba5315-090d-4776-9315-0cbca209b5af-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 18:14           ` Grant Likely
     [not found]     ` <1279918663-29960-4-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]       ` <1279918663-29960-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57         ` [PATCH 4/9] drivers/of: Allow IRQ code to work properly on architectures without NO_IRQ Stephen Neuendorffer
     [not found]       ` <1279918663-29960-5-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]         ` <1279918663-29960-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57           ` [PATCH 5/9] arch/x86: Add support for device tree code Stephen Neuendorffer
     [not found]             ` <a85fdc9c-4a93-4381-b01e-5b9bc7666863-RaUQJvECHitCYczPSvLbDrjjLBE8jN/0@public.gmane.org>
2010-08-10 18:00               ` Grant Likely
     [not found]         ` <1279918663-29960-6-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]           ` <1279918663-29960-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57             ` [PATCH 6/9] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver Stephen Neuendorffer
     [not found]               ` <fad5faaa-1fab-4d9f-b41e-236b874e9c08-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 18:14                 ` Grant Likely
     [not found]           ` <1279918663-29960-7-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]             ` <1279918663-29960-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57               ` [PATCH 7/9] [Xilinx] xilinx_hwicap: use linux/io.h instead of asm/io.h Stephen Neuendorffer
     [not found]                 ` <bd5961af-2af1-4f6d-a220-a03fdbb19453-+Ck8Kgl/v0+44QFJ4H5SYbjjLBE8jN/0@public.gmane.org>
2010-08-10 18:16                   ` Grant Likely
     [not found]             ` <1279918663-29960-8-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]               ` <1279918663-29960-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57                 ` [PATCH 8/9] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors Stephen Neuendorffer
     [not found]                   ` <e8b3593c-3be3-4b4e-aabd-e3baeb4e792a-+Ck8Kgl/v0/VOT3FKhN2rLjjLBE8jN/0@public.gmane.org>
2010-08-10 18:17                     ` Grant Likely
     [not found]               ` <1279918663-29960-9-git-send-email-stephen.neuendorffer@xilinx.com>
     [not found]                 ` <1279918663-29960-9-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57                   ` [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available Stephen Neuendorffer
     [not found]                     ` <d3cc257d-ca6f-40cd-82d4-5941e5fbc1d0-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
2010-08-10 18:18                       ` Grant Likely
     [not found]                         ` <AANLkTimxkhWtnwViKj=3rEXcwZ7rPNezTe39Ef3Q5-WO-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 19:01                           ` Stephen Neuendorffer
     [not found]                             ` <5817abce-3f51-4e8e-a8ba-f95ea13a3536-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 19:19                               ` Grant Likely
     [not found] ` <1279918663-29960-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57   ` [PATCH 1/9] drivers/of: Make device tree code work on any arch Stephen Neuendorffer
     [not found]     ` <7e773827-71eb-47a5-826c-cd255b4ce02c-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>
2010-08-10 17:22       ` Grant Likely
2010-07-23 21:39   ` [PATCH 0/9] Xilinx PCI endpoint driver Stephen Neuendorffer
     [not found]     ` <0f773b9c-7bf4-4795-93e1-64b1f81dd286-+Ck8Kgl/v08NTaRkHJHP0bjjLBE8jN/0@public.gmane.org>
2010-08-10 17:15       ` Grant Likely
     [not found]         ` <AANLkTim81JjUYzRaiz_X3sh1evKSEfUia39_Lzjr7H-o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 17:27           ` Stephen Neuendorffer

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.