Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2009 Extreme Engineering Solutions, Inc. |
| 3 | * |
| 4 | * See file CREDITS for list of people who contributed to this |
| 5 | * project. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; either version 2 of |
| 10 | * the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 20 | * MA 02111-1307 USA |
| 21 | */ |
| 22 | |
| 23 | #include <common.h> |
| 24 | #include <asm/processor.h> |
| 25 | #include <asm/mmu.h> |
| 26 | #include <asm/io.h> |
| 27 | #include <fdt_support.h> |
| 28 | #include <pca953x.h> |
John Schmoller | 92af6549 | 2010-10-22 00:20:24 -0500 | [diff] [blame] | 29 | #include "../common/fsl_8xxx_misc.h" |
Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 30 | |
| 31 | #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_PCI) |
| 32 | extern void ft_board_pci_setup(void *blob, bd_t *bd); |
| 33 | #endif |
| 34 | |
Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 35 | /* |
| 36 | * Print out which flash was booted from and if booting from the 2nd flash, |
| 37 | * swap flash chip selects to maintain consistent flash numbering/addresses. |
| 38 | */ |
| 39 | static void flash_cs_fixup(void) |
| 40 | { |
Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 41 | int flash_sel; |
| 42 | |
| 43 | /* |
| 44 | * Print boot dev and swap flash flash chip selects if booted from 2nd |
| 45 | * flash. Swapping chip selects presents user with a common memory |
| 46 | * map regardless of which flash was booted from. |
| 47 | */ |
| 48 | flash_sel = !((pca953x_get_val(CONFIG_SYS_I2C_PCA953X_ADDR0) & |
| 49 | CONFIG_SYS_PCA953X_C0_FLASH_PASS_CS)); |
| 50 | printf("FLASH: Executed from FLASH%d\n", flash_sel ? 2 : 1); |
| 51 | |
| 52 | if (flash_sel) { |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 53 | set_lbc_br(0, CONFIG_SYS_BR1_PRELIM); |
| 54 | set_lbc_or(0, CONFIG_SYS_OR1_PRELIM); |
Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 55 | |
Becky Bruce | f51cdaf | 2010-06-17 11:37:20 -0500 | [diff] [blame] | 56 | set_lbc_br(1, CONFIG_SYS_BR0_PRELIM); |
| 57 | set_lbc_or(1, CONFIG_SYS_OR0_PRELIM); |
Peter Tyser | 5da6f80 | 2009-06-30 17:26:01 -0500 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
| 61 | int board_early_init_r(void) |
| 62 | { |
| 63 | /* Initialize PCA9557 devices */ |
| 64 | pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR0, 0xff, 0); |
| 65 | pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR1, 0xff, 0); |
| 66 | pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR2, 0xff, 0); |
| 67 | pca953x_set_pol(CONFIG_SYS_I2C_PCA953X_ADDR3, 0xff, 0); |
| 68 | |
| 69 | flash_cs_fixup(); |
| 70 | |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | #if defined(CONFIG_OF_BOARD_SETUP) |
| 75 | void ft_board_setup(void *blob, bd_t *bd) |
| 76 | { |
| 77 | #ifdef CONFIG_PCI |
| 78 | ft_board_pci_setup(blob, bd); |
| 79 | #endif |
| 80 | ft_cpu_setup(blob, bd); |
| 81 | } |
| 82 | #endif |
| 83 | |
| 84 | #ifdef CONFIG_MP |
| 85 | extern void cpu_mp_lmb_reserve(struct lmb *lmb); |
| 86 | |
| 87 | void board_lmb_reserve(struct lmb *lmb) |
| 88 | { |
| 89 | cpu_mp_lmb_reserve(lmb); |
| 90 | } |
| 91 | #endif |