Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2008 |
| 3 | * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de. |
| 4 | * |
| 5 | * Based in part on board/icecube/icecube.c from PPCBoot |
| 6 | * (C) Copyright 2003 Intrinsyc Software |
| 7 | * |
| 8 | * See file CREDITS for list of people who contributed to this |
| 9 | * project. |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU General Public License as |
| 13 | * published by the Free Software Foundation; either version 2 of |
| 14 | * the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This program is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 24 | * MA 02111-1307 USA |
| 25 | */ |
| 26 | |
| 27 | #include <common.h> |
| 28 | #include <command.h> |
| 29 | #include <malloc.h> |
| 30 | #include <environment.h> |
| 31 | #include <logbuff.h> |
| 32 | #include <post.h> |
| 33 | |
| 34 | #include <asm/processor.h> |
| 35 | #include <asm/io.h> |
Stefan Roese | de21eab | 2010-09-16 14:30:37 +0200 | [diff] [blame] | 36 | #include <asm/ppc4xx-gpio.h> |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 37 | |
| 38 | DECLARE_GLOBAL_DATA_PTR; |
| 39 | |
| 40 | int board_early_init_f(void) |
| 41 | { |
| 42 | /* taken from PPCBoot */ |
Stefan Roese | 707fd36 | 2009-09-24 09:55:50 +0200 | [diff] [blame] | 43 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 44 | mtdcr(UIC0ER, 0x00000000); /* disable all ints */ |
| 45 | mtdcr(UIC0CR, 0x00000000); |
| 46 | mtdcr(UIC0PR, 0xFFFF7FFE); /* set int polarities */ |
| 47 | mtdcr(UIC0TR, 0x00000000); /* set int trigger levels */ |
| 48 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 49 | mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */ |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 50 | |
| 51 | mtdcr(CPC0_SRR, 0x00040000); /* Hold PCI bridge in reset */ |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | /* |
| 57 | * Check Board Identity: |
| 58 | */ |
| 59 | int checkboard(void) |
| 60 | { |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame^] | 61 | char buf[64]; |
| 62 | int i = getenv_f("serial#", buf, sizeof(buf)); |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 63 | #ifdef DISPLAY_BOARD_INFO |
| 64 | sys_info_t sysinfo; |
| 65 | #endif |
| 66 | |
| 67 | puts("Board: Quad100hd"); |
| 68 | |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame^] | 69 | if (i > 0) { |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 70 | puts(", serial# "); |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame^] | 71 | puts(buf); |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 72 | } |
| 73 | putc('\n'); |
| 74 | |
| 75 | #ifdef DISPLAY_BOARD_INFO |
| 76 | /* taken from ppcboot */ |
| 77 | get_sys_info(&sysinfo); |
| 78 | |
| 79 | printf("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz); |
| 80 | printf("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000); |
| 81 | printf("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000); |
| 82 | printf("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000); |
| 83 | printf("\tEPB: %lu MHz\n", sysinfo.freqPLB / (sysinfo.pllExtBusDiv * |
| 84 | 1000000)); |
| 85 | printf("\tPCI: %lu MHz\n", sysinfo.freqPCI / 1000000); |
| 86 | #endif |
| 87 | |
| 88 | return 0; |
| 89 | } |