bcm23550_w1d.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2013 Broadcom Corporation.
  4. */
  5. #include <common.h>
  6. #include <init.h>
  7. #include <log.h>
  8. #include <asm/io.h>
  9. #include <asm/mach-types.h>
  10. #include <env.h>
  11. #include <mmc.h>
  12. #include <asm/kona-common/kona_sdhci.h>
  13. #include <asm/kona-common/clk.h>
  14. #include <asm/arch/sysmap.h>
  15. #include <usb.h>
  16. #include <usb/dwc2_udc.h>
  17. #include <g_dnl.h>
  18. #define SECWATCHDOG_SDOGCR_OFFSET 0x00000000
  19. #define SECWATCHDOG_SDOGCR_EN_SHIFT 27
  20. #define SECWATCHDOG_SDOGCR_SRSTEN_SHIFT 26
  21. #define SECWATCHDOG_SDOGCR_CLKS_SHIFT 20
  22. #define SECWATCHDOG_SDOGCR_LD_SHIFT 0
  23. #ifndef CONFIG_USB_SERIALNO
  24. #define CONFIG_USB_SERIALNO "1234567890"
  25. #endif
  26. DECLARE_GLOBAL_DATA_PTR;
  27. /*
  28. * board_init - early hardware init
  29. */
  30. int board_init(void)
  31. {
  32. printf("Relocation Offset is: %08lx\n", gd->reloc_off);
  33. /* adress of boot parameters */
  34. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  35. clk_init();
  36. return 0;
  37. }
  38. /*
  39. * misc_init_r - miscellaneous platform dependent initializations
  40. */
  41. int misc_init_r(void)
  42. {
  43. return 0;
  44. }
  45. /*
  46. * dram_init - sets uboots idea of sdram size
  47. */
  48. int dram_init(void)
  49. {
  50. gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
  51. CONFIG_SYS_SDRAM_SIZE);
  52. return 0;
  53. }
  54. /* This is called after dram_init() so use get_ram_size result */
  55. int dram_init_banksize(void)
  56. {
  57. gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
  58. gd->bd->bi_dram[0].size = gd->ram_size;
  59. return 0;
  60. }
  61. #ifdef CONFIG_MMC_SDHCI_KONA
  62. /*
  63. * mmc_init - Initializes mmc
  64. */
  65. int board_mmc_init(struct bd_info *bis)
  66. {
  67. int ret = 0;
  68. /* Register eMMC - SDIO2 */
  69. ret = kona_sdhci_init(1, 400000, 0);
  70. if (ret)
  71. return ret;
  72. /* Register SD Card - SDIO4 kona_mmc_init assumes 0 based index */
  73. ret = kona_sdhci_init(3, 400000, 0);
  74. return ret;
  75. }
  76. #endif
  77. #ifdef CONFIG_USB_GADGET
  78. static struct dwc2_plat_otg_data bcm_otg_data = {
  79. .regs_otg = HSOTG_BASE_ADDR
  80. };
  81. int board_usb_init(int index, enum usb_init_type init)
  82. {
  83. debug("%s: performing dwc2_udc_probe\n", __func__);
  84. return dwc2_udc_probe(&bcm_otg_data);
  85. }
  86. int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
  87. {
  88. debug("%s\n", __func__);
  89. if (!env_get("serial#"))
  90. g_dnl_set_serialnumber(CONFIG_USB_SERIALNO);
  91. return 0;
  92. }
  93. int g_dnl_get_board_bcd_device_number(int gcnum)
  94. {
  95. debug("%s\n", __func__);
  96. return 1;
  97. }
  98. int board_usb_cleanup(int index, enum usb_init_type init)
  99. {
  100. debug("%s\n", __func__);
  101. return 0;
  102. }
  103. #endif