starfive-jh7100.h 3.9 KB

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