1c6ff132dSArnd Bergmann /* SPDX-License-Identifier: GPL-2.0 */ 2c6ff132dSArnd Bergmann /* 3c6ff132dSArnd Bergmann * Copyright (c) 2011 Samsung Electronics Co., Ltd. 4c6ff132dSArnd Bergmann * http://www.samsung.com/ 5c6ff132dSArnd Bergmann * 6c6ff132dSArnd Bergmann * Copyright (c) 2004-2005 Simtec Electronics 7c6ff132dSArnd Bergmann * Ben Dooks <ben@simtec.co.uk> 8c6ff132dSArnd Bergmann * 9c6ff132dSArnd Bergmann * Header file for Samsung CPU support 10c6ff132dSArnd Bergmann */ 11c6ff132dSArnd Bergmann 12c6ff132dSArnd Bergmann /* todo - fix when rmk changes iodescs to use `void __iomem *` */ 13c6ff132dSArnd Bergmann 14c6ff132dSArnd Bergmann #ifndef __SAMSUNG_PLAT_CPU_H 15c6ff132dSArnd Bergmann #define __SAMSUNG_PLAT_CPU_H 16c6ff132dSArnd Bergmann 17c6ff132dSArnd Bergmann extern unsigned long samsung_cpu_id; 18c6ff132dSArnd Bergmann 19c6ff132dSArnd Bergmann #define S3C6400_CPU_ID 0x36400000 20c6ff132dSArnd Bergmann #define S3C6410_CPU_ID 0x36410000 21c6ff132dSArnd Bergmann #define S3C64XX_CPU_MASK 0xFFFFF000 22c6ff132dSArnd Bergmann 23c6ff132dSArnd Bergmann #define S5PV210_CPU_ID 0x43110000 24c6ff132dSArnd Bergmann #define S5PV210_CPU_MASK 0xFFFFF000 25c6ff132dSArnd Bergmann 26c6ff132dSArnd Bergmann #define IS_SAMSUNG_CPU(name, id, mask) \ 27c6ff132dSArnd Bergmann static inline int is_samsung_##name(void) \ 28c6ff132dSArnd Bergmann { \ 29c6ff132dSArnd Bergmann return ((samsung_cpu_id & mask) == (id & mask)); \ 30c6ff132dSArnd Bergmann } 31c6ff132dSArnd Bergmann 32c6ff132dSArnd Bergmann IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK) 33c6ff132dSArnd Bergmann IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK) 34c6ff132dSArnd Bergmann 35c6ff132dSArnd Bergmann #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410) 36c6ff132dSArnd Bergmann # define soc_is_s3c6400() is_samsung_s3c6400() 37c6ff132dSArnd Bergmann # define soc_is_s3c6410() is_samsung_s3c6410() 38c6ff132dSArnd Bergmann # define soc_is_s3c64xx() (is_samsung_s3c6400() || is_samsung_s3c6410()) 39c6ff132dSArnd Bergmann #else 40c6ff132dSArnd Bergmann # define soc_is_s3c6400() 0 41c6ff132dSArnd Bergmann # define soc_is_s3c6410() 0 42c6ff132dSArnd Bergmann # define soc_is_s3c64xx() 0 43c6ff132dSArnd Bergmann #endif 44c6ff132dSArnd Bergmann 45c6ff132dSArnd Bergmann #ifndef MHZ 46c6ff132dSArnd Bergmann #define MHZ (1000*1000) 47c6ff132dSArnd Bergmann #endif 48c6ff132dSArnd Bergmann 49c6ff132dSArnd Bergmann #define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000) 50c6ff132dSArnd Bergmann 51c6ff132dSArnd Bergmann /* forward declaration */ 52c6ff132dSArnd Bergmann struct s3c24xx_uart_resources; 53c6ff132dSArnd Bergmann struct platform_device; 54c6ff132dSArnd Bergmann struct s3c2410_uartcfg; 55c6ff132dSArnd Bergmann struct map_desc; 56c6ff132dSArnd Bergmann 57c6ff132dSArnd Bergmann /* per-cpu initialisation function table. */ 58c6ff132dSArnd Bergmann 59c6ff132dSArnd Bergmann struct cpu_table { 60c6ff132dSArnd Bergmann unsigned long idcode; 61c6ff132dSArnd Bergmann unsigned long idmask; 62c6ff132dSArnd Bergmann void (*map_io)(void); 63c6ff132dSArnd Bergmann void (*init_uarts)(struct s3c2410_uartcfg *cfg, int no); 64c6ff132dSArnd Bergmann int (*init)(void); 65c6ff132dSArnd Bergmann const char *name; 66c6ff132dSArnd Bergmann }; 67c6ff132dSArnd Bergmann 68c6ff132dSArnd Bergmann extern void s3c_init_cpu(unsigned long idcode, 69c6ff132dSArnd Bergmann struct cpu_table *cpus, unsigned int cputab_size); 70c6ff132dSArnd Bergmann 71c6ff132dSArnd Bergmann /* core initialisation functions */ 72c6ff132dSArnd Bergmann extern void s3c64xx_init_cpu(void); 73c6ff132dSArnd Bergmann 74c6ff132dSArnd Bergmann extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); 75c6ff132dSArnd Bergmann extern void s3c24xx_init_uartdevs(char *name, 76c6ff132dSArnd Bergmann struct s3c24xx_uart_resources *res, 77c6ff132dSArnd Bergmann struct s3c2410_uartcfg *cfg, int no); 78c6ff132dSArnd Bergmann 79*a3891621SRicardo B. Marliere extern const struct bus_type s3c6410_subsys; 80c6ff132dSArnd Bergmann 81c6ff132dSArnd Bergmann #endif 82