aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/mips
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /Documentation/mips
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'Documentation/mips')
-rw-r--r--Documentation/mips/GT64120.README65
-rw-r--r--Documentation/mips/pci/pci.README54
-rw-r--r--Documentation/mips/time.README198
3 files changed, 317 insertions, 0 deletions
diff --git a/Documentation/mips/GT64120.README b/Documentation/mips/GT64120.README
new file mode 100644
index 000000000000..2d0eec91dc59
--- /dev/null
+++ b/Documentation/mips/GT64120.README
@@ -0,0 +1,65 @@
1README for arch/mips/gt64120 directory and subdirectories
2
3Jun Sun, jsun@mvista.com or jsun@junsun.net
401/27, 2001
5
6MOTIVATION
7----------
8
9Many MIPS boards share the same system controller (or CPU companian chip),
10such as GT-64120. It is highly desirable to let these boards share
11the same controller code instead of duplicating them.
12
13This directory is meant to hold all MIPS boards that use GT-64120 or GT-64120A.
14
15
16HOW TO ADD A BOARD
17------------------
18
19. Create a subdirectory include/asm/gt64120/<board>.
20
21. Create a file called gt64120_dep.h under that directory.
22
23. Modify include/asm/gt64120/gt64120.h file to include the new gt64120_dep.h
24 based on config options. The board-dep section is at the end of
25 include/asm/gt64120/gt64120.h file. There you can find all required
26 definitions include/asm/gt64120/<board>/gt64120_dep.h file must supply.
27
28. Create a subdirectory arch/mips/gt64120/<board> directory to hold
29 board specific routines.
30
31. The GT-64120 common code is supplied under arch/mips/gt64120/common directory.
32 It includes:
33 1) arch/mips/gt64120/pci.c -
34 common PCI routine, include the top-level pcibios_init()
35 2) arch/mips/gt64120/irq.c -
36 common IRQ routine, include the top-level do_IRQ()
37 [This part really belongs to arch/mips/kernel. jsun]
38 3) arch/mips/gt64120/gt_irq.c -
39 common IRQ routines for GT-64120 chip. Currently it only handles
40 the timer interrupt.
41
42. Board-specific routines are supplied under arch/mips/gt64120/<board> dir.
43 1) arch/mips/gt64120/<board>/pci.c - it provides bus fixup routine
44 2) arch/mips/gt64120/<board>/irq.c - it provides enable/disable irqs
45 and board irq setup routine (irq_setup)
46 3) arch/mips/gt64120/<board>/int-handler.S -
47 The first-level interrupt dispatching routine.
48 4) a bunch of other "normal" stuff (setup, prom, dbg_io, reset, etc)
49
50. Follow other "normal" procedure to modify configuration files, etc.
51
52
53TO-DO LIST
54----------
55
56. Expand arch/mips/gt64120/gt_irq.c to handle all GT-64120 interrupts.
57 We probably need to introduce GT_IRQ_BASE in board-dep header file,
58 which is used the starting irq_nr for all GT irqs.
59
60 A function, gt64120_handle_irq(), will be added so that the first-level
61 irq dispatcher will call this function if it detects an interrupt
62 from GT-64120.
63
64. More support for GT-64120 PCI features (2nd PCI bus, perhaps)
65
diff --git a/Documentation/mips/pci/pci.README b/Documentation/mips/pci/pci.README
new file mode 100644
index 000000000000..8697ee41372d
--- /dev/null
+++ b/Documentation/mips/pci/pci.README
@@ -0,0 +1,54 @@
1
2Pete Popov, ppopov@pacbell.net
307/11/2001
4
5This README briefly explains how to use the pci and pci_auto
6code in arch/mips/kernel. The code was ported from PowerPC and
7modified slightly. It has been tested pretty well on PPC on some
8rather complex systems with multiple bridges and devices behind
9each bridge. However, at the time this README was written, the
10mips port was tested only on boards with a single pci bus and
11no P2P bridges. It's very possible that on boards with P2P
12bridges some modifications have to be made. The code will
13evolve, no doubt, but currently every single mips board
14is doing its own pcibios thing and it has become a big
15mess. This generic pci code is meant to clean up the mips
16pci mess and make it easier to add pci support to new boards.
17
18inside the define for your board in arch/mips/config.in.
19For example, the Galileo EV96100 board looks like this:
20
21if [ "$CONFIG_MIPS_EV96100" = "y" ]; then
22 define_bool CONFIG_PCI y
23 define_bool CONFIG_MIPS_GT96100 y
24 define_bool CONFIG_NEW_PCI y
25 define_bool CONFIG_SWAP_IO_SPACE y
26fi
27
28
29Next, if you want to use the arch/mips/kernel/pci code, which has the
30pcibios_init() function, add
31
32define_bool CONFIG_NEW_PCI y
33
34inside the define for your board. Again, the EV96100 example above
35show NEW_PCI turned on.
36
37
38Now you need to add your files to hook in your pci configuration
39cycles. Usually you'll need only a couple of files named something
40like pci_fixups.c and pci_ops.c. You can copy the templates
41provided and fill in the code.
42
43The file pci_ops.c should contain the pci configuration cycles routines.
44It also has the mips_pci_channels[] array which contains the descriptors
45of each pci controller.
46
47The file pci_fixups.c contains a few routines to do interrupt fixups,
48resources fixups, and, if needed, pci bios fixups.
49
50Usually you'll put your pci_fixups.c file in your board specific directory,
51since the functions in that file are board specific. The functions in
52pci_ops.c, on the other hand, are usually pci controller specific so that
53file could be shared among a few different boards using the same
54pci controller.
diff --git a/Documentation/mips/time.README b/Documentation/mips/time.README
new file mode 100644
index 000000000000..70bc0dd43d6d
--- /dev/null
+++ b/Documentation/mips/time.README
@@ -0,0 +1,198 @@
1README for MIPS time services
2
3Jun Sun
4jsun@mvista.com or jsun@junsun.net
5
6
7ABOUT
8-----
9This file describes the new arch/mips/kernel/time.c, related files and the
10services they provide.
11
12If you are short in patience and just want to know how to use time.c for a
13new board or convert an existing board, go to the last section.
14
15
16FILES, COMPATABILITY AND CONFIGS
17---------------------------------
18
19The old arch/mips/kernel/time.c is renamed to old-time.c.
20
21A new time.c is put there, together with include/asm-mips/time.h.
22
23Two configs variables are introduced, CONFIG_OLD_TIME_C and CONFIG_NEW_TIME_C.
24So we allow boards using
25
26 1) old time.c (CONFIG_OLD_TIME_C)
27 2) new time.c (CONFIG_NEW_TIME_C)
28 3) neither (their own private time.c)
29
30However, it is expected every board will move to the new time.c in the near
31future.
32
33
34WHAT THE NEW CODE PROVIDES?
35---------------------------
36
37The new time code provide the following services:
38
39 a) Implements functions required by Linux common code:
40 time_init
41 do_gettimeofday
42 do_settimeofday
43
44 b) provides an abstraction of RTC and null RTC implementation as default.
45 extern unsigned long (*rtc_get_time)(void);
46 extern int (*rtc_set_time)(unsigned long);
47
48 c) a set of gettimeoffset functions for different CPUs and different
49 needs.
50
51 d) high-level and low-level timer interrupt routines where the timer
52 interrupt source may or may not be the CPU timer. The high-level
53 routine is dispatched through do_IRQ() while the low-level is
54 dispatched in assemably code (usually int-handler.S)
55
56
57WHAT THE NEW CODE REQUIRES?
58---------------------------
59
60For the new code to work properly, each board implementation needs to supply
61the following functions or values:
62
63 a) board_time_init - a function pointer. Invoked at the beginnig of
64 time_init(). It is optional.
65 1. (optional) set up RTC routines
66 2. (optional) calibrate and set the mips_counter_frequency
67
68 b) board_timer_setup - a function pointer. Invoked at the end of time_init()
69 1. (optional) over-ride any decisions made in time_init()
70 2. set up the irqaction for timer interrupt.
71 3. enable the timer interrupt
72
73 c) (optional) board-specific RTC routines.
74
75 d) (optional) mips_counter_frequency - It must be definied if the board
76 is using CPU counter for timer interrupt or it is using fixed rate
77 gettimeoffset().
78
79
80PORTING GUIDE
81-------------
82
83Step 1: decide how you like to implement the time services.
84
85 a) does this board have a RTC? If yes, implement the two RTC funcs.
86
87 b) does the CPU have counter/compare registers?
88
89 If the answer is no, you need a timer to provide the timer interrupt
90 at 100 HZ speed.
91
92 You cannot use the fast gettimeoffset functions, i.e.,
93
94 unsigned long fixed_rate_gettimeoffset(void);
95 unsigned long calibrate_div32_gettimeoffset(void);
96 unsigned long calibrate_div64_gettimeoffset(void);
97
98 You can use null_gettimeoffset() will gives the same time resolution as
99 jiffy. Or you can implement your own gettimeoffset (probably based on
100 some ad hoc hardware on your machine.)
101
102 c) The following sub steps assume your CPU has counter register.
103 Do you plan to use the CPU counter register as the timer interrupt
104 or use an exnternal timer?
105
106 In order to use CPU counter register as the timer interrupt source, you
107 must know the counter speed (mips_counter_frequency). It is usually the
108 same as the CPU speed or an integral divisor of it.
109
110 d) decide on whether you want to use high-level or low-level timer
111 interrupt routines. The low-level one is presumably faster, but should
112 not make too mcuh difference.
113
114
115Step 2: the machine setup() function
116
117 If you supply board_time_init(), set the function poointer.
118
119 Set the function pointer board_timer_setup() (mandatory)
120
121
122Step 3: implement rtc routines, board_time_init() and board_timer_setup()
123 if needed.
124
125 board_time_init() -
126 a) (optional) set up RTC routines,
127 b) (optional) calibrate and set the mips_counter_frequency
128 (only needed if you intended to use fixed_rate_gettimeoffset
129 or use cpu counter as timer interrupt source)
130
131 board_timer_setup() -
132 a) (optional) over-write any choices made above by time_init().
133 b) machine specific code should setup the timer irqaction.
134 c) enable the timer interrupt
135
136
137 If the RTC chip is a common chip, I suggest the routines are put under
138 arch/mips/libs. For example, for DS1386 chip, one would create
139 rtc-ds1386.c under arch/mips/lib directory. Add the following line to
140 the arch/mips/lib/Makefile:
141
142 obj-$(CONFIG_DDB5476) += rtc-ds1386.o
143
144Step 4: if you are using low-level timer interrupt, change your interrupt
145 dispathcing code to check for timer interrupt and jump to
146 ll_timer_interrupt() directly if one is detected.
147
148Step 5: Modify arch/mips/config.in and add CONFIG_NEW_TIME_C to your machine.
149 Modify the appropriate defconfig if applicable.
150
151Final notes:
152
153For some tricky cases, you may need to add your own wrapper functions
154for some of the functions in time.c.
155
156For example, you may define your own timer interrupt routine, which does
157some of its own processing and then calls timer_interrupt().
158
159You can also over-ride any of the built-in functions (gettimeoffset,
160RTC routines and/or timer interrupt routine).
161
162
163PORTING NOTES FOR SMP
164----------------------
165
166If you have a SMP box, things are slightly more complicated.
167
168The time service running every jiffy is logically divided into two parts:
169
170 1) the one for the whole system (defined in timer_interrupt())
171 2) the one that should run for each CPU (defined in local_timer_interrupt())
172
173You need to decide on your timer interrupt sources.
174
175 case 1) - whole system has only one timer interrupt delivered to one CPU
176
177 In this case, you set up timer interrupt as in UP systems. In addtion,
178 you need to set emulate_local_timer_interrupt to 1 so that other
179 CPUs get to call local_timer_interrupt().
180
181 THIS IS CURRENTLY NOT IMPLEMNETED. However, it is rather easy to write
182 one should such a need arise. You simply make a IPI call.
183
184 case 2) - each CPU has a separate timer interrupt
185
186 In this case, you need to set up IRQ such that each of them will
187 call local_timer_interrupt(). In addition, you need to arrange
188 one and only one of them to call timer_interrupt().
189
190 You can also do the low-level version of those interrupt routines,
191 following similar dispatching routes described above.
192
193Note about do_gettimeoffset():
194
195 It is very likely the CPU counter registers are not sync'ed up in a SMP box.
196 Therefore you cannot really use the many of the existing routines that
197 are based on CPU counter. You should wirte your own gettimeoffset rouinte
198 if you want intra-jiffy resolution.