Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 1 | /* |
Yusuke Goda | 54cda8b | 2008-03-05 14:23:26 +0900 | [diff] [blame] | 2 | * (C) Copyright 2007,2008 Nobuhiro Iwamatsu <iwamatsu@nigauri.org> |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 17 | * MA 02111-1307 USA |
| 18 | */ |
| 19 | |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 20 | #ifndef _ASM_CPU_SH4_H_ |
| 21 | #define _ASM_CPU_SH4_H_ |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 22 | |
| 23 | /* cache control */ |
| 24 | #define CCR_CACHE_STOP 0x00000808 |
| 25 | #define CCR_CACHE_ENABLE 0x00000101 |
| 26 | #define CCR_CACHE_ICI 0x00000800 |
| 27 | |
| 28 | #define CACHE_OC_ADDRESS_ARRAY 0xf4000000 |
Nobuhiro Iwamatsu | 121e2c5 | 2008-11-25 11:05:19 +0900 | [diff] [blame] | 29 | |
| 30 | #if defined (CONFIG_CPU_SH7750) || \ |
| 31 | defined(CONFIG_CPU_SH7751) |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 32 | #define CACHE_OC_WAY_SHIFT 14 |
| 33 | #define CACHE_OC_NUM_ENTRIES 512 |
Nobuhiro Iwamatsu | 121e2c5 | 2008-11-25 11:05:19 +0900 | [diff] [blame] | 34 | #else |
| 35 | #define CACHE_OC_WAY_SHIFT 13 |
| 36 | #define CACHE_OC_NUM_ENTRIES 256 |
| 37 | #endif |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 38 | #define CACHE_OC_ENTRY_SHIFT 5 |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 39 | |
Nobuhiro Iwamatsu | 53b3143 | 2008-03-12 12:10:28 +0900 | [diff] [blame] | 40 | #if defined (CONFIG_CPU_SH7750) || \ |
| 41 | defined(CONFIG_CPU_SH7751) |
| 42 | # include <asm/cpu_sh7750.h> |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 43 | #elif defined (CONFIG_CPU_SH7722) |
Nobuhiro Iwamatsu | 53b3143 | 2008-03-12 12:10:28 +0900 | [diff] [blame] | 44 | # include <asm/cpu_sh7722.h> |
Nobuhiro Iwamatsu | fcabccc | 2008-08-22 17:48:51 +0900 | [diff] [blame] | 45 | #elif defined (CONFIG_CPU_SH7723) |
| 46 | # include <asm/cpu_sh7723.h> |
Nobuhiro Iwamatsu | db57d71 | 2011-11-15 11:00:01 +0900 | [diff] [blame] | 47 | #elif defined (CONFIG_CPU_SH7724) |
| 48 | # include <asm/cpu_sh7724.h> |
Nobuhiro Iwamatsu | 73bbe6d | 2012-01-11 10:45:01 +0900 | [diff] [blame^] | 49 | #elif defined (CONFIG_CPU_SH7734) |
| 50 | # include <asm/cpu_sh7734.h> |
Yoshihiro Shimoda | a7d382c | 2011-02-02 10:05:36 +0900 | [diff] [blame] | 51 | #elif defined (CONFIG_CPU_SH7757) |
| 52 | # include <asm/cpu_sh7757.h> |
Nobuhiro Iwamatsu | 6b165de | 2008-06-06 16:24:13 +0900 | [diff] [blame] | 53 | #elif defined (CONFIG_CPU_SH7763) |
| 54 | # include <asm/cpu_sh7763.h> |
Yusuke Goda | 54cda8b | 2008-03-05 14:23:26 +0900 | [diff] [blame] | 55 | #elif defined (CONFIG_CPU_SH7780) |
Nobuhiro Iwamatsu | 53b3143 | 2008-03-12 12:10:28 +0900 | [diff] [blame] | 56 | # include <asm/cpu_sh7780.h> |
Yoshihiro Shimoda | c8a368c | 2008-07-10 19:32:53 +0900 | [diff] [blame] | 57 | #elif defined (CONFIG_CPU_SH7785) |
| 58 | # include <asm/cpu_sh7785.h> |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 59 | #else |
Nobuhiro Iwamatsu | 53b3143 | 2008-03-12 12:10:28 +0900 | [diff] [blame] | 60 | # error "Unknown SH4 variant" |
Nobuhiro Iwamatsu | 970dc33 | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 61 | #endif |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 62 | |
Yoshihiro Shimoda | e55bb63 | 2009-03-03 15:11:08 +0900 | [diff] [blame] | 63 | #if defined(CONFIG_SH_32BIT) |
| 64 | #define PMB_ADDR_ARRAY 0xf6100000 |
| 65 | #define PMB_ADDR_ENTRY 8 |
| 66 | #define PMB_VPN 24 |
| 67 | |
| 68 | #define PMB_DATA_ARRAY 0xf7100000 |
| 69 | #define PMB_DATA_ENTRY 8 |
| 70 | #define PMB_PPN 24 |
| 71 | #define PMB_UB 9 /* Buffered write */ |
| 72 | #define PMB_V 8 /* Valid */ |
| 73 | #define PMB_SZ1 7 /* Page size (upper bit) */ |
| 74 | #define PMB_SZ0 4 /* Page size (lower bit) */ |
| 75 | #define PMB_C 3 /* Cacheability */ |
| 76 | #define PMB_WT 0 /* Write-through */ |
| 77 | |
| 78 | #define PMB_ADDR_BASE(entry) (PMB_ADDR_ARRAY + (entry << PMB_ADDR_ENTRY)) |
| 79 | #define PMB_DATA_BASE(entry) (PMB_DATA_ARRAY + (entry << PMB_DATA_ENTRY)) |
| 80 | #define mk_pmb_addr_val(vpn) ((vpn << PMB_VPN)) |
| 81 | #define mk_pmb_data_val(ppn, ub, v, sz1, sz0, c, wt) \ |
| 82 | ((ppn << PMB_PPN) | (ub << PMB_UB) | \ |
| 83 | (v << PMB_V) | (sz1 << PMB_SZ1) | \ |
| 84 | (sz0 << PMB_SZ0) | (c << PMB_C) | \ |
| 85 | (wt << PMB_WT)) |
| 86 | #endif |
| 87 | |
Nobuhiro Iwamatsu | 547b67f | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 88 | #endif /* _ASM_CPU_SH4_H_ */ |