1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef __HISOC_NAND_H__ 17 #define __HISOC_NAND_H__ 18 19 #include "asm/platform.h" 20 21 #ifdef __cplusplus 22 #if __cplusplus 23 extern "C" { 24 #endif /* __cplusplus */ 25 #endif /* __cplusplus */ 26 27 #define PERI_CRG52 (CRG_REG_BASE + 0x00D0) 28 #define PERI_CRG52_CLK_EN (1U << 1) 29 #define PERI_CRG52_CLK_SEL_198M (1U << 2) 30 31 #define REG_SYSSTAT 0x008C 32 #define BOOT_FROM_NAND 2 33 hinfc620_clk_enable(int enable)34static void hinfc620_clk_enable(int enable) 35 { 36 unsigned int reg_val = readl(PERI_CRG52); 37 38 if (enable) 39 reg_val |= (PERI_CRG52_CLK_EN | PERI_CRG52_CLK_SEL_198M); 40 else 41 reg_val &= ~PERI_CRG52_CLK_EN; 42 43 writel(reg_val, (PERI_CRG52)); 44 } 45 #define check_boot_type() ((readl(SYS_CTRL_REG_BASE + REG_SYSSTAT) >> 4) & 0x3); 46 47 48 #ifdef __cplusplus 49 #if __cplusplus 50 } 51 #endif /* __cplusplus */ 52 #endif /* __cplusplus */ 53 54 #endif 55 56