diff options
author | Lee Leahy <leroy.p.leahy@intel.com> | 2016-05-15 15:05:56 -0700 |
---|---|---|
committer | Leroy P Leahy <leroy.p.leahy@intel.com> | 2016-05-18 00:58:06 +0200 |
commit | 15843bdad076149e9d04dcfaa07f4eedda84acfa (patch) | |
tree | 42caf73696eccd79a2128718330111dc5495ea6d /src/mainboard/intel/galileo/gen1.h | |
parent | ac690b1e9ba1318375bc7fba088aef5c7e3c07ce (diff) | |
download | coreboot-15843bdad076149e9d04dcfaa07f4eedda84acfa.tar.xz |
mainboard/intel/galileo: Add I2C chip initialization
Add I2C chip initialization for the Galileo boards.
TEST=Build and run on Galileo Gen2
Change-Id: Ib5284d5cd7a67de2f3f98940837ceb2aa69af468
Signed-off-by: Lee Leahy <leroy.p.leahy@intel.com>
Reviewed-on: https://review.coreboot.org/14829
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/mainboard/intel/galileo/gen1.h')
-rw-r--r-- | src/mainboard/intel/galileo/gen1.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mainboard/intel/galileo/gen1.h b/src/mainboard/intel/galileo/gen1.h index c718b617a8..26335dad61 100644 --- a/src/mainboard/intel/galileo/gen1.h +++ b/src/mainboard/intel/galileo/gen1.h @@ -13,6 +13,9 @@ * GNU General Public License for more details. */ +/* Jumper J2 determines the slave address of Cypress I/O GPIO expander */ +#define GALILEO_DETERMINE_IOEXP_SLA_RESUMEWELL_GPIO 5 + static const struct reg_script gen1_gpio_init[] = { /* Initialize the legacy GPIO controller */ REG_LEG_GPIO_WRITE(R_QNC_GPIO_CGEN_CORE_WELL, 0x03), @@ -49,5 +52,48 @@ static const struct reg_script gen1_gpio_init[] = { /* Toggle the Cypress reset line */ REG_GPIO_OR(GPIO_SWPORTA_DR, BIT4), REG_GPIO_AND(GPIO_SWPORTA_DR, ~BIT4), + + REG_SCRIPT_END +}; + +static const struct reg_script gen1_i2c_0x20_init[] = { + /* Route I2C pins to Arduino header: + * Clear I2C_MUX (GPORT1_BIT5) to route I2C to Arduino Shield connector + * + * I2C_SDA -> ANALOG_A4 + * I2C_SCL -> ANALOG_A5 + */ + REG_I2C_WRITE(GEN1_I2C_GPIO_EXP_0x20, GEN1_GPIO_EXP_PORT_SELECT, 1), + REG_I2C_AND(GEN1_I2C_GPIO_EXP_0x20, GEN1_GPIO_EXP_PORT_DIR, ~BIT5), + REG_I2C_WRITE(GEN1_I2C_GPIO_EXP_0x20, GEN1_GPIO_EXP_OUTPUT1, ~BIT5), + + /* Set all GPIO expander pins connected to the Reset Button as inputs + * Configure RESET_N_SHLD (GPORT5_BIT0) and SW_RESET_N_SHLD + * (GPORT5_BIT1) as inputs + */ + REG_I2C_WRITE(GEN1_I2C_GPIO_EXP_0x20, GEN1_GPIO_EXP_PORT_SELECT, 5), + REG_I2C_OR(GEN1_I2C_GPIO_EXP_0x20, GEN1_GPIO_EXP_PORT_DIR, BIT1 | BIT0), + + REG_SCRIPT_END +}; + +static const struct reg_script gen1_i2c_0x21_init[] = { + /* Route I2C pins to Arduino header: + * Clear I2C_MUX (GPORT1_BIT5) to route I2C to Arduino Shield connector + * + * I2C_SDA -> ANALOG_A4 + * I2C_SCL -> ANALOG_A5 + */ + REG_I2C_WRITE(GEN1_I2C_GPIO_EXP_0x21, GEN1_GPIO_EXP_PORT_SELECT, 1), + REG_I2C_AND(GEN1_I2C_GPIO_EXP_0x21, GEN1_GPIO_EXP_PORT_DIR, ~BIT5), + REG_I2C_AND(GEN1_I2C_GPIO_EXP_0x21, GEN1_GPIO_EXP_OUTPUT1, ~BIT5), + + /* Set all GPIO expander pins connected to the Reset Button as inputs + * Configure RESET_N_SHLD (GPORT5_BIT0) and SW_RESET_N_SHLD + * (GPORT5_BIT1) as inputs + */ + REG_I2C_WRITE(GEN1_I2C_GPIO_EXP_0x21, GEN1_GPIO_EXP_PORT_SELECT, 5), + REG_I2C_OR(GEN1_I2C_GPIO_EXP_0x21, GEN1_GPIO_EXP_PORT_DIR, BIT1 | BIT0), + REG_SCRIPT_END }; |