mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 02:45:33 +00:00
In preparation for adding support for additional USB-C mux chips, add a new high-level USB-C mux interface usb_mux.c. usb_mux functions are now called from pd code instead of board-level functions. usb_mux calls down into a mux chip-specific driver (currently pi3usb30532) or board-specific drivers which toggle GPIOs (for legacy boards). BUG=chrome-os-partner:41696 TEST=Manual on Glados in subsequent commit. Verify set() and get() functions set and return consistent values. Verify that USB SS device functions when muxes are set to dock or USB. Also, verify that DP dongle and USB SS device are functional on both PD ports on samus_pd. BRANCH=None Change-Id: Ib6477f489310f3be1430585ea09fea26f57e3752 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/281435 Reviewed-by: Alec Berg <alecaberg@chromium.org>
68 lines
1.8 KiB
C
68 lines
1.8 KiB
C
/* Copyright 2015 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.
|
|
*
|
|
* Pericom PI3USB30532 USB port switch driver.
|
|
*/
|
|
|
|
#ifndef __CROS_EC_PI3USB30532_H
|
|
#define __CROS_EC_PI3USB30532_H
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include "usb_pd.h"
|
|
|
|
/* USB switch registers */
|
|
#define PI3USB30532_REG_ADDR 0x00
|
|
#define PI3USB30532_REG_VENDOR 0x01
|
|
#define PI3USB30532_REG_CONTROL 0x02
|
|
/* Control register field */
|
|
#define PI3USB30532_CTRL_MASK 0x7
|
|
#define PI3USB30532_CTRL_RSVD 0
|
|
/* Switch vendor ID */
|
|
#define PI3USB30532_VENDOR_ID 0
|
|
|
|
/* PI3USB30532 control flags */
|
|
#define PI3USB30532_BIT_SWAP (1 << 0)
|
|
#define PI3USB30532_BIT_DP (1 << 1)
|
|
#define PI3USB30532_BIT_USB (1 << 2)
|
|
|
|
/* PI3USB30532 modes */
|
|
/* Power down, switch open */
|
|
#define PI3USB30532_MODE_POWERDOWN 0
|
|
/* Keep power on, switch open */
|
|
#define PI3USB30532_MODE_POWERON 1
|
|
/* 4-lane DP 1.2
|
|
* dp0~3 : rx2, tx2, tx1, rx1
|
|
* hpd+/-: rfu1, rfu2
|
|
*/
|
|
#define PI3USB30532_MODE_DP PI3USB30532_BIT_DP
|
|
/* 4-lane DP 1.2 swap
|
|
* dp0~3 : rx1, tx1, tx2, rx2
|
|
* hpd+/-: rfu2, rfu1
|
|
*/
|
|
#define PI3USB30532_MODE_DP_SWAP (PI3USB30532_MODE_DP | PI3USB30532_BIT_SWAP)
|
|
/* USB3
|
|
* tx/rx : tx1, rx1
|
|
*/
|
|
#define PI3USB30532_MODE_USB PI3USB30532_BIT_USB
|
|
/* USB3 swap
|
|
* tx/rx : tx2, rx2
|
|
*/
|
|
#define PI3USB30532_MODE_USB_SWAP (PI3USB30532_MODE_USB | PI3USB30532_BIT_SWAP)
|
|
/* 2-lane DP 1.2 + USB3
|
|
* tx/rx : tx1, rx1
|
|
* dp0~1 : rx2, tx2
|
|
* hpd+/-: rfu1, rfu2
|
|
*/
|
|
#define PI3USB30532_MODE_DP_USB (PI3USB30532_BIT_DP | PI3USB30532_BIT_USB)
|
|
/* 2-lane DP 1.2 + USB3, swap
|
|
* tx/rx : tx2, rx2
|
|
* dp0-1 : rx1, tx1
|
|
* hpd+/-: rfu2, rfu1
|
|
*/
|
|
#define PI3USB30532_MODE_DP_USB_SWAP (PI3USB30532_MODE_DP_USB | \
|
|
PI3USB30532_BIT_SWAP)
|
|
|
|
#endif /* __CROS_EC_PI3USB30532_H */
|