From 934f345ec566aca297a72f8548a36cc024e5f64a Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Thu, 23 Apr 2015 14:39:41 -0700 Subject: pd: ignore cable reset Identify and ignore cable reset PD command BUG=chrome-os-partner:39464 BRANCH=samus TEST=connect two samus'. on one samus add code to send a cable reset like such: int send_cable_reset(int port) { int off; CPRINTF("C%d Send cable reset\n", port); /* 64-bit preamble */ off = pd_write_preamble(port); /* Hard-Reset: 3x RST-1 + 1x RST-2 */ off = pd_write_sym(port, off, BMC(PD_RST1)); off = pd_write_sym(port, off, BMC(PD_SYNC1)); off = pd_write_sym(port, off, BMC(PD_RST1)); off = pd_write_sym(port, off, BMC(PD_SYNC3)); /* Ensure that we have a final edge */ off = pd_write_last_edge(port, off); /* Transmit the packet */ if (pd_start_tx(port, pd[port].polarity, off) < 0) { pd[port].send_error = -5; return -5; } pd_tx_done(port, pd[port].polarity); /* Keep RX monitoring on */ pd_rx_enable_monitoring(port); return 0; } Without this CL, the receiving samus times out and ends up causing equivalent of hard reset. With this CL, we receive cable reset and drop it. Also used twinkie to measure goodCRC delay. No measureable change in delay on samus and zinger. Samus delay is ~70us and zinger delay is ~65us. Change-Id: Ic0e871c8cf96502b861f430e05ee145881fb55fa Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/266981 Reviewed-by: Vincent Palatin --- include/usb_pd.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/usb_pd.h b/include/usb_pd.h index 97dbeed51e..478f840193 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -14,10 +14,12 @@ #define PD_HOST_COMMAND_TIMEOUT_US SECOND enum pd_errors { - PD_ERR_INVAL = -1, /* Invalid packet */ - PD_ERR_HARD_RESET = -2, /* Got a Hard-Reset packet */ - PD_ERR_CRC = -3, /* CRC mismatch */ - PD_ERR_ID = -4, /* Invalid ID number */ + PD_ERR_INVAL = -1, /* Invalid packet */ + PD_ERR_HARD_RESET = -2, /* Got a Hard-Reset packet */ + PD_ERR_CRC = -3, /* CRC mismatch */ + PD_ERR_ID = -4, /* Invalid ID number */ + PD_ERR_UNSUPPORTED_SOP = -5, /* Unsupported SOP */ + PD_ERR_CABLE_RESET = -6 /* Got a Cable-Reset packet */ }; /* incoming packet event (for the USB PD task) */ -- cgit v1.2.1