maxbcm.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (C) 2014 Stefan Roese <sr@denx.de>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <miiphy.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/cpu.h>
  10. #include <asm/arch/soc.h>
  11. #include <linux/mbus.h>
  12. DECLARE_GLOBAL_DATA_PTR;
  13. /* Base addresses for the external device chip selects */
  14. #define DEV_CS0_BASE 0xe0000000
  15. #define DEV_CS1_BASE 0xe1000000
  16. #define DEV_CS2_BASE 0xe2000000
  17. #define DEV_CS3_BASE 0xe3000000
  18. /* Needed for dynamic (board-specific) mbus configuration */
  19. extern struct mvebu_mbus_state mbus_state;
  20. int board_early_init_f(void)
  21. {
  22. /*
  23. * Don't configure MPP (pin multiplexing) and GPIO here,
  24. * its already done in bin_hdr
  25. */
  26. /*
  27. * Setup some board specific mbus address windows
  28. */
  29. mbus_dt_setup_win(&mbus_state, DEV_CS0_BASE, 16 << 20,
  30. CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS0);
  31. mbus_dt_setup_win(&mbus_state, DEV_CS1_BASE, 16 << 20,
  32. CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS1);
  33. mbus_dt_setup_win(&mbus_state, DEV_CS2_BASE, 16 << 20,
  34. CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS2);
  35. mbus_dt_setup_win(&mbus_state, DEV_CS3_BASE, 16 << 20,
  36. CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_DEV_CS3);
  37. return 0;
  38. }
  39. int board_init(void)
  40. {
  41. /* adress of boot parameters */
  42. gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
  43. return 0;
  44. }
  45. int checkboard(void)
  46. {
  47. puts("Board: maxBCM\n");
  48. return 0;
  49. }
  50. #ifdef CONFIG_RESET_PHY_R
  51. /* Configure and enable MV88E6185 switch */
  52. void reset_phy(void)
  53. {
  54. u16 devadr = CONFIG_PHY_BASE_ADDR;
  55. char *name = "neta0";
  56. u16 reg;
  57. if (miiphy_set_current_dev(name))
  58. return;
  59. /* todo: fill this with the real setup / config code */
  60. printf("88E6185 Initialized on %s\n", name);
  61. }
  62. #endif /* CONFIG_RESET_PHY_R */