diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2014-08-21 10:03:33 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-29 03:00:17 +0000 |
commit | f5b9f2d64119ec1f56a7fc9d8a503ebe2a5af5d8 (patch) | |
tree | 9e7e00340136b2a76e1fc25bb57d05fb0c36f282 /board | |
parent | 866af4f6f275266850be9dd3fd8ee0aae085b8d1 (diff) | |
download | chrome-ec-f5b9f2d64119ec1f56a7fc9d8a503ebe2a5af5d8.tar.gz |
First drop of ryu sensor hub file
For building a basic image for the Ryu Sensor Hub.
BUG=chrome-os-partner:30801
TEST=uart work, i2c master finds device, pin with EC works.
BRANCH=ToT
Change-Id: I6f8c6fa550da91eabf8b21452684d2de410611b9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210755
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/ryu_sh/board.c | 32 | ||||
-rw-r--r-- | board/ryu_sh/board.h | 50 | ||||
-rw-r--r-- | board/ryu_sh/build.mk | 12 | ||||
-rw-r--r-- | board/ryu_sh/ec.tasklist | 22 | ||||
-rw-r--r-- | board/ryu_sh/gpio.inc | 45 |
5 files changed, 161 insertions, 0 deletions
diff --git a/board/ryu_sh/board.c b/board/ryu_sh/board.c new file mode 100644 index 0000000000..577b5b3a0c --- /dev/null +++ b/board/ryu_sh/board.c @@ -0,0 +1,32 @@ +/* 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. + */ +/* ryu sensor hub configuration */ + +#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. */ +static void board_init(void) +{ +} +DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); + +/* I2C ports */ +const struct i2c_port_t i2c_ports[] = { + {"master", I2C_PORT_MASTER, 100, + GPIO_MASTER_I2C_SCL, GPIO_MASTER_I2C_SDA}, + {"slave", I2C_PORT_SLAVE, 100, + GPIO_SLAVE_I2C_SCL, GPIO_SLAVE_I2C_SDA}, +}; +const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + diff --git a/board/ryu_sh/board.h b/board/ryu_sh/board.h new file mode 100644 index 0000000000..298f0df223 --- /dev/null +++ b/board/ryu_sh/board.h @@ -0,0 +1,50 @@ +/* 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. + */ + +/* ryu sensor board configuration */ + +#ifndef __BOARD_H +#define __BOARD_H + +/* 48 MHz SYSCLK clock frequency */ +#define CPU_CLOCK 48000000 + +/* the UART console is on USART2 (PA2/PA3) */ +#undef CONFIG_UART_CONSOLE +#define CONFIG_UART_CONSOLE 2 + +/* By default, enable all console messages */ +#define CC_DEFAULT CC_ALL + +/* Optional features */ +#define CONFIG_STM_HWTIMER32 +#define CONFIG_I2C +#undef CONFIG_LID_SWITCH +#define CONFIG_VBOOT_HASH +#undef CONFIG_WATCHDOG_HELP + +/* I2C ports configuration */ +#define I2C_PORT_MASTER 1 +#define I2C_PORT_SLAVE 0 +#define I2C_PORT_EC I2C_PORT_SLAVE +#define I2C_PORT_ACCEL I2C_PORT_MASTER +#define I2C_PORT_COMPASS I2C_PORT_MASTER + +/* slave address for host commands */ +#ifdef HAS_TASK_HOSTCMD +#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR 0x3e +#endif + +#ifndef __ASSEMBLER__ + +/* Timer selection */ +#define TIM_CLOCK32 2 +#define TIM_ADC 3 + +#include "gpio_signal.h" + +#endif /* !__ASSEMBLER__ */ + +#endif /* __BOARD_H */ diff --git a/board/ryu_sh/build.mk b/board/ryu_sh/build.mk new file mode 100644 index 0000000000..76ac52f9e5 --- /dev/null +++ b/board/ryu_sh/build.mk @@ -0,0 +1,12 @@ +# 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 STM32F072VBH6 +CHIP:=stm32 +CHIP_FAMILY:=stm32f0 +CHIP_VARIANT:=stm32f07x + +board-y=board.o diff --git a/board/ryu_sh/ec.tasklist b/board/ryu_sh/ec.tasklist new file mode 100644 index 0000000000..aaed7865c8 --- /dev/null +++ b/board/ryu_sh/ec.tasklist @@ -0,0 +1,22 @@ +/* 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, LARGER_TASK_STACK_SIZE) \ + TASK_NOTEST(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ + TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) diff --git a/board/ryu_sh/gpio.inc b/board/ryu_sh/gpio.inc new file mode 100644 index 0000000000..f2adefb4b5 --- /dev/null +++ b/board/ryu_sh/gpio.inc @@ -0,0 +1,45 @@ +/* -*- 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. + */ + +/* Interrupts */ +/* + * TODO(gwendal): Follow Rambus work. + * Combined accelerometer input. This will become an interrupt, once we have + * support for it. + */ +GPIO(ACC_IRQ, B, 12, GPIO_INPUT, NULL) + +/* Outputs */ +GPIO(SH_EC_SIGNAL, A, 7, GPIO_OUT_LOW, NULL) +GPIO(SH_IRQ_L, A, 11, GPIO_OUT_LOW, NULL) + +/* Inputs */ +GPIO(COMPASS_DRDY, B, 11, GPIO_INPUT, NULL) +GPIO(AP_IN_SUSPEND, B, 15, GPIO_INPUT, NULL) + +#if 0 +/* Alternate functions */ +GPIO(UART_TX, A, 2, GPIO_OUT_LOW, NULL) +GPIO(UART_RX, A, 3, GPIO_OUT_LOW, NULL) +#endif + +/* Needed to bypass flash write protection */ +UNIMPLEMENTED(ENTERING_RW) +UNIMPLEMENTED(WP_L) + +/* + * I2C pins should be configured as inputs until I2C module is + * initialized. This will avoid driving the lines unintentionally. + */ +GPIO(SLAVE_I2C_SCL, B, 6, GPIO_INPUT, NULL) +GPIO(SLAVE_I2C_SDA, B, 7, GPIO_INPUT, NULL) +GPIO(MASTER_I2C_SCL, B, 13, GPIO_INPUT, NULL) +GPIO(MASTER_I2C_SDA, B, 14, GPIO_INPUT, NULL) + +ALTERNATE(A, 0x000C, 1, MODULE_UART, 0) /* USART2: PA2/PA3 */ +ALTERNATE(B, 0x00C0, 1, MODULE_I2C, 0) /* I2C SLAVE:PB6/7 */ +ALTERNATE(B, 0x6000, 5, MODULE_I2C, 0) /* I2C MASTER:PB13/14 */ |