Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
f3e5b6f9
Commit
f3e5b6f9
authored
Jul 15, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boards/generic: add eeprom storage as an example
parent
5c49af50
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
23 deletions
+40
-23
board.c
boards/generic/board.c
+38
-23
board.h
boards/generic/board.h
+2
-0
No files found.
boards/generic/board.c
View file @
f3e5b6f9
#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,33 +14,46 @@ int wrc_board_early_init()
uint32_t
sector_size
;
uint8_t
mac_addr
[
6
];
/*
* declare GPIO pins and configure their directions for bit-banging SPI
* limit SPI speed to 10MHz by setting bit_delay = CPU_CLOCK / 10^6
*/
bb_spi_create
(
&
spi_wrc_flash
,
&
pin_sysc_spi_ncs
,
&
pin_sysc_spi_mosi
,
&
pin_sysc_spi_miso
,
&
pin_sysc_spi_sclk
,
CPU_CLOCK
/
10000000
);
spi_wrc_flash
.
rd_falling_edge
=
1
;
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
);
/*
* Read from gateware info about used memory. Currently only base
* address and sector size for memtype flash is supported.
*/
get_storage_info
(
&
memtype
,
&
sdbfs_entry
,
&
sector_size
);
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
*/
bb_spi_create
(
&
spi_wrc_flash
,
&
pin_sysc_spi_ncs
,
&
pin_sysc_spi_mosi
,
&
pin_sysc_spi_miso
,
&
pin_sysc_spi_sclk
,
CPU_CLOCK
/
10000000
);
/*
* Initialize SPI flash and read its ID
*/
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
sector_size
,
sdbfs_entry
);
spi_wrc_flash
.
rd_falling_edge
=
1
;
/*
* Initialize storage subsystem with newly created SPI Flash
*/
storage_spiflash_create
(
&
wrc_storage_dev
,
&
wrc_flash_dev
);
/*
* Read from gateware info about used memory. Currently only base
* address and sector size for memtype flash is supported.
*/
get_storage_info
(
&
memtype
,
&
sdbfs_entry
,
&
sector_size
);
/*
* Initialize SPI flash and read its ID
*/
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
sector_size
,
sdbfs_entry
);
/*
* Initialize storage subsystem with newly created SPI Flash
*/
storage_spiflash_create
(
&
wrc_storage_dev
,
&
wrc_flash_dev
);
}
/*
* Mount SDBFS filesystem from storage.
...
...
boards/generic/board.h
View file @
f3e5b6f9
...
...
@@ -89,6 +89,8 @@
#define SDBFS_REC 5
#define EEPROM_STORAGE 0
void
sdb_find_devices
(
void
);
void
sdb_print_devices
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment