Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/mach-at91/include/mach/cpu.h |
| 3 | * |
| 4 | * Copyright (C) 2006 SAN People |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #ifndef __ASM_ARCH_CPU_H |
| 14 | #define __ASM_ARCH_CPU_H |
| 15 | |
| 16 | #include <mach/hardware.h> |
| 17 | #include <mach/at91_dbgu.h> |
| 18 | |
| 19 | |
| 20 | #define ARCH_ID_AT91RM9200 0x09290780 |
| 21 | #define ARCH_ID_AT91SAM9260 0x019803a0 |
| 22 | #define ARCH_ID_AT91SAM9261 0x019703a0 |
| 23 | #define ARCH_ID_AT91SAM9263 0x019607a0 |
Nicolas Ferre | b784b7c | 2009-06-26 15:36:59 +0100 | [diff] [blame] | 24 | #define ARCH_ID_AT91SAM9G10 0x819903a0 |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | #define ARCH_ID_AT91SAM9G20 0x019905a0 |
| 26 | #define ARCH_ID_AT91SAM9RL64 0x019b03a0 |
Nicolas Ferre | fddcc0a | 2009-06-26 15:36:56 +0100 | [diff] [blame] | 27 | #define ARCH_ID_AT91SAM9G45 0x819b05a0 |
Nicolas Ferre | d8951ad | 2009-09-21 12:03:56 +0200 | [diff] [blame] | 28 | #define ARCH_ID_AT91SAM9G45MRL 0x819b05a2 /* aka 9G45-ES2 & non ES lots */ |
| 29 | #define ARCH_ID_AT91SAM9G45ES 0x819b05a1 /* 9G45-ES (Engineering Sample) */ |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 30 | #define ARCH_ID_AT91CAP9 0x039A03A0 |
| 31 | |
| 32 | #define ARCH_ID_AT91SAM9XE128 0x329973a0 |
| 33 | #define ARCH_ID_AT91SAM9XE256 0x329a93a0 |
| 34 | #define ARCH_ID_AT91SAM9XE512 0x329aa3a0 |
| 35 | |
Andrew Victor | 5e38efa | 2009-12-15 21:57:27 +0100 | [diff] [blame^] | 36 | #define ARCH_ID_AT572D940HF 0x0e0303e0 |
| 37 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 38 | #define ARCH_ID_AT91M40800 0x14080044 |
| 39 | #define ARCH_ID_AT91R40807 0x44080746 |
| 40 | #define ARCH_ID_AT91M40807 0x14080745 |
| 41 | #define ARCH_ID_AT91R40008 0x44000840 |
| 42 | |
| 43 | static inline unsigned long at91_cpu_identify(void) |
| 44 | { |
| 45 | return (at91_sys_read(AT91_DBGU_CIDR) & ~AT91_CIDR_VERSION); |
| 46 | } |
| 47 | |
Nicolas Ferre | d8951ad | 2009-09-21 12:03:56 +0200 | [diff] [blame] | 48 | static inline unsigned long at91_cpu_fully_identify(void) |
| 49 | { |
| 50 | return at91_sys_read(AT91_DBGU_CIDR); |
| 51 | } |
| 52 | |
Nicolas Ferre | fddcc0a | 2009-06-26 15:36:56 +0100 | [diff] [blame] | 53 | #define ARCH_EXID_AT91SAM9M11 0x00000001 |
| 54 | #define ARCH_EXID_AT91SAM9M10 0x00000002 |
| 55 | #define ARCH_EXID_AT91SAM9G45 0x00000004 |
| 56 | |
| 57 | static inline unsigned long at91_exid_identify(void) |
| 58 | { |
| 59 | return at91_sys_read(AT91_DBGU_EXID); |
| 60 | } |
| 61 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 62 | |
| 63 | #define ARCH_FAMILY_AT91X92 0x09200000 |
| 64 | #define ARCH_FAMILY_AT91SAM9 0x01900000 |
| 65 | #define ARCH_FAMILY_AT91SAM9XE 0x02900000 |
| 66 | |
| 67 | static inline unsigned long at91_arch_identify(void) |
| 68 | { |
| 69 | return (at91_sys_read(AT91_DBGU_CIDR) & AT91_CIDR_ARCH); |
| 70 | } |
| 71 | |
Stelian Pop | 7be90a6 | 2008-10-22 13:52:08 +0100 | [diff] [blame] | 72 | #ifdef CONFIG_ARCH_AT91CAP9 |
| 73 | #include <mach/at91_pmc.h> |
| 74 | |
| 75 | #define ARCH_REVISION_CAP9_B 0x399 |
| 76 | #define ARCH_REVISION_CAP9_C 0x601 |
| 77 | |
| 78 | static inline unsigned long at91cap9_rev_identify(void) |
| 79 | { |
| 80 | return (at91_sys_read(AT91_PMC_VER)); |
| 81 | } |
| 82 | #endif |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 83 | |
| 84 | #ifdef CONFIG_ARCH_AT91RM9200 |
| 85 | #define cpu_is_at91rm9200() (at91_cpu_identify() == ARCH_ID_AT91RM9200) |
| 86 | #else |
| 87 | #define cpu_is_at91rm9200() (0) |
| 88 | #endif |
| 89 | |
| 90 | #ifdef CONFIG_ARCH_AT91SAM9260 |
| 91 | #define cpu_is_at91sam9xe() (at91_arch_identify() == ARCH_FAMILY_AT91SAM9XE) |
| 92 | #define cpu_is_at91sam9260() ((at91_cpu_identify() == ARCH_ID_AT91SAM9260) || cpu_is_at91sam9xe()) |
| 93 | #else |
| 94 | #define cpu_is_at91sam9xe() (0) |
| 95 | #define cpu_is_at91sam9260() (0) |
| 96 | #endif |
| 97 | |
| 98 | #ifdef CONFIG_ARCH_AT91SAM9G20 |
| 99 | #define cpu_is_at91sam9g20() (at91_cpu_identify() == ARCH_ID_AT91SAM9G20) |
| 100 | #else |
| 101 | #define cpu_is_at91sam9g20() (0) |
| 102 | #endif |
| 103 | |
| 104 | #ifdef CONFIG_ARCH_AT91SAM9261 |
| 105 | #define cpu_is_at91sam9261() (at91_cpu_identify() == ARCH_ID_AT91SAM9261) |
| 106 | #else |
| 107 | #define cpu_is_at91sam9261() (0) |
| 108 | #endif |
| 109 | |
Nicolas Ferre | b784b7c | 2009-06-26 15:36:59 +0100 | [diff] [blame] | 110 | #ifdef CONFIG_ARCH_AT91SAM9G10 |
| 111 | #define cpu_is_at91sam9g10() (at91_cpu_identify() == ARCH_ID_AT91SAM9G10) |
| 112 | #else |
| 113 | #define cpu_is_at91sam9g10() (0) |
| 114 | #endif |
| 115 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 116 | #ifdef CONFIG_ARCH_AT91SAM9263 |
| 117 | #define cpu_is_at91sam9263() (at91_cpu_identify() == ARCH_ID_AT91SAM9263) |
| 118 | #else |
| 119 | #define cpu_is_at91sam9263() (0) |
| 120 | #endif |
| 121 | |
| 122 | #ifdef CONFIG_ARCH_AT91SAM9RL |
| 123 | #define cpu_is_at91sam9rl() (at91_cpu_identify() == ARCH_ID_AT91SAM9RL64) |
| 124 | #else |
| 125 | #define cpu_is_at91sam9rl() (0) |
| 126 | #endif |
| 127 | |
Nicolas Ferre | fddcc0a | 2009-06-26 15:36:56 +0100 | [diff] [blame] | 128 | #ifdef CONFIG_ARCH_AT91SAM9G45 |
| 129 | #define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45) |
Nicolas Ferre | d8951ad | 2009-09-21 12:03:56 +0200 | [diff] [blame] | 130 | #define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES) |
Nicolas Ferre | fddcc0a | 2009-06-26 15:36:56 +0100 | [diff] [blame] | 131 | #else |
| 132 | #define cpu_is_at91sam9g45() (0) |
Nicolas Ferre | d8951ad | 2009-09-21 12:03:56 +0200 | [diff] [blame] | 133 | #define cpu_is_at91sam9g45es() (0) |
Nicolas Ferre | fddcc0a | 2009-06-26 15:36:56 +0100 | [diff] [blame] | 134 | #endif |
| 135 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 136 | #ifdef CONFIG_ARCH_AT91CAP9 |
| 137 | #define cpu_is_at91cap9() (at91_cpu_identify() == ARCH_ID_AT91CAP9) |
Stelian Pop | 7be90a6 | 2008-10-22 13:52:08 +0100 | [diff] [blame] | 138 | #define cpu_is_at91cap9_revB() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_B) |
| 139 | #define cpu_is_at91cap9_revC() (at91cap9_rev_identify() == ARCH_REVISION_CAP9_C) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 140 | #else |
| 141 | #define cpu_is_at91cap9() (0) |
Stelian Pop | 7be90a6 | 2008-10-22 13:52:08 +0100 | [diff] [blame] | 142 | #define cpu_is_at91cap9_revB() (0) |
| 143 | #define cpu_is_at91cap9_revC() (0) |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 144 | #endif |
| 145 | |
Andrew Victor | 5e38efa | 2009-12-15 21:57:27 +0100 | [diff] [blame^] | 146 | #ifdef CONFIG_ARCH_AT572D940HF |
| 147 | #define cpu_is_at572d940hf() (at91_cpu_identify() == ARCH_ID_AT572D940HF) |
| 148 | #else |
| 149 | #define cpu_is_at572d940hf() (0) |
| 150 | #endif |
| 151 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 152 | /* |
| 153 | * Since this is ARM, we will never run on any AVR32 CPU. But these |
| 154 | * definitions may reduce clutter in common drivers. |
| 155 | */ |
| 156 | #define cpu_is_at32ap7000() (0) |
| 157 | |
| 158 | #endif |