summaryrefslogtreecommitdiff
path: root/board/careena
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-05-23 17:11:17 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-05-25 20:31:50 -0700
commit092e647d99c0100f0a51574eda28cc6130bb0df2 (patch)
treeea3a9142fa1eb36e5ef777ab0a557f93e13868f5 /board/careena
parent4ab9fc9fa9a0a246bc78eb70d301457abe8dc79b (diff)
downloadchrome-ec-092e647d99c0100f0a51574eda28cc6130bb0df2.tar.gz
careena: Make GPIOs match hardware
Update GPIO definitions for Careena to match hardware. BUG=b:79704826 BRANCH=none TEST=make BOARD=careena Change-Id: I755e5fd8123eefdfa8d30ca2314435c28340e488 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1070989 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/careena')
-rw-r--r--board/careena/board.c56
-rw-r--r--board/careena/board.h5
-rw-r--r--board/careena/gpio.inc20
3 files changed, 14 insertions, 67 deletions
diff --git a/board/careena/board.c b/board/careena/board.c
index cdf0652307..6ead756952 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -50,17 +50,10 @@
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-/*
- * These GPIOs change pins depending on board version. They are configured
- * in board_init.
- */
-static enum gpio_signal gpio_usb_c1_oc_l = GPIO_USB_C1_OC_L_V2;
-static enum gpio_signal gpio_usb_c0_pd_rst_l = GPIO_USB_C0_PD_RST_L_V2;
-
static void tcpc_alert_event(enum gpio_signal signal)
{
if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
- !gpio_get_level(gpio_usb_c0_pd_rst_l))
+ !gpio_get_level(GPIO_USB_C0_PD_RST_L))
return;
if ((signal == GPIO_USB_C1_PD_INT_ODL) &&
@@ -77,7 +70,7 @@ static void tcpc_alert_event(enum gpio_signal signal)
static void anx74xx_cable_det_handler(void)
{
int cable_det = gpio_get_level(GPIO_USB_C0_CABLE_DET);
- int reset_n = gpio_get_level(gpio_usb_c0_pd_rst_l);
+ int reset_n = gpio_get_level(GPIO_USB_C0_PD_RST_L);
/*
* A cable_det low->high transition was detected. If following the
@@ -115,31 +108,12 @@ const struct i2c_port_t i2c_ports[] = {
{"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
{"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
{"thermal", I2C_PORT_THERMAL, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"kblight", I2C_PORT_KBLIGHT, 100, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
{"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, GPIO_I2C7_SDA},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
static void board_init(void)
{
- if (system_get_board_version() < 2) {
- /*
- * These GPIOs change pins depending on board version. Change
- * them here from the V2 pin to the V0 pin.
- */
- gpio_usb_c1_oc_l = GPIO_USB_C1_OC_L_V0;
- gpio_usb_c0_pd_rst_l = GPIO_USB_C0_PD_RST_L_V0;
- } else {
- /* Alternate functions for board version 2 only. */
- gpio_set_alternate_function(GPIO_F, 0x02, 1); /* ADC8 */
- gpio_set_alternate_function(GPIO_0, 0x10, 0); /* KSO_13 */
- gpio_set_alternate_function(GPIO_8, 0x04, 0); /* KSO_14 */
- }
-
- /* Now that we know which pin to use, set the correct output mode. */
- gpio_set_flags(gpio_usb_c1_oc_l, GPIO_OUT_HIGH);
- gpio_set_flags(gpio_usb_c0_pd_rst_l, GPIO_OUT_HIGH);
-
/* Enable Gyro interrupts */
gpio_enable_interrupt(GPIO_6AXIS_INT_L);
}
@@ -148,7 +122,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void board_overcurrent_event(int port)
{
enum gpio_signal signal = (port == 0) ? GPIO_USB_C0_OC_L
- : gpio_usb_c1_oc_l;
+ : GPIO_USB_C1_OC_L;
gpio_set_level(signal, 0);
@@ -175,10 +149,7 @@ void board_tcpc_init(void)
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_SWCTL_INT_ODL);
- if (system_get_board_version() < 2)
- gpio_enable_interrupt(GPIO_USB_C1_SWCTL_INT_ODL_V0);
- else
- gpio_enable_interrupt(GPIO_USB_C1_SWCTL_INT_ODL_V2);
+ gpio_enable_interrupt(GPIO_USB_C1_SWCTL_INT_ODL);
/* Enable TCPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -205,7 +176,7 @@ uint16_t tcpc_get_alert_status(void)
uint16_t status = 0;
if (!gpio_get_level(GPIO_USB_C0_PD_INT_ODL)) {
- if (gpio_get_level(gpio_usb_c0_pd_rst_l))
+ if (gpio_get_level(GPIO_USB_C0_PD_RST_L))
status |= PD_STATUS_TCPC_ALERT_0;
}
@@ -233,10 +204,10 @@ void board_set_tcpc_power_mode(int port, int mode)
case ANX74XX_NORMAL_MODE:
gpio_set_level(GPIO_EN_USB_C0_TCPC_PWR, 1);
msleep(ANX74XX_PWR_H_RST_H_DELAY_MS);
- gpio_set_level(gpio_usb_c0_pd_rst_l, 1);
+ gpio_set_level(GPIO_USB_C0_PD_RST_L, 1);
break;
case ANX74XX_STANDBY_MODE:
- gpio_set_level(gpio_usb_c0_pd_rst_l, 0);
+ gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
msleep(ANX74XX_RST_L_PWR_L_DELAY_MS);
gpio_set_level(GPIO_EN_USB_C0_TCPC_PWR, 0);
msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
@@ -252,7 +223,7 @@ void board_reset_pd_mcu(void)
gpio_set_level(GPIO_USB_C1_PD_RST_L, 0);
/* Assert reset to TCPC0 (anx3429) */
- gpio_set_level(gpio_usb_c0_pd_rst_l, 0);
+ gpio_set_level(GPIO_USB_C0_PD_RST_L, 0);
/* TCPC1 (ps8751) requires 1ms reset down assertion */
msleep(MAX(1, ANX74XX_RST_L_PWR_L_DELAY_MS));
@@ -268,14 +239,3 @@ void board_reset_pd_mcu(void)
msleep(ANX74XX_PWR_L_PWR_H_DELAY_MS);
board_set_tcpc_power_mode(USB_PD_PORT_ANX74XX, 1);
}
-
-static void board_kblight_init(void)
-{
- /*
- * Enable keyboard backlight. This needs to be done here because
- * the chip doesn't have power until PP3300_S0 comes up.
- */
- gpio_set_level(GPIO_KB_BL_EN, 1);
- lm3630a_poweron();
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_kblight_init, HOOK_PRIO_DEFAULT);
diff --git a/board/careena/board.h b/board/careena/board.h
index 7f0906ddec..5d1b47e230 100644
--- a/board/careena/board.h
+++ b/board/careena/board.h
@@ -36,9 +36,4 @@
#define CONFIG_LED_PWM_COUNT 1
-#define I2C_PORT_KBLIGHT NPCX_I2C_PORT5_0
-
-/* KB backlight driver */
-#define CONFIG_LED_DRIVER_LM3630A
-
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/careena/gpio.inc b/board/careena/gpio.inc
index bfdbd0e376..9341933995 100644
--- a/board/careena/gpio.inc
+++ b/board/careena/gpio.inc
@@ -11,8 +11,7 @@
GPIO_INT(USB_C0_PD_INT_ODL, PIN(A, 0), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C1_PD_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C0_SWCTL_INT_ODL, PIN(0, 3), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C1_SWCTL_INT_ODL_V0, PIN(0, 4), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C1_SWCTL_INT_ODL_V2, PIN(D, 4), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C1_SWCTL_INT_ODL, PIN(D, 4), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(PCH_SLP_S3_L, PIN(A, 6), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PCH_SLP_S5_L, PIN(A, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(S0_PGOOD, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt)
@@ -32,7 +31,7 @@ GPIO(ENABLE_BACKLIGHT_L, PIN(D, 3), GPIO_OUT_HIGH) /* Enable Backlight */
GPIO(PCH_RSMRST_L, PIN(C, 2), GPIO_OUT_LOW) /* RSMRST# to SOC */
GPIO(PCH_PWRBTN_L, PIN(C, 1), GPIO_OUT_HIGH) /* Power Button to SOC */
GPIO(PCH_WAKE_L, PIN(7, 4), GPIO_OUT_HIGH) /* Wake SOC */
-GPIO(PCH_RCIN_L, PIN(0, 2), GPIO_ODR_HIGH) /* Cold Reset to SOC */
+GPIO(PCH_RCIN_L, PIN(3, 5), GPIO_ODR_HIGH) /* Cold Reset to SOC */
GPIO(CCD_MODE_ODL, PIN(E, 3), GPIO_INPUT) /* Case Closed Debug Mode */
GPIO(ENTERING_RW, PIN(E, 1), GPIO_OUT_LOW) /* EC Entering RW */
GPIO(EC_BATT_PRES_ODL, PIN(E, 5), GPIO_INPUT | GPIO_PULL_UP) /* Battery Present */
@@ -41,7 +40,6 @@ GPIO(EC_APU_RST, PIN(E, 4), GPIO_INPUT) /* Reset to SOC */
GPIO(CPU_PROCHOT, PIN(3, 4), GPIO_INPUT | GPIO_SEL_1P8V) /* PROCHOT to SOC */
GPIO(APU_ALERT_L, PIN(A, 2), GPIO_INPUT) /* Alert to SOC */
GPIO(3AXIS_INT_L, PIN(5, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* 3 Axis Accel */
-GPIO(KB_BL_EN, PIN(F, 2), GPIO_OUT_LOW) /* Enable KB Backlight */
/* We don't have 5V rail control but the BQ24392 driver expects the GPIO */
UNIMPLEMENTED(EN_PP5000)
@@ -55,10 +53,6 @@ GPIO(I2C2_SCL, PIN(9, 2), GPIO_INPUT) /* EC_I2C_USB_C1_PD_SCL */
GPIO(I2C2_SDA, PIN(9, 1), GPIO_INPUT) /* EC_I2C_USB_C1_PD_SDA */
GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT | GPIO_SEL_1P8V) /* APU_SIC */
GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* APU_SID */
-GPIO(I2C5_SCL, PIN(3, 3), GPIO_INPUT) /* EC_I2C_EEPROM_SCL and
- EC_I2C_KB_BL_SCL */
-GPIO(I2C5_SDA, PIN(3, 6), GPIO_INPUT) /* EC_I2C_EEPROM_SDA and
- EC_I2C_KB_BL_SDA */
GPIO(I2C7_SCL, PIN(B, 3), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C_SENSOR_SCL */
GPIO(I2C7_SDA, PIN(B, 2), GPIO_INPUT | GPIO_SEL_1P8V) /* EC_I2C_SENSOR_SDA */
@@ -73,13 +67,10 @@ GPIO(EN_USB_A0_5V, PIN(6, 1), GPIO_OUT_LOW) /* Enable A0 5V Charging */
GPIO(EN_USB_A1_5V, PIN(C, 0), GPIO_OUT_LOW) /* Enable A1 5V Charging */
GPIO(EN_USB_C0_TCPC_PWR, PIN(6, 0), GPIO_OUT_LOW) /* Enable C0 TCPC Power */
GPIO(USB_C0_OC_L, PIN(7, 3), GPIO_OUT_HIGH) /* C0 Over Current */
-GPIO(USB_C1_OC_L_V0, PIN(D, 7), GPIO_INPUT) /* C1 Over Current */
-GPIO(USB_C1_OC_L_V2, PIN(7, 2), GPIO_INPUT) /* C1 Over Current */
-GPIO(USB_C0_PD_RST_L_V0, PIN(F, 1), GPIO_INPUT) /* C0 PD Reset */
-GPIO(USB_C0_PD_RST_L_V2, PIN(3, 2), GPIO_INPUT) /* C0 PD Reset */
+GPIO(USB_C1_OC_L, PIN(7, 2), GPIO_OUT_HIGH) /* C1 Over Current */
+GPIO(USB_C0_PD_RST_L, PIN(3, 2), GPIO_OUT_HIGH) /* C0 PD Reset */
GPIO(USB_C1_PD_RST_L, PIN(D, 5), GPIO_OUT_HIGH) /* C1 PD Reset */
-GPIO(USB_C0_BC12_VBUS_ON_L_V0, PIN(8, 2), GPIO_INPUT) /* C0 BC1.2 Power */
-GPIO(USB_C0_BC12_VBUS_ON_L_V2, PIN(4, 0), GPIO_ODR_HIGH) /* C0 BC1.2 Power */
+GPIO(USB_C0_BC12_VBUS_ON_L, PIN(4, 0), GPIO_ODR_HIGH) /* C0 BC1.2 Power */
GPIO(USB_C1_BC12_VBUS_ON_L, PIN(B, 1), GPIO_ODR_HIGH) /* C1 BC1.2 Power */
GPIO(USB_C0_BC12_CHG_DET, PIN(6, 2), GPIO_INPUT) /* C0 BC1.2 Detect */
GPIO(USB_C1_BC12_CHG_DET, PIN(8, 3), GPIO_INPUT) /* C1 BC1.2 Detect */
@@ -104,6 +95,7 @@ ALTERNATE(PIN_MASK(3, 0x48), 1, MODULE_I2C, 0) /* I2C5 */
ALTERNATE(PIN_MASK(B, 0x0C), 1, MODULE_I2C, 0) /* I2C7 */
ALTERNATE(PIN_MASK(4, 0x30), 1, MODULE_ADC, 0) /* ADC0-1 */
ALTERNATE(PIN_MASK(4, 0x02), 1, MODULE_ADC, 0) /* ADC4 */
+ALTERNATE(PIN_MASK(F, 0x02), 1, MODULE_ADC, 0) /* ADC8 */
ALTERNATE(PIN_MASK(F, 0x01), 1, MODULE_ADC, 0) /* ADC9 */
ALTERNATE(PIN_MASK(B, 0x80), 1, MODULE_PWM, 0) /* KB Backlight */
ALTERNATE(PIN_MASK(C, 0x18), 1, MODULE_PWM, 0) /* LED 1 & 2 */