Files
OpenCellular/chip/g/clock.c
Mary Ruthven d281308b48 cr50: Detect debug cable and switch the PHY
This adds support for RD Detection on cr50. It can be used to detect a
debug device and signal the controller to switch from the AP PHY to the
to CCD PHY. When RDCC1 and 2 no longer detect the debug device, then
the controller switches back to using the USB to AP PHY.

BUG=chrome-os-partner:50700
BRANCH=none
TEST=change the value on RDCC1 and RDCC1 and check that the usb
controller connects to the right PHY.

Change-Id: Ice01a45a31fe1932945f89df2e3b851f4d287a17
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/338454
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-13 20:10:38 -07:00

56 lines
1.1 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.
*/
#include "clock.h"
#include "registers.h"
#include "pmu.h"
void clock_init(void)
{
pmu_clock_en(PERIPH_TIMEHS0);
pmu_clock_en(PERIPH_TIMEHS1);
pmu_clock_en(PERIPH_TIMELS0);
pmu_clock_switch_xo();
}
void clock_enable_module(enum module_id module, int enable)
{
pmu_clock_func clock_func;
clock_func = (enable) ? pmu_clock_en : pmu_clock_dis;
switch (module) {
case MODULE_UART:
clock_func(PERIPH_UART0);
clock_func(PERIPH_UART1);
clock_func(PERIPH_UART2);
break;
case MODULE_I2C:
clock_func(PERIPH_I2C0);
clock_func(PERIPH_I2C1);
break;
case MODULE_RDD:
clock_func(PERIPH_RDD0);
break;
case MODULE_SPI_FLASH:
case MODULE_SPI_MASTER:
clock_func(PERIPH_SPI);
break;
case MODULE_SPI:
clock_func(PERIPH_SPS);
break;
case MODULE_USB:
clock_func(PERIPH_USB0);
clock_func(PERIPH_USB0_USB_PHY);
pmu_enable_clock_doubler();
break;
case MODULE_PMU:
clock_func(PERIPH_PMU);
break;
default:
break;
}
return;
}