-
Notifications
You must be signed in to change notification settings - Fork 7.6k
driver: flash: Add Set/ Get write protect function #90150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -427,20 +427,44 @@ static int flash_read_sr2(const struct device *dev, uint8_t *val) | |||
} | |||
#endif | |||
|
|||
#ifdef CONFIG_FLASH_EX_OP_ENABLED | |||
#define SPIC_BASE 0x40010200ul |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This base address is already captured by the driver config structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
#define SPIC_BASE 0x40010200ul | ||
static int flash_set_wp(const struct device *dev, uint8_t *val, uint8_t cnt) | ||
{ | ||
volatile uint32_t *reg = (volatile uint32_t *)(SPIC_BASE + 0x110u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to define register 0x110 in the struct reg_spic_reg
structure.
volatile uint32_t *reg = (volatile uint32_t *)(SPIC_BASE + 0x110u); | |
const struct flash_rts5912_dev_config *config = dev->config; | |
volatile struct reg_spic_reg *spic_reg = config->regs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
static int flash_get_wp(const struct device *dev, uint8_t *val) | ||
{ | ||
volatile uint32_t *reg = (volatile uint32_t *)(SPIC_BASE + 0x110u); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here - use struct reg_spic_reg
to access the register at offset 0x110.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
7209bcd
to
f1affb5
Compare
@@ -427,20 +427,44 @@ static int flash_read_sr2(const struct device *dev, uint8_t *val) | |||
} | |||
#endif | |||
|
|||
#ifdef CONFIG_FLASH_EX_OP_ENABLED | |||
static int flash_set_wp(const struct device *dev, uint8_t *val, uint8_t cnt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cnt
parameter is not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Add Set_WP function to set SPI flash WP line to low Add Get_WP function to obtain status of the SPI flash WP line Signed-off-by: Benson Huang <[email protected]>
|
Add Set_WP function to set SPI flash WP line to low
Add Get_WP function to obtain status of the SPI flash WP line