]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Drivers/PL35xSmc/InitializeSMC.S
ArmPlatformPkg/PL35xSmc: Clean SMC driver to replace hardcoded Chip Select into the...
[mirror_edk2.git] / ArmPlatformPkg / Drivers / PL35xSmc / InitializeSMC.S
CommitLineData
633724f4 1#\r
2# Copyright (c) 2011, ARM Limited. All rights reserved.\r
3# \r
4# This program and the accompanying materials \r
5# are licensed and made available under the terms and conditions of the BSD License \r
6# which accompanies this distribution. The full text of the license may be found at \r
7# http:#opensource.org/licenses/bsd-license.php \r
8#\r
9# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11#\r
12#\r
13\r
14#include <AsmMacroIoLib.h>\r
15#include <Library/PcdLib.h>\r
16#include <AutoGen.h>\r
17#include <Drivers/PL35xSmc.h>\r
18\r
19.text\r
20\r
21#Maintain 8 byte alignment\r
22.align 3\r
23\r
c52e2dca 24GCC_ASM_EXPORT(PL35xSmcInitialize)\r
633724f4 25\r
c52e2dca 26// IN r1 Smc Base Address\r
27// IN r2 Smc Configuration Start Address\r
28// IN r3 Smc Configuration End Address\r
633724f4 29// NOTE: This code is been called before any stack has been setup. It means some registers\r
30// could be overwritten (case of 'r0')\r
c52e2dca 31ASM_PFX(PL35xSmcInitialize):\r
32 // While (SmcConfigurationStart < SmcConfigurationEnd)\r
33 cmp r2, r3\r
34 blxge lr\r
633724f4 35\r
c52e2dca 36 // Write to set_cycle register(holding register for NOR 1 cycle register or NAND cycle register)\r
37 ldr r0, [r2, #0x4]\r
38 str r0, [r1, #PL350_SMC_SET_CYCLES_OFFSET]\r
633724f4 39\r
c52e2dca 40 // Write to set_opmode register(holding register for NOR 1 opomode register or NAND opmode register)\r
41 ldr r0, [r2, #0x8]\r
42 str r0, [r1, #PL350_SMC_SET_OPMODE_OFFSET]\r
633724f4 43\r
c52e2dca 44 // Write to direct_cmd register so that the NOR 1 registers(set-cycles and opmode) are updated with holding registers\r
45 ldr r0, =PL350_SMC_DIRECT_CMD_ADDR_CMD_UPDATE\r
46 ldr r4, [r2, #0x0]\r
47 orr r0, r0, r4\r
48 str r0, [r1, #PL350_SMC_DIRECT_CMD_OFFSET]\r
633724f4 49\r
c52e2dca 50 add r2, #0xC\r
51 b ASM_PFX(PL350SmcInitialize)\r
633724f4 52\r
633724f4 53ASM_FUNCTION_REMOVE_IF_UNREFERENCED