mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 18:11:05 +00:00
Cr50 needs to connect to the AP phy when not in ccd so cr50 can be updated and used as a gnubby. This change uses the strapping options to detect when it is on reef and modifies the ccd behavior to initialize usb on the AP phy when ccd is disabled. On gru the cr50 behavior is unchanged. In RDD this change removes the checks that the current_map is the correct one based on the detected debug state. rdd_init calls rdd_interrupt to set up the usb and ccd state correctly. Having that check prevents that initial rdd_interrupt from calling rdd_detached. Before rdd_detached just disabled usb and we knew during init it would already be disabled. Now we want to make sure it is called if a debug accessory is not attached to initialize usb on the AP PHY. BUG=chrome-os-partner:56098 BRANCH=none TEST=manual verify ccd still works on gru disconnect suzyq and reset reef. run lsusb on the AP and verify it shows cr50 as a device. connect suzyq and check that the AP no longer sees cr50. disconnect suzyq and verify the AP sees it again Change-Id: I3c1ccc54895835bce12302f3ea43fc2e751b4c97 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/372920 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
63 lines
1.4 KiB
C
63 lines
1.4 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_COUNT;
|
|
|
|
void ccd_set_mode(enum ccd_mode new_mode)
|
|
{
|
|
if (new_mode == current_mode)
|
|
return;
|
|
|
|
#ifndef CONFIG_USB_SELECT_PHY
|
|
if (current_mode != CCD_MODE_DISABLED)
|
|
#endif
|
|
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
|
|
|
|
#ifdef CONFIG_USB_SELECT_PHY
|
|
ccd_phy_init(new_mode != CCD_MODE_DISABLED);
|
|
#else
|
|
if (new_mode != CCD_MODE_DISABLED)
|
|
usb_init();
|
|
#endif
|
|
}
|