linux/arch/arm/plat-samsung/include/plat/cpu.h
<<
>>
Prefs
   1/* linux/arch/arm/plat-samsung/include/plat/cpu.h
   2 *
   3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
   4 *              http://www.samsung.com/
   5 *
   6 * Copyright (c) 2004-2005 Simtec Electronics
   7 *      Ben Dooks <ben@simtec.co.uk>
   8 *
   9 * Header file for Samsung CPU support
  10 *
  11 * This program is free software; you can redistribute it and/or modify
  12 * it under the terms of the GNU General Public License version 2 as
  13 * published by the Free Software Foundation.
  14*/
  15
  16/* todo - fix when rmk changes iodescs to use `void __iomem *` */
  17
  18#ifndef __SAMSUNG_PLAT_CPU_H
  19#define __SAMSUNG_PLAT_CPU_H
  20
  21extern unsigned long samsung_cpu_id;
  22
  23#define S3C24XX_CPU_ID          0x32400000
  24#define S3C24XX_CPU_MASK        0xFFF00000
  25
  26#define S3C2412_CPU_ID          0x32412000
  27#define S3C2412_CPU_MASK        0xFFFFF000
  28
  29#define S3C6400_CPU_ID          0x36400000
  30#define S3C6410_CPU_ID          0x36410000
  31#define S3C64XX_CPU_MASK        0xFFFFF000
  32
  33#define S5P6440_CPU_ID          0x56440000
  34#define S5P6450_CPU_ID          0x36450000
  35#define S5P64XX_CPU_MASK        0xFFFFF000
  36
  37#define S5PC100_CPU_ID          0x43100000
  38#define S5PC100_CPU_MASK        0xFFFFF000
  39
  40#define S5PV210_CPU_ID          0x43110000
  41#define S5PV210_CPU_MASK        0xFFFFF000
  42
  43#define EXYNOS4210_CPU_ID       0x43210000
  44#define EXYNOS4212_CPU_ID       0x43220000
  45#define EXYNOS4412_CPU_ID       0xE4412200
  46#define EXYNOS4_CPU_MASK        0xFFFE0000
  47
  48#define EXYNOS5250_SOC_ID       0x43520000
  49#define EXYNOS5420_SOC_ID       0xE5420000
  50#define EXYNOS5440_SOC_ID       0xE5440000
  51#define EXYNOS5_SOC_MASK        0xFFFFF000
  52
  53#define IS_SAMSUNG_CPU(name, id, mask)          \
  54static inline int is_samsung_##name(void)       \
  55{                                               \
  56        return ((samsung_cpu_id & mask) == (id & mask));        \
  57}
  58
  59IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
  60IS_SAMSUNG_CPU(s3c2412, S3C2412_CPU_ID, S3C2412_CPU_MASK)
  61IS_SAMSUNG_CPU(s3c6400, S3C6400_CPU_ID, S3C64XX_CPU_MASK)
  62IS_SAMSUNG_CPU(s3c6410, S3C6410_CPU_ID, S3C64XX_CPU_MASK)
  63IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
  64IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
  65IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
  66IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
  67IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
  68IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
  69IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
  70IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
  71IS_SAMSUNG_CPU(exynos5420, EXYNOS5420_SOC_ID, EXYNOS5_SOC_MASK)
  72IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK)
  73
  74#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
  75    defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
  76    defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
  77    defined(CONFIG_CPU_S3C2443)
  78# define soc_is_s3c24xx()       is_samsung_s3c24xx()
  79#else
  80# define soc_is_s3c24xx()       0
  81#endif
  82
  83#if defined(CONFIG_CPU_S3C2412)
  84# define soc_is_s3c2412()       is_samsung_s3c2412()
  85#else
  86# define soc_is_s3c2412()       0
  87#endif
  88
  89#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
  90# define soc_is_s3c64xx()       (is_samsung_s3c6400() || is_samsung_s3c6410())
  91#else
  92# define soc_is_s3c64xx()       0
  93#endif
  94
  95#if defined(CONFIG_CPU_S5P6440)
  96# define soc_is_s5p6440()       is_samsung_s5p6440()
  97#else
  98# define soc_is_s5p6440()       0
  99#endif
 100
 101#if defined(CONFIG_CPU_S5P6450)
 102# define soc_is_s5p6450()       is_samsung_s5p6450()
 103#else
 104# define soc_is_s5p6450()       0
 105#endif
 106
 107#if defined(CONFIG_CPU_S5PC100)
 108# define soc_is_s5pc100()       is_samsung_s5pc100()
 109#else
 110# define soc_is_s5pc100()       0
 111#endif
 112
 113#if defined(CONFIG_CPU_S5PV210)
 114# define soc_is_s5pv210()       is_samsung_s5pv210()
 115#else
 116# define soc_is_s5pv210()       0
 117#endif
 118
 119#if defined(CONFIG_CPU_EXYNOS4210)
 120# define soc_is_exynos4210()    is_samsung_exynos4210()
 121#else
 122# define soc_is_exynos4210()    0
 123#endif
 124
 125#if defined(CONFIG_SOC_EXYNOS4212)
 126# define soc_is_exynos4212()    is_samsung_exynos4212()
 127#else
 128# define soc_is_exynos4212()    0
 129#endif
 130
 131#if defined(CONFIG_SOC_EXYNOS4412)
 132# define soc_is_exynos4412()    is_samsung_exynos4412()
 133#else
 134# define soc_is_exynos4412()    0
 135#endif
 136
 137#define EXYNOS4210_REV_0        (0x0)
 138#define EXYNOS4210_REV_1_0      (0x10)
 139#define EXYNOS4210_REV_1_1      (0x11)
 140
 141#if defined(CONFIG_SOC_EXYNOS5250)
 142# define soc_is_exynos5250()    is_samsung_exynos5250()
 143#else
 144# define soc_is_exynos5250()    0
 145#endif
 146
 147#if defined(CONFIG_SOC_EXYNOS5420)
 148# define soc_is_exynos5420()    is_samsung_exynos5420()
 149#else
 150# define soc_is_exynos5420()    0
 151#endif
 152
 153#if defined(CONFIG_SOC_EXYNOS5440)
 154# define soc_is_exynos5440()    is_samsung_exynos5440()
 155#else
 156# define soc_is_exynos5440()    0
 157#endif
 158
 159#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
 160
 161#ifndef KHZ
 162#define KHZ (1000)
 163#endif
 164
 165#ifndef MHZ
 166#define MHZ (1000*1000)
 167#endif
 168
 169#define print_mhz(m) ((m) / MHZ), (((m) / 1000) % 1000)
 170
 171/* forward declaration */
 172struct s3c24xx_uart_resources;
 173struct platform_device;
 174struct s3c2410_uartcfg;
 175struct map_desc;
 176
 177/* per-cpu initialisation function table. */
 178
 179struct cpu_table {
 180        unsigned long   idcode;
 181        unsigned long   idmask;
 182        void            (*map_io)(void);
 183        void            (*init_uarts)(struct s3c2410_uartcfg *cfg, int no);
 184        void            (*init_clocks)(int xtal);
 185        int             (*init)(void);
 186        const char      *name;
 187};
 188
 189extern void s3c_init_cpu(unsigned long idcode,
 190                         struct cpu_table *cpus, unsigned int cputab_size);
 191
 192/* core initialisation functions */
 193
 194extern void s5p_init_irq(u32 *vic, u32 num_vic);
 195
 196extern void s3c24xx_init_io(struct map_desc *mach_desc, int size);
 197
 198extern void s3c24xx_init_cpu(void);
 199extern void s3c64xx_init_cpu(void);
 200extern void s5p_init_cpu(void __iomem *cpuid_addr);
 201
 202extern unsigned int samsung_rev(void);
 203
 204extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
 205
 206extern void s3c24xx_init_clocks(int xtal);
 207
 208extern void s3c24xx_init_uartdevs(char *name,
 209                                  struct s3c24xx_uart_resources *res,
 210                                  struct s3c2410_uartcfg *cfg, int no);
 211
 212extern struct syscore_ops s3c2410_pm_syscore_ops;
 213extern struct syscore_ops s3c2412_pm_syscore_ops;
 214extern struct syscore_ops s3c2416_pm_syscore_ops;
 215extern struct syscore_ops s3c244x_pm_syscore_ops;
 216
 217/* system device subsystems */
 218
 219extern struct bus_type s3c2410_subsys;
 220extern struct bus_type s3c2410a_subsys;
 221extern struct bus_type s3c2412_subsys;
 222extern struct bus_type s3c2416_subsys;
 223extern struct bus_type s3c2440_subsys;
 224extern struct bus_type s3c2442_subsys;
 225extern struct bus_type s3c2443_subsys;
 226extern struct bus_type s3c6410_subsys;
 227extern struct bus_type s5p64x0_subsys;
 228extern struct bus_type s5pv210_subsys;
 229extern struct bus_type exynos_subsys;
 230
 231extern void (*s5pc1xx_idle)(void);
 232
 233#endif
 234