mpc8308_p1m.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (C) 2010 Freescale Semiconductor, Inc.
  3. * Copyright (C) 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <i2c.h>
  25. #include <libfdt.h>
  26. #include <fdt_support.h>
  27. #include <pci.h>
  28. #include <mpc83xx.h>
  29. #include <netdev.h>
  30. #include <asm/io.h>
  31. #include <asm/fsl_serdes.h>
  32. #include <asm/fsl_mpc83xx_serdes.h>
  33. DECLARE_GLOBAL_DATA_PTR;
  34. int checkboard(void)
  35. {
  36. printf("Board: MPC8308 P1M\n");
  37. return 0;
  38. }
  39. static struct pci_region pcie_regions_0[] = {
  40. {
  41. .bus_start = CONFIG_SYS_PCIE1_MEM_BASE,
  42. .phys_start = CONFIG_SYS_PCIE1_MEM_PHYS,
  43. .size = CONFIG_SYS_PCIE1_MEM_SIZE,
  44. .flags = PCI_REGION_MEM,
  45. },
  46. {
  47. .bus_start = CONFIG_SYS_PCIE1_IO_BASE,
  48. .phys_start = CONFIG_SYS_PCIE1_IO_PHYS,
  49. .size = CONFIG_SYS_PCIE1_IO_SIZE,
  50. .flags = PCI_REGION_IO,
  51. },
  52. };
  53. void pci_init_board(void)
  54. {
  55. immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  56. sysconf83xx_t *sysconf = &immr->sysconf;
  57. law83xx_t *pcie_law = sysconf->pcielaw;
  58. struct pci_region *pcie_reg[] = { pcie_regions_0 };
  59. fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
  60. FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
  61. /* Deassert the resets in the control register */
  62. out_be32(&sysconf->pecr1, 0xE0008000);
  63. udelay(2000);
  64. /* Configure PCI Express Local Access Windows */
  65. out_be32(&pcie_law[0].bar, CONFIG_SYS_PCIE1_BASE & LAWBAR_BAR);
  66. out_be32(&pcie_law[0].ar, LBLAWAR_EN | LBLAWAR_512MB);
  67. mpc83xx_pcie_init(1, pcie_reg);
  68. }
  69. #if defined(CONFIG_OF_BOARD_SETUP)
  70. void ft_board_setup(void *blob, bd_t *bd)
  71. {
  72. ft_cpu_setup(blob, bd);
  73. fdt_fixup_dr_usb(blob, bd);
  74. }
  75. #endif
  76. int board_eth_init(bd_t *bis)
  77. {
  78. int rv, num_if = 0;
  79. /* Initialize TSECs first */
  80. rv = cpu_eth_init(bis);
  81. if (rv >= 0)
  82. num_if += rv;
  83. else
  84. printf("ERROR: failed to initialize TSECs.\n");
  85. rv = pci_eth_init(bis);
  86. if (rv >= 0)
  87. num_if += rv;
  88. else
  89. printf("ERROR: failed to initialize PCI Ethernet.\n");
  90. return num_if;
  91. }