Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *		http://www.samsung.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Common Header for Exynos machines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define __ARCH_ARM_MACH_EXYNOS_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/platform_data/cpuidle-exynos.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define EXYNOS3250_SOC_ID	0xE3472000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define EXYNOS3_SOC_MASK	0xFFFFF000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define EXYNOS4210_CPU_ID	0x43210000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #define EXYNOS4412_CPU_ID	0xE4412200
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define EXYNOS4_CPU_MASK	0xFFFE0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define EXYNOS5250_SOC_ID	0x43520000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define EXYNOS5410_SOC_ID	0xE5410000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define EXYNOS5420_SOC_ID	0xE5420000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #define EXYNOS5800_SOC_ID	0xE5422000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define EXYNOS5_SOC_MASK	0xFFFFF000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) extern unsigned long exynos_cpu_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define IS_SAMSUNG_CPU(name, id, mask)		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) static inline int is_samsung_##name(void)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) {						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	return ((exynos_cpu_id & mask) == (id & mask));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) IS_SAMSUNG_CPU(exynos5410, EXYNOS5410_SOC_ID, EXYNOS5_SOC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #if defined(CONFIG_SOC_EXYNOS3250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) # define soc_is_exynos3250()	is_samsung_exynos3250()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) # define soc_is_exynos3250()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #if defined(CONFIG_CPU_EXYNOS4210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) # define soc_is_exynos4210()	is_samsung_exynos4210()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) # define soc_is_exynos4210()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #if defined(CONFIG_SOC_EXYNOS4412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) # define soc_is_exynos4412()	is_samsung_exynos4412()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) # define soc_is_exynos4412()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define EXYNOS4210_REV_0	(0x0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) #define EXYNOS4210_REV_1_0	(0x10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #define EXYNOS4210_REV_1_1	(0x11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) #if defined(CONFIG_SOC_EXYNOS5250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) # define soc_is_exynos5250()	is_samsung_exynos5250()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) # define soc_is_exynos5250()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) #if defined(CONFIG_SOC_EXYNOS5410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) # define soc_is_exynos5410()	is_samsung_exynos5410()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) # define soc_is_exynos5410()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #if defined(CONFIG_SOC_EXYNOS5420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) # define soc_is_exynos5420()	is_samsung_exynos5420()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) # define soc_is_exynos5420()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) #if defined(CONFIG_SOC_EXYNOS5800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) # define soc_is_exynos5800()	is_samsung_exynos5800()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) # define soc_is_exynos5800()	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) extern u32 cp15_save_diag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) extern u32 cp15_save_power;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) extern void __iomem *sysram_ns_base_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) extern void __iomem *sysram_base_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) extern phys_addr_t sysram_base_phys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) extern void __iomem *pmu_base_addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) void exynos_sysram_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	FW_DO_IDLE_SLEEP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	FW_DO_IDLE_AFTR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) void exynos_firmware_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* CPU BOOT mode flag for Exynos3250 SoC bootloader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define C2_STATE	(1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Magic values for bootloader indicating chosen low power mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * See also Documentation/arm/samsung/bootloader-interface.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #define EXYNOS_SLEEP_MAGIC	0x00000bad
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #define EXYNOS_AFTR_MAGIC	0xfcba0d10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) bool __init exynos_secure_firmware_available(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) void exynos_set_boot_flag(unsigned int cpu, unsigned int mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) void exynos_clear_boot_flag(unsigned int cpu, unsigned int mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) extern void __init exynos_pm_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static inline void exynos_pm_init(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) extern void exynos_cpu_resume(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) extern void exynos_cpu_resume_ns(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) extern const struct smp_operations exynos_smp_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) extern void exynos_cpu_power_down(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) extern void exynos_cpu_power_up(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) extern int  exynos_cpu_power_state(int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) extern void exynos_cluster_power_down(int cluster);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) extern void exynos_cluster_power_up(int cluster);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) extern int  exynos_cluster_power_state(int cluster);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) extern void exynos_cpu_save_register(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) extern void exynos_cpu_restore_register(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) extern void exynos_pm_central_suspend(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) extern int exynos_pm_central_resume(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) extern void exynos_enter_aftr(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #ifdef CONFIG_SMP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) extern void exynos_scu_enable(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static inline void exynos_scu_enable(void) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) extern void exynos_set_delayed_reset_assertion(bool enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) extern unsigned int exynos_rev(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) extern void exynos_core_restart(u32 core_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) extern int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static inline void pmu_raw_writel(u32 val, u32 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	writel_relaxed(val, pmu_base_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static inline u32 pmu_raw_readl(u32 offset)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	return readl_relaxed(pmu_base_addr + offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */