wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. |
| 4 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <mpc824x.h> |
| 10 | #include <pci.h> |
Ben Warren | 1940363 | 2008-08-31 10:03:22 -0700 | [diff] [blame] | 11 | #include <netdev.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 12 | |
| 13 | int checkboard (void) |
| 14 | { |
| 15 | /*TODO: Check processor type */ |
| 16 | |
| 17 | puts ( "Board: Sandpoint " |
| 18 | #ifdef CONFIG_MPC8240 |
| 19 | "8240" |
| 20 | #endif |
| 21 | #ifdef CONFIG_MPC8245 |
| 22 | "8245" |
| 23 | #endif |
| 24 | " Unity ##Test not implemented yet##\n"); |
| 25 | return 0; |
| 26 | } |
| 27 | |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 28 | #if 0 /* NOT USED */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 29 | int checkflash (void) |
| 30 | { |
| 31 | /* TODO: XXX XXX XXX */ |
| 32 | printf ("## Test not implemented yet ##\n"); |
| 33 | |
| 34 | return (0); |
| 35 | } |
| 36 | #endif |
| 37 | |
Becky Bruce | 9973e3c | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 38 | phys_size_t initdram (int board_type) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 39 | { |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 40 | long size; |
| 41 | long new_bank0_end; |
| 42 | long mear1; |
| 43 | long emear1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 44 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 45 | size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 46 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 47 | new_bank0_end = size - 1; |
| 48 | mear1 = mpc824x_mpc107_getreg(MEAR1); |
| 49 | emear1 = mpc824x_mpc107_getreg(EMEAR1); |
| 50 | mear1 = (mear1 & 0xFFFFFF00) | |
| 51 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT); |
| 52 | emear1 = (emear1 & 0xFFFFFF00) | |
| 53 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT); |
| 54 | mpc824x_mpc107_setreg(MEAR1, mear1); |
| 55 | mpc824x_mpc107_setreg(EMEAR1, emear1); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 56 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 57 | return (size); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | /* |
| 61 | * Initialize PCI Devices, report devices found. |
| 62 | */ |
| 63 | #ifndef CONFIG_PCI_PNP |
| 64 | static struct pci_config_table pci_sandpoint_config_table[] = { |
| 65 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID, |
| 66 | pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, |
| 67 | PCI_ENET0_MEMADDR, |
| 68 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, |
| 69 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID, |
| 70 | pci_cfgfunc_config_device, { PCI_ENET1_IOADDR, |
| 71 | PCI_ENET1_MEMADDR, |
| 72 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, |
| 73 | { } |
| 74 | }; |
| 75 | #endif |
| 76 | |
| 77 | struct pci_controller hose = { |
| 78 | #ifndef CONFIG_PCI_PNP |
| 79 | config_table: pci_sandpoint_config_table, |
| 80 | #endif |
| 81 | }; |
| 82 | |
stroese | ad10dd9 | 2003-02-14 11:21:23 +0000 | [diff] [blame] | 83 | void pci_init_board(void) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 84 | { |
| 85 | pci_mpc824x_init(&hose); |
| 86 | } |
Ben Warren | 1940363 | 2008-08-31 10:03:22 -0700 | [diff] [blame] | 87 | |
| 88 | int board_eth_init(bd_t *bis) |
| 89 | { |
| 90 | return pci_eth_init(bis); |
| 91 | } |