summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-08-18 12:01:01 -0700
committerCommit Bot <commit-bot@chromium.org>2020-08-19 23:59:28 +0000
commit386b25657e3a2224d0dbecbaafeec54ab9ea1f73 (patch)
tree77b4b08928b2630a375851b214d361141abbc79e
parentbb20158f5c2c837a6e780672add4fd49bebb833c (diff)
downloadchrome-ec-386b25657e3a2224d0dbecbaafeec54ab9ea1f73.tar.gz
BB retimer: Remove FORCE_PWR GPIO from EC driver
FORCE_PWR GPIO is used for keeping the BB retimer in active state during f/w updating. On TGLRVP, control to enable the FORCE_PWR GPIO was given to EC to support the I2C based F/W updating. I2C based f/w updating is deprecated and the LSx interface is POR hence the FORCE_PWR GPIO control is given to AP now. Thus, removing the FORCE_PWR GPIO from EC driver. BUG=b:165214747 BRANCH=none TEST=make buildall -j Change-Id: If9bb7199a68c93f704f698552e5594a58bd68f7c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2363334 Reviewed-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--baseboard/intelrvp/retimer.c2
-rw-r--r--baseboard/volteer/baseboard.c1
-rw-r--r--board/delbin/board.c1
-rw-r--r--board/delbin/gpio.inc3
-rw-r--r--board/eldrid/gpio.inc2
-rw-r--r--board/halvor/gpio.inc2
-rw-r--r--board/lindar/gpio.inc4
-rw-r--r--board/lingcod/gpio.inc2
-rw-r--r--board/malefor/gpio.inc2
-rw-r--r--board/terrador/board.c1
-rw-r--r--board/terrador/gpio.inc3
-rw-r--r--board/tglrvpu_ite/board.c44
-rw-r--r--board/todor/board.c1
-rw-r--r--board/todor/gpio.inc3
-rw-r--r--board/trondo/gpio.inc2
-rw-r--r--board/volteer/gpio.inc2
-rw-r--r--board/voxel/board.c1
-rw-r--r--board/voxel/gpio.inc3
-rw-r--r--driver/retimer/bb_retimer.c5
-rw-r--r--driver/retimer/bb_retimer.h15
20 files changed, 59 insertions, 40 deletions
diff --git a/baseboard/intelrvp/retimer.c b/baseboard/intelrvp/retimer.c
index 0397057641..cf09c76d3e 100644
--- a/baseboard/intelrvp/retimer.c
+++ b/baseboard/intelrvp/retimer.c
@@ -16,14 +16,12 @@ const struct bb_usb_control bb_controls[] = {
.shared_nvm = USB_PORT0_BB_RETIMER_SHARED_NVM,
.usb_ls_en_gpio = GPIO_USB_C0_LS_EN,
.retimer_rst_gpio = GPIO_USB_C0_RETIMER_RST,
- .force_power_gpio = GPIO_USB_C0_RETIMER_FORCE_PWR,
},
#ifdef HAS_TASK_PD_C1
[TYPE_C_PORT_1] = {
.shared_nvm = USB_PORT1_BB_RETIMER_SHARED_NVM,
.usb_ls_en_gpio = GPIO_USB_C1_LS_EN,
.retimer_rst_gpio = GPIO_USB_C1_RETIMER_RST,
- .force_power_gpio = GPIO_USB_C1_RETIMER_FORCE_PWR,
},
#endif /* HAS_TASK_PD_C1 */
};
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 8a12c6576e..94246aac05 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -294,7 +294,6 @@ struct bb_usb_control bb_controls[] = {
.shared_nvm = false,
.usb_ls_en_gpio = GPIO_USB_C1_LS_EN,
.retimer_rst_gpio = GPIO_USB_C1_RT_RST_ODL,
- .force_power_gpio = GPIO_USB_C1_RT_FORCE_PWR,
},
};
BUILD_ASSERT(ARRAY_SIZE(bb_controls) == USBC_PORT_COUNT);
diff --git a/board/delbin/board.c b/board/delbin/board.c
index 413bc42b7f..5d52800439 100644
--- a/board/delbin/board.c
+++ b/board/delbin/board.c
@@ -258,7 +258,6 @@ static const struct bb_usb_control bb_p0_control = {
.shared_nvm = false,
.usb_ls_en_gpio = GPIO_USB_C0_LS_EN,
.retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL,
- .force_power_gpio = GPIO_USB_C0_RT_FORCE_PWR,
};
/******************************************************************************/
diff --git a/board/delbin/gpio.inc b/board/delbin/gpio.inc
index 2b18a2b053..3ac9d81092 100644
--- a/board/delbin/gpio.inc
+++ b/board/delbin/gpio.inc
@@ -94,9 +94,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C0_LS_EN)
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C0_RT_FORCE_PWR)
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(UART2_EC_RX, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/board/eldrid/gpio.inc b/board/eldrid/gpio.inc
index cbd0fe2bc1..d0055671ca 100644
--- a/board/eldrid/gpio.inc
+++ b/board/eldrid/gpio.inc
@@ -100,8 +100,6 @@ GPIO(USB_C1_RT_INT_ODL, PIN(F, 3), GPIO_INPUT)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(EC_H1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/board/halvor/gpio.inc b/board/halvor/gpio.inc
index cc2809f1f0..f7c3a41be1 100644
--- a/board/halvor/gpio.inc
+++ b/board/halvor/gpio.inc
@@ -92,8 +92,6 @@ GPIO(USB_C2_OC_ODL, PIN(3, 2), GPIO_ODR_HIGH)
UNIMPLEMENTED(USB_C1_LS_EN)
UNIMPLEMENTED(USB_C0_BC12_INT_ODL)
UNIMPLEMENTED(USB_C1_BC12_INT_ODL)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Other input pins */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
diff --git a/board/lindar/gpio.inc b/board/lindar/gpio.inc
index 9fa9f377b7..4323d300e8 100644
--- a/board/lindar/gpio.inc
+++ b/board/lindar/gpio.inc
@@ -81,8 +81,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(EC_H1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
@@ -165,4 +163,4 @@ GPIO(UNUSED_GPIOF2, PIN(F, 2), GPIO_INPUT | GPIO_PULL_UP)
GPIO(UNUSED_GPIOF3, PIN(F, 3), GPIO_INPUT | GPIO_PULL_UP)
GPIO(UNUSED_GPIO56, PIN(5, 6), GPIO_INPUT | GPIO_PULL_UP)
GPIO(UNUSED_GPIO95, PIN(9, 5), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(UNUSED_GPIOB0, PIN(B, 0), GPIO_INPUT | GPIO_PULL_UP) \ No newline at end of file
+GPIO(UNUSED_GPIOB0, PIN(B, 0), GPIO_INPUT | GPIO_PULL_UP)
diff --git a/board/lingcod/gpio.inc b/board/lingcod/gpio.inc
index 4e86f66a74..6144bba66f 100644
--- a/board/lingcod/gpio.inc
+++ b/board/lingcod/gpio.inc
@@ -83,8 +83,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
diff --git a/board/malefor/gpio.inc b/board/malefor/gpio.inc
index 4e86f66a74..6144bba66f 100644
--- a/board/malefor/gpio.inc
+++ b/board/malefor/gpio.inc
@@ -83,8 +83,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
diff --git a/board/terrador/board.c b/board/terrador/board.c
index 92dd58187f..8f9e973e06 100644
--- a/board/terrador/board.c
+++ b/board/terrador/board.c
@@ -183,7 +183,6 @@ __override void board_cbi_init(void)
bb_controls[USBC_PORT_C0].shared_nvm = false;
bb_controls[USBC_PORT_C0].usb_ls_en_gpio = GPIO_USB_C0_LS_EN;
bb_controls[USBC_PORT_C0].retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL;
- bb_controls[USBC_PORT_C0].force_power_gpio = GPIO_USB_C0_RT_FORCE_PWR;
}
diff --git a/board/terrador/gpio.inc b/board/terrador/gpio.inc
index 5ab2e614e7..b95ce51dc3 100644
--- a/board/terrador/gpio.inc
+++ b/board/terrador/gpio.inc
@@ -97,9 +97,6 @@ GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C0_LS_EN)
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C0_RT_FORCE_PWR)
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(EC_H1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/board/tglrvpu_ite/board.c b/board/tglrvpu_ite/board.c
index 888b893d03..aa4ff77e96 100644
--- a/board/tglrvpu_ite/board.c
+++ b/board/tglrvpu_ite/board.c
@@ -5,6 +5,7 @@
/* Intel TGL-U-RVP-ITE board-specific configuration */
+#include "bb_retimer.h"
#include "button.h"
#include "charger.h"
#include "driver/charger/isl9241.h"
@@ -155,3 +156,46 @@ int board_get_version(void)
return board_id | (fab_id << 8);
}
+
+__override void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
+{
+ const struct bb_usb_control *control = &bb_controls[me->usb_port];
+
+ /*
+ * LSx based F/W updating is a POR, however to avoid the rework on
+ * RVP retain the FORCE_PWR GPIO with EC.
+ */
+ enum gpio_signal force_power_gpio = me->usb_port ?
+ GPIO_USB_C1_RETIMER_FORCE_PWR : GPIO_USB_C0_RETIMER_FORCE_PWR;
+
+ /* handle retimer's power domain */
+ if (on_off) {
+ gpio_set_level(control->usb_ls_en_gpio, 1);
+ /*
+ * Tpw, minimum time from VCC to RESET_N de-assertion is 100us.
+ * For boards that don't provide a load switch control, the
+ * retimer_init() function ensures power is up before calling
+ * this function.
+ */
+ msleep(1);
+ gpio_set_level(control->retimer_rst_gpio, 1);
+ msleep(10);
+ gpio_set_level(force_power_gpio, 1);
+
+ /*
+ * If BB retimer NVM is shared between multiple ports, allow
+ * 40ms time for all the retimers to be initialized.
+ * Else allow 20ms to initialize.
+ */
+ if (control->shared_nvm)
+ msleep(40);
+ else
+ msleep(20);
+ } else {
+ gpio_set_level(force_power_gpio, 0);
+ msleep(1);
+ gpio_set_level(control->retimer_rst_gpio, 0);
+ msleep(1);
+ gpio_set_level(control->usb_ls_en_gpio, 0);
+ }
+}
diff --git a/board/todor/board.c b/board/todor/board.c
index ef0bbaf0a2..ce036ffab2 100644
--- a/board/todor/board.c
+++ b/board/todor/board.c
@@ -209,7 +209,6 @@ __override void board_cbi_init(void)
bb_controls[USBC_PORT_C0].shared_nvm = false;
bb_controls[USBC_PORT_C0].usb_ls_en_gpio = GPIO_USB_C0_LS_EN;
bb_controls[USBC_PORT_C0].retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL;
- bb_controls[USBC_PORT_C0].force_power_gpio = GPIO_USB_C0_RT_FORCE_PWR;
}
diff --git a/board/todor/gpio.inc b/board/todor/gpio.inc
index 345f485b39..0ccb99815e 100644
--- a/board/todor/gpio.inc
+++ b/board/todor/gpio.inc
@@ -95,9 +95,6 @@ GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C0_LS_EN)
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C0_RT_FORCE_PWR)
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(UART2_EC_RX, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/board/trondo/gpio.inc b/board/trondo/gpio.inc
index f95fb26947..4ea6194140 100644
--- a/board/trondo/gpio.inc
+++ b/board/trondo/gpio.inc
@@ -99,8 +99,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
diff --git a/board/volteer/gpio.inc b/board/volteer/gpio.inc
index 060534ef69..183f20c890 100644
--- a/board/volteer/gpio.inc
+++ b/board/volteer/gpio.inc
@@ -100,8 +100,6 @@ GPIO(USB_C1_RT_INT_ODL, PIN(F, 3), GPIO_INPUT)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(EC_H1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/board/voxel/board.c b/board/voxel/board.c
index 23c4c6391a..66015c522d 100644
--- a/board/voxel/board.c
+++ b/board/voxel/board.c
@@ -239,7 +239,6 @@ __override void board_cbi_init(void)
bb_controls[USBC_PORT_C0].shared_nvm = false;
bb_controls[USBC_PORT_C0].usb_ls_en_gpio = GPIO_USB_C0_LS_EN;
bb_controls[USBC_PORT_C0].retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL;
- bb_controls[USBC_PORT_C0].force_power_gpio = GPIO_USB_C0_RT_FORCE_PWR;
}
/******************************************************************************/
diff --git a/board/voxel/gpio.inc b/board/voxel/gpio.inc
index 0a1c6ae1cf..649ceef053 100644
--- a/board/voxel/gpio.inc
+++ b/board/voxel/gpio.inc
@@ -101,9 +101,6 @@ GPIO(USB_C1_OC_ODL, PIN(5, 0), GPIO_ODR_HIGH)
/* Don't have a load switch for retimer */
UNIMPLEMENTED(USB_C0_LS_EN)
UNIMPLEMENTED(USB_C1_LS_EN)
-/* Retimer Force Power enable is connected to AP */
-UNIMPLEMENTED(USB_C0_RT_FORCE_PWR)
-UNIMPLEMENTED(USB_C1_RT_FORCE_PWR)
/* Misc Signals */
GPIO(UART2_EC_RX, PIN(7, 5), GPIO_OUT_LOW) /* H1 Packet Mode */
diff --git a/driver/retimer/bb_retimer.c b/driver/retimer/bb_retimer.c
index f0785d1dce..e6c6ac6298 100644
--- a/driver/retimer/bb_retimer.c
+++ b/driver/retimer/bb_retimer.c
@@ -88,7 +88,7 @@ static int bb_retimer_write(const struct usb_mux *me,
buf, BB_RETIMER_WRITE_SIZE, NULL, 0);
}
-static void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
+__overridable void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
{
const struct bb_usb_control *control = &bb_controls[me->usb_port];
@@ -105,7 +105,6 @@ static void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
msleep(1);
gpio_set_level(control->retimer_rst_gpio, 1);
msleep(10);
- gpio_set_level(control->force_power_gpio, 1);
/*
* If BB retimer NVM is shared between multiple ports, allow
@@ -117,8 +116,6 @@ static void bb_retimer_power_handle(const struct usb_mux *me, int on_off)
else
msleep(20);
} else {
- gpio_set_level(control->force_power_gpio, 0);
- msleep(1);
gpio_set_level(control->retimer_rst_gpio, 0);
msleep(1);
gpio_set_level(control->usb_ls_en_gpio, 0);
diff --git a/driver/retimer/bb_retimer.h b/driver/retimer/bb_retimer.h
index 0993d58896..cdd75bbdd8 100644
--- a/driver/retimer/bb_retimer.h
+++ b/driver/retimer/bb_retimer.h
@@ -52,8 +52,6 @@ struct bb_usb_control {
enum gpio_signal usb_ls_en_gpio;
/* Retimer reset */
enum gpio_signal retimer_rst_gpio;
- /* Force power (active/low) */
- enum gpio_signal force_power_gpio;
};
#ifndef CONFIG_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG
@@ -62,4 +60,17 @@ extern const struct bb_usb_control bb_controls[];
extern struct bb_usb_control bb_controls[];
#endif
+/**
+ * Handle the power state of BB retimer
+ *
+ * Define override function at board level if the platform specific changes
+ * are needed to handle the power state of BB retimer.
+ *
+ * @param me Pointer to USB mux
+ * @param on_off BB retimer state to be changed
+ *
+ */
+__override_proto void bb_retimer_power_handle(const struct usb_mux *me,
+ int on_off);
+
#endif /* __CROS_EC_BB_RETIMER_H */