diff options
author | Todd Broch <tbroch@chromium.org> | 2014-08-07 14:06:43 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-16 05:26:40 +0000 |
commit | e1ff1a3caef94bef3c2ea9e8036aa784be26ef1b (patch) | |
tree | 2b502fe069c0c9395b53630db3af87dcd4cb7424 /board | |
parent | f3c308108b88ff4c8ac276269da056560265bf1b (diff) | |
download | chrome-ec-e1ff1a3caef94bef3c2ea9e8036aa784be26ef1b.tar.gz |
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>
Diffstat (limited to 'board')
l--------- | board/hoho/Makefile | 1 | ||||
-rw-r--r-- | board/hoho/board.c | 40 | ||||
-rw-r--r-- | board/hoho/board.h | 52 | ||||
-rw-r--r-- | board/hoho/build.mk | 13 | ||||
-rw-r--r-- | board/hoho/ec.tasklist | 21 | ||||
-rw-r--r-- | board/hoho/gpio.inc | 33 |
6 files changed, 160 insertions, 0 deletions
diff --git a/board/hoho/Makefile b/board/hoho/Makefile new file mode 120000 index 0000000000..94aaae2c4d --- /dev/null +++ b/board/hoho/Makefile @@ -0,0 +1 @@ +../../Makefile
\ No newline at end of file diff --git a/board/hoho/board.c b/board/hoho/board.c new file mode 100644 index 0000000000..b0e3a7d37b --- /dev/null +++ b/board/hoho/board.c @@ -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); diff --git a/board/hoho/board.h b/board/hoho/board.h new file mode 100644 index 0000000000..47fd3a28f4 --- /dev/null +++ b/board/hoho/board.h @@ -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 */ diff --git a/board/hoho/build.mk b/board/hoho/build.mk new file mode 100644 index 0000000000..83b8716734 --- /dev/null +++ b/board/hoho/build.mk @@ -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 diff --git a/board/hoho/ec.tasklist b/board/hoho/ec.tasklist new file mode 100644 index 0000000000..8ff4e8234b --- /dev/null +++ b/board/hoho/ec.tasklist @@ -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) diff --git a/board/hoho/gpio.inc b/board/hoho/gpio.inc new file mode 100644 index 0000000000..98eb079cd6 --- /dev/null +++ b/board/hoho/gpio.inc @@ -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 */ |