linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] DT early console initialization
@ 2014-05-08 22:23 Rob Herring
  2014-05-08 22:23 ` [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks Rob Herring
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

From: Rob Herring <robh@kernel.org>

This series adds support for early serial console initialization using 
DT. This enables determining the serial port type and address using the 
FDT and allows enabling the console before platform specific 
initialization runs. I've tested this on arm64. ARM support is dependent 
on adding fixmap support.

Currently, the earlycon is only enabled if "earlycon" is present on the 
kernel command line. The FDT needs to have /chosen/stdout-path set to 
the path of the serial port.

This series is dependent on generic earlycon[1], libfdt support[2], and 
vmlinux.lds.h clean-ups[3]. The first 2 are in linux-next already. A git 
branch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git earlycon-dt

Rob

[1] https://lkml.org/lkml/2014/4/18/573
[2] https://lkml.org/lkml/2014/4/22/1202
[3] https://lkml.org/lkml/2014/3/27/285

Rob Herring (6):
  of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
  of: consolidate linker section OF match table declarations
  serial: earlycon: add DT support
  of/fdt: add FDT address translation support
  of/fdt: add FDT serial scanning for earlycon
  tty/serial: pl011: add DT based earlycon support

 drivers/clocksource/clksrc-of.c   |   2 +-
 drivers/irqchip/irqchip.h         |   7 +-
 drivers/of/Makefile               |   2 +
 drivers/of/fdt.c                  |  56 +++++++++
 drivers/of/fdt_address.c          | 241 ++++++++++++++++++++++++++++++++++++++
 drivers/of/of_reserved_mem.c      |   2 +-
 drivers/tty/serial/amba-pl011.c   |   1 +
 drivers/tty/serial/earlycon.c     |  27 +++++
 include/asm-generic/vmlinux.lds.h |   4 +-
 include/linux/clk-provider.h      |   5 +-
 include/linux/clocksource.h       |  16 +--
 include/linux/of.h                |  22 ++++
 include/linux/of_fdt.h            |   1 +
 include/linux/of_reserved_mem.h   |  22 +---
 include/linux/serial_core.h       |   6 +
 15 files changed, 372 insertions(+), 42 deletions(-)
 create mode 100644 drivers/of/fdt_address.c

-- 
1.9.1


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

* [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-09 10:46   ` Marek Szyprowski
  2014-05-08 22:23 ` [PATCH 2/6] of: consolidate linker section OF match table declarations Rob Herring
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman,
	Rob Herring, Marek Szyprowski

From: Rob Herring <robh@kernel.org>

All the parameters for RESERVEDMEM_OF_DECLARE function callbacks are
members of struct reserved_mem, so just pass the struct ptr to callback
functions so the function callback is more in line with other OF match
table callbacks.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/of/of_reserved_mem.c    | 2 +-
 include/linux/of_reserved_mem.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index e420eb5..632aae8 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -188,7 +188,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
 		if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
 			continue;
 
-		if (initfn(rmem, rmem->fdt_node, rmem->name) == 0) {
+		if (initfn(rmem) == 0) {
 			pr_info("Reserved memory: initialized node %s, compatible id %s\n",
 				rmem->name, compat);
 			return 0;
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 9b1fbb7..4c81b84 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -21,8 +21,8 @@ struct reserved_mem_ops {
 				  struct device *dev);
 };
 
-typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
-				      unsigned long node, const char *uname);
+typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
+
 
 #ifdef CONFIG_OF_RESERVED_MEM
 void fdt_init_reserved_mem(void);
-- 
1.9.1


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

* [PATCH 2/6] of: consolidate linker section OF match table declarations
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
  2014-05-08 22:23 ` [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-14 14:24   ` Grant Likely
  2014-05-08 22:23 ` [PATCH 3/6] serial: earlycon: add DT support Rob Herring
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

From: Rob Herring <robh@kernel.org>

We now have several OF match tables using linker sections that are
nearly the same definition. The only variation is the callback function
prototype. Create a common define for creating linker section OF match
table entries which each table declaration can use.

Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/clocksource/clksrc-of.c |  2 +-
 drivers/irqchip/irqchip.h       |  7 +++----
 include/linux/clk-provider.h    |  5 +----
 include/linux/clocksource.h     | 16 +++-------------
 include/linux/of.h              | 22 ++++++++++++++++++++++
 include/linux/of_reserved_mem.h | 18 ++----------------
 6 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c
index ae2e427..0093a8e 100644
--- a/drivers/clocksource/clksrc-of.c
+++ b/drivers/clocksource/clksrc-of.c
@@ -27,7 +27,7 @@ void __init clocksource_of_init(void)
 {
 	struct device_node *np;
 	const struct of_device_id *match;
-	clocksource_of_init_fn init_func;
+	of_init_fn_1 init_func;
 	unsigned clocksources = 0;
 
 	for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h
index e445ba2..0f6486d 100644
--- a/drivers/irqchip/irqchip.h
+++ b/drivers/irqchip/irqchip.h
@@ -11,6 +11,8 @@
 #ifndef _IRQCHIP_H
 #define _IRQCHIP_H
 
+#include <linux/of.h>
+
 /*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their DT compatible string and their
@@ -21,9 +23,6 @@
  * @compstr: compatible string of the irqchip driver
  * @fn: initialization function
  */
-#define IRQCHIP_DECLARE(name,compstr,fn)				\
-	static const struct of_device_id irqchip_of_match_##name	\
-	__used __section(__irqchip_of_table)				\
-	= { .compatible = compstr, .data = fn }
+#define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
 
 #endif
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 59e2eb5..3429929 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -501,10 +501,7 @@ struct clk_onecell_data {
 
 extern struct of_device_id __clk_of_table;
 
-#define CLK_OF_DECLARE(name, compat, fn)			\
-	static const struct of_device_id __clk_of_table_##name	\
-		__used __section(__clk_of_table)		\
-		= { .compatible = compat, .data = fn };
+#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
 
 #ifdef CONFIG_OF
 int of_clk_add_provider(struct device_node *np,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 67301a4..a16b497 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -339,23 +339,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
 
 extern int clocksource_i8253_init(void);
 
-struct device_node;
-typedef void(*clocksource_of_init_fn)(struct device_node *);
+#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
+	OF_DECLARE_1(clksrc, name, compat, fn)
+
 #ifdef CONFIG_CLKSRC_OF
 extern void clocksource_of_init(void);
-
-#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
-	static const struct of_device_id __clksrc_of_table_##name	\
-		__used __section(__clksrc_of_table)			\
-		 = { .compatible = compat,				\
-		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
 #else
 static inline void clocksource_of_init(void) {}
-#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
-	static const struct of_device_id __clksrc_of_table_##name	\
-		__attribute__((unused))					\
-		 = { .compatible = compat,				\
-		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
 #endif
 
 #endif /* _LINUX_CLOCKSOURCE_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index 3bad8d1..6fb2185 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -757,4 +757,26 @@ static inline int of_get_available_child_count(const struct device_node *np)
 	return num;
 }
 
+#ifdef CONFIG_OF
+#define _OF_DECLARE(table, name, compat, fn, fn_type)			\
+	static const struct of_device_id __of_table_##name		\
+		__used __section(__##table##_of_table)			\
+		 = { .compatible = compat,				\
+		     .data = (fn == (fn_type)NULL) ? fn : fn  }
+#else
+#define _OF_DECLARE(name, compat, fn, fn_type)					\
+	static const struct of_device_id __of_table_##name		\
+		__attribute__((unused))					\
+		 = { .compatible = compat,				\
+		     .data = (fn == (fn_type)NULL) ? fn : fn }
+#endif
+
+typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
+typedef void (*of_init_fn_1)(struct device_node *);
+
+#define OF_DECLARE_1(table, name, compat, fn) \
+		_OF_DECLARE(table, name, compat, fn, of_init_fn_1)
+#define OF_DECLARE_2(table, name, compat, fn) \
+		_OF_DECLARE(table, name, compat, fn, of_init_fn_2)
+
 #endif /* _LINUX_OF_H */
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
index 4c81b84..4669ddf 100644
--- a/include/linux/of_reserved_mem.h
+++ b/include/linux/of_reserved_mem.h
@@ -23,31 +23,17 @@ struct reserved_mem_ops {
 
 typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
 
+#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
+	_OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
 
 #ifdef CONFIG_OF_RESERVED_MEM
 void fdt_init_reserved_mem(void);
 void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
 			       phys_addr_t base, phys_addr_t size);
-
-#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
-	static const struct of_device_id __reservedmem_of_table_##name	\
-		__used __section(__reservedmem_of_table)		\
-		 = { .compatible = compat,				\
-		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
-				init : init }
-
 #else
 static inline void fdt_init_reserved_mem(void) { }
 static inline void fdt_reserved_mem_save_node(unsigned long node,
 		const char *uname, phys_addr_t base, phys_addr_t size) { }
-
-#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
-	static const struct of_device_id __reservedmem_of_table_##name	\
-		__attribute__((unused))					\
-		 = { .compatible = compat,				\
-		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
-				init : init }
-
 #endif
 
 #endif /* __OF_RESERVED_MEM_H */
-- 
1.9.1


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

* [PATCH 3/6] serial: earlycon: add DT support
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
  2014-05-08 22:23 ` [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks Rob Herring
  2014-05-08 22:23 ` [PATCH 2/6] of: consolidate linker section OF match table declarations Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-08 22:23 ` [PATCH 4/6] of/fdt: add FDT address translation support Rob Herring
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman,
	Rob Herring, Jiri Slaby

From: Rob Herring <robh@kernel.org>

This adds the infrastructure to generic earlycon for earlycon setup
using DT. The actual setup is not enabled until a following commit to
add the FDT parsing.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/earlycon.c     | 27 +++++++++++++++++++++++++++
 include/asm-generic/vmlinux.lds.h |  4 +++-
 include/linux/serial_core.h       |  6 ++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index c92e830..021fe5f 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/serial_core.h>
+#include <linux/mod_devicetable.h>
 
 #ifdef CONFIG_FIX_EARLYCON_MEM
 #include <asm/fixmap.h>
@@ -32,6 +33,9 @@ static struct earlycon_device early_console_dev = {
 	.con = &early_con,
 };
 
+static const struct of_device_id __earlycon_of_table_sentinel
+	__used __section(__earlycon_of_table_end);
+
 static void __iomem * __init earlycon_map(unsigned long paddr, size_t size)
 {
 	void __iomem *base;
@@ -142,3 +146,26 @@ int __init setup_earlycon(char *buf, const char *match,
 	register_console(early_console_dev.con);
 	return 0;
 }
+
+int __init of_setup_earlycon(unsigned long addr,
+			     int (*setup)(struct earlycon_device *, const char *))
+{
+	int err;
+	struct uart_port *port = &early_console_dev.port;
+
+	port->iotype = UPIO_MEM;
+	port->mapbase = addr;
+	port->uartclk = BASE_BAUD * 16;
+	port->membase = earlycon_map(addr, SZ_4K);
+
+	early_console_dev.con->data = &early_console_dev;
+	err = setup(&early_console_dev, NULL);
+	if (err < 0)
+		return err;
+	if (!early_console_dev.con->write)
+		return -ENODEV;
+
+
+	register_console(early_console_dev.con);
+	return 0;
+}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 120ccb9..f5249c4 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -129,6 +129,7 @@
 #define CLK_OF_TABLES()		OF_TABLE(CONFIG_COMMON_CLK, clk)
 #define RESERVEDMEM_OF_TABLES()	OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
 #define CPU_METHOD_OF_TABLES()	OF_TABLE(CONFIG_SMP, cpu_method)
+#define EARLYCON_OF_TABLES()	OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
 
 #define KERNEL_DTB()							\
 	STRUCT_ALIGN();							\
@@ -458,7 +459,8 @@
 	CLKSRC_OF_TABLES()						\
 	CPU_METHOD_OF_TABLES()						\
 	KERNEL_DTB()							\
-	IRQCHIP_OF_MATCH_TABLE()
+	IRQCHIP_OF_MATCH_TABLE()					\
+	EARLYCON_OF_TABLES()
 
 #define INIT_TEXT							\
 	*(.init.text)							\
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 7a15b5b..5bbb809 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -294,6 +294,9 @@ struct earlycon_device {
 int setup_earlycon(char *buf, const char *match,
 		   int (*setup)(struct earlycon_device *, const char *));
 
+extern int of_setup_earlycon(unsigned long addr,
+			     int (*setup)(struct earlycon_device *, const char *));
+
 #define EARLYCON_DECLARE(name, func) \
 static int __init name ## _setup_earlycon(char *buf) \
 { \
@@ -301,6 +304,9 @@ static int __init name ## _setup_earlycon(char *buf) \
 } \
 early_param("earlycon", name ## _setup_earlycon);
 
+#define OF_EARLYCON_DECLARE(name, compat, fn)				\
+	_OF_DECLARE(earlycon, name, compat, fn, void *)
+
 struct uart_port *uart_get_console(struct uart_port *ports, int nr,
 				   struct console *c);
 void uart_parse_options(char *options, int *baud, int *parity, int *bits,
-- 
1.9.1


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

* [PATCH 4/6] of/fdt: add FDT address translation support
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
                   ` (2 preceding siblings ...)
  2014-05-08 22:23 ` [PATCH 3/6] serial: earlycon: add DT support Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-08 22:23 ` [PATCH 5/6] of/fdt: add FDT serial scanning for earlycon Rob Herring
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

From: Rob Herring <robh@kernel.org>

Copy u-boot's FDT address translation code from common/fdt_support. This
code was originally based on the kernel's unflattened DT address parsing
code.

This commit can be reverted once relicensing of this code to GPLv2/BSD
is done and it is added to libfdt.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
---
 drivers/of/Makefile      |   2 +
 drivers/of/fdt_address.c | 241 +++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h   |   1 +
 3 files changed, 244 insertions(+)
 create mode 100644 drivers/of/fdt_address.c

diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 9891232..099b1fb 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -1,5 +1,6 @@
 obj-y = base.o device.o platform.o
 obj-$(CONFIG_OF_FLATTREE) += fdt.o
+obj-$(CONFIG_OF_EARLY_FLATTREE) += fdt_address.o
 obj-$(CONFIG_OF_PROMTREE) += pdt.o
 obj-$(CONFIG_OF_ADDRESS)  += address.o
 obj-$(CONFIG_OF_IRQ)    += irq.o
@@ -12,3 +13,4 @@ obj-$(CONFIG_OF_MTD)	+= of_mtd.o
 obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
 
 CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
+CFLAGS_fdt_address.o = -I$(src)/../../scripts/dtc/libfdt
diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c
new file mode 100644
index 0000000..8d3dc6f
--- /dev/null
+++ b/drivers/of/fdt_address.c
@@ -0,0 +1,241 @@
+/*
+ * FDT Address translation based on u-boot fdt_support.c which in turn was
+ * based on the kernel unflattened DT address translation code.
+ *
+ * (C) Copyright 2007
+ * Gerald Van Baren, Custom IDEAS, vanbaren@cideas.com
+ *
+ * Copyright 2010-2011 Freescale Semiconductor, Inc.
+ *
+ * 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, or (at your option)
+ * any later version.
+ */
+#include <linux/kernel.h>
+#include <linux/libfdt.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
+#include <linux/sizes.h>
+
+/* Max address size we deal with */
+#define OF_MAX_ADDR_CELLS	4
+#define OF_CHECK_COUNTS(na, ns)	((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
+			(ns) > 0)
+
+/* Debug utility */
+#ifdef DEBUG
+static void __init of_dump_addr(const char *s, const __be32 *addr, int na)
+{
+	pr_debug("%s", s);
+	while(na--)
+		pr_cont(" %08x", *(addr++));
+	pr_debug("\n");
+}
+#else
+static void __init of_dump_addr(const char *s, const __be32 *addr, int na) { }
+#endif
+
+/* Callbacks for bus specific translators */
+struct of_bus {
+	void		(*count_cells)(const void *blob, int parentoffset,
+				int *addrc, int *sizec);
+	u64		(*map)(__be32 *addr, const __be32 *range,
+				int na, int ns, int pna);
+	int		(*translate)(__be32 *addr, u64 offset, int na);
+};
+
+/* Default translator (generic bus) */
+static void __init fdt_bus_default_count_cells(const void *blob, int parentoffset,
+					       int *addrc, int *sizec)
+{
+	const __be32 *prop;
+
+	if (addrc) {
+		prop = fdt_getprop(blob, parentoffset, "#address-cells", NULL);
+		if (prop)
+			*addrc = be32_to_cpup(prop);
+		else
+			*addrc = dt_root_addr_cells;
+	}
+
+	if (sizec) {
+		prop = fdt_getprop(blob, parentoffset, "#size-cells", NULL);
+		if (prop)
+			*sizec = be32_to_cpup(prop);
+		else
+			*sizec = dt_root_size_cells;
+	}
+}
+
+static u64 __init fdt_bus_default_map(__be32 *addr, const __be32 *range,
+				      int na, int ns, int pna)
+{
+	u64 cp, s, da;
+
+	cp = of_read_number(range, na);
+	s  = of_read_number(range + na + pna, ns);
+	da = of_read_number(addr, na);
+
+	pr_debug("FDT: default map, cp=%llx, s=%llx, da=%llx\n",
+	    cp, s, da);
+
+	if (da < cp || da >= (cp + s))
+		return OF_BAD_ADDR;
+	return da - cp;
+}
+
+static int __init fdt_bus_default_translate(__be32 *addr, u64 offset, int na)
+{
+	u64 a = of_read_number(addr, na);
+	memset(addr, 0, na * 4);
+	a += offset;
+	if (na > 1)
+		addr[na - 2] = cpu_to_fdt32(a >> 32);
+	addr[na - 1] = cpu_to_fdt32(a & 0xffffffffu);
+
+	return 0;
+}
+
+/* Array of bus specific translators */
+static const struct of_bus of_busses[] __initconst = {
+	/* Default */
+	{
+		.count_cells = fdt_bus_default_count_cells,
+		.map = fdt_bus_default_map,
+		.translate = fdt_bus_default_translate,
+	},
+};
+
+static int __init fdt_translate_one(const void *blob, int parent,
+				    const struct of_bus *bus,
+				    const struct of_bus *pbus, __be32 *addr,
+				    int na, int ns, int pna, const char *rprop)
+{
+	const __be32 *ranges;
+	int rlen;
+	int rone;
+	u64 offset = OF_BAD_ADDR;
+
+	ranges = fdt_getprop(blob, parent, rprop, &rlen);
+	if (!ranges)
+		return 1;
+	if (rlen == 0) {
+		offset = of_read_number(addr, na);
+		memset(addr, 0, pna * 4);
+		pr_debug("FDT: empty ranges, 1:1 translation\n");
+		goto finish;
+	}
+
+	pr_debug("FDT: walking ranges...\n");
+
+	/* Now walk through the ranges */
+	rlen /= 4;
+	rone = na + pna + ns;
+	for (; rlen >= rone; rlen -= rone, ranges += rone) {
+		offset = bus->map(addr, ranges, na, ns, pna);
+		if (offset != OF_BAD_ADDR)
+			break;
+	}
+	if (offset == OF_BAD_ADDR) {
+		pr_debug("FDT: not found !\n");
+		return 1;
+	}
+	memcpy(addr, ranges + na, 4 * pna);
+
+ finish:
+	of_dump_addr("FDT: parent translation for:", addr, pna);
+	pr_debug("FDT: with offset: %llx\n", offset);
+
+	/* Translate it into parent bus space */
+	return pbus->translate(addr, offset, pna);
+}
+
+/*
+ * Translate an address from the device-tree into a CPU physical address,
+ * this walks up the tree and applies the various bus mappings on the
+ * way.
+ *
+ * Note: We consider that crossing any level with #size-cells == 0 to mean
+ * that translation is impossible (that is we are not dealing with a value
+ * that can be mapped to a cpu physical address). This is not really specified
+ * that way, but this is traditionally the way IBM at least do things
+ */
+u64 __init fdt_translate_address(const void *blob, int node_offset)
+{
+	int parent, len;
+	const struct of_bus *bus, *pbus;
+	const __be32 *reg;
+	__be32 addr[OF_MAX_ADDR_CELLS];
+	int na, ns, pna, pns;
+	u64 result = OF_BAD_ADDR;
+
+	pr_debug("FDT: ** translation for device %s **\n",
+		 fdt_get_name(blob, node_offset, NULL));
+
+	reg = fdt_getprop(blob, node_offset, "reg", &len);
+	if (!reg) {
+		pr_err("FDT: warning: device tree node '%s' has no address.\n",
+			fdt_get_name(blob, node_offset, NULL));
+		goto bail;
+	}
+
+	/* Get parent & match bus type */
+	parent = fdt_parent_offset(blob, node_offset);
+	if (parent < 0)
+		goto bail;
+	bus = &of_busses[0];
+
+	/* Cound address cells & copy address locally */
+	bus->count_cells(blob, parent, &na, &ns);
+	if (!OF_CHECK_COUNTS(na, ns)) {
+		pr_err("FDT: Bad cell count for %s\n",
+		       fdt_get_name(blob, node_offset, NULL));
+		goto bail;
+	}
+	memcpy(addr, reg, na * 4);
+
+	pr_debug("FDT: bus (na=%d, ns=%d) on %s\n",
+		 na, ns, fdt_get_name(blob, parent, NULL));
+	of_dump_addr("OF: translating address:", addr, na);
+
+	/* Translate */
+	for (;;) {
+		/* Switch to parent bus */
+		node_offset = parent;
+		parent = fdt_parent_offset(blob, node_offset);
+
+		/* If root, we have finished */
+		if (parent < 0) {
+			pr_debug("FDT: reached root node\n");
+			result = of_read_number(addr, na);
+			break;
+		}
+
+		/* Get new parent bus and counts */
+		pbus = &of_busses[0];
+		pbus->count_cells(blob, parent, &pna, &pns);
+		if (!OF_CHECK_COUNTS(pna, pns)) {
+			pr_err("FDT: Bad cell count for %s\n",
+				fdt_get_name(blob, node_offset, NULL));
+			break;
+		}
+
+		pr_debug("FDT: parent bus (na=%d, ns=%d) on %s\n",
+			 pna, pns, fdt_get_name(blob, parent, NULL));
+
+		/* Apply bus translation */
+		if (fdt_translate_one(blob, node_offset, bus, pbus,
+					addr, na, ns, pna, "ranges"))
+			break;
+
+		/* Complete the move up one level */
+		na = pna;
+		ns = pns;
+		bus = pbus;
+
+		of_dump_addr("FDT: one level translation:", addr, na);
+	}
+ bail:
+	return result;
+}
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 5c0ab05..0511789 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -83,6 +83,7 @@ extern void unflatten_device_tree(void);
 extern void unflatten_and_copy_device_tree(void);
 extern void early_init_devtree(void *);
 extern void early_get_first_memblock_info(void *, phys_addr_t *);
+extern u64 fdt_translate_address(const void *blob, int node_offset);
 #else /* CONFIG_OF_FLATTREE */
 static inline void early_init_fdt_scan_reserved_mem(void) {}
 static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
-- 
1.9.1


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

* [PATCH 5/6] of/fdt: add FDT serial scanning for earlycon
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
                   ` (3 preceding siblings ...)
  2014-05-08 22:23 ` [PATCH 4/6] of/fdt: add FDT address translation support Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-08 22:23 ` [PATCH 6/6] tty/serial: pl011: add DT based earlycon support Rob Herring
  2014-05-14 14:26 ` [PATCH 0/6] DT early console initialization Grant Likely
  6 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

From: Rob Herring <robh@kernel.org>

This adds FDT parsing of {linux,}stdout-path to setup an early serial
console. Enabling of the early console is triggered with "earlycon"
(with no options) on the kernel command line.

Platforms must either have fixmap permanent mapping support,
have a functioning ioremap when early params are parsed, or explicitly
call early_init_dt_scan_chosen_serial from architecture code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
---
 drivers/of/fdt.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index a6f83ea..1fbeab2 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/libfdt.h>
 #include <linux/debugfs.h>
+#include <linux/serial_core.h>
 
 #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
 #include <asm/page.h>
@@ -696,6 +697,61 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
 }
 #endif /* CONFIG_BLK_DEV_INITRD */
 
+#ifdef CONFIG_SERIAL_EARLYCON
+extern struct of_device_id __earlycon_of_table[];
+
+int __init early_init_dt_scan_chosen_serial(void)
+{
+	int offset;
+	const char *p;
+	int l;
+	const struct of_device_id *match = __earlycon_of_table;
+	const void *fdt = initial_boot_params;
+
+	offset = fdt_path_offset(fdt, "/chosen");
+	if (offset < 0)
+		offset = fdt_path_offset(fdt, "/chosen@0");
+	if (offset < 0)
+		return -ENOENT;
+
+	p = fdt_getprop(fdt, offset, "stdout-path", &l);
+	if (!p)
+		p = fdt_getprop(fdt, offset, "linux,stdout-path", &l);
+	if (!p || !l)
+		return -ENOENT;
+
+	/* Get the node specified by stdout-path */
+	offset = fdt_path_offset(fdt, p);
+	if (offset < 0)
+		return -ENODEV;
+
+	while (match->compatible) {
+		unsigned long addr;
+		if (fdt_node_check_compatible(fdt, offset, match->compatible)) {
+			match++;
+			continue;
+		}
+
+		addr = fdt_translate_address(fdt, offset);
+		if (!addr)
+			return -ENXIO;
+
+		of_setup_earlycon(addr, match->data);
+		return 0;
+	}
+	return -ENODEV;
+}
+
+static int __init setup_of_earlycon(char *buf)
+{
+	if (buf)
+		return 0;
+
+	return early_init_dt_scan_chosen_serial();
+}
+early_param("earlycon", setup_of_earlycon);
+#endif
+
 /**
  * early_init_dt_scan_root - fetch the top level address and size cells
  */
-- 
1.9.1


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

* [PATCH 6/6] tty/serial: pl011: add DT based earlycon support
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
                   ` (4 preceding siblings ...)
  2014-05-08 22:23 ` [PATCH 5/6] of/fdt: add FDT serial scanning for earlycon Rob Herring
@ 2014-05-08 22:23 ` Rob Herring
  2014-05-14 14:26 ` [PATCH 0/6] DT early console initialization Grant Likely
  6 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2014-05-08 22:23 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman,
	Rob Herring, Russell King, Jiri Slaby

From: Rob Herring <robh@kernel.org>

Enable DT based earlycon initialization for the pl011 uart.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/amba-pl011.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index ee3d803..908a6e3 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2072,6 +2072,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
 	return 0;
 }
 EARLYCON_DECLARE(pl011, pl011_early_console_setup);
+OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
 
 #else
 #define AMBA_CONSOLE	NULL
-- 
1.9.1


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

* Re: [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
  2014-05-08 22:23 ` [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks Rob Herring
@ 2014-05-09 10:46   ` Marek Szyprowski
  0 siblings, 0 replies; 12+ messages in thread
From: Marek Szyprowski @ 2014-05-09 10:46 UTC (permalink / raw)
  To: Rob Herring, devicetree, linux-kernel, linux-arm-kernel
  Cc: Grant Likely, benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

Hello,

On 2014-05-09 00:23, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
>
> All the parameters for RESERVEDMEM_OF_DECLARE function callbacks are
> members of struct reserved_mem, so just pass the struct ptr to callback
> functions so the function callback is more in line with other OF match
> table callbacks.
>
> Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/of/of_reserved_mem.c    | 2 +-
>   include/linux/of_reserved_mem.h | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index e420eb5..632aae8 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -188,7 +188,7 @@ static int __init __reserved_mem_init_node(struct reserved_mem *rmem)
>   		if (!of_flat_dt_is_compatible(rmem->fdt_node, compat))
>   			continue;
>   
> -		if (initfn(rmem, rmem->fdt_node, rmem->name) == 0) {
> +		if (initfn(rmem) == 0) {
>   			pr_info("Reserved memory: initialized node %s, compatible id %s\n",
>   				rmem->name, compat);
>   			return 0;
> diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
> index 9b1fbb7..4c81b84 100644
> --- a/include/linux/of_reserved_mem.h
> +++ b/include/linux/of_reserved_mem.h
> @@ -21,8 +21,8 @@ struct reserved_mem_ops {
>   				  struct device *dev);
>   };
>   
> -typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem,
> -				      unsigned long node, const char *uname);
> +typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
> +
>   
>   #ifdef CONFIG_OF_RESERVED_MEM
>   void fdt_init_reserved_mem(void);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


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

* Re: [PATCH 2/6] of: consolidate linker section OF match table declarations
  2014-05-08 22:23 ` [PATCH 2/6] of: consolidate linker section OF match table declarations Rob Herring
@ 2014-05-14 14:24   ` Grant Likely
  0 siblings, 0 replies; 12+ messages in thread
From: Grant Likely @ 2014-05-14 14:24 UTC (permalink / raw)
  To: Rob Herring, devicetree, linux-kernel, linux-arm-kernel
  Cc: benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

On Thu,  8 May 2014 17:23:39 -0500, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <robh@kernel.org>
> 
> We now have several OF match tables using linker sections that are
> nearly the same definition. The only variation is the callback function
> prototype. Create a common define for creating linker section OF match
> table entries which each table declaration can use.
> 
> Cc: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>

Nice!

Acked-by: Grant Likely <grant.likely@linaro.org>

g.

> ---
>  drivers/clocksource/clksrc-of.c |  2 +-
>  drivers/irqchip/irqchip.h       |  7 +++----
>  include/linux/clk-provider.h    |  5 +----
>  include/linux/clocksource.h     | 16 +++-------------
>  include/linux/of.h              | 22 ++++++++++++++++++++++
>  include/linux/of_reserved_mem.h | 18 ++----------------
>  6 files changed, 32 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c
> index ae2e427..0093a8e 100644
> --- a/drivers/clocksource/clksrc-of.c
> +++ b/drivers/clocksource/clksrc-of.c
> @@ -27,7 +27,7 @@ void __init clocksource_of_init(void)
>  {
>  	struct device_node *np;
>  	const struct of_device_id *match;
> -	clocksource_of_init_fn init_func;
> +	of_init_fn_1 init_func;
>  	unsigned clocksources = 0;
>  
>  	for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
> diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h
> index e445ba2..0f6486d 100644
> --- a/drivers/irqchip/irqchip.h
> +++ b/drivers/irqchip/irqchip.h
> @@ -11,6 +11,8 @@
>  #ifndef _IRQCHIP_H
>  #define _IRQCHIP_H
>  
> +#include <linux/of.h>
> +
>  /*
>   * This macro must be used by the different irqchip drivers to declare
>   * the association between their DT compatible string and their
> @@ -21,9 +23,6 @@
>   * @compstr: compatible string of the irqchip driver
>   * @fn: initialization function
>   */
> -#define IRQCHIP_DECLARE(name,compstr,fn)				\
> -	static const struct of_device_id irqchip_of_match_##name	\
> -	__used __section(__irqchip_of_table)				\
> -	= { .compatible = compstr, .data = fn }
> +#define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
>  
>  #endif
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 59e2eb5..3429929 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -501,10 +501,7 @@ struct clk_onecell_data {
>  
>  extern struct of_device_id __clk_of_table;
>  
> -#define CLK_OF_DECLARE(name, compat, fn)			\
> -	static const struct of_device_id __clk_of_table_##name	\
> -		__used __section(__clk_of_table)		\
> -		= { .compatible = compat, .data = fn };
> +#define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn)
>  
>  #ifdef CONFIG_OF
>  int of_clk_add_provider(struct device_node *np,
> diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
> index 67301a4..a16b497 100644
> --- a/include/linux/clocksource.h
> +++ b/include/linux/clocksource.h
> @@ -339,23 +339,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *,
>  
>  extern int clocksource_i8253_init(void);
>  
> -struct device_node;
> -typedef void(*clocksource_of_init_fn)(struct device_node *);
> +#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
> +	OF_DECLARE_1(clksrc, name, compat, fn)
> +
>  #ifdef CONFIG_CLKSRC_OF
>  extern void clocksource_of_init(void);
> -
> -#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
> -	static const struct of_device_id __clksrc_of_table_##name	\
> -		__used __section(__clksrc_of_table)			\
> -		 = { .compatible = compat,				\
> -		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
>  #else
>  static inline void clocksource_of_init(void) {}
> -#define CLOCKSOURCE_OF_DECLARE(name, compat, fn)			\
> -	static const struct of_device_id __clksrc_of_table_##name	\
> -		__attribute__((unused))					\
> -		 = { .compatible = compat,				\
> -		     .data = (fn == (clocksource_of_init_fn)NULL) ? fn : fn }
>  #endif
>  
>  #endif /* _LINUX_CLOCKSOURCE_H */
> diff --git a/include/linux/of.h b/include/linux/of.h
> index 3bad8d1..6fb2185 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -757,4 +757,26 @@ static inline int of_get_available_child_count(const struct device_node *np)
>  	return num;
>  }
>  
> +#ifdef CONFIG_OF
> +#define _OF_DECLARE(table, name, compat, fn, fn_type)			\
> +	static const struct of_device_id __of_table_##name		\
> +		__used __section(__##table##_of_table)			\
> +		 = { .compatible = compat,				\
> +		     .data = (fn == (fn_type)NULL) ? fn : fn  }
> +#else
> +#define _OF_DECLARE(name, compat, fn, fn_type)					\
> +	static const struct of_device_id __of_table_##name		\
> +		__attribute__((unused))					\
> +		 = { .compatible = compat,				\
> +		     .data = (fn == (fn_type)NULL) ? fn : fn }
> +#endif
> +
> +typedef int (*of_init_fn_2)(struct device_node *, struct device_node *);
> +typedef void (*of_init_fn_1)(struct device_node *);
> +
> +#define OF_DECLARE_1(table, name, compat, fn) \
> +		_OF_DECLARE(table, name, compat, fn, of_init_fn_1)
> +#define OF_DECLARE_2(table, name, compat, fn) \
> +		_OF_DECLARE(table, name, compat, fn, of_init_fn_2)
> +
>  #endif /* _LINUX_OF_H */
> diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h
> index 4c81b84..4669ddf 100644
> --- a/include/linux/of_reserved_mem.h
> +++ b/include/linux/of_reserved_mem.h
> @@ -23,31 +23,17 @@ struct reserved_mem_ops {
>  
>  typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
>  
> +#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
> +	_OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
>  
>  #ifdef CONFIG_OF_RESERVED_MEM
>  void fdt_init_reserved_mem(void);
>  void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
>  			       phys_addr_t base, phys_addr_t size);
> -
> -#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
> -	static const struct of_device_id __reservedmem_of_table_##name	\
> -		__used __section(__reservedmem_of_table)		\
> -		 = { .compatible = compat,				\
> -		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
> -				init : init }
> -
>  #else
>  static inline void fdt_init_reserved_mem(void) { }
>  static inline void fdt_reserved_mem_save_node(unsigned long node,
>  		const char *uname, phys_addr_t base, phys_addr_t size) { }
> -
> -#define RESERVEDMEM_OF_DECLARE(name, compat, init)			\
> -	static const struct of_device_id __reservedmem_of_table_##name	\
> -		__attribute__((unused))					\
> -		 = { .compatible = compat,				\
> -		     .data = (init == (reservedmem_of_init_fn)NULL) ?	\
> -				init : init }
> -
>  #endif
>  
>  #endif /* __OF_RESERVED_MEM_H */
> -- 
> 1.9.1
> 


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

* Re: [PATCH 0/6] DT early console initialization
  2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
                   ` (5 preceding siblings ...)
  2014-05-08 22:23 ` [PATCH 6/6] tty/serial: pl011: add DT based earlycon support Rob Herring
@ 2014-05-14 14:26 ` Grant Likely
  2014-05-28 16:30   ` Rob Herring
  6 siblings, 1 reply; 12+ messages in thread
From: Grant Likely @ 2014-05-14 14:26 UTC (permalink / raw)
  To: Rob Herring, devicetree, linux-kernel, linux-arm-kernel
  Cc: benh, Arnd Bergmann, Greg Kroah-Hartman, Rob Herring

On Thu,  8 May 2014 17:23:37 -0500, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <robh@kernel.org>
> 
> This series adds support for early serial console initialization using 
> DT. This enables determining the serial port type and address using the 
> FDT and allows enabling the console before platform specific 
> initialization runs. I've tested this on arm64. ARM support is dependent 
> on adding fixmap support.
> 
> Currently, the earlycon is only enabled if "earlycon" is present on the 
> kernel command line. The FDT needs to have /chosen/stdout-path set to 
> the path of the serial port.
> 
> This series is dependent on generic earlycon[1], libfdt support[2], and 
> vmlinux.lds.h clean-ups[3]. The first 2 are in linux-next already. A git 
> branch is available here:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git earlycon-dt

Nice. For the whole series:

Acked-by: Grant Likely <grant.likely@linaro.org>

I haven't tested it though.

> 
> Rob
> 
> [1] https://lkml.org/lkml/2014/4/18/573
> [2] https://lkml.org/lkml/2014/4/22/1202
> [3] https://lkml.org/lkml/2014/3/27/285
> 
> Rob Herring (6):
>   of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
>   of: consolidate linker section OF match table declarations
>   serial: earlycon: add DT support
>   of/fdt: add FDT address translation support
>   of/fdt: add FDT serial scanning for earlycon
>   tty/serial: pl011: add DT based earlycon support
> 
>  drivers/clocksource/clksrc-of.c   |   2 +-
>  drivers/irqchip/irqchip.h         |   7 +-
>  drivers/of/Makefile               |   2 +
>  drivers/of/fdt.c                  |  56 +++++++++
>  drivers/of/fdt_address.c          | 241 ++++++++++++++++++++++++++++++++++++++
>  drivers/of/of_reserved_mem.c      |   2 +-
>  drivers/tty/serial/amba-pl011.c   |   1 +
>  drivers/tty/serial/earlycon.c     |  27 +++++
>  include/asm-generic/vmlinux.lds.h |   4 +-
>  include/linux/clk-provider.h      |   5 +-
>  include/linux/clocksource.h       |  16 +--
>  include/linux/of.h                |  22 ++++
>  include/linux/of_fdt.h            |   1 +
>  include/linux/of_reserved_mem.h   |  22 +---
>  include/linux/serial_core.h       |   6 +
>  15 files changed, 372 insertions(+), 42 deletions(-)
>  create mode 100644 drivers/of/fdt_address.c
> 
> -- 
> 1.9.1
> 


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

* Re: [PATCH 0/6] DT early console initialization
  2014-05-14 14:26 ` [PATCH 0/6] DT early console initialization Grant Likely
@ 2014-05-28 16:30   ` Rob Herring
  2014-05-28 20:30     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 12+ messages in thread
From: Rob Herring @ 2014-05-28 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devicetree, linux-kernel, linux-arm-kernel,
	Benjamin Herrenschmidt, Arnd Bergmann, Grant Likely

On Wed, May 14, 2014 at 9:26 AM, Grant Likely <grant.likely@linaro.org> wrote:
> On Thu,  8 May 2014 17:23:37 -0500, Rob Herring <robherring2@gmail.com> wrote:
>> From: Rob Herring <robh@kernel.org>
>>
>> This series adds support for early serial console initialization using
>> DT. This enables determining the serial port type and address using the
>> FDT and allows enabling the console before platform specific
>> initialization runs. I've tested this on arm64. ARM support is dependent
>> on adding fixmap support.
>>
>> Currently, the earlycon is only enabled if "earlycon" is present on the
>> kernel command line. The FDT needs to have /chosen/stdout-path set to
>> the path of the serial port.
>>
>> This series is dependent on generic earlycon[1], libfdt support[2], and
>> vmlinux.lds.h clean-ups[3]. The first 2 are in linux-next already. A git
>> branch is available here:
>>
>> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git earlycon-dt
>
> Nice. For the whole series:
>
> Acked-by: Grant Likely <grant.likely@linaro.org>
>
> I haven't tested it though.
>>
>> Rob
>>
>> [1] https://lkml.org/lkml/2014/4/18/573
>> [2] https://lkml.org/lkml/2014/4/22/1202
>> [3] https://lkml.org/lkml/2014/3/27/285
>>
>> Rob Herring (6):
>>   of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
>>   of: consolidate linker section OF match table declarations
>>   serial: earlycon: add DT support
>>   of/fdt: add FDT address translation support
>>   of/fdt: add FDT serial scanning for earlycon
>>   tty/serial: pl011: add DT based earlycon support

Greg, I plan to take this series thru the DT tree for 3.16 unless you
have any objections. It has dependencies on both the tty-next and the
DT trees.

Rob

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

* Re: [PATCH 0/6] DT early console initialization
  2014-05-28 16:30   ` Rob Herring
@ 2014-05-28 20:30     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2014-05-28 20:30 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, linux-kernel, linux-arm-kernel,
	Benjamin Herrenschmidt, Arnd Bergmann, Grant Likely

On Wed, May 28, 2014 at 11:30:04AM -0500, Rob Herring wrote:
> On Wed, May 14, 2014 at 9:26 AM, Grant Likely <grant.likely@linaro.org> wrote:
> > On Thu,  8 May 2014 17:23:37 -0500, Rob Herring <robherring2@gmail.com> wrote:
> >> From: Rob Herring <robh@kernel.org>
> >>
> >> This series adds support for early serial console initialization using
> >> DT. This enables determining the serial port type and address using the
> >> FDT and allows enabling the console before platform specific
> >> initialization runs. I've tested this on arm64. ARM support is dependent
> >> on adding fixmap support.
> >>
> >> Currently, the earlycon is only enabled if "earlycon" is present on the
> >> kernel command line. The FDT needs to have /chosen/stdout-path set to
> >> the path of the serial port.
> >>
> >> This series is dependent on generic earlycon[1], libfdt support[2], and
> >> vmlinux.lds.h clean-ups[3]. The first 2 are in linux-next already. A git
> >> branch is available here:
> >>
> >> git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git earlycon-dt
> >
> > Nice. For the whole series:
> >
> > Acked-by: Grant Likely <grant.likely@linaro.org>
> >
> > I haven't tested it though.
> >>
> >> Rob
> >>
> >> [1] https://lkml.org/lkml/2014/4/18/573
> >> [2] https://lkml.org/lkml/2014/4/22/1202
> >> [3] https://lkml.org/lkml/2014/3/27/285
> >>
> >> Rob Herring (6):
> >>   of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks
> >>   of: consolidate linker section OF match table declarations
> >>   serial: earlycon: add DT support
> >>   of/fdt: add FDT address translation support
> >>   of/fdt: add FDT serial scanning for earlycon
> >>   tty/serial: pl011: add DT based earlycon support
> 
> Greg, I plan to take this series thru the DT tree for 3.16 unless you
> have any objections. It has dependencies on both the tty-next and the
> DT trees.

No objection from me at all, feel free to do so.

greg k-h

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

end of thread, other threads:[~2014-05-28 20:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 22:23 [PATCH 0/6] DT early console initialization Rob Herring
2014-05-08 22:23 ` [PATCH 1/6] of: align RESERVEDMEM_OF_DECLARE function callbacks to other callbacks Rob Herring
2014-05-09 10:46   ` Marek Szyprowski
2014-05-08 22:23 ` [PATCH 2/6] of: consolidate linker section OF match table declarations Rob Herring
2014-05-14 14:24   ` Grant Likely
2014-05-08 22:23 ` [PATCH 3/6] serial: earlycon: add DT support Rob Herring
2014-05-08 22:23 ` [PATCH 4/6] of/fdt: add FDT address translation support Rob Herring
2014-05-08 22:23 ` [PATCH 5/6] of/fdt: add FDT serial scanning for earlycon Rob Herring
2014-05-08 22:23 ` [PATCH 6/6] tty/serial: pl011: add DT based earlycon support Rob Herring
2014-05-14 14:26 ` [PATCH 0/6] DT early console initialization Grant Likely
2014-05-28 16:30   ` Rob Herring
2014-05-28 20:30     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).