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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <command.h> |
| 13 | #include <malloc.h> |
| 14 | #include <environment.h> |
| 15 | #include <logbuff.h> |
| 16 | #include <post.h> |
| 17 | |
| 18 | #include <asm/processor.h> |
| 19 | #include <asm/io.h> |
Stefan Roese | de21eab | 2010-09-16 14:30:37 +0200 | [diff] [blame] | 20 | #include <asm/ppc4xx-gpio.h> |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | int board_early_init_f(void) |
| 25 | { |
| 26 | /* taken from PPCBoot */ |
Stefan Roese | 707fd36 | 2009-09-24 09:55:50 +0200 | [diff] [blame] | 27 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 28 | mtdcr(UIC0ER, 0x00000000); /* disable all ints */ |
| 29 | mtdcr(UIC0CR, 0x00000000); |
| 30 | mtdcr(UIC0PR, 0xFFFF7FFE); /* set int polarities */ |
| 31 | mtdcr(UIC0TR, 0x00000000); /* set int trigger levels */ |
| 32 | mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */ |
| 33 | mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority */ |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 34 | |
| 35 | mtdcr(CPC0_SRR, 0x00040000); /* Hold PCI bridge in reset */ |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | /* |
| 41 | * Check Board Identity: |
| 42 | */ |
| 43 | int checkboard(void) |
| 44 | { |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 45 | char buf[64]; |
| 46 | int i = getenv_f("serial#", buf, sizeof(buf)); |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 47 | #ifdef DISPLAY_BOARD_INFO |
| 48 | sys_info_t sysinfo; |
| 49 | #endif |
| 50 | |
| 51 | puts("Board: Quad100hd"); |
| 52 | |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 53 | if (i > 0) { |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 54 | puts(", serial# "); |
Wolfgang Denk | 5c1cfee | 2011-05-04 10:32:28 +0000 | [diff] [blame] | 55 | puts(buf); |
Gary Jennejohn | 0ec4f30 | 2008-04-28 14:04:32 +0200 | [diff] [blame] | 56 | } |
| 57 | putc('\n'); |
| 58 | |
| 59 | #ifdef DISPLAY_BOARD_INFO |
| 60 | /* taken from ppcboot */ |
| 61 | get_sys_info(&sysinfo); |
| 62 | |
| 63 | printf("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz); |
| 64 | printf("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000); |
| 65 | printf("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000); |
| 66 | printf("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000); |
| 67 | printf("\tEPB: %lu MHz\n", sysinfo.freqPLB / (sysinfo.pllExtBusDiv * |
| 68 | 1000000)); |
| 69 | printf("\tPCI: %lu MHz\n", sysinfo.freqPCI / 1000000); |
| 70 | #endif |
| 71 | |
| 72 | return 0; |
| 73 | } |