From f9fd94f64d3294c2005048164361e3697d63a7bb Mon Sep 17 00:00:00 2001 From: Denis Brockus Date: Thu, 21 Nov 2019 07:30:54 -0700 Subject: usbc: make BB virtual mux retimer compatible with non-virtual Changed the driver interface for BB virtual mux retimer to stop using global functions and use the usb_retimers array instead. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I56befaca1720eb2f4e0599a983629b4df45dc76b Signed-off-by: Denis Brockus Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928121 Reviewed-by: Edward Hill Commit-Queue: Edward Hill --- include/config.h | 12 ++---------- include/usb_mux.h | 19 +++++++++++-------- include/usb_pd.h | 2 -- include/usb_retimer.h | 38 -------------------------------------- 4 files changed, 13 insertions(+), 58 deletions(-) delete mode 100644 include/usb_retimer.h (limited to 'include') diff --git a/include/config.h b/include/config.h index d9b8afcd8b..add8fcfa0e 100644 --- a/include/config.h +++ b/include/config.h @@ -3846,11 +3846,6 @@ * automatically be included. This does not stop a board/basebord.h * configration from defining these as well. */ - -/* Type-C retimer used with virtual mux */ -#undef CONFIG_USBC_VIRTUAL_MUX_RETIMER - -/* Type-C retimer used with real mux */ #undef CONFIG_USBC_MUX_RETIMER /* @@ -4748,11 +4743,8 @@ * for convenience. Any retimer driver that also needs USBC MUX Retimers * will not have to include it in their own board/baseboard.h file. */ -#ifdef CONFIG_USBC_RETIMER_INTEL_BB -#define CONFIG_USBC_VIRTUAL_MUX_RETIMER -#endif - -#ifdef CONFIG_USBC_RETIMER_PI3DPX1207 +#if defined(CONFIG_USBC_RETIMER_INTEL_BB) || \ + defined(CONFIG_USBC_RETIMER_PI3DPX1207) #define CONFIG_USBC_MUX_RETIMER #endif diff --git a/include/usb_mux.h b/include/usb_mux.h index 0a5a19a338..c0e781f65d 100644 --- a/include/usb_mux.h +++ b/include/usb_mux.h @@ -178,20 +178,23 @@ struct usb_retimer_driver { struct usb_retimer { /* * All of the fields are provided on an as needed basis. - * If your retimer does not perform I2C operations, then - * values would not be set. This includes the driver - * field, which would indicate no retimer driver is to - * be called. Values that are not specifically popuplated - * shall be 0/NULL. + * If your retimer does not use the provided machanism then + * values would not be set (defaulted to 0/NULL). This + * defaulting includes the driver field, which would indicate + * no retimer driver is to be called. */ /* I2C port and slave address */ const int i2c_port; const uint16_t i2c_addr_flags; - /* GPIOs for enabling the retimer and DP mode */ - const int gpio_enable; - const int gpio_dp_enable; + /* Retimer control GPIOs */ + const enum gpio_signal gpio_enable; /* Retimer enable */ + const enum gpio_signal gpio_dp_enable; /* DP Mode enable */ + + const enum gpio_signal usb_ls_en_gpio; /* Load switch enable */ + const enum gpio_signal retimer_rst_gpio;/* Retimer reset */ + const enum gpio_signal force_power_gpio;/* Force power (active/low) */ /* Driver interfaces for this retimer */ const struct usb_retimer_driver *driver; diff --git a/include/usb_pd.h b/include/usb_pd.h index ca6f63254b..6051706670 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -2275,7 +2275,6 @@ static inline uint8_t board_get_usb_pd_port_count(void) #endif /* CONFIG_USB_POWER_DELIVERY */ #endif /* CONFIG_USB_PD_PORT_MAX_COUNT */ -#ifdef CONFIG_USBC_VIRTUAL_MUX_RETIMER /** * Return true if specified PD port partner is UFP. * @@ -2289,7 +2288,6 @@ int pd_partner_is_ufp(int port); * @param port USB-C port number */ int pd_is_debug_acc(int port); -#endif /* * Notify the AP that we have entered into DisplayPort Alternate Mode. This diff --git a/include/usb_retimer.h b/include/usb_retimer.h deleted file mode 100644 index 9b750b51bd..0000000000 --- a/include/usb_retimer.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright 2019 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* USB retimer driver */ - -#ifndef __CROS_EC_USB_RETIMER_H -#define __CROS_EC_USB_RETIMER_H - -#include "usb_mux.h" - -/** - * Set USB retimer state - * - * @param port Port number. - * @param mux_state current MUX state - * @return Non-zero if fail; otherwise, zero. - */ -int retimer_set_state(int port, mux_state_t mux_state); - -/** - * USB retimer enter to low power mode. - * - * @param port Port number. - * @return Non-zero if fail; otherwise, zero. - */ -int retimer_low_power_mode(int port); - -/** - * Initialize USB Retimer to its default state. - * - * @param port Port number. - * @return Non-zero if fail; otherwise, zero. - */ -int retimer_init(int port); - -#endif /* __CROS_EC_USB_RETIMER_H */ -- cgit v1.2.1