]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pdk_k2g_1_0_1_0_eng/packages/ti/boot/sbl/soc/k2g/sbl_slave_boot.c
Add alpha files for car
[processor-sdk/performance-audio-sr.git] / pdk_k2g_1_0_1_0_eng / packages / ti / boot / sbl / soc / k2g / sbl_slave_boot.c
1 /*
2  * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the
14  * distribution.
15  *
16  * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
34 #include <stdlib.h>
35 #include <string.h>
36 #include <ti/csl/csl_bootcfgAux.h>
37 #include <ti/csl/csl_pscAux.h>
39 /* Entry address for DSP1 applications in the memory region where trampolene is located */
40 #define DSP1_ENTRY_ADDR         (0x0C0FFC00)
42 /*
43  * DSP instructions to be copied to the Trampolene to avoid the alignment
44  * requirement.
45  */
46 uint32_t dsp1Instruction[10] =
47 {
48     0x0500002a, /* MVK.S2  destAddr, B10      */
49     0x0500006a, /* MVKH.S2 destAddr, B10      */
50     0x00280362, /* B.S2    B10                */
51     0x00006000, /* NOP     4                  */
52     0x00000000, /* NOP                        */
53     0x00000000  /* NOP                        */
54 };
56 static void SBL_DspEntryPointSet(uint32_t entryPoint, uint32_t *pDspInstr)
57 {
58     uint32_t entryVal = 0U;
59     uint32_t dspOpcode = 0U;
61     entryVal = (entryPoint & 0x0000FFFF);
62     dspOpcode = *pDspInstr;
63     /*
64     ** Mask and update the lower 16 bits of entry address within the MVK
65     ** instruction opcode.
66     */
67     *pDspInstr = (((dspOpcode) & ~(0x007FFF80)) | (( (entryVal) << 0x7) & 0x007FFF80));
69     entryVal = ((entryPoint & 0xFFFF0000) >> 16);
70     dspOpcode = *(pDspInstr + 1);
71     /*
72     ** Mask and update the upper 16 bits of entry address within the MVK
73     ** instruction opcode.
74     */
75     *(pDspInstr + 1) = (((dspOpcode) & ~(0x007FFF80)) | (( (entryVal) << 0x7) & 0x007FFF80));
76 }
78 void SBL_DSP1BringUp(uint32_t EntryPoint)
79 {
80     CSL_PSC_setModuleLocalReset(18, PSC_MDLRST_ASSERTED);
82     SBL_DspEntryPointSet(EntryPoint, dsp1Instruction);
84     memcpy((void *) DSP1_ENTRY_ADDR, (void *)dsp1Instruction,
85         sizeof(dsp1Instruction));
87     /* Set DSP boot address to trampoline for both Secure and NS mode */
88     CSL_BootCfgSetDSPBootAddress(0, (DSP1_ENTRY_ADDR >> 10));
89     CSL_FINS(hBootCfg->DSP_BOOT_ADDR0_NS, BOOTCFG_DSP_BOOT_ADDR0_NS_ISTP_RST_VAL, (DSP1_ENTRY_ADDR >> 10));
91     CSL_PSC_setModuleLocalReset(18, PSC_MDLRST_DEASSERTED);
92 }