aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-ks8695/ks8695-base-r0.patch
blob: 98477c7861e3a79d5c6fa7ec6639f3eb74aac292 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
This patch adds KS8695 CPU machine support.
It is pretty much a standard ARM922T core.

This patch inludes the cpu/machine configuration and Makefile changes,
the architecture, timer, interrupt and PCI support.


diff -Naur linux-2.6.16/arch/arm/Kconfig linux-2.6.16.ks8695/arch/arm/Kconfig
--- linux-2.6.16/arch/arm/Kconfig	2006-03-20 15:53:29.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/Kconfig	2006-03-22 09:57:18.000000000 +1000
@@ -141,6 +141,13 @@
 	help
 	  Support for Intel's IXP2400/2800 (XScale) family of processors.
 
+config ARCH_KS8695
+	bool "Kendin-Micrel KS8695"
+	help
+	  The Kendin-Micrel KS8695 "Centaur" family is an ARM920 based
+	  System-On-Chip device. It is commonly used on small routers and
+	  other small scale embedded devices.
+
 config ARCH_L7200
 	bool "LinkUp-L7200"
 	select FIQ
@@ -260,6 +267,8 @@
 
 source "arch/arm/mach-ixp2000/Kconfig"
 
+source "arch/arm/mach-ks8695/Kconfig"
+
 source "arch/arm/mach-pxa/Kconfig"
 
 source "arch/arm/mach-sa1100/Kconfig"
@@ -331,7 +340,7 @@
 	bool
 
 config PCI
-	bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB
+	bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_KS8695
 	help
 	  Find out whether you have a PCI motherboard. PCI is the name of a
 	  bus system, i.e. the way the CPU talks to the other stuff inside
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/arch.c linux-2.6.16.ks8695/arch/arm/mach-ks8695/arch.c
--- linux-2.6.16/arch/arm/mach-ks8695/arch.c	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/arch.c	2006-03-15 22:42:43.000000000 +1000
@@ -0,0 +1,124 @@
+/*
+ *  linux/arch/arm/mach-ks8695/arch.c
+ *
+ *  Copyright (C) 2002 Micrel Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <asm/memory.h>
+#include <asm/hardware.h>
+#include <asm/setup.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/arch/ks8695-regs.h>
+
+extern void ks8695_map_io(void);
+extern void ks8695_init_irq(void);
+extern struct sys_timer ks8695_timer;
+
+#ifdef CONFIG_MACH_KS8695
+MACHINE_START(KS8695, "Micrel-KS8695")
+	/* Micrel Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_DSM320
+MACHINE_START(DSM320, "DLink-DSM320")
+	/* Maintainer: Ben Dooks <ben@simtec.co.uk> */
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT) >> 18) & 0xfffc,
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_LITE300
+MACHINE_START(LITE300, "Secure Computing SG300")
+	/* Secure Computing Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_SE4200
+MACHINE_START(SE4200, "Secure Computing SE4200")
+	/* Secure Computing Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_CM4002
+MACHINE_START(CM4002, "OpenGear/CM4002")
+	/* OpenGear Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_CM4008
+MACHINE_START(CM4008, "OpenGear/CM4008")
+	/* OpenGear Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
+#ifdef CONFIG_MACH_CM41xx
+MACHINE_START(CM41xx, "OpenGear/CM41xx")
+	/* OpenGear Inc. */
+	.phys_ram	= PHYS_OFFSET,
+	.phys_io	= KS8695_IO_BASE,
+	.io_pg_offst	= ((KS8695_IO_VIRT >> 18) & 0xfffc),
+	.map_io		= ks8695_map_io,
+	.init_irq	= ks8695_init_irq,
+	.timer		= &ks8695_timer,
+	.boot_params	= 0x100,
+MACHINE_END
+#endif
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/irq.c linux-2.6.16.ks8695/arch/arm/mach-ks8695/irq.c
--- linux-2.6.16/arch/arm/mach-ks8695/irq.c	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/irq.c	2006-03-11 00:01:51.000000000 +1000
@@ -0,0 +1,71 @@
+/*
+ *  linux/arch/arm/mach-ks8695/irq.c
+ *
+ *  Copyright (C) 2002 Micrel Inc.
+ *  Copyright (C) 2006 Greg Ungerer <gerg@snapgear.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/mach/irq.h>
+
+static void ks8695_irq_mask(unsigned int irq)
+{
+	unsigned long msk;
+	msk = __raw_readl(KS8695_REG(KS8695_INT_ENABLE));
+	msk &= ~(1 << irq);
+	__raw_writel(msk, KS8695_REG(KS8695_INT_ENABLE));
+}
+
+static void ks8695_irq_unmask(unsigned int irq)
+{
+	unsigned long msk;
+	msk = __raw_readl(KS8695_REG(KS8695_INT_ENABLE));
+	msk |= (1 << irq);
+	__raw_writel(msk, KS8695_REG(KS8695_INT_ENABLE));
+}
+
+static int ks8695_irq_set_type(unsigned int irq, unsigned int type)
+{
+	return 0;
+}
+
+struct irqchip ks8695_irq_chip = {
+	.ack		= ks8695_irq_mask,
+	.mask		= ks8695_irq_mask,
+	.unmask		= ks8695_irq_unmask,
+	.set_type	= ks8695_irq_set_type,
+};
+
+void __init ks8695_init_irq(void)
+{
+	unsigned int i;
+
+	/* Disable all interrupts initially. */
+	__raw_writel(0, KS8695_REG(KS8695_INT_CONTL));
+	__raw_writel(0, KS8695_REG(KS8695_INT_ENABLE));
+
+	for (i = 0; (i < NR_IRQS); i++) {
+		set_irq_chip(i, &ks8695_irq_chip);
+		set_irq_handler(i, do_level_IRQ);
+		set_irq_flags(i, IRQF_VALID);
+	}
+}
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/Kconfig linux-2.6.16.ks8695/arch/arm/mach-ks8695/Kconfig
--- linux-2.6.16/arch/arm/mach-ks8695/Kconfig	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/Kconfig	2006-03-15 22:42:43.000000000 +1000
@@ -0,0 +1,59 @@
+
+menu "Kendin-Micrel KS8695 Implementation Options"
+
+comment "KS8695 Platforms"
+
+config MACH_KS8695
+	bool "KS8695 development board"
+	help
+	  Say 'Y' here if you want your kernel to run on the original
+	  Kendin-Micrel KS8695 development board.
+
+config MACH_DSM320
+	bool "DLink DSM320 Media Player"
+	help
+	  Say 'Y' here if you want your kernel to run on the DLink DSM320
+	  Media Player.
+
+config MACH_CM4002
+	bool "OpenGear CM4002"
+	depends on ARCH_KS8695
+	help
+	  Say 'Y' here if you want your kernel to support the OpenGear
+	  CM4002 Secure Access Server. See http://www.opengear.com for
+	  more details.
+
+config MACH_CM4008
+	bool "OpenGear CM4008"
+	depends on ARCH_KS8695
+	help
+	  Say 'Y' here if you want your kernel to support the OpenGear
+	  CM4008 Console Server. See http://www.opengear.com for more
+	  details.
+
+config MACH_CM40xx
+	bool "OpenGear CM40xx"
+	help
+	depends on ARCH_KS8695
+	  Say 'Y' here if you want your kernel to support the OpenGear
+	  CM4016 or CM4048 Console Servers. See http://www.opengear.com for
+	  more details.
+
+config MACH_LITE300
+	bool "Secure Computing / CyberGuard SG300"
+	depends on ARCH_KS8695
+	help
+	  Say 'Y' here if you want your kernel to support the Secure
+	  Computing / CyberGuard / SnapGear SG300 VPN Internet Router.
+	  See http://www.securecomputing.com for more details.
+
+config MACH_SE4200
+	bool "Secure Computing / CyberGuard SE4200"
+	depends on ARCH_KS8695
+	help
+	  Say 'Y' here if you want your kernel to support the Secure
+	  Computing / CyberGuard / SnapGear SE4200 Secure Wireless VPN
+	  Internet Router. See http://www.securecomputing.com for more
+	  details.
+
+endmenu
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/Makefile linux-2.6.16.ks8695/arch/arm/mach-ks8695/Makefile
--- linux-2.6.16/arch/arm/mach-ks8695/Makefile	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/Makefile	2006-03-15 22:42:43.000000000 +1000
@@ -0,0 +1,7 @@
+#
+# Makefile for the KS8695 machines..
+#
+
+obj-y			:= arch.o irq.o mm.o time.o
+obj-$(CONFIG_PCI)       += pci.o
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/Makefile.boot linux-2.6.16.ks8695/arch/arm/mach-ks8695/Makefile.boot
--- linux-2.6.16/arch/arm/mach-ks8695/Makefile.boot	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/Makefile.boot	2006-02-17 11:57:24.000000000 +1000
@@ -0,0 +1,3 @@
+   zreladdr-y	:= 0x00008000
+params_phys-y	:= 0x00000100
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/mm.c linux-2.6.16.ks8695/arch/arm/mach-ks8695/mm.c
--- linux-2.6.16/arch/arm/mach-ks8695/mm.c	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/mm.c	2006-03-11 00:01:51.000000000 +1000
@@ -0,0 +1,50 @@
+/*
+ *  linux/arch/arm/mach-ks8695/mm.c
+ *
+ *  Copyright (C) 1999,2000 Arm Limited
+ *  Copyright (C) 2000 Deep Blue Solutions Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <asm/io.h>
+#include <asm/page.h>
+#include <asm/sizes.h>
+#include <asm/mach/map.h>
+
+/*
+ * The only fixed mapping we setup is for the internal register block.
+ * This contains the all the device peripheral registers.
+ *
+ * Logical      Physical        Comment
+ * -----------------------------------------
+ * FF000000	03FF0000	IO registers
+ */
+static struct map_desc ks8695_io_desc[] __initdata = {
+	{
+		.virtual	= KS8695_IO_VIRT,
+		.pfn		= __phys_to_pfn(KS8695_IO_BASE),
+		.length		= SZ_64K,
+		.type		= MT_DEVICE
+	},
+};
+
+void __init ks8695_map_io(void)
+{
+	iotable_init(ks8695_io_desc, ARRAY_SIZE(ks8695_io_desc));
+}
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/pci.c linux-2.6.16.ks8695/arch/arm/mach-ks8695/pci.c
--- linux-2.6.16/arch/arm/mach-ks8695/pci.c	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/pci.c	2006-03-15 22:42:43.000000000 +1000
@@ -0,0 +1,218 @@
+/*
+ *  Copyright (c) 2003, Micrel Semiconductors
+ *  Copyright (C) 2006, Greg Ungerer <gerg@snapgear.com>
+ *
+ *  Written 2003 by LIQUN RUAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/mm.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <asm/io.h>
+#include <asm/mach/pci.h>
+#include <asm/hardware.h>
+#include <asm/arch/ks8695-regs.h>
+
+
+static u32 pcicmd(unsigned int bus, unsigned int devfn, int where)
+{
+	where &= 0xfffffffc;
+	return (0x80000000 | (bus << 16) | (devfn << 8) | where);
+}
+
+static void local_write_config(unsigned int bus, unsigned int devfn, int where, u32 value)
+{
+	__raw_writel(pcicmd(bus, devfn, where), KS8695_REG(KS8695_PBCA));
+	__raw_writel(value, KS8695_REG(KS8695_PBCD));
+}
+
+
+static int ks8695_pci_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
+{
+	u32 v;
+
+
+	__raw_writel(pcicmd(bus->number, devfn, where), KS8695_REG(KS8695_PBCA));
+	v = __raw_readl(KS8695_REG(KS8695_PBCD));
+
+	if (size == 1)
+		*value = (u8) (v >> ((where & 0x3) * 8));
+	else if (size == 2)
+		*value = (u16) (v >> ((where & 0x2) * 8));
+	else
+		*value = v;
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+static u32 bytemasks[] = {
+	0xffffff00, 0xffff00ff, 0xff0ffff, 0x00ffffff,
+};
+static u32 wordmasks[] = {
+	0xffff0000, 0x00000000, 0x0000ffff,
+};
+
+static int ks8695_pci_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
+{
+	u32 cmd, v;
+	int nr;
+
+	v = value;
+	cmd = pcicmd(bus->number, devfn, where);
+	__raw_writel(cmd, KS8695_REG(KS8695_PBCA));
+
+	if (size == 1) {
+		nr = where & 0x3;
+		v = __raw_readl(KS8695_REG(KS8695_PBCD));
+		v = (v & bytemasks[nr]) | ((value & 0xff) << (nr * 8));
+	} else if (size == 2) {
+		nr = where & 0x2;
+		v = __raw_readl(KS8695_REG(KS8695_PBCD));
+		v = (v & wordmasks[nr]) | ((value & 0xffff) << (nr * 8));
+	}
+
+	__raw_writel(v, KS8695_REG(KS8695_PBCD));
+
+	return PCIBIOS_SUCCESSFUL;
+}
+
+struct pci_ops ks8695_pci_ops = {
+	.read	= ks8695_pci_read_config,
+	.write	= ks8695_pci_write_config,
+};
+
+static struct pci_bus *ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
+{
+	return pci_scan_bus(sys->busnr, &ks8695_pci_ops, sys);
+}
+
+static struct resource pci_mem = {
+	.name	= "PCI memory space",
+	.start	= KS8695P_PCI_MEM_BASE + 0x04000000,
+	.end	= KS8695P_PCI_MEM_BASE + KS8695P_PCI_MEM_SIZE - 1,
+	.flags	= IORESOURCE_MEM,
+};
+
+static struct resource pci_io = {
+	.name	= "PCI IO space",
+	.start	= KS8695P_PCI_IO_BASE,
+	.end	= KS8695P_PCI_IO_BASE + KS8695P_PCI_IO_SIZE - 1,
+	.flags	= IORESOURCE_IO,
+};
+
+static int __init ks8695_pci_setup(int nr, struct pci_sys_data *sys)
+{
+	if (nr > 0)
+		return 0;
+
+	/* Assign and enable processor bridge */
+	local_write_config(0, 0, PCI_BASE_ADDRESS_0, KS8695P_PCI_MEM_BASE);
+	local_write_config(0, 0, PCI_COMMAND,
+		PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
+
+	request_resource(&iomem_resource, &pci_mem);
+	request_resource(&ioport_resource, &pci_io);
+
+	sys->resource[0] = &pci_io;
+	sys->resource[1] = &pci_mem;
+	sys->resource[2] = NULL;
+
+	return 1;
+}
+
+/*
+ * EXT0 is used as PCI bus interrupt source.
+ * level detection (active low)
+ */
+static void __init ks8695_pci_configure_interrupt(void)
+{
+	u32 v;
+
+	v = __raw_readl(KS8695_REG(KS8695_GPIO_MODE));
+	v |= 0x00000001;
+	__raw_writel(v, KS8695_REG(KS8695_GPIO_MODE));
+
+	v = __raw_readl(KS8695_REG(KS8695_GPIO_CTRL));
+	v &= 0xfffffff8;
+	v |= 0x8;
+	__raw_writel(v, KS8695_REG(KS8695_GPIO_CTRL));
+
+	v = __raw_readl(KS8695_REG(KS8695_GPIO_MODE));
+	v &= ~0x00000001;
+	__raw_writel(v, KS8695_REG(KS8695_GPIO_MODE));
+}
+
+static void __init ks8695_pci_preinit(void)
+{
+#if defined(CONFIG_MACH_CM4008) || defined(CONFIG_MACH_CM41xx)
+	/* Reset the PCI bus - (GPIO line is hooked up to bus reset) */
+	u32 msk;
+	msk = __raw_readl(KS8695_REG(KS8695_GPIO_MODE));
+	__raw_writel(msk | 0x2, KS8695_REG(KS8695_GPIO_MODE));
+
+	msk = __raw_readl(KS8695_REG(KS8695_GPIO_DATA));
+	__raw_writel(msk & ~0x2, KS8695_REG(KS8695_GPIO_DATA));
+	udelay(1000);
+	__raw_writel(msk | 0x2, KS8695_REG(KS8695_GPIO_DATA));
+	udelay(1000);
+#endif
+
+	/* stage 1 initialization, subid, subdevice = 0x0001 */
+	__raw_writel(0x00010001, KS8695_REG(KS8695_CRCSID));
+
+	/* stage 2 initialization */
+	/* prefetch limits with 16 words, retru enable */
+	__raw_writel(0x40000000, KS8695_REG(KS8695_PBCS));
+
+	/* configure memory mapping */
+	__raw_writel(KS8695P_PCIBG_MEM_BASE, KS8695_REG(KS8695_PMBA));
+	__raw_writel(KS8695P_PCI_MEM_MASK, KS8695_REG(KS8695_PMBAM));
+	__raw_writel(KS8695P_PCI_MEM_BASE, KS8695_REG(KS8695_PMBAT));
+
+	/* configure IO mapping */
+	__raw_writel(KS8695P_PCIBG_IO_BASE, KS8695_REG(KS8695_PIOBA));
+	__raw_writel(KS8695P_PCI_IO_MASK, KS8695_REG(KS8695_PIOBAM));
+	__raw_writel(KS8695P_PCI_IO_BASE, KS8695_REG(KS8695_PIOBAT));
+
+	ks8695_pci_configure_interrupt();
+}
+
+static int __init ks8695_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+	return 2;
+}
+
+struct hw_pci ks8695_pci __initdata = {
+	.nr_controllers	= 1,
+	.preinit	= ks8695_pci_preinit,
+	.swizzle	= pci_std_swizzle,
+	.setup		= ks8695_pci_setup,
+	.scan		= ks8695_pci_scan_bus,
+	.map_irq	= ks8695_pci_map_irq,
+};
+
+static int __init ks8695_pci_init(void)
+{
+	pci_common_init(&ks8695_pci);
+	return 0;
+}
+
+subsys_initcall(ks8695_pci_init);
+
diff -Naur linux-2.6.16/arch/arm/mach-ks8695/time.c linux-2.6.16.ks8695/arch/arm/mach-ks8695/time.c
--- linux-2.6.16/arch/arm/mach-ks8695/time.c	1970-01-01 10:00:00.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mach-ks8695/time.c	2006-03-15 22:42:43.000000000 +1000
@@ -0,0 +1,79 @@
+/*
+ *  linux/arch/arm/mach-ks8695/time.c
+ *
+ *  Copyright (C) 2002 Micrel Inc.
+ *  Copyright (C) 2006 Greg Ungerer <gerg@snapgear.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/time.h>
+#include <asm/system.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/mach/time.h>
+
+
+/*
+ * Cannout read back time on KS8695.
+ */
+static unsigned long ks8695_gettimeoffset(void)
+{
+	return 0;
+}
+
+static irqreturn_t ks8695_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	write_seqlock(&xtime_lock);
+        __raw_writel(KS8695_INTMASK_TIMERINT1, KS8695_REG(KS8695_INT_STATUS));
+	timer_tick(regs);
+	write_sequnlock(&xtime_lock);
+	return IRQ_HANDLED;
+}
+
+static struct irqaction ks8695_timer_irq = {
+	.name	 = "KS8695 Timer Tick",
+	.flags	 = SA_INTERRUPT | SA_TIMER,
+	.handler = ks8695_timer_interrupt,
+};
+
+/*
+ * Set up timer interrupt, and return the current time in seconds.
+ */
+static void __init ks8695_timer_init(void)
+{
+	unsigned long tmout = CLOCK_TICK_RATE / HZ;
+
+	/* Initialise to a known state (all timers off) */
+        __raw_writel(0, KS8695_REG(KS8695_TIMER_CTRL));
+
+	/* enable timer 1 as HZ clock */
+        __raw_writel(tmout, KS8695_REG(KS8695_TIMER1));
+        __raw_writel(tmout / 2, KS8695_REG(KS8695_TIMER1_PCOUNT));
+        __raw_writel(0x02, KS8695_REG(KS8695_TIMER_CTRL));
+
+	setup_irq(KS8695_INT_TIMERINT1, &ks8695_timer_irq);
+}
+
+struct sys_timer ks8695_timer = {
+	.init	= ks8695_timer_init,
+	.offset	= ks8695_gettimeoffset,
+};
+
diff -Naur linux-2.6.16/arch/arm/Makefile linux-2.6.16.ks8695/arch/arm/Makefile
--- linux-2.6.16/arch/arm/Makefile	2006-03-20 15:53:29.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/Makefile	2006-03-21 17:07:44.000000000 +1000
@@ -94,6 +94,7 @@
  machine-$(CONFIG_ARCH_IOP3XX)	   := iop3xx
  machine-$(CONFIG_ARCH_IXP4XX)	   := ixp4xx
  machine-$(CONFIG_ARCH_IXP2000)    := ixp2000
+ machine-$(CONFIG_ARCH_KS8695)     := ks8695
  machine-$(CONFIG_ARCH_OMAP1)	   := omap1
  machine-$(CONFIG_ARCH_OMAP2)	   := omap2
   incdir-$(CONFIG_ARCH_OMAP)	   := omap
diff -Naur linux-2.6.16/arch/arm/mm/Kconfig linux-2.6.16.ks8695/arch/arm/mm/Kconfig
--- linux-2.6.16/arch/arm/mm/Kconfig	2006-03-20 15:53:29.000000000 +1000
+++ linux-2.6.16.ks8695/arch/arm/mm/Kconfig	2006-03-21 17:07:46.000000000 +1000
@@ -83,8 +83,8 @@
 # ARM922T
 config CPU_ARM922T
 	bool "Support ARM922T processor" if ARCH_INTEGRATOR
-	depends on ARCH_LH7A40X || ARCH_INTEGRATOR
-	default y if ARCH_LH7A40X
+	depends on ARCH_LH7A40X || ARCH_INTEGRATOR || ARCH_KS8695
+	default y if ARCH_LH7A40X || ARCH_KS8695
 	select CPU_32v4
 	select CPU_ABRT_EV4T
 	select CPU_CACHE_V4WT

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php