hoho: Initial board configuration.

Create necessary boiler plate files for USB type-C to HDMI dongle.

BRANCH=none
BUG=chrome-os-partner:31192
TEST=manual
1. Compiles & can program via fruitpie.
2. Can access uart (w/ rework for tx/rx).
3. Can drive HDMI capable monitor.

test details ...

Programming:
------------
   # connect fruitpie + fruitpie std-adapter(red) with u-USB (CN3) & type-A
   # (CN1) both to host that will run servod.
   FPIE_PORT=9993
   sudo servod -p 0x5009 --port $FPIE_PORT

   dut-control --port $FPIE_PORT "ec_uart_cmd:gpioset USB_C_5V_EN 1"
   dut-control --port $FPIE_PORT "ec_uart_cmd:usbmux usb"
   util/flash_ec --board=hoho

Configuring samus for DPout on both ports:
------------------------------------------

    sudo servod -b samus

    for port 0 1; do
        dut-control "usbpd_uart_cmd:pd ${PORT} dualrole off"
        dut-control "usbpd_uart_cmd:gpioset USB_C${PORT}_CHARGE_EN_L 1"
        dut-control "usbpd_uart_cmd:typec ${PORT} dp"
        dut-control "usbpd_uart_cmd:gpioset USB_C${PORT}_5V_EN 1"
        dut-control "usbpd_uart_cmd:typec ${PORT}"
    done
Change-Id: I39bbe1e347d1cfd777b68f3fdac6c5c6dd22800d
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212523
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Todd Broch
2014-08-07 14:06:43 -07:00
committed by chrome-internal-fetch
parent f3c308108b
commit e1ff1a3cae
7 changed files with 162 additions and 1 deletions

1
board/hoho/Makefile Symbolic link
View File

@@ -0,0 +1 @@
../../Makefile

40
board/hoho/board.c Normal file
View File

@@ -0,0 +1,40 @@
/* 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.
*/
/* Twinkie dongle configuration */
#include "adc.h"
#include "adc_chip.h"
#include "common.h"
#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "i2c.h"
#include "registers.h"
#include "task.h"
#include "util.h"
#include "gpio_list.h"
/* Initialize board. */
void board_config_pre_init(void)
{
/* enable SYSCFG clock */
STM32_RCC_APB2ENR |= 1 << 0;
/* Remap USART DMA to match the USART driver */
STM32_SYSCFG_CFGR1 |= (1 << 9) | (1 << 10);/* Remap USART1 RX/TX DMA */
}
/* 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);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
{"master", I2C_PORT_MASTER, 400, GPIO_MCDP_I2C_SCL, GPIO_MCDP_I2C_SDA},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);

52
board/hoho/board.h Normal file
View File

@@ -0,0 +1,52 @@
/* 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.
*/
/* Twinkie dongle configuration */
#ifndef __BOARD_H
#define __BOARD_H
/* 48 MHz SYSCLK clock frequency */
#define CPU_CLOCK 48000000
/* the UART console is on USART1 (PA9/PA10) */
#define CONFIG_UART_CONSOLE 1
/* Optional features */
#define CONFIG_STM_HWTIMER32
#define CONFIG_ADC
#define CONFIG_BOARD_PRE_INIT
#define CONFIG_I2C
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
#undef CONFIG_TASK_PROFILING
/* I2C ports configuration */
#define I2C_PORT_MASTER 0
/*
* Allow dangerous commands all the time, since we don't have a write protect
* switch.
*/
#define CONFIG_SYSTEM_UNLOCKED
#ifndef __ASSEMBLER__
/* Timer selection */
#define TIM_CLOCK_PD_RX 1
#define TIM_CLOCK32 2
#define TIM_ADC 3
#include "gpio_signal.h"
/* ADC signal */
enum adc_channel {
ADC_CH_CC1_PD = 0,
/* Number of ADC channels */
ADC_CH_COUNT
};
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */

13
board/hoho/build.mk Normal file
View File

@@ -0,0 +1,13 @@
# -*- makefile -*-
# 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.
#
# Board specific files build
# the IC is STmicro STM32F072B
CHIP:=stm32
CHIP_FAMILY:=stm32f0
CHIP_VARIANT:=stm32f07x
board-y=board.o

21
board/hoho/ec.tasklist Normal file
View File

@@ -0,0 +1,21 @@
/* 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.
*/
/**
* List of enabled tasks in the priority order
*
* The first one has the lowest priority.
*
* For each task, use the macro TASK_ALWAYS(n, r, d, s) for base tasks and
* TASK_NOTEST(n, r, d, s) for tasks that can be excluded in test binaries,
* where :
* 'n' in the name of the task
* 'r' in the main routine of the task
* 'd' in an opaque parameter passed to the routine at startup
* 's' is the stack size in bytes; must be a multiple of 8
*/
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)

33
board/hoho/gpio.inc Normal file
View File

@@ -0,0 +1,33 @@
/* -*- mode: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.
*/
GPIO(DP_HPD, A, 0, GPIO_INPUT, NULL)
GPIO(USB_C_CC1_PD, A, 1, GPIO_ANALOG, NULL)
GPIO(MCDP_RESET_L, A, 3, GPIO_OUT_HIGH, NULL)
GPIO(PD_DAC_REF, A, 4, GPIO_ANALOG, NULL)
GPIO(PD_RFU1_ENABLE, A, 7, GPIO_OUT_HIGH, NULL)
GPIO(PD_RFU2_ENABLE, A, 8, GPIO_OUT_HIGH, NULL)
GPIO(USB_DM, A, 11, GPIO_ANALOG, NULL)
GPIO(USB_DP, A, 12, GPIO_ANALOG, NULL)
GPIO(PD_CC1_TX_EN, A, 15, GPIO_OUT_LOW, NULL)
GPIO(MCDP_GPIO1, B, 0, GPIO_INPUT, NULL)
GPIO(MCDP_CONFIG1, B, 1, GPIO_OUT_LOW, NULL)
GPIO(PD_MCDP_SPI_WP_L, B, 2, GPIO_OUT_LOW, NULL)
GPIO(PD_CC1_TX_DATA, B, 4, GPIO_OUT_LOW, NULL)
GPIO(MCDP_I2C_SCL, B, 6, GPIO_INPUT, NULL)
GPIO(MCDP_I2C_SDA, B, 7, GPIO_INPUT, NULL)
/* Unimplemented signals which we need to emulate for now */
UNIMPLEMENTED(ENTERING_RW)
UNIMPLEMENTED(WP_L)
ALTERNATE(B, 0x0008, 0, MODULE_USB_PD, 0) /* SPI1: SCK(PB3) */
ALTERNATE(B, 0x0200, 2, MODULE_USB_PD, 0) /* TIM17_CH1: PB9 */
ALTERNATE(A, 0x0600, 1, MODULE_UART, GPIO_PULL_UP) /* USART1: PA9/PA10 */
ALTERNATE(B, 0x0C00, 4, MODULE_UART, GPIO_PULL_UP) /* USART3: PB10/PB11 */
ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C1 MASTER:PB6/7 */

View File

@@ -77,6 +77,7 @@ BOARDS_STM32=(
BOARDS_STM32_DFU=(
twinkie
hoho
)
# Flags
@@ -231,7 +232,7 @@ function ec_uart() {
case "${BOARD}" in
ryu_sh ) MCU="sh" ;;
samus_pd ) MCU="usbpd" ;;
twinkie ) DUT_CONTROL_CMD="true" ; MCU="ec" ;;
twinkie|hoho ) DUT_CONTROL_CMD="true" ; MCU="ec" ;;
*) MCU="ec" ;;
esac