1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/boards/weact-f411ce/board.c
Benjamin Valentin 59a41968b5 boards/weact-f411ce: determine flash size at run-time
The pad for SPI-Flash on the WeAct-f411ce does not come pre-populated.
The user has to manually solder a SPI-flash chip on the board, so specifying
a size here makes no sense.

Instead, rely on automatic detection of the flash size at run-time.
2020-06-10 12:10:29 +02:00

63 lines
1.5 KiB
C

/*
* Copyright (C) 2019 Benjamin Valentin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_weact-f411ce
* @{
*
* @file
* @brief Board initialization code for the WeAct-F411CE board.
*
* @author Benjamin Valentin <benpicco@googlemail.com>
*
* @}
*/
#include "board.h"
#include "cpu.h"
#include "mtd.h"
#include "mtd_spi_nor.h"
#include "periph/gpio.h"
#ifdef MODULE_MTD
/* AT25SF041 */
static const mtd_spi_nor_params_t _weact_nor_params = {
.opcode = &mtd_spi_nor_opcode_default,
.wait_chip_erase = 4800LU * US_PER_MS,
.wait_32k_erase = 300LU * US_PER_MS,
.wait_sector_erase = 70LU * US_PER_MS,
.wait_4k_erase = 70LU * US_PER_MS,
.wait_chip_wake_up = 1LU * US_PER_MS,
.clk = WEACT_411CE_NOR_SPI_CLK,
.flag = WEACT_411CE_NOR_FLAGS,
.spi = WEACT_411CE_NOR_SPI_DEV,
.mode = WEACT_411CE_NOR_SPI_MODE,
.cs = WEACT_411CE_NOR_SPI_CS,
.addr_width = 3,
};
static mtd_spi_nor_t weact_nor_dev = {
.base = {
.driver = &mtd_spi_nor_driver,
.page_size = WEACT_411CE_NOR_PAGE_SIZE,
.pages_per_sector = WEACT_411CE_NOR_PAGES_PER_SECTOR,
},
.params = &_weact_nor_params,
};
mtd_dev_t *mtd0 = (mtd_dev_t *)&weact_nor_dev;
#endif /* MODULE_MTD */
void board_init(void)
{
cpu_init();
gpio_init(LED0_PIN, GPIO_OUT);
LED0_OFF;
}