summaryrefslogtreecommitdiff
path: root/chip/g/usb.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2016-05-03 12:49:22 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-05-04 16:15:02 -0700
commit3ef613fa4403df1dcb063540553349e092bd8f5d (patch)
treebdbf648b7d0007cb8725b266075e7c0954352065 /chip/g/usb.c
parentbdbf0810d061ca535b23c711349fa741fb96cf67 (diff)
downloadchrome-ec-3ef613fa4403df1dcb063540553349e092bd8f5d.tar.gz
Cr50: Enable the USB SOF clock auto-calibrationstabilize-8282.B
The timer clock nominally requires no firmware settings. It is tuned in manufacturing to be centered around 24MHz. However, it will potentially migrate away from 24MHz based upon variations in temperature and voltage. The variation is approximately 0.1-0.5MHz, based upon functional simulations, and backed up with observations in the lab. This CL enables a hardware feature to dynamically tune the timer clock if the device has an active USB port, by monitoring the SOF (start of frame) USB packets that are sent by the USB host every milllsecond with 500ppm accuracy. BUG=chrome-os-partner:50800 BRANCH=none TEST=make buildall; run on Cr50 hardware Verified that deep sleep, USB suspend/resume, etc continue to work with this enabled. Not too surprising, since I've never encountered a problem without it. In addition, I monitored XO_CLK_TIMER_CURRENT to see that the timer adjustments are being made while connecting and disconnecting from USB, entering andleaving sleep and deep sleep, etc. They are. Change-Id: I328b6416bc40ef8718815c5e09cf91ec1c6646f0 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/342145 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'chip/g/usb.c')
-rw-r--r--chip/g/usb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/chip/g/usb.c b/chip/g/usb.c
index b5e036d60b..d47912dd02 100644
--- a/chip/g/usb.c
+++ b/chip/g/usb.c
@@ -9,6 +9,7 @@
#include "console.h"
#include "gpio.h"
#include "hooks.h"
+#include "init_chip.h"
#include "link_defs.h"
#include "registers.h"
#include "system.h"
@@ -1073,6 +1074,9 @@ static void usb_reset(void)
/* Reinitialize all the endpoints */
usb_init_endpoints();
+
+ /* Init the clock calibrator */
+ init_sof_clock();
}
static void usb_resetdet(void)
@@ -1188,14 +1192,12 @@ static void usb_softreset(void)
void usb_connect(void)
{
- CPRINTS("%s", __func__);
print_later("usb_connect()", 0, 0, 0, 0, 0);
GR_USB_DCTL &= ~DCTL_SFTDISCON;
}
void usb_disconnect(void)
{
- CPRINTS("%s", __func__);
print_later("usb_disconnect()", 0, 0, 0, 0, 0);
GR_USB_DCTL |= DCTL_SFTDISCON;