UPSTREAM: realtek_mst_i2c_spi.c: Update GPIO pin 88 toggle function

Here we provide a helper function to allow indexing MCU configuration
registers. The 0x9F port allows access to these MCU configuration
registers followed by the high and then low bytes of the register
address we wish to index written into 0xF5 or 0xF4 respectively, a
read or write can then be made via 0xF5.

For the configuration of GPIO pins on the chip, there are two relevant
register address, 0x104F for pin direction (sink input or push-pull
in-out) configuration and 0xFE3F for pin data values (1 to push-pull
and 0 to sink). The reference design uses GPIO 88 to strap the
write protection pin and so we provide a function that allows the call
site to toggle this state and therefore de-assert hardware write
protection of the external spi flash.

BUG=b:152558985,b:148745673
BRANCH=none
TEST=builds && verified the write protection get disabled.

Original-Change-Id: I1aed0086f917e31bebb51857ad5cce138158fe82
Original-Signed-off-by: Shiyu Sun <sshiyu@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/46089
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
(cherry picked from commit 8a99a6e210edfb037571bdc5019ca3b224012c03)

Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Change-Id: I7fa7e700fee802acaa158c8714c71031ef2657af
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2477710
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Commit-Queue: Sam McNally <sammc@chromium.org>
1 file changed
tree: d125f91221496eb9df8e0cbbf09ac199fe8d1073
  1. .gitattributes
  2. .gitignore
  3. 82802ab.c
  4. COPYING
  5. Documentation/
  6. Makefile
  7. OWNERS
  8. PRESUBMIT.cfg
  9. README.chromiumos
  10. action_descriptor.c
  11. action_descriptor.h
  12. amd_imc.c
  13. archtest.c
  14. at45db.c
  15. atahpt.c
  16. atapromise.c
  17. atavia.c
  18. big_lock.c
  19. big_lock.h
  20. bitbang_spi.c
  21. board_enable.c
  22. buspirate_spi.c
  23. cbtable.c
  24. ch341a_spi.c
  25. chipdrivers.h
  26. chipset_enable.c
  27. cli_classic.c
  28. cli_common.c
  29. cli_output.c
  30. coreboot_tables.h
  31. cros_ec.c
  32. cros_ec.h
  33. cros_ec_commands.h
  34. cros_ec_dev.c
  35. custom_baud.c
  36. custom_baud.h
  37. dediprog.c
  38. developerbox_spi.c
  39. digilent_spi.c
  40. dmi.c
  41. drkaiser.c
  42. dummyflasher.c
  43. edi.c
  44. edi.h
  45. en29lv640b.c
  46. endiantest.c
  47. ene.h
  48. ene_lpc.c
  49. file.c
  50. file.h
  51. file_lock.c
  52. flash.h
  53. flashchips.c
  54. flashchips.h
  55. flashchips_hwseq.c
  56. flashrom.8.tmpl
  57. flashrom.c
  58. fmap.c
  59. fmap.h
  60. ft2232_spi.c
  61. gfxnvidia.c
  62. helpers.c
  63. hwaccess.c
  64. hwaccess.h
  65. i2c_helper.h
  66. i2c_helper_linux.c
  67. ich_descriptors.c
  68. ich_descriptors.h
  69. ichspi.c
  70. internal.c
  71. ipc_lock.h
  72. it8212.c
  73. it85spi.c
  74. it87spi.c
  75. jedec.c
  76. jlink_spi.c
  77. layout.c
  78. layout.h
  79. libflashrom.h
  80. linux_mtd.c
  81. linux_spi.c
  82. lspcon_i2c_spi.c
  83. m29f400bt.c
  84. mcp6x_spi.c
  85. mec1308.c
  86. meson.build
  87. meson_options.txt
  88. mstarddc_spi.c
  89. ni845x_spi.c
  90. nic3com.c
  91. nicintel.c
  92. nicintel_eeprom.c
  93. nicintel_spi.c
  94. nicnatsemi.c
  95. nicrealtek.c
  96. ogp_spi.c
  97. opaque.c
  98. os.h
  99. pcidev.c
  100. physmap.c
  101. pickit2_spi.c
  102. platform.h
  103. pony_spi.c
  104. power.c
  105. power.h
  106. print.c
  107. print_wiki.c
  108. processor_enable.c
  109. programmer.c
  110. programmer.h
  111. raiden_debug_spi.c
  112. rayer_spi.c
  113. realtek_mst_i2c_spi.c
  114. s25f.c
  115. satamv.c
  116. satasii.c
  117. sb600spi.c
  118. search.c
  119. search.h
  120. serial.c
  121. serprog.c
  122. serprog.h
  123. sfdp.c
  124. sharplhf00l04.c
  125. spi.c
  126. spi.h
  127. spi25.c
  128. spi25_statusreg.c
  129. spi4ba.c
  130. spi4ba.h
  131. spi95.c
  132. sst28sf040.c
  133. sst49lfxxxc.c
  134. sst_fwhub.c
  135. stlinkv3_spi.c
  136. stm50.c
  137. stm50flw0x0x.c
  138. tests/
  139. udelay.c
  140. usb_device.c
  141. usb_device.h
  142. usbblaster_spi.c
  143. usbdev.c
  144. util/
  145. w29ee011.c
  146. w39.c
  147. wbsio_spi.c
  148. wpce775x.c
  149. writeprotect.c
  150. writeprotect.h