bcm23550_w1d.c 2.3 KB

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