drivers: flash: stm32 ospi driver correct device size
The find_lsb_set is giving the position of the first '1' found, starting from 1. "Bits are numbered starting at 1 from the least significant bit." So that the find_lsb_set(64MBytes) is 27. To get 64MBytes = 2^26, the value of the Init.DeviceSize must be 26. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
2cca8b54a3
commit
4500dba078
1 changed files with 2 additions and 1 deletions
|
@ -1934,7 +1934,8 @@ static int flash_stm32_ospi_init(const struct device *dev)
|
|||
/* Initialize OSPI HAL structure completely */
|
||||
dev_data->hospi.Init.FifoThreshold = 4;
|
||||
dev_data->hospi.Init.ClockPrescaler = prescaler;
|
||||
dev_data->hospi.Init.DeviceSize = find_lsb_set(dev_cfg->flash_size);
|
||||
/* Give a bit position from 0 to 31 to the HAL init for the DCR1 reg */
|
||||
dev_data->hospi.Init.DeviceSize = find_lsb_set(dev_cfg->flash_size) - 1;
|
||||
dev_data->hospi.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
|
||||
dev_data->hospi.Init.ChipSelectHighTime = 2;
|
||||
dev_data->hospi.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue