x1000: add setup_chip hook for NAND chips

Add a chip setup hook for configuring vendor specific registers
after the chip is identified.

Change-Id: Ifffa7f01be16fd147a9db3d6e402b7b0debd7e12
This commit is contained in:
Aidan MacDonald 2022-06-07 19:28:07 +01:00
parent ad8ace53e5
commit df29c7991a
2 changed files with 9 additions and 0 deletions

View file

@ -156,6 +156,10 @@ static void setup_chip_registers(struct nand_drv* drv)
/* Clear write protection bits */
nand_set_reg(drv, FREG_PROT, FREG_PROT_UNLOCK);
/* Call any chip-specific hooks */
if(drv->chip->setup_chip)
drv->chip->setup_chip(drv);
}
int nand_open(struct nand_drv* drv)

View file

@ -95,6 +95,8 @@
typedef uint32_t nand_block_t;
typedef uint32_t nand_page_t;
struct nand_drv;
struct nand_chip {
/* Manufacturer and device ID bytes */
uint8_t mf_id;
@ -126,6 +128,9 @@ struct nand_chip {
/* Chip specific flags */
uint32_t flags;
/* Chip-specific setup routine */
void(*setup_chip)(struct nand_drv* drv);
};
struct nand_drv {