gsc.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2022 Gateworks Corporation
  4. */
  5. #include <command.h>
  6. #include <gsc.h>
  7. #include <i2c.h>
  8. #include <rtc.h>
  9. #include <asm/unaligned.h>
  10. #include <linux/delay.h>
  11. #include <dm/device.h>
  12. #include <dm/device-internal.h>
  13. #include <dm/ofnode.h>
  14. #include <dm/read.h>
  15. #define GSC_BUSNO 0
  16. #define GSC_SC_ADDR 0x20
  17. #define GSC_HWMON_ADDR 0x29
  18. #define GSC_RTC_ADDR 0x68
  19. /* System Controller registers */
  20. enum {
  21. GSC_SC_CTRL0 = 0,
  22. GSC_SC_CTRL1 = 1,
  23. GSC_SC_TIME = 2,
  24. GSC_SC_TIME_ADD = 6,
  25. GSC_SC_STATUS = 10,
  26. GSC_SC_FWCRC = 12,
  27. GSC_SC_FWVER = 14,
  28. GSC_SC_WP = 15,
  29. GSC_SC_RST_CAUSE = 16,
  30. GSC_SC_THERM_PROTECT = 19,
  31. };
  32. /* System Controller Control1 bits */
  33. enum {
  34. GSC_SC_CTRL1_SLEEP_EN = 0, /* 1 = enable sleep */
  35. GSC_SC_CTRL1_SLEEP_ACTIVATE = 1, /* 1 = activate sleep */
  36. GSC_SC_CTRL1_SLEEP_ADD = 2, /* 1 = latch and add sleep time */
  37. GSC_SC_CTRL1_SLEEP_NOWAKEPB = 3, /* 1 = do not wake on sleep on button press */
  38. GSC_SC_CTRL1_WDTIME = 4, /* 1 = 60s timeout, 0 = 30s timeout */
  39. GSC_SC_CTRL1_WDEN = 5, /* 1 = enable, 0 = disable */
  40. GSC_SC_CTRL1_BOOT_CHK = 6, /* 1 = enable alt boot check */
  41. GSC_SC_CTRL1_WDDIS = 7, /* 1 = disable boot watchdog */
  42. };
  43. /* System Controller Interrupt bits */
  44. enum {
  45. GSC_SC_IRQ_PB = 0, /* Pushbutton switch */
  46. GSC_SC_IRQ_SECURE = 1, /* Secure Key erase operation complete */
  47. GSC_SC_IRQ_EEPROM_WP = 2, /* EEPROM write violation */
  48. GSC_SC_IRQ_GPIO = 4, /* GPIO change */
  49. GSC_SC_IRQ_TAMPER = 5, /* Tamper detect */
  50. GSC_SC_IRQ_WATCHDOG = 6, /* Watchdog trip */
  51. GSC_SC_IRQ_PBLONG = 7, /* Pushbutton long hold */
  52. };
  53. /* System Controller WP bits */
  54. enum {
  55. GSC_SC_WP_ALL = 0, /* Write Protect All EEPROM regions */
  56. GSC_SC_WP_BOARDINFO = 1, /* Write Protect Board Info region */
  57. };
  58. /* System Controller Reset Cause */
  59. enum {
  60. GSC_SC_RST_CAUSE_VIN = 0,
  61. GSC_SC_RST_CAUSE_PB = 1,
  62. GSC_SC_RST_CAUSE_WDT = 2,
  63. GSC_SC_RST_CAUSE_CPU = 3,
  64. GSC_SC_RST_CAUSE_TEMP_LOCAL = 4,
  65. GSC_SC_RST_CAUSE_TEMP_REMOTE = 5,
  66. GSC_SC_RST_CAUSE_SLEEP = 6,
  67. GSC_SC_RST_CAUSE_BOOT_WDT = 7,
  68. GSC_SC_RST_CAUSE_BOOT_WDT_MAN = 8,
  69. GSC_SC_RST_CAUSE_SOFT_PWR = 9,
  70. GSC_SC_RST_CAUSE_MAX = 10,
  71. };
  72. #if CONFIG_IS_ENABLED(DM_I2C)
  73. struct gsc_priv {
  74. int gscver;
  75. int fwver;
  76. int fwcrc;
  77. struct udevice *hwmon;
  78. struct udevice *rtc;
  79. };
  80. /*
  81. * GSCv2 will fail to ACK an I2C transaction if it is busy, which can occur
  82. * during its 1HZ timer tick while reading ADC's. When this does occur,
  83. * it will never be busy longer than 2 back-to-back transfers so retry 3 times.
  84. */
  85. static int gsc_i2c_read(struct udevice *dev, uint addr, u8 *buf, int len)
  86. {
  87. struct gsc_priv *priv = dev_get_priv(dev);
  88. int retry = (priv->gscver == 3) ? 1 : 3;
  89. int n = 0;
  90. int ret;
  91. while (n++ < retry) {
  92. ret = dm_i2c_read(dev, addr, buf, len);
  93. if (!ret)
  94. break;
  95. if (ret != -EREMOTEIO)
  96. break;
  97. mdelay(10);
  98. }
  99. return ret;
  100. }
  101. static int gsc_i2c_write(struct udevice *dev, uint addr, const u8 *buf, int len)
  102. {
  103. struct gsc_priv *priv = dev_get_priv(dev);
  104. int retry = (priv->gscver == 3) ? 1 : 3;
  105. int n = 0;
  106. int ret;
  107. while (n++ < retry) {
  108. ret = dm_i2c_write(dev, addr, buf, len);
  109. if (!ret)
  110. break;
  111. if (ret != -EREMOTEIO)
  112. break;
  113. mdelay(10);
  114. }
  115. return ret;
  116. }
  117. static struct udevice *gsc_get_dev(int busno, int slave)
  118. {
  119. struct udevice *dev, *bus;
  120. int ret;
  121. ret = uclass_get_device_by_seq(UCLASS_I2C, busno, &bus);
  122. if (ret)
  123. return NULL;
  124. ret = dm_i2c_probe(bus, slave, 0, &dev);
  125. if (ret)
  126. return NULL;
  127. return dev;
  128. }
  129. static int gsc_thermal_get_info(struct udevice *dev, u8 *outreg, int *tmax, bool *enable)
  130. {
  131. struct gsc_priv *priv = dev_get_priv(dev);
  132. int ret;
  133. u8 reg;
  134. if (priv->gscver > 2 && priv->fwver > 52) {
  135. ret = gsc_i2c_read(dev, GSC_SC_THERM_PROTECT, &reg, 1);
  136. if (!ret) {
  137. if (outreg)
  138. *outreg = reg;
  139. if (tmax) {
  140. *tmax = ((reg & 0xf8) >> 3) * 2;
  141. if (*tmax)
  142. *tmax += 70;
  143. else
  144. *tmax = 120;
  145. }
  146. if (enable)
  147. *enable = reg & 1;
  148. }
  149. } else {
  150. ret = -ENODEV;
  151. }
  152. return ret;
  153. }
  154. static int gsc_thermal_get_temp(struct udevice *dev)
  155. {
  156. struct gsc_priv *priv = dev_get_priv(dev);
  157. u32 reg, mode, val;
  158. const char *label;
  159. ofnode node;
  160. u8 buf[2];
  161. ofnode_for_each_subnode(node, dev_read_subnode(dev, "adc")) {
  162. if (ofnode_read_u32(node, "reg", &reg))
  163. reg = -1;
  164. if (ofnode_read_u32(node, "gw,mode", &mode))
  165. mode = -1;
  166. label = ofnode_read_string(node, "label");
  167. if ((reg == -1) || (mode == -1) || !label)
  168. continue;
  169. if (mode != 0 || strcmp(label, "temp"))
  170. continue;
  171. memset(buf, 0, sizeof(buf));
  172. if (!gsc_i2c_read(priv->hwmon, reg, buf, sizeof(buf))) {
  173. val = buf[0] | buf[1] << 8;
  174. if (val > 0x8000)
  175. val -= 0xffff;
  176. return val;
  177. }
  178. }
  179. return 0;
  180. }
  181. static void gsc_thermal_info(struct udevice *dev)
  182. {
  183. struct gsc_priv *priv = dev_get_priv(dev);
  184. switch (priv->gscver) {
  185. case 2:
  186. printf("board_temp:%dC ", gsc_thermal_get_temp(dev) / 10);
  187. break;
  188. case 3:
  189. if (priv->fwver > 52) {
  190. bool enabled;
  191. int tmax;
  192. if (!gsc_thermal_get_info(dev, NULL, &tmax, &enabled)) {
  193. puts("Thermal protection:");
  194. if (enabled)
  195. printf("enabled at %dC ", tmax);
  196. else
  197. puts("disabled ");
  198. }
  199. }
  200. break;
  201. }
  202. }
  203. static void gsc_reset_info(struct udevice *dev)
  204. {
  205. struct gsc_priv *priv = dev_get_priv(dev);
  206. static const char * const names[] = {
  207. "VIN",
  208. "PB",
  209. "WDT",
  210. "CPU",
  211. "TEMP_L",
  212. "TEMP_R",
  213. "SLEEP",
  214. "BOOT_WDT1",
  215. "BOOT_WDT2",
  216. "SOFT_PWR",
  217. };
  218. u8 reg;
  219. /* reset cause */
  220. switch (priv->gscver) {
  221. case 2:
  222. if (!gsc_i2c_read(dev, GSC_SC_STATUS, &reg, 1)) {
  223. if (reg & BIT(GSC_SC_IRQ_WATCHDOG)) {
  224. puts("RST:WDT");
  225. reg &= ~BIT(GSC_SC_IRQ_WATCHDOG);
  226. gsc_i2c_write(dev, GSC_SC_STATUS, &reg, 1);
  227. } else {
  228. puts("RST:VIN");
  229. }
  230. printf(" WDT:%sabled ",
  231. (reg & BIT(GSC_SC_CTRL1_WDEN)) ? "en" : "dis");
  232. }
  233. break;
  234. case 3:
  235. if (priv->fwver > 52 &&
  236. !gsc_i2c_read(dev, GSC_SC_RST_CAUSE, &reg, 1)) {
  237. puts("RST:");
  238. if (reg < ARRAY_SIZE(names))
  239. printf("%s ", names[reg]);
  240. else
  241. printf("0x%02x ", reg);
  242. }
  243. break;
  244. }
  245. }
  246. /* display hardware monitor ADC channels */
  247. static int gsc_hwmon(struct udevice *dev)
  248. {
  249. struct gsc_priv *priv = dev_get_priv(dev);
  250. u32 reg, mode, val, offset;
  251. const char *label;
  252. ofnode node;
  253. u8 buf[2];
  254. u32 r[2];
  255. int ret;
  256. /* iterate over hwmon nodes */
  257. ofnode_for_each_subnode(node, dev_read_subnode(dev, "adc")) {
  258. if (ofnode_read_u32(node, "reg", &reg))
  259. reg = -1;
  260. if (ofnode_read_u32(node, "gw,mode", &mode))
  261. mode = -1;
  262. label = ofnode_read_string(node, "label");
  263. if ((reg == -1) || (mode == -1) || !label)
  264. continue;
  265. memset(buf, 0, sizeof(buf));
  266. ret = gsc_i2c_read(priv->hwmon, reg, buf, sizeof(buf));
  267. if (ret) {
  268. printf("i2c error: %d\n", ret);
  269. continue;
  270. }
  271. val = buf[0] | buf[1] << 8;
  272. switch (mode) {
  273. case 0: /* temperature (C*10) */
  274. if (val > 0x8000)
  275. val -= 0xffff;
  276. printf("%-8s: %d.%ldC\n", label, val / 10, abs(val % 10));
  277. break;
  278. case 1: /* prescaled voltage */
  279. if (val != 0xffff)
  280. printf("%-8s: %d.%03dV\n", label, val / 1000, val % 1000);
  281. break;
  282. case 2: /* scaled based on ref volt and resolution */
  283. val *= 2500;
  284. val /= 1 << 12;
  285. /* apply pre-scaler voltage divider */
  286. if (!ofnode_read_u32_index(node, "gw,voltage-divider-ohms", 0, &r[0]) &&
  287. !ofnode_read_u32_index(node, "gw,voltage-divider-ohms", 1, &r[1]) &&
  288. r[0] && r[1]) {
  289. val *= (r[0] + r[1]);
  290. val /= r[1];
  291. }
  292. /* adjust by offset */
  293. val += (offset / 1000);
  294. printf("%-8s: %d.%03dV\n", label, val / 1000, val % 1000);
  295. break;
  296. }
  297. }
  298. return 0;
  299. }
  300. static int gsc_banner(struct udevice *dev)
  301. {
  302. struct gsc_priv *priv = dev_get_priv(dev);
  303. /* banner */
  304. printf("GSCv%d : v%d 0x%04x ", priv->gscver, priv->fwver, priv->fwcrc);
  305. gsc_reset_info(dev);
  306. gsc_thermal_info(dev);
  307. puts("\n");
  308. /* Display RTC */
  309. if (priv->rtc) {
  310. u8 buf[4];
  311. time_t timestamp;
  312. struct rtc_time tm;
  313. if (!gsc_i2c_read(priv->rtc, 0, buf, 4)) {
  314. timestamp = get_unaligned_le32(buf);
  315. rtc_to_tm(timestamp, &tm);
  316. printf("RTC : %4d-%02d-%02d %2d:%02d:%02d UTC\n",
  317. tm.tm_year, tm.tm_mon, tm.tm_mday,
  318. tm.tm_hour, tm.tm_min, tm.tm_sec);
  319. }
  320. }
  321. return 0;
  322. }
  323. static int gsc_probe(struct udevice *dev)
  324. {
  325. struct gsc_priv *priv = dev_get_priv(dev);
  326. u8 buf[32];
  327. int ret;
  328. ret = gsc_i2c_read(dev, 0, buf, sizeof(buf));
  329. if (ret)
  330. return ret;
  331. /*
  332. * GSC chip version:
  333. * GSCv2 has 16 registers (which overlap)
  334. * GSCv3 has 32 registers
  335. */
  336. priv->gscver = memcmp(buf, buf + 16, 16) ? 3 : 2;
  337. priv->fwver = buf[GSC_SC_FWVER];
  338. priv->fwcrc = buf[GSC_SC_FWCRC] | buf[GSC_SC_FWCRC + 1] << 8;
  339. priv->hwmon = gsc_get_dev(GSC_BUSNO, GSC_HWMON_ADDR);
  340. if (priv->hwmon)
  341. dev_set_priv(priv->hwmon, priv);
  342. priv->rtc = gsc_get_dev(GSC_BUSNO, GSC_RTC_ADDR);
  343. if (priv->rtc)
  344. dev_set_priv(priv->rtc, priv);
  345. #ifdef CONFIG_SPL_BUILD
  346. gsc_banner(dev);
  347. #endif
  348. return 0;
  349. };
  350. static const struct udevice_id gsc_ids[] = {
  351. { .compatible = "gw,gsc", },
  352. { }
  353. };
  354. U_BOOT_DRIVER(gsc) = {
  355. .name = "gsc",
  356. .id = UCLASS_MISC,
  357. .of_match = gsc_ids,
  358. .probe = gsc_probe,
  359. .priv_auto = sizeof(struct gsc_priv),
  360. .flags = DM_FLAG_PRE_RELOC,
  361. };
  362. static int gsc_sleep(struct udevice *dev, unsigned long secs)
  363. {
  364. u8 regs[4];
  365. int ret;
  366. printf("GSC Sleeping for %ld seconds\n", secs);
  367. put_unaligned_le32(secs, regs);
  368. ret = gsc_i2c_write(dev, GSC_SC_TIME_ADD, regs, sizeof(regs));
  369. if (ret)
  370. goto err;
  371. ret = gsc_i2c_read(dev, GSC_SC_CTRL1, regs, 1);
  372. if (ret)
  373. goto err;
  374. regs[0] |= BIT(GSC_SC_CTRL1_SLEEP_ADD);
  375. ret = gsc_i2c_write(dev, GSC_SC_CTRL1, regs, 1);
  376. if (ret)
  377. goto err;
  378. regs[0] &= ~BIT(GSC_SC_CTRL1_SLEEP_ADD);
  379. regs[0] |= BIT(GSC_SC_CTRL1_SLEEP_EN) | BIT(GSC_SC_CTRL1_SLEEP_ACTIVATE);
  380. ret = gsc_i2c_write(dev, GSC_SC_CTRL1, regs, 1);
  381. if (ret)
  382. goto err;
  383. return 0;
  384. err:
  385. printf("i2c error: %d\n", ret);
  386. return ret;
  387. }
  388. static int gsc_wd_disable(struct udevice *dev)
  389. {
  390. int ret;
  391. u8 reg;
  392. ret = gsc_i2c_read(dev, GSC_SC_CTRL1, &reg, 1);
  393. if (ret)
  394. goto err;
  395. reg |= BIT(GSC_SC_CTRL1_WDDIS);
  396. reg &= ~BIT(GSC_SC_CTRL1_BOOT_CHK);
  397. ret = gsc_i2c_write(dev, GSC_SC_CTRL1, &reg, 1);
  398. if (ret)
  399. goto err;
  400. puts("GSC : boot watchdog disabled\n");
  401. return 0;
  402. err:
  403. puts("i2c error");
  404. return ret;
  405. }
  406. static int gsc_thermal(struct udevice *dev, const char *cmd, const char *val)
  407. {
  408. struct gsc_priv *priv = dev_get_priv(dev);
  409. int ret, tmax;
  410. bool enabled;
  411. u8 reg;
  412. if (priv->gscver < 3 || priv->fwver < 53)
  413. return -EINVAL;
  414. ret = gsc_thermal_get_info(dev, &reg, &tmax, &enabled);
  415. if (ret)
  416. return ret;
  417. if (cmd && !strcmp(cmd, "enable")) {
  418. if (val && *val) {
  419. tmax = clamp((int)simple_strtoul(val, NULL, 0), 72, 122);
  420. reg &= ~0xf8;
  421. reg |= ((tmax - 70) / 2) << 3;
  422. }
  423. reg |= BIT(0);
  424. gsc_i2c_write(dev, GSC_SC_THERM_PROTECT, &reg, 1);
  425. } else if (cmd && !strcmp(cmd, "disable")) {
  426. reg &= ~BIT(0);
  427. gsc_i2c_write(dev, GSC_SC_THERM_PROTECT, &reg, 1);
  428. } else if (cmd) {
  429. return -EINVAL;
  430. }
  431. /* show status */
  432. gsc_thermal_info(dev);
  433. puts("\n");
  434. return 0;
  435. }
  436. /* override in board files to display additional board EEPROM info */
  437. __weak void board_gsc_info(void)
  438. {
  439. }
  440. static void gsc_info(struct udevice *dev)
  441. {
  442. gsc_banner(dev);
  443. board_gsc_info();
  444. }
  445. static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
  446. {
  447. struct udevice *dev;
  448. int ret;
  449. /* get/probe driver */
  450. ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(gsc), &dev);
  451. if (ret)
  452. return CMD_RET_USAGE;
  453. if (argc < 2) {
  454. gsc_info(dev);
  455. return CMD_RET_SUCCESS;
  456. } else if (strcasecmp(argv[1], "sleep") == 0) {
  457. if (argc < 3)
  458. return CMD_RET_USAGE;
  459. if (!gsc_sleep(dev, dectoul(argv[2], NULL)))
  460. return CMD_RET_SUCCESS;
  461. } else if (strcasecmp(argv[1], "hwmon") == 0) {
  462. if (!gsc_hwmon(dev))
  463. return CMD_RET_SUCCESS;
  464. } else if (strcasecmp(argv[1], "wd-disable") == 0) {
  465. if (!gsc_wd_disable(dev))
  466. return CMD_RET_SUCCESS;
  467. } else if (strcasecmp(argv[1], "thermal") == 0) {
  468. char *cmd, *val;
  469. cmd = (argc > 2) ? argv[2] : NULL;
  470. val = (argc > 3) ? argv[3] : NULL;
  471. if (!gsc_thermal(dev, cmd, val))
  472. return CMD_RET_SUCCESS;
  473. }
  474. return CMD_RET_USAGE;
  475. }
  476. U_BOOT_CMD(gsc, 4, 1, do_gsc, "Gateworks System Controller",
  477. "[sleep <secs>]|[hwmon]|[wd-disable][thermal [disable|enable [temp]]]\n");
  478. /* disable boot watchdog - useful for an SPL that wants to use falcon mode */
  479. int gsc_boot_wd_disable(void)
  480. {
  481. struct udevice *dev;
  482. int ret;
  483. /* get/probe driver */
  484. ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(gsc), &dev);
  485. if (!ret)
  486. ret = gsc_wd_disable(dev);
  487. return ret;
  488. }
  489. # else
  490. /*
  491. * GSCv2 will fail to ACK an I2C transaction if it is busy, which can occur
  492. * during its 1HZ timer tick while reading ADC's. When this does occur,
  493. * it will never be busy longer than 2 back-to-back transfers so retry 3 times.
  494. */
  495. static int gsc_i2c_read(uint chip, uint addr, u8 *buf, int len)
  496. {
  497. int retry = 3;
  498. int n = 0;
  499. int ret;
  500. while (n++ < retry) {
  501. ret = i2c_read(chip, addr, 1, buf, len);
  502. if (!ret)
  503. break;
  504. if (ret != -EREMOTEIO)
  505. break;
  506. printf("%s 0x%02x retry %d\n", __func__, addr, n);
  507. mdelay(10);
  508. }
  509. return ret;
  510. }
  511. static int gsc_i2c_write(uint chip, uint addr, u8 *buf, int len)
  512. {
  513. int retry = 3;
  514. int n = 0;
  515. int ret;
  516. while (n++ < retry) {
  517. ret = i2c_write(chip, addr, 1, buf, len);
  518. if (!ret)
  519. break;
  520. if (ret != -EREMOTEIO)
  521. break;
  522. printf("%s 0x%02x retry %d\n", __func__, addr, n);
  523. mdelay(10);
  524. }
  525. return ret;
  526. }
  527. /* disable boot watchdog - useful for an SPL that wants to use falcon mode */
  528. int gsc_boot_wd_disable(void)
  529. {
  530. u8 buf[32];
  531. int ret;
  532. i2c_set_bus_num(GSC_BUSNO);
  533. ret = gsc_i2c_read(GSC_SC_ADDR, 0, buf, sizeof(buf));
  534. if (!ret) {
  535. buf[GSC_SC_CTRL1] |= BIT(GSC_SC_CTRL1_WDDIS);
  536. ret = gsc_i2c_write(GSC_SC_ADDR, GSC_SC_CTRL1, &buf[GSC_SC_CTRL1], 1);
  537. printf("GSCv%d: v%d 0x%04x ",
  538. memcmp(buf, buf + 16, 16) ? 3 : 2,
  539. buf[GSC_SC_FWVER],
  540. buf[GSC_SC_FWCRC] | buf[GSC_SC_FWCRC + 1] << 8);
  541. if (buf[GSC_SC_STATUS] & BIT(GSC_SC_IRQ_WATCHDOG)) {
  542. puts("RST:WDT ");
  543. buf[GSC_SC_STATUS] &= ~BIT(GSC_SC_IRQ_WATCHDOG);
  544. gsc_i2c_write(GSC_SC_ADDR, GSC_SC_STATUS, &buf[GSC_SC_STATUS], 1);
  545. } else {
  546. puts("RST:VIN ");
  547. }
  548. puts("WDT:disabled\n");
  549. }
  550. return ret;
  551. }
  552. #endif