1*6fba6e04STony Xie /* 2*6fba6e04STony Xie * Copyright (c) 2014-2016, ARM Limited and Contributors. All rights reserved. 3*6fba6e04STony Xie * 4*6fba6e04STony Xie * Redistribution and use in source and binary forms, with or without 5*6fba6e04STony Xie * modification, are permitted provided that the following conditions are met: 6*6fba6e04STony Xie * 7*6fba6e04STony Xie * Redistributions of source code must retain the above copyright notice, this 8*6fba6e04STony Xie * list of conditions and the following disclaimer. 9*6fba6e04STony Xie * 10*6fba6e04STony Xie * Redistributions in binary form must reproduce the above copyright notice, 11*6fba6e04STony Xie * this list of conditions and the following disclaimer in the documentation 12*6fba6e04STony Xie * and/or other materials provided with the distribution. 13*6fba6e04STony Xie * 14*6fba6e04STony Xie * Neither the name of ARM nor the names of its contributors may be used 15*6fba6e04STony Xie * to endorse or promote products derived from this software without specific 16*6fba6e04STony Xie * prior written permission. 17*6fba6e04STony Xie * 18*6fba6e04STony Xie * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*6fba6e04STony Xie * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*6fba6e04STony Xie * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*6fba6e04STony Xie * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*6fba6e04STony Xie * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*6fba6e04STony Xie * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*6fba6e04STony Xie * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*6fba6e04STony Xie * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*6fba6e04STony Xie * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*6fba6e04STony Xie * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*6fba6e04STony Xie * POSSIBILITY OF SUCH DAMAGE. 29*6fba6e04STony Xie */ 30*6fba6e04STony Xie 31*6fba6e04STony Xie #ifndef __PLAT_PRIVATE_H__ 32*6fba6e04STony Xie #define __PLAT_PRIVATE_H__ 33*6fba6e04STony Xie 34*6fba6e04STony Xie #ifndef __ASSEMBLY__ 35*6fba6e04STony Xie #include <mmio.h> 36*6fba6e04STony Xie #include <stdint.h> 37*6fba6e04STony Xie #include <xlat_tables.h> 38*6fba6e04STony Xie 39*6fba6e04STony Xie /****************************************************************************** 40*6fba6e04STony Xie * For rockchip socs pm ops 41*6fba6e04STony Xie ******************************************************************************/ 42*6fba6e04STony Xie struct rockchip_pm_ops_cb { 43*6fba6e04STony Xie int (*cores_pwr_dm_on)(unsigned long mpidr, uint64_t entrypoint); 44*6fba6e04STony Xie int (*cores_pwr_dm_off)(void); 45*6fba6e04STony Xie int (*cores_pwr_dm_on_finish)(void); 46*6fba6e04STony Xie int (*cores_pwr_dm_suspend)(void); 47*6fba6e04STony Xie int (*cores_pwr_dm_resume)(void); 48*6fba6e04STony Xie int (*sys_pwr_dm_suspend)(void); 49*6fba6e04STony Xie int (*sys_pwr_dm_resume)(void); 50*6fba6e04STony Xie void (*sys_gbl_soft_reset)(void) __dead2; 51*6fba6e04STony Xie void (*system_off)(void) __dead2; 52*6fba6e04STony Xie }; 53*6fba6e04STony Xie 54*6fba6e04STony Xie /****************************************************************************** 55*6fba6e04STony Xie * The register have write-mask bits, it is mean, if you want to set the bits, 56*6fba6e04STony Xie * you needs set the write-mask bits at the same time, 57*6fba6e04STony Xie * The write-mask bits is in high 16-bits. 58*6fba6e04STony Xie * The fllowing macro definition helps access write-mask bits reg efficient! 59*6fba6e04STony Xie ******************************************************************************/ 60*6fba6e04STony Xie #define REG_MSK_SHIFT 16 61*6fba6e04STony Xie 62*6fba6e04STony Xie #ifndef BIT 63*6fba6e04STony Xie #define BIT(nr) (1 << (nr)) 64*6fba6e04STony Xie #endif 65*6fba6e04STony Xie 66*6fba6e04STony Xie #ifndef WMSK_BIT 67*6fba6e04STony Xie #define WMSK_BIT(nr) BIT((nr) + REG_MSK_SHIFT) 68*6fba6e04STony Xie #endif 69*6fba6e04STony Xie 70*6fba6e04STony Xie /* set one bit with write mask */ 71*6fba6e04STony Xie #ifndef BIT_WITH_WMSK 72*6fba6e04STony Xie #define BIT_WITH_WMSK(nr) (BIT(nr) | WMSK_BIT(nr)) 73*6fba6e04STony Xie #endif 74*6fba6e04STony Xie 75*6fba6e04STony Xie #ifndef BITS_SHIFT 76*6fba6e04STony Xie #define BITS_SHIFT(bits, shift) (bits << (shift)) 77*6fba6e04STony Xie #endif 78*6fba6e04STony Xie 79*6fba6e04STony Xie #ifndef BITS_WITH_WMASK 80*6fba6e04STony Xie #define BITS_WITH_WMASK(msk, bits, shift)\ 81*6fba6e04STony Xie (BITS_SHIFT(bits, shift) | BITS_SHIFT(msk, (shift + REG_MSK_SHIFT))) 82*6fba6e04STony Xie #endif 83*6fba6e04STony Xie 84*6fba6e04STony Xie /****************************************************************************** 85*6fba6e04STony Xie * Function and variable prototypes 86*6fba6e04STony Xie *****************************************************************************/ 87*6fba6e04STony Xie void plat_configure_mmu_el3(unsigned long total_base, 88*6fba6e04STony Xie unsigned long total_size, 89*6fba6e04STony Xie unsigned long, 90*6fba6e04STony Xie unsigned long, 91*6fba6e04STony Xie unsigned long, 92*6fba6e04STony Xie unsigned long); 93*6fba6e04STony Xie 94*6fba6e04STony Xie void plat_cci_init(void); 95*6fba6e04STony Xie void plat_cci_enable(void); 96*6fba6e04STony Xie void plat_cci_disable(void); 97*6fba6e04STony Xie 98*6fba6e04STony Xie void plat_delay_timer_init(void); 99*6fba6e04STony Xie 100*6fba6e04STony Xie void plat_rockchip_gic_driver_init(void); 101*6fba6e04STony Xie void plat_rockchip_gic_init(void); 102*6fba6e04STony Xie void plat_rockchip_gic_cpuif_enable(void); 103*6fba6e04STony Xie void plat_rockchip_gic_cpuif_disable(void); 104*6fba6e04STony Xie void plat_rockchip_gic_pcpu_init(void); 105*6fba6e04STony Xie 106*6fba6e04STony Xie void plat_rockchip_pmusram_prepare(void); 107*6fba6e04STony Xie void plat_rockchip_pmu_init(void); 108*6fba6e04STony Xie void plat_rockchip_soc_init(void); 109*6fba6e04STony Xie void plat_setup_rockchip_pm_ops(struct rockchip_pm_ops_cb *ops); 110*6fba6e04STony Xie 111*6fba6e04STony Xie extern const unsigned char rockchip_power_domain_tree_desc[]; 112*6fba6e04STony Xie 113*6fba6e04STony Xie extern void *pmu_cpuson_entrypoint_start; 114*6fba6e04STony Xie extern void *pmu_cpuson_entrypoint_end; 115*6fba6e04STony Xie extern uint64_t cpuson_entry_point[PLATFORM_CORE_COUNT]; 116*6fba6e04STony Xie extern uint32_t cpuson_flags[PLATFORM_CORE_COUNT]; 117*6fba6e04STony Xie 118*6fba6e04STony Xie extern const mmap_region_t plat_rk_mmap[]; 119*6fba6e04STony Xie #endif /* __ASSEMBLY__ */ 120*6fba6e04STony Xie 121*6fba6e04STony Xie /* only Cortex-A53 */ 122*6fba6e04STony Xie #define RK_PLAT_CFG0 0 123*6fba6e04STony Xie 124*6fba6e04STony Xie /* include Cortex-A72 */ 125*6fba6e04STony Xie #define RK_PLAT_CFG1 1 126*6fba6e04STony Xie 127*6fba6e04STony Xie #endif /* __PLAT_PRIVATE_H__ */ 128