Commit 8720372d authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

bsp/generic: adding flash support for storage

parent d9c3d162
......@@ -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 );
......
#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;
}
......
......@@ -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;
}
......@@ -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++)
......
......@@ -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
......@@ -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
......
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