wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. |
| 4 | * |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 5 | * Modified during 2003 by |
| 6 | * Ken Chou, kchou@ieee.org |
| 7 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <mpc824x.h> |
| 13 | #include <pci.h> |
Ben Warren | b902b8d | 2008-08-31 10:07:16 -0700 | [diff] [blame] | 14 | #include <netdev.h> |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 15 | |
| 16 | int checkboard (void) |
| 17 | { |
| 18 | ulong busfreq = get_bus_freq(0); |
| 19 | char buf[32]; |
| 20 | |
| 21 | printf("Board: A3000 Local Bus at %s MHz\n", strmhz(buf, busfreq)); |
| 22 | return 0; |
| 23 | |
| 24 | } |
| 25 | |
Becky Bruce | 9973e3c | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 26 | phys_size_t initdram (int board_type) |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 27 | { |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 28 | long size; |
| 29 | long new_bank0_end; |
| 30 | long mear1; |
| 31 | long emear1; |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 32 | |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 33 | size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE); |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 34 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 35 | new_bank0_end = size - 1; |
| 36 | mear1 = mpc824x_mpc107_getreg(MEAR1); |
| 37 | emear1 = mpc824x_mpc107_getreg(EMEAR1); |
| 38 | mear1 = (mear1 & 0xFFFFFF00) | |
| 39 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT); |
| 40 | emear1 = (emear1 & 0xFFFFFF00) | |
| 41 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT); |
| 42 | mpc824x_mpc107_setreg(MEAR1, mear1); |
| 43 | mpc824x_mpc107_setreg(EMEAR1, emear1); |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 44 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 45 | return (size); |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | /* |
| 49 | * Initialize PCI Devices |
| 50 | */ |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 51 | #ifndef CONFIG_PCI_PNP |
| 52 | static struct pci_config_table pci_a3000_config_table[] = { |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 53 | /* vendor, device, class */ |
| 54 | /* bus, dev, func */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 55 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_83815, PCI_ANY_ID, |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 56 | PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, /* dp83815 eth0 divice */ |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 57 | pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, |
| 58 | PCI_ENET0_MEMADDR, |
| 59 | PCI_COMMAND_IO | |
| 60 | PCI_COMMAND_MEMORY | |
| 61 | PCI_COMMAND_MASTER }}, |
| 62 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 63 | PCI_ANY_ID, 0x14, PCI_ANY_ID, /* PCI slot1 */ |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 64 | pci_cfgfunc_config_device, { PCI_ENET1_IOADDR, |
| 65 | PCI_ENET1_MEMADDR, |
| 66 | PCI_COMMAND_IO | |
| 67 | PCI_COMMAND_MEMORY | |
| 68 | PCI_COMMAND_MASTER }}, |
| 69 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
Wolfgang Denk | 53677ef | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 70 | PCI_ANY_ID, 0x15, PCI_ANY_ID, /* PCI slot2 */ |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 71 | pci_cfgfunc_config_device, { PCI_ENET2_IOADDR, |
| 72 | PCI_ENET2_MEMADDR, |
| 73 | PCI_COMMAND_IO | |
| 74 | PCI_COMMAND_MEMORY | |
| 75 | PCI_COMMAND_MASTER }}, |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 76 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 77 | PCI_ANY_ID, 0x16, PCI_ANY_ID, /* PCI slot3 */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 78 | pci_cfgfunc_config_device, { PCI_ENET3_IOADDR, |
| 79 | PCI_ENET3_MEMADDR, |
| 80 | PCI_COMMAND_IO | |
| 81 | PCI_COMMAND_MEMORY | |
| 82 | PCI_COMMAND_MASTER }}, |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 83 | { } |
| 84 | }; |
| 85 | #endif |
| 86 | |
wdenk | 0332990 | 2003-06-20 22:36:30 +0000 | [diff] [blame] | 87 | struct pci_controller hose = { |
| 88 | #ifndef CONFIG_PCI_PNP |
| 89 | config_table: pci_a3000_config_table, |
| 90 | #endif |
| 91 | }; |
| 92 | |
| 93 | void pci_init_board(void) |
| 94 | { |
| 95 | pci_mpc824x_init(&hose); |
| 96 | } |
Ben Warren | b902b8d | 2008-08-31 10:07:16 -0700 | [diff] [blame] | 97 | |
| 98 | int board_eth_init(bd_t *bis) |
| 99 | { |
| 100 | return pci_eth_init(bis); |
| 101 | } |