wdenk | 935ecca | 2002-08-06 20:46:37 +0000 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------+ |
| 2 | | |
| 3 | | This source code has been made available to you by IBM on an AS-IS |
| 4 | | basis. Anyone receiving this source is licensed under IBM |
| 5 | | copyrights to use it in any way he or she deems fit, including |
| 6 | | copying it, modifying it, compiling it, and redistributing it either |
| 7 | | with or without modifications. No license under IBM patents or |
| 8 | | patent applications is to be implied by the copyright license. |
| 9 | | |
| 10 | | Any user of this software should understand that IBM cannot provide |
| 11 | | technical support for this software and will not be responsible for |
| 12 | | any consequences resulting from the use of this software. |
| 13 | | |
| 14 | | Any person who transfers this source code or any derivative work |
| 15 | | must include the IBM copyright notice, this paragraph, and the |
| 16 | | preceding two paragraphs in the transferred software. |
| 17 | | |
| 18 | | COPYRIGHT I B M CORPORATION 1999 |
| 19 | | LICENSED MATERIAL - PROGRAM PROPERTY OF I B M |
| 20 | +----------------------------------------------------------------------------*/ |
| 21 | |
| 22 | #ifndef __PPC4XX_H__ |
| 23 | #define __PPC4XX_H__ |
| 24 | |
Stefan Roese | 39271dd | 2008-06-02 14:57:41 +0200 | [diff] [blame] | 25 | /* |
| 26 | * Configure which SDRAM/DDR/DDR2 controller is equipped |
| 27 | */ |
| 28 | #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_405EP) || \ |
| 29 | defined(CONFIG_AP1000) || defined(CONFIG_ML2) |
| 30 | #define CONFIG_SDRAM_PPC4xx_IBM_SDRAM /* IBM SDRAM controller */ |
| 31 | #endif |
| 32 | |
| 33 | #if defined(CONFIG_440GP) || defined(CONFIG_440GX) || \ |
| 34 | defined(CONFIG_440EP) || defined(CONFIG_440GR) |
| 35 | #define CONFIG_SDRAM_PPC4xx_IBM_DDR /* IBM DDR controller */ |
| 36 | #endif |
| 37 | |
| 38 | #if defined(CONFIG_440EPX) || defined(CONFIG_440GRX) |
| 39 | #define CONFIG_SDRAM_PPC4xx_DENALI_DDR2 /* Denali DDR(2) controller */ |
| 40 | #endif |
| 41 | |
| 42 | #if defined(CONFIG_405EX) || \ |
| 43 | defined(CONFIG_440SP) || defined(CONFIG_440SPE) || \ |
Feng Kan | 33384d1 | 2008-07-08 22:48:07 -0700 | [diff] [blame] | 44 | defined(CONFIG_460EX) || defined(CONFIG_460GT) || \ |
| 45 | defined(CONFIG_460SX) |
Stefan Roese | 39271dd | 2008-06-02 14:57:41 +0200 | [diff] [blame] | 46 | #define CONFIG_SDRAM_PPC4xx_IBM_DDR2 /* IBM DDR(2) controller */ |
| 47 | #endif |
| 48 | |
wdenk | 935ecca | 2002-08-06 20:46:37 +0000 | [diff] [blame] | 49 | #if defined(CONFIG_440) |
| 50 | #include <ppc440.h> |
| 51 | #else |
| 52 | #include <ppc405.h> |
| 53 | #endif |
| 54 | |
Stefan Roese | 39271dd | 2008-06-02 14:57:41 +0200 | [diff] [blame] | 55 | #include <asm/ppc4xx-sdram.h> |
Stefan Roese | c415db6 | 2008-06-24 17:18:50 +0200 | [diff] [blame] | 56 | #include <asm/ppc4xx-ebc.h> |
Stefan Roese | 41b1746 | 2008-06-25 10:59:22 +0200 | [diff] [blame^] | 57 | #include <asm/ppc4xx-uic.h> |
Stefan Roese | 39271dd | 2008-06-02 14:57:41 +0200 | [diff] [blame] | 58 | |
Stefan Roese | edd73f2 | 2007-10-21 08:12:41 +0200 | [diff] [blame] | 59 | /* |
Grant Erickson | b693341 | 2008-05-22 14:44:14 -0700 | [diff] [blame] | 60 | * Macro for generating register field mnemonics |
| 61 | */ |
| 62 | #define PPC_REG_BITS 32 |
| 63 | #define PPC_REG_VAL(bit, value) ((value) << ((PPC_REG_BITS - 1) - (bit))) |
| 64 | |
| 65 | /* |
| 66 | * Elide casts when assembling register mnemonics |
| 67 | */ |
| 68 | #ifndef __ASSEMBLY__ |
| 69 | #define static_cast(type, val) (type)(val) |
| 70 | #else |
| 71 | #define static_cast(type, val) (val) |
| 72 | #endif |
| 73 | |
| 74 | /* |
Stefan Roese | edd73f2 | 2007-10-21 08:12:41 +0200 | [diff] [blame] | 75 | * Common stuff for 4xx (405 and 440) |
| 76 | */ |
| 77 | |
| 78 | #define EXC_OFF_SYS_RESET 0x0100 /* System reset */ |
| 79 | #define _START_OFFSET (EXC_OFF_SYS_RESET + 0x2000) |
| 80 | |
| 81 | #define RESET_VECTOR 0xfffffffc |
| 82 | #define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache |
| 83 | line aligned data. */ |
| 84 | |
| 85 | #define CPR0_DCR_BASE 0x0C |
| 86 | #define cprcfga (CPR0_DCR_BASE+0x0) |
| 87 | #define cprcfgd (CPR0_DCR_BASE+0x1) |
| 88 | |
| 89 | #define SDR_DCR_BASE 0x0E |
| 90 | #define sdrcfga (SDR_DCR_BASE+0x0) |
| 91 | #define sdrcfgd (SDR_DCR_BASE+0x1) |
| 92 | |
| 93 | #define SDRAM_DCR_BASE 0x10 |
| 94 | #define memcfga (SDRAM_DCR_BASE+0x0) |
| 95 | #define memcfgd (SDRAM_DCR_BASE+0x1) |
| 96 | |
| 97 | #define EBC_DCR_BASE 0x12 |
| 98 | #define ebccfga (EBC_DCR_BASE+0x0) |
| 99 | #define ebccfgd (EBC_DCR_BASE+0x1) |
| 100 | |
| 101 | /* |
| 102 | * Macros for indirect DCR access |
| 103 | */ |
| 104 | #define mtcpr(reg, d) do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,d); } while (0) |
| 105 | #define mfcpr(reg, d) do { mtdcr(cprcfga,reg);d = mfdcr(cprcfgd); } while (0) |
| 106 | |
| 107 | #define mtebc(reg, d) do { mtdcr(ebccfga,reg);mtdcr(ebccfgd,d); } while (0) |
| 108 | #define mfebc(reg, d) do { mtdcr(ebccfga,reg);d = mfdcr(ebccfgd); } while (0) |
| 109 | |
| 110 | #define mtsdram(reg, d) do { mtdcr(memcfga,reg);mtdcr(memcfgd,d); } while (0) |
| 111 | #define mfsdram(reg, d) do { mtdcr(memcfga,reg);d = mfdcr(memcfgd); } while (0) |
| 112 | |
| 113 | #define mtsdr(reg, d) do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,d); } while (0) |
| 114 | #define mfsdr(reg, d) do { mtdcr(sdrcfga,reg);d = mfdcr(sdrcfgd); } while (0) |
| 115 | |
| 116 | #ifndef __ASSEMBLY__ |
| 117 | |
| 118 | typedef struct |
| 119 | { |
| 120 | unsigned long freqDDR; |
| 121 | unsigned long freqEBC; |
| 122 | unsigned long freqOPB; |
| 123 | unsigned long freqPCI; |
| 124 | unsigned long freqPLB; |
| 125 | unsigned long freqTmrClk; |
| 126 | unsigned long freqUART; |
| 127 | unsigned long freqProcessor; |
| 128 | unsigned long freqVCOHz; |
| 129 | unsigned long freqVCOMhz; /* in MHz */ |
| 130 | unsigned long pciClkSync; /* PCI clock is synchronous */ |
| 131 | unsigned long pciIntArbEn; /* Internal PCI arbiter is enabled */ |
| 132 | unsigned long pllExtBusDiv; |
| 133 | unsigned long pllFbkDiv; |
| 134 | unsigned long pllFwdDiv; |
| 135 | unsigned long pllFwdDivA; |
| 136 | unsigned long pllFwdDivB; |
| 137 | unsigned long pllOpbDiv; |
| 138 | unsigned long pllPciDiv; |
| 139 | unsigned long pllPlbDiv; |
| 140 | } PPC4xx_SYS_INFO; |
| 141 | |
| 142 | #endif /* __ASSEMBLY__ */ |
| 143 | |
wdenk | 935ecca | 2002-08-06 20:46:37 +0000 | [diff] [blame] | 144 | #endif /* __PPC4XX_H__ */ |