cu824.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * (C) Copyright 2001
  3. * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
  4. *
  5. * (C) Copyright 2001-2006
  6. * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #include <common.h>
  26. #include <mpc824x.h>
  27. #include <asm/processor.h>
  28. #include <pci.h>
  29. #include <netdev.h>
  30. DECLARE_GLOBAL_DATA_PTR;
  31. #define BOARD_REV_REG 0xFE80002B
  32. int checkboard (void)
  33. {
  34. char revision = *(volatile char *)(BOARD_REV_REG);
  35. char buf[32];
  36. puts ("Board: CU824 ");
  37. printf("Revision %d ", revision);
  38. printf("Local Bus at %s MHz\n", strmhz(buf, gd->bus_clk));
  39. return 0;
  40. }
  41. phys_size_t initdram(int board_type)
  42. {
  43. long size;
  44. long new_bank0_end;
  45. long mear1;
  46. long emear1;
  47. size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
  48. new_bank0_end = size - 1;
  49. mear1 = mpc824x_mpc107_getreg(MEAR1);
  50. emear1 = mpc824x_mpc107_getreg(EMEAR1);
  51. mear1 = (mear1 & 0xFFFFFF00) |
  52. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
  53. emear1 = (emear1 & 0xFFFFFF00) |
  54. ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
  55. mpc824x_mpc107_setreg(MEAR1, mear1);
  56. mpc824x_mpc107_setreg(EMEAR1, emear1);
  57. return (size);
  58. }
  59. /*
  60. * Initialize PCI Devices, report devices found.
  61. */
  62. #ifndef CONFIG_PCI_PNP
  63. static struct pci_config_table pci_sandpoint_config_table[] = {
  64. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
  65. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  66. PCI_ENET0_MEMADDR,
  67. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
  68. { }
  69. };
  70. #endif
  71. struct pci_controller hose = {
  72. #ifndef CONFIG_PCI_PNP
  73. config_table: pci_sandpoint_config_table,
  74. #endif
  75. };
  76. void pci_init_board(void)
  77. {
  78. pci_mpc824x_init(&hose);
  79. }
  80. int board_eth_init(bd_t *bis)
  81. {
  82. return pci_eth_init(bis);
  83. }