Change order of module startup to force USB2 before USB1.1
[openwrt.git] / target / linux / brcm63xx / files / arch / mips / bcm963xx / info.c
1 /*
2 * $Id$
3 *
4 * Copyright (C) 2007 OpenWrt.org
5 * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
6 * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14 #include <linux/types.h>
15 #include <linux/autoconf.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/module.h>
19
20 #include <asm/bootinfo.h>
21 #include <asm/addrspace.h>
22 #include <asm/string.h>
23 #include <asm/mach-bcm963xx/bootloaders.h>
24
25 static char *boot_loader_names[BOOT_LOADER_LAST+1] = {
26 [BOOT_LOADER_UNKNOWN] = "Unknown",
27 [BOOT_LOADER_CFE] = "CFE",
28 [BOOT_LOADER_REDBOOT] = "RedBoot",
29 [BOOT_LOADER_CFE2] = "CFEv2"
30 };
31
32 /* boot loaders specific definitions */
33 #define CFE_EPTSEAL 0x43464531 /* CFE1 is the magic number to recognize CFE from other bootloaders */
34
35 int boot_loader_type;
36 /*
37 * Boot loader detection routines
38 */
39 static int __init detect_cfe(void)
40 {
41 /*
42 * This method only works, when we are booted directly from the CFE.
43 */
44 uint32_t cfe_handle = (uint32_t) fw_arg0;
45 uint32_t cfe_a1_val = (uint32_t) fw_arg1;
46 uint32_t cfe_entry = (uint32_t) fw_arg2;
47 uint32_t cfe_seal = (uint32_t) fw_arg3;
48
49 /* Check for CFE by finding the CFE magic number */
50 if (cfe_seal != CFE_EPTSEAL)
51 /* We are not booted from CFE */
52 return 0;
53
54 /* cfe_a1_val must be 0, because only one CPU present in the ADM5120 SoC */
55 if (cfe_a1_val != 0)
56 return 0;
57
58 /* The cfe_handle, and the cfe_entry must be kernel mode addresses */
59 if ((cfe_handle < KSEG0) || (cfe_entry < KSEG0))
60 return 0;
61
62 return 1;
63 }
64
65 static int __init detect_redboot(void)
66 {
67 /* On Inventel Livebox, the boot loader is passed as a command line argument, check for it */
68 if (!strncmp(arcs_cmdline, "boot_loader=RedBoot", 19))
69 return 1;
70 return 0;
71 }
72
73 void __init detect_bootloader(void)
74 {
75 if (detect_cfe()) {
76 boot_loader_type = BOOT_LOADER_CFE;
77 }
78
79 if (detect_redboot()) {
80 boot_loader_type = BOOT_LOADER_REDBOOT;
81 }
82 else {
83 /* Some devices are using CFE, but it is not detected as is */
84 boot_loader_type = BOOT_LOADER_CFE2;
85 }
86 printk("Boot loader is : %s\n", boot_loader_names[boot_loader_type]);
87 }
88
89 void __init detect_board(void)
90 {
91 switch (boot_loader_type)
92 {
93 case BOOT_LOADER_CFE:
94 break;
95 case BOOT_LOADER_REDBOOT:
96 break;
97 default:
98 break;
99 }
100 }
101
102 EXPORT_SYMBOL(boot_loader_type);
This page took 0.047253 seconds and 5 git commands to generate.