blob: 6b23c537888d90ad799a2c24041f1f7efec6d91c [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
2 * (C) Copyright 2001
3 * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
4 *
Wolfgang Denkd87080b2006-03-31 18:32:53 +02005 * (C) Copyright 2001-2006
wdenkc6097192002-11-03 00:24:07 +00006 * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
7
Wolfgang Denk1a459662013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
wdenkc6097192002-11-03 00:24:07 +00009 */
10
11#include <common.h>
12#include <mpc824x.h>
13#include <asm/processor.h>
14#include <pci.h>
Ben Warren8ca0b3f2008-08-31 10:45:44 -070015#include <netdev.h>
wdenkc6097192002-11-03 00:24:07 +000016
Wolfgang Denkd87080b2006-03-31 18:32:53 +020017DECLARE_GLOBAL_DATA_PTR;
18
wdenkc6097192002-11-03 00:24:07 +000019#define BOARD_REV_REG 0xFE80002B
20
21int checkboard (void)
22{
wdenkc6097192002-11-03 00:24:07 +000023 char revision = *(volatile char *)(BOARD_REV_REG);
24 char buf[32];
25
26 puts ("Board: CU824 ");
27 printf("Revision %d ", revision);
28 printf("Local Bus at %s MHz\n", strmhz(buf, gd->bus_clk));
29
30 return 0;
31}
32
Becky Bruce9973e3c2008-06-09 16:03:40 -050033phys_size_t initdram(int board_type)
wdenkc6097192002-11-03 00:24:07 +000034{
wdenkc83bf6a2004-01-06 22:38:14 +000035 long size;
36 long new_bank0_end;
37 long mear1;
38 long emear1;
wdenkc6097192002-11-03 00:24:07 +000039
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020040 size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
wdenkc6097192002-11-03 00:24:07 +000041
wdenkc83bf6a2004-01-06 22:38:14 +000042 new_bank0_end = size - 1;
43 mear1 = mpc824x_mpc107_getreg(MEAR1);
44 emear1 = mpc824x_mpc107_getreg(EMEAR1);
45 mear1 = (mear1 & 0xFFFFFF00) |
46 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
47 emear1 = (emear1 & 0xFFFFFF00) |
48 ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
49 mpc824x_mpc107_setreg(MEAR1, mear1);
50 mpc824x_mpc107_setreg(EMEAR1, emear1);
wdenkc6097192002-11-03 00:24:07 +000051
wdenkc83bf6a2004-01-06 22:38:14 +000052 return (size);
wdenkc6097192002-11-03 00:24:07 +000053}
54
55/*
56 * Initialize PCI Devices, report devices found.
57 */
58#ifndef CONFIG_PCI_PNP
59static struct pci_config_table pci_sandpoint_config_table[] = {
wdenk3bac3512003-03-12 10:41:04 +000060 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
61 pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
62 PCI_ENET0_MEMADDR,
63 PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
64
wdenkc6097192002-11-03 00:24:07 +000065 { }
66};
67#endif
68
69struct pci_controller hose = {
70#ifndef CONFIG_PCI_PNP
71 config_table: pci_sandpoint_config_table,
72#endif
73};
74
stroesead10dd92003-02-14 11:21:23 +000075void pci_init_board(void)
wdenkc6097192002-11-03 00:24:07 +000076{
77 pci_mpc824x_init(&hose);
78}
Ben Warren8ca0b3f2008-08-31 10:45:44 -070079
80int board_eth_init(bd_t *bis)
81{
82 return pci_eth_init(bis);
83}