* [PATCH] of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
@ 2014-10-19 8:11 Kevin Cernekee
[not found] ` <1413706294-12578-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Cernekee @ 2014-10-19 8:11 UTC (permalink / raw)
To: robh-DgEjT+Ai2ygdnm+yROfE0A, grant.likely-QSEj5FYQhm4dnm+yROfE0A
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA
The original commit that introduced this function (fb11ffe74c794a)
indicated that calling it from the architecture code was one possible
use case. Let's declare it in of_fdt.h to make it a public API.
Signed-off-by: Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
include/linux/of_fdt.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 0ff360d..5d233df 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -12,6 +12,7 @@
#ifndef _LINUX_OF_FDT_H
#define _LINUX_OF_FDT_H
+#include <linux/errno.h>
#include <linux/types.h>
#include <linux/init.h>
@@ -87,6 +88,13 @@ 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);
extern void of_fdt_limit_memory(int limit);
+
+#if defined(CONFIG_SERIAL_EARLYCON)
+extern int early_init_dt_scan_chosen_serial(void);
+#else
+static inline int early_init_dt_scan_chosen_serial(void) { return -ENOENT; }
+#endif
+
#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; }
--
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
[not found] ` <1413706294-12578-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-10-20 7:26 ` Geert Uytterhoeven
2014-10-20 9:22 ` Rob Herring
1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2014-10-20 7:26 UTC (permalink / raw)
To: Kevin Cernekee, Michal Simek
Cc: Rob Herring, Grant Likely,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Sun, Oct 19, 2014 at 10:11 AM, Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The original commit that introduced this function (fb11ffe74c794a)
> indicated that calling it from the architecture code was one possible
> use case. Let's declare it in of_fdt.h to make it a public API.
>
> Signed-off-by: Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Please note that arch/microblaze/kernel/prom.c has a local function with
the same name but a different signature, so this will cause a compile
failure there.
> ---
> include/linux/of_fdt.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 0ff360d..5d233df 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -12,6 +12,7 @@
> #ifndef _LINUX_OF_FDT_H
> #define _LINUX_OF_FDT_H
>
> +#include <linux/errno.h>
> #include <linux/types.h>
> #include <linux/init.h>
>
> @@ -87,6 +88,13 @@ 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);
> extern void of_fdt_limit_memory(int limit);
> +
> +#if defined(CONFIG_SERIAL_EARLYCON)
> +extern int early_init_dt_scan_chosen_serial(void);
> +#else
> +static inline int early_init_dt_scan_chosen_serial(void) { return -ENOENT; }
> +#endif
> +
> #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; }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
[not found] ` <1413706294-12578-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-20 7:26 ` Geert Uytterhoeven
@ 2014-10-20 9:22 ` Rob Herring
[not found] ` <CAL_JsqKzWfwMRheB0qGhcHFkj9zku2uevX7GF+=U4Qhd9m3VYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2014-10-20 9:22 UTC (permalink / raw)
To: Kevin Cernekee
Cc: Grant Likely, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Sun, Oct 19, 2014 at 4:11 PM, Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The original commit that introduced this function (fb11ffe74c794a)
> indicated that calling it from the architecture code was one possible
> use case. Let's declare it in of_fdt.h to make it a public API.
Who is the user for this?
Despite what I said, there would be issues calling this from arch
code. Doing so would result in 2 calls to this function as the
early_param call is not disabled. This could be fixed, but really we
want an arch to implement one of the other options.
Rob
>
> Signed-off-by: Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> include/linux/of_fdt.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 0ff360d..5d233df 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -12,6 +12,7 @@
> #ifndef _LINUX_OF_FDT_H
> #define _LINUX_OF_FDT_H
>
> +#include <linux/errno.h>
> #include <linux/types.h>
> #include <linux/init.h>
>
> @@ -87,6 +88,13 @@ 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);
> extern void of_fdt_limit_memory(int limit);
> +
> +#if defined(CONFIG_SERIAL_EARLYCON)
> +extern int early_init_dt_scan_chosen_serial(void);
> +#else
> +static inline int early_init_dt_scan_chosen_serial(void) { return -ENOENT; }
> +#endif
> +
> #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; }
> --
> 2.1.1
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial()
[not found] ` <CAL_JsqKzWfwMRheB0qGhcHFkj9zku2uevX7GF+=U4Qhd9m3VYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2014-10-20 15:59 ` Kevin Cernekee
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Cernekee @ 2014-10-20 15:59 UTC (permalink / raw)
To: Rob Herring
Cc: Grant Likely, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
On Mon, Oct 20, 2014 at 2:22 AM, Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Sun, Oct 19, 2014 at 4:11 PM, Kevin Cernekee <cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>> The original commit that introduced this function (fb11ffe74c794a)
>> indicated that calling it from the architecture code was one possible
>> use case. Let's declare it in of_fdt.h to make it a public API.
>
> Who is the user for this?
bcm3384 on MIPS, a new target under development.
There are three objectives here:
1) Use the new DT-based earlycon code instead of the old MIPS
EARLY_PRINTK code. This lets us read the MMIO addresses straight out
of DT instead of hardcoding them.
2) Start earlycon as soon as possible, so if there are errors during
the boot sequence, the user will see some output that helps diagnose
problems. The MIPS code was ideal as it started printing output
before memory setup or command line parsing.
3) Enable earlycon by default without forcing everyone to tweak their
command lines. On this system the command line is supplied by another
OS on another CPU, and requiring "earlycon" to be added is
problematic. The original MIPS EARLY_PRINTK code could be enabled
unconditionally.
> Despite what I said, there would be issues calling this from arch
> code. Doing so would result in 2 calls to this function as the
> early_param call is not disabled.
Good point - it looks like this case will need to be covered in either
scenario (called from early_param() or called from arch code). If I
add "earlycon earlycon" to the command line, it yields a scary
warning:
bootconsole [uart0] enabled
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:2391
register_console+0x244/0x3fc()
console 'uart0' already registered
CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0+ #97
Stack : 00000000 00000004 80bb0000 80bb0000 00000000 00000000 00000000 00000000
80b94e12 00000033 00000000 00000000 00010000 80511308 804cff8c 80510f67
00000000 00000000 80b938d8 80511308 804cebd4 43f42d13 99808621 80445bd4
80510000 80032574 00000000 00000000 804d4214 804ffc84 804ffc84 804cff8c
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
...
Call Trace:
[<80019f8c>] show_stack+0x64/0x7c
[<80447a5c>] dump_stack+0xc8/0xfc
[<800327c8>] warn_slowpath_common+0x7c/0xac
[<80032858>] warn_slowpath_fmt+0x2c/0x38
[<80076244>] register_console+0x244/0x3fc
[<8053a7e4>] of_setup_earlycon+0x74/0x98
[<8053d07c>] early_init_dt_scan_chosen_serial+0x110/0x140
[<805281a0>] do_early_param+0xc4/0x13c
[<8004ecc0>] parse_args+0x284/0x444
[<805286cc>] parse_early_options+0x34/0x40
[<80528714>] parse_early_param+0x3c/0x58
[<8052b7b0>] setup_arch+0xec/0x6ac
[<805287d4>] start_kernel+0x94/0x458
---[ end trace dc8fa200cb88537f ]---
I'll send a patch to fix this.
> This could be fixed, but really we
> want an arch to implement one of the other options.
We do have a functioning ioremap when early params are parsed. But
this doesn't solve objective #3, which is what I was trying to
accomplish by calling early_init_dt_scan_chosen_serial() from the arch
code.
In lieu of my original solution, I can send a patch to add a
CONFIG_EARLYCON_FORCE option to unconditionally call
early_init_dt_scan_chosen_serial() from early_init_dt_scan(), if that
makes sense.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-20 15:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-19 8:11 [PATCH] of/fdt: Add extern prototype for early_init_dt_scan_chosen_serial() Kevin Cernekee
[not found] ` <1413706294-12578-1-git-send-email-cernekee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-20 7:26 ` Geert Uytterhoeven
2014-10-20 9:22 ` Rob Herring
[not found] ` <CAL_JsqKzWfwMRheB0qGhcHFkj9zku2uevX7GF+=U4Qhd9m3VYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-20 15:59 ` Kevin Cernekee
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).