gsc.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2013 Gateworks Corporation
  4. *
  5. * Author: Tim Harvey <tharvey@gateworks.com>
  6. */
  7. #ifndef __ASSEMBLY__
  8. /* i2c slave addresses */
  9. #define GSC_SC_ADDR 0x20
  10. #define GSC_RTC_ADDR 0x68
  11. #define GSC_HWMON_ADDR 0x29
  12. #define GSC_EEPROM_ADDR 0x51
  13. /* System Controller registers */
  14. enum {
  15. GSC_SC_CTRL0 = 0x00,
  16. GSC_SC_CTRL1 = 0x01,
  17. GSC_SC_STATUS = 0x0a,
  18. GSC_SC_FWCRC = 0x0c,
  19. GSC_SC_FWVER = 0x0e,
  20. };
  21. /* System Controller Control1 bits */
  22. enum {
  23. GSC_SC_CTRL1_WDTIME = 4, /* 1 = 60s timeout, 0 = 30s timeout */
  24. GSC_SC_CTRL1_WDEN = 5, /* 1 = enable, 0 = disable */
  25. GSC_SC_CTRL1_WDDIS = 7, /* 1 = disable boot watchdog */
  26. };
  27. /* System Controller Interrupt bits */
  28. enum {
  29. GSC_SC_IRQ_PB = 0, /* Pushbutton switch */
  30. GSC_SC_IRQ_SECURE = 1, /* Secure Key erase operation complete */
  31. GSC_SC_IRQ_EEPROM_WP = 2, /* EEPROM write violation */
  32. GSC_SC_IRQ_GPIO = 4, /* GPIO change */
  33. GSC_SC_IRQ_TAMPER = 5, /* Tamper detect */
  34. GSC_SC_IRQ_WATCHDOG = 6, /* Watchdog trip */
  35. GSC_SC_IRQ_PBLONG = 7, /* Pushbutton long hold */
  36. };
  37. /* Hardware Monitor registers */
  38. enum {
  39. GSC_HWMON_TEMP = 0x00,
  40. GSC_HWMON_VIN = 0x02,
  41. GSC_HWMON_VDD_3P3 = 0x05,
  42. GSC_HWMON_VBATT = 0x08,
  43. GSC_HWMON_VDD_5P0 = 0x0b,
  44. GSC_HWMON_VDD_CORE = 0x0e,
  45. GSC_HWMON_VDD_SOC = 0x11,
  46. GSC_HWMON_VDD_HIGH = 0x14,
  47. GSC_HWMON_VDD_DDR = 0x17,
  48. GSC_HWMON_VDD_EXT = 0x1a,
  49. GSC_HWMON_VDD_1P8 = 0x1d,
  50. GSC_HWMON_VDD_IO2 = 0x20,
  51. GSC_HWMON_VDD_2P5 = 0x23,
  52. GSC_HWMON_VDD_IO3 = 0x26,
  53. GSC_HWMON_VDD_IO4 = 0x29,
  54. };
  55. /*
  56. * I2C transactions to the GSC are done via these functions which
  57. * perform retries in the case of a busy GSC NAK'ing the transaction
  58. */
  59. int gsc_i2c_read(uchar chip, uint addr, int alen, uchar *buf, int len);
  60. int gsc_i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len);
  61. int gsc_info(int verbose);
  62. int gsc_boot_wd_disable(void);
  63. const char *gsc_get_dtb_name(int level, char *buf, int sz);
  64. #endif