drivers: flash: jesd216: improve support for address size selection
Add a helper function to decode the address byte support data from the SFDP BFP. Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
parent
e0f514f670
commit
6c4312605c
2 changed files with 11 additions and 3 deletions
|
@ -182,6 +182,16 @@ struct jesd216_bfp {
|
|||
* * DW17-20 (quad/oct support) no API except jesd216_bfp_read_support().
|
||||
*/
|
||||
|
||||
/* Extract the supported address bytes from BFP DW1. */
|
||||
static inline uint8_t jesd216_bfp_addrbytes(const struct jesd216_bfp *hp)
|
||||
{
|
||||
uint32_t dw1 = sys_le32_to_cpu(hp->dw1);
|
||||
uint8_t addr_support = (dw1 & JESD216_SFDP_BFP_DW1_ADDRBYTES_MASK)
|
||||
>> JESD216_SFDP_BFP_DW1_ADDRBYTES_SHFT;
|
||||
|
||||
return addr_support;
|
||||
}
|
||||
|
||||
/* Extract the density of the chip in bits from BFP DW2. */
|
||||
static inline uint64_t jesd216_bfp_density(const struct jesd216_bfp *hp)
|
||||
{
|
||||
|
|
|
@ -206,9 +206,7 @@ static void summarize_dw16(const struct jesd216_param_header *php,
|
|||
return;
|
||||
}
|
||||
|
||||
uint32_t dw1 = sys_le32_to_cpu(bfp->dw1);
|
||||
uint8_t addr_support = (dw1 & JESD216_SFDP_BFP_DW1_ADDRBYTES_MASK)
|
||||
>> JESD216_SFDP_BFP_DW1_ADDRBYTES_SHFT;
|
||||
uint8_t addr_support = jesd216_bfp_addrbytes(bfp);
|
||||
|
||||
/* Don't display bits when 4-byte addressing is not supported. */
|
||||
if (addr_support != JESD216_SFDP_BFP_DW1_ADDRBYTES_VAL_3B) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue