Skip to content

Commit d5ef856

Browse files
committed
Main bcm2708 linux port
Signed-off-by: popcornmix <[email protected]>
1 parent c2eaacd commit d5ef856

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+10481
-176
lines changed

arch/arm/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,19 @@ config PLAT_SPEAR
896896
help
897897
Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx).
898898

899+
config ARCH_BCM2708
900+
bool "Broadcom BCM2708 family"
901+
select CPU_V6
902+
select ARM_AMBA
903+
select HAVE_CLK
904+
select CLKDEV_LOOKUP
905+
select GENERIC_CLOCKEVENTS
906+
select ARM_ERRATA_411920
907+
select MACH_BCM2708
908+
select VC4
909+
help
910+
This enables support for Broadcom BCM2708 boards.
911+
899912
config ARCH_VT8500
900913
bool "VIA/WonderMedia 85xx"
901914
select CPU_ARM926T
@@ -1042,6 +1055,7 @@ source "arch/arm/plat-versatile/Kconfig"
10421055
source "arch/arm/mach-vt8500/Kconfig"
10431056

10441057
source "arch/arm/mach-w90x900/Kconfig"
1058+
source "arch/arm/mach-bcm2708/Kconfig"
10451059

10461060
# Definitions to make life easier
10471061
config ARCH_ACORN

arch/arm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ machine-$(CONFIG_MACH_SPEAR310) := spear3xx
196196
machine-$(CONFIG_MACH_SPEAR320) := spear3xx
197197
machine-$(CONFIG_MACH_SPEAR600) := spear6xx
198198
machine-$(CONFIG_ARCH_ZYNQ) := zynq
199+
machine-$(CONFIG_ARCH_BCM2708) := bcm2708
199200

200201
# Platform directory name. This list is sorted alphanumerically
201202
# by CONFIG_* macro name.

arch/arm/boot/compressed/Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,17 @@ LDFLAGS_vmlinux += -X
121121
LDFLAGS_vmlinux += -T
122122

123123
# For __aeabi_uidivmod
124-
lib1funcs = $(obj)/lib1funcs.o
124+
lib1funcs = $(obj)/lib1funcs.o $(obj)/divdi3.o
125125

126126
$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S FORCE
127127
$(call cmd,shipped)
128128

129+
$(obj)/longlong.h: $(srctree)/arch/$(SRCARCH)/lib/longlong.h FORCE
130+
$(call cmd,shipped)
131+
132+
$(obj)/divdi3.c: $(srctree)/arch/$(SRCARCH)/lib/divdi3.c $(obj)/longlong.h FORCE
133+
$(call cmd,shipped)
134+
129135
# We need to prevent any GOTOFF relocs being used with references
130136
# to symbols in the .bss section since we cannot relocate them
131137
# independently from the rest at run time. This can be achieved by

arch/arm/boot/compressed/divdi3.c

Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
/* 64-bit multiplication and division
2+
Copyright (C) 1989, 1992-1999, 2000, 2001, 2002, 2003
3+
Free Software Foundation, Inc.
4+
This file is part of the GNU C Library.
5+
6+
The GNU C Library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
The GNU C Library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with the GNU C Library; if not, write to the Free
18+
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19+
02111-1307 USA. */
20+
21+
#include "longlong.h"
22+
23+
#define W_TYPE_SIZE (sizeof(long))
24+
25+
#ifdef __ARMEB__
26+
struct DWstruct { long high, low;};
27+
#else
28+
struct DWstruct { long low, high;};
29+
#endif
30+
31+
typedef union { struct DWstruct s; long long ll; } DWunion;
32+
33+
/* Prototypes of exported functions. */
34+
long long __divdi3 (long long u, long long v);
35+
long long __moddi3 (long long u, long long v);
36+
unsigned long long __udivdi3 (unsigned long long u, unsigned long long v);
37+
unsigned long long __umoddi3 (unsigned long long u, unsigned long long v);
38+
39+
static unsigned long long
40+
__udivmoddi4 (unsigned long long n, unsigned long long d, unsigned long long *rp)
41+
{
42+
DWunion ww;
43+
DWunion nn, dd;
44+
DWunion rr;
45+
unsigned long d0, d1, n0, n1, n2;
46+
unsigned long q0, q1;
47+
unsigned long b, bm;
48+
49+
nn.ll = n;
50+
dd.ll = d;
51+
52+
d0 = dd.s.low;
53+
d1 = dd.s.high;
54+
n0 = nn.s.low;
55+
n1 = nn.s.high;
56+
57+
#if !UDIV_NEEDS_NORMALIZATION
58+
if (d1 == 0)
59+
{
60+
if (d0 > n1)
61+
{
62+
/* 0q = nn / 0D */
63+
64+
udiv_qrnnd (q0, n0, n1, n0, d0);
65+
q1 = 0;
66+
67+
/* Remainder in n0. */
68+
}
69+
else
70+
{
71+
/* qq = NN / 0d */
72+
73+
if (d0 == 0)
74+
d0 = 1 / d0; /* Divide intentionally by zero. */
75+
76+
udiv_qrnnd (q1, n1, 0, n1, d0);
77+
udiv_qrnnd (q0, n0, n1, n0, d0);
78+
79+
/* Remainder in n0. */
80+
}
81+
82+
if (rp != 0)
83+
{
84+
rr.s.low = n0;
85+
rr.s.high = 0;
86+
*rp = rr.ll;
87+
}
88+
}
89+
90+
#else /* UDIV_NEEDS_NORMALIZATION */
91+
92+
if (d1 == 0)
93+
{
94+
if (d0 > n1)
95+
{
96+
/* 0q = nn / 0D */
97+
98+
count_leading_zeros (bm, d0);
99+
100+
if (bm != 0)
101+
{
102+
/* Normalize, i.e. make the most significant bit of the
103+
denominator set. */
104+
105+
d0 = d0 << bm;
106+
n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
107+
n0 = n0 << bm;
108+
}
109+
110+
udiv_qrnnd (q0, n0, n1, n0, d0);
111+
q1 = 0;
112+
113+
/* Remainder in n0 >> bm. */
114+
}
115+
else
116+
{
117+
/* qq = NN / 0d */
118+
119+
if (d0 == 0)
120+
d0 = 1 / d0; /* Divide intentionally by zero. */
121+
122+
count_leading_zeros (bm, d0);
123+
124+
if (bm == 0)
125+
{
126+
/* From (n1 >= d0) /\ (the most significant bit of d0 is set),
127+
conclude (the most significant bit of n1 is set) /\ (the
128+
leading quotient digit q1 = 1).
129+
130+
This special case is necessary, not an optimization.
131+
(Shifts counts of W_TYPE_SIZE are undefined.) */
132+
133+
n1 -= d0;
134+
q1 = 1;
135+
}
136+
else
137+
{
138+
/* Normalize. */
139+
140+
b = W_TYPE_SIZE - bm;
141+
142+
d0 = d0 << bm;
143+
n2 = n1 >> b;
144+
n1 = (n1 << bm) | (n0 >> b);
145+
n0 = n0 << bm;
146+
147+
udiv_qrnnd (q1, n1, n2, n1, d0);
148+
}
149+
150+
/* n1 != d0... */
151+
152+
udiv_qrnnd (q0, n0, n1, n0, d0);
153+
154+
/* Remainder in n0 >> bm. */
155+
}
156+
157+
if (rp != 0)
158+
{
159+
rr.s.low = n0 >> bm;
160+
rr.s.high = 0;
161+
*rp = rr.ll;
162+
}
163+
}
164+
#endif /* UDIV_NEEDS_NORMALIZATION */
165+
166+
else
167+
{
168+
if (d1 > n1)
169+
{
170+
/* 00 = nn / DD */
171+
172+
q0 = 0;
173+
q1 = 0;
174+
175+
/* Remainder in n1n0. */
176+
if (rp != 0)
177+
{
178+
rr.s.low = n0;
179+
rr.s.high = n1;
180+
*rp = rr.ll;
181+
}
182+
}
183+
else
184+
{
185+
/* 0q = NN / dd */
186+
187+
count_leading_zeros (bm, d1);
188+
if (bm == 0)
189+
{
190+
/* From (n1 >= d1) /\ (the most significant bit of d1 is set),
191+
conclude (the most significant bit of n1 is set) /\ (the
192+
quotient digit q0 = 0 or 1).
193+
194+
This special case is necessary, not an optimization. */
195+
196+
/* The condition on the next line takes advantage of that
197+
n1 >= d1 (true due to program flow). */
198+
if (n1 > d1 || n0 >= d0)
199+
{
200+
q0 = 1;
201+
sub_ddmmss (n1, n0, n1, n0, d1, d0);
202+
}
203+
else
204+
q0 = 0;
205+
206+
q1 = 0;
207+
208+
if (rp != 0)
209+
{
210+
rr.s.low = n0;
211+
rr.s.high = n1;
212+
*rp = rr.ll;
213+
}
214+
}
215+
else
216+
{
217+
unsigned long m1, m0;
218+
/* Normalize. */
219+
220+
b = W_TYPE_SIZE - bm;
221+
222+
d1 = (d1 << bm) | (d0 >> b);
223+
d0 = d0 << bm;
224+
n2 = n1 >> b;
225+
n1 = (n1 << bm) | (n0 >> b);
226+
n0 = n0 << bm;
227+
228+
udiv_qrnnd (q0, n1, n2, n1, d1);
229+
umul_ppmm (m1, m0, q0, d0);
230+
231+
if (m1 > n1 || (m1 == n1 && m0 > n0))
232+
{
233+
q0--;
234+
sub_ddmmss (m1, m0, m1, m0, d1, d0);
235+
}
236+
237+
q1 = 0;
238+
239+
/* Remainder in (n1n0 - m1m0) >> bm. */
240+
if (rp != 0)
241+
{
242+
sub_ddmmss (n1, n0, n1, n0, m1, m0);
243+
rr.s.low = (n1 << b) | (n0 >> bm);
244+
rr.s.high = n1 >> bm;
245+
*rp = rr.ll;
246+
}
247+
}
248+
}
249+
}
250+
251+
ww.s.low = q0;
252+
ww.s.high = q1;
253+
return ww.ll;
254+
}
255+
256+
long long
257+
__divdi3 (long long u, long long v)
258+
{
259+
long c = 0;
260+
long long w;
261+
262+
if (u < 0)
263+
{
264+
c = ~c;
265+
u = -u;
266+
}
267+
if (v < 0)
268+
{
269+
c = ~c;
270+
v = -v;
271+
}
272+
w = __udivmoddi4 (u, v, 0);
273+
if (c)
274+
w = -w;
275+
return w;
276+
}
277+
278+
long long
279+
__moddi3 (long long u, long long v)
280+
{
281+
long c = 0;
282+
long long w;
283+
284+
if (u < 0)
285+
{
286+
c = ~c;
287+
u = -u;
288+
}
289+
if (v < 0)
290+
v = -v;
291+
__udivmoddi4 (u, v, &w);
292+
if (c)
293+
w = -w;
294+
return w;
295+
}
296+
297+
unsigned long long
298+
__udivdi3 (unsigned long long u, unsigned long long v)
299+
{
300+
return __udivmoddi4 (u, v, 0);
301+
}
302+
303+
unsigned long long
304+
__umoddi3 (unsigned long long u, unsigned long long v)
305+
{
306+
unsigned long long w;
307+
308+
__udivmoddi4 (u, v, &w);
309+
return w;
310+
}
311+
312+
long long
313+
__gnu_ldivmod_helper (long long a,
314+
315+
long long b,
316+
long long *remainder)
317+
{
318+
long long quotient;
319+
320+
quotient = __divdi3 (a, b);
321+
*remainder = a - b * quotient;
322+
323+
return quotient;
324+
}
325+
326+
unsigned long long
327+
328+
__gnu_uldivmod_helper (unsigned long long a,
329+
330+
unsigned long long b,
331+
unsigned long long *remainder)
332+
{
333+
unsigned long long quotient;
334+
335+
quotient = __udivdi3 (a, b);
336+
*remainder = a - b * quotient;
337+
return quotient;
338+
}

0 commit comments

Comments
 (0)