nand_imx: merge send_read_page and send_prog_page
[barebox-mini2440.git] / arch / architecture.dox
blob6ef5ba928d69430383295011056da94e429c664f
1 /** @page dev_architecture Integrate a new architecture (ARCH)
3 @section linker_scripts Rules for the generic Linker Script File
5 Never include an object file by name directly! Linker Script Files defines the
6 layout, not the content. Content is defined in objecfiles instead.
8 Don't rely on the given object file order to create your binary U-Boot v2! This
9 may work, but is not relyable in all cases (and its a very bad style)!
11 For the special case some layout contraints exists, use specific section
12 naming instead. Refer @ref reset_code how to define this specific section.
14 @section reset_code Bring it up: The Reset Code
16 The way a CPU wakes up after reset is very specific to its architecture.
18 For example the ARM architecture starts its reset code at address 0x0000000,
19 the x86 architecture at 0x000FFFF0, PowerPC at 0x00000100 or 0xFFFFF100.
21 So for the special reset code on all architectures it must be located at
22 architecture specific locations within the binary U-Boot image.
24 All reset code uses section ".text_entry" for its localisation within the
25 binary U-Boot image. Its up to the linker script file to use this section name
26 to find the right place in whatever environment and U-Boot sizes.
28 @code
29         .section ".text_entry","ax"
30 @endcode
32 @section arch_files List of changes
34  - create a new subdirectory in /arch
35 TODO
39 /** @page dev_cpu Integrate a new CPU (MACH)
41 Features required for every CPU:
43  - clocksource
44  - CPU reset function
46 @section time_keeping Time keeping
48 In U-Boot-v2 we are using the clocksource mechanism from the Linux Kernel.
49 This makes it fairly easy to add timer functionality for a new board or
50 architecture.
52 Apart from initialization there is only one function to be registerd:
53 clocksource_read(). This function returns the current value of a free running
54 counter. Other functions like udelay() and get_time_ns() are derived from this
55 function. The only thing you have to implement is a clocksource driver and
56 to register it at runtime.
58 @code
59 static uint64_t mycpu_clocksource_read(void)
61         TODO
64 static struct clocksource cs = {
65         .read   = mycpu_clocksource_read,
66         .mask   = 0xffffffff,
67         .shift  = 10,
70 ....
71         init_clock(&cs);
72 ....
73 @endcode
75 See arch/arm/mach-imx/clocksource.c for an example. clocksource drivers from
76 the Linux Kernel can be used nearly 1:1, except for the register accesses.
78 Note: For clocksources the __lshrdi3 symbol is needed. You can find the
79 function for your architecture in the Linux Kernel or a libc of your choice.
81 Note: U-Boot-v2 expects an upward counting counter!
83 @section reset_function Reset function
85 TODO
87 @li @subpage dev_arm_mach
88 @li @subpage dev_bf_mach
89 @li @subpage dev_ppc_mach
93 /** @page io_access_functions I/O access functions
95 List of functions to be used for hardware register access (I/O).
97 @section native_access Native IN/OUT access
99 @note Native means: It uses the same endianess than the CPU.
101 @subsection single_native_access Single access of various width
103 The following functions are intended to be used for a single I/O access.
105 To read a byte (8 bit) from a specific I/O address:
106 @code
107 uint8_t readb(unsigned long)
108 @endcode
110 To read a word (16 bit) from a specific I/O address:
111 @code
112 uint16_t readw(unsigned long)
113 @endcode
115 To read a long word (32 bit) from a specific I/O address:
116 @code
117 uint32_t readl(unsigned long)
118 @endcode
120 To write a byte (8 bit) into a specific I/O address:
121 @code
122 void writeb(uint8_t val, unsigned long)
123 @endcode
125 To write a word (16 bit) into a specific I/O address:
126 @code
127 void writew(uint16_t val, unsigned long)
128 @endcode
130 To write a long word (32 bit) into a specific I/O address:
131 @code
132 void writel(uint32_t val, unsigned long)
133 @endcode
135 @subsection string_native_access String native access of various width
137 The following functions are intended to be used for string based I/O access.
139 To read a string of bytes (8 bit) from one specific I/O address:
140 @code
141 void readsb(const void __iomem *addr, void *mem_buffer, int byte_count);
142 @endcode
144 To read a string of words (16 bit) from one specific I/O address:
145 @code
146 void readsw(const void __iomem *addr, void *mem_buffer, int word_count);
147 @endcode
149 To read a string of long words (32 bit) from one specific I/O address:
150 @code
151 void readsl(const void __iomem *addr, void *mem_buffer, int long_count);
152 @endcode
154 To write a string of bytes (8 bit) to one specific I/O address:
155 @code
156 void writesb(void __iomem *addr, const void *mem_buffer, int byte_count);
157 @endcode
159 To write a string of words (16 bit) to one specific I/O address:
160 @code
161 void writesw(void __iomem *addr, const void *mem_buffer, int word_count);
162 @endcode
164 To write a string of long words (32 bit) to one specific I/O address:
165 @code
166 void writesl(void __iomem *addr, const void *mem_buffer, int long_count);
167 @endcode
169 @section special_access Special IN/OUT access