source: rtems/bsps/powerpc/mpc55xxevb/start/start-cache.S

Last change on this file was bcef89f2, checked in by Sebastian Huber <sebastian.huber@…>, on 05/19/23 at 06:18:25

Update company name

The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup mpc55xx_asm
7 *
8 * @brief Cache initialization.
9 */
10
11/*
12 * Copyright (C) 2008, 2012 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 *    notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 *    notice, this list of conditions and the following disclaimer in the
21 *    documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#include <libcpu/powerpc-utility.h>
37
38#include <mpc55xx/regs.h>
39
40        .globl  mpc55xx_start_cache
41
42        .section        ".bsp_start_text", "ax"
43
44mpc55xx_start_cache:
45
46#ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT
47
48        /* Load zero, CINV, and CABT) */
49        li      r0, 0
50        li      r3, 0x2
51        li      r4, 0x4
52
53#if defined(BSP_INSTRUCTION_CACHE_ENABLED) \
54  && defined(MPC55XX_HAS_INSTRUCTION_CACHE)
55
56start_instruction_cache_invalidation:
57
58        /* Clear instruction cache invalidation abort */
59        mtspr   FSL_EIS_L1CSR1, r0
60
61        /* Start instruction cache invalidation */
62        mtspr   FSL_EIS_L1CSR1, r3
63
64get_instruction_cache_invalidation_status:
65
66        /* Get instruction cache invalidation status */
67        mfspr   r5, FSL_EIS_L1CSR1
68
69        /* Check CABT */
70        and.    r6, r5, r4
71        bne     start_instruction_cache_invalidation
72
73        /* Check CINV */
74        and.    r6, r5, r3
75        bne     get_instruction_cache_invalidation_status
76
77        /* Save instruction cache settings */
78        LWI     r6, 0x00010001
79        isync
80        msync
81        mtspr   FSL_EIS_L1CSR1, r6
82
83#endif
84
85#if (defined(BSP_DATA_CACHE_ENABLED) && defined(MPC55XX_HAS_DATA_CACHE)) \
86  || ((defined(BSP_DATA_CACHE_ENABLED) \
87    || defined(BSP_INSTRUCTION_CACHE_ENABLED)) \
88      && defined(MPC55XX_HAS_UNIFIED_CACHE))
89
90start_data_cache_invalidation:
91
92        /* Clear data cache invalidation abort */
93        mtspr   FSL_EIS_L1CSR0, r0
94
95        /* Start data cache invalidation */
96        mtspr   FSL_EIS_L1CSR0, r3
97
98get_data_cache_invalidation_status:
99
100        /* Get data cache invalidation status */
101        mfspr   r5, FSL_EIS_L1CSR0
102
103        /* Check CABT */
104        and.    r6, r5, r4
105        bne     start_data_cache_invalidation
106
107        /* Check CINV */
108        and.    r6, r5, r3
109        bne     get_data_cache_invalidation_status
110
111        /* Save data cache settings */
112#if MPC55XX_CHIP_FAMILY != 567
113        /* FIXME: CORG??? 0x00180011 */
114        LWI     r6, 0x00100001
115#else
116        LWI     r6, 0x00190001
117#endif
118        isync
119        msync
120        mtspr   FSL_EIS_L1CSR0, r6
121
122#endif
123
124#endif /* MPC55XX_NEEDS_LOW_LEVEL_INIT */
125
126        /* Return */
127        blr
Note: See TracBrowser for help on using the repository browser.