mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-19 00:51:18 +08:00
bsps/xqspipsu: Use device information from the FCT
Instead of statically defining the device parameters, use the device information available via the NOR device layer's Flash Configuration Table.
This commit is contained in:
committed by
Joel Sherrill
parent
7a14c3df8b
commit
09fd5dd353
@@ -38,9 +38,6 @@ typedef struct {
|
||||
XQspiPsu *qspipsu;
|
||||
} flash_control;
|
||||
|
||||
/* From the N25Q512A datasheet */
|
||||
#define BLOCK_SIZE (64UL * 1024UL)
|
||||
#define FLASH_SIZE (1024UL * BLOCK_SIZE)
|
||||
#define FLASH_DEVICE_ID 0xbb20 /* Type: 0xbb, Capacity: 0x20 */
|
||||
|
||||
static flash_control *get_flash_control( rtems_jffs2_flash_control *super )
|
||||
@@ -117,7 +114,7 @@ static int do_erase(
|
||||
Status = QspiPsu_NOR_Erase(
|
||||
QspiPsuPtr,
|
||||
offset,
|
||||
BLOCK_SIZE
|
||||
super->block_size
|
||||
);
|
||||
if ( Status != XST_SUCCESS ) {
|
||||
return Status;
|
||||
@@ -139,8 +136,6 @@ static void do_destroy( rtems_jffs2_flash_control *super )
|
||||
|
||||
static flash_control flash_instance = {
|
||||
.super = {
|
||||
.block_size = BLOCK_SIZE,
|
||||
.flash_size = FLASH_SIZE,
|
||||
.read = do_read,
|
||||
.write = do_write,
|
||||
.erase = do_erase,
|
||||
@@ -171,6 +166,11 @@ int xilinx_zynqmp_nor_jffs2_initialize(
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint32_t sect_size = QspiPsu_NOR_Get_Sector_Size(qspipsu_ptr);
|
||||
uint32_t flash_size = QspiPsu_NOR_Get_Device_Size(qspipsu_ptr);
|
||||
flash_instance.super.flash_size = flash_size;
|
||||
flash_instance.super.block_size = sect_size;
|
||||
|
||||
rv = mount(
|
||||
NULL,
|
||||
mount_dir,
|
||||
|
||||
@@ -131,3 +131,27 @@ int QspiPsu_NOR_Read_Ecc(
|
||||
u32 Address,
|
||||
u8 *ReadBfrPtr
|
||||
);
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function returns the size of attached flash parts.
|
||||
*
|
||||
* @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
|
||||
*
|
||||
* @return The size of attached flash in bytes.
|
||||
*
|
||||
******************************************************************************/
|
||||
u32 QspiPsu_NOR_Get_Device_Size(XQspiPsu *QspiPsuPtr);
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
*
|
||||
* This function returns the sector size of attached flash parts.
|
||||
*
|
||||
* @param QspiPsuPtr is a pointer to the QSPIPSU driver component to use.
|
||||
*
|
||||
* @return The sector size of attached flash in bytes.
|
||||
*
|
||||
******************************************************************************/
|
||||
u32 QspiPsu_NOR_Get_Sector_Size(XQspiPsu *QspiPsuPtr);
|
||||
|
||||
@@ -2258,3 +2258,19 @@ static int MultiDieReadEcc(
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 QspiPsu_NOR_Get_Sector_Size(XQspiPsu *QspiPsuPtr)
|
||||
{
|
||||
if(QspiPsuPtr->Config.ConnectionMode == XQSPIPSU_CONNECTION_MODE_PARALLEL) {
|
||||
return Flash_Config_Table[FCTIndex].SectSize * 2;
|
||||
}
|
||||
return Flash_Config_Table[FCTIndex].SectSize;
|
||||
}
|
||||
|
||||
u32 QspiPsu_NOR_Get_Device_Size(XQspiPsu *QspiPsuPtr)
|
||||
{
|
||||
if(QspiPsuPtr->Config.ConnectionMode == XQSPIPSU_CONNECTION_MODE_STACKED) {
|
||||
return Flash_Config_Table[FCTIndex].FlashDeviceSize * 2;
|
||||
}
|
||||
return Flash_Config_Table[FCTIndex].FlashDeviceSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user