1 /*
2 * Copyright (C) 2017 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 <stdbool.h>
38 #include <ti/csl/tistdtypes.h>
39 #include <ti/csl/csl.h>
40 #include <ti/csl/cslr_psc.h>
41 #include <ti/csl/csl_psc.h>
42 #include <ti/csl/csl_pscAux.h>
43 #include <ti/csl/csl_syscfgAux.h>
45 #include "sbl_slave_core_boot.h"
47 int32_t SBL_ImageCopy(sblEntryPoint_t *pEntry)
48 {
49 int32_t retval = 0;
51 #if defined(BOOT_MMCSD)
52 /* MMCSD Boot Mode Image Copy function. */
53 if (SBL_MMCBootImage(pEntry) != 0)
54 {
55 retval = -1;
56 }
57 #endif
59 return retval;
60 }
62 void SBL_DSPBringUp(uint8_t core, uint32_t entry)
63 {
64 volatile uint32_t dspState;
65 /* Add DSP init code */
66 Board_unlockMMR();
67 hSysCfg->HOST1CFG = entry;
69 /* Set NEXT state to ENABLE */
70 CSL_PSC_setModuleNextState(CSL_PSC_DSP, PSC_MODSTATE_ENABLE);
71 /* Set GO bit to initiate state transition */
72 CSL_PSC_startStateTransition(1);
73 /* Wait for power state transition to finish */
74 while (!CSL_PSC_isStateTransitionDone(1));
75 /* Wait for state transition */
76 while (CSL_PSC_getModuleState(CSL_PSC_DSP) != PSC_MODSTATE_ENABLE);
77 /* Trigger DSP local reset */
78 CSL_FINS (hPscRegs0->MDCTL[CSL_PSC_DSP], PSC_MDCTL_LRST, 1);
79 }