mpc8308_p1m.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2010 Freescale Semiconductor, Inc.
  4. * Copyright (C) 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com
  5. */
  6. #include <common.h>
  7. #include <i2c.h>
  8. #include <init.h>
  9. #include <linux/libfdt.h>
  10. #include <fdt_support.h>
  11. #include <pci.h>
  12. #include <mpc83xx.h>
  13. #include <netdev.h>
  14. #include <asm/io.h>
  15. #include <asm/fsl_serdes.h>
  16. #include <asm/fsl_mpc83xx_serdes.h>
  17. int checkboard(void)
  18. {
  19. printf("Board: MPC8308 P1M\n");
  20. return 0;
  21. }
  22. static struct pci_region pcie_regions_0[] = {
  23. {
  24. .bus_start = CONFIG_SYS_PCIE1_MEM_BASE,
  25. .phys_start = CONFIG_SYS_PCIE1_MEM_PHYS,
  26. .size = CONFIG_SYS_PCIE1_MEM_SIZE,
  27. .flags = PCI_REGION_MEM,
  28. },
  29. {
  30. .bus_start = CONFIG_SYS_PCIE1_IO_BASE,
  31. .phys_start = CONFIG_SYS_PCIE1_IO_PHYS,
  32. .size = CONFIG_SYS_PCIE1_IO_SIZE,
  33. .flags = PCI_REGION_IO,
  34. },
  35. };
  36. void pci_init_board(void)
  37. {
  38. immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
  39. sysconf83xx_t *sysconf = &immr->sysconf;
  40. law83xx_t *pcie_law = sysconf->pcielaw;
  41. struct pci_region *pcie_reg[] = { pcie_regions_0 };
  42. fsl_setup_serdes(CONFIG_FSL_SERDES1, FSL_SERDES_PROTO_PEX,
  43. FSL_SERDES_CLK_100, FSL_SERDES_VDD_1V);
  44. /* Deassert the resets in the control register */
  45. out_be32(&sysconf->pecr1, 0xE0008000);
  46. udelay(2000);
  47. /* Configure PCI Express Local Access Windows */
  48. out_be32(&pcie_law[0].bar, CONFIG_SYS_PCIE1_BASE & LAWBAR_BAR);
  49. out_be32(&pcie_law[0].ar, LBLAWAR_EN | LBLAWAR_512MB);
  50. mpc83xx_pcie_init(1, pcie_reg);
  51. }
  52. #if defined(CONFIG_OF_BOARD_SETUP)
  53. int ft_board_setup(void *blob, bd_t *bd)
  54. {
  55. ft_cpu_setup(blob, bd);
  56. fsl_fdt_fixup_dr_usb(blob, bd);
  57. return 0;
  58. }
  59. #endif
  60. int board_eth_init(bd_t *bis)
  61. {
  62. int rv, num_if = 0;
  63. /* Initialize TSECs first */
  64. rv = cpu_eth_init(bis);
  65. if (rv >= 0)
  66. num_if += rv;
  67. else
  68. printf("ERROR: failed to initialize TSECs.\n");
  69. rv = pci_eth_init(bis);
  70. if (rv >= 0)
  71. num_if += rv;
  72. else
  73. printf("ERROR: failed to initialize PCI Ethernet.\n");
  74. return num_if;
  75. }