liblitespi: fix xor-used-as-pow bug

This commit is contained in:
Richard Tucker 2024-06-24 16:37:36 +10:00
parent 22f9c063db
commit a0763bf652
1 changed files with 3 additions and 3 deletions

View File

@ -76,11 +76,11 @@ void spiflash_dummy_bits_setup(unsigned int dummy_bits)
static void spiflash_len_mask_width_write(uint32_t len, uint32_t width, uint32_t mask) static void spiflash_len_mask_width_write(uint32_t len, uint32_t width, uint32_t mask)
{ {
uint32_t tmp = len & ((2 ^ CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_LEN_SIZE) - 1); uint32_t tmp = len & ((1 << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_LEN_SIZE) - 1);
uint32_t word = tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_LEN_OFFSET; uint32_t word = tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_LEN_OFFSET;
tmp = width & ((2 ^ CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_WIDTH_SIZE) - 1); tmp = width & ((1 << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_WIDTH_SIZE) - 1);
word |= tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_WIDTH_OFFSET; word |= tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_WIDTH_OFFSET;
tmp = mask & ((2 ^ CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_MASK_SIZE) - 1); tmp = mask & ((1 << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_MASK_SIZE) - 1);
word |= tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_MASK_OFFSET; word |= tmp << CSR_SPIFLASH_CORE_MASTER_PHYCONFIG_MASK_OFFSET;
spiflash_core_master_phyconfig_write(word); spiflash_core_master_phyconfig_write(word);
} }