stm32l: add support for ADV board

Compared to Daisy, it has the EC console on USART2 (pins PA2 and PA3)
and regulator enable GPIOS EN_PP1350 and EN_PP5000 are on PA9/PA10.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=None
TEST=make BOARD=adv && make BOARD=daisy && make BOARD=discovery

Change-Id: I545f7c9b05480e58db913ea562c77a1a1cd2b11c
This commit is contained in:
Vincent Palatin
2012-02-16 02:46:56 +00:00
parent 8a37e9a0d8
commit b221c77b62
5 changed files with 121 additions and 1 deletions

44
board/adv/board.c Normal file
View File

@@ -0,0 +1,44 @@
/* Copyright (c) 2012 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.
*/
/* ADV board-specific configuration */
#include "board.h"
#include "common.h"
#include "gpio.h"
#include "registers.h"
#include "util.h"
/* GPIO interrupt handlers prototypes */
void gaia_power_event(enum gpio_signal signal);
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[GPIO_COUNT] = {
/* Inputs with interrupt handlers are first for efficiency */
{"EC_PWRON", GPIO_A, (1<<0), GPIO_INT_BOTH, gaia_power_event},
{"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, gaia_power_event},
{"XPSHOLD", GPIO_A, (1<<11), GPIO_INT_RISING, gaia_power_event},
{"CHARGER_INT", GPIO_B, (1<<0), GPIO_INT_RISING, NULL},
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, NULL},
/* Other inputs */
/* Outputs */
{"EN_PP1350", GPIO_A, (1<<9), GPIO_OUT_LOW, NULL},
{"EN_PP5000", GPIO_A, (1<<10), GPIO_OUT_LOW, NULL},
{"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
{"PMIC_ACOK", GPIO_A, (1<<12), GPIO_OUT_LOW, NULL},
{"ENTERING_RW", GPIO_B, (1<<1), GPIO_OUT_LOW, NULL},
{"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
{"EC_INT", GPIO_B, (1<<9), GPIO_OUT_LOW, NULL},
};
void configure_board(void)
{
/* Enable all GPIOs clocks
* TODO: more fine-grained enabling for power saving
*/
STM32L_RCC_AHBENR |= 0x3f;
/* Select Alternate function for USART2 on pins PA2/PA3 */
gpio_set_alternate_function(GPIO_A, (1<<2) | (1<<3), GPIO_ALT_USART);
}

43
board/adv/board.h Normal file
View File

@@ -0,0 +1,43 @@
/* Copyright (c) 2012 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.
*/
/* ADV board configuration */
#ifndef __BOARD_H
#define __BOARD_H
/* 16 MHz SYSCLK clock frequency */
#define CPU_CLOCK 16000000
/* Use USART2 as console serial port */
#define CONFIG_CONSOLE_UART 2
#define USB_CHARGE_PORT_COUNT 0
/* GPIO signal list */
enum gpio_signal {
/* Inputs with interrupt handlers are first for efficiency */
GPIO_EC_PWRON = 0, /* Power button */
GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */
GPIO_SOC1V8_XPSHOLD, /* App Processor ON */
GPIO_CHARGER_INT,
GPIO_LID_OPEN, /* LID switch detection */
/* Other inputs */
/* Outputs */
GPIO_EN_PP1350, /* DDR 1.35v rail enable */
GPIO_EN_PP5000, /* 5.0v rail enable */
GPIO_EN_PP3300, /* 3.3v rail enable */
GPIO_PMIC_ACOK, /* 5v rail ready */
GPIO_EC_ENTERING_RW, /* EC is R/W mode for the kbc mux */
GPIO_CHARGER_EN,
GPIO_EC_INT,
/* Number of GPIOs; not an actual GPIO */
GPIO_COUNT
};
void configure_board(void);
#endif /* __BOARD_H */

10
board/adv/build.mk Normal file
View File

@@ -0,0 +1,10 @@
# Copyright (c) 2012 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 STM32L151R8H6
CHIP:=stm32l
board-y=board.o

19
board/adv/ec.tasklist Normal file
View File

@@ -0,0 +1,19 @@
/* Copyright (c) 2012 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(n, r, d) 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
*/
#define CONFIG_TASK_LIST \
TASK(WATCHDOG, watchdog_task, NULL) \
TASK(GAIAPOWER, gaia_power_task, NULL) \
TASK(CONSOLE, console_task, NULL)

View File

@@ -20,7 +20,11 @@
#define CONFIG_IRQ_COUNT 45
/* Debug UART parameters for panic message */
#define CONFIG_UART_ADDRESS 0x40013800
#ifdef BOARD_adv
#define CONFIG_UART_ADDRESS 0x40004400 /* USART2 */
#else
#define CONFIG_UART_ADDRESS 0x40013800 /* USART1 */
#endif
#define CONFIG_UART_DR_OFFSET 0x04
#define CONFIG_UART_SR_OFFSET 0x00
#define CONFIG_UART_SR_TXEMPTY 0x80