wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 1 | PowerPC 440 |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 2 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 3 | Last Update: September 11, 2002 |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 4 | ======================================================================= |
| 5 | |
| 6 | |
| 7 | OVERVIEW |
| 8 | ============ |
| 9 | |
| 10 | Support for the ppc440 is contained in the cpu/ppc44x directory |
| 11 | and enabled via the CONFIG_440 flag. It is largely based on the |
| 12 | 405gp code. A sample board support implementation is contained |
| 13 | in the board/ebony directory. |
| 14 | |
Wolfgang Denk | 0ee7077 | 2005-09-23 11:05:55 +0200 | [diff] [blame] | 15 | All testing was performed using the AMCC Ebony board using both |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 16 | Rev B and Rev C silicon. However, since the Rev B. silicon has |
| 17 | extensive errata, support for Rev B. is minimal (it boots, and |
| 18 | features such as i2c, pci, tftpboot, etc. seem to work ok). |
| 19 | The expectation is that all new board designs will be using |
| 20 | Rev C or later parts -- if not, you may be in for a rough ride ;-) |
| 21 | |
| 22 | The ppc440 port does a fair job of keeping "board-specific" code |
| 23 | out of the "cpu-specific" source. The goal of course was to |
| 24 | provide mechanisms for each board to customize without having |
| 25 | to clutter the cpu-specific source with a lot of ifdefs. Most |
| 26 | of these mechanisms are described in the following sections. |
| 27 | |
| 28 | |
| 29 | MEMORY MANAGEMENT |
| 30 | ================= |
| 31 | |
| 32 | The ppc440 doesn't run in "real mode". The MMU must be active |
| 33 | at all times. Additionally, the 440 implements a 36-bit physical |
| 34 | memory space that gets mapped into the PowerPC 32-bit virtual |
| 35 | address space. So things like memory-mapped peripherals, etc must |
| 36 | all be mapped in. Once this is done, the 32-bit virtual address |
| 37 | space is then viewed as though it were physical memory. |
| 38 | |
| 39 | However, this means that memory, peripherals, etc can be configured |
| 40 | to appear (mostly) anywhere in the virtual address space. Each board |
| 41 | must define its own mappings using the tlbtab (see board/ebony/init.S). |
| 42 | The actual TLB setup is performed by the cpu-specific code. |
| 43 | |
| 44 | Although each board is free to define its own mappings, there are |
| 45 | several definitions to be aware of. These definitions may be used in |
| 46 | the cpu-specific code (vs. board-specific code), so you should |
| 47 | at least review these before deciding to make any changes ... it |
| 48 | will probably save you some headaches ;-) |
| 49 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 50 | CONFIG_SYS_SDRAM_BASE - The virtual address where SDRAM is mapped (always 0) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 51 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 52 | CONFIG_SYS_FLASH_BASE - The virtual address where FLASH is mapped. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 53 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 54 | CONFIG_SYS_PCI_MEMBASE - The virtual address where PCI-bus memory is mapped. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 55 | This mapping provides access to PCI-bus memory. |
| 56 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 57 | CONFIG_SYS_PERIPHERAL_BASE - The virtual address where the 440 memory-mapped |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | peripherals are mapped. (e.g. -- UART registers, IIC registers, etc). |
| 59 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 60 | CONFIG_SYS_ISRAM_BASE - The virtual address where the 440 internal SRAM is |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 61 | mapped. The internal SRAM is equivalent to 405gp OCM and is used |
| 62 | for the initial stack. |
| 63 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 64 | CONFIG_SYS_PCI_BASE - The virtual address where the 440 PCI-x bridge config |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 65 | registers are mapped. |
| 66 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 67 | CONFIG_SYS_PCI_TARGBASE - The PCI address that is mapped to the virtual address |
| 68 | defined by CONFIG_SYS_PCI_MEMBASE. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 69 | |
| 70 | |
| 71 | UART / SERIAL |
| 72 | ================= |
| 73 | |
| 74 | The UART port works fine when an external serial clock is provided |
| 75 | (like the one on the Ebony board) and when using internal clocking. |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 76 | This is controlled with the CONFIG_SYS_EXT_SERIAL_CLOCK flag. When using |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 77 | internal clocking, the "ideal baud rate" settings in the 440GP |
| 78 | user manual are automatically calculated. |
| 79 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 80 | |
| 81 | I2C |
| 82 | ================= |
| 83 | |
| 84 | The i2c utilities have been tested on both Rev B. and Rev C. and |
Peter Tyser | 469cde4 | 2009-04-18 22:34:03 -0500 | [diff] [blame] | 85 | look good. The 'i2c probe' command implementation has been updated to |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 86 | allow for 'skipped' addresses. Some i2c slaves are write only and |
| 87 | cause problems when a probe (read) is performed (for example the |
| 88 | CDCV850 clock controller at address 0x69 on the ebony board). |
| 89 | |
| 90 | To prevent probing certain addresses you can define the |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 91 | CONFIG_SYS_I2C_NOPROBES macro in your board-specific header file. When |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 92 | defined, all specified addresses are skipped during a probe. |
| 93 | The addresses that are skipped will be displayed in the output |
Peter Tyser | 469cde4 | 2009-04-18 22:34:03 -0500 | [diff] [blame] | 94 | of the 'i2c probe' command. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 95 | |
| 96 | For example, to prevent probing address 0x69, define the macro as |
| 97 | follows: |
| 98 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 99 | #define CONFIG_SYS_I2C_NOPROBES {0x69} |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 100 | |
| 101 | Similarly, to prevent probing addresses 0x69 and 0x70, define the |
| 102 | macro a: |
| 103 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 104 | #define CONFIG_SYS_I2C_NOPROBES {0x69, 0x70} |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 105 | |
| 106 | |
| 107 | DDR SDRAM CONTROLLER |
| 108 | ==================== |
| 109 | |
| 110 | SDRAM controller intialization using Serial Presence Detect (SPD) is |
| 111 | now supported (thanks Jun). It is enabled by defining CONFIG_SPD_EEPROM. |
| 112 | The i2c eeprom addresses are controlled by the SPD_EEPROM_ADDRESS macro. |
| 113 | |
| 114 | NOTE: The SPD_EEPROM_ADDRESS macro is defined differently than for other |
| 115 | processors. Traditionally, it defined a single address. For the 440 it |
| 116 | defines an array of addresses to support multiple banks. Address order |
| 117 | is significant: the addresses are used in order to program the BankN |
| 118 | registers. For example, two banks with i2c addresses of 0x53 (bank 0) |
| 119 | and 0x52 (bank 1) would be defined as follows: |
| 120 | |
| 121 | #define SPD_EEPROM_ADDRESS {0x53,0x52} |
| 122 | |
| 123 | |
| 124 | PCI-X BRIDGE |
| 125 | ==================== |
| 126 | |
| 127 | PCI is an area that requires lots of flexibility since every board has |
| 128 | its own set of constraints and configuration. This section describes the |
| 129 | 440 implementation. |
| 130 | |
| 131 | CPC0_STRP1[PISE] -- if the PISE strap bit is not asserted, PCI init |
| 132 | is aborted and an indication is printed. This is NOT considered an |
| 133 | error -- only an indication that PCI shouldn't be initialized. This |
| 134 | gives you a chance to edit the i2c bootstrap eeproms using the i2c |
| 135 | utilities once you get to the U-Boot command prompt. NOTE: the default |
| 136 | 440 bootstrap options (not using i2c eeprom) negates this bit. |
| 137 | |
| 138 | The cpu-specific code sets up a default pci_controller structure |
| 139 | that maps in a single PCI I/O space and PCI memory space. The I/O |
| 140 | space begins at PCI I/O address 0 and the PCI memory space is |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 141 | 256 MB starting at PCI address CONFIG_SYS_PCI_TARGBASE. After the |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 142 | pci_controller structure is initialized, the cpu-specific code will |
Stefan Roese | 54ef7fd | 2007-06-25 15:57:39 +0200 | [diff] [blame] | 143 | call the routine pci_pre_init(). This routine is implemented by |
| 144 | board-specific code & is where the board can over-ride/extend the |
| 145 | default pci_controller structure settings and exspecially provide |
| 146 | a routine to map the PCI interrupts and do other pre-initialization |
| 147 | tasks. If pci_pre_init() returns a value of zero, PCI initialization |
| 148 | is aborted; otherwise the controller structure is registered and |
| 149 | initialization continues. |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 150 | |
| 151 | The default 440GP PCI target configuration is minimal -- it assumes that |
| 152 | the strapping registers are set as necessary. Since the strapping bits |
| 153 | provide very limited flexibility, you may want to customize the boards |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 154 | target configuration. If CONFIG_SYS_PCI_TARGET_INIT is defined, the cpu-specific |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 155 | code will call the routine pci_target_init() which you must implement |
| 156 | in your board-specific code. |
| 157 | |
| 158 | Target initialization is completed by the cpu-specific code by |
| 159 | initializing the subsystem id and subsystem vendor id, and then ensuring |
| 160 | that the 'enable host configuration' bit in the PCIX0_BRDGOPT2 is set. |
| 161 | |
| 162 | The default PCI master initialization maps in 256 MB of pci memory |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 163 | starting at PCI address CONFIG_SYS_PCI_MEMBASE. To customize this, define |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 164 | PCI_MASTER_INIT. This will call the routine pci_master_init() in your |
| 165 | board-specific code rather than performing the default master |
| 166 | initialization. |
| 167 | |
| 168 | The decision to perform PCI host configuration must often be determined |
| 169 | at run time. The ppc440 port differs from most other implementations in |
| 170 | that it requires the board to determine its host configuration at run |
| 171 | time rather than by using compile-time flags. This shouldn't create a |
| 172 | large impact on the board-specific code since the board only needs to |
| 173 | implement a single routine that returns a zero or non-zero value: |
| 174 | is_pci_host(). |
| 175 | |
| 176 | Justification for this becomes clear when considering systems running |
| 177 | in a cPCI environment: |
| 178 | |
| 179 | 1. Arbiter strapping: Many cPCI boards provide an external arbiter (often |
| 180 | part of the PCI-to-PCI bridge). Even though the arbiter is external (the |
| 181 | arbiter strapping is negated), the CPU may still be required to perform |
| 182 | local PCI bus configuration. |
| 183 | |
| 184 | 2. Host only: PPMC boards must sample the MONARCH# signal at run-time. |
| 185 | Depending on the configuration of the carrier boar, the PPMC board must |
| 186 | determine if it should configure the PCI bus at run-time. And in most |
| 187 | cases, access to the MONARCH# signal is board-specific (e.g. via |
| 188 | board-specific FPGA registers, etc). |
| 189 | |
| 190 | In any event, the is_pci_host() routine gives each board the opportunity |
| 191 | to decide at run-time. If your board is always configured a certain way, |
| 192 | then just hardcode a return of 1 or 0 as appropriate. |
| 193 | |
| 194 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 195 | Regards, |
| 196 | --Scott |
| 197 | <smcnutt@artesyncp.com> |