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