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