starfive-jh7100.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2021 Shanghai StarFive Technology Co., Ltd.
  4. * Micheal Zhu <michael.zhu@starfivetech.com>
  5. */
  6. #ifndef __CONFIG_H
  7. #define __CONFIG_H
  8. #include <version.h>
  9. #include <linux/sizes.h>
  10. /*
  11. * Miscellaneous configurable options
  12. */
  13. #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
  14. #define CONFIG_SYS_BOOTM_LEN (64 << 20) /* 64MB */
  15. /*
  16. * Print Buffer Size
  17. */
  18. #define CONFIG_SYS_PBSIZE \
  19. (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
  20. /*
  21. * Boot Argument Buffer Size
  22. */
  23. #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
  24. /*
  25. * max number of command args
  26. */
  27. #define CONFIG_SYS_MAXARGS 16
  28. #define CONFIG_SYS_SDRAM_BASE 0x80000000
  29. /* Init Stack Pointer */
  30. #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M)
  31. #define CONFIG_STANDALONE_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + SZ_2M)
  32. /*mac addr offset in otp*/
  33. #define STARFIVE_OTP_MAC_OFFSET 0x28
  34. /*
  35. * Ethernet
  36. */
  37. #if CONFIG_IS_ENABLED(CMD_NET)
  38. #define CONFIG_DW_ALTDESCRIPTOR
  39. #define CONFIG_ARP_TIMEOUT 0x5000
  40. #endif
  41. /* HACK these should have '#if defined (stuff) around them like zynqp*/
  42. #define BOOT_TARGET_DEVICES(func) func(MMC, mmc, 0) \
  43. func(DHCP, dhcp, na)
  44. #include <config_distro_bootcmd.h>
  45. #include <environment/distro/sf.h>
  46. #define STARLIGHT_FEDORA_BOOTENV \
  47. "bootdir=/boot\0" \
  48. "bootenv=uEnv.txt\0" \
  49. "mmcdev=0\0" \
  50. "mmcpart=3\0"
  51. #define STARLIGHT_TEST_BOOTENV \
  52. "testpart=0:1\0" \
  53. "testenv=u74_uEnv.txt\0" \
  54. "mmcsetup=mmc part\0" \
  55. "fdtsetup=fdt addr ${fdtcontroladdr}\0" \
  56. "fatenv=fatload mmc ${testpart} ${loadaddr} ${testenv};" \
  57. "env import -t ${loadaddr} ${filesize}\0"
  58. #define CONFIG_EXTRA_ENV_SETTINGS \
  59. "fdt_high=0xffffffffffffffff\0" \
  60. "initrd_high=0xffffffffffffffff\0" \
  61. "kernel_addr_r=0x84000000\0" \
  62. "kernel_comp_addr_r=0x90000000\0" \
  63. "kernel_comp_size=0x10000000\0" \
  64. "fdt_addr_r=0x88000000\0" \
  65. "scriptaddr=0x88100000\0" \
  66. "pxefile_addr_r=0x88200000\0" \
  67. "ramdisk_addr_r=0x88300000\0" \
  68. STARLIGHT_FEDORA_BOOTENV \
  69. "loadaddr=0xa0000000\0" \
  70. STARLIGHT_TEST_BOOTENV \
  71. "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
  72. "ext4bootenv=ext4load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootenv}\0" \
  73. "importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
  74. "env import -t ${loadaddr} ${filesize}\0" \
  75. "mmcbootenv=setenv bootpart ${mmcdev}:${mmcpart}; " \
  76. "mmc dev ${mmcdev}; " \
  77. "if mmc rescan; then " \
  78. "run loadbootenv && run importbootenv; " \
  79. "run ext4bootenv && run importbootenv; " \
  80. "if test -n $uenvcmd; then " \
  81. "echo Running uenvcmd ...; " \
  82. "run uenvcmd; " \
  83. "fi; " \
  84. "fi\0" \
  85. "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
  86. BOOTENV \
  87. BOOTENV_SF
  88. #define CONFIG_SYS_MAX_FLASH_SECT 0
  89. #define CONFIG_SYS_MAX_FLASH_BANKS 0
  90. #define __io
  91. /*
  92. * QSPI support
  93. */
  94. #ifdef CONFIG_OF_CONTROL /* QSPI is controlled via DT */
  95. #define CONFIG_CQSPI_REF_CLK (250000000)
  96. #endif
  97. #ifdef CONFIG_ID_EEPROM /* EEPROM for SN and MAC */
  98. #define CONFIG_SYS_EEPROM_BUS_NUM 0
  99. #define FORMAT_VERSION 0x1
  100. #define PCB_VERSION 0x1
  101. #define BOM_VERSION 'A'
  102. /*
  103. * BYTES_PER_EEPROM_PAGE: the 24FC04H datasheet says that data can
  104. * only be written in page mode, which means 16 bytes at a time:
  105. * 16-Byte Page Write Buffer
  106. */
  107. #define BYTES_PER_EEPROM_PAGE 16
  108. /*
  109. * EEPROM_WRITE_DELAY_MS: the 24FC04H datasheet says it takes up to
  110. * 5ms to complete a given write:
  111. * Write Cycle Time (byte or page) ro Page Write Time 5 ms, Maximum
  112. */
  113. #define EEPROM_WRITE_DELAY_MS 5000
  114. /*
  115. * StarFive OUI. Registration Date is 20xx-xx-xx
  116. */
  117. #define STARFIVE_OUI_PREFIX "6C:CF:39:"
  118. #define STARFIVE_DEFAULT_MAC {0x6C, 0xCF, 0x39, 0x08, 0x08, 0x08}
  119. /* Magic number at the first four bytes of EEPROM HATs */
  120. #define STARFIVE_EEPROM_HATS_SIG "SFVF" /* StarFive VisionFive */
  121. #define STARFIVE_EEPROM_HATS_SIZE_MAX 128 /* Header + Atom1&4(v1) */
  122. #define STARFIVE_EEPROM_WP_OFFSET 256 /* Read only field */
  123. #define STARFIVE_EEPROM_ATOM1_PSTR "VF7100A1-2201-D008E000-00000001\0"
  124. #define STARFIVE_EEPROM_ATOM1_PSTR_SIZE 32
  125. #define STARFIVE_EEPROM_ATOM1_SN_OFFSET 23
  126. #define STARFIVE_EEPROM_ATOM1_VSTR "StarFive Technology Co., Ltd.\0\0\0"
  127. #define STARFIVE_EEPROM_ATOM1_VSTR_SIZE 32
  128. #endif
  129. #endif /* __CONFIG_H */