diff options
author | Simon Glass <sjg@chromium.org> | 2021-06-04 13:32:32 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-09 18:35:46 +0000 |
commit | 935deb921a4bddfe840f568de5a57843827e31cd (patch) | |
tree | 19d6dee4834ac3915b98e8339bc32292af80170d | |
parent | 0a7d8b159229ace9d5b8131d6be61d69a71e6e69 (diff) | |
download | chrome-ec-935deb921a4bddfe840f568de5a57843827e31cd.tar.gz |
Create a public header for ps8743.c
Add a separate public header for this chip so we can include it from
Zephyr.
BUG=b:189855648
BRANCH=none
TEST=make BOARD=hayato -j30
Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: Ieefe30bbacac0fea2132355c88626525fa37c3d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2941809
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Tested-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | driver/usb_mux/ps8743.h | 64 | ||||
-rw-r--r-- | include/driver/usb_mux/ps8743_public.h | 76 |
2 files changed, 77 insertions, 63 deletions
diff --git a/driver/usb_mux/ps8743.h b/driver/usb_mux/ps8743.h index a520f970ac..741b93e98a 100644 --- a/driver/usb_mux/ps8743.h +++ b/driver/usb_mux/ps8743.h @@ -9,25 +9,7 @@ #define __CROS_EC_PS8743_H #include "usb_mux.h" - -#define PS8743_I2C_ADDR0_FLAG 0x10 -#define PS8743_I2C_ADDR1_FLAG 0x11 -#define PS8743_I2C_ADDR2_FLAG 0x19 -#define PS8743_I2C_ADDR3_FLAG 0x1a - -/* Mode register for setting mux */ -#define PS8743_REG_MODE 0x00 -#define PS8743_MODE_IN_HPD_ASSERT BIT(0) -#define PS8743_MODE_IN_HPD_CONTROL BIT(1) -#define PS8743_MODE_FLIP_ENABLE BIT(2) -#define PS8743_MODE_FLIP_REG_CONTROL BIT(3) -#define PS8743_MODE_USB_ENABLE BIT(4) -#define PS8743_MODE_USB_REG_CONTROL BIT(5) -#define PS8743_MODE_DP_ENABLE BIT(6) -#define PS8743_MODE_DP_REG_CONTROL BIT(7) -/* To reset the state machine to default */ -#define PS8743_MODE_POWER_DOWN (PS8743_MODE_USB_REG_CONTROL | \ - PS8743_MODE_DP_REG_CONTROL) +#include "usb_mux/ps8743_public.h" /* Status register for checking mux state */ #define PS8743_REG_STATUS 0x09 @@ -47,48 +29,4 @@ #define PS8743_CHIP_ID1 0x41 #define PS8743_CHIP_ID2 0x87 -/* USB equalization settings for Host to Mux */ -#define PS8743_REG_USB_EQ_TX 0x32 -#define PS8743_USB_EQ_TX_12_8_DB 0x00 -#define PS8743_USB_EQ_TX_17_DB 0x20 -#define PS8743_USB_EQ_TX_7_7_DB 0x40 -#define PS8743_USB_EQ_TX_3_6_DB 0x60 -#define PS8743_USB_EQ_TX_15_DB 0x80 -#define PS8743_USB_EQ_TX_10_9_DB 0xc0 -#define PS8743_USB_EQ_TX_4_5_DB 0xe0 - -/* USB equalization settings for Connector to Mux */ -#define PS8743_REG_USB_EQ_RX 0x3b -#define PS8743_USB_EQ_RX_2_4_DB 0x00 -#define PS8743_USB_EQ_RX_5_DB 0x10 -#define PS8743_USB_EQ_RX_6_5_DB 0x20 -#define PS8743_USB_EQ_RX_7_4_DB 0x30 -#define PS8743_USB_EQ_RX_8_7_DB 0x40 -#define PS8743_USB_EQ_RX_10_9_DB 0x50 -#define PS8743_USB_EQ_RX_12_8_DB 0x60 -#define PS8743_USB_EQ_RX_13_8_DB 0x70 -#define PS8743_USB_EQ_RX_14_8_DB 0x80 -#define PS8743_USB_EQ_RX_15_4_DB 0x90 -#define PS8743_USB_EQ_RX_16_0_DB 0xa0 -#define PS8743_USB_EQ_RX_16_7_DB 0xb0 -#define PS8743_USB_EQ_RX_18_8_DB 0xc0 -#define PS8743_USB_EQ_RX_21_3_DB 0xd0 -#define PS8743_USB_EQ_RX_22_2_DB 0xe0 - -/* USB High Speed Signal Detector thershold adjustment */ -#define PS8743_REG_HS_DET_THRESHOLD 0x3c -#define PS8743_USB_HS_THRESH_DEFAULT 0x00 -#define PS8743_USB_HS_THRESH_POS_10 0x20 -#define PS8743_USB_HS_THRESH_POS_33 0x40 -#define PS8743_USB_HS_THRESH_NEG_10 0x60 -#define PS8743_USB_HS_THRESH_NEG_25 0x80 -#define PS8743_USB_HS_THRESH_POS_25 0xa0 -#define PS8743_USB_HS_THRESH_NEG_45 0xc0 -#define PS8743_USB_HS_THRESH_NEG_35 0xe0 - -int ps8743_tune_usb_eq(const struct usb_mux *me, uint8_t tx, uint8_t rx); -int ps8743_write(const struct usb_mux *me, uint8_t reg, uint8_t val); -int ps8743_read(const struct usb_mux *me, uint8_t reg, int *val); -int ps8743_check_chip_id(const struct usb_mux *me, int *val); - #endif /* __CROS_EC_PS8743_H */ diff --git a/include/driver/usb_mux/ps8743_public.h b/include/driver/usb_mux/ps8743_public.h new file mode 100644 index 0000000000..8a843aaf7f --- /dev/null +++ b/include/driver/usb_mux/ps8743_public.h @@ -0,0 +1,76 @@ +/* Copyright 2021 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. + * + * Parade PS8743 USB Type-C Redriving Switch for USB Host / DisplayPort. + */ + +#ifndef __CROS_EC_DRIVER_USB_MUX_PS8743_PUBLIC_H +#define __CROS_EC_DRIVER_USB_MUX_PS8743_PUBLIC_H + +#include <inttypes.h> + +#define PS8743_I2C_ADDR0_FLAG 0x10 +#define PS8743_I2C_ADDR1_FLAG 0x11 +#define PS8743_I2C_ADDR2_FLAG 0x19 +#define PS8743_I2C_ADDR3_FLAG 0x1a + +/* Mode register for setting mux */ +#define PS8743_REG_MODE 0x00 +#define PS8743_MODE_IN_HPD_ASSERT BIT(0) +#define PS8743_MODE_IN_HPD_CONTROL BIT(1) +#define PS8743_MODE_FLIP_ENABLE BIT(2) +#define PS8743_MODE_FLIP_REG_CONTROL BIT(3) +#define PS8743_MODE_USB_ENABLE BIT(4) +#define PS8743_MODE_USB_REG_CONTROL BIT(5) +#define PS8743_MODE_DP_ENABLE BIT(6) +#define PS8743_MODE_DP_REG_CONTROL BIT(7) +/* To reset the state machine to default */ +#define PS8743_MODE_POWER_DOWN (PS8743_MODE_USB_REG_CONTROL | \ + PS8743_MODE_DP_REG_CONTROL) + +/* USB equalization settings for Host to Mux */ +#define PS8743_REG_USB_EQ_TX 0x32 +#define PS8743_USB_EQ_TX_12_8_DB 0x00 +#define PS8743_USB_EQ_TX_17_DB 0x20 +#define PS8743_USB_EQ_TX_7_7_DB 0x40 +#define PS8743_USB_EQ_TX_3_6_DB 0x60 +#define PS8743_USB_EQ_TX_15_DB 0x80 +#define PS8743_USB_EQ_TX_10_9_DB 0xc0 +#define PS8743_USB_EQ_TX_4_5_DB 0xe0 + +/* USB equalization settings for Connector to Mux */ +#define PS8743_REG_USB_EQ_RX 0x3b +#define PS8743_USB_EQ_RX_2_4_DB 0x00 +#define PS8743_USB_EQ_RX_5_DB 0x10 +#define PS8743_USB_EQ_RX_6_5_DB 0x20 +#define PS8743_USB_EQ_RX_7_4_DB 0x30 +#define PS8743_USB_EQ_RX_8_7_DB 0x40 +#define PS8743_USB_EQ_RX_10_9_DB 0x50 +#define PS8743_USB_EQ_RX_12_8_DB 0x60 +#define PS8743_USB_EQ_RX_13_8_DB 0x70 +#define PS8743_USB_EQ_RX_14_8_DB 0x80 +#define PS8743_USB_EQ_RX_15_4_DB 0x90 +#define PS8743_USB_EQ_RX_16_0_DB 0xa0 +#define PS8743_USB_EQ_RX_16_7_DB 0xb0 +#define PS8743_USB_EQ_RX_18_8_DB 0xc0 +#define PS8743_USB_EQ_RX_21_3_DB 0xd0 +#define PS8743_USB_EQ_RX_22_2_DB 0xe0 + +/* USB High Speed Signal Detector thershold adjustment */ +#define PS8743_REG_HS_DET_THRESHOLD 0x3c +#define PS8743_USB_HS_THRESH_DEFAULT 0x00 +#define PS8743_USB_HS_THRESH_POS_10 0x20 +#define PS8743_USB_HS_THRESH_POS_33 0x40 +#define PS8743_USB_HS_THRESH_NEG_10 0x60 +#define PS8743_USB_HS_THRESH_NEG_25 0x80 +#define PS8743_USB_HS_THRESH_POS_25 0xa0 +#define PS8743_USB_HS_THRESH_NEG_45 0xc0 +#define PS8743_USB_HS_THRESH_NEG_35 0xe0 + +int ps8743_tune_usb_eq(const struct usb_mux *me, uint8_t tx, uint8_t rx); +int ps8743_write(const struct usb_mux *me, uint8_t reg, uint8_t val); +int ps8743_read(const struct usb_mux *me, uint8_t reg, int *val); +int ps8743_check_chip_id(const struct usb_mux *me, int *val); + +#endif /* __CROS_EC_DRIVER_USB_MUX_PS8743_PUBLIC_H */ |