^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) * Copyright (c) 2004-2005 Simtec Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * Header file for Samsung CPU support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* todo - fix when rmk changes iodescs to use `void __iomem *` */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #ifndef __SAMSUNG_PLAT_CPU_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define __SAMSUNG_PLAT_CPU_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) extern unsigned long samsung_cpu_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define S3C2410_CPU_ID 0x32410000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define S3C2410_CPU_MASK 0xFFFFFFFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define S3C24XX_CPU_ID 0x32400000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define S3C24XX_CPU_MASK 0xFFF00000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define S3C2412_CPU_ID 0x32412000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define S3C2412_CPU_MASK 0xFFFFF000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define S3C6400_CPU_ID 0x36400000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define S3C6410_CPU_ID 0x36410000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define S3C64XX_CPU_MASK 0xFFFFF000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define S5PV210_CPU_ID 0x43110000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define S5PV210_CPU_MASK 0xFFFFF000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define IS_SAMSUNG_CPU(name, id, mask) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static inline int is_samsung_##name(void) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) return ((samsung_cpu_id & mask) == (id & mask)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) IS_SAMSUNG_CPU(s3c2410, S3C2410_CPU_ID, S3C2410_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) defined(CONFIG_CPU_S3C2443)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) # define soc_is_s3c24xx() is_samsung_s3c24xx()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) # define soc_is_s3c2410() is_samsung_s3c2410()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) # define soc_is_s3c24xx() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) # define soc_is_s3c2410() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #if defined(CONFIG_CPU_S3C2412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) # define soc_is_s3c2412() is_samsung_s3c2412()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) # define soc_is_s3c2412() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) # define soc_is_s3c6400() is_samsung_s3c6400()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) # define soc_is_s3c6410() is_samsung_s3c6410()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) # define soc_is_s3c6400() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) # define soc_is_s3c6410() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) # define soc_is_s3c64xx() 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #ifndef KHZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define KHZ (1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #ifndef MHZ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define MHZ (1000*1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* forward declaration */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct s3c24xx_uart_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct platform_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) struct s3c2410_uartcfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct map_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* per-cpu initialisation function table. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) struct cpu_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) unsigned long idcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unsigned long idmask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) void (*map_io)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) void (*init_clocks)(int xtal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) int (*init)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) extern void s3c_init_cpu(unsigned long idcode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct cpu_table *cpus, unsigned int cputab_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /* core initialisation functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) extern void s3c64xx_init_cpu(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) extern void s3c24xx_init_clocks(int xtal);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) extern void s3c24xx_init_uartdevs(char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct s3c24xx_uart_resources *res,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct s3c2410_uartcfg *cfg, int no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) extern struct syscore_ops s3c2410_pm_syscore_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) extern struct syscore_ops s3c2412_pm_syscore_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) extern struct syscore_ops s3c2416_pm_syscore_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) extern struct syscore_ops s3c244x_pm_syscore_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) extern struct bus_type s3c6410_subsys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #endif