mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-31 02:51:26 +00:00
In USB FS on a bulk/interrupt endpoint, the transactions normally toggles between DATA0 and DATA1 PIDs. After a USB suspend/resume cycle, we need to restart from the PID we were at before suspend. In our current code, when going to deep-sleep during USB suspend, we are re-initializing everything when the MCU restarts at each resume. So we set implicitly the PID to DATA0. The USB Hardware IP just silently discards the packet when the PID of an incoming OUT packet is not matching the expectation in the endpoint register. In order to preserve DATA PIDS, record the state of the PID toggling on each endpoint when going to deep-sleep and restore it during the USB initialization. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:38160821 TEST=manual, plug a HG proto2 on a Linux host machine and enable 'auto-suspend' for this USB device. Let it go to sleep and wake-it up by sending a U2FHID request. Repeat the process several times and see that the key answers every time (while it was failing after the second cycle before). Change-Id: I75e2cfc39f22483d9e9b32c5f8b887dbafc37108 Reviewed-on: https://chromium-review.googlesource.com/655238 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
45 lines
1.2 KiB
C
45 lines
1.2 KiB
C
/* Copyright 2016 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.
|
|
*/
|
|
|
|
#ifndef __CROS_EC_INIT_CHIP_H
|
|
#define __CROS_EC_INIT_CHIP_H
|
|
|
|
/**
|
|
* This is the current state of the PMU persistent registers. There are two
|
|
* types: long life and pwrdn scratch. Long life will persist through any
|
|
* reset other than POR. PWRDN scratch only survives deep sleep.
|
|
*
|
|
* LONG_LIFE_SCRATCH 0 - 2
|
|
* SCRATCH0 - Rollback counter
|
|
* SCRATCH1 - Board properties
|
|
* SCRATCH2
|
|
*
|
|
* PWRDN_SCRATCH 0 - 15 - Locked
|
|
*
|
|
* PWRDN_SCRATCH 16 - 27 - Can be used by RW
|
|
* SCRATCH16 - Indicator that firmware is running for debug purposes
|
|
* SCRATCH17 - deep sleep count
|
|
* SCRATCH18 - Preserving USB_DCFG through deep sleep
|
|
* SCRATCH19 - Preserving USB data sequencing PID through deep sleep
|
|
*
|
|
* PWRDN_SCRATCH 28 - 31 - Reserved for boot rom
|
|
*/
|
|
|
|
|
|
enum permission_level {
|
|
PERMISSION_LOW = 0x00,
|
|
PERMISSION_MEDIUM = 0x33, /* APPS run at medium */
|
|
PERMISSION_HIGH = 0x3C,
|
|
PERMISSION_HIGHEST = 0x55
|
|
};
|
|
|
|
int runlevel_is_high(void);
|
|
void init_runlevel(const enum permission_level desired_level);
|
|
|
|
void init_jittery_clock(int highsec);
|
|
void init_sof_clock(void);
|
|
|
|
#endif /* __CROS_EC_INIT_CHIP_H */
|