]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.arch/ppc-efika-psc-console-autodetection.patch
Disable build of xen kernel.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.arch / ppc-efika-psc-console-autodetection.patch
1 Subject: [PATCH] autodetect serial console on efika
2 From: Olaf Hering <olh@suse.de>
3
4 Efika boards have to be booted with console=ttyPSC0 unless there is a
5 graphics card plugged in. Detect if the firmware stdout is the serial
6 connector.
7
8 ---
9 arch/powerpc/platforms/52xx/efika.c | 50 ++++++++++++++++++++++++++++++++++++
10 1 file changed, 50 insertions(+)
11
12 --- a/arch/powerpc/platforms/52xx/efika.c
13 +++ b/arch/powerpc/platforms/52xx/efika.c
14 @@ -13,6 +13,7 @@
15 #include <linux/utsrelease.h>
16 #include <linux/pci.h>
17 #include <linux/of.h>
18 +#include <linux/console.h>
19 #include <asm/prom.h>
20 #include <asm/time.h>
21 #include <asm/machdep.h>
22 @@ -211,12 +212,61 @@ static int __init efika_probe(void)
23 return 1;
24 }
25
26 +/*
27 + * Per default, input/output-device points to the keyboard/screen
28 + * If no card is installed, the built-in serial port is used as a fallback.
29 + * But unfortunately, the firmware does not connect /chosen/{stdin,stdout}
30 + * the the built-in serial node. Instead, a /failsafe node is created.
31 + * More advanced hardware configurations cant be detected,
32 + * boot with console=xyz123 to point the kernel to the correct device
33 + */
34 +static void __init efika_init_early(void)
35 +{
36 +#ifdef CONFIG_SERIAL_MPC52xx
37 + struct device_node *stdout_node;
38 + const char *property;
39 +
40 + if (strstr(cmd_line, "console="))
41 + return;
42 + /* find the boot console from /chosen/stdout */
43 + if (!of_chosen)
44 + return;
45 + property = of_get_property(of_chosen, "linux,stdout-path", NULL);
46 + if (!property)
47 + return;
48 + stdout_node = of_find_node_by_path(property);
49 + if (!stdout_node)
50 + return;
51 + property = of_get_property(stdout_node, "device_type", NULL);
52 + if (property && strcmp(property, "serial") == 0) {
53 + /*
54 + * The 9pin connector is either /failsafe or /builtin/serial.
55 + * The optional graphics card has also type 'serial' in VGA mode.
56 + */
57 + property = of_get_property(stdout_node, "name", NULL);
58 + if (property) {
59 + if (strcmp(property, "failsafe") == 0)
60 + add_preferred_console("ttyPSC", 0, NULL);
61 + else {
62 + if (strcmp(property, "serial") == 0) {
63 + property = of_get_property(stdout_node, "model", NULL);
64 + if (property && strcmp(property, "mpc5200-serial") == 0)
65 + add_preferred_console("ttyPSC", 0, NULL);
66 + }
67 + }
68 + }
69 + }
70 + of_node_put(stdout_node);
71 +#endif
72 +}
73 +
74 define_machine(efika)
75 {
76 .name = EFIKA_PLATFORM_NAME,
77 .probe = efika_probe,
78 .setup_arch = efika_setup_arch,
79 .init = mpc52xx_declare_of_platform_devices,
80 + .init_early = efika_init_early,
81 .show_cpuinfo = efika_show_cpuinfo,
82 .init_IRQ = mpc52xx_init_irq,
83 .get_irq = mpc52xx_get_irq,