Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: sh: convert new-machine.txt to ReST

- Add a SPDX header;
- Adjust document title to follow ReST style;
- Mark literal blocks as such;
- Mark a table as such;
- Add it to sh/index.rst.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/4437d379ccf201cc3a369232f9159a02754ca530.1592203650.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
7539b417 599448d8

+106 -94
+5
Documentation/sh/index.rst
··· 4 4 5 5 :Author: Paul Mundt 6 6 7 + .. toctree:: 8 + :maxdepth: 1 9 + 10 + new-machine 11 + 7 12 Memory Management 8 13 ================= 9 14
+101 -94
Documentation/sh/new-machine.txt Documentation/sh/new-machine.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 1 2 2 - Adding a new board to LinuxSH 3 - ================================ 3 + ============================= 4 + Adding a new board to LinuxSH 5 + ============================= 4 6 5 7 Paul Mundt <lethal@linux-sh.org> 6 8 ··· 21 19 companion chip type, and CPU type. Looking at a tree view of this directory 22 20 hierarchy looks like the following: 23 21 24 - Board-specific code: 22 + Board-specific code:: 25 23 26 - . 27 - |-- arch 28 - | `-- sh 29 - | `-- boards 30 - | |-- adx 31 - | | `-- board-specific files 32 - | |-- bigsur 33 - | | `-- board-specific files 34 - | | 35 - | ... more boards here ... 36 - | 37 - `-- include 38 - `-- asm-sh 39 - |-- adx 40 - | `-- board-specific headers 41 - |-- bigsur 42 - | `-- board-specific headers 43 - | 44 - .. more boards here ... 24 + . 25 + |-- arch 26 + | `-- sh 27 + | `-- boards 28 + | |-- adx 29 + | | `-- board-specific files 30 + | |-- bigsur 31 + | | `-- board-specific files 32 + | | 33 + | ... more boards here ... 34 + | 35 + `-- include 36 + `-- asm-sh 37 + |-- adx 38 + | `-- board-specific headers 39 + |-- bigsur 40 + | `-- board-specific headers 41 + | 42 + .. more boards here ... 45 43 46 - Next, for companion chips: 47 - . 48 - `-- arch 49 - `-- sh 50 - `-- cchips 51 - `-- hd6446x 52 - `-- hd64461 53 - `-- cchip-specific files 44 + Next, for companion chips:: 45 + 46 + . 47 + `-- arch 48 + `-- sh 49 + `-- cchips 50 + `-- hd6446x 51 + `-- hd64461 52 + `-- cchip-specific files 54 53 55 54 ... and so on. Headers for the companion chips are treated the same way as 56 55 board-specific headers. Thus, include/asm-sh/hd64461 is home to all of the 57 56 hd64461-specific headers. 58 57 59 - Finally, CPU family support is also abstracted: 60 - . 61 - |-- arch 62 - | `-- sh 63 - | |-- kernel 64 - | | `-- cpu 65 - | | |-- sh2 66 - | | | `-- SH-2 generic files 67 - | | |-- sh3 68 - | | | `-- SH-3 generic files 69 - | | `-- sh4 70 - | | `-- SH-4 generic files 71 - | `-- mm 72 - | `-- This is also broken out per CPU family, so each family can 73 - | have their own set of cache/tlb functions. 74 - | 75 - `-- include 76 - `-- asm-sh 77 - |-- cpu-sh2 78 - | `-- SH-2 specific headers 79 - |-- cpu-sh3 80 - | `-- SH-3 specific headers 81 - `-- cpu-sh4 82 - `-- SH-4 specific headers 58 + Finally, CPU family support is also abstracted:: 59 + 60 + . 61 + |-- arch 62 + | `-- sh 63 + | |-- kernel 64 + | | `-- cpu 65 + | | |-- sh2 66 + | | | `-- SH-2 generic files 67 + | | |-- sh3 68 + | | | `-- SH-3 generic files 69 + | | `-- sh4 70 + | | `-- SH-4 generic files 71 + | `-- mm 72 + | `-- This is also broken out per CPU family, so each family can 73 + | have their own set of cache/tlb functions. 74 + | 75 + `-- include 76 + `-- asm-sh 77 + |-- cpu-sh2 78 + | `-- SH-2 specific headers 79 + |-- cpu-sh3 80 + | `-- SH-3 specific headers 81 + `-- cpu-sh4 82 + `-- SH-4 specific headers 83 83 84 84 It should be noted that CPU subtypes are _not_ abstracted. Thus, these still 85 85 need to be dealt with by the CPU family specific code. ··· 114 110 explain this, we use some examples for adding an imaginary board. For 115 111 setup code, we're required at the very least to provide definitions for 116 112 get_system_type() and platform_setup(). For our imaginary board, this 117 - might look something like: 113 + might look something like:: 118 114 119 - /* 120 - * arch/sh/boards/vapor/setup.c - Setup code for imaginary board 121 - */ 122 - #include <linux/init.h> 115 + /* 116 + * arch/sh/boards/vapor/setup.c - Setup code for imaginary board 117 + */ 118 + #include <linux/init.h> 123 119 124 - const char *get_system_type(void) 125 - { 126 - return "FooTech Vaporboard"; 127 - } 120 + const char *get_system_type(void) 121 + { 122 + return "FooTech Vaporboard"; 123 + } 128 124 129 - int __init platform_setup(void) 130 - { 131 - /* 132 - * If our hardware actually existed, we would do real 133 - * setup here. Though it's also sane to leave this empty 134 - * if there's no real init work that has to be done for 135 - * this board. 136 - */ 125 + int __init platform_setup(void) 126 + { 127 + /* 128 + * If our hardware actually existed, we would do real 129 + * setup here. Though it's also sane to leave this empty 130 + * if there's no real init work that has to be done for 131 + * this board. 132 + */ 137 133 138 - /* Start-up imaginary PCI ... */ 134 + /* Start-up imaginary PCI ... */ 139 135 140 - /* And whatever else ... */ 136 + /* And whatever else ... */ 141 137 142 - return 0; 143 - } 138 + return 0; 139 + } 144 140 145 141 Our new imaginary board will also have to tie into the machvec in order for it 146 142 to be of any use. ··· 176 172 vector. 177 173 178 174 Note that these prototypes are generated automatically by setting 179 - __IO_PREFIX to something sensible. A typical example would be: 175 + __IO_PREFIX to something sensible. A typical example would be:: 180 176 181 177 #define __IO_PREFIX vapor 182 - #include <asm/io_generic.h> 178 + #include <asm/io_generic.h> 183 179 184 180 somewhere in the board-specific header. Any boards being ported that still 185 181 have a legacy io.h should remove it entirely and switch to the new model. 186 182 187 183 - Add machine vector definitions to the board's setup.c. At a bare minimum, 188 - this must be defined as something like: 184 + this must be defined as something like:: 189 185 190 186 struct sh_machine_vector mv_vapor __initmv = { 191 187 .mv_name = "vapor", ··· 206 202 require the proper entry here and there in order to get things done. 207 203 208 204 The first thing to do is to add an entry to arch/sh/Kconfig, under the 209 - "System type" menu: 205 + "System type" menu:: 210 206 211 - config SH_VAPOR 212 - bool "Vapor" 213 - help 214 - select Vapor if configuring for a FooTech Vaporboard. 207 + config SH_VAPOR 208 + bool "Vapor" 209 + help 210 + select Vapor if configuring for a FooTech Vaporboard. 215 211 216 212 next, this has to be added into arch/sh/Makefile. All boards require a 217 213 machdir-y entry in order to be built. This entry needs to be the name of 218 214 the board directory as it appears in arch/sh/boards, even if it is in a 219 215 sub-directory (in which case, all parent directories below arch/sh/boards/ 220 - need to be listed). For our new board, this entry can look like: 216 + need to be listed). For our new board, this entry can look like:: 221 217 222 - machdir-$(CONFIG_SH_VAPOR) += vapor 218 + machdir-$(CONFIG_SH_VAPOR) += vapor 223 219 224 220 provided that we've placed everything in the arch/sh/boards/vapor/ directory. 225 221 ··· 234 230 list. The method for doing this is self explanatory, and so we won't waste 235 231 space restating it here. After this is done, you will be able to use 236 232 implicit checks for your board if you need this somewhere throughout the 237 - common code, such as: 233 + common code, such as:: 238 234 239 235 /* Make sure we're on the FooTech Vaporboard */ 240 236 if (!mach_is_vapor()) ··· 257 253 Looking at the 'make help' output, you should now see something like: 258 254 259 255 Architecture specific targets (sh): 260 - zImage - Compressed kernel image (arch/sh/boot/zImage) 261 - adx_defconfig - Build for adx 262 - cqreek_defconfig - Build for cqreek 263 - dreamcast_defconfig - Build for dreamcast 264 - ... 265 - vapor_defconfig - Build for vapor 266 256 267 - which then allows you to do: 257 + ======================= ============================================= 258 + zImage Compressed kernel image (arch/sh/boot/zImage) 259 + adx_defconfig Build for adx 260 + cqreek_defconfig Build for cqreek 261 + dreamcast_defconfig Build for dreamcast 262 + ... 263 + vapor_defconfig Build for vapor 264 + ======================= ============================================= 268 265 269 - $ make ARCH=sh CROSS_COMPILE=sh4-linux- vapor_defconfig vmlinux 266 + which then allows you to do:: 267 + 268 + $ make ARCH=sh CROSS_COMPILE=sh4-linux- vapor_defconfig vmlinux 270 269 271 270 which will in turn copy the defconfig for this board, run it through 272 271 oldconfig (prompting you for any new options since the time of creation),