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 | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame^] | 44 | static inline bool __attribute_const__ cpu_is_u9540(void) |
| 45 | { |
| 46 | return dbx500_partnumber() == 0x9540; |
| 47 | } |
| 48 | |
| 49 | static inline bool cpu_is_u8500_family(void) |
| 50 | { |
| 51 | return cpu_is_u8500() || cpu_is_u9540(); |
| 52 | } |
| 53 | |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 54 | static inline bool __attribute_const__ cpu_is_u5500(void) |
| 55 | { |
| 56 | return dbx500_partnumber() == 0x5500; |
| 57 | } |
| 58 | |
| 59 | /* |
Linus Walleij | d5608bb | 2011-12-15 11:41:09 +0100 | [diff] [blame] | 60 | * 5500 revisions |
| 61 | */ |
| 62 | |
| 63 | static inline bool __attribute_const__ cpu_is_u5500v1(void) |
| 64 | { |
| 65 | return cpu_is_u5500() && (dbx500_revision() & 0xf0) == 0xA0; |
| 66 | } |
| 67 | |
| 68 | static inline bool __attribute_const__ cpu_is_u5500v2(void) |
| 69 | { |
| 70 | return (dbx500_id.revision & 0xf0) == 0xB0; |
| 71 | } |
| 72 | |
| 73 | static inline bool __attribute_const__ cpu_is_u5500v20(void) |
| 74 | { |
| 75 | return cpu_is_u5500() && ((dbx500_revision() & 0xf0) == 0xB0); |
| 76 | } |
| 77 | |
| 78 | static inline bool __attribute_const__ cpu_is_u5500v21(void) |
| 79 | { |
| 80 | return cpu_is_u5500() && (dbx500_revision() == 0xB1); |
| 81 | } |
| 82 | |
| 83 | /* |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 84 | * 8500 revisions |
| 85 | */ |
| 86 | |
| 87 | static inline bool __attribute_const__ cpu_is_u8500ed(void) |
| 88 | { |
| 89 | return cpu_is_u8500() && dbx500_revision() == 0x00; |
| 90 | } |
| 91 | |
| 92 | static inline bool __attribute_const__ cpu_is_u8500v1(void) |
| 93 | { |
| 94 | return cpu_is_u8500() && (dbx500_revision() & 0xf0) == 0xA0; |
| 95 | } |
| 96 | |
| 97 | static inline bool __attribute_const__ cpu_is_u8500v10(void) |
| 98 | { |
| 99 | return cpu_is_u8500() && dbx500_revision() == 0xA0; |
| 100 | } |
| 101 | |
| 102 | static inline bool __attribute_const__ cpu_is_u8500v11(void) |
| 103 | { |
| 104 | return cpu_is_u8500() && dbx500_revision() == 0xA1; |
| 105 | } |
| 106 | |
| 107 | static inline bool __attribute_const__ cpu_is_u8500v2(void) |
| 108 | { |
| 109 | return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); |
| 110 | } |
| 111 | |
Linus Walleij | 5d99eae | 2011-03-29 22:05:06 +0200 | [diff] [blame] | 112 | static inline bool cpu_is_u8500v20(void) |
| 113 | { |
| 114 | return cpu_is_u8500() && (dbx500_revision() == 0xB0); |
| 115 | } |
| 116 | |
| 117 | static inline bool cpu_is_u8500v21(void) |
| 118 | { |
| 119 | return cpu_is_u8500() && (dbx500_revision() == 0xB1); |
| 120 | } |
| 121 | |
| 122 | static inline bool cpu_is_u8500v20_or_later(void) |
| 123 | { |
Linus Walleij | bc71c09 | 2012-01-23 11:54:44 +0100 | [diff] [blame^] | 124 | /* |
| 125 | * U9540 has so much in common with U8500 that is is considered a |
| 126 | * U8500 variant. |
| 127 | */ |
| 128 | return cpu_is_u9540() || |
| 129 | (cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11()); |
Linus Walleij | 5d99eae | 2011-03-29 22:05:06 +0200 | [diff] [blame] | 130 | } |
| 131 | |
| 132 | static inline bool ux500_is_svp(void) |
| 133 | { |
| 134 | return false; |
| 135 | } |
| 136 | |
Rabin Vincent | abf12d7 | 2010-12-08 11:07:59 +0530 | [diff] [blame] | 137 | #define ux500_unknown_soc() BUG() |
| 138 | |
| 139 | #endif |