Commit b10be2c2 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

boards/generic: add eeprom storage as an example

parent be5c7d72
Pipeline #314 failed with stages
in 8 seconds
#include "board.h"
#include "dev/bb_spi.h"
#include "dev/bb_i2c.h"
#include "dev/spi_flash.h"
#include "dev/i2c_eeprom.h"
#include "dev/syscon.h"
#include "dev/endpoint.h"
#include "storage.h"
......@@ -12,6 +14,18 @@ int wrc_board_early_init()
uint32_t sector_size;
uint8_t mac_addr[6];
if (EEPROM_STORAGE) {
/* EEPROM support */
bb_i2c_create( &i2c_wrc_eeprom,
&pin_sysc_fmc_scl,
&pin_sysc_fmc_sda );
bb_i2c_init( &i2c_wrc_eeprom );
i2c_eeprom_create( &wrc_eeprom_dev, &i2c_wrc_eeprom, FMC_EEPROM_ADR, 2);
storage_i2ceeprom_create( &wrc_storage_dev, &wrc_eeprom_dev );
} else {
/* Flash support */
/*
* declare GPIO pins and configure their directions for bit-banging SPI
* limit SPI speed to 10MHz by setting bit_delay = CPU_CLOCK / 10^6
......@@ -39,6 +53,7 @@ int wrc_board_early_init()
* Initialize storage subsystem with newly created SPI Flash
*/
storage_spiflash_create( &wrc_storage_dev, &wrc_flash_dev );
}
/*
* Mount SDBFS filesystem from storage.
......
......@@ -89,6 +89,8 @@
#define SDBFS_REC 5
#define EEPROM_STORAGE 0
void sdb_find_devices(void);
void sdb_print_devices(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment