[ramips] add patches for v3.8
[openwrt/svn-archive/archive.git] / target / linux / ramips / patches-3.8 / 0004-MIPS-ralink-adds-prom-and-cmdline-code.patch
1 From 7e47cefa69c8ed2c889522ce29fcce73ce8cf08e Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 20 Jan 2013 22:01:05 +0100
4 Subject: [PATCH 04/14] MIPS: ralink: adds prom and cmdline code
5
6 Add minimal code to handle commandlines.
7
8 Signed-off-by: John Crispin <blogic@openwrt.org>
9 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
10 Patchwork: http://patchwork.linux-mips.org/patch/4892/
11 ---
12 arch/mips/ralink/prom.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++
13 1 file changed, 69 insertions(+)
14 create mode 100644 arch/mips/ralink/prom.c
15
16 diff --git a/arch/mips/ralink/prom.c b/arch/mips/ralink/prom.c
17 new file mode 100644
18 index 0000000..9c64f02
19 --- /dev/null
20 +++ b/arch/mips/ralink/prom.c
21 @@ -0,0 +1,69 @@
22 +/*
23 + * This program is free software; you can redistribute it and/or modify it
24 + * under the terms of the GNU General Public License version 2 as published
25 + * by the Free Software Foundation.
26 + *
27 + * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
28 + * Copyright (C) 2010 Joonas Lahtinen <joonas.lahtinen@gmail.com>
29 + * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
30 + */
31 +
32 +#include <linux/string.h>
33 +#include <linux/of_fdt.h>
34 +#include <linux/of_platform.h>
35 +
36 +#include <asm/bootinfo.h>
37 +#include <asm/addrspace.h>
38 +
39 +#include "common.h"
40 +
41 +struct ralink_soc_info soc_info;
42 +
43 +const char *get_system_type(void)
44 +{
45 + return soc_info.sys_type;
46 +}
47 +
48 +static __init void prom_init_cmdline(int argc, char **argv)
49 +{
50 + int i;
51 +
52 + pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
53 + (unsigned int)fw_arg0, (unsigned int)fw_arg1,
54 + (unsigned int)fw_arg2, (unsigned int)fw_arg3);
55 +
56 + argc = fw_arg0;
57 + argv = (char **) KSEG1ADDR(fw_arg1);
58 +
59 + if (!argv) {
60 + pr_debug("argv=%p is invalid, skipping\n",
61 + argv);
62 + return;
63 + }
64 +
65 + for (i = 0; i < argc; i++) {
66 + char *p = (char *) KSEG1ADDR(argv[i]);
67 +
68 + if (CPHYSADDR(p) && *p) {
69 + pr_debug("argv[%d]: %s\n", i, p);
70 + strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
71 + strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
72 + }
73 + }
74 +}
75 +
76 +void __init prom_init(void)
77 +{
78 + int argc;
79 + char **argv;
80 +
81 + prom_soc_init(&soc_info);
82 +
83 + pr_info("SoC Type: %s\n", get_system_type());
84 +
85 + prom_init_cmdline(argc, argv);
86 +}
87 +
88 +void __init prom_free_prom_memory(void)
89 +{
90 +}
91 --
92 1.7.10.4
93