Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) ST-Ericsson SA 2010 |
| 3 | * |
| 4 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson |
| 5 | * License terms: GNU General Public License (GPL) version 2 |
| 6 | */ |
| 7 | |
| 8 | #ifndef __MACH_UX500_ID |
| 9 | #define __MACH_UX500_ID |
| 10 | |
| 11 | /** |
| 12 | * struct dbx500_asic_id - fields of the ASIC ID |
| 13 | * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard" |
| 14 | * @partnumber: hithereto 0x8500 for DB8500 |
| 15 | * @revision: version code in the series |
| 16 | */ |
| 17 | struct dbx500_asic_id { |
| 18 | u16 partnumber; |
| 19 | u8 revision; |
| 20 | u8 process; |
| 21 | }; |
| 22 | |
| 23 | extern struct dbx500_asic_id dbx500_id; |
| 24 | |
| 25 | static inline unsigned int __attribute_const__ dbx500_partnumber(void) |
| 26 | { |
| 27 | return dbx500_id.partnumber; |
| 28 | } |
| 29 | |
| 30 | static inline unsigned int __attribute_const__ dbx500_revision(void) |
| 31 | { |
| 32 | return dbx500_id.revision; |
| 33 | } |
| 34 | |
| 35 | /* |
| 36 | * SOCs |
| 37 | */ |
| 38 | |
| 39 | static inline bool __attribute_const__ cpu_is_u8500(void) |
| 40 | { |
| 41 | return dbx500_partnumber() == 0x8500; |
| 42 | } |
| 43 | |
Linus Walleij | a4d9b33 | 2012-08-09 16:34:41 +0200 | [diff] [blame] | 44 | static inline bool __attribute_const__ cpu_is_u8520(void) |
| 45 | { |
| 46 | return dbx500_partnumber() == 0x8520; |
| 47 | } |
| 48 | |
Linus Walleij | e1bbb55 | 2012-08-09 17:10:36 +0200 | [diff] [blame] | 49 | static inline bool cpu_is_u8500_family(void) |
| 50 | { |
| 51 | return cpu_is_u8500() || cpu_is_u8520(); |
| 52 | } |
| 53 | |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 54 | static inline bool __attribute_const__ cpu_is_u9540(void) |
| 55 | { |
| 56 | return dbx500_partnumber() == 0x9540; |
| 57 | } |
| 58 | |
Linus Walleij | e1bbb55 | 2012-08-09 17:10:36 +0200 | [diff] [blame] | 59 | static inline bool __attribute_const__ cpu_is_u8540(void) |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 60 | { |
Linus Walleij | e1bbb55 | 2012-08-09 17:10:36 +0200 | [diff] [blame] | 61 | return dbx500_partnumber() == 0x8540; |
| 62 | } |
| 63 | |
| 64 | static inline bool cpu_is_ux540_family(void) |
| 65 | { |
| 66 | return cpu_is_u9540() || cpu_is_u8540(); |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame] | 67 | } |
| 68 | |
Linus Walleij | d5608bb | 2011-12-15 11:41:09 +0100 | [diff] [blame] | 69 | /* |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 70 | * 8500 revisions |
| 71 | */ |
| 72 | |
| 73 | static inline bool __attribute_const__ cpu_is_u8500ed(void) |
| 74 | { |
| 75 | return cpu_is_u8500() && dbx500_revision() == 0x00; |
| 76 | } |
| 77 | |
| 78 | static inline bool __attribute_const__ cpu_is_u8500v1(void) |
| 79 | { |
| 80 | return cpu_is_u8500() && (dbx500_revision() & 0xf0) == 0xA0; |
| 81 | } |
| 82 | |
| 83 | static inline bool __attribute_const__ cpu_is_u8500v10(void) |
| 84 | { |
| 85 | return cpu_is_u8500() && dbx500_revision() == 0xA0; |
| 86 | } |
| 87 | |
| 88 | static inline bool __attribute_const__ cpu_is_u8500v11(void) |
| 89 | { |
| 90 | return cpu_is_u8500() && dbx500_revision() == 0xA1; |
| 91 | } |
| 92 | |
| 93 | static inline bool __attribute_const__ cpu_is_u8500v2(void) |
| 94 | { |
| 95 | return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); |
| 96 | } |
| 97 | |
Linus Walleij | 5d99eae | 2011-03-29 22:05:06 +0200 | [diff] [blame] | 98 | static inline bool cpu_is_u8500v20(void) |
| 99 | { |
| 100 | return cpu_is_u8500() && (dbx500_revision() == 0xB0); |
| 101 | } |
| 102 | |
| 103 | static inline bool cpu_is_u8500v21(void) |
| 104 | { |
| 105 | return cpu_is_u8500() && (dbx500_revision() == 0xB1); |
| 106 | } |
| 107 | |
Linus Walleij | 1d3266e | 2012-08-09 17:46:27 +0200 | [diff] [blame^] | 108 | static inline bool cpu_is_u8500v22(void) |
| 109 | { |
| 110 | return cpu_is_u8500() && (dbx500_revision() == 0xB2); |
| 111 | } |
| 112 | |
Linus Walleij | 5d99eae | 2011-03-29 22:05:06 +0200 | [diff] [blame] | 113 | static inline bool cpu_is_u8500v20_or_later(void) |
| 114 | { |
Linus Walleij | e1bbb55 | 2012-08-09 17:10:36 +0200 | [diff] [blame] | 115 | return (cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11()); |
Linus Walleij | 5d99eae | 2011-03-29 22:05:06 +0200 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | static inline bool ux500_is_svp(void) |
| 119 | { |
| 120 | return false; |
| 121 | } |
| 122 | |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 123 | #define ux500_unknown_soc() BUG() |
| 124 | |
| 125 | #endif |