diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2021-11-04 12:11:58 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-05 04:22:34 +0000 |
commit | 252457d4b21f46889eebad61d4c0a65331919cec (patch) | |
tree | 01856c4d31d710b20e85a74c8d7b5836e35c3b98 /board/hoho/board.c | |
parent | 08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff) | |
download | chrome-ec-stabilize-14438.B-ish.tar.gz |
ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ish
In the interest of making long-term branch maintenance incur as little
technical debt on us as possible, we should not maintain any files on
the branch we are not actually using.
This has the added effect of making it extremely clear when merging CLs
from the main branch when changes have the possibility to affect us.
The follow-on CL adds a convenience script to actually pull updates from
the main branch and generate a CL for the update.
BUG=b:204206272
BRANCH=ish
TEST=make BOARD=arcada_ish && make BOARD=drallion_ish
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'board/hoho/board.c')
-rw-r--r-- | board/hoho/board.c | 248 |
1 files changed, 0 insertions, 248 deletions
diff --git a/board/hoho/board.c b/board/hoho/board.c deleted file mode 100644 index 07b772c826..0000000000 --- a/board/hoho/board.c +++ /dev/null @@ -1,248 +0,0 @@ -/* Copyright 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. - */ -/* Hoho dongle configuration */ - -#include "adc.h" -#include "common.h" -#include "ec_commands.h" -#include "ec_version.h" -#include "gpio.h" -#include "hooks.h" -#include "mcdp28x0.h" -#include "registers.h" -#include "task.h" -#include "usb_bb.h" -#include "usb_descriptor.h" -#include "usb_pd.h" -#include "timer.h" -#include "util.h" - -static volatile uint64_t hpd_prev_ts; -static volatile int hpd_prev_level; - -void hpd_event(enum gpio_signal signal); -#include "gpio_list.h" - -/** - * Hotplug detect deferred task - * - * Called after level change on hpd GPIO to evaluate (and debounce) what event - * has occurred. There are 3 events that occur on HPD: - * 1. low : downstream display sink is deattached - * 2. high : downstream display sink is attached - * 3. irq : downstream display sink signalling an interrupt. - * - * The debounce times for these various events are: - * HPD_USTREAM_DEBOUNCE_LVL : min pulse width of level value. - * HPD_USTREAM_DEBOUNCE_IRQ : min pulse width of IRQ low pulse. - * - * lvl(n-2) lvl(n-1) lvl prev_delta now_delta event - * ---------------------------------------------------- - * 1 0 1 <IRQ n/a low glitch (ignore) - * 1 0 1 >IRQ <LVL irq - * x 0 1 n/a >LVL high - * 0 1 0 <LVL n/a high glitch (ignore) - * x 1 0 n/a >LVL low - */ - -void hpd_irq_deferred(void) -{ - pd_send_hpd(0, hpd_irq); -} -DECLARE_DEFERRED(hpd_irq_deferred); - -void hpd_lvl_deferred(void) -{ - int level = gpio_get_level(GPIO_DP_HPD); - - if (level != hpd_prev_level) - /* It's a glitch while in deferred or canceled action */ - return; - - pd_send_hpd(0, (level) ? hpd_high : hpd_low); -} -DECLARE_DEFERRED(hpd_lvl_deferred); - -void hpd_event(enum gpio_signal signal) -{ - timestamp_t now = get_time(); - int level = gpio_get_level(signal); - uint64_t cur_delta = now.val - hpd_prev_ts; - - /* store current time */ - hpd_prev_ts = now.val; - - /* All previous hpd level events need to be re-triggered */ - hook_call_deferred(&hpd_lvl_deferred_data, -1); - - /* It's a glitch. Previous time moves but level is the same. */ - if (cur_delta < HPD_USTREAM_DEBOUNCE_IRQ) - return; - - if ((!hpd_prev_level && level) && - (cur_delta < HPD_USTREAM_DEBOUNCE_LVL)) - /* It's an irq */ - hook_call_deferred(&hpd_irq_deferred_data, 0); - else if (cur_delta >= HPD_USTREAM_DEBOUNCE_LVL) - hook_call_deferred(&hpd_lvl_deferred_data, - HPD_USTREAM_DEBOUNCE_LVL); - - hpd_prev_level = level; -} - -/* Initialize board. */ -void board_config_pre_init(void) -{ - /* enable SYSCFG clock */ - STM32_RCC_APB2ENR |= BIT(0); - /* Remap USART DMA to match the USART driver */ - STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10);/* Remap USART1 RX/TX DMA */ -} - -#ifdef CONFIG_SPI_FLASH - -static void board_init_spi2(void) -{ - /* Remap SPI2 to DMA channels 6 and 7 */ - STM32_SYSCFG_CFGR1 |= BIT(24); - - /* Set pin NSS to general purpose output mode (01b). */ - /* Set pins SCK, MISO, and MOSI to alternate function (10b). */ - STM32_GPIO_MODER(GPIO_B) &= ~0xff000000; - STM32_GPIO_MODER(GPIO_B) |= 0xa9000000; - - /* Set all four pins to alternate function 0 */ - STM32_GPIO_AFRH(GPIO_B) &= ~(0xffff0000); - - /* Set all four pins to output push-pull */ - STM32_GPIO_OTYPER(GPIO_B) &= ~(0xf000); - - /* Set pullup on NSS */ - STM32_GPIO_PUPDR(GPIO_B) |= 0x1000000; - - /* Set all four pins to high speed */ - STM32_GPIO_OSPEEDR(GPIO_B) |= 0xff000000; - - /* Reset SPI2 */ - STM32_RCC_APB1RSTR |= BIT(14); - STM32_RCC_APB1RSTR &= ~BIT(14); - - /* Enable clocks to SPI2 module */ - STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2; -} -#endif /* CONFIG_SPI_FLASH */ - -static void factory_validation_deferred(void) -{ - struct mcdp_info info; - - mcdp_enable(); - - /* test mcdp via serial to validate function */ - if (!mcdp_get_info(&info) && (MCDP_FAMILY(info.family) == 0x0010) && - (MCDP_CHIPID(info.chipid) == 0x2850)) { - gpio_set_level(GPIO_MCDP_READY, 1); - pd_log_event(PD_EVENT_VIDEO_CODEC, - PD_LOG_PORT_SIZE(0, sizeof(info)), - 0, &info); - } - - mcdp_disable(); -} -DECLARE_DEFERRED(factory_validation_deferred); - -/* Initialize board. */ -static void board_init(void) -{ - timestamp_t now; -#ifdef CONFIG_SPI_FLASH - board_init_spi2(); -#endif - now = get_time(); - hpd_prev_level = gpio_get_level(GPIO_DP_HPD); - hpd_prev_ts = now.val; - gpio_enable_interrupt(GPIO_DP_HPD); - - gpio_set_level(GPIO_STM_READY, 1); /* factory test only */ - /* Delay needed to allow HDMI MCU to boot. */ - hook_call_deferred(&factory_validation_deferred_data, 200*MSEC); -} - -DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); - -/* ADC channels */ -const struct adc_t adc_channels[] = { - /* USB PD CC lines sensing. Converted to mV (3300mV/4096). */ - [ADC_CH_CC1_PD] = {"USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1)}, -}; -BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); - -const void * const usb_strings[] = { - [USB_STR_DESC] = usb_string_desc, - [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), - [USB_STR_PRODUCT] = USB_STRING_DESC("Hoho"), - [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), - [USB_STR_BB_URL] = USB_STRING_DESC(USB_GOOGLE_TYPEC_URL), -}; -BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); - -/** - * USB configuration - * Any type-C device with alternate mode capabilities must have the following - * set of descriptors. - * - * 1. Standard Device - * 2. BOS - * 2a. Container ID - * 2b. Billboard Caps - */ -struct my_bos { - struct usb_bos_hdr_descriptor bos; - struct usb_contid_caps_descriptor contid_caps; - struct usb_bb_caps_base_descriptor bb_caps; - struct usb_bb_caps_svid_descriptor bb_caps_svids[1]; -}; - -static struct my_bos bos_desc = { - .bos = { - .bLength = USB_DT_BOS_SIZE, - .bDescriptorType = USB_DT_BOS, - .wTotalLength = (USB_DT_BOS_SIZE + USB_DT_CONTID_SIZE + - USB_BB_CAPS_BASE_SIZE + - USB_BB_CAPS_SVID_SIZE * 1), - .bNumDeviceCaps = 2, /* contid + bb_caps */ - }, - .contid_caps = { - .bLength = USB_DT_CONTID_SIZE, - .bDescriptorType = USB_DT_DEVICE_CAPABILITY, - .bDevCapabilityType = USB_DC_DTYPE_CONTID, - .bReserved = 0, - .ContainerID = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - }, - .bb_caps = { - .bLength = (USB_BB_CAPS_BASE_SIZE + USB_BB_CAPS_SVID_SIZE * 1), - .bDescriptorType = USB_DT_DEVICE_CAPABILITY, - .bDevCapabilityType = USB_DC_DTYPE_BILLBOARD, - .iAdditionalInfoURL = USB_STR_BB_URL, - .bNumberOfAlternateModes = 1, - .bPreferredAlternateMode = 1, - .VconnPower = 0, - .bmConfigured = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - .bReserved = 0, - }, - .bb_caps_svids = { - { - .wSVID = 0xff01, /* TODO(tbroch) def'd in other CL remove hardcode */ - .bAlternateMode = 1, - .iAlternateModeString = USB_STR_BB_URL, /* TODO(crosbug.com/p/32687) */ - }, - }, -}; - -const struct bos_context bos_ctx = { - .descp = (void *)&bos_desc, - .size = sizeof(struct my_bos), -}; |