mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
Merge "stm32l: Add skeleton for Daisy board"
This commit is contained in:
70
board/daisy/board.c
Normal file
70
board/daisy/board.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/* 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.
|
||||
*/
|
||||
/* Daisy board-specific configuration */
|
||||
|
||||
#include "board.h"
|
||||
#include "common.h"
|
||||
#include "gpio.h"
|
||||
#include "registers.h"
|
||||
#include "util.h"
|
||||
|
||||
/* 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, NULL},
|
||||
{"PP1800_LDO2", GPIO_A, (1<<1), GPIO_INT_BOTH, NULL},
|
||||
{"XPSHOLD", GPIO_A, (1<<11), GPIO_INT_RISING, NULL},
|
||||
{"CHARGER_INT", GPIO_B, (1<<0), GPIO_INT_RISING, NULL},
|
||||
{"EC_INT", GPIO_B, (1<<9), GPIO_INT_RISING, NULL},
|
||||
{"LID_OPEN", GPIO_C, (1<<13), GPIO_INT_BOTH, NULL},
|
||||
/* Other inputs */
|
||||
/* Outputs */
|
||||
{"EN_PP1350", GPIO_A, (1<<2), GPIO_OUT_LOW, NULL},
|
||||
{"EN_PP5000", GPIO_A, (1<<3), 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},
|
||||
};
|
||||
|
||||
void configure_board(void)
|
||||
{
|
||||
/* Enable all GPIOs clocks
|
||||
* TODO: more fine-grained enabling for power saving
|
||||
*/
|
||||
STM32L_RCC_AHBENR |= 0x3f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stubs for non implemented drivers
|
||||
* TODO: implement
|
||||
*/
|
||||
int jtag_pre_init(void)
|
||||
{
|
||||
/* stop TIM2, TIM3 and watchdogs when the JTAG stops the CPU */
|
||||
STM32L_DBGMCU_APB1FZ |= 0x00001803;
|
||||
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int eeprom_init(void)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int i2c_init(void)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int power_button_init(void)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
|
||||
int adc_init(void)
|
||||
{
|
||||
return EC_SUCCESS;
|
||||
}
|
||||
43
board/daisy/board.h
Normal file
43
board/daisy/board.h
Normal 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.
|
||||
*/
|
||||
|
||||
/* Daisy board configuration */
|
||||
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
/* 16 MHz SYSCLK clock frequency */
|
||||
#define CPU_CLOCK 16000000
|
||||
|
||||
/* Use USART1 as console serial port */
|
||||
#define CONFIG_CONSOLE_UART 1
|
||||
|
||||
#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_LID_OPEN, /* LID switch detection */
|
||||
GPIO_PP1800_LDO2, /* LDO2 is ON (end of PMIC sequence) */
|
||||
GPIO_SOC1V8_XPSHOLD, /* App Processor ON */
|
||||
GPIO_CHARGER_INT,
|
||||
GPIO_EC_INT,
|
||||
/* 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,
|
||||
|
||||
/* Number of GPIOs; not an actual GPIO */
|
||||
GPIO_COUNT
|
||||
};
|
||||
|
||||
void configure_board(void);
|
||||
|
||||
#endif /* __BOARD_H */
|
||||
10
board/daisy/build.mk
Normal file
10
board/daisy/build.mk
Normal 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
|
||||
18
board/daisy/ec.tasklist
Normal file
18
board/daisy/ec.tasklist
Normal file
@@ -0,0 +1,18 @@
|
||||
/* 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(CONSOLE, console_task, NULL)
|
||||
Reference in New Issue
Block a user