Skip to contentSkip to conversation

sparc: make drivers/of/pdt.c no longer sparc-only

PATCH Applied Andres Salomon 3 participants 6 messages Oct 10, 2010 – Oct 11, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 sparc: make drivers/of/pdt.c no longer sparc-only

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

---
 arch/sparc/Kconfig              |    1 +
 arch/sparc/include/asm/prom.h   |    5 ++-
 arch/sparc/kernel/prom.h        |    6 ----
 arch/sparc/kernel/prom_common.c |   10 ++++++-
 drivers/of/Kconfig              |    5 +++-
 drivers/of/Makefile             |    1 +
 drivers/of/pdt.c                |   54 ++++++++++++++++++++++++++++-----------
 include/linux/of_pdt.h          |   24 +++++++++++++++++
 8 files changed, 81 insertions(+), 25 deletions(-)
 create mode 100644 include/linux/of_pdt.h
arch/sparc/Kconfig +1 -0
index 491e9d6..a06c959 100644
@@ -19,6 +19,7 @@ config SPARC
 	bool
 	default y
 	select OF
+	select OF_PROMTREE
 	select HAVE_IDE
 	select HAVE_OPROFILE
 	select HAVE_ARCH_KGDB if !SMP || SPARC64
arch/sparc/include/asm/prom.h +3 -2
index 291f125..56bbaad 100644
@@ -18,6 +18,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <linux/types.h>
+#include <linux/of_pdt.h>
 #include <linux/proc_fs.h>
 #include <linux/mutex.h>
 #include <asm/atomic.h>
@@ -67,8 +68,8 @@ extern struct device_node *of_console_device;
 extern char *of_console_path;
 extern char *of_console_options;
 
-extern void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp);
-extern char *build_full_name(struct device_node *dp);
+extern void irq_trans_init(struct device_node *dp);
+extern char *build_path_component(struct device_node *dp);
 
 #endif /* __KERNEL__ */
 #endif /* _SPARC_PROM_H */
arch/sparc/kernel/prom.h +0 -6
index eeb04a7..cf5fe1c 100644
@@ -4,12 +4,6 @@
 #include <linux/spinlock.h>
 #include <asm/prom.h>
 
-extern void * prom_early_alloc(unsigned long size);
-extern void irq_trans_init(struct device_node *dp);
-
-extern unsigned int prom_unique_id;
-
-extern char *build_path_component(struct device_node *dp);
 extern void of_console_init(void);
 
 extern unsigned int prom_early_allocated;
arch/sparc/kernel/prom_common.c +9 -1
index 7b454f6..fe84d56 100644
@@ -20,6 +20,7 @@
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/of_pdt.h>
 #include <asm/prom.h>
 #include <asm/oplib.h>
 #include <asm/leon.h>
@@ -119,4 +120,11 @@ EXPORT_SYMBOL(of_find_in_proplist);
 
 unsigned int prom_early_allocated __initdata;
 
-#include "../../../drivers/of/pdt.c"
+void __init prom_build_devicetree(void)
+{
+	of_pdt_build_devicetree(prom_root_node);
+	of_console_init();
+
+	pr_info("PROM: Built device tree with %u bytes of memory.\n",
+			prom_early_allocated);
+}
drivers/of/Kconfig +4 -1
index 6acbff3..aa675eb 100644
@@ -4,7 +4,7 @@ config DTC
 config OF
 	bool
 
-menu "Flattened Device Tree and Open Firmware support"
+menu "Device Tree and Open Firmware support"
 	depends on OF
 
 config PROC_DEVICETREE
@@ -19,6 +19,9 @@ config OF_FLATTREE
 	bool
 	select DTC
 
+config OF_PROMTREE
+	bool
+
 config OF_DYNAMIC
 	def_bool y
 	depends on PPC_OF
drivers/of/Makefile +1 -0
index 0052c40..7888155 100644
@@ -1,5 +1,6 @@
 obj-y = base.o
 obj-$(CONFIG_OF_FLATTREE) += fdt.o
+obj-$(CONFIG_OF_PROMTREE) += pdt.o
 obj-$(CONFIG_OF_ADDRESS)  += address.o
 obj-$(CONFIG_OF_IRQ)    += irq.o
 obj-$(CONFIG_OF_DEVICE) += device.o platform.o
drivers/of/pdt.c +39 -15

123 lines not on this page · raw message

include/linux/of_pdt.h new file +24 -0
new file mode 100644
index 0000000..c0a8774
@@ -0,0 +1,24 @@
+/*
+ * Definitions for building a device tree by calling into the
+ * Open Firmware PROM.
+ *
+ * Copyright (C) 2010  Andres Salomon <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _LINUX_OF_PDT_H
+#define _LINUX_OF_PDT_H
+
+extern void *prom_early_alloc(unsigned long size);
+
+/* for building the device tree */
+extern void of_pdt_build_devicetree(phandle root_node);
+
+extern void (*prom_build_more)(struct device_node *dp,
+		struct device_node ***nextp);
+
+#endif /* _LINUX_OF_PDT_H */
Signature · 1 line
1.5.6.5
#1 lore raw

Whoops, that should've been 1/5, not 1/7. Two additional x86 patches snuck in there that are already in Grant's test-devicetree branch.

Quoted 7 lines · On Sun, 10 Oct 2010 01:43:58 -0700 Andres Salomon <[email protected]> wrote:

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

#2 lore raw
Quoted 2 lines · Andres Salomon

Whoops, that should've been 1/5, not 1/7. Two additional x86 patches snuck in there that are already in Grant's test-devicetree branch.

Note that of the two patches I'm carrying in test-devicetree, only one of them is actually able to move into linux-next at this present time.

1) of/irq: remove references to NO_IRQ in drivers/of/platform.c

I'm putting this one into next-devicetree now

2) x86/of: define irq functions to allow drivers/of/* to build on x86

I've not yet received an ack from the x86 maintainers on this, so I cannot put it into my next branch. (Sorry I didn't notice this earlier; it just dawned on me as I was looking over which patches I needed to move over). The same goes for the patch that actaully adds OF support for x86 OLPC. I'll need an ack from x86 folks before I merge it.

g.

Quoted 12 lines
Quoted 7 lines · On Sun, 10 Oct 2010 01:43:58 -0700 Andres Salomon <[email protected]> wrote:

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

#3 lore raw
Quoted 14 lines · On Sun, 10 Oct 2010 22:04:43 -0600 Grant Likely…
Quoted 3 lines · Andres Salomon

Whoops, that should've been 1/5, not 1/7. Two additional x86 patches snuck in there that are already in Grant's test-devicetree branch.

Note that of the two patches I'm carrying in test-devicetree, only one of them is actually able to move into linux-next at this present time.

1) of/irq: remove references to NO_IRQ in drivers/of/platform.c

I'm putting this one into next-devicetree now

2) x86/of: define irq functions to allow drivers/of/* to build on x86

Quoted 8 lines

I've not yet received an ack from the x86 maintainers on this, so I cannot put it into my next branch. (Sorry I didn't notice this earlier; it just dawned on me as I was looking over which patches I needed to move over). The same goes for the patch that actaully adds OF support for x86 OLPC. I'll need an ack from x86 folks before I merge it.

g.

Okay. For reference, that patch is:

https://patchwork.kernel.org/patch/168662/

x86 folks, mind reviewing and providing an Ack or Nack?

Applied
#4 lore raw
In reply to Andres Salomon
Quoted 7 lines · Andres Salomon

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

Applied, thanks. Since the difference between this version and the last is trivial, I've carried over davem's acked-by lines on the first 3 patches.

Dave, let me know if you've got any issues with this and I'll drop them from my tree.

g.

maintainer
#5 lore raw

From: Grant Likely <[email protected]>
Date: Sun, 10 Oct 2010 22:10:10 -0600

Quoted 7 lines · Andres Salomon
Quoted 6 lines

Clean up pdt.c:
- make build dependent upon config OF_PROMTREE
- #ifdef out the sparc-specific stuff
- create pdt-specific header

Quoted 8 lines
Quoted 1 line

Applied, thanks. Since the difference between this version and the last is trivial, I've carried over davem's acked-by lines on the first 3 patches.

Dave, let me know if you've got any issues with this and I'll drop them from my tree.

No problems.