Files
OpenCellular/common/case_closed_debug.c
Mary Ruthven 2df0218c18 cr50: Dont switch from PHY 1 to 0 when disabling CCD
The AP no longer uses PHY0 to to interact with Cr50. Cr50 only uses PHY1
so dont switch the PHY when disabling CCD just release the usb.

BUG=none
BRANCH=none
TEST=After running 'ccd disable' the command 'usb' still returns PHY B,
but 'lsusb | grep 5014' on the host doesn't show any devices. When CCD
is enabled 'lsusb | grep 5014' shows a device on the host.

Change-Id: Icec0acc7a0d00f7eb56c6feef3ff4cf5a3f99735
Reviewed-on: https://chromium-review.googlesource.com/359931
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-07-11 21:28:06 -07:00

57 lines
1.3 KiB
C

/* Copyright (c) 2014 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.
*
* Case Closed Debug common implementation
*/
#include "case_closed_debug.h"
#include "common.h"
#include "usb_api.h"
#include "usb_console.h"
#include "usb_spi.h"
#if !defined(CONFIG_USB)
#error "CONFIG_USB must be defined to use Case Closed Debugging"
#endif
#if !defined(CONFIG_USB_CONSOLE)
#error "CONFIG_USB_CONSOLE must be defined to use Case Closed Debugging"
#endif
#if !defined(CONFIG_USB_INHIBIT_INIT)
#error "CONFIG_USB_INHIBIT_INIT must be defined to use Case Closed Debugging"
#endif
#if defined(CONFIG_USB_SPI)
USB_SPI_CONFIG(ccd_usb_spi, USB_IFACE_SPI, USB_EP_SPI);
#endif
static enum ccd_mode current_mode = CCD_MODE_DISABLED;
void ccd_set_mode(enum ccd_mode new_mode)
{
if (new_mode == current_mode)
return;
if (current_mode != CCD_MODE_DISABLED)
usb_release();
current_mode = new_mode;
/*
* The forwarding of the local console over USB is read-only
* if we are not in the fully enabled mode.
*/
usb_console_enable(new_mode != CCD_MODE_DISABLED,
new_mode != CCD_MODE_ENABLED);
#if defined(CONFIG_USB_SPI)
usb_spi_enable(&ccd_usb_spi, new_mode == CCD_MODE_ENABLED);
#endif
if (new_mode != CCD_MODE_DISABLED)
usb_init();
}