wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001 |
| 3 | * Rob Taylor, Flying Pig Systems. robt@flyingpig.com. |
| 4 | * |
| 5 | * (C) Copyright 2002 |
| 6 | * Gregory E. Allen, gallen@arlut.utexas.edu |
| 7 | * Matthew E. Karger, karger@arlut.utexas.edu |
| 8 | * Applied Research Laboratories, The University of Texas at Austin |
| 9 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <common.h> |
| 14 | #include <mpc824x.h> |
| 15 | #include <asm/processor.h> |
| 16 | #include <asm/io.h> |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 17 | #include <asm/mmu.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 18 | #include <pci.h> |
Ben Warren | 052a5ea | 2008-08-31 20:37:00 -0700 | [diff] [blame] | 19 | #include <netdev.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 20 | |
| 21 | #define SAVE_SZ 32 |
| 22 | |
| 23 | |
| 24 | int checkboard(void) |
| 25 | { |
| 26 | ulong busfreq = get_bus_freq(0); |
| 27 | char buf[32]; |
| 28 | |
| 29 | printf("Board: UTX8245 Local Bus at %s MHz\n", strmhz(buf, busfreq)); |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | |
Becky Bruce | bd99ae7 | 2008-06-09 16:03:40 -0500 | [diff] [blame] | 34 | phys_size_t initdram(int board_type) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 35 | { |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 36 | long size; |
| 37 | long new_bank0_end; |
wdenk | 19c8fb7 | 2004-04-18 22:26:17 +0000 | [diff] [blame] | 38 | long new_bank1_end; |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 39 | long mear1; |
| 40 | long emear1; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 41 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 43 | |
wdenk | 19c8fb7 | 2004-04-18 22:26:17 +0000 | [diff] [blame] | 44 | new_bank0_end = size/2 - 1; |
| 45 | new_bank1_end = size - 1; |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 46 | mear1 = mpc824x_mpc107_getreg(MEAR1); |
| 47 | emear1 = mpc824x_mpc107_getreg(EMEAR1); |
wdenk | 19c8fb7 | 2004-04-18 22:26:17 +0000 | [diff] [blame] | 48 | |
| 49 | mear1 = (mear1 & 0xFFFF0000) | |
| 50 | ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT) | |
| 51 | ((new_bank1_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT << 8); |
| 52 | emear1 = (emear1 & 0xFFFF0000) | |
| 53 | ((new_bank0_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT) | |
| 54 | ((new_bank1_end & MICR_EADDR_MASK) >> MICR_EADDR_SHIFT << 8); |
wdenk | e44b911 | 2004-04-18 23:32:11 +0000 | [diff] [blame] | 55 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 56 | mpc824x_mpc107_setreg(MEAR1, mear1); |
| 57 | mpc824x_mpc107_setreg(EMEAR1, emear1); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | |
wdenk | 87249ba | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 59 | return (size); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | |
| 63 | /* |
| 64 | * Initialize PCI Devices, report devices found. |
| 65 | */ |
| 66 | |
| 67 | static struct pci_config_table pci_utx8245_config_table[] = { |
| 68 | #ifndef CONFIG_PCI_PNP |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 69 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0C, PCI_ANY_ID, |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 70 | pci_cfgfunc_config_device, { PCI_ENET0_IOADDR, |
| 71 | PCI_ENET0_MEMADDR, |
| 72 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 73 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0B, PCI_ANY_ID, |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 74 | pci_cfgfunc_config_device, { PCI_FIREWIRE_IOADDR, |
| 75 | PCI_FIREWIRE_MEMADDR, |
| 76 | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }}, |
| 77 | #endif /*CONFIG_PCI_PNP*/ |
| 78 | { } |
| 79 | }; |
| 80 | |
| 81 | |
| 82 | static void pci_utx8245_fixup_irq(struct pci_controller *hose, pci_dev_t dev) |
| 83 | { |
| 84 | if (PCI_DEV(dev) == 11) |
| 85 | /* assign serial interrupt line 9 (int25) to FireWire */ |
| 86 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 25); |
| 87 | |
| 88 | else if (PCI_DEV(dev) == 12) |
| 89 | /* assign serial interrupt line 8 (int24) to Ethernet */ |
| 90 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 24); |
wdenk | abda5ca | 2003-05-31 18:35:21 +0000 | [diff] [blame] | 91 | |
| 92 | else if (PCI_DEV(dev) == 14) |
| 93 | /* assign serial interrupt line 0 (int16) to PMC slot 0 */ |
| 94 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 16); |
| 95 | |
| 96 | else if (PCI_DEV(dev) == 15) |
| 97 | /* assign serial interrupt line 1 (int17) to PMC slot 1 */ |
| 98 | pci_hose_write_config_byte(hose, dev, PCI_INTERRUPT_LINE, 17); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | static struct pci_controller utx8245_hose = { |
| 102 | #ifndef CONFIG_PCI_PNP |
| 103 | config_table: pci_utx8245_config_table, |
| 104 | fixup_irq: pci_utx8245_fixup_irq, |
| 105 | write_byte: pci_hose_write_config_byte |
| 106 | #endif /*CONFIG_PCI_PNP*/ |
| 107 | }; |
| 108 | |
stroese | f5dd410 | 2003-02-14 11:21:23 +0000 | [diff] [blame] | 109 | void pci_init_board (void) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 110 | { |
| 111 | pci_mpc824x_init(&utx8245_hose); |
| 112 | |
| 113 | icache_enable(); |
| 114 | } |
Ben Warren | 052a5ea | 2008-08-31 20:37:00 -0700 | [diff] [blame] | 115 | |
| 116 | int board_eth_init(bd_t *bis) |
| 117 | { |
| 118 | return pci_eth_init(bis); |
| 119 | } |