blob: f9a39a0546bb099cfcea2bb89662816ae7c98dab [file] [log] [blame]
Grzegorz Jaszczyk2ed16f52018-06-29 18:00:33 +02001.. _porting:
2
Konstantin Porotchkinaf3d5292018-02-26 16:32:35 +02003TF-A Porting Guide
4=================
5
6This section describes how to port TF-A to a customer board, assuming that the SoC being used is already supported
7in TF-A.
8
9
10Source Code Structure
11---------------------
12- The customer platform specific code shall reside under "plat/marvell/<soc family>/<soc>_cust"
13 (e.g. 'plat/marvell/a8k/a7040_cust').
14- The platform name for build purposes is called "<soc>_cust" (e.g. a7040_cust).
15- The build system will reuse all files from within the soc directory, and take only the porting
16 files from the customer platform directory.
17
18Files that require porting are located at "plat/marvell/<soc family>/<soc>_cust" directory.
19
20
21Armada-70x0/Armada-80x0 Porting
22-------------------------------
23
24 - SoC Physical Address Map (marvell_plat_config.c):
25 - This file describes the SoC physical memory mapping to be used for the CCU, IOWIN, AXI-MBUS and IOB
26 address decode units (Refer to the functional spec for more details).
27 - In most cases, using the default address decode windows should work OK.
28 - In cases where a special physical address map is needed (e.g. Special size for PCIe MEM windows,
29 large memory mapped SPI flash...), then porting of the SoC memory map is required.
30 - Note: For a detailed information on how CCU, IOWIN, AXI-MBUS & IOB work, please refer to the SoC functional spec,
31 and under "docs/marvell/misc/mvebu-[ccu/iob/amb/io-win].txt" files.
32
33 - boot loader recovery (marvell_plat_config.c):
34 - Background:
35 boot rom can skip the current image and choose to boot from next position if a specific value
36 (0xDEADB002) is returned by the ble main function. This feature is used for boot loader recovery
37 by booting from a valid flash-image saved in next position on flash (e.g. address 2M in SPI flash).
38
39 Supported options to implement the skip request are:
40 - GPIO
41 - I2C
42 - User defined
43
44 - Porting:
45 Under marvell_plat_config.c, implement struct skip_image that includes specific board parameters.
46 .. warning:: to disable this feature make sure the struct skip_image is not implemented.
47
48 - Example:
49 In A7040-DB specific implementation (plat/marvell/a8k/a70x0/board/marvell_plat_config.c),
50 the image skip is implemented using GPIO: mpp 33 (SW5).
51
52 Before resetting the board make sure there is a valid image on the next flash address:
53 -tftp [valid address] flash-image.bin
54 -sf update [valid address] 0x2000000 [size]
55
56 Press reset and keep pressing the button connected to the chosen GPIO pin. A skip image request
57 message is printed on the screen and boot rom boots from the saved image at the next position.
58
59 - DDR Porting (dram_port.c):
60 - This file defines the dram topology and parameters of the target board.
61 - The DDR code is part of the BLE component, which is an extension of ARM Trusted Firmware (TF-A).
62 - The DDR driver called mv_ddr is released separately apart from TF-A sources.
63 - The BLE and consequently, the DDR init code is executed at the early stage of the boot process.
64 - Each supported platform of the TF-A has its own DDR porting file called dram_port.c located at
65 ``atf/plat/marvell/a8k/<platform>/board`` directory.
66 - Please refer to '<path_to_mv_ddr_sources>/doc/porting_guide.txt' for detailed porting description.
67 - The build target directory is "build/<platform>/release/ble".
68
Grzegorz Jaszczyk2ed16f52018-06-29 18:00:33 +020069 - Comphy Porting (phy-porting-layer.h or phy-default-porting-layer.h)
70 - Background:
71 Some of the comphy's parameters value depend on the HW connection between the SoC and the PHY. Every
72 board type has specific HW characteristics like wire length. Due to those differences some comphy
73 parameters vary between board types. Therefore each board type can have its own list of values for
74 all relevant comphy parameters. The PHY porting layer specifies which parameters need to be suited and
75 the board designer should provide relevant values.
76
77 .. seealso::
78 For XFI/SFI comphy type there is procedure "rx_training" which eases process of suiting some of
79 the parameters. Please see :ref:`uboot_cmd` section: rx_training.
80
81 The PHY porting layer simplifies updating static values per board type, which are now grouped in one place.
82
83 .. note::
84 The parameters for the same type of comphy may vary even for the same board type, it is because
85 the lanes from comphy-x to some PHY may have different HW characteristic than lanes from
86 comphy-y to the same (multiplexed) or other PHY.
87
88 - Porting:
89 The porting layer for PHY was introduced in TF-A. There is one file
90 ``drivers/marvell/comphy/phy-default-porting-layer.h`` which contains the defaults. Those default
91 parameters are used only if there is no appropriate phy-porting-layer.h file under:
92 ``plat/marvell/<soc family>/<platform>/board/phy-porting-layer.h``. If the phy-porting-layer.h exists,
93 the phy-default-porting-layer.h is not going to be included.
94
95 .. warning::
96 Not all comphy types are already reworked to support the PHY porting layer, currently the porting
97 layer is supported for XFI/SFI and SATA comphy types.
98
99 The easiest way to prepare the PHY porting layer for custom board is to copy existing example to a new
100 platform:
101
102 - cp ``plat/marvell/a8k/a80x0/board/phy-porting-layer.h`` "plat/marvell/<soc family>/<platform>/board/phy-porting-layer.h"
103 - adjust relevant parameters or
104 - if different comphy index is used for specific feature, move it to proper table entry and then adjust.
105
106 .. note::
107 The final table size with comphy parameters can be different, depending on the CP module count for
108 given SoC type.
109
110 - Example:
111 Example porting layer for armada-8040-db is under: ``plat/marvell/a8k/a80x0/board/phy-porting-layer.h``
112
113 .. note::
114 If there is no PHY porting layer for new platform (missing phy-porting-layer.h), the default
115 values are used (drivers/marvell/comphy/phy-default-porting-layer.h) and the user is warned:
116
117 .. warning::
118 "Using default comphy parameters - it may be required to suit them for your board".