Lines Matching refs:regs
46 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in flash_stm32_valid_range() local
50 if (regs->OPTCR & FLASH_OPTCR_DB1M) { in flash_stm32_valid_range()
59 static inline void flush_cache(FLASH_TypeDef *regs) in flush_cache() argument
61 if (regs->ACR & FLASH_ACR_DCEN) { in flush_cache()
62 regs->ACR &= ~FLASH_ACR_DCEN; in flush_cache()
66 regs->ACR |= FLASH_ACR_DCRST; in flush_cache()
67 regs->ACR &= ~FLASH_ACR_DCRST; in flush_cache()
68 regs->ACR |= FLASH_ACR_DCEN; in flush_cache()
71 if (regs->ACR & FLASH_ACR_ICEN) { in flush_cache()
72 regs->ACR &= ~FLASH_ACR_ICEN; in flush_cache()
77 regs->ACR |= FLASH_ACR_ICRST; in flush_cache()
78 regs->ACR &= ~FLASH_ACR_ICRST; in flush_cache()
79 regs->ACR |= FLASH_ACR_ICEN; in flush_cache()
85 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in write_value() local
93 if (regs->CR & FLASH_CR_LOCK) { in write_value()
107 if (regs->ACR & FLASH_ACR_DCEN) { in write_value()
109 regs->ACR &= (~FLASH_ACR_DCEN); in write_value()
113 regs->CR &= CR_PSIZE_MASK; in write_value()
114 regs->CR |= FLASH_PROGRAM_SIZE; in write_value()
115 regs->CR |= FLASH_CR_PG; in write_value()
118 tmp = regs->CR; in write_value()
123 regs->CR &= (~FLASH_CR_PG); in write_value()
128 regs->ACR |= FLASH_ACR_DCRST; in write_value()
129 regs->ACR &= (~FLASH_ACR_DCRST); in write_value()
130 regs->ACR |= FLASH_ACR_DCEN; in write_value()
139 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in erase_sector() local
144 if (regs->CR & FLASH_CR_LOCK) { in erase_sector()
158 flush_cache(regs); in erase_sector()
171 regs->CR &= CR_PSIZE_MASK; in erase_sector()
172 regs->CR |= FLASH_PROGRAM_SIZE; in erase_sector()
174 regs->CR &= ~FLASH_CR_SNB; in erase_sector()
175 regs->CR |= FLASH_CR_SER | (sector << 3); in erase_sector()
176 regs->CR |= FLASH_CR_STRT; in erase_sector()
179 tmp = regs->CR; in erase_sector()
182 regs->CR &= ~(FLASH_CR_SER | FLASH_CR_SNB); in erase_sector()
237 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in flash_stm32_option_bytes_write() local
240 if (regs->OPTCR & FLASH_OPTCR_OPTLOCK) { in flash_stm32_option_bytes_write()
244 if ((regs->OPTCR & mask) == value) { in flash_stm32_option_bytes_write()
253 regs->OPTCR = (regs->OPTCR & ~mask) | value; in flash_stm32_option_bytes_write()
254 regs->OPTCR |= FLASH_OPTCR_OPTSTRT; in flash_stm32_option_bytes_write()
269 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in flash_stm32_option_bytes_read() local
271 return regs->OPTCR; in flash_stm32_option_bytes_read()
296 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in flash_stm32_get_wp_sectors() local
299 (~regs->OPTCR & FLASH_OPTCR_nWRP_Msk) >> FLASH_OPTCR_nWRP_Pos; in flash_stm32_get_wp_sectors()
308 FLASH_TypeDef *regs = FLASH_STM32_REGS(dev); in flash_stm32_get_rdp_level() local
310 return (regs->OPTCR & FLASH_OPTCR_RDP_Msk) >> FLASH_OPTCR_RDP_Pos; in flash_stm32_get_rdp_level()