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
4
Merge Requests
4
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
8720372d
Commit
8720372d
authored
Apr 21, 2020
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bsp/generic: adding flash support for storage
parent
d9c3d162
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
7 deletions
+27
-7
board.c
boards/afcz/board.c
+1
-1
board.c
boards/generic/board.c
+20
-0
flash.c
dev/flash.c
+1
-1
spi_flash.c
dev/spi_flash.c
+2
-2
spi_flash.h
include/dev/spi_flash.h
+2
-2
boot.c
tools/uart-bootloader/boot.c
+1
-1
No files found.
boards/afcz/board.c
View file @
8720372d
...
...
@@ -604,7 +604,7 @@ int wrc_board_init()
spi_wrc_flash
.
rd_falling_edge
=
1
;
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
16384
);
storage_spiflash_create
(
&
wrc_storage_dev
,
&
wrc_flash_dev
);
storage_mount
(
&
wrc_storage_dev
);
...
...
boards/generic/board.c
View file @
8720372d
#include "board.h"
#include "dev/bb_spi.h"
#include "dev/spi_flash.h"
#include "dev/syscon.h"
#include "storage.h"
int
wrc_board_early_init
()
{
...
...
@@ -7,6 +11,22 @@ int wrc_board_early_init()
int
wrc_board_init
()
{
int
memtype
;
uint32_t
sdbfs_addr
;
uint32_t
sector_size
;
bb_spi_create
(
&
spi_wrc_flash
,
&
pin_sysc_spi_ncs
,
&
pin_sysc_spi_mosi
,
&
pin_sysc_spi_miso
,
&
pin_sysc_spi_sclk
,
10
);
spi_wrc_flash
.
rd_falling_edge
=
1
;
get_storage_info
(
&
memtype
,
&
sdbfs_addr
,
&
sector_size
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
sector_size
);
storage_spiflash_create
(
&
wrc_storage_dev
,
&
wrc_flash_dev
);
storage_mount
(
&
wrc_storage_dev
);
return
0
;
}
...
...
dev/flash.c
View file @
8720372d
...
...
@@ -29,7 +29,7 @@ void flash_init(void)
&
pin_sysc_spi_miso
,
&
pin_sysc_spi_sclk
,
10
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
);
spi_flash_create
(
&
wrc_flash_dev
,
&
spi_wrc_flash
,
16384
);
return
0
;
}
dev/spi_flash.c
View file @
8720372d
...
...
@@ -16,12 +16,12 @@ static uint8_t spi_flash_rsr(struct spi_flash_device *dev);
/*
* Init function (just set the SPI pins for idle)
*/
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
)
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
)
{
int
i
;
dev
->
bus
=
bus
;
dev
->
sector_size
=
16384
;
dev
->
sector_size
=
sector_size
;
dev
->
use_4byte_addr
=
0
;
for
(
i
=
0
;
i
<
10
;
i
++
)
...
...
include/dev/spi_flash.h
View file @
8720372d
...
...
@@ -24,7 +24,7 @@ struct spi_flash_device
};
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
);
void
spi_flash_create
(
struct
spi_flash_device
*
dev
,
struct
spi_bus
*
bus
,
uint32_t
sector_size
);
int
spi_flash_write
(
struct
spi_flash_device
*
dev
,
uint32_t
addr
,
uint8_t
*
buf
,
int
count
);
int
spi_flash_read
(
struct
spi_flash_device
*
dev
,
uint32_t
addr
,
uint8_t
*
buf
,
int
count
);
uint32_t
spi_flash_read_id
(
struct
spi_flash_device
*
dev
);
...
...
@@ -32,4 +32,4 @@ void spi_flash_erase_sector(struct spi_flash_device *dev, uint32_t addr);
int
spi_flash_erase
(
struct
spi_flash_device
*
dev
,
uint32_t
addr
,
int
count
);
int
spi_flash_get_sector_size
(
struct
spi_flash_device
*
dev
);
#endif
\ No newline at end of file
#endif
tools/uart-bootloader/boot.c
View file @
8720372d
...
...
@@ -119,7 +119,7 @@ void boot_flash_init()
&
boot_pin_sysc_spi_sclk
,
10
);
spi_flash_create
(
&
dev_flash
,
&
spi_flash
);
spi_flash_create
(
&
dev_flash
,
&
spi_flash
,
16384
);
}
#endif
...
...
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