* backport 2.6.8 patches to .39 / .32.33
[openwrt/openwrt.git] / target / linux / lantiq / patches-2.6.39 / 0006-MIPS-Lantiq-Add-mips_machine-support.patch
1 From 52a5369d1067d4feddbfa7ff4486a77ac9a2971e Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 30 Mar 2011 09:27:54 +0200
4 Subject: [PATCH 06/13] MIPS: Lantiq: Add mips_machine support
5
6 This patch adds support for Gabor's mips_machine patch.
7
8 Signed-off-by: John Crispin <blogic@openwrt.org>
9 Signed-off-by: Ralph Hempel <ralph.hempel@lantiq.com>
10 Cc: Gabor Juhos <juhosg@openwrt.org>
11 Cc: linux-mips@linux-mips.org
12 Patchwork: https://patchwork.linux-mips.org/patch/2251/
13 Patchwork: https://patchwork.linux-mips.org/patch/2358/
14 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
15 ---
16 arch/mips/Kconfig | 1 +
17 arch/mips/lantiq/machtypes.h | 18 ++++++++++++++++++
18 arch/mips/lantiq/prom.h | 1 +
19 arch/mips/lantiq/setup.c | 25 +++++++++++++++++++++++++
20 arch/mips/lantiq/xway/Makefile | 4 ++--
21 arch/mips/lantiq/xway/setup-ase.c | 19 +++++++++++++++++++
22 arch/mips/lantiq/xway/setup-xway.c | 20 ++++++++++++++++++++
23 7 files changed, 86 insertions(+), 2 deletions(-)
24 create mode 100644 arch/mips/lantiq/machtypes.h
25 create mode 100644 arch/mips/lantiq/xway/setup-ase.c
26 create mode 100644 arch/mips/lantiq/xway/setup-xway.c
27
28 --- a/arch/mips/Kconfig
29 +++ b/arch/mips/Kconfig
30 @@ -190,6 +190,7 @@
31 select SWAP_IO_SPACE
32 select BOOT_RAW
33 select HAVE_CLK
34 + select MIPS_MACHINE
35
36 config LASAT
37 bool "LASAT Networks platforms"
38 --- /dev/null
39 +++ b/arch/mips/lantiq/machtypes.h
40 @@ -0,0 +1,18 @@
41 +/*
42 + * This program is free software; you can redistribute it and/or modify it
43 + * under the terms of the GNU General Public License version 2 as published
44 + * by the Free Software Foundation.
45 + *
46 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
47 + */
48 +
49 +#ifndef _LANTIQ_MACH_H__
50 +#define _LANTIQ_MACH_H__
51 +
52 +#include <asm/mips_machine.h>
53 +
54 +enum lantiq_mach_type {
55 + LTQ_MACH_GENERIC = 0,
56 +};
57 +
58 +#endif
59 --- a/arch/mips/lantiq/prom.h
60 +++ b/arch/mips/lantiq/prom.h
61 @@ -20,5 +20,6 @@
62 };
63
64 extern void ltq_soc_detect(struct ltq_soc_info *i);
65 +extern void ltq_soc_setup(void);
66
67 #endif
68 --- a/arch/mips/lantiq/setup.c
69 +++ b/arch/mips/lantiq/setup.c
70 @@ -14,6 +14,12 @@
71
72 #include <lantiq_soc.h>
73
74 +#include "machtypes.h"
75 +#include "devices.h"
76 +#include "prom.h"
77 +
78 +unsigned long physical_memsize = 0L;
79 +
80 void __init plat_mem_setup(void)
81 {
82 /* assume 16M as default incase uboot fails to pass proper ramsize */
83 @@ -32,10 +38,32 @@
84 if (!strncmp(e, "memsize=", 8)) {
85 e += 8;
86 if (strict_strtoul(e, 0, &memsize))
87 - pr_warn("bad memsize specified\n");
88 + pr_warning("bad memsize specified\n");
89 }
90 envp++;
91 }
92 memsize *= 1024 * 1024;
93 add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
94 + physical_memsize = memsize;
95 +}
96 +
97 +static int __init
98 +lantiq_setup(void)
99 +{
100 + ltq_soc_setup();
101 + mips_machine_setup();
102 + return 0;
103 }
104 +
105 +arch_initcall(lantiq_setup);
106 +
107 +static void __init
108 +lantiq_generic_init(void)
109 +{
110 + /* Nothing to do */
111 +}
112 +
113 +MIPS_MACHINE(LTQ_MACH_GENERIC,
114 + "Generic",
115 + "Generic Lantiq based board",
116 + lantiq_generic_init);
117 --- a/arch/mips/lantiq/xway/Makefile
118 +++ b/arch/mips/lantiq/xway/Makefile
119 @@ -1,4 +1,4 @@
120 obj-y := pmu.o ebu.o reset.o gpio.o devices.o
121
122 -obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o
123 -obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o
124 +obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o setup-xway.o
125 +obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o setup-ase.o
126 --- /dev/null
127 +++ b/arch/mips/lantiq/xway/setup-ase.c
128 @@ -0,0 +1,19 @@
129 +/*
130 + * This program is free software; you can redistribute it and/or modify it
131 + * under the terms of the GNU General Public License version 2 as published
132 + * by the Free Software Foundation.
133 + *
134 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
135 + */
136 +
137 +#include <lantiq_soc.h>
138 +
139 +#include "../prom.h"
140 +#include "devices.h"
141 +
142 +void __init ltq_soc_setup(void)
143 +{
144 + ltq_register_ase_asc();
145 + ltq_register_gpio();
146 + ltq_register_wdt();
147 +}
148 --- /dev/null
149 +++ b/arch/mips/lantiq/xway/setup-xway.c
150 @@ -0,0 +1,20 @@
151 +/*
152 + * This program is free software; you can redistribute it and/or modify it
153 + * under the terms of the GNU General Public License version 2 as published
154 + * by the Free Software Foundation.
155 + *
156 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
157 + */
158 +
159 +#include <lantiq_soc.h>
160 +
161 +#include "../prom.h"
162 +#include "devices.h"
163 +
164 +void __init ltq_soc_setup(void)
165 +{
166 + ltq_register_asc(0);
167 + ltq_register_asc(1);
168 + ltq_register_gpio();
169 + ltq_register_wdt();
170 +}